@warpgogol/forge 5.3.4 → 6.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/bin/cli.ts +7 -2
- package/dist/bin/cli.js +7 -2
- package/dist/bin/cli.js.map +1 -1
- package/dist/os/adr/adr.module.d.ts.map +1 -1
- package/dist/os/adr/adr.module.js +2 -0
- package/dist/os/adr/adr.module.js.map +1 -1
- package/dist/os/audit/audit.module.d.ts.map +1 -1
- package/dist/os/audit/audit.module.js +2 -0
- package/dist/os/audit/audit.module.js.map +1 -1
- package/dist/os/compass/compass.module.d.ts.map +1 -1
- package/dist/os/compass/compass.module.js +47 -15
- package/dist/os/compass/compass.module.js.map +1 -1
- package/dist/os/compass/handlers/compass-audit-handler.d.ts +2 -0
- package/dist/os/compass/handlers/compass-audit-handler.d.ts.map +1 -1
- package/dist/os/compass/handlers/compass-audit-handler.js +40 -10
- package/dist/os/compass/handlers/compass-audit-handler.js.map +1 -1
- package/dist/os/compass/handlers/compass-docs-validate.d.ts +13 -0
- package/dist/os/compass/handlers/compass-docs-validate.d.ts.map +1 -0
- package/dist/os/compass/handlers/compass-docs-validate.js +328 -0
- package/dist/os/compass/handlers/compass-docs-validate.js.map +1 -0
- package/dist/os/compass/handlers/summary-record.d.ts +11 -2
- package/dist/os/compass/handlers/summary-record.d.ts.map +1 -1
- package/dist/os/compass/handlers/summary-record.js +95 -15
- package/dist/os/compass/handlers/summary-record.js.map +1 -1
- package/dist/os/core/core.module.d.ts.map +1 -1
- package/dist/os/core/core.module.js +124 -73
- package/dist/os/core/core.module.js.map +1 -1
- package/dist/os/core/handlers/file-size-lint.d.ts.map +1 -1
- package/dist/os/core/handlers/file-size-lint.js +2 -0
- package/dist/os/core/handlers/file-size-lint.js.map +1 -1
- package/dist/os/exploration/exploration.module.d.ts.map +1 -1
- package/dist/os/exploration/exploration.module.js +3 -0
- package/dist/os/exploration/exploration.module.js.map +1 -1
- package/dist/os/naming/naming-convention.d.ts.map +1 -1
- package/dist/os/naming/naming-convention.js +11 -1
- package/dist/os/naming/naming-convention.js.map +1 -1
- package/dist/os/naming/naming.module.d.ts.map +1 -1
- package/dist/os/naming/naming.module.js +9 -2
- package/dist/os/naming/naming.module.js.map +1 -1
- package/dist/os/notes/notes.module.d.ts.map +1 -1
- package/dist/os/notes/notes.module.js +17 -6
- package/dist/os/notes/notes.module.js.map +1 -1
- package/dist/os/plan/plan.module.d.ts.map +1 -1
- package/dist/os/plan/plan.module.js +2 -0
- package/dist/os/plan/plan.module.js.map +1 -1
- package/dist/os/plugin/plugin.module.d.ts.map +1 -1
- package/dist/os/plugin/plugin.module.js +9 -2
- package/dist/os/plugin/plugin.module.js.map +1 -1
- package/dist/os/program/program.module.d.ts.map +1 -1
- package/dist/os/program/program.module.js +19 -4
- package/dist/os/program/program.module.js.map +1 -1
- package/dist/os/queue/handlers/queue-validate.d.ts.map +1 -1
- package/dist/os/queue/handlers/queue-validate.js +154 -7
- package/dist/os/queue/handlers/queue-validate.js.map +1 -1
- package/dist/os/queue/manifest.d.ts +17 -1
- package/dist/os/queue/manifest.d.ts.map +1 -1
- package/dist/os/queue/manifest.js +127 -6
- package/dist/os/queue/manifest.js.map +1 -1
- package/dist/os/queue/queue.module.d.ts.map +1 -1
- package/dist/os/queue/queue.module.js +32 -4
- package/dist/os/queue/queue.module.js.map +1 -1
- package/dist/os/queue/types.d.ts +100 -1
- package/dist/os/queue/types.d.ts.map +1 -1
- package/dist/os/queue/types.js +44 -0
- package/dist/os/queue/types.js.map +1 -1
- package/dist/os/rfc/handlers/implement-stamp.d.ts.map +1 -1
- package/dist/os/rfc/handlers/implement-stamp.js +30 -8
- package/dist/os/rfc/handlers/implement-stamp.js.map +1 -1
- package/dist/os/rfc/rfc.module.d.ts.map +1 -1
- package/dist/os/rfc/rfc.module.js +25 -6
- package/dist/os/rfc/rfc.module.js.map +1 -1
- package/dist/os/rfc/types.d.ts +12 -2
- package/dist/os/rfc/types.d.ts.map +1 -1
- package/dist/os/rfc/types.js +2 -2
- package/dist/os/rfc/types.js.map +1 -1
- package/dist/os/rfc/verification-evidence.d.ts +21 -0
- package/dist/os/rfc/verification-evidence.d.ts.map +1 -1
- package/dist/os/rfc/verification-evidence.js +134 -23
- package/dist/os/rfc/verification-evidence.js.map +1 -1
- package/dist/os/rfc/verification-refresh.d.ts.map +1 -1
- package/dist/os/rfc/verification-refresh.js +66 -37
- package/dist/os/rfc/verification-refresh.js.map +1 -1
- package/dist/os/session/handlers/save.d.ts.map +1 -1
- package/dist/os/session/handlers/save.js +42 -5
- package/dist/os/session/handlers/save.js.map +1 -1
- package/dist/os/session/session.module.d.ts.map +1 -1
- package/dist/os/session/session.module.js +5 -0
- package/dist/os/session/session.module.js.map +1 -1
- package/dist/os/spec/live-spec-merge.d.ts.map +1 -1
- package/dist/os/spec/live-spec-merge.js +55 -134
- package/dist/os/spec/live-spec-merge.js.map +1 -1
- package/dist/os/spec/live-spec-rebuild.d.ts +32 -0
- package/dist/os/spec/live-spec-rebuild.d.ts.map +1 -0
- package/dist/os/spec/live-spec-rebuild.js +272 -0
- package/dist/os/spec/live-spec-rebuild.js.map +1 -0
- package/dist/os/spec/live-spec-shared.d.ts +62 -0
- package/dist/os/spec/live-spec-shared.d.ts.map +1 -0
- package/dist/os/spec/live-spec-shared.js +315 -0
- package/dist/os/spec/live-spec-shared.js.map +1 -0
- package/dist/os/spec/live-spec-types.d.ts +17 -1
- package/dist/os/spec/live-spec-types.d.ts.map +1 -1
- package/dist/os/spec/live-spec-types.js +3 -0
- package/dist/os/spec/live-spec-types.js.map +1 -1
- package/dist/os/spec/live-spec-validate.d.ts.map +1 -1
- package/dist/os/spec/live-spec-validate.js +105 -2
- package/dist/os/spec/live-spec-validate.js.map +1 -1
- package/dist/os/spec/spec-materialize.d.ts +2 -0
- package/dist/os/spec/spec-materialize.d.ts.map +1 -1
- package/dist/os/spec/spec-materialize.js +45 -5
- package/dist/os/spec/spec-materialize.js.map +1 -1
- package/dist/os/spec/spec-schema.d.ts +19 -0
- package/dist/os/spec/spec-schema.d.ts.map +1 -1
- package/dist/os/spec/spec-schema.js +30 -0
- package/dist/os/spec/spec-schema.js.map +1 -1
- package/dist/os/spec/spec-status.d.ts +4 -0
- package/dist/os/spec/spec-status.d.ts.map +1 -1
- package/dist/os/spec/spec-status.js +19 -1
- package/dist/os/spec/spec-status.js.map +1 -1
- package/dist/os/spec/spec-validate.d.ts.map +1 -1
- package/dist/os/spec/spec-validate.js +55 -8
- package/dist/os/spec/spec-validate.js.map +1 -1
- package/dist/os/spec/spec.module.d.ts.map +1 -1
- package/dist/os/spec/spec.module.js +84 -8
- package/dist/os/spec/spec.module.js.map +1 -1
- package/dist/os/werkstatt/handlers/werkstatt-operation-validate.d.ts.map +1 -1
- package/dist/os/werkstatt/handlers/werkstatt-operation-validate.js +10 -4
- package/dist/os/werkstatt/handlers/werkstatt-operation-validate.js.map +1 -1
- package/dist/os/werkstatt/werkstatt.module.d.ts.map +1 -1
- package/dist/os/werkstatt/werkstatt.module.js +13 -4
- package/dist/os/werkstatt/werkstatt.module.js.map +1 -1
- package/dist/os/workflow/workflow.module.d.ts.map +1 -1
- package/dist/os/workflow/workflow.module.js +13 -5
- package/dist/os/workflow/workflow.module.js.map +1 -1
- package/dist/src/cli-flags.d.ts.map +1 -1
- package/dist/src/cli-flags.js +25 -5
- package/dist/src/cli-flags.js.map +1 -1
- package/dist/src/config/forge-config.d.ts +3 -0
- package/dist/src/config/forge-config.d.ts.map +1 -1
- package/dist/src/config/forge-config.js +2 -0
- package/dist/src/config/forge-config.js.map +1 -1
- package/dist/src/onboarding/doctor.d.ts.map +1 -1
- package/dist/src/onboarding/doctor.js +2 -3
- package/dist/src/onboarding/doctor.js.map +1 -1
- package/dist/src/onboarding/init.d.ts.map +1 -1
- package/dist/src/onboarding/init.js +8 -3
- package/dist/src/onboarding/init.js.map +1 -1
- package/dist/src/pipeline-status.d.ts +14 -1
- package/dist/src/pipeline-status.d.ts.map +1 -1
- package/dist/src/pipeline-status.js +28 -8
- package/dist/src/pipeline-status.js.map +1 -1
- package/dist/src/types.d.ts +7 -1
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js +6 -0
- package/dist/src/types.js.map +1 -1
- package/dist/src/utils/generated-marker.d.ts +8 -0
- package/dist/src/utils/generated-marker.d.ts.map +1 -1
- package/dist/src/utils/generated-marker.js +25 -0
- package/dist/src/utils/generated-marker.js.map +1 -1
- package/dist/src/validators/skill-validate.d.ts.map +1 -1
- package/dist/src/validators/skill-validate.js +2 -4
- package/dist/src/validators/skill-validate.js.map +1 -1
- package/os/adr/adr.module.ts +2 -0
- package/os/audit/audit.module.ts +2 -0
- package/os/compass/compass.module.ts +49 -15
- package/os/compass/handlers/compass-audit-handler.ts +51 -10
- package/os/compass/handlers/compass-docs-validate.ts +361 -0
- package/os/compass/handlers/summary-record.ts +106 -15
- package/os/compass/handlers/tests/compass-audit-record.test.ts +2 -1
- package/os/compass/handlers/tests/compass-audit-validate.test.ts +92 -3
- package/os/compass/handlers/tests/compass-docs-validate.test.ts +203 -0
- package/os/compass/handlers/tests/compass-ledger-scope.test.ts +2 -1
- package/os/compass/handlers/tests/compass-policy.test.ts +7 -1
- package/os/compass/handlers/tests/summary-record.test.ts +127 -0
- package/os/core/core.module.ts +147 -75
- package/os/core/docs-archive.test.ts +136 -0
- package/os/core/handlers/file-size-lint.ts +2 -0
- package/os/exploration/exploration.module.ts +3 -0
- package/os/naming/naming-convention.ts +11 -1
- package/os/naming/naming.module.ts +9 -2
- package/os/notes/notes.module.ts +17 -6
- package/os/plan/plan-0000-template.md +150 -0
- package/os/plan/plan.module.ts +2 -0
- package/os/plugin/plugin.module.ts +9 -2
- package/os/program/program.module.ts +19 -4
- package/os/queue/decision-ledger.test.ts +163 -0
- package/os/queue/handlers/queue-validate.ts +190 -8
- package/os/queue/manifest.ts +201 -7
- package/os/queue/queue-validate.test.ts +303 -0
- package/os/queue/queue.module.ts +32 -4
- package/os/queue/types.ts +56 -1
- package/os/rfc/handlers/implement-stamp.ts +37 -8
- package/os/rfc/rfc-read-only-no-side-effects.test.ts +1 -0
- package/os/rfc/rfc.module.ts +27 -6
- package/os/rfc/types.ts +18 -3
- package/os/rfc/verification-emit.test.ts +305 -0
- package/os/rfc/verification-evidence.ts +149 -24
- package/os/rfc/verification-refresh.test.ts +222 -1
- package/os/rfc/verification-refresh.ts +74 -38
- package/os/session/handlers/save.ts +37 -5
- package/os/session/session.module.ts +5 -0
- package/os/spec/live-spec-idempotency.pbt.test.ts +222 -0
- package/os/spec/live-spec-list-show-validate.test.ts +10 -6
- package/os/spec/live-spec-merge.test.ts +187 -7
- package/os/spec/live-spec-merge.ts +71 -155
- package/os/spec/live-spec-rebuild.test.ts +317 -0
- package/os/spec/live-spec-rebuild.ts +356 -0
- package/os/spec/live-spec-shared.ts +378 -0
- package/os/spec/live-spec-types.ts +21 -1
- package/os/spec/live-spec-validate.test.ts +317 -0
- package/os/spec/live-spec-validate.ts +106 -2
- package/os/spec/spec-materialize.test.ts +192 -0
- package/os/spec/spec-materialize.ts +48 -4
- package/os/spec/spec-schema.ts +49 -0
- package/os/spec/spec-status.ts +24 -0
- package/os/spec/spec-validate.test.ts +66 -0
- package/os/spec/spec-validate.ts +62 -8
- package/os/spec/spec.module.ts +85 -8
- package/os/werkstatt/handlers/werkstatt-operation-validate.ts +10 -4
- package/os/werkstatt/werkstatt.module.ts +13 -4
- package/os/workflow/workflow.module.ts +13 -5
- package/package.json +1 -1
- package/skills/_shared/fo-pipeline-conventions.md +126 -1
- package/skills/fo/fo-doc-audit/SKILL.md +4 -4
- package/skills/fo/fo-explore/SKILL.md +2 -1
- package/skills/fo/fo-fix/SKILL.md +11 -3
- package/skills/fo/fo-handoff/SKILL.md +4 -6
- package/skills/fo/fo-idea-create-rfc/SKILL.md +2 -1
- package/skills/fo/fo-idea-enhance/SKILL.md +23 -4
- package/skills/fo/fo-idea-i-just-want-to-see-the-result/SKILL.md +86 -22
- package/skills/fo/fo-idea-implement/SKILL.md +53 -10
- package/skills/fo/fo-idea-plan/SKILL.md +28 -6
- package/skills/fo/fo-review/SKILL.md +69 -8
- package/skills/fo/fo-session-retro/SKILL.md +3 -2
- package/skills/fo/fo-step-commit/SKILL.md +2 -0
- package/skills/shared/grilling/SKILL.md +12 -0
- package/skills/shared/writing-great-skills/GLOSSARY.md +2 -0
- package/skills/shared/writing-great-skills/SKILL.md +2 -1
- package/src/cli-flags.ts +23 -5
- package/src/config/forge-config.ts +4 -0
- package/src/onboarding/doctor.ts +2 -3
- package/src/onboarding/init.ts +8 -3
- package/src/pipeline-status.ts +32 -8
- package/src/tests/cli-flags.test.ts +20 -0
- package/src/tests/cli-output.test.ts +13 -7
- package/src/tests/fixtures/agents-generate-business-before.txt +7 -7
- package/src/tests/implement-stamp.test.ts +38 -0
- package/src/tests/session-handlers.test.ts +33 -0
- package/src/types.ts +13 -1
- package/src/utils/generated-marker.ts +28 -0
- package/src/validators/skill-validate.ts +2 -4
- package/skills/fo/fo-idea-implement/ADR-FLOW.md +0 -179
- package/skills/fo/fo-review/AXES.md +0 -70
|
@@ -117,6 +117,309 @@ describe("loadQueueManifest — validation rules (RFC-1140)", () => {
|
|
|
117
117
|
});
|
|
118
118
|
});
|
|
119
119
|
|
|
120
|
+
async function writeLedger(manifestName: string, body: string): Promise<void> {
|
|
121
|
+
await fs.writeFile(path.join(tmpDir, `docs/queues/${manifestName}.decisions.yaml`), body);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
const LEDGER_HEADER = (id: string) => `id: ${id}.decisions\nqueue: ${id}\ncreatedAt: 2026-10-09\n`;
|
|
125
|
+
|
|
126
|
+
describe("runQueueValidate — decision ledger (RFC-1250)", () => {
|
|
127
|
+
test("implement-stage item with open entry → QUEUE-07 + exitCode 1 (AC-2)", async () => {
|
|
128
|
+
await writeRfc("RFC-1500", "status: accepted\n");
|
|
129
|
+
const file = await writeManifest(
|
|
130
|
+
"block-q7",
|
|
131
|
+
"id: block-q7\ncreatedAt: 2026-10-09\nitems:\n - id: RFC-1500\n",
|
|
132
|
+
);
|
|
133
|
+
await writeLedger(
|
|
134
|
+
"block-q7",
|
|
135
|
+
`${LEDGER_HEADER("block-q7")}items:\n - id: Q-1\n doc: RFC-1500\n stage: plan\n question: which scope?\n resolutionPath: none\n status: open\n`,
|
|
136
|
+
);
|
|
137
|
+
|
|
138
|
+
const result = await runQueueValidate({ argv: [], flags: { file } }, testContext());
|
|
139
|
+
|
|
140
|
+
expect(result?.data?.status).toBe("fail");
|
|
141
|
+
expect(result?.exitCode).toBe(1);
|
|
142
|
+
expect(result?.data?.errors.some((e) => e.ruleId === "QUEUE-07")).toBe(true);
|
|
143
|
+
expect(result?.data?.items[0]?.decisions?.open).toBe(1);
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
test("no QUEUE-07 when entries are answered/auto-resolved/deferred (AC-3)", async () => {
|
|
147
|
+
await writeRfc("RFC-1501", "status: accepted\n");
|
|
148
|
+
const file = await writeManifest(
|
|
149
|
+
"block-q7b",
|
|
150
|
+
"id: block-q7b\ncreatedAt: 2026-10-09\nitems:\n - id: RFC-1501\n",
|
|
151
|
+
);
|
|
152
|
+
await writeLedger(
|
|
153
|
+
"block-q7b",
|
|
154
|
+
`${LEDGER_HEADER("block-q7b")}items:\n - id: Q-1\n doc: RFC-1501\n stage: plan\n question: a\n resolutionPath: none\n status: answered\n answer: scope A\n - id: Q-2\n doc: RFC-1501\n stage: implement\n question: b\n resolutionPath: convention\n status: auto-resolved\n answer: option B\n - id: Q-3\n doc: RFC-1501\n stage: review\n question: c\n resolutionPath: none\n status: deferred\n`,
|
|
155
|
+
);
|
|
156
|
+
|
|
157
|
+
const result = await runQueueValidate({ argv: [], flags: { file } }, testContext());
|
|
158
|
+
|
|
159
|
+
expect(result?.data?.errors.some((e) => e.ruleId === "QUEUE-07")).toBe(false);
|
|
160
|
+
expect(result?.data?.status).toBe("pass");
|
|
161
|
+
const d = result?.data?.items[0]?.decisions;
|
|
162
|
+
expect(d?.open).toBe(0);
|
|
163
|
+
expect(d?.deferred).toBe(1);
|
|
164
|
+
expect(d?.autoResolved).toBe(1);
|
|
165
|
+
expect(result?.data?.decisions).toEqual({
|
|
166
|
+
open: 0,
|
|
167
|
+
answered: 1,
|
|
168
|
+
deferred: 1,
|
|
169
|
+
autoResolved: 1,
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
test("no ledger sibling → no QUEUE-07 (AC-4)", async () => {
|
|
174
|
+
await writeRfc("RFC-1502", "status: accepted\n");
|
|
175
|
+
const file = await writeManifest(
|
|
176
|
+
"block-q7c",
|
|
177
|
+
"id: block-q7c\ncreatedAt: 2026-10-09\nitems:\n - id: RFC-1502\n",
|
|
178
|
+
);
|
|
179
|
+
|
|
180
|
+
const result = await runQueueValidate({ argv: [], flags: { file } }, testContext());
|
|
181
|
+
|
|
182
|
+
expect(result?.data?.status).toBe("pass");
|
|
183
|
+
expect(result?.data?.errors).toEqual([]);
|
|
184
|
+
expect(result?.data?.items[0]?.decisions).toBeUndefined();
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
test("open entries on pre-implement stages stay legal — no QUEUE-07", async () => {
|
|
188
|
+
await writeRfc("RFC-1503"); // status: draft, no artifacts → pending
|
|
189
|
+
const file = await writeManifest(
|
|
190
|
+
"block-q7d",
|
|
191
|
+
"id: block-q7d\ncreatedAt: 2026-10-09\nitems:\n - id: RFC-1503\n",
|
|
192
|
+
);
|
|
193
|
+
await writeLedger(
|
|
194
|
+
"block-q7d",
|
|
195
|
+
`${LEDGER_HEADER("block-q7d")}items:\n - id: Q-1\n doc: RFC-1503\n stage: enhance\n question: q\n resolutionPath: none\n status: open\n`,
|
|
196
|
+
);
|
|
197
|
+
|
|
198
|
+
const result = await runQueueValidate({ argv: [], flags: { file } }, testContext());
|
|
199
|
+
|
|
200
|
+
expect(result?.data?.errors.some((e) => e.ruleId === "QUEUE-07")).toBe(false);
|
|
201
|
+
expect(result?.data?.status).toBe("pass");
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
test("pending ADR with open entry → QUEUE-07", async () => {
|
|
205
|
+
await fs.writeFile(
|
|
206
|
+
path.join(tmpDir, "docs/adrs/adr-1504-test.md"),
|
|
207
|
+
"---\nid: ADR-1504\nstatus: proposed\n---\n# ADR-1504\n",
|
|
208
|
+
);
|
|
209
|
+
const file = await writeManifest(
|
|
210
|
+
"block-q7e",
|
|
211
|
+
"id: block-q7e\ncreatedAt: 2026-10-09\nitems:\n - id: ADR-1504\n",
|
|
212
|
+
);
|
|
213
|
+
await writeLedger(
|
|
214
|
+
"block-q7e",
|
|
215
|
+
`${LEDGER_HEADER("block-q7e")}items:\n - id: Q-1\n doc: ADR-1504\n stage: implement\n question: which adapter?\n resolutionPath: none\n status: open\n`,
|
|
216
|
+
);
|
|
217
|
+
|
|
218
|
+
const result = await runQueueValidate({ argv: [], flags: { file } }, testContext());
|
|
219
|
+
|
|
220
|
+
expect(result?.data?.errors.some((e) => e.ruleId === "QUEUE-07")).toBe(true);
|
|
221
|
+
expect(result?.exitCode).toBe(1);
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
test("next skips deferred and parked items, dependsOn cascades (AC-5)", async () => {
|
|
225
|
+
await writeRfc("RFC-1510", "status: accepted\n");
|
|
226
|
+
await writeRfc("RFC-1511", "status: draft\ndependsOn:\n - RFC-1510\n");
|
|
227
|
+
await writeRfc("RFC-1512");
|
|
228
|
+
const file = await writeManifest(
|
|
229
|
+
"block-park",
|
|
230
|
+
"id: block-park\ncreatedAt: 2026-10-09\nitems:\n - id: RFC-1510\n - id: RFC-1511\n - id: RFC-1512\n",
|
|
231
|
+
);
|
|
232
|
+
// RFC-1510 operator-deferred → parked; RFC-1511 dependsOn it → cascade-parked;
|
|
233
|
+
// next must be RFC-1512.
|
|
234
|
+
await writeLedger(
|
|
235
|
+
"block-park",
|
|
236
|
+
`${LEDGER_HEADER("block-park")}items:\n - id: Q-1\n doc: RFC-1510\n stage: implement\n question: park it\n resolutionPath: none\n status: deferred\n`,
|
|
237
|
+
);
|
|
238
|
+
|
|
239
|
+
const result = await runQueueValidate({ argv: [], flags: { file } }, testContext());
|
|
240
|
+
|
|
241
|
+
expect(result?.data?.next).toBe("RFC-1512");
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
test("open+parked entry parks the item — no QUEUE-07, next skips, batch stays green", async () => {
|
|
245
|
+
await writeRfc("RFC-1520", "status: accepted\n");
|
|
246
|
+
await writeRfc("RFC-1521");
|
|
247
|
+
const file = await writeManifest(
|
|
248
|
+
"block-park2",
|
|
249
|
+
"id: block-park2\ncreatedAt: 2026-10-09\nitems:\n - id: RFC-1520\n - id: RFC-1521\n",
|
|
250
|
+
);
|
|
251
|
+
await writeLedger(
|
|
252
|
+
"block-park2",
|
|
253
|
+
`${LEDGER_HEADER("block-park2")}items:\n - id: Q-1\n doc: RFC-1520\n stage: implement\n question: destructive op\n resolutionPath: none\n status: open\n parked: true\n`,
|
|
254
|
+
);
|
|
255
|
+
|
|
256
|
+
const result = await runQueueValidate({ argv: [], flags: { file } }, testContext());
|
|
257
|
+
|
|
258
|
+
// A parked open is already execution-gated — QUEUE-07 must not fire on
|
|
259
|
+
// it (the park is the containment); the item just drops out of `next`.
|
|
260
|
+
expect(result?.data?.status).toBe("pass");
|
|
261
|
+
expect(result?.data?.errors.some((e) => e.ruleId === "QUEUE-07")).toBe(false);
|
|
262
|
+
expect(result?.data?.next).toBe("RFC-1521");
|
|
263
|
+
expect(result?.data?.items[0]?.decisions?.open).toBe(1);
|
|
264
|
+
});
|
|
265
|
+
|
|
266
|
+
test("un-parked open on implementable item blocks it — QUEUE-07 + next skips it", async () => {
|
|
267
|
+
await writeRfc("RFC-1530", "status: accepted\n");
|
|
268
|
+
await writeRfc("RFC-1531");
|
|
269
|
+
const file = await writeManifest(
|
|
270
|
+
"block-q7-skip",
|
|
271
|
+
"id: block-q7-skip\ncreatedAt: 2026-10-09\nitems:\n - id: RFC-1530\n - id: RFC-1531\n",
|
|
272
|
+
);
|
|
273
|
+
await writeLedger(
|
|
274
|
+
"block-q7-skip",
|
|
275
|
+
`${LEDGER_HEADER("block-q7-skip")}items:\n - id: Q-1\n doc: RFC-1530\n stage: plan\n question: pending answer\n resolutionPath: none\n status: open\n`,
|
|
276
|
+
);
|
|
277
|
+
|
|
278
|
+
const result = await runQueueValidate({ argv: [], flags: { file } }, testContext());
|
|
279
|
+
|
|
280
|
+
expect(result?.data?.status).toBe("fail");
|
|
281
|
+
expect(result?.data?.errors.some((e) => e.ruleId === "QUEUE-07")).toBe(true);
|
|
282
|
+
// QUEUE-07-blocked items are not executable — `next` must not name one.
|
|
283
|
+
expect(result?.data?.next).toBe("RFC-1531");
|
|
284
|
+
});
|
|
285
|
+
|
|
286
|
+
test("ledger bound to a different manifest → QUEUE-02 error", async () => {
|
|
287
|
+
await writeRfc("RFC-1540", "status: accepted\n");
|
|
288
|
+
const file = await writeManifest(
|
|
289
|
+
"block-bind",
|
|
290
|
+
"id: block-bind\ncreatedAt: 2026-10-09\nitems:\n - id: RFC-1540\n",
|
|
291
|
+
);
|
|
292
|
+
await writeLedger(
|
|
293
|
+
"block-bind",
|
|
294
|
+
`id: block-bind.decisions\nqueue: other-queue\ncreatedAt: 2026-10-09\nitems: []\n`,
|
|
295
|
+
);
|
|
296
|
+
|
|
297
|
+
const result = await runQueueValidate({ argv: [], flags: { file } }, testContext());
|
|
298
|
+
|
|
299
|
+
expect(result?.data?.status).toBe("fail");
|
|
300
|
+
expect(result?.data?.errors.some((e) => e.ruleId === "QUEUE-02")).toBe(true);
|
|
301
|
+
});
|
|
302
|
+
|
|
303
|
+
test("ledger id mismatching filename stem → QUEUE-02 error", async () => {
|
|
304
|
+
await writeRfc("RFC-1541", "status: accepted\n");
|
|
305
|
+
const file = await writeManifest(
|
|
306
|
+
"block-stem",
|
|
307
|
+
"id: block-stem\ncreatedAt: 2026-10-09\nitems:\n - id: RFC-1541\n",
|
|
308
|
+
);
|
|
309
|
+
await writeLedger(
|
|
310
|
+
"block-stem",
|
|
311
|
+
`id: wrong-id\nqueue: block-stem\ncreatedAt: 2026-10-09\nitems: []\n`,
|
|
312
|
+
);
|
|
313
|
+
|
|
314
|
+
const result = await runQueueValidate({ argv: [], flags: { file } }, testContext());
|
|
315
|
+
|
|
316
|
+
expect(result?.data?.errors.some((e) => e.ruleId === "QUEUE-02")).toBe(true);
|
|
317
|
+
});
|
|
318
|
+
|
|
319
|
+
test("duplicate decision id → QUEUE-05 error", async () => {
|
|
320
|
+
await writeRfc("RFC-1542", "status: draft\n");
|
|
321
|
+
const file = await writeManifest(
|
|
322
|
+
"block-dup",
|
|
323
|
+
"id: block-dup\ncreatedAt: 2026-10-09\nitems:\n - id: RFC-1542\n",
|
|
324
|
+
);
|
|
325
|
+
await writeLedger(
|
|
326
|
+
"block-dup",
|
|
327
|
+
`${LEDGER_HEADER("block-dup")}items:\n - id: Q-1\n doc: RFC-1542\n stage: enhance\n question: a\n resolutionPath: none\n - id: Q-1\n doc: RFC-1542\n stage: plan\n question: b\n resolutionPath: none\n`,
|
|
328
|
+
);
|
|
329
|
+
|
|
330
|
+
const result = await runQueueValidate({ argv: [], flags: { file } }, testContext());
|
|
331
|
+
|
|
332
|
+
expect(result?.data?.status).toBe("fail");
|
|
333
|
+
expect(result?.data?.errors.some((e) => e.ruleId === "QUEUE-05")).toBe(true);
|
|
334
|
+
});
|
|
335
|
+
|
|
336
|
+
test("answered entry without answer → QUEUE-08 warning, not blocking", async () => {
|
|
337
|
+
await writeRfc("RFC-1543", "status: accepted\n");
|
|
338
|
+
const file = await writeManifest(
|
|
339
|
+
"block-noans",
|
|
340
|
+
"id: block-noans\ncreatedAt: 2026-10-09\nitems:\n - id: RFC-1543\n",
|
|
341
|
+
);
|
|
342
|
+
await writeLedger(
|
|
343
|
+
"block-noans",
|
|
344
|
+
`${LEDGER_HEADER("block-noans")}items:\n - id: Q-1\n doc: RFC-1543\n stage: plan\n question: a\n resolutionPath: none\n status: answered\n`,
|
|
345
|
+
);
|
|
346
|
+
|
|
347
|
+
const result = await runQueueValidate({ argv: [], flags: { file } }, testContext());
|
|
348
|
+
|
|
349
|
+
expect(result?.data?.status).toBe("pass");
|
|
350
|
+
expect(result?.data?.warnings.some((w) => w.ruleId === "QUEUE-08")).toBe(true);
|
|
351
|
+
});
|
|
352
|
+
|
|
353
|
+
test("decision targeting a foreign doc → QUEUE-08 warning", async () => {
|
|
354
|
+
await writeRfc("RFC-1544", "status: accepted\n");
|
|
355
|
+
const file = await writeManifest(
|
|
356
|
+
"block-foreign",
|
|
357
|
+
"id: block-foreign\ncreatedAt: 2026-10-09\nitems:\n - id: RFC-1544\n",
|
|
358
|
+
);
|
|
359
|
+
await writeLedger(
|
|
360
|
+
"block-foreign",
|
|
361
|
+
`${LEDGER_HEADER("block-foreign")}items:\n - id: Q-1\n doc: RFC-9998\n stage: plan\n question: a\n resolutionPath: none\n status: open\n`,
|
|
362
|
+
);
|
|
363
|
+
|
|
364
|
+
const result = await runQueueValidate({ argv: [], flags: { file } }, testContext());
|
|
365
|
+
|
|
366
|
+
expect(result?.data?.status).toBe("pass");
|
|
367
|
+
expect(result?.data?.warnings.some((w) => w.ruleId === "QUEUE-08")).toBe(true);
|
|
368
|
+
});
|
|
369
|
+
|
|
370
|
+
test("QUEUE-07-blocked item cascades exclusion to dependsOn dependents", async () => {
|
|
371
|
+
await writeRfc("RFC-1550", "status: accepted\n");
|
|
372
|
+
await writeRfc("RFC-1551", "status: draft\ndependsOn:\n - RFC-1550\n");
|
|
373
|
+
await writeRfc("RFC-1552");
|
|
374
|
+
const file = await writeManifest(
|
|
375
|
+
"block-q7-cascade",
|
|
376
|
+
"id: block-q7-cascade\ncreatedAt: 2026-10-09\nitems:\n - id: RFC-1550\n - id: RFC-1551\n - id: RFC-1552\n",
|
|
377
|
+
);
|
|
378
|
+
await writeLedger(
|
|
379
|
+
"block-q7-cascade",
|
|
380
|
+
`${LEDGER_HEADER("block-q7-cascade")}items:\n - id: Q-1\n doc: RFC-1550\n stage: plan\n question: unresolved\n resolutionPath: none\n status: open\n`,
|
|
381
|
+
);
|
|
382
|
+
|
|
383
|
+
const result = await runQueueValidate({ argv: [], flags: { file } }, testContext());
|
|
384
|
+
|
|
385
|
+
expect(result?.data?.status).toBe("fail");
|
|
386
|
+
expect(result?.data?.errors.some((e) => e.ruleId === "QUEUE-07")).toBe(true);
|
|
387
|
+
// RFC-1551 is pending and has no open decisions, but it depends on a
|
|
388
|
+
// QUEUE-07-blocked item — it must not execute before its dependency.
|
|
389
|
+
expect(result?.data?.next).toBe("RFC-1552");
|
|
390
|
+
});
|
|
391
|
+
|
|
392
|
+
test("broken manifest + valid ledger → no spurious QUEUE-02/QUEUE-08 noise", async () => {
|
|
393
|
+
await writeRfc("RFC-1560", "status: accepted\n");
|
|
394
|
+
const file = await writeManifest("block-broken", "id: [\n"); // unparseable YAML
|
|
395
|
+
await writeLedger(
|
|
396
|
+
"block-broken",
|
|
397
|
+
`${LEDGER_HEADER("block-broken")}items:\n - id: Q-1\n doc: RFC-1560\n stage: plan\n question: q\n resolutionPath: none\n status: open\n`,
|
|
398
|
+
);
|
|
399
|
+
|
|
400
|
+
const result = await runQueueValidate({ argv: [], flags: { file } }, testContext());
|
|
401
|
+
|
|
402
|
+
expect(result?.data?.status).toBe("fail");
|
|
403
|
+
expect(result?.data?.errors.some((e) => e.ruleId === "QUEUE-02")).toBe(false);
|
|
404
|
+
expect(result?.data?.warnings.some((w) => w.ruleId === "QUEUE-08")).toBe(false);
|
|
405
|
+
});
|
|
406
|
+
|
|
407
|
+
test("unreadable ledger (non-ENOENT) → QUEUE-01 error, never fails open", async () => {
|
|
408
|
+
await writeRfc("RFC-1545", "status: accepted\n");
|
|
409
|
+
const file = await writeManifest(
|
|
410
|
+
"block-eisdir",
|
|
411
|
+
"id: block-eisdir\ncreatedAt: 2026-10-09\nitems:\n - id: RFC-1545\n",
|
|
412
|
+
);
|
|
413
|
+
// A directory at the ledger path → EISDIR on read: not legal absence.
|
|
414
|
+
await fs.mkdir(path.join(tmpDir, "docs/queues/block-eisdir.decisions.yaml"));
|
|
415
|
+
|
|
416
|
+
const result = await runQueueValidate({ argv: [], flags: { file } }, testContext());
|
|
417
|
+
|
|
418
|
+
expect(result?.data?.status).toBe("fail");
|
|
419
|
+
expect(result?.data?.errors.some((e) => e.ruleId === "QUEUE-01")).toBe(true);
|
|
420
|
+
});
|
|
421
|
+
});
|
|
422
|
+
|
|
120
423
|
describe("runQueueValidate — command contract (RFC-1140)", () => {
|
|
121
424
|
test("throws without --file", async () => {
|
|
122
425
|
await expect(runQueueValidate({ argv: [], flags: {} }, testContext())).rejects.toThrow(
|
package/os/queue/queue.module.ts
CHANGED
|
@@ -13,6 +13,20 @@ Extract pipeline-status derivation into packages/forge/src/pipeline-status.ts, r
|
|
|
13
13
|
<item>RFC-1140: queue.validate missing contract/rules metadata (DNA-91)
|
|
14
14
|
|
|
15
15
|
fo-review REVIEW-CODE-2026-09-23-01 finding: declare contract queue and emitted ruleIds QUEUE-01..06 so validator.inventory.generate does not fail closed. Manifest regenerated.</item>
|
|
16
|
+
<item>RFC-1250: review wave — QUEUE-07 gates un-parked opens only, ledger binding checks, fail-closed loader
|
|
17
|
+
|
|
18
|
+
REVIEW-RFC-1250-01 findings: QUEUE-07 no longer fires on parked entries
|
|
19
|
+
(the park is the containment — a parked queue stays resumable and the
|
|
20
|
+
decision window arbitrates it); loader fails open only on ENOENT —
|
|
21
|
+
other read errors are QUEUE-01; ledger gains queue/id-stem binding
|
|
22
|
+
(QUEUE-02), Q-N uniqueness (QUEUE-05), and QUEUE-08 hygiene warnings
|
|
23
|
+
(missing answers, foreign doc ids); next excludes QUEUE-07-blocked
|
|
24
|
+
items; top-level decision totals added. Orchestrator pre-flight treats
|
|
25
|
+
QUEUE-07 as the window agenda — structural errors still stop the batch;
|
|
26
|
+
maturation skips parked/deferred items; uncovered imperative ask sites
|
|
27
|
+
gain collect riders (ADR code-trace, NC markers, audit-verdict guard).</item>
|
|
28
|
+
<item>RFC-1250: re-review wave — blocked dependsOn cascade, manifest-failure gating, generated artifacts</item>
|
|
29
|
+
<history>RFC-1250</history>
|
|
16
30
|
</CHANGE_SUMMARY>
|
|
17
31
|
*/
|
|
18
32
|
|
|
@@ -29,12 +43,26 @@ export async function createForgeQueueModule(): Promise<ForgeModule> {
|
|
|
29
43
|
{
|
|
30
44
|
name: "queue.validate",
|
|
31
45
|
description:
|
|
32
|
-
"Validate a queue manifest (docs/queues/*.yaml) and
|
|
33
|
-
"per-item pipeline status plus the
|
|
34
|
-
"
|
|
46
|
+
"Validate a queue manifest (docs/queues/*.yaml) and its decision " +
|
|
47
|
+
"ledger sibling, report derived per-item pipeline status plus the " +
|
|
48
|
+
"next actionable item. QUEUE-07 blocks implementable items carrying " +
|
|
49
|
+
"un-parked open decisions (RFC-1250); QUEUE-08 warns on ledger " +
|
|
50
|
+
"hygiene issues (missing answers, foreign doc ids). Read-only — " +
|
|
51
|
+
"the pipeline orchestrator runs this before a queued batch and the " +
|
|
52
|
+
"decision window consumes its diagnostics (RFC-1140). " +
|
|
53
|
+
"Required flags: `--file`.",
|
|
35
54
|
scope: "workspace",
|
|
36
55
|
contract: "queue",
|
|
37
|
-
rules: [
|
|
56
|
+
rules: [
|
|
57
|
+
"QUEUE-01",
|
|
58
|
+
"QUEUE-02",
|
|
59
|
+
"QUEUE-03",
|
|
60
|
+
"QUEUE-04",
|
|
61
|
+
"QUEUE-05",
|
|
62
|
+
"QUEUE-06",
|
|
63
|
+
"QUEUE-07",
|
|
64
|
+
"QUEUE-08",
|
|
65
|
+
],
|
|
38
66
|
mutatesState: false,
|
|
39
67
|
reads: [
|
|
40
68
|
"docs/queues/*.yaml",
|
package/os/queue/types.ts
CHANGED
|
@@ -7,10 +7,23 @@ block consumed by queue.validate and the pipeline orchestrator's queue mode.</pu
|
|
|
7
7
|
</non-goals>
|
|
8
8
|
</MODULE_CONTRACT>
|
|
9
9
|
<CHANGE_SUMMARY>
|
|
10
|
+
<item>RFC-1250: decision-ledger schemas — DecisionLedger, DecisionEntry, DecisionStatus, policies.</item>
|
|
10
11
|
<item>RFC-1140: initial QueueManifest schema and queue.validate result types.</item>
|
|
11
12
|
<item>RFC-1140: steps 1-4 — shared resolver, queue module, registration
|
|
12
13
|
|
|
13
14
|
Extract pipeline-status derivation into packages/forge/src/pipeline-status.ts, refactor rfc.pipeline.status onto it, add os/queue module with queue.validate command, register in WORKSHOP_MODULE_MAP.forge + bin/cli.ts + package.json exports.</item>
|
|
15
|
+
<item>RFC-1250: review wave — QUEUE-07 gates un-parked opens only, ledger binding checks, fail-closed loader
|
|
16
|
+
|
|
17
|
+
REVIEW-RFC-1250-01 findings: QUEUE-07 no longer fires on parked entries
|
|
18
|
+
(the park is the containment — a parked queue stays resumable and the
|
|
19
|
+
decision window arbitrates it); loader fails open only on ENOENT —
|
|
20
|
+
other read errors are QUEUE-01; ledger gains queue/id-stem binding
|
|
21
|
+
(QUEUE-02), Q-N uniqueness (QUEUE-05), and QUEUE-08 hygiene warnings
|
|
22
|
+
(missing answers, foreign doc ids); next excludes QUEUE-07-blocked
|
|
23
|
+
items; top-level decision totals added. Orchestrator pre-flight treats
|
|
24
|
+
QUEUE-07 as the window agenda — structural errors still stop the batch;
|
|
25
|
+
maturation skips parked/deferred items; uncovered imperative ask sites
|
|
26
|
+
gain collect riders (ADR code-trace, NC markers, audit-verdict guard).</item>
|
|
14
27
|
</CHANGE_SUMMARY>
|
|
15
28
|
*/
|
|
16
29
|
|
|
@@ -21,6 +34,46 @@ import type { QueueItemReport } from "../../src/pipeline-status.ts";
|
|
|
21
34
|
|
|
22
35
|
export const QUEUE_ITEM_ID_PATTERN = /^(RFC|ADR)-\d{4}$/;
|
|
23
36
|
|
|
37
|
+
export const DECISION_STATUS = ["open", "answered", "auto-resolved", "deferred"] as const;
|
|
38
|
+
export type DecisionStatus = (typeof DECISION_STATUS)[number];
|
|
39
|
+
|
|
40
|
+
export const decisionOptionSchema = z.object({
|
|
41
|
+
label: z.string().min(1),
|
|
42
|
+
consequence: z.string().optional(),
|
|
43
|
+
recommended: z.boolean().optional(),
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
export const decisionEntrySchema = z.object({
|
|
47
|
+
id: z.string().regex(/^Q-\d+$/),
|
|
48
|
+
doc: z.string().regex(QUEUE_ITEM_ID_PATTERN),
|
|
49
|
+
stage: z.enum(["idea", "enhance", "plan", "implement", "review"]),
|
|
50
|
+
question: z.string().min(1),
|
|
51
|
+
resolutionPath: z.enum(["codebase", "convention", "profile", "policy", "none"]),
|
|
52
|
+
options: z.array(decisionOptionSchema).default([]),
|
|
53
|
+
status: z.enum(DECISION_STATUS).default("open"),
|
|
54
|
+
answer: z.string().optional(),
|
|
55
|
+
answeredAt: z.string().optional(),
|
|
56
|
+
parked: z.boolean().optional(),
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
export const decisionPolicySchema = z.object({
|
|
60
|
+
id: z.string().min(1),
|
|
61
|
+
question: z.string().min(1),
|
|
62
|
+
answer: z.string().min(1),
|
|
63
|
+
appliesTo: z.union([z.literal("*"), z.array(z.string())]),
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
export const decisionLedgerSchema = z.object({
|
|
67
|
+
id: z.string().min(1),
|
|
68
|
+
queue: z.string().min(1),
|
|
69
|
+
createdAt: z.string().min(1),
|
|
70
|
+
policies: z.array(decisionPolicySchema).default([]),
|
|
71
|
+
items: z.array(decisionEntrySchema).default([]),
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
export type DecisionEntry = z.infer<typeof decisionEntrySchema>;
|
|
75
|
+
export type DecisionLedger = z.infer<typeof decisionLedgerSchema>;
|
|
76
|
+
|
|
24
77
|
export const queueManifestSchema = z.object({
|
|
25
78
|
id: z.string().min(1),
|
|
26
79
|
createdAt: z.string().min(1),
|
|
@@ -42,8 +95,10 @@ export interface QueueValidateResult {
|
|
|
42
95
|
queue: string;
|
|
43
96
|
file: string;
|
|
44
97
|
items: QueueItemReport[];
|
|
45
|
-
/** First item
|
|
98
|
+
/** First actionable item — pending/in-progress, not parked or QUEUE-07-blocked; null when none. */
|
|
46
99
|
next: string | null;
|
|
100
|
+
/** Aggregate decision counts across the ledger (present when a sibling ledger exists). */
|
|
101
|
+
decisions?: { open: number; answered: number; deferred: number; autoResolved: number };
|
|
47
102
|
errors: Diagnostic[];
|
|
48
103
|
warnings: Diagnostic[];
|
|
49
104
|
}
|
|
@@ -12,8 +12,6 @@ verification evidence, and atomically mutates RFC frontmatter.
|
|
|
12
12
|
</non-goals>
|
|
13
13
|
</MODULE_CONTRACT>
|
|
14
14
|
<CHANGE_SUMMARY>
|
|
15
|
-
<item>RFC-0795: add RFC-IMP-07 dependsOn dependency gate — blocks stamping when any dependsOn entry is not implemented.</item>
|
|
16
|
-
<item>RFC-0997: add RFC-IMP-08 minimum-one-probe gate — blocks stamping for post-cutoff architecture/contract/command RFCs with no acceptance probes.</item>
|
|
17
15
|
<item>RFC-1053: integrate generateRfcMetrics after successful stamp (non-fatal, guarded by !isDryRun).</item>
|
|
18
16
|
<item>RFC-1097: step 6 — compass.migrate codemod run
|
|
19
17
|
|
|
@@ -21,7 +19,9 @@ Mechanical v1 to v2 header migration across the workspace: 942 files rewritten
|
|
|
21
19
|
<item>RFC-1097: sweep — packages/forge + services clean
|
|
22
20
|
|
|
23
21
|
Sweep batch 2: real KEY_DECISIONS on 10 files, expanded purposes (CONTRACT-02/PURPOSE-02), headers on mission/index + gen-upstreams, sanitizeItemText in summary.record (literal Compass tags corrupted history), excludedPaths for wrangler types, test-fixtures testPattern. forge+services now 0 diagnostics under --mode error.</item>
|
|
24
|
-
<
|
|
22
|
+
<item>Session-retro 2026-10-08: auto-detect picks the sole implement/feat-prefixed candidate among multi-commit references (RFC-IMP-03 no longer blocks full pipelines); ambiguous sets keep blocking with annotated candidate list + earliest-candidate suggestion.</item>
|
|
23
|
+
<item>RFC-1249: wire werkstatt.commands.validate into packages.check + retire CMD-OUTPUT debt</item>
|
|
24
|
+
<history>RFC-0268, RFC-0476, RFC-0756, RFC-0795, RFC-0997, RFC-IMP-07</history>
|
|
25
25
|
</CHANGE_SUMMARY>
|
|
26
26
|
*/
|
|
27
27
|
|
|
@@ -58,6 +58,11 @@ const VERIFICATION_DIR = join(RFC_DIR, "verification");
|
|
|
58
58
|
|
|
59
59
|
// ─── Git helpers ─────────────────────────────────────────────────────────────
|
|
60
60
|
|
|
61
|
+
// Pipeline convention: the implementation commit's subject carries an
|
|
62
|
+
// `implement:` (or `feat:`) conventional prefix — audit/enhance/plan/docs/
|
|
63
|
+
// review/fix/chore commits referencing the same RFC id never claim it.
|
|
64
|
+
const IMPLEMENTATION_SUBJECT_RE = /^(implement|feat)(\([^)]*\))?!?:/i;
|
|
65
|
+
|
|
61
66
|
function execGit(workspaceRoot: string, args: string[]): Promise<string> {
|
|
62
67
|
return new Promise((resolve) => {
|
|
63
68
|
execFile("git", args, { cwd: workspaceRoot, timeout: 10000 }, (err, stdout) => {
|
|
@@ -347,11 +352,35 @@ export async function runRfcImplementStamp(
|
|
|
347
352
|
message: `No commit referencing ${targetId} found in git history. Pass --implementation-commit <SHA> explicitly.`,
|
|
348
353
|
});
|
|
349
354
|
} else {
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
+
// Auto-resolve when exactly one candidate looks like an implementation
|
|
356
|
+
// commit — a multi-commit RFC pipeline (audit → plan → implement → docs →
|
|
357
|
+
// review) references the id at every step, but only one step implements.
|
|
358
|
+
const implCandidates = detected.multiple.filter((c) =>
|
|
359
|
+
IMPLEMENTATION_SUBJECT_RE.test(c.message),
|
|
360
|
+
);
|
|
361
|
+
if (implCandidates.length === 1) {
|
|
362
|
+
implementationCommit = implCandidates[0]!.sha;
|
|
363
|
+
logger.info(
|
|
364
|
+
`[rfc.implement.stamp] auto-selected implementation commit ${implCandidates[0]!.sha} (sole implement/feat-prefixed candidate)`,
|
|
365
|
+
);
|
|
366
|
+
} else {
|
|
367
|
+
const candidateList = detected.multiple
|
|
368
|
+
.map(
|
|
369
|
+
(c) =>
|
|
370
|
+
` ${c.sha} — ${c.message}${IMPLEMENTATION_SUBJECT_RE.test(c.message) ? " [implementation-shaped]" : ""}`,
|
|
371
|
+
)
|
|
372
|
+
.join("\n");
|
|
373
|
+
// git log lists newest first — the earliest implementation-shaped
|
|
374
|
+
// commit is the most likely canonical pick for a step-wise wave.
|
|
375
|
+
const earliest = implCandidates[implCandidates.length - 1];
|
|
376
|
+
const suggestion = earliest
|
|
377
|
+
? `\nLikely: ${earliest.sha} (earliest implementation-shaped commit).`
|
|
378
|
+
: "";
|
|
379
|
+
violations.push({
|
|
380
|
+
rule: "RFC-IMP-03",
|
|
381
|
+
message: `Multiple commits reference ${targetId}:\n${candidateList}\nPass --implementation-commit <SHA> to specify which one.${suggestion}`,
|
|
382
|
+
});
|
|
383
|
+
}
|
|
355
384
|
}
|
|
356
385
|
}
|
|
357
386
|
|
|
@@ -37,6 +37,7 @@ function makeInput(flags: Record<string, unknown> = {}): ForgeCommandInput {
|
|
|
37
37
|
|
|
38
38
|
async function snapshotTree(root: string): Promise<Map<string, string>> {
|
|
39
39
|
const snapshot = new Map<string, string>();
|
|
40
|
+
// fs.walk.lint: allow — test snapshot helper collects file contents into a Map, not a path list — collectFiles does not read contents
|
|
40
41
|
async function walk(dir: string): Promise<void> {
|
|
41
42
|
for (const entry of await fs.readdir(dir, { withFileTypes: true })) {
|
|
42
43
|
const full = path.join(dir, entry.name);
|
package/os/rfc/rfc.module.ts
CHANGED
|
@@ -7,15 +7,14 @@
|
|
|
7
7
|
</non-goals>
|
|
8
8
|
</MODULE_CONTRACT>
|
|
9
9
|
<CHANGE_SUMMARY>
|
|
10
|
-
<item>RFC-0260: declare typed `flags` schemas for the whole rfc.* command family; unknown/malformed flags now fail with KERNEL-FLAG-01/02/03 instead of being silently ignored.</item>
|
|
11
|
-
<item>RFC-0795: add `--batch` flag to `rfc.list` for filtering by batch slug.</item>
|
|
12
|
-
<item>RFC-1097: step 6 — compass.migrate codemod run
|
|
13
|
-
|
|
14
|
-
Mechanical v1 to v2 header migration across the workspace: 942 files rewritten — CHANGE_SUMMARY windows collapsed into history, forbidden v1 blocks stripped, KEY_DECISIONS seeded from @ai-invariant comments (5 files) or TODO placeholders (103 files), blocks reordered to canonical order.</item>
|
|
15
10
|
<item>RFC-1097: sweep — werkstatt-engine clean
|
|
16
11
|
|
|
17
12
|
Sweep batch 4: 73 Compass headers on headerless engine files (certification, component-runtime, isolation, evolution, testing), real KEY_DECISIONS on 75 files (kernel, cache, dht, swim, gitmesh, runtime), ~80 purpose expansions (CONTRACT-02/PURPOSE-02), non-goals on 13 CONTRACT-03 files, CS-07 history literal fix repo-wide (253 files). Policy: .template.ts/.template.astro excludedPaths. werkstatt-engine now 0 diagnostics.</item>
|
|
18
13
|
<item>RFC-1173: declare mutatesState on all kernel commands — collectDeclarationDiagnostics emits error-severity MUTATES-STATE-DECLARED, command.manifest.validate is the blocking consumer in packages.check, sweep declares the flag on every command definition (factories hardcode false for read-only check specs)</item>
|
|
14
|
+
<item>RFC-1231: rfc.verification.refresh gains acceptsAllFlag: true — the declared --all flag is now reachable via werkstatt run (consumed selector re-injected as flags.all after the gate).</item>
|
|
15
|
+
<item>RFC-1237: honor dry-run via context.dryRun across kernel commands; verification envelopes keep emit-canonical ownership</item>
|
|
16
|
+
<item>RFC-1249: wire werkstatt.commands.validate into packages.check + retire CMD-OUTPUT debt</item>
|
|
17
|
+
<history>RFC-0260, RFC-0795, RFC-1097</history>
|
|
19
18
|
</CHANGE_SUMMARY>
|
|
20
19
|
*/
|
|
21
20
|
|
|
@@ -114,6 +113,7 @@ export async function createForgeRfcModule(): Promise<ForgeModule> {
|
|
|
114
113
|
},
|
|
115
114
|
{
|
|
116
115
|
name: "rfc.next-id",
|
|
116
|
+
coverage: "operator" as const,
|
|
117
117
|
mutatesState: false,
|
|
118
118
|
description:
|
|
119
119
|
"Return the next free RFC number (max existing + 1) by scanning docs/rfcs/ recursively including archive/.",
|
|
@@ -212,6 +212,7 @@ export async function createForgeRfcModule(): Promise<ForgeModule> {
|
|
|
212
212
|
},
|
|
213
213
|
{
|
|
214
214
|
name: "rfc.graph",
|
|
215
|
+
coverage: "operator" as const,
|
|
215
216
|
mutatesState: false,
|
|
216
217
|
description:
|
|
217
218
|
"Print one RFC's relationship neighbours (supersedes/supersededBy/amends/" +
|
|
@@ -249,7 +250,8 @@ export async function createForgeRfcModule(): Promise<ForgeModule> {
|
|
|
249
250
|
description:
|
|
250
251
|
"RFC-0330: execute acceptance probes for target RFC(s) and write per-RFC verification " +
|
|
251
252
|
"evidence artifacts to docs/rfcs/verification/*.generated.yaml. Requires --id <rfc-id> " +
|
|
252
|
-
"or --status <status>. Reuses runProbe from RFC-0268. Writes via
|
|
253
|
+
"or --status <status>. Reuses runProbe from RFC-0268. Writes via the WorkspaceIO port " +
|
|
254
|
+
"(io.writeFile); --dry-run runs probes and reports without writing (RFC-1237).",
|
|
253
255
|
scope: "workspace",
|
|
254
256
|
mutatesState: true,
|
|
255
257
|
writes: ["docs/rfcs/verification/*.generated.yaml"],
|
|
@@ -262,6 +264,15 @@ export async function createForgeRfcModule(): Promise<ForgeModule> {
|
|
|
262
264
|
kind: "string",
|
|
263
265
|
description: "Target every RFC with this status (e.g. implemented).",
|
|
264
266
|
},
|
|
267
|
+
"dry-run": {
|
|
268
|
+
kind: "boolean",
|
|
269
|
+
description: "Run probes and report results without writing envelope files.",
|
|
270
|
+
},
|
|
271
|
+
concurrency: {
|
|
272
|
+
kind: "string",
|
|
273
|
+
description:
|
|
274
|
+
"Bounded parallelism across RFCs for sweep runs (default 1, capped at 16 — invalid values warn and fall back). Probe workers spawn subprocesses.",
|
|
275
|
+
},
|
|
265
276
|
},
|
|
266
277
|
execute: runRfcVerificationEmit,
|
|
267
278
|
},
|
|
@@ -274,6 +285,7 @@ export async function createForgeRfcModule(): Promise<ForgeModule> {
|
|
|
274
285
|
"probes[] with fresh results. Requires --id <rfc-id> or --all. Use --dry-run to " +
|
|
275
286
|
"run probes without writing envelope files.",
|
|
276
287
|
scope: "workspace",
|
|
288
|
+
acceptsAllFlag: true,
|
|
277
289
|
mutatesState: true,
|
|
278
290
|
writes: ["docs/rfcs/verification/*.generated.yaml"],
|
|
279
291
|
// Secondary writer — rfc.verification.emit owns these envelopes;
|
|
@@ -297,6 +309,11 @@ export async function createForgeRfcModule(): Promise<ForgeModule> {
|
|
|
297
309
|
kind: "boolean",
|
|
298
310
|
description: "Run probes and report results without writing envelope files.",
|
|
299
311
|
},
|
|
312
|
+
concurrency: {
|
|
313
|
+
kind: "string",
|
|
314
|
+
description:
|
|
315
|
+
"Bounded parallelism across RFCs for sweep runs (default 1, capped at 16 — invalid values warn and fall back). Probe workers spawn subprocesses.",
|
|
316
|
+
},
|
|
300
317
|
},
|
|
301
318
|
execute: runRfcVerificationRefresh,
|
|
302
319
|
},
|
|
@@ -321,6 +338,7 @@ export async function createForgeRfcModule(): Promise<ForgeModule> {
|
|
|
321
338
|
},
|
|
322
339
|
{
|
|
323
340
|
name: "rfc.dna.trace.generate",
|
|
341
|
+
coverage: "operator" as const,
|
|
324
342
|
modulePath: "packages/forge/os/rfc/rfc.module.ts",
|
|
325
343
|
description:
|
|
326
344
|
"RFC-0331: generate docs/rfcs/dna-trace.generated.yaml — the machine-readable " +
|
|
@@ -360,6 +378,7 @@ export async function createForgeRfcModule(): Promise<ForgeModule> {
|
|
|
360
378
|
},
|
|
361
379
|
{
|
|
362
380
|
name: "rfc.supersede.propose",
|
|
381
|
+
coverage: "operator" as const,
|
|
363
382
|
description:
|
|
364
383
|
"RFC-0334: escalate a blocked implementation by creating a draft superseding RFC " +
|
|
365
384
|
"with the conflict stated and TODO sections for the proposed alternative.",
|
|
@@ -391,6 +410,7 @@ export async function createForgeRfcModule(): Promise<ForgeModule> {
|
|
|
391
410
|
},
|
|
392
411
|
{
|
|
393
412
|
name: "rfc.archive",
|
|
413
|
+
coverage: "operator" as const,
|
|
394
414
|
description:
|
|
395
415
|
"Move terminal-status RFC files (implemented, rejected, superseded) into " +
|
|
396
416
|
"docs/rfcs/archive/<status>/ subdirectories. Bidirectional: moves non-terminal " +
|
|
@@ -417,6 +437,7 @@ export async function createForgeRfcModule(): Promise<ForgeModule> {
|
|
|
417
437
|
},
|
|
418
438
|
{
|
|
419
439
|
name: "rfc.pipeline.status",
|
|
440
|
+
coverage: "operator" as const,
|
|
420
441
|
mutatesState: false,
|
|
421
442
|
description:
|
|
422
443
|
"Report the pipeline status of RFCs — which steps (audit, enhance, plan, implement) " +
|