@warpgogol/forge 9.4.0 → 9.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (167) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/README.md +4 -2
  3. package/README.uk.md +10 -8
  4. package/bin/cli.ts +152 -11
  5. package/dist/bin/cli.js +125 -5
  6. package/dist/bin/cli.js.map +1 -1
  7. package/dist/os/flow/dirty-classify.d.ts +11 -1
  8. package/dist/os/flow/dirty-classify.d.ts.map +1 -1
  9. package/dist/os/flow/dirty-classify.js +13 -0
  10. package/dist/os/flow/dirty-classify.js.map +1 -1
  11. package/dist/os/flow/flow.module.d.ts.map +1 -1
  12. package/dist/os/flow/flow.module.js +29 -3
  13. package/dist/os/flow/flow.module.js.map +1 -1
  14. package/dist/os/flow/handlers/flow-check.d.ts.map +1 -1
  15. package/dist/os/flow/handlers/flow-check.js +9 -9
  16. package/dist/os/flow/handlers/flow-check.js.map +1 -1
  17. package/dist/os/flow/handlers/flow-cut.d.ts.map +1 -1
  18. package/dist/os/flow/handlers/flow-cut.js +22 -8
  19. package/dist/os/flow/handlers/flow-cut.js.map +1 -1
  20. package/dist/os/flow/handlers/flow-integrate.d.ts +6 -0
  21. package/dist/os/flow/handlers/flow-integrate.d.ts.map +1 -1
  22. package/dist/os/flow/handlers/flow-integrate.js +155 -44
  23. package/dist/os/flow/handlers/flow-integrate.js.map +1 -1
  24. package/dist/os/flow/handlers/flow-open.d.ts.map +1 -1
  25. package/dist/os/flow/handlers/flow-open.js +14 -19
  26. package/dist/os/flow/handlers/flow-open.js.map +1 -1
  27. package/dist/os/flow/handlers/flow-peers.d.ts +24 -0
  28. package/dist/os/flow/handlers/flow-peers.d.ts.map +1 -0
  29. package/dist/os/flow/handlers/flow-peers.js +99 -0
  30. package/dist/os/flow/handlers/flow-peers.js.map +1 -0
  31. package/dist/os/flow/index.d.ts +3 -0
  32. package/dist/os/flow/index.d.ts.map +1 -1
  33. package/dist/os/flow/index.js +9 -4
  34. package/dist/os/flow/index.js.map +1 -1
  35. package/dist/os/flow/ops-registry.d.ts +33 -0
  36. package/dist/os/flow/ops-registry.d.ts.map +1 -0
  37. package/dist/os/flow/ops-registry.js +177 -0
  38. package/dist/os/flow/ops-registry.js.map +1 -0
  39. package/dist/os/flow/preflight.d.ts +70 -3
  40. package/dist/os/flow/preflight.d.ts.map +1 -1
  41. package/dist/os/flow/preflight.js +545 -49
  42. package/dist/os/flow/preflight.js.map +1 -1
  43. package/dist/os/flow/registry.d.ts +2 -2
  44. package/dist/os/flow/standalone-invoke.d.ts +11 -0
  45. package/dist/os/flow/standalone-invoke.d.ts.map +1 -0
  46. package/dist/os/flow/standalone-invoke.js +75 -0
  47. package/dist/os/flow/standalone-invoke.js.map +1 -0
  48. package/dist/os/gate-run/detach.d.ts +27 -0
  49. package/dist/os/gate-run/detach.d.ts.map +1 -0
  50. package/dist/os/gate-run/detach.js +85 -0
  51. package/dist/os/gate-run/detach.js.map +1 -0
  52. package/dist/os/gate-run/gate-run.module.d.ts +3 -0
  53. package/dist/os/gate-run/gate-run.module.d.ts.map +1 -0
  54. package/dist/os/gate-run/gate-run.module.js +23 -0
  55. package/dist/os/gate-run/gate-run.module.js.map +1 -0
  56. package/dist/os/gate-run/index.d.ts +7 -0
  57. package/dist/os/gate-run/index.d.ts.map +1 -0
  58. package/dist/os/gate-run/index.js +5 -0
  59. package/dist/os/gate-run/index.js.map +1 -0
  60. package/dist/os/gate-run/record.d.ts +47 -0
  61. package/dist/os/gate-run/record.d.ts.map +1 -0
  62. package/dist/os/gate-run/record.js +157 -0
  63. package/dist/os/gate-run/record.js.map +1 -0
  64. package/dist/os/gate-run/status.d.ts +41 -0
  65. package/dist/os/gate-run/status.d.ts.map +1 -0
  66. package/dist/os/gate-run/status.js +142 -0
  67. package/dist/os/gate-run/status.js.map +1 -0
  68. package/dist/os/gate-run/types.d.ts +47 -0
  69. package/dist/os/gate-run/types.d.ts.map +1 -0
  70. package/dist/os/gate-run/types.js +24 -0
  71. package/dist/os/gate-run/types.js.map +1 -0
  72. package/dist/os/mission/handlers/archive.d.ts.map +1 -1
  73. package/dist/os/mission/handlers/archive.js +12 -8
  74. package/dist/os/mission/handlers/archive.js.map +1 -1
  75. package/dist/os/mission/importer-block.d.ts +19 -0
  76. package/dist/os/mission/importer-block.d.ts.map +1 -0
  77. package/dist/os/mission/importer-block.js +124 -0
  78. package/dist/os/mission/importer-block.js.map +1 -0
  79. package/dist/os/mission/lockfile.d.ts +17 -0
  80. package/dist/os/mission/lockfile.d.ts.map +1 -1
  81. package/dist/os/mission/lockfile.js +38 -0
  82. package/dist/os/mission/lockfile.js.map +1 -1
  83. package/dist/os/rfc/evidence-annotation.d.ts +26 -0
  84. package/dist/os/rfc/evidence-annotation.d.ts.map +1 -0
  85. package/dist/os/rfc/evidence-annotation.js +52 -0
  86. package/dist/os/rfc/evidence-annotation.js.map +1 -0
  87. package/dist/os/rfc/handlers/fixed-inputs.d.ts.map +1 -1
  88. package/dist/os/rfc/handlers/fixed-inputs.js +7 -1
  89. package/dist/os/rfc/handlers/fixed-inputs.js.map +1 -1
  90. package/dist/os/rfc/handlers/implement-stamp.d.ts.map +1 -1
  91. package/dist/os/rfc/handlers/implement-stamp.js +21 -28
  92. package/dist/os/rfc/handlers/implement-stamp.js.map +1 -1
  93. package/dist/os/rfc/handlers/list-create.d.ts.map +1 -1
  94. package/dist/os/rfc/handlers/list-create.js +25 -3
  95. package/dist/os/rfc/handlers/list-create.js.map +1 -1
  96. package/dist/os/rfc/handlers/validate-rules.d.ts.map +1 -1
  97. package/dist/os/rfc/handlers/validate-rules.js +127 -7
  98. package/dist/os/rfc/handlers/validate-rules.js.map +1 -1
  99. package/dist/os/rfc/rfc.module.d.ts.map +1 -1
  100. package/dist/os/rfc/rfc.module.js +3 -2
  101. package/dist/os/rfc/rfc.module.js.map +1 -1
  102. package/dist/os/rfc/types.d.ts +9 -2
  103. package/dist/os/rfc/types.d.ts.map +1 -1
  104. package/dist/os/rfc/types.js +2 -2
  105. package/dist/os/rfc/types.js.map +1 -1
  106. package/dist/os/system/handlers/system-task-collect.d.ts.map +1 -1
  107. package/dist/os/system/handlers/system-task-collect.js +11 -5
  108. package/dist/os/system/handlers/system-task-collect.js.map +1 -1
  109. package/dist/src/cli-flags.d.ts.map +1 -1
  110. package/dist/src/cli-flags.js +6 -0
  111. package/dist/src/cli-flags.js.map +1 -1
  112. package/dist/src/onboarding/prettierignore.d.ts.map +1 -1
  113. package/dist/src/onboarding/prettierignore.js +2 -0
  114. package/dist/src/onboarding/prettierignore.js.map +1 -1
  115. package/dist/src/types.d.ts +7 -0
  116. package/dist/src/types.d.ts.map +1 -1
  117. package/dist/src/types.js +2 -8
  118. package/dist/src/types.js.map +1 -1
  119. package/os/flow/dirty-classify.ts +21 -0
  120. package/os/flow/flow.module.ts +31 -3
  121. package/os/flow/handlers/flow-check.ts +17 -18
  122. package/os/flow/handlers/flow-cut.ts +28 -11
  123. package/os/flow/handlers/flow-integrate.ts +229 -62
  124. package/os/flow/handlers/flow-open.ts +24 -31
  125. package/os/flow/handlers/flow-peers.ts +142 -0
  126. package/os/flow/index.ts +10 -8
  127. package/os/flow/ops-registry.ts +194 -0
  128. package/os/flow/preflight.ts +608 -55
  129. package/os/flow/standalone-invoke.ts +85 -0
  130. package/os/flow/tests/dirty-classify.test.ts +139 -4
  131. package/os/flow/tests/flow-cut.test.ts +21 -0
  132. package/os/flow/tests/flow-integrate.preflight.test.ts +34 -9
  133. package/os/flow/tests/flow-integrate.test.ts +433 -17
  134. package/os/flow/tests/lockfile-induced.test.ts +328 -0
  135. package/os/flow/tests/ops-registry.test.ts +136 -0
  136. package/os/gate-run/detach.ts +106 -0
  137. package/os/gate-run/gate-run.module.ts +25 -0
  138. package/os/gate-run/index.ts +16 -0
  139. package/os/gate-run/record.ts +194 -0
  140. package/os/gate-run/status.ts +168 -0
  141. package/os/gate-run/tests/gate-run-detach.test.ts +144 -0
  142. package/os/gate-run/tests/gate-run-record.test.ts +200 -0
  143. package/os/gate-run/types.ts +73 -0
  144. package/os/mission/handlers/archive.ts +22 -14
  145. package/os/mission/importer-block.ts +119 -0
  146. package/os/mission/lockfile.ts +41 -0
  147. package/os/rfc/evidence-annotation.ts +61 -0
  148. package/os/rfc/handlers/fixed-inputs.test.ts +70 -0
  149. package/os/rfc/handlers/fixed-inputs.ts +11 -1
  150. package/os/rfc/handlers/implement-stamp.ts +25 -28
  151. package/os/rfc/handlers/list-create.test.ts +58 -5
  152. package/os/rfc/handlers/list-create.ts +30 -3
  153. package/os/rfc/handlers/validate-evidence-shape.test.ts +218 -0
  154. package/os/rfc/handlers/validate-probe-meta.test.ts +71 -0
  155. package/os/rfc/handlers/validate-rules.ts +169 -17
  156. package/os/rfc/handlers/validate-transient-probes.test.ts +222 -0
  157. package/os/rfc/rfc-0000-template.md +10 -10
  158. package/os/rfc/rfc.module.ts +3 -2
  159. package/os/rfc/types.ts +5 -2
  160. package/os/system/handlers/system-task-collect.ts +11 -5
  161. package/os/system/tests/system-task-collect.test.ts +16 -0
  162. package/package.json +17 -1
  163. package/skills/fo/fo-session-retro/SKILL.md +12 -4
  164. package/src/cli-flags.ts +7 -0
  165. package/src/onboarding/prettierignore.ts +2 -0
  166. package/src/tests/prettierignore-manage.test.ts +11 -0
  167. package/src/types.ts +9 -8
