Expand description
The two path forms (spec/surface §1 “Paths”, 2.0). The store keeps a
document’s path in git’s repo-relative form (projects/oqx.md: docs.path,
the adapters, every store/sync spec), while every reference an author
writes — a Markdown link, a wikilink, a frontmatter relation — is
root-absolute (/projects/oqx.md). The surface speaks the reference form:
every path a query, a tool or a CLI verb RETURNS is /-rooted, and every
path they ACCEPT tolerates both forms. These two functions are the whole
conversion; the store never sees a rooted path and the surface never hands
out a bare one. Port of packages/core/src/core/paths.ts.
Functions§
- reference_
json reference_pathover a JSON string value; anything else passes through.- reference_
keyed - Re-key a
{ <path>: … }object (the dry-rundiffs) by the reference form, positions kept. - reference_
path - The reference (surface) form of a storage path: exactly one leading
/.""(the repo root,docs_tree’s prefix) becomes/. - root_
field - Root the string under
keyof a JSON object in place (a non-string or absent value is left alone). - storage_
path - The storage form of a path a caller handed in: every leading
/stripped (a missing slash is fine, an extra one is forgiven).