@warpgogol/forge 9.6.1 → 9.6.2

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 (44) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +42 -18
  3. package/README.uk.md +60 -36
  4. package/dist/os/core/core.module.d.ts.map +1 -1
  5. package/dist/os/core/core.module.js +58 -5
  6. package/dist/os/core/core.module.js.map +1 -1
  7. package/dist/os/core/handlers/package-health.d.ts.map +1 -1
  8. package/dist/os/core/handlers/package-health.js +95 -8
  9. package/dist/os/core/handlers/package-health.js.map +1 -1
  10. package/dist/os/flow/handlers/flow-cut.d.ts.map +1 -1
  11. package/dist/os/flow/handlers/flow-cut.js +27 -6
  12. package/dist/os/flow/handlers/flow-cut.js.map +1 -1
  13. package/dist/src/onboarding/scaffold-project.d.ts.map +1 -1
  14. package/dist/src/onboarding/scaffold-project.js +21 -2
  15. package/dist/src/onboarding/scaffold-project.js.map +1 -1
  16. package/dist/src/validators/skill-doc-sync.d.ts +76 -0
  17. package/dist/src/validators/skill-doc-sync.d.ts.map +1 -0
  18. package/dist/src/validators/skill-doc-sync.js +333 -0
  19. package/dist/src/validators/skill-doc-sync.js.map +1 -0
  20. package/docs/concepts/governance-model.md +9 -1
  21. package/docs/concepts/verification-model.md +31 -0
  22. package/docs/guides/existing-project.md +12 -0
  23. package/docs/guides/skills.md +27 -8
  24. package/docs/guides/upgrading.md +6 -2
  25. package/docs/guides/verification-and-evidence.md +45 -0
  26. package/docs/integrations/devin.md +49 -0
  27. package/docs/reference/cli.md +12 -1
  28. package/docs/reference/fleet-measurement.md +52 -0
  29. package/docs/reference/programmatic-api.md +62 -33
  30. package/os/core/core.module.ts +70 -11
  31. package/os/core/handlers/package-health.test.ts +104 -23
  32. package/os/core/handlers/package-health.ts +133 -19
  33. package/os/flow/handlers/flow-cut.ts +27 -6
  34. package/os/flow/tests/flow-cut.rerun.test.ts +54 -4
  35. package/package.json +1 -1
  36. package/profiles/forge-shell.yaml +1 -0
  37. package/profiles/godot-game.yaml +1 -0
  38. package/profiles/phaser-game.yaml +1 -0
  39. package/profiles/site-workshop.yaml +1 -0
  40. package/profiles/system.yaml +1 -0
  41. package/profiles/typescript.yaml +1 -0
  42. package/src/onboarding/scaffold-project.ts +19 -2
  43. package/src/tests/skill-doc-sync.test.ts +233 -0
  44. package/src/validators/skill-doc-sync.ts +449 -0
@@ -15,13 +15,26 @@
15
15
  <item>Module attribution is provider-aware: deriveModulePackageMap returns separate workshop/site maps because module names collide across buckets (deploy is engine() AND sitePlugin()), and each command resolves through the map matching its manifest siteScope — a flat last-write-wins map silently misattributed the engine deploy.* family to the private site package (RFC-1518 r2, deviation D-004).</item>
16
16
  </KEY_DECISIONS>
17
17
  <CHANGE_SUMMARY>
18
- <item>RFC-1518: attribution merge, private-package docs gate, suppression journal</item>
19
18
  <item>RFC-1518: key decision for private-package docs-gate scope</item>
20
19
  <item>RFC-1518: provider-aware module attribution, per-rule markers, tld-tail scoping</item>
21
20
  <item>RFC-1518: key decision for provider-aware attribution</item>
22
21
  <item>ADR-0131: pkg-health-10 suppression on the line above the literal
23
22
 
24
23
  literalEscapesInLine accepts a // pkg-health-10: comment directly above the literal (one-line reach); the publish at-ref scan fetches that line via git show only for candidate lines; bin/cli.ts drops its prettier-ignore lines.</item>
