specweave 1.0.256 → 1.0.259

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 (113) hide show
  1. package/CLAUDE.md +56 -221
  2. package/README.md +31 -0
  3. package/bin/specweave.js +17 -0
  4. package/dist/src/adapters/README.md +4 -4
  5. package/dist/src/adapters/agents-md-generator.d.ts.map +1 -1
  6. package/dist/src/adapters/agents-md-generator.js +0 -2
  7. package/dist/src/adapters/agents-md-generator.js.map +1 -1
  8. package/dist/src/adapters/claude/README.md +3 -3
  9. package/dist/src/adapters/claude/adapter.js +3 -3
  10. package/dist/src/adapters/claude-md-generator.js +1 -1
  11. package/dist/src/adapters/claude-md-generator.js.map +1 -1
  12. package/dist/src/adapters/registry.yaml +1 -1
  13. package/dist/src/cli/commands/create-increment.d.ts +24 -0
  14. package/dist/src/cli/commands/create-increment.d.ts.map +1 -0
  15. package/dist/src/cli/commands/create-increment.js +53 -0
  16. package/dist/src/cli/commands/create-increment.js.map +1 -0
  17. package/dist/src/cli/commands/init.d.ts.map +1 -1
  18. package/dist/src/cli/commands/init.js +48 -31
  19. package/dist/src/cli/commands/init.js.map +1 -1
  20. package/dist/src/cli/commands/update.d.ts.map +1 -1
  21. package/dist/src/cli/commands/update.js +36 -0
  22. package/dist/src/cli/commands/update.js.map +1 -1
  23. package/dist/src/cli/helpers/init/directory-structure.d.ts.map +1 -1
  24. package/dist/src/cli/helpers/init/directory-structure.js +13 -1
  25. package/dist/src/cli/helpers/init/directory-structure.js.map +1 -1
  26. package/dist/src/cli/helpers/init/summary-banner.d.ts +11 -0
  27. package/dist/src/cli/helpers/init/summary-banner.d.ts.map +1 -1
  28. package/dist/src/cli/helpers/init/summary-banner.js +49 -3
  29. package/dist/src/cli/helpers/init/summary-banner.js.map +1 -1
  30. package/dist/src/cli/helpers/issue-tracker/index.d.ts.map +1 -1
  31. package/dist/src/cli/helpers/issue-tracker/index.js +0 -1
  32. package/dist/src/cli/helpers/issue-tracker/index.js.map +1 -1
  33. package/dist/src/cli/helpers/issue-tracker/sync-config-writer.d.ts.map +1 -1
  34. package/dist/src/cli/helpers/issue-tracker/sync-config-writer.js +6 -2
  35. package/dist/src/cli/helpers/issue-tracker/sync-config-writer.js.map +1 -1
  36. package/dist/src/core/ac-progress-sync.d.ts +13 -0
  37. package/dist/src/core/ac-progress-sync.d.ts.map +1 -1
  38. package/dist/src/core/ac-progress-sync.js +28 -0
  39. package/dist/src/core/ac-progress-sync.js.map +1 -1
  40. package/dist/src/core/config/types.d.ts +24 -1
  41. package/dist/src/core/config/types.d.ts.map +1 -1
  42. package/dist/src/core/config/types.js +6 -1
  43. package/dist/src/core/config/types.js.map +1 -1
  44. package/dist/src/core/doctor/checkers/project-structure-checker.d.ts +1 -0
  45. package/dist/src/core/doctor/checkers/project-structure-checker.d.ts.map +1 -1
  46. package/dist/src/core/doctor/checkers/project-structure-checker.js +53 -3
  47. package/dist/src/core/doctor/checkers/project-structure-checker.js.map +1 -1
  48. package/dist/src/core/fabric/security-scanner.d.ts.map +1 -1
  49. package/dist/src/core/fabric/security-scanner.js +70 -9
  50. package/dist/src/core/fabric/security-scanner.js.map +1 -1
  51. package/dist/src/core/increment/increment-utils.d.ts +6 -0
  52. package/dist/src/core/increment/increment-utils.d.ts.map +1 -1
  53. package/dist/src/core/increment/increment-utils.js +5 -0
  54. package/dist/src/core/increment/increment-utils.js.map +1 -1
  55. package/dist/src/core/living-docs/discovery.d.ts +2 -0
  56. package/dist/src/core/living-docs/discovery.d.ts.map +1 -1
  57. package/dist/src/core/living-docs/discovery.js +91 -17
  58. package/dist/src/core/living-docs/discovery.js.map +1 -1
  59. package/dist/src/core/living-docs/intelligent-analyzer/index.d.ts +5 -0
  60. package/dist/src/core/living-docs/intelligent-analyzer/index.d.ts.map +1 -1
  61. package/dist/src/core/living-docs/intelligent-analyzer/index.js +3 -3
  62. package/dist/src/core/living-docs/intelligent-analyzer/index.js.map +1 -1
  63. package/dist/src/core/living-docs/lsp-bootstrapper.d.ts +64 -0
  64. package/dist/src/core/living-docs/lsp-bootstrapper.d.ts.map +1 -0
  65. package/dist/src/core/living-docs/lsp-bootstrapper.js +118 -0
  66. package/dist/src/core/living-docs/lsp-bootstrapper.js.map +1 -0
  67. package/dist/src/core/project/project-service.d.ts +10 -1
  68. package/dist/src/core/project/project-service.d.ts.map +1 -1
  69. package/dist/src/core/project/project-service.js +37 -2
  70. package/dist/src/core/project/project-service.js.map +1 -1
  71. package/dist/src/core/universal-auto-create.d.ts +64 -0
  72. package/dist/src/core/universal-auto-create.d.ts.map +1 -0
  73. package/dist/src/core/universal-auto-create.js +228 -0
  74. package/dist/src/core/universal-auto-create.js.map +1 -0
  75. package/package.json +1 -1
  76. package/plugins/specweave/PLUGIN.md +0 -3
  77. package/plugins/specweave/commands/living-docs.md +0 -2
  78. package/plugins/specweave/hooks/stop-sync.sh +34 -5
  79. package/plugins/specweave/hooks/user-prompt-submit.sh +115 -326
  80. package/plugins/specweave/hooks/v2/dispatchers/post-tool-use.sh +19 -5
  81. package/plugins/specweave/hooks/v2/handlers/ac-sync-dispatcher.sh +14 -4
  82. package/plugins/specweave/hooks/v2/handlers/universal-auto-create-dispatcher.sh +181 -0
  83. package/plugins/specweave/lib/hooks/sync-living-docs.js +4 -2
  84. package/plugins/specweave/scripts/skill-context.sh +160 -0
  85. package/plugins/specweave/skills/architect/SKILL.md +1 -1
  86. package/plugins/specweave/skills/archive-increments/SKILL.md +13 -3
  87. package/plugins/specweave/skills/auto/SKILL.md +92 -1038
  88. package/plugins/specweave/skills/do/SKILL.md +66 -1106
  89. package/plugins/specweave/skills/docs/SKILL.md +124 -56
  90. package/plugins/specweave/skills/done/SKILL.md +76 -1406
  91. package/plugins/specweave/skills/framework/SKILL.md +1 -1
  92. package/plugins/specweave/skills/increment/SKILL.md +1 -1
  93. package/plugins/specweave/skills/increment-planner/SKILL.md +29 -19
  94. package/plugins/specweave/skills/jobs/SKILL.md +52 -0
  95. package/plugins/specweave/skills/multi-project-spec-mapper/SKILL.md +1 -1
  96. package/plugins/specweave/skills/save/SKILL.md +51 -1372
  97. package/plugins/specweave/skills/smart-reopen-detector/SKILL.md +1 -1
  98. package/plugins/specweave/skills/tdd-orchestrator/SKILL.md +1 -1
  99. package/plugins/specweave/skills/validate/SKILL.md +65 -848
  100. package/plugins/specweave-backend/skills/database-optimizer/SKILL.md +1 -1
  101. package/plugins/specweave-backend/skills/graphql/SKILL.md +1 -1
  102. package/plugins/specweave-frontend/skills/design-system-architect/SKILL.md +1 -1
  103. package/plugins/specweave-frontend/skills/frontend/SKILL.md +1 -1
  104. package/plugins/specweave-frontend/skills/frontend-architect/SKILL.md +1 -1
  105. package/plugins/specweave-frontend/skills/frontend-design/SKILL.md +1 -1
  106. package/plugins/specweave-frontend/skills/i18n-expert/SKILL.md +1 -1
  107. package/plugins/specweave-payments/skills/billing-automation/SKILL.md +1 -1
  108. package/plugins/specweave-testing/skills/accessibility-testing/SKILL.md +1 -1
  109. package/src/templates/CLAUDE.md.template +50 -356
  110. package/src/templates/config.json.template +5 -1
  111. package/plugins/specweave/commands/brownfield-analyzer.md +0 -408
  112. package/plugins/specweave/commands/brownfield-onboarder.md +0 -837
  113. package/plugins/specweave/commands/export-skills.md +0 -179
