@uniswap/ai-toolkit-nx-claude 0.5.28 → 0.5.30-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli-generator.cjs +28 -59
- package/dist/packages/ai-toolkit-nx-claude/src/cli-generator.d.ts +8 -10
- package/dist/packages/ai-toolkit-nx-claude/src/cli-generator.d.ts.map +1 -1
- package/dist/packages/ai-toolkit-nx-claude/src/index.d.ts +0 -1
- package/dist/packages/ai-toolkit-nx-claude/src/index.d.ts.map +1 -1
- package/generators.json +0 -15
- package/package.json +4 -35
- package/dist/content/agents/agnostic/CLAUDE.md +0 -282
- package/dist/content/agents/agnostic/agent-capability-analyst.md +0 -575
- package/dist/content/agents/agnostic/agent-optimizer.md +0 -396
- package/dist/content/agents/agnostic/agent-orchestrator.md +0 -475
- package/dist/content/agents/agnostic/cicd-agent.md +0 -301
- package/dist/content/agents/agnostic/claude-agent-discovery.md +0 -304
- package/dist/content/agents/agnostic/claude-docs-fact-checker.md +0 -435
- package/dist/content/agents/agnostic/claude-docs-initializer.md +0 -782
- package/dist/content/agents/agnostic/claude-docs-manager.md +0 -595
- package/dist/content/agents/agnostic/code-explainer.md +0 -269
- package/dist/content/agents/agnostic/code-generator.md +0 -785
- package/dist/content/agents/agnostic/commit-message-generator.md +0 -101
- package/dist/content/agents/agnostic/context-loader.md +0 -432
- package/dist/content/agents/agnostic/debug-assistant.md +0 -321
- package/dist/content/agents/agnostic/doc-writer.md +0 -536
- package/dist/content/agents/agnostic/feedback-collector.md +0 -165
- package/dist/content/agents/agnostic/infrastructure-agent.md +0 -406
- package/dist/content/agents/agnostic/migration-assistant.md +0 -489
- package/dist/content/agents/agnostic/pattern-learner.md +0 -481
- package/dist/content/agents/agnostic/performance-analyzer.md +0 -528
- package/dist/content/agents/agnostic/plan-reviewer.md +0 -173
- package/dist/content/agents/agnostic/planner.md +0 -235
- package/dist/content/agents/agnostic/pr-creator.md +0 -498
- package/dist/content/agents/agnostic/pr-reviewer.md +0 -142
- package/dist/content/agents/agnostic/prompt-engineer.md +0 -541
- package/dist/content/agents/agnostic/refactorer.md +0 -311
- package/dist/content/agents/agnostic/researcher.md +0 -349
- package/dist/content/agents/agnostic/security-analyzer.md +0 -1087
- package/dist/content/agents/agnostic/stack-splitter.md +0 -642
- package/dist/content/agents/agnostic/style-enforcer.md +0 -568
- package/dist/content/agents/agnostic/test-runner.md +0 -481
- package/dist/content/agents/agnostic/test-writer.md +0 -292
- package/dist/content/commands/agnostic/CLAUDE.md +0 -207
- package/dist/content/commands/agnostic/address-pr-issues.md +0 -205
- package/dist/content/commands/agnostic/auto-spec.md +0 -386
- package/dist/content/commands/agnostic/claude-docs.md +0 -409
- package/dist/content/commands/agnostic/claude-init-plus.md +0 -439
- package/dist/content/commands/agnostic/create-pr.md +0 -79
- package/dist/content/commands/agnostic/daily-standup.md +0 -185
- package/dist/content/commands/agnostic/deploy.md +0 -441
- package/dist/content/commands/agnostic/execute-plan.md +0 -167
- package/dist/content/commands/agnostic/explain-file.md +0 -303
- package/dist/content/commands/agnostic/explore.md +0 -82
- package/dist/content/commands/agnostic/fix-bug.md +0 -273
- package/dist/content/commands/agnostic/gen-tests.md +0 -185
- package/dist/content/commands/agnostic/generate-commit-message.md +0 -92
- package/dist/content/commands/agnostic/git-worktree-orchestrator.md +0 -647
- package/dist/content/commands/agnostic/implement-spec.md +0 -270
- package/dist/content/commands/agnostic/monitor.md +0 -581
- package/dist/content/commands/agnostic/perf-analyze.md +0 -214
- package/dist/content/commands/agnostic/plan.md +0 -453
- package/dist/content/commands/agnostic/refactor.md +0 -315
- package/dist/content/commands/agnostic/refine-linear-task.md +0 -575
- package/dist/content/commands/agnostic/research.md +0 -49
- package/dist/content/commands/agnostic/review-code.md +0 -321
- package/dist/content/commands/agnostic/review-plan.md +0 -109
- package/dist/content/commands/agnostic/review-pr.md +0 -393
- package/dist/content/commands/agnostic/split-stack.md +0 -705
- package/dist/content/commands/agnostic/update-claude-md.md +0 -401
- package/dist/content/commands/agnostic/work-through-pr-comments.md +0 -873
- package/dist/generators/add-agent/CLAUDE.md +0 -130
- package/dist/generators/add-agent/files/__name__.md.template +0 -37
- package/dist/generators/add-agent/generator.cjs +0 -640
- package/dist/generators/add-agent/schema.json +0 -59
- package/dist/generators/add-command/CLAUDE.md +0 -131
- package/dist/generators/add-command/files/__name__.md.template +0 -46
- package/dist/generators/add-command/generator.cjs +0 -643
- package/dist/generators/add-command/schema.json +0 -50
- package/dist/generators/files/src/index.ts.template +0 -1
- package/dist/generators/init/CLAUDE.md +0 -520
- package/dist/generators/init/generator.cjs +0 -3304
- package/dist/generators/init/schema.json +0 -180
- package/dist/packages/ai-toolkit-nx-claude/src/generators/add-agent/generator.d.ts +0 -5
- package/dist/packages/ai-toolkit-nx-claude/src/generators/add-agent/generator.d.ts.map +0 -1
- package/dist/packages/ai-toolkit-nx-claude/src/generators/add-command/generator.d.ts +0 -5
- package/dist/packages/ai-toolkit-nx-claude/src/generators/add-command/generator.d.ts.map +0 -1
- package/dist/packages/ai-toolkit-nx-claude/src/generators/init/generator.d.ts +0 -5
- package/dist/packages/ai-toolkit-nx-claude/src/generators/init/generator.d.ts.map +0 -1
- package/dist/packages/ai-toolkit-nx-claude/src/utils/auto-update-utils.d.ts +0 -30
- package/dist/packages/ai-toolkit-nx-claude/src/utils/auto-update-utils.d.ts.map +0 -1
|
@@ -1,315 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Orchestrate comprehensive refactoring with architectural analysis, pattern application, and incremental safety checks.
|
|
3
|
-
argument-hint: <path|glob> [--strategy safe|aggressive|architectural] [--goal readability|performance|maintainability|testability|all]
|
|
4
|
-
allowed-tools: Read(*), Grep(*), Bash(git diff:*), Bash(git show:*), Task(subagent_type:refactorer), Task(subagent_type:style-enforcer), Task(subagent_type:code-explainer), Task(subagent_type:test-writer), Task(subagent_type:agent-orchestrator)
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## Inputs
|
|
8
|
-
|
|
9
|
-
Parse arguments from `$ARGUMENTS`:
|
|
10
|
-
|
|
11
|
-
- **path**: Target file, directory, or glob pattern
|
|
12
|
-
- **--strategy**: Refactoring approach (safe|aggressive|architectural) - default: safe
|
|
13
|
-
- **--goal**: Optimization target (readability|performance|maintainability|testability|all) - default: readability
|
|
14
|
-
- **--patterns**: Apply specific design patterns (e.g., "factory,observer")
|
|
15
|
-
- **--validate**: Run validation after refactoring (default: true)
|
|
16
|
-
- **--batch-size**: Number of changes per patch (default: 3 for safe, 10 for aggressive)
|
|
17
|
-
|
|
18
|
-
Examples:
|
|
19
|
-
|
|
20
|
-
- `/refactor src/utils/helpers.ts`
|
|
21
|
-
- `/refactor src/api/*.ts --strategy aggressive --goal performance`
|
|
22
|
-
- `/refactor src/core/ --strategy architectural --patterns "repository,facade"`
|
|
23
|
-
- `/refactor src/legacy/ --goal testability --validate`
|
|
24
|
-
|
|
25
|
-
## Task
|
|
26
|
-
|
|
27
|
-
Orchestrate sophisticated refactoring through multi-agent coordination:
|
|
28
|
-
|
|
29
|
-
1. **Code Analysis**: Understand current structure and issues
|
|
30
|
-
2. **Pattern Identification**: Detect applicable design patterns
|
|
31
|
-
3. **Refactoring Strategy**: Plan incremental, safe transformations
|
|
32
|
-
4. **Validation**: Ensure behavior preservation
|
|
33
|
-
5. **Test Generation**: Create tests for refactored code
|
|
34
|
-
|
|
35
|
-
## Orchestration Strategy
|
|
36
|
-
|
|
37
|
-
### Safe Refactoring (Default)
|
|
38
|
-
|
|
39
|
-
Incremental, low-risk improvements:
|
|
40
|
-
|
|
41
|
-
```typescript
|
|
42
|
-
{
|
|
43
|
-
phases: [
|
|
44
|
-
{
|
|
45
|
-
name: 'Analysis',
|
|
46
|
-
agent: 'code-explainer',
|
|
47
|
-
task: 'Identify refactoring opportunities',
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
name: 'Style Fixes',
|
|
51
|
-
agent: 'style-enforcer',
|
|
52
|
-
task: 'Apply automatic style improvements',
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
name: 'Small Refactors',
|
|
56
|
-
agent: 'refactorer',
|
|
57
|
-
task: 'Generate minimal, safe patches',
|
|
58
|
-
},
|
|
59
|
-
];
|
|
60
|
-
}
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
### Aggressive Refactoring
|
|
64
|
-
|
|
65
|
-
Comprehensive restructuring with validation:
|
|
66
|
-
|
|
67
|
-
```typescript
|
|
68
|
-
{
|
|
69
|
-
orchestrator: "agent-orchestrator",
|
|
70
|
-
parallel: [
|
|
71
|
-
{
|
|
72
|
-
agent: "refactorer",
|
|
73
|
-
focus: "structural-improvements"
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
agent: "style-enforcer",
|
|
77
|
-
focus: "comprehensive-cleanup"
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
agent: "test-writer",
|
|
81
|
-
focus: "regression-test-generation"
|
|
82
|
-
}
|
|
83
|
-
],
|
|
84
|
-
validation: {
|
|
85
|
-
agent: "test-runner",
|
|
86
|
-
task: "Verify behavior preservation"
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
### Architectural Refactoring
|
|
92
|
-
|
|
93
|
-
System-wide pattern application:
|
|
94
|
-
|
|
95
|
-
1. **Pattern Analysis**:
|
|
96
|
-
|
|
97
|
-
- Identify current anti-patterns
|
|
98
|
-
- Determine applicable design patterns
|
|
99
|
-
- Plan migration strategy
|
|
100
|
-
|
|
101
|
-
2. **Coordinated Refactoring**:
|
|
102
|
-
- **refactorer**: Structural changes
|
|
103
|
-
- **code-generator**: New pattern implementations
|
|
104
|
-
- **migration-assistant**: Gradual migration plan
|
|
105
|
-
- **test-writer**: Comprehensive test coverage
|
|
106
|
-
|
|
107
|
-
## Output Format
|
|
108
|
-
|
|
109
|
-
```typescript
|
|
110
|
-
{
|
|
111
|
-
summary: {
|
|
112
|
-
filesAnalyzed: number;
|
|
113
|
-
refactoringsProposed: number;
|
|
114
|
-
estimatedImprovement: {
|
|
115
|
-
readability: number; // % improvement
|
|
116
|
-
performance: number;
|
|
117
|
-
maintainability: number;
|
|
118
|
-
testability: number;
|
|
119
|
-
};
|
|
120
|
-
risk: 'low' | 'medium' | 'high';
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
analysis: {
|
|
124
|
-
currentIssues: Array<{
|
|
125
|
-
type: string; // e.g., "Code duplication", "High complexity"
|
|
126
|
-
severity: 'critical' | 'high' | 'medium' | 'low';
|
|
127
|
-
location: string;
|
|
128
|
-
metrics: object; // Relevant metrics
|
|
129
|
-
}>;
|
|
130
|
-
patterns: {
|
|
131
|
-
detected: string[]; // Current patterns
|
|
132
|
-
antiPatterns: string[]; // Anti-patterns found
|
|
133
|
-
applicable: string[]; // Patterns that could be applied
|
|
134
|
-
};
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
patches: Array<{
|
|
138
|
-
id: string;
|
|
139
|
-
file: string;
|
|
140
|
-
type: string; // e.g., "Extract Method", "Introduce Parameter Object"
|
|
141
|
-
description: string;
|
|
142
|
-
diff: string; // Git-style diff
|
|
143
|
-
impact: {
|
|
144
|
-
loc: number; // Lines changed
|
|
145
|
-
complexity: number; // Complexity reduction
|
|
146
|
-
risk: 'low' | 'medium' | 'high';
|
|
147
|
-
};
|
|
148
|
-
dependencies: string[]; // Other patches this depends on
|
|
149
|
-
validation: {
|
|
150
|
-
testsNeeded: boolean;
|
|
151
|
-
testsGenerated: string[]; // Generated test files
|
|
152
|
-
breakingChange: boolean;
|
|
153
|
-
};
|
|
154
|
-
}>;
|
|
155
|
-
|
|
156
|
-
migrationPlan?: { // For architectural refactoring
|
|
157
|
-
phases: Array<{
|
|
158
|
-
name: string;
|
|
159
|
-
description: string;
|
|
160
|
-
patches: string[]; // Patch IDs
|
|
161
|
-
validation: string; // How to validate
|
|
162
|
-
rollback: string; // Rollback procedure
|
|
163
|
-
}>;
|
|
164
|
-
timeline: string; // Estimated timeline
|
|
165
|
-
risks: string[]; // Identified risks
|
|
166
|
-
};
|
|
167
|
-
|
|
168
|
-
followups: {
|
|
169
|
-
immediate: string[]; // Can be done now
|
|
170
|
-
shortTerm: string[]; // Should be done soon
|
|
171
|
-
longTerm: string[]; // Future improvements
|
|
172
|
-
monitoring: string[]; // Metrics to track
|
|
173
|
-
};
|
|
174
|
-
|
|
175
|
-
validation: {
|
|
176
|
-
testCoverage: {
|
|
177
|
-
before: number;
|
|
178
|
-
after: number;
|
|
179
|
-
newTests: string[];
|
|
180
|
-
};
|
|
181
|
-
behaviorPreserved: boolean;
|
|
182
|
-
performanceImpact: string; // e.g., "+10% faster", "negligible"
|
|
183
|
-
regressionRisks: string[];
|
|
184
|
-
};
|
|
185
|
-
}
|
|
186
|
-
```
|
|
187
|
-
|
|
188
|
-
## Refactoring Strategies by Goal
|
|
189
|
-
|
|
190
|
-
### Readability Goal
|
|
191
|
-
|
|
192
|
-
Focus on code clarity:
|
|
193
|
-
|
|
194
|
-
- Extract complex expressions
|
|
195
|
-
- Rename variables for clarity
|
|
196
|
-
- Simplify conditional logic
|
|
197
|
-
- Add intermediate variables
|
|
198
|
-
- Remove magic numbers
|
|
199
|
-
|
|
200
|
-
### Performance Goal
|
|
201
|
-
|
|
202
|
-
Optimize execution:
|
|
203
|
-
|
|
204
|
-
- Algorithm improvements
|
|
205
|
-
- Caching implementations
|
|
206
|
-
- Query optimization
|
|
207
|
-
- Lazy loading
|
|
208
|
-
- Parallel processing
|
|
209
|
-
|
|
210
|
-
### Maintainability Goal
|
|
211
|
-
|
|
212
|
-
Improve structure:
|
|
213
|
-
|
|
214
|
-
- Extract modules
|
|
215
|
-
- Reduce coupling
|
|
216
|
-
- Increase cohesion
|
|
217
|
-
- Apply SOLID principles
|
|
218
|
-
- Remove code duplication
|
|
219
|
-
|
|
220
|
-
### Testability Goal
|
|
221
|
-
|
|
222
|
-
Enable better testing:
|
|
223
|
-
|
|
224
|
-
- Dependency injection
|
|
225
|
-
- Extract pure functions
|
|
226
|
-
- Mock-friendly interfaces
|
|
227
|
-
- Reduce side effects
|
|
228
|
-
- Isolate business logic
|
|
229
|
-
|
|
230
|
-
## Pattern Application
|
|
231
|
-
|
|
232
|
-
When `--patterns` specified:
|
|
233
|
-
|
|
234
|
-
```typescript
|
|
235
|
-
{
|
|
236
|
-
patternApplication: {
|
|
237
|
-
requested: string[]; // Patterns requested
|
|
238
|
-
applicable: Array<{
|
|
239
|
-
pattern: string;
|
|
240
|
-
location: string;
|
|
241
|
-
rationale: string;
|
|
242
|
-
implementation: string; // How to apply
|
|
243
|
-
}>;
|
|
244
|
-
notApplicable: Array<{
|
|
245
|
-
pattern: string;
|
|
246
|
-
reason: string; // Why it can't be applied
|
|
247
|
-
}>;
|
|
248
|
-
};
|
|
249
|
-
}
|
|
250
|
-
```
|
|
251
|
-
|
|
252
|
-
## Safety Mechanisms
|
|
253
|
-
|
|
254
|
-
### Incremental Application
|
|
255
|
-
|
|
256
|
-
- Small, reviewable patches
|
|
257
|
-
- Dependency ordering
|
|
258
|
-
- Rollback procedures
|
|
259
|
-
- Validation checkpoints
|
|
260
|
-
|
|
261
|
-
### Risk Assessment
|
|
262
|
-
|
|
263
|
-
Each patch includes:
|
|
264
|
-
|
|
265
|
-
- Breaking change analysis
|
|
266
|
-
- Dependency impact
|
|
267
|
-
- Test coverage requirements
|
|
268
|
-
- Performance implications
|
|
269
|
-
|
|
270
|
-
### Validation Steps
|
|
271
|
-
|
|
272
|
-
1. **Static Analysis**: Type checking, linting
|
|
273
|
-
2. **Test Execution**: Run existing tests
|
|
274
|
-
3. **Behavior Comparison**: Input/output validation
|
|
275
|
-
4. **Performance Benchmarking**: Measure impact
|
|
276
|
-
5. **Manual Review**: Require approval for high-risk changes
|
|
277
|
-
|
|
278
|
-
## Examples
|
|
279
|
-
|
|
280
|
-
### Basic Readability Refactoring
|
|
281
|
-
|
|
282
|
-
```bash
|
|
283
|
-
/refactor src/utils/helpers.ts
|
|
284
|
-
# Safe, incremental improvements for readability
|
|
285
|
-
```
|
|
286
|
-
|
|
287
|
-
### Performance Optimization
|
|
288
|
-
|
|
289
|
-
```bash
|
|
290
|
-
/refactor src/api/handlers.ts --goal performance --strategy aggressive
|
|
291
|
-
# Aggressive performance optimizations with validation
|
|
292
|
-
```
|
|
293
|
-
|
|
294
|
-
### Architectural Pattern Application
|
|
295
|
-
|
|
296
|
-
```bash
|
|
297
|
-
/refactor src/services/ --strategy architectural --patterns "repository,unit-of-work"
|
|
298
|
-
# Apply repository and unit-of-work patterns
|
|
299
|
-
```
|
|
300
|
-
|
|
301
|
-
### Testability Improvement
|
|
302
|
-
|
|
303
|
-
```bash
|
|
304
|
-
/refactor src/core/logic.ts --goal testability --validate
|
|
305
|
-
# Refactor for better testability with validation
|
|
306
|
-
```
|
|
307
|
-
|
|
308
|
-
## Best Practices
|
|
309
|
-
|
|
310
|
-
1. **Start Safe**: Begin with safe strategy for critical code
|
|
311
|
-
2. **Validate Always**: Enable validation for production code
|
|
312
|
-
3. **Incremental Application**: Apply patches gradually
|
|
313
|
-
4. **Review Each Patch**: Manually review before applying
|
|
314
|
-
5. **Test Coverage First**: Ensure tests exist before refactoring
|
|
315
|
-
6. **Track Metrics**: Monitor improvement metrics over time
|