@donotdev/cli 0.0.20 → 0.0.21

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 (103) hide show
  1. package/README.md +31 -0
  2. package/dependencies-matrix.json +86 -19
  3. package/dist/bin/commands/agent-setup.js +2 -2
  4. package/dist/bin/commands/build.js +6 -6
  5. package/dist/bin/commands/bump.js +491 -69
  6. package/dist/bin/commands/cacheout.js +6 -6
  7. package/dist/bin/commands/coach.js +6 -6
  8. package/dist/bin/commands/create-app.js +23 -15
  9. package/dist/bin/commands/create-project.js +101 -16
  10. package/dist/bin/commands/db.js +142136 -0
  11. package/dist/bin/commands/deploy.js +336 -126
  12. package/dist/bin/commands/dev.js +6 -6
  13. package/dist/bin/commands/doctor.js +140 -33
  14. package/dist/bin/commands/emu.js +6 -6
  15. package/dist/bin/commands/format.js +6 -6
  16. package/dist/bin/commands/get-demo.js +11 -6
  17. package/dist/bin/commands/make-admin.js +14210 -13770
  18. package/dist/bin/commands/preview.js +6 -6
  19. package/dist/bin/commands/seed.js +142426 -0
  20. package/dist/bin/commands/setup-cicd.js +8904 -0
  21. package/dist/bin/commands/setup.js +256 -212
  22. package/dist/bin/commands/staging.js +343 -127
  23. package/dist/bin/commands/sync-secrets.js +55 -33
  24. package/dist/bin/commands/type-check.js +6 -6
  25. package/dist/bin/commands/wai.js +6 -6
  26. package/dist/bin/dndev.js +76 -11
  27. package/dist/bin/donotdev.js +21 -12
  28. package/dist/index.js +437 -142
  29. package/package.json +1 -1
  30. package/templates/app-demo/.env.example +1 -0
  31. package/templates/{root-consumer → app-demo}/entities/ExampleEntity.ts.example +15 -9
  32. package/templates/app-demo/index.html.example +1 -1
  33. package/templates/app-dndev/index.html.example +164 -0
  34. package/templates/app-dndev/public/logo.svg.example +1 -0
  35. package/templates/app-dndev/public/manifest.json.example +10 -0
  36. package/templates/app-dndev/src/App.tsx.example +35 -0
  37. package/templates/app-dndev/src/components/CockpitLayout.css.example +181 -0
  38. package/templates/app-dndev/src/components/CockpitLayout.tsx.example +209 -0
  39. package/templates/app-dndev/src/components/Kanban.css.example +385 -0
  40. package/templates/app-dndev/src/components/ModeToggle.tsx.example +32 -0
  41. package/templates/app-dndev/src/components/OverlaySlot.tsx.example +68 -0
  42. package/templates/app-dndev/src/components/TerminalPanel.css.example +228 -0
  43. package/templates/app-dndev/src/components/TerminalPanel.tsx.example +714 -0
  44. package/templates/app-dndev/src/components/markdown-prose.css.example +49 -0
  45. package/templates/app-dndev/src/components/phases/CaptainLog.tsx.example +107 -0
  46. package/templates/app-dndev/src/components/phases/ContextTabs.tsx.example +352 -0
  47. package/templates/app-dndev/src/components/phases/PhaseCard.tsx.example +126 -0
  48. package/templates/app-dndev/src/components/phases/PhaseDetail.tsx.example +147 -0
  49. package/templates/app-dndev/src/components/phases/ReviewPanel.tsx.example +115 -0
  50. package/templates/app-dndev/src/components/phases/phaseData.ts.example +366 -0
  51. package/templates/app-dndev/src/config/app.ts.example +103 -0
  52. package/templates/app-dndev/src/config/commands.ts.example +171 -0
  53. package/templates/app-dndev/src/config/legal.ts.example +170 -0
  54. package/templates/app-dndev/src/config/providers.ts.example +7 -0
  55. package/templates/app-dndev/src/globals.css.example +10 -0
  56. package/templates/app-dndev/src/hooks/useDndevFile.ts.example +144 -0
  57. package/templates/app-dndev/src/main.tsx.example +21 -0
  58. package/templates/app-dndev/src/pages/BoardPage.tsx.example +640 -0
  59. package/templates/app-dndev/src/pages/GrillPage.tsx.example +658 -0
  60. package/templates/app-dndev/src/pages/HomePage.tsx.example +347 -0
  61. package/templates/app-dndev/src/pages/NotFoundPage.tsx.example +33 -0
  62. package/templates/app-dndev/src/pages/PhasesPage.tsx.example +137 -0
  63. package/templates/app-dndev/src/pages/SettingsPage.tsx.example +64 -0
  64. package/templates/app-dndev/src/pages/legal/LegalNoticePage.tsx.example +75 -0
  65. package/templates/app-dndev/src/pages/legal/PrivacyPage.tsx.example +69 -0
  66. package/templates/app-dndev/src/pages/legal/TermsPage.tsx.example +71 -0
  67. package/templates/app-dndev/src/stores/dndevStore.ts.example +386 -0
  68. package/templates/app-dndev/src/themes.css.example +161 -0
  69. package/templates/app-dndev/terminal-sidecar.cjs.example +341 -0
  70. package/templates/app-dndev/tsconfig.json.example +9 -0
  71. package/templates/app-dndev/vite.config.ts.example +24 -0
  72. package/templates/app-next/src/locales/home_en.json.example +6 -6
  73. package/templates/app-vite/index.html.example +1 -1
  74. package/templates/app-vite/src/locales/home_en.json.example +6 -6
  75. package/templates/functions-supabase/supabase/functions/.env.example +0 -2
  76. package/templates/root-consumer/.claude/commands/grill.md.example +86 -8
  77. package/templates/root-consumer/.dndev.secrets.example +32 -0
  78. package/templates/root-consumer/.gitignore.example +3 -0
  79. package/templates/root-consumer/AI.md.example +4 -0
  80. package/templates/root-consumer/entities/index.ts.example +2 -5
  81. package/templates/root-consumer/guides/dndev/COMPONENTS_ATOMIC.md.example +4 -0
  82. package/templates/root-consumer/guides/dndev/ENV_SETUP.md.example +23 -20
  83. package/templates/root-consumer/guides/dndev/INDEX.md.example +1 -0
  84. package/templates/root-consumer/guides/dndev/SETUP_BILLING.md.example +3 -7
  85. package/templates/root-consumer/guides/dndev/SETUP_CICD.md.example +115 -0
  86. package/templates/root-consumer/guides/dndev/SETUP_CRUD.md.example +41 -0
  87. package/templates/root-consumer/guides/dndev/SETUP_SUPABASE.md.example +13 -18
  88. package/templates/root-consumer/guides/dndev/SETUP_VERCEL.md.example +17 -12
  89. package/templates/root-consumer/guides/dndev/advanced/COOKIE_REFERENCE.md.example +252 -252
  90. package/templates/root-consumer/guides/dndev/advanced/VERSION_CONTROL.md.example +174 -174
  91. package/templates/root-consumer/guides/wai-way/WAI_WAY_CLI.md.example +185 -251
  92. package/templates/root-consumer/guides/wai-way/agents/extractor.md.example +26 -8
  93. package/templates/root-consumer/guides/wai-way/blueprints/0_brainstorm.md.example +66 -49
  94. package/templates/root-consumer/guides/wai-way/blueprints/1_scaffold.md.example +6 -5
  95. package/templates/root-consumer/guides/wai-way/blueprints/2_entities.md.example +9 -9
  96. package/templates/root-consumer/guides/wai-way/blueprints/3_compose.md.example +1 -1
  97. package/templates/root-consumer/guides/wai-way/blueprints/4_configure.md.example +7 -6
  98. package/templates/root-consumer/guides/wai-way/context_map.json.example +51 -20
  99. package/templates/root-consumer/guides/wai-way/hld_template.md.example +138 -0
  100. package/templates/root-consumer/guides/wai-way/lld_template.md.example +103 -0
  101. package/templates/root-consumer/guides/wai-way/prd_template.md.example +140 -0
  102. /package/templates/{root-consumer → app-demo}/entities/Contact.ts.example +0 -0
  103. /package/templates/{root-consumer → app-demo}/entities/demo.ts.example +0 -0
