Skip to content

Trace and query

Trace call chains, inspect reachability, compute impact, search by SQL fragment, and run declarative JSON queries.

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.

codeweb trace "process_order"
codeweb trace "process_order" --style path     # flat path list instead of a tree
codeweb trace "t_order" --exact                # case-insensitive exact key match
codeweb trace "order.*insert" --regex          # regex over node keys
codeweb trace "calc" --all-matches             # every matching node
codeweb trace "calc" --fail-on-multiple        # refuse ambiguous matches
codeweb trace "trim" --builtfunc               # include built-in function calls (hidden by default)

Detail

codeweb detail <NAMES>... shows direct callers and callees per node, optionally with source context:

codeweb detail "calculate_total"
codeweb detail "calculate_total" --files          # list source files in the chain
codeweb detail "pkg_order" --summarize-tables     # aggregate R/W table access of a package
codeweb detail "v_order" --related-ddl            # include indexes, synonyms, triggers
codeweb detail "v_order" --verbose                # include DDL source text
codeweb detail "calculate_total" --depth -1       # unlimited traversal (default 1)

--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:

codeweb inspect "createOrder" "pkg_payment"
codeweb inspect "createOrder" "pkg_payment" --max-depth 15 --max-paths 10
codeweb inspect "createOrder" "pkg_payment" --style tree
codeweb inspect "createOrder" "pgl_unused" --unreachable   # also show pairs with 0 paths

Impact

codeweb impact answers “what is affected by this change” — per file or per node. The two target flags are mutually exclusive:

# Everything upstream and downstream of a file's nodes (JSON, integrates with git diff hooks)
codeweb impact --file src/main/java/com/example/OrderMapper.java --format json

# A single symbol
codeweb impact --node "proc_create_order" --format text

# Widen traversal and restrict edge categories
codeweb impact --node "orders" --depth 2 --edge-types call,dataflow

--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:

codeweb trace-sql "UPDATE inventory SET"
codeweb trace-sql --file fragment.sql     # read the fragment from a file (avoids shell quoting)
codeweb trace-sql - <<'EOF'
SELECT * FROM orders WHERE status = 'PENDING'
EOF

Deduplicate

codeweb dedup merges duplicate nodes and edges (for example a table seen both with and without DDL across phases):

codeweb dedup --dry-run          # preview only
codeweb dedup                    # in-place
codeweb dedup -o cleaned.bincode # write to a new store

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).

codeweb query --spec '{"start":{"type":"proc","name":"order"},"collect":"nodes"}'
codeweb query --file spec.json
FieldValuesMeaning
starttype, name, schemaStarting 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
collectnodes (default), paths, subgraphResult 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.