MCPcopy Index your code
hub / github.com/codeaashu/claude-code / computeEnvInfo

Function computeEnvInfo

src/constants/prompts.ts:606–649  ·  view source on GitHub ↗
(
  modelId: string,
  additionalWorkingDirectories?: string[],
)

Source from the content-addressed store, hash-verified

604}
605
606export async function computeEnvInfo(
607 modelId: string,
608 additionalWorkingDirectories?: string[],
609): Promise<string> {
610 const [isGit, unameSR] = await Promise.all([getIsGit(), getUnameSR()])
611
612 // Undercover: keep ALL model names/IDs out of the system prompt so nothing
613 // internal can leak into public commits/PRs. This includes the public
614 // FRONTIER_MODEL_* constants — if those ever point at an unannounced model,
615 // we don't want them in context. Go fully dark.
616 //
617 // DCE: `process.env.USER_TYPE === 'ant'` is build-time --define. It MUST be
618 // inlined at each callsite (not hoisted to a const) so the bundler can
619 // constant-fold it to `false` in external builds and eliminate the branch.
620 let modelDescription = ''
621 if (process.env.USER_TYPE === 'ant' && isUndercover()) {
622 // suppress
623 } else {
624 const marketingName = getMarketingNameForModel(modelId)
625 modelDescription = marketingName
626 ? `You are powered by the model named ${marketingName}. The exact model ID is ${modelId}.`
627 : `You are powered by the model ${modelId}.`
628 }
629
630 const additionalDirsInfo =
631 additionalWorkingDirectories && additionalWorkingDirectories.length > 0
632 ? `Additional working directories: ${additionalWorkingDirectories.join(', ')}\n`
633 : ''
634
635 const cutoff = getKnowledgeCutoff(modelId)
636 const knowledgeCutoffMessage = cutoff
637 ? `\n\nAssistant knowledge cutoff is ${cutoff}.`
638 : ''
639
640 return `Here is useful information about the environment you are running in:
641<env>
642Working directory: ${getCwd()}
643Is directory a git repo: ${isGit ? 'Yes' : 'No'}
644${additionalDirsInfo}Platform: ${env.platform}
645${getShellInfoLine()}
646OS Version: ${unameSR}
647</env>
648${modelDescription}${knowledgeCutoffMessage}`
649}
650
651export async function computeSimpleEnvInfo(
652 modelId: string,

Callers 1

Calls 6

getUnameSRFunction · 0.85
isUndercoverFunction · 0.85
getMarketingNameForModelFunction · 0.85
getKnowledgeCutoffFunction · 0.85
getCwdFunction · 0.85
getShellInfoLineFunction · 0.85

Tested by

no test coverage detected