Skip to content

AidenGeunGeun/code-intel

Repository files navigation

code-intel

See relationships, not just strings.

GitHub Release npm version License Node.js CI

Structural code intelligence for AI agents and developers


Quick Install

npx @opencode/code-intel doctor
npm install -g @opencode/code-intel

Note

VOYAGE_API_KEY is optional. BM25 keyword search works without it.

What This Does

code-intel indexes your codebase into a local SQLite database, then answers structural questions: what calls what, what depends on what, which files changed the most, and how symbols connect across the project. grep and rg find text. code-intel finds relationships.

Intents

Intent What it does Example
overview Project structure snapshot with key symbols, pipelines, and hotspots code-intel overview src/services --dir .
search Hybrid BM25 + vector semantic search over indexed entities code-intel search "auth middleware" scope:src/api --dir .
context Deep analysis of a symbol or file: deps, impact, history, similar code code-intel context formatContext --dir .
refs Grouped cross-references with exact file:line locations code-intel refs openProjectDB scope:lib --dir .
trace Call-chain tracing in fan-out and shortest-path modes code-intel trace formatKeyPipelines --depth 4 --dir .
index Build or refresh the local index code-intel index --dir .
doctor Check runtime dependencies and configuration npx @opencode/code-intel doctor

Usage

JSON input is the preferred mode for agents:

code-intel '{"intent":"search","target":"auth middleware","dir":"."}'
code-intel '{"intent":"context","target":"resolveProjectDB","fresh":true,"dir":"."}'

Flag mode stays convenient for humans:

code-intel search "auth middleware" --dir .
code-intel trace formatKeyPipelines formatProjectOverview --dir .

Tip

code-intel also accepts JSON over stdin: printf '%s' '{"intent":"trace","from":"formatKeyPipelines","to":"formatProjectOverview","dir":"."}' | code-intel

Architecture

cli.ts -> query-engine.ts -> db.ts (SQLite + FTS5 + sqlite-vec)
                          -> indexer.ts -> ast-extractor.ts (tree-sitter)
                          -> embeddings.ts (Voyage AI vectors)

Supported Languages

TypeScript, JavaScript, TSX, JSX, Python, Go, and C/C++.

Embedding Providers

Voyage AI is the current embedding provider and uses VOYAGE_API_KEY. If the key is not set, code-intel falls back to BM25-only search. Support for OpenAI, Google, and local models is planned.

Agent Integration

An OpenCode / OCO skill file is included in this repo at skill/SKILL.md.

mkdir -p ~/.config/opencode/skill/code-intel
cp skill/SKILL.md ~/.config/opencode/skill/code-intel/SKILL.md

Tip

Keep the included skill file in sync with the npm package so agent installs and source installs behave the same way.

Build From Source

git clone https://github.com/AidenGeunGeun/code-intel.git
cd code-intel
npm install
npm run build
npm test

npm test currently runs 177 tests.

License

MIT. See LICENSE.

About

Structural codebase retrieval. Relationships, not strings.

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors