Manifest graph walking
State: open/verified · Kind: module · Audience: system
Summary
Section titled “Summary”- Walks a directory tree of
package.json/Cargo.tomlmanifests into a typed dependency graph plus a derived containment tree. - TypeScript peer of the
manifest-graphRust crate; both are held to one shared fixture tree and must agree byte-for-byte on the flattened output.
Statement
Section titled “Statement”Given a project root, the library discovers and parses every package.json and Cargo.toml into a
typed ManifestInfo, builds the dependency graph the manifests declare (graph.edges, a mesh), and
separately derives the containment tree the directory layout implies (GraphNode.parent): one
synthetic repo root, group nodes for directories that hold manifests but declare none,
single-child groups collapsed away, externals held outside the tree. Malformed manifests degrade to
an error-carrying entry rather than aborting the walk. buildSystemGraph runs all three passes and
flattens the result into the snake_case SystemGraph wire payload the system-graph viewer and its
CLI dump read.
What it provides
Section titled “What it provides”- walkManifests — recursive, error-tolerant discovery/parsing of manifests into ManifestInfo
- buildDependencyGraph — typed dependency graph from declared deps, with optional external-package inclusion
- applyContainment — the containment tree (repo root + collapsed group nodes) as a separate structure from the dependency mesh
- buildSystemGraph — flattens all three passes into the SystemGraph wire payload
- CLI (
bin/manifest-graph, src/cli.ts) to dump the payload as JSON, used to regenerate the system-graph lab’s fixtures
Underlying implementation
Section titled “Underlying implementation”- packages/ts/manifest-graph/src/walk.ts, graph.ts, containment.ts, system-graph.ts, aspects.ts
- peer implementation: solutions/ontological/crates/manifest-graph (Rust), which is what SDF’s system-graph service actually calls
Locations
Section titled “Locations”packages/ts/manifest-graph/src/