gitSettings.ts 838 B

123456789101112131415161718
  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. import { isEnvDefinedFalsy, isEnvTruthy } from './envUtils.js'
  10. import { getInitialSettings } from './settings/settings.js'
  11. export function shouldIncludeGitInstructions(): boolean {
  12. const envVal = process.env.CLAUDE_CODE_DISABLE_GIT_INSTRUCTIONS
  13. if (isEnvTruthy(envVal)) return false
  14. if (isEnvDefinedFalsy(envVal)) return true
  15. return getInitialSettings().includeGitInstructions ?? true
  16. }