@@ -11,7 +11,7 @@ agent:
11
11
  title: Requirements Extractor
12
12
  icon: 🧠
13
13
  phases: ["0_brainstorm_spec", "1_scaffold_sitemap"]
14
- done_when: "Spec COMPLETELY filled with user journeys, entities, rules, permissions - validated by user"
14
+ done_when: "PRD.md + HLD.md + LLD.md produced from spec_template.md conversation - validated by user"
15
15
 
16
16
  persona:
17
17
  role: Product Strategist & Requirements Engineer
@@ -42,7 +42,7 @@ core_principles:
42
42
  - **Spec Drift:** Any changes to the validated spec must be logged in `spec_changes.md` for human review.
43
43
 
44
44
  phase_0_brainstorm:
45
- goal: DEEPLY understand the app and produce COMPLETE validated spec
45
+ goal: DEEPLY understand the app and produce PRD.md + HLD.md + LLD.md
46
46
  mindset: "If I can't answer any question about this app, I haven't asked enough questions yet."
47
47
 
48
48
  question_flow:
@@ -122,11 +122,16 @@ phase_0_brainstorm:
122
122
  - "Which features are 'Delighters' (Marketing/Heroes) vs 'Must-Haves' (CRUD)?"
123
123
  done_when: "Navigation hierarchy planned; high-friction paths challenged"
