Skip to main content

Module path_utils

Module path_utils 

Source
Expand description

Path expansion, cwd resolution, and macOS path-variant fallback for tool file arguments.

Ports .references/pi/packages/coding-agent/src/core/tools/path-utils.ts together with the normalizePath / resolvePath helpers from .references/pi/packages/coding-agent/src/utils/paths.ts. Inputs are normalized with Unicode-space folding and an optional @ strip, ~ and file:// expansion, then resolved against a cwd. When the resolved path does not exist, the read resolvers try the macOS variants in order: narrow no-break space before AM/PM, NFD normalization, curly apostrophe, and NFD + curly apostrophe combined.

Enums§

PathResolveError
Errors produced while expanding or resolving tool paths.

Functions§

expand_path
Expand a user-supplied path without resolving it against a cwd (TypeScript expandPath): Unicode-space folding, @ strip, ~ expansion, and file:// conversion.
path_exists
Async existence check (TypeScript pathExists).
resolve_read_path
Resolve a read path, falling back through the macOS variants when the plainly resolved path does not exist (TypeScript resolveReadPath). Returns the plainly resolved path when no variant exists either.
resolve_read_path_async
Async form of resolve_read_path (TypeScript resolveReadPathAsync).
resolve_to_cwd
Resolve a path relative to cwd (TypeScript resolveToCwd). The input gets Unicode-space folding, @ strip, ~ expansion, and file:// conversion; the cwd is itself ~-expanded but not space-folded, matching resolvePath(filePath, cwd, { normalizeUnicodeSpaces: true, stripAtPrefix: true }).