dflow-sdd-ddd 0.12.0 → 0.13.0

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 (38) hide show
  1. package/CHANGELOG.md +91 -0
  2. package/README.en.md +83 -17
  3. package/README.md +39 -9
  4. package/TEMPLATE-COVERAGE.md +1 -0
  5. package/bin/dflow.js +58 -2
  6. package/docs/evaluating-dflow.en.md +21 -2
  7. package/docs/evaluating-dflow.md +17 -3
  8. package/docs/using-with-claude-code.en.md +23 -16
  9. package/docs/using-with-claude-code.md +20 -14
  10. package/docs/using-with-codex.en.md +15 -8
  11. package/docs/using-with-codex.md +10 -7
  12. package/docs/using-with-github-copilot.en.md +8 -3
  13. package/docs/using-with-github-copilot.md +6 -3
  14. package/lib/init.js +93 -8
  15. package/lib/render.js +1263 -0
  16. package/package.json +5 -2
  17. package/templates/brownfield/references/init-project-flow.md +43 -1
  18. package/templates/brownfield/scaffolding/AI-AGENT-GUIDE.md +5 -0
  19. package/templates/brownfield/templates/_index.md +2 -0
  20. package/templates/brownfield/templates/context-definition.md +2 -0
  21. package/templates/brownfield/templates/context-map.md +1 -0
  22. package/templates/brownfield/templates/glossary.md +1 -0
  23. package/templates/brownfield/templates/models.md +1 -0
  24. package/templates/brownfield/templates/phase-spec.md +2 -0
  25. package/templates/brownfield/templates/rules.md +1 -0
  26. package/templates/brownfield/templates/tech-debt.md +1 -0
  27. package/templates/greenfield/references/init-project-flow.md +43 -1
  28. package/templates/greenfield/scaffolding/AI-AGENT-GUIDE.md +5 -0
  29. package/templates/greenfield/templates/_index.md +2 -0
  30. package/templates/greenfield/templates/aggregate-design.md +2 -0
  31. package/templates/greenfield/templates/context-definition.md +2 -0
  32. package/templates/greenfield/templates/context-map.md +1 -0
  33. package/templates/greenfield/templates/events.md +1 -0
  34. package/templates/greenfield/templates/glossary.md +1 -0
  35. package/templates/greenfield/templates/models.md +1 -0
  36. package/templates/greenfield/templates/phase-spec.md +2 -0
  37. package/templates/greenfield/templates/rules.md +1 -0
  38. package/templates/greenfield/templates/tech-debt.md +1 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dflow-sdd-ddd",
3
- "version": "0.12.0",
3
+ "version": "0.13.0",
4
4
  "description": "Spec-first SDD/DDD workflow kit for AI-assisted development",
5
5
  "type": "commonjs",
6
6
  "bin": {
@@ -39,10 +39,13 @@
39
39
  },
40
40
  "homepage": "https://github.com/weilung/dflow-sdd-ddd#readme",
41
41
  "scripts": {
42
- "test": "node test/smoke.mjs && node test/registry-parity.mjs && node test/agent-inject.mjs && node test/bundle-guards.mjs"
42
+ "test": "node test/smoke.mjs && node test/skill-default.mjs && node test/registry-parity.mjs && node test/agent-inject.mjs && node test/bundle-guards.mjs && node test/render.mjs"
43
43
  },
44
44
  "license": "AGPL-3.0-or-later",
45
45
  "publishConfig": {
46
46
  "access": "public"
47
+ },
48
+ "dependencies": {
49
+ "marked": "18.0.5"
47
50
  }
48
51
  }
@@ -167,6 +167,32 @@ Wait for answers.
167
167
  > and refreshes it in place on re-run. Merge snippets under
168
168
  > `dflow/specs/shared/` are used only if Dflow markers conflict."
169
169
 