124
124
 
125
- output: Filled spec_template.md with ALL sections complete, including Section 11 for overrides.
125
+ output: |
126
+ Three documents produced in docs/:
127
+ - docs/PRD.md — requirements, journeys, rules, permissions, overrides (Section 11)
128
+ - docs/HLD.md — architecture, preset, auth, pages, features
129
+ - docs/LLD.md — per-entity field specs, state machines, access matrices
130
+ Then: init_implementation({ from_spec: true }) → .dndev/implementation.md
126
131
 
127
132
  phase_1_scaffold:
128
- goal: Create an Interactive Prototype from the validated spec
129
- prerequisite: "spec_template.md is COMPLETE with no empty sections or TBDs"
133
+ goal: Create an Interactive Prototype from the validated documents
134
+ prerequisite: "docs/PRD.md, docs/HLD.md, docs/LLD.md are COMPLETE no TBDs"
130
135
  steps:
131
136
  - Verify spec is truly complete
132
137
  - Create *Page.tsx files for each route in spec
@@ -160,6 +165,9 @@ validation_checklist:
160
165
  read_files:
161
166
  - "guides/wai-way/blueprints/0_brainstorm.md"
162
167
  - "guides/wai-way/spec_template.md"
168
+ - "guides/wai-way/prd_template.md"
169
+ - "guides/wai-way/hld_template.md"
170
+ - "guides/wai-way/lld_template.md"
163
171
  - "guides/wai-way/presets_guide.md"
164
172
  - "guides/wai-way/entity_patterns.md"
165
173
  - "guides/wai-way/page_patterns.md"
@@ -185,12 +193,15 @@ Activate AGENT Extractor.
185
193
 
186
194
  READ these files FIRST:
187
195
  - guides/wai-way/blueprints/0_brainstorm.md (DEEP requirements process)
188
- - guides/wai-way/spec_template.md (template to fill COMPLETELY)
196
+ - guides/wai-way/spec_template.md (conversation FORMAT — the shell you fill through questions)
197
+ - guides/wai-way/prd_template.md (OUTPUT format for Product Requirements)
198
+ - guides/wai-way/hld_template.md (OUTPUT format for High-Level Design)
199
+ - guides/wai-way/lld_template.md (OUTPUT format for Low-Level Design)
189
200
  - guides/wai-way/presets_guide.md (preset = config change)
190
201
  - guides/wai-way/entity_patterns.md (common entity schemas)
191
202
  - guides/wai-way/page_patterns.md (common page structures)
192
203
 
193
- Your goal: DEEPLY understand the app before any code.
204
+ Your goal: DEEPLY understand the app, then produce docs/PRD.md + docs/HLD.md + docs/LLD.md.
194
205
 
195
206
  DO NOT RUSH. The #1 cause of wasted work is incomplete requirements.
196
207
 
@@ -211,7 +222,12 @@ KEEP ASKING until you can:
211
222
  - Define every entity with states and permissions
212
223
  - Answer "what happens when X?" for any scenario
213
224
 
