@ai-coach/util-path
Paths without Node. Pure posix path helpers for code that may not import node:path, such as a domain or application library. You change this package only if a library needs a path helper it doesn't have yet.
What it does not do
- No file system access. It only works on path strings; nothing here touches the disk.
- No Windows paths. Vault and note paths are always
/-separated, so onlyposixbehaviour is offered. - No dependencies. It imports nothing, so any scope can use it without pulling anything in.
Architecture fit
- Scope:
scope:shared - Style:
type:util - Depends on: nothing
- Used by:
@ai-coach/vault-domain,@ai-coach/vault-application
[vault-domain / vault-application] ──▶ [@ai-coach/util-path]
Internal architecture & rules
- One object,
posix, insrc/lib/posix.ts, withjoin,dirname,basename,extname,normalize,relative,resolveandisAbsolute. - Same results as
node:path. Every helper behaves exactly likenode:path'sposixfunction of the same name, edge cases included. The specs pin that. - No comments in source code (DEC-AIC-0011).
Public surface
posix— the path helpers:
import { posix } from '@ai-coach/util-path';
posix.join('3.Resources', 'Book', 'Idea.md');
// → '3.Resources/Book/Idea.md'
posix.basename('3.Resources/Book/Idea.md', '.md');
// → 'Idea'
How to extend it
- Add the helper to
posixinsrc/lib/posix.ts, matchingnode:path'sposixbehaviour. - Add spec cases in
src/lib/posix.spec.tsthat compare it withnode:pathfor normal and edge inputs. - Run
npm exec nx test @ai-coach/util-pathandnpm exec nx lint @ai-coach/util-path.
Running & testing
npm exec nx test @ai-coach/util-path
npm exec nx lint @ai-coach/util-path
npm exec nx typecheck @ai-coach/util-path
npm exec nx build @ai-coach/util-path
The specs run with Vitest and compare each helper with node:path itself.
Key ADRs
- DEC-AIC-0052 — moves the posix helpers into this pure shared util so the vault domain and application need no Node.
- DEC-AIC-0051 — defines the
scope:sharedandtype:utiltags and what may import them.