@@ -6,9 +6,6 @@
6
6
  </non-goals>
7
7
  </MODULE_CONTRACT>
8
8
  <CHANGE_SUMMARY>
9
- <item>RFC-1455: fixed inputs bound to outcome probes — V-50/V-51 + skills</item>
10
- <item>RFC-1534: V-PROBE-META-01 metachar lint — warning on unescaped parens and `**` + slash glob shapes in file-contains/test probe patterns at authoring statuses; `probe-meta: intentional` comment suppresses per-pattern via raw frontmatterSource scan.</item>
11
- <item>RFC-1454: review deviations recorded in the RFC — IMP-15 gate, V-49 provenance, skill contract</item>
12
9
  <item>RFC-1467: block rfc.create on terminal-kind near-duplicates until --revisit acknowledges + V-52 validate mirror</item>
13
10
  <item>RFC-1489: batch test probes through one instrumented Vitest run + frontmatter corpus reads
14
11
 
@@ -20,7 +17,9 @@ process (per-spec null on missing objects, wholesale null on spawn or
20
17
  framing failure). collectCommittedReviews prefers it and keeps the
21
18
  sequential show loop for stubs. rfc.validate memoizes the index once
22
19
  per run and V-49 consumes it — identical diagnostics, one batched read.</item>
23
- <history>RFC-0303, RFC-0722, RFC-0755, RFC-0795, RFC-0997, RFC-1006, RFC-1097, RFC-1271, RFC-1322, RFC-1330, RFC-1334, RFC-1336, RFC-1391, RFC-1453</history>
20
+ <item>RFC-1569: lint rfc evidence annotations and transient probe targets</item>
21
+ <item>RFC-1563: share the kernel command-result cache across session worktrees — one SQLite DB in the primary checkout, @@WORKSPACE_ROOT@@ payload anchoring, scoped --force clear, kernel.cache.prune</item>
22
+ <history>RFC-0303, RFC-0722, RFC-0755, RFC-0795, RFC-0997, RFC-1006, RFC-1097, RFC-1271, RFC-1322, RFC-1330, RFC-1334, RFC-1336, RFC-1391, RFC-1453, RFC-1454, RFC-1455, RFC-1534</history>
24
23
  </CHANGE_SUMMARY>
