A Rust dependency and impact analysis tool built on a fast, memory-mapped CSR (compressed sparse row) graph engine.
Strand answers the question "what breaks if I change X?" in a second or
two, even on graphs with tens of millions of edges, with no server and
no query language. strand deep goes further: offline interprocedural
analysis (taint, null, resource-leak findings) for Python, JS/TS, Go,
and Rust source trees.
$ strand build deps.csv -o deps.strand
$ strand impact deps.strand serde_json
impact of [serde_json]: 20 affected (6 direct, 14 transitive)
$ strand why deps.strand my-app serde_json
my-app -> serde -> serde_jsonExisting tools are either in-memory libraries (petgraph, igraph, NetworkX) or server databases (Neo4j). Strand's niche:
- Fast-open, zero-copy, single-file graphs. A
.strandfile is a memory-mapped CSR with forward and reverse adjacency. Opening is a header parse + validation; traversals read straight from the mapping. - Dependency/impact analysis as a first-class feature: blast radius,
why-paths, cycle detection, risk ranking, build order - all deterministic
and scriptable (
--jsoneverywhere). - Embeddable:
Graph::open("x.strand")from Rust, no server.
strand-store is an embeddable read-write graph store -
"SQLite for graphs" - with transactions, snapshots, a write-ahead log,
crash-safe compaction, and the same analysis algorithms running on the
merged view.
crates/
strand-core/ file format, mmap reader, builder, algorithms
strand-deep/ interprocedural analysis engine (IPA + taint/null/leak
solvers for Python, JS/TS, Go, Rust)
strand-import/ importers (cargo metadata JSON, CSV/TSV edge lists)
strand-cli/ the `strand` binary
strand-store/ embeddable read-write store (base + WAL delta)
strand-gui/ desktop GUI (eframe/egui) for browsing + analysis
docs/
FORMAT.md binary format spec (normative, .strand + .strandb)
testdata/ sample graphs used by tests and docs
Tests live in each crate's tests/ directory (see Testing).
Prebuilt binaries - grab the archive for your platform from
Releases and verify it
against SHA256SUMS.txt. Archives cover Windows x86_64, Linux x86_64
(glibc 2.35), macOS arm64, and macOS x86_64 (runs under Rosetta 2 on
Apple Silicon, natively on Intel). Each archive contains strand (CLI)
and strand-gui (desktop GUI).
The binaries are unsigned: Windows SmartScreen ("Windows protected your PC") and macOS Gatekeeper ("cannot be opened because the developer cannot be verified") will warn on first run. That's expected
- right-click → Open (macOS) or More info → Run anyway (Windows), or build from source below.
From crates.io (needs a Rust toolchain, no repo clone):
cargo install strand-cli strand-gui # full Strand: CLI + GUI
cargo install strand-cli # CLI only (`strand`)
cargo install strand-gui # GUI only (`strand-gui`)Re-running any of these installs the latest published version - same command updates an existing install.
From source (needs a Rust toolchain):
cd path/to/Strand
cargo install --path crates/strand-cli # the `strand` CLI
cargo install --path crates/strand-gui # the desktop GUIBoth binaries include a lightweight version check: at most once
per 24h they query crates.io in the background (800ms timeout, silent
when offline) and note it when a newer release exists - stderr for the
CLI, a notice card/top-bar label for the GUI. Disable with
STRAND_NO_UPDATE_CHECK=1.
cargo install puts the binaries in %USERPROFILE%\.cargo\bin
(C:\Users\<you>\.cargo\bin on Windows), which rustup adds to PATH
automatically. For the prebuilt binaries instead, extract the archive
to a folder of your choice (e.g. %LOCALAPPDATA%\Programs\strand) and
add that folder to your user PATH if it isn't picked up.
# From an edge list (src,dst[,weight]; "src depends on dst"):
strand build deps.csv -o deps.strand
# Multiple inputs merge into one graph (names must match across files):
strand build frontend.csv backend.csv meta.json -o all.strand
# From cargo metadata:
cargo metadata --format-version 1 > meta.json
strand build meta.json -o deps.strand
# Or straight from lockfiles/manifests (auto-detected by filename;
# renamed files are content-sniffed. ~30 formats: Cargo.lock,
# package-lock/npm-shrinkwrap, yarn.lock, pnpm-lock.yaml, bun.lock,
# deno.lock, poetry/uv/pdm/conda locks, go.mod/go.sum/go.work.sum,
# pom.xml, Gradle lockfiles + verification metadata,
# composer/Gemfile/Podfile/Carthage locks, NuGet paket/
# packages.lock.json, Swift Package.resolved, pubspec, stack, mix,
# conan, flake, Julia manifest, rebar, renv):
strand build Cargo.lock -o deps.strand # Rust
strand build package-lock.json -o deps.strand # npm
strand build poetry.lock -o deps.strand # Python/poetry
strand build go.mod -o deps.strand # Go
strand build pom.xml -o deps.strand # Maven
# (--format auto|csv|cargo|cargo-lock|npm-lock|poetry-lock|go-mod|
# pom|webpack|esbuild overrides detection)
# Scan a project folder and build a source-level dependency graph
# (skips target/, .git/, node_modules/, and build-output dirs like
# .next/, dist/, out/, coverage/, .turbo/, .firebase/):
strand scan ./my-project -o deps.strand
# Rust (mod/use/#[path]/include!/...crate paths), Python (import/from,
# relative + absolute imports resolved against ancestor dirs so nested
# package roots like repo/pkg/pkg/ work, literal import_module()/
# __import__() calls, and entry points from pyproject.toml/setup.cfg/
# setup.py - variable-referenced dicts included), JS/TS
# (import/export-from/require, index resolution,
# tsconfig/jsconfig paths+extends+baseUrl, package.json "imports"),
# Go (import specs resolved against go.mod modules and package dirs).
# A file argument scans its project root (nearest ancestor manifest).
# Edges static analysis can't see can be declared manually:
# # strand: depends-on pkg/target.py (Python)
# // strand: depends-on src/b.rs (Rust/JS/TS)
# // strand: depends-on util/helper.go (Go)
# Dynamic sites it can't resolve (computed module names, require(expr),
# computed entry_points) are reported as per-file warnings.
# --lang rust|python|js|go restricts to one language; default scans all.
strand scan ./my-project --lang python -o pydeps.strand
# `scan` also picks up dependency manifests and config files
# language-agnostically: requirements*.txt, pyproject.toml, Pipfile,
# setup.cfg/py, package.json, Cargo.toml, composer.json, Gemfile,
# pubspec.yaml(+overrides), Podfile, Package.swift, deno.json,
# environment.yml, *.csproj/*.fsproj/*.vbproj + Directory.Packages.props,
# paket.dependencies, libs.versions.toml, stack.yaml, mix.exs,
# Cartfile, conanfile.txt/py, vcpkg.json, flake.nix/shell.nix,
# build.zig.zon, gleam.toml, pixi.toml, shard.yml, cpanfile,
# *.rockspec, dub.json, description, deps.edn/bb.edn/project.clj,
# *.sbt, rebar.config, *.cabal, CMakeLists.txt/*.cmake, meson.build,
# chart.yaml, Brewfile, docker-compose/compose.yml, Dockerfile/
# *.dockerfile FROM images, .github/workflows + .gitlab-ci.yml `uses:`,
# .cargo/config*, .npmrc, pip.conf/ini, .pypirc, Bazel
# WORKSPACE/MODULE.bazel/.bzl, Gradle *.gradle(.kts), Terraform *.tf,
# and version pins (.python-version/.nvmrc/.tool-versions). Lockfile
# transitive chains and local package-cache probes (pub, Go module,
# NuGet, Maven) layer on top wherever those ecosystems' caches exist.
# Python projects: merge runtime-observed edges. Runs your command
# under an import hook, so computed import_module() names, getattr
# lazy-imports, and entry points actually loaded at runtime become
# real edges (coverage = what the command exercised):
strand trace ./my-project -o traced.strand -- pytest
# Deep scan: everything `scan` does (same .strand output unless
# --ipa-only), plus interprocedural analysis
# (the `strand-deep` engine - call graphs, dynamic-import()
# resolution, and taint/null/leak findings) for Python, JS/TS, Go,
# and Rust. Slower than `scan`; use for security/bug review:
strand deep ./my-project --analyze
strand deep ./my-project -o deep.strand # custom graph output
# -o, --output output .strand file (default: <dir-name>.strand)
# --analyze print taint/null/leak findings with call paths
# and confidence, plus a blind-spot report for
# calls the analyzer couldn't resolve
# --dump-callgraph print resolved `module.func -> module.func` edges
# --ipa-only run IPA + solver only; skip writing the graph
# --models <dir> override the embedded per-language TOML models
# (python/js/go/rust sources, sinks, sanitizers)
#
# Example finding:
# [Shell] main.go:20 exec.Command - src:Env (via main -> Server.Run) [90%]
#
# Bug classes: taint (env/request/file data -> shell/SQL/eval sinks),
# null/None/nil/Option reaching derefs or unwraps, and resource leaks
# (defer/RAII-aware). Sources, sinks and sanitizers are TOML data -
# see crates/strand-deep/src/models/. The same engine is available
# to the GUI ("Deep scan..." button) and as a library:
# strand_deep::analyze::analyze_project(root)
# Analyze:
strand info deps.strand
strand nodes deps.strand # list every node name
strand deps deps.strand my-crate --depth 3
strand impact deps.strand serde --by-depth
strand why deps.strand my-app serde_json
strand cycles deps.strand
strand top deps.strand --by impact -n 20
# huge DAGs: landmark-sampling estimate, top rows reranked exactly;
# tune with --samples N, force sampling with --approx (benchmarking),
# force exact (slow!) with --exact
strand order deps.strand --critical-path
strand roots deps.strand
strand leaves deps.strand
strand common deps.strand deps a b
# Impact of everything changed vs a git ref (CI use):
# maps `git diff --name-only <ref>` paths onto graph nodes - exact path
# for file-level scan graphs, directory/package segment for cargo graphs.
strand impact deps.strand --git-diff origin/main --max-impact 25
# exits non-zero when the blast radius exceeds --max-impact
# Export diagrams for docs/PRs (Graphviz DOT or Mermaid):
strand export deps.strand --format mermaid --impact serde_json --depth 2
strand export deps.strand --format dot --why my-app serde_json
# Ask the build tool: merge edges the project's bundler already
# resolved. `webpack --json > stats.json` gives per-module deps
# (aliases, dynamic requires, loader chains); `esbuild --metafile`
# gives per-input imports. Edges import as `resolved` confidence:
strand scan ./web-app -o app.strand --import stats.json
strand build stats.json -o bundler.strand # bundler edges alone
# Enforce architecture rules (exit 1 on violations, CI-friendly):
# strand.rules:
# forbid ui/ -> db/ # substring match on node names
# forbid *.test -> src/ # * and ? globs also work
strand check deps.strand # reads ./strand.rules
strand check deps.strand --rules ci.rules --json
# Diff two graphs (e.g. rescan after changes, no git required):
strand diff old.strand new.strand
# Filter by edge confidence. Every edge carries a provenance tag:
# static - directly parsed syntax (import, use, mod, literal require)
# resolved - literal-derived: const-prop imports, glob expansions,
# entry-point consumer links
# declared - config/comment declarations: depends-on, entry-point
# targets, pytest_plugins, INSTALLED_APPS, conftest
# traced - runtime-observed via `strand trace`
# heuristic - inferred (e.g. Rust parent module from file layout)
# --min-confidence hides edges below the threshold from traversal
# commands (deps, impact, why, top, order, roots, leaves, common,
# cycles, diff, export). E.g. review only human-declared edges:
strand impact deps.strand my-lib --min-confidence declared
strand deps deps.strand app --min-confidence static # literal imports onlyThe analysis commands (info, nodes, deps, impact, why,
cycles, top, order, roots, leaves, common, check,
diff) accept --json for CI use; build/scan/trace/deep
write graphs and reports, and export emits DOT/Mermaid.
For graphs that change, strand-store keeps the immutable .strand base
and layers a small write-optimized delta on top:
use strand_store::Store;
let db = Store::open("graph.strandb")?;
// One writer at a time (enforced by an fd-lock file); readers are unblocked.
{
let mut tx = db.begin_write()?;
tx.add_edge("app", "lib")?;
tx.remove_edge("app", "old-lib")?;
tx.commit()?; // WAL append + fsync -> durable
}
// Any number of consistent point-in-time snapshots; compaction never
// invalidates them (they pin their own Arc'd base+delta).
let snap = db.begin_read()?;
let view = snap.view(); // implements strand_core::view::GraphView
let depths = strand_core::algo::bfs(&view, &[core_id], Dir::In, None);
db.compact()?; // fold delta into a fresh base-<epoch>.strand, atomic manifest swap
// Or let it manage itself: commits auto-compact once the delta passes
// Options::compact_threshold_ops (default 1M ops; best-effort).
//
// Heads-up on delta RAM: each applied op costs ~100+ bytes in the
// in-memory delta maps, so 1M ops ≈ ~120MB. The effective threshold is
// max(compact_threshold_ops, base_edges/10) - on a 50M-edge base the
// delta can reach ~5M ops (~580MB) before auto-compaction kicks in.
// Lower compact_threshold_ops if that spike matters.- Durability: each commit is one WAL record
[len][crc][ops], fsynced beforecommit()returns. On open, replay stops at the first bad checksum - torn tail writes lose at most the uncommitted tail. - Reads: with an empty delta, neighbor iteration is the pure CSR fast path; with a small delta, untouched nodes still take it (per-node merge only where the delta has ops).
- Compaction: rebuilds a new immutable base, fsyncs, atomically swaps
manifest.json, reclaims old epoch files lazily. Live snapshots keep their pinnedArcs, so readers are never blocked. Measured on a 50M-edge base with a 1k-op delta: ~3 min and ~1.2 GB peak - it rebuilds the whole file, so keep GUI auto-compaction off (it is, by default) and let the ratio threshold keep it rare. A streaming merge is the planned fix. - Node removal:
remove_nodetombstones the id; re-adding the name creates a fresh id, so stale incident edges never resurrect.
Store layout and the WAL/op encoding are specified in
docs/FORMAT.md.
A native window (eframe/egui, no webview) for people who'd rather click than type.
From a repo checkout (always runs the newest source - the launcher
pulls main then builds only what changed):
- Windows: double-click
strand-gui.batin the repo root - macOS/Linux: run
./strand-gui.shfrom the repo root
Both need the Rust toolchain installed; the first launch compiles the GUI (a few minutes), later launches are instant. This is the best way to try unreleased changes - it never drifts from the checkout.
Installed binary (works from any directory, no repo needed):
cargo install strand-cli strand-gui # full Strand: CLI + GUI
# or
cargo install strand-gui # GUI only (`strand-gui`)
cargo install --path crates/strand-gui # build the local checkout insteadstrand-gui then works from any directory.
- Open .strand… loads an immutable graph; Open store… loads a
.strandbdirectory (read-write if the lock is free, read-only otherwise - analyses work identically on the merged view); Close unloads the current graph; Instructions opens a full reference of every button and canvas gesture. .strandfiles carry their scan warnings (dynamic imports, parse errors, files the scanner couldn't reach) - they show as an amber "Scan warnings" section in the left panel, andstrand infolists them on the CLI. A graph with warnings means the edge set may be incomplete.- Deep scan… picks any project directory and runs the
strand-deepengine on a worker thread - the same taint/null/leak solvers asstrand deep --analyzefor Python, JS/TS, Go, and Rust. Findings land in the report panel grouped by language with per- language solver stats. Works with no graph open; independent of the canvas. - First launch shows a short card tutorial (right arrow or Next to
advance); a marker file in
~/.strand/means it only appears once. - Pick nodes A and B three ways: the boxes autocomplete as you type (up to 8 case-insensitive substring matches; the index is skipped on graphs over 200k nodes), click a node on the canvas (click = A, shift+click = B), or browse every name in the Browse nodes panel (same click/shift+click rules). Then run Deps of A/B, Impact of A/B, Why A->B or Why B->A, swap A/B, Cycles, Build order, Roots, Leaves, Top (in-degree / impact / pagerank), and Common deps/impact - all with an optional depth limit.
- The bottom report panel lists full results - even ones too large to draw - with a filter box (case-insensitive substring, shows "shown of total") and clickable rows: click re-selects a node as A, right-click re-selects it as B.
- The canvas draws the graph and supports scroll/pinch zoom (up to 200×, toward the cursor), drag pan, and double-click reset. Hovering a node shows its name and dep/dependent counts.
- After an impact/deps run the canvas switches to ring layout by BFS depth; selecting a node alone also clusters its 3-hop neighborhood. The organic layout toggle runs a deterministic force-directed layout on that neighborhood (SCCs collapsed to super-nodes, computed on a worker thread); Clear highlight resets selections, rings, and layout back to the scatter view.
- Edges are tiered: edges touching your A/B selection draw bright yellow with a black outline on top, highlight-set edges amber, everything else dim. On huge highlight sets the middle tier is skipped so the canvas stays readable - the report list still has every node. Edges incident to A/B are always drawn (up to 96 neighbors each way), even when they fall outside the sampled edge set - neighbors beyond the node cap appear as small dots ringing the selected node.
- It handles up to 100k nodes / 300k edges: past 8k nodes it switches to cheap square markers, and opening a larger file shows a warning that the canvas is a partial sample (analyses always cover the full graph).
- Analyses, the name index, node focusing, and the organic layout all run on worker threads - the window stays responsive while they compute. Very large graphs may still show "analyzing…" for a while; the canvas itself is capped (see warning above) since hit-testing and repaints scale with drawn nodes.
- With a writable store open, the Edit store panel commits real transactions: Add/Remove edge A->B and Add/Remove node A (names come from the A/B boxes; edges auto-create missing nodes). Edits are WAL-durable immediately and show up in subsequent analyses.
.strand files stay strictly read-only; store edits go through
strand-store transactions (fsync'd WAL + atomic delta apply).
.strand is a binary memory-mapped format, so editors/IDEs can't
render it - the GUI is the viewer. To make double-clicking a .strand
file open Strand:
- Windows: right-click the file → Open with → Choose another
app → select
strand-gui.exe→ tick Always use this app. - macOS: right-click → Get Info → Open with → select
strand-gui→ Change All. - Linux: create a
~/.local/share/applications/strand.desktopentry withExec=/path/to/strand-gui %fandMimeType=for the extension, then set it as default for.strandfiles.
Alternatively use Open .strand… inside the app.
skills/strand/SKILL.md documents Strand for
AI coding agents: install via cargo install strand-cli, scan a project
to a .strand graph, and query it (impact, why, deps, top,
cycles, order, diff, check) - every query command supports
--json for machine-readable output. strand deep --analyze adds
interprocedural taint/null/leak findings. The CLI is fully offline and
deterministic; agents should treat scan warnings (listed by
strand info) as signals that results are incomplete.
Supported clients: any agent that can run shell commands (Claude Code,
Codex, Cursor, Gemini CLI, etc.). Tested with cargo install on
Windows, Linux, and macOS.
See docs/FORMAT.md. Highlights:
- 128-byte header + 10 sections, all 8-byte aligned, little-endian.
- Forward and reverse CSR adjacency, sorted targets, optional f32 weights.
- xxh64 checksum over all post-header bytes; readers validate magic, version, layout, monotonic offsets, target bounds, and UTF-8 names before trusting any slice. Corrupt/truncated files produce clean errors.
- Node ids are dense
u32s assigned by lexicographic name order, so builds are byte-for-byte deterministic.
Criterion, synthetic graph (i5-1335U, 12 threads, 8GB RAM, release build):
| Operation | 200k nodes / ~1M edges |
|---|---|
strand/open (mmap + full validation + checksum) |
~21 ms |
reverse BFS (impact) |
~35 ms |
| Tarjan SCC (iterative) | ~94 ms |
| PageRank (100 iters, rayon) | ~151 ms |
petgraph: build Graph + one BFS, same edges |
~123 ms |
Store read path (strand-store, 20k nodes / 100k edges, reverse BFS over
the merged view vs the same BFS on the bare Graph):
| View | time |
|---|---|
pure CSR Graph |
~7 µs |
| store snapshot, empty delta | ~8-11 µs |
| store snapshot, 200-edge delta | ~9-23 µs |
Timings are microseconds on a small graph and fluctuate run-to-run; the
structural point is that the empty-delta path is within ~10-20% of pure CSR
and the merge cost is proportional to delta-touched nodes, not graph size.
Reproduce: cargo bench -p strand-store.
Notes:
openvalidates everything (layout, monotonic offsets, target bounds, UTF-8 names, xxh64 checksum over the whole file), so its cost scales with file size. Measured on a 790MB / 50M-edge file (below): ~0.5s warm, ~1.8s cold. The mapping itself is zero-copy - traversals touch only the pages they need.- petgraph has no on-disk CSR format; the comparison above is in-memory construction + BFS, not open+query. Strand's advantage is that the "open" cost is paid once and queries then run directly on the mapped file with no per-query deserialization.
impact_sizes(used bytop --by impact) collapses the graph to its SCC condensation DAG and computes ancestor sets with bitsets -O(E·C/64)word-ops, memory-blocked to ~256MB. On graphs whose component count makes that too expensive it falls back to a per-node reverse BFS (fine for small/medium graphs; see Limitations).
Reproduce: cargo bench (env STRAND_BENCH_NODES, STRAND_BENCH_EDGES).
cargo run --release -p strand-core --example bigbench streams a
10,000,000-node / 50,000,000-edge graph (790MB .strand file) directly in
the file format, then times the real open + analyses. Measured on an
i5-1335U (12 threads, 8GB RAM); page cache warm unless noted:
| Operation | time |
|---|---|
| file generation (streaming writer) | ~3.7 s |
Graph::open (mmap + validation + xxh64 over 790MB) |
~0.5 s warm / ~1.8 s cold |
| forward BFS visiting all 10M nodes / 50M edges | ~1.3 s |
| Tarjan SCC (iterative) | ~9 s |
| PageRank (~0.12 s/iter, rayon) | ~0.25 s - converged in ~2 iters |
top --by impact (SCC condensation + bitsets) |
~17 s total incl. open+SCC |
Caveat: the synthetic graph is near-regular (every node has exactly 5
out-edges) and collapses into one giant SCC, so the condensation has a
single component and the bitsets are tiny - the ~17 s top --by impact
row does not represent a large mostly-acyclic graph (that's what the
sampling path covers, e.g. the 300k-node run). PageRank also converges
unusually fast here. Real dependency graphs are skewed with a few hub
nodes; expect more iterations there. BFS and SCC times are edge-count
bound and should transfer to skewed graphs.
Merged the committed package-lock.json files from three public repos -
axios, lodash,
microsoft/TypeScript - into one
graph (1,778 nodes / 3,790 edges / 105KB):
strand build axios-lock.json lodash-lock.json ts-lock.json -o web.strand
strand top web.strand --by impact -n 5top 5 by Impact:
209.0000 safe-buffer
208.0000 isarray
198.0000 yallist
194.0000 inherits
188.0000 pseudomap
top --by impact completes in ~0.13s and correctly surfaces the classic
npm hub packages. impact semver reports 182 affected packages - the
kind of blast-radius answer --git-diff + --max-impact is built for.
cargo test runs ~263 tests across the workspace:
- core algorithms (
strand-core/tests/algorithms.rs): BFS/depths, shortest & k-shortest paths, non-shortestpaths_within_depth, Tarjan SCC + self-loops, critical path, weighted Dijkstra, PageRank sanity, common sets. - impact ranking verified against brute force:
impact_sizes_match_bfsandimpact_sizes_match_bfs_on_cyclescheck every node's count against a naive per-node reverse BFS, acyclic and cyclic;impact_sizes_blocked_bitsetsexercises the multi-block (50k-component chain) path;impact_sizes_approx_tracks_exactchecks the landmark-sampling estimate is deterministic and tracks exact counts on a test graph;impact_approx_tracks_exact_on_random_dagcompares sampled vs exact on a 2k-node random DAG (top-20 overlap, Spearman rank correlation, and exact reranking of top candidates). - proptest (
proptests.rs): random graphs built, re-opened, and compared against an independent in-memory reference. - roundtrip/corruption/determinism (
roundtrip.rs): byte-identical output regardless of input order, duplicate-edge merging, node kinds, truncations and bit flips produce clean errors (never panics). - scanner (
strand-import/tests/scan.rs): Rustmod/use/#[path]/include!viasyn, Python and JS/TS imports via tree-sitter, groupedusetrees anduse-inside-fn, parse-failure warnings, docstring/string/comment false-positive rejection, Python absolute imports resolving against ancestor package roots (nestedpkg/pkg/layouts),tsconfig/jsconfigpathsaliases +baseUrl+extendsinheritance, JSONC comments/ trailing commas, per-package configs in monorepos,package.json"imports"(#alias), multiline/parenthesized imports, template- literalrequire(), dedup, char literals vs lifetimes, raw strings, non-ASCII, plus a dogfood test that scans Strand's own repo. - store (
strand-store/tests/store.rs): transactions, persistence, snapshots, compaction (incl. weighted edges), read-only rejection, WAL torn-tail/bit-flip recovery, a model-based randomized op test, and a crash-consistency harness that corrupts the WAL at random points and verifies the store always equals exactly some prefix of committed transactions (500 cases in CI, 10,000 viacargo test -p strand-store -- --ignored), plus the auto-compaction threshold. - CLI end-to-end (
strand-cli/tests/cli.rs): build (single and multi-input), info/nodes/deps/impact/why/cycles/top/order/roots/leaves/ common/scan/export/check/diff,--git-diffseed resolution,--max-impactgating, impact-count consistency, and missing-node errors viaCARGO_BIN_EXE_strand. - rule engine unit tests (
strand-cli/src/check.rs): rules-file parsing, comment/blank handling, malformed-rule rejection, substring vs glob pattern semantics (*/?). - lockfile importers (
strand-import/tests/locks.rs): the major formats incl. npm nestednode_modulesresolution andname@versiondisambiguation when multiple versions are installed, poetry dev-dependencies, go.mod directive boundaries, pom parent inheritance, and format auto-detection. - deep-analysis engine (
strand-deep, 51 tests): taint env-to-shell/SQL cross-function flows, sanitizer stops, null/None/ nil/Option guard narrowing, per-index array and per-field struct tracking, resource leaks incl. defer/RAII handling, method-call resolution via receiver types, cross-file/cross-package module flows,include_str!/format!handling, and SCC fixpoint convergence.
Tests live next to the code: crates/strand-core/tests/ (algorithms,
proptest, roundtrip/corruption/determinism), crates/strand-cli/
(tests/cli.rs end-to-end plus src/check.rs unit tests),
crates/strand-deep/src/ (per-language solver unit tests inline),
crates/strand-import/tests/ (scan.rs, locks.rs, manifests.rs,
caches.rs, bundler.rs, resolution.rs), and
crates/strand-store/tests/store.rs.
cargo test- No query language - Rust API + CLI + desktop GUI.
- The GUI canvas caps at 100k nodes / 300k edges with level-of-detail rendering; beyond that use the CLI. Store edits are limited to node/edge add/remove - no batch import or schema changes from the GUI.
top --by impactuses SCC condensation + bitset ancestor sets (O(E·C/64)word-ops, processed in ~256MB column blocks) when the op count fits the budget. On huge mostly-acyclic graphs (C≈ V) it switches to a deterministic landmark-sampling estimate (impact_sizes_approx, ~2G edge visits). The estimate is unbiased but not uniform-accuracy: high-impact nodes (the top of the ranking) are accurate, low-impact nodes are noisy and often estimate as 0 - fine for ranking, near-ties can misorder. The CLI reranks the top candidates with exact per-node BFS (boundary ties included, budget-capped), prints the landmark count, marks approximate rows with~, and reports per-nodeexactflags in--json.--samples Noverrides the landmark count;--approxforces sampling even when exact is affordable (benchmarking/validation);--exactforces the exact algorithm even over budget (per-node BFS fallback - can be very slow on huge DAGs). Estimates are clamped ton-1. The library functionimpact_sizes()itself falls back to exact per-node BFS for any graph over the bitset budget - which can run for hours on a large mostly-acyclic DAG; useimpact_sizes_autofor the sampling path.why --all-pathsenumerates alternative shortest chains (cap via--limit), or every simple chain up to--max-depth Nhops. Both are step-budgeted and report truncation, so dense graphs can't hang.- Weighted edges:
why --weightedruns Dijkstra over edge weights (unweighted graphs count every edge as 1.0). The store preserves weights through compaction. - The store is single-writer per directory (one process holds the write
lock); scale-out means one store per shard - e.g. one
.strandbper top-level subtree or per service, queried independently. Cross-shard queries are not supported yet. - Store node ids are not stable across compaction: the new base
renumbers nodes by name, so anything holding ids across a compaction
(selections, cached lookups) goes stale. Use node names as stable
keys -
node_id/node_namere-resolve cheaply. - Edges carry an optional confidence/provenance tag (
EdgeKind:static>resolved>declared>traced>heuristic), stored as per-edgeu8tables insidenode_metaonly when any edge is non-static- all-static graphs are byte-identical to the old format, and old readers ignore the tail. There are still no dependency-type distinctions (dev vs build vs optional, import vs require); importers that know the kind collapse them into one edge. strand deepanalysis is a may-analysis without type information: dynamic dispatch, reflection, FFI boundaries, and receivers that aren't statically bound stay unresolved (counted in the blind-spot report, never guessed). Resolution is syntactic and scope-aware:x = new C()/x = C()seeds,this.x = new C()/self.x = C()attribute seeds,new C()reachingconstructor/__init__/__new__,this.m()/self.m()inside the class body, plus a callsite-agreement pass that seeds a parameter or assignment target with a class only when every observed callsite/return agrees (disagreement stays unresolved), andf().m()resolves through the callee's inferred return class. Container element types also seed (x = [C()]/x[i] = C()->x[0].m()). Remaining gaps: element types built by unsupported expressions (mutated collections, mixed-type literals), callsites the graph never saw (dynamic imports, reflection), and genuinely ambiguous types. Findings are heuristic - expect false positives on heavily dynamic code and false negatives where values flow through unsupported constructs. Per-language coverage differs: Go relies on syntactic type seeding for cross-function method calls, and Rust reports no local leak findings (RAII closes on drop) thoughreturns_unclosedmetadata still flows through summaries - explicit leak-intent calls (mem::forget,Box::leak,ManuallyDrop::new) do report Leak findings, but RAII suppression remains unsound forRc/Arcreference cycles, which can leak without a finding. Model files (crates/strand-deep/src/models/) define sources/sinks per language and are a starting point, not exhaustive.- Store delta is in-memory, but commits auto-compact once it passes
Options::compact_threshold_ops(default 1M ops, 0 disables) - the delta can still spike RAM between compactions, and readers pin their snapshot's delta until they drop it. - Crash safety covers WAL commits and manifest swaps; orphaned
*.tmpfiles from interrupted writes are garbage-collected on open (writers only publish via rename). - mmap assumes files aren't truncated while mapped (inherent SIGBUS
risk - a crash, not a degraded result). Mitigations in place: open
validates magic, section bounds, and an xxh64 payload checksum, so
pre-existing corruption fails cleanly; every write goes through a
temp file + fsync + rename (manifest included); the
.strandbstore holds an fd lock so a second writer gets a clear read-only error instead of corrupting data. The residual case is an external process truncating or rewriting a.strandfile in place during a read - avoid editing graph files while tools have them open. strand scanparses sources with real parsers -synfor Rust, tree-sitter for Python and JS/TS, a line scanner for Go import specs - so comments, string literals, and groupedusetrees (use a::{b, c::d}) are handled by the grammar, not text matching. It handlesmod/use/#[path]/include!(Rust),import/fromincl. relative imports and literalimport_module()/__import__()calls, plus entry-point targets frompyproject.toml,setup.cfg, andsetup.py(the config file becomes the edge source) (Python),import/export-from/require/dynamicimport()(JS/TS), includingtsconfig/jsconfigpathsaliases andbaseUrl(JSONC-tolerant,extendschains followed, nearest config per file for monorepos) andpackage.json"imports"(#alias), andimportspecs resolved againstgo.modmodules (Go). Computed imports are resolved when every piece is a literal-derived constant: a per-file set-of-strings pass folds+, f-strings,%,.format,"".join, ternaries, dict subscripts, and loops over literal collections (set size capped at 64; mutations and unknown values stay dynamic). The same pass also propagates literal call-site arguments one hop:def load(name): import_module(name)called asload('ldap')in the same file resolves through the parameter. Sites that still can't resolve are counted per file and reported as warnings - with a "(N read env vars/config)" hint when the argument mentionsenviron/getenv/config-style sources. Literal glob patterns expand against the scanned files: Pythonglob.glob/iglob/Path.glob, JSrequire.context,import.meta.glob, and template/+-concat dynamic imports with a static directory anchor. Framework conventions add edges imports never show: Pythonpytest_plugins, DjangoINSTALLED_APPSdotted strings (longest resolvable module prefix wins), andconftest.pyancestors of test files. Files that fail to parse are skipped with a warning (the scan may be incomplete). It misses macro-generated modules (a real parser can't see them either without expanding macros -cargo expandoutput is a workaround for inspection, not for scanning),include_str!payloads, and dynamic language tricks whose values only exist at runtime - env vars, config, cross-function data flow, andentry_pointsbuilt by function calls stay invisible, so runtime-only dependencies can be missed. Each such site is counted and reported as a per-file warning ("N dynamic import site(s)") so incomplete results are visible. For Rust, whentarget/contains cargo dep-info (.dfiles from a priorcargo check/build), two cross-checks run: source files rustc read but the scanner didn't reach, and scanned files rustc compiled with no incomingmodedge (the macro-generated-module signature, excluding crate roots likelib.rs/tests/). For the edgeless files, Rust's deterministic module layout (a/b/c.rsis declared bya/b.rsora/b/mod.rs,src/x.rsby the crate root) lets the scanner infer and add the parent edge; only files with no existing candidate stay warnings.entry_points(group="x")andentry_points().select(group="x")callers link to every target declared in that group acrosspyproject.toml,setup.cfg, andsetup.py; a bareentry_points()links to all declared targets. For JS/TS,strand scan --import <file>(orstrand build) accepts bundler metadata -webpack --jsonstats andesbuild --metafileJSON - whose resolved module edges import asresolvedconfidence. This is the escape hatch for what static analysis structurally cannot see: ask the tool that already did the resolution. And# strand: depends-on <path>/// strand: depends-on <path>comments add manual edges for the cases you know about (paths resolve relative to the file's dir, then the project root). For Python,strand trace <dir> -- <cmd>goes further: it runs the command under an import hook and merges every observed.py -> .pyimport into the graph, covering the computed-name andgetattrcases for whatever the command exercised. It then prints a coverage report - scanned.pyfiles the command never loaded are listed asdark:, so untested paths stay visible instead of silently absent. Interpreter flags that bypass the hook (python -S,-I,-E) are detected up front and warned about. Nodes are file paths, so it answers "what breaks if I changesrc/foo.rs?" - package-level questions still wantcargo metadatainput. Unresolvable imports and third-party packages are dropped entirely (they are not nodes); the node set is exactly the source files found under the scan root.
MIT - permissive, do whatever you want, just keep the copyright notice.
