gitnexushub 0.2.1 → 0.2.2
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/content.js +1 -15
- package/package.json +1 -1
- package/skills/gitnexus-debugging.md +2 -2
- package/skills/gitnexus-exploring.md +1 -1
- package/skills/gitnexus-impact-analysis.md +18 -16
- package/skills/gitnexus-pr-review.md +13 -15
- package/skills/gitnexus-guide.md +0 -64
- package/skills/gitnexus-refactoring.md +0 -121
package/dist/content.js
CHANGED
|
@@ -16,8 +16,6 @@ export const HUB_SKILLS = [
|
|
|
16
16
|
'gitnexus-exploring',
|
|
17
17
|
'gitnexus-debugging',
|
|
18
18
|
'gitnexus-impact-analysis',
|
|
19
|
-
'gitnexus-refactoring',
|
|
20
|
-
'gitnexus-guide',
|
|
21
19
|
'gitnexus-pr-review',
|
|
22
20
|
];
|
|
23
21
|
/**
|
|
@@ -89,18 +87,6 @@ Before completing any code modification task, verify:
|
|
|
89
87
|
|
|
90
88
|
${GITNEXUS_END_MARKER}`;
|
|
91
89
|
}
|
|
92
|
-
/**
|
|
93
|
-
* Replace CLI references with Hub dashboard instructions.
|
|
94
|
-
*/
|
|
95
|
-
function adaptSkillForHub(content) {
|
|
96
|
-
return content
|
|
97
|
-
.replace(/run `npx gitnexus analyze` in terminal\.?/g, 'trigger re-indexing from the Hub dashboard.')
|
|
98
|
-
.replace(/run `npx gitnexus analyze` in the terminal first\.?/g, 'trigger re-indexing from the Hub dashboard.')
|
|
99
|
-
.replace(/> If "Index is stale" → run `npx gitnexus analyze` in terminal\.?/g, '> If "Index is stale" → trigger re-indexing from the Hub dashboard.')
|
|
100
|
-
.replace(/> If step 2 says "Index is stale" → run `npx gitnexus analyze` in terminal\.?/g, '> If step 2 says "Index is stale" → trigger re-indexing from the Hub dashboard.')
|
|
101
|
-
.replace(/> If step 1 warns the index is stale, run `npx gitnexus analyze` in the terminal first\.?/g, '> If step 1 warns the index is stale, trigger re-indexing from the Hub dashboard.')
|
|
102
|
-
.replace(/> If any GitNexus tool warns the index is stale, run `npx gitnexus analyze` in terminal first\.?/g, '> Re-indexing is managed from the GitNexus Hub dashboard.');
|
|
103
|
-
}
|
|
104
90
|
/**
|
|
105
91
|
* Load bundled skills from the package's own skills/ directory.
|
|
106
92
|
* Skills ship with the npm package — no Hub API needed.
|
|
@@ -113,7 +99,7 @@ async function loadBundledSkills() {
|
|
|
113
99
|
try {
|
|
114
100
|
const skillPath = path.join(skillsDir, `${skillName}.md`);
|
|
115
101
|
const raw = await fs.readFile(skillPath, 'utf-8');
|
|
116
|
-
skills.push({ name: skillName, content:
|
|
102
|
+
skills.push({ name: skillName, content: raw });
|
|
117
103
|
}
|
|
118
104
|
catch {
|
|
119
105
|
// Skill file not found — skip
|
package/package.json
CHANGED
|
@@ -22,7 +22,7 @@ description: "Use when the user is debugging a bug, tracing an error, or asking
|
|
|
22
22
|
4. gitnexus_cypher({query: "MATCH path..."}) → Custom traces if needed
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
-
> If "Index is stale" →
|
|
25
|
+
> If "Index is stale" → trigger re-indexing from the Hub dashboard.
|
|
26
26
|
|
|
27
27
|
## Checklist
|
|
28
28
|
|
|
@@ -44,7 +44,7 @@ description: "Use when the user is debugging a bug, tracing an error, or asking
|
|
|
44
44
|
| Wrong return value | `context` on the function → trace callees for data flow |
|
|
45
45
|
| Intermittent failure | `context` → look for external calls, async deps |
|
|
46
46
|
| Performance issue | `context` → find symbols with many callers (hot paths) |
|
|
47
|
-
| Recent regression | `
|
|
47
|
+
| Recent regression | `impact` on changed functions → check what callers broke |
|
|
48
48
|
|
|
49
49
|
## Tools
|
|
50
50
|
|
|
@@ -23,7 +23,7 @@ description: "Use when the user asks how code works, wants to understand archite
|
|
|
23
23
|
5. READ gitnexus://repo/{name}/process/{name} → Trace full execution flow
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
-
> If step 2 says "Index is stale" →
|
|
26
|
+
> If step 2 says "Index is stale" → trigger re-indexing from the Hub dashboard.
|
|
27
27
|
|
|
28
28
|
## Checklist
|
|
29
29
|
|
|
@@ -12,27 +12,25 @@ description: "Use when the user wants to know what will break if they change som
|
|
|
12
12
|
- "Show me the blast radius"
|
|
13
13
|
- "Who uses this code?"
|
|
14
14
|
- Before making non-trivial code changes
|
|
15
|
-
- Before committing — to understand what your changes affect
|
|
16
15
|
|
|
17
16
|
## Workflow
|
|
18
17
|
|
|
19
18
|
```
|
|
20
19
|
1. gitnexus_impact({target: "X", direction: "upstream"}) → What depends on this
|
|
21
|
-
2.
|
|
22
|
-
3.
|
|
23
|
-
4.
|
|
20
|
+
2. Review d=1 items (WILL BREAK) and affected processes
|
|
21
|
+
3. gitnexus_context({name: "<high-risk symbol>"}) → Understand callers/callees
|
|
22
|
+
4. READ gitnexus://repo/{name}/process/{name} → Trace affected execution flows
|
|
23
|
+
5. Assess risk and report to user
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
-
> If "Index is stale" → run `npx gitnexus analyze` in terminal.
|
|
27
|
-
|
|
28
26
|
## Checklist
|
|
29
27
|
|
|
30
28
|
```
|
|
31
29
|
- [ ] gitnexus_impact({target, direction: "upstream"}) to find dependents
|
|
32
30
|
- [ ] Review d=1 items first (these WILL BREAK)
|
|
33
31
|
- [ ] Check high-confidence (>0.8) dependencies
|
|
32
|
+
- [ ] gitnexus_context on high-risk d=1 symbols
|
|
34
33
|
- [ ] READ processes to check affected execution flows
|
|
35
|
-
- [ ] gitnexus_detect_changes() for pre-commit check
|
|
36
34
|
- [ ] Assess risk level and report to user
|
|
37
35
|
```
|
|
38
36
|
|
|
@@ -73,14 +71,13 @@ gitnexus_impact({
|
|
|
73
71
|
- authRouter (src/routes/auth.ts:22) [CALLS, 95%]
|
|
74
72
|
```
|
|
75
73
|
|
|
76
|
-
**
|
|
74
|
+
**gitnexus_context** — understand high-risk dependents:
|
|
77
75
|
|
|
78
76
|
```
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
→
|
|
82
|
-
→
|
|
83
|
-
→ Risk: MEDIUM
|
|
77
|
+
gitnexus_context({name: "loginHandler"})
|
|
78
|
+
→ Incoming calls: authRouter, oauthCallback
|
|
79
|
+
→ Outgoing calls: validateUser, createSession
|
|
80
|
+
→ Processes: LoginFlow (step 2/5)
|
|
84
81
|
```
|
|
85
82
|
|
|
86
83
|
## Example: "What breaks if I change validateUser?"
|
|
@@ -89,9 +86,14 @@ gitnexus_detect_changes({scope: "staged"})
|
|
|
89
86
|
1. gitnexus_impact({target: "validateUser", direction: "upstream"})
|
|
90
87
|
→ d=1: loginHandler, apiMiddleware (WILL BREAK)
|
|
91
88
|
→ d=2: authRouter, sessionManager (LIKELY AFFECTED)
|
|
89
|
+
→ Affected processes: LoginFlow, TokenRefresh
|
|
90
|
+
→ Risk: MEDIUM
|
|
91
|
+
|
|
92
|
+
2. gitnexus_context({name: "loginHandler"})
|
|
93
|
+
→ Understand how loginHandler uses validateUser
|
|
92
94
|
|
|
93
|
-
|
|
94
|
-
→
|
|
95
|
+
3. READ gitnexus://repo/my-app/process/LoginFlow
|
|
96
|
+
→ Full execution trace to see where validateUser fits
|
|
95
97
|
|
|
96
|
-
|
|
98
|
+
4. Risk: 2 direct callers, 2 processes = MEDIUM
|
|
97
99
|
```
|
|
@@ -17,22 +17,20 @@ description: "Use when the user wants to review a pull request, understand what
|
|
|
17
17
|
## Workflow
|
|
18
18
|
|
|
19
19
|
```
|
|
20
|
-
1. gh pr diff <number>
|
|
21
|
-
2.
|
|
22
|
-
3.
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
5.
|
|
20
|
+
1. gh pr diff <number> or git diff main...HEAD → Get changed files
|
|
21
|
+
2. git diff main...HEAD --name-only → Get file list
|
|
22
|
+
3. gitnexus_detect_changes({changed_files: ["file1", "file2", ...]}) → Map to affected flows
|
|
23
|
+
4. For each changed symbol:
|
|
24
|
+
gitnexus_impact({target: "<symbol>", direction: "upstream"}) → Blast radius per change
|
|
25
|
+
5. gitnexus_context({name: "<key symbol>"}) → Understand callers/callees
|
|
26
26
|
6. Summarize findings with risk assessment
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
-
> If "Index is stale" → run `npx gitnexus analyze` in terminal before reviewing.
|
|
30
|
-
|
|
31
29
|
## Checklist
|
|
32
30
|
|
|
33
31
|
```
|
|
34
|
-
- [ ]
|
|
35
|
-
- [ ] gitnexus_detect_changes to map changes to affected
|
|
32
|
+
- [ ] Get PR diff and file list (gh pr diff / git diff --name-only)
|
|
33
|
+
- [ ] gitnexus_detect_changes({changed_files: [...]}) to map changes to affected flows
|
|
36
34
|
- [ ] gitnexus_impact on each non-trivial changed symbol
|
|
37
35
|
- [ ] Review d=1 items (WILL BREAK) — are callers updated?
|
|
38
36
|
- [ ] gitnexus_context on key changed symbols to understand full picture
|
|
@@ -66,9 +64,9 @@ description: "Use when the user wants to review a pull request, understand what
|
|
|
66
64
|
**gitnexus_detect_changes** — map PR diff to affected execution flows:
|
|
67
65
|
|
|
68
66
|
```
|
|
69
|
-
gitnexus_detect_changes({
|
|
67
|
+
gitnexus_detect_changes({changed_files: ["src/payments.ts", "src/checkout.ts", "src/types.ts"]})
|
|
70
68
|
|
|
71
|
-
→ Changed: 8 symbols in
|
|
69
|
+
→ Changed: 8 symbols in 3 files
|
|
72
70
|
→ Affected processes: CheckoutFlow, RefundFlow, WebhookHandler
|
|
73
71
|
→ Risk: MEDIUM
|
|
74
72
|
```
|
|
@@ -109,10 +107,10 @@ gitnexus_context({name: "validatePayment"})
|
|
|
109
107
|
## Example: "Review PR #42"
|
|
110
108
|
|
|
111
109
|
```
|
|
112
|
-
1.
|
|
113
|
-
→
|
|
110
|
+
1. git diff main...HEAD --name-only
|
|
111
|
+
→ payments.ts, checkout.ts, types.ts, utils.ts
|
|
114
112
|
|
|
115
|
-
2. gitnexus_detect_changes({
|
|
113
|
+
2. gitnexus_detect_changes({changed_files: ["src/payments.ts", "src/checkout.ts", "src/types.ts", "src/utils.ts"]})
|
|
116
114
|
→ Changed symbols: validatePayment, PaymentInput, formatAmount
|
|
117
115
|
→ Affected processes: CheckoutFlow, RefundFlow
|
|
118
116
|
→ Risk: MEDIUM
|
package/skills/gitnexus-guide.md
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: gitnexus-guide
|
|
3
|
-
description: "Use when the user asks about GitNexus itself — available tools, how to query the knowledge graph, MCP resources, graph schema, or workflow reference. Examples: \"What GitNexus tools are available?\", \"How do I use GitNexus?\""
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# GitNexus Guide
|
|
7
|
-
|
|
8
|
-
Quick reference for all GitNexus MCP tools, resources, and the knowledge graph schema.
|
|
9
|
-
|
|
10
|
-
## Always Start Here
|
|
11
|
-
|
|
12
|
-
For any task involving code understanding, debugging, impact analysis, or refactoring:
|
|
13
|
-
|
|
14
|
-
1. **Read `gitnexus://repo/{name}/context`** — codebase overview + check index freshness
|
|
15
|
-
2. **Match your task to a skill below** and **read that skill file**
|
|
16
|
-
3. **Follow the skill's workflow and checklist**
|
|
17
|
-
|
|
18
|
-
> If step 1 warns the index is stale, run `npx gitnexus analyze` in the terminal first.
|
|
19
|
-
|
|
20
|
-
## Skills
|
|
21
|
-
|
|
22
|
-
| Task | Skill to read |
|
|
23
|
-
| -------------------------------------------- | ------------------- |
|
|
24
|
-
| Understand architecture / "How does X work?" | `gitnexus-exploring` |
|
|
25
|
-
| Blast radius / "What breaks if I change X?" | `gitnexus-impact-analysis` |
|
|
26
|
-
| Trace bugs / "Why is X failing?" | `gitnexus-debugging` |
|
|
27
|
-
| Rename / extract / split / refactor | `gitnexus-refactoring` |
|
|
28
|
-
| Tools, resources, schema reference | `gitnexus-guide` (this file) |
|
|
29
|
-
| Index, status, clean, wiki CLI commands | `gitnexus-cli` |
|
|
30
|
-
|
|
31
|
-
## Tools Reference
|
|
32
|
-
|
|
33
|
-
| Tool | What it gives you |
|
|
34
|
-
| ---------------- | ------------------------------------------------------------------------ |
|
|
35
|
-
| `query` | Process-grouped code intelligence — execution flows related to a concept |
|
|
36
|
-
| `context` | 360-degree symbol view — categorized refs, processes it participates in |
|
|
37
|
-
| `impact` | Symbol blast radius — what breaks at depth 1/2/3 with confidence |
|
|
38
|
-
| `detect_changes` | Git-diff impact — what do your current changes affect |
|
|
39
|
-
| `rename` | Multi-file coordinated rename with confidence-tagged edits |
|
|
40
|
-
| `cypher` | Raw graph queries (read `gitnexus://repo/{name}/schema` first) |
|
|
41
|
-
| `list_repos` | Discover indexed repos |
|
|
42
|
-
|
|
43
|
-
## Resources Reference
|
|
44
|
-
|
|
45
|
-
Lightweight reads (~100-500 tokens) for navigation:
|
|
46
|
-
|
|
47
|
-
| Resource | Content |
|
|
48
|
-
| ---------------------------------------------- | ----------------------------------------- |
|
|
49
|
-
| `gitnexus://repo/{name}/context` | Stats, staleness check |
|
|
50
|
-
| `gitnexus://repo/{name}/clusters` | All functional areas with cohesion scores |
|
|
51
|
-
| `gitnexus://repo/{name}/cluster/{clusterName}` | Area members |
|
|
52
|
-
| `gitnexus://repo/{name}/processes` | All execution flows |
|
|
53
|
-
| `gitnexus://repo/{name}/process/{processName}` | Step-by-step trace |
|
|
54
|
-
| `gitnexus://repo/{name}/schema` | Graph schema for Cypher |
|
|
55
|
-
|
|
56
|
-
## Graph Schema
|
|
57
|
-
|
|
58
|
-
**Nodes:** File, Function, Class, Interface, Method, Community, Process
|
|
59
|
-
**Edges (via CodeRelation.type):** CALLS, IMPORTS, EXTENDS, IMPLEMENTS, DEFINES, MEMBER_OF, STEP_IN_PROCESS
|
|
60
|
-
|
|
61
|
-
```cypher
|
|
62
|
-
MATCH (caller)-[:CodeRelation {type: 'CALLS'}]->(f:Function {name: "myFunc"})
|
|
63
|
-
RETURN caller.name, caller.filePath
|
|
64
|
-
```
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: gitnexus-refactoring
|
|
3
|
-
description: "Use when the user wants to rename, extract, split, move, or restructure code safely. Examples: \"Rename this function\", \"Extract this into a module\", \"Refactor this class\", \"Move this to a separate file\""
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Refactoring with GitNexus
|
|
7
|
-
|
|
8
|
-
## When to Use
|
|
9
|
-
|
|
10
|
-
- "Rename this function safely"
|
|
11
|
-
- "Extract this into a module"
|
|
12
|
-
- "Split this service"
|
|
13
|
-
- "Move this to a new file"
|
|
14
|
-
- Any task involving renaming, extracting, splitting, or restructuring code
|
|
15
|
-
|
|
16
|
-
## Workflow
|
|
17
|
-
|
|
18
|
-
```
|
|
19
|
-
1. gitnexus_impact({target: "X", direction: "upstream"}) → Map all dependents
|
|
20
|
-
2. gitnexus_query({query: "X"}) → Find execution flows involving X
|
|
21
|
-
3. gitnexus_context({name: "X"}) → See all incoming/outgoing refs
|
|
22
|
-
4. Plan update order: interfaces → implementations → callers → tests
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
> If "Index is stale" → run `npx gitnexus analyze` in terminal.
|
|
26
|
-
|
|
27
|
-
## Checklists
|
|
28
|
-
|
|
29
|
-
### Rename Symbol
|
|
30
|
-
|
|
31
|
-
```
|
|
32
|
-
- [ ] gitnexus_rename({symbol_name: "oldName", new_name: "newName", dry_run: true}) — preview all edits
|
|
33
|
-
- [ ] Review graph edits (high confidence) and ast_search edits (review carefully)
|
|
34
|
-
- [ ] If satisfied: gitnexus_rename({..., dry_run: false}) — apply edits
|
|
35
|
-
- [ ] gitnexus_detect_changes() — verify only expected files changed
|
|
36
|
-
- [ ] Run tests for affected processes
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
### Extract Module
|
|
40
|
-
|
|
41
|
-
```
|
|
42
|
-
- [ ] gitnexus_context({name: target}) — see all incoming/outgoing refs
|
|
43
|
-
- [ ] gitnexus_impact({target, direction: "upstream"}) — find all external callers
|
|
44
|
-
- [ ] Define new module interface
|
|
45
|
-
- [ ] Extract code, update imports
|
|
46
|
-
- [ ] gitnexus_detect_changes() — verify affected scope
|
|
47
|
-
- [ ] Run tests for affected processes
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
### Split Function/Service
|
|
51
|
-
|
|
52
|
-
```
|
|
53
|
-
- [ ] gitnexus_context({name: target}) — understand all callees
|
|
54
|
-
- [ ] Group callees by responsibility
|
|
55
|
-
- [ ] gitnexus_impact({target, direction: "upstream"}) — map callers to update
|
|
56
|
-
- [ ] Create new functions/services
|
|
57
|
-
- [ ] Update callers
|
|
58
|
-
- [ ] gitnexus_detect_changes() — verify affected scope
|
|
59
|
-
- [ ] Run tests for affected processes
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
## Tools
|
|
63
|
-
|
|
64
|
-
**gitnexus_rename** — automated multi-file rename:
|
|
65
|
-
|
|
66
|
-
```
|
|
67
|
-
gitnexus_rename({symbol_name: "validateUser", new_name: "authenticateUser", dry_run: true})
|
|
68
|
-
→ 12 edits across 8 files
|
|
69
|
-
→ 10 graph edits (high confidence), 2 ast_search edits (review)
|
|
70
|
-
→ Changes: [{file_path, edits: [{line, old_text, new_text, confidence}]}]
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
**gitnexus_impact** — map all dependents first:
|
|
74
|
-
|
|
75
|
-
```
|
|
76
|
-
gitnexus_impact({target: "validateUser", direction: "upstream"})
|
|
77
|
-
→ d=1: loginHandler, apiMiddleware, testUtils
|
|
78
|
-
→ Affected Processes: LoginFlow, TokenRefresh
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
**gitnexus_detect_changes** — verify your changes after refactoring:
|
|
82
|
-
|
|
83
|
-
```
|
|
84
|
-
gitnexus_detect_changes({scope: "all"})
|
|
85
|
-
→ Changed: 8 files, 12 symbols
|
|
86
|
-
→ Affected processes: LoginFlow, TokenRefresh
|
|
87
|
-
→ Risk: MEDIUM
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
**gitnexus_cypher** — custom reference queries:
|
|
91
|
-
|
|
92
|
-
```cypher
|
|
93
|
-
MATCH (caller)-[:CodeRelation {type: 'CALLS'}]->(f:Function {name: "validateUser"})
|
|
94
|
-
RETURN caller.name, caller.filePath ORDER BY caller.filePath
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
## Risk Rules
|
|
98
|
-
|
|
99
|
-
| Risk Factor | Mitigation |
|
|
100
|
-
| ------------------- | ----------------------------------------- |
|
|
101
|
-
| Many callers (>5) | Use gitnexus_rename for automated updates |
|
|
102
|
-
| Cross-area refs | Use detect_changes after to verify scope |
|
|
103
|
-
| String/dynamic refs | gitnexus_query to find them |
|
|
104
|
-
| External/public API | Version and deprecate properly |
|
|
105
|
-
|
|
106
|
-
## Example: Rename `validateUser` to `authenticateUser`
|
|
107
|
-
|
|
108
|
-
```
|
|
109
|
-
1. gitnexus_rename({symbol_name: "validateUser", new_name: "authenticateUser", dry_run: true})
|
|
110
|
-
→ 12 edits: 10 graph (safe), 2 ast_search (review)
|
|
111
|
-
→ Files: validator.ts, login.ts, middleware.ts, config.json...
|
|
112
|
-
|
|
113
|
-
2. Review ast_search edits (config.json: dynamic reference!)
|
|
114
|
-
|
|
115
|
-
3. gitnexus_rename({symbol_name: "validateUser", new_name: "authenticateUser", dry_run: false})
|
|
116
|
-
→ Applied 12 edits across 8 files
|
|
117
|
-
|
|
118
|
-
4. gitnexus_detect_changes({scope: "all"})
|
|
119
|
-
→ Affected: LoginFlow, TokenRefresh
|
|
120
|
-
→ Risk: MEDIUM — run tests for these flows
|
|
121
|
-
```
|