/ src / utils / gitSettings.ts
gitSettings.ts
 1  // Git-related behaviors that depend on user settings.
 2  //
 3  // This lives outside git.ts because git.ts is in the vscode extension's
 4  // dep graph and must stay free of settings.ts, which transitively pulls
 5  // @opentelemetry/api + undici (forbidden in vscode). It's also a cycle:
 6  // settings.ts → git/gitignore.ts → git.ts, so git.ts → settings.ts loops.
 7  //
 8  // If you're tempted to add `import settings` to git.ts — don't. Put it here.
 9  
10  import { isEnvDefinedFalsy, isEnvTruthy } from './envUtils.js'
11  import { getInitialSettings } from './settings/settings.js'
12  
13  export function shouldIncludeGitInstructions(): boolean {
14    const envVal = process.env.CLAUDE_CODE_DISABLE_GIT_INSTRUCTIONS
15    if (isEnvTruthy(envVal)) return false
16    if (isEnvDefinedFalsy(envVal)) return true
17    return getInitialSettings().includeGitInstructions ?? true
18  }