fix: honor REPO_MAP runtime env var in addition to compile-time flag

Addresses review feedback from @Vasanthdev2004: the docs advertised
REPO_MAP=1 openclaude as the enablement path, but the gate in
getRepoMapContext only checked feature('REPO_MAP'), which is compile-time
and hardcoded to false in the open build. The env var was effectively
a no-op.

Now getRepoMapContext enables auto-injection when EITHER the compile-time
flag is true OR the runtime env var REPO_MAP is truthy. This makes the
documented enablement path actually work without requiring users to edit
scripts/build.ts and rebuild.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
gnanam1990
2026-04-10 08:34:46 +05:30
parent a36639034b
commit 8c8ec7ca94

View File

@@ -113,7 +113,10 @@ export const getGitStatus = memoize(async (): Promise<string | null> => {
export const getRepoMapContext = memoize(
async (): Promise<string | null> => {
if (!feature('REPO_MAP')) return null
// Enable via compile-time feature flag OR runtime env var.
// The runtime env var lets users enable auto-injection without rebuilding.
const runtimeEnabled = isEnvTruthy(process.env.REPO_MAP)
if (!feature('REPO_MAP') && !runtimeEnabled) return null
if (isBareMode()) return null
if (isEnvTruthy(process.env.CLAUDE_CODE_REMOTE)) return null