fix: tighten project instruction path handling

This commit is contained in:
Yichen Jiang
2026-06-29 21:42:23 +08:00
parent 234ffe4604
commit 21ae734839
20 changed files with 247 additions and 30 deletions

View File

@@ -0,0 +1,25 @@
import { homedir } from 'node:os'
import { join } from 'node:path'
import { describe, expect, it } from 'vitest'
import {
DEFAULT_DSH_HOME_DISPLAY,
DSH_HOME_DIR_NAME,
defaultDshHome,
expandHomePath,
} from '@deepseek-ai/dsh-paths'
describe('dsh path helpers', () => {
it('owns the shared default DSH home directory name', () => {
expect(DSH_HOME_DIR_NAME).toBe('.dsh')
expect(DEFAULT_DSH_HOME_DISPLAY).toBe('~/.dsh')
expect(defaultDshHome()).toBe(join(homedir(), '.dsh'))
})
it('expands tilde paths without changing non-tilde paths', () => {
expect(expandHomePath('~')).toBe(homedir())
expect(expandHomePath('~/.dsh')).toBe(join(homedir(), '.dsh'))
expect(expandHomePath('~\\.dsh')).toBe(join(homedir(), '.dsh'))
expect(expandHomePath('/tmp/.dsh')).toBe('/tmp/.dsh')
expect(expandHomePath('~other/.dsh')).toBe('~other/.dsh')
})
})