@warpgogol/forge 9.2.3 → 9.3.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 +25 -0
- package/bin/cli.ts +3 -2
- package/dist/bin/cli.js +3 -2
- package/dist/bin/cli.js.map +1 -1
- package/dist/os/adr/handlers/implement-stamp.d.ts +6 -0
- package/dist/os/adr/handlers/implement-stamp.d.ts.map +1 -1
- package/dist/os/adr/handlers/implement-stamp.js +23 -15
- package/dist/os/adr/handlers/implement-stamp.js.map +1 -1
- package/dist/os/checks/handlers/counters-journal.d.ts.map +1 -1
- package/dist/os/checks/handlers/counters-journal.js +9 -1
- package/dist/os/checks/handlers/counters-journal.js.map +1 -1
- package/dist/os/core/core.module.d.ts.map +1 -1
- package/dist/os/core/core.module.js +27 -36
- package/dist/os/core/core.module.js.map +1 -1
- package/dist/os/core/lock-holder.d.ts +32 -0
- package/dist/os/core/lock-holder.d.ts.map +1 -0
- package/dist/os/core/lock-holder.js +81 -0
- package/dist/os/core/lock-holder.js.map +1 -0
- package/dist/os/core/stamp-lock.d.ts +30 -0
- package/dist/os/core/stamp-lock.d.ts.map +1 -0
- package/dist/os/core/stamp-lock.js +112 -0
- package/dist/os/core/stamp-lock.js.map +1 -0
- package/dist/os/flow/digest.d.ts +19 -0
- package/dist/os/flow/digest.d.ts.map +1 -1
- package/dist/os/flow/digest.js +33 -4
- package/dist/os/flow/digest.js.map +1 -1
- package/dist/os/flow/flow.module.d.ts.map +1 -1
- package/dist/os/flow/flow.module.js +61 -6
- package/dist/os/flow/flow.module.js.map +1 -1
- package/dist/os/flow/handlers/flow-cut.d.ts +8 -0
- package/dist/os/flow/handlers/flow-cut.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-cut.js +91 -5
- package/dist/os/flow/handlers/flow-cut.js.map +1 -1
- package/dist/os/flow/handlers/flow-digest.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-digest.js +6 -0
- package/dist/os/flow/handlers/flow-digest.js.map +1 -1
- package/dist/os/flow/handlers/flow-discard.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-discard.js +17 -13
- package/dist/os/flow/handlers/flow-discard.js.map +1 -1
- package/dist/os/flow/handlers/flow-fix.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-fix.js +99 -10
- package/dist/os/flow/handlers/flow-fix.js.map +1 -1
- package/dist/os/flow/handlers/flow-integrate.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-integrate.js +32 -15
- package/dist/os/flow/handlers/flow-integrate.js.map +1 -1
- package/dist/os/flow/handlers/flow-publication-retire.d.ts +17 -0
- package/dist/os/flow/handlers/flow-publication-retire.d.ts.map +1 -0
- package/dist/os/flow/handlers/flow-publication-retire.js +132 -0
- package/dist/os/flow/handlers/flow-publication-retire.js.map +1 -0
- package/dist/os/flow/handlers/flow-push.d.ts +7 -0
- package/dist/os/flow/handlers/flow-push.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-push.js +106 -15
- package/dist/os/flow/handlers/flow-push.js.map +1 -1
- package/dist/os/flow/locks.d.ts +6 -1
- package/dist/os/flow/locks.d.ts.map +1 -1
- package/dist/os/flow/locks.js +53 -23
- package/dist/os/flow/locks.js.map +1 -1
- package/dist/os/flow/publication-order.d.ts +25 -0
- package/dist/os/flow/publication-order.d.ts.map +1 -0
- package/dist/os/flow/publication-order.js +75 -0
- package/dist/os/flow/publication-order.js.map +1 -0
- package/dist/os/flow/publish.d.ts +18 -0
- package/dist/os/flow/publish.d.ts.map +1 -1
- package/dist/os/flow/publish.js +58 -2
- package/dist/os/flow/publish.js.map +1 -1
- package/dist/os/flow/registry.d.ts +1 -1
- package/dist/os/flow/registry.d.ts.map +1 -1
- package/dist/os/flow/registry.js +2 -1
- package/dist/os/flow/registry.js.map +1 -1
- package/dist/os/flow/release-tags.d.ts +1 -0
- package/dist/os/flow/release-tags.d.ts.map +1 -1
- package/dist/os/flow/release-tags.js +5 -4
- package/dist/os/flow/release-tags.js.map +1 -1
- package/dist/os/flow/scripts.d.ts +1 -1
- package/dist/os/flow/scripts.d.ts.map +1 -1
- package/dist/os/flow/scripts.js +1 -0
- package/dist/os/flow/scripts.js.map +1 -1
- package/dist/os/flow/task-files.d.ts +11 -0
- package/dist/os/flow/task-files.d.ts.map +1 -0
- package/dist/os/flow/task-files.js +51 -0
- package/dist/os/flow/task-files.js.map +1 -0
- package/dist/os/flow/tests/helpers.d.ts +4 -1
- package/dist/os/flow/tests/helpers.d.ts.map +1 -1
- package/dist/os/flow/tests/helpers.js +9 -5
- package/dist/os/flow/tests/helpers.js.map +1 -1
- package/dist/os/mission/handlers/archive.d.ts.map +1 -1
- package/dist/os/mission/handlers/archive.js +30 -74
- package/dist/os/mission/handlers/archive.js.map +1 -1
- package/dist/os/mission/lockfile.d.ts +21 -0
- package/dist/os/mission/lockfile.d.ts.map +1 -0
- package/dist/os/mission/lockfile.js +76 -0
- package/dist/os/mission/lockfile.js.map +1 -0
- package/dist/os/mission/mission.module.d.ts.map +1 -1
- package/dist/os/mission/mission.module.js +2 -1
- package/dist/os/mission/mission.module.js.map +1 -1
- package/dist/os/rfc/handlers/implement-stamp.d.ts +6 -0
- package/dist/os/rfc/handlers/implement-stamp.d.ts.map +1 -1
- package/dist/os/rfc/handlers/implement-stamp.js +24 -19
- package/dist/os/rfc/handlers/implement-stamp.js.map +1 -1
- package/dist/os/system/handlers/outbox-validate.d.ts +8 -0
- package/dist/os/system/handlers/outbox-validate.d.ts.map +1 -0
- package/dist/os/system/handlers/outbox-validate.js +102 -0
- package/dist/os/system/handlers/outbox-validate.js.map +1 -0
- package/dist/os/system/handlers/system-map-validate.d.ts +13 -0
- package/dist/os/system/handlers/system-map-validate.d.ts.map +1 -0
- package/dist/os/system/handlers/system-map-validate.js +78 -0
- package/dist/os/system/handlers/system-map-validate.js.map +1 -0
- package/dist/os/system/handlers/system-outbox-scan.d.ts +10 -0
- package/dist/os/system/handlers/system-outbox-scan.d.ts.map +1 -0
- package/dist/os/system/handlers/system-outbox-scan.js +195 -0
- package/dist/os/system/handlers/system-outbox-scan.js.map +1 -0
- package/dist/os/system/handlers/system-task-collect.d.ts +13 -0
- package/dist/os/system/handlers/system-task-collect.d.ts.map +1 -0
- package/dist/os/system/handlers/system-task-collect.js +238 -0
- package/dist/os/system/handlers/system-task-collect.js.map +1 -0
- package/dist/os/system/handlers/system-task-create.d.ts +32 -0
- package/dist/os/system/handlers/system-task-create.d.ts.map +1 -0
- package/dist/os/system/handlers/system-task-create.js +216 -0
- package/dist/os/system/handlers/system-task-create.js.map +1 -0
- package/dist/os/system/handlers/system-task-dispatch.d.ts +14 -0
- package/dist/os/system/handlers/system-task-dispatch.d.ts.map +1 -0
- package/dist/os/system/handlers/system-task-dispatch.js +290 -0
- package/dist/os/system/handlers/system-task-dispatch.js.map +1 -0
- package/dist/os/system/handlers/system-task-move.d.ts +12 -0
- package/dist/os/system/handlers/system-task-move.d.ts.map +1 -0
- package/dist/os/system/handlers/system-task-move.js +217 -0
- package/dist/os/system/handlers/system-task-move.js.map +1 -0
- package/dist/os/system/handlers/system-task-status.d.ts +20 -0
- package/dist/os/system/handlers/system-task-status.d.ts.map +1 -0
- package/dist/os/system/handlers/system-task-status.js +139 -0
- package/dist/os/system/handlers/system-task-status.js.map +1 -0
- package/dist/os/system/handlers/system-versionset-record.d.ts +12 -0
- package/dist/os/system/handlers/system-versionset-record.d.ts.map +1 -0
- package/dist/os/system/handlers/system-versionset-record.js +332 -0
- package/dist/os/system/handlers/system-versionset-record.js.map +1 -0
- package/dist/os/system/index.d.ts +6 -0
- package/dist/os/system/index.d.ts.map +1 -0
- package/dist/os/system/index.js +18 -0
- package/dist/os/system/index.js.map +1 -0
- package/dist/os/system/outbox-schema.d.ts +30 -0
- package/dist/os/system/outbox-schema.d.ts.map +1 -0
- package/dist/os/system/outbox-schema.js +29 -0
- package/dist/os/system/outbox-schema.js.map +1 -0
- package/dist/os/system/repo.d.ts +64 -0
- package/dist/os/system/repo.d.ts.map +1 -0
- package/dist/os/system/repo.js +364 -0
- package/dist/os/system/repo.js.map +1 -0
- package/dist/os/system/scenario-schemas.d.ts +26 -0
- package/dist/os/system/scenario-schemas.d.ts.map +1 -0
- package/dist/os/system/scenario-schemas.js +53 -0
- package/dist/os/system/scenario-schemas.js.map +1 -0
- package/dist/os/system/schemas.d.ts +63 -0
- package/dist/os/system/schemas.d.ts.map +1 -0
- package/dist/os/system/schemas.js +83 -0
- package/dist/os/system/schemas.js.map +1 -0
- package/dist/os/system/system.module.d.ts +3 -0
- package/dist/os/system/system.module.d.ts.map +1 -0
- package/dist/os/system/system.module.js +429 -0
- package/dist/os/system/system.module.js.map +1 -0
- package/dist/os/system/task-schemas.d.ts +108 -0
- package/dist/os/system/task-schemas.d.ts.map +1 -0
- package/dist/os/system/task-schemas.js +152 -0
- package/dist/os/system/task-schemas.js.map +1 -0
- package/dist/os/system/task-store.d.ts +41 -0
- package/dist/os/system/task-store.d.ts.map +1 -0
- package/dist/os/system/task-store.js +142 -0
- package/dist/os/system/task-store.js.map +1 -0
- package/dist/os/system/tests/helpers.d.ts +30 -0
- package/dist/os/system/tests/helpers.d.ts.map +1 -0
- package/dist/os/system/tests/helpers.js +178 -0
- package/dist/os/system/tests/helpers.js.map +1 -0
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +5 -4
- package/dist/src/index.js.map +1 -1
- package/os/adr/handlers/implement-stamp-lock.test.ts +90 -0
- package/os/adr/handlers/implement-stamp.ts +29 -20
- package/os/checks/handlers/counters-journal.test.ts +10 -0
- package/os/checks/handlers/counters-journal.ts +8 -1
- package/os/core/core.module.ts +32 -36
- package/os/core/lock-holder.ts +88 -0
- package/os/core/stamp-lock.ts +142 -0
- package/os/flow/digest.ts +46 -4
- package/os/flow/flow.module.ts +62 -6
- package/os/flow/handlers/flow-cut.ts +118 -5
- package/os/flow/handlers/flow-digest.ts +6 -0
- package/os/flow/handlers/flow-discard.ts +22 -13
- package/os/flow/handlers/flow-fix.ts +116 -10
- package/os/flow/handlers/flow-integrate.ts +31 -15
- package/os/flow/handlers/flow-publication-retire.ts +156 -0
- package/os/flow/handlers/flow-push.ts +128 -13
- package/os/flow/locks.ts +75 -25
- package/os/flow/publication-order.ts +99 -0
- package/os/flow/publish.ts +73 -2
- package/os/flow/registry.ts +5 -2
- package/os/flow/release-tags.ts +5 -4
- package/os/flow/scripts.ts +2 -0
- package/os/flow/task-files.ts +59 -0
- package/os/flow/tests/flow-cut-prepare.test.ts +298 -0
- package/os/flow/tests/flow-cut.test.ts +5 -1
- package/os/flow/tests/flow-publication-retire.test.ts +191 -0
- package/os/flow/tests/flow-push-supersede.test.ts +221 -0
- package/os/flow/tests/flow-task-files.test.ts +59 -0
- package/os/flow/tests/helpers.ts +9 -5
- package/os/flow/tests/locks.test.ts +219 -0
- package/os/flow/tests/publication-order.test.ts +102 -0
- package/os/mission/handlers/archive.test.ts +97 -52
- package/os/mission/handlers/archive.ts +31 -76
- package/os/mission/lockfile.ts +84 -0
- package/os/mission/mission.module.ts +2 -1
- package/os/rfc/handlers/implement-stamp-lock.test.ts +133 -0
- package/os/rfc/handlers/implement-stamp.ts +30 -24
- package/os/system/handlers/outbox-validate.ts +120 -0
- package/os/system/handlers/system-map-validate.ts +107 -0
- package/os/system/handlers/system-outbox-scan.ts +320 -0
- package/os/system/handlers/system-task-collect.ts +305 -0
- package/os/system/handlers/system-task-create.ts +271 -0
- package/os/system/handlers/system-task-dispatch.ts +387 -0
- package/os/system/handlers/system-task-move.ts +353 -0
- package/os/system/handlers/system-task-status.ts +176 -0
- package/os/system/handlers/system-versionset-record.ts +476 -0
- package/os/system/index.ts +47 -0
- package/os/system/outbox-schema.ts +47 -0
- package/os/system/repo.ts +451 -0
- package/os/system/scenario-schemas.ts +62 -0
- package/os/system/schemas.ts +102 -0
- package/os/system/system.module.ts +449 -0
- package/os/system/task-schemas.ts +190 -0
- package/os/system/task-store.ts +184 -0
- package/os/system/tests/helpers.ts +189 -0
- package/os/system/tests/outbox-validate.test.ts +92 -0
- package/os/system/tests/system-map-validate.test.ts +321 -0
- package/os/system/tests/system-outbox-scan.test.ts +273 -0
- package/os/system/tests/system-profile.test.ts +90 -0
- package/os/system/tests/system-task-collect.test.ts +293 -0
- package/os/system/tests/system-task-dispatch.test.ts +279 -0
- package/os/system/tests/system-task-status.test.ts +153 -0
- package/os/system/tests/system-task.test.ts +330 -0
- package/os/system/tests/system-versionset.test.ts +314 -0
- package/package.json +33 -1
- package/profiles/system.yaml +650 -0
- package/skills/fo/fo-outbox/SKILL.md +71 -0
- package/skills/fo/fo-system-dispatch/SKILL.md +65 -0
- package/skills/fo/fo-task-run/SKILL.md +75 -0
- package/src/index.ts +11 -4
- package/src/tests/fixtures/agents-generate-business-before.txt +6 -0
- package/src/tests/profile-schema.test.ts +2 -1
|
@@ -0,0 +1,449 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>Register the forge-system commands with the forge kernel registry:
|
|
4
|
+
system.map.validate (RFC-1508, read-only), the RFC-1509 task queue —
|
|
5
|
+
system.task.create/move/dispatch/collect/status — and the RFC-1510 outbox
|
|
6
|
+
pair: outbox.validate (any profile) plus system.outbox.scan. System commands
|
|
7
|
+
gate on the system profile and mutate only system-repository files;
|
|
8
|
+
dispatch's product side is limited to opening the task branch and writing
|
|
9
|
+
.forge/task/.</purpose>
|
|
10
|
+
<non-goals>
|
|
11
|
+
<item>Do not implement handler logic here — delegate to handlers/.</item>
|
|
12
|
+
<item>No scenario or version-set commands — those are RFC-1511.</item>
|
|
13
|
+
</non-goals>
|
|
14
|
+
</MODULE_CONTRACT>
|
|
15
|
+
<CHANGE_SUMMARY>
|
|
16
|
+
<item>RFC-1509: address RFC-1509 review r2 — mark-failed without product, journal-read warning, status map diagnostics, V-49 deviations</item>
|
|
17
|
+
<item>RFC-1510: implement RFC-1510 — product outbox for dependency-contract requests</item>
|
|
18
|
+
<item>RFC-1510: close RFC-1510 review r2 — declare OUTBOX-02 in scan rules, flat-scope test, readdir TOCTOU guard</item>
|
|
19
|
+
<item>RFC-1511: scenarios, version sets and system.versionset.record</item>
|
|
20
|
+
<item>RFC-1511: accept recorded products map in verified gate, guard folders lookup and exec edges (RFC-1511 review r1)</item>
|
|
21
|
+
<history>RFC-1508, RFC-1509</history>
|
|
22
|
+
</CHANGE_SUMMARY>
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
import type { ForgeModule } from "../../src/forge-module.ts";
|
|
26
|
+
|
|
27
|
+
export async function createForgeSystemModule(): Promise<ForgeModule> {
|
|
28
|
+
const { runSystemMapValidate } = await import("./handlers/system-map-validate.ts");
|
|
29
|
+
const { runSystemTaskCreate } = await import("./handlers/system-task-create.ts");
|
|
30
|
+
const { runSystemTaskMove } = await import("./handlers/system-task-move.ts");
|
|
31
|
+
const { runSystemTaskDispatch } = await import("./handlers/system-task-dispatch.ts");
|
|
32
|
+
const { runSystemTaskCollect } = await import("./handlers/system-task-collect.ts");
|
|
33
|
+
const { runSystemTaskStatus } = await import("./handlers/system-task-status.ts");
|
|
34
|
+
const { runOutboxValidate } = await import("./handlers/outbox-validate.ts");
|
|
35
|
+
const { runSystemOutboxScan } = await import("./handlers/system-outbox-scan.ts");
|
|
36
|
+
const { runSystemVersionSetRecord } = await import("./handlers/system-versionset-record.ts");
|
|
37
|
+
return {
|
|
38
|
+
name: "forge-system",
|
|
39
|
+
version: "0.1.0",
|
|
40
|
+
runtime: "autonomous",
|
|
41
|
+
declarations: [],
|
|
42
|
+
commands: [
|
|
43
|
+
{
|
|
44
|
+
name: "system.map.validate",
|
|
45
|
+
description:
|
|
46
|
+
"Read-only system-map validator (RFC-1508). Refuses outside the " +
|
|
47
|
+
"system profile (SYSTEM-01), reports missing or schema-invalid map " +
|
|
48
|
+
"files (SYSTEM-MAP-01), duplicate product ids and unknown edge " +
|
|
49
|
+
"consumers (SYSTEM-MAP-02), edges naming contracts no product " +
|
|
50
|
+
"offers (SYSTEM-MAP-03), consumer/contract pairs both allowed and " +
|
|
51
|
+
"forbidden (SYSTEM-MAP-04), warns on products.local.yaml gaps " +
|
|
52
|
+
"(SYSTEM-MAP-05), and errors on scenarios naming undeclared " +
|
|
53
|
+
"products or unoffered contracts (SYSTEM-MAP-06, RFC-1511). Exit 1 " +
|
|
54
|
+
"iff an error-severity diagnostic exists.",
|
|
55
|
+
scope: "workspace",
|
|
56
|
+
contract: "system",
|
|
57
|
+
rules: [
|
|
58
|
+
{ id: "SYSTEM-01", severity: "error" },
|
|
59
|
+
{ id: "SYSTEM-MAP-01", severity: "error" },
|
|
60
|
+
{ id: "SYSTEM-MAP-02", severity: "error" },
|
|
61
|
+
{ id: "SYSTEM-MAP-03", severity: "error" },
|
|
62
|
+
{ id: "SYSTEM-MAP-04", severity: "error" },
|
|
63
|
+
{ id: "SYSTEM-MAP-05", severity: "warning" },
|
|
64
|
+
{ id: "SYSTEM-MAP-06", severity: "error" },
|
|
65
|
+
],
|
|
66
|
+
mutatesState: false,
|
|
67
|
+
writes: [],
|
|
68
|
+
coverage: "operator",
|
|
69
|
+
coverageNote:
|
|
70
|
+
"map validation — the operator runs this before dispatching system work (RFC-1508)",
|
|
71
|
+
reads: [
|
|
72
|
+
"forge.yaml",
|
|
73
|
+
"system/system.yaml",
|
|
74
|
+
"system/products.yaml",
|
|
75
|
+
"system/edges.yaml",
|
|
76
|
+
"system/products.local.yaml",
|
|
77
|
+
"system/scenarios/",
|
|
78
|
+
],
|
|
79
|
+
cacheable: false,
|
|
80
|
+
flags: {},
|
|
81
|
+
execute: runSystemMapValidate,
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
name: "system.task.create",
|
|
85
|
+
description:
|
|
86
|
+
"Create a system task (RFC-1509). Allocates the next T-NNNN id, " +
|
|
87
|
+
"writes queue/tasks/<id>.yaml (forge/system-task@1, state proposed) " +
|
|
88
|
+
"and a dispatch-brief scaffold at queue/briefs/<id>.md. Requires " +
|
|
89
|
+
"the system profile (SYSTEM-01) and a declared product " +
|
|
90
|
+
"(SYSTEM-TASK-05). Writes files only — the session commits.",
|
|
91
|
+
scope: "workspace",
|
|
92
|
+
contract: "system",
|
|
93
|
+
rules: [
|
|
94
|
+
{ id: "SYSTEM-01", severity: "error" },
|
|
95
|
+
{ id: "SYSTEM-MAP-01", severity: "error" },
|
|
96
|
+
{ id: "SYSTEM-TASK-01", severity: "error" },
|
|
97
|
+
{ id: "SYSTEM-TASK-05", severity: "error" },
|
|
98
|
+
],
|
|
99
|
+
mutatesState: true,
|
|
100
|
+
idempotency: "not-idempotent",
|
|
101
|
+
writes: ["queue/tasks/", "queue/briefs/"],
|
|
102
|
+
generates: [],
|
|
103
|
+
coverage: "operator",
|
|
104
|
+
coverageNote:
|
|
105
|
+
"task creation — the operator or an outbox/scenario command creates cross-product work (RFC-1509)",
|
|
106
|
+
reads: [
|
|
107
|
+
"forge.yaml",
|
|
108
|
+
"system/system.yaml",
|
|
109
|
+
"system/products.yaml",
|
|
110
|
+
"system/edges.yaml",
|
|
111
|
+
"queue/tasks/",
|
|
112
|
+
],
|
|
113
|
+
cacheable: false,
|
|
114
|
+
flags: {
|
|
115
|
+
product: { kind: "string", required: true, description: "Product id from system/products.yaml" },
|
|
116
|
+
slug: { kind: "string", required: true, description: "kebab-case slug for the product branch" },
|
|
117
|
+
title: { kind: "string", required: true, description: "Human-readable task title" },
|
|
118
|
+
kind: { kind: "string", required: true, description: "change | adoption | dependency-update | verification" },
|
|
119
|
+
contracts: { kind: "string[]", description: "Contracts the task touches (repeatable)" },
|
|
120
|
+
"depends-on": { kind: "string[]", description: "Task ids that must be done first (repeatable)" },
|
|
121
|
+
origin: { kind: "string", description: "<kind>:<ref> — operator | outbox | decision | scenario (default operator)" },
|
|
122
|
+
reason: { kind: "string", description: "Optional note recorded on the creation history row" },
|
|
123
|
+
"dry-run": { kind: "boolean", description: "Plan only — write nothing" },
|
|
124
|
+
},
|
|
125
|
+
execute: runSystemTaskCreate,
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
name: "system.task.move",
|
|
129
|
+
description:
|
|
130
|
+
"Move a system task between states (RFC-1509). Owns every move-side " +
|
|
131
|
+
"transition: proposed→ready (brief valid, dependencies done, no " +
|
|
132
|
+
"forbidden edge), proposed→cancelled, ready/failed→parked, " +
|
|
133
|
+
"parked→ready, reported→ready, failed→ready (each requiring " +
|
|
134
|
+
"--reason where the table says so), integrated→verified " +
|
|
135
|
+
"(--version-set must list the product) and verified→done. " +
|
|
136
|
+
"Illegal transitions refuse with SYSTEM-TASK-02; forbidden edges " +
|
|
137
|
+
"with SYSTEM-TASK-03; undeclared edges warn with SYSTEM-TASK-04.",
|
|
138
|
+
scope: "workspace",
|
|
139
|
+
contract: "system",
|
|
140
|
+
rules: [
|
|
141
|
+
{ id: "SYSTEM-01", severity: "error" },
|
|
142
|
+
{ id: "SYSTEM-MAP-01", severity: "error" },
|
|
143
|
+
{ id: "SYSTEM-TASK-01", severity: "error" },
|
|
144
|
+
{ id: "SYSTEM-TASK-02", severity: "error" },
|
|
145
|
+
{ id: "SYSTEM-TASK-03", severity: "error" },
|
|
146
|
+
{ id: "SYSTEM-TASK-04", severity: "warning" },
|
|
147
|
+
],
|
|
148
|
+
mutatesState: true,
|
|
149
|
+
idempotency: "rerun-safe",
|
|
150
|
+
writes: ["queue/tasks/"],
|
|
151
|
+
generates: [],
|
|
152
|
+
coverage: "operator",
|
|
153
|
+
coverageNote:
|
|
154
|
+
"task state machine — the operator moves tasks; dispatch/collect own their transitions (RFC-1509)",
|
|
155
|
+
reads: [
|
|
156
|
+
"forge.yaml",
|
|
157
|
+
"system/system.yaml",
|
|
158
|
+
"system/products.yaml",
|
|
159
|
+
"system/edges.yaml",
|
|
160
|
+
"system/version-sets/",
|
|
161
|
+
"queue/tasks/",
|
|
162
|
+
"queue/briefs/",
|
|
163
|
+
],
|
|
164
|
+
cacheable: false,
|
|
165
|
+
flags: {
|
|
166
|
+
task: { kind: "string", required: true, description: "Task id T-NNNN" },
|
|
167
|
+
to: { kind: "string", required: true, description: "Target state" },
|
|
168
|
+
reason: { kind: "string", description: "Required by transitions the table marks reason-bearing" },
|
|
169
|
+
"version-set": { kind: "string", description: "Required for integrated → verified — names system/version-sets/<id>.yaml" },
|
|
170
|
+
"dry-run": { kind: "boolean", description: "Plan only — write nothing" },
|
|
171
|
+
},
|
|
172
|
+
execute: runSystemTaskMove,
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
name: "system.task.dispatch",
|
|
176
|
+
description:
|
|
177
|
+
"Dispatch a ready task into its product repository (RFC-1509). " +
|
|
178
|
+
"Resolves the product folder from products.local.yaml " +
|
|
179
|
+
"(SYSTEM-TASK-05), refuses forbidden edges (SYSTEM-TASK-03), warns " +
|
|
180
|
+
"on undeclared ones (SYSTEM-TASK-04), refuses briefs that leak " +
|
|
181
|
+
"system identity or sibling product folders (SYSTEM-TASK-06), then " +
|
|
182
|
+
"opens an auto/task-… branch in-process, git-excludes .forge/task/, " +
|
|
183
|
+
"writes the brief into the worktree and records dispatch on the " +
|
|
184
|
+
"task. An optional launcher argv from products.local.yaml runs " +
|
|
185
|
+
"best-effort (SYSTEM-TASK-09). Never commits or pushes in the " +
|
|
186
|
+
"product.",
|
|
187
|
+
scope: "workspace",
|
|
188
|
+
contract: "system",
|
|
189
|
+
rules: [
|
|
190
|
+
{ id: "SYSTEM-01", severity: "error" },
|
|
191
|
+
{ id: "SYSTEM-MAP-01", severity: "error" },
|
|
192
|
+
{ id: "SYSTEM-TASK-01", severity: "error" },
|
|
193
|
+
{ id: "SYSTEM-TASK-02", severity: "error" },
|
|
194
|
+
{ id: "SYSTEM-TASK-03", severity: "error" },
|
|
195
|
+
{ id: "SYSTEM-TASK-04", severity: "warning" },
|
|
196
|
+
{ id: "SYSTEM-TASK-05", severity: "error" },
|
|
197
|
+
{ id: "SYSTEM-TASK-06", severity: "error" },
|
|
198
|
+
{ id: "SYSTEM-TASK-09", severity: "warning" },
|
|
199
|
+
{ id: "FLOW-07", severity: "error" },
|
|
200
|
+
{ id: "FLOW-OPEN-01", severity: "error" },
|
|
201
|
+
{ id: "FLOW-OPEN-02", severity: "error" },
|
|
202
|
+
{ id: "FLOW-OPEN-03", severity: "error" },
|
|
203
|
+
{ id: "FLOW-OPEN-04", severity: "error" },
|
|
204
|
+
{ id: "FLOW-OPEN-05", severity: "error" },
|
|
205
|
+
{ id: "FLOW-OPEN-06", severity: "error" },
|
|
206
|
+
{ id: "FLOW-OPEN-07", severity: "error" },
|
|
207
|
+
],
|
|
208
|
+
mutatesState: true,
|
|
209
|
+
idempotency: "rerun-safe",
|
|
210
|
+
writes: [
|
|
211
|
+
"queue/tasks/",
|
|
212
|
+
"<product>/.git/**",
|
|
213
|
+
"<product>/info/exclude",
|
|
214
|
+
"<product>/.forge/task/",
|
|
215
|
+
],
|
|
216
|
+
generates: [],
|
|
217
|
+
coverage: "operator",
|
|
218
|
+
coverageNote:
|
|
219
|
+
"task dispatch — opens a product task branch and hands the operator the worktree (RFC-1509)",
|
|
220
|
+
reads: [
|
|
221
|
+
"forge.yaml",
|
|
222
|
+
"system/system.yaml",
|
|
223
|
+
"system/products.yaml",
|
|
224
|
+
"system/edges.yaml",
|
|
225
|
+
"system/products.local.yaml",
|
|
226
|
+
"queue/tasks/",
|
|
227
|
+
"queue/briefs/",
|
|
228
|
+
],
|
|
229
|
+
cacheable: false,
|
|
230
|
+
flags: {
|
|
231
|
+
task: { kind: "string", required: true, description: "Task id T-NNNN (must be ready)" },
|
|
232
|
+
"dry-run": { kind: "boolean", description: "Plan only — open no branch, write nothing" },
|
|
233
|
+
},
|
|
234
|
+
execute: runSystemTaskDispatch,
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
name: "system.task.collect",
|
|
238
|
+
description:
|
|
239
|
+
"Collect a task report from the product side (RFC-1509). Reads " +
|
|
240
|
+
".forge/task/report.yaml in the dispatch worktree, falling back to " +
|
|
241
|
+
"the preserved copy under the product's common git dir. Missing " +
|
|
242
|
+
"report refuses SYSTEM-TASK-07 unless --mark-failed --reason; an " +
|
|
243
|
+
"invalid or wrong-task report refuses SYSTEM-TASK-08. A valid " +
|
|
244
|
+
"report is copied to queue/reports/; done|needs-decision → " +
|
|
245
|
+
"reported, blocked → failed. A product journal integrate event " +
|
|
246
|
+
"for the dispatch branch then advances to integrated with the " +
|
|
247
|
+
"journal sha as integratedCommit. Read-only in the product.",
|
|
248
|
+
scope: "workspace",
|
|
249
|
+
contract: "system",
|
|
250
|
+
rules: [
|
|
251
|
+
{ id: "SYSTEM-01", severity: "error" },
|
|
252
|
+
{ id: "SYSTEM-MAP-01", severity: "error" },
|
|
253
|
+
{ id: "SYSTEM-TASK-01", severity: "error" },
|
|
254
|
+
{ id: "SYSTEM-TASK-02", severity: "error" },
|
|
255
|
+
{ id: "SYSTEM-TASK-05", severity: "error" },
|
|
256
|
+
{ id: "SYSTEM-TASK-07", severity: "error" },
|
|
257
|
+
{ id: "SYSTEM-TASK-08", severity: "error" },
|
|
258
|
+
],
|
|
259
|
+
mutatesState: true,
|
|
260
|
+
idempotency: "rerun-safe",
|
|
261
|
+
writes: ["queue/tasks/", "queue/reports/"],
|
|
262
|
+
generates: [],
|
|
263
|
+
coverage: "operator",
|
|
264
|
+
coverageNote:
|
|
265
|
+
"report collection — the operator collects after the product session finishes (RFC-1509)",
|
|
266
|
+
reads: [
|
|
267
|
+
"forge.yaml",
|
|
268
|
+
"system/system.yaml",
|
|
269
|
+
"system/products.yaml",
|
|
270
|
+
"system/products.local.yaml",
|
|
271
|
+
"queue/tasks/",
|
|
272
|
+
"<product>/.forge/task/report.yaml",
|
|
273
|
+
"<product>/.git/forge/tasks/",
|
|
274
|
+
"<product>/.git/forge/journal.jsonl",
|
|
275
|
+
],
|
|
276
|
+
cacheable: false,
|
|
277
|
+
flags: {
|
|
278
|
+
task: { kind: "string", required: true, description: "Task id T-NNNN (dispatched or reported)" },
|
|
279
|
+
"mark-failed": { kind: "boolean", description: "Mark the task failed instead of collecting a report" },
|
|
280
|
+
reason: { kind: "string", description: "Required with --mark-failed" },
|
|
281
|
+
"dry-run": { kind: "boolean", description: "Plan only — write nothing" },
|
|
282
|
+
},
|
|
283
|
+
execute: runSystemTaskCollect,
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
name: "system.task.status",
|
|
287
|
+
description:
|
|
288
|
+
"Project every system task plus product-side flow evidence " +
|
|
289
|
+
"(RFC-1509). The task file is authoritative for state; dispatched " +
|
|
290
|
+
"tasks also report productStatus: registered, integrated, " +
|
|
291
|
+
"discarded, orphaned (no registry entry and no journal event) or " +
|
|
292
|
+
"unknown (product repo unreadable). Read-only.",
|
|
293
|
+
scope: "workspace",
|
|
294
|
+
contract: "system",
|
|
295
|
+
rules: [
|
|
296
|
+
{ id: "SYSTEM-01", severity: "error" },
|
|
297
|
+
{ id: "SYSTEM-TASK-01", severity: "error" },
|
|
298
|
+
],
|
|
299
|
+
mutatesState: false,
|
|
300
|
+
writes: [],
|
|
301
|
+
generates: [],
|
|
302
|
+
coverage: "operator",
|
|
303
|
+
coverageNote:
|
|
304
|
+
"task overview — the operator's queue dashboard before collect/move decisions (RFC-1509)",
|
|
305
|
+
reads: [
|
|
306
|
+
"forge.yaml",
|
|
307
|
+
"system/products.yaml",
|
|
308
|
+
"system/products.local.yaml",
|
|
309
|
+
"queue/tasks/",
|
|
310
|
+
"<product>/.git/forge/registry.yaml",
|
|
311
|
+
"<product>/.git/forge/journal.jsonl",
|
|
312
|
+
],
|
|
313
|
+
cacheable: false,
|
|
314
|
+
flags: {
|
|
315
|
+
task: { kind: "string", description: "Limit the projection to one task id" },
|
|
316
|
+
},
|
|
317
|
+
execute: runSystemTaskStatus,
|
|
318
|
+
},
|
|
319
|
+
{
|
|
320
|
+
name: "outbox.validate",
|
|
321
|
+
description:
|
|
322
|
+
"Validate docs/outbox/*.yaml entries in ANY repository profile " +
|
|
323
|
+
"(RFC-1510) — the single validator of the outbox contract (DNA-91). " +
|
|
324
|
+
"Each file must satisfy forge/outbox@1 (OUTBOX-01) and its id must " +
|
|
325
|
+
"equal the filename stem (OUTBOX-02). An absent docs/outbox/ " +
|
|
326
|
+
"passes — adoption is opt-in per product. No system required.",
|
|
327
|
+
scope: "workspace",
|
|
328
|
+
contract: "outbox",
|
|
329
|
+
rules: [
|
|
330
|
+
{ id: "OUTBOX-01", severity: "error" },
|
|
331
|
+
{ id: "OUTBOX-02", severity: "error" },
|
|
332
|
+
],
|
|
333
|
+
mutatesState: false,
|
|
334
|
+
writes: [],
|
|
335
|
+
coverage: "operator",
|
|
336
|
+
coverageNote:
|
|
337
|
+
"outbox entry validation — any forge repository, adopted per product (RFC-1510)",
|
|
338
|
+
reads: ["docs/outbox/"],
|
|
339
|
+
cacheable: false,
|
|
340
|
+
flags: {},
|
|
341
|
+
execute: runOutboxValidate,
|
|
342
|
+
},
|
|
343
|
+
{
|
|
344
|
+
name: "system.outbox.scan",
|
|
345
|
+
description:
|
|
346
|
+
"Scan every product's committed docs/outbox/ entries from develop " +
|
|
347
|
+
"(RFC-1510). Matches each open entry's contract to the offering " +
|
|
348
|
+
"product, classifies the edge via edgeVerdict and prints " +
|
|
349
|
+
"OutboxProposal rows. SYSTEM-OUTBOX-01 warns on contracts nobody " +
|
|
350
|
+
"offers, SYSTEM-OUTBOX-02 errors on forbidden edges (no task), " +
|
|
351
|
+
"SYSTEM-OUTBOX-03 warns when forge.yaml or an entry names the " +
|
|
352
|
+
"system id, SYSTEM-OUTBOX-04 warns and skips products without a " +
|
|
353
|
+
"local folder or develop. --create writes one proposed task per " +
|
|
354
|
+
"entry (origin outbox:<product>:<id>) — rescanning deduplicates.",
|
|
355
|
+
scope: "workspace",
|
|
356
|
+
contract: "system",
|
|
357
|
+
rules: [
|
|
358
|
+
{ id: "SYSTEM-01", severity: "error" },
|
|
359
|
+
{ id: "SYSTEM-MAP-01", severity: "error" },
|
|
360
|
+
{ id: "OUTBOX-01", severity: "error" },
|
|
361
|
+
{ id: "OUTBOX-02", severity: "error" },
|
|
362
|
+
{ id: "SYSTEM-OUTBOX-01", severity: "warning" },
|
|
363
|
+
{ id: "SYSTEM-OUTBOX-02", severity: "error" },
|
|
364
|
+
{ id: "SYSTEM-OUTBOX-03", severity: "warning" },
|
|
365
|
+
{ id: "SYSTEM-OUTBOX-04", severity: "warning" },
|
|
366
|
+
],
|
|
367
|
+
mutatesState: true,
|
|
368
|
+
idempotency: "rerun-safe",
|
|
369
|
+
writes: ["queue/tasks/", "queue/briefs/"],
|
|
370
|
+
generates: [],
|
|
371
|
+
coverage: "operator",
|
|
372
|
+
coverageNote:
|
|
373
|
+
"outbox scan — the operator turns committed product needs into proposed tasks (RFC-1510)",
|
|
374
|
+
reads: [
|
|
375
|
+
"forge.yaml",
|
|
376
|
+
"system/system.yaml",
|
|
377
|
+
"system/products.yaml",
|
|
378
|
+
"system/edges.yaml",
|
|
379
|
+
"system/products.local.yaml",
|
|
380
|
+
"queue/tasks/",
|
|
381
|
+
"<product>/.git/**",
|
|
382
|
+
],
|
|
383
|
+
cacheable: false,
|
|
384
|
+
flags: {
|
|
385
|
+
create: { kind: "boolean", description: "Create proposed tasks for matched entries" },
|
|
386
|
+
"dry-run": { kind: "boolean", description: "Plan only — write nothing" },
|
|
387
|
+
},
|
|
388
|
+
execute: runSystemOutboxScan,
|
|
389
|
+
},
|
|
390
|
+
{
|
|
391
|
+
name: "system.versionset.record",
|
|
392
|
+
description:
|
|
393
|
+
"Record a verified version set (RFC-1511). Runs every check of " +
|
|
394
|
+
"every named scenario inside a temporary detached worktree of each " +
|
|
395
|
+
"product at its forge/release-tag@1 tag (the product's own " +
|
|
396
|
+
"worktree-setup hook prepares it), then writes " +
|
|
397
|
+
"system/version-sets/VS-NNNN.yaml with sha256 evidence per " +
|
|
398
|
+
"scenario only when all checks pass — a failing check leaves the " +
|
|
399
|
+
"logs but writes no set (DNA-106). --dry-run validates flags, " +
|
|
400
|
+
"scenarios, folders and tags without creating worktrees.",
|
|
401
|
+
scope: "workspace",
|
|
402
|
+
contract: "system",
|
|
403
|
+
rules: [
|
|
404
|
+
{ id: "SYSTEM-01", severity: "error" },
|
|
405
|
+
{ id: "SYSTEM-MAP-01", severity: "error" },
|
|
406
|
+
{ id: "SYSTEM-VS-01", severity: "error" },
|
|
407
|
+
{ id: "SYSTEM-VS-02", severity: "error" },
|
|
408
|
+
{ id: "SYSTEM-VS-03", severity: "error" },
|
|
409
|
+
{ id: "SYSTEM-VS-04", severity: "error" },
|
|
410
|
+
{ id: "SYSTEM-VS-05", severity: "warning" },
|
|
411
|
+
],
|
|
412
|
+
mutatesState: true,
|
|
413
|
+
idempotency: "rerun-safe",
|
|
414
|
+
writes: ["system/version-sets/", "<product>/.git/**"],
|
|
415
|
+
generates: [],
|
|
416
|
+
coverage: "operator",
|
|
417
|
+
coverageNote:
|
|
418
|
+
"version-set recording — the operator proves a release combination against the business scenarios (RFC-1511)",
|
|
419
|
+
reads: [
|
|
420
|
+
"forge.yaml",
|
|
421
|
+
"system/system.yaml",
|
|
422
|
+
"system/products.yaml",
|
|
423
|
+
"system/edges.yaml",
|
|
424
|
+
"system/products.local.yaml",
|
|
425
|
+
"system/scenarios/",
|
|
426
|
+
"system/version-sets/",
|
|
427
|
+
"<product>/.git/**",
|
|
428
|
+
"<product>/hooks/worktree-setup.sh",
|
|
429
|
+
],
|
|
430
|
+
cacheable: false,
|
|
431
|
+
flags: {
|
|
432
|
+
products: {
|
|
433
|
+
kind: "string",
|
|
434
|
+
required: true,
|
|
435
|
+
description: "Release combination — <product>=<release-tag>,…",
|
|
436
|
+
},
|
|
437
|
+
scenarios: {
|
|
438
|
+
kind: "string",
|
|
439
|
+
required: true,
|
|
440
|
+
description: "Comma-separated scenario ids from system/scenarios/",
|
|
441
|
+
},
|
|
442
|
+
"dry-run": { kind: "boolean", description: "Validate only — create no worktree, write nothing" },
|
|
443
|
+
},
|
|
444
|
+
execute: runSystemVersionSetRecord,
|
|
445
|
+
},
|
|
446
|
+
],
|
|
447
|
+
pipelines: [],
|
|
448
|
+
};
|
|
449
|
+
}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>Task-queue schemas for the system repository (RFC-1509): the
|
|
4
|
+
forge/system-task@1 task file, forge/dispatch-brief@1 brief frontmatter and
|
|
5
|
+
forge/task-report@1 product report, plus the task state machine expressed as
|
|
6
|
+
data. Every object is strict — a typo in a task file is a SYSTEM-TASK-01/08
|
|
7
|
+
diagnostic, never silently stripped.</purpose>
|
|
8
|
+
<non-goals>
|
|
9
|
+
<item>No store or handler logic — schemas and the transition table only.</item>
|
|
10
|
+
</non-goals>
|
|
11
|
+
</MODULE_CONTRACT>
|
|
12
|
+
<CHANGE_SUMMARY>
|
|
13
|
+
<item>RFC-1509: step 2 — task schemas and transition table</item>
|
|
14
|
+
<item>RFC-1509: implement RFC-1509 — system task queue, dispatch briefs and task reports</item>
|
|
15
|
+
<item>RFC-1509: close RFC-1509 review r1 findings — mark-failed escape, open-error refusal, dry-run coverage</item>
|
|
16
|
+
</CHANGE_SUMMARY>
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import { z } from "zod";
|
|
20
|
+
|
|
21
|
+
// ---------------------------------------------------------------------------
|
|
22
|
+
// States, kinds, transitions
|
|
23
|
+
// ---------------------------------------------------------------------------
|
|
24
|
+
|
|
25
|
+
export const TASK_STATES = [
|
|
26
|
+
"proposed",
|
|
27
|
+
"ready",
|
|
28
|
+
"dispatched",
|
|
29
|
+
"reported",
|
|
30
|
+
"integrated",
|
|
31
|
+
"verified",
|
|
32
|
+
"done",
|
|
33
|
+
"failed",
|
|
34
|
+
"parked",
|
|
35
|
+
"cancelled",
|
|
36
|
+
] as const;
|
|
37
|
+
export type TaskState = (typeof TASK_STATES)[number];
|
|
38
|
+
|
|
39
|
+
export const TASK_KINDS = [
|
|
40
|
+
"change",
|
|
41
|
+
"adoption",
|
|
42
|
+
"dependency-update",
|
|
43
|
+
"verification",
|
|
44
|
+
] as const;
|
|
45
|
+
export type TaskKind = (typeof TASK_KINDS)[number];
|
|
46
|
+
|
|
47
|
+
export type TaskTransitionOwner = "move" | "dispatch" | "collect";
|
|
48
|
+
|
|
49
|
+
export interface TaskTransition {
|
|
50
|
+
from: TaskState;
|
|
51
|
+
to: TaskState;
|
|
52
|
+
/** The command allowed to apply this transition. */
|
|
53
|
+
owner: TaskTransitionOwner;
|
|
54
|
+
/** Transitions that require --reason. */
|
|
55
|
+
needsReason?: boolean;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** The RFC-1509 transition table, as data. Any pair absent here is SYSTEM-TASK-02. */
|
|
59
|
+
export const TASK_TRANSITIONS: readonly TaskTransition[] = [
|
|
60
|
+
{ from: "proposed", to: "ready", owner: "move" },
|
|
61
|
+
{ from: "proposed", to: "cancelled", owner: "move", needsReason: true },
|
|
62
|
+
{ from: "ready", to: "dispatched", owner: "dispatch" },
|
|
63
|
+
{ from: "ready", to: "parked", owner: "move", needsReason: true },
|
|
64
|
+
{ from: "failed", to: "parked", owner: "move", needsReason: true },
|
|
65
|
+
{ from: "parked", to: "ready", owner: "move" },
|
|
66
|
+
{ from: "dispatched", to: "reported", owner: "collect" },
|
|
67
|
+
{ from: "dispatched", to: "failed", owner: "collect" },
|
|
68
|
+
{ from: "reported", to: "integrated", owner: "collect" },
|
|
69
|
+
{ from: "reported", to: "ready", owner: "move", needsReason: true },
|
|
70
|
+
{ from: "failed", to: "ready", owner: "move" },
|
|
71
|
+
{ from: "integrated", to: "verified", owner: "move" },
|
|
72
|
+
{ from: "verified", to: "done", owner: "move" },
|
|
73
|
+
];
|
|
74
|
+
|
|
75
|
+
export function findTransition(
|
|
76
|
+
from: TaskState,
|
|
77
|
+
to: TaskState,
|
|
78
|
+
): TaskTransition | null {
|
|
79
|
+
return TASK_TRANSITIONS.find((t) => t.from === from && t.to === to) ?? null;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// ---------------------------------------------------------------------------
|
|
83
|
+
// forge/system-task@1
|
|
84
|
+
// ---------------------------------------------------------------------------
|
|
85
|
+
|
|
86
|
+
export const TASK_ID_RE = /^T-\d{4}$/;
|
|
87
|
+
|
|
88
|
+
export const systemTaskSchema = z
|
|
89
|
+
.object({
|
|
90
|
+
schema: z.literal("forge/system-task@1"),
|
|
91
|
+
id: z.string().regex(TASK_ID_RE),
|
|
92
|
+
title: z.string().min(1),
|
|
93
|
+
product: z.string().min(1),
|
|
94
|
+
slug: z
|
|
95
|
+
.string()
|
|
96
|
+
.regex(/^[a-z0-9]+(-[a-z0-9]+)*$/)
|
|
97
|
+
.min(3)
|
|
98
|
+
.max(48),
|
|
99
|
+
kind: z.enum(TASK_KINDS),
|
|
100
|
+
state: z.enum(TASK_STATES),
|
|
101
|
+
origin: z
|
|
102
|
+
.object({
|
|
103
|
+
kind: z.enum(["operator", "outbox", "decision", "scenario"]),
|
|
104
|
+
ref: z.string().nullable(),
|
|
105
|
+
})
|
|
106
|
+
.strict(),
|
|
107
|
+
contracts: z.array(z.string().min(1)).default([]),
|
|
108
|
+
dependsOn: z.array(z.string().regex(TASK_ID_RE)).default([]),
|
|
109
|
+
brief: z.string().min(1),
|
|
110
|
+
briefSha256: z.string().nullable(),
|
|
111
|
+
dispatch: z
|
|
112
|
+
.object({
|
|
113
|
+
branch: z.string().min(1),
|
|
114
|
+
worktree: z.string().min(1),
|
|
115
|
+
baseCommit: z.string().min(1),
|
|
116
|
+
dispatchedAt: z.string().min(1),
|
|
117
|
+
})
|
|
118
|
+
.strict()
|
|
119
|
+
.nullable(),
|
|
120
|
+
report: z.string().nullable(),
|
|
121
|
+
integratedCommit: z.string().nullable(),
|
|
122
|
+
history: z.array(
|
|
123
|
+
z
|
|
124
|
+
.object({
|
|
125
|
+
at: z.string(),
|
|
126
|
+
from: z.string(),
|
|
127
|
+
to: z.string(),
|
|
128
|
+
by: z.string(),
|
|
129
|
+
reason: z.string().optional(),
|
|
130
|
+
})
|
|
131
|
+
.strict(),
|
|
132
|
+
),
|
|
133
|
+
})
|
|
134
|
+
.strict();
|
|
135
|
+
|
|
136
|
+
export type SystemTask = z.infer<typeof systemTaskSchema>;
|
|
137
|
+
|
|
138
|
+
// ---------------------------------------------------------------------------
|
|
139
|
+
// forge/dispatch-brief@1 — frontmatter of queue/briefs/<id>.md
|
|
140
|
+
// ---------------------------------------------------------------------------
|
|
141
|
+
|
|
142
|
+
export const dispatchBriefFrontmatterSchema = z
|
|
143
|
+
.object({
|
|
144
|
+
schema: z.literal("forge/dispatch-brief@1"),
|
|
145
|
+
task: z.string().regex(TASK_ID_RE),
|
|
146
|
+
product: z.string().min(1),
|
|
147
|
+
goal: z.string().min(1),
|
|
148
|
+
acceptance: z
|
|
149
|
+
.array(
|
|
150
|
+
z
|
|
151
|
+
.object({ claim: z.string().min(1), check: z.string().min(1) })
|
|
152
|
+
.strict(),
|
|
153
|
+
)
|
|
154
|
+
.min(1),
|
|
155
|
+
constraints: z.array(z.string()).default([]),
|
|
156
|
+
})
|
|
157
|
+
.strict();
|
|
158
|
+
|
|
159
|
+
export type DispatchBriefFrontmatter = z.infer<typeof dispatchBriefFrontmatterSchema>;
|
|
160
|
+
|
|
161
|
+
// ---------------------------------------------------------------------------
|
|
162
|
+
// forge/task-report@1 — .forge/task/report.yaml in the product worktree
|
|
163
|
+
// ---------------------------------------------------------------------------
|
|
164
|
+
|
|
165
|
+
export const taskReportSchema = z
|
|
166
|
+
.object({
|
|
167
|
+
schema: z.literal("forge/task-report@1"),
|
|
168
|
+
task: z.string().regex(TASK_ID_RE),
|
|
169
|
+
outcome: z.enum(["done", "blocked", "needs-decision"]),
|
|
170
|
+
summary: z.string().min(1),
|
|
171
|
+
commits: z.array(z.string()).default([]),
|
|
172
|
+
gate: z.enum(["pass", "fail", "not-run"]),
|
|
173
|
+
acceptance: z
|
|
174
|
+
.array(z.object({ claim: z.string(), evidence: z.string() }).strict())
|
|
175
|
+
.default([]),
|
|
176
|
+
outbox: z.array(z.string()).default([]),
|
|
177
|
+
question: z.string().optional(),
|
|
178
|
+
})
|
|
179
|
+
.strict()
|
|
180
|
+
.superRefine((report, ctx) => {
|
|
181
|
+
if (report.outcome === "needs-decision" && (!report.question || report.question.trim() === "")) {
|
|
182
|
+
ctx.addIssue({
|
|
183
|
+
code: "custom",
|
|
184
|
+
path: ["question"],
|
|
185
|
+
message: "question is required when outcome is needs-decision",
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
export type TaskReport = z.infer<typeof taskReportSchema>;
|