codeintel-cli
Original:🇨🇳 Chinese
Translated
Use the codeintel command-line tool: intelligent indexing and field trace query for Go codebases. Features include building indexes (init), querying symbol/field read-write summaries (query fields), field tracing (trace-backward/forward), full-chain data value tracing (value-trace), call relationship analysis (callers/callees/impact), export (export), and Web service (serve). This skill is used when users request to analyze field data flows in Go codebases, trace field users/producers, check function field read-write operations, or query call relationships.
7installs
Sourceschaepher/codeintel
Added on
NPX Install
npx skill4agent add schaepher/codeintel codeintel-cliTags
Translated version includes tags in frontmatterSKILL.md Content (Chinese)
View Translation Comparison →codeintel CLI User Guide
codeintel is an intelligent indexing tool for Go codebases (SSA field tracing), with output stored in SQLite (). Repository module: .
.codeintel/codeintel.dbgithub.com/schaepher/codeintelBuild and Installation
bash
# Build within the codeintel repository
go build -o codeintel ./cmd/codeintel
# Or install to GOBIN
make installCommand Quick Reference
bash
codeintel init --repo <path> # Full index build (requires go.mod; will prompt to enter module directory at go.work root)
codeintel update --repo <path> # Incremental update (git detects changed files, full analysis + incremental write)
codeintel serve --repo <path> --addr :8096 # Start graph exploration Web service (frontend AntV G6, default port :8090)
codeintel query <sub> ... --repo <path> # Query (see below; all subcommands support --json / --compact)
codeintel export --repo <path> [--out x.json] # Export field double-layer index JSON (field → producer/consumer)
codeintel export graph --type value-trace|callees|lifecycle --target <node> [--format mermaid|dot] [--out file]
# Graph export: value-trace defaults to mermaid (function grouping), callees defaults to dot,
# lifecycle diagram ([storage]/[observation]/[read]/[write] + condition annotations)
codeintel clean --repo <path> --force # Delete index (must clean + init rebuild after schema changes)
codeintel versionquery Subcommands
| Subcommand | Purpose | Key Parameters |
|---|---|---|
| Symbol details (including callers/callees) | |
| Function field read-write summary (direct_read/write + indirect_write) | |
| Reverse trace of field production points | |
| Forward trace of subsequent field usage | |
| Full chain of data values (cross-function, grouped by function context) | |
| Callers/callees | |
| Impact analysis | |
| Cross-layer summary: main chain of entry → compute → write → consume (each step with file:line) | |
-
All query subcommands support(structured output) and
--json(no indentation)--compact -
Logs are written to(same directory as db), only query results are kept in stdout
.codeintel/codeintel.log -
accepts canonical ID (
<sym>, methodsymbol:go:<pkg>:<name>) or name (reports error and lists candidates if multiple matches)(T).m -
is a type-qualified path (e.g.,
<field>)example.com/app/internal/agent.Config.APIKey -
is a complete node ID (e.g.,
<nodeID>)symbol:go:...:(Manager).Run#m.cfg.APIKey.read@47
Real-world Examples
Take a Go repository (module , with the field of an LLM agent) as an example:
example.com/appm.cfg.APIKeybash
# 1. Build index (first time or after schema changes)
codeintel init --repo <target-repo>
# 2. Function field read-write summary (after verification, you can see [direct_read]/[direct_write]/[indirect_write] groups)
codeintel query fields "(Manager).Run" --repo <target-repo>
# 3. Forward trace of field users
codeintel query trace-forward example.com/app/internal/agent.Config.APIKey \
--func "(Manager).Run" --repo <target-repo>
# 4. Full chain of data values (cross-function): first query node ID, then trace
sqlite3 <target-repo>/.codeintel/codeintel.db \
"SELECT id FROM nodes WHERE kind='field_access' AND json_extract(properties,'\$.instance_path')='m.cfg.APIKey' LIMIT 1"
codeintel query value-trace "<ID obtained above>" --repo <target-repo>Output Interpretation
- fields summary: reads fields,
[direct_read]writes fields,[direct_write]writes indirectly via aliases/call closures (e.g.,[indirect_write]). The summary table deduplicates by field UNIQUE (only the first line is listed for multiple accesses to the same field), details are in graph nodesm.mu :55 m.mu.Lock() - value-trace: grouped by + indented tree,
【function name】production chain (reverse),←usage chain (forward), edge types (data_flows_to/argument/returns/phi_operand),→markers and line numbers[read]/[write] - Intermediate layers of read chains (e.g., inner layer of
m.cfg) are marked as read instead of write;m.cfg.APIKeyliteral initialization does not generate element nodes[]T{...} - Path conditions: trace lines may include (if/type branch/env, calculated during query)
[condition: ...] - Dynamic dispatch: symbol interface types show candidate implementations (/
[register 0.9]+ registration points)[enum 0.7] - Persistence: SQL writes are mapped to virtual nodes (field → table.column, visible via value-trace)
users.name - Global traceability: global variables share nodes across functions (), value-trace can reach initialization expressions
var.<name> - Cross-layer summary: outputs the main lifecycle chain (entry/compute/write/consume)
query summary <node>
Verification and Notes
- Change verification matrix: (unit),
make test(integration, requires scip-go),make it(22 playwright cases, port 8096, specify verification repository withmake e2e)E2E_REPO=<repo> - No automatic schema migration (user_version=2): after schema changes, verification repositories must run +
clean --forceto rebuild, otherwise version mismatch error will occurinit - Push to git after each modification and verification (user agreement)
- Logs: zap + OTel writes to (main rough parsing --repo passed to Setup); debug logs with --verbose are also in the file; stdout only contains query results
.codeintel/codeintel.log - Pitfall: will match its own command line and kill itself (use
pkill -f "codeintel-e2e serve"+ kill)pgrep -x codeintel-e2e - Index query has no network dependencies; build requires and optional
go(scip adapter degrades and skips if missing)scip-go