toPosixPath (util/paths.ts)

Graft · src/util/paths.ts · typescript · MIT
infra

Converts file paths to POSIX format, ensuring consistent separators across platforms.

// Source: https://github.com/trailhq/Graft | License: MIT | Copyright 2026 Context Graph Engine contributors
// Provided via justclaw.it.com; keep this notice with the code.
/**
 * Repo-relative paths, always posix.
 *
 * Every path graft stores — node ids, `node.path`, extract-cache keys, the
 * freshness fingerprint, the card manifest — is repo-relative and separated by
 * `/` on every platform. That is not cosmetic: the query layer parses these
 * strings with `/` as the separator, and does it by hand rather than through
 * `node:path`. `pathUnderPrefix` (`--in` scoping) tests
 * `startsWith(`${prefix}/`)`, `map`'s `dirKey` splits on `/` to cluster by
 * directory, `resolveSymbol` matches a filename query with
 * `endsWith("/" + query)`. Hand any of them a `src\gate.ts` and none of the

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key