A line in an architecture diagram reads like a fact. If a tool draws that line from a naming convention or a guess, the graph can be more misleading than a stale hand-drawn diagram. In CARTOGRAPH, I want every relationship to have a traceable reason to exist—and every unsupported relationship to remain visible as a gap.

That leads to a very specific pipeline: load a bounded TypeScript project, resolve supported constructs, emit a canonical graph with evidence, then compare two graph snapshots. Each stage has a contract; none promises a complete map of runtime behavior.

CARTOGRAPH analysis and uncertainty path TypeScript source and configuration flow through compiler-backed analysis into a canonical graph and semantic diff. Literal routes produce evidence-backed edges, while dynamic routes produce diagnostics. .ts + tsconfigbounded project compiler analysisimports · calls · routes canonical graphedges + evidence revision diffJSON · Markdown · HTML app.get("/users", loadUsers)endpoint + evidenced handler edge app.get(routePath, loadUsers)UNSUPPORTED_DYNAMIC_ROUTE
Resolution produces either an evidence-backed relationship or an explicit diagnostic.

Resolve the project before drawing edges

The analyzer does more than walk files and match identifier text. It reads TypeScript configuration without executing it, follows supported in-repository extends chains and project references, and applies the owning project’s compiler options. For Node16 and NodeNext resolution, it passes the file’s implied ESM or CommonJS mode to TypeScript’s module resolver. That matters when exports or imports maps expose different targets for import, require, node, and types conditions.

The TypeScript analyzer then materializes a ts-morph project and extracts modules, callables, imports, calls, and supported framework boundaries. Local calls become edges only when the analyzer can resolve the target under its current semantic rules. Files are processed in canonical order, and graph nodes, edges, and diagnostics are sorted before the snapshot is returned. Identical input should therefore serialize to identical graph JSON.

The documented local flow is intentionally ordinary:

node dist/cli.js scan /path/to/typescript-project \
  --output .cartograph/current.graph.json

The result is a versioned snapshot, not a rendered picture scraped from a running service. It contains typed nodes, typed edges, diagnostics, revision metadata, and the analyzer capability-registry version. The checked-in GraphSnapshot schema defines that interchange boundary.

Evidence travels with each edge

Consider these Express calls:

app.get("/users", loadUsers);
app.get(routePath, loadUsers);

The first path is a literal. In the supported Express slice, CARTOGRAPH can emit an endpoint and a relationship to the local loadUsers callable. The second path depends on a runtime value. The analyzer emits an UNSUPPORTED_DYNAMIC_ROUTE diagnostic instead of inventing an endpoint from the variable’s name.

For a source-backed relationship, evidence records a repository-relative path, source span, versioned detector identity, and content hash. The graph retains no absolute path, source excerpt, or source body. Confidence is categorical: it distinguishes direct semantic evidence from bounded inference; it is not a probability that the edge is true. A relationship without evidence must carry an explicit unresolved reason. These requirements are enforced during canonicalization, so malformed or conflicting graph records fail validation rather than making it into a report.

This gives a reviewer something better than a polished line: the path and span to inspect, the detector that emitted it, and a hash tying the evidence to the analyzed file contents. For an unsupported route, the diagnostic points to the source location and names the construct that stopped resolution. Both are useful results, but they are not interchangeable.

The analyzer’s Express adapter makes the route boundary concrete. It handles literal string and no-substitution template paths, selected app/router receivers, route chains, and bounded use middleware. Dynamic mount paths stay diagnostic. The support matrix lists other implemented slices, including imports, resolvable calls, API schema boundaries, Prisma models, lockfiles, queues, and outbound HTTP destinations; each has its own limits.

A diff compares graph identities

File diffs answer “which text changed?” A graph diff asks which modeled components or relationships changed because of the two source states. CARTOGRAPH compares nodes by stableKey, edges by (from, to, kind), and diagnostics by stable ID. If a node or edge keeps its identity but its fields change, the diff keeps before-and-after records and lists the fields that differ. An edge can be classified as evidence-only, confidence-changed, or otherwise changed.

Endpoint rewires need special care. If a route keeps its identity but now points to another handler, a plain set difference looks like one edge was removed and another added. The diff engine can pair them as endpoint-rewired only when the match is unambiguous: shared evidence is the strongest signal; otherwise, matching edge kind plus one unchanged endpoint is considered, and the best pairing must be unique in both directions. Ambiguous candidates remain in the added and removed sets. Consumers that only understand ordinary set differences can still read those original sets.

Node identity across refactors is harder than edge identity. The exact stable key is the first signal. For changed keys, the matcher considers compatible node kinds plus signals such as the same name, supplied Git path history, language, and neighboring graph structure. A unique mutual best match can be retained as a lower-confidence identity. Ties, competing candidates, and weak matches become ambiguity or unsupported-rename diagnostics; the matcher does not choose the “closest-looking” node to make a report tidy. The identity implementation also applies a candidate-search ceiling so a large graph cannot trigger unbounded pairwise comparison.

The two-revision command can make comparison semantics explicit:

node dist/cli.js diff /path/to/repository \
  --base origin/main --head HEAD --comparison merge-base \
  --format html --output .cartograph/architecture-diff.html

merge-base is intended for pull-request comparisons and requires full, non-shallow history with a unique merge base. Use direct when the two chosen trees themselves are the comparison. Both sides are analyzed locally; the report can render as JSON, Markdown, or self-contained HTML. The diff contract records which comparison was made and preserves the evidence and diagnostics behind each change.

Unknown is part of the output

CARTOGRAPH analyzes supported TypeScript constructs. It does not run the repository, import its modules, execute package scripts, contact a network, or observe live traffic. JavaScript, generated routes, framework metaprogramming, reflection, ambiguous calls, and dynamic destinations can exceed the current analyzer model. Some produce diagnostics; none should be silently upgraded to a verified edge. The quickstart and support matrix spell out that boundary.

This matters especially when reading an empty region of a graph. It might mean a relationship is absent. It might also mean the relevant construct is unsupported or unresolved. Diagnostics preserve the difference, and the report should be read with them in view. CARTOGRAPH is pre-alpha, so neither the current language slice nor the refactor matcher is a claim of universal coverage.

An architecture graph is useful when it lets someone verify a claim and find the places where verification stopped. A source-backed edge, an explicit unresolved reason, and a stable ambiguity record carry more engineering value than a complete-looking diagram that has no account of how it got there.