170
+ Wait for answers.
171
+
172
+ ### Q9. Project-level skill (agent-gated, default yes)
173
+
174
+ Asked only when Q8 selected at least one agent — with no agents there is no
175
+ projection target and this question is skipped entirely.
176
+
177
+ > "Install the project-level Dflow skill for natural-language auto-trigger?
178
+ > (Y/n)
179
+ >
180
+ > The skill is what makes requests like 'I want to add a feature' surface the
181
+ > matching workflow automatically; without it, triggering relies on the
182
+ > instruction files alone and degrades in long sessions. Skill files are
183
+ > Dflow-generated derivatives — the recommended default is to gitignore them
184
+ > and re-project after cloning."
185
+
186
+ Wait for the answer. **Blank defaults to yes.** On `n`, tell the developer:
187
+
188
+ > "Skipped the project-level skill; add it later with
189
+ > `dflow configure-agents --skills`."
190
+
191
+ CLI note: the CLI asks this question only on an interactive terminal. A
192
+ non-interactive (piped) `dflow init` never reads an extra stdin answer for it
193
+ — existing scripted answer sequences keep their structure and keep working —
194
+ and installs the skill for the selected agents by default.
195
+
170
196
  **→ Transition (step-internal)**: Step 2 complete. Announce
171
197
  > "Step 2 complete (project information captured). Entering Step 3:
172
198
  > File-list preview."
@@ -274,7 +300,7 @@ skip, and wait for developer confirmation:
274
300
  **→ Step Gate: Step 3 → Step 4**
275
301
 
276
302
  Wait for explicit confirmation. If the developer asks to change the
277
- selection, go back to the relevant Step 2 question (Q5–Q8) and re-run Step 3.
303
+ selection, go back to the relevant Step 2 question (Q5–Q9) and re-run Step 3.
278
304
 
279
305
  ---
280
306
 