214
- Only THEN fill spec_template.md and present for validation.
225
+ Only THEN present summary for validation, and SPLIT into:
226
+ - docs/PRD.md (requirements, journeys, rules, permissions)
227
+ - docs/HLD.md (architecture, preset, auth, pages, features)
228
+ - docs/LLD.md (per-entity field specs, state machines, access matrices)
229
+
230
+ Then call init_implementation({ from_spec: true }) to create the macro plan.
215
231
  ```
216
232
 
217
233
  ## EXAMPLE CONVERSATION FLOW (THOROUGH)
@@ -343,3 +359,5 @@ You've done Phase 0 correctly when:
343
359
  - [ ] Every entity has CRUD permissions for every role
344
360
  - [ ] Every business rule is documented
345
361
  - [ ] User has said "yes, that's complete"
362
+ - [ ] docs/PRD.md, docs/HLD.md, docs/LLD.md written and validated
363
+ - [ ] .dndev/implementation.md created via init_implementation({ from_spec: true })
@@ -1,9 +1,9 @@
1
- # BLUEPRINT: 0_BRAINSTORM → SPEC
1
+ # BLUEPRINT: 0_BRAINSTORM → PRD + HLD + LLD
2
2
 
3
- **Goal:** Deeply understand the app and document ALL requirements before any code.
3
+ **Goal:** Deeply understand the app and produce THREE validated specification documents.
4
4
 
5
5
  **MCP:** `start_phase(0)` to begin. `complete_phase()` when done.
6
- **Done when:** `docs/HLD.md` is COMPLETE (using `guides/wai-way/spec_template.md` as template) and user has validated it.
6
+ **Done when:** `docs/PRD.md`, `docs/HLD.md`, `docs/LLD.md` are COMPLETE and user has validated them.
7
7
 
8
8
  ---
9
9
 
@@ -19,7 +19,7 @@ It returns a one-line summary from each framework package README (core, ui, temp
19
19
 
20
20
  **The #1 cause of wasted work is incomplete requirements.**
21
21
 
22
- Before moving to Phase 1, you MUST have:
22
+ Before producing documents, you MUST have:
23
23
  - [ ] Complete understanding of what users DO (not just what data exists)
24
24
  - [ ] All user journeys mapped step-by-step
25
25
  - [ ] Business rules and validations documented
@@ -37,7 +37,8 @@ User provides idea
37
37
 
38
38
  Agent calls list_features() → matches needs to existing framework capabilities
39
39
 
40
- Agent asks IDENTITY questions (who, what, why, and **Aesthetic Essence**)
40
+ Agent asks IDENTITY questions (who, what, why, and **Aesthetic Essence**)
41
+
41
42
  Agent asks USER JOURNEY questions (what do users DO step by step?)
42
43
 
43
44
  Agent asks DATA questions (what entities, relationships, states?)
@@ -46,11 +47,13 @@ Agent asks BUSINESS RULES questions (validations, permissions, constraints)
46
47
 
47
48
  Agent asks EDGE CASE questions (what if X fails? what about Y?)
48
49
 
49
- Agent fills spec template
50
+ Agent fills spec_template.md FORMAT through conversation
51
+
52
+ Agent presents summary for user validation
50
53
 
51
- Agent presents spec for validation
54
+ User confirms → Agent SPLITS into PRD.md + HLD.md + LLD.md
52
55
 
53
- User confirms OR agent asks more questions
56
+ Agent calls init_implementation({ from_spec: true }) → creates implementation.md
54
57
  ```
55
58
 
56
59
  ---
@@ -144,7 +147,7 @@ Ask about validations and constraints:
144
147
  ```
145
148
  ## Business Rules: Orders
146
149
 
147
- - Order total = sum(item.price × item.quantity) + shipping - discount
150
+ - Order total = sum(item.price x item.quantity) + shipping - discount
148
151
  - Discount cannot exceed 50% of subtotal
149
152
  - Order cannot be cancelled after shipping
150
153
  - Stock is reserved when order is confirmed, released if cancelled
@@ -188,35 +191,50 @@ For EACH entity AND action:
188
191
 
189
192
  ---
190
193
 
191
- ### 7. NON-FUNCTIONAL (The "How Well")
194
+ ### 7. UX INTENT (The "Where + Flow")
192
195
 
193
- - "How fast should [action] be?"
194
- - "How many [entities] will exist? (10? 1000? 1M?)"
195
- - "Who needs to be notified when [event]?"
196
- - "What needs to work offline?"
197
- - "What needs real-time updates?"
196
+ - "Where should the shortcut for the North Star action live? (Goal: < 2 clicks)"
197
+ - "Which features are 'Delighters' (Marketing/Heroes) vs 'Must-Haves' (CRUD)?"
198
198
 
199
199
  ---
200
200
 
201
- ## Filling the Spec Template
202
-
203
- Only after ALL questions are answered, fill `spec_template.md`:
204
-
205
- 1. **Identity** - Name, tagline, users
206
- 2. **User Journeys** - Step-by-step flows (NEW)
207
- 3. **Preset** - Based on app type
208
- 4. **Auth** - Providers, roles
209
- 5. **Billing** - If needed
210
- 6. **Entities** - With relationships and states (EXPANDED)
211
- 7. **Business Rules** - Validations, calculations (NEW)
212
- 8. **Pages** - Derived from user journeys
213
- 9. **Features** - i18n, PWA, etc.
201
+ ## Producing the Documents
202
+
203
+ Only after ALL questions are answered, use `spec_template.md` as the FORMAT to organize gathered information, then SPLIT into three documents:
204
+
205
+ ### What Goes Where
206
+
207
+ **`docs/PRD.md`** (from `prd_template.md`):
208
+ - Identity (name, users, value prop, North Star)
209
+ - User journeys (numbered steps, success/failure criteria)
210
+ - Business rules (validations, calculations, triggers)
211
+ - Permissions matrix (who can CRUD what)
212
+ - Edge cases and error handling
213
+ - Design decision overrides
214
+
215
+ **`docs/HLD.md`** (from `hld_template.md`):
216
+ - Preset selection and rationale
217
+ - Auth model (providers, roles, self-registration)
218
+ - Billing model (if applicable)
219
+ - Aesthetic essence
220
+ - Page map (routes, purpose, which journey they serve)
221
+ - Entity relationship diagram (text-based overview)
222
+ - Feature flags (i18n, PWA, real-time, uploads, etc.)
223
+ - Architecture decisions and trade-offs
224
+
225
+ **`docs/LLD.md`** (from `lld_template.md`):
226
+ - Per-entity detailed spec:
227
+ - Field definitions (name, type, required, validation, visibility)
228
+ - State machine (from/to/trigger/who/side-effects)
229
+ - Relationships (type, target, via field, cascade rule)
230
+ - Access matrix (CRUD per role per condition)
231
+ - Cross-entity validation rules
214
232
 
215
233
  ---
216
234
 
217
235
  ## Validation: The Completeness Test
218
236
 
219
- Before presenting spec to user, verify:
237
+ Before producing the three documents, verify:
220
238
 
221
239
  ### Can You Answer These?
222
240
 
@@ -227,24 +245,24 @@ Before presenting spec to user, verify:
227
245
  - [ ] "Who can [action] on [entity]?" → Know for every combination
228
246
  - [ ] "What if [failure scenario]?" → Have answer for common failures
229
247
 
230
- ### Is The Spec Complete?
231
-
232
- - [ ] Every entity has fields, relationships, states documented
233
- - [ ] Every user journey has numbered steps
234
- - [ ] Every business rule is explicit
235
- - [ ] Every permission is defined
236
- - [ ] No "TBD" or "TODO" in the spec
248
+ ### Is Everything Complete?
237
249
 
238
- **If ANY checkbox is unchecked, ask more questions.**
250
+ - [ ] Every user journey has 5+ numbered steps
251
+ - [ ] Every entity has fields, states, and state transitions
252
+ - [ ] Every entity has CRUD permissions for every role
253
+ - [ ] Every business rule is documented explicitly
254
+ - [ ] Every page traces back to a user journey
255
+ - [ ] No "TBD", "TODO", or empty fields
256
+ - [ ] User has said "yes, that's complete"
239
257
 
240
258
  ---
241
259
 
242
- ## Presenting the Spec
260
+ ## Presenting for Validation
243
261
 
244
- When spec is complete, present it as:
262
+ When ready, present a summary:
245
263
 
246
264
  ```markdown
