gitnexus-impact-analysis
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseImpact Analysis with GitNexus
基于GitNexus的影响分析
When to Use
适用场景
- "Is it safe to change this function?"
- "What will break if I modify X?"
- "Show me the blast radius"
- "Who uses this code?"
- Before making non-trivial code changes
- Before committing — to understand what your changes affect
- 「修改这个函数是否安全?」
- 「如果我修改X会导致什么功能故障?」
- 「展示本次修改的影响范围」
- 「谁在使用这段代码?」
- 在进行非琐碎的代码修改前
- 在提交代码前 — 了解你的修改会影响哪些内容
Workflow
工作流
1. gitnexus_impact({target: "X", direction: "upstream"}) → What depends on this
2. READ gitnexus://repo/{name}/processes → Check affected execution flows
3. gitnexus_detect_changes() → Map current git changes to affected flows
4. Assess risk and report to userIf "Index is stale" → runin terminal.npx gitnexus analyze
1. gitnexus_impact({target: "X", direction: "upstream"}) → What depends on this
2. READ gitnexus://repo/{name}/processes → Check affected execution flows
3. gitnexus_detect_changes() → Map current git changes to affected flows
4. Assess risk and report to user如果出现「索引过时」提示 → 在终端中运行。npx gitnexus analyze
Checklist
检查清单
- [ ] gitnexus_impact({target, direction: "upstream"}) to find dependents
- [ ] Review d=1 items first (these WILL BREAK)
- [ ] Check high-confidence (>0.8) dependencies
- [ ] READ processes to check affected execution flows
- [ ] gitnexus_detect_changes() for pre-commit check
- [ ] Assess risk level and report to user- [ ] gitnexus_impact({target, direction: "upstream"}) to find dependents
- [ ] Review d=1 items first (these WILL BREAK)
- [ ] Check high-confidence (>0.8) dependencies
- [ ] READ processes to check affected execution flows
- [ ] gitnexus_detect_changes() for pre-commit check
- [ ] Assess risk level and report to userUnderstanding Output
输出说明
| Depth | Risk Level | Meaning |
|---|---|---|
| d=1 | WILL BREAK | Direct callers/importers |
| d=2 | LIKELY AFFECTED | Indirect dependencies |
| d=3 | MAY NEED TESTING | Transitive effects |
| 深度 | 风险等级 | 含义 |
|---|---|---|
| d=1 | 必然故障 | 直接调用方/导入方 |
| d=2 | 大概率受影响 | 间接依赖 |
| d=3 | 可能需要测试 | 传递性影响 |
Risk Assessment
风险评估
| Affected | Risk |
|---|---|
| <5 symbols, few processes | LOW |
| 5-15 symbols, 2-5 processes | MEDIUM |
| >15 symbols or many processes | HIGH |
| Critical path (auth, payments) | CRITICAL |
| 影响范围 | 风险等级 |
|---|---|
| <5个符号,少量流程 | 低 |
| 5-15个符号,2-5个流程 | 中 |
| >15个符号或大量流程 | 高 |
| 关键路径(鉴权、支付) | 极高 |
Tools
工具
gitnexus_impact — the primary tool for symbol blast radius:
gitnexus_impact({
target: "validateUser",
direction: "upstream",
minConfidence: 0.8,
maxDepth: 3
})
→ d=1 (WILL BREAK):
- loginHandler (src/auth/login.ts:42) [CALLS, 100%]
- apiMiddleware (src/api/middleware.ts:15) [CALLS, 100%]
→ d=2 (LIKELY AFFECTED):
- authRouter (src/routes/auth.ts:22) [CALLS, 95%]gitnexus_detect_changes — git-diff based impact analysis:
gitnexus_detect_changes({scope: "staged"})
→ Changed: 5 symbols in 3 files
→ Affected: LoginFlow, TokenRefresh, APIMiddlewarePipeline
→ Risk: MEDIUMgitnexus_impact — 评估符号修改影响范围的核心工具:
gitnexus_impact({
target: "validateUser",
direction: "upstream",
minConfidence: 0.8,
maxDepth: 3
})
→ d=1 (WILL BREAK):
- loginHandler (src/auth/login.ts:42) [CALLS, 100%]
- apiMiddleware (src/api/middleware.ts:15) [CALLS, 100%]
→ d=2 (LIKELY AFFECTED):
- authRouter (src/routes/auth.ts:22) [CALLS, 95%]gitnexus_detect_changes — 基于git-diff的影响分析工具:
gitnexus_detect_changes({scope: "staged"})
→ Changed: 5 symbols in 3 files
→ Affected: LoginFlow, TokenRefresh, APIMiddlewarePipeline
→ Risk: MEDIUMExample: "What breaks if I change validateUser?"
示例:「如果我修改validateUser会导致什么故障?」
1. gitnexus_impact({target: "validateUser", direction: "upstream"})
→ d=1: loginHandler, apiMiddleware (WILL BREAK)
→ d=2: authRouter, sessionManager (LIKELY AFFECTED)
2. READ gitnexus://repo/my-app/processes
→ LoginFlow and TokenRefresh touch validateUser
3. Risk: 2 direct callers, 2 processes = MEDIUM1. gitnexus_impact({target: "validateUser", direction: "upstream"})
→ d=1: loginHandler, apiMiddleware (WILL BREAK)
→ d=2: authRouter, sessionManager (LIKELY AFFECTED)
2. READ gitnexus://repo/my-app/processes
→ LoginFlow and TokenRefresh touch validateUser
3. Risk: 2 direct callers, 2 processes = MEDIUM