fix: tighten project instruction path handling
This commit is contained in:
26
packages/util/paths/src/index.ts
Normal file
26
packages/util/paths/src/index.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* Shared filesystem path helpers for DeepSeek Harness user data.
|
||||
*
|
||||
* @module @deepseek-ai/dsh-paths
|
||||
*/
|
||||
|
||||
import { homedir } from 'node:os'
|
||||
import { join } from 'node:path'
|
||||
|
||||
/** Directory name for the default DeepSeek Harness home under the OS home. */
|
||||
export const DSH_HOME_DIR_NAME = '.dsh'
|
||||
|
||||
/** Stable user-facing display form for the default DeepSeek Harness home. */
|
||||
export const DEFAULT_DSH_HOME_DISPLAY = `~/${DSH_HOME_DIR_NAME}`
|
||||
|
||||
/** Resolve the default DeepSeek Harness home using Node's platform path rules. */
|
||||
export function defaultDshHome(): string {
|
||||
return join(homedir(), DSH_HOME_DIR_NAME)
|
||||
}
|
||||
|
||||
/** Expand `~`, `~/...`, and Windows-style `~\...` prefixes against the OS home. */
|
||||
export function expandHomePath(path: string): string {
|
||||
if (path === '~') return homedir()
|
||||
if (path.startsWith('~/') || path.startsWith('~\\')) return join(homedir(), path.slice(2))
|
||||
return path
|
||||
}
|
||||
Reference in New Issue
Block a user