index.ts 795 B

1234567891011121314151617181920212223
  1. /**
  2. * Canonical DeepSeek Harness home-directory resolution.
  3. *
  4. * @module @deepseek-ai/dsh-home
  5. */
  6. import { homedir } from 'node:os'
  7. import { join, resolve } from 'node:path'
  8. const DEFAULT_DSH_HOME_DIRNAME = '.dsh'
  9. /** Environment variable that overrides the default Harness home directory. */
  10. export const DSH_HOME_ENV = 'DSH_HOME' as const
  11. /**
  12. * Resolve the DeepSeek Harness home directory without caching or mutating the environment.
  13. *
  14. * @param configured - Optional configured path, which takes precedence over the environment.
  15. * @returns The absolute configured path, `$DSH_HOME`, or `~/.dsh`, in that order.
  16. */
  17. export function resolveDshHome(configured?: string): string {
  18. return resolve(configured ?? process.env[DSH_HOME_ENV] ?? join(homedir(), DEFAULT_DSH_HOME_DIRNAME))
  19. }