25
24
  */
26
25
 
@@ -37,11 +36,8 @@ import { execFile } from "../../../src/utils/sync-fs.ts";
37
36
  import { parse as yamlParse } from "yaml";
38
37
  import { proofSpecSchema } from "../../../src/formal/proof-spec.ts";
39
38
  import { validateAcceptanceShape } from "../acceptance.ts";
40
- import {
41
- scoreDecisions,
42
- REPROPOSED_SCORE,
43
- TERMINAL_KINDS,
44
- } from "../decision-log.ts";
39
+ import { EVIDENCE_FORMS, parseEvidenceAnnotation } from "../evidence-annotation.ts";
40
+ import { scoreDecisions, REPROPOSED_SCORE, TERMINAL_KINDS } from "../decision-log.ts";
45
41
  import type { DecisionLogEntry } from "../types.ts";
46
42
  import type { ParsedRfc, RfcCorpusEntry } from "../frontmatter-io.ts";
47
43
  import type { ReadAndParseRfcResult } from "../frontmatter-io.ts";
@@ -564,9 +560,7 @@ export function collectProbeMetacharHits(
564
560
  for (let i = 0; i < fmLines.length; i++) {
565
561
  const line = fmLines[i]!;
566
562
  if (!line.includes(`${field}:`) || !line.includes(value)) continue;
567
- return (
568
- line.includes(PROBE_META_MARKER) || (fmLines[i - 1] ?? "").includes(PROBE_META_MARKER)
569
- );
563
+ return line.includes(PROBE_META_MARKER) || (fmLines[i - 1] ?? "").includes(PROBE_META_MARKER);
570
564
  }
571
565
  return false;
572
566
  };
