mcpField
G
gitnexus-impact-analysis

gitnexus-impact-analysis

github.com/arenukvern开发39447 次安装2 周前更新
代码仓库

关于 gitnexus-impact-analysis

gitnexus-impact-analysis 是供开发者和编码 Agent 使用的 GitNexus 工作流程技能,用于评估代码变更影响。它结合符号依赖分析、执行流程审查和 Git 差异分析,辅助判断风险。

主要功能

  1. 01符号依赖与影响范围分析
  2. 02执行流程审查
  3. 03基于 Git 差异的变更分析
  4. 04按深度与置信度检查风险

适用场景

  1. 01修改函数前检查依赖项
  2. 02提交前审查受影响的流程
  3. 03估算变更的直接与间接风险

MCP 相关

该技能使用 impact、detect_changes 等 GitNexus MCP 工具,并读取仓库流程资源,以识别受影响的代码和执行流程。

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/arenukvern/mcp_flutter --skill gitnexus-impact-analysis

安装后在 Claude Code 中输入/gitnexus-impact-analysis确认已加载。

详细介绍

使用 GitNexus 进行影响分析

适用场景

  • “修改这个函数安全吗?”
  • “如果我修改 X,会破坏什么?”
  • “展示影响范围”
  • “哪些地方使用了这段代码?”
  • 在进行较大规模代码更改之前
  • 在提交之前——了解你的更改会影响什么

工作流

1. impact({target: "X", direction: "upstream"})  → What depends on this
2. READ gitnexus://repo/{name}/processes                   → Check affected execution flows
3. detect_changes()                               → Map current git changes to affected flows
4. Assess risk and report to user

如果出现“索引已过期” → 在终端中运行 node .gitnexus/run.cjs analyze。

检查清单

- [ ] 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
- [ ] detect_changes() for pre-commit check
- [ ] Assess risk level and report to user

理解输出

深度风险级别含义
d=1将会破坏直接调用方/导入方
d=2可能受到影响间接依赖
d=3可能需要测试传递影响

风险评估

受影响范围风险
<5 个符号,少量进程低
5-15 个符号,2-5 个进程中
>15 个符号或大量进程高
关键路径(身份验证、支付)严重

工具

impact — 用于分析符号影响范围的主要工具:

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%]

detect_changes — 基于 git 差异的影响分析:

detect_changes({scope: "staged"})

→ Changed: 5 symbols in 3 files
→ Affected: LoginFlow, TokenRefresh, APIMiddlewarePipeline
→ Risk: MEDIUM

示例:“如果我修改 validateUser,会破坏什么?”

1. 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

评论

支持 Markdown