@@ -1,837 +0,0 @@
1
- ---
2
- description: Intelligently onboards brownfield projects by merging existing CLAUDE.md backups into SpecWeave structure. Use when installing SpecWeave into existing projects with CLAUDE.md, merging documentation, or importing project knowledge. Distributes content to appropriate folders without bloating main CLAUDE.md.
3
- disable-model-invocation: true
4
- ---
5
-
6
- # Brownfield Onboarder - Intelligent CLAUDE.md Merger
7
-
8
- **Purpose**: Intelligently merge existing CLAUDE.md backups into SpecWeave's structure without bloating the main CLAUDE.md file.
9
-
10
- **When to Use**: After installing SpecWeave into an existing project that had CLAUDE.md
11
-
12
- **Philosophy**: Keep CLAUDE.md as a concise guide, distribute detailed content to appropriate SpecWeave folders.
13
-
14
- **Modes**: Supports both Quick Start (incremental) and Comprehensive (upfront) approaches 🆕
15
-
16
- ---
17
-
18
- ## Two-Mode Support 🆕
19
-
20
- The brownfield-onboarder works differently based on the chosen documentation path:
21
-
22
- ### Quick Start Mode (Incremental)
23
- **Philosophy**: Merge only essential context, defer detailed docs to per-increment
24
-
25
- **What to merge immediately**:
26
- - ✅ Core architecture overview (high-level)
27
- - ✅ Tech stack and infrastructure
28
- - ✅ Critical patterns (auth, payment, security)
29
- - ✅ Team conventions and workflows
30
- - ✅ Project summary and domain context
31
-
32
- **What to defer** (document per increment):
33
- - ⏸️ Detailed business rules (extract when modifying that code)
34
- - ⏸️ Module-specific documentation (extract when working on that module)
35
- - ⏸️ API-level documentation (extract when touching those APIs)
36
- - ⏸️ Code examples (extract as needed)
37
-
38
- **Result**: Minimal upfront merge (30-60 minutes), detailed docs grow incrementally
39
-
40
- ### Comprehensive Mode (Upfront)
41
- **Philosophy**: Merge everything upfront for complete context
42
-
43
- **What to merge**:
44
- - ✅ All architecture documentation
45
- - ✅ All business rules
46
- - ✅ All module-specific docs
47
- - ✅ All API documentation
48
- - ✅ All conventions and patterns
49
- - ✅ All code examples
50
-
51
- **Result**: Complete merge (1-3 hours), full context available immediately
52
-
53
- ### Mode Selection
54
-
55
- **Auto-detection**:
56
- ```typescript
57
- // Settings auto-detected
58
- const mode = config.brownfield?.mode || 'auto';
59
-
60
- if (mode === 'auto') {
61
- // Use complexity from brownfield-analyzer
62
- const complexity = await readComplexityAssessment();
63
- mode = complexity.recommendedPath === 'Quick Start' ? 'incremental' : 'comprehensive';
64
- }
65
- ```
66
-
67
- **User can override**:
68
- ```bash
69
- # Force Quick Start mode
70
- brownfield-onboarder --mode quick-start
71
-
72
- # Force Comprehensive mode
73
- brownfield-onboarder --mode comprehensive
74
- ```
75
-
76
- ---
77
-
78
- ## The Problem
79
-
80
- When installing SpecWeave into an existing project:
81
- 1. Project already has `CLAUDE.md` with valuable project-specific context
82
- 2. SpecWeave installs its own `CLAUDE.md` as the development guide
83
- 3. Old `CLAUDE.md` is backed up to `.claude/backups/CLAUDE-backup-{timestamp}.md`
84
- 4. Need to intelligently merge project-specific content WITHOUT bloating SpecWeave's CLAUDE.md
85
-
86
- ---
87
-
88
- ## The Solution: Smart Distribution
89
-
90
- **Instead of bloating CLAUDE.md**, distribute content to appropriate folders:
91
-
92
- ```
93
- Project-specific content → SpecWeave folders:
94
-
95
- # Internal Documentation (strategic, team-only)
96
- Architecture details → .specweave/docs/internal/architecture/existing-system.md
97
- Technology stack → .specweave/docs/internal/architecture/tech-stack.md
98
- Business rules → .specweave/docs/internal/strategy/business-rules.md
99
- Team workflows → .specweave/docs/internal/processes/team-workflows.md
100
- Deployment process → .specweave/docs/internal/processes/deployment.md
101
- Domain knowledge → .specweave/increments/{####-name}/docs/domain/{domain}.md
102
-
103
- # Public Documentation (user-facing, can be published)
104
- Project conventions → .specweave/docs/public/guides/project-conventions.md
105
- API conventions → .specweave/docs/public/guides/api-conventions.md
106
- Code style → .specweave/docs/public/guides/code-style.md
107
- ```
108
-
109
- **Only add to CLAUDE.md**: High-level project summary (1-2 paragraphs max)
110
-
111
- ---
112
-
113
- ## Activation
114
-
115
- **Trigger**: User runs `specweave merge-docs` or asks "merge my old CLAUDE.md"
116
-
117
- **Auto-detection**:
118
- 1. Check if `.claude/backups/CLAUDE-backup-*.md` exists
119
- 2. If multiple backups, use most recent
120
- 3. If no backups, inform user and exit gracefully
121
-
122
- ---
123
-
124
- ## Analysis Process
125
-
126
- ### Step 1: Parse Backup CLAUDE.md
127
-
128
- **Extract sections**:
129
- ```typescript
130
- interface ParsedCLAUDEmd {
131
- projectName: string;
132
- projectDescription: string;
133
- techStack: TechStack;
134
- architecture: ArchitectureSection[];
135
- conventions: Convention[];
136
- workflows: Workflow[];
137
- domainKnowledge: DomainSection[];
138
- teamGuidelines: TeamGuideline[];
139
- deploymentProcess: DeploymentSection[];
140
- apiDesign: APISection[];
141
- businessRules: BusinessRule[];
142
- codeExamples: CodeExample[];
143
- customInstructions: Instruction[];
144
- }
145
- ```
146
-
147
- **Section Detection Keywords**:
148
- - **Tech Stack**: "technology", "framework", "database", "infrastructure", "stack", "tools"
149
- - **Architecture**: "architecture", "system design", "components", "services", "microservices"
150
- - **Conventions**: "naming convention", "code style", "pattern", "standard", "guideline"
151
- - **Workflows**: "workflow", "process", "pipeline", "deployment flow", "release process"
152
- - **Domain**: Domain-specific terms (e.g., "patient", "booking", "payment", "order")
153
- - **Business Rules**: "business rule", "validation", "policy", "constraint", "requirement"
154
- - **API Design**: "API", "endpoint", "REST", "GraphQL", "authentication", "authorization"
155
- - **Deployment**: "deploy", "CI/CD", "environment", "production", "staging"
156
-
157
- ### Step 2: Classify Content (Mode-Aware) 🆕
158
-
159
- **For each section, determine**:
160
-
161
- 1. **Generic or Project-Specific?**
162
- - Generic: Common programming advice, general best practices
163
- - Project-specific: Domain knowledge, team conventions, project architecture
164
-
165
- 2. **Overlap with SpecWeave CLAUDE.md?**
166
- - Compare section with SpecWeave's CLAUDE.md
167
- - If >80% similar, skip (already covered)
168
- - If <80% similar, extract unique content
169
-
170
- 3. **Essential or Detailed?** 🆕
171
- - Essential: Core architecture, critical patterns, tech stack, team workflows
172
- - Detailed: Module-specific rules, detailed APIs, code examples
173
-
174
- 4. **Mode-Based Decision** 🆕
175
- - **Quick Start Mode**: Merge essential only, defer detailed
176
- - **Comprehensive Mode**: Merge everything
177
-
178
- 5. **Target Destination**
179
- - Determine best SpecWeave folder for this content
180
- - See "Content Distribution Rules" below
181
-
182
- **Classification Matrix** 🆕:
183
-
184
- | Content Type | Essential? | Quick Start Action | Comprehensive Action |
185
- |--------------|-----------|-------------------|---------------------|
186
- | Core Architecture | ✅ Yes | Merge immediately | Merge immediately |
187
- | Tech Stack | ✅ Yes | Merge immediately | Merge immediately |
188
- | Critical Patterns (auth, payment) | ✅ Yes | Merge immediately | Merge immediately |
189
- | Team Conventions | ✅ Yes | Merge immediately | Merge immediately |
190
- | Project Summary | ✅ Yes | Merge immediately | Merge immediately |
191
- | Detailed Business Rules | ❌ No | **Defer to increment** | Merge immediately |
192
- | Module Documentation | ❌ No | **Defer to increment** | Merge immediately |
193
- | API-Level Docs | ❌ No | **Defer to increment** | Merge immediately |
194
- | Code Examples | ❌ No | **Defer to increment** | Merge immediately |
195
-
196
- **Example (Quick Start)**:
197
- ```
198
- Analyzing CLAUDE.md backup (Quick Start mode)...
199
-
200
- Found sections:
201
- ✅ Core Architecture (merge now)
202
- ✅ Tech Stack (merge now)
203
- ✅ Auth Pattern (merge now - critical)
204
- ⏸️ Payment Business Rules (defer - extract when working on payments)
205
- ⏸️ User Module API (defer - extract when modifying user code)
206
- ⏸️ Code Examples (defer - extract as needed)
207
-
208
- Merging 3 sections immediately, deferring 3 for incremental extraction.
209
- ```
210
-
211
- ### Step 3: Content Distribution Rules
212
-
213
- #### Rule 1: Domain Knowledge → Specifications
214
-
215
- **Indicators**: Business concepts, entities, domain terminology
216
-
217
- **Example**:
218
- ```markdown
219
- # Old CLAUDE.md
220
- ## Domain Model
221
-
222
- Our platform manages **patient appointments** with **healthcare providers**.
223
- Key entities:
224
- - Patient (demographics, insurance, medical history)
225
- - Provider (specialties, availability, credentials)
226
- - Appointment (time slot, status, notes)
227
- - Clinic (location, services, staff)
228
-
229
- Business rules:
230
- - Appointments must be 15-60 minutes
231
- - Patients can cancel up to 24 hours before
232
- - Providers can override cancellation policy
233
- ```
234
-
235
- **Destination**: `specifications/modules/appointments/domain-model.md`
236
-
237
- **CLAUDE.md addition**: None (link from CLAUDE.md to specifications)
238
-
239
- ---
240
-
241
- #### Rule 2: Architecture → .specweave/docs/architecture/
242
-
243
- **Indicators**: System design, component descriptions, data flow
244
-
245
- **Example**:
246
- ```markdown
247
- # Old CLAUDE.md
248
- ## System Architecture
249
-
250
- We use a microservices architecture:
251
- - API Gateway (Kong) - routing, authentication
252
- - Booking Service (Node.js) - appointment management
253
- - Notification Service (Python) - email/SMS
254
- - Payment Service (Node.js) - Stripe integration
255
- - Database (PostgreSQL) - shared across services
256
- ```
257
-
258
- **Destination**: `.specweave/docs/internal/architecture/existing-system.md`
259
-
260
- **CLAUDE.md addition**:
261
- ```markdown
262
- ## Project-Specific Architecture
263
-
264
- See [Existing System Architecture](.specweave/docs/internal/architecture/existing-system.md) for complete microservices architecture.
265
- ```
266
-
267
- ---
268
-
269
- #### Rule 3: Conventions → .specweave/docs/guides/
270
-
271
- **Indicators**: Naming conventions, code style, patterns
272
-
273
- **Example**:
274
- ```markdown
275
- # Old CLAUDE.md
276
- ## Naming Conventions
277
-
278
- - API endpoints: `/api/v1/{resource}/{action}` (kebab-case)
279
- - Database tables: `{domain}_{entity}` (snake_case)
280
- - TypeScript interfaces: `I{Name}` prefix (PascalCase)
281
- - React components: `{Name}Component.tsx` suffix
282
- ```
283
-
284
- **Destination**: `.specweave/docs/public/guides/project-conventions.md`
285
-
286
- **CLAUDE.md addition**: None (standard conventions, no need to clutter CLAUDE.md)
287
-
288
- ---
289
-
290
- #### Rule 4: Workflows → .specweave/docs/guides/
291
-
292
- **Indicators**: Deployment process, CI/CD, release workflow
293
-
294
- **Example**:
295
- ```markdown
296
- # Old CLAUDE.md
297
- ## Deployment Process
298
-
299
- 1. Create feature branch from `main`
300
- 2. Implement feature with tests
301
- 3. Create PR (requires 2 approvals)
302
- 4. Merge → auto-deploy to staging
303
- 5. Manual approval → deploy to production
304
- 6. Rollback via GitHub Actions if needed
305
- ```
306
-
307
- **Destination**: `.specweave/docs/internal/processes/deployment.md`
308
-
309
- **CLAUDE.md addition**:
310
- ```markdown
311
- ## Deployment
312
-
313
- See [Deployment Guide](.specweave/docs/internal/processes/deployment.md).
314
- ```
315
-
316
- ---
317
-
318
- #### Rule 5: Business Rules → specifications/modules/
319
-
320
- **Indicators**: Validation rules, policies, constraints
321
-
322
- **Example**:
323
- ```markdown
324
- # Old CLAUDE.md
325
- ## Business Rules
326
-
327
- ### Appointment Booking
328
- - Patients can book up to 3 months in advance
329
- - Maximum 5 active appointments per patient
330
- - Same-day appointments require $50 deposit
331
- - Insurance verification required before booking
332
- ```
333
-
334
- **Destination**: `.specweave/docs/internal/strategy/appointments/business-rules.md`
335
-
336
- **CLAUDE.md addition**: None (specifications are source of truth)
337
-
338
- ---
339
-
340
- #### Rule 6: Tech Stack → .specweave/docs/architecture/
341
-
342
- **Indicators**: Technologies, frameworks, tools
343
-
344
- **Example**:
345
- ```markdown
346
- # Old CLAUDE.md
347
- ## Tech Stack
348
-
349
- - Frontend: Next.js 14, React, Tailwind CSS
350
- - Backend: Node.js 20, Express, TypeScript
351
- - Database: PostgreSQL 16, Prisma ORM
352
- - Cache: Redis
353
- - Queue: BullMQ
354
- - Infrastructure: Hetzner Cloud, Terraform
355
- - Monitoring: Grafana, Prometheus
356
- ```
357
-
358
- **Destination**: `.specweave/docs/internal/architecture/tech-stack.md`
359
-
360
- **CLAUDE.md addition**:
361
- ```markdown
362
- ## Tech Stack
363
-
364
- Next.js 14 + Node.js 20 + PostgreSQL 16 + Hetzner Cloud
365
-
366
- See [Tech Stack Details](.specweave/docs/internal/architecture/tech-stack.md).
367
- ```
368
-
369
- ---
370
-
371
- #### Rule 7: API Design → .specweave/docs/guides/
372
-
373
- **Indicators**: API conventions, authentication, error handling
374
-
375
- **Example**:
376
- ```markdown
377
- # Old CLAUDE.md
378
- ## API Design
379
-
380
- All APIs follow REST conventions:
381
- - Authentication: JWT in Authorization header
382
- - Errors: Standard structure { error, message, details }
383
- - Pagination: page, limit query params
384
- - Filtering: field[operator]=value
385
- - Versioning: /api/v1, /api/v2
386
- ```
387
-
388
- **Destination**: `.specweave/docs/public/guides/api-conventions.md`
389
-
390
- **CLAUDE.md addition**: None (guide covers it)
391
-
392
- ---
393
-
394
- #### Rule 8: Code Examples → Discard or Minimal
395
-
396
- **Indicators**: Code snippets, example implementations
397
-
398
- **Decision**:
399
- - If generic (standard pattern): Discard (SpecWeave CLAUDE.md already has examples)
400
- - If project-specific (custom pattern): Extract to guide
401
-
402
- **Example**:
403
- ```markdown
404
- # Old CLAUDE.md - Generic React pattern
405
- function UserList() {
406
- const [users, setUsers] = useState([]);
407
- // ... standard React code
408
- }
409
- ```
410
-
411
- **Action**: Discard (generic React, not project-specific)
412
-
413
- **Example**:
414
- ```markdown
415
- # Old CLAUDE.md - Custom authentication pattern
416
- // Our custom auth hook (wraps Supabase)
417
- function useCustomAuth() {
418
- const { session } = useSupabase();
419
- const { roles } = useRoleProvider();
420
- return { user: session?.user, hasRole: (role) => roles.includes(role) };
421
- }
422
- ```
423
-
424
- **Action**: Extract to `.specweave/docs/public/guides/authentication.md` (project-specific pattern)
425
-
426
- ---
427
-
428
- ### Step 4: Update CLAUDE.md (Minimal)
429
-
430
- **ONLY add high-level project summary** to SpecWeave's CLAUDE.md:
431
-
432
- ```markdown
433
- ---
434
-
435
- ## Project-Specific Context
436
-
437
- **Project**: Healthcare Appointment Booking Platform
438
- **Domain**: Healthcare, Patient Management, Provider Scheduling
439
-
440
- ### Quick Links
441
- - [Domain Model](.specweave/increments/####-name/docs/domain/appointments/domain-model.md)
442
- - [Existing System Architecture](.specweave/docs/internal/architecture/existing-system.md)
443
- - [Tech Stack](.specweave/docs/internal/architecture/tech-stack.md)
444
- - [Business Rules](.specweave/docs/internal/strategy/appointments/business-rules.md)
445
- - [Deployment Guide](.specweave/docs/internal/processes/deployment.md)
446
- - [Project Conventions](.specweave/docs/public/guides/project-conventions.md)
447
-
448
- **Note**: All project-specific details are in linked documents. This keeps CLAUDE.md concise.
449
-
450
- ---
451
- ```
452
-
453
- **Total addition**: ~15 lines max
454
-
455
- ---
456
-
457
- ## Intelligence Rules
458
-
459
- ### Avoid Bloat
460
-
461
- **Never add to CLAUDE.md**:
462
- - Generic programming advice (SpecWeave CLAUDE.md already has it)
463
- - Detailed code examples (put in guides)
464
- - Long architecture descriptions (put in architecture docs)
465
- - Business rule details (put in specifications)
466
- - API documentation (put in guides)
467
-
468
- **Only add to CLAUDE.md**:
469
- - 1-2 sentence project description
470
- - Domain/industry context
471
- - Links to detailed docs
472
-
473
- ### Avoid Duplicates
474
-
475
- **Before creating files, check if similar content exists**:
476
-
477
- ```typescript
478
- // Check if domain model already exists
479
- if (exists("specifications/modules/appointments/domain-model.md")) {
480
- // Compare content
481
- existingContent = read("specifications/modules/appointments/domain-model.md");
482
- newContent = extractDomainModel(backupCLAUDEmd);
483
-
484
- if (similarity(existingContent, newContent) > 0.8) {
485
- // Skip, already documented
486
- skip();
487
- } else {
488
- // Merge unique content
489
- mergedContent = merge(existingContent, newContent);
490
- write("specifications/modules/appointments/domain-model.md", mergedContent);
491
- }
492
- }
493
- ```
494
-
495
- ### Preserve Accuracy
496
-
497
- **When extracting content**:
498
- - Don't paraphrase technical details
499
- - Preserve exact terminology
500
- - Keep code examples verbatim
501
- - Maintain formatting (tables, lists, code blocks)
502
-
503
- ### User Confirmation
504
-
505
- **Before writing files, show user**:
506
-
507
- ```
508
- I found the following project-specific content in your backup CLAUDE.md:
509
-
510
- 📦 Domain Model (Healthcare Appointments)
511
- → .specweave/increments/####-name/docs/domain/appointments/domain-model.md
512
-
513
- 🏗️ Microservices Architecture
514
- → .specweave/docs/internal/architecture/existing-system.md
515
-
516
- 🛠️ Tech Stack (Next.js + Node.js + PostgreSQL)
517
- → .specweave/docs/internal/architecture/tech-stack.md
518
-
519
- 📋 Business Rules (Booking policies)
520
- → .specweave/docs/internal/strategy/appointments/business-rules.md
521
-
522
- 🔧 Project Conventions (Naming, code style)
523
- → .specweave/docs/public/guides/project-conventions.md
524
-
525
- 🚀 Deployment Process (CI/CD workflow)
526
- → .specweave/docs/internal/processes/deployment.md
527
-
528
- 📝 CLAUDE.md Update
529
- → Add 12-line project summary with links
530
-
531
- Total files to create: 6
532
- Total lines added to CLAUDE.md: 12
533
-
534
- Proceed with merge? (y/n)
535
- ```
536
-
537
- ---
538
-
539
- ## Output: Merge Report
540
-
541
- **After merge, generate mode-specific report**:
542
-
543
- ### Quick Start Mode Report 🆕
544
-
545
- ```markdown
546
- # CLAUDE.md Merge Report - Quick Start Mode
547
-
548
- **Date**: 2025-10-26
549
- **Backup File**: .claude/backups/CLAUDE-backup-20251026-143022.md
550
- **Merge Status**: ✅ Complete (Essential content only)
551
- **Mode**: Quick Start (Incremental Documentation)
552
-
553
- ---
554
-
555
- ## Files Created (Essential Only)
556
-
557
- 1. ✅ `.specweave/docs/internal/architecture/core-architecture.md` (120 lines)
558
- 2. ✅ `.specweave/docs/internal/architecture/tech-stack.md` (80 lines)
559
- 3. ✅ `.specweave/docs/internal/architecture/critical-patterns.md` (100 lines)
560
- 4. ✅ `.specweave/docs/public/guides/project-conventions.md` (90 lines)
561
- 5. ✅ `.specweave/docs/internal/processes/deployment.md` (70 lines)
562
-
563
- **Total**: 5 files, 460 lines (essential content)
564
-
565
- ---
566
-
567
- ## CLAUDE.md Updated
568
-
569
- **Added**: 10 lines (project summary + links)
570
-
571
- **Location**: Lines 850-860
572
-
573
- ---
574
-
575
- ## Content Distribution (Quick Start)
576
-
577
- | Content Type | Lines | Status | Destination |
578
- |--------------|-------|--------|-------------|
579
- | Core Architecture | 120 | ✅ Merged | .specweave/docs/internal/architecture/ |
580
- | Tech Stack | 80 | ✅ Merged | .specweave/docs/internal/architecture/ |
581
- | Critical Patterns | 100 | ✅ Merged | .specweave/docs/internal/architecture/ |
582
- | Conventions | 90 | ✅ Merged | .specweave/docs/public/guides/ |
583
- | Deployment | 70 | ✅ Merged | .specweave/docs/internal/processes/ |
584
- | **CLAUDE.md** | **10** | ✅ **Updated** | **Root** |
585
- | **Subtotal Merged** | **470** | | |
586
- | | | | |
587
- | Domain Model (detailed) | 450 | ⏸️ Deferred | Extract when working on appointments |
588
- | Business Rules (detailed) | 280 | ⏸️ Deferred | Extract when working on payments |
589
- | User Module API | 150 | ⏸️ Deferred | Extract when modifying user code |
590
- | Code Examples | 200 | ⏸️ Deferred | Extract as needed per increment |
591
- | **Subtotal Deferred** | **1,080** | | **Document incrementally** |
592
-
593
- **Result**: 470 lines merged now, 1,080 lines to extract per increment
594
-
595
- **Benefit**: Start in 30-60 minutes, not 1-3 hours
596
-
597
- ---
598
-
599
- ## Deferred Content (Extract Per Increment)
600
-
601
- The following content remains in the backup and will be extracted when you work on related features:
602
-
603
- ### 📦 Domain Documentation
604
- - `appointments/domain-model.md` (450 lines)
605
- → Extract when creating increment for appointments feature
606
-
607
- ### 📋 Business Rules
608
- - `payments/business-rules.md` (280 lines)
609
- → Extract when creating increment for payment modifications
610
-
611
- ### 🔌 API Documentation
612
- - `users/api-endpoints.md` (150 lines)
613
- → Extract when creating increment for user service changes
614
-
615
- ### 💻 Code Examples
616
- - Various code snippets (200 lines)
617
- → Extract as needed
618
-
619
- **How to extract later**:
620
- ```bash
621
- # When starting increment for appointments
622
- /inc "Refactor appointment booking"
623
-
624
- # In spec.md, reference:
625
- # "See backup: .claude/backups/CLAUDE-backup-*.md (appointments section)"
626
-
627
- # Or ask:
628
- # "Extract appointment documentation from CLAUDE.md backup"
629
- ```
630
-
631
- ---
632
-
633
- ## Skipped Content
634
-
635
- - Generic React patterns (25 lines) - Already covered in SpecWeave
636
- - Standard git workflow (15 lines) - Common knowledge
637
- - TypeScript basics (40 lines) - Not project-specific
638
-
639
- **Total skipped**: 80 lines (generic content)
640
-
641
- ---
642
-
643
- ## Next Steps
644
-
645
- 1. ✅ Review merged essential docs (30 min)
646
- 2. ✅ Start first increment (immediate)
647
- 3. ⏸️ Extract detailed docs as you work on features
648
-
649
- **Time saved**: ~2 hours (vs comprehensive upfront)
650
-
651
- ---
652
- ```
653
-
654
- ### Comprehensive Mode Report
655
-
656
- ```markdown
657
- # CLAUDE.md Merge Report - Comprehensive Mode
658
-
659
- **Date**: 2025-10-26
660
- **Backup File**: .claude/backups/CLAUDE-backup-20251026-143022.md
661
- **Merge Status**: ✅ Complete (All content)
662
- **Mode**: Comprehensive (Upfront Documentation)
663
-
664
- ---
665
-
666
- ## Files Created
667
-
668
- 1. ✅ `.specweave/increments/####-name/docs/domain/appointments/domain-model.md` (450 lines)
669
- 2. ✅ `.specweave/docs/internal/architecture/existing-system.md` (320 lines)
670
- 3. ✅ `.specweave/docs/internal/architecture/tech-stack.md` (180 lines)
671
- 4. ✅ `.specweave/docs/internal/strategy/appointments/business-rules.md` (280 lines)
672
- 5. ✅ `.specweave/docs/public/guides/project-conventions.md` (200 lines)
673
- 6. ✅ `.specweave/docs/internal/processes/deployment.md` (150 lines)
674
-
675
- **Total**: 6 files, 1,580 lines
676
-
677
- ---
678
-
679
- ## CLAUDE.md Updated
680
-
681
- **Added**: 12 lines (project summary + links)
682
-
683
- **Location**: Lines 850-862 (after "Living Documentation Principles")
684
-
685
- ---
686
-
687
- ## Content Distribution
688
-
689
- | Content Type | Lines | Destination |
690
- |--------------|-------|-------------|
691
- | Domain Model | 450 | .specweave/increments/####-name/docs/domain/ |
692
- | Architecture | 320 | .specweave/docs/internal/architecture/ |
693
- | Tech Stack | 180 | .specweave/docs/internal/architecture/ |
694
- | Business Rules | 280 | .specweave/docs/internal/strategy/ |
695
- | Conventions | 200 | .specweave/docs/public/guides/ |
696
- | Deployment | 150 | .specweave/docs/internal/processes/ |
697
- | **CLAUDE.md** | **12** | **Root** |
698
-
699
- **Result**: 99.2% of content distributed to appropriate folders, not bloating CLAUDE.md
700
-
701
- ---
702
-
703
- ## Skipped Content
704
-
705
- - Generic React patterns (25 lines) - Already covered in SpecWeave
706
- - Standard git workflow (15 lines) - Common knowledge
707
- - TypeScript basics (40 lines) - Not project-specific
708
-
709
- **Total skipped**: 80 lines (generic content)
710
-
711
- ---
712
-
713
- ## Next Steps
714
-
715
- 1. ✅ Review generated files in `.specweave/docs/internal/` and `.specweave/docs/public/`
716
- 2. ✅ SpecWeave uses auto-detection
717
- 3. ✅ Run `npm run docs:dev` to preview documentation
718
- 4. ✅ Create features from specifications: `specweave plan-feature {name}`
719
-
720
- ---
721
-
722
- ## Backup Preserved
723
-
724
- Original backup remains at:
725
- `.claude/backups/CLAUDE-backup-20251026-143022.md`
726
-
727
- You can reference it anytime.
728
-
729
- ---
730
-
731
- **Merge Complete! 🎉**
732
-
733
- Your project-specific knowledge is now integrated into SpecWeave's structure.
734
- ```
735
-
736
- ---
737
-
738
- ## Example Usage
739
-
740
- ### User Request
741
-
742
- ```
743
- User: "I installed SpecWeave and it backed up my CLAUDE.md. Can you merge the important parts?"
744
- ```
745
-
746
- ### Your Response
747
-
748
- ```
749
- I'll analyze your backup CLAUDE.md and intelligently merge project-specific content.
750
-
751
- 🔍 Analyzing: .claude/backups/CLAUDE-backup-20251026-143022.md
752
-
753
- Found:
754
- - Project: Healthcare Appointment Booking Platform
755
- - Domain model: Patients, Providers, Appointments, Clinics
756
- - Architecture: Microservices (4 services)
757
- - Tech stack: Next.js + Node.js + PostgreSQL
758
- - Business rules: Booking policies, cancellation rules
759
- - Conventions: Naming, API design
760
- - Deployment: CI/CD workflow
761
-
762
- 📦 Content Distribution Plan:
763
-
764
- 1. Domain Model → specifications/modules/appointments/domain-model.md
765
- 2. Architecture → .specweave/docs/architecture/existing-system.md
766
- 3. Tech Stack → .specweave/docs/architecture/tech-stack.md
767
- 4. Business Rules → specifications/modules/appointments/business-rules.md
768
- 5. Conventions → .specweave/docs/guides/project-conventions.md
769
- 6. Deployment → .specweave/docs/guides/deployment.md
770
-
771
- CLAUDE.md: Add 12-line summary with links (no bloat!)
772
-
773
- Total: 6 files, ~1,580 lines
774
- CLAUDE.md additions: 12 lines (99.2% distributed to folders)
775
-
776
- Proceed with merge? (y/n)
777
- ```
778
-
779
- ### After User Approval
780
-
781
- ```
782
- ✅ Merge complete!
783
-
784
- Created:
785
- 1. .specweave/increments/####-name/docs/domain/appointments/domain-model.md
786
- 2. .specweave/docs/internal/architecture/existing-system.md
787
- 3. .specweave/docs/internal/architecture/tech-stack.md
788
- 4. .specweave/docs/internal/strategy/appointments/business-rules.md
789
- 5. .specweave/docs/public/guides/project-conventions.md
790
- 6. .specweave/docs/internal/processes/deployment.md
791
-
792
- Updated:
793
- - CLAUDE.md (added 12-line project summary)
794
-
795
- Report saved: ai-logs/reports/CLAUDE-MERGE-REPORT-20251026.md
796
-
797
- Your project knowledge is now integrated! 🎉
798
-
799
- Next: Review files and run `npm run docs:dev` to preview.
800
- ```
801
-
802
- ---
803
-
804
- ## Tool Usage
805
-
806
- **Scan for backups**:
807
- ```typescript
808
- const backups = glob(".claude/backups/CLAUDE-backup-*.md");
809
- const latestBackup = backups.sort().reverse()[0]; // Most recent
810
- ```
811
-
812
- **Parse content**:
813
- ```typescript
814
- const content = read(latestBackup);
815
- const sections = parseSections(content); // Split by headers
816
- const classified = classifyContent(sections); // Domain, Architecture, etc.
817
- ```
818
-
819
- **Avoid duplicates**:
820
- ```typescript
821
- if (exists(targetPath)) {
822
- const existing = read(targetPath);
823
- if (similarity(existing, newContent) > 0.8) {
824
- skip(); // Already documented
825
- }
826
- }
827
- ```
828
-
829
- ---
830
-
831
- ## Related Documentation
832
-
833
- - [BROWNFIELD-INTEGRATION-STRATEGY.md](../../docs/internal/delivery/BROWNFIELD-INTEGRATION-STRATEGY.md)
834
- - [brownfield-analyzer skill](../brownfield-analyzer/SKILL.md)
835
- - [CLAUDE.md](../../CLAUDE.md)
836
-
837
-