# CLI reference

> Every codeweb subcommand and flag, verified against the --help output of the current release.

---

LLMS index: [llms.txt](/codeweb/llms.txt)

---

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 {#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&#124;json&#124;mermaid&#124;ndjson> --output <FILE> [--include-unresolved] [--sql-only]` parses a file or directory directly and prints an export.

## Project lifecycle {#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 {#tracing-and-inspection}

| Command | Key options | Purpose |
| ------- | ----------- | ------- |
| `codeweb trace <FROM>` | `-s, --style tree&#124;path`, `--exact`, `--regex`, `--all-matches`, `--fail-on-multiple`, `--builtfunc` | Callers and callees of a node |
| `codeweb detail [NAMES]...` | `-s, --style tree&#124;path`, `-d, --depth 1&#124;0&#124;-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&#124;paths&#124;both&#124;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&#124;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 {#analysis}

| Command | Key options | Purpose |
| ------- | ----------- | ------- |
| `codeweb lineage <TARGET>` | `--direction upstream&#124;downstream&#124;both` (default both), `--depth` (default 5), `--format tree&#124;json&#124;dot&#124;mermaid`, `--view tree&#124;entity&#124;relation&#124;grouped`, `--flow-only` | Table/column lineage. See [Lineage](/codeweb/docs/lineage/) |
| `codeweb columns` | `--procedure <NAME>` or `--package <NAME>` (required, one only), `--table <NAME>`, `--format json&#124;seed-hints` (default json), `--discriminator <COL>` (repeatable) | Aggregated column analysis. See [Column analysis](/codeweb/docs/column-analysis/) |
| `codeweb predicates` | `--procedure <NAME>` (required), `--format json` | PL `IF`/`CASE` predicates resolved to columns |
| `codeweb conflicts` | `--severity high&#124;medium` (default high), `-f, --format json&#124;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 {#query-and-export}

| Command | Key options | Purpose |
| ------- | ----------- | ------- |
| `codeweb query` | `-f, --file <FILE>` (`-` for stdin) or `-s, --spec <JSON>` | Execute a declarative [QuerySpec](/codeweb/docs/trace-and-query/#declarative-queries) |
| `codeweb export` | `-f, --format dot&#124;json&#124;mermaid&#124;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/docs/cgef/) |
| `codeweb merge` | `-o, --output <FILE>` (required), `--name <NAME>` (default `merged`), `[STORES]...` | Merge multiple stores with dedup |

## Interactive and server {#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&#124;debug` | HTTP server with browser UI. See [HTTP API](/codeweb/docs/serve/) |
| `codeweb mcp` | `mcp` | `-p, --project` | MCP server over stdio. See [MCP tools](/codeweb/docs/mcp/) |

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.

---

Backlinks:

- [Getting started](/codeweb/docs/getting-started/)