@@ -346,6 +372,22 @@ For each selected tool-specific file (`AGENTS.md`, `CLAUDE.md`,
346
372
  in the preview, and refresh that same block on re-run. If the developer later
347
373
  deletes the block, a later `init` / `configure-agents` run appends it again
348
374
 
375
+ If the developer chose to install the project-level skill (Q9), the CLI also
376
+ creates the skill file for each selected tool at its native project-level
377
+ path:
378
+
379
+ - `.claude/skills/dflow/SKILL.md` — Claude Code
380
+ - `.agents/skills/dflow/SKILL.md` — Codex
381
+ - `.github/skills/dflow/SKILL.md` — GitHub Copilot
382
+
383
+ All three are the same edition-neutral thin skill projected from the single
384
+ canonical source in the npm package. An existing file at one of those paths
385
+ that is **not** Dflow-generated (missing the
386
+ `<!-- dflow-generated: skill-adapter -->` marker) is left unchanged with a
387
+ warning. Manual AI fallback (no npm available): do **not** hand-write SKILL.md
388
+ content — report that the skill install is deferred and the developer should
389
+ run `dflow configure-agents --skills` once npm is available.
390
+
349
391
  ### 4.4 Directory-only entries
350
392
 
351
393
  For directories that Git otherwise wouldn't track (empty `active/` /
@@ -108,6 +108,11 @@ input like this (supporting files live in the workflow bundle at
108
108
  is written with Greenfield artifact names; see its **Edition note** for where
109
109
  Brownfield records the same decisions (`models.md` / `rules.md` /
110
110
  `behavior.md` / `migration/tech-debt.md`).
111
+ - **"Turn the specs into HTML" / "make the specs easier to read"** → run the
112
+ CLI command `dflow render` (a human-readability tool, not a `/dflow:*`
113
+ workflow). It mirrors `dflow/specs/` into a browsable static HTML tree
114
+ (default output: `dflow-specs-html/`); re-run it after specs change —
115
+ Markdown stays the AI-facing source of truth.
111
116
  - **"Dflow seems wrong" / "this template is confusing"** (or you notice Dflow
112
117
  guidance drift) → suggest `/dflow:report-dflow-feedback`; never submit
113
118
  anything upstream automatically.
@@ -39,6 +39,8 @@ Template note (for AI):
39
39
  initial BR Snapshot + Resume Pointer. The other sections can stay empty.
40
40
  -->
41
41
 
42
+ <!-- Formatting convention: keep table cells concise. When one cell holds multiple short items (invariants, rules, steps), separate them with <br> so each renders on its own line - never chain them into one line with ;/; separators. Long narrative detail does not belong in a table cell: keep the cell to a concise summary and put extended detail in an existing section of this document when one fits, or give each item its own row. -->
43
+
42
44
  # {Feature Title}
43
45
 
44
46
  ## Goals & Scope
@@ -5,6 +5,8 @@ owner: {負責的開發者或團隊}
5
5
  created: {YYYY-MM-DD}
6
6
  ---
7
7
 
8
+ <!-- Formatting convention: keep table cells concise. When one cell holds multiple short items (invariants, rules, steps), separate them with <br> so each renders on its own line - never chain them into one line with ;/; separators. Long narrative detail does not belong in a table cell: keep the cell to a concise summary and put extended detail in an existing section of this document when one fits, or give each item its own row. -->
9
+
8
10
  # {ContextName} Bounded Context
9
11
 
10
12
  ## Responsibilities
@@ -1,4 +1,5 @@
1
1
  <!-- Seeded by Dflow. -->
2
+ <!-- Formatting convention: keep table cells concise. When one cell holds multiple short items (invariants, rules, steps), separate them with <br> so each renders on its own line - never chain them into one line with ;/; separators. Long narrative detail does not belong in a table cell: keep the cell to a concise summary and put extended detail in an existing section of this document when one fits, or give each item its own row. -->
2
3
 
3
4
  # Context Map
4
5
 
@@ -1,4 +1,5 @@
1
1
  <!-- Seeded by Dflow. -->
2
+ <!-- Formatting convention: keep table cells concise. When one cell holds multiple short items (invariants, rules, steps), separate them with <br> so each renders on its own line - never chain them into one line with ;/; separators. Long narrative detail does not belong in a table cell: keep the cell to a concise summary and put extended detail in an existing section of this document when one fits, or give each item its own row. -->
2
3
 
3
4
  # Glossary
4
5
 
@@ -1,4 +1,5 @@
1
1
  <!-- Seeded by Dflow. -->
2
+ <!-- Formatting convention: keep table cells concise. When one cell holds multiple short items (invariants, rules, steps), separate them with <br> so each renders on its own line - never chain them into one line with ;/; separators. Long narrative detail does not belong in a table cell: keep the cell to a concise summary and put extended detail in an existing section of this document when one fits, or give each item its own row. -->
2
3
 
3
4
  # Domain Models
4
5
 
@@ -8,6 +8,8 @@ author: {developer-name}
8
8
  branch: feature/{SPEC-ID}-{slug}
9
9
  ---
10
10
 
11
+ <!-- Formatting convention: keep table cells concise. When one cell holds multiple short items (invariants, rules, steps), separate them with <br> so each renders on its own line - never chain them into one line with ;/; separators. Long narrative detail does not belong in a table cell: keep the cell to a concise summary and put extended detail in an existing section of this document when one fits, or give each item its own row. -->
12
+
11
13
  # {Feature Title}
12
14
 
13
15
  <!--
@@ -1,4 +1,5 @@
1
1
  <!-- Seeded by Dflow. -->
2
+ <!-- Formatting convention: keep table cells concise. When one cell holds multiple short items (invariants, rules, steps), separate them with <br> so each renders on its own line - never chain them into one line with ;/; separators. Long narrative detail does not belong in a table cell: keep the cell to a concise summary and put extended detail in an existing section of this document when one fits, or give each item its own row. -->
2
3
 
3
4
  # Business Rules
4
5
 
@@ -1,4 +1,5 @@
1
1
  <!-- Seeded by Dflow. -->
2
+ <!-- Formatting convention: keep table cells concise. When one cell holds multiple short items (invariants, rules, steps), separate them with <br> so each renders on its own line - never chain them into one line with ;/; separators. Long narrative detail does not belong in a table cell: keep the cell to a concise summary and put extended detail in an existing section of this document when one fits, or give each item its own row. -->
2
3
 
3
4
  # Migration Tech Debt
4
5
 
@@ -178,6 +178,32 @@ Wait for answers.
178
178
  > and refreshes it in place on re-run. Merge snippets under
179
179
  > `dflow/specs/shared/` are used only if Dflow markers conflict."
180
180
 
181
+ Wait for answers.
182
+
183
+ ### Q9. Project-level skill (agent-gated, default yes)
184
+
185
+ Asked only when Q8 selected at least one agent — with no agents there is no
186
+ projection target and this question is skipped entirely.
187
+
188
+ > "Install the project-level Dflow skill for natural-language auto-trigger?
189
+ > (Y/n)
190
+ >
191
+ > The skill is what makes requests like 'I want to add a feature' surface the
192
+ > matching workflow automatically; without it, triggering relies on the
193
+ > instruction files alone and degrades in long sessions. Skill files are
194
+ > Dflow-generated derivatives — the recommended default is to gitignore them
195
+ > and re-project after cloning."
196
+
197
+ Wait for the answer. **Blank defaults to yes.** On `n`, tell the developer:
198
+
199
+ > "Skipped the project-level skill; add it later with
200
+ > `dflow configure-agents --skills`."
201
+
202
+ CLI note: the CLI asks this question only on an interactive terminal. A
203
+ non-interactive (piped) `dflow init` never reads an extra stdin answer for it
204
+ — existing scripted answer sequences keep their structure and keep working —
205
+ and installs the skill for the selected agents by default.
206
+
181
207
  **→ Transition (step-internal)**: Step 2 complete. Announce
182
208
  > "Step 2 complete (project information captured). Entering Step 3:
183
209
  > File-list preview."
@@ -293,7 +319,7 @@ skip, and wait for developer confirmation:
293
319
  **→ Step Gate: Step 3 → Step 4**
294
320
 
295
321
  Wait for explicit confirmation. If the developer asks to change the
296
- selection, go back to the relevant Step 2 question (Q5–Q8) and re-run Step 3.
322
+ selection, go back to the relevant Step 2 question (Q5–Q9) and re-run Step 3.
297
323
 
298
324
  ---
299
325
 
@@ -367,6 +393,22 @@ For each selected tool-specific file (`AGENTS.md`, `CLAUDE.md`,
367
393
  in the preview, and refresh that same block on re-run. If the developer later
368
394
  deletes the block, a later `init` / `configure-agents` run appends it again
369
395
 
396
+ If the developer chose to install the project-level skill (Q9), the CLI also
397
+ creates the skill file for each selected tool at its native project-level
398
+ path:
399
+
400
+ - `.claude/skills/dflow/SKILL.md` — Claude Code
401
+ - `.agents/skills/dflow/SKILL.md` — Codex
402
+ - `.github/skills/dflow/SKILL.md` — GitHub Copilot
403
+
404
+ All three are the same edition-neutral thin skill projected from the single
405
+ canonical source in the npm package. An existing file at one of those paths
406
+ that is **not** Dflow-generated (missing the
407
+ `<!-- dflow-generated: skill-adapter -->` marker) is left unchanged with a
408
+ warning. Manual AI fallback (no npm available): do **not** hand-write SKILL.md
409
+ content — report that the skill install is deferred and the developer should
410
+ run `dflow configure-agents --skills` once npm is available.
411
+
370
412
  ### 4.4 Directory-only entries
371
413
 
372
414
  For directories that Git otherwise wouldn't track (empty `active/` /
@@ -64,6 +64,11 @@ input like this (supporting files live in the workflow bundle at
64
64
  - **"Quick question about..." / "How does X work?"** → check
65
65
  `dflow/specs/domain/` first and answer from the documented domain knowledge.
66
66
  - **"I'm creating a branch"** → read `references/git-integration.md`.
67
+ - **"Turn the specs into HTML" / "make the specs easier to read"** → run the
68
+ CLI command `dflow render` (a human-readability tool, not a `/dflow:*`
69
+ workflow). It mirrors `dflow/specs/` into a browsable static HTML tree
70
+ (default output: `dflow-specs-html/`); re-run it after specs change —
71
+ Markdown stays the AI-facing source of truth.
67
72
  - **"Dflow seems wrong" / "this template is confusing"** (or you notice Dflow
68
73
  guidance drift) → suggest `/dflow:report-dflow-feedback`; never submit
69
74
  anything upstream automatically.
@@ -46,6 +46,8 @@ Template note (for AI):
46
46
  initial BR Snapshot + Resume Pointer. The other sections can stay empty.
47
47
  -->
48
48
 
49
+ <!-- Formatting convention: keep table cells concise. When one cell holds multiple short items (invariants, rules, steps), separate them with <br> so each renders on its own line - never chain them into one line with ;/; separators. Long narrative detail does not belong in a table cell: keep the cell to a concise summary and put extended detail in an existing section of this document when one fits, or give each item its own row. -->
50
+
49
51
  # {Feature Title}
50
52
 
51
53
  ## Goals & Scope
@@ -4,6 +4,8 @@ bounded-context: {ContextName}
4
4
  created: {YYYY-MM-DD}
5
5
  ---
6
6
 
7
+ <!-- Formatting convention: keep table cells concise. When one cell holds multiple short items (invariants, rules, steps), separate them with <br> so each renders on its own line - never chain them into one line with ;/; separators. Long narrative detail does not belong in a table cell: keep the cell to a concise summary and put extended detail in an existing section of this document when one fits, or give each item its own row. -->
8
+
7
9
  # {AggregateName} Aggregate
8
10
 
9
11
  ## Purpose
@@ -5,6 +5,8 @@ owner: {負責的開發者或團隊}
5
5
  created: {YYYY-MM-DD}
6
6
  ---
7
7
 
8
+ <!-- Formatting convention: keep table cells concise. When one cell holds multiple short items (invariants, rules, steps), separate them with <br> so each renders on its own line - never chain them into one line with ;/; separators. Long narrative detail does not belong in a table cell: keep the cell to a concise summary and put extended detail in an existing section of this document when one fits, or give each item its own row. -->
9
+
8
10
  # {ContextName} Bounded Context
9
11
 
10
12
  ## Responsibilities
@@ -1,4 +1,5 @@
1
1
  <!-- Seeded by Dflow. -->
2
+ <!-- Formatting convention: keep table cells concise. When one cell holds multiple short items (invariants, rules, steps), separate them with <br> so each renders on its own line - never chain them into one line with ;/; separators. Long narrative detail does not belong in a table cell: keep the cell to a concise summary and put extended detail in an existing section of this document when one fits, or give each item its own row. -->
2
3
 
3
4
  # Context Map
4
5
 
@@ -1,4 +1,5 @@
1
1
  <!-- Seeded by Dflow. -->
2
+ <!-- Formatting convention: keep table cells concise. When one cell holds multiple short items (invariants, rules, steps), separate them with <br> so each renders on its own line - never chain them into one line with ;/; separators. Long narrative detail does not belong in a table cell: keep the cell to a concise summary and put extended detail in an existing section of this document when one fits, or give each item its own row. -->
2
3
 
3
4
  # Domain Events
4
5
 
@@ -1,4 +1,5 @@
1
1
  <!-- Seeded by Dflow. -->
2
+ <!-- Formatting convention: keep table cells concise. When one cell holds multiple short items (invariants, rules, steps), separate them with <br> so each renders on its own line - never chain them into one line with ;/; separators. Long narrative detail does not belong in a table cell: keep the cell to a concise summary and put extended detail in an existing section of this document when one fits, or give each item its own row. -->
2
3
 
3
4
  # Glossary
4
5
 
@@ -1,4 +1,5 @@
1
1
  <!-- Seeded by Dflow. -->
2
+ <!-- Formatting convention: keep table cells concise. When one cell holds multiple short items (invariants, rules, steps), separate them with <br> so each renders on its own line - never chain them into one line with ;/; separators. Long narrative detail does not belong in a table cell: keep the cell to a concise summary and put extended detail in an existing section of this document when one fits, or give each item its own row. -->
2
3
 
3
4
  # Domain Models
4
5
 
@@ -8,6 +8,8 @@ author: {developer-name}
8
8
  branch: feature/{SPEC-ID}-{slug}
9
9
  ---
10
10
 
11
+ <!-- Formatting convention: keep table cells concise. When one cell holds multiple short items (invariants, rules, steps), separate them with <br> so each renders on its own line - never chain them into one line with ;/; separators. Long narrative detail does not belong in a table cell: keep the cell to a concise summary and put extended detail in an existing section of this document when one fits, or give each item its own row. -->
12
+
11
13
  # {功能標題}
12
14
 
13
15
  <!--
@@ -1,4 +1,5 @@
1
1
  <!-- Seeded by Dflow. -->
2
+ <!-- Formatting convention: keep table cells concise. When one cell holds multiple short items (invariants, rules, steps), separate them with <br> so each renders on its own line - never chain them into one line with ;/; separators. Long narrative detail does not belong in a table cell: keep the cell to a concise summary and put extended detail in an existing section of this document when one fits, or give each item its own row. -->
2
3
 
3
4
  # Business Rules
4
5
 
@@ -1,4 +1,5 @@
1
1
  <!-- Seeded by Dflow. -->
2
+ <!-- Formatting convention: keep table cells concise. When one cell holds multiple short items (invariants, rules, steps), separate them with <br> so each renders on its own line - never chain them into one line with ;/; separators. Long narrative detail does not belong in a table cell: keep the cell to a concise summary and put extended detail in an existing section of this document when one fits, or give each item its own row. -->
2
3
 
3
4
  # Architecture Tech Debt
4
5