关于 gitnexus-impact-analysis
gitnexus-impact-analysis 是供开发者和编码 Agent 使用的 GitNexus 工作流程技能,用于评估代码变更影响。它结合符号依赖分析、执行流程审查和 Git 差异分析,辅助判断风险。
主要功能
- 01符号依赖与影响范围分析
- 02执行流程审查
- 03基于 Git 差异的变更分析
- 04按深度与置信度检查风险
适用场景
- 01修改函数前检查依赖项
- 02提交前审查受影响的流程
- 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