CLI reference
Every codeweb subcommand and flag, verified against the –help output of the current release.
Every project-scoped command accepts -p, --project <DIR> (default .), plus the global options below. This page documents codeweb v0.9.11 with all features enabled.
Global options
| Option | Values | Meaning |
|---|---|---|
--lang | zh-CN, en (default zh-CN) | Output language |
--threads | integer | Worker threads for parallel parsing. Default: max(4, logical_cpus - 2). Also honors RAYON_NUM_THREADS; the flag wins |
-V, --version | — | Print version (currently 0.9.11) |
Without a subcommand, codeweb runs in legacy mode: codeweb [INPUT] --format <dot|json|mermaid|ndjson> --output <FILE> [--include-unresolved] [--sql-only] parses a file or directory directly and prints an export.
Project lifecycle
| Command | Key options | Purpose |
|---|---|---|
codeweb init <NAME> | -d, --dir <DIR> (repeatable), --root <DIR>, --force | Create codeweb.toml + .codeweb/, register analysis paths, and immediately run the first analysis (the MCP codeweb_init tool, in contrast, inits without analyzing). A non-empty --root without codeweb.toml needs --force |
codeweb analyze | -p, --project | Full or incremental analysis (fingerprint-based) |
codeweb diff | -p, --project | Files changed since the last analysis |
codeweb stats | -p, --project | Node/edge counts by type |
codeweb files | -p, --project | Analyzed files with node counts |
Tracing and inspection
| Command | Key options | Purpose |
|---|---|---|
codeweb trace <FROM> | -s, --style tree|path, --exact, --regex, --all-matches, --fail-on-multiple, --builtfunc | Callers and callees of a node |
codeweb detail [NAMES]... | -s, --style tree|path, -d, --depth 1|0|-1, -f, --files, --related-ddl, -v, --verbose, --summarize-tables, --exact, --regex, --all-matches, --fail-on-multiple, --builtfunc | Per-node callers/callees with optional source context |
codeweb inspect [NODES]... | -m, --max-depth (default 15), --max-paths (default 10), -s, --style summary|paths|both|tree, --unreachable, --exact, --regex, --all-matches, --fail-on-multiple | Directed paths connecting two or more nodes |
codeweb impact | --file <FILE> (repeatable) or --node <NODE> (mutually exclusive), -f, --format json|text (default json), -d, --depth (default 1), -e, --edge-types (default all), --exact, --regex | Upstream/downstream impact for a file’s nodes or one symbol |
codeweb trace-sql [SQL] | -f, --file <FILE> or positional SQL / - for stdin | Search mapper/sql nodes by SQL fragment, trace back to Java methods |
Analysis
| Command | Key options | Purpose |
|---|---|---|
codeweb lineage <TARGET> | --direction upstream|downstream|both (default both), --depth (default 5), --format tree|json|dot|mermaid, --view tree|entity|relation|grouped, --flow-only | Table/column lineage. See Lineage |
codeweb columns | --procedure <NAME> or --package <NAME> (required, one only), --table <NAME>, --format json|seed-hints (default json), --discriminator <COL> (repeatable) | Aggregated column analysis. See Column analysis |
codeweb predicates | --procedure <NAME> (required), --format json | PL IF/CASE predicates resolved to columns |
codeweb conflicts | --severity high|medium (default high), -f, --format json|text (default json), --table <NAME> | Cross-procedure table-lock conflicts (static analysis) |
codeweb partition | -k, --k <K>, --auto, --gamma <GAMMA>, --max-iterations <N>, --min-delta-q <Q>, --min-component-size <N> (default 1), --table-projection [<tau:lambda:k>], -o, --output <FILE> | Cluster nodes for system decomposition; exports DOT with cluster_* blocks |
codeweb mark | -n, --node <NODE> (repeatable), -c, --csv <CSV> (required), -o, --output <FILE> | Mark WDR SQL detail CSV rows by relation to graph nodes |
Query and export
| Command | Key options | Purpose |
|---|---|---|
codeweb query | -f, --file <FILE> (- for stdin) or -s, --spec <JSON> | Execute a declarative QuerySpec |
codeweb export | -f, --format dot|json|mermaid|ndjson (default dot), -o, --output <FILE> (stdout if omitted), --filter <SUBSTR> | Export the graph or the subgraph around matching seeds |
codeweb dedup | -o, --output <FILE> (default in-place), --dry-run | Merge duplicate nodes and edges |
codeweb import | -f, --file <FILE>, -o, --output <FILE>, -p, --prefix <PREFIX>, -n, --name <NAME>, --force | Import a CGEF JSON file. See CGEF |
codeweb merge | -o, --output <FILE> (required), --name <NAME> (default merged), [STORES]... | Merge multiple stores with dedup |
Interactive and server
| Command | Feature | Key options | Purpose |
|---|---|---|---|
codeweb tui | tui | -p, --project | Terminal explorer with search and node detail |
codeweb serve | serve | -a, --addr (default 127.0.0.1:3000), --open, --log-level info|debug | HTTP server with browser UI. See HTTP API |
codeweb mcp | mcp | -p, --project | MCP server over stdio. See MCP tools |
Subcommands that need a feature flag are absent from binaries built without it; codeweb serve on a default build exits with an unrecognized-command error.