create-specfuse 0.18.0 → 0.20.0-rc.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 (48) hide show
  1. package/README.md +80 -9
  2. package/dist/fuseqa/templates/_case-schema.yaml +6 -2
  3. package/dist/fuseqa/templates/ledger.md +9 -9
  4. package/dist/index.js +5 -1
  5. package/dist/index.js.map +1 -1
  6. package/dist/prompts.d.ts +2 -0
  7. package/dist/prompts.d.ts.map +1 -1
  8. package/dist/prompts.js +32 -2
  9. package/dist/prompts.js.map +1 -1
  10. package/dist/scaffolder.d.ts.map +1 -1
  11. package/dist/scaffolder.js +44 -1
  12. package/dist/scaffolder.js.map +1 -1
  13. package/dist/templates/beat-hook.d.ts +14 -0
  14. package/dist/templates/beat-hook.d.ts.map +1 -0
  15. package/dist/templates/beat-hook.js +57 -0
  16. package/dist/templates/beat-hook.js.map +1 -0
  17. package/dist/templates/claude-md.d.ts.map +1 -1
  18. package/dist/templates/claude-md.js +80 -7
  19. package/dist/templates/claude-md.js.map +1 -1
  20. package/dist/templates/fuseqa-skill.d.ts.map +1 -1
  21. package/dist/templates/fuseqa-skill.js +5 -0
  22. package/dist/templates/fuseqa-skill.js.map +1 -1
  23. package/dist/templates/openspec-config.d.ts.map +1 -1
  24. package/dist/templates/openspec-config.js +4 -0
  25. package/dist/templates/openspec-config.js.map +1 -1
  26. package/dist/templates/pipeline-records.d.ts +22 -0
  27. package/dist/templates/pipeline-records.d.ts.map +1 -0
  28. package/dist/templates/pipeline-records.js +84 -0
  29. package/dist/templates/pipeline-records.js.map +1 -0
  30. package/dist/templates/requirement-brief.d.ts +20 -0
  31. package/dist/templates/requirement-brief.d.ts.map +1 -0
  32. package/dist/templates/requirement-brief.js +131 -0
  33. package/dist/templates/requirement-brief.js.map +1 -0
  34. package/dist/templates/specfuse-command.d.ts +2 -19
  35. package/dist/templates/specfuse-command.d.ts.map +1 -1
  36. package/dist/templates/specfuse-command.js +251 -39
  37. package/dist/templates/specfuse-command.js.map +1 -1
  38. package/dist/templates/specfuse-flash-agent.d.ts +12 -0
  39. package/dist/templates/specfuse-flash-agent.d.ts.map +1 -0
  40. package/dist/templates/specfuse-flash-agent.js +73 -0
  41. package/dist/templates/specfuse-flash-agent.js.map +1 -0
  42. package/dist/templates/traceability.d.ts +29 -0
  43. package/dist/templates/traceability.d.ts.map +1 -0
  44. package/dist/templates/traceability.js +81 -0
  45. package/dist/templates/traceability.js.map +1 -0
  46. package/dist/types.d.ts +2 -0
  47. package/dist/types.d.ts.map +1 -1
  48. package/package.json +2 -2