24
+ <item>RFC-1585: review wave — write-path corruptions, --check flag, scaffold hydration
25
+
26
+ Independent fo-review (isolation: subagent) found: empty marker pairs lost
27
+ their open tag on --write, multi-line regions collapsed line numbers, a
28
+ leading fence injected a phantom line, --check was undocumented-undeclared,
29
+ and --write exited 1 on a successful heal. Fixes: open-marker capture,
30
+ newline-preserving placeholder, empty-chunk skip, check flag, healedRegions
31
+ split (write always exits 0), dryRun/io threading, byte-exact inventory
32
+ compare on the prettier-stable canonical form, CHECK-13 delegated through
33
+ commandRegistry/invoke so the registry-integrity scan stays within its
34
+ slice cap (KNOWN_TRUNCATED_SCANS is shrink-only), record-tree exclusions
35
+ extended, two real stale claims corrected, profile templates ship empty
36
+ markers hydrated at scaffold write time. RFC amended to implemented
37
+ grammar/result/exclusions; command moved to commands.added.</item>
25
38
  <history>PKG-HEALTH-05, RFC-1097, RFC-1254, RFC-1255, RFC-1517, RFC-1518</history>
26
39
  </CHANGE_SUMMARY>
27
40
  */
@@ -29,6 +42,7 @@ literalEscapesInLine accepts a // pkg-health-10: comment directly above the lite
29
42
  import * as fs from "../../../src/utils/sync-fs.ts";
30
43
  import path from "node:path";
31
44
  import { parse as parseYaml } from "yaml";
