@thedecipherist/mdd 1.5.3 → 1.5.4

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.
@@ -72,45 +72,131 @@ For each identified feature, determine its `path` value:
72
72
  - Title Case, 1–3 levels, `/`-separated
73
73
  - Siblings must use identical parent spelling (if `Auth/Login` exists, new auth docs use `Auth`, not `Authentication`)
74
74
 
75
- #### Step IS2c — Build-order classification
75
+ #### Step IS2c — Project type detection + wave ordering
76
76
 
77
- This is the most important step. Features are numbered in the order a developer would actually build them — not the order they appear in the spec.
77
+ This is the most important step. Features are numbered in the order a developer would actually build them — not the order they appear in the spec. The correct order depends entirely on what type of project is being built.
78
78
 
79
- **Classify every feature as one of two types:**
79
+ **Step 1 Detect project type from the spec.**
80
80
 
81
- **COMPONENT** Something that results in code: a module, class, package, service, server, or runtime. The thing you sit down and write. Examples: Parser, Template Engine, Renderer, MCP Server, CLI.
81
+ Read the spec for these signals:
82
82
 
83
- **SPEC** Something that describes behaviour a COMPONENT must implement: a directive definition, an API contract, a security rule, a caching rule, a language feature. You consult a SPEC doc while building the COMPONENT that implements it. Examples: `@include` directive spec, Security Config spec, Cache Modes spec.
83
+ | Project type | Signals |
84
+ |---|---|
85
+ | **Language / Toolchain** | Has a Parser, AST, or grammar section. Describes directives, syntax, or a runtime. Has a CLI section. Describes an interpreter, compiler, or processing pipeline. |
86
+ | **Web API / Backend** | Describes endpoints, routes, REST, or GraphQL. Has auth/authorization sections. Describes DB models and migrations. |
87
+ | **Frontend / UI App** | Describes components, pages, or routing. Describes user interactions, forms, and layouts. Has a state management section. |
88
+ | **Library / SDK** | Describes a public API surface with exported types. Has integration or plugin sections. No server or UI sections. |
89
+ | **Extension / Plugin** | Spec is adding features to an existing product. Most features assume a host system already exists. |
84
90
 
85
- **Order COMPONENT features by build dependency:**
91
+ If signals from multiple types appear, pick the dominant one and note the mix.
86
92
 
87
- Start from the foundation (the component everything else depends on) and work outward. Ask: "What must exist before I can build this?" The component with no dependencies comes first. The component that depends on everything comes last.
93
+ **Step 2 Apply the wave ordering template for the detected type.**
88
94
 
89
- Example for a language toolchain:
95
+ **Language / Toolchain:**
90
96
  ```
91
- Parser — foundation, no deps, must exist first
92
- Stripper — depends on Parser AST
93
- Renderer — depends on Parser AST, no connection deps
94
- Template Engine depends on Parser + Renderer
95
- MCP Server — depends on Template Engine
96
- Hook depends on MCP Server
97
- CLI — depends on all of the above
97
+ Wave 1 Infrastructure Skeleton
98
+ Goal: a working program that can accept input and produce output, even if incomplete.
99
+ Build: Parser + AST types + core shared types + minimal CLI entry point
100
+ Demo-state: "can parse a source file and print the AST to stdout"
101
+
102
+ Wave 2 First Shippable Artifact
103
+ Goal: the first thing an end user can actually use.
104
+ Build: Stripper / Renderer / Compiler — whatever produces the first real output
105
+ Demo-state: "can take a source file and produce correct output for the simplest case"
106
+
107
+ Wave 3 — Language Features
108
+ Goal: full language coverage. All directives, all syntax, all semantics.
109
+ Build: SPEC docs for every language feature + the Template Engine / Resolver that implements them
110
+ Demo-state: "all static features work correctly end to end"
111
+
112
+ Wave 4 — Dynamic / Live Features
113
+ Goal: features that require external connections (DB, HTTP, shell, AI client).
114
+ Build: MCP Server, Hook, live directive execution
115
+ Demo-state: "live data directives execute and return real results"
116
+
117
+ Wave 5 — Security, Hardening, Extras
118
+ Goal: production-safe. Sandboxed execution, audit logging, edge case handling.
119
+ Build: Security system, caching, graceful degradation
120
+ Demo-state: "untrusted documents are safe to run; audit log captures all executions"
121
+
122
+ Wave 6 — CLI, Distribution, Packaging
123
+ Goal: installable and usable by someone who has never seen the codebase.
124
+ Build: Full CLI, npm package, CI integration, documentation
125
+ Demo-state: "npm install -g, run against a real file, get correct output"
98
126
  ```
