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.
Files changed (59) hide show
  1. package/README.md +194 -186
  2. package/dist/cli/ai-context.js +71 -71
  3. package/dist/cli/analyze.js +69 -28
  4. package/dist/cli/index.js +20 -0
  5. package/dist/cli/setup.js +8 -1
  6. package/dist/cli/view.d.ts +13 -0
  7. package/dist/cli/view.js +59 -0
  8. package/dist/core/augmentation/engine.js +20 -20
  9. package/dist/core/embeddings/embedding-pipeline.js +26 -26
  10. package/dist/core/graph/graph.js +5 -0
  11. package/dist/core/graph/html-graph-viewer.d.ts +15 -0
  12. package/dist/core/graph/html-graph-viewer.js +542 -0
  13. package/dist/core/graph/html-graph-viewer.test.d.ts +1 -0
  14. package/dist/core/graph/html-graph-viewer.test.js +67 -0
  15. package/dist/core/graph/types.d.ts +12 -1
  16. package/dist/core/ingestion/call-processor.js +52 -32
  17. package/dist/core/ingestion/cluster-enricher.js +16 -16
  18. package/dist/core/ingestion/community-processor.js +75 -40
  19. package/dist/core/ingestion/filesystem-walker.d.ts +23 -0
  20. package/dist/core/ingestion/filesystem-walker.js +38 -3
  21. package/dist/core/ingestion/import-processor.d.ts +11 -3
  22. package/dist/core/ingestion/import-processor.js +27 -11
  23. package/dist/core/ingestion/parsing-processor.js +2 -4
  24. package/dist/core/ingestion/pipeline.js +142 -135
  25. package/dist/core/ingestion/process-processor.js +12 -11
  26. package/dist/core/ingestion/workers/parse-worker.js +67 -6
  27. package/dist/core/ingestion/workers/worker-pool.d.ts +3 -9
  28. package/dist/core/ingestion/workers/worker-pool.js +39 -18
  29. package/dist/core/kuzu/csv-generator.d.ts +15 -8
  30. package/dist/core/kuzu/csv-generator.js +258 -196
  31. package/dist/core/kuzu/kuzu-adapter.d.ts +1 -4
  32. package/dist/core/kuzu/kuzu-adapter.js +84 -72
  33. package/dist/core/kuzu/schema.d.ts +1 -1
  34. package/dist/core/kuzu/schema.js +266 -256
  35. package/dist/core/search/bm25-index.js +5 -5
  36. package/dist/core/search/hybrid-search.js +3 -3
  37. package/dist/core/wiki/graph-queries.js +52 -52
  38. package/dist/core/wiki/html-viewer.js +192 -192
  39. package/dist/core/wiki/prompts.js +82 -82
  40. package/dist/mcp/core/embedder.js +8 -4
  41. package/dist/mcp/local/local-backend.d.ts +6 -0
  42. package/dist/mcp/local/local-backend.js +224 -117
  43. package/dist/mcp/resources.js +42 -42
  44. package/dist/mcp/server.js +16 -16
  45. package/dist/mcp/tools.js +86 -77
  46. package/dist/server/api.d.ts +4 -2
  47. package/dist/server/api.js +253 -83
  48. package/dist/types/pipeline.d.ts +6 -2
  49. package/dist/types/pipeline.js +6 -4
  50. package/hooks/claude/gitnexus-hook.cjs +135 -135
  51. package/hooks/claude/pre-tool-use.sh +78 -78
  52. package/hooks/claude/session-start.sh +42 -42
  53. package/package.json +82 -82
  54. package/skills/debugging.md +85 -85
  55. package/skills/exploring.md +75 -75
  56. package/skills/impact-analysis.md +94 -94
  57. package/skills/refactoring.md +113 -113
  58. package/vendor/leiden/index.cjs +355 -355
  59. 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
