Skip to content

Impact & Analysis

NestWeaver’s analysis commands help you understand the consequences of changes before you make them. The impact command traces the blast radius of a symbol through the dependency graph with confidence-weighted scoring, while pr-impact analyzes an entire PR’s changed files and assigns a risk level. These are structural analyses based on the graph — no LLM required.

Impact walks back from a symbol to its callers checkout refund processPayment the symbol
checkout and refund call processPayment, so they sit in its blast radius. The walk follows incoming calls, imports, and inheritance.
CommandDescriptionKey Flags
impactTrace blast radius of a symbol--depth, --confidence, --min-score, --limit, --repo, --json
pr-impactPR blast radius with risk scoring--files, --base, --repo, --depth, --strict, --sarif, --json
affected-testsSelect tests for changed files--files, --base-ref, --repo, --json
dead-codeReview unreachable symbols--min-confidence, --repo, --limit, --offset, --generation, --page-token, --json
hubsFind most-connected hub nodes--top, --repo, --json, --config
bridgesFind architectural chokepoints--top, --repo, --json, --config
contractsInspect API contract graphlist, drift, diff subcommands
rankingInspect ranking priorsexplain, rank subcommands
evalOffline retrieval-quality evaluationrun, compare subcommands
exportExport graph to external format--format, --scope, --output, --top
clustersDetect community clusters--resolution, --repo, --limit, --members, --json
Terminal window
# Check what depends on a symbol
nestweaver impact "processPayment" --depth 5
# Filter to a specific repo in a multi-repo setup
nestweaver impact "processPayment" --repo payments-api --json
# Set minimum edge confidence threshold
nestweaver impact "processPayment" --confidence 0.8

impact traverses incoming CALLS, IMPORTS, EXTENDS, and IMPLEMENTS edges from the target symbol. Each affected symbol gets an impact_score that decays multiplicatively through edges — low-confidence paths are pruned automatically, and the pruning is disclosed (--min-score 0 opts out). The default depth is 3 (range 1–15) and the default --limit is 50 (range 1–1000).

Name a symbol by UID, by name, or qualified as path::name, Class::method or path::Class::method. path::<module> names a file’s top-level code. A miss exits 2 with a Did you mean: line; an ambiguous name exits 3 and lists candidates with their file paths. A --repo that names no indexed repo exits 2 and an ambiguous one exits 3. An empty or malformed --repo is not handled the same way everywhere yet: --repo '' exits 64 on hubs, dead-code, affected-tests and clusters but is ignored by impact, flow-trace and pr-impact, which then match every repo, and a malformed selector such as repo::: names no repo and exits 2. A selector over 512 bytes exits 64. Pass a repo name, root path or UID from nestweaver list-repos.

Terminal window
# Auto-detect changed files from git diff
nestweaver pr-impact
# Specify files explicitly, in a named repo
nestweaver pr-impact --files src/auth.rs,src/db.rs --repo payments-api
# Diff against a base ref (a merge-base SHA gives the PR's own changes)
nestweaver pr-impact --base "$(git merge-base origin/main HEAD)"
# Gate CI on contract-verified breaking changes, or emit SARIF
nestweaver pr-impact --base origin/main --strict
nestweaver pr-impact --base origin/main --sarif > nestweaver.sarif

pr-impact maps changed files to their symbols, runs transitive impact analysis, groups results by cluster, and assigns Low, Medium, High, or Unknown. Unknown means the change was not assessed. When neither --files nor --base is given, it uses git diff --name-only against the working tree.

pr-impact reviews one repo: the indexed repo checked out at the working directory’s git root, or the one --repo <name or UID> names. Repo-relative --files paths resolve in that repo only. --strict exits 2 on a contract-verified breaking change; what it blocks on is set by [pr_impact] in the instance config. A degraded or incomplete run never blocks.

Terminal window
# Select tests affected by specific file changes
nestweaver affected-tests --files src/auth.rs,src/db.rs
# Name the repo when the database holds more than one
nestweaver affected-tests --files src/auth.rs --repo my-service
# Diff against a base branch
nestweaver affected-tests --base-ref main --json

Pass --files or --base-ref, not both. The selection covers one repository. With --base-ref, that is the indexed repo checked out at the working directory’s git root. With --files, it is the only indexed repo; when the database holds more than one, --repo is required and the command exits 64 without it. Repo-relative paths resolve in that repo only, and --json names the repo. --base-ref runs git diff --name-only <ref>, which compares the ref with your working tree: it includes uncommitted edits and is not the merge-base diff, so pass a merge-base SHA when that is what you want.

affected-tests performs static, call-graph-based regression test selection. It maps changed files to symbols, reverse-traverses CALLS/IMPORTS to depth 3, and buckets dependent test files into priority tiers. This is a prioritized signal, not a provably safe subset — it misses reflection, DI, codegen, and data-driven tests.

Terminal window
# Review unreachable symbols
nestweaver dead-code
# Only high-confidence candidates in one repo
nestweaver dead-code --min-confidence high --repo my-service --json

dead-code walks forward from every entry point (and every file’s top-level <module> code) following CALLS, IMPORTS, EXTENDS, IMPLEMENTS, and MEMBER_OF edges. Symbols the walk does not reach are review candidates, not a deletion list: a reference the parser does not capture looks the same as no reference. Every confidence tier (low, medium, high) is a candidate to check by hand. Entry points come from manifest files, language-specific rules and visibility modifiers.

On a graph built by an older resolver generation, dead-code refuses and exits 2 with the nestweaver index --repo <path> --force commands to run, because a missing edge would move live code onto the list. coverage: "degraded" means the walk had no roots or could not read its inputs. --limit is 1–1000 (default 50); page with --offset, or with --page-token and --generation from the previous page.

Terminal window
# Find hub nodes (ranked by total degree: incoming plus outgoing)
nestweaver hubs --top 20
# Find bridge/chokepoint nodes (highest betweenness centrality)
nestweaver bridges --top 20
# Detect community clusters (Louvain-style local moving)
nestweaver clusters --resolution 0.5 --json

Hubs are central abstractions many parts of the codebase depend on. Bridges are architectural chokepoints — many shortest paths pass through them, so changing a bridge has outsized blast radius. Clusters use Louvain-style local moving, not the full Leiden algorithm. Results are cached in a sidecar file. Hubs are ranked by total degree. PageRank is extra metadata, not the sort key.

Terminal window
# Export as Cypher (Neo4j)
nestweaver export --format cypher
# Export as GraphML (Gephi/yEd)
nestweaver export --format graphml --output graph.xml
# Export as Mermaid flowchart (top 30 symbols by PageRank)
nestweaver export --format mermaid --top 30
# Export as MessagePack (for WASM mode)
nestweaver export --format msgpack --output graph.msgpack

Supported formats: Cypher (Neo4j), GraphML (Gephi/yEd), Mermaid, MessagePack. --scope picks all (default), code or vault; cypher, mermaid and msgpack are code-only. An invalid --format or --scope value exits 64, while a valid but unsupported combination (such as --format cypher --scope vault) exits 1.

Terminal window
nestweaver contracts diff --base openapi-v1.yaml --head openapi-v2.yaml --fail-on-breaking

contracts diff compares two OpenAPI spec files at the endpoint, request/response field and type level, including request parameters and response statuses, and classifies each change as BREAKING or INFO. --fail-on-breaking exits non-zero on any BREAKING change, so a breaking parameter or status change now fails it too.