99
127
 
100
- **Assign SPEC features to waves:** A SPEC feature belongs in the wave of the COMPONENT that implements it. The SPEC doc gets created alongside its implementing COMPONENT's wave so that both exist when building begins. The COMPONENT doc lists SPEC docs in its `depends_on`.
128
+ **Web API / Backend:**
129
+ ```
130
+ Wave 1 — Project scaffold + DB + core models
131
+ Demo-state: "server starts, DB connects, migrations run"
132
+
133
+ Wave 2 — Auth
134
+ Demo-state: "can register, login, receive a JWT, access a protected route"
135
+
136
+ Wave 3 — Core endpoints
137
+ Demo-state: "core CRUD for the main resource works end to end"
138
+
139
+ Wave 4 — Business logic features
140
+ Demo-state: "main product workflow works end to end"
141
+
142
+ Wave 5 — Integrations, webhooks, external APIs
143
+ Demo-state: "third-party integrations work in staging"
144
+
145
+ Wave 6 — Admin, analytics, hardening
146
+ Demo-state: "production-ready: rate limiting, logging, admin panel live"
147
+ ```
148
+
149
+ **Frontend / UI App:**
150
+ ```
151
+ Wave 1 — Routing + layout shell
152
+ Demo-state: "app loads, all routes navigate without error"
101
153
 
102
- **Determine wave breakdown:** Group COMPONENTs (and their associated SPECs) into waves by build phase. Each wave should have a clear demo-state — a thing you can actually demonstrate when the wave is done.
154
+ Wave 2 Auth + core state
155
+ Demo-state: "can log in and see the main dashboard"
103
156
 
104
- Example wave structure for a language toolchain:
157
+ Wave 3 Core features
158
+ Demo-state: "primary user workflow works end to end"
159
+
160
+ Wave 4 — Secondary features + integrations
161
+ Demo-state: "all documented features work"
162
+
163
+ Wave 5 — Polish, performance, accessibility
164
+ Demo-state: "passes lighthouse audit, all a11y checks green"
105
165
  ```
106
- Wave 1 — Foundation: Parser + all language directive SPECs
107
- Wave 2 — Static Output: Stripper + Renderer
108
- Wave 3 — Engine: Template Engine + Caching SPECs
109
- Wave 4 — Live Data: MCP Server + Hook + Security SPECs
110
- Wave 5 — CLI: CLI + Distribution
166
+
167
+ **Library / SDK:**
111
168
  ```
169
+ Wave 1 — Core types + core algorithm
170
+ Demo-state: "library installs, core function produces correct output"
171
+
172
+ Wave 2 — Full public API
173
+ Demo-state: "all documented methods work, test suite passes"
174
+
175
+ Wave 3 — Extensions, plugins, advanced options
176
+ Demo-state: "extension points work, plugin example runs"
112
177
 
113
- **If no COMPONENT/SPEC distinction applies** (e.g. a feature-extension spec for an existing product), order features by: user-facing value first, infrastructure last. Earlier features should be shippable without later features.
178
+ Wave 4 Distribution, docs, examples
179
+ Demo-state: "published to registry, README example runs from a fresh install"
180
+ ```
181
+
182
+ **Extension / Plugin:**
183
+ ```
184
+ Order by user-facing value — the most impactful feature first. Each wave should be independently usable without later waves. Infrastructure last.
185
+ ```
186
+
187
+ **Step 3 — Classify every feature.**
188
+
189
+ With the wave structure determined, classify each feature:
190
+
191
+ **COMPONENT** — results in code files: a module, class, package, service, server, or runtime. The thing you sit down and write.
192
+
193
+ **SPEC** — describes behaviour a COMPONENT must implement: a directive definition, an API contract, a security rule, a protocol. You consult a SPEC while building the COMPONENT. SPEC docs belong in the same wave as their implementing COMPONENT.
194
+
195
+ **Step 4 — Assign features to waves.**
196
+
197
+ Place each feature in the wave where it logically gets built. Ask: "At which wave would a developer need this?" Not: "In which section does the spec describe it?"
198
+
199
+ SPEC docs and their implementing COMPONENT always go in the same wave. The COMPONENT `depends_on` the SPECs it implements.
114
200
 
