specdacular 0.2.5 → 0.5.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.
Files changed (34) hide show
  1. package/README.md +186 -68
  2. package/commands/specd/blueprint.md +64 -0
  3. package/commands/specd/{discuss-feature.md → feature/discuss.md} +1 -1
  4. package/commands/specd/{new-feature.md → feature/new.md} +3 -3
  5. package/commands/specd/{plan-feature.md → feature/plan.md} +15 -18
  6. package/commands/specd/{research-feature.md → feature/research.md} +5 -5
  7. package/commands/specd/help.md +51 -29
  8. package/commands/specd/{execute-plan.md → phase/execute.md} +4 -4
  9. package/commands/specd/phase/insert.md +62 -0
  10. package/commands/specd/phase/plan.md +73 -0
  11. package/commands/specd/{discuss-phase.md → phase/prepare.md} +21 -9
  12. package/commands/specd/phase/renumber.md +66 -0
  13. package/commands/specd/{research-phase.md → phase/research.md} +3 -1
  14. package/commands/specd/status.md +20 -0
  15. package/package.json +1 -1
  16. package/specdacular/agents/feature-researcher.md +4 -2
  17. package/specdacular/templates/blueprint/index.html +110 -0
  18. package/specdacular/templates/blueprint/scripts.js +71 -0
  19. package/specdacular/templates/blueprint/styles.css +429 -0
  20. package/specdacular/templates/features/STATE.md +6 -4
  21. package/specdacular/workflows/blueprint-diagrams.md +273 -0
  22. package/specdacular/workflows/blueprint-wireframes.md +312 -0
  23. package/specdacular/workflows/blueprint.md +372 -0
  24. package/specdacular/workflows/discuss-feature.md +4 -4
  25. package/specdacular/workflows/execute-plan.md +4 -4
  26. package/specdacular/workflows/insert-phase.md +222 -0
  27. package/specdacular/workflows/new-feature.md +5 -5
  28. package/specdacular/workflows/plan-feature.md +60 -233
  29. package/specdacular/workflows/plan-phase.md +363 -0
  30. package/specdacular/workflows/prepare-phase.md +759 -0
  31. package/specdacular/workflows/renumber-phases.md +273 -0
  32. package/specdacular/workflows/research-phase.md +5 -3
  33. package/specdacular/workflows/status.md +85 -0
  34. package/specdacular/workflows/discuss-phase.md +0 -389
