@warpgogol/forge 9.7.1 → 10.0.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 (158) hide show
  1. package/AGENTS.md +50 -27
  2. package/CHANGELOG.md +27 -0
  3. package/bin/cli.js +0 -0
  4. package/dist/os/codebase/handlers/codebase-measure-symbols.d.ts.map +1 -1
  5. package/dist/os/codebase/handlers/codebase-measure-symbols.js +35 -4
  6. package/dist/os/codebase/handlers/codebase-measure-symbols.js.map +1 -1
  7. package/dist/os/core/core.module.d.ts.map +1 -1
  8. package/dist/os/core/core.module.js +1 -69
  9. package/dist/os/core/core.module.js.map +1 -1
  10. package/dist/os/core/handlers/assets-helpers.d.ts.map +1 -1
  11. package/dist/os/core/handlers/assets-helpers.js +2 -3
  12. package/dist/os/core/handlers/assets-helpers.js.map +1 -1
  13. package/dist/os/core/handlers/determinism-check.d.ts.map +1 -1
  14. package/dist/os/core/handlers/determinism-check.js +2 -3
  15. package/dist/os/core/handlers/determinism-check.js.map +1 -1
  16. package/dist/os/core/handlers/release-prepare.d.ts.map +1 -1
  17. package/dist/os/core/handlers/release-prepare.js +2 -4
  18. package/dist/os/core/handlers/release-prepare.js.map +1 -1
  19. package/dist/os/flow/handlers/flow-peers.js +1 -1
  20. package/dist/os/flow/handlers/flow-peers.js.map +1 -1
  21. package/dist/os/{mission → flow}/open-missions.d.ts +1 -2
  22. package/dist/os/flow/open-missions.d.ts.map +1 -0
  23. package/dist/os/flow/open-missions.js +37 -0
  24. package/dist/os/flow/open-missions.js.map +1 -0
  25. package/dist/os/flow/preflight.js +1 -1
  26. package/dist/os/flow/preflight.js.map +1 -1
  27. package/dist/src/command-modules.d.ts.map +1 -1
  28. package/dist/src/command-modules.js +0 -2
  29. package/dist/src/command-modules.js.map +1 -1
  30. package/dist/src/index.d.ts +0 -2
  31. package/dist/src/index.d.ts.map +1 -1
  32. package/dist/src/index.js +0 -2
  33. package/dist/src/index.js.map +1 -1
  34. package/dist/src/onboarding/doctor.d.ts +0 -5
  35. package/dist/src/onboarding/doctor.d.ts.map +1 -1
  36. package/dist/src/onboarding/doctor.js +6 -79
  37. package/dist/src/onboarding/doctor.js.map +1 -1
  38. package/dist/src/onboarding/npm-token-check.d.ts +1 -1
  39. package/dist/src/onboarding/npm-token-check.d.ts.map +1 -1
  40. package/dist/src/onboarding/npm-token-check.js +2 -2
  41. package/dist/src/onboarding/npm-token-check.js.map +1 -1
  42. package/dist/src/utils/hash.d.ts +1 -0
  43. package/dist/src/utils/hash.d.ts.map +1 -1
  44. package/dist/src/utils/hash.js +4 -0
  45. package/dist/src/utils/hash.js.map +1 -1
  46. package/dist/{os/mission → src/utils}/lockfile.d.ts +1 -18
  47. package/dist/src/utils/lockfile.d.ts.map +1 -0
  48. package/dist/src/utils/lockfile.js +70 -0
  49. package/dist/src/utils/lockfile.js.map +1 -0
  50. package/os/codebase/handlers/codebase-measure-symbols.ts +32 -4
  51. package/os/core/core.module.ts +3 -76
  52. package/os/core/handlers/assets-helpers.ts +2 -4
  53. package/os/core/handlers/determinism-check.ts +2 -3
  54. package/os/core/handlers/lifecycle-handlers.test.ts +529 -0
  55. package/os/core/handlers/release-prepare.ts +2 -4
  56. package/os/correctness/gate/trust-boundary-cx18.test.ts +1 -1
  57. package/os/flow/handlers/flow-peers.ts +1 -1
  58. package/os/flow/open-missions.ts +45 -0
  59. package/os/flow/preflight.ts +1 -1
  60. package/os/flow/tests/release-lines.test.ts +136 -0
  61. package/os/flow/tests/state-roots.test.ts +1 -48
  62. package/os/rfc/handlers/validate-corpus.test.ts +149 -0
  63. package/os/rfc/probe-batch.test.ts +253 -0
  64. package/os/rfc/verifier/rfc-1391/ac10-operating-model-policy.acceptance.test.ts +63 -0
  65. package/package.json +161 -506
  66. package/src/command-modules.ts +0 -2
  67. package/src/index.ts +0 -2
  68. package/src/onboarding/doctor.ts +9 -96
  69. package/src/onboarding/npm-token-check.ts +3 -3
  70. package/src/tests/pkg-health-self-scan.test.ts +29 -0
  71. package/src/tests/rfc-evidence-sync.test.ts +369 -0
  72. package/src/tests/skill-agents-sync.test.ts +192 -0
  73. package/src/utils/hash.ts +5 -0
  74. package/src/utils/lockfile.ts +78 -0
  75. package/dist/os/core/handlers/forge-autonomy-validate.d.ts +0 -25
  76. package/dist/os/core/handlers/forge-autonomy-validate.d.ts.map +0 -1
  77. package/dist/os/core/handlers/forge-autonomy-validate.js +0 -208
  78. package/dist/os/core/handlers/forge-autonomy-validate.js.map +0 -1
  79. package/dist/os/mission/handlers/archive.d.ts +0 -4
  80. package/dist/os/mission/handlers/archive.d.ts.map +0 -1
  81. package/dist/os/mission/handlers/archive.js +0 -583
  82. package/dist/os/mission/handlers/archive.js.map +0 -1
  83. package/dist/os/mission/importer-block.d.ts +0 -19
  84. package/dist/os/mission/importer-block.d.ts.map +0 -1
  85. package/dist/os/mission/importer-block.js +0 -124
  86. package/dist/os/mission/importer-block.js.map +0 -1
  87. package/dist/os/mission/index.d.ts +0 -2
  88. package/dist/os/mission/index.d.ts.map +0 -1
  89. package/dist/os/mission/index.js +0 -15
  90. package/dist/os/mission/index.js.map +0 -1
  91. package/dist/os/mission/lockfile.d.ts.map +0 -1
  92. package/dist/os/mission/lockfile.js +0 -138
  93. package/dist/os/mission/lockfile.js.map +0 -1
  94. package/dist/os/mission/mission.module.d.ts +0 -3
  95. package/dist/os/mission/mission.module.d.ts.map +0 -1
  96. package/dist/os/mission/mission.module.js +0 -63
  97. package/dist/os/mission/mission.module.js.map +0 -1
  98. package/dist/os/mission/open-missions.d.ts.map +0 -1
  99. package/dist/os/mission/open-missions.js +0 -42
  100. package/dist/os/mission/open-missions.js.map +0 -1
  101. package/dist/os/mission/types.d.ts +0 -23
  102. package/dist/os/mission/types.d.ts.map +0 -1
  103. package/dist/os/mission/types.js +0 -19
  104. package/dist/os/mission/types.js.map +0 -1
  105. package/dist/os/werkstatt/handlers/lock.d.ts +0 -10
  106. package/dist/os/werkstatt/handlers/lock.d.ts.map +0 -1
  107. package/dist/os/werkstatt/handlers/lock.js +0 -153
  108. package/dist/os/werkstatt/handlers/lock.js.map +0 -1
  109. package/dist/os/werkstatt/handlers/schema.d.ts +0 -33
  110. package/dist/os/werkstatt/handlers/schema.d.ts.map +0 -1
  111. package/dist/os/werkstatt/handlers/schema.js +0 -42
  112. package/dist/os/werkstatt/handlers/schema.js.map +0 -1
  113. package/dist/os/werkstatt/handlers/werkstatt-lock-recover.d.ts +0 -15
  114. package/dist/os/werkstatt/handlers/werkstatt-lock-recover.d.ts.map +0 -1
  115. package/dist/os/werkstatt/handlers/werkstatt-lock-recover.js +0 -171
  116. package/dist/os/werkstatt/handlers/werkstatt-lock-recover.js.map +0 -1
  117. package/dist/os/werkstatt/handlers/werkstatt-lock-status.d.ts +0 -18
  118. package/dist/os/werkstatt/handlers/werkstatt-lock-status.d.ts.map +0 -1
  119. package/dist/os/werkstatt/handlers/werkstatt-lock-status.js +0 -51
  120. package/dist/os/werkstatt/handlers/werkstatt-lock-status.js.map +0 -1
  121. package/dist/os/werkstatt/handlers/werkstatt-operation-validate.d.ts +0 -11
  122. package/dist/os/werkstatt/handlers/werkstatt-operation-validate.d.ts.map +0 -1
  123. package/dist/os/werkstatt/handlers/werkstatt-operation-validate.js +0 -86
  124. package/dist/os/werkstatt/handlers/werkstatt-operation-validate.js.map +0 -1
  125. package/dist/os/werkstatt/handlers/workspace-deps.d.ts +0 -12
  126. package/dist/os/werkstatt/handlers/workspace-deps.d.ts.map +0 -1
  127. package/dist/os/werkstatt/handlers/workspace-deps.js +0 -42
  128. package/dist/os/werkstatt/handlers/workspace-deps.js.map +0 -1
  129. package/dist/os/werkstatt/index.d.ts +0 -7
  130. package/dist/os/werkstatt/index.d.ts.map +0 -1
  131. package/dist/os/werkstatt/index.js +0 -18
  132. package/dist/os/werkstatt/index.js.map +0 -1
  133. package/dist/os/werkstatt/werkstatt.module.d.ts +0 -3
  134. package/dist/os/werkstatt/werkstatt.module.d.ts.map +0 -1
  135. package/dist/os/werkstatt/werkstatt.module.js +0 -91
  136. package/dist/os/werkstatt/werkstatt.module.js.map +0 -1
  137. package/os/core/handlers/forge-autonomy-validate.ts +0 -276
  138. package/os/correctness/gate/trust-boundary-cx19.test.ts +0 -514
  139. package/os/mission/handlers/archive.test.ts +0 -764
  140. package/os/mission/handlers/archive.ts +0 -711
  141. package/os/mission/handlers/ship-inflight-degraded.test.ts +0 -105
  142. package/os/mission/importer-block.ts +0 -119
  143. package/os/mission/index.ts +0 -15
  144. package/os/mission/lockfile.ts +0 -152
  145. package/os/mission/mission.module.ts +0 -68
  146. package/os/mission/open-missions.ts +0 -50
  147. package/os/mission/types.ts +0 -42
  148. package/os/werkstatt/handlers/lock.ts +0 -168
  149. package/os/werkstatt/handlers/schema.ts +0 -47
  150. package/os/werkstatt/handlers/werkstatt-lock-recover.ts +0 -206
  151. package/os/werkstatt/handlers/werkstatt-lock-status.ts +0 -82
  152. package/os/werkstatt/handlers/werkstatt-operation-validate.ts +0 -112
  153. package/os/werkstatt/handlers/workspace-deps.ts +0 -56
  154. package/os/werkstatt/index.ts +0 -39
  155. package/os/werkstatt/werkstatt.module.ts +0 -95
  156. package/src/tests/doctor-autonomy.test.ts +0 -246
  157. package/src/tests/forge-autonomy-validate.test.ts +0 -159
  158. package/src/tests/werkstatt-lock.test.ts +0 -357