115
201
  #### Step IS2d — Determine output structure
116
202
 
@@ -234,6 +320,19 @@ Is the build order correct? Does each wave's demo-state make sense?
234
320
 
235
321
  ### Phase IS4 — Write Files
236
322
 
323
+ **First — ensure the MDD directory structure exists.** Run these before writing any file:
324
+
325
+ ```bash
326
+ mkdir -p .mdd/initiatives
327
+ mkdir -p .mdd/waves
328
+ mkdir -p .mdd/docs
329
+ ```
330
+
331
+ These are the exact directories MDD uses. Do not write initiative or wave files anywhere else. Full paths on disk:
332
+ - Initiatives: `.mdd/initiatives/<slug>.md`
333
+ - Waves: `.mdd/waves/<slug>-wave-N.md`
334
+ - Feature docs: `.mdd/docs/<NN>-<slug>.md`
335
+
237
336
  Write in this order: CLAUDE.md (if approved) → initiative → waves → feature docs.
238
337
 
239
338
  #### CLAUDE.md (if approved in IS2.5)
@@ -319,6 +418,10 @@ Compute and write the `hash:` field after writing.
319
418
 
320
419
  #### Feature docs
321
420
 
421
+ **Critical framing — these are build instructions, not reference documentation.**
422
+
423
+ When a developer runs `/mdd NN`, Claude reads this doc and uses it to write code. That is the only reader that matters. Write every section as if answering the question: "What exactly do I build, and how do I know when it's done?" Not: "What does this feature do?" — a passive description is useless to a builder.
424
+
322
425
  For each feature in the approved plan, in wave order:
323
426
 
324
427
  1. Auto-number continuing from the highest existing doc number in `.mdd/docs/`
@@ -375,29 +478,37 @@ known_issues: []
375
478
 
376
479
  # <NN> — <Feature Title>
377
480
 
378
- ## Purpose
481
+ ## What to Build
379
482
 
380
- <Full description of what this feature is and does. Include the core design rationale the "why" behind the decisions. Do not limit this to a sentence count. If the spec says a lot about this feature, capture it all here. A developer reading only this doc should fully understand what they are building.>
483
+ <Answer: "What exactly am I being asked to create?" For a COMPONENT: name the files/modules to create, what they take as input, what they produce as output, and what they must never do. For a SPEC: describe the exact behaviour contract the implementing COMPONENT must satisfy — what inputs it must accept, what output it must produce, what errors it must raise. Be concrete. "A parser that reads .md files" is too vague. "A parser that reads a .md source file and produces an array of ASTNode objects, one per directive" is correct.>
381
484
 
382
485
  ## Architecture
383
486
 