@@ -0,0 +1,372 @@
1
+ <purpose>
2
+ Generate a visual HTML blueprint for exploring Specdacular feature artifacts.
3
+
4
+ Reads FEATURE.md, CONTEXT.md, DECISIONS.md, and plans/ to create a browsable
5
+ static HTML file with sidebar navigation and accordion decision viewer.
6
+
7
+ **Output:** `.specd/features/{name}/blueprint/index.html`
8
+ </purpose>
9
+
10
+ <philosophy>
11
+
12
+ ## Self-Contained Output
13
+
14
+ The generated HTML must work when opened directly in a browser (file:// protocol).
15
+ All CSS and JS is inlined. Only external dependency is Mermaid.js CDN.
16
+
17
+ ## Parse Defensively
18
+
19
+ Markdown files may have missing fields, multi-line values, or edge cases.
20
+ Always provide defaults and handle gracefully.
21
+
22
+ ## HTML-Escape Everything
23
+
24
+ All content from markdown files must be HTML-escaped before embedding
25
+ to prevent XSS and layout breakage.
26
+
27
+ </philosophy>
28
+
29
+ <process>
30
+
31
+ <step name="parse_arguments">
32
+ Parse the command arguments.
33
+
34
+ **Input:** `$ARGUMENTS` (e.g., "my-feature wireframes")
35
+
36
+ **Extract:**
37
+ - Feature name: First word
38
+ - Subcommand: Second word (optional) — "wireframes", "diagrams", or empty
39
+
40
+ ```bash
41
+ # Parse arguments
42
+ FEATURE_NAME=$(echo "$ARGUMENTS" | awk '{print $1}')
43
+ SUBCOMMAND=$(echo "$ARGUMENTS" | awk '{print $2}')
44
+
45
+ echo "Feature: $FEATURE_NAME"
46
+ echo "Subcommand: $SUBCOMMAND"
47
+ ```
48
+
49
+ **If no feature name:**
50
+ ```
51
+ Please provide a feature name: /specd:blueprint {feature-name}
52
+ ```
53
+
54
+ Continue to validate.
55
+ </step>
56
+
57
+ <step name="validate">
58
+ Check feature exists and has required files.
59
+
60
+ ```bash
61
+ # Check feature directory exists
62
+ [ -d ".specd/features/$FEATURE_NAME" ] || { echo "not found"; exit 1; }
63
+
64
+ # Check required files
65
+ [ -f ".specd/features/$FEATURE_NAME/FEATURE.md" ] || { echo "missing FEATURE.md"; exit 1; }
66
+ [ -f ".specd/features/$FEATURE_NAME/CONTEXT.md" ] || { echo "missing CONTEXT.md"; exit 1; }
67
+ [ -f ".specd/features/$FEATURE_NAME/DECISIONS.md" ] || { echo "missing DECISIONS.md"; exit 1; }
68
+
69
+ # Check optional files
70
+ [ -d ".specd/features/$FEATURE_NAME/plans" ] && echo "has_plans"
71
+ [ -f ".specd/features/$FEATURE_NAME/blueprint/wireframes.html" ] && echo "has_wireframes"
72
+ [ -f ".specd/features/$FEATURE_NAME/blueprint/diagrams.html" ] && echo "has_diagrams"
73
+ ```
74
+
75
+ **If feature not found:**
76
+ ```
77
+ Feature '{name}' not found.
78
+
79
+ Run /specd:feature:new {name} to create it first.
80
+ ```
81
+
82
+ Continue to load_context.
83
+ </step>
84
+
85
+ <step name="load_context">
86
+ Read all feature files.
87
+
88
+ **Read with Read tool:**
89
+ - `.specd/features/{name}/FEATURE.md`
90
+ - `.specd/features/{name}/CONTEXT.md`
91
+ - `.specd/features/{name}/DECISIONS.md`
92
+ - `.specd/features/{name}/STATE.md` (for stats)
93
+ - `.specd/features/{name}/config.json` (for counts)
94
+
95
+ **If plans/ exists:**
96
+ - List all plan files: `.specd/features/{name}/plans/phase-*/`
97
+ - Read ROADMAP.md if exists
98
+
99
+ Continue to parse_decisions.
100
+ </step>
101
+
102
+ <step name="parse_decisions">
103
+ Parse DECISIONS.md to extract decision data.
104
+
105
+ **Parsing strategy:**
106
+ 1. Split content on `### DEC-` to find decision blocks
107
+ 2. For each block:
108
+ - Extract ID from heading: `### DEC-XXX: Title`
109
+ - Parse `**Date:**` line for date
110
+ - Parse `**Phase:**` line for phase number (default: 0 if missing)
111
+ - Parse `**Status:**` line for status
112
+ - Parse `**Context:**` for context (may be multi-line)
113
+ - Parse `**Decision:**` for decision text
114
+ - Parse `**Rationale:**` for bullet points
115
+ - Parse `**Implications:**` for bullet points
116
+
117
+ **Output format (for each decision):**
118
+ ```
119
+ {
120
+ id: "DEC-001",
121
+ title: "Decision title",
122
+ date: "2026-02-04",
123
+ phase: 0,
124
+ status: "Active",
125
+ context: "Context text...",
126
+ decision: "Decision text...",
127
+ rationale: ["Reason 1", "Reason 2"],
128
+ implications: ["Implication 1", "Implication 2"]
129
+ }
130
+ ```
131
+
132
+ **Edge cases:**
133
+ - Missing Phase field → default to 0 (pre-planning)
134
+ - Phase: 0 → label as "Pre-planning"
135
+ - Missing fields → use empty string or "Unknown"
136
+ - Multi-line values → collect until next `**Field:**`
137
+ - Code blocks → skip parsing inside triple backticks
138
+
139
+ **Collect unique phases** from all decisions (sorted numerically) for phase tab generation.
140
+
141
+ Continue to parse_context.
142
+ </step>
143
+
144
+ <step name="parse_context">
145
+ Parse CONTEXT.md to extract resolved questions.
146
+
147
+ **Parsing strategy:**
148
+ 1. Find `## Resolved Questions` section
149
+ 2. Split on `### ` to find question blocks
150
+ 3. For each question:
151
+ - Extract title from heading
152
+ - Parse `**Question:**` for the question
153
+ - Parse `**Resolution:**` for the answer
154
+ - Parse `**Details:**` for bullet points
155
+ - Parse `**Related Decisions:**` for decision references (e.g., "DEC-001")
156
+
157
+ **Associate with phase:**
158
+ - Check `**Related Decisions:** DEC-XXX` field
159
+ - Look up the phase of the referenced decision (from parsed decisions)
160
+ - If no related decision, use phase 0
161
+
162
+ **Output format:**
163
+ ```
164
+ {
165
+ title: "Question title",
166
+ question: "What was unclear?",
167
+ resolution: "The answer",
168
+ details: ["Detail 1", "Detail 2"],
169
+ relatedDecisions: ["DEC-001"],
170
+ phase: 0
171
+ }
172
+ ```
173
+
174
+ Continue to parse_feature.
175
+ </step>
176
+
177
+ <step name="parse_feature">
178
+ Parse FEATURE.md to extract overview and stats.
179
+
180
+ **Extract:**
181
+ - `## What This Is` section → feature description
182
+ - Count items in `### Must Create` → files to create count
183
+ - `## Success Criteria` items → for progress indicators
184
+
185
+ **From config.json:**
186
+ - `discussion_sessions` count
187
+ - `decisions_count`
188
+
189
+ **From plans/:**
190
+ - Count phase directories
191
+ - Count plan files
192
+
193
+ Continue to generate_html.
194
+ </step>
195
+
196
+ <step name="generate_html">
197
+ Generate the HTML by filling in the template.
198
+
199
+ **Read templates:**
200
+ - `~/.claude/specdacular/templates/blueprint/index.html`
201
+ - `~/.claude/specdacular/templates/blueprint/styles.css`
202
+ - `~/.claude/specdacular/templates/blueprint/scripts.js`
203
+
204
+ **Replace placeholders:**
205
+ - `{feature-name}` → Feature name
206
+ - `{date}` → Current date (YYYY-MM-DD)
207
+ - `{feature-description}` → From FEATURE.md "What This Is"
208
+ - `{decisions-count}` → Number of decisions
209
+ - `{sessions-count}` → Number of discussion sessions
210
+ - `{plans-count}` → Number of plans
211
+ - `{styles}` → Contents of styles.css
212
+ - `{scripts}` → Contents of scripts.js
213
+
214
+ **Generate phase tabs HTML:**
215
+ Collect unique phases from decisions (sorted numerically).
216
+ For each section (Decisions, Context), generate:
217
+
218
+ ```html
219
+ <button class="phase-tab all-tab active" data-phase="all">All</button>
220
+ <button class="phase-tab" data-phase="0">Pre-planning</button>
221
+ <button class="phase-tab" data-phase="1">Phase 1</button>
222
+ <button class="phase-tab" data-phase="2">Phase 2</button>
223
+ <!-- ... for each phase found -->
224
+ ```
225
+
226
+ **Replace placeholders:**
227
+ - `{decisions-phase-tabs}` → Generated phase tabs for decisions
228
+ - `{context-phase-tabs}` → Generated phase tabs for context
229
+ - `{plans-phase-tabs}` → Generated phase tabs for plans (no "All" tab needed, use phase numbers only)
230
+
231
+ **Generate decisions HTML:**
232
+ Group decisions by phase, wrap each group in a phase-content div:
233
+ ```html
234
+ <div class="phase-content active" data-phase="0">
235
+ <!-- Pre-planning decisions -->
236
+ <details class="decision-item">
237
+ <summary class="decision-header">
238
+ <span class="decision-id">{id}</span>
239
+ <span class="decision-title">{title}</span>
240
+ <span class="decision-status status-{status-lower}">{status}</span>
241
+ <span class="decision-date">{date}</span>
242
+ </summary>
243
+ <div class="decision-content">
244
+ <p><strong>Context:</strong> {context}</p>
245
+ <p><strong>Decision:</strong> {decision}</p>
246
+ <p><strong>Rationale:</strong></p>
247
+ <ul>{rationale-items}</ul>
248
+ <p><strong>Implications:</strong></p>
249
+ <ul>{implication-items}</ul>
250
+ </div>
251
+ </details>
252
+ </div>
253
+ <div class="phase-content active" data-phase="1">
254
+ <!-- Phase 1 decisions -->
255
+ </div>
256
+ ```
257
+
258
+ All phase-content divs start with `active` class so "All" tab shows everything by default.
259
+
260
+ **Generate context HTML:**
261
+ For each resolved question, associate with a phase via `**Related Decisions:** DEC-XXX` field:
262
+ - Look up the phase of the referenced decision
263
+ - If no related decision, use phase 0
264
+ - Wrap context items in phase-content divs (same pattern as decisions)
265
+
266
+ **Generate plans HTML:**
267
+ Plans are already grouped by phase directory. Wrap each phase in a phase-content div:
268
+ ```html
269
+ <div class="phase-content active" data-phase="1">
270
+ <div class="phase-group">
271
+ <div class="phase-header">Phase 1: {title}</div>
272
+ <div class="plan-item">...</div>
273
+ </div>
274
+ </div>
275
+ <div class="phase-content active" data-phase="2">
276
+ <div class="phase-group">
277
+ <div class="phase-header">Phase 2: {title}</div>
278
+ <div class="plan-item">...</div>
279
+ </div>
280
+ </div>
281
+ ```
282
+
283
+ **Generate timeline HTML:**
284
+ Combine decision dates and discussion session dates into chronological timeline.
285
+
286
+ **Tab states:**
287
+ - `{wireframes-disabled}` → "disabled" if no wireframes, empty if exists
288
+ - `{diagrams-disabled}` → "disabled" if no diagrams, empty if exists
289
+
290
+ **HTML-escape all content:**
291
+ ```javascript
292
+ text.replace(/&/g, '&amp;')
293
+ .replace(/</g, '&lt;')
294
+ .replace(/>/g, '&gt;')
295
+ .replace(/"/g, '&quot;')
296
+ ```
297
+
298
+ Continue to write_output.
299
+ </step>
300
+
301
+ <step name="write_output">
302
+ Write the generated HTML to the blueprint directory.
303
+
304
+ ```bash
305
+ # Create blueprint directory
306
+ mkdir -p ".specd/features/$FEATURE_NAME/blueprint"
307
+ ```
308
+
309
+ **Write file:**
310
+ Use Write tool to create `.specd/features/{name}/blueprint/index.html`
311
+ with the generated HTML content.
312
+
313
+ Continue to open_browser.
314
+ </step>
315
+
316
+ <step name="open_browser">
317
+ Open the blueprint in the default browser.
318
+
319
+ ```bash
320
+ open ".specd/features/$FEATURE_NAME/blueprint/index.html"
321
+ ```
322
+
323
+ **Present completion:**
324
+ ```
325
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
326
+ BLUEPRINT GENERATED
327
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
328
+
329
+ **Feature:** {feature-name}
330
+
331
+ ## Stats
332
+ - {N} decisions
333
+ - {N} discussion sessions
334
+ - {N} plans
335
+
336
+ ## Tabs
337
+ - Overview ✓
338
+ - Decisions ✓
339
+ - Context ✓
340
+ - Plans {✓ or ✗}
341
+ - Wireframes {✓ or "not generated"}
342
+ - Diagrams {✓ or "not generated"}
343
+
344
+ **File:** `.specd/features/{name}/blueprint/index.html`
345
+
346
+ ───────────────────────────────────────────────────────
347
+
348
+ ## To Update
349
+
350
+ Run `/specd:blueprint {name}` again to regenerate.
351
+
352
+ ## To Add Wireframes
353
+
354
+ Run `/specd:blueprint {name} wireframes`
355
+
356
+ ## To Add Diagrams
357
+
358
+ Run `/specd:blueprint {name} diagrams`
359
+ ```
360
+
361
+ End workflow.
362
+ </step>
363
+
364
+ </process>
365
+
366
+ <success_criteria>
367
+ - [ ] Feature validated
368
+ - [ ] All files read and parsed
369
+ - [ ] HTML generated with all content embedded
370
+ - [ ] Output written to `.specd/features/{name}/blueprint/index.html`
371
+ - [ ] Browser opens with the blueprint
372
+ </success_criteria>
@@ -63,7 +63,7 @@ Validate feature exists and has required files.
63
63
  ```
64
64
  Feature '{name}' not found.
65
65
 
66
- Did you mean to run /specd:new-feature {name} first?
66
+ Did you mean to run /specd:feature:new {name} first?
67
67
  ```
68
68
 
69
69
  Continue to load_context.
@@ -358,13 +358,13 @@ Present session summary and next options.
358
358
 
359
359
  ## What's Next
360
360
 
361
- **/specd:discuss-feature {feature-name}** — Continue discussing
361
+ **/specd:feature:discuss {feature-name}** — Continue discussing
362
362
  {Recommended if gray areas remain}
363
363
 
364
- **/specd:research-feature {feature-name}** — Research implementation
364
+ **/specd:feature:research {feature-name}** — Research implementation
365
365
  {Recommended if technical questions need investigation}
366
366
 
367
- **/specd:plan-feature {feature-name}** — Create executable plans
367
+ **/specd:feature:plan {feature-name}** — Create roadmap with phase overview
368
368
  {Recommended when discussion is sufficient}
369
369
 
370
370
  Or just **keep talking** — this conversation continues naturally.
@@ -64,14 +64,14 @@ Validate feature exists and has plans.
64
64
  ```
65
65
  Feature '{name}' not found.
66
66
 
67
- Run /specd:new-feature {name} to create it.
67
+ Run /specd:feature:new {name} to create it.
68
68
  ```
69
69
 
70
70
  **If no plans:**
71
71
  ```
72
72
  Feature '{name}' has no plans yet.
73
73
 
74
- Run /specd:plan-feature {name} to create plans.
74
+ Run /specd:feature:plan {name} to create a roadmap, then /specd:phase:plan {name} {N} to create plans.
75
75
  ```
76
76
 
77
77
  Continue to load_context.
@@ -101,7 +101,7 @@ Load ALL context needed for execution.
101
101
  - Which phase we're in
102
102
  - Key decisions affecting implementation
103
103
  - Patterns to follow
104
- - Phase-specific context and research (if discuss-phase/research-phase were run)
104
+ - Phase-specific context and research (if phase:prepare/phase:research were run)
105
105
 
106
106
  Continue to find_plan.
107
107
  </step>
@@ -383,7 +383,7 @@ git commit -m "docs({feature}): complete plan {phase-XX/YY}"
383
383
  **Next plan:** {path or "None - all plans complete"}
384
384
 
385
385
  {If next plan exists:}
386
- Run `/specd:execute-plan {feature}` to continue.
386
+ Run `/specd:phase:execute {feature}` to continue.
387
387
 
388
388
  {If all complete:}
389
389
  All plans complete! Feature '{feature}' is implemented.
@@ -0,0 +1,222 @@
1
+ <purpose>
2
+ Insert a new phase after an existing one using decimal numbering (e.g., Phase 03.1).
3
+
4
+ **Key principles:**
5
+ - Decimal numbering preserves existing phase sequence
6
+ - Never renumber existing phases — that's what renumber-phases is for
7
+ - Create directory structure but don't create plans — user decides how to plan
8
+ - Mark inserted phases with `(INSERTED)` in ROADMAP.md
9
+
10
+ **Output:** New phase directory, updated ROADMAP.md, STATE.md, config.json
11
+ </purpose>
12
+
13
+ <process>
14
+
15
+ <step name="parse_arguments">
16
+ Parse the command arguments:
17
+ - First argument: feature name
18
+ - Second argument: integer phase number to insert after
19
+ - Remaining arguments: phase description
20
+
21
+ Example: `/specd:phase:insert visual-blueprint-tool 3 Architecture Update`
22
+ → feature = "visual-blueprint-tool"
23
+ → after = 3
24
+ → description = "Architecture Update"
25
+
26
+ **Validation:**
27
+ - All three parts are required (feature, phase number, description)
28
+ - Phase number must be a positive integer
29
+ - Cannot insert before Phase 1 (no Phase 0.x)
30
+
31
+ **If arguments missing:**
32
+ ```
33
+ ERROR: Missing arguments.
34
+
35
+ Usage: /specd:phase:insert [feature-name] [after-phase] [description...]
36
+ Example: /specd:phase:insert visual-blueprint-tool 3 Architecture Update
37
+ ```
38
+ </step>
39
+
40
+ <step name="validate">
41
+ Validate the feature and target phase exist.
42
+
43
+ 1. Check feature directory exists:
44
+ ```bash
45
+ [ -d ".specd/features/$feature" ] || { echo "Feature not found"; exit 1; }
46
+ ```
47
+
48
+ 2. Check ROADMAP.md exists:
49
+ ```bash
50
+ [ -f ".specd/features/$feature/ROADMAP.md" ] || { echo "No ROADMAP.md"; exit 1; }
51
+ ```
52
+
53
+ 3. Check target phase exists in ROADMAP.md:
54
+ - Search for phase heading matching the target number (e.g., `## Phase 3:` or `### Phase 3:`)
55
+ - If not found, list available phases and exit
56
+
57
+ 4. Check config.json exists:
58
+ ```bash
59
+ [ -f ".specd/features/$feature/config.json" ] || { echo "No config.json"; exit 1; }
60
+ ```
61
+
62
+ **If feature not found:**
63
+ ```
64
+ Feature '{name}' not found.
65
+
66
+ Available features:
67
+ {list .specd/features/*/}
68
+
69
+ Run /specd:feature:new {name} to create it.
70
+ ```
71
+
72
+ **If target phase not found:**
73
+ ```
74
+ Phase {N} not found in ROADMAP.md.
75
+
76
+ Available phases: {list phase numbers from ROADMAP.md}
77
+ ```
78
+ </step>
79
+
80
+ <step name="find_next_decimal">
81
+ Scan for existing decimal phases after the target phase.
82
+
83
+ 1. List all `phase-*` directories under `plans/`:
84
+ ```bash
85
+ ls -d .specd/features/$feature/plans/phase-* 2>/dev/null
86
+ ```
87
+
88
+ 2. Filter for directories matching `phase-{NN}.{M}` where NN matches the target phase (zero-padded to 2 digits):
89
+ - Format target phase as two digits: `printf "%02d" $after_phase`
90
+ - Look for `phase-{NN}.1/`, `phase-{NN}.2/`, etc.
91
+
92
+ 3. Find the highest existing decimal suffix M
93
+
94
+ 4. Calculate next decimal: M + 1 (or 1 if no decimals exist)
95
+
96
+ Examples:
97
+ - Phase 03 with no decimals → next is 03.1
98
+ - Phase 03 with 03.1 → next is 03.2
99
+ - Phase 03 with 03.1, 03.2 → next is 03.3
100
+
101
+ Store the new phase number as: `new_phase = "{NN}.{next_decimal}"`
102
+ (e.g., "03.1")
103
+ </step>
104
+
105
+ <step name="create_phase_directory">
106
+ Create the phase directory under the feature's plans folder.
107
+
108
+ ```bash
109
+ mkdir -p ".specd/features/$feature/plans/phase-${new_phase}"
110
+ ```
111
+
112
+ Confirm: "Created directory: plans/phase-{new_phase}/"
113
+ </step>
114
+
115
+ <step name="update_roadmap">
116
+ Insert the new phase into ROADMAP.md immediately after the target phase's section.
117
+
118
+ 1. Read ROADMAP.md
119
+ 2. Find the target phase section (heading and all content until the next phase heading)
120
+ 3. Insert new phase section after the target phase's content:
121
+
122
+ ```markdown
123
+ ## Phase {new_phase}: {Description} (INSERTED)
124
+
125
+ **Goal:** {Description}
126
+ **Plans:** TBD — discuss and plan this phase
127
+
128
+ - [ ] Phase {new_phase} plans created
129
+ ```
130
+
131
+ 4. Write updated ROADMAP.md
132
+
133
+ **Important:**
134
+ - Preserve all existing content exactly (formatting, spacing, other phases)
135
+ - The `(INSERTED)` marker identifies decimal phases as mid-flight insertions
136
+ - Don't modify the target phase content
137
+ - Insert before the next integer phase heading
138
+ </step>
139
+
140
+ <step name="update_state">
141
+ Update STATE.md with the insertion.
142
+
143
+ 1. Read STATE.md
144
+
145
+ 2. Add roadmap evolution note. Find or create "### Roadmap Evolution" section under accumulated context:
146
+ ```markdown
147
+ - Phase {new_phase} inserted after Phase {after_phase}: {description}
148
+ ```
149
+
150
+ 3. Add the new phase to the execution tracking section. Find the phase completion checkboxes and insert the new phase after the target phase:
151
+ ```markdown
152
+ - [ ] Phase {new_phase} complete
153
+ ```
154
+
155
+ Insert this line after `Phase {after_phase}` checkbox and before `Phase {after_phase + 1}` checkbox.
156
+
157
+ 4. Write updated STATE.md
158
+ </step>
159
+
160
+ <step name="update_config">
161
+ Update config.json to reflect the new phase count.
162
+
163
+ 1. Read config.json
164
+ 2. Increment `phases_count` by 1
165
+ 3. Write updated config.json
166
+ </step>
167
+
168
+ <step name="completion">
169
+ Present completion summary:
170
+
171
+ ```
172
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
173
+ PHASE INSERTED
174
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
175
+
176
+ **Phase {new_phase}: {description}**
177
+ - Directory: plans/phase-{new_phase}/
178
+ - Inserted after: Phase {after_phase}
179
+ - Marker: (INSERTED)
180
+
181
+ **Updated:**
182
+ - ROADMAP.md — New phase section added
183
+ - STATE.md — Evolution note + unchecked checkbox
184
+ - config.json — phases_count incremented
185
+
186
+ ───────────────────────────────────────────────────────
187
+
188
+ ## Next Steps
189
+
190
+ - `/specd:phase:prepare {feature} {new_phase}` — Discuss + optionally research the new phase
191
+ - `/specd:phase:plan {feature} {new_phase}` — Create detailed plans for the phase
192
+ - `/specd:phase:execute {feature}` — Execute when plans exist
193
+ - `/specd:phase:renumber {feature}` — Clean up to integer sequence when ready
194
+ ```
195
+
196
+ End workflow.
197
+ </step>
198
+
199
+ </process>
200
+
201
+ <anti_patterns>
202
+ - Don't insert before Phase 1 (Phase 0.x makes no sense)
203
+ - Don't renumber existing phases (that's /specd:phase:renumber)
204
+ - Don't modify the target phase content
205
+ - Don't create plans yet — user decides how to plan (discuss, research, or manual)
206
+ - Don't commit changes — user decides when to commit
207
+ </anti_patterns>
208
+
209
+ <success_criteria>
210
+ Phase insertion is complete when:
211
+
212
+ - [ ] Arguments parsed: feature name, after-phase number, description
213
+ - [ ] Feature validated: exists with ROADMAP.md
214
+ - [ ] Target phase validated: exists in ROADMAP.md
215
+ - [ ] Decimal number calculated correctly (based on existing decimals)
216
+ - [ ] Phase directory created: `plans/phase-{NN.M}/`
217
+ - [ ] ROADMAP.md updated with new phase entry (includes `(INSERTED)` marker)
218
+ - [ ] Phase inserted in correct position (after target phase, before next integer phase)
219
+ - [ ] STATE.md updated with roadmap evolution note and unchecked checkbox
220
+ - [ ] config.json `phases_count` incremented
221
+ - [ ] User informed of next steps
222
+ </success_criteria>
@@ -67,7 +67,7 @@ Use AskUserQuestion:
67
67
  - header: "Feature Exists"
