gitnexushub 0.2.10 → 0.2.12
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/dist/config.js +17 -1
- package/dist/content.js +64 -62
- package/dist/editors/claude-code.js +2 -1
- package/dist/editors/cursor.js +2 -1
- package/dist/editors/opencode.js +2 -1
- package/dist/editors/types.d.ts +1 -0
- package/dist/editors/windsurf.js +2 -1
- package/dist/index.js +7 -1
- package/package.json +53 -53
- package/skills/gitnexus-debugging.md +89 -89
- package/skills/gitnexus-exploring.md +78 -78
- package/skills/gitnexus-guide.md +64 -0
- package/skills/gitnexus-impact-analysis.md +99 -99
- package/skills/gitnexus-pr-review.md +161 -161
- package/skills/gitnexus-refactoring.md +121 -0
package/dist/config.js
CHANGED
|
@@ -20,7 +20,23 @@ export async function saveConfig(updates) {
|
|
|
20
20
|
export async function clearConfig() {
|
|
21
21
|
try {
|
|
22
22
|
const fs = await import('fs/promises');
|
|
23
|
-
|
|
23
|
+
// Only remove connect-specific keys, not the entire ~/.gitnexus/ dir
|
|
24
|
+
// (other tools like `gitnexus wiki` store their own config here)
|
|
25
|
+
const existing = await loadConfig();
|
|
26
|
+
if (!existing.hubToken && !existing.hubUrl)
|
|
27
|
+
return; // nothing to clear
|
|
28
|
+
const config = await readJsonFile(CONFIG_PATH);
|
|
29
|
+
if (config) {
|
|
30
|
+
delete config.hubToken;
|
|
31
|
+
delete config.hubUrl;
|
|
32
|
+
// If nothing left, remove the file; otherwise rewrite
|
|
33
|
+
if (Object.keys(config).length === 0) {
|
|
34
|
+
await fs.rm(CONFIG_PATH, { force: true });
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
await writeJsonFile(CONFIG_PATH, config);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
24
40
|
}
|
|
25
41
|
catch {
|
|
26
42
|
// Already gone
|
package/dist/content.js
CHANGED
|
@@ -16,6 +16,8 @@ export const HUB_SKILLS = [
|
|
|
16
16
|
'gitnexus-exploring',
|
|
17
17
|
'gitnexus-debugging',
|
|
18
18
|
'gitnexus-impact-analysis',
|
|
19
|
+
'gitnexus-refactoring',
|
|
20
|
+
'gitnexus-guide',
|
|
19
21
|
'gitnexus-pr-review',
|
|
20
22
|
];
|
|
21
23
|
/**
|
|
@@ -23,68 +25,68 @@ export const HUB_SKILLS = [
|
|
|
23
25
|
* No detect_changes or rename references (not available via Hub MCP).
|
|
24
26
|
*/
|
|
25
27
|
function generateHubContent(projectName, stats) {
|
|
26
|
-
return `${GITNEXUS_START_MARKER}
|
|
27
|
-
# GitNexus — Code Intelligence
|
|
28
|
-
|
|
29
|
-
This project is indexed by GitNexus as **${projectName}** (${stats.nodes || 0} symbols, ${stats.edges || 0} relationships, ${stats.processes || 0} execution flows). Use the GitNexus MCP tools to understand code, assess impact, and navigate safely.
|
|
30
|
-
|
|
31
|
-
> Re-indexing is managed from the GitNexus Hub dashboard.
|
|
32
|
-
|
|
33
|
-
## Always Do
|
|
34
|
-
|
|
35
|
-
- **MUST run impact analysis before editing any symbol.** Before modifying a function, class, or method, run \`gitnexus_impact({target: "symbolName", direction: "upstream"})\` and report the blast radius (direct callers, affected processes, risk level) to the user.
|
|
36
|
-
- **MUST warn the user** if impact analysis returns HIGH or CRITICAL risk before proceeding with edits.
|
|
37
|
-
- When exploring unfamiliar code, use \`gitnexus_query({query: "concept"})\` to find execution flows instead of grepping. It returns process-grouped results ranked by relevance.
|
|
38
|
-
- When you need full context on a specific symbol — callers, callees, which execution flows it participates in — use \`gitnexus_context({name: "symbolName"})\`.
|
|
39
|
-
|
|
40
|
-
## When Debugging
|
|
41
|
-
|
|
42
|
-
1. \`gitnexus_query({query: "<error or symptom>"})\` — find execution flows related to the issue
|
|
43
|
-
2. \`gitnexus_context({name: "<suspect function>"})\` — see all callers, callees, and process participation
|
|
44
|
-
3. \`READ gitnexus://repo/${projectName}/process/{processName}\` — trace the full execution flow step by step
|
|
45
|
-
|
|
46
|
-
## When Refactoring
|
|
47
|
-
|
|
48
|
-
- **Extracting/Splitting**: MUST run \`gitnexus_context({name: "target"})\` to see all incoming/outgoing refs, then \`gitnexus_impact({target: "target", direction: "upstream"})\` to find all external callers before moving code.
|
|
49
|
-
|
|
50
|
-
## Never Do
|
|
51
|
-
|
|
52
|
-
- NEVER edit a function, class, or method without first running \`gitnexus_impact\` on it.
|
|
53
|
-
- NEVER ignore HIGH or CRITICAL risk warnings from impact analysis.
|
|
54
|
-
|
|
55
|
-
## Tools Quick Reference
|
|
56
|
-
|
|
57
|
-
| Tool | When to use | Command |
|
|
58
|
-
|------|-------------|---------|
|
|
59
|
-
| \`query\` | Find code by concept | \`gitnexus_query({query: "auth validation"})\` |
|
|
60
|
-
| \`context\` | 360-degree view of one symbol | \`gitnexus_context({name: "validateUser"})\` |
|
|
61
|
-
| \`impact\` | Blast radius before editing | \`gitnexus_impact({target: "X", direction: "upstream"})\` |
|
|
62
|
-
| \`cypher\` | Custom graph queries | \`gitnexus_cypher({query: "MATCH ..."})\` |
|
|
63
|
-
|
|
64
|
-
## Impact Risk Levels
|
|
65
|
-
|
|
66
|
-
| Depth | Meaning | Action |
|
|
67
|
-
|-------|---------|--------|
|
|
68
|
-
| d=1 | WILL BREAK — direct callers/importers | MUST update these |
|
|
69
|
-
| d=2 | LIKELY AFFECTED — indirect deps | Should test |
|
|
70
|
-
| d=3 | MAY NEED TESTING — transitive | Test if critical path |
|
|
71
|
-
|
|
72
|
-
## Resources
|
|
73
|
-
|
|
74
|
-
| Resource | Use for |
|
|
75
|
-
|----------|---------|
|
|
76
|
-
| \`gitnexus://repo/${projectName}/context\` | Codebase overview, check index freshness |
|
|
77
|
-
| \`gitnexus://repo/${projectName}/clusters\` | All functional areas |
|
|
78
|
-
| \`gitnexus://repo/${projectName}/processes\` | All execution flows |
|
|
79
|
-
| \`gitnexus://repo/${projectName}/process/{name}\` | Step-by-step execution trace |
|
|
80
|
-
|
|
81
|
-
## Self-Check Before Finishing
|
|
82
|
-
|
|
83
|
-
Before completing any code modification task, verify:
|
|
84
|
-
1. \`gitnexus_impact\` was run for all modified symbols
|
|
85
|
-
2. No HIGH/CRITICAL risk warnings were ignored
|
|
86
|
-
3. All d=1 (WILL BREAK) dependents were updated
|
|
87
|
-
|
|
28
|
+
return `${GITNEXUS_START_MARKER}
|
|
29
|
+
# GitNexus — Code Intelligence
|
|
30
|
+
|
|
31
|
+
This project is indexed by GitNexus as **${projectName}** (${stats.nodes || 0} symbols, ${stats.edges || 0} relationships, ${stats.processes || 0} execution flows). Use the GitNexus MCP tools to understand code, assess impact, and navigate safely.
|
|
32
|
+
|
|
33
|
+
> Re-indexing is managed from the GitNexus Hub dashboard.
|
|
34
|
+
|
|
35
|
+
## Always Do
|
|
36
|
+
|
|
37
|
+
- **MUST run impact analysis before editing any symbol.** Before modifying a function, class, or method, run \`gitnexus_impact({target: "symbolName", direction: "upstream"})\` and report the blast radius (direct callers, affected processes, risk level) to the user.
|
|
38
|
+
- **MUST warn the user** if impact analysis returns HIGH or CRITICAL risk before proceeding with edits.
|
|
39
|
+
- When exploring unfamiliar code, use \`gitnexus_query({query: "concept"})\` to find execution flows instead of grepping. It returns process-grouped results ranked by relevance.
|
|
40
|
+
- When you need full context on a specific symbol — callers, callees, which execution flows it participates in — use \`gitnexus_context({name: "symbolName"})\`.
|
|
41
|
+
|
|
42
|
+
## When Debugging
|
|
43
|
+
|
|
44
|
+
1. \`gitnexus_query({query: "<error or symptom>"})\` — find execution flows related to the issue
|
|
45
|
+
2. \`gitnexus_context({name: "<suspect function>"})\` — see all callers, callees, and process participation
|
|
46
|
+
3. \`READ gitnexus://repo/${projectName}/process/{processName}\` — trace the full execution flow step by step
|
|
47
|
+
|
|
48
|
+
## When Refactoring
|
|
49
|
+
|
|
50
|
+
- **Extracting/Splitting**: MUST run \`gitnexus_context({name: "target"})\` to see all incoming/outgoing refs, then \`gitnexus_impact({target: "target", direction: "upstream"})\` to find all external callers before moving code.
|
|
51
|
+
|
|
52
|
+
## Never Do
|
|
53
|
+
|
|
54
|
+
- NEVER edit a function, class, or method without first running \`gitnexus_impact\` on it.
|
|
55
|
+
- NEVER ignore HIGH or CRITICAL risk warnings from impact analysis.
|
|
56
|
+
|
|
57
|
+
## Tools Quick Reference
|
|
58
|
+
|
|
59
|
+
| Tool | When to use | Command |
|
|
60
|
+
|------|-------------|---------|
|
|
61
|
+
| \`query\` | Find code by concept | \`gitnexus_query({query: "auth validation"})\` |
|
|
62
|
+
| \`context\` | 360-degree view of one symbol | \`gitnexus_context({name: "validateUser"})\` |
|
|
63
|
+
| \`impact\` | Blast radius before editing | \`gitnexus_impact({target: "X", direction: "upstream"})\` |
|
|
64
|
+
| \`cypher\` | Custom graph queries | \`gitnexus_cypher({query: "MATCH ..."})\` |
|
|
65
|
+
|
|
66
|
+
## Impact Risk Levels
|
|
67
|
+
|
|
68
|
+
| Depth | Meaning | Action |
|
|
69
|
+
|-------|---------|--------|
|
|
70
|
+
| d=1 | WILL BREAK — direct callers/importers | MUST update these |
|
|
71
|
+
| d=2 | LIKELY AFFECTED — indirect deps | Should test |
|
|
72
|
+
| d=3 | MAY NEED TESTING — transitive | Test if critical path |
|
|
73
|
+
|
|
74
|
+
## Resources
|
|
75
|
+
|
|
76
|
+
| Resource | Use for |
|
|
77
|
+
|----------|---------|
|
|
78
|
+
| \`gitnexus://repo/${projectName}/context\` | Codebase overview, check index freshness |
|
|
79
|
+
| \`gitnexus://repo/${projectName}/clusters\` | All functional areas |
|
|
80
|
+
| \`gitnexus://repo/${projectName}/processes\` | All execution flows |
|
|
81
|
+
| \`gitnexus://repo/${projectName}/process/{name}\` | Step-by-step execution trace |
|
|
82
|
+
|
|
83
|
+
## Self-Check Before Finishing
|
|
84
|
+
|
|
85
|
+
Before completing any code modification task, verify:
|
|
86
|
+
1. \`gitnexus_impact\` was run for all modified symbols
|
|
87
|
+
2. No HIGH/CRITICAL risk warnings were ignored
|
|
88
|
+
3. All d=1 (WILL BREAK) dependents were updated
|
|
89
|
+
|
|
88
90
|
${GITNEXUS_END_MARKER}`;
|
|
89
91
|
}
|
|
90
92
|
/**
|
|
@@ -17,13 +17,14 @@ async function configure(hubUrl, token) {
|
|
|
17
17
|
if (!existing.mcpServers || typeof existing.mcpServers !== 'object') {
|
|
18
18
|
existing.mcpServers = {};
|
|
19
19
|
}
|
|
20
|
+
const overrodeCli = !!(existing.mcpServers.gitnexus && 'command' in existing.mcpServers.gitnexus);
|
|
20
21
|
existing.mcpServers.gitnexus = {
|
|
21
22
|
type: 'http',
|
|
22
23
|
url: mcpUrl,
|
|
23
24
|
headers: { Authorization: `Bearer ${token}` },
|
|
24
25
|
};
|
|
25
26
|
await writeJsonFile(claudeJsonPath, existing);
|
|
26
|
-
return { success: true, message: 'MCP configured in ~/.claude.json' };
|
|
27
|
+
return { success: true, message: 'MCP configured in ~/.claude.json', overrodeCli };
|
|
27
28
|
}
|
|
28
29
|
catch (err) {
|
|
29
30
|
return { success: false, message: `Failed: ${err.message}` };
|
package/dist/editors/cursor.js
CHANGED
|
@@ -23,9 +23,10 @@ async function configure(hubUrl, token) {
|
|
|
23
23
|
if (!existing.mcpServers || typeof existing.mcpServers !== 'object') {
|
|
24
24
|
existing.mcpServers = {};
|
|
25
25
|
}
|
|
26
|
+
const overrodeCli = !!(existing.mcpServers.gitnexus && 'command' in existing.mcpServers.gitnexus);
|
|
26
27
|
existing.mcpServers.gitnexus = getMcpConfig(hubUrl, token);
|
|
27
28
|
await writeJsonFile(mcpPath, existing);
|
|
28
|
-
return { success: true, message: 'MCP configured in ~/.cursor/mcp.json' };
|
|
29
|
+
return { success: true, message: 'MCP configured in ~/.cursor/mcp.json', overrodeCli };
|
|
29
30
|
}
|
|
30
31
|
catch (err) {
|
|
31
32
|
return { success: false, message: `Failed: ${err.message}` };
|
package/dist/editors/opencode.js
CHANGED
|
@@ -23,9 +23,10 @@ async function configure(hubUrl, token) {
|
|
|
23
23
|
if (!existing.mcp || typeof existing.mcp !== 'object') {
|
|
24
24
|
existing.mcp = {};
|
|
25
25
|
}
|
|
26
|
+
const overrodeCli = !!(existing.mcp.gitnexus && 'command' in existing.mcp.gitnexus);
|
|
26
27
|
existing.mcp.gitnexus = getMcpConfig(hubUrl, token);
|
|
27
28
|
await writeJsonFile(configPath, existing);
|
|
28
|
-
return { success: true, message: 'MCP configured in ~/.config/opencode/opencode.json' };
|
|
29
|
+
return { success: true, message: 'MCP configured in ~/.config/opencode/opencode.json', overrodeCli };
|
|
29
30
|
}
|
|
30
31
|
catch (err) {
|
|
31
32
|
return { success: false, message: `Failed: ${err.message}` };
|
package/dist/editors/types.d.ts
CHANGED
package/dist/editors/windsurf.js
CHANGED
|
@@ -22,9 +22,10 @@ async function configure(hubUrl, token) {
|
|
|
22
22
|
if (!existing.mcpServers || typeof existing.mcpServers !== 'object') {
|
|
23
23
|
existing.mcpServers = {};
|
|
24
24
|
}
|
|
25
|
+
const overrodeCli = !!(existing.mcpServers.gitnexus && 'command' in existing.mcpServers.gitnexus);
|
|
25
26
|
existing.mcpServers.gitnexus = getMcpConfig(hubUrl, token);
|
|
26
27
|
await writeJsonFile(mcpPath, existing);
|
|
27
|
-
return { success: true, message: 'MCP configured in ~/.codeium/windsurf/mcp_config.json' };
|
|
28
|
+
return { success: true, message: 'MCP configured in ~/.codeium/windsurf/mcp_config.json', overrodeCli };
|
|
28
29
|
}
|
|
29
30
|
catch (err) {
|
|
30
31
|
return { success: false, message: `Failed: ${err.message}` };
|
package/dist/index.js
CHANGED
|
@@ -22,7 +22,7 @@ import { cursorEditor } from './editors/cursor.js';
|
|
|
22
22
|
import { windsurfEditor } from './editors/windsurf.js';
|
|
23
23
|
import { opencodeEditor } from './editors/opencode.js';
|
|
24
24
|
import { claudeCodeEditor } from './editors/claude-code.js';
|
|
25
|
-
const DEFAULT_HUB_URL = 'https://gitnexus-enterprise-production.up.railway.app';
|
|
25
|
+
const DEFAULT_HUB_URL = process.env.GITNEXUS_HUB_URL || 'https://gitnexus-enterprise-production.up.railway.app';
|
|
26
26
|
const EDITORS = {
|
|
27
27
|
'claude-code': claudeCodeEditor,
|
|
28
28
|
cursor: cursorEditor,
|
|
@@ -190,6 +190,12 @@ async function runConnect(tokenArg, opts) {
|
|
|
190
190
|
const result = await editor.configure(hubUrl, token);
|
|
191
191
|
if (result.success) {
|
|
192
192
|
ok(result.message);
|
|
193
|
+
if (result.overrodeCli) {
|
|
194
|
+
console.log('');
|
|
195
|
+
console.log(` ${pc.cyan('⬆')} ${pc.bold('GitNexus open-source detected — upgraded to Hub')}`);
|
|
196
|
+
console.log(` ${pc.dim('Remote indexing. Deeper analysis. PR blast radius. Auto-reindex on push.')}`);
|
|
197
|
+
console.log(` ${pc.dim('Your tools (query, context, impact) are unchanged — just faster and smarter.')}`);
|
|
198
|
+
}
|
|
193
199
|
}
|
|
194
200
|
else {
|
|
195
201
|
fail(result.message);
|
package/package.json
CHANGED
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "gitnexushub",
|
|
3
|
-
"version": "0.2.
|
|
4
|
-
"description": "Connect your editor to GitNexus Hub — one command MCP setup + project context",
|
|
5
|
-
"author": "Abhigyan Patwari",
|
|
6
|
-
"license": "PolyForm-Noncommercial-1.0.0",
|
|
7
|
-
"homepage": "https://app.akonlabs.com",
|
|
8
|
-
"repository": {
|
|
9
|
-
"type": "git",
|
|
10
|
-
"url": "git+https://github.com/Akon-Labs/gitnexus-enterprise.git",
|
|
11
|
-
"directory": "gitnexus-connect"
|
|
12
|
-
},
|
|
13
|
-
"bugs": {
|
|
14
|
-
"url": "https://github.com/Akon-Labs/gitnexus-enterprise/issues"
|
|
15
|
-
},
|
|
16
|
-
"keywords": [
|
|
17
|
-
"gitnexus",
|
|
18
|
-
"mcp",
|
|
19
|
-
"model-context-protocol",
|
|
20
|
-
"claude",
|
|
21
|
-
"cursor",
|
|
22
|
-
"windsurf",
|
|
23
|
-
"code-intelligence",
|
|
24
|
-
"ai-agent"
|
|
25
|
-
],
|
|
26
|
-
"type": "module",
|
|
27
|
-
"bin": {
|
|
28
|
-
"gnx": "dist/index.js",
|
|
29
|
-
"gitnexus-connect": "dist/index.js"
|
|
30
|
-
},
|
|
31
|
-
"scripts": {
|
|
32
|
-
"build": "tsc",
|
|
33
|
-
"dev": "tsx src/index.ts",
|
|
34
|
-
"prepare": "npm run build"
|
|
35
|
-
},
|
|
36
|
-
"dependencies": {
|
|
37
|
-
"commander": "^12.0.0",
|
|
38
|
-
"picocolors": "^1.1.1"
|
|
39
|
-
},
|
|
40
|
-
"devDependencies": {
|
|
41
|
-
"@types/node": "^20.19.37",
|
|
42
|
-
"tsx": "^4.0.0",
|
|
43
|
-
"typescript": "^5.4.5"
|
|
44
|
-
},
|
|
45
|
-
"engines": {
|
|
46
|
-
"node": ">=18.0.0"
|
|
47
|
-
},
|
|
48
|
-
"files": [
|
|
49
|
-
"dist",
|
|
50
|
-
"skills"
|
|
51
|
-
],
|
|
52
|
-
"publishConfig": {}
|
|
53
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "gitnexushub",
|
|
3
|
+
"version": "0.2.12",
|
|
4
|
+
"description": "Connect your editor to GitNexus Hub — one command MCP setup + project context",
|
|
5
|
+
"author": "Abhigyan Patwari",
|
|
6
|
+
"license": "PolyForm-Noncommercial-1.0.0",
|
|
7
|
+
"homepage": "https://app.akonlabs.com",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/Akon-Labs/gitnexus-enterprise.git",
|
|
11
|
+
"directory": "gitnexus-connect"
|
|
12
|
+
},
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/Akon-Labs/gitnexus-enterprise/issues"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"gitnexus",
|
|
18
|
+
"mcp",
|
|
19
|
+
"model-context-protocol",
|
|
20
|
+
"claude",
|
|
21
|
+
"cursor",
|
|
22
|
+
"windsurf",
|
|
23
|
+
"code-intelligence",
|
|
24
|
+
"ai-agent"
|
|
25
|
+
],
|
|
26
|
+
"type": "module",
|
|
27
|
+
"bin": {
|
|
28
|
+
"gnx": "dist/index.js",
|
|
29
|
+
"gitnexus-connect": "dist/index.js"
|
|
30
|
+
},
|
|
31
|
+
"scripts": {
|
|
32
|
+
"build": "tsc",
|
|
33
|
+
"dev": "tsx src/index.ts",
|
|
34
|
+
"prepare": "npm run build"
|
|
35
|
+
},
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"commander": "^12.0.0",
|
|
38
|
+
"picocolors": "^1.1.1"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@types/node": "^20.19.37",
|
|
42
|
+
"tsx": "^4.0.0",
|
|
43
|
+
"typescript": "^5.4.5"
|
|
44
|
+
},
|
|
45
|
+
"engines": {
|
|
46
|
+
"node": ">=18.0.0"
|
|
47
|
+
},
|
|
48
|
+
"files": [
|
|
49
|
+
"dist",
|
|
50
|
+
"skills"
|
|
51
|
+
],
|
|
52
|
+
"publishConfig": {}
|
|
53
|
+
}
|
|
@@ -1,89 +1,89 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: gitnexus-debugging
|
|
3
|
-
description: "Use when the user is debugging a bug, tracing an error, or asking why something fails. Examples: \"Why is X failing?\", \"Where does this error come from?\", \"Trace this bug\""
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Debugging with GitNexus
|
|
7
|
-
|
|
8
|
-
## When to Use
|
|
9
|
-
|
|
10
|
-
- "Why is this function failing?"
|
|
11
|
-
- "Trace where this error comes from"
|
|
12
|
-
- "Who calls this method?"
|
|
13
|
-
- "This endpoint returns 500"
|
|
14
|
-
- Investigating bugs, errors, or unexpected behavior
|
|
15
|
-
|
|
16
|
-
## Workflow
|
|
17
|
-
|
|
18
|
-
```
|
|
19
|
-
1. gitnexus_query({query: "<error or symptom>"}) → Find related execution flows
|
|
20
|
-
2. gitnexus_context({name: "<suspect>"}) → See callers/callees/processes
|
|
21
|
-
3. READ gitnexus://repo/{name}/process/{name} → Trace execution flow
|
|
22
|
-
4. gitnexus_cypher({query: "MATCH path..."}) → Custom traces if needed
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
> If "Index is stale" → trigger re-indexing from the Hub dashboard.
|
|
26
|
-
|
|
27
|
-
## Checklist
|
|
28
|
-
|
|
29
|
-
```
|
|
30
|
-
- [ ] Understand the symptom (error message, unexpected behavior)
|
|
31
|
-
- [ ] gitnexus_query for error text or related code
|
|
32
|
-
- [ ] Identify the suspect function from returned processes
|
|
33
|
-
- [ ] gitnexus_context to see callers and callees
|
|
34
|
-
- [ ] Trace execution flow via process resource if applicable
|
|
35
|
-
- [ ] gitnexus_cypher for custom call chain traces if needed
|
|
36
|
-
- [ ] Read source files to confirm root cause
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
## Debugging Patterns
|
|
40
|
-
|
|
41
|
-
| Symptom | GitNexus Approach |
|
|
42
|
-
| -------------------- | ---------------------------------------------------------- |
|
|
43
|
-
| Error message | `gitnexus_query` for error text → `context` on throw sites |
|
|
44
|
-
| Wrong return value | `context` on the function → trace callees for data flow |
|
|
45
|
-
| Intermittent failure | `context` → look for external calls, async deps |
|
|
46
|
-
| Performance issue | `context` → find symbols with many callers (hot paths) |
|
|
47
|
-
| Recent regression | `impact` on changed functions → check what callers broke |
|
|
48
|
-
|
|
49
|
-
## Tools
|
|
50
|
-
|
|
51
|
-
**gitnexus_query** — find code related to error:
|
|
52
|
-
|
|
53
|
-
```
|
|
54
|
-
gitnexus_query({query: "payment validation error"})
|
|
55
|
-
→ Processes: CheckoutFlow, ErrorHandling
|
|
56
|
-
→ Symbols: validatePayment, handlePaymentError, PaymentException
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
**gitnexus_context** — full context for a suspect:
|
|
60
|
-
|
|
61
|
-
```
|
|
62
|
-
gitnexus_context({name: "validatePayment"})
|
|
63
|
-
→ Incoming calls: processCheckout, webhookHandler
|
|
64
|
-
→ Outgoing calls: verifyCard, fetchRates (external API!)
|
|
65
|
-
→ Processes: CheckoutFlow (step 3/7)
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
**gitnexus_cypher** — custom call chain traces:
|
|
69
|
-
|
|
70
|
-
```cypher
|
|
71
|
-
MATCH path = (a)-[:CodeRelation {type: 'CALLS'}*1..2]->(b:Function {name: "validatePayment"})
|
|
72
|
-
RETURN [n IN nodes(path) | n.name] AS chain
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
## Example: "Payment endpoint returns 500 intermittently"
|
|
76
|
-
|
|
77
|
-
```
|
|
78
|
-
1. gitnexus_query({query: "payment error handling"})
|
|
79
|
-
→ Processes: CheckoutFlow, ErrorHandling
|
|
80
|
-
→ Symbols: validatePayment, handlePaymentError
|
|
81
|
-
|
|
82
|
-
2. gitnexus_context({name: "validatePayment"})
|
|
83
|
-
→ Outgoing calls: verifyCard, fetchRates (external API!)
|
|
84
|
-
|
|
85
|
-
3. READ gitnexus://repo/my-app/process/CheckoutFlow
|
|
86
|
-
→ Step 3: validatePayment → calls fetchRates (external)
|
|
87
|
-
|
|
88
|
-
4. Root cause: fetchRates calls external API without proper timeout
|
|
89
|
-
```
|
|
1
|
+
---
|
|
2
|
+
name: gitnexus-debugging
|
|
3
|
+
description: "Use when the user is debugging a bug, tracing an error, or asking why something fails. Examples: \"Why is X failing?\", \"Where does this error come from?\", \"Trace this bug\""
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Debugging with GitNexus
|
|
7
|
+
|
|
8
|
+
## When to Use
|
|
9
|
+
|
|
10
|
+
- "Why is this function failing?"
|
|
11
|
+
- "Trace where this error comes from"
|
|
12
|
+
- "Who calls this method?"
|
|
13
|
+
- "This endpoint returns 500"
|
|
14
|
+
- Investigating bugs, errors, or unexpected behavior
|
|
15
|
+
|
|
16
|
+
## Workflow
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
1. gitnexus_query({query: "<error or symptom>"}) → Find related execution flows
|
|
20
|
+
2. gitnexus_context({name: "<suspect>"}) → See callers/callees/processes
|
|
21
|
+
3. READ gitnexus://repo/{name}/process/{name} → Trace execution flow
|
|
22
|
+
4. gitnexus_cypher({query: "MATCH path..."}) → Custom traces if needed
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
> If "Index is stale" → trigger re-indexing from the Hub dashboard.
|
|
26
|
+
|
|
27
|
+
## Checklist
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
- [ ] Understand the symptom (error message, unexpected behavior)
|
|
31
|
+
- [ ] gitnexus_query for error text or related code
|
|
32
|
+
- [ ] Identify the suspect function from returned processes
|
|
33
|
+
- [ ] gitnexus_context to see callers and callees
|
|
34
|
+
- [ ] Trace execution flow via process resource if applicable
|
|
35
|
+
- [ ] gitnexus_cypher for custom call chain traces if needed
|
|
36
|
+
- [ ] Read source files to confirm root cause
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Debugging Patterns
|
|
40
|
+
|
|
41
|
+
| Symptom | GitNexus Approach |
|
|
42
|
+
| -------------------- | ---------------------------------------------------------- |
|
|
43
|
+
| Error message | `gitnexus_query` for error text → `context` on throw sites |
|
|
44
|
+
| Wrong return value | `context` on the function → trace callees for data flow |
|
|
45
|
+
| Intermittent failure | `context` → look for external calls, async deps |
|
|
46
|
+
| Performance issue | `context` → find symbols with many callers (hot paths) |
|
|
47
|
+
| Recent regression | `impact` on changed functions → check what callers broke |
|
|
48
|
+
|
|
49
|
+
## Tools
|
|
50
|
+
|
|
51
|
+
**gitnexus_query** — find code related to error:
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
gitnexus_query({query: "payment validation error"})
|
|
55
|
+
→ Processes: CheckoutFlow, ErrorHandling
|
|
56
|
+
→ Symbols: validatePayment, handlePaymentError, PaymentException
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**gitnexus_context** — full context for a suspect:
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
gitnexus_context({name: "validatePayment"})
|
|
63
|
+
→ Incoming calls: processCheckout, webhookHandler
|
|
64
|
+
→ Outgoing calls: verifyCard, fetchRates (external API!)
|
|
65
|
+
→ Processes: CheckoutFlow (step 3/7)
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
**gitnexus_cypher** — custom call chain traces:
|
|
69
|
+
|
|
70
|
+
```cypher
|
|
71
|
+
MATCH path = (a)-[:CodeRelation {type: 'CALLS'}*1..2]->(b:Function {name: "validatePayment"})
|
|
72
|
+
RETURN [n IN nodes(path) | n.name] AS chain
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Example: "Payment endpoint returns 500 intermittently"
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
1. gitnexus_query({query: "payment error handling"})
|
|
79
|
+
→ Processes: CheckoutFlow, ErrorHandling
|
|
80
|
+
→ Symbols: validatePayment, handlePaymentError
|
|
81
|
+
|
|
82
|
+
2. gitnexus_context({name: "validatePayment"})
|
|
83
|
+
→ Outgoing calls: verifyCard, fetchRates (external API!)
|
|
84
|
+
|
|
85
|
+
3. READ gitnexus://repo/my-app/process/CheckoutFlow
|
|
86
|
+
→ Step 3: validatePayment → calls fetchRates (external)
|
|
87
|
+
|
|
88
|
+
4. Root cause: fetchRates calls external API without proper timeout
|
|
89
|
+
```
|