384
- <How this feature fits into the system. For a COMPONENT: describe its responsibilities, inputs, outputs, and what it must never do. For a SPEC: describe the behaviour contract the implementing COMPONENT must satisfy. Include TypeScript interfaces, AST node types, and data structures if the spec defines them.>
487
+ <How this feature fits into the system and what it depends on. For a COMPONENT: its place in the pipeline, what calls it, what it calls, what it must never reach into directly. For a SPEC: which COMPONENT implements this spec and how. Include TypeScript interfaces, AST node types, and data structures exactly as defined in the spec copy them verbatim, do not paraphrase.>
488
+
489
+ ## Implementation Notes
490
+
491
+ <Key decisions Claude must follow when implementing this feature. This is not boilerplate — write only what is non-obvious or constraining. Examples: "use a single-pass regex scanner, not a recursive descent parser"; "never buffer the full file in memory"; "the AST must be immutable after construction". If the spec gives explicit implementation guidance, it belongs here.>
385
492
 
386
493
  ## Data Model
387
494
 
388
- <Data structures, schemas, config formats described in the spec. Include the exact field names, types, and constraints. Omit section only if the spec truly defines no data structures for this feature.>
495
+ <Data structures, schemas, config formats. Include exact field names, types, nesting, and defaults. Copy JSON examples from the spec verbatim. Omit only if the spec truly defines no data structures for this feature.>
389
496
 
390
497
  ## API / Interface
391
498
 
392
- <Public interface this feature exposes: function signatures, tool names, command syntax, config keys. Omit if not applicable.>
499
+ <The exact public interface this feature exposes. Function signatures, exported types, CLI commands and flags, config keys, MCP tool names. Every option, every flag, every subcommand — do not omit rare or advanced ones. A developer should be able to write the module's index.ts exports from this section alone.>
393
500
 
394
501
  ## Business Rules
395
502
 
396
- <Every decision, constraint, validation rule, edge case, error behaviour, and "never do X" described in the spec for this feature. This section should be exhaustive — if it is in the spec, it is here. Use bullet points or numbered lists for clarity.>
503
+ <Every constraint, validation rule, edge case, error behaviour, platform difference, and "always/never/only valid when" rule from the spec. Exhaustive. If it is in the spec for this feature, it is here. Use a numbered or bulleted list. Include exact error message formats and the conditions that trigger them.>
504
+
505
+ ## Acceptance Criteria
506
+
507
+ <How do you know this feature is done? Write concrete, verifiable statements. Each criterion should be something Claude can check with a test or a manual run. Examples: "mai strip input.md produces output with zero @ directives remaining"; "parsing a file with a circular @include chain throws CIRCULAR_REFERENCE_ERROR with the full chain in the message"; "all 11 content masking patterns fire correctly on the test fixtures".>
397
508
 
398
509
  ## Dependencies
399
510
 
400
- <Other feature docs this one requires. List by ID and title. For SPECs, name the COMPONENT that implements this spec.>
511
+ <Other feature docs this one requires, by ID and title. For SPECs, state which COMPONENT implements this spec.>
401
512
 
402
513
  ## Known Issues
403
514
 
@@ -411,12 +522,12 @@ known_issues: []
411
522
  ```
412
523
  Writing files...
413
524
  ✅ CLAUDE.md
414
- ✅ initiatives/markdownai.md
415
- ✅ waves/markdownai-wave-1.md (Wave 1 — Foundation)
416
- ✅ waves/markdownai-wave-2.md (Wave 2 — Static Pipeline)
525
+ .mdd/initiatives/<slug>.md
526
+ .mdd/waves/<slug>-wave-1.md (Wave 1 — <name>)
527
+ .mdd/waves/<slug>-wave-2.md (Wave 2 — <name>)
417
528
  ...
418
- ✅ docs/01-<slug>.md [COMPONENT] <path>
419
- ✅ docs/02-<slug>.md [SPEC] <path>
529
+ .mdd/docs/01-<slug>.md [COMPONENT] <path>
530
+ .mdd/docs/02-<slug>.md [SPEC] <path>
420
531
  ...
421
532
  ```
422
533
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thedecipherist/mdd",
3
- "version": "1.5.3",
3
+ "version": "1.5.4",
4
4
  "description": "MDD — Manual-Driven Development workflow for Claude Code",
5
5
  "type": "module",
6
6
  "bin": {