/** * Path helpers — the one implementation of each, CLI-wide. * * Two rules live here, promoted from private copies by two different instances, * for the same reason: a second copy of a path rule is how one rule quietly * becomes two subtly different rules. * * **`isWithin`** — lexical containment. Promoted from * `cost/providers/claude-code.ts` by project-constitution (design D4): the * constitution importer needs the same bounds check the cost providers already * perform, and a second copy of a security-relevant predicate is how an absent * mechanism reproduces independently. `claude-code.ts` re-exports this symbol, so * every existing importer is untouched. * * **`toPosixRelative`** — rendering a path for anything that leaves this machine. * Promoted from `compile/loaders.ts` by compliance-packs: generated skill bodies * and the compliance evidence report are both committed or handed to another * person, and neither may contain an absolute path. A path under `/Users//` * is meaningless elsewhere and, in a compliance report, leaks who ran the tool and * from where. * * Both are purely lexical on purpose. Callers that also care about symlink escape * check the resolved real path against a resolved real root — two `isWithin` calls, * not a smarter one. And `toPosixRelative` is deliberately not secret redaction: * `operational/redact.ts` exists for that, its own header says it is best-effort * rather than a guarantee, and its `looksLikeSecret` returns false for any token * containing a slash — so it cannot classify a filesystem path at all. Paths are * handled by construction here; redaction is defence in depth elsewhere. * * Requirements: project-constitution design D4; compliance-packs/AC-33, AC-107, * and guidance-layers-never-resolve/AC-8 which the rendering behaviour first served. * * @module */ /** * Can `name` be used as exactly one path segment — an instance, phase or file name — * without leaving the directory it is joined onto? Rejects empty, absolute, any * separator, and any `..`. The one definition: `change/reopen.ts` enforced it first * (AC-82), state writes now do too (security-review-findings/AC-8). */ export declare function isSafeSegment(name: string): boolean; /** Is `p` the directory `root` or something beneath it? Purely lexical. */ export declare function isWithin(root: string, p: string): boolean; /** * Express `filePath` relative to `projectRoot` using forward slashes. * * Falls back to the basename when the target lies outside the project, so the * result is never an absolute path and never escapes upward with `..` — either * would defeat the point. * * @param projectRoot - Absolute project root. * @param filePath - Absolute or relative path to render. */ export declare function toPosixRelative(projectRoot: string, filePath: string): string; //# sourceMappingURL=paths.d.ts.map