gitnexus-impact-analysis

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Impact 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 user
If "Index is stale" → run
npx gitnexus analyze
in terminal.
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 user

Understanding Output

输出说明

DepthRisk LevelMeaning
d=1WILL BREAKDirect callers/importers
d=2LIKELY AFFECTEDIndirect dependencies
d=3MAY NEED TESTINGTransitive effects
深度风险等级含义
d=1必然故障直接调用方/导入方
d=2大概率受影响间接依赖
d=3可能需要测试传递性影响

Risk Assessment

风险评估

AffectedRisk
<5 symbols, few processesLOW
5-15 symbols, 2-5 processesMEDIUM
>15 symbols or many processesHIGH
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: MEDIUM
gitnexus_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: MEDIUM

Example: "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 = MEDIUM
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 = MEDIUM