gitnexus-refactoring
13
总安装量
6
周安装量
#24322
全站排名
安装命令
npx skills add https://github.com/abhigyanpatwari/gitnexus --skill gitnexus-refactoring
Agent 安装分布
opencode
6
github-copilot
6
codex
6
kimi-cli
6
gemini-cli
6
amp
6
Skill 文档
Refactoring with GitNexus
When to Use
- “Rename this function safely”
- “Extract this into a module”
- “Split this service”
- “Move this to a new file”
- Any task involving renaming, extracting, splitting, or restructuring code
Workflow
1. gitnexus_impact({target: "X", direction: "upstream"}) â Map all dependents
2. gitnexus_query({query: "X"}) â Find execution flows involving X
3. gitnexus_context({name: "X"}) â See all incoming/outgoing refs
4. Plan update order: interfaces â implementations â callers â tests
If “Index is stale” â run
npx gitnexus analyzein terminal.
Checklists
Rename Symbol
- [ ] gitnexus_rename({symbol_name: "oldName", new_name: "newName", dry_run: true}) â preview all edits
- [ ] Review graph edits (high confidence) and ast_search edits (review carefully)
- [ ] If satisfied: gitnexus_rename({..., dry_run: false}) â apply edits
- [ ] gitnexus_detect_changes() â verify only expected files changed
- [ ] Run tests for affected processes
Extract Module
- [ ] gitnexus_context({name: target}) â see all incoming/outgoing refs
- [ ] gitnexus_impact({target, direction: "upstream"}) â find all external callers
- [ ] Define new module interface
- [ ] Extract code, update imports
- [ ] gitnexus_detect_changes() â verify affected scope
- [ ] Run tests for affected processes
Split Function/Service
- [ ] gitnexus_context({name: target}) â understand all callees
- [ ] Group callees by responsibility
- [ ] gitnexus_impact({target, direction: "upstream"}) â map callers to update
- [ ] Create new functions/services
- [ ] Update callers
- [ ] gitnexus_detect_changes() â verify affected scope
- [ ] Run tests for affected processes
Tools
gitnexus_rename â automated multi-file rename:
gitnexus_rename({symbol_name: "validateUser", new_name: "authenticateUser", dry_run: true})
â 12 edits across 8 files
â 10 graph edits (high confidence), 2 ast_search edits (review)
â Changes: [{file_path, edits: [{line, old_text, new_text, confidence}]}]
gitnexus_impact â map all dependents first:
gitnexus_impact({target: "validateUser", direction: "upstream"})
â d=1: loginHandler, apiMiddleware, testUtils
â Affected Processes: LoginFlow, TokenRefresh
gitnexus_detect_changes â verify your changes after refactoring:
gitnexus_detect_changes({scope: "all"})
â Changed: 8 files, 12 symbols
â Affected processes: LoginFlow, TokenRefresh
â Risk: MEDIUM
gitnexus_cypher â custom reference queries:
MATCH (caller)-[:CodeRelation {type: 'CALLS'}]->(f:Function {name: "validateUser"})
RETURN caller.name, caller.filePath ORDER BY caller.filePath
Risk Rules
| Risk Factor | Mitigation |
|---|---|
| Many callers (>5) | Use gitnexus_rename for automated updates |
| Cross-area refs | Use detect_changes after to verify scope |
| String/dynamic refs | gitnexus_query to find them |
| External/public API | Version and deprecate properly |
Example: Rename validateUser to authenticateUser
1. gitnexus_rename({symbol_name: "validateUser", new_name: "authenticateUser", dry_run: true})
â 12 edits: 10 graph (safe), 2 ast_search (review)
â Files: validator.ts, login.ts, middleware.ts, config.json...
2. Review ast_search edits (config.json: dynamic reference!)
3. gitnexus_rename({symbol_name: "validateUser", new_name: "authenticateUser", dry_run: false})
â Applied 12 edits across 8 files
4. gitnexus_detect_changes({scope: "all"})
â Affected: LoginFlow, TokenRefresh
â Risk: MEDIUM â run tests for these flows