create-specfuse 0.19.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 (35) hide show
  1. package/README.md +53 -0
  2. package/dist/fuseqa/templates/_case-schema.yaml +6 -2
  3. package/dist/fuseqa/templates/ledger.md +9 -9
  4. package/dist/templates/beat-hook.d.ts +14 -0
  5. package/dist/templates/beat-hook.d.ts.map +1 -0
  6. package/dist/templates/beat-hook.js +57 -0
  7. package/dist/templates/beat-hook.js.map +1 -0
  8. package/dist/templates/claude-md.d.ts.map +1 -1
  9. package/dist/templates/claude-md.js +75 -4
  10. package/dist/templates/claude-md.js.map +1 -1
  11. package/dist/templates/fuseqa-skill.d.ts.map +1 -1
  12. package/dist/templates/fuseqa-skill.js +5 -0
  13. package/dist/templates/fuseqa-skill.js.map +1 -1
  14. package/dist/templates/openspec-config.d.ts.map +1 -1
  15. package/dist/templates/openspec-config.js +4 -0
  16. package/dist/templates/openspec-config.js.map +1 -1
  17. package/dist/templates/pipeline-records.d.ts +22 -0
  18. package/dist/templates/pipeline-records.d.ts.map +1 -0
  19. package/dist/templates/pipeline-records.js +84 -0
  20. package/dist/templates/pipeline-records.js.map +1 -0
  21. package/dist/templates/requirement-brief.d.ts +20 -0
  22. package/dist/templates/requirement-brief.d.ts.map +1 -0
  23. package/dist/templates/requirement-brief.js +131 -0
  24. package/dist/templates/requirement-brief.js.map +1 -0
  25. package/dist/templates/specfuse-command.d.ts.map +1 -1
  26. package/dist/templates/specfuse-command.js +133 -5
  27. package/dist/templates/specfuse-command.js.map +1 -1
  28. package/dist/templates/specfuse-flash-agent.d.ts.map +1 -1
  29. package/dist/templates/specfuse-flash-agent.js +3 -0
  30. package/dist/templates/specfuse-flash-agent.js.map +1 -1
  31. package/dist/templates/traceability.d.ts +29 -0
  32. package/dist/templates/traceability.d.ts.map +1 -0
  33. package/dist/templates/traceability.js +81 -0
  34. package/dist/templates/traceability.js.map +1 -0
  35. package/package.json +1 -1
package/README.md CHANGED
@@ -103,6 +103,56 @@ Verify /opsx:verify → /opsx:archive —— 全量验收与归档
103
103
 
104
104
  这些命令都由模型按推荐答案自答并记录在最终报告中:模型切换默认不切换,FuseReview 自动进入,verify 全部通过后 archive,全程不 commit、不 push。verify 仍失败时不 archive,保留变更目录并把失败写进报告。`/specfuse:full` 把 FuseQA 放在 FuseReview 之后、Verify 之前,让它新写的用例进入随后的全量测试。默认的 `/opsx:*` 交互行为不受影响。
105
105
 
106
+ ### Beat hooks(外部检查扩展点)
107
+
108
+ 想让项目自己的检查(质量门禁、合规扫描、指标快照)固定在流水线的边界运行,可在项目根目录声明 `.specfuse/beat-hook`。这是一个通用扩展点,不绑定任何具体外部模块。
109
+
110
+ - 文件为 UTF-8 文本:以 `#` 开头的行是注释,其余非空行为 `key=value`,恰好两个键 `protocol` 和 `command`,`command` 的值取该行剩余部分。
111
+ - 文件不存在时所有 beat hook 均为 no-op,既不失败也不停止;`protocol` 不是 `1`,或没有非空的 `command=` 行时,一个都不运行。两种情况都在最终报告里留一行记录。
112
+ - `protocol=1` 时,每个边界以 POSIX shell 从项目根目录执行 `SPECFUSE_BEAT_PROTOCOL=1 <command> <beat> <change>`。
113
+ - 六个边界依次为 `pre-think`、`post-think`、`post-apply`、`post-review`、`pre-archive`、`post-archive`。
114
+ - 每次运行的 stdout 写到 change 目录的 `handoff/beat-<beat>.json`,其中工作区根目录的绝对路径替换为 `.`;重跑覆盖同一个文件。
115
+ - 退出码 `0` 且 `outcome` 为 `continue` 继续;退出码 `2` 且 `outcome` 为 `block` 先修复再重跑;其它非零退出视为未完成。无人值守模式每个边界最多两轮修复,仍未通过则停止且不归档。
116
+
117
+ ### 评审记录与测试结果
118
+
119
+ FuseReview 关闭后(最后一次修复复审之后、`post-review` beat hook 之前),主模型在 change 根目录写 `openspec/changes/<change>/review.md`。评审者自己的笔记(例如 flashmode 的 `handoff/review.md`)不替代这个文件,subagent 也不写它。
120
+
121
+ - 记录里恰好一行以 `FuseReview: ` 开头,取值 `FuseReview: PASS|CONCERNS|BLOCK`;正文、标题和缩进行都不承载该判定,出现第二行判定或其它取值即判定无效。
122
+ - `PASS`:没有未处理发现,且评审为冷读;`CONCERNS`:没有未关闭的 Blocking 发现,但仍有未处理 Suggestion 或评审不是冷读;`BLOCK`:修复轮次用尽后 Blocking 发现仍未关闭。
123
+ - 判定反映最后一次修复复审之后的状态。`CONCERNS` 不阻止归档;`BLOCK` 在 `post-review` 之后停止运行且不归档。
124
+ - 发现清单位于一个 info string 为 `reflection` 的围栏代码块里,顶层键为 `items`,每项有 `id` 与 `status`(`open`、`addressed`、`waived`);`waived` 项还要有非空的 `reason`、`owner`、`expires`(`YYYY-MM-DD`)。没有条目时写 `items:` 并留空值,不写 `items: []`。
125
+ - 交互模式下用户在 Phase 2.5 拒绝评审时仍写记录:判定 `FuseReview: CONCERNS`,正文写明 `FuseReview skipped by user` 与检查点列出的 change 事实,并在 `reflection` 中留一个 `id: review-skipped`、`status: waived` 的条目,30 天后到期;随后照常运行 `post-review`。
126
+
127
+ 项目可在自身 `CLAUDE.md` 的 `## Test Result Declaration` 段(位于 FUSION 块之外)声明机器可读的测试结果:
128
+
129
+ - `format`:`junit` 或 `pytest-json`,分别写 `evidence/verify-result.xml` 与 `evidence/verify-result.json`。
130
+ - `command`:写出结果文件的命令,含 `{out}`,运行时替换为该路径。
131
+
132
+ 声明只在两个时点从项目根目录运行:实现结束、`post-apply` 之前一次;Verify 中随全量测试一次。后一次覆盖前一次,最终保留 Verify 的结果,结果文件位于 change 目录的 `openspec/changes/<change>/evidence/verify-result.<ext>`。两种扩展名不会同时存在;改代码、测试或文档的修复轮次要在重跑 `post-apply` 前重跑该命令;非零退出视同测试失败。没有声明时不写结果文件,终端原始输出仍写 `evidence/*.txt`。
133
+
134
+ ### 需求简报(spec-meta)
135
+
136
+ `proposal.md` 里放一个 info string 为 `spec-meta` 的围栏代码块,作为需求简报。字段固定为七个,不可增删或改名:`scope` 必填,`workType`、`priority`、`source`、`stakeholder`、`nfrThresholds`、`scopeExclusions` 可选。
137
+
138
+ - 每个字段是含 `value` 与 `decidedBy` 的块映射;`decidedBy` 取 `human` 或 `ai`,取 `ai` 时还必须有不空的 `reason`。
139
+ - `workType` 取 `feature`、`bugfix`、`refactor`、`chore`;`priority` 取 `must`、`should`、`could`、`wont`。
140
+ - `nfrThresholds` 与 `scopeExclusions` 是字符串列表,可以为空 `[]`。
141
+
142
+ `design.md` 里放 `## Clarifications` 段,每个澄清是一个 info string 为 `clarification` 的围栏代码块:必填 `question` 与 `status`(`open` 或 `answered`),可选 `answer`、`options`、`impacts`、`decidedBy`、`reason`。`status: answered` 必须有非空 `answer`,`status: open` 不带 `answer`;`decidedBy: ai` 必须有非空 `reason`。每个记录为 `decidedBy: ai` 的字段都要有一条已答的 `clarification` 块;记录为 `decidedBy: human` 的字段,其 `clarification` 块可选。已经记录为 `decidedBy: human` 的字段,模型永不改写。
143
+
144
+ - 无人值守(`/specfuse`、`/specfuse:full`、`/specfuse:flashmode` 及 dsh 入口):不提问;需求文本已给出的字段记为 `decidedBy: human`,其余字段取推荐值并记 `decidedBy: ai` 加 `reason`,同时在 `design.md` 写一条已答的 `clarification` 块。
145
+ - 交互式(Path A 与 Path B):brainstorming 先读 `pre-think` 节拍的输出,列出需求缺失的业务字段,一次一问、按影响排序,最多 5 个问题;用户作答的字段记 `decidedBy: human`,未问到的记 `decidedBy: ai`,用户委托给模型的记 `decidedBy: ai` 并写 `reason: delegated`。
146
+
147
+ ### 可追溯写法
148
+
149
+ 任务、测试与 E2E 用例都按同一种形式回指 spec 场景,检查才能顺着链接找到它;写成别的形式即等于没有链接。
150
+
151
+ - 引用写作 `spec: <capability> / Scenario: <name>`,同一能力的其它场景接在 `; Scenario: <name>` 之后;任务还可以用 `spec: <capability> / Requirement: <name>` 指一个需求。测试与 E2E 台账只引用 `Scenario:`,不引用 `Requirement:`。
152
+ - `tasks.md` 的每个任务块写一行 `traces-to: <引用>`,再加一到多行 `files: <路径>[, <路径>]`,列出该任务改动的文件,路径相对项目根目录;只跑验证的任务不写 `files:` 行。
153
+ - 每个测试声明在紧跟其上的注释块里写 `traces-to: <引用>`,沿用该语言的注释语法(`// traces-to:`、`# traces-to:`)。注释与声明之间隔了空行或别的代码就不再关联;文件顶部的汇总注释不算。
154
+ - 每个能力的 E2E 台账为 `tests/e2e/<capability>/ledger.md`,其 `## Addition` 表有 `Case` 与 `Traces to` 两列。`Case` 写作 `` `<file>::<test name>` ``,`<file>` 相对台账所在目录;`Traces to` 写一个引用或 `defect: <描述>`。
155
+
106
156
  ### Flashmode(成本优化)
107
157
 
108
158
  `/specfuse:flashmode <需求描述>` 按 `/specfuse:full` 的完整顺序执行,但把 Do、FuseReview、FuseQA 三拍交给 `specfuse-flash` 的 subagent;Think(制品)、Verify 与归档仍由主模型完成。subagent 顺序执行,不使用 worktree,也没有 merge。
@@ -112,6 +162,7 @@ Verify /opsx:verify → /opsx:archive —— 全量验收与归档
112
162
  - 脚手架运行时已打开的 Claude Code 会话不会加载新写入的 agent 定义,需要新开一个 Claude Code 会话。
113
163
  - `CLAUDE_CODE_SUBAGENT_MODEL_FORCE=1` 会让宿主忽略所有 agent 定义的 `model`,包括这一个。
114
164
  - dsh 没有 flashmode 入口:该模式依赖 Claude Code 的具名 agent 与模型绑定。
165
+ - 长任务覆盖多个 change 时,可由一个编排 agent 充当该命令的主模型,为每个 change 各执行一次 `/specfuse:flashmode`;Do、FuseReview、FuseQA 仍交给 `specfuse-flash` subagent。
115
166
  - Do 的交接记录与证据先放在被 `.gitignore` 忽略的 `tmp/` 目录,评审结束后移入 change 目录的 `handoff/` 与 `evidence/`,随归档保留。
116
167
 
117
168
  ### Think
@@ -180,6 +231,8 @@ Verify /opsx:verify → /opsx:archive —— 全量验收与归档
180
231
 
181
232
  删除 `CLAUDE.md` 里的 FUSION 块,项目即回到无调度状态——整套编排零侵入、可逆。
182
233
 
234
+ `## Test Result Declaration` 段只写入新建的 `CLAUDE.md`。已有项目重新 scaffold 不会把这段添加到现有文件,需要项目维护者手动在 FUSION 块之外补上;不补则该项目声明为空,不写测试结果文件。
235
+
183
236
  ## 与技术栈无关
184
237
 
185
238
  SpecFuse 是流程,不是栈选择器。四拍对 Rust、React 或一个裸脚本完全一致,所以初始化时不会问你用什么栈,也不生成栈特化内容:
@@ -63,8 +63,12 @@ properties:
63
63
  type: string
64
64
  description: >-
65
65
  Why this case exists: the spec Scenario it derives from, or the escaped
66
- defect it was written for. A case with no traceable source cannot be
67
- retired later on evidence.
66
+ defect it was written for. A value naming a spec source names only
67
+ `Scenario:` items, joined with `; Scenario: <name>`; a value naming an
68
+ escaped defect stays `defect: <description>`. The value is also written as
69
+ the comment directly above the test declaration. A case with no traceable
70
+ source cannot be retired later on evidence.
68
71
  examples:
69
72
  - "spec: <capability> / Scenario: <name>"
73
+ - "spec: <capability> / Scenario: <name>; Scenario: <name>"
70
74
  - "defect: entry guard failed through symlinked bin shim"
@@ -5,7 +5,7 @@ lifecycle so the suite stays trustworthy as it grows.
5
5
 
6
6
  Cases live in `tests/e2e/<capability>/`, the capability name matching
7
7
  `openspec/specs/<capability>/`. That alignment IS the index — no separate
8
- mapping file to drift.
8
+ mapping file to drift. This file is `tests/e2e/<capability>/ledger.md`.
9
9
 
10
10
  A suite that only grows rots: cases outlive their requirements, drift into
11
11
  permanent red, and get skipped wholesale. Retirement with a recorded reason is
@@ -13,12 +13,12 @@ what prevents that.
13
13
 
14
14
  ## Addition
15
15
 
16
- | Field | Content |
17
- |---|---|
18
- | Case | file path and case name |
19
- | Capability | the `<capability>` it sits under |
20
- | Traces to | the spec Scenario it derives from, or the escaped defect it was written for |
21
- | Shape | CLI / HTTP API / WebUI / Library / Data artifact (or the derived conclusion) |
16
+ `Case` is `` `<file>::<test name>` ``, with `<file>` relative to this ledger's
17
+ directory. `Traces to` is a reference or `defect: <description>`. `Capability`
18
+ is the `<capability>` the case sits under, and `Shape` names the entry recipe.
19
+
20
+ | Case | Capability | Traces to | Shape |
21
+ |---|---|---|---|
22
22
 
23
23
  A case with no traceable source cannot later be retired on evidence — nobody
24
24
  will know what it was protecting.
@@ -27,7 +27,7 @@ will know what it was protecting.
27
27
 
28
28
  | Field | Content |
29
29
  |---|---|
30
- | Case | file path and case name |
30
+ | Case | `` `<file>::<test name>` `` |
31
31
  | What changed | the assertion, the entry construction, or the isolation |
32
32
  | Why the original was wrong | the actual misjudgment |
33
33
  | Evidence the implementation is correct | how it was established that the product was not at fault |
@@ -39,7 +39,7 @@ test until it passes. A correction without it is not a correction.
39
39
 
40
40
  | Field | Content |
41
41
  |---|---|
42
- | Case | file path and case name |
42
+ | Case | `` `<file>::<test name>` `` |
43
43
  | Reason no longer valid | requirement withdrawn / entry point restructured / superseded by a better case |
44
44
  | Superseded by | the replacing case, if any |
