@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.
Files changed (87) hide show
  1. package/dist/cli-generator.cjs +28 -59
  2. package/dist/packages/ai-toolkit-nx-claude/src/cli-generator.d.ts +8 -10
  3. package/dist/packages/ai-toolkit-nx-claude/src/cli-generator.d.ts.map +1 -1
  4. package/dist/packages/ai-toolkit-nx-claude/src/index.d.ts +0 -1
  5. package/dist/packages/ai-toolkit-nx-claude/src/index.d.ts.map +1 -1
  6. package/generators.json +0 -15
  7. package/package.json +4 -35
  8. package/dist/content/agents/agnostic/CLAUDE.md +0 -282
  9. package/dist/content/agents/agnostic/agent-capability-analyst.md +0 -575
  10. package/dist/content/agents/agnostic/agent-optimizer.md +0 -396
  11. package/dist/content/agents/agnostic/agent-orchestrator.md +0 -475
  12. package/dist/content/agents/agnostic/cicd-agent.md +0 -301
  13. package/dist/content/agents/agnostic/claude-agent-discovery.md +0 -304
  14. package/dist/content/agents/agnostic/claude-docs-fact-checker.md +0 -435
  15. package/dist/content/agents/agnostic/claude-docs-initializer.md +0 -782
  16. package/dist/content/agents/agnostic/claude-docs-manager.md +0 -595
  17. package/dist/content/agents/agnostic/code-explainer.md +0 -269
  18. package/dist/content/agents/agnostic/code-generator.md +0 -785
  19. package/dist/content/agents/agnostic/commit-message-generator.md +0 -101
  20. package/dist/content/agents/agnostic/context-loader.md +0 -432
  21. package/dist/content/agents/agnostic/debug-assistant.md +0 -321
  22. package/dist/content/agents/agnostic/doc-writer.md +0 -536
  23. package/dist/content/agents/agnostic/feedback-collector.md +0 -165
  24. package/dist/content/agents/agnostic/infrastructure-agent.md +0 -406
  25. package/dist/content/agents/agnostic/migration-assistant.md +0 -489
  26. package/dist/content/agents/agnostic/pattern-learner.md +0 -481
  27. package/dist/content/agents/agnostic/performance-analyzer.md +0 -528
  28. package/dist/content/agents/agnostic/plan-reviewer.md +0 -173
  29. package/dist/content/agents/agnostic/planner.md +0 -235
  30. package/dist/content/agents/agnostic/pr-creator.md +0 -498
  31. package/dist/content/agents/agnostic/pr-reviewer.md +0 -142
  32. package/dist/content/agents/agnostic/prompt-engineer.md +0 -541
  33. package/dist/content/agents/agnostic/refactorer.md +0 -311
  34. package/dist/content/agents/agnostic/researcher.md +0 -349
  35. package/dist/content/agents/agnostic/security-analyzer.md +0 -1087
  36. package/dist/content/agents/agnostic/stack-splitter.md +0 -642
  37. package/dist/content/agents/agnostic/style-enforcer.md +0 -568
  38. package/dist/content/agents/agnostic/test-runner.md +0 -481
  39. package/dist/content/agents/agnostic/test-writer.md +0 -292
  40. package/dist/content/commands/agnostic/CLAUDE.md +0 -207
  41. package/dist/content/commands/agnostic/address-pr-issues.md +0 -205
  42. package/dist/content/commands/agnostic/auto-spec.md +0 -386
  43. package/dist/content/commands/agnostic/claude-docs.md +0 -409
  44. package/dist/content/commands/agnostic/claude-init-plus.md +0 -439
  45. package/dist/content/commands/agnostic/create-pr.md +0 -79
  46. package/dist/content/commands/agnostic/daily-standup.md +0 -185
  47. package/dist/content/commands/agnostic/deploy.md +0 -441
  48. package/dist/content/commands/agnostic/execute-plan.md +0 -167
  49. package/dist/content/commands/agnostic/explain-file.md +0 -303
  50. package/dist/content/commands/agnostic/explore.md +0 -82
  51. package/dist/content/commands/agnostic/fix-bug.md +0 -273
  52. package/dist/content/commands/agnostic/gen-tests.md +0 -185
  53. package/dist/content/commands/agnostic/generate-commit-message.md +0 -92
  54. package/dist/content/commands/agnostic/git-worktree-orchestrator.md +0 -647
  55. package/dist/content/commands/agnostic/implement-spec.md +0 -270
  56. package/dist/content/commands/agnostic/monitor.md +0 -581
  57. package/dist/content/commands/agnostic/perf-analyze.md +0 -214
  58. package/dist/content/commands/agnostic/plan.md +0 -453
  59. package/dist/content/commands/agnostic/refactor.md +0 -315
  60. package/dist/content/commands/agnostic/refine-linear-task.md +0 -575
  61. package/dist/content/commands/agnostic/research.md +0 -49
  62. package/dist/content/commands/agnostic/review-code.md +0 -321
  63. package/dist/content/commands/agnostic/review-plan.md +0 -109
  64. package/dist/content/commands/agnostic/review-pr.md +0 -393
  65. package/dist/content/commands/agnostic/split-stack.md +0 -705
  66. package/dist/content/commands/agnostic/update-claude-md.md +0 -401
  67. package/dist/content/commands/agnostic/work-through-pr-comments.md +0 -873
  68. package/dist/generators/add-agent/CLAUDE.md +0 -130
  69. package/dist/generators/add-agent/files/__name__.md.template +0 -37
  70. package/dist/generators/add-agent/generator.cjs +0 -640
  71. package/dist/generators/add-agent/schema.json +0 -59
  72. package/dist/generators/add-command/CLAUDE.md +0 -131
  73. package/dist/generators/add-command/files/__name__.md.template +0 -46
  74. package/dist/generators/add-command/generator.cjs +0 -643
  75. package/dist/generators/add-command/schema.json +0 -50
  76. package/dist/generators/files/src/index.ts.template +0 -1
  77. package/dist/generators/init/CLAUDE.md +0 -520
  78. package/dist/generators/init/generator.cjs +0 -3304
  79. package/dist/generators/init/schema.json +0 -180
  80. package/dist/packages/ai-toolkit-nx-claude/src/generators/add-agent/generator.d.ts +0 -5
  81. package/dist/packages/ai-toolkit-nx-claude/src/generators/add-agent/generator.d.ts.map +0 -1
  82. package/dist/packages/ai-toolkit-nx-claude/src/generators/add-command/generator.d.ts +0 -5
  83. package/dist/packages/ai-toolkit-nx-claude/src/generators/add-command/generator.d.ts.map +0 -1
  84. package/dist/packages/ai-toolkit-nx-claude/src/generators/init/generator.d.ts +0 -5
  85. package/dist/packages/ai-toolkit-nx-claude/src/generators/init/generator.d.ts.map +0 -1
  86. package/dist/packages/ai-toolkit-nx-claude/src/utils/auto-update-utils.d.ts +0 -30
  87. package/dist/packages/ai-toolkit-nx-claude/src/utils/auto-update-utils.d.ts.map +0 -1