@@ -1,3 +1,68 @@
1
+ /**
2
+ * Renders the unattended pipeline as Claude Code slash commands and as
3
+ * dsh-invocable skills.
4
+ *
5
+ * The pipeline is prose, not a runtime: every ordering rule below is enforced
6
+ * only by the model reading it. Keep clauses exact — the tests assert the
7
+ * sentences that carry each requirement, because a looser paraphrase can drop
8
+ * a prohibition (for example, "archive after verify" without "only when every
9
+ * check passes") while every keyword still appears.
10
+ *
11
+ * The unattended modes share the same automatic-decision policy, TDD rules, verify gate,
12
+ * and prohibitions. They differ only in the FuseQA posture, the execution
13
+ * order, the worktree phase list, and the completion report. The Claude and
14
+ * dsh variants differ only in their frontmatter, the way the requirement
15
+ * arrives, and the harness-specific skill and verify paths.
16
+ */
17
+ import { renderBeatHookRules } from './beat-hook.js';
18
+ import { renderReviewRecordRules, renderTestResultRules, } from './pipeline-records.js';
19
+ import { renderRequirementBriefRules, renderUnattendedBriefDecisions, } from './requirement-brief.js';
20
+ import { renderLedgerTracePointer, renderTaskTracePointer, renderTestTracePointer, renderTraceabilityRules, } from './traceability.js';
21
+ function beatHookBoundaries(mode) {
22
+ const flash = mode === 'flashmode';
23
+ const full = mode === 'full';
24
+ const applyBoundary = flash
25
+ ? 'Step 3 runs `post-apply` after the Do subagent returns.'
26
+ : 'Step 3 runs `post-apply` when every task passes.';
27
+ const verifyStep = full || flash ? 6 : 5;
28
+ const archiveStep = full || flash ? 7 : 6;
29
+ return `Boundaries in this pipeline:
30
+
31
+ - Step 1 runs \`pre-think\` after the change is created.
32
+ - Step 2 runs \`post-think\` after \`tasks.md\` is written.
33
+ - ${applyBoundary}
34
+ - Step 4 runs \`post-review\` when the review closes.
35
+ - Step ${verifyStep} runs \`pre-archive\` after every check passes and before archive.
36
+ - Step ${archiveStep} runs \`post-archive\` after a successful archive.`;
37
+ }
38
+ function beatHookSection(mode) {
39
+ return `## Beat hooks
40
+
41
+ ${renderBeatHookRules('unattended')}
42
+
43
+ ${beatHookBoundaries(mode)}`;
44
+ }
45
+ function pipelineRecordsSection() {
46
+ return `## Review record
47
+
48
+ ${renderReviewRecordRules()}
49
+
50
+ ## Test results
51
+
52
+ ${renderTestResultRules('unattended')}`;
53
+ }
54
+ function requirementBriefSection() {
55
+ return `## Requirement brief
56
+
57
+ ${renderRequirementBriefRules()}
58
+
59
+ ${renderUnattendedBriefDecisions()}`;
60
+ }
61
+ function traceabilitySection() {
62
+ return `## Traceability
63
+
64
+ ${renderTraceabilityRules()}`;
65
+ }
1
66
  function verifyStep(harness) {
2
67
  return harness === 'claude'
3
68
  ? 'Run the verify phase with `/opsx:verify <change>`, then the project\'s full test suite and the project\'s linter.'
@@ -8,69 +73,186 @@ function defaultExecution(harness) {
8
73
 
9
74
  Run the \`fusereview\` skill over the working-tree diff from the recorded baseline, including untracked files. Do not use \`baseline..HEAD\`: no commits are made. Fix Blocking findings test-first and re-review only the fix diff.
10
75
 
76
+ When the review closes, write the change-root \`review.md\` (see Review record above); with a \`BLOCK\` decision, run the \`post-review\` beat hook and then stop without archiving.
77
+
78
+ When the review closes, run the \`post-review\` beat hook.
79
+
11
80
  ### 5. Verify
12
81
 
13
82
  ${verifyStep(harness)} Paste the raw output for each. Structural validation alone does not check implementation against specs.
14
83
 
84
+ Run the declared test result command, if any, alongside the full test suite (see Test results above).
85
+
86
+ After every check passes, run the \`pre-archive\` beat hook; archive only after it continues.
87
+
15
88
  ### 6. Archive
16
89
 
17
- Archive only when every verify check passes: run \`openspec archive <change> --yes\`. If any check still fails after best-effort repair, do not archive; leave the change directory in place and write each failure with its raw output into the final report.`;
90
+ Archive only when every verify check passes: run \`openspec archive <change> --yes\`. If any check still fails after best-effort repair, do not archive; leave the change directory in place and write each failure with its raw output into the final report.
91
+
92
+ After a successful archive, run the \`post-archive\` beat hook; its stdout goes to the archived change directory's \`handoff/\`.`;
18
93
  }
19
94
  function fullExecution(harness) {
20
95
  return `### 4. FuseReview
21
96
 
22
97
  Run the \`fusereview\` skill over the working-tree diff from the recorded baseline, including untracked files. Do not use \`baseline..HEAD\`: no commits are made. Fix Blocking findings test-first and re-review only the fix diff.
23
98
 
99
+ When the review closes, write the change-root \`review.md\` (see Review record above); with a \`BLOCK\` decision, run the \`post-review\` beat hook and then stop without archiving.
100
+
101
+ When the review closes, run the \`post-review\` beat hook.
102
+
24
103
  ### 5. FuseQA
25
104
 
26
105
  Run the \`fuseqa\` skill over the built artifact. Author E2E cases for this change's entry-point behavior and handle what they expose. It is a step, not a checkpoint: do not ask whether to enter it. Its new cases are included in the Verify full test run.
27
106
 
107
+ ${renderLedgerTracePointer()}
108
+
28
109
  ### 6. Verify
29
110
 
30
111
  ${verifyStep(harness)} Paste the raw output for each. Structural validation alone does not check implementation against specs.
31
112
 
113
+ Run the declared test result command, if any, alongside the full test suite (see Test results above).
114
+
115
+ After every check passes, run the \`pre-archive\` beat hook; archive only after it continues.
116
+
32
117
  ### 7. Archive
33
118
 
34
- Archive only when every verify check passes: run \`openspec archive <change> --yes\`. If any check still fails after best-effort repair, do not archive; leave the change directory in place and write each failure with its raw output into the final report.`;
119
+ Archive only when every verify check passes: run \`openspec archive <change> --yes\`. If any check still fails after best-effort repair, do not archive; leave the change directory in place and write each failure with its raw output into the final report.
120
+
121
+ After a successful archive, run the \`post-archive\` beat hook; its stdout goes to the archived change directory's \`handoff/\`.`;
122
+ }
123
+ function flashExecution(harness) {
124
+ const verify = verifyStep(harness);
125
+ return `### 4. FuseReview — \`specfuse-flash\` subagent, separate context
126
+
127
+ Dispatch a subagent other than the Do subagent, using the same \`specfuse-flash\` definition. Do not resume the Do subagent to perform the review.
128
+
129
+ The dispatch names only the change name, the baseline commit, the paths of \`proposal.md\`, \`specs/\`, \`design.md\`, and \`tasks.md\`, and the path \`.claude/skills/fusereview/SKILL.md\`. Do not include the Do note, its evidence, or a summary of the work. The dispatch names \`handoff/beat-*.json\` as out of review scope. It also names \`evidence/verify-result.*\` as out of review scope.
130
+
131
+ The Do note and evidence wait in \`tmp/specfuse-flash/<change>/\`, outside the reviewed tree, until the review closes. If a note or evidence file is already inside the change directory, name it in the dispatch as out of review scope. When the review closes, move the Do note to \`handoff/do.md\` and its evidence to \`evidence/\`.
132
+
133
+ The reviewer reads \`.claude/skills/fusereview/SKILL.md\`, reviews the working-tree diff from the baseline including untracked files, and writes its findings to \`handoff/review.md\`.
134
+
135
+ ### Fix rounds
136
+
137
+ Read \`handoff/review.md\`. Route each Blocking finding by its subject:
138
+
139
+ - design, specs, or scope → the main model must resolve it and amend the artifacts before any code changes.
140
+ - code, tests, or docs assigned by \`tasks.md\` → resume the Do subagent with the findings note as the message.
141
+ - when the host cannot resume a subagent, dispatch a fresh \`specfuse-flash\` subagent with the note and the paths.
142
+
143
+ Resume the reviewer with the fix diff and the same findings note for a re-review. No gate allows more than two fix rounds, whether the implementer is resumed or freshly dispatched; when the count is reached the gate stays closed and the run stops. There is no second full review round.
144
+
145
+ A Do subagent resumed for a fix round cannot hand back a second time. When the change ends, stop every subagent this run dispatched that is still running.
146
+
147
+ When the review closes, the main model writes the change-root \`review.md\` (see Review record above); \`handoff/review.md\` is the reviewer's note and does not replace it. With a \`BLOCK\` decision, run the \`post-review\` beat hook and then stop without archiving.
148
+
149
+ When the review closes, the main model runs the \`post-review\` beat hook.
150
+
151
+ ### 5. FuseQA — \`specfuse-flash\` subagent
152
+
153
+ Dispatch a fresh \`specfuse-flash\` subagent. It reads \`.claude/skills/fuseqa/SKILL.md\`, authors E2E cases for this change's entry-point behavior, handles what they expose, and writes \`handoff/qa.md\` and \`evidence/qa-*.txt\`. FuseQA is a step, not a checkpoint. Its new cases are included in the Verify full test run.
154
+
155
+ ${renderLedgerTracePointer()}
156
+
157
+ ### 6. Verify — main model
158
+
159
+ The main model runs Verify itself. Do not dispatch Verify to a subagent.
160
+
161
+ Verify compares the implementation against the specs and runs ${verify.replace("Run the verify phase with", "the verify phase with")} Redirect each command's raw output to \`evidence/verify-*.txt\` and read it; do not accept a subagent's report of success in its place.
162
+
163
+ If Verify fails, resume the Do subagent with the failure output as a new fix round, record each round in the final report, and rerun Verify. No gate allows more than two fix rounds, whether the implementer is resumed or freshly dispatched; when the count is reached, stop without archiving.
164
+
165
+ Run the declared test result command, if any, alongside the full test suite (see Test results above).
166
+
167
+ After every check passes, run the \`pre-archive\` beat hook; archive only after it continues.
168
+
169
+ ### 7. Archive — main model
170
+
171
+ Before archiving, replace the absolute path of the workspace root with \`.\` in every note under \`handoff/\` and every file under \`evidence/\`, because the change directory is committed.
172
+
173
+ Archive only when every verify check passes: run \`openspec archive <change> --yes\`. Archived change directories keep \`handoff/\` and \`evidence/\`, so those files remain in the change directory after archive. If any check still fails after best-effort repair, do not archive; leave the change directory in place and write each failure with its raw output and evidence path into the final report.
174
+
175
+ After a successful archive, run the \`post-archive\` beat hook; its stdout goes to the archived change directory's \`handoff/\`.`;
176
+ }
177
+ function flashSections() {
178
+ return `
179
+
180
+ ## Beat ownership
181
+
182
+ - The main model writes the brainstorming decisions, \`proposal.md\`, \`specs/\`, \`design.md\`, \`tasks.md\`, runs Verify, archives, and writes the final report.
183
+ - A \`specfuse-flash\` subagent runs each of Do, FuseReview, and FuseQA: one subagent per beat, one at a time in the main agent's workspace.
184
+ - The main model runs every beat hook. A \`specfuse-flash\` subagent never runs one: its reply is one line and it cannot ask a question.
185
+
186
+ ## Dispatch rules
187
+
188
+ Dispatch with \`subagent_type\` \`specfuse-flash\`. Do not pass a \`model\` parameter: it outranks the agent definition and accepts aliases only. Do not dispatch a \`fork\`.
189
+
190
+ If a dispatch fails — unknown agent type, unavailable model, or the concurrency limit — stop the run with a failure report. Do not continue that beat on the main model. When \`specfuse-flash\` is not found, the report names \`.claude/agents/specfuse-flash.md\` and tells the user to start a new Claude Code session, because a definition written after a session started may not be loaded by that session.
191
+
192
+ ## Write authority
193
+
194
+ Subagents must not edit \`proposal.md\`, \`design.md\`, or \`specs/\`. The main model must not edit the implementation, tests, and docs that \`tasks.md\` assigns. A subagent that finds the artifacts incomplete or contradictory returns \`BLOCKED\` with the question.
195
+
196
+ ## Handoffs
197
+
198
+ A dispatch carries pointers — the change name, the baseline commit, artifact paths, and prior note paths. Do not summarize prior work in a dispatch. The baseline commit recorded in step 1 is the review baseline for the whole run.
199
+
200
+ Notes go in \`handoff/\` and evidence in \`evidence/\`, both under the change directory. Evidence files use the \`.txt\` extension, because the generated \`.gitignore\` excludes \`*.log\`. Redirect raw command output into those files; never restate output.`;
35
201
  }
36
202
  function renderPipelineBody(mode, harness) {
37
203
  const full = mode === 'full';
204
+ const flash = mode === 'flashmode';
205
+ const complete = full || flash;
38
206
  const isDsh = harness === 'dsh';
39
- const slug = full ? '/specfuse-full' : '/specfuse';
40
- const claudeSlug = full ? '/specfuse:full' : '/specfuse';
41
- const title = full
42
- ? isDsh
43
- ? '/specfuse-full — complete unattended pipeline'
44
- : '/specfuse:full — complete unattended pipeline'
45
- : '/specfuse — unattended pipeline';
46
- const fuseqaDecision = full
47
- ? isDsh
48
- ? '- **FuseQA:** record `auto: entered` and run the `fuseqa` skill (`.agents/skills/fuseqa/SKILL.md`) after FuseReview, before Verify. It is a step, not a checkpoint.'
49
- : '- **FuseQA:** record `auto: entered` and run the `fuseqa` skill after FuseReview, before Verify. It is a step, not a checkpoint.'
50
- : '- **FuseQA:** not part of the pipeline; do not invoke it. It remains available only through an explicit `/fuseqa` request.';
51
- const worktreePhases = full
52
- ? 'artifacts, apply, FuseReview, FuseQA, verify, and archive'
53
- : 'artifacts, apply, FuseReview, verify, and archive';
54
- const report = full
55
- ? 'State the change name and location, the artifacts written, the task count, verification output, the FuseReview decision (`auto: entered`), the FuseQA decision (`auto: entered`), the archive outcome, any worktree path, every automatic decision with its rationale, and that no commit and no push were performed.'
56
- : 'State the change name and location, the artifacts written, the task count, verification output, the FuseReview decision (`auto: entered`), the archive outcome, any worktree path, every automatic decision with its rationale, and that no commit and no push were performed. FuseQA is not part of the pipeline, so no FuseQA decision is recorded.';
57
- const execution = full ? fullExecution(harness) : defaultExecution(harness);
207
+ const slug = full ? '/specfuse-full' : flash ? '/specfuse-flashmode' : '/specfuse';
208
+ const claudeSlug = full ? '/specfuse:full' : flash ? '/specfuse:flashmode' : '/specfuse';
209
+ const title = flash
210
+ ? '/specfuse:flashmode — cost-optimized complete unattended pipeline'
211
+ : full
212
+ ? isDsh
213
+ ? '/specfuse-full — complete unattended pipeline'
214
+ : '/specfuse:full — complete unattended pipeline'
215
+ : '/specfuse — unattended pipeline';
216
+ const fuseqaDecision = flash
217
+ ? '- **FuseQA:** record `auto: entered` and run the `fuseqa` skill after FuseReview and before Verify. It is a step, not a checkpoint.'
218
+ : complete
219
+ ? isDsh
220
+ ? '- **FuseQA:** record `auto: entered` and run the `fuseqa` skill (`.agents/skills/fuseqa/SKILL.md`) after FuseReview, before Verify. It is a step, not a checkpoint.'
221
+ : '- **FuseQA:** record `auto: entered` and run the `fuseqa` skill after FuseReview, before Verify. It is a step, not a checkpoint.'
222
+ : '- **FuseQA:** not part of the pipeline; do not invoke it. It remains available only through an explicit `/fuseqa` request.';
223
+ const worktreePhases = flash
224
+ ? 'artifacts, Do, FuseReview, FuseQA, verify, and archive'
225
+ : complete
226
+ ? 'artifacts, apply, FuseReview, FuseQA, verify, and archive'
227
+ : 'artifacts, apply, FuseReview, verify, and archive';
228
+ const report = flash
229
+ ? 'State the change name and location, the artifacts written, the task count, verification output, the FuseReview decision (`auto: entered`), the FuseQA decision (`auto: entered`), which beats ran on `specfuse-flash`, the archive outcome, any worktree path, every automatic decision with its rationale, and that no commit and no push were performed. Return the final report only after every beat hook, subagent, and background command of this run has ended.'
230
+ : full
231
+ ? 'State the change name and location, the artifacts written, the task count, verification output, the FuseReview decision (`auto: entered`), the FuseQA decision (`auto: entered`), the archive outcome, any worktree path, every automatic decision with its rationale, and that no commit and no push were performed.'
232
+ : 'State the change name and location, the artifacts written, the task count, verification output, the FuseReview decision (`auto: entered`), the archive outcome, any worktree path, every automatic decision with its rationale, and that no commit and no push were performed. FuseQA is not part of the pipeline, so no FuseQA decision is recorded.';
233
+ const execution = flash ? flashExecution(harness) : full ? fullExecution(harness) : defaultExecution(harness);
58
234
  const fusedocPath = isDsh ? '.agents/skills/fusedoc/SKILL.md' : '.claude/skills/fusedoc/SKILL.md';
59
235
  const questionRule = isDsh
60
236
  ? 'Do not ask the user a question at any decision point. Answer each with the recommended option and record the decision in the final report.'
61
237
  : 'Do not call AskUserQuestion at any decision point. Answer each with the recommended option and record the decision in the final report.';
62
- const applyRule = isDsh
63
- ? 'Apply strict Red-Green-Refactor: for every task, write the failing test first, make it pass, then refactor. Before checking off a task, run the project\'s test command and paste the raw output as evidence. Do not dispatch implementation subagents: their worktrees would require a merge, which auto mode forbids.'
64
- : 'Activate `test-driven-development` and `verification-before-completion`. For every task, write the failing test first, make it pass, then refactor. Before checking a task off, run the project\'s test command and paste the raw output as evidence. Do not dispatch implementation subagents: their worktrees would require a merge, which auto mode forbids.';
238
+ const applyRule = flash
239
+ ? 'Dispatch one `specfuse-flash` subagent for the whole beat. It works through every task in `tasks.md`, follows strict Red-Green-Refactor, writes the failing test first, and redirects each verification command\'s output to an evidence file. This is one dispatch covering every task in `tasks.md`. Do not dispatch one subagent per task. Do not create a worktree per subagent. There is no merge step.\n\nIts note records, per task, the files it touched and its verification command. It writes the note and evidence to `tmp/specfuse-flash/<change>/`, which the generated `.gitignore` excludes.'
240
+ : isDsh
241
+ ? 'Apply strict Red-Green-Refactor: for every task, write the failing test first, make it pass, then refactor. Before checking off a task, run the project\'s test command and paste the raw output as evidence. Do not dispatch implementation subagents: their worktrees would require a merge, which auto mode forbids.'
242
+ : 'Activate `test-driven-development` and `verification-before-completion`. For every task, write the failing test first, make it pass, then refactor. Before checking a task off, run the project\'s test command and paste the raw output as evidence. Do not dispatch implementation subagents: their worktrees would require a merge, which auto mode forbids.';
65
243
  const skillRootNote = isDsh
66
244
  ? '\n\nThe shared skills are installed under `.agents/skills/`: `design-md`, `fusedoc`, `fusereview`, and `fuseqa`.'
67
245
  : '';
68
- const invocation = isDsh
69
- ? `Run the ${full ? 'complete ' : 'full '}SpecFuse pipeline for the requirement text following \`${slug}\` in the user's message.`
70
- : `Run the ${full ? 'complete ' : 'full '}SpecFuse pipeline for: $ARGUMENTS`;
71
- const missing = isDsh
72
- ? `If no requirement text follows the invocation, print exactly \`${full ? 'SPECFUSE_FULL_USAGE: /specfuse-full' : 'SPECFUSE_USAGE: /specfuse'} <requirement description>\` and stop. Do not create a change or generate an artifact. Do not ask a question.`
73
- : `If \`$ARGUMENTS\` is empty, print usage as \`${claudeSlug} <requirement description>\` and stop. Do not create a change or generate an artifact. Do not ask a question.`;
246
+ const invocation = flash
247
+ ? 'Run the complete SpecFuse pipeline on the cost-optimized flash model for: $ARGUMENTS'
248
+ : isDsh
249
+ ? `Run the ${full ? 'complete ' : 'full '}SpecFuse pipeline for the requirement text following \`${slug}\` in the user's message.`
250
+ : `Run the ${full ? 'complete ' : 'full '}SpecFuse pipeline for: $ARGUMENTS`;
251
+ const missing = flash
252
+ ? `If \`$ARGUMENTS\` is empty, print usage as \`/specfuse:flashmode <requirement description>\` and stop. Do not create a change, dispatch a subagent, or generate an artifact. Do not ask a question.`
253
+ : isDsh
254
+ ? `If no requirement text follows the invocation, print exactly \`${full ? 'SPECFUSE_FULL_USAGE: /specfuse-full' : 'SPECFUSE_USAGE: /specfuse'} <requirement description>\` and stop. Do not create a change or generate an artifact. Do not ask a question.`
255
+ : `If \`$ARGUMENTS\` is empty, print usage as \`${claudeSlug} <requirement description>\` and stop. Do not create a change or generate an artifact. Do not ask a question.`;
74
256
  return `# ${title}
75
257
 
76
258
  ${invocation}
@@ -82,31 +264,54 @@ ${missing}
82
264
  ${questionRule}
83
265
 
84
266
  - **Brainstorming:** derive 2–3 alternatives with trade-offs, select the recommended one, and write the selection and rationale into \`design.md\`.
267
+ - **Requirement brief:** decide every \`spec-meta\` field the requirement leaves out and mark it (see Requirement brief below).
85
268
  - **Design tokens:** when the three-gate test triggers \`/design-md\`, answer the questionnaire with recommended values and generate \`DESIGN-TOKENS.md\`; never overwrite an existing \`DESIGN-TOKENS.md\`.
86
269
  - **Model switch:** record \`continue with current model\`; do not switch and do not ask.
87
270
  - **FuseReview:** record \`auto: entered\` and run the review.
88
271
  ${fuseqaDecision}
89
272
  - **Pace control:** do not stop between artifacts for review.
90
273
 
274
+ ${beatHookSection(mode)}
275
+
276
+ ${pipelineRecordsSection()}
277
+
278
+ ${requirementBriefSection()}
279
+
280
+ ${traceabilitySection()}
281
+
91
282
  ## Execution order
92
283
 
93
284
  ### 0. Select the workspace
94
285
 
95
286
  When a Git Worktree trigger condition is met, create and enter a dedicated worktree before writing anything, so every artifact stays inside it. If worktree creation fails, continue in the current working tree and record the fallback.
96
287
 
97
- ### 1. Create the change
288
+ ${flash ? '### 1. Create the change — main model' : '### 1. Create the change'}
98
289
 
99
290
  Run \`openspec new change <kebab-case-name>\`. Record the current HEAD as the review baseline.
100
291
 
101
- ### 2. Generate the artifacts
292
+ Then run the \`pre-think\` beat hook.
293
+
294
+ ${flash ? '### 2. Generate the artifacts — main model' : '### 2. Generate the artifacts'}
102
295
 
103
296
  Read \`openspec instructions <artifact-id> --change <name>\` for each artifact and write them in one pass, in this order: \`proposal.md\`, \`specs/\`, \`design.md\`, \`tasks.md\`. Artifact prose follows the FuseDoc standard at \`${fusedocPath}\`.${skillRootNote}
104
297
 
105
- ### 3. Apply
298
+ Write the \`spec-meta\` block into \`proposal.md\` and, in \`design.md\`, one \`clarification\` block for every field recorded \`decidedBy: ai\` (see Requirement brief above).
299
+
300
+ ${renderTaskTracePointer()}
301
+
302
+ After \`tasks.md\` is written, run the \`post-think\` beat hook.
303
+
304
+ ${flash ? '### 3. Do — `specfuse-flash` subagent' : '### 3. Apply'}
106
305
 
107
306
  ${applyRule}
108
307
 
109
- ${execution}
308
+ ${renderTestTracePointer()}
309
+
310
+ ${flash ? 'After the Do subagent returns, the main model runs the declared test result command, if any (see Test results above).' : 'When every task passes, run the declared test result command, if any (see Test results above).'}
311
+
312
+ ${flash ? 'After the Do subagent returns, the main model runs the `post-apply` beat hook.' : 'When every task passes, run the `post-apply` beat hook.'}
313
+
314
+ ${execution}${flash ? flashSections() : ''}
110
315
 
111
316
  ## Worktree isolation
112
317
 
@@ -117,18 +322,22 @@ When a Git Worktree trigger condition is met, the worktree is selected in step 0
117
322
  - Never run \`git commit\`, \`git push\`, or \`git merge\`.
118
323
  - Never skip TDD or verification evidence.
119
324
  - Never archive after a failing verify.
120
- - Never leave an automatic decision out of the final report.
325
+ - Never leave an automatic decision out of the final report.${flash ? '\n- The final report must state that no commit and no push were performed.' : ''}
121
326
 
122
327
  ## Final report
123
328
 
124
329
  ${report}
330
+ List each beat hook's exit code and \`outcome\` with its \`handoff/beat-<beat>.json\` path, or the one line recording a missing declaration or a protocol mismatch.
331
+ State the decision line of the change-root \`review.md\`, and the \`evidence/verify-result.<ext>\` path or that no test result command is declared.
332
+ List every \`spec-meta\` field recorded \`decidedBy: ai\`.
125
333
  `;
126
334
  }
127
335
  function renderClaudeCommand(mode) {
128
- const full = mode === 'full';
129
- const description = full
130
- ? 'Run the complete SpecFuse pipeline unattended, including FuseQA, from brainstorming through archive'
131
- : 'Run the SpecFuse pipeline unattended, from brainstorming through archive';
336
+ const description = mode === 'flashmode'
337
+ ? 'Run the complete SpecFuse pipeline unattended with Do, FuseReview, and FuseQA on the cost-optimized flash model'
338
+ : mode === 'full'
339
+ ? 'Run the complete SpecFuse pipeline unattended, including FuseQA, from brainstorming through archive'
340
+ : 'Run the SpecFuse pipeline unattended, from brainstorming through archive';
132
341
  return `---
133
342
  description: ${description}
134
343
  argument-hint: <requirement description>
@@ -142,6 +351,9 @@ export function composeSpecfuseCommand() {
142
351
  export function composeSpecfuseFullCommand() {
143
352
  return renderClaudeCommand('full');
144
353
  }
354
+ export function composeSpecfuseFlashmodeCommand() {
355
+ return renderClaudeCommand('flashmode');
356
+ }
145
357
  export function composeSpecfuseDshSkill(mode) {
146
358
  const full = mode === 'full';
147
359
  const name = full ? 'specfuse-full' : 'specfuse';
@@ -1 +1 @@
1
- {"version":3,"file":"specfuse-command.js","sourceRoot":"","sources":["../../src/templates/specfuse-command.ts"],"names":[],"mappings":"AAmBA,SAAS,UAAU,CAAC,OAAgB;IAClC,OAAO,OAAO,KAAK,QAAQ;QACzB,CAAC,CAAC,mHAAmH;QACrH,CAAC,CAAC,wKAAwK,CAAC;AAC/K,CAAC;AAED,SAAS,gBAAgB,CAAC,OAAgB;IACxC,OAAO;;;;;;EAMP,UAAU,CAAC,OAAO,CAAC;;;;+PAI0O,CAAC;AAChQ,CAAC;AAED,SAAS,aAAa,CAAC,OAAgB;IACrC,OAAO;;;;;;;;;;EAUP,UAAU,CAAC,OAAO,CAAC;;;;+PAI0O,CAAC;AAChQ,CAAC;AAED,SAAS,kBAAkB,CAAC,IAAkB,EAAE,OAAgB;IAC9D,MAAM,IAAI,GAAG,IAAI,KAAK,MAAM,CAAC;IAC7B,MAAM,KAAK,GAAG,OAAO,KAAK,KAAK,CAAC;IAChC,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,WAAW,CAAC;IACnD,MAAM,UAAU,GAAG,IAAI,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,WAAW,CAAC;IACzD,MAAM,KAAK,GAAG,IAAI;QAChB,CAAC,CAAC,KAAK;YACL,CAAC,CAAC,+CAA+C;YACjD,CAAC,CAAC,+CAA+C;QACnD,CAAC,CAAC,iCAAiC,CAAC;I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AIP,CAAC;AACF,CAAC;AAED,SAAS,mBAAmB,CAAC,IAAkB;IAC7C,MAAM,WAAW,GACf,IAAI,KAAK,WAAW;QAClB,CAAC,CAAC,iHAAiH;QACnH,CAAC,CAAC,IAAI,KAAK,MAAM;YACf,CAAC,CAAC,qGAAqG;YACvG,CAAC,CAAC,0EAA0E,CAAC;IAEnF,OAAO;eACM,WAAW;;;;EAIxB,kBAAkB,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE,CAAC;AACvC,CAAC;AAED,MAAM,UAAU,sBAAsB;IACpC,OAAO,mBAAmB,CAAC,SAAS,CAAC,CAAC;AACxC,CAAC;AAED,MAAM,UAAU,0BAA0B;IACxC,OAAO,mBAAmB,CAAC,MAAM,CAAC,CAAC;AACrC,CAAC;AAED,MAAM,UAAU,+BAA+B;IAC7C,OAAO,mBAAmB,CAAC,WAAW,CAAC,CAAC;AAC1C,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,IAAwB;IAC9D,MAAM,IAAI,GAAG,IAAI,KAAK,MAAM,CAAC;IAC7B,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,UAAU,CAAC;IACjD,MAAM,WAAW,GAAG,IAAI;QACtB,CAAC,CAAC,iIAAiI;QACnI,CAAC,CAAC,iGAAiG,CAAC;IAEtG,OAAO;QACD,IAAI;eACG,WAAW;;;;;EAKxB,kBAAkB,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC;AACpC,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * The model id is written into YAML frontmatter that Claude Code parses with an
3
+ * unspecified parser version. The character grammar alone is not enough:
4
+ * `true`, `123`, and `12:30` all pass it and are then parsed as a boolean or a
5
+ * number, so the id would silently differ from what the user typed. Validation
6
+ * therefore round-trips the id through both YAML versions the host may use.
7
+ */
8
+ export declare const DEFAULT_FLASH_MODEL = "deepseek-flash[1m]";
9
+ /** Returns true, or the message to show. Never throws. */
10
+ export declare function validateFlashModel(id: string): true | string;
11
+ export declare function composeSpecfuseFlashAgent(flashModel: string): string;
12
+ //# sourceMappingURL=specfuse-flash-agent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"specfuse-flash-agent.d.ts","sourceRoot":"","sources":["../../src/templates/specfuse-flash-agent.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,uBAAuB,CAAC;AAcxD,0DAA0D;AAC1D,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAY5D;AAED,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAmCpE"}
@@ -0,0 +1,73 @@
1
+ import { parse as parseYaml } from 'yaml';
2
+ /**
3
+ * The model id is written into YAML frontmatter that Claude Code parses with an
4
+ * unspecified parser version. The character grammar alone is not enough:
5
+ * `true`, `123`, and `12:30` all pass it and are then parsed as a boolean or a
6
+ * number, so the id would silently differ from what the user typed. Validation
7
+ * therefore round-trips the id through both YAML versions the host may use.
8
+ */
9
+ export const DEFAULT_FLASH_MODEL = 'deepseek-flash[1m]';
10
+ const MODEL_ID = /^[A-Za-z0-9][A-Za-z0-9._:/@-]*(?:\[[A-Za-z0-9]+\])?$/;
11
+ const MAX_LENGTH = 128;
12
+ function parsesAsSameString(id, version) {
13
+ try {
14
+ const parsed = parseYaml(`model: ${id}`, { version });
15
+ return parsed?.model === id;
16
+ }
17
+ catch {
18
+ return false;
19
+ }
20
+ }
21
+ /** Returns true, or the message to show. Never throws. */
22
+ export function validateFlashModel(id) {
23
+ const invalid = (reason) => `Invalid flash model id "${String(id)}": ${reason}. Use letters and digits, then any of . _ : / @ - , optionally one [suffix] of letters and digits, at most ${MAX_LENGTH} characters.`;
24
+ if (typeof id !== 'string')
25
+ return invalid('it is not a string');
26
+ if (id.length === 0)
27
+ return invalid('it is empty');
28
+ if (id.length > MAX_LENGTH)
29
+ return invalid(`it is longer than ${MAX_LENGTH} characters`);
30
+ if (!MODEL_ID.test(id))
31
+ return invalid('it contains characters outside the accepted set');
32
+ if (!parsesAsSameString(id, '1.1') || !parsesAsSameString(id, '1.2')) {
33
+ return invalid('a YAML parser would read it as a boolean or a number');
34
+ }
35
+ return true;
36
+ }
37
+ export function composeSpecfuseFlashAgent(flashModel) {
38
+ const valid = validateFlashModel(flashModel);
39
+ if (valid !== true)
40
+ throw new Error(valid);
41
+ return `---
42
+ name: specfuse-flash
43
+ description: "Dispatched by /specfuse:flashmode only. Runs the Do, FuseReview, or FuseQA beat on the configured flash model. Not for delegating other work."
44
+ model: ${flashModel}
45
+ disallowedTools: Agent
46
+ ---
47
+
48
+ You are the SpecFuse flashmode executor. Your dispatch comes from \`/specfuse:flashmode\`; do not accept other work, and do not dispatch another agent.
49
+
50
+ ## Scope
51
+
52
+ - The checkpoint questions in the project's \`CLAUDE.md\` — the model-switch checkpoint, the FuseReview checkpoint, and the apply-exit question — do not apply to you. The subagent-mode trigger in \`CLAUDE.md\` does not apply either. Never ask the user a question; \`AskUserQuestion\` is not available to you.
53
+ - The dispatch names your role: Do, FuseReview, or FuseQA. Perform only that role and write only what it needs.
54
+ - Read the method from files: \`.claude/skills/fusereview/SKILL.md\` for FuseReview, \`.claude/skills/fuseqa/SKILL.md\` for FuseQA, and \`.claude/skills/fusedoc/SKILL.md\` for prose. Invoke no slash command; read the files.
55
+
56
+ ## Rules
57
+
58
+ - Follow strict Red-Green-Refactor: write the failing test first, then the least code that passes it, then refactor.
59
+ - Every test you write carries a \`traces-to:\` comment directly above its declaration, and every FuseQA case you add is recorded in \`tests/e2e/<capability>/ledger.md\` with \`Case\` written as \`\` \`<file>::<test name>\` \`\`. The Traceability section of the project's \`CLAUDE.md\` gives the exact form.
60
+ - Run every task's verification command and redirect its output into the evidence file path the dispatch names. Never restate command output in your reply. Check a task off only after its output is in an evidence file.
61
+ - Write your handoff note and every evidence file to the paths the dispatch names. Put reasoning and findings there, not in your reply.
62
+ - Never edit \`proposal.md\`, \`design.md\`, or anything under the change's \`specs/\`. Those belong to the main model.
63
+ - Never run a beat hook from \`.specfuse/beat-hook\`; the main model runs every one.
64
+ - Never write the change-root \`review.md\` or \`evidence/verify-result.*\`; the main model writes both.
65
+ - Never run \`git commit\`, \`git push\`, \`git merge\`, or \`git stash\`; never create a worktree; never run \`openspec archive\`; never dispatch another agent.
66
+ - When the artifacts are missing information or contradict each other, stop and return \`BLOCKED\` with the question instead of guessing.
67
+
68
+ ## Reply
69
+
70
+ Your final message is one line: \`DONE\`, \`BLOCKED\`, or \`FAILED\`, followed by the path of your note and every evidence file you wrote. Nothing else.
71
+ `;
72
+ }
73
+ //# sourceMappingURL=specfuse-flash-agent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"specfuse-flash-agent.js","sourceRoot":"","sources":["../../src/templates/specfuse-flash-agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,MAAM,CAAC;AAE1C;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,oBAAoB,CAAC;AAExD,MAAM,QAAQ,GAAG,sDAAsD,CAAC;AACxE,MAAM,UAAU,GAAG,GAAG,CAAC;AAEvB,SAAS,kBAAkB,CAAC,EAAU,EAAE,OAAsB;IAC5D,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,SAAS,CAAC,UAAU,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,CAA+B,CAAC;QACpF,OAAO,MAAM,EAAE,KAAK,KAAK,EAAE,CAAC;IAC9B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED,0DAA0D;AAC1D,MAAM,UAAU,kBAAkB,CAAC,EAAU;IAC3C,MAAM,OAAO,GAAG,CAAC,MAAc,EAAU,EAAE,CACzC,2BAA2B,MAAM,CAAC,EAAE,CAAC,MAAM,MAAM,8GAA8G,UAAU,cAAc,CAAC;IAE1L,IAAI,OAAO,EAAE,KAAK,QAAQ;QAAE,OAAO,OAAO,CAAC,oBAAoB,CAAC,CAAC;IACjE,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,OAAO,CAAC,aAAa,CAAC,CAAC;IACnD,IAAI,EAAE,CAAC,MAAM,GAAG,UAAU;QAAE,OAAO,OAAO,CAAC,qBAAqB,UAAU,aAAa,CAAC,CAAC;IACzF,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QAAE,OAAO,OAAO,CAAC,iDAAiD,CAAC,CAAC;IAC1F,IAAI,CAAC,kBAAkB,CAAC,EAAE,EAAE,KAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC,EAAE,EAAE,KAAK,CAAC,EAAE,CAAC;QACrE,OAAO,OAAO,CAAC,sDAAsD,CAAC,CAAC;IACzE,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,UAAU,yBAAyB,CAAC,UAAkB;IAC1D,MAAM,KAAK,GAAG,kBAAkB,CAAC,UAAU,CAAC,CAAC;IAC7C,IAAI,KAAK,KAAK,IAAI;QAAE,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC;IAE3C,OAAO;;;SAGA,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2BlB,CAAC;AACF,CAAC"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Renders the traceability conventions shared by every SpecFuse entry point:
3
+ * the trace reference grammar, the task `traces-to:`/`files:` lines, the
4
+ * per-test `traces-to:` comment, and the E2E ledger columns.
5
+ *
6
+ * The rules are prose: no runtime in this package parses any of these lines. A
7
+ * beat hook in a project may check them, so each generated surface renders the
8
+ * same strings and tests compare them across outputs so the wording cannot
9
+ * drift. The text names no directory a generated project lacks.
10
+ */
11
+ /** The reference grammar (one paragraph, no label). */
12
+ export declare function renderTraceReferenceRule(): string;
13
+ /** The task traces-to / files rule (one paragraph, no label). */
14
+ export declare function renderTaskTraceRule(): string;
15
+ /** The per-test comment rule (one paragraph, no label). */
16
+ export declare function renderTestTraceRule(): string;
17
+ /** The E2E ledger rule (one paragraph, no label). */
18
+ export declare function renderLedgerTraceRule(): string;
19
+ /** The unique-scenario rule for the openspec config specs rules. */
20
+ export declare function renderScenarioNameRule(): string;
21
+ /** Intro, the four labelled bullets, and the example. Identical in every entry point. */
22
+ export declare function renderTraceabilityRules(): string;
23
+ /** Pointer sentence placed at the task-writing step. */
24
+ export declare function renderTaskTracePointer(): string;
25
+ /** Pointer sentence placed at the test-writing step. */
26
+ export declare function renderTestTracePointer(): string;
27
+ /** Pointer sentence placed at the FuseQA step. */
28
+ export declare function renderLedgerTracePointer(): string;
29
+ //# sourceMappingURL=traceability.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"traceability.d.ts","sourceRoot":"","sources":["../../src/templates/traceability.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,uDAAuD;AACvD,wBAAgB,wBAAwB,IAAI,MAAM,CAEjD;AAED,iEAAiE;AACjE,wBAAgB,mBAAmB,IAAI,MAAM,CAE5C;AAED,2DAA2D;AAC3D,wBAAgB,mBAAmB,IAAI,MAAM,CAE5C;AAED,qDAAqD;AACrD,wBAAgB,qBAAqB,IAAI,MAAM,CAE9C;AAED,oEAAoE;AACpE,wBAAgB,sBAAsB,IAAI,MAAM,CAE/C;AA4BD,yFAAyF;AACzF,wBAAgB,uBAAuB,IAAI,MAAM,CAWhD;AAED,wDAAwD;AACxD,wBAAgB,sBAAsB,IAAI,MAAM,CAE/C;AAED,wDAAwD;AACxD,wBAAgB,sBAAsB,IAAI,MAAM,CAE/C;AAED,kDAAkD;AAClD,wBAAgB,wBAAwB,IAAI,MAAM,CAEjD"}
@@ -0,0 +1,81 @@
1
+ /**
2
+ * Renders the traceability conventions shared by every SpecFuse entry point:
3
+ * the trace reference grammar, the task `traces-to:`/`files:` lines, the
4
+ * per-test `traces-to:` comment, and the E2E ledger columns.
5
+ *
6
+ * The rules are prose: no runtime in this package parses any of these lines. A
7
+ * beat hook in a project may check them, so each generated surface renders the
8
+ * same strings and tests compare them across outputs so the wording cannot
9
+ * drift. The text names no directory a generated project lacks.
10
+ */
11
+ /** The reference grammar (one paragraph, no label). */
12
+ export function renderTraceReferenceRule() {
13
+ return 'A reference is `spec: <capability> / Scenario: <name>`; further scenarios of the same capability follow as `; Scenario: <name>`. A task may also name a requirement as `spec: <capability> / Requirement: <name>`. A test and an E2E ledger row name only `Scenario:` items, never a `Requirement:`.';
14
+ }
15
+ /** The task traces-to / files rule (one paragraph, no label). */
16
+ export function renderTaskTraceRule() {
17
+ return 'Each task block in `tasks.md` holds one `traces-to: <reference>` line and one or more `files: <path>[, <path>]` lines listing the files the task changes, relative to the project root. A task that only runs verification has no `files:` line.';
18
+ }
19
+ /** The per-test comment rule (one paragraph, no label). */
20
+ export function renderTestTraceRule() {
21
+ return "Each test declaration has `traces-to: <reference>` in the comment block directly above it, in the language's comment syntax (`// traces-to:`, `# traces-to:`). A blank line or other code between the comment and the declaration detaches it, and a summary comment at the top of a file links no test.";
22
+ }
23
+ /** The E2E ledger rule (one paragraph, no label). */
24
+ export function renderLedgerTraceRule() {
25
+ return "A capability's E2E ledger is `tests/e2e/<capability>/ledger.md`. Its `## Addition` table has a `Case` column and a `Traces to` column. `Case` is `` `<file>::<test name>` ``, with `<file>` relative to the ledger's directory; `Traces to` is a reference or `defect: <description>`.";
26
+ }
27
+ /** The unique-scenario rule for the openspec config specs rules. */
28
+ export function renderScenarioNameRule() {
29
+ return 'Scenario names are unique within a capability, so a `Scenario:` reference resolves to one scenario';
30
+ }
31
+ /**
32
+ * The example block. It uses the same unrelated feature as the requirement
33
+ * brief example, so a value copied from the rendered text is obviously wrong.
34
+ * The outer four-backtick fence holds the inner blocks so they render as text.
35
+ */
36
+ function renderTraceabilityExample() {
37
+ return [
38
+ '````markdown',
39
+ '```markdown',
40
+ '- [ ] 2.1 Export the monthly report as CSV',
41
+ ' traces-to: spec: report-export / Requirement: CSV export',
42
+ ' files: src/export/csv.ts, tests/export/csv.test.ts',
43
+ '```',
44
+ '',
45
+ '```ts',
46
+ '// traces-to: spec: report-export / Scenario: Export succeeds; Scenario: Empty month',
47
+ "it('writes one row per entry', () => {",
48
+ '```',
49
+ '',
50
+ '| Case | Capability | Traces to | Shape |',
51
+ '|---|---|---|---|',
52
+ '| `export.test.ts::exports the monthly report` | `report-export` | `spec: report-export / Scenario: Export succeeds` | CLI |',
53
+ '````',
54
+ ].join('\n');
55
+ }
56
+ /** Intro, the four labelled bullets, and the example. Identical in every entry point. */
57
+ export function renderTraceabilityRules() {
58
+ return [
59
+ 'Links from tasks, tests, and E2E cases to spec scenarios are written in one exact form, so a check can follow them; a link in any other form links nothing.',
60
+ '',
61
+ `- **References.** ${renderTraceReferenceRule()}`,
62
+ `- **Tasks.** ${renderTaskTraceRule()}`,
63
+ `- **Tests.** ${renderTestTraceRule()}`,
64
+ `- **E2E ledger.** ${renderLedgerTraceRule()}`,
65
+ '',
66
+ renderTraceabilityExample(),
67
+ ].join('\n');
68
+ }
69
+ /** Pointer sentence placed at the task-writing step. */
70
+ export function renderTaskTracePointer() {
71
+ return 'Give every task in `tasks.md` its `traces-to:` line and, unless it only runs verification, its `files:` lines (see Traceability above).';
72
+ }
73
+ /** Pointer sentence placed at the test-writing step. */
74
+ export function renderTestTracePointer() {
75
+ return 'Every test written for a task carries a `traces-to:` comment directly above its declaration (see Traceability above).';
76
+ }
77
+ /** Pointer sentence placed at the FuseQA step. */
78
+ export function renderLedgerTracePointer() {
79
+ return "Record each new E2E case in `tests/e2e/<capability>/ledger.md`, with `Case` written as `` `<file>::<test name>` `` and the case's test carrying a `traces-to:` comment (see Traceability above).";
80
+ }
81
+ //# sourceMappingURL=traceability.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"traceability.js","sourceRoot":"","sources":["../../src/templates/traceability.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,uDAAuD;AACvD,MAAM,UAAU,wBAAwB;IACtC,OAAO,sS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