68
68
  - question: "Feature '{name}' already exists. What would you like to do?"
69
69
  - options:
70
- - "Resume" — Continue with existing feature (suggest /specd:discuss-feature)
70
+ - "Resume" — Continue with existing feature (suggest /specd:feature:discuss)
71
71
  - "Reset" — Delete and start fresh
72
72
  - "Different name" — Use a different name
73
73
 
@@ -164,7 +164,7 @@ Does that capture it, or should we dig into anything more?
164
164
  **When to move on:**
165
165
  - User confirms understanding is correct
166
166
  - You have enough for initial FEATURE.md
167
- - Further details can be discussed later with /specd:discuss-feature
167
+ - Further details can be discussed later with /specd:feature:discuss
168
168
 
169
169
  Continue to write_feature.
170
170
  </step>
@@ -322,13 +322,13 @@ Present what was created and next options.
322
322
 
323
323
  You control the rhythm. Options:
324
324
 
325
- **/specd:discuss-feature {feature-name}** — Dive deeper into specific areas
325
+ **/specd:feature:discuss {feature-name}** — Dive deeper into specific areas
326
326
  {Suggested if gray areas remain}
327
327
 
328
- **/specd:research-feature {feature-name}** — Research implementation approach
328
+ **/specd:feature:research {feature-name}** — Research implementation approach
329
329
  {Suggested if technology choices are unclear}
330
330
 
331
- **/specd:plan-feature {feature-name}** — Create executable task plans
331
+ **/specd:feature:plan {feature-name}** — Create roadmap with phase overview
332
332
  {Only when discussion + research are sufficient}
333
333
 
334
334
  Or just **keep talking** — this conversation continues naturally.