@@ -1,401 +0,0 @@
1
- ---
2
- description: Intelligently update CLAUDE.md files based on detected code changes
3
- argument-hint: [path] (optional - auto-detects from git if omitted)
4
- ---
5
-
6
- # `/update-claude-md` - Fast CLAUDE.md Synchronization
7
-
8
- ## Purpose
9
-
10
- Quickly update CLAUDE.md files based on staged git changes. Optimized for speed and simplicity.
11
-
12
- ## Usage
13
-
14
- **Auto-detect mode (recommended):**
15
-
16
- ```bash
17
- /update-claude-md
18
- ```
19
-
20
- Analyzes staged changes and updates affected CLAUDE.md files.
21
-
22
- **Explicit mode:**
23
-
24
- ```bash
25
- /update-claude-md apps/slack-oauth-backend
26
- /update-claude-md packages/agents/agnostic
27
- ```
28
-
29
- Updates CLAUDE.md for a specific path.
30
-
31
- ## Implementation
32
-
33
- ### Step 1: Check Git Availability
34
-
35
- ```typescript
36
- // Verify we're in a git repository
37
- const isGitRepo = await checkGitRepo();
38
- if (!isGitRepo) {
39
- return error('Not a git repository. Cannot detect changes.');
40
- }
41
- ```
42
-
43
- ### Step 2: Get Staged Files (Single Git Command)
44
-
45
- ```bash
46
- # Get all staged files with their status
47
- git diff --cached --name-status
48
-
49
- # Output format:
50
- # M apps/slack-oauth-backend/app/api/route.ts
51
- # A libs/data-access/src/new-file.ts
52
- # D old-file.ts
53
- ```
54
-
55
- This single command replaces multiple git operations and provides all needed information.
56
-
57
- ### Step 3: Group Files by Nearest CLAUDE.md
58
-
59
- For each staged file:
60
-
61
- ```typescript
62
- function findNearestClaudeMd(filePath: string): string | null {
63
- let currentDir = path.dirname(filePath);
64
- const workspaceRoot = process.cwd();
65
-
66
- // Walk up directories
67
- while (currentDir !== workspaceRoot) {
68
- const claudeMdPath = path.join(currentDir, 'CLAUDE.md');
69
- if (fs.existsSync(claudeMdPath)) {
70
- return claudeMdPath;
71
- }
72
- currentDir = path.dirname(currentDir);
73
- }
74
-
75
- // Check workspace root
76
- const rootClaudeMd = path.join(workspaceRoot, 'CLAUDE.md');
77
- return fs.existsSync(rootClaudeMd) ? rootClaudeMd : null;
78
- }
79
- ```
80
-
81
- Group files by their nearest CLAUDE.md:
82
-
83
- ```typescript
84
- const groups = new Map<string, string[]>();
85
- for (const file of stagedFiles) {
86
- const claudeMd = findNearestClaudeMd(file);
87
- if (claudeMd) {
88
- if (!groups.has(claudeMd)) groups.set(claudeMd, []);
89
- groups.get(claudeMd).push(file);
90
- }
91
- }
92
- ```
93
-
94
- ### Step 4: Analyze Each Group
95
-
96
- For each CLAUDE.md with changed files:
97
-
98
- ```typescript
99
- async function analyzeChanges(claudeMdPath: string, files: string[]): Promise<UpdatePlan> {
100
- // Read current CLAUDE.md
101
- const currentContent = await readFile(claudeMdPath);
102
-
103
- // Get diffs for all files in group
104
- const diffs = await Promise.all(files.map((f) => execAsync(`git diff --cached -- "${f}"`)));
105
-
106
- // Determine if update needed based on simple heuristics
107
- const needsUpdate = determineIfUpdateNeeded(files, diffs, currentContent);
108
-
109
- if (!needsUpdate) return null;
110
-
111
- // Generate update suggestions
112
- return generateUpdateSuggestions(files, diffs, currentContent);
113
- }
114
-
115
- function determineIfUpdateNeeded(files: string[], diffs: string[], claudeContent: string): boolean {
116
- // Update if:
117
- // 1. New files added (status 'A')
118
- // 2. package.json modified
119
- // 3. project.json modified
120
- // 4. Significant code changes (>50 lines)
121
- // 5. New exports added
122
-
123
- const hasNewFiles = files.some((f) => f.startsWith('A\t'));
124
- const hasPackageJson = files.some((f) => f.includes('package.json'));
125
- const hasProjectJson = files.some((f) => f.includes('project.json'));
126
- const hasSignificantChanges = diffs.some((d) => d.split('\n').length > 50);
127
-
128
- return hasNewFiles || hasPackageJson || hasProjectJson || hasSignificantChanges;
129
- }
130
- ```
131
-
132
- ### Step 5: Show Summary and Get Confirmation
133
-
134
- ```typescript
135
- console.log('Will update the following CLAUDE.md files:\n');
136
- for (const [claudeMd, files] of updates) {
137
- console.log(`📝 ${claudeMd}`);
138
- console.log(` ${files.length} changed file(s)`);
139
- }
140
-
141
- const proceed = await askUser('\nProceed with updates? (y/n): ');
142
- if (proceed !== 'y') {
143
- console.log('Cancelled.');
144
- return;
145
- }
146
- ```
147
-
148
- ### Step 6: Apply Updates
149
-
150
- ```typescript
151
- async function applyUpdates(updates: Map<string, UpdatePlan>): Promise<void> {
152
- for (const [claudeMdPath, plan] of updates) {
153
- // Read current content
154
- const content = await readFile(claudeMdPath);
155
-
156
- // Apply updates (append or smart insert)
157
- const newContent = applyUpdatePlan(content, plan);
158
-
159
- // Write back
160
- await writeFile(claudeMdPath, newContent);
161
-
162
- console.log(`✅ Updated ${claudeMdPath}`);
163
- }
164
- }
165
-
166
- function applyUpdatePlan(content: string, plan: UpdatePlan): string {
167
- // Simple strategies:
168
- // - New files: Add to "Project Structure" or "Key Files" section
169
- // - Dependencies: Add to "Dependencies" section
170
- // - Commands: Add to "Key Commands" section
171
- // - Otherwise: Add note to "Recent Changes" section
172
-
173
- let updated = content;
174
-
175
- for (const suggestion of plan.suggestions) {
176
- const section = findSection(updated, suggestion.targetSection);
177
- if (section) {
178
- updated = insertIntoSection(updated, section, suggestion.text);
179
- } else {
180
- // Append to end if section not found
181
- updated += `\n\n${suggestion.text}`;
182
- }
183
- }
184
-
185
- return updated;
186
- }
187
- ```
188
-
189
- ### Step 7: Show Completion
190
-
191
- ```typescript
192
- console.log(`\n✅ Updated ${updates.size} CLAUDE.md file(s)`);
193
- console.log('\nRun "git diff **/*CLAUDE.md" to review changes.');
194
- ```
195
-
196
- ## Length Constraints
197
-
198
- **CRITICAL: All updated CLAUDE.md files MUST remain concise and focused.**
199
-
200
- - **Token Limit**: 500 tokens or less (~2000 characters in English)
201
- - **Why**: Keeps documentation scannable and focused on essentials
202
- - **How to achieve**:
203
- - Use bullet points instead of paragraphs
204
- - Include only essential commands/dependencies
205
- - Avoid verbose descriptions (5-10 words max per item)
206
- - Skip redundant sections
207
- - Use `[TODO]` placeholders instead of long explanations
208
-
209
- **When adding updates:**
210
-
211
- 1. Check current CLAUDE.md size before adding content
212
- 2. If approaching 2000 characters, trim before adding:
213
- - Remove outdated sections
214
- - Consolidate similar items
215
- - Shorten verbose descriptions
216
- 3. After updates, verify file is ≤2000 characters
217
- 4. If exceeded, remove least important content until within limit
218
-
219
- **Priority for content retention (when trimming):**
220
-
221
- 1. Overview/Purpose (always keep)
222
- 2. Commands/Scripts (essential)
223
- 3. Recent changes (current updates)
224
- 4. Key dependencies (top 5-10)
225
- 5. Structure/additional notes (remove first)
226
-
227
- ## Update Strategies
228
-
229
- ### New Files Added
230
-
231
- ```typescript
232
- if (file.status === 'A') {
233
- return {
234
- targetSection: 'Project Structure',
235
- text: `- \`${file.path}\` - [TODO: Add description]`,
236
- };
237
- }
238
- ```
239
-
240
- ### package.json Modified
241
-
242
- ```typescript
243
- if (file.path.endsWith('package.json')) {
244
- const diff = await getDiff(file.path);
245
- const addedDeps = parseAddedDependencies(diff);
246
-
247
- return {
248
- targetSection: 'Dependencies',
249
- text: addedDeps.map((d) => `- **${d.name}** (${d.version})`).join('\n'),
250
- };
251
- }
252
- ```
253
-
254
- ### project.json Modified (if it is an Nx workspace)
255
-
256
- ```typescript
257
- if (file.path.endsWith('project.json')) {
258
- const diff = await getDiff(file.path);
259
- const addedTargets = parseAddedTargets(diff);
260
-
261
- return {
262
- targetSection: 'Key Commands',
263
- text: addedTargets
264
- .map(
265
- (t) => `- \`nx ${t.name} ${projectName}\` - ${t.description || '[TODO: Add description]'}`
266
- )
267
- .join('\n'),
268
- };
269
- }
270
- ```
271
-
272
- ### Significant Code Changes
273
-
274
- ```typescript
275
- if (linesChanged > 50) {
276
- return {
277
- targetSection: 'Recent Changes',
278
- text: `- Modified \`${file.path}\` (${linesChanged} lines changed)`,
279
- };
280
- }
281
- ```
282
-
283
- ## Performance Characteristics
284
-
285
- - **Single git command:** `git diff --cached --name-status`
286
- - **No external tools:** No jq, comm, markdown-lint
287
- - **Simple algorithms:** O(n) file traversal, no complex parsing
288
- - **Minimal user interaction:** Single confirmation prompt
289
- - **Fast writes:** Direct file operations, no verification overhead
290
-
291
- **Expected Performance:**
292
-
293
- - Small changes (1-5 files): < 1 second
294
- - Medium changes (5-20 files): 1-2 seconds
295
- - Large changes (20+ files): 2-3 seconds
296
-
297
- **95% faster than previous implementation.**
298
-
299
- ## Error Handling
300
-
301
- ```typescript
302
- // Not a git repository
303
- if (!isGitRepo) {
304
- console.error('❌ Not a git repository');
305
- console.log('Use explicit mode: /update-claude-md <path>');
306
- return;
307
- }
308
-
309
- // No staged changes
310
- if (stagedFiles.length === 0) {
311
- console.log('No staged changes detected.');
312
- return;
313
- }
314
-
315
- // No CLAUDE.md files found
316
- if (groups.size === 0) {
317
- console.log('⚠️ No CLAUDE.md files found for changed files');
318
- console.log('Recommendation: Run /claude-init-plus to create documentation');
319
- return;
320
- }
321
-
322
- // Write failed
323
- try {
324
- await writeFile(claudeMdPath, newContent);
325
- } catch (error) {
326
- console.error(`❌ Failed to write ${claudeMdPath}: ${error.message}`);
327
- continue;
328
- }
329
- ```
330
-
331
- ## Explicit Mode Implementation
332
-
333
- When path is specified:
334
-
335
- ```typescript
336
- async function updateExplicitPath(targetPath: string): Promise<void> {
337
- // Find CLAUDE.md in target path
338
- const claudeMdPath = path.join(targetPath, 'CLAUDE.md');
339
-
340
- if (!fs.existsSync(claudeMdPath)) {
341
- console.error(`❌ No CLAUDE.md found at ${targetPath}`);
342
- console.log('Run /claude-init-plus to create one');
343
- return;
344
- }
345
-
346
- // Get all staged files under this path
347
- const stagedFiles = await getStagedFiles();
348
- const relevantFiles = stagedFiles.filter((f) => f.startsWith(targetPath));
349
-
350
- if (relevantFiles.length === 0) {
351
- console.log('No staged changes in this path.');
352
- return;
353
- }
354
-
355
- // Analyze and update
356
- const plan = await analyzeChanges(claudeMdPath, relevantFiles);
357
-
358
- if (!plan) {
359
- console.log('No updates needed.');
360
- return;
361
- }
362
-
363
- console.log(`Will update: ${claudeMdPath}`);
364
- const proceed = await askUser('Proceed? (y/n): ');
365
-
366
- if (proceed === 'y') {
367
- await applyUpdate(claudeMdPath, plan);
368
- console.log('✅ Updated successfully');
369
- }
370
- }
371
- ```
372
-
373
- ## Best Practices
374
-
375
- 1. **Stage changes first:** Run `git add` before `/update-claude-md`
376
- 2. **Review updates:** Use `git diff **/*CLAUDE.md` to review
377
- 3. **Commit together:** Commit CLAUDE.md with related code changes
378
- 4. **Run frequently:** After significant changes
379
- 5. **Add context:** Auto-updates add structure, you add "why"
380
-
381
- ## Safety
382
-
383
- - **Git provides rollback:** If you don't like changes, run `git restore CLAUDE.md`
384
- - **Single confirmation:** You control what gets updated
385
- - **Non-destructive:** Only adds/appends, doesn't remove content
386
- - **Review before commit:** Check `git diff` before committing
387
-
388
- ## Comparison to Previous Implementation
389
-
390
- | Aspect | Old | New | Improvement |
391
- | -------------- | ----------------------- | ---- | -------------- |
392
- | Git commands | 10-15 | 1 | 90% fewer |
393
- | Lines of code | ~630 | ~100 | 84% less code |
394
- | External tools | jq, comm, markdown-lint | None | 100% reduction |
395
- | User prompts | 3-5 | 1 | 80% fewer |
396
- | Performance | 10-60s | 1-3s | 85-95% faster |
397
- | Complexity | Very high | Low | 95% simpler |
398
-
399
- ---
400
-
401
- **Last updated:** 2025-11-18