@uniswap/ai-toolkit-nx-claude 0.5.29 → 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,520 +0,0 @@
1
- # CLAUDE.md - Init Generator
2
-
3
- ## Overview
4
-
5
- The `init` generator is the primary entry point for setting up Claude Code configurations in projects. It provides a one-shot, interactive installer that deploys curated commands and agents from the AI Toolkit content packages to either a global or local installation directory.
6
-
7
- ## Core Functionality
8
-
9
- ### Two Installation Modes
10
-
11
- The generator provides two distinct paths:
12
-
13
- #### 1. Default Installation Mode (`installMode: 'default'`)
14
-
15
- **Purpose**: Get started quickly with recommended components for most users.
16
-
17
- **Characteristics**:
18
-
19
- - Pre-selects 6 essential commands (explore, plan, review-plan, execute-plan, address-pr-issues)
20
- - Pre-selects 6 essential agents (context-loader, planner, plan-reviewer, test-writer, doc-writer, pr-reviewer)
21
- - Installs globally by default (~/.claude)
22
- - Only prompts for notification hooks (recommended)
23
- - Skips dry-run mode (always performs installation)
24
- - Shows summary of pre-selected components before installation
25
-
26
- **User Experience**:
27
-
28
- ```
29
- 📦 Default Installation Mode
30
- Installing recommended setup with pre-selected components
31
-
32
- 📍 Location: Global (~/.claude)
33
- 📝 Commands: 6 pre-selected
34
- 🤖 Agents: 6 pre-selected
35
-
36
- 🔔 Install notification hooks? (y/n)
37
- ```
38
-
39
- #### 2. Custom Installation Mode (`installMode: 'custom'`)
40
-
41
- **Purpose**: Full control for power users who want to choose exactly what to install.
42
-
43
- **Characteristics**:
44
-
45
- - Prompts for installation location (global/local)
46
- - Prompts whether to install commands (yes/no)
47
- - If installing commands → multi-select which ones
48
- - Prompts whether to install agents (yes/no)
49
- - If installing agents → multi-select which ones
50
- - Prompts for notification hooks (yes/no)
51
- - After hooks, prompts for addons like spec-mcp-workflow (yes/no)
52
- - Prompts for dry-run mode (yes/no)
53
-
54
- **User Experience**:
55
-
56
- ```
57
- 📍 Would you like to install globally or locally?
58
- 📝 Install slash commands? (y/n)
59
- 🤖 Install AI agents? (y/n)
60
- 🔔 Install notification hooks? (y/n)
61
- 🔌 Install addons? (y/n)
62
- 👁️ Run in dry-run mode? (y/n)
63
- ```
64
-
65
- Note: The addons prompt appears after notification hooks have been installed in the custom flow.
66
-
67
- ### What It Does
68
-
69
- 1. **Mode Detection**: Determines installation mode (default vs custom) from CLI flag or interactive menu selection
70
- 2. **Claude CLI Check**: Verifies Claude CLI installation and offers to install it if missing
71
- 3. **Automatic Fallback Installation**: If curl installation fails, automatically attempts npm installation as fallback
72
- 4. **Default Mode Pre-Configuration**: For default mode, auto-populates recommended selections and skips most prompts
73
- 5. **Installation Type Selection**: For custom mode, prompts user to choose between global (~/.claude) or local (./.claude) installation
74
- 6. **Local Path Confirmation**: For local installations in custom mode, confirms the user is at project root (exits if not)
75
- 7. **Schema-Driven Interactive Setup**: Dynamically generates prompts from `schema.json` based on `prompt-when` conditions
76
- 8. **Conditional Prompting**: Only shows relevant prompts based on mode and previous answers (e.g., command selection only if installCommands=true)
77
- 9. **Cross-Location Detection**: Shows when files exist in the other location (e.g., "exists globally" when installing locally)
78
- 10. **Overwrite Detection**: Indicates which files will be overwritten in the target location
79
- 11. **Smart Multi-Select**: Provides multi-select with 'a' key for toggle all functionality
80
- 12. **Integrated Hooks Installation**: Can install notification hooks as part of the flow (no separate command needed)
81
- 13. **Integrated Addons Installation**: Can install addons like spec-mcp-workflow (custom mode only; prompted after hooks)
82
- 14. **Content Deployment**: Copies selected commands and agents from content packages to the target directory
83
- 15. **Manifest Generation**: Creates a `manifest.json` file tracking installed components, version, and installation metadata
84
- 16. **Collision Detection**: Checks for existing installations and prompts for overwrite confirmation (unless forced)
85
- 17. **Installation Verification**: Verifies successful installation using `which claude` (optional: `claude --version`)
86
- 18. **Auto-Update Checker Installation**: Installs background update checker to shell configuration (bash/zsh/fish)
87
- 19. **Installation Summary**: Shows comprehensive summary of what was installed
88
-
89
- ### Claude CLI Installation
90
-
91
- The generator automatically handles Claude CLI installation with intelligent fallback:
92
-
93
- 1. **Primary Method (curl)**: Attempts to install using the official curl script
94
-
95
- - Command: `curl -fsSL https://claude.ai/install.sh | bash`
96
- - Works best on macOS and most Linux distributions
97
- - 5-minute timeout protection
98
-
99
- 2. **Fallback Method (npm)**: Automatically triggered if curl fails
100
-
101
- - Command: `npm install -g @anthropic-ai/claude-code`
102
- - Better for restricted environments or Windows systems
103
- - Does NOT use sudo to avoid permission issues
104
- - Handles specific error cases:
105
- - npm not found: Prompts to install Node.js
106
- - Permission errors: Suggests manual installation with `migrate-installer`
107
- - Network failures: Provides manual instructions
108
-
109
- 3. **Verification**: After successful installation (either method)
110
-
111
- - Primary check: Uses `which claude` to confirm availability on PATH
112
- - Optional: Run `claude --version` or `claude doctor` manually for deeper checks
113
- - PATH warnings: Alerts if CLI installed but not in PATH
114
-
115
- 4. **Manual Instructions**: Provided if both methods fail
116
- - Shows curl and npm commands for manual execution
117
- - Links to official documentation
118
- - Suggests troubleshooting with `claude doctor`
119
-
120
- ### Auto-Update Checker
121
-
122
- After successful installation, the generator automatically installs an update checker to your shell configuration:
123
-
124
- **Installation Process**:
125
-
126
- 1. **Shell Detection**: Detects your shell type (bash, zsh, or fish)
127
- 2. **Version Extraction**: Reads current package version from package.json
128
- 3. **Config Backup**: Creates timestamped backup of shell config (e.g., `~/.zshrc.backup-1234567890`)
129
- 4. **Script Injection**: Adds update check script between `AI_TOOLKIT_UPDATE_CHECK` markers
130
- 5. **Self-Updating**: Re-running init updates the script version in your shell config
131
-
132
- **Update Check Script Features**:
133
-
134
- - **Weekly Frequency**: Checks once per week using cache file `~/.uniswap-ai-toolkit/.last-update-check`
135
- - **Background Execution**: Runs in background to avoid blocking shell startup (<5ms overhead)
136
- - **Version Tracking**: Stores current version in script comment for self-maintenance
137
- - **npm Registry Query**: Queries npm for `@uniswap/ai-toolkit-nx-claude` latest version
138
- - **User Notification**: Displays message when update available with upgrade instructions
139
- - **Disable Option**: Respects `AI_TOOLKIT_SKIP_UPDATE_CHECK=1` environment variable
140
-
141
- **User Experience**:
142
-
143
- When an update is available, users see this on shell startup (once per week):
144
-
145
- ```
146
- 📦 AI Toolkit update available: 0.5.7 → 0.6.0
147
- Run: npx @uniswap/ai-toolkit-nx-claude@latest init
148
- Disable these checks: export AI_TOOLKIT_SKIP_UPDATE_CHECK=1
149
- ```
150
-
151
- **Disabling Updates**:
152
-
153
- ```bash
154
- # Temporary (one session)
155
- export AI_TOOLKIT_SKIP_UPDATE_CHECK=1
156
-
157
- # Permanent (add to shell config)
158
- echo "export AI_TOOLKIT_SKIP_UPDATE_CHECK=1" >> ~/.zshrc
159
- ```
160
-
161
- **Error Handling**:
162
-
163
- - If update checker installation fails, a warning is shown but installation continues
164
- - Failure is treated as non-critical (user can still use installed commands/agents)
165
- - Users are advised to report issues at <https://github.com/Uniswap/ai-toolkit/issues>
166
-
167
- ### Installation Modes
168
-
169
- - **Global**: Installs to `~/.claude/` for user-wide configurations
170
- - **Local**: Installs to `./.claude/` in the current directory for project-specific configurations
171
- - Requires confirmation that you're at the project root
172
- - Exits if not at project root
173
-
174
- ### Content Sources
175
-
176
- The generator pulls content from:
177
-
178
- - `@ai-toolkit/commands-agnostic`: Language-agnostic command templates
179
- - `@ai-toolkit/agents-agnostic`: Language-agnostic agent configurations
180
-
181
- ## Generator Options
182
-
183
- ### Optional Parameters
184
-
185
- - `installMode`: Choose between 'default' (recommended setup) or 'custom' (full control) - typically set by CLI menu selection
186
- - `installationType`: Choose between 'global' or 'local' installation (custom mode only)
187
- - `confirmLocalPath`: For local installations, confirms you're at project root (custom mode only, auto-prompted if not provided)
188
- - `installCommands`: Boolean flag to install commands (custom mode only)
189
- - `installAgents`: Boolean flag to install agents (custom mode only)
190
- - `installHooks`: Boolean flag to install notification hooks (always prompted)
191
- - `hooksMode`: Notification mode - 'sound', 'speech', or 'both' (default: 'sound')
192
- - `installAddons`: Boolean flag to install addons like spec-mcp-workflow (custom mode only; interactive prompt occurs after hooks)
193
- - `commands`: Array of specific command names to install (only used if installCommands=true)
194
- - `agents`: Array of specific agent names to install (only used if installAgents=true)
195
- - `dry`: Preview installation without making changes (custom mode only)
196
- - `nonInteractive`: Skip all prompts and use provided options
197
- - `force`: Overwrite existing installation without confirmation
198
-
199
- ## Usage Examples
200
-
201
- ### Recommended: Via CLI Menu
202
-
203
- The best way to run the init generator is through the CLI, which presents a clear menu:
204
-
205
- ```bash
206
- npx @uniswap/ai-toolkit-nx-claude@latest
207
-
208
- # Presents menu:
209
- # 1. default-install - Recommended setup with pre-selected components
210
- # 2. custom-install - Choose exactly what to install
211
- ```
212
-
213
- ### Default Installation Mode
214
-
215
- Automatically invoked when selecting "default-install" from CLI menu, or explicitly:
216
-
217
- ```bash
218
- npx nx generate @uniswap/ai-toolkit-nx-claude:init --install-mode=default
219
- ```
220
-
221
- **Flow**:
222
-
223
- 1. Check if Claude CLI is installed (offer to install if missing)
224
- 2. Show pre-selected components (6 commands, 6 agents, global installation)
225
- 3. Prompt for notification hooks installation
226
- 4. Install everything and show summary
227
-
228
- **Output**:
229
-
230
- ```
231
- 📦 Default Installation Mode
232
- Installing recommended setup with pre-selected components
233
-
234
- 📍 Location: Global (~/.claude)
235
- 📝 Commands: 6 pre-selected
236
- 🤖 Agents: 6 pre-selected
237
-
238
- 🔔 Install notification hooks? (y/n) > y
239
-
240
- [Installation progress...]
241
-
242
- ✨ Installation complete!
243
- Commands: explore, plan, review-plan, execute-plan, address-pr-issues
244
- Agents: context-loader, planner, plan-reviewer, test-writer, doc-writer, pr-reviewer
245
- Hooks: ✅ Installed
246
- ```
247
-
248
- ### Custom Installation Mode
249
-
250
- Automatically invoked when selecting "custom-install" from CLI menu, or explicitly:
251
-
252
- ```bash
253
- npx nx generate @uniswap/ai-toolkit-nx-claude:init --install-mode=custom
254
- ```
255
-
256
- **Flow**:
257
-
258
- 1. Check if Claude CLI is installed (offer to install if missing)
259
- 2. Ask for installation type (global or local)
260
- 3. For local installations: Confirm you're at project root (exits if not)
261
- 4. Ask if you want to install commands (yes/no)
262
- 5. If yes → show command multi-select with indicators for existing files:
263
- - "(will overwrite)" for files in target location
264
- - "(exists globally/locally)" for files in other location
265
- 6. Ask if you want to install agents (yes/no)
266
- 7. If yes → show agent multi-select with same indicators
267
- 8. Ask if you want to install notification hooks (yes/no)
268
- 9. After installing hooks, ask if you want to install addons (yes/no)
269
- 10. Ask for dry-run mode preference
270
- 11. If existing installation detected: Ask to force overwrite
271
- 12. Install selections, install hooks, optionally install addons, and show summary
272
-
273
- ### Non-Interactive Default Installation
274
-
275
- ```bash
276
- npx nx generate @uniswap/ai-toolkit-nx-claude:init --no-interactive --install-mode=default --install-hooks=true
277
- ```
278
-
279
- ### Non-Interactive Custom Installation
280
-
281
- ```bash
282
- npx nx generate @uniswap/ai-toolkit-nx-claude:init \
283
- --no-interactive \
284
- --install-mode=custom \
285
- --installation-type=global \
286
- --install-commands=true \
287
- --commands=review-pr,gen-tests,plan,execute-plan \
288
- --install-agents=true \
289
- --agents=test-writer,doc-writer,planner \
290
- --install-hooks=true \
291
- --install-addons=false
292
- ```
293
-
294
- ### Dry Run to Preview (Custom Mode Only)
295
-
296
- ```bash
297
- npx nx generate @uniswap/ai-toolkit-nx-claude:init --install-mode=custom --dry
298
- ```
299
-
300
- In dry-run mode, the generator will show:
301
-
302
- - The installation methods that would be attempted (curl → npm → manual) if Claude CLI not installed
303
- - The files that would be installed
304
- - Hooks that would be installed
305
- - Whether you would be prompted for addons after hooks, and the addon that would be installed if accepted
306
- - The auto-update checker setup plan (shell detection, config update, frequency)
307
- - No actual changes will be made to the system
308
-
309
- **Note**: Default mode does not support dry-run (it always installs).
310
-
311
- ## File Structure Created
312
-
313
- ### Global Installation (~/.claude/)
314
-
315
- ```
316
- ~/.claude/
317
- ├── commands/
318
- │ ├── review-pr.md
319
- │ ├── gen-tests.md
320
- │ ├── plan.md
321
- │ ├── explain-file.md
322
- │ ├── fix-bug.md
323
- │ └── refactor.md
324
- ├── agents/
325
- │ ├── test-writer.md
326
- │ ├── doc-writer.md
327
- │ ├── code-explainer.md
328
- │ ├── debug-assistant.md
329
- │ ├── refactorer.md
330
- │ └── style-enforcer.md
331
- ├── manifest.json
332
- └── .last-update-check # Cache file for auto-update checker (timestamp)
333
- ```
334
-
335
- ### Local Installation (./.claude/)
336
-
337
- ```
338
- ./.claude/
339
- ├── commands/
340
- │ ├── review-pr.md
341
- │ ├── gen-tests.md
342
- │ ├── plan.md
343
- │ ├── explain-file.md
344
- │ ├── fix-bug.md
345
- │ └── refactor.md
346
- ├── agents/
347
- │ ├── test-writer.md
348
- │ ├── doc-writer.md
349
- │ ├── code-explainer.md
350
- │ ├── debug-assistant.md
351
- │ ├── refactorer.md
352
- │ └── style-enforcer.md
353
- └── manifest.json
354
-
355
- Note: The .last-update-check cache file is stored in ~/.uniswap-ai-toolkit/ (global location) regardless of installation type, since auto-update checker is installed globally to shell config.
356
- ```
357
-
358
- ## Shell Configuration Modifications
359
-
360
- The init generator modifies your shell configuration file to add the auto-update checker:
361
-
362
- ### Bash (~/.bashrc)
363
-
364
- ```bash
365
- # AUTOMATED BY AI_TOOLKIT_UPDATE_CHECK v0.5.7
366
- _ai_toolkit_check_updates() {
367
- [ -n "$AI_TOOLKIT_SKIP_UPDATE_CHECK" ] && return
368
- # ... update check logic ...
369
- }
370
- _ai_toolkit_check_updates
371
- # END AI_TOOLKIT_UPDATE_CHECK
372
- ```
373
-
374
- ### Zsh (~/.zshrc)
375
-
376
- Same format as bash (uses POSIX-compatible syntax).
377
-
378
- ### Fish (~/.config/fish/config.fish)
379
-
380
- ```fish
381
- # AUTOMATED BY AI_TOOLKIT_UPDATE_CHECK v0.5.7
382
- function _ai_toolkit_check_updates
383
- if set -q AI_TOOLKIT_SKIP_UPDATE_CHECK
384
- return
385
- end
386
- # ... update check logic ...
387
- end
388
- _ai_toolkit_check_updates
389
- # END AI_TOOLKIT_UPDATE_CHECK
390
- ```
391
-
392
- **Important Notes**:
393
-
394
- - The script is self-contained between marker comments for easy removal
395
- - Running init again will update the version in the script
396
- - Backup files are created before any modifications (e.g., `~/.zshrc.backup-1234567890`)
397
- - The script only runs if the markers aren't already present (idempotent)
398
-
399
- ## Manifest File Structure
400
-
401
- The generated `manifest.json` contains:
402
-
403
- ```json
404
- {
405
- "version": "1.0.0",
406
- "installedAt": "2024-01-15T10:30:00.000Z",
407
- "commands": ["review-pr", "gen-tests", ...],
408
- "agents": ["test-writer", "doc-writer", ...],
409
- "files": ["commands/review-pr.md", "agents/test-writer.md", ...]
410
- }
411
- ```
412
-
413
- ## Implementation Details
414
-
415
- ### Key Components
416
-
417
- 1. **initGenerator**: Main generator function that orchestrates the installation
418
- - Checks Claude CLI installation
419
- - Handles installation type selection (global/local)
420
- - Validates local installation path
421
- - Detects existing files in both locations
422
- - Orchestrates file copying and manifest creation
423
- - Installs auto-update checker after successful setup
424
- 2. **Claude CLI Installation Functions**:
425
- - **installClaude**: Main orchestrator for installation with fallback logic
426
- - **installViaCurl**: Primary installation method using official curl script
427
- - **installViaNpm**: Fallback installation method using npm
428
- - **verifyInstallation**: Verifies CLI installation success
429
- - **provideManualInstructions**: Displays manual installation steps when auto-install fails
430
- 3. **Auto-Update Functions** (from `auto-update-utils.ts`):
431
- - **detectShell**: Detects shell type from environment (bash/zsh/fish)
432
- - **getCurrentToolkitVersion**: Reads version from package.json
433
- - **installUpdateChecker**: Main function that installs update checker to shell config
434
- - **generateAutoUpdateSnippet**: Generates bash/zsh update check script
435
- - **generateFishAutoUpdateSnippet**: Generates fish-specific update check script
436
- - **getShellConfigPath**: Returns shell config file path for detected shell
437
- 4. **prompt-utils.ts**: Schema-driven prompt generation module
438
- - **promptForMissingOptions**: Reads schema.json and generates prompts for missing options
439
- - **promptForProperty**: Handles different property types (boolean, string, array, enum)
440
- - **promptMultiSelectWithAll**: Enhanced multi-select with file existence indicators
441
- 5. **checkExistingFiles**: Detects which files already exist in target locations
442
- 6. **promptOverwrite**: Manages collision detection and user confirmation
443
- 7. **checkClaudeInstalled**: Checks if Claude CLI is already installed
444
- 8. **promptInstallClaude**: Prompts user for consent to install Claude CLI
445
-
446
- ### Schema-Driven Prompting
447
-
448
- The generator uses `schema.json` as the single source of truth for all options:
449
-
450
- - Automatically discovers all configurable options
451
- - Generates appropriate prompt types based on schema property types
452
- - Supports x-prompt hints from the schema for custom prompt messages
453
- - Special handling for conditional prompts (e.g., confirmLocalPath only for local installations)
454
- - Dynamic choice enhancement with file existence indicators
455
-
456
- ### Content Resolution
457
-
458
- - Commands and agents are imported from their respective content packages
459
- - File paths are resolved relative to the compiled output directory
460
- - Content is read from source files and written to the target directory
461
-
462
- ### Error Handling
463
-
464
- - Validates target directory existence
465
- - Checks for existing installations
466
- - Handles missing content gracefully
467
- - Provides informative logging throughout the process
468
- - **Installation-specific error handling**:
469
- - Command not found errors (curl/npm)
470
- - Permission denied errors
471
- - Network timeouts (5-minute limit)
472
- - PATH configuration issues
473
- - Platform compatibility warnings
474
-
475
- ## Development Notes
476
-
477
- ### Adding New Content
478
-
479
- To add new commands or agents:
480
-
481
- 1. Add them to the respective content packages (`@ai-toolkit/commands-*` or `@ai-toolkit/agents-*`)
482
- 2. Export them from the package's index file
483
- 3. The init generator will automatically discover them
484
-
485
- ### Testing the Generator
486
-
487
- ```bash
488
- # Build the plugin first
489
- npx nx build nx-claude
490
-
491
- # Test global installation with dry-run
492
- npx nx generate @uniswap/ai-toolkit-nx-claude:init --dry --installation-type=global
493
-
494
- # Test local installation (must be at project root)
495
- npx nx generate @uniswap/ai-toolkit-nx-claude:init --installation-type=local --confirm-local-path=true
496
-
497
- # Test interactive mode
498
- npx nx generate @uniswap/ai-toolkit-nx-claude:init
499
-
500
- # Verify global installation
501
- ls -la ~/.claude/
502
- cat ~/.claude/manifest.json
503
-
504
- # Verify local installation
505
- ls -la ./.claude/
506
- cat ./.claude/manifest.json
507
- ```
508
-
509
- ## Maintenance Requirements
510
-
511
- ⚠️ **IMPORTANT**: Whenever the init generator is updated, this CLAUDE.md file MUST also be updated to reflect any changes in:
512
-
513
- - Functionality
514
- - Options/parameters
515
- - File structure
516
- - Content sources
517
- - Usage patterns
518
- - Implementation details
519
-
520
- It should, at any given point in time, be a snapshot of the functionality of this generator. This ensures that Claude Code and other AI assistants have accurate, up-to-date information about the generator's capabilities and usage.