247
- ## App Specification Summary
265
+ ## Specification Summary
248
266
 
249
267
  ### Identity
250
268
  **Name:** [App Name]
@@ -281,18 +299,17 @@ What's missing or incorrect?
281
299
 
282
300
  ## Output
283
301
 
284
- Completed spec_template.md with:
285
- - All user journeys mapped
286
- - All entities with relationships and states
287
- - All business rules documented
288
- - All permissions defined
289
- - User validation
302
+ User validates → produce three documents in `docs/`:
303
+
304
+ 1. **`docs/PRD.md`** requirements, journeys, rules, permissions
305
+ 2. **`docs/HLD.md`** architecture, preset, auth, pages, features
306
+ 3. **`docs/LLD.md`** detailed entity specs, state machines, access matrices
290
307
 
291
- **After spec validation, generate the implementation tracker:**
308
+ Then generate the implementation tracker:
292
309
  ```
293
310
  init_implementation({ from_spec: true })
294
311
  ```
295
- This creates `.dndev/implementation.md` with checklist items for all phases (pages, entities, composition, config). Agents will read and update this file across sessions.
312
+ This creates `.dndev/implementation.md` with checklist items for all phases.
296
313
 
297
- **Spec validated AND complete? Move to Phase 1: SCAFFOLD.**
314
+ **Documents validated AND complete? Move to Phase 1: SCAFFOLD.**
298
315
  **Anything unclear? Keep asking questions.**
@@ -5,7 +5,7 @@
5
5
  **MCP:** `start_phase(1)` to begin. `complete_phase()` when done.
6
6
  **Done when:** All routes listed, all *Page.tsx files created with correct PageMeta.
7
7
 
8
- **Prerequisite:** Phase 0 (spec) must be complete.
8
+ **Prerequisite:** Phase 0 complete `docs/PRD.md`, `docs/HLD.md`, `docs/LLD.md` validated.
9
9
 
10
10
  ---
11
11
 
@@ -51,17 +51,18 @@ It shows the canonical pattern:
51
51
 
52
52
  ---
53
53
 
54
- ## Step 3: Review Spec Pages
54
+ ## Step 3: Review Pages from HLD
55
55
 
56
- From your spec, you have a list of pages. Now create them.
56
+ From `docs/HLD.md` section 5 (Page Map), you have the list of pages. Now create them.
57
57
 
