@cassiomc1/forgeloop 1.13.0 → 2.0.0-rc.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 (395) hide show
  1. package/AGENT_COMPATIBILITY.md +8 -0
  2. package/CONTRIBUTING.md +11 -7
  3. package/DOCS_INDEX.md +37 -4
  4. package/ENG/c-development-eng.md +2 -2
  5. package/ENG/cpp-development-eng.md +2 -2
  6. package/ENG/dotnet-aspnetcore-development-eng.md +7 -1
  7. package/ENG/flutter-development-eng.md +4 -2
  8. package/ENG/go-development-eng.md +2 -2
  9. package/ENG/java-development-eng.md +3 -3
  10. package/ENG/nodejs-backend-development-eng.md +10 -6
  11. package/ENG/php-development-eng.md +3 -3
  12. package/ENG/python-development-eng.md +205 -0
  13. package/ENG/rust-development-eng.md +42 -1
  14. package/ENG/sec-code-eng.md +7 -7
  15. package/ENG/sql-development-eng.md +4 -4
  16. package/ENG/swift-development-eng.md +5 -4
  17. package/ENG/test-code-eng.md +1 -1
  18. package/ENG/typescript-development-eng.md +4 -4
  19. package/EXECUTION_STATE.md +12 -0
  20. package/GUIDE_ROUTER.md +6 -0
  21. package/LICENSE +133 -21
  22. package/LOOP_ENGINEERING.md +28 -2
  23. package/LOOP_SYSTEM_DESIGN.md +10 -10
  24. package/ORCHESTRATOR_INTEGRATION.md +9 -5
  25. package/PROTOCOL_INTEGRATION.md +55 -2
  26. package/README.md +63 -59
  27. package/TERMINOLOGY.md +2 -0
  28. package/THIRD_PARTY_NOTICES.md +3 -4
  29. package/THREAT_MODEL.md +140 -1
  30. package/completions/_forgeloop +29 -3
  31. package/completions/forgeloop.bash +55 -3
  32. package/completions/forgeloop.fish +183 -1
  33. package/docs/ADVISORY_CONTEXT.md +25 -0
  34. package/docs/AGENT_BROWSER_ADAPTER.md +81 -0
  35. package/docs/AGENT_BROWSER_VERIFICATION.md +6 -0
  36. package/docs/AGENT_PROTOCOL_SUMMARY.md +74 -39
  37. package/docs/AGENT_SKILL.md +66 -0
  38. package/docs/ARTIFACT_REFERENCE.md +171 -35
  39. package/docs/AUDIT_UX.md +46 -0
  40. package/docs/BROWSER_VERIFICATION.md +136 -0
  41. package/docs/CLI_REFERENCE.md +512 -8
  42. package/docs/CODE_ATTESTATION.md +2 -2
  43. package/docs/DOCUMENTATION_GUIDE.md +34 -11
  44. package/docs/GETTING_STARTED.md +3 -3
  45. package/docs/JEV_BENCHMARKS.md +31 -0
  46. package/docs/MODEL_ROUTING.md +37 -0
  47. package/docs/OPENSRC_ADAPTER.md +241 -0
  48. package/docs/PACKAGE_CONTENTS.md +46 -18
  49. package/docs/PROVIDERS.md +126 -0
  50. package/docs/PROVIDER_ARCHITECTURE.md +199 -0
  51. package/docs/RECIPES.md +9 -0
  52. package/docs/RELEASE_CHECKLIST.md +116 -12
  53. package/docs/SECURITY_REVIEW.md +71 -0
  54. package/docs/SELF_HOSTED_TESTS.md +121 -0
  55. package/docs/SEMANTIC_DECISION_PLANE.md +71 -0
  56. package/docs/TEST_INTELLIGENCE.md +29 -0
  57. package/docs/TEST_PRUNING.md +14 -0
  58. package/docs/TROUBLESHOOTING.md +198 -1
  59. package/docs/UNIVERSAL_INTEGRATION.md +31 -0
  60. package/docs/assets/diagrams/forgeloop-code-attestation-flow.html +2 -2
  61. package/docs/assets/diagrams/forgeloop-code-attestation-flow.receipt.json +5 -5
  62. package/docs/assets/diagrams/forgeloop-code-attestation-flow.svg +1 -1
  63. package/docs/assets/diagrams/forgeloop-engineering-flow.html +39 -26
  64. package/docs/assets/diagrams/forgeloop-engineering-flow.receipt.json +6 -6
  65. package/docs/assets/diagrams/forgeloop-engineering-flow.svg +26 -26
  66. package/docs/assets/diagrams/forgeloop-verification-trust-flow.html +2 -1
  67. package/docs/assets/diagrams/forgeloop-verification-trust-flow.receipt.json +5 -5
  68. package/docs/assets/diagrams/forgeloop-verification-trust-flow.svg +1 -1
  69. package/docs/diagrams/README.md +13 -9
  70. package/docs/diagrams/forgeloop-code-attestation-flow.workflow.json +1 -1
  71. package/docs/diagrams/forgeloop-engineering-flow.workflow.json +24 -19
  72. package/docs/diagrams/forgeloop-verification-trust-flow.workflow.json +1 -0
  73. package/docs/diagrams/reviews/forgeloop-code-attestation-flow.review.json +4 -4
  74. package/docs/diagrams/reviews/forgeloop-engineering-flow.review.json +4 -4
  75. package/docs/diagrams/reviews/forgeloop-verification-trust-flow.review.json +4 -4
  76. package/docs/documentation-manifest.json +774 -16
  77. package/docs/protocol-requirements.json +24 -0
  78. package/package.json +43 -11
  79. package/schemas/config.schema.json +14 -0
  80. package/schemas/context-plan.schema.json +18 -0
  81. package/schemas/semantic-decision.schema.json +46 -0
  82. package/schemas/task-bundle.schema.json +7 -2
  83. package/schemas/test-utility.schema.json +44 -0
  84. package/scripts/CI_VALIDATORS.md +6 -6
  85. package/scripts/benchmark-jev.mjs +5 -0
  86. package/scripts/benchmark-test-intelligence.mjs +4 -0
  87. package/scripts/generate-agent-protocol-summary.mjs +6 -3
  88. package/scripts/generate-forgeloop-skill.mjs +133 -0
  89. package/scripts/jev-smoke.mjs +19 -0
  90. package/scripts/run-mcp-clean-tests.mjs +30 -0
  91. package/skills/forgeloop/README.md +9 -0
  92. package/skills/forgeloop/SKILL.md +77 -0
  93. package/skills/forgeloop/references/lifecycle.md +9 -0
  94. package/skills/forgeloop/references/recovery.md +7 -0
  95. package/skills/forgeloop/references/verification.md +7 -0
  96. package/src/adapters/agent-browser/assertions.js +47 -0
  97. package/src/adapters/agent-browser/commands.js +54 -0
  98. package/src/adapters/agent-browser/index.js +3 -0
  99. package/src/adapters/agent-browser/locator.js +40 -0
  100. package/src/adapters/agent-browser/process.js +215 -0
  101. package/src/adapters/agent-browser/provider.js +316 -0
  102. package/src/adapters/emulated-services/constants.js +24 -0
  103. package/src/adapters/emulated-services/index.js +7 -0
  104. package/src/adapters/emulated-services/process.js +162 -0
  105. package/src/adapters/emulated-services/provider.js +289 -0
  106. package/src/adapters/opensrc/normalize.js +90 -0
  107. package/src/adapters/opensrc/process.js +248 -0
  108. package/src/adapters/opensrc/provider.js +338 -0
  109. package/src/adapters/opensrc/search.js +264 -0
  110. package/src/adapters/temporary-paths.js +18 -0
  111. package/src/adapters/typesafe/client.js +28 -0
  112. package/src/adapters/typesafe/engine.js +63 -0
  113. package/src/adapters/typesafe/normalize.js +41 -0
  114. package/src/cli.js +218 -174
  115. package/src/commands/action-show.js +5 -2
  116. package/src/commands/advance.js +5 -1
  117. package/src/commands/baseline.js +13 -11
  118. package/src/commands/checkpoint-revalidate.js +192 -0
  119. package/src/commands/complete.js +19 -3
  120. package/src/commands/context-plan.js +38 -0
  121. package/src/commands/contract-create.js +266 -0
  122. package/src/commands/contract-revise.js +236 -0
  123. package/src/commands/decision-show.js +14 -0
  124. package/src/commands/decision-status.js +22 -0
  125. package/src/commands/discover.js +41 -0
  126. package/src/commands/doctor.js +51 -13
  127. package/src/commands/gate-record.js +194 -0
  128. package/src/commands/gate-revalidate.js +135 -0
  129. package/src/commands/handoff-list.js +6 -1
  130. package/src/commands/handoff-show.js +6 -1
  131. package/src/commands/migrate-protocol.js +2 -2
  132. package/src/commands/model-route.js +40 -0
  133. package/src/commands/next.js +7 -1
  134. package/src/commands/policy-diff.js +25 -4
  135. package/src/commands/progress.js +17 -11
  136. package/src/commands/record-diagnosis.js +3 -0
  137. package/src/commands/route.js +146 -18
  138. package/src/commands/semantic-plan.js +41 -0
  139. package/src/commands/status.js +6 -1
  140. package/src/commands/storage-backup.js +15 -0
  141. package/src/commands/storage-migrate.js +5 -0
  142. package/src/commands/storage-migration-resume.js +5 -0
  143. package/src/commands/storage-migration-status.js +44 -0
  144. package/src/commands/storage-restore-resume.js +7 -0
  145. package/src/commands/storage-restore.js +8 -0
  146. package/src/commands/task-abandon.js +224 -0
  147. package/src/commands/task-list.js +8 -43
  148. package/src/commands/task-migrate-contract-bootstrap-repair.js +288 -0
  149. package/src/commands/task-migrate.js +3 -3
  150. package/src/commands/task-recover.js +10 -2
  151. package/src/commands/task-repair-contract-bootstrap.js +263 -0
  152. package/src/commands/task-scope.js +18 -2
  153. package/src/commands/task-show.js +16 -2
  154. package/src/commands/test-inventory.js +5 -0
  155. package/src/commands/test-prune-plan.js +5 -0
  156. package/src/commands/test-prune-probe.js +5 -0
  157. package/src/commands/test-utility.js +5 -0
  158. package/src/commands/validate-protocol.js +39 -15
  159. package/src/commands/validate-receipt.js +8 -1
  160. package/src/config/guides.json +4 -0
  161. package/src/core/action-ledger-projection.js +10 -3
  162. package/src/core/actions.js +38 -75
  163. package/src/core/activation.js +11 -3
  164. package/src/core/approvals.js +17 -51
  165. package/src/core/artifact-registry.js +83 -2
  166. package/src/core/artifacts.js +81 -27
  167. package/src/core/attachment-paths.js +45 -0
  168. package/src/core/attestation-coverage.js +6 -1
  169. package/src/core/attestation-verifier.js +21 -2
  170. package/src/core/attestation.js +17 -6
  171. package/src/core/audit-ux.js +514 -0
  172. package/src/core/audit.js +6 -1
  173. package/src/core/browser-verification/constants.js +149 -0
  174. package/src/core/browser-verification/normalize.js +254 -0
  175. package/src/core/browser-verification/provider.js +519 -0
  176. package/src/core/browser-verification/service.js +115 -0
  177. package/src/core/bundles.js +160 -66
  178. package/src/core/checkpoint-revalidation.js +321 -0
  179. package/src/core/cli-command-definitions.js +350 -7
  180. package/src/core/code-manifest.js +9 -3
  181. package/src/core/command-executors.js +274 -108
  182. package/src/core/command-input.js +136 -44
  183. package/src/core/completion-artifacts.js +85 -34
  184. package/src/core/completion-ownership.js +19 -8
  185. package/src/core/completion-recovery-rebind.js +11 -1
  186. package/src/core/completion.js +64 -15
  187. package/src/core/config.js +3 -0
  188. package/src/core/conformance.js +2 -1
  189. package/src/core/context-compiler/budget.js +9 -0
  190. package/src/core/context-compiler/candidates.js +39 -0
  191. package/src/core/context-compiler/compiler.js +63 -0
  192. package/src/core/context-compiler/fingerprint.js +11 -0
  193. package/src/core/context-compiler/policy.js +13 -0
  194. package/src/core/context-compiler/result.js +23 -0
  195. package/src/core/continuity-lint.js +13 -2
  196. package/src/core/continuity-reconciliation.js +16 -3
  197. package/src/core/continuity.js +16 -8
  198. package/src/core/contract-bootstrap-recovery.js +656 -0
  199. package/src/core/contract-revision.js +209 -0
  200. package/src/core/decision/artifact.js +70 -0
  201. package/src/core/decision/benchmarks.js +103 -0
  202. package/src/core/decision/cache.js +27 -0
  203. package/src/core/decision/constants.js +58 -0
  204. package/src/core/decision/cutover.js +34 -0
  205. package/src/core/decision/engine.js +22 -0
  206. package/src/core/decision/errors.js +68 -0
  207. package/src/core/decision/events.js +104 -0
  208. package/src/core/decision/freshness.js +19 -0
  209. package/src/core/decision/normalizers/index.js +115 -0
  210. package/src/core/decision/policy.js +18 -0
  211. package/src/core/decision/projection.js +16 -0
  212. package/src/core/decision/question-registry.js +201 -0
  213. package/src/core/decision/request.js +26 -0
  214. package/src/core/decision/resolver.js +138 -0
  215. package/src/core/decision/result.js +58 -0
  216. package/src/core/decision/service.js +181 -0
  217. package/src/core/decision/state-builder.js +65 -0
  218. package/src/core/decision/task-bindings.js +35 -0
  219. package/src/core/decision/test-provider.js +32 -0
  220. package/src/core/decision/thresholds.js +15 -0
  221. package/src/core/diagnosis-model.js +11 -0
  222. package/src/core/diagnosis.js +10 -1
  223. package/src/core/diagnostic-projection.js +29 -12
  224. package/src/core/diagnostic-record.js +28 -3
  225. package/src/core/efficiency.js +6 -1
  226. package/src/core/error-codes.js +278 -0
  227. package/src/core/events.js +535 -147
  228. package/src/core/evidence-readiness.js +9 -0
  229. package/src/core/execution-prerequisites.js +36 -13
  230. package/src/core/execution-profile.js +63 -38
  231. package/src/core/execution.js +26 -40
  232. package/src/core/filesystem.js +11 -0
  233. package/src/core/gate-artifact.js +105 -19
  234. package/src/core/gate-provenance.js +125 -0
  235. package/src/core/handoff.js +26 -14
  236. package/src/core/history.js +39 -35
  237. package/src/core/hypothesis-projection.js +32 -0
  238. package/src/core/information-gain-projection.js +104 -100
  239. package/src/core/inspect.js +12 -3
  240. package/src/core/integration-invocation-policy.js +37 -4
  241. package/src/core/integration-resources.js +119 -87
  242. package/src/core/ledger-event-collection.js +189 -0
  243. package/src/core/ledger-relations.js +23 -0
  244. package/src/core/model-router/constants.js +10 -0
  245. package/src/core/model-router/policy.js +103 -0
  246. package/src/core/model-router/router.js +37 -0
  247. package/src/core/native-storage.js +12 -0
  248. package/src/core/next-action-continuity.js +31 -9
  249. package/src/core/next-action-model.js +58 -0
  250. package/src/core/next-action-phases.js +131 -43
  251. package/src/core/next-action-refresh.js +43 -9
  252. package/src/core/next-action-review-phase.js +9 -4
  253. package/src/core/next-action-verification-phase.js +2 -1
  254. package/src/core/next-action.js +56 -9
  255. package/src/core/phase.js +266 -103
  256. package/src/core/policy-engine.js +12 -13
  257. package/src/core/preflight-consistency.js +89 -62
  258. package/src/core/preflight-loaders.js +48 -9
  259. package/src/core/preflight-model.js +6 -1
  260. package/src/core/preflight.js +29 -12
  261. package/src/core/progress.js +21 -10
  262. package/src/core/protocol-info.js +68 -0
  263. package/src/core/protocol-migration.js +7 -6
  264. package/src/core/protocol.js +20 -0
  265. package/src/core/reconcile-closure.js +281 -67
  266. package/src/core/recovery-history.js +67 -47
  267. package/src/core/reflection.js +72 -77
  268. package/src/core/responsibility.js +25 -13
  269. package/src/core/resumability.js +154 -44
  270. package/src/core/route-artifact.js +28 -4
  271. package/src/core/router.js +67 -1
  272. package/src/core/runtime-context.js +123 -61
  273. package/src/core/schema-validation.js +11 -3
  274. package/src/core/security-review/constants.js +64 -0
  275. package/src/core/security-review/normalize.js +245 -0
  276. package/src/core/security-review/provider.js +204 -0
  277. package/src/core/security-review/service.js +134 -0
  278. package/src/core/semantic-planning/constants.js +19 -0
  279. package/src/core/semantic-planning/projection.js +94 -0
  280. package/src/core/semantic-planning/service.js +15 -0
  281. package/src/core/settlement.js +12 -1
  282. package/src/core/signing/bundle-file.js +53 -0
  283. package/src/core/signing/bundle-reference.js +15 -0
  284. package/src/core/signing/sigstore.js +60 -33
  285. package/src/core/signing/statement-file.js +27 -0
  286. package/src/core/sources.js +37 -0
  287. package/src/core/storage-runtime-registry.js +41 -0
  288. package/src/core/structural-quality/artifacts.js +20 -14
  289. package/src/core/structural-quality/service.js +81 -56
  290. package/src/core/target-layout.js +1 -1
  291. package/src/core/task-claim-state.js +249 -15
  292. package/src/core/task-command.js +21 -1
  293. package/src/core/task-conflict-inspection.js +133 -102
  294. package/src/core/task-descriptor.js +29 -22
  295. package/src/core/task-discovery.js +288 -90
  296. package/src/core/task-lock.js +66 -306
  297. package/src/core/task-migration-validation.js +5 -5
  298. package/src/core/task-migration.js +17 -287
  299. package/src/core/task-paths.js +13 -0
  300. package/src/core/task-recovery.js +1 -0
  301. package/src/core/task-snapshot.js +51 -8
  302. package/src/core/task-storage-migration.js +18 -0
  303. package/src/core/templates.js +23 -8
  304. package/src/core/test-intelligence/benchmarks.js +68 -0
  305. package/src/core/test-intelligence/inventory.js +73 -0
  306. package/src/core/test-intelligence/prune.js +94 -0
  307. package/src/core/test-intelligence/semantic-state.js +15 -0
  308. package/src/core/test-intelligence/service.js +40 -0
  309. package/src/core/test-intelligence/utility.js +50 -0
  310. package/src/core/trace.js +164 -105
  311. package/src/core/trajectory-evaluation.js +15 -3
  312. package/src/core/trajectory-metrics.js +47 -32
  313. package/src/core/transaction.js +16 -287
  314. package/src/core/verification-scope.js +20 -12
  315. package/src/core/work-state.js +100 -59
  316. package/src/integration.d.ts +492 -0
  317. package/src/integration.js +54 -0
  318. package/src/providers/README.md +47 -0
  319. package/src/providers/capabilities.js +46 -0
  320. package/src/providers/errors.js +15 -0
  321. package/src/providers/index.js +29 -0
  322. package/src/providers/json-snapshot.js +105 -0
  323. package/src/providers/registry.js +152 -0
  324. package/src/repository-index/binary-manager.js +7 -5
  325. package/src/storage/artifact-bytes.js +22 -0
  326. package/src/storage/attachment-binding.js +11 -0
  327. package/src/storage/attachment-files.js +82 -0
  328. package/src/storage/attachment-references.js +36 -0
  329. package/src/storage/backup.js +53 -0
  330. package/src/storage/capabilities.js +31 -0
  331. package/src/storage/connection-owner.js +119 -0
  332. package/src/storage/connection.js +376 -0
  333. package/src/storage/existing-project-scope.js +45 -0
  334. package/src/storage/export-destination.js +44 -0
  335. package/src/storage/exporter.js +284 -0
  336. package/src/storage/file-durability.js +46 -0
  337. package/src/storage/importer.js +461 -0
  338. package/src/storage/index.js +74 -0
  339. package/src/storage/leases.js +63 -0
  340. package/src/storage/ledger-event-snapshot.js +150 -0
  341. package/src/storage/ledger-relations.js +220 -0
  342. package/src/storage/legacy-maintenance-boundary.js +18 -0
  343. package/src/storage/legacy-signature.js +115 -0
  344. package/src/storage/maintenance-handoff.js +129 -0
  345. package/src/storage/maintenance-owner.js +42 -0
  346. package/src/storage/maintenance.js +310 -0
  347. package/src/storage/metadata-json.js +35 -0
  348. package/src/storage/migration-activate.js +59 -0
  349. package/src/storage/migration-archive.js +57 -0
  350. package/src/storage/migration-attachment-root.js +61 -0
  351. package/src/storage/migration-candidate.js +398 -0
  352. package/src/storage/migration-publication.js +143 -0
  353. package/src/storage/migration-rollback-admission.js +54 -0
  354. package/src/storage/migration-rollback-preparation.js +132 -0
  355. package/src/storage/migration-rollback-publication.js +183 -0
  356. package/src/storage/migration-rollback-release.js +66 -0
  357. package/src/storage/migration-rollback-source-stage.js +103 -0
  358. package/src/storage/migration-rollback.js +43 -0
  359. package/src/storage/migration-source-partition.js +56 -0
  360. package/src/storage/migration-source.js +255 -0
  361. package/src/storage/migration-terminal.js +39 -0
  362. package/src/storage/migration-validation.js +75 -0
  363. package/src/storage/migration.js +43 -0
  364. package/src/storage/operational-attachments.js +49 -0
  365. package/src/storage/operational-context.js +50 -0
  366. package/src/storage/project-backup.js +98 -0
  367. package/src/storage/project-bootstrap.js +24 -0
  368. package/src/storage/project-boundary.js +79 -0
  369. package/src/storage/project-read-snapshot.js +18 -0
  370. package/src/storage/project-replacement.js +137 -0
  371. package/src/storage/project-restore.js +203 -0
  372. package/src/storage/record-definitions.js +45 -0
  373. package/src/storage/repository.js +507 -0
  374. package/src/storage/restore-journal.js +62 -0
  375. package/src/storage/restore-layout.js +30 -0
  376. package/src/storage/restore-preparation.js +84 -0
  377. package/src/storage/restore-replacement-archive.js +162 -0
  378. package/src/storage/restore-replacement-owner.js +31 -0
  379. package/src/storage/restore-replacement-preparation.js +128 -0
  380. package/src/storage/restore-replacement.js +142 -0
  381. package/src/storage/restore-terminal.js +32 -0
  382. package/src/storage/runtime.js +31 -0
  383. package/src/storage/schema.js +214 -0
  384. package/src/storage/singleton-import.js +84 -0
  385. package/src/storage/snapshot-continuity.js +16 -0
  386. package/src/storage/snapshot.js +36 -0
  387. package/src/storage/storage-marker.js +79 -0
  388. package/src/storage/task-guards.js +107 -0
  389. package/src/storage/topology.js +42 -0
  390. package/src/storage/transaction.js +179 -0
  391. package/src/storage/unit-of-work.js +663 -0
  392. package/src/storage/windows-process-incarnation.js +206 -0
  393. package/.forgeloop/forgeloop.gitignore +0 -4
  394. package/LICENSE-DOCS.md +0 -13
  395. package/src/core/transaction-maintenance.js +0 -70
