gitnexus 1.2.8 → 1.3.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/README.md +194 -186
- package/dist/cli/ai-context.js +71 -71
- package/dist/cli/analyze.js +69 -28
- package/dist/cli/index.js +20 -0
- package/dist/cli/setup.js +8 -1
- package/dist/cli/view.d.ts +13 -0
- package/dist/cli/view.js +59 -0
- package/dist/core/augmentation/engine.js +20 -20
- package/dist/core/embeddings/embedding-pipeline.js +26 -26
- package/dist/core/graph/graph.js +5 -0
- package/dist/core/graph/html-graph-viewer.d.ts +15 -0
- package/dist/core/graph/html-graph-viewer.js +542 -0
- package/dist/core/graph/html-graph-viewer.test.d.ts +1 -0
- package/dist/core/graph/html-graph-viewer.test.js +67 -0
- package/dist/core/graph/types.d.ts +12 -1
- package/dist/core/ingestion/call-processor.js +52 -32
- package/dist/core/ingestion/cluster-enricher.js +16 -16
- package/dist/core/ingestion/community-processor.js +75 -40
- package/dist/core/ingestion/filesystem-walker.d.ts +23 -0
- package/dist/core/ingestion/filesystem-walker.js +38 -3
- package/dist/core/ingestion/import-processor.d.ts +11 -3
- package/dist/core/ingestion/import-processor.js +27 -11
- package/dist/core/ingestion/parsing-processor.js +2 -4
- package/dist/core/ingestion/pipeline.js +142 -135
- package/dist/core/ingestion/process-processor.js +12 -11
- package/dist/core/ingestion/workers/parse-worker.js +67 -6
- package/dist/core/ingestion/workers/worker-pool.d.ts +3 -9
- package/dist/core/ingestion/workers/worker-pool.js +39 -18
- package/dist/core/kuzu/csv-generator.d.ts +15 -8
- package/dist/core/kuzu/csv-generator.js +258 -196
- package/dist/core/kuzu/kuzu-adapter.d.ts +1 -4
- package/dist/core/kuzu/kuzu-adapter.js +84 -72
- package/dist/core/kuzu/schema.d.ts +1 -1
- package/dist/core/kuzu/schema.js +266 -256
- package/dist/core/search/bm25-index.js +5 -5
- package/dist/core/search/hybrid-search.js +3 -3
- package/dist/core/wiki/graph-queries.js +52 -52
- package/dist/core/wiki/html-viewer.js +192 -192
- package/dist/core/wiki/prompts.js +82 -82
- package/dist/mcp/core/embedder.js +8 -4
- package/dist/mcp/local/local-backend.d.ts +6 -0
- package/dist/mcp/local/local-backend.js +224 -117
- package/dist/mcp/resources.js +42 -42
- package/dist/mcp/server.js +16 -16
- package/dist/mcp/tools.js +86 -77
- package/dist/server/api.d.ts +4 -2
- package/dist/server/api.js +253 -83
- package/dist/types/pipeline.d.ts +6 -2
- package/dist/types/pipeline.js +6 -4
- package/hooks/claude/gitnexus-hook.cjs +135 -135
- package/hooks/claude/pre-tool-use.sh +78 -78
- package/hooks/claude/session-start.sh +42 -42
- package/package.json +82 -82
- package/skills/debugging.md +85 -85
- package/skills/exploring.md +75 -75
- package/skills/impact-analysis.md +94 -94
- package/skills/refactoring.md +113 -113
- package/vendor/leiden/index.cjs +355 -355
- package/vendor/leiden/utils.cjs +392 -392
package/README.md
CHANGED
|
@@ -1,186 +1,194 @@
|
|
|
1
|
-
# GitNexus
|
|
2
|
-
|
|
3
|
-
**Graph-powered code intelligence for AI agents.** Index any codebase into a knowledge graph, then query it via MCP or CLI.
|
|
4
|
-
|
|
5
|
-
Works with **Cursor**, **Claude Code**, **Windsurf**, **Cline**, **OpenCode**, and any MCP-compatible tool.
|
|
6
|
-
|
|
7
|
-
[](https://www.npmjs.com/package/gitnexus)
|
|
8
|
-
[](https://polyformproject.org/licenses/noncommercial/1.0.0/)
|
|
9
|
-
|
|
10
|
-
---
|
|
11
|
-
|
|
12
|
-
## Why?
|
|
13
|
-
|
|
14
|
-
AI coding tools don't understand your codebase structure. They edit a function without knowing 47 other functions depend on it. GitNexus fixes this by **precomputing every dependency, call chain, and relationship** into a queryable graph.
|
|
15
|
-
|
|
16
|
-
**Three commands to give your AI agent full codebase awareness.**
|
|
17
|
-
|
|
18
|
-
## Quick Start
|
|
19
|
-
|
|
20
|
-
```bash
|
|
21
|
-
# Index your repo (run from repo root)
|
|
22
|
-
npx gitnexus analyze
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
That's it. This indexes the codebase, installs agent skills, registers Claude Code hooks, and creates `AGENTS.md` / `CLAUDE.md` context files — all in one command.
|
|
26
|
-
|
|
27
|
-
To configure MCP for your editor, run `npx gitnexus setup` once — or set it up manually below.
|
|
28
|
-
|
|
29
|
-
`gitnexus setup` auto-detects your editors and writes the correct global MCP config. You only need to run it once.
|
|
30
|
-
|
|
31
|
-
### Editor Support
|
|
32
|
-
|
|
33
|
-
| Editor | MCP | Skills | Hooks (auto-augment) | Support |
|
|
34
|
-
|--------|-----|--------|---------------------|---------|
|
|
35
|
-
| **Claude Code** | Yes | Yes | Yes (PreToolUse) | **Full** |
|
|
36
|
-
| **Cursor** | Yes | Yes | — | MCP + Skills |
|
|
37
|
-
| **Windsurf** | Yes | — | — | MCP |
|
|
38
|
-
| **OpenCode** | Yes | Yes | — | MCP + Skills |
|
|
39
|
-
|
|
40
|
-
> **Claude Code** gets the deepest integration: MCP tools + agent skills + PreToolUse hooks that automatically enrich grep/glob/bash calls with knowledge graph context.
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
###
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
|
106
|
-
|
|
107
|
-
| `
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
|
120
|
-
|
|
121
|
-
| `gitnexus://
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
|
126
|
-
|
|
127
|
-
| `
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
gitnexus
|
|
140
|
-
gitnexus
|
|
141
|
-
gitnexus
|
|
142
|
-
gitnexus
|
|
143
|
-
gitnexus
|
|
144
|
-
gitnexus
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
-
|
|
175
|
-
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
1
|
+
# GitNexus
|
|
2
|
+
|
|
3
|
+
**Graph-powered code intelligence for AI agents.** Index any codebase into a knowledge graph, then query it via MCP or CLI.
|
|
4
|
+
|
|
5
|
+
Works with **Cursor**, **Claude Code**, **Windsurf**, **Cline**, **OpenCode**, and any MCP-compatible tool.
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/gitnexus)
|
|
8
|
+
[](https://polyformproject.org/licenses/noncommercial/1.0.0/)
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Why?
|
|
13
|
+
|
|
14
|
+
AI coding tools don't understand your codebase structure. They edit a function without knowing 47 other functions depend on it. GitNexus fixes this by **precomputing every dependency, call chain, and relationship** into a queryable graph.
|
|
15
|
+
|
|
16
|
+
**Three commands to give your AI agent full codebase awareness.**
|
|
17
|
+
|
|
18
|
+
## Quick Start
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
# Index your repo (run from repo root)
|
|
22
|
+
npx gitnexus analyze
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
That's it. This indexes the codebase, installs agent skills, registers Claude Code hooks, and creates `AGENTS.md` / `CLAUDE.md` context files — all in one command.
|
|
26
|
+
|
|
27
|
+
To configure MCP for your editor, run `npx gitnexus setup` once — or set it up manually below.
|
|
28
|
+
|
|
29
|
+
`gitnexus setup` auto-detects your editors and writes the correct global MCP config. You only need to run it once.
|
|
30
|
+
|
|
31
|
+
### Editor Support
|
|
32
|
+
|
|
33
|
+
| Editor | MCP | Skills | Hooks (auto-augment) | Support |
|
|
34
|
+
|--------|-----|--------|---------------------|---------|
|
|
35
|
+
| **Claude Code** | Yes | Yes | Yes (PreToolUse) | **Full** |
|
|
36
|
+
| **Cursor** | Yes | Yes | — | MCP + Skills |
|
|
37
|
+
| **Windsurf** | Yes | — | — | MCP |
|
|
38
|
+
| **OpenCode** | Yes | Yes | — | MCP + Skills |
|
|
39
|
+
|
|
40
|
+
> **Claude Code** gets the deepest integration: MCP tools + agent skills + PreToolUse hooks that automatically enrich grep/glob/bash calls with knowledge graph context.
|
|
41
|
+
|
|
42
|
+
### Community Integrations
|
|
43
|
+
|
|
44
|
+
| Agent | Install | Source |
|
|
45
|
+
|-------|---------|--------|
|
|
46
|
+
| [pi](https://pi.dev) | `pi install npm:pi-gitnexus` | [pi-gitnexus](https://github.com/tintinweb/pi-gitnexus) |
|
|
47
|
+
|
|
48
|
+
## MCP Setup (manual)
|
|
49
|
+
|
|
50
|
+
If you prefer to configure manually instead of using `gitnexus setup`:
|
|
51
|
+
|
|
52
|
+
### Claude Code (full support — MCP + skills + hooks)
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
claude mcp add gitnexus -- npx -y gitnexus@latest mcp
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Cursor / Windsurf
|
|
59
|
+
|
|
60
|
+
Add to `~/.cursor/mcp.json` (global — works for all projects):
|
|
61
|
+
|
|
62
|
+
```json
|
|
63
|
+
{
|
|
64
|
+
"mcpServers": {
|
|
65
|
+
"gitnexus": {
|
|
66
|
+
"command": "npx",
|
|
67
|
+
"args": ["-y", "gitnexus@latest", "mcp"]
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### OpenCode
|
|
74
|
+
|
|
75
|
+
Add to `~/.config/opencode/config.json`:
|
|
76
|
+
|
|
77
|
+
```json
|
|
78
|
+
{
|
|
79
|
+
"mcp": {
|
|
80
|
+
"gitnexus": {
|
|
81
|
+
"command": "npx",
|
|
82
|
+
"args": ["-y", "gitnexus@latest", "mcp"]
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## How It Works
|
|
89
|
+
|
|
90
|
+
GitNexus builds a complete knowledge graph of your codebase through a multi-phase indexing pipeline:
|
|
91
|
+
|
|
92
|
+
1. **Structure** — Walks the file tree and maps folder/file relationships
|
|
93
|
+
2. **Parsing** — Extracts functions, classes, methods, and interfaces using Tree-sitter ASTs
|
|
94
|
+
3. **Resolution** — Resolves imports and function calls across files with language-aware logic
|
|
95
|
+
4. **Clustering** — Groups related symbols into functional communities
|
|
96
|
+
5. **Processes** — Traces execution flows from entry points through call chains
|
|
97
|
+
6. **Search** — Builds hybrid search indexes for fast retrieval
|
|
98
|
+
|
|
99
|
+
The result is a **KuzuDB graph database** stored locally in `.gitnexus/` with full-text search and semantic embeddings.
|
|
100
|
+
|
|
101
|
+
## MCP Tools
|
|
102
|
+
|
|
103
|
+
Your AI agent gets these tools automatically:
|
|
104
|
+
|
|
105
|
+
| Tool | What It Does | `repo` Param |
|
|
106
|
+
|------|-------------|--------------|
|
|
107
|
+
| `list_repos` | Discover all indexed repositories | — |
|
|
108
|
+
| `query` | Process-grouped hybrid search (BM25 + semantic + RRF) | Optional |
|
|
109
|
+
| `context` | 360-degree symbol view — categorized refs, process participation | Optional |
|
|
110
|
+
| `impact` | Blast radius analysis with depth grouping and confidence | Optional |
|
|
111
|
+
| `detect_changes` | Git-diff impact — maps changed lines to affected processes | Optional |
|
|
112
|
+
| `rename` | Multi-file coordinated rename with graph + text search | Optional |
|
|
113
|
+
| `cypher` | Raw Cypher graph queries | Optional |
|
|
114
|
+
|
|
115
|
+
> With one indexed repo, the `repo` param is optional. With multiple, specify which: `query({query: "auth", repo: "my-app"})`.
|
|
116
|
+
|
|
117
|
+
## MCP Resources
|
|
118
|
+
|
|
119
|
+
| Resource | Purpose |
|
|
120
|
+
|----------|---------|
|
|
121
|
+
| `gitnexus://repos` | List all indexed repositories (read first) |
|
|
122
|
+
| `gitnexus://repo/{name}/context` | Codebase stats, staleness check, and available tools |
|
|
123
|
+
| `gitnexus://repo/{name}/clusters` | All functional clusters with cohesion scores |
|
|
124
|
+
| `gitnexus://repo/{name}/cluster/{name}` | Cluster members and details |
|
|
125
|
+
| `gitnexus://repo/{name}/processes` | All execution flows |
|
|
126
|
+
| `gitnexus://repo/{name}/process/{name}` | Full process trace with steps |
|
|
127
|
+
| `gitnexus://repo/{name}/schema` | Graph schema for Cypher queries |
|
|
128
|
+
|
|
129
|
+
## MCP Prompts
|
|
130
|
+
|
|
131
|
+
| Prompt | What It Does |
|
|
132
|
+
|--------|-------------|
|
|
133
|
+
| `detect_impact` | Pre-commit change analysis — scope, affected processes, risk level |
|
|
134
|
+
| `generate_map` | Architecture documentation from the knowledge graph with mermaid diagrams |
|
|
135
|
+
|
|
136
|
+
## CLI Commands
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
gitnexus setup # Configure MCP for your editors (one-time)
|
|
140
|
+
gitnexus analyze [path] # Index a repository (or update stale index)
|
|
141
|
+
gitnexus analyze --force # Force full re-index
|
|
142
|
+
gitnexus analyze --skip-embeddings # Skip embedding generation (faster)
|
|
143
|
+
gitnexus mcp # Start MCP server (stdio) — serves all indexed repos
|
|
144
|
+
gitnexus serve # Start local HTTP server (multi-repo) for web UI
|
|
145
|
+
gitnexus list # List all indexed repositories
|
|
146
|
+
gitnexus status # Show index status for current repo
|
|
147
|
+
gitnexus clean # Delete index for current repo
|
|
148
|
+
gitnexus clean --all --force # Delete all indexes
|
|
149
|
+
gitnexus wiki [path] # Generate LLM-powered docs from knowledge graph
|
|
150
|
+
gitnexus wiki --model <model> # Wiki with custom LLM model (default: gpt-4o-mini)
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## Multi-Repo Support
|
|
154
|
+
|
|
155
|
+
GitNexus supports indexing multiple repositories. Each `gitnexus analyze` registers the repo in a global registry (`~/.gitnexus/registry.json`). The MCP server serves all indexed repos automatically.
|
|
156
|
+
|
|
157
|
+
## Supported Languages
|
|
158
|
+
|
|
159
|
+
TypeScript, JavaScript, Python, Java, C, C++, C#, Go, Rust
|
|
160
|
+
|
|
161
|
+
## Agent Skills
|
|
162
|
+
|
|
163
|
+
GitNexus ships with skill files that teach AI agents how to use the tools effectively:
|
|
164
|
+
|
|
165
|
+
- **Exploring** — Navigate unfamiliar code using the knowledge graph
|
|
166
|
+
- **Debugging** — Trace bugs through call chains
|
|
167
|
+
- **Impact Analysis** — Analyze blast radius before changes
|
|
168
|
+
- **Refactoring** — Plan safe refactors using dependency mapping
|
|
169
|
+
|
|
170
|
+
Installed automatically by both `gitnexus analyze` (per-repo) and `gitnexus setup` (global).
|
|
171
|
+
|
|
172
|
+
## Requirements
|
|
173
|
+
|
|
174
|
+
- Node.js >= 18
|
|
175
|
+
- Git repository (uses git for commit tracking)
|
|
176
|
+
|
|
177
|
+
## Privacy
|
|
178
|
+
|
|
179
|
+
- All processing happens locally on your machine
|
|
180
|
+
- No code is sent to any server
|
|
181
|
+
- Index stored in `.gitnexus/` inside your repo (gitignored)
|
|
182
|
+
- Global registry at `~/.gitnexus/` stores only paths and metadata
|
|
183
|
+
|
|
184
|
+
## Web UI
|
|
185
|
+
|
|
186
|
+
GitNexus also has a browser-based UI at [gitnexus.vercel.app](https://gitnexus.vercel.app) — 100% client-side, your code never leaves the browser.
|
|
187
|
+
|
|
188
|
+
**Local Backend Mode:** Run `gitnexus serve` and open the web UI locally — it auto-detects the server and shows all your indexed repos, with full AI chat support. No need to re-upload or re-index. The agent's tools (Cypher queries, search, code navigation) route through the backend HTTP API automatically.
|
|
189
|
+
|
|
190
|
+
## License
|
|
191
|
+
|
|
192
|
+
[PolyForm Noncommercial 1.0.0](https://polyformproject.org/licenses/noncommercial/1.0.0/)
|
|
193
|
+
|
|
194
|
+
Free for non-commercial use. Contact for commercial licensing.
|
package/dist/cli/ai-context.js
CHANGED
|
@@ -24,67 +24,67 @@ const GITNEXUS_END_MARKER = '<!-- gitnexus:end -->';
|
|
|
24
24
|
* - Tools/Resources sections are labeled "Reference" — agents treat them as lookup, not workflow
|
|
25
25
|
*/
|
|
26
26
|
function generateGitNexusContent(projectName, stats) {
|
|
27
|
-
return `${GITNEXUS_START_MARKER}
|
|
28
|
-
# GitNexus MCP
|
|
29
|
-
|
|
30
|
-
This project is indexed by GitNexus as **${projectName}** (${stats.nodes || 0} symbols, ${stats.edges || 0} relationships, ${stats.processes || 0} execution flows).
|
|
31
|
-
|
|
32
|
-
GitNexus provides a knowledge graph over this codebase — call chains, blast radius, execution flows, and semantic search.
|
|
33
|
-
|
|
34
|
-
## Always Start Here
|
|
35
|
-
|
|
36
|
-
For any task involving code understanding, debugging, impact analysis, or refactoring, you must:
|
|
37
|
-
|
|
38
|
-
1. **Read \`gitnexus://repo/{name}/context\`** — codebase overview + check index freshness
|
|
39
|
-
2. **Match your task to a skill below** and **read that skill file**
|
|
40
|
-
3. **Follow the skill's workflow and checklist**
|
|
41
|
-
|
|
42
|
-
> If step 1 warns the index is stale, run \`npx gitnexus analyze\` in the terminal first.
|
|
43
|
-
|
|
44
|
-
## Skills
|
|
45
|
-
|
|
46
|
-
| Task | Read this skill file |
|
|
47
|
-
|------|---------------------|
|
|
48
|
-
| Understand architecture / "How does X work?" | \`.claude/skills/gitnexus/exploring/SKILL.md\` |
|
|
49
|
-
| Blast radius / "What breaks if I change X?" | \`.claude/skills/gitnexus/impact-analysis/SKILL.md\` |
|
|
50
|
-
| Trace bugs / "Why is X failing?" | \`.claude/skills/gitnexus/debugging/SKILL.md\` |
|
|
51
|
-
| Rename / extract / split / refactor | \`.claude/skills/gitnexus/refactoring/SKILL.md\` |
|
|
52
|
-
|
|
53
|
-
## Tools Reference
|
|
54
|
-
|
|
55
|
-
| Tool | What it gives you |
|
|
56
|
-
|------|-------------------|
|
|
57
|
-
| \`query\` | Process-grouped code intelligence — execution flows related to a concept |
|
|
58
|
-
| \`context\` | 360-degree symbol view — categorized refs, processes it participates in |
|
|
59
|
-
| \`impact\` | Symbol blast radius — what breaks at depth 1/2/3 with confidence |
|
|
60
|
-
| \`detect_changes\` | Git-diff impact — what do your current changes affect |
|
|
61
|
-
| \`rename\` | Multi-file coordinated rename with confidence-tagged edits |
|
|
62
|
-
| \`cypher\` | Raw graph queries (read \`gitnexus://repo/{name}/schema\` first) |
|
|
63
|
-
| \`list_repos\` | Discover indexed repos |
|
|
64
|
-
|
|
65
|
-
## Resources Reference
|
|
66
|
-
|
|
67
|
-
Lightweight reads (~100-500 tokens) for navigation:
|
|
68
|
-
|
|
69
|
-
| Resource | Content |
|
|
70
|
-
|----------|---------|
|
|
71
|
-
| \`gitnexus://repo/{name}/context\` | Stats, staleness check |
|
|
72
|
-
| \`gitnexus://repo/{name}/clusters\` | All functional areas with cohesion scores |
|
|
73
|
-
| \`gitnexus://repo/{name}/cluster/{clusterName}\` | Area members |
|
|
74
|
-
| \`gitnexus://repo/{name}/processes\` | All execution flows |
|
|
75
|
-
| \`gitnexus://repo/{name}/process/{processName}\` | Step-by-step trace |
|
|
76
|
-
| \`gitnexus://repo/{name}/schema\` | Graph schema for Cypher |
|
|
77
|
-
|
|
78
|
-
## Graph Schema
|
|
79
|
-
|
|
80
|
-
**Nodes:** File, Function, Class, Interface, Method, Community, Process
|
|
81
|
-
**Edges (via CodeRelation.type):** CALLS, IMPORTS, EXTENDS, IMPLEMENTS, DEFINES, MEMBER_OF, STEP_IN_PROCESS
|
|
82
|
-
|
|
83
|
-
\`\`\`cypher
|
|
84
|
-
MATCH (caller)-[:CodeRelation {type: 'CALLS'}]->(f:Function {name: "myFunc"})
|
|
85
|
-
RETURN caller.name, caller.filePath
|
|
86
|
-
\`\`\`
|
|
87
|
-
|
|
27
|
+
return `${GITNEXUS_START_MARKER}
|
|
28
|
+
# GitNexus MCP
|
|
29
|
+
|
|
30
|
+
This project is indexed by GitNexus as **${projectName}** (${stats.nodes || 0} symbols, ${stats.edges || 0} relationships, ${stats.processes || 0} execution flows).
|
|
31
|
+
|
|
32
|
+
GitNexus provides a knowledge graph over this codebase — call chains, blast radius, execution flows, and semantic search.
|
|
33
|
+
|
|
34
|
+
## Always Start Here
|
|
35
|
+
|
|
36
|
+
For any task involving code understanding, debugging, impact analysis, or refactoring, you must:
|
|
37
|
+
|
|
38
|
+
1. **Read \`gitnexus://repo/{name}/context\`** — codebase overview + check index freshness
|
|
39
|
+
2. **Match your task to a skill below** and **read that skill file**
|
|
40
|
+
3. **Follow the skill's workflow and checklist**
|
|
41
|
+
|
|
42
|
+
> If step 1 warns the index is stale, run \`npx gitnexus analyze\` in the terminal first.
|
|
43
|
+
|
|
44
|
+
## Skills
|
|
45
|
+
|
|
46
|
+
| Task | Read this skill file |
|
|
47
|
+
|------|---------------------|
|
|
48
|
+
| Understand architecture / "How does X work?" | \`.claude/skills/gitnexus/exploring/SKILL.md\` |
|
|
49
|
+
| Blast radius / "What breaks if I change X?" | \`.claude/skills/gitnexus/impact-analysis/SKILL.md\` |
|
|
50
|
+
| Trace bugs / "Why is X failing?" | \`.claude/skills/gitnexus/debugging/SKILL.md\` |
|
|
51
|
+
| Rename / extract / split / refactor | \`.claude/skills/gitnexus/refactoring/SKILL.md\` |
|
|
52
|
+
|
|
53
|
+
## Tools Reference
|
|
54
|
+
|
|
55
|
+
| Tool | What it gives you |
|
|
56
|
+
|------|-------------------|
|
|
57
|
+
| \`query\` | Process-grouped code intelligence — execution flows related to a concept |
|
|
58
|
+
| \`context\` | 360-degree symbol view — categorized refs, processes it participates in |
|
|
59
|
+
| \`impact\` | Symbol blast radius — what breaks at depth 1/2/3 with confidence |
|
|
60
|
+
| \`detect_changes\` | Git-diff impact — what do your current changes affect |
|
|
61
|
+
| \`rename\` | Multi-file coordinated rename with confidence-tagged edits |
|
|
62
|
+
| \`cypher\` | Raw graph queries (read \`gitnexus://repo/{name}/schema\` first) |
|
|
63
|
+
| \`list_repos\` | Discover indexed repos |
|
|
64
|
+
|
|
65
|
+
## Resources Reference
|
|
66
|
+
|
|
67
|
+
Lightweight reads (~100-500 tokens) for navigation:
|
|
68
|
+
|
|
69
|
+
| Resource | Content |
|
|
70
|
+
|----------|---------|
|
|
71
|
+
| \`gitnexus://repo/{name}/context\` | Stats, staleness check |
|
|
72
|
+
| \`gitnexus://repo/{name}/clusters\` | All functional areas with cohesion scores |
|
|
73
|
+
| \`gitnexus://repo/{name}/cluster/{clusterName}\` | Area members |
|
|
74
|
+
| \`gitnexus://repo/{name}/processes\` | All execution flows |
|
|
75
|
+
| \`gitnexus://repo/{name}/process/{processName}\` | Step-by-step trace |
|
|
76
|
+
| \`gitnexus://repo/{name}/schema\` | Graph schema for Cypher |
|
|
77
|
+
|
|
78
|
+
## Graph Schema
|
|
79
|
+
|
|
80
|
+
**Nodes:** File, Function, Class, Interface, Method, Community, Process
|
|
81
|
+
**Edges (via CodeRelation.type):** CALLS, IMPORTS, EXTENDS, IMPLEMENTS, DEFINES, MEMBER_OF, STEP_IN_PROCESS
|
|
82
|
+
|
|
83
|
+
\`\`\`cypher
|
|
84
|
+
MATCH (caller)-[:CodeRelation {type: 'CALLS'}]->(f:Function {name: "myFunc"})
|
|
85
|
+
RETURN caller.name, caller.filePath
|
|
86
|
+
\`\`\`
|
|
87
|
+
|
|
88
88
|
${GITNEXUS_END_MARKER}`;
|
|
89
89
|
}
|
|
90
90
|
/**
|
|
@@ -168,16 +168,16 @@ async function installSkills(repoPath) {
|
|
|
168
168
|
}
|
|
169
169
|
catch {
|
|
170
170
|
// Fallback: generate minimal skill content
|
|
171
|
-
skillContent = `---
|
|
172
|
-
name: gitnexus-${skill.name}
|
|
173
|
-
description: ${skill.description}
|
|
174
|
-
---
|
|
175
|
-
|
|
176
|
-
# ${skill.name.charAt(0).toUpperCase() + skill.name.slice(1)}
|
|
177
|
-
|
|
178
|
-
${skill.description}
|
|
179
|
-
|
|
180
|
-
Use GitNexus tools to accomplish this task.
|
|
171
|
+
skillContent = `---
|
|
172
|
+
name: gitnexus-${skill.name}
|
|
173
|
+
description: ${skill.description}
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
# ${skill.name.charAt(0).toUpperCase() + skill.name.slice(1)}
|
|
177
|
+
|
|
178
|
+
${skill.description}
|
|
179
|
+
|
|
180
|
+
Use GitNexus tools to accomplish this task.
|
|
181
181
|
`;
|
|
182
182
|
}
|
|
183
183
|
await fs.writeFile(skillPath, skillContent, 'utf-8');
|