opencode-codebase-index 0.11.0 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +16 -0
- package/.claude-plugin/plugin.json +29 -0
- package/.codex-plugin/plugin.json +43 -0
- package/.mcp.json +8 -0
- package/README.md +143 -4
- package/commands/call-graph.md +9 -5
- package/commands/pr-impact.md +23 -0
- package/commands/visualize.md +30 -0
- package/dist/cli.cjs +4449 -700
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +4439 -704
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +9512 -7957
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +8029 -6474
- package/dist/index.js.map +1 -1
- package/dist/pi-extension.cjs +9594 -0
- package/dist/pi-extension.cjs.map +1 -0
- package/dist/pi-extension.js +9586 -0
- package/dist/pi-extension.js.map +1 -0
- package/hooks/hooks.json +17 -0
- package/native/codebase-index-native.darwin-arm64.node +0 -0
- package/native/codebase-index-native.darwin-x64.node +0 -0
- package/native/codebase-index-native.linux-arm64-gnu.node +0 -0
- package/native/codebase-index-native.linux-x64-gnu.node +0 -0
- package/native/codebase-index-native.win32-x64-msvc.node +0 -0
- package/package.json +29 -15
- package/skill/SKILL.md +6 -3
- package/skills/codebase-search/SKILL.md +41 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "helweg-plugins",
|
|
3
|
+
"owner": {
|
|
4
|
+
"name": "Kenneth",
|
|
5
|
+
"email": "kenneth@example.com",
|
|
6
|
+
"url": "https://github.com/Helweg/opencode-codebase-index"
|
|
7
|
+
},
|
|
8
|
+
"plugins": [
|
|
9
|
+
{
|
|
10
|
+
"name": "codebase-index",
|
|
11
|
+
"description": "Semantic code search and codebase graph tools for Claude Code",
|
|
12
|
+
"source": "./",
|
|
13
|
+
"version": "0.12.0"
|
|
14
|
+
}
|
|
15
|
+
]
|
|
16
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "codebase-index",
|
|
3
|
+
"version": "0.13.0",
|
|
4
|
+
"description": "Semantic code search and codebase graph tools for Claude Code",
|
|
5
|
+
"displayName": "Codebase Index",
|
|
6
|
+
"author": {
|
|
7
|
+
"name": "Kenneth",
|
|
8
|
+
"email": "kenneth@example.com",
|
|
9
|
+
"url": "https://github.com/Helweg/opencode-codebase-index"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/Helweg/opencode-codebase-index",
|
|
12
|
+
"repository": "https://github.com/Helweg/opencode-codebase-index",
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"keywords": [
|
|
15
|
+
"codebase-index",
|
|
16
|
+
"semantic search",
|
|
17
|
+
"claude",
|
|
18
|
+
"claude-code",
|
|
19
|
+
"mcp"
|
|
20
|
+
],
|
|
21
|
+
"skills": "./skills/",
|
|
22
|
+
"hooks": "./hooks/hooks.json",
|
|
23
|
+
"mcpServers": {
|
|
24
|
+
"codebase-index": {
|
|
25
|
+
"command": "npx",
|
|
26
|
+
"args": ["-y", "--package", "opencode-codebase-index", "opencode-codebase-index-mcp", "--host", "claude"]
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "codebase-index",
|
|
3
|
+
"version": "0.13.0",
|
|
4
|
+
"description": "Semantic code search and codebase graph tools for Codex",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "Kenneth",
|
|
7
|
+
"email": "kenneth@example.com",
|
|
8
|
+
"url": "https://github.com/Helweg/opencode-codebase-index"
|
|
9
|
+
},
|
|
10
|
+
"homepage": "https://github.com/Helweg/opencode-codebase-index",
|
|
11
|
+
"repository": "https://github.com/Helweg/opencode-codebase-index",
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"keywords": [
|
|
14
|
+
"codebase-index",
|
|
15
|
+
"semantic search",
|
|
16
|
+
"opencode",
|
|
17
|
+
"codex",
|
|
18
|
+
"mcp"
|
|
19
|
+
],
|
|
20
|
+
"skills": "./skills/",
|
|
21
|
+
"hooks": "./hooks/hooks.json",
|
|
22
|
+
"id": "codebase-index",
|
|
23
|
+
"mcpServers": "./.mcp.json",
|
|
24
|
+
"interface": {
|
|
25
|
+
"displayName": "Codebase Index",
|
|
26
|
+
"shortDescription": "Navigate large codebases with semantic search and graph tools",
|
|
27
|
+
"longDescription": "Install this plugin to get semantic search tools in Codex. The skill layer gives usage guidance, and MCP tools provide searchable context for large repos.",
|
|
28
|
+
"developerName": "Kenneth",
|
|
29
|
+
"category": "Productivity",
|
|
30
|
+
"capabilities": [
|
|
31
|
+
"Instructions",
|
|
32
|
+
"MCP Tools",
|
|
33
|
+
"Search"
|
|
34
|
+
],
|
|
35
|
+
"websiteURL": "https://github.com/Helweg/opencode-codebase-index",
|
|
36
|
+
"privacyPolicyURL": "https://github.com/Helweg/opencode-codebase-index/blob/main/SECURITY.md",
|
|
37
|
+
"termsOfServiceURL": "https://github.com/Helweg/opencode-codebase-index/blob/main/LICENSE",
|
|
38
|
+
"brandColor": "#3B82F6",
|
|
39
|
+
"defaultPrompt": [
|
|
40
|
+
"Use codebase-search skills and MCP tools to find local implementation context before edits."
|
|
41
|
+
]
|
|
42
|
+
}
|
|
43
|
+
}
|
package/.mcp.json
ADDED
package/README.md
CHANGED
|
@@ -8,13 +8,17 @@
|
|
|
8
8
|
|
|
9
9
|
> **Stop grepping for concepts. Start searching for meaning.**
|
|
10
10
|
|
|
11
|
-
**opencode-codebase-index** brings semantic understanding to your [OpenCode](https://opencode.ai)
|
|
11
|
+
**opencode-codebase-index** brings semantic understanding to your [OpenCode](https://opencode.ai), [Pi](https://pi.dev), Codex, and MCP-compatible workflows. Instead of guessing function names or grepping for keywords, ask your codebase questions in plain English.
|
|
12
12
|
|
|
13
13
|
## 📌 Quick Navigation
|
|
14
14
|
|
|
15
15
|
- [⚡ Quick Start](#-quick-start)
|
|
16
|
+
- [🥧 Pi Package](#-pi-package)
|
|
17
|
+
- [🧩 Codex Plugin](#-codex-plugin)
|
|
18
|
+
- [🧩 Claude Code Plugin](#-claude-code-plugin)
|
|
16
19
|
- [🌐 MCP Server (Cursor, Claude Code, Windsurf, etc.)](#-mcp-server-cursor-claude-code-windsurf-etc)
|
|
17
20
|
- [🎯 When to Use What](#-when-to-use-what)
|
|
21
|
+
- [🧭 OMO CodeGraph Compatibility](#-omo-codegraph-compatibility)
|
|
18
22
|
- [🧰 Tools Available](#-tools-available)
|
|
19
23
|
- [🎮 Slash Commands](#-slash-commands)
|
|
20
24
|
- [📚 Knowledge Base](#-knowledge-base)
|
|
@@ -25,6 +29,7 @@
|
|
|
25
29
|
## 👋 Choose Your Path
|
|
26
30
|
|
|
27
31
|
- **I want to try it now** → go to [Quick Start](#-quick-start)
|
|
32
|
+
- **I use Pi** → go to [Pi Package](#-pi-package)
|
|
28
33
|
- **I use Cursor/Claude Code/Windsurf** → go to [MCP Server setup](#-mcp-server-cursor-claude-code-windsurf-etc)
|
|
29
34
|
- **I’m comparing tools and workflows** → go to [When to Use What](#-when-to-use-what)
|
|
30
35
|
- **I’m tuning behavior/cost/performance** → go to [Configuration](#️-configuration)
|
|
@@ -37,6 +42,7 @@
|
|
|
37
42
|
- 🌿 **Branch-Aware**: Seamlessly handles git branch switches — reuses embeddings, filters stale results.
|
|
38
43
|
- 🔒 **Privacy Focused**: Your vector index is stored locally in your project.
|
|
39
44
|
- 🔌 **Model Agnostic**: Works out-of-the-box with GitHub Copilot, OpenAI, Gemini, or local Ollama models.
|
|
45
|
+
- 🥧 **Pi Package**: First-class Pi extension and skill package with native tools.
|
|
40
46
|
- 🌐 **MCP Server**: Use with Cursor, Claude Code, Windsurf, or any MCP-compatible client — index once, search from anywhere.
|
|
41
47
|
|
|
42
48
|
## ⚡ Quick Start
|
|
@@ -61,6 +67,57 @@
|
|
|
61
67
|
4. **Start Searching**
|
|
62
68
|
Ask:
|
|
63
69
|
> "Find the function that handles credit card validation errors"
|
|
70
|
+
## 🥧 Pi Package
|
|
71
|
+
|
|
72
|
+
Install as a Pi package to get first-class `codebase_search`, `index_codebase`, call graph, PR impact, and knowledge-base tools plus the `codebase-search` skill.
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
pi install npm:opencode-codebase-index
|
|
76
|
+
# or, for local development:
|
|
77
|
+
pi install ./path/to/opencode-codebase-index
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Pi uses the neutral `.codebase-index/` project storage and falls back to existing OpenCode state when present.
|
|
81
|
+
|
|
82
|
+
## 🧩 Codex Plugin
|
|
83
|
+
Install once for Codex threads and get skill guidance plus MCP tools in one manifest.
|
|
84
|
+
|
|
85
|
+
1. **Add this repo as a marketplace source**
|
|
86
|
+
```bash
|
|
87
|
+
codex plugin marketplace add Helweg/opencode-codebase-index
|
|
88
|
+
```
|
|
89
|
+
2. **Install the plugin**
|
|
90
|
+
```bash
|
|
91
|
+
codex plugin add codebase-index@helweg-plugins
|
|
92
|
+
```
|
|
93
|
+
3. **Restart or open a new thread** in the target workspace.
|
|
94
|
+
4. Use MCP tools (`index_codebase`, `index_status`, `codebase_search`, etc.) and the `codebase-search` skill guidance.
|
|
95
|
+
|
|
96
|
+
The plugin includes:
|
|
97
|
+
- `skills/` guidance for local workflows
|
|
98
|
+
- `hooks/hooks.json` lightweight session-start guidance
|
|
99
|
+
- `.mcp.json` running the published `opencode-codebase-index` CLI via `npx … --host codex`, so a git marketplace install works without a local build
|
|
100
|
+
- `.agents/plugins/marketplace.json` so this repo can act as a Codex marketplace source
|
|
101
|
+
|
|
102
|
+
## 🧩 Claude Code Plugin
|
|
103
|
+
Install once for Claude Code sessions and get skill guidance plus MCP tools in one manifest.
|
|
104
|
+
|
|
105
|
+
1. **Add this repo as a marketplace source**
|
|
106
|
+
```bash
|
|
107
|
+
/plugin marketplace add Helweg/opencode-codebase-index
|
|
108
|
+
```
|
|
109
|
+
2. **Install the plugin**
|
|
110
|
+
```bash
|
|
111
|
+
/plugin install codebase-index@helweg-plugins
|
|
112
|
+
```
|
|
113
|
+
3. **Restart or open a new session** in the target workspace.
|
|
114
|
+
4. Use MCP tools (`index_codebase`, `index_status`, `codebase_search`, etc.) and the `codebase-search` skill guidance.
|
|
115
|
+
|
|
116
|
+
The plugin includes:
|
|
117
|
+
- `skills/` guidance for local workflows
|
|
118
|
+
- `hooks/hooks.json` lightweight session-start guidance
|
|
119
|
+
- inline `mcpServers` (in `.claude-plugin/plugin.json`) running the published `opencode-codebase-index` CLI via `npx … --host claude`, so a git marketplace install works without a local build
|
|
120
|
+
- `.claude-plugin/marketplace.json` so this repo can act as a Claude Code marketplace source
|
|
64
121
|
|
|
65
122
|
### Provider selection notes
|
|
66
123
|
|
|
@@ -124,7 +181,7 @@ Use the same semantic search from any MCP-compatible client. Index once, search
|
|
|
124
181
|
npx opencode-codebase-index-mcp # uses current directory
|
|
125
182
|
```
|
|
126
183
|
|
|
127
|
-
The MCP server exposes all
|
|
184
|
+
The MCP server exposes all 12 tools (`codebase_search`, `codebase_peek`, `find_similar`, `implementation_lookup`, `call_graph`, `call_graph_path`, `pr_impact`, `index_codebase`, `index_status`, `index_health_check`, `index_metrics`, `index_logs`) and 5 prompts (`search`, `find`, `definition`, `index`, `status`).
|
|
128
185
|
|
|
129
186
|
The MCP dependencies (`@modelcontextprotocol/sdk`, `zod`) are optional peer dependencies — they're only needed if you use the MCP server.
|
|
130
187
|
|
|
@@ -156,12 +213,35 @@ src/api/checkout.ts:89 (Route handler for /pay)
|
|
|
156
213
|
| Just need to find locations | `codebase_peek` | Returns metadata only, saves ~90% tokens |
|
|
157
214
|
| Need the authoritative definition site | `implementation_lookup` | Prioritizes real implementation definitions over docs/tests |
|
|
158
215
|
| Understand code flow | `call_graph` | Find callers/callees of any function |
|
|
216
|
+
| Trace dependency paths | `call_graph_path` | Find the shortest known call path between two symbols |
|
|
159
217
|
| Know exact identifier | `grep` | Faster, finds all occurrences |
|
|
160
218
|
| Need ALL matches | `grep` | Semantic returns top N only |
|
|
161
219
|
| Mixed discovery + precision | `/find` (hybrid) | Best of both worlds |
|
|
162
220
|
|
|
163
221
|
**Rule of thumb**: `codebase_peek` to find locations → `Read` to examine → `grep` for precision. For symbol-definition questions, use `implementation_lookup` first.
|
|
164
222
|
|
|
223
|
+
## 🧭 OMO CodeGraph Compatibility
|
|
224
|
+
|
|
225
|
+
Recent OMO releases include a built-in CodeGraph MCP and make it part of the default agent workflow. This does **not** replace `opencode-codebase-index`; the two tools answer different first questions.
|
|
226
|
+
|
|
227
|
+
| Need | Prefer | Why |
|
|
228
|
+
|------|--------|-----|
|
|
229
|
+
| Find code by intent, behavior, or natural language | `codebase_peek` / `codebase_search` | Semantic + hybrid retrieval works when you do not know exact names |
|
|
230
|
+
| Jump to the likely implementation site | `implementation_lookup` | Definition-oriented ranking prefers source over tests/docs |
|
|
231
|
+
| Find similar implementations or duplicate patterns | `find_similar` | Embedding similarity compares code shape and meaning |
|
|
232
|
+
| Follow callers, callees, imports, inheritance, or implementations | OMO CodeGraph or `call_graph` | Structural graph tools are best for dependency topology |
|
|
233
|
+
| Find a shortest known relationship chain | `call_graph_path` | Uses this plugin's indexed call edges to connect two symbols |
|
|
234
|
+
| Include external docs, examples, or API references in discovery | `add_knowledge_base` + `codebase_search` | Knowledge bases are indexed into the same retrieval store |
|
|
235
|
+
|
|
236
|
+
Recommended OMO workflow:
|
|
237
|
+
|
|
238
|
+
1. Start broad with `codebase_peek` when the prompt is conceptual, such as "where is auth enforced?" or "payment validation flow".
|
|
239
|
+
2. Use `implementation_lookup` once you have a symbol or concept that should resolve to a definition.
|
|
240
|
+
3. Use OMO CodeGraph, `call_graph`, or `call_graph_path` after locating the relevant symbol to check blast radius and dependency flow.
|
|
241
|
+
4. Keep `grep` for exact identifiers and exhaustive text matches.
|
|
242
|
+
|
|
243
|
+
If OMO reports an uninitialized CodeGraph workspace, follow its `codegraph init` guidance. That setup is independent from this plugin's index under `.opencode/index/`, so `/index` and `codegraph init` may both be useful in the same repository.
|
|
244
|
+
|
|
165
245
|
## 📊 Token Usage
|
|
166
246
|
|
|
167
247
|
In our testing across open-source codebases (axios, express), we observed **up to 90% reduction in token usage** for conceptual queries like *"find the error handling middleware"*.
|
|
@@ -363,9 +443,43 @@ Returns recent debug logs with optional filtering.
|
|
|
363
443
|
Query the call graph to find callers or callees of a function/method. Automatically built during indexing for TypeScript, JavaScript, Python, Go, Rust, PHP, Apex, Zig, GDScript, and MATLAB.
|
|
364
444
|
|
|
365
445
|
- **Use for**: Understanding code flow, tracing dependencies, impact analysis.
|
|
366
|
-
- **Parameters**: `name` (function name), `direction` (`callers` or `callees`), `symbolId` (required for `callees`, returned by previous queries).
|
|
446
|
+
- **Parameters**: `name` (function name), `direction` (`callers` or `callees`), `symbolId` (required for `callees`, returned by previous queries), `relationshipType` (optional: `Call`, `MethodCall`, `Constructor`, `Import`, `Inherits`, `Implements`).
|
|
367
447
|
- **Example**: Find who calls `validateToken` → `call_graph(name="validateToken", direction="callers")`
|
|
368
448
|
|
|
449
|
+
### `call_graph_path`
|
|
450
|
+
|
|
451
|
+
Find the shortest known call-graph path between two symbols. Use it after `codebase_peek`, `implementation_lookup`, or `call_graph` identifies the important source and target names.
|
|
452
|
+
|
|
453
|
+
- **Use for**: Blast-radius checks, dependency-chain discovery, explaining how one subsystem reaches another.
|
|
454
|
+
- **Parameters**: `from` (source symbol name), `to` (target symbol name), `maxDepth` (optional, default `10`).
|
|
455
|
+
- **Example**: Trace how `createOrder` reaches `chargeCard` → `call_graph_path(from="createOrder", to="chargeCard")`
|
|
456
|
+
|
|
457
|
+
### `pr_impact`
|
|
458
|
+
Analyzes a PR's changed files to determine impact scope within the codebase.
|
|
459
|
+
- **Use for**: Understanding which symbols are affected by a PR, their call-graph reach, risk level, and community/cluster detection.
|
|
460
|
+
- **Parameters**: `checkConflicts` (optional, default `false`) — when `true`, detects overlapping concurrent PRs sharing affected symbols and returns `conflictingPRs`.
|
|
461
|
+
|
|
462
|
+
### `index_visualize`
|
|
463
|
+
Generate a self-contained temporal call graph view for browser-based exploration.
|
|
464
|
+
|
|
465
|
+
- **Use for**: Onboarding, architecture walkthroughs, and understanding what moved recently before drilling into call relationships.
|
|
466
|
+
- **What it shows**: Recent change lenses, module overview, symbol exploration, hotspots, and cycles.
|
|
467
|
+
- **Concepts**: Modules are path-based code areas such as `src/tools` or `native`; symbols are indexed functions, classes, methods, or similar named code units; edges are caller/callee relationships.
|
|
468
|
+
- **Parameters**: `directory` (optional folder filter), `maxNodes` (default `5000`), `includeOrphans` (include disconnected symbols).
|
|
469
|
+
- **Output**: Writes a temporary HTML file you can open in any browser.
|
|
470
|
+
- **Example**: `index_visualize(directory="src/tools", maxNodes=1500)`
|
|
471
|
+
|
|
472
|
+
CLI shortcut after building locally:
|
|
473
|
+
|
|
474
|
+
```bash
|
|
475
|
+
npm run build
|
|
476
|
+
npm run visualize
|
|
477
|
+
npm run visualize -- native
|
|
478
|
+
npm run visualize -- src/tools max=1000
|
|
479
|
+
npm run visualize -- src/indexer orphans
|
|
480
|
+
```
|
|
481
|
+
|
|
482
|
+
|
|
369
483
|
### `add_knowledge_base`
|
|
370
484
|
Add a folder as a knowledge base to be indexed alongside project code.
|
|
371
485
|
- **Use for**: Indexing external documentation, API references, example programs.
|
|
@@ -393,6 +507,8 @@ The plugin automatically registers these slash commands:
|
|
|
393
507
|
| `/search <query>` | **Pure Semantic Search**. Best for "How does X work?" |
|
|
394
508
|
| `/find <query>` | **Hybrid Search**. Combines semantic search + grep. Best for "Find usage of X". |
|
|
395
509
|
| `/call-graph <query>` | **Call Graph Trace**. Find callers/callees to understand execution flow. |
|
|
510
|
+
| `/pr-impact <PR number or branch>` | **PR Impact Analysis**. Analyze changed files, affected symbols, communities, hub nodes, and risk. |
|
|
511
|
+
| `/visualize [directory|max=N|orphans]` | **Temporal Call Graph Visualization**. Open recent changes, module overview, symbol exploration, hotspots, and cycles in a browser-ready HTML file. |
|
|
396
512
|
| `/index` | **Update Index**. Runs incremental indexing by default; use `/index force` for a full rebuild. |
|
|
397
513
|
| `/status` | **Check Status**. Shows if indexed, chunk count, and provider info. |
|
|
398
514
|
|
|
@@ -507,6 +623,27 @@ Any OpenAI-compatible reranking endpoint. Examples:
|
|
|
507
623
|
|
|
508
624
|
## ⚙️ Configuration
|
|
509
625
|
|
|
626
|
+
### Storage Paths (OpenCode + Codex + Claude + Pi)
|
|
627
|
+
OpenCode default (existing behavior):
|
|
628
|
+
- project config: `.opencode/codebase-index.json`
|
|
629
|
+
- project index: `.opencode/index`
|
|
630
|
+
- global config: `~/.config/opencode/codebase-index.json`
|
|
631
|
+
- global index: `~/.opencode/global-index`
|
|
632
|
+
|
|
633
|
+
Codex/Pi host mode (neutral default):
|
|
634
|
+
- project config: `.codebase-index/config.json`
|
|
635
|
+
- project index: `.codebase-index/index`
|
|
636
|
+
- global config: `~/.config/codebase-index/config.json`
|
|
637
|
+
- global index: `~/.codebase-index/global-index`
|
|
638
|
+
|
|
639
|
+
Claude Code host mode (`--host claude`):
|
|
640
|
+
- project config: `.claude/codebase-index.json`
|
|
641
|
+
- project index: `.claude/index`
|
|
642
|
+
- global config: `~/.claude/codebase-index.json`
|
|
643
|
+
- global index: `~/.claude/global-index`
|
|
644
|
+
|
|
645
|
+
Codex, Claude Code, and Pi read legacy OpenCode paths when host-native paths are absent, so existing state continues to work.
|
|
646
|
+
|
|
510
647
|
Zero-config by default (uses `auto` mode). Customize in `.opencode/codebase-index.json`:
|
|
511
648
|
|
|
512
649
|
### Full Configuration Example
|
|
@@ -576,6 +713,7 @@ Zero-config by default (uses `auto` mode). Customize in `.opencode/codebase-inde
|
|
|
576
713
|
"rerankTopN": 20, // Deterministic rerank depth
|
|
577
714
|
"contextLines": 0, // Extra lines before/after match
|
|
578
715
|
"routingHints": true, // Runtime nudges for local discovery/definition queries
|
|
716
|
+
"routingGraphHandoffHints": false, // Add opt-in graph/OMO CodeGraph handoff wording
|
|
579
717
|
"routingHintRole": "system" // system | developer (message role used for hints)
|
|
580
718
|
},
|
|
581
719
|
"reranker": {
|
|
@@ -647,6 +785,7 @@ String values in `codebase-index.json` can reference environment variables with
|
|
|
647
785
|
| `rerankTopN` | `20` | Deterministic rerank depth cap. Applies lightweight name/path/chunk-type rerank to top-N only |
|
|
648
786
|
| `contextLines` | `0` | Extra lines to include before/after each match |
|
|
649
787
|
| `routingHints` | `true` | Inject lightweight runtime hints for local conceptual discovery and definition lookups. Set to `false` to disable plugin-side routing nudges. |
|
|
788
|
+
| `routingGraphHandoffHints` | `false` | When `true`, conceptual discovery hints also say to use graph tools (including OMO CodeGraph) after semantic discovery identifies relevant symbols. |
|
|
650
789
|
| `routingHintRole` | `"system"` | Message role used when injecting routing hints: `"system"` (default) or `"developer"`. |
|
|
651
790
|
| **reranker** | | Optional second-stage model reranker for the top candidate pool |
|
|
652
791
|
| `enabled` | `false` | Turn external reranking on/off |
|
|
@@ -678,7 +817,7 @@ These warnings improve observability but do **not** change the recovery behavior
|
|
|
678
817
|
### Retrieval ranking behavior
|
|
679
818
|
|
|
680
819
|
- `codebase_search` and `codebase_peek` use the hybrid path: semantic + keyword retrieval → fusion (`fusionStrategy`) → deterministic rerank (`rerankTopN`) → optional external reranker (`reranker`) → filtering.
|
|
681
|
-
- When `search.routingHints` is enabled (default), the plugin adds tiny per-turn runtime hints for local conceptual discovery and definition queries. Conceptual discovery is nudged toward `codebase_peek` / `codebase_search`, while definition questions are nudged toward `implementation_lookup`. Exact identifier and unrelated operational tasks are left alone. Set `search.routingHintRole` to `"developer"` if your client/runtime expects developer-role guidance instead of system-role guidance.
|
|
820
|
+
- When `search.routingHints` is enabled (default), the plugin adds tiny per-turn runtime hints for local conceptual discovery and definition queries. Conceptual discovery is nudged toward `codebase_peek` / `codebase_search`, while definition questions are nudged toward `implementation_lookup`. Exact identifier and unrelated operational tasks are left alone. Set `search.routingGraphHandoffHints` to `true` to add opt-in graph/OMO CodeGraph handoff wording, and set `search.routingHintRole` to `"developer"` if your client/runtime expects developer-role guidance instead of system-role guidance.
|
|
682
821
|
- `find_similar` stays semantic-only: semantic retrieval + deterministic rerank only (no keyword retrieval, no RRF).
|
|
683
822
|
- For compatibility rollbacks, set `search.fusionStrategy` to `"weighted"` to use the legacy weighted fusion path.
|
|
684
823
|
- When enabled, the external reranker sees path metadata plus a bounded on-disk code snippet for each candidate so it can distinguish real implementations from docs/tests more reliably.
|
package/commands/call-graph.md
CHANGED
|
@@ -1,24 +1,28 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: Trace callers or
|
|
2
|
+
description: Trace callers, callees, or paths using the call graph
|
|
3
3
|
---
|
|
4
4
|
|
|
5
|
-
Trace function dependencies using the `call_graph`
|
|
5
|
+
Trace function dependencies using the `call_graph` and `call_graph_path` tools.
|
|
6
6
|
|
|
7
7
|
User input: $ARGUMENTS
|
|
8
8
|
|
|
9
9
|
Interpret input as follows:
|
|
10
|
+
- If input asks for a path, connection, route, chain, or "from X to Y", use `call_graph_path`.
|
|
10
11
|
- Default to `direction="callers"` unless input asks for callees/calls/makes calls.
|
|
11
12
|
- `name=<function>` or plain text function name sets `name`.
|
|
12
13
|
- `symbolId=<id>` is required for `direction="callees"`.
|
|
14
|
+
- For path queries, parse `from=<function>`, `to=<function>`, and optional `maxDepth=<number>`.
|
|
13
15
|
|
|
14
16
|
Execution flow:
|
|
15
|
-
1. If
|
|
16
|
-
2. If direction is `
|
|
17
|
-
3. If direction is `callees` and `symbolId` is
|
|
17
|
+
1. If input asks for a path and has source/target names, call `call_graph_path` with `{ from, to, maxDepth? }`.
|
|
18
|
+
2. If direction is `callers`, call `call_graph` with `{ name, direction: "callers" }`.
|
|
19
|
+
3. If direction is `callees` and `symbolId` is present, call `call_graph` with `{ name, direction: "callees", symbolId }`.
|
|
20
|
+
4. If direction is `callees` and `symbolId` is missing, first call `call_graph` with `direction="callers"` to get symbol IDs, then ask the user to choose one if multiple are returned.
|
|
18
21
|
|
|
19
22
|
Examples:
|
|
20
23
|
- `/call-graph Database` → callers for `Database`
|
|
21
24
|
- `/call-graph callers name=Indexer` → callers for `Indexer`
|
|
22
25
|
- `/call-graph callees name=Database symbolId=sym_abc123` → callees for selected symbol
|
|
26
|
+
- `/call-graph path from=createOrder to=chargeCard` → shortest known path between the two symbols
|
|
23
27
|
|
|
24
28
|
If output says no callers found, suggest running `/index force` first.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Analyze PR or branch impact using the call graph
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Analyze the impact of a pull request or branch before merging.
|
|
6
|
+
|
|
7
|
+
User input: $ARGUMENTS
|
|
8
|
+
|
|
9
|
+
Interpret input as follows:
|
|
10
|
+
- `pr=N` or plain number at the start → set `pr`
|
|
11
|
+
- `branch=<name>` or plain branch name → set `branch`
|
|
12
|
+
- `maxDepth=N` → set max traversal depth
|
|
13
|
+
- `hubThreshold=N` → set hub node threshold
|
|
14
|
+
- `checkConflicts` or `conflicts` → set `checkConflicts=true`
|
|
15
|
+
|
|
16
|
+
Call `pr_impact` with the parsed arguments.
|
|
17
|
+
|
|
18
|
+
Examples:
|
|
19
|
+
- `/pr-impact 42` → pr=42
|
|
20
|
+
- `/pr-impact branch=feature/auth` → branch="feature/auth"
|
|
21
|
+
- `/pr-impact branch=feature/x maxDepth=3 checkConflicts` → branch="feature/x", maxDepth=3, checkConflicts=true
|
|
22
|
+
|
|
23
|
+
If the index doesn't exist, run `index_codebase` first.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Generate temporal HTML call graph visualization
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Generate an interactive temporal call graph visualization that starts with recent movement/onboarding context, then supports module overview, symbol exploration, hotspots, and cycles.
|
|
6
|
+
|
|
7
|
+
User input: $ARGUMENTS
|
|
8
|
+
|
|
9
|
+
Parse input for optional parameters:
|
|
10
|
+
- Plain text → directory filter (e.g., `/visualize src/services`)
|
|
11
|
+
- `max=N` or "limit N" → sets maxNodes
|
|
12
|
+
- `orphans` or `include-orphans` → sets includeOrphans=true
|
|
13
|
+
- No input → visualize recent code movement plus entire call graph
|
|
14
|
+
|
|
15
|
+
Call `index_visualize` with parsed parameters.
|
|
16
|
+
|
|
17
|
+
Examples:
|
|
18
|
+
- `/visualize` → temporal onboarding view with changes, modules, symbols, hotspots, and cycles
|
|
19
|
+
- `/visualize src/tools` → only symbols in src/tools/
|
|
20
|
+
- `/visualize max=1000` → limit to 1000 nodes
|
|
21
|
+
- `/visualize src/indexer orphans` → include disconnected nodes
|
|
22
|
+
|
|
23
|
+
If the index doesn't exist, run `index_codebase` first.
|
|
24
|
+
|
|
25
|
+
Return the generated file path and open instructions.
|
|
26
|
+
|
|
27
|
+
Terminology:
|
|
28
|
+
- Modules are path-based code areas, such as `src/tools` or `native`.
|
|
29
|
+
- Symbols are indexed named code units, such as functions, methods, classes, or Rust modules.
|
|
30
|
+
- Cycles are loops where code can eventually call or depend back on itself.
|