@@ -58,6 +58,104 @@ export const CLI_TASK_OPTION = Object.freeze({
58
58
  export const CLI_BOOTSTRAP_OPTIONS = CLI_COMMON_OPTIONS;
59
59
 
60
60
  export const CLI_COMMAND_DEFINITIONS = Object.freeze({
61
+ "storage-restore-resume": Object.freeze({
62
+ name: "storage-restore-resume", category: "project-maintenance", mutation: "MUTATING",
63
+ options: Object.freeze({
64
+ ...CLI_COMMON_OPTIONS,
65
+ "--operation": Object.freeze({ targetKey: "operationId", parseType: "string", takesValue: true, valueName: "uuid", missingValueMessage: "--operation requires a UUID", description: "exact retained restore journal operation UUID" }),
66
+ "--expected-owner": Object.freeze({ targetKey: "expectedOwnerId", parseType: "string", takesValue: true, valueName: "uuid", missingValueMessage: "--expected-owner requires a UUID", description: "exact retained maintenance owner UUID" }),
67
+ "--replace-active": Object.freeze({ targetKey: "replaceActive", parseType: "boolean", takesValue: false, description: "explicitly select active replacement with retained outgoing authority" }),
68
+ "--writers-quiesced": Object.freeze({ targetKey: "writersQuiesced", parseType: "boolean", takesValue: false, description: "assert that all writers have been externally stopped" }),
69
+ "--json": Object.freeze({ targetKey: "json", parseType: "boolean", takesValue: false, description: "emit restore recovery metadata" }),
70
+ }),
71
+ writes: [".forgeloop/storage-restores", ".forgeloop/state.sqlite", ".forgeloop/attachments", ".forgeloop/storage-version.json", ".forgeloop/.storage-maintenance", ".forgeloop/storage-maintenance-history"], removes: [], mayExecuteExternalProcess: false,
72
+ description: "Adopts an exact dead local maintenance owner and resumes restore. Incomplete snapshots and prior rebuild intents are retained before rebuilding from bound source; completed preparation requires source parity/domain validation. Use --replace-active for preparation or publication replacement recovery. Conflicting intents and retained handoff locks remain refused.",
73
+ }),
74
+ "storage-restore": Object.freeze({
75
+ name: "storage-restore", category: "project-maintenance", mutation: "MUTATING",
76
+ options: Object.freeze({
77
+ ...CLI_COMMON_OPTIONS,
78
+ "--source": Object.freeze({ targetKey: "source", parseType: "string", takesValue: true, valueName: "path", missingValueMessage: "--source requires a path", description: "verified attachment-inclusive backup directory; absolute or relative to the target project" }),
79
+ "--replace-active": Object.freeze({ targetKey: "replaceActive", parseType: "boolean", takesValue: false, description: "explicitly select active replacement with retained outgoing authority" }),
80
+ "--writers-quiesced": Object.freeze({ targetKey: "writersQuiesced", parseType: "boolean", takesValue: false, description: "assert that all writers have been externally stopped" }),
81
+ "--json": Object.freeze({ targetKey: "json", parseType: "boolean", takesValue: false, description: "emit restore activation metadata" }),
82
+ }),
83
+ writes: [".forgeloop/storage-restores", ".forgeloop/state.sqlite", ".forgeloop/attachments", ".forgeloop/storage-version.json", ".forgeloop/.storage-maintenance"], removes: [], mayExecuteExternalProcess: false,
84
+ description: "Verifies and retains a backup before activating it in an operationally fresh project. Existing operational state requires explicit --replace-active, which independently retains and archives outgoing authority before activation; failed restore evidence and maintenance exclusion are retained.",
85
+ }),
86
+ "storage-migration-status": Object.freeze({
87
+ name: "storage-migration-status", category: "project-maintenance", mutation: "READ_ONLY",
88
+ options: Object.freeze({
89
+ ...CLI_COMMON_OPTIONS,
90
+ "--json": Object.freeze({ targetKey: "json", parseType: "boolean", takesValue: false, description: "emit bootstrap storage layout and retained maintenance ownership" }),
91
+ }),
92
+ writes: [], removes: [], mayExecuteExternalProcess: false,
93
+ description: "Inspects storage layout and maintenance exclusion without opening or repairing a database.",
94
+ }),
95
+ "storage-migration-resume": Object.freeze({
96
+ name: "storage-migration-resume", category: "project-maintenance", mutation: "MUTATING",
97
+ options: Object.freeze({
98
+ ...CLI_COMMON_OPTIONS,
99
+ "--destination": Object.freeze({ targetKey: "destination", parseType: "string", takesValue: true, valueName: "path", missingValueMessage: "--destination requires a path", description: "retained migration directory relative to the project" }),
100
+ "--expected-owner": Object.freeze({ targetKey: "expectedOwnerId", parseType: "string", takesValue: true, valueName: "uuid", missingValueMessage: "--expected-owner requires a UUID", description: "exact retained maintenance owner reported by storage-migration-status" }),
101
+ "--writers-quiesced": Object.freeze({ targetKey: "writersQuiesced", parseType: "boolean", takesValue: false, description: "assert that all writers, including older clients, have been externally stopped" }),
102
+ "--reconcile-unbound-handoff": Object.freeze({ targetKey: "acknowledgeUnboundHandoff", parseType: "boolean", takesValue: false, description: "preserve an unbound legacy handoff by atomic archival before resuming the exact dead owner" }),
103
+ "--json": Object.freeze({ targetKey: "json", parseType: "boolean", takesValue: false, description: "emit recovery verification metadata" }),
104
+ }),
105
+ writes: ["<destination>", ".forgeloop/state.sqlite", ".forgeloop/storage-version.json", ".forgeloop/.storage-maintenance", ".forgeloop/storage-maintenance-history"], removes: [], mayExecuteExternalProcess: false,
106
+ description: "Adopts an exact dead local owner and continues verified publication stages. Unrecorded capture and unbound candidate files remain refused; an unbound legacy handoff is archived opaquely only with explicit --reconcile-unbound-handoff acknowledgement.",
107
+ }),
108
+ "storage-rollback": Object.freeze({
109
+ name: "storage-rollback", category: "project-maintenance", mutation: "MUTATING",
110
+ options: Object.freeze({
111
+ ...CLI_COMMON_OPTIONS,
112
+ "--destination": Object.freeze({ targetKey: "destination", parseType: "string", takesValue: true, valueName: "path", missingValueMessage: "--destination requires a path", description: "retained published migration directory relative to the project" }),
113
+ "--legacy-root": Object.freeze({ targetKey: "legacyRoot", parseType: "string", takesValue: true, valueName: "path", missingValueMessage: "--legacy-root requires a path", description: "clean supported pinned legacy checkout used for actual target validation" }),
114
+ "--writers-quiesced": Object.freeze({ targetKey: "writersQuiesced", parseType: "boolean", takesValue: false, description: "assert that all writers, including older clients, have been externally stopped and excluded" }),
115
+ "--native-writes-excluded": Object.freeze({ targetKey: "nativeWritesExcluded", parseType: "boolean", takesValue: false, description: "assert that native writes have been excluded since migration; snapshot equality alone does not prove this" }),
116
+ "--json": Object.freeze({ targetKey: "json", parseType: "boolean", takesValue: false, description: "emit restoration and target-validation metadata" }),
117
+ }),
118
+ writes: ["<destination>", "export-index.json", ".forgeloop/task-state", ".forgeloop/attachments", ".forgeloop/.storage-maintenance"],
119
+ removes: [".forgeloop/state.sqlite", ".forgeloop/storage-version.json"], mayExecuteExternalProcess: true,
120
+ description: "Conditionally restores preserved source before native writes, retaining original native bytes and validating every task with the supported pinned legacy target before release. Failures retain exclusion; post-write restoration is refused.",
121
+ }),
122
+ "storage-rollback-resume": Object.freeze({
123
+ name: "storage-rollback-resume", category: "project-maintenance", mutation: "MUTATING",
124
+ options: Object.freeze({
125
+ ...CLI_COMMON_OPTIONS,
126
+ "--expected-owner": Object.freeze({ targetKey: "expectedOwnerId", parseType: "string", takesValue: true, valueName: "uuid", missingValueMessage: "--expected-owner requires a UUID", description: "exact retained dead local owner reported by storage-migration-status" }),
127
+ "--destination": Object.freeze({ targetKey: "destination", parseType: "string", takesValue: true, valueName: "path", missingValueMessage: "--destination requires a path", description: "retained migration with recorded rollback preparation, staging or publication" }),
128
+ "--legacy-root": Object.freeze({ targetKey: "legacyRoot", parseType: "string", takesValue: true, valueName: "path", missingValueMessage: "--legacy-root requires a path", description: "clean supported pinned legacy checkout used for actual target validation" }),
129
+ "--writers-quiesced": Object.freeze({ targetKey: "writersQuiesced", parseType: "boolean", takesValue: false, description: "assert that all writers, including older clients, have been externally stopped and excluded" }),
130
+ "--native-writes-excluded": Object.freeze({ targetKey: "nativeWritesExcluded", parseType: "boolean", takesValue: false, description: "assert that native writes have been excluded since migration; snapshot equality alone does not prove this" }),
131
+ "--json": Object.freeze({ targetKey: "json", parseType: "boolean", takesValue: false, description: "emit restoration and target-validation metadata" }),
132
+ }),
133
+ writes: ["<destination>", "export-index.json", ".forgeloop/task-state", ".forgeloop/attachments", ".forgeloop/.storage-maintenance"],
134
+ removes: [".forgeloop/state.sqlite", ".forgeloop/storage-version.json"], mayExecuteExternalProcess: true,
135
+ description: "Resumes recorded rollback preparation, staging or publication under exact dead-owner adoption, revalidates native/source locations, and validates every task with the pinned target before release. Unbound attempts remain refused.",
136
+ }),
137
+ "storage-migrate": Object.freeze({
138
+ name: "storage-migrate", category: "project-maintenance", mutation: "MUTATING",
139
+ options: Object.freeze({
140
+ ...CLI_COMMON_OPTIONS,
141
+ "--destination": Object.freeze({ targetKey: "destination", parseType: "string", takesValue: true, valueName: "path", missingValueMessage: "--destination requires a path", description: "new retained migration directory relative to the project; missing parent directories are created" }),
142
+ "--writers-quiesced": Object.freeze({ targetKey: "writersQuiesced", parseType: "boolean", takesValue: false, description: "assert that all writers, including older clients, have been externally stopped" }),
143
+ "--json": Object.freeze({ targetKey: "json", parseType: "boolean", takesValue: false, description: "emit migration publication and verification metadata" }),
144
+ }),
145
+ writes: ["<destination>", ".forgeloop/state.sqlite", ".forgeloop/storage-version.json", ".forgeloop/.storage-maintenance"], removes: [], mayExecuteExternalProcess: false,
146
+ description: "Validates, retains and archives legacy state before activating SQLite. Failed attempts retain maintenance exclusion; resume requires the exact retained owner and a verified candidate.",
147
+ }),
148
+ "storage-backup": Object.freeze({
149
+ name: "storage-backup", category: "project-maintenance", mutation: "MUTATING",
150
+ options: Object.freeze({
151
+ ...CLI_COMMON_OPTIONS,
152
+ "--destination": Object.freeze({ targetKey: "destination", parseType: "string", takesValue: true, valueName: "path", missingValueMessage: "--destination requires a path", description: "new backup file or attachment-inclusive directory relative to the project; parent directory must exist" }),
153
+ "--include-attachments": Object.freeze({ targetKey: "includeAttachments", parseType: "boolean", takesValue: false, description: "create a new backup directory including all canonically referenced attachment bytes" }),
154
+ "--json": Object.freeze({ targetKey: "json", parseType: "boolean", takesValue: false, description: "emit backup metadata" }),
155
+ }),
156
+ writes: ["<destination>"], removes: [], mayExecuteExternalProcess: false,
157
+ description: "Creates an exclusive native SQLite backup, optionally including canonically referenced attachments in a retained directory.",
158
+ }),
61
159
  "protocol-info": Object.freeze({
62
160
  name: "protocol-info",
63
161
  category: "diagnostics",
@@ -71,6 +169,188 @@ export const CLI_COMMAND_DEFINITIONS = Object.freeze({
71
169
  mayExecuteExternalProcess: false,
72
170
  description: "Reports versioning, lifecycle, command, guide, and public error compatibility metadata for external harnesses.",
73
171
  }),
172
+ "decision-status": Object.freeze({
173
+ name: "decision-status",
174
+ category: "diagnostics",
175
+ mutation: "READ_ONLY",
176
+ options: Object.freeze({
177
+ ...CLI_COMMON_OPTIONS,
178
+ "--health": Object.freeze({ targetKey: "health", parseType: "boolean", takesValue: false, description: "perform a bounded live Jev health check when credentials are configured" }),
179
+ "--json": Object.freeze({ targetKey: "json", parseType: "boolean", takesValue: false, description: "emit decision-plane status as JSON" }),
180
+ }),
181
+ writes: [], removes: [], mayExecuteExternalProcess: true,
182
+ description: "Reports the pinned semantic decision-plane configuration without exposing credentials.",
183
+ }),
184
+ "decision-show": Object.freeze({
185
+ name: "decision-show",
186
+ category: "diagnostics",
187
+ mutation: "READ_ONLY",
188
+ options: Object.freeze({
189
+ ...CLI_COMMON_OPTIONS,
190
+ ...CLI_TASK_OPTION,
191
+ "--decision": Object.freeze({ targetKey: "decisionId", parseType: "string", takesValue: true, valueName: "id", missingValueMessage: "--decision requires an ID", description: "decision artifact ID" }),
192
+ "--json": Object.freeze({ targetKey: "json", parseType: "boolean", takesValue: false, description: "emit the decision artifact as JSON" }),
193
+ }),
194
+ writes: [], removes: [], mayExecuteExternalProcess: false,
195
+ description: "Shows one persisted semantic decision artifact without performing a live request.",
196
+ }),
197
+ "context-plan": Object.freeze({
198
+ name: "context-plan",
199
+ category: "diagnostics",
200
+ mutation: "READ_ONLY",
201
+ options: Object.freeze({
202
+ ...CLI_COMMON_OPTIONS,
203
+ ...CLI_TASK_OPTION,
204
+ "--decision": Object.freeze({ targetKey: "decisionId", parseType: "string", takesValue: true, valueName: "id", missingValueMessage: "--decision requires an ID", description: "persisted Jev decision artifact ID" }),
205
+ "--profile": Object.freeze({ targetKey: "profile", parseType: "string", takesValue: true, valueName: "profile", missingValueMessage: "--profile requires light, balanced, or full", description: "bounded context budget profile" }),
206
+ "--json": Object.freeze({ targetKey: "json", parseType: "boolean", takesValue: false, description: "emit the bounded context plan as JSON" }),
207
+ }),
208
+ writes: [], removes: [], mayExecuteExternalProcess: false,
209
+ description: "Compiles a bounded non-authoritative context plan from deterministic candidates.",
210
+ }),
211
+ "model-route": Object.freeze({
212
+ name: "model-route",
213
+ category: "diagnostics",
214
+ mutation: "READ_ONLY",
215
+ options: Object.freeze({
216
+ ...CLI_COMMON_OPTIONS,
217
+ ...CLI_TASK_OPTION,
218
+ "--decision": Object.freeze({ targetKey: "decisionId", parseType: "string", takesValue: true, valueName: "id", missingValueMessage: "--decision requires an ID", description: "persisted Jev decision artifact ID" }),
219
+ "--work": Object.freeze({ targetKey: "workType", parseType: "string", takesValue: true, valueName: "type", missingValueMessage: "--work requires a type", description: "declared work type" }),
220
+ "--surface": Object.freeze({ targetKey: "surfaces", parseType: "string", takesValue: true, valueName: "value", repeatable: true, missingValueMessage: "--surface requires a value", description: "affected surface" }),
221
+ "--risk": Object.freeze({ targetKey: "risks", parseType: "string", takesValue: true, valueName: "value", repeatable: true, missingValueMessage: "--risk requires a value", description: "task risk" }),
222
+ "--platform": Object.freeze({ targetKey: "platforms", parseType: "string", takesValue: true, valueName: "value", repeatable: true, missingValueMessage: "--platform requires a value", description: "affected platform" }),
223
+ "--behavior-change": Object.freeze({ targetKey: "behaviorChange", parseType: "boolean", takesValue: false, description: "declare behavior change" }),
224
+ "--executable-change": Object.freeze({ targetKey: "executableChange", parseType: "boolean", takesValue: false, description: "declare executable/configuration change" }),
225
+ "--generation-required": Object.freeze({ targetKey: "generationRequired", parseType: "boolean", takesValue: false, description: "declare that generation is required" }),
226
+ "--architecture-change": Object.freeze({ targetKey: "architectureChange", parseType: "boolean", takesValue: false, description: "declare an architectural change" }),
227
+ "--ambiguous": Object.freeze({ targetKey: "ambiguity", parseType: "boolean", takesValue: false, description: "declare unresolved ambiguity" }),
228
+ "--json": Object.freeze({ targetKey: "json", parseType: "boolean", takesValue: false, description: "emit model-route projection as JSON" }),
229
+ }),
230
+ writes: [], removes: [], mayExecuteExternalProcess: false,
231
+ description: "Projects a deterministic model-routing floor with advisory Jev escalation only.",
232
+ }),
233
+ "semantic-plan": Object.freeze({
234
+ name: "semantic-plan",
235
+ category: "diagnostics",
236
+ mutation: "READ_ONLY",
237
+ options: Object.freeze({
238
+ ...CLI_COMMON_OPTIONS,
239
+ ...CLI_TASK_OPTION,
240
+ "--decision": Object.freeze({ targetKey: "decisionId", parseType: "string", takesValue: true, valueName: "id", missingValueMessage: "--decision requires an ID", description: "persisted Jev decision artifact ID" }),
241
+ "--kind": Object.freeze({ targetKey: "semanticPlanKind", parseType: "string", takesValue: true, valueName: "failure|diagnosis|review", missingValueMessage: "--kind requires failure, diagnosis, or review", description: "bounded semantic planning projection" }),
242
+ "--input": Object.freeze({ targetKey: "semanticPlanInput", parseType: "json-object", takesValue: true, valueName: "json", missingValueMessage: "--input requires a JSON object", description: "bounded failure, diagnosis, or review context" }),
243
+ "--json": Object.freeze({ targetKey: "json", parseType: "boolean", takesValue: false, description: "emit semantic plan projection as JSON" }),
244
+ }),
245
+ writes: [], removes: [], mayExecuteExternalProcess: false,
246
+ description: "Projects fail-closed failure triage, diagnosis priority, or review planning without authority.",
247
+ }),
248
+ "test-inventory": Object.freeze({
249
+ name: "test-inventory",
250
+ category: "diagnostics",
251
+ mutation: "READ_ONLY",
252
+ options: Object.freeze({
253
+ ...CLI_COMMON_OPTIONS,
254
+ "--json": Object.freeze({ targetKey: "json", parseType: "boolean", takesValue: false, description: "emit deterministic test inventory as JSON" }),
255
+ }),
256
+ writes: [], removes: [], mayExecuteExternalProcess: false,
257
+ description: "Discovers tests deterministically and assigns stable semantic test IDs without pruning authority.",
258
+ }),
259
+ "test-utility": Object.freeze({
260
+ name: "test-utility",
261
+ category: "diagnostics",
262
+ mutation: "MUTATING",
263
+ options: Object.freeze({
264
+ ...CLI_COMMON_OPTIONS,
265
+ ...CLI_TASK_OPTION,
266
+ "--json": Object.freeze({ targetKey: "json", parseType: "boolean", takesValue: false, description: "emit test utility analysis as JSON" }),
267
+ }),
268
+ writes: [".forgeloop/task-state/<taskKey>/test-utility.json"], removes: [], mayExecuteExternalProcess: false,
269
+ description: "Persists non-evidence test utility analysis; never deletes tests or authorizes pruning.",
270
+ }),
271
+ "test-prune-plan": Object.freeze({
272
+ name: "test-prune-plan", category: "diagnostics", mutation: "READ_ONLY",
273
+ options: Object.freeze({ ...CLI_COMMON_OPTIONS, ...CLI_TASK_OPTION, "--json": Object.freeze({ targetKey: "json", parseType: "boolean", takesValue: false, description: "emit test prune plan as JSON" }) }),
274
+ writes: [], removes: [], mayExecuteExternalProcess: false,
275
+ description: "Projects KEEP, PROBE_REMOVAL, or BLOCKED without deleting tests.",
276
+ }),
277
+ "test-prune-probe": Object.freeze({
278
+ name: "test-prune-probe", category: "verification", mutation: "EXTERNAL_EXECUTION",
279
+ options: Object.freeze({ ...CLI_COMMON_OPTIONS, ...CLI_TASK_OPTION, "--test": Object.freeze({ targetKey: "testId", parseType: "string", takesValue: true, valueName: "id", missingValueMessage: "--test requires a test ID", description: "stable test ID to probe in isolation" }), "--json": Object.freeze({ targetKey: "json", parseType: "boolean", takesValue: false, description: "emit test prune probe as JSON" }) }),
280
+ writes: [], removes: [], mayExecuteExternalProcess: true,
281
+ description: "Runs only an isolated, fail-closed removal probe; never modifies the live worktree.",
282
+ }),
283
+ discover: Object.freeze({
284
+ name: "discover",
285
+ category: "lifecycle",
286
+ mutation: "MUTATING",
287
+ options: Object.freeze({
288
+ ...CLI_COMMON_OPTIONS,
289
+ ...CLI_TASK_OPTION,
290
+ "--json": Object.freeze({ targetKey: "json", parseType: "boolean", takesValue: false, description: "emit structured discovery output as JSON" }),
291
+ }),
292
+ writes: [".forgeloop/task-state/<taskKey>/events.ndjson"],
293
+ removes: [],
294
+ mayExecuteExternalProcess: false,
295
+ description: "Records the canonical initial discovery milestone for a newly created task.",
296
+ }),
297
+ "contract-create": Object.freeze({
298
+ name: "contract-create",
299
+ category: "lifecycle",
300
+ mutation: "MUTATING",
301
+ options: Object.freeze({
302
+ ...CLI_COMMON_OPTIONS,
303
+ ...CLI_TASK_OPTION,
304
+ "--contract-file": Object.freeze({ targetKey: "contractFile", parseType: "string", takesValue: true, valueName: "path", missingValueMessage: "--contract-file requires a path", description: "validated JSON contract relative to the target" }),
305
+ "--preset": Object.freeze({ targetKey: "preset", parseType: "string", takesValue: true, valueName: "name", missingValueMessage: "--preset requires a name", description: "bounded contract preset: documentation, bug, feature, or release" }),
306
+ "--json": Object.freeze({ targetKey: "json", parseType: "boolean", takesValue: false, description: "emit structured contract output as JSON" }),
307
+ }),
308
+ writes: [".forgeloop/task-state/<taskKey>/contract.json", ".forgeloop/task-state/<taskKey>/work-state.json", ".forgeloop/task-state/<taskKey>/events.ndjson"],
309
+ removes: [],
310
+ mayExecuteExternalProcess: false,
311
+ description: "Persists a validated contract and materializes the first real lifecycle checkpoint.",
312
+ }),
313
+ "contract-revise": Object.freeze({
314
+ name: "contract-revise",
315
+ category: "project-maintenance",
316
+ mutation: "MUTATING",
317
+ options: Object.freeze({
318
+ ...CLI_COMMON_OPTIONS,
319
+ ...CLI_TASK_OPTION,
320
+ "--contract-file": Object.freeze({ targetKey: "contractFile", parseType: "string", takesValue: true, valueName: "path", missingValueMessage: "--contract-file requires a path", description: "validated replacement JSON contract relative to the target" }),
321
+ "--preset": Object.freeze({ targetKey: "preset", parseType: "string", takesValue: true, valueName: "name", missingValueMessage: "--preset requires a name", description: "bounded replacement contract preset: documentation, bug, feature, or release" }),
322
+ "--json": Object.freeze({ targetKey: "json", parseType: "boolean", takesValue: false, description: "emit structured contract revision output as JSON" }),
323
+ }),
324
+ writes: [".forgeloop/task-state/<taskKey>/contract.json", ".forgeloop/task-state/<taskKey>/work-state.json", ".forgeloop/task-state/<taskKey>/events.ndjson"],
325
+ removes: [],
326
+ mayExecuteExternalProcess: false,
327
+ description: "Replaces an existing contract canonically before execution while preserving task identity and invalidating derived evidence.",
328
+ }),
329
+ "gate-record": Object.freeze({
330
+ name: "gate-record", category: "lifecycle", mutation: "MUTATING",
331
+ options: Object.freeze({ ...CLI_COMMON_OPTIONS, ...CLI_TASK_OPTION,
332
+ "--gate": Object.freeze({ targetKey: "gate", parseType: "string", takesValue: true, valueName: "name", missingValueMessage: "--gate requires a name", description: "required gate name" }),
333
+ "--status": Object.freeze({ targetKey: "gateStatus", parseType: "string", takesValue: true, valueName: "status", missingValueMessage: "--status requires a status", description: "satisfied, unverified, or blocked" }),
334
+ "--artifact": Object.freeze({ targetKey: "gateArtifacts", parseType: "string", takesValue: true, repeatable: true, valueName: "path", missingValueMessage: "--artifact requires a path", description: "project-relative evidence artifact" }),
335
+ "--decision": Object.freeze({ targetKey: "gateDecisions", parseType: "string", takesValue: true, repeatable: true, valueName: "text", missingValueMessage: "--decision requires text", description: "caller-recorded gate decision" }),
336
+ "--unknown": Object.freeze({ targetKey: "gateUnknowns", parseType: "string", takesValue: true, repeatable: true, valueName: "text", missingValueMessage: "--unknown requires text", description: "known unresolved item" }),
337
+ "--assumption": Object.freeze({ targetKey: "gateAssumptions", parseType: "string", takesValue: true, repeatable: true, valueName: "text", missingValueMessage: "--assumption requires text", description: "approved local assumption" }),
338
+ "--evidence-file": Object.freeze({ targetKey: "gateEvidenceFile", parseType: "string", takesValue: true, valueName: "path", missingValueMessage: "--evidence-file requires a path", description: "bounded local descriptive evidence JSON" }),
339
+ "--json": Object.freeze({ targetKey: "json", parseType: "boolean", takesValue: false, description: "emit structured gate output as JSON" }),
340
+ }),
341
+ writes: [".forgeloop/task-state/<taskKey>/gates/<gate>.json"], removes: [], mayExecuteExternalProcess: false,
342
+ description: "Records a required pre-execution gate with ForgeLoop-owned artifact hashes.",
343
+ }),
344
+ "gate-revalidate": Object.freeze({
345
+ name: "gate-revalidate", category: "lifecycle", mutation: "MUTATING",
346
+ options: Object.freeze({ ...CLI_COMMON_OPTIONS, ...CLI_TASK_OPTION,
347
+ "--gate": Object.freeze({ targetKey: "gate", parseType: "string", takesValue: true, valueName: "name", missingValueMessage: "--gate requires a name", description: "satisfied gate to refresh after safe artifact drift" }),
348
+ "--acknowledge-stale": Object.freeze({ targetKey: "acknowledgeStale", parseType: "boolean", takesValue: false, description: "explicitly acknowledge refresh of stale gate artifacts inside active task claims" }),
349
+ "--json": Object.freeze({ targetKey: "json", parseType: "boolean", takesValue: false, description: "emit structured gate revalidation output as JSON" }),
350
+ }),
351
+ writes: [".forgeloop/task-state/<taskKey>/gates/<gate>.json", ".forgeloop/task-state/<taskKey>/events.ndjson"], removes: [], mayExecuteExternalProcess: false,
352
+ description: "Refreshes a stale satisfied gate after execution only when current identity and active claims prove the change is safe.",
353
+ }),
74
354
  init: Object.freeze({
75
355
  name: "init",
76
356
  category: "project-maintenance",
@@ -976,6 +1256,20 @@ export const CLI_COMMAND_DEFINITIONS = Object.freeze({
976
1256
  mayExecuteExternalProcess: false,
977
1257
  description: "Removes work-state.json for the active task only, preserving sibling contract, routing, and ledger files.",
978
1258
  }),
1259
+ "checkpoint-revalidate": Object.freeze({
1260
+ name: "checkpoint-revalidate",
1261
+ category: "project-maintenance",
1262
+ mutation: "MUTATING",
1263
+ options: Object.freeze({
1264
+ ...CLI_COMMON_OPTIONS,
1265
+ ...CLI_TASK_OPTION,
1266
+ "--json": Object.freeze({ targetKey: "json", parseType: "boolean", takesValue: false, description: "emit structured revalidation output as JSON" }),
1267
+ }),
1268
+ writes: [".forgeloop/task-state/<taskKey>/work-state.json", ".forgeloop/task-state/<taskKey>/events.ndjson"],
1269
+ removes: [],
1270
+ mayExecuteExternalProcess: false,
1271
+ description: "Revalidates a safe ROUTED checkpoint after repository-only drift without changing contract or route identity.",
1272
+ }),
979
1273
  "reconcile-closure": Object.freeze({
980
1274
  name: "reconcile-closure",
981
1275
  category: "lifecycle",
@@ -992,7 +1286,7 @@ export const CLI_COMMAND_DEFINITIONS = Object.freeze({
992
1286
  writes: [".forgeloop/task-state/<taskKey>/executions/exec-<id>.json", ".forgeloop/task-state/<taskKey>/work-state.json", ".forgeloop/task-state/<taskKey>/events.ndjson"],
993
1287
  removes: [],
994
1288
  mayExecuteExternalProcess: true,
995
- description: "Refreshes the work-state checkpoint of an EXECUTING, VERIFYING, or REVIEWING task whose objective is already satisfied in the current repository, after contract-bound executed evidence, so canonical completion can proceed.",
1289
+ description: "Refreshes the work-state checkpoint of an EXECUTING, VERIFYING, CORRECTING, or REVIEWING task whose objective is already satisfied in the current repository, after contract-bound executed evidence, so canonical completion can proceed.",
996
1290
  }),
997
1291
  "validate-receipt": Object.freeze({
998
1292
  name: "validate-receipt",
@@ -1115,13 +1409,15 @@ export const CLI_COMMAND_DEFINITIONS = Object.freeze({
1115
1409
  mutation: "MUTATING",
1116
1410
  options: Object.freeze({
1117
1411
  ...CLI_COMMON_OPTIONS,
1412
+ "--destination": Object.freeze({ targetKey: "destination", parseType: "string", takesValue: true, valueName: "path", description: "retained source and publication evidence destination" }),
1413
+ "--writers-quiesced": Object.freeze({ targetKey: "writersQuiesced", parseType: "boolean", takesValue: false, description: "confirm all legacy writers are stopped and excluded" }),
1118
1414
  "--dry-run": Object.freeze({ targetKey: "dryRun", parseType: "boolean", takesValue: false, description: "show planned migration actions without moving files" }),
1119
1415
  "--json": Object.freeze({ targetKey: "json", parseType: "boolean", takesValue: false, description: "emit structured output as JSON" }),
1120
1416
  }),
1121
- writes: [".forgeloop/task-state/<taskKey>/*"],
1417
+ writes: [".forgeloop/state.sqlite", ".forgeloop/storage-version.json", "<destination>/*"],
1122
1418
  removes: [".forgeloop/current-contract.json", ".forgeloop/routing-result.json", ".forgeloop/work-state.json", ".forgeloop/preflight.json", ".forgeloop/execution-receipt.json", ".forgeloop/events.ndjson", ".forgeloop/continuity.json", ".forgeloop/gates", ".forgeloop/executions"],
1123
1419
  mayExecuteExternalProcess: false,
1124
- description: "Migrates a legacy 1.0 singleton task state layout into a task-namespaced layout.",
1420
+ description: "Migrates legacy singleton task state into SQLite with retained source and verified publication evidence.",
1125
1421
  }),
1126
1422
  "migrate-protocol": Object.freeze({
1127
1423
  name: "migrate-protocol",
@@ -1129,11 +1425,13 @@ export const CLI_COMMAND_DEFINITIONS = Object.freeze({
1129
1425
  mutation: "MUTATING",
1130
1426
  options: Object.freeze({
1131
1427
  ...CLI_COMMON_OPTIONS,
1428
+ "--destination": Object.freeze({ targetKey: "destination", parseType: "string", takesValue: true, valueName: "path", description: "retained source and publication evidence destination" }),
1429
+ "--writers-quiesced": Object.freeze({ targetKey: "writersQuiesced", parseType: "boolean", takesValue: false, description: "confirm all legacy writers are stopped and excluded" }),
1132
1430
  "--to": Object.freeze({ targetKey: "to", parseType: "string", takesValue: true, valueName: "protocolVersion", missingValueMessage: "--to requires a protocol version", description: "target supported protocol version" }),
1133
1431
  "--dry-run": Object.freeze({ targetKey: "dryRun", parseType: "boolean", takesValue: false, description: "show migration actions without writing or deleting artifacts" }),
1134
1432
  "--json": Object.freeze({ targetKey: "json", parseType: "boolean", takesValue: false, description: "emit structured migration result as JSON" }),
1135
1433
  }),
1136
- writes: [".forgeloop/task-state/<taskKey>/*"],
1434
+ writes: [".forgeloop/state.sqlite", ".forgeloop/storage-version.json", "<destination>/*"],
1137
1435
  removes: [".forgeloop/current-contract.json", ".forgeloop/routing-result.json", ".forgeloop/work-state.json", ".forgeloop/preflight.json", ".forgeloop/execution-receipt.json", ".forgeloop/events.ndjson", ".forgeloop/continuity.json", ".forgeloop/gates", ".forgeloop/executions"],
1138
1436
  mayExecuteExternalProcess: false,
1139
1437
  description: "Safely migrates explicitly supported protocol state; unknown target versions fail without rewriting artifacts.",
@@ -1149,10 +1447,10 @@ export const CLI_COMMAND_DEFINITIONS = Object.freeze({
1149
1447
  "--stale-only": Object.freeze({ targetKey: "staleOnly", parseType: "boolean", takesValue: false, description: "release only a lock whose lease is expired" }),
1150
1448
  "--json": Object.freeze({ targetKey: "json", parseType: "boolean", takesValue: false, description: "emit structured output as JSON" }),
1151
1449
  }),
1152
- writes: [],
1153
- removes: [".forgeloop/locks/<taskKey>.lock"],
1450
+ writes: [".forgeloop/state.sqlite"],
1451
+ removes: [],
1154
1452
  mayExecuteExternalProcess: false,
1155
- description: "Removes an orphaned task lock file to recover an interrupted task.",
1453
+ description: "Releases a canonical SQLite operation lease to recover an interrupted task.",
1156
1454
  }),
1157
1455
  "task-recover": Object.freeze({
1158
1456
  name: "task-recover",
@@ -1170,6 +1468,51 @@ export const CLI_COMMAND_DEFINITIONS = Object.freeze({
1170
1468
  mayExecuteExternalProcess: false,
1171
1469
  description: "Caller-acknowledged recovery of a STALE or ABANDONED task; records durable state and releases effective write claims.",
1172
1470
  }),
1471
+ "task-abandon": Object.freeze({
1472
+ name: "task-abandon",
1473
+ category: "project-maintenance",
1474
+ mutation: "MUTATING",
1475
+ options: Object.freeze({
1476
+ ...CLI_COMMON_OPTIONS,
1477
+ ...CLI_TASK_OPTION,
1478
+ "--acknowledge-abandonment": Object.freeze({ targetKey: "acknowledgeAbandonment", parseType: "boolean", takesValue: false, description: "explicitly acknowledge abandonment of an active task (required; not completion authority)" }),
1479
+ "--json": Object.freeze({ targetKey: "json", parseType: "boolean", takesValue: false, description: "emit structured abandonment output as JSON" }),
1480
+ }),
1481
+ writes: [".forgeloop/task-state/<taskKey>/recovery.json", ".forgeloop/task-state/<taskKey>/events.ndjson"],
1482
+ removes: [],
1483
+ mayExecuteExternalProcess: false,
1484
+ description: "Explicitly abandons an active non-terminal task; records append-only evidence and releases claims without completion authority.",
1485
+ }),
1486
+ "task-repair-contract-bootstrap": Object.freeze({
1487
+ name: "task-repair-contract-bootstrap",
1488
+ category: "project-maintenance",
1489
+ mutation: "MUTATING",
1490
+ options: Object.freeze({
1491
+ ...CLI_COMMON_OPTIONS,
1492
+ ...CLI_TASK_OPTION,
1493
+ "--acknowledge-repair": Object.freeze({ targetKey: "acknowledgeRepair", parseType: "boolean", takesValue: false, description: "explicit caller acknowledgement of the exact append-only repair (required)" }),
1494
+ "--json": Object.freeze({ targetKey: "json", parseType: "boolean", takesValue: false, description: "emit structured repair output as JSON" }),
1495
+ }),
1496
+ writes: [".forgeloop/task-state/<taskKey>/work-state.json", ".forgeloop/task-state/<taskKey>/events.ndjson"],
1497
+ removes: [],
1498
+ mayExecuteExternalProcess: false,
1499
+ description: "Repairs the exact duplicate contract bootstrap defect without rewriting history; idempotent and append-only.",
1500
+ }),
1501
+ "task-migrate-contract-bootstrap-repair": Object.freeze({
1502
+ name: "task-migrate-contract-bootstrap-repair",
1503
+ category: "project-maintenance",
1504
+ mutation: "MUTATING",
1505
+ options: Object.freeze({
1506
+ ...CLI_COMMON_OPTIONS,
1507
+ ...CLI_TASK_OPTION,
1508
+ "--acknowledge-migration": Object.freeze({ targetKey: "acknowledgeMigration", parseType: "boolean", takesValue: false, description: "fresh explicit caller acknowledgement of the exact legacy marker migration (required)" }),
1509
+ "--json": Object.freeze({ targetKey: "json", parseType: "boolean", takesValue: false, description: "emit structured migration output as JSON" }),
1510
+ }),
1511
+ writes: [".forgeloop/task-state/<taskKey>/events.ndjson"],
1512
+ removes: [],
1513
+ mayExecuteExternalProcess: false,
1514
+ description: "Migrates the exact legacy contract bootstrap repair marker by appending a bound migration event; the original marker and artifacts remain unchanged.",
1515
+ }),
1173
1516
  "task-repair-legacy-recovery": Object.freeze({
1174
1517
  name: "task-repair-legacy-recovery",
1175
1518
  category: "project-maintenance",
@@ -1,3 +1,4 @@
1
+ import { withTaskTransaction } from "./transaction.js";
1
2
  import { createHash } from "node:crypto";
2
3
  import path from "node:path";
3
4
 
@@ -15,6 +16,7 @@ import {
15
16
  taskCodeManifestHistoryPath,
16
17
  } from "./task-paths.js";
17
18
  import { ensureWithin, fileExists } from "./filesystem.js";
19
+ import { operationalArtifactExists } from "../storage/operational-context.js";
18
20
  import { resolveRevisionProvider } from "./revision/provider.js";
19
21
  import { REVISION_PROVIDERS } from "./revision/registry.js";
20
22
 
@@ -217,10 +219,14 @@ export async function readCodeManifest({ target, packageRoot = getPackageRoot(),
217
219
  }
218
220
  }
219
221
 
220
- export async function writeCodeManifest({ target, packageRoot = getPackageRoot(), taskId, manifest } = {}) {
222
+ export async function writeCodeManifest(options = {}) {
223
+ return withTaskTransaction({ target: options.target, taskId: options.taskId, packageRoot: options.packageRoot, operation: "code-manifest-capture" }, () => writeCodeManifestInTransaction(options));
224
+ }
225
+
226
+ async function writeCodeManifestInTransaction({ target, packageRoot = getPackageRoot(), taskId, manifest } = {}) {
221
227
  const value = await validateCodeManifest(manifest, packageRoot);
222
228
  const relativePath = taskCodeManifestPath(taskId);
223
- if (await fileExists(ensureWithin(target, relativePath))) {
229
+ if (operationalArtifactExists(target, relativePath) ?? await fileExists(ensureWithin(target, relativePath))) {
224
230
  let previous;
225
231
  try {
226
232
  previous = await readCodeManifest({ target, packageRoot, taskId });
@@ -232,7 +238,7 @@ export async function writeCodeManifest({ target, packageRoot = getPackageRoot()
232
238
  throw manifestError("E_ATTESTATION_MANIFEST_INVALID", "Code manifest is immutable within a verification cycle", [relativePath]);
233
239
  }
234
240
  const historyPath = taskCodeManifestHistoryPath(taskId, previousCycle);
235
- if (!(await fileExists(ensureWithin(target, historyPath)))) {
241
+ if (!(operationalArtifactExists(target, historyPath) ?? await fileExists(ensureWithin(target, historyPath)))) {
236
242
  await writeJsonArtifact(target, historyPath, previous.value, "code-manifest", packageRoot, { taskId, operation: "code-manifest-history" });
237
243
  }
238
244
  }