- [![npm version](https://img.shields.io/npm/v/gitnexus.svg)](https://www.npmjs.com/package/gitnexus)
8
- [![License: PolyForm Noncommercial](https://img.shields.io/badge/License-PolyForm%20Noncommercial-blue.svg)](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
- ## MCP Setup (manual)
43
-
44
- If you prefer to configure manually instead of using `gitnexus setup`:
45
-
46
- ### Claude Code (full support MCP + skills + hooks)
47
-
48
- ```bash
49
- claude mcp add gitnexus -- npx -y gitnexus@latest mcp
50
- ```
51
-
52
- ### Cursor / Windsurf
53
-
54
- Add to `~/.cursor/mcp.json` (global — works for all projects):
55
-
56
- ```json
57
- {
58
- "mcpServers": {
59
- "gitnexus": {
60
- "command": "npx",
61
- "args": ["-y", "gitnexus@latest", "mcp"]
62
- }
63
- }
64
- }
65
- ```
66
-
67
- ### OpenCode
68
-
69
- Add to `~/.config/opencode/config.json`:
70
-
71
- ```json
72
- {
73
- "mcp": {
74
- "gitnexus": {
75
- "command": "npx",
76
- "args": ["-y", "gitnexus@latest", "mcp"]
77
- }
78
- }
79
- }
80
- ```
81
-
82
- ## How It Works
83
-
84
- GitNexus builds a complete knowledge graph of your codebase through a multi-phase indexing pipeline:
85
-
86
- 1. **Structure** — Walks the file tree and maps folder/file relationships
87
- 2. **Parsing** — Extracts functions, classes, methods, and interfaces using Tree-sitter ASTs
88
- 3. **Resolution** Resolves imports and function calls across files with language-aware logic
89
- 4. **Clustering** — Groups related symbols into functional communities
90
- 5. **Processes** Traces execution flows from entry points through call chains
91
- 6. **Search** — Builds hybrid search indexes for fast retrieval
92
-
93
- The result is a **KuzuDB graph database** stored locally in `.gitnexus/` with full-text search and semantic embeddings.
94
-
95
- ## MCP Tools
96
-
97
- Your AI agent gets these tools automatically:
98
-
99
- | Tool | What It Does | `repo` Param |
100
- |------|-------------|--------------|
101
- | `list_repos` | Discover all indexed repositories | — |
102
- | `query` | Process-grouped hybrid search (BM25 + semantic + RRF) | Optional |
103
- | `context` | 360-degree symbol view — categorized refs, process participation | Optional |
104
- | `impact` | Blast radius analysis with depth grouping and confidence | Optional |
105
- | `detect_changes` | Git-diff impact maps changed lines to affected processes | Optional |
106
- | `rename` | Multi-file coordinated rename with graph + text search | Optional |
107
- | `cypher` | Raw Cypher graph queries | Optional |
108
-
109
- > With one indexed repo, the `repo` param is optional. With multiple, specify which: `query({query: "auth", repo: "my-app"})`.
110
-
111
- ## MCP Resources
112
-
113
- | Resource | Purpose |
114
- |----------|---------|
115
- | `gitnexus://repos` | List all indexed repositories (read first) |
116
- | `gitnexus://repo/{name}/context` | Codebase stats, staleness check, and available tools |
117
- | `gitnexus://repo/{name}/clusters` | All functional clusters with cohesion scores |
118
- | `gitnexus://repo/{name}/cluster/{name}` | Cluster members and details |
119
- | `gitnexus://repo/{name}/processes` | All execution flows |
120
- | `gitnexus://repo/{name}/process/{name}` | Full process trace with steps |
121
- | `gitnexus://repo/{name}/schema` | Graph schema for Cypher queries |
122
-
123
- ## MCP Prompts
124
-
125
- | Prompt | What It Does |
126
- |--------|-------------|
127
- | `detect_impact` | Pre-commit change analysis scope, affected processes, risk level |
128
- | `generate_map` | Architecture documentation from the knowledge graph with mermaid diagrams |
129
-
130
- ## CLI Commands
131
-
132
- ```bash
133
- gitnexus setup # Configure MCP for your editors (one-time)
134
- gitnexus analyze [path] # Index a repository (or update stale index)
135
- gitnexus analyze --force # Force full re-index
136
- gitnexus analyze --skip-embeddings # Skip embedding generation (faster)
137
- gitnexus mcp # Start MCP server (stdio) — serves all indexed repos
138
- gitnexus serve # Start HTTP server for web UI
139
- gitnexus list # List all indexed repositories
140
- gitnexus status # Show index status for current repo
141
- gitnexus clean # Delete index for current repo
142
- gitnexus clean --all --force # Delete all indexes
143
- gitnexus wiki [path] # Generate LLM-powered docs from knowledge graph
144
- gitnexus wiki --model <model> # Wiki with custom LLM model (default: gpt-4o-mini)
145
- ```
146
-
147
- ## Multi-Repo Support
148
-
149
- 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.
150
-
151
- ## Supported Languages
152
-
153
- TypeScript, JavaScript, Python, Java, C, C++, C#, Go, Rust
154
-
155
- ## Agent Skills
156
-
157
- GitNexus ships with skill files that teach AI agents how to use the tools effectively:
158
-
159
- - **Exploring** Navigate unfamiliar code using the knowledge graph
160
- - **Debugging** — Trace bugs through call chains
161
- - **Impact Analysis** — Analyze blast radius before changes
162
- - **Refactoring** — Plan safe refactors using dependency mapping
163
-
164
- Installed automatically by both `gitnexus analyze` (per-repo) and `gitnexus setup` (global).
165
-
166
- ## Requirements
167
-
168
- - Node.js >= 18
169
- - Git repository (uses git for commit tracking)
170
-
171
- ## Privacy
172
-
173
- - All processing happens locally on your machine
174
- - No code is sent to any server
175
- - Index stored in `.gitnexus/` inside your repo (gitignored)
176
- - Global registry at `~/.gitnexus/` stores only paths and metadata
177
-
178
- ## Web UI
179
-
180
- GitNexus also has a browser-based UI at [gitnexus.vercel.app](https://gitnexus.vercel.app) 100% client-side, your code never leaves the browser.
181
-
182
- ## License
183
-
184
- [PolyForm Noncommercial 1.0.0](https://polyformproject.org/licenses/noncommercial/1.0.0/)
185
-
186
- Free for non-commercial use. Contact for commercial licensing.
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
+ [![npm version](https://img.shields.io/npm/v/gitnexus.svg)](https://www.npmjs.com/package/gitnexus)
8
+ [![License: PolyForm Noncommercial](https://img.shields.io/badge/License-PolyForm%20Noncommercial-blue.svg)](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.
@@ -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');