core.py
core.py — the per-invocation Context: root + config + graph adapter.
Overview
core.py — the per-invocation Context: root + config + graph adapter.
A documate command runs against one repo (or one sub-tree of a monorepo). The CLI resolves the root, loads its config, wires the graph adapter, and hands this Context to every command. No import-time globals — the same process can point at different roots, and nothing is hard-bound to one checkout.
depends on src/documate/config.py, src/documate/graphdb.py · used by src/documate/anchors.py, src/documate/briefs.py, src/documate/check.py, src/documate/cli.py, src/documate/docs.py, src/documate/drift.py, src/documate/prose.py, src/documate/resolve.py, src/documate/rewrap.py, src/documate/site.py, src/documate/stats.py, src/documate/undo.py
API
Fresolve_root(root: str | Path | None=None) -> Path
Explicit path wins; else the git toplevel of cwd; else cwd (non-git trees).
Context.makeCclass Context
Per-invocation bundle: resolved root, loaded Config, wired graph adapter. No import-time globals.
FContext.make(cls, root: str | Path | None=None) -> 'Context'
Resolve the root, load its config, and wire a GraphDB into a ready Context.
resolve_rootFContext.rel(self, abspath: str) -> str
Strip the absolute root off a graph path (file or <abspath>::scope),
returning a repo-relative POSIX path. Idempotent on already-relative input.