@@ -0,0 +1,70 @@
1
+ /*
2
+ <MODULE_CONTRACT>
3
+ <purpose>Generic tracked-lockfile hygiene — restore pnpm-lock.yaml to HEAD bytes through the judged git channel, plus a sync-world exec adapter. Absorbed from the v9 os/mission module during the v10 core transfer (Werkstatt RFC-1649); mission-specific importer pruning stayed studio-private and did not transfer.</purpose>
4
+ <non-goals>
5
+ <item>No mission/studio layout knowledge — this module is layout-generic.</item>
6
+ </non-goals>
7
+ </MODULE_CONTRACT>
8
+ */
9
+ import path from "node:path";
10
+ import { execFileSync } from "./sync-fs.js";
11
+ import { verifierGit } from "./verifier-git.js";
12
+ const LOCKFILE_NAME = "pnpm-lock.yaml";
13
+ /**
14
+ * Restore `pnpm-lock.yaml` to the bytes committed at HEAD.
15
+ *
16
+ * Runs `git show HEAD:pnpm-lock.yaml` in `root`. On exit 0 the stdout is written
17
+ * back over `root/pnpm-lock.yaml` and the call returns `true`. On a non-zero
18
+ * exit (no such file at HEAD, not a git repository) it returns `false` and
19
+ * changes nothing. Spawn failures (missing git binary) propagate.
20
+ * `root` is the repository root — git resolves `HEAD:pnpm-lock.yaml` against
21
+ * the enclosing repo's top level, so passing a nested directory of a larger
22
+ * repo would restore that repo's root lockfile instead.
23
+ */
24
+ export async function restoreTrackedLockfile(root, io) {
25
+ // The committed-bytes read goes through the judged channel — the
26
+ // ambient exec layer inherits `process.env`, so a session `GIT_DIR`
27
+ // would serve `HEAD:` from a foreign object store and this "restore"
28
+ // would write forged bytes into the real worktree (CX-164). A refused
29
+ // read restores nothing and reports false.
30
+ const res = await verifierGit(root, ["show", `HEAD:${LOCKFILE_NAME}`]);
31
+ if (res.exitCode !== 0)
32
+ return false;
33
+ await io.writeFile(path.join(root, LOCKFILE_NAME), res.stdout);
34
+ return true;
35
+ }
36
+ /**
37
+ * Sync-world adapter for `io.exec` — wraps `execFileSync` so handlers that still
38
+ * run on `execSync`/`execFileSync` (e.g. mission.archive) can call
39
+ * `restoreTrackedLockfile` without duplicating its logic. A non-zero exit maps
40
+ * to `exitCode`; a spawn failure (missing binary) keeps throwing.
41
+ */
42
+ export function execFileSyncAdapter() {
43
+ return {
44
+ exec(command, args, opts) {
45
+ try {
46
+ const stdout = execFileSync(command, args, {
47
+ cwd: opts?.cwd,
48
+ encoding: "utf-8",
49
+ stdio: ["pipe", "pipe", "pipe"],
50
+ timeout: opts?.timeoutMs,
51
+ // Real pnpm-lock.yaml files exceed the 1 MiB default many times over —
52
+ // an ENOBUFS kill carries status null and would rethrow below.
53
+ maxBuffer: 64 * 1024 * 1024,
54
+ });
55
+ return Promise.resolve({ exitCode: 0, stdout, stderr: "" });
56
+ }
57
+ catch (err) {
58
+ const e = err;
59
+ if (e.status === undefined || e.status === null)
60
+ throw err;
61
+ return Promise.resolve({
62
+ exitCode: e.status,
63
+ stdout: e.stdout?.toString() ?? "",
64
+ stderr: e.stderr?.toString() ?? "",
65
+ });
66
+ }
67
+ },
68
+ };
69
+ }
70
+ //# sourceMappingURL=lockfile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lockfile.js","sourceRoot":"","sources":["../../../src/utils/lockfile.ts"],"names":[],"mappings":"AAAA;;;;;;;EAOE;AAEF,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,aAAa,GAAG,gBAAgB,CAAC;AAEvC;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC1C,IAAY,EACZ,EAA2C;IAE3C,iEAAiE;IACjE,oEAAoE;IACpE,qEAAqE;IACrE,sEAAsE;IACtE,2CAA2C;IAC3C,MAAM,GAAG,GAAG,MAAM,WAAW,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,QAAQ,aAAa,EAAE,CAAC,CAAC,CAAC;IACvE,IAAI,GAAG,CAAC,QAAQ,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IACrC,MAAM,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,aAAa,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC/D,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB;IACjC,OAAO;QACL,IAAI,CAAC,OAAe,EAAE,IAAc,EAAE,IAAkB;YACtD,IAAI,CAAC;gBACH,MAAM,MAAM,GAAG,YAAY,CAAC,OAAO,EAAE,IAAI,EAAE;oBACzC,GAAG,EAAE,IAAI,EAAE,GAAG;oBACd,QAAQ,EAAE,OAAO;oBACjB,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;oBAC/B,OAAO,EAAE,IAAI,EAAE,SAAS;oBACxB,uEAAuE;oBACvE,+DAA+D;oBAC/D,SAAS,EAAE,EAAE,GAAG,IAAI,GAAG,IAAI;iBAC5B,CAAC,CAAC;gBACH,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC;YAC9D,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,MAAM,CAAC,GAAG,GAIT,CAAC;gBACF,IAAI,CAAC,CAAC,MAAM,KAAK,SAAS,IAAI,CAAC,CAAC,MAAM,KAAK,IAAI;oBAAE,MAAM,GAAG,CAAC;gBAC3D,OAAO,OAAO,CAAC,OAAO,CAAC;oBACrB,QAAQ,EAAE,CAAC,CAAC,MAAM;oBAClB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;oBAClC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;iBACnC,CAAC,CAAC;YACL,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -17,10 +17,38 @@ estimate, never a crash.
17
17
  </CHANGE_SUMMARY>