45
+ import type { SkillDocDrift } from "../../../src/validators/skill-doc-sync.ts";
32
46
  import type {
33
47
  ForgeCommandInput,
34
48
  ForgeCommandResult,
@@ -92,7 +106,14 @@ export interface HealthScanConfig {
92
106
  }
93
107
 
94
108
  const DEFAULT_KEY_SEGMENTS = [".input/signing-key", ".input/batches"];
95
- const BASE_IGNORE_DIRS = new Set(["node_modules", ".turbo", "dist", ".env", ".DS_Store", "Thumbs.db"]);
109
+ const BASE_IGNORE_DIRS = new Set([
110
+ "node_modules",
111
+ ".turbo",
112
+ "dist",
113
+ ".env",
114
+ ".DS_Store",
115
+ "Thumbs.db",
116
+ ]);
96
117
  const IGNORE_FILES = new Set([
97
118
  ".env",
98
119
  ".env.local",
@@ -348,7 +369,13 @@ export function scanDocsSurface(
348
369
  // (warpgogol.com) or TLD-shaped property paths (context.io); a 3+
349
370
  // segment token under a registered namespace (deploy.smoke.run after
350
371
  // removal) stays a dead-reference candidate — never TLD-exempt.
351
- .filter((t) => !registeredCommands || registeredCommands.has(t) || t.split(".").length > 2 || !DOC_TLD_TAIL_RE.test(t));
372
+ .filter(
373
+ (t) =>
374
+ !registeredCommands ||
375
+ registeredCommands.has(t) ||
376
+ t.split(".").length > 2 ||
377
+ !DOC_TLD_TAIL_RE.test(t),
378
+ );
352
379
  const s11 = line.match(DOC_SUPPRESS_11_RE);
353
380
  const s12 = line.match(DOC_SUPPRESS_12_RE);
354
381
  // A marker with an empty reason does not suppress — an exemption needs
@@ -359,14 +386,26 @@ export function scanDocsSurface(
359
386
  const m12 = s12 ? reason(s12) || null : null;
360
387
  for (const token of tokens) {
361
388
  if (m11) {
362
- const entry = { ruleId: "PKG-HEALTH-11" as const, file: rel, line: i + 1, token, reason: m11 };
389
+ const entry = {
390
+ ruleId: "PKG-HEALTH-11" as const,
391
+ file: rel,
392
+ line: i + 1,
393
+ token,
394
+ reason: m11,
395
+ };
363
396
  suppressed11.set(token, entry);
364
397
  suppressions.push(entry);
365
398
  } else {
366
399
  documented.add(token);
367
400
  }
368
401
  if (m12) {
369
- suppressions.push({ ruleId: "PKG-HEALTH-12", file: rel, line: i + 1, token, reason: m12 });
402
+ suppressions.push({
403
+ ruleId: "PKG-HEALTH-12",
404
+ file: rel,
405
+ line: i + 1,
406
+ token,
407
+ reason: m12,
408
+ });
370
409
  documented.add(token);
371
410
  } else if (!refs.has(token)) {
372
411
  refs.set(token, { file: rel, line: i + 1 });
@@ -386,13 +425,27 @@ export function scanDocsSurface(
386
425
  * buckets (deploy is both engine() and sitePlugin()) and commands attribute
387
426
  * through the map matching their siteScope.
388
427
  */
389
- export function deriveModulePackageMap(workspaceRoot: string): { workshop: Map<string, string>; site: Map<string, string> } {
428
+ export function deriveModulePackageMap(workspaceRoot: string): {
429
+ workshop: Map<string, string>;
430
+ site: Map<string, string>;
431
+ } {
390
432
  const out = new Map<string, string>();
391
433
  const site = new Map<string, string>();
392
- const mmPath = path.join(workspaceRoot, "packages", "werkstatt-engine", "src", "kernel", "module-map.ts");
434
+ const mmPath = path.join(
435
+ workspaceRoot,
436
+ "packages",
437
+ "werkstatt-engine",
438
+ "src",
439
+ "kernel",
440
+ "module-map.ts",
441
+ );
393
442
  try {
394
443
  const mm = fs.readFileSync(mmPath, "utf8");
395
- const bucketToConst: Record<string, string> = { engine: "ENGINE", sitePlugin: "SITE", forge: "FORGE" };
444
+ const bucketToConst: Record<string, string> = {
445
+ engine: "ENGINE",
446
+ sitePlugin: "SITE",
447
+ forge: "FORGE",
448
+ };
396
449
  const constToSpec: Record<string, string> = {};
397
450
  for (const m of mm.matchAll(/const (\w+) = "(@warpgogol\/[^"]+)"/g)) constToSpec[m[1]!] = m[2]!;
398
451
  for (const m of mm.matchAll(/["']?([\w-]+)["']?:\s*(engine|sitePlugin|forge)\(/g)) {
@@ -407,7 +460,9 @@ export function deriveModulePackageMap(workspaceRoot: string): { workshop: Map<s
407
460
  const kcPath = path.join(workspaceRoot, "tools", "kernel.config.ts");
408
461
  try {
409
462
  const kc = fs.readFileSync(kcPath, "utf8");
410
- for (const m of kc.matchAll(/["']?(\w[\w-]*)["']?:\s*async[^=]*=>[^;]*?import\("(@warpgogol\/[^"]+)"/g)) {
463
+ for (const m of kc.matchAll(
464
+ /["']?(\w[\w-]*)["']?:\s*async[^=]*=>[^;]*?import\("(@warpgogol\/[^"]+)"/g,
465
+ )) {
411
466
  out.set(m[1]!, `packages/${m[2]!.split("/")[1]}`);
412
467
  }
413
468
  } catch {
@@ -426,14 +481,21 @@ export function deriveModulePackageMap(workspaceRoot: string): { workshop: Map<s
426
481
  */
427
482
  export function loadCommandInventory(
428
483
  workspaceRoot: string,
429
- commandRegistry?: { listCommands(): Array<{ name: string; module?: string; siteScope?: boolean }> },
484
+ commandRegistry?: {
485
+ listCommands(): Array<{ name: string; module?: string; siteScope?: boolean }>;
486
+ },
430
487
  ): Array<{ name: string; module?: string; siteScope?: boolean }> {
431
488
  const byName = new Map<string, { name: string; module?: string; siteScope?: boolean }>();
432
489
  const manifestPath = path.join(workspaceRoot, "docs", "command-manifest.generated.yaml");
433
490
  try {
434
491
  const raw = fs.readFileSync(manifestPath, "utf8");
435
492
  const parsed = parseYaml(raw) as {
436
- commands?: Array<{ name?: unknown; module?: unknown; siteScope?: unknown; providers?: unknown }>;
493
+ commands?: Array<{
494
+ name?: unknown;
495
+ module?: unknown;
496
+ siteScope?: unknown;
497
+ providers?: unknown;
498
+ }>;
437
499
  } | null;
438
500
  for (const c of parsed?.commands ?? []) {
439
501
  if (typeof c.name === "string" && c.name.length > 0) {
@@ -492,10 +554,7 @@ export function isShippedEntry(
492
554
  * repo-extract's `cp` filter; a realpath-set bounds link cycles. Never a
493
555
  * hand-maintained file list.
494
556
  */
495
- export function deriveShippedFiles(
496
- projectRoot: string,
497
- extractConfigRaw: string | null,
498
- ): string[] {
557
+ export function deriveShippedFiles(projectRoot: string, extractConfigRaw: string | null): string[] {
499
558
  const cfg = parseHealthScanConfig(extractConfigRaw);
500
559
  const root = path.resolve(projectRoot);
501
560
  const shipped: string[] = [];
@@ -766,7 +825,9 @@ export async function runPackageHealth(
766
825
  (pkgCommands.get(pkg) ?? pkgCommands.set(pkg, []).get(pkg)!).push(c.name);
767
826
  }
768
827
 
769
- const entries = fs.readdirSync(packagesDir, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name));
828
+ const entries = fs
829
+ .readdirSync(packagesDir, { withFileTypes: true })
830
+ .sort((a, b) => a.name.localeCompare(b.name));
770
831
  for (const entry of entries) {
771
832
  if (!entry.isDirectory()) continue;
772
833
  if (entry.name.startsWith(".")) continue;
@@ -822,6 +883,54 @@ export async function runPackageHealth(
822
883
  }
823
884
  }
824
885
 
886
+ // RFC-1585 CHECK 13 — skill-count claims and <!-- forge:skills-* -->
887
+ // marked regions drifted from FORGE_SKILLS. Runs outside the command-
888
+ // inventory gate: the lint needs no command list. Delegated through the
889
+ // registry (standalone CLI) or the invoke port (kernel host — `werkstatt
890
+ // run` injects no commandRegistry) so the child is judged by its own
891
+ // declaration; an in-handler descent into the doc-sync subtree truncates
892
+ // the registry-integrity scan.
893
+ {
894
+ const docSyncCmd = context.commandRegistry?.getCommand("forge.skill.doc-sync");
895
+ let docSync: { drift?: SkillDocDrift[] } | undefined;
896
+ if (docSyncCmd) {
897
+ const r = await docSyncCmd.execute(
898
+ { argv: [], flags: { check: true, root: pkgDir } },
899
+ context,
900
+ );
901
+ docSync = r?.data as { drift?: SkillDocDrift[] } | undefined;
902
+ } else if (context.invoke) {
903
+ const r = await context.invoke("forge.skill.doc-sync", {
904
+ check: true,
905
+ root: pkgDir,
906
+ });
907
+ docSync = r.data as { drift?: SkillDocDrift[] } | undefined;
908
+ } else {
909
+ violations.push({
910
+ ruleId: "PKG-HEALTH-13",
911
+ packageName,
912
+ severity: "warning",
913
+ message: "skill doc-sync check skipped — no commandRegistry or invoke port in this host",
914
+ file: pkgDir,
915
+ fixHint:
916
+ "Run `forge skill.doc-sync --check` directly, or dispatch through a host that exposes the command.",
917
+ });
918
+ }
919
+ for (const d of docSync?.drift ?? []) {
920
+ violations.push({
921
+ ruleId: "PKG-HEALTH-13",
922
+ packageName,
923
+ severity: "error",
924
+ message: `${d.file}:${d.line} ${d.kind} — found "${d.found}", registry renders "${d.expected}"`,
925
+ file: path.join(pkgDir, d.file),
926
+ fixHint:
927
+ d.kind === "marked-region"
928
+ ? `Run "forge skill.doc-sync --write" to re-render the marked region.`
929
+ : `Fix the literal to the registry count, or journal a same-line "<!-- forge-skill-count:ok: <reason> -->" exemption.`,
930
+ });
931
+ }
932
+ }
933
+
825
934
  if (isPrivate) continue;
826
935
 
827
936
  packagesChecked++;
@@ -1044,7 +1153,10 @@ export async function runPackageHealth(
1044
1153
  }
1045
1154
 
1046
1155
  suppressions.sort(
1047
- (a, b) => (a.packageName ?? "").localeCompare(b.packageName ?? "") || a.file.localeCompare(b.file) || a.line - b.line,
1156
+ (a, b) =>
1157
+ (a.packageName ?? "").localeCompare(b.packageName ?? "") ||
1158
+ a.file.localeCompare(b.file) ||
1159
+ a.line - b.line,
1048
1160
  );
1049
1161
  if (packagesChecked > 0 && commandInfos.length === 0) {
1050
1162
  violations.push({
@@ -1054,7 +1166,8 @@ export async function runPackageHealth(
1054
1166
  message:
1055
1167
  "no command inventory available — docs-drift gate skipped (context.commandRegistry unset and docs/command-manifest.generated.yaml absent or unparsable)",
1056
1168
  file: workspaceRoot,
1057
- fixHint: "Run `werkstatt run command.manifest.generate`, or dispatch through a host that injects commandRegistry.",
1169
+ fixHint:
1170
+ "Run `werkstatt run command.manifest.generate`, or dispatch through a host that injects commandRegistry.",
1058
1171
  });
1059
1172
  } else if (packagesChecked > 0 && commandInfos.length > 0 && attributed === 0) {
1060
1173
  // Inventory exists but no command resolved to a package — module→package
@@ -1066,7 +1179,8 @@ export async function runPackageHealth(
1066
1179
  severity: "warning",
1067
1180
  message: `${commandInfos.length} inventoried command(s) resolved to no package — module attribution unavailable, PKG-HEALTH-11 coverage skipped`,
1068
1181
  file: workspaceRoot,
1069
- fixHint: "Check that packages/werkstatt-engine/src/kernel/module-map.ts or tools/kernel.config.ts declares the command modules.",
1182
+ fixHint:
1183
+ "Check that packages/werkstatt-engine/src/kernel/module-map.ts or tools/kernel.config.ts declares the command modules.",
1070
1184
  });
1071
1185
  }
1072
1186
 
@@ -20,11 +20,20 @@ released with no mutation.</purpose>
20
20
  <item>RFC-1502: `git add -u` folds the release-prepare hook's tracked edits in; its untracked leftovers are listed as FLOW-CUT-14 then removed via io.rm (the integrate gate demands a clean tree, and `git clean -f` is blocked in agent sessions). Pre-tag verification extracts every named line at the release commit — a failure deletes worktree+branch before any ref or tag moves (FLOW-CUT-13).</item>
21
21
  </KEY_DECISIONS>
22
22
  <CHANGE_SUMMARY>
23
- <item>RFC-1502: review r1 — fix-cut rollback on FLOW-CUT-12/13, populated steps[], hook validation, GIT_* env scrub</item>
24
23
  <item>RFC-1515: harden forge flow worktree lifecycle against vanished paths, forge-local state, dead-holder locks and generated drift</item>
25
24
  <item>RFC-1515: close rfc-1515 review findings — delete tolerated paths before worktree remove, prune vanished registrations, verified branch -D, shared held-lock render, gated e2e throw, journal toleratedState, edge tests</item>
26
25
  <item>RFC-1528: close review findings — manifest-union command inventory for regen/preflight</item>
27
26
  <item>RFC-1546: derive-and-repair recoverable state across flow surfaces (AC-1..AC-5)</item>
27
+ <item>RFC-1546: flow.cut resume keys on nearest chore(release): subject, not tip only (F-0269)
28
+
29
+ A concurrent session landing on develop between a cut's own integrate and
30
+ its tail buried the release commit — every re-run fell through to the
31
+ fresh-cut path and refused FLOW-CUT-01 on already-bumped version files
32
+ (the documented recovery could never fire). planOrdinaryCut now back-walks
33
+ git log (-20) to the nearest chore(release): declaration; resume fires only
34
+ for an incomplete release (missing tags) or a tip-resident one — a buried
35
+ completed release never re-runs its main CAS. Regression tests cover the
36
+ buried-pending and buried-completed cases.</item>
28
37
  <history>RFC-1490, RFC-1491, RFC-1494, RFC-1502</history>
29
38
  </CHANGE_SUMMARY>
30
39
  */
@@ -271,9 +280,17 @@ async function planOrdinaryCut(
271
280
  // still runs but the tail completes exactly the subject's tags (and tags
272
281
  // the subject names cannot block as FLOW-CUT-06).
273
282
  const tipSubject = (await git(repoRoot, io, ["log", "-1", "--format=%s", ref])).stdout.trim();
283
+ // The tip may sit past the release commit: a concurrent session can land
284
+ // on develop between this cut's own integrate and its tail — the release
285
+ // declaration is still the nearest `chore(release):` subject behind tip.
286
+ const recentSubjects = (await git(repoRoot, io, ["log", "-20", "--format=%s", ref])).stdout
287
+ .split("\n")
288
+ .map((s) => s.trim());
289
+ const releaseIdx = recentSubjects.findIndex((s) => s.startsWith("chore(release): "));
290
+ const releaseSubject = releaseIdx >= 0 ? recentSubjects[releaseIdx]! : tipSubject;
274
291
  let resumeTags: string[] | null = null;
275
- if (tipSubject.startsWith("chore(release): ")) {
276
- const named = tipSubject
292
+ if (releaseSubject.startsWith("chore(release): ")) {
293
+ const named = releaseSubject
277
294
  .slice("chore(release): ".length)
278
295
  .split(",")
279
296
  .map((t) => t.trim())
@@ -297,14 +314,18 @@ async function planOrdinaryCut(
297
314
  const existence = await Promise.all(
298
315
  named.map(
299
316
  async (t) =>
300
- (await git(repoRoot, io, ["rev-parse", "--verify", "-q", `refs/tags/${t}`])).exitCode ===
301
- 0,
317
+ (await git(repoRoot, io, ["rev-parse", "--verify", "-q", `refs/tags/${t}`]))
318
+ .exitCode === 0,
302
319
  ),
303
320
  );
304
321
  if (named.length > 0 && existence.every((e) => e) && mainTip === ref) {
305
322
  return { kind: "completed", ref, tags: named, allLines: lines, mainTip };
306
323
  }
307
- if (named.length > 0) resumeTags = named;
324
+ // A buried release whose tags all exist already ran its tail — do not
325
+ // resume it to redo the main CAS. Only an incomplete release (missing
326
+ // tags) or the tip-resident one may resume.
327
+ const allNamedExist = named.length > 0 && existence.every((e) => e);
328
+ if (named.length > 0 && (releaseIdx === 0 || !allNamedExist)) resumeTags = named;
308
329
  }
309
330
  }
310
331
 
@@ -14,6 +14,16 @@ tagged tail completes exactly the named tags (fingerprints → main → tags).</
14
14
  <CHANGE_SUMMARY>
15
15
  <item>RFC-1490: step 4 — resume-path tests split out per the RFC file table</item>
16
16
  <item>RFC-1490: independent-review pass — lock-held planning, fix-branch verification, spec-shaped data, coverage</item>
17
+ <item>RFC-1546: flow.cut resume keys on nearest chore(release): subject, not tip only (F-0269)
18
+
19
+ A concurrent session landing on develop between a cut's own integrate and
20
+ its tail buried the release commit — every re-run fell through to the
21
+ fresh-cut path and refused FLOW-CUT-01 on already-bumped version files
22
+ (the documented recovery could never fire). planOrdinaryCut now back-walks
23
+ git log (-20) to the nearest chore(release): declaration; resume fires only
24
+ for an incomplete release (missing tags) or a tip-resident one — a buried
25
+ completed release never re-runs its main CAS. Regression tests cover the
26
+ buried-pending and buried-completed cases.</item>
17
27
  </CHANGE_SUMMARY>
18
28
  */
19
29
 
@@ -42,10 +52,7 @@ async function adoptedRepo(): Promise<string> {
42
52
  const repo = await initRepo({ prefix: "flow-cut-rerun-" });
43
53
  dirs.push(repo);
44
54
  await writeFile(join(repo, "forge.yaml"), 'schema: "forge/workspace@1"\n');
45
- await writeFile(
46
- join(repo, "package.json"),
47
- '{\n "name": "fixture",\n "version": "0.1.0"\n}\n',
48
- );
55
+ await writeFile(join(repo, "package.json"), '{\n "name": "fixture",\n "version": "0.1.0"\n}\n');
49
56
  await gitExec(repo, ["add", "-A"]);
50
57
  await gitExec(repo, ["commit", "-m", "config"]);
51
58
  await gitExec(repo, ["switch", "-c", "develop"]);
@@ -92,4 +99,47 @@ describe("flow.cut — rerun/resume (AC-5)", () => {
92
99
  expect(await sha(repo, "v0.1.1^{}")).toBe(await sha(repo, "develop"));
93
100
  expect(await sha(repo, "main")).toBe(await sha(repo, "develop"));
94
101
  }, 30_000);
102
+
103
+ it("resumes the tail when a later commit buried the release commit on develop", async () => {
104
+ const repo = await adoptedRepo();
105
+ const first = await runOrdinaryCut(repo, ambientIo, { lines: [], dryRun: false });
106
+ expect(first.released).toBe(true);
107
+ // Break the tail as a refused fingerprints step would have, then let an
108
+ // unrelated session land on develop past the release commit.
109
+ await gitExec(repo, ["tag", "-d", "v0.1.1"]);
110
+ await gitExec(repo, ["update-ref", "refs/heads/main", "v0.1.0"]);
111
+ await writeFile(join(repo, "housekeeping.txt"), "retro");
112
+ await gitExec(repo, ["add", "housekeeping.txt"]);
113
+ const bury = await gitExec(repo, ["commit", "-m", "chore: session-end housekeeping"], {
114
+ FORGE_FLOW_OP: "install",
115
+ });
116
+ if (bury.exitCode !== 0) throw new Error(`bury commit failed: ${bury.stderr}`);
117
+
118
+ const data = await runOrdinaryCut(repo, ambientIo, { lines: [], dryRun: false });
119
+
120
+ expect(data.diagnostics).toEqual([]);
121
+ expect(data.released).toBe(true);
122
+ expect(data.resumed).toBe(true);
123
+ expect(await sha(repo, "v0.1.1^{}")).toBe(await sha(repo, "develop"));
124
+ expect(await sha(repo, "main")).toBe(await sha(repo, "develop"));
125
+ }, 30_000);
126
+
127
+ it("does not resume a buried release whose tags already exist", async () => {
128
+ const repo = await adoptedRepo();
129
+ const first = await runOrdinaryCut(repo, ambientIo, { lines: [], dryRun: false });
130
+ expect(first.released).toBe(true);
131
+ // Fully landed release, then a later commit — the buried declaration
132
+ // must not trigger a resume (main lagging develop is unrelated state).
133
+ await writeFile(join(repo, "later.txt"), "later");
134
+ await gitExec(repo, ["add", "later.txt"]);
135
+ const bury = await gitExec(repo, ["commit", "-m", "docs: later work"], {
136
+ FORGE_FLOW_OP: "install",
137
+ });
138
+ if (bury.exitCode !== 0) throw new Error(`bury commit failed: ${bury.stderr}`);
139
+
140
+ const data = await runOrdinaryCut(repo, ambientIo, { lines: [], dryRun: false });
141
+
142
+ // Falls through to the fresh-cut path — the prior release is complete.
143
+ expect(data.resumed).toBe(false);
144
+ }, 30_000);
95
145
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@warpgogol/forge",
3
- "version": "9.6.1",
3
+ "version": "9.6.2",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -599,6 +599,7 @@ workspace:
599
599
 
600
600
  - Engine: @warpgogol/forge
601
601
  - Stack profile: forge-shell
602
+ - Skills: <!-- forge:skills-count --><!-- /forge:skills-count --> (rendered by `forge skill.doc-sync`)
602
603
  - path: hooks/worktree-setup.sh
603
604
  content: |
604
605
  #!/bin/sh
@@ -1108,6 +1108,7 @@ workspace:
1108
1108
  - Engine: @warpgogol/werkstatt-engine
1109
1109
  - Plugin: @warpgogol/werkstatt-godot-game
1110
1110
  - Stack profile: godot-game
1111
+ - Skills: <!-- forge:skills-count --><!-- /forge:skills-count --> (rendered by `forge skill.doc-sync`)
1111
1112
  - path: hooks/worktree-setup.sh
1112
1113
  content: |
1113
1114
  #!/bin/sh
@@ -677,6 +677,7 @@ workspace:
677
677
  - Engine: @warpgogol/werkstatt-engine
678
678
  - Plugin: @warpgogol/werkstatt-phaser-game
679
679
  - Stack profile: phaser-game
680
+ - Skills: <!-- forge:skills-count --><!-- /forge:skills-count --> (rendered by `forge skill.doc-sync`)
680
681
  - path: hooks/worktree-setup.sh
681
682
  content: |
682
683
  #!/bin/sh
@@ -596,6 +596,7 @@ workspace:
596
596
  - Engine: @warpgogol/werkstatt-engine + @warpgogol/werkstatt-site
597
597
  - Governance: @warpgogol/forge
598
598
  - Stack profile: site-workshop
599
+ - Skills: <!-- forge:skills-count --><!-- /forge:skills-count --> (rendered by `forge skill.doc-sync`)
599
600
 
600
601
  ## Platform updates
601
602
 
@@ -627,6 +627,7 @@ workspace:
627
627
 
628
628
  - Engine: @warpgogol/forge
629
629
  - Stack profile: system
630
+ - Skills: <!-- forge:skills-count --><!-- /forge:skills-count --> (rendered by `forge skill.doc-sync`)
630
631
  - path: hooks/worktree-setup.sh
631
632
  content: |
632
633
  #!/bin/sh
@@ -540,6 +540,7 @@ workspace:
540
540
  - Engine: @warpgogol/forge
541
541
  - Plugin: @warpgogol/werkstatt-typescript
542
542
  - Stack profile: typescript
543
+ - Skills: <!-- forge:skills-count --><!-- /forge:skills-count --> (rendered by `forge skill.doc-sync`)
543
544
  - path: docs/correctness.yaml
544
545
  content: |
545
546
  # Product correctness manifest (RFC-1578, forge/correctness-manifest@1).
@@ -15,6 +15,20 @@ Mechanical v1 to v2 header migration across the workspace: 942 files rewritten
15
15
  <item>RFC-1097: sweep — werkstatt-engine clean
16
16
 
17
17
  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
+ <item>RFC-1585: review wave — write-path corruptions, --check flag, scaffold hydration
19
+
20
+ Independent fo-review (isolation: subagent) found: empty marker pairs lost
21
+ their open tag on --write, multi-line regions collapsed line numbers, a
22
+ leading fence injected a phantom line, --check was undocumented-undeclared,
23
+ and --write exited 1 on a successful heal. Fixes: open-marker capture,
24
+ newline-preserving placeholder, empty-chunk skip, check flag, healedRegions
25
+ split (write always exits 0), dryRun/io threading, byte-exact inventory
26
+ compare on the prettier-stable canonical form, CHECK-13 delegated through
27
+ commandRegistry/invoke so the registry-integrity scan stays within its
28
+ slice cap (KNOWN_TRUNCATED_SCANS is shrink-only), record-tree exclusions
29
+ extended, two real stale claims corrected, profile templates ship empty
30
+ markers hydrated at scaffold write time. RFC amended to implemented
31
+ grammar/result/exclusions; command moved to commands.added.</item>
18
32
  </CHANGE_SUMMARY>
19
33
  */
20
34
 
@@ -23,6 +37,7 @@ import { resolveIo } from "../utils/io.ts";
23
37
  import { listStackProfiles, type StackProfile } from "../profiles/stack-profile.ts";
24
38
  import { checkNpmToken, workshopNeedsWarpgogolToken } from "./npm-token-check.ts";
25
39
  import { resolveForgeRoot } from "../config/forge-config.ts";
40
+ import { hydrateSkillDocMarkers } from "../validators/skill-doc-sync.ts";
26
41
  import type {
27
42
  ForgeCommandInput,
28
43
  ForgeCommandResult,
@@ -117,7 +132,8 @@ export async function runScaffoldProject(
117
132
  for (const file of profile.workspace.files) {
118
133
  const filePath = path.join(workspaceRoot, file.path);
119
134
  await fio.mkdir(path.dirname(filePath));
120
- const content = file.content.replace(/__PROJECT_NAME__/g, effectiveProjectName);
135
+ let content = file.content.replace(/__PROJECT_NAME__/g, effectiveProjectName);
136
+ if (file.path.endsWith(".md")) content = hydrateSkillDocMarkers(content);
121
137
  await fio.writeFile(filePath, content);
122
138
  created.push(file.path);
123
139
  }
@@ -170,9 +186,10 @@ export async function runScaffoldProject(
170
186
  const filePath = path.join(wsDir, file.path);
171
187
  await fio.mkdir(path.dirname(filePath));
172
188
  // Replace placeholder names (quoted and bare)
173
- const content = file.content
189
+ let content = file.content
174
190
  .replace(/my-site/g, effectiveProjectName)
175
191
  .replace(/my-game/g, effectiveProjectName);
192
+ if (file.path.endsWith(".md")) content = hydrateSkillDocMarkers(content);
176
193
  await fio.writeFile(filePath, content);
177
194
  created.push(`${wsPath}/${file.path}`);
178
195
  }