gitnexus 1.2.7 → 1.2.8
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 +186 -186
- package/dist/cli/ai-context.js +71 -71
- package/dist/cli/analyze.d.ts +1 -1
- package/dist/cli/analyze.js +59 -15
- package/dist/cli/index.js +1 -1
- package/dist/core/augmentation/engine.js +20 -20
- package/dist/core/embeddings/embedder.js +1 -0
- package/dist/core/embeddings/embedding-pipeline.js +26 -26
- package/dist/core/ingestion/cluster-enricher.js +16 -16
- package/dist/core/ingestion/tree-sitter-queries.js +282 -282
- package/dist/core/kuzu/kuzu-adapter.js +9 -9
- package/dist/core/kuzu/schema.js +256 -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/local/local-backend.js +112 -112
- package/dist/mcp/resources.js +42 -42
- package/dist/mcp/server.js +16 -16
- package/dist/mcp/tools.js +77 -77
- 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
|
@@ -1,78 +1,78 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
# GitNexus PreToolUse hook for Claude Code
|
|
3
|
-
# Intercepts Grep/Glob/Bash searches and augments with graph context.
|
|
4
|
-
# Receives JSON on stdin with { tool_name, tool_input, cwd, ... }
|
|
5
|
-
# Returns JSON with additionalContext for graph-enriched results.
|
|
6
|
-
|
|
7
|
-
INPUT=$(cat)
|
|
8
|
-
|
|
9
|
-
TOOL_NAME=$(echo "$INPUT" | jq -r '.tool_name // empty' 2>/dev/null)
|
|
10
|
-
CWD=$(echo "$INPUT" | jq -r '.cwd // empty' 2>/dev/null)
|
|
11
|
-
|
|
12
|
-
# Extract search pattern based on tool type
|
|
13
|
-
PATTERN=""
|
|
14
|
-
|
|
15
|
-
case "$TOOL_NAME" in
|
|
16
|
-
Grep)
|
|
17
|
-
PATTERN=$(echo "$INPUT" | jq -r '.tool_input.pattern // empty' 2>/dev/null)
|
|
18
|
-
;;
|
|
19
|
-
Glob)
|
|
20
|
-
# Glob patterns are file paths, not search terms — extract meaningful part
|
|
21
|
-
RAW=$(echo "$INPUT" | jq -r '.tool_input.pattern // empty' 2>/dev/null)
|
|
22
|
-
# Strip glob syntax to get the meaningful name (e.g., "**/*.ts" → skip, "auth*.ts" → "auth")
|
|
23
|
-
PATTERN=$(echo "$RAW" | sed -n 's/.*[*\/]\([a-zA-Z][a-zA-Z0-9_-]*\).*/\1/p')
|
|
24
|
-
;;
|
|
25
|
-
Bash)
|
|
26
|
-
CMD=$(echo "$INPUT" | jq -r '.tool_input.command // empty' 2>/dev/null)
|
|
27
|
-
# Only augment grep/rg commands
|
|
28
|
-
if echo "$CMD" | grep -qE '\brg\b|\bgrep\b'; then
|
|
29
|
-
# Extract pattern from rg/grep
|
|
30
|
-
if echo "$CMD" | grep -qE '\brg\b'; then
|
|
31
|
-
PATTERN=$(echo "$CMD" | sed -n "s/.*\brg\s\+\(--[^ ]*\s\+\)*['\"]\\?\([^'\";\| >]*\\).*/\2/p")
|
|
32
|
-
elif echo "$CMD" | grep -qE '\bgrep\b'; then
|
|
33
|
-
PATTERN=$(echo "$CMD" | sed -n "s/.*\bgrep\s\+\(-[^ ]*\s\+\)*['\"]\\?\([^'\";\| >]*\\).*/\2/p")
|
|
34
|
-
fi
|
|
35
|
-
fi
|
|
36
|
-
;;
|
|
37
|
-
*)
|
|
38
|
-
# Not a search tool — skip
|
|
39
|
-
exit 0
|
|
40
|
-
;;
|
|
41
|
-
esac
|
|
42
|
-
|
|
43
|
-
# Skip if pattern too short or empty
|
|
44
|
-
if [ -z "$PATTERN" ] || [ ${#PATTERN} -lt 3 ]; then
|
|
45
|
-
exit 0
|
|
46
|
-
fi
|
|
47
|
-
|
|
48
|
-
# Check if we're in a GitNexus-indexed repo
|
|
49
|
-
dir="${CWD:-$PWD}"
|
|
50
|
-
found=false
|
|
51
|
-
for i in 1 2 3 4 5; do
|
|
52
|
-
if [ -d "$dir/.gitnexus" ]; then
|
|
53
|
-
found=true
|
|
54
|
-
break
|
|
55
|
-
fi
|
|
56
|
-
parent="$(dirname "$dir")"
|
|
57
|
-
[ "$parent" = "$dir" ] && break
|
|
58
|
-
dir="$parent"
|
|
59
|
-
done
|
|
60
|
-
|
|
61
|
-
if [ "$found" = false ]; then
|
|
62
|
-
exit 0
|
|
63
|
-
fi
|
|
64
|
-
|
|
65
|
-
# Run gitnexus augment — must be fast (<500ms target)
|
|
66
|
-
RESULT=$(cd "$CWD" && npx -y gitnexus augment "$PATTERN" 2>/dev/null)
|
|
67
|
-
|
|
68
|
-
if [ -n "$RESULT" ]; then
|
|
69
|
-
ESCAPED=$(echo "$RESULT" | jq -Rs .)
|
|
70
|
-
jq -n --argjson ctx "$ESCAPED" '{
|
|
71
|
-
hookSpecificOutput: {
|
|
72
|
-
hookEventName: "PreToolUse",
|
|
73
|
-
additionalContext: $ctx
|
|
74
|
-
}
|
|
75
|
-
}'
|
|
76
|
-
else
|
|
77
|
-
exit 0
|
|
78
|
-
fi
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# GitNexus PreToolUse hook for Claude Code
|
|
3
|
+
# Intercepts Grep/Glob/Bash searches and augments with graph context.
|
|
4
|
+
# Receives JSON on stdin with { tool_name, tool_input, cwd, ... }
|
|
5
|
+
# Returns JSON with additionalContext for graph-enriched results.
|
|
6
|
+
|
|
7
|
+
INPUT=$(cat)
|
|
8
|
+
|
|
9
|
+
TOOL_NAME=$(echo "$INPUT" | jq -r '.tool_name // empty' 2>/dev/null)
|
|
10
|
+
CWD=$(echo "$INPUT" | jq -r '.cwd // empty' 2>/dev/null)
|
|
11
|
+
|
|
12
|
+
# Extract search pattern based on tool type
|
|
13
|
+
PATTERN=""
|
|
14
|
+
|
|
15
|
+
case "$TOOL_NAME" in
|
|
16
|
+
Grep)
|
|
17
|
+
PATTERN=$(echo "$INPUT" | jq -r '.tool_input.pattern // empty' 2>/dev/null)
|
|
18
|
+
;;
|
|
19
|
+
Glob)
|
|
20
|
+
# Glob patterns are file paths, not search terms — extract meaningful part
|
|
21
|
+
RAW=$(echo "$INPUT" | jq -r '.tool_input.pattern // empty' 2>/dev/null)
|
|
22
|
+
# Strip glob syntax to get the meaningful name (e.g., "**/*.ts" → skip, "auth*.ts" → "auth")
|
|
23
|
+
PATTERN=$(echo "$RAW" | sed -n 's/.*[*\/]\([a-zA-Z][a-zA-Z0-9_-]*\).*/\1/p')
|
|
24
|
+
;;
|
|
25
|
+
Bash)
|
|
26
|
+
CMD=$(echo "$INPUT" | jq -r '.tool_input.command // empty' 2>/dev/null)
|
|
27
|
+
# Only augment grep/rg commands
|
|
28
|
+
if echo "$CMD" | grep -qE '\brg\b|\bgrep\b'; then
|
|
29
|
+
# Extract pattern from rg/grep
|
|
30
|
+
if echo "$CMD" | grep -qE '\brg\b'; then
|
|
31
|
+
PATTERN=$(echo "$CMD" | sed -n "s/.*\brg\s\+\(--[^ ]*\s\+\)*['\"]\\?\([^'\";\| >]*\\).*/\2/p")
|
|
32
|
+
elif echo "$CMD" | grep -qE '\bgrep\b'; then
|
|
33
|
+
PATTERN=$(echo "$CMD" | sed -n "s/.*\bgrep\s\+\(-[^ ]*\s\+\)*['\"]\\?\([^'\";\| >]*\\).*/\2/p")
|
|
34
|
+
fi
|
|
35
|
+
fi
|
|
36
|
+
;;
|
|
37
|
+
*)
|
|
38
|
+
# Not a search tool — skip
|
|
39
|
+
exit 0
|
|
40
|
+
;;
|
|
41
|
+
esac
|
|
42
|
+
|
|
43
|
+
# Skip if pattern too short or empty
|
|
44
|
+
if [ -z "$PATTERN" ] || [ ${#PATTERN} -lt 3 ]; then
|
|
45
|
+
exit 0
|
|
46
|
+
fi
|
|
47
|
+
|
|
48
|
+
# Check if we're in a GitNexus-indexed repo
|
|
49
|
+
dir="${CWD:-$PWD}"
|
|
50
|
+
found=false
|
|
51
|
+
for i in 1 2 3 4 5; do
|
|
52
|
+
if [ -d "$dir/.gitnexus" ]; then
|
|
53
|
+
found=true
|
|
54
|
+
break
|
|
55
|
+
fi
|
|
56
|
+
parent="$(dirname "$dir")"
|
|
57
|
+
[ "$parent" = "$dir" ] && break
|
|
58
|
+
dir="$parent"
|
|
59
|
+
done
|
|
60
|
+
|
|
61
|
+
if [ "$found" = false ]; then
|
|
62
|
+
exit 0
|
|
63
|
+
fi
|
|
64
|
+
|
|
65
|
+
# Run gitnexus augment — must be fast (<500ms target)
|
|
66
|
+
RESULT=$(cd "$CWD" && npx -y gitnexus augment "$PATTERN" 2>/dev/null)
|
|
67
|
+
|
|
68
|
+
if [ -n "$RESULT" ]; then
|
|
69
|
+
ESCAPED=$(echo "$RESULT" | jq -Rs .)
|
|
70
|
+
jq -n --argjson ctx "$ESCAPED" '{
|
|
71
|
+
hookSpecificOutput: {
|
|
72
|
+
hookEventName: "PreToolUse",
|
|
73
|
+
additionalContext: $ctx
|
|
74
|
+
}
|
|
75
|
+
}'
|
|
76
|
+
else
|
|
77
|
+
exit 0
|
|
78
|
+
fi
|
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
# GitNexus SessionStart hook for Claude Code
|
|
3
|
-
# Fires on session startup. Stdout is injected into Claude's context.
|
|
4
|
-
# Checks if the current directory has a GitNexus index.
|
|
5
|
-
|
|
6
|
-
dir="$PWD"
|
|
7
|
-
found=false
|
|
8
|
-
for i in 1 2 3 4 5; do
|
|
9
|
-
if [ -d "$dir/.gitnexus" ]; then
|
|
10
|
-
found=true
|
|
11
|
-
break
|
|
12
|
-
fi
|
|
13
|
-
parent="$(dirname "$dir")"
|
|
14
|
-
[ "$parent" = "$dir" ] && break
|
|
15
|
-
dir="$parent"
|
|
16
|
-
done
|
|
17
|
-
|
|
18
|
-
if [ "$found" = false ]; then
|
|
19
|
-
exit 0
|
|
20
|
-
fi
|
|
21
|
-
|
|
22
|
-
# Inject GitNexus context — this stdout goes directly into Claude's context
|
|
23
|
-
cat << 'EOF'
|
|
24
|
-
## GitNexus Code Intelligence
|
|
25
|
-
|
|
26
|
-
This codebase is indexed by GitNexus, providing a knowledge graph with execution flows, relationships, and semantic search.
|
|
27
|
-
|
|
28
|
-
**Available MCP Tools:**
|
|
29
|
-
- `query` — Process-grouped code intelligence (execution flows related to a concept)
|
|
30
|
-
- `context` — 360-degree symbol view (categorized refs, process participation)
|
|
31
|
-
- `impact` — Blast radius analysis (what breaks if you change a symbol)
|
|
32
|
-
- `detect_changes` — Git-diff impact analysis (what do your changes affect)
|
|
33
|
-
- `rename` — Multi-file coordinated rename with confidence tags
|
|
34
|
-
- `cypher` — Raw graph queries
|
|
35
|
-
- `list_repos` — Discover indexed repos
|
|
36
|
-
|
|
37
|
-
**Quick Start:** READ `gitnexus://repo/{name}/context` for codebase overview, then use `query` to find execution flows.
|
|
38
|
-
|
|
39
|
-
**Resources:** `gitnexus://repo/{name}/context` (overview), `/processes` (execution flows), `/schema` (for Cypher)
|
|
40
|
-
EOF
|
|
41
|
-
|
|
42
|
-
exit 0
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# GitNexus SessionStart hook for Claude Code
|
|
3
|
+
# Fires on session startup. Stdout is injected into Claude's context.
|
|
4
|
+
# Checks if the current directory has a GitNexus index.
|
|
5
|
+
|
|
6
|
+
dir="$PWD"
|
|
7
|
+
found=false
|
|
8
|
+
for i in 1 2 3 4 5; do
|
|
9
|
+
if [ -d "$dir/.gitnexus" ]; then
|
|
10
|
+
found=true
|
|
11
|
+
break
|
|
12
|
+
fi
|
|
13
|
+
parent="$(dirname "$dir")"
|
|
14
|
+
[ "$parent" = "$dir" ] && break
|
|
15
|
+
dir="$parent"
|
|
16
|
+
done
|
|
17
|
+
|
|
18
|
+
if [ "$found" = false ]; then
|
|
19
|
+
exit 0
|
|
20
|
+
fi
|
|
21
|
+
|
|
22
|
+
# Inject GitNexus context — this stdout goes directly into Claude's context
|
|
23
|
+
cat << 'EOF'
|
|
24
|
+
## GitNexus Code Intelligence
|
|
25
|
+
|
|
26
|
+
This codebase is indexed by GitNexus, providing a knowledge graph with execution flows, relationships, and semantic search.
|
|
27
|
+
|
|
28
|
+
**Available MCP Tools:**
|
|
29
|
+
- `query` — Process-grouped code intelligence (execution flows related to a concept)
|
|
30
|
+
- `context` — 360-degree symbol view (categorized refs, process participation)
|
|
31
|
+
- `impact` — Blast radius analysis (what breaks if you change a symbol)
|
|
32
|
+
- `detect_changes` — Git-diff impact analysis (what do your changes affect)
|
|
33
|
+
- `rename` — Multi-file coordinated rename with confidence tags
|
|
34
|
+
- `cypher` — Raw graph queries
|
|
35
|
+
- `list_repos` — Discover indexed repos
|
|
36
|
+
|
|
37
|
+
**Quick Start:** READ `gitnexus://repo/{name}/context` for codebase overview, then use `query` to find execution flows.
|
|
38
|
+
|
|
39
|
+
**Resources:** `gitnexus://repo/{name}/context` (overview), `/processes` (execution flows), `/schema` (for Cypher)
|
|
40
|
+
EOF
|
|
41
|
+
|
|
42
|
+
exit 0
|
package/package.json
CHANGED
|
@@ -1,82 +1,82 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "gitnexus",
|
|
3
|
-
"version": "1.2.
|
|
4
|
-
"description": "Graph-powered code intelligence for AI agents. Index any codebase, query via MCP or CLI.",
|
|
5
|
-
"author": "Abhigyan Patwari",
|
|
6
|
-
"license": "PolyForm-Noncommercial-1.0.0",
|
|
7
|
-
"homepage": "https://github.com/abhigyanpatwari/GitNexus#readme",
|
|
8
|
-
"repository": {
|
|
9
|
-
"type": "git",
|
|
10
|
-
"url": "git+https://github.com/abhigyanpatwari/GitNexus.git",
|
|
11
|
-
"directory": "gitnexus"
|
|
12
|
-
},
|
|
13
|
-
"bugs": {
|
|
14
|
-
"url": "https://github.com/abhigyanpatwari/GitNexus/issues"
|
|
15
|
-
},
|
|
16
|
-
"keywords": [
|
|
17
|
-
"mcp",
|
|
18
|
-
"model-context-protocol",
|
|
19
|
-
"code-intelligence",
|
|
20
|
-
"knowledge-graph",
|
|
21
|
-
"cursor",
|
|
22
|
-
"claude",
|
|
23
|
-
"ai-agent",
|
|
24
|
-
"gitnexus",
|
|
25
|
-
"static-analysis",
|
|
26
|
-
"codebase-indexing"
|
|
27
|
-
],
|
|
28
|
-
"type": "module",
|
|
29
|
-
"bin": {
|
|
30
|
-
"gitnexus": "dist/cli/index.js"
|
|
31
|
-
},
|
|
32
|
-
"files": [
|
|
33
|
-
"dist",
|
|
34
|
-
"hooks",
|
|
35
|
-
"skills",
|
|
36
|
-
"vendor"
|
|
37
|
-
],
|
|
38
|
-
"scripts": {
|
|
39
|
-
"build": "tsc",
|
|
40
|
-
"dev": "tsx watch src/cli/index.ts",
|
|
41
|
-
"prepare": "npm run build"
|
|
42
|
-
},
|
|
43
|
-
"dependencies": {
|
|
44
|
-
"@huggingface/transformers": "^3.0.0",
|
|
45
|
-
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
46
|
-
"cli-progress": "^3.12.0",
|
|
47
|
-
"commander": "^12.0.0",
|
|
48
|
-
"cors": "^2.8.5",
|
|
49
|
-
"express": "^4.19.2",
|
|
50
|
-
"glob": "^11.0.0",
|
|
51
|
-
"graphology": "^0.25.4",
|
|
52
|
-
"graphology-indices": "^0.17.0",
|
|
53
|
-
"graphology-utils": "^2.3.0",
|
|
54
|
-
"kuzu": "^0.11.3",
|
|
55
|
-
"lru-cache": "^11.0.0",
|
|
56
|
-
"mnemonist": "^0.39.0",
|
|
57
|
-
"pandemonium": "^2.4.0",
|
|
58
|
-
"tree-sitter": "^0.21.0",
|
|
59
|
-
"tree-sitter-c": "^0.21.0",
|
|
60
|
-
"tree-sitter-c-sharp": "^0.21.0",
|
|
61
|
-
"tree-sitter-cpp": "^0.22.0",
|
|
62
|
-
"tree-sitter-go": "^0.21.0",
|
|
63
|
-
"tree-sitter-java": "^0.21.0",
|
|
64
|
-
"tree-sitter-javascript": "^0.21.0",
|
|
65
|
-
"tree-sitter-python": "^0.21.0",
|
|
66
|
-
"tree-sitter-rust": "^0.21.0",
|
|
67
|
-
"tree-sitter-typescript": "^0.21.0",
|
|
68
|
-
"typescript": "^5.4.5",
|
|
69
|
-
"uuid": "^13.0.0"
|
|
70
|
-
},
|
|
71
|
-
"devDependencies": {
|
|
72
|
-
"@types/cli-progress": "^3.11.6",
|
|
73
|
-
"@types/cors": "^2.8.17",
|
|
74
|
-
"@types/express": "^4.17.21",
|
|
75
|
-
"@types/node": "^20.0.0",
|
|
76
|
-
"@types/uuid": "^10.0.0",
|
|
77
|
-
"tsx": "^4.0.0"
|
|
78
|
-
},
|
|
79
|
-
"engines": {
|
|
80
|
-
"node": ">=18.0.0"
|
|
81
|
-
}
|
|
82
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "gitnexus",
|
|
3
|
+
"version": "1.2.8",
|
|
4
|
+
"description": "Graph-powered code intelligence for AI agents. Index any codebase, query via MCP or CLI.",
|
|
5
|
+
"author": "Abhigyan Patwari",
|
|
6
|
+
"license": "PolyForm-Noncommercial-1.0.0",
|
|
7
|
+
"homepage": "https://github.com/abhigyanpatwari/GitNexus#readme",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/abhigyanpatwari/GitNexus.git",
|
|
11
|
+
"directory": "gitnexus"
|
|
12
|
+
},
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/abhigyanpatwari/GitNexus/issues"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"mcp",
|
|
18
|
+
"model-context-protocol",
|
|
19
|
+
"code-intelligence",
|
|
20
|
+
"knowledge-graph",
|
|
21
|
+
"cursor",
|
|
22
|
+
"claude",
|
|
23
|
+
"ai-agent",
|
|
24
|
+
"gitnexus",
|
|
25
|
+
"static-analysis",
|
|
26
|
+
"codebase-indexing"
|
|
27
|
+
],
|
|
28
|
+
"type": "module",
|
|
29
|
+
"bin": {
|
|
30
|
+
"gitnexus": "dist/cli/index.js"
|
|
31
|
+
},
|
|
32
|
+
"files": [
|
|
33
|
+
"dist",
|
|
34
|
+
"hooks",
|
|
35
|
+
"skills",
|
|
36
|
+
"vendor"
|
|
37
|
+
],
|
|
38
|
+
"scripts": {
|
|
39
|
+
"build": "tsc",
|
|
40
|
+
"dev": "tsx watch src/cli/index.ts",
|
|
41
|
+
"prepare": "npm run build"
|
|
42
|
+
},
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"@huggingface/transformers": "^3.0.0",
|
|
45
|
+
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
46
|
+
"cli-progress": "^3.12.0",
|
|
47
|
+
"commander": "^12.0.0",
|
|
48
|
+
"cors": "^2.8.5",
|
|
49
|
+
"express": "^4.19.2",
|
|
50
|
+
"glob": "^11.0.0",
|
|
51
|
+
"graphology": "^0.25.4",
|
|
52
|
+
"graphology-indices": "^0.17.0",
|
|
53
|
+
"graphology-utils": "^2.3.0",
|
|
54
|
+
"kuzu": "^0.11.3",
|
|
55
|
+
"lru-cache": "^11.0.0",
|
|
56
|
+
"mnemonist": "^0.39.0",
|
|
57
|
+
"pandemonium": "^2.4.0",
|
|
58
|
+
"tree-sitter": "^0.21.0",
|
|
59
|
+
"tree-sitter-c": "^0.21.0",
|
|
60
|
+
"tree-sitter-c-sharp": "^0.21.0",
|
|
61
|
+
"tree-sitter-cpp": "^0.22.0",
|
|
62
|
+
"tree-sitter-go": "^0.21.0",
|
|
63
|
+
"tree-sitter-java": "^0.21.0",
|
|
64
|
+
"tree-sitter-javascript": "^0.21.0",
|
|
65
|
+
"tree-sitter-python": "^0.21.0",
|
|
66
|
+
"tree-sitter-rust": "^0.21.0",
|
|
67
|
+
"tree-sitter-typescript": "^0.21.0",
|
|
68
|
+
"typescript": "^5.4.5",
|
|
69
|
+
"uuid": "^13.0.0"
|
|
70
|
+
},
|
|
71
|
+
"devDependencies": {
|
|
72
|
+
"@types/cli-progress": "^3.11.6",
|
|
73
|
+
"@types/cors": "^2.8.17",
|
|
74
|
+
"@types/express": "^4.17.21",
|
|
75
|
+
"@types/node": "^20.0.0",
|
|
76
|
+
"@types/uuid": "^10.0.0",
|
|
77
|
+
"tsx": "^4.0.0"
|
|
78
|
+
},
|
|
79
|
+
"engines": {
|
|
80
|
+
"node": ">=18.0.0"
|
|
81
|
+
}
|
|
82
|
+
}
|
package/skills/debugging.md
CHANGED
|
@@ -1,85 +1,85 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: gitnexus-debugging
|
|
3
|
-
description: Trace bugs through call chains using knowledge graph
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Debugging with GitNexus
|
|
7
|
-
|
|
8
|
-
## When to Use
|
|
9
|
-
- "Why is this function failing?"
|
|
10
|
-
- "Trace where this error comes from"
|
|
11
|
-
- "Who calls this method?"
|
|
12
|
-
- "This endpoint returns 500"
|
|
13
|
-
- Investigating bugs, errors, or unexpected behavior
|
|
14
|
-
|
|
15
|
-
## Workflow
|
|
16
|
-
|
|
17
|
-
```
|
|
18
|
-
1. gitnexus_query({query: "<error or symptom>"}) → Find related execution flows
|
|
19
|
-
2. gitnexus_context({name: "<suspect>"}) → See callers/callees/processes
|
|
20
|
-
3. READ gitnexus://repo/{name}/process/{name} → Trace execution flow
|
|
21
|
-
4. gitnexus_cypher({query: "MATCH path..."}) → Custom traces if needed
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
> If "Index is stale" → run `npx gitnexus analyze` in terminal.
|
|
25
|
-
|
|
26
|
-
## Checklist
|
|
27
|
-
|
|
28
|
-
```
|
|
29
|
-
- [ ] Understand the symptom (error message, unexpected behavior)
|
|
30
|
-
- [ ] gitnexus_query for error text or related code
|
|
31
|
-
- [ ] Identify the suspect function from returned processes
|
|
32
|
-
- [ ] gitnexus_context to see callers and callees
|
|
33
|
-
- [ ] Trace execution flow via process resource if applicable
|
|
34
|
-
- [ ] gitnexus_cypher for custom call chain traces if needed
|
|
35
|
-
- [ ] Read source files to confirm root cause
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
## Debugging Patterns
|
|
39
|
-
|
|
40
|
-
| Symptom | GitNexus Approach |
|
|
41
|
-
|---------|-------------------|
|
|
42
|
-
| Error message | `gitnexus_query` for error text → `context` on throw sites |
|
|
43
|
-
| Wrong return value | `context` on the function → trace callees for data flow |
|
|
44
|
-
| Intermittent failure | `context` → look for external calls, async deps |
|
|
45
|
-
| Performance issue | `context` → find symbols with many callers (hot paths) |
|
|
46
|
-
| Recent regression | `detect_changes` to see what your changes affect |
|
|
47
|
-
|
|
48
|
-
## Tools
|
|
49
|
-
|
|
50
|
-
**gitnexus_query** — find code related to error:
|
|
51
|
-
```
|
|
52
|
-
gitnexus_query({query: "payment validation error"})
|
|
53
|
-
→ Processes: CheckoutFlow, ErrorHandling
|
|
54
|
-
→ Symbols: validatePayment, handlePaymentError, PaymentException
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
**gitnexus_context** — full context for a suspect:
|
|
58
|
-
```
|
|
59
|
-
gitnexus_context({name: "validatePayment"})
|
|
60
|
-
→ Incoming calls: processCheckout, webhookHandler
|
|
61
|
-
→ Outgoing calls: verifyCard, fetchRates (external API!)
|
|
62
|
-
→ Processes: CheckoutFlow (step 3/7)
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
**gitnexus_cypher** — custom call chain traces:
|
|
66
|
-
```cypher
|
|
67
|
-
MATCH path = (a)-[:CodeRelation {type: 'CALLS'}*1..2]->(b:Function {name: "validatePayment"})
|
|
68
|
-
RETURN [n IN nodes(path) | n.name] AS chain
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
## Example: "Payment endpoint returns 500 intermittently"
|
|
72
|
-
|
|
73
|
-
```
|
|
74
|
-
1. gitnexus_query({query: "payment error handling"})
|
|
75
|
-
→ Processes: CheckoutFlow, ErrorHandling
|
|
76
|
-
→ Symbols: validatePayment, handlePaymentError
|
|
77
|
-
|
|
78
|
-
2. gitnexus_context({name: "validatePayment"})
|
|
79
|
-
→ Outgoing calls: verifyCard, fetchRates (external API!)
|
|
80
|
-
|
|
81
|
-
3. READ gitnexus://repo/my-app/process/CheckoutFlow
|
|
82
|
-
→ Step 3: validatePayment → calls fetchRates (external)
|
|
83
|
-
|
|
84
|
-
4. Root cause: fetchRates calls external API without proper timeout
|
|
85
|
-
```
|
|
1
|
+
---
|
|
2
|
+
name: gitnexus-debugging
|
|
3
|
+
description: Trace bugs through call chains using knowledge graph
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Debugging with GitNexus
|
|
7
|
+
|
|
8
|
+
## When to Use
|
|
9
|
+
- "Why is this function failing?"
|
|
10
|
+
- "Trace where this error comes from"
|
|
11
|
+
- "Who calls this method?"
|
|
12
|
+
- "This endpoint returns 500"
|
|
13
|
+
- Investigating bugs, errors, or unexpected behavior
|
|
14
|
+
|
|
15
|
+
## Workflow
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
1. gitnexus_query({query: "<error or symptom>"}) → Find related execution flows
|
|
19
|
+
2. gitnexus_context({name: "<suspect>"}) → See callers/callees/processes
|
|
20
|
+
3. READ gitnexus://repo/{name}/process/{name} → Trace execution flow
|
|
21
|
+
4. gitnexus_cypher({query: "MATCH path..."}) → Custom traces if needed
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
> If "Index is stale" → run `npx gitnexus analyze` in terminal.
|
|
25
|
+
|
|
26
|
+
## Checklist
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
- [ ] Understand the symptom (error message, unexpected behavior)
|
|
30
|
+
- [ ] gitnexus_query for error text or related code
|
|
31
|
+
- [ ] Identify the suspect function from returned processes
|
|
32
|
+
- [ ] gitnexus_context to see callers and callees
|
|
33
|
+
- [ ] Trace execution flow via process resource if applicable
|
|
34
|
+
- [ ] gitnexus_cypher for custom call chain traces if needed
|
|
35
|
+
- [ ] Read source files to confirm root cause
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Debugging Patterns
|
|
39
|
+
|
|
40
|
+
| Symptom | GitNexus Approach |
|
|
41
|
+
|---------|-------------------|
|
|
42
|
+
| Error message | `gitnexus_query` for error text → `context` on throw sites |
|
|
43
|
+
| Wrong return value | `context` on the function → trace callees for data flow |
|
|
44
|
+
| Intermittent failure | `context` → look for external calls, async deps |
|
|
45
|
+
| Performance issue | `context` → find symbols with many callers (hot paths) |
|
|
46
|
+
| Recent regression | `detect_changes` to see what your changes affect |
|
|
47
|
+
|
|
48
|
+
## Tools
|
|
49
|
+
|
|
50
|
+
**gitnexus_query** — find code related to error:
|
|
51
|
+
```
|
|
52
|
+
gitnexus_query({query: "payment validation error"})
|
|
53
|
+
→ Processes: CheckoutFlow, ErrorHandling
|
|
54
|
+
→ Symbols: validatePayment, handlePaymentError, PaymentException
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
**gitnexus_context** — full context for a suspect:
|
|
58
|
+
```
|
|
59
|
+
gitnexus_context({name: "validatePayment"})
|
|
60
|
+
→ Incoming calls: processCheckout, webhookHandler
|
|
61
|
+
→ Outgoing calls: verifyCard, fetchRates (external API!)
|
|
62
|
+
→ Processes: CheckoutFlow (step 3/7)
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
**gitnexus_cypher** — custom call chain traces:
|
|
66
|
+
```cypher
|
|
67
|
+
MATCH path = (a)-[:CodeRelation {type: 'CALLS'}*1..2]->(b:Function {name: "validatePayment"})
|
|
68
|
+
RETURN [n IN nodes(path) | n.name] AS chain
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Example: "Payment endpoint returns 500 intermittently"
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
1. gitnexus_query({query: "payment error handling"})
|
|
75
|
+
→ Processes: CheckoutFlow, ErrorHandling
|
|
76
|
+
→ Symbols: validatePayment, handlePaymentError
|
|
77
|
+
|
|
78
|
+
2. gitnexus_context({name: "validatePayment"})
|
|
79
|
+
→ Outgoing calls: verifyCard, fetchRates (external API!)
|
|
80
|
+
|
|
81
|
+
3. READ gitnexus://repo/my-app/process/CheckoutFlow
|
|
82
|
+
→ Step 3: validatePayment → calls fetchRates (external)
|
|
83
|
+
|
|
84
|
+
4. Root cause: fetchRates calls external API without proper timeout
|
|
85
|
+
```
|