18
18
  */
19
19
 
20
- import { createRequire } from "node:module";
21
- import { join } from "node:path";
20
+ import { existsSync, readFileSync } from "node:fs";
21
+ import { dirname, join, resolve } from "node:path";
22
22
  import { pathToFileURL } from "node:url";
23
23
 
24
+ /**
25
+ * Walk the node_modules chain upward from the measured workspace root,
26
+ * mirroring Node's directory resolution — but deliberately WITHOUT the
27
+ * environment-dependent fallbacks (NODE_PATH, $HOME/.node_modules, global
28
+ * prefixes). The measured workspace counts typescript as available only when
29
+ * its own directory chain provides it; a harness that injects typescript into
30
+ * the process environment (vitest's NODE_PATH, a global install) must not
31
+ * leak into the measurement.
32
+ */
33
+ function resolveWorkspaceTypeScript(workspaceRoot: string): string | null {
34
+ let dir = resolve(workspaceRoot);
35
+ for (;;) {
36
+ const pkgJsonPath = join(dir, "node_modules", "typescript", "package.json");
37
+ if (existsSync(pkgJsonPath)) {
38
+ try {
39
+ const pkg = JSON.parse(readFileSync(pkgJsonPath, "utf8")) as { main?: string };
40
+ const entry = join(dir, "node_modules", "typescript", pkg.main ?? "lib/typescript.js");
41
+ if (existsSync(entry)) return entry;
42
+ } catch {
43
+ // malformed package.json — keep walking up
44
+ }
45
+ }
46
+ const parent = dirname(dir);
47
+ if (parent === dir) return null;
48
+ dir = parent;
49
+ }
50
+ }
51
+
24
52
  export interface FileSymbols {
25
53
  classes: number;
26
54
  functions: number;
@@ -88,8 +116,8 @@ export async function measureSymbols(
88
116
  try {
89
117
  // Resolve against the measured workspace, not this package — forge carries
90
118
  // no typescript dependency of its own, so a bare import would never find it.
91
- const requireFromRoot = createRequire(join(workspaceRoot, "package.json"));
92
- const tsPath = requireFromRoot.resolve("typescript");
119
+ const tsPath = resolveWorkspaceTypeScript(workspaceRoot);
120
+ if (tsPath == null) throw new Error("typescript-unavailable");
93
121
  ts = (await import(pathToFileURL(tsPath).href)) as unknown as TsApi;
94
122
  } catch {
95
123
  skipped.push("typescript-unavailable");
@@ -52,13 +52,9 @@ import type {
52
52
  ForgeRuntimeContext,
53
53
  } from "../../src/types.ts";
54
54
  import path from "node:path";
55
- import { restoreTrackedLockfile, execFileSyncAdapter } from "../mission/lockfile.ts";
56
55
  import {
57
- closeEvidenceIndex,
58
- evidenceAnchoredGit,
59
- evidenceRepoPreflight,
56
+
60
57
  } from "../../src/utils/verifier-git.ts";
61
- import { writeFileIfChanged } from "../../src/utils/fs-idempotent.ts";
62
58
  import {
63
59
  FORGE_SKILLS,
64
60
  discoverPackSkills,
@@ -93,7 +89,6 @@ export async function createForgeCoreModule(): Promise<ForgeModule> {
93
89
  const { runReleasePublish } = await import("./handlers/release-publish.ts");
94
90
  const { runKnowledgeCompact } = await import("./handlers/knowledge-compact.ts");
95
91
  const { runPackageHealth } = await import("./handlers/package-health.ts");
96
- const { runForgeAutonomyValidate } = await import("./handlers/forge-autonomy-validate.ts");
97
92
  const { runPublicSurfaceValidate } = await import("./handlers/public-surface.ts");
98
93
  const { runFileSizeLint } = await import("./handlers/file-size-lint.ts");
99
94
  const { runCompassDocsScaffold } = await import("../compass/handlers/compass-docs-scaffold.ts");
@@ -999,25 +994,6 @@ export async function createForgeCoreModule(): Promise<ForgeModule> {
999
994
  },
1000
995
  execute: runPackageHealth,
1001
996
  },
1002
- {
1003
- name: "forge.autonomy.validate",
1004
- mutatesState: false,
1005
- // RFC-1606: the FORGE-AUTONOMY-02 strip-types arm spawns tsc — the
1006
- // read-only IO adapter refuses exec unless the command opts in.
1007
- execOnReadOnly: true,
1008
- contract: "forge",
1009
- rules: [],
1010
- description:
1011
- "Scan packages/forge/os/** for forbidden @warpgogol/werkstatt-engine imports outside os/werkstatt/. " +
1012
- "Enforces FORGE-AUTONOMY-01 (RFC-0940, DNA-64). @warpgogol/werkstatt-shared is exempt. " +
1013
- "Type-only imports (import type) are exempt.",
1014
- scope: "workspace",
1015
- acceptsAllFlag: false,
1016
- reads: ["packages/forge/os/**/*.ts"],
1017
- cacheable: false,
1018
- flags: {},
1019
- execute: runForgeAutonomyValidate,
1020
- },
1021
997
  {
1022
998
  name: "forge.public-surface.validate",
1023
999
  mutatesState: false,
@@ -1071,7 +1047,7 @@ export async function createForgeCoreModule(): Promise<ForgeModule> {
1071
1047
  coverage: "operator" as const,
1072
1048
  description:
1073
1049
  "Umbrella command that runs rfc.archive, adr.archive, plan.archive, " +
1074
- "audit.archive, session.archive, and mission.archive in sequence. " +
1050
+ "audit.archive, and session.archive in sequence. " +
1075
1051
  "Passes --dry-run and --status through to all sub-commands. Not atomic " +
1076
1052
  "— if one sub-command fails, prior moves are not rolled back. " +
1077
1053
  "Owner generators of every generated artifact invalidated by the " +
@@ -1093,8 +1069,6 @@ export async function createForgeCoreModule(): Promise<ForgeModule> {
1093
1069
  "docs/audits/archive/**",
1094
1070
  "docs/sessions/*.md",
1095
1071
  "docs/sessions/archive/**",
1096
- "missions/*",
1097
- "missions/archive/**",
1098
1072
  "docs/specs/live/*.md",
1099
1073
  "pnpm-lock.yaml",
1100
1074
  // RFC-1528: owner-regen writes the generated artifacts invalidated by
@@ -1110,7 +1084,6 @@ export async function createForgeCoreModule(): Promise<ForgeModule> {
1110
1084
  "docs/audits/**/*.md",
1111
1085
  "docs/sessions/**/*.md",
1112
1086
  "docs/specs/live/*.md",
1113
- "missions/**",
1114
1087
  ],
1115
1088
  cacheable: false,
1116
1089
  flags: {
@@ -1160,7 +1133,6 @@ export async function createForgeCoreModule(): Promise<ForgeModule> {
1160
1133
  const { runPlanArchive } = await import("../plan/handlers/archive.ts");
1161
1134
  const { runAuditArchive } = await import("../audit/handlers/archive.ts");
1162
1135
  const { runSessionArchive } = await import("../session/handlers/archive.ts");
1163
- const { runMissionArchive } = await import("../mission/handlers/archive.ts");
1164
1136
 
1165
1137
  type ArchiveHandler = (
1166
1138
  input: ForgeCommandInput,
@@ -1173,7 +1145,6 @@ export async function createForgeCoreModule(): Promise<ForgeModule> {
1173
1145
  { name: "plan.archive", fn: runPlanArchive as ArchiveHandler },
1174
1146
  { name: "audit.archive", fn: runAuditArchive as ArchiveHandler },
1175
1147
  { name: "session.archive", fn: runSessionArchive as ArchiveHandler },
1176
- { name: "mission.archive", fn: runMissionArchive as ArchiveHandler },
1177
1148
  ];
1178
1149
 
1179
1150
  for (const { name: cmdName, fn } of subCommands) {
@@ -1304,51 +1275,7 @@ export async function createForgeCoreModule(): Promise<ForgeModule> {
1304
1275
  }
1305
1276
  }
1306
1277
 
1307
- // RFC-1505: post-loop lockfile restore — safety net for mission.archive's
1308
- // own restore. Only mission moves run `pnpm install` and can churn the
1309
- // lockfile; gating on them alone means an rfc/adr/plan-only archive run
1310
- // never touches a locally edited pnpm-lock.yaml. Restore HEAD bytes
1311
- // instead of staging — mission churn is never committed.
1312
- const missionData = results["mission.archive"] as { moved?: unknown[] } | undefined;
1313
- const missionMoved = Array.isArray(missionData?.moved) ? missionData.moved.length : 0;
1314
- if (!dryRun && missionMoved > 0) {
1315
- try {
1316
- const restored = await restoreTrackedLockfile(routedContext.workspaceRoot, {
1317
- ...execFileSyncAdapter(),
1318
- writeFile: async (target, content) => {
1319
- await writeFileIfChanged(target, content);
1320
- },
1321
- });
1322
- if (restored) {
1323
- // RFC-1602 (F-0245): index-side counterpart — the restore put
1324
- // HEAD back on disk; without unstaging, the pre-restore prune
1325
- // stays staged and the lockfile sits MM. Anchored mutation:
1326
- // ambient exec inherits session GIT_* and could reset a
1327
- // foreign index (CX-170).
1328
- const lockPreflight = await evidenceRepoPreflight(routedContext.workspaceRoot);
1329
- if (lockPreflight !== null) {
1330
- try {
1331
- await evidenceAnchoredGit(
1332
- routedContext.workspaceRoot,
1333
- ["reset", "-q", "--", "pnpm-lock.yaml"],
1334
- { preflight: lockPreflight },
1335
- );
1336
- } finally {
1337
- closeEvidenceIndex(lockPreflight);
1338
- }
1339
- }
1340
- if (outputFormat === "pretty") {
1341
- logger.info(" docs.archive: restored pnpm-lock.yaml to HEAD (safety net)");
1342
- }
1343
- }
1344
- } catch (refreshErr) {
1345
- if (outputFormat === "pretty") {
1346
- logger.warn(
1347
- ` docs.archive: lockfile safety-net restore failed — run 'pnpm install' manually: ${refreshErr instanceof Error ? refreshErr.message : String(refreshErr)}`,
1348
- );
1349
- }
1350
- }
1351
- }
1278
+
1352
1279
 
1353
1280
  // ── RFC-1602 (F-0212): owner-regen is DEFERRED to the integrate
1354
1281
  // fold — archive returns in seconds; flow.integrate regenerates the
@@ -13,7 +13,8 @@
13
13
 
14
14
  import { join, relative, extname } from "node:path";
15
15
  import { ambientIo } from "../../../src/utils/io.ts";
16
- import { loadWorkspaceDeps } from "../../werkstatt/handlers/workspace-deps.ts";
16
+ import { collectFiles } from "../../../src/utils/fs.ts";
17
+ import { byteHashFile } from "../../../src/utils/hash.ts";
17
18
  import type { ProfileAsset, ProfileAssetType } from "../../../src/profiles/profile-schema.ts";
18
19
 
19
20
  // Ambient default for helper fns without a context param — handlers override
@@ -43,7 +44,6 @@ export async function scanAssets(
43
44
  assetsConfig: ProfileAsset,
44
45
  options: { dryRun?: boolean; typeFilter?: string } = {},
45
46
  ): Promise<AssetEntry[]> {
46
- const { collectFiles, byteHashFile } = await loadWorkspaceDeps();
47
47
  const assetsDir = join(workspaceRoot, assetsConfig.dir);
48
48
  const allFiles = await collectFiles(assetsDir, {
49
49
  ignore: (name) => name.startsWith("-") || name.startsWith("old-") || name === ".DS_Store",
@@ -92,8 +92,6 @@ export async function extractReferences(
92
92
  compositionExtensions: string[],
93
93
  ): Promise<Map<string, string[]>> {
94
94
  const refMap = new Map<string, string[]>();
95
-
96
- const { collectFiles } = await loadWorkspaceDeps();
97
95
  const allFiles = await collectFiles(workspaceRoot, {
98
96
  extensions: compositionExtensions,
99
97
  ignore: (name) =>
@@ -13,12 +13,13 @@
13
13
 
14
14
  import { exec } from "../../../src/utils/sync-fs.ts";
15
15
  import { ambientIo, resolveIo } from "../../../src/utils/io.ts";
16
+ import { collectFiles } from "../../../src/utils/fs.ts";
17
+ import { byteHashFile } from "../../../src/utils/hash.ts";
16
18
  import { promisify } from "node:util";
17
19
 
18
20
  import { existsSync } from "../../../src/utils/sync-fs.ts";
19
21
  import { join, relative, dirname } from "node:path";
20
22
  import { createHash } from "node:crypto";
21
- import { loadWorkspaceDeps } from "../../werkstatt/handlers/workspace-deps.ts";
22
23
  import type {
23
24
  ForgeCommandInput,
24
25
  ForgeCommandResult,
@@ -95,7 +96,6 @@ function matchesGlob(filePath: string, patterns: string[]): boolean {
95
96
  }
96
97
 
97
98
  async function computeInputHash(workspaceRoot: string, inputPatterns: string[]): Promise<string> {
98
- const { collectFiles, byteHashFile } = await loadWorkspaceDeps();
99
99
  const allFiles = await collectFiles(workspaceRoot, {
100
100
  ignore: (name) =>
101
101
  name.startsWith("-") ||
@@ -292,7 +292,6 @@ export async function runDeterminismCheck(
292
292
  const absOutputPath = join(workspaceRoot, outputPath);
293
293
 
294
294
  try {
295
- const { byteHashFile } = await loadWorkspaceDeps();
296
295
  await execAsync(produceCommand, { cwd: workspaceRoot, timeout: 60_000 });
297
296
  const firstHash = await byteHashFile(absOutputPath);
298
297