This is the multi-page printable view of this section.
Documentation
- 1: Getting started
- 2: CLI reference
- 3: Graph model
- 4: Trace and query
- 5: Lineage
- 6: Column analysis
- 7: CGEF import and merge
- 8: HTTP API
- 9: MCP tools
- 10: Architecture
- 11: Contributing
The pages in this section cover one user task each. Start with Getting started, then pick the surface you need. Every factual claim is verified against the source code of the current release.
1 - Getting started
What codeweb does
codeweb parses a source tree and builds a directed semantic graph. The core chain connects four layers:
- SQL layer: procedures, functions, packages, tables, views, triggers, and other DDL objects parsed from openGauss / GaussDB dialect SQL.
- Mapper layer: MyBatis/iBatis
<select>/<update>/<insert>/<delete>statements from XML mapper files. - Java layer: methods and classes parsed with tree-sitter, plus SQL embedded in annotations and JDBC calls.
- JSP layer (default feature
jsp): SQL embedded in scriptlets, declarations, and expressions.
The result is queryable in both directions: who calls a procedure, what does a Java method touch, and what breaks when a table changes.
Build from source
codeweb is a single Rust crate. Rust’s latest stable toolchain is required.
The binary lands in target/release/codeweb. Which subcommands exist depends on the feature set: serve needs the serve feature, mcp needs the mcp feature. See Architecture for the full feature matrix.
Create a project
codeweb init writes a codeweb.toml and a .codeweb/ state directory, registers the source directories to analyze, and immediately runs the first full analysis:
- Without
--root, the project is created in the current directory and every-dpath is registered for analysis. A-dthat points outside the current directory does not move the project there. --root <dir>creates the project in<dir>instead. A non-empty root without an existingcodeweb.tomlis refused unless you pass--force.
The generated codeweb.toml controls what is analyzed:
Analyze and inspect
Run from the same directory where you ran codeweb init — the project root holding codeweb.toml (or pass -p <dir> from anywhere):
Subsequent codeweb analyze runs only re-parse files whose fingerprint (blake3 hash) changed, so iterations are fast. To force a full re-analysis, delete the .codeweb/fingerprints state.
Trace your first chain
With the repository’s demo sources, run inside the codeweb checkout:
trace prints the callers and callees of the matched node as a tree. trace-sql finds MappedStatement and JavaSql nodes by SQL fragment and walks back to the Java methods that reach them.
Pick an interface
| Surface | Command | Feature | What you get |
|---|---|---|---|
| CLI | codeweb <command> | default | All analysis and export commands |
| TUI | codeweb tui | default | Terminal explorer with search and node detail |
| Browser UI | codeweb serve | serve | Cytoscape.js canvas plus a REST API |
| MCP | codeweb mcp | mcp | 11 JSON-RPC tools for LLM clients |
Next steps
- CLI reference — every command and flag.
- Graph model — node types, edge kinds, and naming rules.
- Trace and query — impact analysis and the JSON query engine.
- HTTP API and MCP tools — automate codeweb.
2 - CLI reference
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.
3 - Graph model
Node types
Every node carries a type tag in CLI output and all export formats. A * suffix is a qualifier whose meaning depends on the type: for table* / view* / seq* it means inferred (referenced by DML, no DDL definition found); for proc* / func* it means the procedure/function body could not be fully parsed.
| Tag | Meaning | Notes |
|---|---|---|
proc / proc* | Stored procedure | * = incomplete body parse |
func / func* | Function | * = incomplete body parse |
table / table* | Table | * = referenced in DML, no DDL |
view / view* | View | * = referenced in DML, no DDL |
seq / seq* | Sequence | * = referenced, no DDL |
pkg | Package | |
trigger | Trigger | |
type | Custom type | |
index | Index | |
mview | Materialized view | |
synonym | Synonym | |
event | Event | |
builtin | Built-in SQL function | Subtypes in JSON: builtin:func, builtin:op, builtin:hint, builtin:special |
unres | Unresolved reference | Dynamic or unmatched call target |
mapper | MyBatis/iBatis mapped statement | |
method | Java method | |
class | Java class | |
sql | SQL embedded in Java | From annotations or JDBC calls |
jsp | JSP page | Requires the jsp feature |
jspsql | SQL embedded in JSP | Requires the jsp feature |
custom | Imported custom node | Created via CGEF import |
Tables and views that live in known system schemas (pg_catalog, sys, dbe_*, …) or are well-known system names (dual, sys_dummy) are flagged system: true in JSON output; codeweb nodes --system filters for them.
Node keys
Nodes are identified by a NodeKey string that combines name, type, and location of origin:
- SQL objects:
type:schema.name(for exampletable:public.orders); routines include the package when defined in one. - Java methods: the fully qualified name including the class (
com.example.OrderService.createOrder). - Mappers:
namespace.id(com.example.OrderMapper.insertOrder).
Substring search in trace, detail, inspect, and impact matches against these keys. Use --exact for a case-insensitive exact match, --regex for regular expressions, and --fail-on-multiple to refuse ambiguous matches.
Edge kinds
| Edge | Connects | Meaning |
|---|---|---|
DirectCall | procedure → procedure | Static CALL / PERFORM |
DynamicCall | procedure → unresolved | EXECUTE IMMEDIATE with a non-literal target |
CallsProcedure | mapper / Java / JSP SQL → procedure | SQL body calls a stored procedure |
InvokesMapper | Java method → mapped statement | Mapper id call or interface binding |
CallsJava | SQL / procedure → Java method | Outbound call into Java |
UsesBuiltinFunction | routine → built-in | COUNT, SUBSTR, operators, hints |
ContainsMethod | class → method | Java class structure |
ContainsSql | Java method → JavaSql | Method owns embedded SQL |
Extends / Implements | class → class | Java inheritance |
TableAccess | routine / statement → table | Read/write with access modes and write kinds |
DependsOn | node → node | Structural dependency (views, synonyms) |
ContainsRoutine | package → routine | Package body membership |
TriggersRoutine | trigger → routine | Trigger fires routine |
ReferencesType / UsesSequence / IndexesTable / AliasesObject | routine → object | DDL references |
AnchorsOn | routine → table/column | %TYPE / %ROWTYPE schema anchor; excluded from lineage, conflicts, and --summarize-tables |
CustomEdge | any → any | Imported via CGEF with a custom type name |
For traversal, edges fold into five categories: call, composition, dataflow, reference, inheritance. These are the values accepted by codeweb impact --edge-types and by the edge_categories field of the query engine.
4 - Trace and query
Trace
codeweb trace <FROM> walks the full call chain around a node, printing callers and callees. Matching is substring-based on node keys by default.
Detail
codeweb detail <NAMES>... shows direct callers and callees per node, optionally with source context:
--depth accepts 1 (direct), 0 (target only), or -1 (unlimited).
Inspect
codeweb inspect finds directed paths that connect two or more nodes across all edge types:
Impact
codeweb impact answers “what is affected by this change” — per file or per node. The two target flags are mutually exclusive:
--edge-types accepts all (default), call, dataflow, reference, composition, inheritance.
Search by SQL fragment
codeweb trace-sql searches mapper and sql nodes by SQL text (case-insensitive substring) and traces back to the invoking Java methods:
Deduplicate
codeweb dedup merges duplicate nodes and edges (for example a table seen both with and without DDL across phases):
Declarative queries
codeweb query runs a JSON QuerySpec against the graph. A spec has three parts: start (which nodes), steps (traversal), and collect (result shape).
| Field | Values | Meaning |
|---|---|---|
start | type, name, schema | Starting node(s); all fields optional |
steps[] | {"action":"outgoing","edge_categories":[...],"max_depth":N} | Follow outgoing edges |
{"action":"incoming", ...} | Follow incoming edges | |
{"action":"filter","type_tag":"table","schema":"public"} | Keep matching nodes | |
{"action":"until","type_tag":"table"} | Stop traversal at a node type | |
collect | nodes (default), paths, subgraph | Result shape |
edge_categories accepts call, composition, dataflow, reference, inheritance — see Edge kinds. The same spec format works over HTTP (POST /api/v1/query) and MCP (codeweb_query), so one spec serves CLI, scripts, and LLM clients.
5 - Lineage
Run lineage
codeweb lineage <TARGET> computes how data reaches — and leaves — a table or column:
Options:
--direction accepts upstream, downstream, or both (default).
Output formats
--format dot and --format mermaid export the entity subgraph. The default --format tree supports four renderings via --view:
| View | Rendering |
|---|---|
tree (default) | Indented lineage tree |
entity | Entities only, no processes |
relation | Explicit source──process──▶target lines |
grouped | Branches grouped by connecting process |
Tune flow detection
With --flow-only, codeweb hides sources that only reference a table without moving data. The thresholds live in codeweb.toml:
The [lineage] section exposes flow thresholds (flow_min_overlap, flow_min_ratio defaults apply unless overridden).
Column-level analysis
Lineage answers “where does this column come from”. For the inverse question — “which filters, joins, and mappings does a procedure apply to its tables” — use the column analysis commands codeweb columns and codeweb predicates. The HTTP equivalent is GET /api/v1/lineage; the MCP equivalent is codeweb_lineage.
6 - Column analysis
Aggregate per procedure
codeweb columns exports, per procedure or package: hard filters, join conditions, SELECT INTO mappings, and enum/column mappings. Exactly one of --procedure or --package is required:
Output is JSON (schema from issue #165). --procedure and --package use the same substring matching as trace; matching more than one node fails the command.
Seed hints
--format seed-hints (issue #181) renders a table-requirements inventory for generating test data: involved tables with per-table operations, the routine signature, hard filters, cross-table equalities, and discriminator values. Each entry carries provenance and confidence.
--discriminatornames a column whose literal values are enumerated asdiscriminator_values. The flag is repeatable and overrides thediscriminator_columnslist fromcodeweb.toml:
By default the list is empty: codeweb has no built-in domain knowledge, so a project opts in explicitly.
Predicates
codeweb predicates --procedure <NAME> resolves PL IF/CASE conditions to table columns and outputs JSON:
--format json is the only supported value today.
Mark WDR report rows
codeweb mark annotates rows of a WDR SQL detail CSV with their relation to a target graph node — useful for tying slow-SQL reports back to procedures and mappers:
Interfaces
The aggregated column analysis is exposed on every surface:
- CLI:
codeweb columns,codeweb predicates - HTTP:
GET /api/v1/columns?procedure=...|package=...[&table=...] - MCP:
codeweb_column_analysis(same JSON schema as the CLI)
7 - CGEF import and merge
Why CGEF
CGEF (Codeweb Graph Exchange Format) is the JSON format for graph data produced outside of codeweb — for example, call relationships of a private ERP system whose source cannot be scanned. Import it as a standalone store, merge it with local analysis, and trace chains across the boundary.
Document structure
A CGEF document is a JSON file with these top-level fields:
| Field | Required | Meaning |
|---|---|---|
format_version | yes | Format version; currently 1 |
metadata | yes | source identifier and ISO 8601 generated_at |
node_schemas | no | Declarations for custom node types |
edge_schemas | no | Declarations for custom edge types |
nodes | yes | Node array (may be empty) |
edges | yes | Edge array (may be empty) |
Standard node types cover all built-in codeweb objects (procedure, function, table, view, mapped_statement, java_method, java_class, java_sql, package, trigger, type, sequence, index, materialized_view, …). The full per-type key fields are specified in the CGEF user guide and the JSON Schema.
Custom types
Node or edge types that have no built-in equivalent are declared in node_schemas / edge_schemas (display name, key fields, property definitions). Their edges import as CustomEdge and their nodes with tag custom, so they behave like first-class nodes in trace, impact, and export.
Import
| Flag | Meaning |
|---|---|
--file | CGEF JSON input |
--output | Output store: .bincode or .json |
--prefix | Path prefix prepended to all relative file paths |
--name | Project name for the imported store |
--force | Import even when validation or parse errors are found |
Merge
Merging deduplicates nodes and edges across stores, so the same table analyzed locally and imported via CGEF collapses into one node. The merged store behaves like any local store for trace, serve, and export.
View the full guide
The Chinese guide docs/cgef-user-guide.md walks through a complete worked example, including the OP Excel lineage converter (lib/op-lineage.py).
8 - HTTP API
Start the server
Built with the serve feature, codeweb serve loads the project store and starts an HTTP server with an embedded browser UI:
| Flag | Default | Meaning |
|---|---|---|
-p, --project | . | Project directory |
-a, --addr | 127.0.0.1:3000 | Bind address (host:port) |
--open | off | Open the browser after startup |
--log-level | info | Access log level: info or debug |
The UI offers a node list with search, a Cytoscape.js graph canvas with dagre layout, and a detail panel with callers/callees. Requests are CORS-permissive and logged to .codeweb/ in the project directory.
REST endpoints
All endpoints live under /api/v1 and return JSON unless noted.
| Method | Path | Parameters | Description |
|---|---|---|---|
| GET | /api/v1/stats | — | Node counts by type, edge count, project name |
| GET | /api/v1/files | — | Analyzed files with node counts |
| GET | /api/v1/nodes | search, node_type, orphan, low_degree, limit (default 100), offset (default 0) | Filter and paginate node summaries; search sorts by match rank |
| GET | /api/v1/nodes/:id | — | Node properties, direct callers, callees |
| GET | /api/v1/nodes/:id/callers | limit, offset, depth | Upstream neighbors |
| GET | /api/v1/nodes/:id/callees | limit, offset, depth | Downstream neighbors |
| GET | /api/v1/nodes/search-sql | q (required) | Search mapper/sql nodes by SQL content, scored |
| GET | /api/v1/trace | from (required), depth (default 2, capped at 10), max_nodes (default 500) | Bidirectional call chain trees; response reports truncated |
| GET | /api/v1/columns | exactly one of procedure, package; optional table | Aggregated column analysis (issue #165 JSON) |
| GET | /api/v1/lineage | target (required), direction (upstream/downstream/both), depth (default 5) | Table/column lineage |
| POST | /api/v1/query | body: QuerySpec JSON | Declarative traversal |
| GET | /api/v1/export | format: dot, json, ndjson, mermaid | Download the graph |
| GET | /api/v1/graph | — | Full graph payload used by the browser UI canvas |
Status codes follow the convention: 404 when a name matches nothing, 400 for ambiguous names or invalid parameters (for example passing both procedure and package to /api/v1/columns).
Examples
Security boundaries
The server reads the project store and binds the address you give it. It does not authenticate requests, and CORS is fully permissive, so treat it as a local development tool: do not expose it to untrusted networks. Read paths may point anywhere under analysis.paths; the serve mode has no write endpoints.
9 - MCP tools
Start the MCP server
Built with the mcp feature, codeweb mcp speaks JSON-RPC over stdio:
Register it in an MCP client, for example Claude Desktop’s claude_desktop_config.json:
Lifecycle
The server starts even when the directory has no codeweb.toml yet: queries then return status: "uninitialized" instead of the process exiting.
codeweb_initwritescodeweb.tomland.codeweb/under the served directory. It never analyzes on its own.codeweb_analyzebuilds or incrementally refreshes the graph and hot-swaps it into the running server, so later queries see the new graph without a restart.codeweb_difflists files added, modified, or deleted since the last analysis.
Tools
| Tool | Parameters | Description |
|---|---|---|
codeweb_init | name (optional, defaults to directory name), paths (optional, defaults to ["."]) | Initialize the project; no analysis |
codeweb_analyze | — | Build/refresh the graph and hot-swap it in |
codeweb_diff | — | Changes since the last analysis |
codeweb_stats | — | Node counts by type, edge count, status; call this first |
codeweb_nodes | search, node_type, limit, offset | List nodes with filtering and pagination |
codeweb_node_detail | ids (list), depth (1 direct, 0 unlimited, N hops) | Properties, callers, callees |
codeweb_trace | from, depth, max_nodes | Bidirectional call chain as nested trees |
codeweb_search_sql | sql | Search mapper/sql nodes by SQL text with relevance scoring |
codeweb_query | spec | Execute a QuerySpec |
codeweb_column_analysis | procedure or package (exactly one), table (optional) | Same JSON schema as codeweb columns --format json |
codeweb_lineage | target, direction, depth | Same functions and JSON shape as codeweb lineage --format json |
Security boundaries
Reads may point at any directory listed in analysis.paths, but every write is confined to the served directory: a tampered store.path that escapes it is rejected. The server exposes no shell execution and no file-write tools beyond the lifecycle above.
10 - Architecture
Pipeline
- Scan —
parser/scanner.rsdiscovers files through the configured include paths and excludes. - Parse —
parser/extractor.rsfans out over a rayon thread pool. SQL goes through ogsql-parser (openGauss/GaussDB dialect), mapper XML through its iBatis loader, Java through tree-sitter-java, and JSP through a preprocessor that synthesizes Java and reuses the Java SQL extraction. - Build —
graph/builder.rsturns relationships into nodes and edges, resolving names to schema/package-qualified keys and marking unreferenced DML targets as inferred (*) nodes. - Store —
graph/store.rskeeps the graph in a petgraph graph with query indexes, serializes to bincode under.codeweb/, merges and dedups stores, and supports incremental re-parse via blake3 fingerprints. - Serve — the same store backs the CLI/TUI, the axum HTTP server, and the rmcp MCP server.
Feature flags
| Feature | Enables | Default |
|---|---|---|
cli | clap-based command line | yes |
tui | ratatui + crossterm terminal UI | yes |
java | tree-sitter-java extraction plus ogsql-parser’s Java SQL extraction | yes |
jsp | JSP scriptlet/declaration/expression SQL extraction (implies java and the ogsql-parser ibatis feature) | yes |
serve | axum HTTP server, browser UI (rust-embed), access log | no |
mcp | rmcp MCP server with schemars-generated tool schemas | no |
analyze | Library-only build shape (no CLI/TUI/serve/MCP) used to embed analysis into other Rust applications | no |
search-sql-v2 | Activates the search-sql-v2 test suite for enhanced token-normalized SQL matching; today it changes tests, while runtime search is identical in every build | no |
full | Everything above | no |
Feature composition matters at runtime: binaries built without serve or mcp lack those subcommands entirely. The default build already extracts SQL from Java and JSP; only the server surfaces are opt-in.
Module map
| Module | Responsibility |
|---|---|
src/main.rs | clap entry point and command dispatch |
src/parser/ | File scanning, loading, and relationship extraction (extractor.rs, ibatis_loader.rs, java_loader.rs, java_method.rs, jsp_loader.rs, jsp_preprocessor.rs, fingerprint.rs) |
src/graph/ | Graph model: store.rs (GraphStore, indexes, dedup, merge), builder.rs, traverse.rs, lineage.rs, cluster.rs, columns.rs, conflict.rs, key.rs; query/ (QuerySpec engine), search/ (fuzzy + SQL search) |
src/export/ | dot.rs, json.rs, mermaid.rs, ndjson.rs |
src/import/ | CGEF document model, parser, validator, custom schema registry, path prefix mapper |
src/server/ | axum router, handlers, state, embedded UI assets, access log (serve) |
src/mcp/ | MCP server entry and tool definitions (mcp) |
src/tui/ | Terminal UI app, theme (tui) |
src/project/ | codeweb.toml loading and project lifecycle |
locales/ | rust-i18n catalogs at the repository root (en, zh-CN) |
Extension points
- New source language: add a loader under
src/parser/that emits relationships as(caller, callee, Edge)triples, then feed them to the graph builder — the JSP loader is the worked example (it preprocesses to synthetic Java and reuses the Java extraction). - External graphs: produce CGEF JSON from any tool and
codeweb importit; custom node and edge types become first-classcustomnodes andCustomEdgeedges. - Automation: drive the same store from scripts via the REST API, the MCP tools, or
codeweb querywith JSON specs.
Known limitations
- Dynamic SQL (
EXECUTE IMMEDIATEwith a non-literal string) becomes aDynamicCalledge to anunresnode; codeweb resolves what is statically visible and marks the rest as unresolved rather than guessing. - JSP extraction reuses the Java SQL keyword gate, so JDBC escape calls such as
{call pkg.x(...)}in scriptlets are filtered out today; direct stored-procedure calls from JSP need a follow-up post-processor. - The openGauss/GaussDB parser accepts the target dialect; other vendor dialects may parse partially or fail.
- codeweb analyzes static source only: runtime configuration, reflection-based dispatch, and dynamically assembled SQL appear only to the extent they are literal in the code.
11 - Contributing
Repository layout
codeweb is a single Rust crate with feature-gated surfaces (cli, tui, serve, mcp, jsp, java, analyze, search-sql-v2; full combines them). There is no workspace: check which module and feature your change touches first. SQL parsing lives in the separate ogsql-parser crate.
Test discipline
The repository follows test-driven development, one behavior per loop:
- Red — write a failing behavior test first. A compile error from a not-yet-existing API counts as red.
- Green — write the minimal implementation that passes; do not widen assertions to get there.
- Refactor — only with the tests green, scoped to the change path.
Rules that reviewers enforce:
- Never delete, skip, or weaken existing tests to make changes pass.
- Test names describe behavior (
should_reject_negative_amount). - Characterization tests lock current behavior of legacy paths before changing them.
- Fix the implementation when your change breaks an existing test, unless the human who wrote it says otherwise.
Pre-commit gates
Match CI exactly:
cargo build --features fullmust compile whenever a change can affect feature-gated code (new enum variants matched in other features, for example).- The skipped tests are environment-dependent in CI by design; a bare
cargo test --features fullfailing ontest_serve_*locally is a known limitation, so confirm your change did not make it worse.
Submitting changes
- Create a feature branch from
main. - Commit with the gates green.
- Push and open a pull request.
- A maintainer reviews and merges; contributors do not merge their own pull requests.