45
45
 
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Renders the beat hook rules shared by every SpecFuse entry point.
3
+ *
4
+ * The rules are prose: no runtime in this package reads `.specfuse/beat-hook`.
5
+ * Each entry point renders this text once and adds its own heading and its own
6
+ * boundary list. `context` changes only the fix-round cap sentence and the
7
+ * report noun, because interactive mode has a human to decide after two
8
+ * rounds, while the unattended modes have none.
9
+ */
10
+ export declare const BEAT_HOOK_FILE = ".specfuse/beat-hook";
11
+ export declare const BEATS: readonly ["pre-think", "post-think", "post-apply", "post-review", "pre-archive", "post-archive"];
12
+ export type Beat = (typeof BEATS)[number];
13
+ export declare function renderBeatHookRules(context: 'unattended' | 'interactive'): string;
14
+ //# sourceMappingURL=beat-hook.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"beat-hook.d.ts","sourceRoot":"","sources":["../../src/templates/beat-hook.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc,wBAAwB,CAAC;AAEpD,eAAO,MAAM,KAAK,kGAOR,CAAC;AAEX,MAAM,MAAM,IAAI,GAAG,CAAC,OAAO,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC;AAE1C,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,YAAY,GAAG,aAAa,GACpC,MAAM,CAsCR"}
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Renders the beat hook rules shared by every SpecFuse entry point.
3
+ *
4
+ * The rules are prose: no runtime in this package reads `.specfuse/beat-hook`.
5
+ * Each entry point renders this text once and adds its own heading and its own
6
+ * boundary list. `context` changes only the fix-round cap sentence and the
7
+ * report noun, because interactive mode has a human to decide after two
8
+ * rounds, while the unattended modes have none.
9
+ */
10
+ export const BEAT_HOOK_FILE = '.specfuse/beat-hook';
11
+ export const BEATS = [
12
+ 'pre-think',
13
+ 'post-think',
14
+ 'post-apply',
15
+ 'post-review',
16
+ 'pre-archive',
17
+ 'post-archive',
18
+ ];
19
+ export function renderBeatHookRules(context) {
20
+ const interactive = context === 'interactive';
21
+ const reportLine = interactive
22
+ ? 'Record either case as one line in the final report (the completion report in interactive mode).'
23
+ : 'Record either case as one line in the final report.';
24
+ const cap = interactive
25
+ ? 'Under `/specfuse`, `/specfuse:full`, and `/specfuse:flashmode`, no beat hook allows more than two fix rounds; one still non-zero after them stops the run without archiving, and its last stdout goes into the final report. In interactive mode, after two fix rounds report the last stdout to the user and do not archive until the beat hook passes.'
26
+ : 'No beat hook allows more than two fix rounds; one still non-zero after them stops the run without archiving, and its last stdout goes into the final report.';
27
+ return `A project can attach an external command to six boundaries of this pipeline by declaring it in \`${BEAT_HOOK_FILE}\` at the project root. The file is UTF-8 text: a line starting with \`#\` is a comment, and every other non-empty line is \`key=value\` with exactly two keys, \`protocol\` and \`command\`. The value of \`command\` is the rest of its line.
28
+
29
+ - When the file does not exist, every beat hook is a no-op: the run neither fails nor stops.
30
+ - When \`protocol\` is not \`1\`, or no non-empty \`command=\` line exists, no beat hook runs at all, because an unknown protocol version cannot be assumed to take the same arguments.
31
+ - ${reportLine}
32
+
33
+ When \`protocol\` is \`1\`, run each beat hook from the project root with POSIX shell:
34
+
35
+ \`\`\`sh
36
+ SPECFUSE_BEAT_PROTOCOL=1 <command> <beat> <change>
37
+ \`\`\`
38
+
39
+ \`<command>\` is the declared command, \`<beat>\` is one of \`pre-think\`, \`post-think\`, \`post-apply\`, \`post-review\`, \`pre-archive\`, or \`post-archive\`, and \`<change>\` is the change name.
40
+
41
+ Decide by the \`outcome\` field of the JSON object on stdout, not by the exit code alone:
42
+
43
+ - Exit \`0\` with \`outcome\` \`continue\`: the stdout joins the context; continue.
44
+ - Exit \`2\` with \`outcome\` \`block\`: stop advancing, fix what \`reasons\` names, and rerun the same beat hook.
45
+ - Any other non-zero exit, including exit \`2\` whose stdout carries no \`outcome\`: the beat hook did not complete; fix the cause and rerun the same beat hook.
46
+
47
+ ${cap}
48
+
49
+ A \`post-review\` result whose \`reasons\` include \`review-block\` is terminal: do not rerun the beat hook, do not fix further, do not open another review, and stop without archiving. A non-zero \`post-archive\` is reported and never rolls the archive back.
50
+
51
+ Write each run's stdout to \`openspec/changes/<change>/handoff/beat-<beat>.json\`, replacing the absolute path of the workspace root with \`.\` and changing nothing else. A rerun overwrites the file, so each beat hook keeps only its last result and the final report's exit codes match these files. \`post-archive\` runs after the archive, so its stdout goes to the archived change directory's \`handoff/\`. These files are beat hook output, not review material.
52
+
53
+ When a fix round after \`post-apply\` changes code, tests, or docs, rerun \`post-apply\` before the next step.
54
+
55
+ The main model runs every beat hook; a subagent never runs one.`;
56
+ }
57
+ //# sourceMappingURL=beat-hook.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"beat-hook.js","sourceRoot":"","sources":["../../src/templates/beat-hook.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,qBAAqB,CAAC;AAEpD,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB,WAAW;IACX,YAAY;IACZ,YAAY;IACZ,aAAa;IACb,aAAa;IACb,cAAc;CACN,CAAC;AAIX,MAAM,UAAU,mBAAmB,CACjC,OAAqC;IAErC,MAAM,WAAW,GAAG,OAAO,KAAK,aAAa,CAAC;IAC9C,MAAM,UAAU,GAAG,WAAW;QAC5B,CAAC,CAAC,iGAAiG;QACnG,CAAC,CAAC,qDAAqD,CAAC;IAC1D,MAAM,GAAG,GAAG,WAAW;QACrB,CAAC,CAAC,0VAA0V;QAC5V,CAAC,CAAC,8JAA8J,CAAC;IAEnK,OAAO,oGAAoG,cAAc;;;;IAIvH,UAAU;;;;;;;;;;;;;;;;EAgBZ,GAAG;;;;;;;;gEAQ2D,CAAC;AACjE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"claude-md.d.ts","sourceRoot":"","sources":["../../src/templates/claude-md.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAyFnD,wBAAgB,gBAAgB,IAAI,MAAM,CA0DzC;AAED,wBAAgB,qBAAqB,IAAI,MAAM,CA2B9C;AAED,wBAAgB,oBAAoB,IAAI,MAAM,CAkB7C;AAED,wBAAgB,qBAAqB,IAAI,MAAM,CAY9C;AAED,wBAAgB,cAAc,IAAI,MAAM,CA4BvC;AAED,wBAAgB,iBAAiB,IAAI,MAAM,CAU1C;AAiBD,wBAAgB,eAAe,CAAC,IAAI,EAAE,eAAe,GAAG,MAAM,CAsC7D"}
1
+ {"version":3,"file":"claude-md.d.ts","sourceRoot":"","sources":["../../src/templates/claude-md.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAqHnD,wBAAgB,gBAAgB,IAAI,MAAM,CA6DzC;AAED,wBAAgB,qBAAqB,IAAI,MAAM,CA+B9C;AAED,wBAAgB,oBAAoB,IAAI,MAAM,CAoB7C;AAED,wBAAgB,qBAAqB,IAAI,MAAM,CAY9C;AAoCD,wBAAgB,cAAc,IAAI,MAAM,CA+BvC;AAED,wBAAgB,iBAAiB,IAAI,MAAM,CAc1C;AAiBD,wBAAgB,eAAe,CAAC,IAAI,EAAE,eAAe,GAAG,MAAM,CAkD7D"}
@@ -1,3 +1,7 @@
1
+ import { renderBeatHookRules } from "./beat-hook.js";
2
+ import { renderReviewRecordRules, renderSkippedReviewRecord, renderTestResultDeclarationSection, renderTestResultRules, } from "./pipeline-records.js";
3
+ import { renderInteractiveBriefQuestions, renderRequirementBriefRules, renderUnattendedBriefDecisions, } from "./requirement-brief.js";
4
+ import { renderLedgerTracePointer, renderTaskTracePointer, renderTestTracePointer, renderTraceabilityRules, } from "./traceability.js";
1
5
  function renderCommitConvention() {
2
6
  return `## Commit Convention
3
7
  - Use conventional commits: feat:, fix:, refactor:, test:, docs:, chore:
@@ -27,6 +31,7 @@ When \`/opsx:propose\` is invoked:
27
31
  1. **MUST activate Superpowers \`brainstorming\` as a pre-requisite skill.**
28
32
  - Ask ONE question at a time (Socratic method). Never fire multiple questions in a single turn.
29
33
  - Proactively present 2-3 architectural alternatives with explicit trade-offs.
34
+ - **Requirement brief:** read the pre-think beat's output first and ask about the business fields the requirement leaves out, one at a time and ordered by impact, at most five questions in all; the artifacts carry the \`spec-meta\` block and a \`clarification\` block for each field the model decided (see Requirement Brief above).
30
35
  - **STOP brainstorming BEFORE its "Write design doc" step (step 6).** Do NOT write to \`docs/superpowers/specs/\`. All spec files are managed exclusively by OpenSpec.
31
36
  - **If the three-gate test (see DESIGN-TOKENS.md Generation Rules above) triggers:** MUST invoke \`/design-md\` skill NOW (before generating artifacts). For weak intent, state that visual design was not discussed in brainstorming before running the questionnaire. Complete the questionnaire → generate DESIGN-TOKENS.md → THEN proceed.
32
37
  - Only after human confirms the approach, generate ALL artifacts (proposal -> design -> specs -> tasks) in one pass.
@@ -36,7 +41,11 @@ When \`/opsx:propose\` is invoked:
36
41
  3. Every proposal artifact MUST contain:
37
42
  - **Non-goals** section (what this change explicitly does NOT do)
38
43
  - **Trade-offs** section (alternatives considered and why they were rejected)
39
- - **Verification strategy** (how we know this change works)`;
44
+ - **Verification strategy** (how we know this change works)
45
+
46
+ 4. **Beat hooks.** Run the \`pre-think\` beat hook after the change is created and before the first artifact, and the \`post-think\` beat hook after \`tasks.md\` is written (see Beat Hooks above).
47
+
48
+ 5. **Traceability.** ${renderTaskTracePointer()}`;
40
49
  }
41
50
  function renderPathB() {
42
51
  return `### Path B: Step-by-Step Change
@@ -47,6 +56,7 @@ When \`/opsx:new\` is invoked:
47
56
 
48
57
  2. **BEFORE drafting the first artifact (proposal), MUST activate Superpowers \`brainstorming\`.**
49
58
  - Use Socratic questioning to clarify scope, non-goals, and trade-offs.
59
+ - **Requirement brief:** read the pre-think beat's output first and ask about the business fields the requirement leaves out, one at a time and ordered by impact, at most five questions in all; the artifacts carry the \`spec-meta\` block and a \`clarification\` block for each field the model decided (see Requirement Brief above).
50
60
  - **STOP brainstorming BEFORE its "Write design doc" step (step 6).** Do NOT write to \`docs/superpowers/specs/\`. All spec files are managed exclusively by OpenSpec.
51
61
  - **If the three-gate test (see DESIGN-TOKENS.md Generation Rules above) triggers:** MUST invoke \`/design-md\` skill NOW (before drafting proposal). For weak intent, state that visual design was not discussed in brainstorming before running the questionnaire. Complete the questionnaire → generate DESIGN-TOKENS.md → THEN proceed.
52
62
  - Only after the user confirms the approach, draft the proposal artifact.
@@ -63,7 +73,11 @@ When \`/opsx:new\` is invoked:
63
73
 
64
74
  4. **Pace control: one artifact per \`/opsx:continue\` invocation.**
65
75
  - Never auto-advance to the next artifact without explicit user confirmation.
66
- - This is the key difference from Path A — the user controls the rhythm.`;
76
+ - This is the key difference from Path A — the user controls the rhythm.
77
+
78
+ 5. **Beat hooks.** Run the \`pre-think\` beat hook once the change directory exists and before drafting the proposal, and the \`post-think\` beat hook after \`tasks.md\` is written (see Beat Hooks above).
79
+
80
+ 6. **Traceability.** ${renderTaskTracePointer()}`;
67
81
  }
68
82
  function renderExploration() {
69
83
  return `### Exploration
@@ -100,6 +114,7 @@ When \`/opsx:apply\` is invoked:
100
114
  a. Write a failing test FIRST
101
115
  b. Write minimal code to make it pass
102
116
  c. Refactor while keeping tests green
117
+ - ${renderTestTracePointer()}
103
118
 
104
119
  2. **MUST activate Superpowers \`verification-before-completion\` before marking ANY task done.**
105
120
  - **IRON LAW: NO COMPLETION CLAIMS WITHOUT FRESH VERIFICATION EVIDENCE.**
@@ -137,7 +152,9 @@ When \`/opsx:apply\` is invoked:
137
152
  Worktree is NOT needed when:
138
153
  - Single-file bugfix
139
154
  - Adding a new independent module (no impact on existing code)
140
- - Documentation or configuration adjustments`;
155
+ - Documentation or configuration adjustments
156
+
157
+ 6. **Beat hooks.** When every task passes, run the \`post-apply\` beat hook (see Beat Hooks above). Before it, run the declared test result command, if any (see Test Results above).`;
141
158
  }
142
159
  export function renderApplyFuseReview() {
143
160
  return `### Phase 2.5: FuseReview Checkpoint (Post-Apply)
@@ -154,6 +171,10 @@ FuseReview is the post-apply review: Think reviews direction, Do produces code,
154
171
 
155
172
  **If the user declines:** record the skip decision in the apply completion report together with the change facts (task count, subagent usage, modules), so the skip is auditable rather than invisible.
156
173
 
174
+ **Review record:** when the review closes, write the change-root \`review.md\` (see Review Record above); when the user declines, write the skipped-review record described there instead. A \`BLOCK\` decision stops before archive.
175
+
176
+ **Beat hooks:** when the review closes — or after the skip is recorded when the user declines — run the \`post-review\` beat hook (see Beat Hooks above).
177
+
157
178
  **Prose changes use the FuseDoc standard:** when the reviewed diff changes prose — docs, comments, READMEs, diagnostics — apply the FuseDoc standard (see Documentation Standard above) alongside the review method. The skill owns the rules; this file does not restate them.
158
179
 
159
180
  **Handling findings:**
@@ -184,6 +205,8 @@ FuseQA verifies the built artifact through real user entry points. It is **not p
184
205
 
185
206
  **Cases are project assets with a recorded lifecycle.** Cases live in \`tests/e2e/<capability>/\`, the capability name matching \`openspec/specs/<capability>/\`. Addition records its source (the spec Scenario or the escaped defect); correction records why the prior judgment was wrong; removal records why the case is no longer valid. Without a reason, "deleting a red case" and "hiding a defect" are indistinguishable in the ledger.
186
207
 
208
+ ${renderLedgerTracePointer()}
209
+
187
210
  The full method lives at \`.claude/skills/fuseqa/SKILL.md\`.`;
188
211
  }
189
212
  export function renderFuseDocStandard() {
@@ -199,6 +222,35 @@ The standard lives at \`.claude/skills/fusedoc/SKILL.md\`. It governs three thin
199
222
 
200
223
  Scope is required. An invocation naming no scope reports the missing input rather than inferring a repository-wide one.`;
201
224
  }
225
+ function renderBeatHooks() {
226
+ return `### Beat Hooks
227
+
228
+ ${renderBeatHookRules('interactive')}`;
229
+ }
230
+ function renderReviewRecord() {
231
+ return `### Review Record
232
+
233
+ ${renderReviewRecordRules()}
234
+
235
+ ${renderSkippedReviewRecord()}`;
236
+ }
237
+ function renderTestResults() {
238
+ return `### Test Results
239
+
240
+ ${renderTestResultRules('interactive')}`;
241
+ }
242
+ function renderRequirementBrief() {
243
+ return `### Requirement Brief
244
+
245
+ ${renderRequirementBriefRules()}
246
+
247
+ ${renderInteractiveBriefQuestions()}`;
248
+ }
249
+ function renderTraceability() {
250
+ return `### Traceability
251
+
252
+ ${renderTraceabilityRules()}`;
253
+ }
202
254
  export function renderAutoMode() {
203
255
  return `### Auto Mode: /specfuse
204
256
 
@@ -206,12 +258,15 @@ export function renderAutoMode() {
206
258
 
207
259
  **Automatic decisions.** Do not call \`AskUserQuestion\` for any decision point. The model answers with the recommended option and records the decision with its rationale in the final report:
208
260
  - **Brainstorming:** derive 2–3 alternatives with trade-offs, select the recommended one, and write the selection and rationale into \`design.md\`.
261
+ - **Requirement brief:** ${renderUnattendedBriefDecisions()} See Requirement Brief above.
209
262
  - **Design tokens:** when the three-gate test triggers \`/design-md\`, answer the questionnaire with recommended values; never overwrite an existing \`DESIGN-TOKENS.md\`.
210
263
  - **Model switch:** record \`continue with current model\`; do not switch and do not ask.
211
264
  - **FuseReview:** record \`auto: entered\` and run the review.
212
265
  - **FuseQA:** under \`/specfuse\`, not part of the pipeline; do not invoke it. It remains available only through an explicit \`/fuseqa\` request or the \`/specfuse:full\` and \`/specfuse:flashmode\` variants.
213
266
  - **Path B pace control:** generate all artifacts in one pass; do not stop between artifacts for review.
214
267
 
268
+ **Beat hooks.** A beat hook runs at six boundaries, in order: \`pre-think\` after the change is created, \`post-think\` after \`tasks.md\`, \`post-apply\` when every task passes, \`post-review\` when FuseReview closes, \`pre-archive\` after every Verify check passes and before archive, and \`post-archive\` after archive. See Beat Hooks above.
269
+
215
270
  **Execution order.** Brainstorming decisions → proposal → specs → design → tasks → apply under \`test-driven-development\` and \`verification-before-completion\` → FuseReview → verify → archive. The command definition at \`.claude/commands/specfuse.md\` carries the full procedure.
216
271
 
217
272
  **Exit sequence.** Under \`/specfuse\`, auto mode enters FuseReview. The apply completion report records the FuseReview decision only. FuseQA is not invoked and no FuseQA decision is recorded; it remains an explicit \`/fuseqa\` invocation outside this command.
@@ -234,9 +289,13 @@ export function renderVerifyPhase() {
234
289
  Before \`/opsx:archive\`:
235
290
 
236
291
  1. Run \`/opsx:verify\` to validate implementation matches all specs
237
- 2. Run the project's full test suite and paste evidence — this run **is the E2E regression gate**: the suite includes every case under \`tests/e2e/\`, and this gate MUST NOT be skipped
292
+ 2. Run the project's full test suite and paste evidence — this run **is the E2E regression gate**: the suite includes every case under \`tests/e2e/\`, and this gate MUST NOT be skipped. Run the declared test result command, if any, in the same pass (see Test Results above).
238
293
  3. Run the project's linter with zero warnings
239
294
 
295
+ 4. **Beat hooks.** After every check passes, run the \`pre-archive\` beat hook and archive only after it continues; after \`/opsx:archive\` succeeds, run the \`post-archive\` beat hook (see Beat Hooks above).
296
+
297
+ **Review record.** Do not archive while the change-root \`review.md\` says \`FuseReview: BLOCK\`; \`CONCERNS\` does not block archive.
298
+
240
299
  Prose synced into \`openspec/specs/\` follows the FuseDoc standard (see Documentation Standard above). Invoke \`/fusedoc\` on the synced text; the skill owns the rules, this file does not restate them.`;
241
300
  }
242
301
  function renderGeneralRules() {
@@ -261,6 +320,8 @@ export function composeCLAUDEmd(_ctx) {
261
320
  "",
262
321
  renderDesignTokensRules(),
263
322
  "",
323
+ renderTestResultDeclarationSection(),
324
+ "",
264
325
  "---",
265
326
  "",
266
327
  "<!-- FUSION:START -->",
@@ -271,6 +332,16 @@ export function composeCLAUDEmd(_ctx) {
271
332
  "",
272
333
  renderFuseDocStandard(),
273
334
  "",
335
+ renderBeatHooks(),
336
+ "",
337
+ renderReviewRecord(),
338
+ "",
339
+ renderTestResults(),
340
+ "",
341
+ renderRequirementBrief(),
342
+ "",
343
+ renderTraceability(),
344
+ "",
274
345
  renderAutoMode(),
275
346
  "",
276
347
  renderPathA(),
@@ -1 +1 @@
1
- {"version":3,"file":"claude-md.js","sourceRoot":"","sources":["../../src/templates/claude-md.ts"],"names":[],"mappings":"AAEA,SAAS,sBAAsB;IAC7B,OAAO;;iCAEwB,CAAC;AAClC,CAAC;AAED,SAAS,uBAAuB;IAC9B,OAAO;;;;;;;;;;;;;oJAa2I,CAAC;AACrJ,CAAC;AAED,SAAS,WAAW;IAClB,OAAO;;;;;;;;;;;;;;;;+DAgBsD,CAAC;AAChE,CAAC;AAED,SAAS,WAAW;IAClB,OAAO;;;;;;;;;;;;;;;;;;;;;;;;4EAwBmE,CAAC;AAC7E,CAAC;AAED,SAAS,iBAAiB;IACxB,OAAO;;;;;;;;;;;;qGAY4F,CAAC;AACtG,CAAC;AAED,MAAM,UAAU,gBAAgB;IAC9B,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gDAwDuC,CAAC;AACjD,CAAC;AAED,MAAM,UAAU,qBAAqB;IACnC,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;uHAyB8G,CAAC;AACxH,CAAC;AAED,MAAM,UAAU,oBAAoB;IAClC,OAAO;;;;;;;;;;;;;;;;6DAgBoD,CAAC;AAC9D,CAAC;AAED,MAAM,UAAU,qBAAqB;IACnC,OAAO;;;;;;;;;;wHAU+G,CAAC;AACzH,CAAC;AAED,MAAM,UAAU,cAAc;IAC5B,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;kNA0ByM,CAAC;AACnN,CAAC;AAED,MAAM,UAAU,iBAAiB;IAC/B,OAAO;;;;;;;;0MAQiM,CAAC;AAC3M,CAAC;AAED,SAAS,kBAAkB;IACzB,OAAO;;;;;;;2EAOkE,CAAC;AAC5E,CAAC;AAED,2EAA2E;AAC3E,8EAA8E;AAC9E,0EAA0E;AAC1E,8EAA8E;AAC9E,MAAM,UAAU,eAAe,CAAC,IAAqB;IACnD,MAAM,QAAQ,GAAG;QACf,qBAAqB;QACrB,EAAE;QACF,sBAAsB,EAAE;QACxB,EAAE;QACF,uBAAuB,EAAE;QACzB,EAAE;QACF,KAAK;QACL,EAAE;QACF,uBAAuB;QACvB,0DAA0D;QAC1D,EAAE;QACF,4EAA4E;QAC5E,sDAAsD;QACtD,EAAE;QACF,qBAAqB,EAAE;QACvB,EAAE;QACF,cAAc,EAAE;QAChB,EAAE;QACF,WAAW,EAAE;QACb,EAAE;QACF,WAAW,EAAE;QACb,EAAE;QACF,iBAAiB,EAAE;QACnB,EAAE;QACF,gBAAgB,EAAE;QAClB,EAAE;QACF,qBAAqB,EAAE;QACvB,EAAE;QACF,iBAAiB,EAAE;QACnB,EAAE;QACF,oBAAoB,EAAE;QACtB,EAAE;QACF,kBAAkB,EAAE;QACpB,qBAAqB;KACtB,CAAC;IACF,OAAO,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;AACpC,CAAC"}
1
+ {"version":3,"file":"claude-md.js","sourceRoot":"","sources":["../../src/templates/claude-md.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EACL,uBAAuB,EACvB,yBAAyB,EACzB,kCAAkC,EAClC,qBAAqB,GACtB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,+BAA+B,EAC/B,2BAA2B,EAC3B,8BAA8B,GAC/B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,wBAAwB,EACxB,sBAAsB,EACtB,sBAAsB,EACtB,uBAAuB,GACxB,MAAM,mBAAmB,CAAC;AAE3B,SAAS,sBAAsB;IA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
1
- {"version":3,"file":"fuseqa-skill.d.ts","sourceRoot":"","sources":["../../src/templates/fuseqa-skill.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,eAAe,GAAG,MAAM,CAgHhE"}
1
+ {"version":3,"file":"fuseqa-skill.d.ts","sourceRoot":"","sources":["../../src/templates/fuseqa-skill.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAOnD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,eAAe,GAAG,MAAM,CAoHhE"}
@@ -1,3 +1,4 @@
1
+ import { renderLedgerTraceRule, renderTestTraceRule, renderTraceReferenceRule, } from './traceability.js';
1
2
  export function composeFuseQASkill(_ctx) {
2
3
  return `---
3
4
  name: fuseqa
@@ -47,6 +48,8 @@ Two hard rules, both mechanically checkable:
47
48
  - **No importing project source.** A case that imports from \`../src/\` is not a FuseQA case — it is a unit test wearing a costume. This is grep-checkable, so it is checked.
48
49
  - **The artifact under test is the build output, not the source.** TDD covers \`src/\`; FuseQA covers what ships. The bin-shim entry-guard defect above passes at source level and fails as a built artifact — that gap is this skill's whole subject.
49
50
 
51
+ **Writing \`traces-to\`.** ${renderTraceReferenceRule()} ${renderTestTraceRule()}
52
+
50
53
  ---
51
54
 
52
55
  ## §3 Entry recipes
@@ -108,6 +111,8 @@ Cases live in \`tests/e2e/<capability>/\`, the capability name matching \`opensp
108
111
  - **Correction** — why the original judgment was wrong.
109
112
  - **Removal** — why the case is no longer valid. Without a reason, "deleting a red case" and "hiding a defect" look identical in the ledger.
110
113
 
114
+ **Ledger format.** ${renderLedgerTraceRule()}
115
+
111
116
  A suite that only grows rots: cases outlive their requirements, drift into permanent red, and get skipped wholesale. Retirement with a recorded reason is what keeps the suite trustworthy.
112
117
  `;
113
118
  }
@@ -1 +1 @@
1
- {"version":3,"file":"fuseqa-skill.js","sourceRoot":"","sources":["../../src/templates/fuseqa-skill.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,kBAAkB,CAAC,IAAqB;IACtD,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8GR,CAAC;AACF,CAAC"}
1
+ {"version":3,"file":"fuseqa-skill.js","sourceRoot":"","sources":["../../src/templates/fuseqa-skill.ts"],"names":[],"mappings":"AACA,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,wBAAwB,GACzB,MAAM,mBAAmB,CAAC;AAE3B,MAAM,UAAU,kBAAkB,CAAC,IAAqB;IACtD,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6BAgDoB,wBAAwB,EAAE,IAAI,mBAAmB,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBA+D3D,qBAAqB,EAAE;;;CAG3C,CAAC;AACF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"openspec-config.d.ts","sourceRoot":"","sources":["../../src/templates/openspec-config.ts"],"names":[],"mappings":"AAiCA,wBAAgB,qBAAqB,IAAI,MAAM,CAM9C"}
1
+ {"version":3,"file":"openspec-config.d.ts","sourceRoot":"","sources":["../../src/templates/openspec-config.ts"],"names":[],"mappings":"AA0CA,wBAAgB,qBAAqB,IAAI,MAAM,CAM9C"}
@@ -1,3 +1,4 @@
1
+ import { renderScenarioNameRule, renderTaskTraceRule, renderTraceReferenceRule, } from './traceability.js';
1
2
  // Stack-agnostic rule set. These are process constraints that hold for any
2
3
  // project, not stack-specific hints (crates, hooks, etc. were dropped with
3
4
  // the stack layer).
@@ -20,6 +21,7 @@ const RULES = {
20
21
  'Specs must define both success and failure behaviors',
21
22
  'Include boundary conditions and edge cases',
22
23
  'Reference concrete symbols, not vague descriptions',
24
+ renderScenarioNameRule(),
23
25
  ],
24
26
  tasks: [
25
27
  'Break tasks into chunks of max 2 hours of work',
@@ -27,6 +29,8 @@ const RULES = {
27
29
  'Tasks must follow TDD order - write test first, then implement, then refactor',
28
30
  'Every task must include a verification command',
29
31
  'Mark blocking dependencies explicitly between tasks',
32
+ renderTraceReferenceRule(),
33
+ renderTaskTraceRule(),
30
34
  ],
31
35
  };
32
36
  export function composeOpenspecConfig() {
@@ -1 +1 @@
1
- {"version":3,"file":"openspec-config.js","sourceRoot":"","sources":["../../src/templates/openspec-config.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,2EAA2E;AAC3E,oBAAoB;AACpB,MAAM,OAAO,GAAG;mEACmD,CAAC;AAEpE,MAAM,KAAK,GAA6B;IACtC,QAAQ,EAAE;QACR,2FAA2F;QAC3F,gFAAgF;QAChF,+CAA+C;QAC/C,gCAAgC;KACjC;IACD,MAAM,EAAE;QACN,gEAAgE;QAChE,iCAAiC;QACjC,qDAAqD;KACtD;IACD,KAAK,EAAE;QACL,0CAA0C;QAC1C,sDAAsD;QACtD,4CAA4C;QAC5C,oDAAoD;KACrD;IACD,KAAK,EAAE;QACL,gDAAgD;QAChD,+EAA+E;QAC/E,+EAA+E;QAC/E,gDAAgD;QAChD,qDAAqD;KACtD;CACF,CAAC;AAEF,MAAM,UAAU,qBAAqB;IACnC,OAAO;QACL,MAAM,EAAE,aAAa;QACrB,OAAO,EAAE,OAAO;QAChB,KAAK,EAAE,KAAK;KACb,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"openspec-config.js","sourceRoot":"","sources":["../../src/templates/openspec-config.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,wBAAwB,GACzB,MAAM,mBAAmB,CAAC;AAE3B,2EAA2E;AAC3E,2EAA2E;AAC3E,oBAAoB;AACpB,MAAM,OAAO,GAAG;mEACmD,CAAC;AAEpE,MAAM,KAAK,GAA6B;IACtC,QAAQ,EAAE;QACR,2FAA2F;QAC3F,gFAAgF;QAChF,+CAA+C;QAC/C,gCAAgC;KACjC;IACD,MAAM,EAAE;QACN,gEAAgE;QAChE,iCAAiC;QACjC,qDAAqD;KACtD;IACD,KAAK,EAAE;QACL,0CAA0C;QAC1C,sDAAsD;QACtD,4CAA4C;QAC5C,oDAAoD;QACpD,sBAAsB,EAAE;KACzB;IACD,KAAK,EAAE;QACL,gDAAgD;QAChD,+EAA+E;QAC/E,+EAA+E;QAC/E,gDAAgD;QAChD,qDAAqD;QACrD,wBAAwB,EAAE;QAC1B,mBAAmB,EAAE;KACtB;CACF,CAAC;AAEF,MAAM,UAAU,qBAAqB;IACnC,OAAO;QACL,MAAM,EAAE,aAAa;QACrB,OAAO,EAAE,OAAO;QAChB,KAAK,EAAE,KAAK;KACb,CAAC;AACJ,CAAC"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Renders the two pipeline records shared by every SpecFuse entry point: the
3
+ * change-root review record and the optional machine-readable test result.
4
+ *
5
+ * Both are prose: no runtime in this package reads `review.md` or a project's
6
+ * declaration. Each entry point renders these strings once; a test compares
7
+ * them across modes so the wording cannot drift.
8
+ */
9
+ export declare const REVIEW_RECORD_PATH = "openspec/changes/<change>/review.md";
10
+ export declare const TEST_RESULT_FILES: {
11
+ readonly junit: "evidence/verify-result.xml";
12
+ readonly 'pytest-json': "evidence/verify-result.json";
13
+ };
14
+ /** Decision line, state after re-review, reflection block, example. */
15
+ export declare function renderReviewRecordRules(): string;
16
+ /** Interactive-only paragraph for a declined review. */
17
+ export declare function renderSkippedReviewRecord(): string;
18
+ /** Declaration shape and run rules; context changes only the report noun. */
19
+ export declare function renderTestResultRules(context: 'unattended' | 'interactive'): string;
20
+ /** The empty project section rendered outside the FUSION block. */
21
+ export declare function renderTestResultDeclarationSection(): string;
22
+ //# sourceMappingURL=pipeline-records.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pipeline-records.d.ts","sourceRoot":"","sources":["../../src/templates/pipeline-records.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,wCAAwC,CAAC;AAExE,eAAO,MAAM,iBAAiB;;;CAGpB,CAAC;AAEX,uEAAuE;AACvE,wBAAgB,uBAAuB,IAAI,MAAM,CA0BhD;AAED,wDAAwD;AACxD,wBAAgB,yBAAyB,IAAI,MAAM,CAElD;AAED,6EAA6E;AAC7E,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,YAAY,GAAG,aAAa,GACpC,MAAM,CA8BR;AAED,mEAAmE;AACnE,wBAAgB,kCAAkC,IAAI,MAAM,CAM3D"}
@@ -0,0 +1,84 @@
1
+ /**
2
+ * Renders the two pipeline records shared by every SpecFuse entry point: the
3
+ * change-root review record and the optional machine-readable test result.
4
+ *
5
+ * Both are prose: no runtime in this package reads `review.md` or a project's
6
+ * declaration. Each entry point renders these strings once; a test compares
7
+ * them across modes so the wording cannot drift.
8
+ */
9
+ export const REVIEW_RECORD_PATH = 'openspec/changes/<change>/review.md';
10
+ export const TEST_RESULT_FILES = {
11
+ junit: 'evidence/verify-result.xml',
12
+ 'pytest-json': 'evidence/verify-result.json',
13
+ };
14
+ /** Decision line, state after re-review, reflection block, example. */
15
+ export function renderReviewRecordRules() {
16
+ return [
17
+ "After FuseReview closes — after the last fix re-review and before the `post-review` beat hook — the main model writes `" +
18
+ REVIEW_RECORD_PATH +
19
+ "`. A reviewer's working note such as `handoff/review.md` does not replace it, and a subagent never writes it. The body records the findings and how each was handled; two parts have a fixed form.",
20
+ '',
21
+ '**Decision line.** Exactly one line starts with `FuseReview: ` and carries one value of `FuseReview: PASS|CONCERNS|BLOCK`. Prose, headings, and indented lines never carry the decision; a second decision line or any other value makes the decision invalid.',
22
+ '',
23
+ '- `PASS`: no finding is open, and the review was a cold read.',
24
+ '- `CONCERNS`: no Blocking finding is open, but a Suggestion is open or the review was not a cold read.',
25
+ '- `BLOCK`: a Blocking finding is still open when the fix rounds end.',
26
+ '',
27
+ 'The decision reflects the state after the fix re-review: a finding the re-review closed is `addressed`; a finding the re-review raised and no fix round closed is `open` and counts toward the decision. `CONCERNS` does not block archive. `BLOCK` stops the run without archiving, after the `post-review` beat hook runs.',
28
+ '',
29
+ '**Reflection block.** One fenced code block whose info string is `reflection`. Its body has one top-level key, `items`, listing each finding as one item. Each item has `id` and `status`, one of `open`, `addressed`, or `waived`; a `waived` item also has non-empty `reason`, `owner`, and `expires` (a `YYYY-MM-DD` date). With no items, write `items:` with an empty value; never write `items: []`.',
30
+ '',
31
+ '````markdown',
32
+ 'FuseReview: PASS',
33
+ '',
34
+ 'No finding is open.',
35
+ '',
36
+ '```reflection',
37
+ 'items:',
38
+ '```',
39
+ '````',
40
+ ].join('\n');
41
+ }
42
+ /** Interactive-only paragraph for a declined review. */
43
+ export function renderSkippedReviewRecord() {
44
+ return '**Skipped review.** When the user declines FuseReview at the checkpoint, still write `' + REVIEW_RECORD_PATH + '`: the decision line `FuseReview: CONCERNS`; a body stating `FuseReview skipped by user` and the change facts listed at the checkpoint (task count, whether subagent mode was used, the modules touched); and a `reflection` block with one item: `id: review-skipped`, `status: waived`, a `reason` giving the user\'s reason, an `owner` naming the person who decided, and an `expires` date 30 days after the skip. Then run the `post-review` beat hook as usual.';
45
+ }
46
+ /** Declaration shape and run rules; context changes only the report noun. */
47
+ export function renderTestResultRules(context) {
48
+ const invalidDeclaration = context === 'interactive'
49
+ ? '- A section missing either item declares nothing. A `format` other than `junit` or `pytest-json`, or a `command` without `{out}`, also declares nothing; record it as one line in the final report (the completion report in interactive mode).'
50
+ : '- A section missing either item declares nothing. A `format` other than `junit` or `pytest-json`, or a `command` without `{out}`, also declares nothing; record it as one line in the final report.';
51
+ return [
52
+ 'A project may declare a command that writes machine-readable test results, in a `## Test Result Declaration` section of its `CLAUDE.md`, outside the FUSION block. The section holds two list items:',
53
+ '',
54
+ '- `format`: `junit` or `pytest-json`. `junit` writes `' +
55
+ TEST_RESULT_FILES.junit +
56
+ '` and `pytest-json` writes `' +
57
+ TEST_RESULT_FILES['pytest-json'] +
58
+ '`, both under the change directory `openspec/changes/<change>/`.',
59
+ '- `command`: the command that writes the result file. It contains `{out}`, which is replaced with that path.',
60
+ '',
61
+ 'For example, the items `format: junit` and `command: pytest --junitxml={out}` declare JUnit XML results.',
62
+ '',
63
+ '- Without a declaration no result file is written; raw terminal output still goes to `evidence/*.txt`.',
64
+ invalidDeclaration,
65
+ '- Run the declared command from the project root twice: once when implementation ends, before the `post-apply` beat hook, and once in Verify alongside the full test suite. Each run overwrites the result file, so the Verify run is the one that remains.',
66
+ '- `' +
67
+ TEST_RESULT_FILES.junit +
68
+ '` and `' +
69
+ TEST_RESULT_FILES['pytest-json'] +
70
+ '` never exist together: remove the other extension before writing.',
71
+ '- When a fix round changes code, tests, or docs, rerun the declared command before rerunning `post-apply`.',
72
+ '- A non-zero exit fails that run, as a failing test suite does.',
73
+ '- The main model runs the declared command; a subagent never runs it.',
74
+ ].join('\n');
75
+ }
76
+ /** The empty project section rendered outside the FUSION block. */
77
+ export function renderTestResultDeclarationSection() {
78
+ return [
79
+ '## Test Result Declaration',
80
+ '',
81
+ 'Optional. To have the pipeline write machine-readable test results to `evidence/verify-result.<ext>` in each change directory, add two list items to this section: `format`, either `junit` or `pytest-json`, and `command`, a command containing `{out}` — for example `format: junit` with `command: pytest --junitxml={out}`, each as a `- ` list item. Until both items exist, this project declares nothing. This section is outside the FUSION block, so rescaffolding keeps it.',
82
+ ].join('\n');
83
+ }
84
+ //# sourceMappingURL=pipeline-records.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pipeline-records.js","sourceRoot":"","sources":["../../src/templates/pipeline-records.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,qCAAqC,CAAC;AAExE,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,KAAK,EAAE,4BAA4B;IACnC,aAAa,EAAE,6BAA6B;CACpC,CAAC;A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