@@ -584,13 +578,25 @@ export function collectProbeMetacharHits(
584
578
  if (/(^|[^\\])\(/.test(pattern)) chars.push("unescaped `(`");
585
579
  if (/(^|[^\\])\)/.test(pattern)) chars.push("unescaped `)`");
586
580
  if (pattern.includes("**/")) chars.push("`**/` glob shape");
581
+ // RFC-1569 (F-0202): a mid-pattern `$`/`^` anchors silently — the probe can
582
+ // never match; unescaped `{}`/`[]` quantify/group instead of matching.
583
+ const rest = pattern.slice(1).replace(/\\\^/g, "");
584
+ if (rest.includes("^")) chars.push("mid-pattern `^` anchor");
585
+ const head = pattern.slice(0, -1).replace(/\\\$/g, "");
586
+ if (head.includes("$")) chars.push("mid-pattern `$` anchor");
587
+ if (/(^|[^\\])[{}]/.test(pattern)) chars.push("unescaped `{`/`}`");
588
+ if (/(^|[^\\])[[\]]/.test(pattern)) chars.push("unescaped `[`/`]`");
587
589
  if (chars.length === 0 || suppressed(field, pattern)) continue;
588
590
  hits.push({
589
591
  criterion: typeof probe.criterion === "string" ? probe.criterion : "?",
590
592
  probe: kind,
591
593
  pattern,
592
594
  chars,
593
- suggestion: pattern.replace(/\*\*\//g, "(?:.*/)?").replace(/([()])/g, "\\$1"),
595
+ suggestion: pattern
596
+ .replace(/\*\*\//g, "(?:.*/)?")
597
+ .replace(/([()[\]{}^$])/g, "\\$1")
598
+ .replace(/^\\\^/, "^")
599
+ .replace(/\\\$$/, "$"),
594
600
  });
595
601
  }
596
602
  return hits;
@@ -993,14 +999,160 @@ export async function validateSingleRfc(
993
999
  }
994
1000
  }
995
1001
 
1002
+ // V-53 (RFC-1569): evidence annotation SHAPE on every criterion line —
1003
+ // the stamp's grammar, applied at authoring time. Warning at
1004
+ // draft/reviewing, error from accepted on; V-37 keeps its checked-line
1005
+ // resolution semantics (the double-fire on checked lines is deliberate).
1006
+ // Implemented and archived RFCs are sealed — historical annotations
1007
+ // degrade to warning (re-authoring them would falsify the record).
1008
+ const v53Probes = Array.isArray(fm["acceptance"]) ? (fm["acceptance"] as AcceptanceProbe[]) : [];
1009
+ if (acceptanceSection) {
1010
+ const v53Severity =
1011
+ status === "draft" || status === "reviewing" || status === "implemented" || isArchived
1012
+ ? "warning"
1013
+ : "error";
1014
+ for (const line of acceptanceSection.split("\n")) {
1015
+ if (!/^- \[[ xX]\]/.test(line)) continue;
1016
+ const v53Matches = [...line.matchAll(/\(evidence:\s*(.+?)\)/g)];
1017
+ const v53Match = v53Matches.at(-1);
1018
+ if (!v53Match) continue;
1019
+ const v53Parsed = parseEvidenceAnnotation(v53Match[1]!);
1020
+ if (v53Parsed.kind === "invalid") {
1021
+ addViolation(
1022
+ rfcId,
1023
+ relFile,
1024
+ "V-53",
1025
+ `evidence "${v53Parsed.raw.trim()}" is not a resolvable form (expected ${EVIDENCE_FORMS}) — rfc.implement.stamp would refuse it with STAMP-CHECK-01`,
1026
+ v53Severity,
1027
+ );
1028
+ } else if (v53Parsed.kind === "probe") {
1029
+ const refId = v53Parsed.criterion;
1030
+ // AC-N existence comes from the checklist; a design:<heading>
1031
+ // criterion "exists" when a frontmatter probe declares it.
1032
+ const exists =
1033
+ criteriaEval.criterionIds.includes(refId) || v53Probes.some((p) => p.criterion === refId);
1034
+ if (!exists) {
1035
+ addViolation(
1036
+ rfcId,
1037
+ relFile,
1038
+ "V-53",
1039
+ `evidence "probe:${refId}" references a criterion that does not exist in acceptance criteria`,
1040
+ v53Severity,
1041
+ );
1042
+ } else if (v53Probes.length > 0 && !v53Probes.some((p) => p.criterion === refId)) {
1043
+ addViolation(
1044
+ rfcId,
1045
+ relFile,
1046
+ "V-53",
1047
+ `evidence "probe:${refId}" references a criterion with no bound probe`,
1048
+ v53Severity,
1049
+ );
1050
+ }
1051
+ }
1052
+ }
1053
+ }
1054
+
1055
+ // V-54 (RFC-1569, F-0175): transient probe targets — a target that only
1056
+ // resolves while a mission is open cannot carry stamp evidence. Warning
1057
+ // only: app-scope fallbacks to the cache clone are legitimate (RFC-1025).
1058
+ {
1059
+ let outcomeBuildRe: RegExp | null = null;
1060
+ try {
1061
+ const ob = loadForgeConfig(workspaceRoot).bindings?.commands.outcomeBuild;
1062
+ if (typeof ob === "string" && ob.trim()) {
1063
+ outcomeBuildRe = new RegExp(
1064
+ `^${ob
1065
+ .trim()
1066
+ .replace(/[.*+?^${}()|[\]\\]/g, "\\$&")
1067
+ .replace(/\\\{target\\\}/g, "\\S+")}$`,
1068
+ );
1069
+ }
1070
+ } catch {
1071
+ // forge.yaml unreadable → no binding → nothing to exempt.
1072
+ }
1073
+ let appScopedCommands: Set<string> | null = null;
1074
+ const runProbes = v53Probes.filter((p) => p.probe === "run");
1075
+ if (runProbes.length > 0) {
1076
+ let manifestRaw: string | null = null;
1077
+ try {
1078
+ manifestRaw = await io.readFile(
1079
+ path.join(workspaceRoot, "docs", "command-manifest.generated.yaml"),
1080
+ );
1081
+ } catch {
1082
+ // Manifest absent (forge-only consumer repos) → skip the arm.
1083
+ }
1084
+ if (manifestRaw !== null) {
1085
+ try {
1086
+ const manifest = yamlParse(manifestRaw) as {
1087
+ commands?: { name?: string; scope?: string }[];
1088
+ };
1089
+ const entries = manifest?.commands;
1090
+ if (!Array.isArray(entries)) throw new Error("no commands[]");
1091
+ appScopedCommands = new Set(
1092
+ entries
1093
+ .filter((c) => c?.scope === "app" && typeof c?.name === "string")
1094
+ .map((c) => c.name as string),
1095
+ );
1096
+ } catch {
1097
+ addViolation(
1098
+ rfcId,
1099
+ relFile,
1100
+ "V-54",
1101
+ `command manifest malformed — app-scope arm of V-54 skipped for this run`,
1102
+ "warning",
1103
+ );
1104
+ }
1105
+ }
1106
+ }
1107
+ for (const probe of v53Probes) {
1108
+ const kind = probe.probe;
1109
+ const criterion = typeof probe.criterion === "string" ? probe.criterion : "?";
1110
+ if (kind === "file-exists" || kind === "file-contains" || kind === "json-schema") {
1111
+ const p = "path" in probe ? String(probe.path ?? "") : "";
1112
+ if (/^missions\/(?!archive\/)/.test(p)) {
1113
+ addViolation(
1114
+ rfcId,
1115
+ relFile,
1116
+ "V-54",
1117
+ `${criterion} ${kind} probe path "${p}" lives under missions/ outside missions/archive/ — it resolves only while a mission is open; bind a durable target instead`,
1118
+ "warning",
1119
+ );
1120
+ }
1121
+ }
1122
+ if (kind === "run") {
1123
+ const cmd = "command" in probe ? String(probe.command ?? "") : "";
1124
+ if (!cmd || (outcomeBuildRe && outcomeBuildRe.test(cmd.trim()))) continue;
1125
+ if (/(^|\s)--mission(\s|=|$)/.test(cmd)) {
1126
+ addViolation(
1127
+ rfcId,
1128
+ relFile,
1129
+ "V-54",
1130
+ `${criterion} run probe "${cmd}" carries a --mission flag — the command resolves only while that mission is open; use a test probe or a durable target`,
1131
+ "warning",
1132
+ );
1133
+ continue;
1134
+ }
1135
+ if (appScopedCommands !== null) {
1136
+ const hit = cmd.split(/\s+/).find((tok) => appScopedCommands!.has(tok));
1137
+ if (hit) {
1138
+ addViolation(
1139
+ rfcId,
1140
+ relFile,
1141
+ "V-54",
1142
+ `${criterion} run probe invokes app-scoped command "${hit}" — it needs an open site workpiece to run; prefer a test probe, a durable target, or the outcomeBuild binding`,
1143
+ "warning",
1144
+ );
1145
+ }
1146
+ }
1147
+ }
1148
+ }
1149
+ }
1150
+
996
1151
  // V-PROBE-META-01 (RFC-1534): regexp-trap metachar lint — warning at
997
1152
  // authoring statuses (draft/reviewing/accepted), never a blocking error;
998
1153
  // terminal statuses are archival and stay silent.
999
1154
  if (status === "draft" || status === "reviewing" || status === "accepted") {
1000
- for (const hit of collectProbeMetacharHits(
1001
- fm["acceptance"],
1002
- parsed.frontmatterSource ?? "",
1003
- )) {
1155
+ for (const hit of collectProbeMetacharHits(fm["acceptance"], parsed.frontmatterSource ?? "")) {
1004
1156
  addViolation(
1005
1157
  rfcId,
1006
1158
  relFile,
@@ -0,0 +1,222 @@
1
+ /*
2
+ <MODULE_CONTRACT>
3
+ <purpose>RFC-1569 V-54 — transient probe target lint: missions/ paths,
4
+ --mission flags, app-scoped run commands, outcomeBuild exemption.</purpose>
5
+ <non-goals>
6
+ <item>Not a contract source of truth — the module under test owns the authoritative behavior; fixtures are minimal scaffolding only.</item>
7
+ </non-goals>
8
+ </MODULE_CONTRACT>
9
+ <CHANGE_SUMMARY>
10
+ <item>RFC-1569: V-54 rule tests (AC-4, AC-5, --mission/app-scope arms)</item>
11
+ <item>RFC-1569: lint rfc evidence annotations and transient probe targets</item>
12
+ </CHANGE_SUMMARY>
13
+ */
14
+
15
+ import { test, expect, describe, beforeAll } from "vitest";
16
+ import { mkdirSync, writeFileSync } from "node:fs";
17
+ import { validateSingleRfc, type AddViolationFn } from "./validate-rules.ts";
18
+ import type { ParsedRfc } from "../frontmatter-io.ts";
19
+ import { join } from "node:path";
20
+ import { tmpdir } from "node:os";
21
+
22
+ const testWorkspace = join(tmpdir(), "test-workspace-rfc1569-v54");
23
+
24
+ beforeAll(() => {
25
+ mkdirSync(join(testWorkspace, "docs"), { recursive: true });
26
+ writeFileSync(
27
+ join(testWorkspace, "forge.yaml"),
28
+ 'bindings:\n commands:\n outcomeBuild: "werkstatt run leitstand.build --id {target}"\n',
29
+ );
30
+ writeFileSync(
31
+ join(testWorkspace, "docs", "command-manifest.generated.yaml"),
32
+ "commands:\n - name: agent.api-catalog.validate\n scope: app\n - name: rfc.validate\n scope: workspace\n",
33
+ );
34
+ });
35
+
36
+ function makeParsed(body: string, acceptance: unknown[]): ParsedRfc {
37
+ return {
38
+ frontmatter: {
39
+ id: "RFC-9999",
40
+ title: "Test RFC",
41
+ status: "draft",
42
+ kind: "command",
43
+ scope: "workspace",
44
+ owners: ["architecture"],
45
+ createdAt: "2026-09-01",
46
+ updatedAt: "2026-09-01",
47
+ acceptance,
48
+ },
49
+ body,
50
+ };
51
+ }
52
+
53
+ const BASE_BODY = `
54
+ # RFC-9999: Test RFC
55
+
56
+ ## Context
57
+
58
+ Test context.
59
+
60
+ ## Problem
61
+
62
+ Test problem.
63
+
64
+ ## Decision
65
+
66
+ Test decision.
67
+
68
+ ## Architectural fit
69
+
70
+ Test fit.
71
+
72
+ ## Design
73
+
74
+ ### CLI surface
75
+
76
+ Test CLI.
77
+
78
+ ### TypeScript contracts
79
+
80
+ Test types.
81
+
82
+ ### File system responsibilities
83
+
84
+ | Path | Role |
85
+ |---|---|
86
+ | \`test.ts\` | test |
87
+
88
+ ### Output format
89
+
90
+ Test output.
91
+
92
+ ### Failure modes
93
+
94
+ Test failures.
95
+
96
+ ## Rollout
97
+
98
+ Test rollout.
99
+
100
+ ## Alternatives considered
101
+
102
+ Test alternatives.
103
+
104
+ ## Risks
105
+
106
+ Test risks.
107
+
108
+ ## Acceptance criteria
109
+
110
+ - [ ] AC-1: first criterion
111
+ - [ ] AC-2: second criterion
112
+
113
+ ## Implementation notes for agents
114
+
115
+ Test notes.
116
+ `;
117
+
118
+ async function runValidate(
119
+ parsed: ParsedRfc,
120
+ ): Promise<{ rfcId: string; rule: string; message: string; severity: string }[]> {
121
+ const violations: { rfcId: string; rule: string; message: string; severity: string }[] = [];
122
+ const add: AddViolationFn = (rfcId, _file, rule, message, severity = "error") => {
123
+ violations.push({ rfcId, rule, message, severity });
124
+ };
125
+ await validateSingleRfc(
126
+ "rfc-9999-test.md",
127
+ parsed,
128
+ new Map(),
129
+ new Map(),
130
+ new Set(),
131
+ new Set(),
132
+ new Set(Object.keys(parsed.frontmatter)),
133
+ testWorkspace,
134
+ add,
135
+ );
136
+ return violations.filter((v) => v.rule === "V-54");
137
+ }
138
+
139
+ describe("V-54: transient probe targets (RFC-1569)", () => {
140
+ test("AC-4: file-contains probe under missions/ reports warning", async () => {
141
+ const violations = await runValidate(
142
+ makeParsed(BASE_BODY, [
143
+ {
144
+ probe: "file-contains",
145
+ criterion: "AC-1",
146
+ path: "missions/warpgogol-m000219/workpiece/src/index.astro",
147
+ pattern: "hero",
148
+ },
149
+ ]),
150
+ );
151
+ expect(violations.length).toBe(1);
152
+ expect(violations[0]!.severity).toBe("warning");
153
+ expect(violations[0]!.message).toContain("missions/");
154
+ });
155
+
156
+ test("missions/archive/ path is durable — no V-54", async () => {
157
+ const violations = await runValidate(
158
+ makeParsed(BASE_BODY, [
159
+ {
160
+ probe: "file-exists",
161
+ criterion: "AC-1",
162
+ path: "missions/archive/warpgogol-m000219/report.json",
163
+ },
164
+ ]),
165
+ );
166
+ expect(violations).toEqual([]);
167
+ });
168
+
169
+ test("run probe carrying --mission reports warning", async () => {
170
+ const violations = await runValidate(
171
+ makeParsed(BASE_BODY, [
172
+ {
173
+ probe: "run",
174
+ criterion: "AC-1",
175
+ command: "werkstatt run mission.validate --mission m000219 --json",
176
+ },
177
+ ]),
178
+ );
179
+ expect(violations.length).toBe(1);
180
+ expect(violations[0]!.message).toContain("--mission");
181
+ });
182
+
183
+ test("app-scoped run command reports warning", async () => {
184
+ const violations = await runValidate(
185
+ makeParsed(BASE_BODY, [
186
+ {
187
+ probe: "run",
188
+ criterion: "AC-1",
189
+ command: "pnpm exec werkstatt run agent.api-catalog.validate --app warpgogol",
190
+ },
191
+ ]),
192
+ );
193
+ expect(violations.length).toBe(1);
194
+ expect(violations[0]!.message).toContain("agent.api-catalog.validate");
195
+ });
196
+
197
+ test("AC-5: outcomeBuild binding command is exempt", async () => {
198
+ const violations = await runValidate(
199
+ makeParsed(BASE_BODY, [
200
+ {
201
+ probe: "run",
202
+ criterion: "AC-1",
203
+ command: "werkstatt run leitstand.build --id warpgogol",
204
+ },
205
+ ]),
206
+ );
207
+ expect(violations).toEqual([]);
208
+ });
209
+
210
+ test("workspace-scoped run command is clean", async () => {
211
+ const violations = await runValidate(
212
+ makeParsed(BASE_BODY, [
213
+ {
214
+ probe: "run",
215
+ criterion: "AC-1",
216
+ command: "pnpm exec werkstatt run rfc.validate --id RFC-9999",
217
+ },
218
+ ]),
219
+ );
220
+ expect(violations).toEqual([]);
221
+ });
222
+ });
@@ -225,8 +225,8 @@ interface ExampleResult {
225
225
  system behavior — they are checks that the document is complete.
226
226
  Use DR-N: identifiers. V-38 enforces completeness for accepted+ post-cutoff RFCs.
227
227
 
228
- - [ ] DR-1: Every considered alternative has a stated reason for rejection (evidence: file: <path:line>)
229
- - [ ] DR-2: The RFC enumerates every existing artifact it touches (evidence: file: <path:line>)
228
+ - [ ] DR-1: Every considered alternative has a stated reason for rejection (evidence: file:<path>:<line>)
229
+ - [ ] DR-2: The RFC enumerates every existing artifact it touches (evidence: file:<path>:<line>)
230
230
  - [ ] DR-3: The RFC states whether the decision is reversible and at what cost
231
231
  -->
232
232
 
@@ -235,12 +235,12 @@ interface ExampleResult {
235
235
  <!-- V-50 contract (RFC-1455): every value this RFC pins for the shipped
236
236
  result (verbatim copy, labels, names, decided option values) is a row
237
237
  bound to exactly one AC-N criterion whose probes observe the value.
238
- Emit the header schema only — a live placeholder row would itself trip
238
+ V-50 containment compares each literal against the regex-UNESCAPED probe pattern — escaping a metachar literal keeps coverage. Emit the header schema only — a live placeholder row would itself trip
239
239
  V-50. Add rows only when the draft fixes real inputs; delete this
240
240
  section's table when none exist. -->
241
241
 
242
- | ID | Value | Source | Checked by |
243
- | --- | --- | --- | --- |
242
+ | ID | Value | Source | Checked by |
243
+ | --- | ----- | ------ | ---------- |
244
244
 
245
245
  ## Acceptance criteria
246
246
 
@@ -248,11 +248,11 @@ interface ExampleResult {
248
248
  Each criterion is a falsifiable claim about an observable artifact, written in EARS form with a stable AC-N: identifier.
249
249
  Required mix: behavior, contract, negative, sync. 3–10 items. One claim = one checking mechanism. -->
250
250
 
251
- - [ ] AC-1: WHEN `<command> --json` is invoked, THE command SHALL return a JSON object matching the documented output schema (evidence: probe:AC-1 or test: <path>)
252
- - [ ] AC-2: THE `<command>` SHALL be registered in the kernel module with the correct name and scope (evidence: file: <module-path>)
253
- - [ ] AC-3: IF `<command>` receives invalid input, THEN THE command SHALL report a blocking error (evidence: test: <path/to/test>)
254
- - [ ] AC-4: IF `<command>` receives invalid input, THEN THE command SHALL exit non-zero (evidence: test: <path/to/test>)
255
- - [ ] AC-5: THE relevant `AGENTS.md` SHALL reference this RFC where agent behavior rules changed (evidence: file: <path:line>)
251
+ - [ ] AC-1: WHEN `<command> --json` is invoked, THE command SHALL return a JSON object matching the documented output schema (evidence: probe:AC-1)
252
+ - [ ] AC-2: THE `<command>` SHALL be registered in the kernel module with the correct name and scope (evidence: file:<module-path>)
253
+ - [ ] AC-3: IF `<command>` receives invalid input, THEN THE command SHALL report a blocking error (evidence: test:<path/to/test>)
254
+ - [ ] AC-4: IF `<command>` receives invalid input, THEN THE command SHALL exit non-zero (evidence: test:<path/to/test>)
255
+ - [ ] AC-5: THE relevant `AGENTS.md` SHALL reference this RFC where agent behavior rules changed (evidence: file:<path>:<line>)
256
256
 
257
257
  ## Implementation notes for agents
258
258
 
@@ -7,14 +7,14 @@
7
7
  </non-goals>
8
8
  </MODULE_CONTRACT>
9
9
  <CHANGE_SUMMARY>
10
- <item>RFC-1483: self-sufficient implement stamp — default repair pass, ordered remediation checklist, --no-repair</item>
11
10
  <item>RFC-1489: batch test probes through one instrumented Vitest run + frontmatter corpus reads
12
11
 
13
12
  runProbeSet is the single shared execution point: barrier-free segments of test probes sharing one effective bound run in one vitest --reporter=json --outputFile process with per-(file,testName) attribution; missing files/reports yield unverified. run/page/proof and all non-test kinds are barriers. --no-batch escapes to the legacy path on acceptance.run, verification.emit and verification.refresh. rfc.validate reads non-target corpus files frontmatter-only via readRfcFrontmatter (64 KiB bound, full-parse fallback); emit/refresh/acceptance corpus scans use the same accessor. Corpus map slimmed to RfcCorpusEntry {fileName, frontmatter}.</item>
14
13
  <item>RFC-1516: add an evidence-freshness window to the stamp-sync chain for rfc-1516</item>
15
14
  <item>RFC-1528: close review findings — manifest-union command inventory for regen/preflight</item>
16
15
  <item>RFC-1534: lint probe patterns, sync amends counterparts, name next free ledger id</item>
17
- <history>RFC-0260, RFC-0795, RFC-1097, RFC-1173, RFC-1231, RFC-1237, RFC-1249, RFC-1271, RFC-1306, RFC-1322, RFC-1333, RFC-1351, RFC-1354, RFC-1364, RFC-1453, RFC-1458, RFC-1461, RFC-1463, RFC-1467, RFC-1474, RFC-1482</history>
16
+ <item>RFC-1568: durable gate-run records, --detach mechanics, and forge CLI wiring</item>
17
+ <history>RFC-0260, RFC-0795, RFC-1097, RFC-1173, RFC-1231, RFC-1237, RFC-1249, RFC-1271, RFC-1306, RFC-1322, RFC-1333, RFC-1351, RFC-1354, RFC-1364, RFC-1453, RFC-1458, RFC-1461, RFC-1463, RFC-1467, RFC-1474, RFC-1482, RFC-1483</history>
18
18
  </CHANGE_SUMMARY>
19
19
  */
20
20
 
@@ -556,6 +556,7 @@ export async function createForgeRfcModule(): Promise<ForgeModule> {
556
556
  },
557
557
  {
558
558
  name: "rfc.implement.stamp",
559
+ detachable: true,
559
560
  // gate-completeness: handlers/implement-stamp.ts accumulates
560
561
  // violations[] across every independent precondition gate and emits
561
562
  // one stampFailResult — the complete set in a single run (RFC-1463).
package/os/rfc/types.ts CHANGED
@@ -12,12 +12,12 @@
12
12
  * </non-goals>
13
13
  * </MODULE_CONTRACT>
14
14
  * * <CHANGE_SUMMARY>
15
- <item>RFC-1516: add an evidence-freshness window to the stamp-sync chain for rfc-1516</item>
16
15
  <item>RFC-1516: bind evidence reuse to the oldest replayed result and harden committed-envelope reads for rfc-1516</item>
17
16
  <item>RFC-1514: attach corrected invocations to blocking diagnostics so retry is one-shot</item>
18
17
  <item>RFC-1536: owning-checkout routing, FLOW-OPEN-01 dirty-primary warning, shared governance-id allocation (RFC+ADR)</item>
19
18
  <item>RFC-1534: lint probe patterns, sync amends counterparts, name next free ledger id</item>
20
- <history>RFC-0465, RFC-0478, RFC-0480, RFC-0795, RFC-0998, RFC-0999, RFC-1097, RFC-1249, RFC-1271, RFC-1306, RFC-1310, RFC-1320, RFC-1322, RFC-1330, RFC-1333, RFC-1334, RFC-1336, RFC-1364, RFC-1383, RFC-1391, RFC-1401, RFC-1445, RFC-1453, RFC-1454, RFC-1455, RFC-1458, RFC-1467, RFC-1483</history>
19
+ <item>RFC-1546: derive-and-repair recoverable state across flow surfaces (AC-1..AC-5)</item>
20
+ <history>RFC-0465, RFC-0478, RFC-0480, RFC-0795, RFC-0998, RFC-0999, RFC-1097, RFC-1249, RFC-1271, RFC-1306, RFC-1310, RFC-1320, RFC-1322, RFC-1330, RFC-1333, RFC-1334, RFC-1336, RFC-1364, RFC-1383, RFC-1391, RFC-1401, RFC-1445, RFC-1453, RFC-1454, RFC-1455, RFC-1458, RFC-1467, RFC-1483, RFC-1516</history>
21
21
  </CHANGE_SUMMARY>
22
22
  ***************************************************************/
23
23
 
@@ -641,6 +641,9 @@ export interface RfcCreateResult {
641
641
  /** RFC-1534: --amends counterpart outcome — wroteCounterpart false means
642
642
  * the amended file was missing/unreadable and V-19 still applies. */
643
643
  amendsSync?: { amended: string; wroteCounterpart: boolean };
644
+ /** RFC-1546: ecosystem.manifest.generate outcome when commands.* seeds were
645
+ * written — invoked false means the kernel invoke port was unavailable. */
646
+ manifestRegen?: { invoked: boolean; ok: boolean; summary?: string };
644
647
  }
645
648
 
646
649
  export interface RfcNextIdResult {
@@ -19,6 +19,7 @@ sha — never from report commit ids. One call may apply dispatched → reported
19
19
  <item>RFC-1509: implement RFC-1509 — system task queue, dispatch briefs and task reports</item>
20
20
  <item>RFC-1509: close RFC-1509 review r1 findings — mark-failed escape, open-error refusal, dry-run coverage</item>
21
21
  <item>RFC-1509: address RFC-1509 review r2 — mark-failed without product, journal-read warning, status map diagnostics, V-49 deviations</item>
22
+ <item>RFC-1546: derive-and-repair recoverable state across flow surfaces (AC-1..AC-5)</item>
22
23
  </CHANGE_SUMMARY>
23
24
  */
24
25
 
@@ -290,11 +291,16 @@ export async function runSystemTaskCollect(
290
291
  },
291
292
  exitCode: errors > 0 ? 1 : 0,
292
293
  summary:
293
- task === null
294
- ? `system.task.collect refused (${errors} error(s))`
295
- : dryRun
296
- ? `system.task.collect would process ${task.id} (state ${task.state})`
297
- : `system.task.collect: ${task.id} is now ${task.state}${task.integratedCommit ? ` (integrated ${task.integratedCommit.slice(0, 9)})` : ""}`,
294
+ errors > 0
295
+ ? `system.task.collect refused — ${diagnostics
296
+ .filter((d) => d.severity === "error")
297
+ .map((d) => `${d.ruleId}: ${d.message}`)
298
+ .join("; ")}`
299
+ : task === null
300
+ ? "system.task.collect refused (0 error(s))"
301
+ : dryRun
302
+ ? `system.task.collect would process ${task.id} (state ${task.state})`
303
+ : `system.task.collect: ${task.id} is now ${task.state}${task.integratedCommit ? ` (integrated ${task.integratedCommit.slice(0, 9)})` : ""}`,
298
304
  nextSteps:
299
305
  task?.state === "reported"
300
306
  ? [{ action: "integrate the product branch, then re-run system.task.collect", kind: "optional" }]
@@ -10,6 +10,7 @@ reported→integrated, and --mark-failed.</purpose>
10
10
  <item>RFC-1509: implement RFC-1509 — system task queue, dispatch briefs and task reports</item>
11
11
  <item>RFC-1509: close RFC-1509 review r1 findings — mark-failed escape, open-error refusal, dry-run coverage</item>
12
12
  <item>RFC-1509: address RFC-1509 review r2 — mark-failed without product, journal-read warning, status map diagnostics, V-49 deviations</item>
13
+ <item>RFC-1546: derive-and-repair recoverable state across flow surfaces (AC-1..AC-5)</item>
13
14
  </CHANGE_SUMMARY>
14
15
  */
15
16
 
@@ -265,6 +266,21 @@ describe("system.task.collect", () => {
265
266
  expect(result.exitCode).toBe(1);
266
267
  expect(result.data?.diagnostics.some((d) => d.ruleId === "SYSTEM-TASK-02")).toBe(true);
267
268
  });
269
+
270
+ it("RFC-1546 AC-5: a refusal's text summary names the ruleId and message", async () => {
271
+ const productRoot = await makeProduct();
272
+ const systemRoot = await makeSystemRepo({
273
+ "system/system.yaml": VALID_SYSTEM_YAML,
274
+ "system/products.yaml": VALID_PRODUCTS_YAML,
275
+ "system/edges.yaml": VALID_EDGES_YAML,
276
+ "system/products.local.yaml": localMapFor({ alpha: productRoot }),
277
+ "queue/tasks/T-0001.yaml": taskYaml({ state: "ready" }),
278
+ });
279
+ const result = await runSystemTaskCollect(input({ task: "T-0001" }), makeContext(systemRoot));
280
+ expect(result.exitCode).toBe(1);
281
+ expect(result.summary).toContain("SYSTEM-TASK-02");
282
+ expect(result.summary).toContain("T-0001 is ready");
283
+ });
268
284
  });
269
285
 
270
286
  async function SystemCollect(systemRoot: string) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@warpgogol/forge",
3
- "version": "9.4.0",
3
+ "version": "9.5.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -176,10 +176,18 @@
176
176
  "types": "./os/queue/index.ts",
177
177
  "default": "./os/queue/index.ts"
178
178
  },
179
+ "./os/gate-run": {
180
+ "types": "./os/gate-run/index.ts",
181
+ "default": "./os/gate-run/index.ts"
182
+ },
179
183
  "./os/queue-module": {
180
184
  "types": "./os/queue/queue.module.ts",
181
185
  "default": "./os/queue/queue.module.ts"
182
186
  },
187
+ "./os/gate-run-module": {
188
+ "types": "./os/gate-run/gate-run.module.ts",
189
+ "default": "./os/gate-run/gate-run.module.ts"
190
+ },
183
191
  "./authority": {
184
192
  "types": "./src/authority/index.ts",
185
193
  "default": "./src/authority/index.ts"
@@ -498,10 +506,18 @@
498
506
  "types": "./dist/os/queue/index.d.ts",
499
507
  "default": "./dist/os/queue/index.js"
500
508
  },
509
+ "./os/gate-run": {
510
+ "types": "./dist/os/gate-run/index.d.ts",
511
+ "default": "./dist/os/gate-run/index.js"
512
+ },
501
513
  "./os/queue-module": {
502
514
  "types": "./dist/os/queue/queue.module.d.ts",
503
515
  "default": "./dist/os/queue/queue.module.js"
504
516
  },
517
+ "./os/gate-run-module": {
518
+ "types": "./dist/os/gate-run/gate-run.module.d.ts",
519
+ "default": "./dist/os/gate-run/gate-run.module.js"
520
+ },
505
521
  "./conformance": {
506
522
  "types": "./dist/src/conformance/index.d.ts",
507
523
  "default": "./dist/src/conformance/index.js"