58
+ **READ:** `docs/HLD.md` for the page map and `docs/PRD.md` for the user journeys they serve.
58
59
  **READ:** `guides/wai-way/page_patterns.md` for page structure patterns.
59
60
 
60
61
  ---
61
62
 
62
- ## Step 3: Create Page Files
63
+ ## Step 4: Create Page Files
63
64
 
64
- For each page in spec:
65
+ For each page in HLD page map:
65
66
 
66
67
  ```bash
67
68
  touch src/pages/AboutPage.tsx
@@ -1,17 +1,17 @@
1
1
  # BLUEPRINT: 2_ENTITIES
2
2
 
3
- **Goal:** Define all data models from spec (Single Source of Truth).
3
+ **Goal:** Define all data models from `docs/LLD.md` (Single Source of Truth).
4
4
 
5
5
  **MCP:** `start_phase(2)` to begin. Use `lookup_symbol('defineEntity')` for types. `complete_phase()` when done.
6
6
  **Done when:** All entities defined with fields, access rules, visibility. Exported from index.ts.
7
7
 
8
- **Prerequisite:** Phase 0 (spec) and Phase 1 (scaffold) complete.
8
+ **Prerequisite:** Phase 0 (PRD + HLD + LLD) and Phase 1 (scaffold) complete.
9
9
 
10
10
  ---
11
11
 
12
- ## Step 1: Review Spec Entities
12
+ ## Step 1: Review LLD Entities
13
13
 
14
- From your spec, you have a list of entities with fields and access rules.
14
+ From `docs/LLD.md`, you have the per-entity specs: fields, state machines, relationships, access matrices.
15
15
 
16
16
  **READ:** `guides/wai-way/entity_patterns.md` for common schemas:
17
17
  - UserProfile, Post, Product, Order, Review, Comment
@@ -21,12 +21,12 @@ From your spec, you have a list of entities with fields and access rules.
21
21
 
22
22
  ## Step 2: Create Entity Files
23
23
 
24
- For each entity in spec:
24
+ For each entity in `docs/LLD.md`:
25
25
 
26
26
  1. Find matching pattern in `entity_patterns.md`
27
27
  2. Copy pattern → `entities/[Entity].ts`
28
- 3. Customize fields from spec
29
- 4. Set access rules from spec
28
+ 3. Customize fields from LLD field definitions
29
+ 4. Set access rules from LLD access matrix
30
30
 
31
31
  **READ:** `entities/ExampleEntity.ts` for the base pattern.
32
32
 
@@ -106,6 +106,6 @@ export { orderEntity } from './Order';
106
106
  ## Output
107
107
 
108
108
  - [ ] All entities from spec defined in `entities/`
109
- - [ ] Fields match spec
110
- - [ ] Access rules match spec
109
+ - [ ] Fields match LLD
110
+ - [ ] Access rules match LLD
111
111
  - [ ] Exported from `entities/index.ts`
@@ -5,7 +5,7 @@
5
5
  **MCP:** `start_phase(3)` to begin. Use `lookup_symbol(component_name)` for types. `complete_phase()` when done.
6
6
  **Done when:** All pages functional with content. CRUD pages use EntityList/EntityFormRenderer. All strings hardcoded.
7
7
 
8
- **Prerequisite:** Phase 0-2 complete. Spec validated, entities defined.
8
+ **Prerequisite:** Phase 0-2 complete. PRD + HLD + LLD validated, entities defined.
9
9
 
10
10
  ---
11
11
 
@@ -5,7 +5,7 @@
5
5
  **MCP:** `start_phase(4)` to begin. `complete_phase({ files: [...], lesson: "..." })` when done.
6
6
  **Done when:** Tests pass, config complete, firestore rules generated.
7
7
 
8
- **Prerequisite:** Phase 0-3 complete. App is functional with hardcoded strings.
8
+ **Prerequisite:** Phase 0-3 complete. PRD + HLD + LLD validated, app is functional with hardcoded strings.
9
9
 
10
10
  ---
11
11
 
@@ -41,7 +41,8 @@ import '@testing-library/jest-dom';
41
41
  ## Step 2: Generate Entity Tests
42
42
 
43
43
  **READ:** `entities/index.ts` — get the list of all entities.
44
- **READ:** `guides/wai-way/spec_template.md` — get the permissions matrix and business rules.
44
+ **READ:** `docs/PRD.md` — get the permissions matrix and business rules.
45
+ **READ:** `docs/LLD.md` — get the per-entity access matrices.
45
46
 
46
47
  For **each entity** in `entities/`, create `tests/entities/[EntityName].test.ts`:
47
48
 
@@ -61,13 +62,13 @@ For **each page**, create `tests/pages/[PageName].test.tsx`:
61
62
 
62
63
  - [ ] Page renders without error
63
64
  - [ ] PageMeta is defined (title, auth, admin)
64
- - [ ] Route protection matches spec (public pages have `auth: false`, protected have `auth: true`, admin have `admin: true`)
65
+ - [ ] Route protection matches HLD page map (public pages have `auth: false`, protected have `auth: true`, admin have `admin: true`)
65
66
 
66
67
  ---
67
68
 
68
69
  ## Step 4: Generate Access Control Tests
69
70
 
70
- **READ:** The spec's permissions section.
71
+ **READ:** `docs/PRD.md` permissions matrix and `docs/LLD.md` access matrices.
71
72
 
72
73
  Create `tests/access/access-rules.test.ts`:
73
74
 
@@ -99,9 +100,9 @@ Create `firestore.rules` from entity access rules:
99
100
 
100
101
  ### app.ts
101
102
  **READ:** `src/config/app.ts`
102
- - [ ] `APP_NAME` from spec
103
+ - [ ] `APP_NAME` from PRD
103
104
  - [ ] `APP_SHORT_NAME` abbreviation
104
- - [ ] `preset` from spec (landing/admin/moolti/docs/blog/game/plain)
105
+ - [ ] `preset` from HLD (landing/admin/moolti/docs/blog/game/plain)
105
106
  - [ ] Footer legal links
106
107
 
107
108
  ### legal.ts
@@ -1,36 +1,51 @@
1
1
  {
2
2
  "description": "WAI-WAY context map - maps phases to required files. READ the scaffolded files, they contain inline documentation.",
3
3
  "golden_rule": "THE SCAFFOLDED FILES ARE YOUR DOCUMENTATION. Read the file. Follow the pattern. Extend.",
4
+ "document_chain": {
5
+ "spec_template.md": "FORMAT — the empty shell the Extractor fills through conversation. NOT kept as-is.",
6
+ "docs/PRD.md": "OUTPUT — Product Requirements (journeys, rules, permissions). The WHAT.",
7
+ "docs/HLD.md": "OUTPUT — High-Level Design (preset, auth, pages, features). The HOW (big picture).",
8
+ "docs/LLD.md": "OUTPUT — Low-Level Design (per-entity specs, state machines, access). The HOW (detailed).",
9
+ ".dndev/implementation.md": "MACRO PLAN — checklist per phase. Versioned, archived per project version.",
10
+ ".dndev/captain-log.json": "SESSION HISTORY — auto-recorded on approve_phase. Never deleted.",
11
+ ".dndev/LESSONS.md": "GOTCHAS — tagged, scored, filtered by phase. Never deleted."
12
+ },
4
13
  "phases": {
5
- "0_brainstorm_spec": {
14
+ "0_brainstorm": {
6
15
  "agent": "extractor",
7
- "goal": "Gather requirements through conversation and produce validated spec",
8
- "flow": "User idea → Agent questions → Agent fills spec User validates",
9
- "done_when": "spec_template.md filled and validated by user",
16
+ "goal": "Gather requirements through conversation and produce validated specification documents",
17
+ "flow": "User idea → Agent questions (using spec_template.md format) User validates → Agent splits into PRD + HLD + LLD",
18
+ "done_when": "docs/PRD.md + docs/HLD.md + docs/LLD.md complete and validated by user",
10
19
  "read_files": [
11
20
  "guides/wai-way/spec_template.md",
21
+ "guides/wai-way/prd_template.md",
22
+ "guides/wai-way/hld_template.md",
23
+ "guides/wai-way/lld_template.md",
12
24
  "guides/wai-way/presets_guide.md",
13
25
  "guides/wai-way/entity_patterns.md",
14
26
  "guides/wai-way/page_patterns.md"
15
27
  ],
16
- "output": "Validated spec with preset, entities, pages, auth/billing requirements"
28
+ "output": "docs/PRD.md, docs/HLD.md, docs/LLD.md, .dndev/implementation.md"
17
29
  },
18
- "1_scaffold_sitemap": {
30
+ "1_scaffold": {
19
31
  "agent": "extractor",
20
- "goal": "Running app with all routes defined",
21
- "done_when": "All routes listed, all *Page.tsx files created with correct PageMeta",
32
+ "goal": "Running app with all routes defined as interactive prototype stubs",
33
+ "done_when": "All routes listed, all *Page.tsx files created with correct PageMeta, clickable prototype",
22
34
  "read_files": [
35
+ "docs/PRD.md",
36
+ "docs/HLD.md",
23
37
  "src/pages/HomePage.tsx",
24
38
  "src/config/app.ts",
25
39
  "guides/wai-way/page_patterns.md"
26
40
  ],
27
- "output": "All *Page.tsx files created with correct PageMeta"
41
+ "output": "All *Page.tsx files created with PageMeta, clickable prototype"
28
42
  },
29
43
  "2_entities": {
30
44
  "agent": "architect",
31
- "goal": "Define all data models",
45
+ "goal": "Define all data models from LLD",
32
46
  "done_when": "All entities defined with fields, access, visibility. Exported from index.ts",
33
47
  "read_files": [
48
+ "docs/LLD.md",
34
49
  "entities/ExampleEntity.ts",
35
50
  "entities/index.ts",
36
51
  "guides/wai-way/entity_patterns.md"
@@ -42,6 +57,8 @@
42
57
  "goal": "Build pages with components (hardcoded strings)",
43
58
  "done_when": "All pages functional, CRUD uses EntityList/EntityFormRenderer, strings hardcoded",
44
59
  "read_files": [
60
+ "docs/PRD.md",
61
+ "docs/HLD.md",
45
62
  "src/pages/ListPageExample.tsx",
46
63
  "src/pages/FormPageExample.tsx",
47
64
  "src/pages/HomePage.tsx",
@@ -51,24 +68,38 @@
51
68
  },
52
69
  "4_configure_test": {
53
70
  "agent": "polisher",
54
- "goal": "Generate tests from spec, firestore rules from entities, finalize config",
71
+ "goal": "Generate tests, firestore rules, CI/CD, finalize config",
55
72
  "done_when": "Tests pass, firestore.rules generated, config complete, mobile responsive",
56
73
  "read_files": [
57
- "guides/wai-way/spec_template.md",
74
+ "docs/PRD.md",
75
+ "docs/LLD.md",
58
76
  "entities/index.ts",
59
77
  "src/config/app.ts",
60
78
  "src/config/legal.ts",
61
79
  "guides/dndev/SETUP_TESTING.md"
62
80
  ],
63
- "output": "Test files, firestore.rules, configured app"
81
+ "output": "Test files, firestore.rules, CI/CD, configured app"
64
82
  }
65
83
  },
66
84
  "key_files": {
67
- "spec": {
68
- "guides/wai-way/spec_template.md": "App specification template - fill before coding",
69
- "guides/wai-way/presets_guide.md": "Preset decision matrix - landing/admin/moolti/docs/blog/game/plain",
70
- "guides/wai-way/entity_patterns.md": "Common entity schemas - UserProfile, Post, Product, Order, etc.",
71
- "guides/wai-way/page_patterns.md": "Common page structures - Dashboard, List, Form, Landing, Settings, etc."
85
+ "spec_documents": {
86
+ "docs/PRD.md": "Product Requirements journeys, rules, permissions (produced by P0)",
87
+ "docs/HLD.md": "High-Level Design preset, auth, pages, features (produced by P0)",
88
+ "docs/LLD.md": "Low-Level Design per-entity specs, state machines, access (produced by P0)"
89
+ },
90
+ "spec_formats": {
91
+ "guides/wai-way/spec_template.md": "Conversation FORMAT — empty shell agent fills through questions",
92
+ "guides/wai-way/prd_template.md": "Output FORMAT for PRD.md",
93
+ "guides/wai-way/hld_template.md": "Output FORMAT for HLD.md",
94
+ "guides/wai-way/lld_template.md": "Output FORMAT for LLD.md",
95
+ "guides/wai-way/presets_guide.md": "Preset decision matrix",
96
+ "guides/wai-way/entity_patterns.md": "Common entity schemas",
97
+ "guides/wai-way/page_patterns.md": "Common page structures"
98
+ },
99
+ "operational": {
100
+ ".dndev/implementation.md": "Active macro plan — checklist per phase (versioned)",
101
+ ".dndev/captain-log.json": "Full session history — auto-recorded (never deleted)",
102
+ ".dndev/LESSONS.md": "Decisions, gotchas, anti-patterns (never deleted)"
72
103
  },
73
104
  "config": {
74
105
  "src/config/app.ts": "App name, preset, features, auth routes",
@@ -90,7 +121,7 @@
90
121
  }
91
122
  },
92
123
  "workflow": {
93
- "summary": "BRAINSTORM (→ spec) → SCAFFOLD → ENTITIES → COMPOSE → CONFIGURE + TEST",
94
- "critical_rule": "Spec is OUTPUT of brainstorming. User validates before coding. Validated spec = mechanical build."
124
+ "summary": "BRAINSTORM (→ PRD + HLD + LLD) → SCAFFOLD → ENTITIES → COMPOSE → CONFIGURE + TEST",
125
+ "critical_rule": "spec_template.md is the FORMAT. P0 produces PRD + HLD + LLD. Validated documents = mechanical build."
95
126
  }
96
127
  }