@uniswap/ai-toolkit-nx-claude 0.5.29 → 0.5.30-next.1
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,409 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Initialize or update CLAUDE.md documentation files based on context and changes
|
|
3
|
-
argument-hint: <natural language request about documentation>
|
|
4
|
-
allowed-tools: Read(*), Write(*.md), Edit(*.md), MultiEdit(*.md), Glob(*), Grep(*), LS(*), Bash(git:*), Task(*)
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# Claude-Docs Command
|
|
8
|
-
|
|
9
|
-
Intelligently manages CLAUDE.md documentation files across your repository. Supports both initialization of new documentation and updates based on changes.
|
|
10
|
-
|
|
11
|
-
## Common Input Processing
|
|
12
|
-
|
|
13
|
-
Accept natural language input and extract intent:
|
|
14
|
-
|
|
15
|
-
- **Input text**: Parse the user's request to understand intent
|
|
16
|
-
|
|
17
|
-
- **"init" keywords**: "init", "initialize", "setup", "create", "bootstrap", "start"
|
|
18
|
-
- Triggers: "init docs", "initialize documentation", "setup CLAUDE.md files"
|
|
19
|
-
- Routes to: **INIT Path** (claude-docs-initializer agent)
|
|
20
|
-
- **"update" keywords**: "update", "refresh", "sync", "maintain" (or no init keywords)
|
|
21
|
-
- Triggers: "update docs", "sync documentation", "refresh based on changes"
|
|
22
|
-
- Routes to: **UPDATE Path** (claude-docs-manager agent)
|
|
23
|
-
- **Additional keywords**:
|
|
24
|
-
- **"git" keywords**: "git changes", "uncommitted", "staged", "diff"
|
|
25
|
-
- Path references: "in packages/ui", "for the UI package", specific paths mentioned
|
|
26
|
-
|
|
27
|
-
- **Mode determination**:
|
|
28
|
-
|
|
29
|
-
1. Explicitly check for init keywords first → Use **INIT Path**
|
|
30
|
-
2. Otherwise → Use **UPDATE Path** (default)
|
|
31
|
-
3. Extract any file limit specification (e.g., "init with max 50 files per agent")
|
|
32
|
-
4. For init: Check if CLAUDE.md files already exist (warn if they do)
|
|
33
|
-
|
|
34
|
-
- **Clarification**: If intent is unclear:
|
|
35
|
-
- For existing repos: "Would you like to initialize new documentation or update existing?"
|
|
36
|
-
- For updates: "Should I update based on current session changes or git diff?"
|
|
37
|
-
|
|
38
|
-
## UPDATE Path (Default)
|
|
39
|
-
|
|
40
|
-
### Inputs for Update
|
|
41
|
-
|
|
42
|
-
- **Derived parameters**:
|
|
43
|
-
- `scope`: Default to `session`, unless git keywords detected
|
|
44
|
-
- `targetPath`: Extracted from path references if mentioned
|
|
45
|
-
- `changeContext`: Why these changes were made (from session/git context)
|
|
46
|
-
|
|
47
|
-
### Task for Update
|
|
48
|
-
|
|
49
|
-
1. **Analyze Change Significance**:
|
|
50
|
-
|
|
51
|
-
- Identify significant vs insignificant changes
|
|
52
|
-
- Filter out minor fixes, typos, formatting
|
|
53
|
-
|
|
54
|
-
2. **Single Agent Invocation**:
|
|
55
|
-
- Call claude-docs-manager with all changes
|
|
56
|
-
- Agent handles Documentation Proximity Principle
|
|
57
|
-
|
|
58
|
-
### Delegation for Update
|
|
59
|
-
|
|
60
|
-
Invoke **claude-docs-manager** with:
|
|
61
|
-
|
|
62
|
-
- `changes`: Complete list of all significant file changes
|
|
63
|
-
- `filePath`: Absolute path to changed file
|
|
64
|
-
- `changeType`: added|modified|deleted
|
|
65
|
-
- `description`: Brief description of the change
|
|
66
|
-
- `changeContext`: Why these changes were made (from session/git context)
|
|
67
|
-
- `projectInfo`: Basic project metadata
|
|
68
|
-
- `name`: Project/package name
|
|
69
|
-
- `type`: Project type (monorepo, library, app, etc.)
|
|
70
|
-
- `techStack`: Detected technologies
|
|
71
|
-
- `packageManager`: npm, yarn, bun, etc.
|
|
72
|
-
- `rootGuidelines`: (Optional) Key guidelines from existing root CLAUDE.md
|
|
73
|
-
|
|
74
|
-
The agent will:
|
|
75
|
-
|
|
76
|
-
- Identify ALL CLAUDE.md files that need updates
|
|
77
|
-
- Update each file with appropriate scope (component/module/package/root)
|
|
78
|
-
- Create new CLAUDE.md files where needed
|
|
79
|
-
- Return all updated files in a single response
|
|
80
|
-
|
|
81
|
-
### Output for Update
|
|
82
|
-
|
|
83
|
-
Return results from claude-docs-manager:
|
|
84
|
-
|
|
85
|
-
```yaml
|
|
86
|
-
summary: |
|
|
87
|
-
Successfully updated N CLAUDE.md files
|
|
88
|
-
Created: X files
|
|
89
|
-
Updated: Y files
|
|
90
|
-
Skipped: Z files (changes not relevant at those levels)
|
|
91
|
-
|
|
92
|
-
updatedFiles:
|
|
93
|
-
- path: /path/to/CLAUDE.md
|
|
94
|
-
operation: created|updated
|
|
95
|
-
changes: [what was added/modified in this file]
|
|
96
|
-
scope: root|package|module|component
|
|
97
|
-
|
|
98
|
-
skippedFiles:
|
|
99
|
-
- path: /path/to/CLAUDE.md
|
|
100
|
-
reason: "Changes don't affect this level's documentation"
|
|
101
|
-
|
|
102
|
-
errors:
|
|
103
|
-
- path: /path/to/failed/CLAUDE.md
|
|
104
|
-
error: [error message]
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
### Examples for Update
|
|
108
|
-
|
|
109
|
-
```bash
|
|
110
|
-
# Update based on current session changes (default)
|
|
111
|
-
/claude-docs update
|
|
112
|
-
/claude-docs update the docs
|
|
113
|
-
/claude-docs sync documentation with my changes
|
|
114
|
-
|
|
115
|
-
# Update based on git changes
|
|
116
|
-
/claude-docs update based on git diff
|
|
117
|
-
/claude-docs sync with uncommitted changes
|
|
118
|
-
|
|
119
|
-
# Process specific package
|
|
120
|
-
/claude-docs update the UI package documentation
|
|
121
|
-
/claude-docs refresh docs for packages/ui
|
|
122
|
-
|
|
123
|
-
# Natural language requests
|
|
124
|
-
/claude-docs "I just refactored the API layer, update the relevant docs"
|
|
125
|
-
/claude-docs "sync the documentation with what I've changed today"
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
## INIT Path
|
|
129
|
-
|
|
130
|
-
### ⏱️ CRITICAL: User Communication FIRST
|
|
131
|
-
|
|
132
|
-
**Before invoking any agents, ALWAYS display this performance notice to the user:**
|
|
133
|
-
|
|
134
|
-
```
|
|
135
|
-
⏱️ **Performance Notice**: CLAUDE.md initialization will take 10-15+ minutes for medium-sized repositories.
|
|
136
|
-
|
|
137
|
-
The process will:
|
|
138
|
-
- Analyze your entire repository structure
|
|
139
|
-
- Read and parse hundreds of files
|
|
140
|
-
- Generate comprehensive documentation at multiple levels
|
|
141
|
-
- Create 3-10+ CLAUDE.md files depending on repository size
|
|
142
|
-
|
|
143
|
-
Please be patient - the process is working even during apparent pauses.
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
**Only after displaying this message should you proceed with repository analysis.**
|
|
147
|
-
|
|
148
|
-
### Inputs for Init
|
|
149
|
-
|
|
150
|
-
- **Derived parameters**:
|
|
151
|
-
- `fileLimit`: Default 100 files per agent (or user-specified)
|
|
152
|
-
- `targetPath`: Extracted from path references if mentioned
|
|
153
|
-
|
|
154
|
-
### Task for Init
|
|
155
|
-
|
|
156
|
-
1. **Repository Analysis**:
|
|
157
|
-
|
|
158
|
-
- Use git to quickly understand structure: `git ls-files | wc -l`
|
|
159
|
-
- Find major boundaries: packages, apps, services
|
|
160
|
-
- Count files per area: `git ls-files [area] | wc -l`
|
|
161
|
-
- Assess complexity by file types and patterns
|
|
162
|
-
|
|
163
|
-
2. **Intelligent Area Splitting**:
|
|
164
|
-
|
|
165
|
-
- Default: 100 files at most per agent (or user-specified limit)
|
|
166
|
-
- Split areas exceeding limits into logical sub-areas
|
|
167
|
-
- Identify natural boundaries (pages vs components, routes vs services)
|
|
168
|
-
|
|
169
|
-
3. **Build Hierarchical Execution Plan**:
|
|
170
|
-
- Level 1: Parallel leaf agents for split areas
|
|
171
|
-
- Level 2: Area root agents (wait for their leaves)
|
|
172
|
-
- Level 3: Repository root agent (waits for all areas)
|
|
173
|
-
- Track dependencies between levels
|
|
174
|
-
|
|
175
|
-
Example execution plan for large monorepo:
|
|
176
|
-
|
|
177
|
-
```
|
|
178
|
-
Level 1 (Parallel leaf documentation):
|
|
179
|
-
- Agent A: "Document user-facing frontend pages in /frontend/pages/user (50 files)"
|
|
180
|
-
- Agent B: "Document admin frontend pages in /frontend/pages/admin (45 files)"
|
|
181
|
-
- Agent C: "Document shared UI components in /frontend/components (80 files)"
|
|
182
|
-
- Agent D: "Document backend API routes in /backend/routes (60 files)"
|
|
183
|
-
- Agent E: "Document backend services in /backend/services (40 files)"
|
|
184
|
-
|
|
185
|
-
Level 2 (Area roots - wait for their leaves):
|
|
186
|
-
- Agent F: "Create frontend root CLAUDE.md" (waits for A,B,C)
|
|
187
|
-
- Agent G: "Create backend root CLAUDE.md" (waits for D,E)
|
|
188
|
-
|
|
189
|
-
Level 3 (Repository root - wait for all areas):
|
|
190
|
-
- Agent H: "Create repository root CLAUDE.md with documentation management rules" (waits for F,G) - uses claude-docs-manager
|
|
191
|
-
```
|
|
192
|
-
|
|
193
|
-
4. **Execute Plan with Task Tool**:
|
|
194
|
-
- Run Level 1 agents in parallel
|
|
195
|
-
- Collect coordinationContext from each
|
|
196
|
-
- Run Level 2 with context from their leaves
|
|
197
|
-
- Run Level 3 with all area contexts
|
|
198
|
-
- Aggregate all results
|
|
199
|
-
|
|
200
|
-
### Delegation for Init
|
|
201
|
-
|
|
202
|
-
Execute hierarchical parallelized documentation creation:
|
|
203
|
-
|
|
204
|
-
#### Phase 1: Repository Analysis
|
|
205
|
-
|
|
206
|
-
**⚠️ CRITICAL: ALWAYS prefer git commands over find/glob for discovery!**
|
|
207
|
-
|
|
208
|
-
- Git automatically excludes node_modules, build outputs, and ignored files
|
|
209
|
-
- Only use find/glob as fallback for non-git repositories
|
|
210
|
-
- If using find, MUST use `*/node_modules/*` not `./node_modules/*` for exclusions
|
|
211
|
-
|
|
212
|
-
Quickly analyze repository structure using git:
|
|
213
|
-
|
|
214
|
-
- Get total file count: `git ls-files | wc -l`
|
|
215
|
-
- Find package boundaries: `git ls-files | grep 'package\.json$'`
|
|
216
|
-
- Identify tech stacks used and major directories and their sizes
|
|
217
|
-
- Determine complexity based on file patterns and structure
|
|
218
|
-
|
|
219
|
-
#### Phase 2: Create Execution Plan
|
|
220
|
-
|
|
221
|
-
Based on analysis, determine splitting strategy
|
|
222
|
-
|
|
223
|
-
#### Phase 3: Execute Level 1 - Parallel Leaf Documentation
|
|
224
|
-
|
|
225
|
-
Invoke multiple **claude-docs-initializer** agents in PARALLEL:
|
|
226
|
-
|
|
227
|
-
For each Level 1 agent:
|
|
228
|
-
|
|
229
|
-
- `target`: "Document [specific area description] in [path]"
|
|
230
|
-
- `siblingContext`: "Other agents are documenting: [list of other Level 1 areas]"
|
|
231
|
-
|
|
232
|
-
Agents work simultaneously on different areas.
|
|
233
|
-
|
|
234
|
-
#### Phase 4: Execute Level 2 - Area Root Documentation
|
|
235
|
-
|
|
236
|
-
After Level 1 agents complete for an area, invoke **claude-docs-initializer**:
|
|
237
|
-
|
|
238
|
-
- `target`: "Create root CLAUDE.md for the [area] summarizing its architecture"
|
|
239
|
-
- `siblingContext`: "Other root agents are creating: [list of other area roots]"
|
|
240
|
-
- `completedContext`: [Concatenated coordinationContext from relevant Level 1 agents]
|
|
241
|
-
|
|
242
|
-
#### Phase 5: Execute Level 3 - Repository Root
|
|
243
|
-
|
|
244
|
-
After all Level 2 agents complete, invoke **claude-docs-manager**:
|
|
245
|
-
|
|
246
|
-
- `changes`: Empty list (no specific file changes for init)
|
|
247
|
-
- `changeContext`: "Initial repository documentation setup"
|
|
248
|
-
- `projectInfo`: [Gathered project metadata from analysis]
|
|
249
|
-
- `rootGuidelines`: null (creating for first time)
|
|
250
|
-
- `isRoot`: true (triggers inclusion of Documentation Management rules)
|
|
251
|
-
- `completedContext`: [Concatenated coordinationContext from all Level 2 agents]
|
|
252
|
-
|
|
253
|
-
**Note**: We use claude-docs-manager here specifically to ensure the Documentation Management rules are properly included in the root CLAUDE.md.
|
|
254
|
-
|
|
255
|
-
### Output for Init
|
|
256
|
-
|
|
257
|
-
Return aggregated results from all agents (claude-docs-initializer for all levels except repository root, claude-docs-manager for repository root only):
|
|
258
|
-
|
|
259
|
-
```yaml
|
|
260
|
-
summary: |
|
|
261
|
-
Repository analysis: [monorepo with X packages | single app | library]
|
|
262
|
-
Execution: [N agents in parallel across M levels]
|
|
263
|
-
Successfully created [total] CLAUDE.md files
|
|
264
|
-
Total files analyzed: [sum across all agents]
|
|
265
|
-
|
|
266
|
-
executionPlan:
|
|
267
|
-
level1Agents: 5 # Parallel leaf documentation
|
|
268
|
-
level2Agents: 2 # Area roots
|
|
269
|
-
level3Agents: 1 # Repository root
|
|
270
|
-
totalExecutionTime: '2m 34s'
|
|
271
|
-
|
|
272
|
-
createdFilesByLevel:
|
|
273
|
-
leafDocumentation:
|
|
274
|
-
- agent: 'frontend-user-pages'
|
|
275
|
-
files: 3
|
|
276
|
-
paths: ['/frontend/pages/user/CLAUDE.md', ...]
|
|
277
|
-
- agent: 'frontend-admin-pages'
|
|
278
|
-
files: 2
|
|
279
|
-
paths: ['/frontend/pages/admin/CLAUDE.md', ...]
|
|
280
|
-
|
|
281
|
-
areaRoots:
|
|
282
|
-
- path: '/frontend/CLAUDE.md'
|
|
283
|
-
synthesizedFrom: ['frontend-user-pages', 'frontend-admin-pages', 'frontend-components']
|
|
284
|
-
- path: '/backend/CLAUDE.md'
|
|
285
|
-
synthesizedFrom: ['backend-routes', 'backend-services']
|
|
286
|
-
|
|
287
|
-
repositoryRoot:
|
|
288
|
-
- path: '/CLAUDE.md'
|
|
289
|
-
synthesizedFrom: ['frontend-root', 'backend-root', 'database']
|
|
290
|
-
|
|
291
|
-
architecturalFindings: # Aggregated from all agents
|
|
292
|
-
frontend: 'Next.js 14 with App Router, Tailwind CSS, 234 total components'
|
|
293
|
-
backend: 'Express with layered architecture, 23 RESTful endpoints'
|
|
294
|
-
database: 'PostgreSQL with Prisma ORM, 15 models'
|
|
295
|
-
patterns: 'Consistent use of TypeScript, feature-based organization'
|
|
296
|
-
|
|
297
|
-
recommendations: # Collected from all agents
|
|
298
|
-
- 'Split large UserDashboard component (500+ lines)'
|
|
299
|
-
- 'Add CLAUDE.md for growing analytics module'
|
|
300
|
-
- 'Consider documenting complex auth flow separately'
|
|
301
|
-
|
|
302
|
-
errors: # Any failures across all agents
|
|
303
|
-
- agent: 'frontend-utils'
|
|
304
|
-
error: 'Failed to analyze due to circular dependencies'
|
|
305
|
-
```
|
|
306
|
-
|
|
307
|
-
### Examples for Init
|
|
308
|
-
|
|
309
|
-
```bash
|
|
310
|
-
# Initialize new documentation (first time setup)
|
|
311
|
-
/claude-docs init
|
|
312
|
-
/claude-docs initialize documentation
|
|
313
|
-
/claude-docs setup CLAUDE.md files
|
|
314
|
-
|
|
315
|
-
# Initialize with custom file limit per agent
|
|
316
|
-
/claude-docs init with max 50 files per agent
|
|
317
|
-
/claude-docs initialize docs limiting each agent to 100 files
|
|
318
|
-
|
|
319
|
-
# Initialize for large repository (automatic splitting)
|
|
320
|
-
/claude-docs "create initial documentation for this large monorepo"
|
|
321
|
-
# → Analyzes repo, finds 3000+ files
|
|
322
|
-
# → Splits into 8 parallel agents across 3 levels
|
|
323
|
-
# → Creates comprehensive hierarchical documentation
|
|
324
|
-
|
|
325
|
-
# Natural language requests
|
|
326
|
-
/claude-docs "initialize CLAUDE.md files for this monorepo"
|
|
327
|
-
```
|
|
328
|
-
|
|
329
|
-
## Example Workflow
|
|
330
|
-
|
|
331
|
-
### Large Next.js + Supabase Monorepo - Init Path
|
|
332
|
-
|
|
333
|
-
When user runs: `/claude-docs init`
|
|
334
|
-
|
|
335
|
-
1. **Quick Analysis** determines:
|
|
336
|
-
|
|
337
|
-
```
|
|
338
|
-
Total files: 2500
|
|
339
|
-
Frontend: /app (1800 files)
|
|
340
|
-
Backend: /api (500 files)
|
|
341
|
-
Database: /supabase (200 files)
|
|
342
|
-
```
|
|
343
|
-
|
|
344
|
-
2. **Intelligent Splitting** creates plan:
|
|
345
|
-
|
|
346
|
-
```
|
|
347
|
-
Frontend needs splitting (1800 > 100):
|
|
348
|
-
- /app/(user) → 450 files (complex pages) → split to 150x3
|
|
349
|
-
- /app/(admin) → 350 files (complex) → split to 175x2
|
|
350
|
-
- /app/components → 600 files (simple UI) → split to 300x2
|
|
351
|
-
- /app/lib → 400 files (utilities) → split to 200x2
|
|
352
|
-
|
|
353
|
-
Backend needs splitting (500 > 100):
|
|
354
|
-
- /api/routes → 300 files → split to 150x2
|
|
355
|
-
- /api/services → 200 files → split to 100x2
|
|
356
|
-
|
|
357
|
-
Database ok as single (200 files, moderate complexity)
|
|
358
|
-
```
|
|
359
|
-
|
|
360
|
-
3. **Hierarchical Execution**:
|
|
361
|
-
|
|
362
|
-
```
|
|
363
|
-
Level 1 (14 agents in parallel):
|
|
364
|
-
├── frontend-user-1 (150 files)
|
|
365
|
-
├── frontend-user-2 (150 files)
|
|
366
|
-
├── frontend-user-3 (150 files)
|
|
367
|
-
├── frontend-admin-1 (175 files)
|
|
368
|
-
├── frontend-admin-2 (175 files)
|
|
369
|
-
├── frontend-components-1 (300 files)
|
|
370
|
-
├── frontend-components-2 (300 files)
|
|
371
|
-
├── frontend-lib-1 (200 files)
|
|
372
|
-
├── frontend-lib-2 (200 files)
|
|
373
|
-
├── backend-routes-1 (150 files)
|
|
374
|
-
├── backend-routes-2 (150 files)
|
|
375
|
-
├── backend-services-1 (100 files)
|
|
376
|
-
├── backend-services-2 (100 files)
|
|
377
|
-
└── database (200 files)
|
|
378
|
-
|
|
379
|
-
Level 2 (2 agents, wait for their leaves):
|
|
380
|
-
├── frontend-root (waits for 9 frontend agents)
|
|
381
|
-
└── backend-root (waits for 4 backend agents)
|
|
382
|
-
|
|
383
|
-
Level 3 (1 agent, waits for all):
|
|
384
|
-
└── repository-root (waits for frontend-root, backend-root, database) - claude-docs-manager
|
|
385
|
-
```
|
|
386
|
-
|
|
387
|
-
4. **Result**: 17 agents total, 14 run in parallel initially, creating comprehensive documentation in ~2-3 minutes instead of 15+ minutes sequentially.
|
|
388
|
-
|
|
389
|
-
## Implementation Notes
|
|
390
|
-
|
|
391
|
-
1. **Mode Detection**: Check for init keywords first, default to update mode
|
|
392
|
-
2. **Agent Orchestration**:
|
|
393
|
-
- **INIT Path**: Parallel multi-agent hierarchical execution
|
|
394
|
-
- Level 1: Multiple agents work on different areas simultaneously
|
|
395
|
-
- Level 2: Area roots synthesize findings from their leaves
|
|
396
|
-
- Level 3: Repository root consolidates all area summaries
|
|
397
|
-
- **UPDATE Path**: Single claude-docs-manager agent (change-driven)
|
|
398
|
-
3. **Intelligent Splitting** (INIT Path only):
|
|
399
|
-
- Default 100 files per agent (configurable)
|
|
400
|
-
- Complexity scoring adjusts effective limits
|
|
401
|
-
- Natural boundary detection (pages/components, routes/services)
|
|
402
|
-
4. **Context Flow** (INIT Path):
|
|
403
|
-
- Leaf agents generate coordinationContext
|
|
404
|
-
- Area roots receive and synthesize leaf contexts
|
|
405
|
-
- Repository root receives all area contexts
|
|
406
|
-
5. **Parallel Execution**: Use Task tool to spawn multiple agents simultaneously
|
|
407
|
-
6. **Session-First Default**: For updates, prioritize session changes unless specified
|
|
408
|
-
7. **Preserve Custom Content**: Both agents respect user-added content sections
|
|
409
|
-
8. **Documentation Hierarchy**: Agents create docs only at their assigned level
|