gitnexus 1.3.9 → 1.3.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +194 -194
- package/dist/cli/ai-context.js +87 -87
- package/dist/cli/index.js +15 -25
- package/dist/cli/lazy-action.d.ts +6 -0
- package/dist/cli/lazy-action.js +18 -0
- package/dist/core/augmentation/engine.js +20 -20
- package/dist/core/embeddings/embedding-pipeline.js +26 -26
- package/dist/core/ingestion/ast-cache.js +3 -2
- package/dist/core/ingestion/cluster-enricher.js +16 -16
- package/dist/core/ingestion/pipeline.js +8 -0
- package/dist/core/ingestion/tree-sitter-queries.js +484 -484
- package/dist/core/kuzu/kuzu-adapter.js +9 -9
- package/dist/core/kuzu/schema.js +287 -287
- 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/compatible-stdio-transport.d.ts +25 -0
- package/dist/mcp/compatible-stdio-transport.js +200 -0
- package/dist/mcp/local/local-backend.js +128 -128
- package/dist/mcp/resources.js +42 -42
- package/dist/mcp/server.js +18 -18
- package/dist/mcp/tools.js +86 -86
- package/hooks/claude/gitnexus-hook.cjs +155 -155
- package/hooks/claude/pre-tool-use.sh +79 -79
- package/hooks/claude/session-start.sh +42 -42
- package/package.json +96 -96
- package/scripts/patch-tree-sitter-swift.cjs +74 -74
- package/skills/gitnexus-cli.md +82 -82
- package/skills/gitnexus-debugging.md +89 -89
- package/skills/gitnexus-exploring.md +78 -78
- package/skills/gitnexus-guide.md +64 -64
- package/skills/gitnexus-impact-analysis.md +97 -97
- package/skills/gitnexus-pr-review.md +163 -163
- package/skills/gitnexus-refactoring.md +121 -121
- package/vendor/leiden/index.cjs +355 -355
- package/vendor/leiden/utils.cjs +392 -392
|
@@ -1,97 +1,97 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: gitnexus-impact-analysis
|
|
3
|
-
description: "Use when the user wants to know what will break if they change something, or needs safety analysis before editing code. Examples: \"Is it safe to change X?\", \"What depends on this?\", \"What will break?\""
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Impact Analysis with GitNexus
|
|
7
|
-
|
|
8
|
-
## When to Use
|
|
9
|
-
|
|
10
|
-
- "Is it safe to change this function?"
|
|
11
|
-
- "What will break if I modify X?"
|
|
12
|
-
- "Show me the blast radius"
|
|
13
|
-
- "Who uses this code?"
|
|
14
|
-
- Before making non-trivial code changes
|
|
15
|
-
- Before committing — to understand what your changes affect
|
|
16
|
-
|
|
17
|
-
## Workflow
|
|
18
|
-
|
|
19
|
-
```
|
|
20
|
-
1. gitnexus_impact({target: "X", direction: "upstream"}) → What depends on this
|
|
21
|
-
2. READ gitnexus://repo/{name}/processes → Check affected execution flows
|
|
22
|
-
3. gitnexus_detect_changes() → Map current git changes to affected flows
|
|
23
|
-
4. Assess risk and report to user
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
> If "Index is stale" → run `npx gitnexus analyze` in terminal.
|
|
27
|
-
|
|
28
|
-
## Checklist
|
|
29
|
-
|
|
30
|
-
```
|
|
31
|
-
- [ ] gitnexus_impact({target, direction: "upstream"}) to find dependents
|
|
32
|
-
- [ ] Review d=1 items first (these WILL BREAK)
|
|
33
|
-
- [ ] Check high-confidence (>0.8) dependencies
|
|
34
|
-
- [ ] READ processes to check affected execution flows
|
|
35
|
-
- [ ] gitnexus_detect_changes() for pre-commit check
|
|
36
|
-
- [ ] Assess risk level and report to user
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
## Understanding Output
|
|
40
|
-
|
|
41
|
-
| Depth | Risk Level | Meaning |
|
|
42
|
-
| ----- | ---------------- | ------------------------ |
|
|
43
|
-
| d=1 | **WILL BREAK** | Direct callers/importers |
|
|
44
|
-
| d=2 | LIKELY AFFECTED | Indirect dependencies |
|
|
45
|
-
| d=3 | MAY NEED TESTING | Transitive effects |
|
|
46
|
-
|
|
47
|
-
## Risk Assessment
|
|
48
|
-
|
|
49
|
-
| Affected | Risk |
|
|
50
|
-
| ------------------------------ | -------- |
|
|
51
|
-
| <5 symbols, few processes | LOW |
|
|
52
|
-
| 5-15 symbols, 2-5 processes | MEDIUM |
|
|
53
|
-
| >15 symbols or many processes | HIGH |
|
|
54
|
-
| Critical path (auth, payments) | CRITICAL |
|
|
55
|
-
|
|
56
|
-
## Tools
|
|
57
|
-
|
|
58
|
-
**gitnexus_impact** — the primary tool for symbol blast radius:
|
|
59
|
-
|
|
60
|
-
```
|
|
61
|
-
gitnexus_impact({
|
|
62
|
-
target: "validateUser",
|
|
63
|
-
direction: "upstream",
|
|
64
|
-
minConfidence: 0.8,
|
|
65
|
-
maxDepth: 3
|
|
66
|
-
})
|
|
67
|
-
|
|
68
|
-
→ d=1 (WILL BREAK):
|
|
69
|
-
- loginHandler (src/auth/login.ts:42) [CALLS, 100%]
|
|
70
|
-
- apiMiddleware (src/api/middleware.ts:15) [CALLS, 100%]
|
|
71
|
-
|
|
72
|
-
→ d=2 (LIKELY AFFECTED):
|
|
73
|
-
- authRouter (src/routes/auth.ts:22) [CALLS, 95%]
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
**gitnexus_detect_changes** — git-diff based impact analysis:
|
|
77
|
-
|
|
78
|
-
```
|
|
79
|
-
gitnexus_detect_changes({scope: "staged"})
|
|
80
|
-
|
|
81
|
-
→ Changed: 5 symbols in 3 files
|
|
82
|
-
→ Affected: LoginFlow, TokenRefresh, APIMiddlewarePipeline
|
|
83
|
-
→ Risk: MEDIUM
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
## Example: "What breaks if I change validateUser?"
|
|
87
|
-
|
|
88
|
-
```
|
|
89
|
-
1. gitnexus_impact({target: "validateUser", direction: "upstream"})
|
|
90
|
-
→ d=1: loginHandler, apiMiddleware (WILL BREAK)
|
|
91
|
-
→ d=2: authRouter, sessionManager (LIKELY AFFECTED)
|
|
92
|
-
|
|
93
|
-
2. READ gitnexus://repo/my-app/processes
|
|
94
|
-
→ LoginFlow and TokenRefresh touch validateUser
|
|
95
|
-
|
|
96
|
-
3. Risk: 2 direct callers, 2 processes = MEDIUM
|
|
97
|
-
```
|
|
1
|
+
---
|
|
2
|
+
name: gitnexus-impact-analysis
|
|
3
|
+
description: "Use when the user wants to know what will break if they change something, or needs safety analysis before editing code. Examples: \"Is it safe to change X?\", \"What depends on this?\", \"What will break?\""
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Impact Analysis with GitNexus
|
|
7
|
+
|
|
8
|
+
## When to Use
|
|
9
|
+
|
|
10
|
+
- "Is it safe to change this function?"
|
|
11
|
+
- "What will break if I modify X?"
|
|
12
|
+
- "Show me the blast radius"
|
|
13
|
+
- "Who uses this code?"
|
|
14
|
+
- Before making non-trivial code changes
|
|
15
|
+
- Before committing — to understand what your changes affect
|
|
16
|
+
|
|
17
|
+
## Workflow
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
1. gitnexus_impact({target: "X", direction: "upstream"}) → What depends on this
|
|
21
|
+
2. READ gitnexus://repo/{name}/processes → Check affected execution flows
|
|
22
|
+
3. gitnexus_detect_changes() → Map current git changes to affected flows
|
|
23
|
+
4. Assess risk and report to user
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
> If "Index is stale" → run `npx gitnexus analyze` in terminal.
|
|
27
|
+
|
|
28
|
+
## Checklist
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
- [ ] gitnexus_impact({target, direction: "upstream"}) to find dependents
|
|
32
|
+
- [ ] Review d=1 items first (these WILL BREAK)
|
|
33
|
+
- [ ] Check high-confidence (>0.8) dependencies
|
|
34
|
+
- [ ] READ processes to check affected execution flows
|
|
35
|
+
- [ ] gitnexus_detect_changes() for pre-commit check
|
|
36
|
+
- [ ] Assess risk level and report to user
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Understanding Output
|
|
40
|
+
|
|
41
|
+
| Depth | Risk Level | Meaning |
|
|
42
|
+
| ----- | ---------------- | ------------------------ |
|
|
43
|
+
| d=1 | **WILL BREAK** | Direct callers/importers |
|
|
44
|
+
| d=2 | LIKELY AFFECTED | Indirect dependencies |
|
|
45
|
+
| d=3 | MAY NEED TESTING | Transitive effects |
|
|
46
|
+
|
|
47
|
+
## Risk Assessment
|
|
48
|
+
|
|
49
|
+
| Affected | Risk |
|
|
50
|
+
| ------------------------------ | -------- |
|
|
51
|
+
| <5 symbols, few processes | LOW |
|
|
52
|
+
| 5-15 symbols, 2-5 processes | MEDIUM |
|
|
53
|
+
| >15 symbols or many processes | HIGH |
|
|
54
|
+
| Critical path (auth, payments) | CRITICAL |
|
|
55
|
+
|
|
56
|
+
## Tools
|
|
57
|
+
|
|
58
|
+
**gitnexus_impact** — the primary tool for symbol blast radius:
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
gitnexus_impact({
|
|
62
|
+
target: "validateUser",
|
|
63
|
+
direction: "upstream",
|
|
64
|
+
minConfidence: 0.8,
|
|
65
|
+
maxDepth: 3
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
→ d=1 (WILL BREAK):
|
|
69
|
+
- loginHandler (src/auth/login.ts:42) [CALLS, 100%]
|
|
70
|
+
- apiMiddleware (src/api/middleware.ts:15) [CALLS, 100%]
|
|
71
|
+
|
|
72
|
+
→ d=2 (LIKELY AFFECTED):
|
|
73
|
+
- authRouter (src/routes/auth.ts:22) [CALLS, 95%]
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
**gitnexus_detect_changes** — git-diff based impact analysis:
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
gitnexus_detect_changes({scope: "staged"})
|
|
80
|
+
|
|
81
|
+
→ Changed: 5 symbols in 3 files
|
|
82
|
+
→ Affected: LoginFlow, TokenRefresh, APIMiddlewarePipeline
|
|
83
|
+
→ Risk: MEDIUM
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Example: "What breaks if I change validateUser?"
|
|
87
|
+
|
|
88
|
+
```
|
|
89
|
+
1. gitnexus_impact({target: "validateUser", direction: "upstream"})
|
|
90
|
+
→ d=1: loginHandler, apiMiddleware (WILL BREAK)
|
|
91
|
+
→ d=2: authRouter, sessionManager (LIKELY AFFECTED)
|
|
92
|
+
|
|
93
|
+
2. READ gitnexus://repo/my-app/processes
|
|
94
|
+
→ LoginFlow and TokenRefresh touch validateUser
|
|
95
|
+
|
|
96
|
+
3. Risk: 2 direct callers, 2 processes = MEDIUM
|
|
97
|
+
```
|
|
@@ -1,163 +1,163 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: gitnexus-pr-review
|
|
3
|
-
description: "Use when the user wants to review a pull request, understand what a PR changes, assess risk of merging, or check for missing test coverage. Examples: \"Review this PR\", \"What does PR #42 change?\", \"Is this PR safe to merge?\""
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# PR Review with GitNexus
|
|
7
|
-
|
|
8
|
-
## When to Use
|
|
9
|
-
|
|
10
|
-
- "Review this PR"
|
|
11
|
-
- "What does PR #42 change?"
|
|
12
|
-
- "Is this safe to merge?"
|
|
13
|
-
- "What's the blast radius of this PR?"
|
|
14
|
-
- "Are there missing tests for this PR?"
|
|
15
|
-
- Reviewing someone else's code changes before merge
|
|
16
|
-
|
|
17
|
-
## Workflow
|
|
18
|
-
|
|
19
|
-
```
|
|
20
|
-
1. gh pr diff <number> → Get the raw diff
|
|
21
|
-
2. gitnexus_detect_changes({scope: "compare", base_ref: "main"}) → Map diff to affected flows
|
|
22
|
-
3. For each changed symbol:
|
|
23
|
-
gitnexus_impact({target: "<symbol>", direction: "upstream"}) → Blast radius per change
|
|
24
|
-
4. gitnexus_context({name: "<key symbol>"}) → Understand callers/callees
|
|
25
|
-
5. READ gitnexus://repo/{name}/processes → Check affected execution flows
|
|
26
|
-
6. Summarize findings with risk assessment
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
> If "Index is stale" → run `npx gitnexus analyze` in terminal before reviewing.
|
|
30
|
-
|
|
31
|
-
## Checklist
|
|
32
|
-
|
|
33
|
-
```
|
|
34
|
-
- [ ] Fetch PR diff (gh pr diff or git diff base...head)
|
|
35
|
-
- [ ] gitnexus_detect_changes to map changes to affected execution flows
|
|
36
|
-
- [ ] gitnexus_impact on each non-trivial changed symbol
|
|
37
|
-
- [ ] Review d=1 items (WILL BREAK) — are callers updated?
|
|
38
|
-
- [ ] gitnexus_context on key changed symbols to understand full picture
|
|
39
|
-
- [ ] Check if affected processes have test coverage
|
|
40
|
-
- [ ] Assess overall risk level
|
|
41
|
-
- [ ] Write review summary with findings
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
## Review Dimensions
|
|
45
|
-
|
|
46
|
-
| Dimension | How GitNexus Helps |
|
|
47
|
-
| --- | --- |
|
|
48
|
-
| **Correctness** | `context` shows callers — are they all compatible with the change? |
|
|
49
|
-
| **Blast radius** | `impact` shows d=1/d=2/d=3 dependents — anything missed? |
|
|
50
|
-
| **Completeness** | `detect_changes` shows all affected flows — are they all handled? |
|
|
51
|
-
| **Test coverage** | `impact({includeTests: true})` shows which tests touch changed code |
|
|
52
|
-
| **Breaking changes** | d=1 upstream items that aren't updated in the PR = potential breakage |
|
|
53
|
-
|
|
54
|
-
## Risk Assessment
|
|
55
|
-
|
|
56
|
-
| Signal | Risk |
|
|
57
|
-
| --- | --- |
|
|
58
|
-
| Changes touch <3 symbols, 0-1 processes | LOW |
|
|
59
|
-
| Changes touch 3-10 symbols, 2-5 processes | MEDIUM |
|
|
60
|
-
| Changes touch >10 symbols or many processes | HIGH |
|
|
61
|
-
| Changes touch auth, payments, or data integrity code | CRITICAL |
|
|
62
|
-
| d=1 callers exist outside the PR diff | Potential breakage — flag it |
|
|
63
|
-
|
|
64
|
-
## Tools
|
|
65
|
-
|
|
66
|
-
**gitnexus_detect_changes** — map PR diff to affected execution flows:
|
|
67
|
-
|
|
68
|
-
```
|
|
69
|
-
gitnexus_detect_changes({scope: "compare", base_ref: "main"})
|
|
70
|
-
|
|
71
|
-
→ Changed: 8 symbols in 4 files
|
|
72
|
-
→ Affected processes: CheckoutFlow, RefundFlow, WebhookHandler
|
|
73
|
-
→ Risk: MEDIUM
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
**gitnexus_impact** — blast radius per changed symbol:
|
|
77
|
-
|
|
78
|
-
```
|
|
79
|
-
gitnexus_impact({target: "validatePayment", direction: "upstream"})
|
|
80
|
-
|
|
81
|
-
→ d=1 (WILL BREAK):
|
|
82
|
-
- processCheckout (src/checkout.ts:42) [CALLS, 100%]
|
|
83
|
-
- webhookHandler (src/webhooks.ts:15) [CALLS, 100%]
|
|
84
|
-
|
|
85
|
-
→ d=2 (LIKELY AFFECTED):
|
|
86
|
-
- checkoutRouter (src/routes/checkout.ts:22) [CALLS, 95%]
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
**gitnexus_impact with tests** — check test coverage:
|
|
90
|
-
|
|
91
|
-
```
|
|
92
|
-
gitnexus_impact({target: "validatePayment", direction: "upstream", includeTests: true})
|
|
93
|
-
|
|
94
|
-
→ Tests that cover this symbol:
|
|
95
|
-
- validatePayment.test.ts [direct]
|
|
96
|
-
- checkout.integration.test.ts [via processCheckout]
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
**gitnexus_context** — understand a changed symbol's role:
|
|
100
|
-
|
|
101
|
-
```
|
|
102
|
-
gitnexus_context({name: "validatePayment"})
|
|
103
|
-
|
|
104
|
-
→ Incoming calls: processCheckout, webhookHandler
|
|
105
|
-
→ Outgoing calls: verifyCard, fetchRates
|
|
106
|
-
→ Processes: CheckoutFlow (step 3/7), RefundFlow (step 1/5)
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
## Example: "Review PR #42"
|
|
110
|
-
|
|
111
|
-
```
|
|
112
|
-
1. gh pr diff 42 > /tmp/pr42.diff
|
|
113
|
-
→ 4 files changed: payments.ts, checkout.ts, types.ts, utils.ts
|
|
114
|
-
|
|
115
|
-
2. gitnexus_detect_changes({scope: "compare", base_ref: "main"})
|
|
116
|
-
→ Changed symbols: validatePayment, PaymentInput, formatAmount
|
|
117
|
-
→ Affected processes: CheckoutFlow, RefundFlow
|
|
118
|
-
→ Risk: MEDIUM
|
|
119
|
-
|
|
120
|
-
3. gitnexus_impact({target: "validatePayment", direction: "upstream"})
|
|
121
|
-
→ d=1: processCheckout, webhookHandler (WILL BREAK)
|
|
122
|
-
→ webhookHandler is NOT in the PR diff — potential breakage!
|
|
123
|
-
|
|
124
|
-
4. gitnexus_impact({target: "PaymentInput", direction: "upstream"})
|
|
125
|
-
→ d=1: validatePayment (in PR), createPayment (NOT in PR)
|
|
126
|
-
→ createPayment uses the old PaymentInput shape — breaking change!
|
|
127
|
-
|
|
128
|
-
5. gitnexus_context({name: "formatAmount"})
|
|
129
|
-
→ Called by 12 functions — but change is backwards-compatible (added optional param)
|
|
130
|
-
|
|
131
|
-
6. Review summary:
|
|
132
|
-
- MEDIUM risk — 3 changed symbols affect 2 execution flows
|
|
133
|
-
- BUG: webhookHandler calls validatePayment but isn't updated for new signature
|
|
134
|
-
- BUG: createPayment depends on PaymentInput type which changed
|
|
135
|
-
- OK: formatAmount change is backwards-compatible
|
|
136
|
-
- Tests: checkout.test.ts covers processCheckout path, but no webhook test
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
## Review Output Format
|
|
140
|
-
|
|
141
|
-
Structure your review as:
|
|
142
|
-
|
|
143
|
-
```markdown
|
|
144
|
-
## PR Review: <title>
|
|
145
|
-
|
|
146
|
-
**Risk: LOW / MEDIUM / HIGH / CRITICAL**
|
|
147
|
-
|
|
148
|
-
### Changes Summary
|
|
149
|
-
- <N> symbols changed across <M> files
|
|
150
|
-
- <P> execution flows affected
|
|
151
|
-
|
|
152
|
-
### Findings
|
|
153
|
-
1. **[severity]** Description of finding
|
|
154
|
-
- Evidence from GitNexus tools
|
|
155
|
-
- Affected callers/flows
|
|
156
|
-
|
|
157
|
-
### Missing Coverage
|
|
158
|
-
- Callers not updated in PR: ...
|
|
159
|
-
- Untested flows: ...
|
|
160
|
-
|
|
161
|
-
### Recommendation
|
|
162
|
-
APPROVE / REQUEST CHANGES / NEEDS DISCUSSION
|
|
163
|
-
```
|
|
1
|
+
---
|
|
2
|
+
name: gitnexus-pr-review
|
|
3
|
+
description: "Use when the user wants to review a pull request, understand what a PR changes, assess risk of merging, or check for missing test coverage. Examples: \"Review this PR\", \"What does PR #42 change?\", \"Is this PR safe to merge?\""
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# PR Review with GitNexus
|
|
7
|
+
|
|
8
|
+
## When to Use
|
|
9
|
+
|
|
10
|
+
- "Review this PR"
|
|
11
|
+
- "What does PR #42 change?"
|
|
12
|
+
- "Is this safe to merge?"
|
|
13
|
+
- "What's the blast radius of this PR?"
|
|
14
|
+
- "Are there missing tests for this PR?"
|
|
15
|
+
- Reviewing someone else's code changes before merge
|
|
16
|
+
|
|
17
|
+
## Workflow
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
1. gh pr diff <number> → Get the raw diff
|
|
21
|
+
2. gitnexus_detect_changes({scope: "compare", base_ref: "main"}) → Map diff to affected flows
|
|
22
|
+
3. For each changed symbol:
|
|
23
|
+
gitnexus_impact({target: "<symbol>", direction: "upstream"}) → Blast radius per change
|
|
24
|
+
4. gitnexus_context({name: "<key symbol>"}) → Understand callers/callees
|
|
25
|
+
5. READ gitnexus://repo/{name}/processes → Check affected execution flows
|
|
26
|
+
6. Summarize findings with risk assessment
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
> If "Index is stale" → run `npx gitnexus analyze` in terminal before reviewing.
|
|
30
|
+
|
|
31
|
+
## Checklist
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
- [ ] Fetch PR diff (gh pr diff or git diff base...head)
|
|
35
|
+
- [ ] gitnexus_detect_changes to map changes to affected execution flows
|
|
36
|
+
- [ ] gitnexus_impact on each non-trivial changed symbol
|
|
37
|
+
- [ ] Review d=1 items (WILL BREAK) — are callers updated?
|
|
38
|
+
- [ ] gitnexus_context on key changed symbols to understand full picture
|
|
39
|
+
- [ ] Check if affected processes have test coverage
|
|
40
|
+
- [ ] Assess overall risk level
|
|
41
|
+
- [ ] Write review summary with findings
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Review Dimensions
|
|
45
|
+
|
|
46
|
+
| Dimension | How GitNexus Helps |
|
|
47
|
+
| --- | --- |
|
|
48
|
+
| **Correctness** | `context` shows callers — are they all compatible with the change? |
|
|
49
|
+
| **Blast radius** | `impact` shows d=1/d=2/d=3 dependents — anything missed? |
|
|
50
|
+
| **Completeness** | `detect_changes` shows all affected flows — are they all handled? |
|
|
51
|
+
| **Test coverage** | `impact({includeTests: true})` shows which tests touch changed code |
|
|
52
|
+
| **Breaking changes** | d=1 upstream items that aren't updated in the PR = potential breakage |
|
|
53
|
+
|
|
54
|
+
## Risk Assessment
|
|
55
|
+
|
|
56
|
+
| Signal | Risk |
|
|
57
|
+
| --- | --- |
|
|
58
|
+
| Changes touch <3 symbols, 0-1 processes | LOW |
|
|
59
|
+
| Changes touch 3-10 symbols, 2-5 processes | MEDIUM |
|
|
60
|
+
| Changes touch >10 symbols or many processes | HIGH |
|
|
61
|
+
| Changes touch auth, payments, or data integrity code | CRITICAL |
|
|
62
|
+
| d=1 callers exist outside the PR diff | Potential breakage — flag it |
|
|
63
|
+
|
|
64
|
+
## Tools
|
|
65
|
+
|
|
66
|
+
**gitnexus_detect_changes** — map PR diff to affected execution flows:
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
gitnexus_detect_changes({scope: "compare", base_ref: "main"})
|
|
70
|
+
|
|
71
|
+
→ Changed: 8 symbols in 4 files
|
|
72
|
+
→ Affected processes: CheckoutFlow, RefundFlow, WebhookHandler
|
|
73
|
+
→ Risk: MEDIUM
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
**gitnexus_impact** — blast radius per changed symbol:
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
gitnexus_impact({target: "validatePayment", direction: "upstream"})
|
|
80
|
+
|
|
81
|
+
→ d=1 (WILL BREAK):
|
|
82
|
+
- processCheckout (src/checkout.ts:42) [CALLS, 100%]
|
|
83
|
+
- webhookHandler (src/webhooks.ts:15) [CALLS, 100%]
|
|
84
|
+
|
|
85
|
+
→ d=2 (LIKELY AFFECTED):
|
|
86
|
+
- checkoutRouter (src/routes/checkout.ts:22) [CALLS, 95%]
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
**gitnexus_impact with tests** — check test coverage:
|
|
90
|
+
|
|
91
|
+
```
|
|
92
|
+
gitnexus_impact({target: "validatePayment", direction: "upstream", includeTests: true})
|
|
93
|
+
|
|
94
|
+
→ Tests that cover this symbol:
|
|
95
|
+
- validatePayment.test.ts [direct]
|
|
96
|
+
- checkout.integration.test.ts [via processCheckout]
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
**gitnexus_context** — understand a changed symbol's role:
|
|
100
|
+
|
|
101
|
+
```
|
|
102
|
+
gitnexus_context({name: "validatePayment"})
|
|
103
|
+
|
|
104
|
+
→ Incoming calls: processCheckout, webhookHandler
|
|
105
|
+
→ Outgoing calls: verifyCard, fetchRates
|
|
106
|
+
→ Processes: CheckoutFlow (step 3/7), RefundFlow (step 1/5)
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Example: "Review PR #42"
|
|
110
|
+
|
|
111
|
+
```
|
|
112
|
+
1. gh pr diff 42 > /tmp/pr42.diff
|
|
113
|
+
→ 4 files changed: payments.ts, checkout.ts, types.ts, utils.ts
|
|
114
|
+
|
|
115
|
+
2. gitnexus_detect_changes({scope: "compare", base_ref: "main"})
|
|
116
|
+
→ Changed symbols: validatePayment, PaymentInput, formatAmount
|
|
117
|
+
→ Affected processes: CheckoutFlow, RefundFlow
|
|
118
|
+
→ Risk: MEDIUM
|
|
119
|
+
|
|
120
|
+
3. gitnexus_impact({target: "validatePayment", direction: "upstream"})
|
|
121
|
+
→ d=1: processCheckout, webhookHandler (WILL BREAK)
|
|
122
|
+
→ webhookHandler is NOT in the PR diff — potential breakage!
|
|
123
|
+
|
|
124
|
+
4. gitnexus_impact({target: "PaymentInput", direction: "upstream"})
|
|
125
|
+
→ d=1: validatePayment (in PR), createPayment (NOT in PR)
|
|
126
|
+
→ createPayment uses the old PaymentInput shape — breaking change!
|
|
127
|
+
|
|
128
|
+
5. gitnexus_context({name: "formatAmount"})
|
|
129
|
+
→ Called by 12 functions — but change is backwards-compatible (added optional param)
|
|
130
|
+
|
|
131
|
+
6. Review summary:
|
|
132
|
+
- MEDIUM risk — 3 changed symbols affect 2 execution flows
|
|
133
|
+
- BUG: webhookHandler calls validatePayment but isn't updated for new signature
|
|
134
|
+
- BUG: createPayment depends on PaymentInput type which changed
|
|
135
|
+
- OK: formatAmount change is backwards-compatible
|
|
136
|
+
- Tests: checkout.test.ts covers processCheckout path, but no webhook test
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## Review Output Format
|
|
140
|
+
|
|
141
|
+
Structure your review as:
|
|
142
|
+
|
|
143
|
+
```markdown
|
|
144
|
+
## PR Review: <title>
|
|
145
|
+
|
|
146
|
+
**Risk: LOW / MEDIUM / HIGH / CRITICAL**
|
|
147
|
+
|
|
148
|
+
### Changes Summary
|
|
149
|
+
- <N> symbols changed across <M> files
|
|
150
|
+
- <P> execution flows affected
|
|
151
|
+
|
|
152
|
+
### Findings
|
|
153
|
+
1. **[severity]** Description of finding
|
|
154
|
+
- Evidence from GitNexus tools
|
|
155
|
+
- Affected callers/flows
|
|
156
|
+
|
|
157
|
+
### Missing Coverage
|
|
158
|
+
- Callers not updated in PR: ...
|
|
159
|
+
- Untested flows: ...
|
|
160
|
+
|
|
161
|
+
### Recommendation
|
|
162
|
+
APPROVE / REQUEST CHANGES / NEEDS DISCUSSION
|
|
163
|
+
```
|