@webpresso/agent-kit 3.1.30 → 3.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of @webpresso/agent-kit might be problematic. Click here for more details.

Files changed (300) hide show
  1. package/README.md +53 -15
  2. package/bin/_run.js +183 -20
  3. package/catalog/AGENTS.md.tpl +3 -3
  4. package/catalog/agent/agents/implementer.md +45 -0
  5. package/catalog/agent/rules/parallel-orchestration-quota.md +100 -0
  6. package/catalog/agent/rules/pre-implementation.md +28 -1
  7. package/catalog/agent/rules/supported-agent-clis.md +9 -0
  8. package/catalog/agent/rules/typescript-version.md +50 -0
  9. package/catalog/agent/skills/codex/SKILL.md +25 -1
  10. package/catalog/agent/skills/verify/SKILL.md +4 -2
  11. package/catalog/docs/templates/blueprint.md +1 -1
  12. package/dist/esm/audit/agents.js +1 -0
  13. package/dist/esm/audit/blueprint-lifecycle-sql.d.ts +12 -0
  14. package/dist/esm/audit/blueprint-lifecycle-sql.js +23 -2
  15. package/dist/esm/audit/blueprint-pr-coverage.js +4 -0
  16. package/dist/esm/audit/blueprint-trust.js +14 -10
  17. package/dist/esm/audit/changeset-evidence.d.ts +23 -0
  18. package/dist/esm/audit/changeset-evidence.js +30 -0
  19. package/dist/esm/audit/changeset-required.d.ts +10 -0
  20. package/dist/esm/audit/changeset-required.js +73 -0
  21. package/dist/esm/audit/ci-guardrails-detection.d.ts +27 -0
  22. package/dist/esm/audit/ci-guardrails-detection.js +68 -0
  23. package/dist/esm/audit/ci-guardrails-wiring.d.ts +22 -0
  24. package/dist/esm/audit/ci-guardrails-wiring.js +80 -0
  25. package/dist/esm/audit/ci-test-perf.js +30 -0
  26. package/dist/esm/audit/command-surface.js +4 -2
  27. package/dist/esm/audit/host-substitution-risk.d.ts +2 -0
  28. package/dist/esm/audit/host-substitution-risk.js +256 -0
  29. package/dist/esm/audit/registry.d.ts +4 -4
  30. package/dist/esm/audit/registry.js +13 -1
  31. package/dist/esm/audit/toolchain-isolation.js +1 -2
  32. package/dist/esm/audit/typescript-version.d.ts +2 -0
  33. package/dist/esm/audit/typescript-version.js +123 -0
  34. package/dist/esm/blueprint/core/parser.js +101 -2
  35. package/dist/esm/blueprint/core/schema.d.ts +1 -0
  36. package/dist/esm/blueprint/core/schema.js +26 -0
  37. package/dist/esm/blueprint/core/validation/criteria.d.ts +14 -0
  38. package/dist/esm/blueprint/core/validation/criteria.js +41 -2
  39. package/dist/esm/blueprint/core/validation/state.js +25 -14
  40. package/dist/esm/blueprint/db/migrations/run.js +4 -2
  41. package/dist/esm/blueprint/lifecycle/audit.d.ts +20 -0
  42. package/dist/esm/blueprint/lifecycle/audit.js +87 -20
  43. package/dist/esm/blueprint/lifecycle/canonicalize.d.ts +6 -0
  44. package/dist/esm/blueprint/lifecycle/canonicalize.js +135 -0
  45. package/dist/esm/blueprint/lifecycle/local.d.ts +2 -1
  46. package/dist/esm/blueprint/lifecycle/local.js +19 -3
  47. package/dist/esm/blueprint/lifecycle/review-provenance.d.ts +6 -0
  48. package/dist/esm/blueprint/lifecycle/review-provenance.js +68 -12
  49. package/dist/esm/blueprint/lifecycle/rollout-anchor.d.ts +97 -0
  50. package/dist/esm/blueprint/lifecycle/rollout-anchor.js +161 -0
  51. package/dist/esm/blueprint/service/BlueprintCreationService.d.ts +1 -0
  52. package/dist/esm/blueprint/service/BlueprintCreationService.js +53 -4
  53. package/dist/esm/blueprint/service/blueprint-tech-debt-links.js +16 -2
  54. package/dist/esm/blueprint/sync/client.d.ts +2 -1
  55. package/dist/esm/blueprint/sync/client.js +1 -1
  56. package/dist/esm/blueprint/trust/command-runner.d.ts +26 -0
  57. package/dist/esm/blueprint/trust/command-runner.js +148 -0
  58. package/dist/esm/blueprint/trust/dossier.d.ts +1 -0
  59. package/dist/esm/blueprint/trust/dossier.js +40 -6
  60. package/dist/esm/blueprint/trust/gates.d.ts +7 -0
  61. package/dist/esm/blueprint/trust/gates.js +20 -0
  62. package/dist/esm/blueprint/trust/promotion.d.ts +8 -0
  63. package/dist/esm/blueprint/trust/promotion.js +74 -112
  64. package/dist/esm/blueprint/trust/scaffold.d.ts +19 -0
  65. package/dist/esm/blueprint/trust/scaffold.js +64 -0
  66. package/dist/esm/blueprint/trust/validator.d.ts +1 -0
  67. package/dist/esm/blueprint/trust/validator.js +7 -1
  68. package/dist/esm/blueprint/utils/archive.js +27 -5
  69. package/dist/esm/blueprint/utils/document-paths.d.ts +18 -0
  70. package/dist/esm/blueprint/utils/document-paths.js +45 -12
  71. package/dist/esm/build/cli-mcp-parity.js +15 -0
  72. package/dist/esm/cli/bundle/commands/blueprint.d.ts +1 -0
  73. package/dist/esm/cli/bundle/commands/blueprint.js +1 -0
  74. package/dist/esm/cli/cli.d.ts +1 -1
  75. package/dist/esm/cli/cli.js +43 -0
  76. package/dist/esm/cli/commands/agent-launch.d.ts +8 -1
  77. package/dist/esm/cli/commands/agent-launch.js +93 -4
  78. package/dist/esm/cli/commands/audit-core.d.ts +1 -1
  79. package/dist/esm/cli/commands/audit-core.js +8 -1
  80. package/dist/esm/cli/commands/audit.js +21 -5
  81. package/dist/esm/cli/commands/blueprint/execution.js +18 -6
  82. package/dist/esm/cli/commands/blueprint/mutations.js +59 -40
  83. package/dist/esm/cli/commands/blueprint/router-dispatch.d.ts +2 -1
  84. package/dist/esm/cli/commands/blueprint/router-dispatch.js +20 -1
  85. package/dist/esm/cli/commands/blueprint/router-output.d.ts +21 -0
  86. package/dist/esm/cli/commands/blueprint/router-output.js +48 -17
  87. package/dist/esm/cli/commands/blueprint/router.d.ts +7 -0
  88. package/dist/esm/cli/commands/blueprint/router.js +13 -1
  89. package/dist/esm/cli/commands/ci-preflight.d.ts +13 -2
  90. package/dist/esm/cli/commands/ci-preflight.js +30 -6
  91. package/dist/esm/cli/commands/compile.js +5 -31
  92. package/dist/esm/cli/commands/dash/delivery-status.d.ts +1 -0
  93. package/dist/esm/cli/commands/dash/delivery-status.js +11 -4
  94. package/dist/esm/cli/commands/doctor.js +5 -0
  95. package/dist/esm/cli/commands/hook.d.ts +5 -0
  96. package/dist/esm/cli/commands/hook.js +15 -9
  97. package/dist/esm/cli/commands/init/config.js +2 -2
  98. package/dist/esm/cli/commands/init/convergence-apply.d.ts +88 -0
  99. package/dist/esm/cli/commands/init/convergence-apply.js +325 -0
  100. package/dist/esm/cli/commands/init/convergence-state.d.ts +13 -0
  101. package/dist/esm/cli/commands/init/convergence-state.js +54 -0
  102. package/dist/esm/cli/commands/init/convergence.d.ts +23 -0
  103. package/dist/esm/cli/commands/init/convergence.js +57 -0
  104. package/dist/esm/cli/commands/init/git-convergence.d.ts +19 -0
  105. package/dist/esm/cli/commands/init/git-convergence.js +168 -0
  106. package/dist/esm/cli/commands/init/gitignore-patcher.js +2 -0
  107. package/dist/esm/cli/commands/init/grok-privacy-smoke.d.ts +52 -0
  108. package/dist/esm/cli/commands/init/grok-privacy-smoke.js +91 -0
  109. package/dist/esm/cli/commands/init/host-native-proof.d.ts +18 -0
  110. package/dist/esm/cli/commands/init/host-native-proof.js +88 -0
  111. package/dist/esm/cli/commands/init/host-visibility.d.ts +2 -2
  112. package/dist/esm/cli/commands/init/host-visibility.js +94 -5
  113. package/dist/esm/cli/commands/init/index.d.ts +3 -0
  114. package/dist/esm/cli/commands/init/index.js +326 -173
  115. package/dist/esm/cli/commands/init/mcp-spec.d.ts +57 -0
  116. package/dist/esm/cli/commands/init/mcp-spec.js +273 -0
  117. package/dist/esm/cli/commands/init/merge.d.ts +1 -0
  118. package/dist/esm/cli/commands/init/merge.js +30 -1
  119. package/dist/esm/cli/commands/init/package-root.d.ts +7 -0
  120. package/dist/esm/cli/commands/init/package-root.js +10 -2
  121. package/dist/esm/cli/commands/init/plugin-cache-prune.d.ts +0 -3
  122. package/dist/esm/cli/commands/init/plugin-cache-prune.js +0 -1
  123. package/dist/esm/cli/commands/init/scaffold-agents-md.d.ts +1 -1
  124. package/dist/esm/cli/commands/init/scaffold-agents-md.js +9 -3
  125. package/dist/esm/cli/commands/init/scaffold-base-kit.d.ts +20 -0
  126. package/dist/esm/cli/commands/init/scaffold-base-kit.js +61 -5
  127. package/dist/esm/cli/commands/init/scaffolders/agent-hooks/emitters/grok.d.ts +14 -8
  128. package/dist/esm/cli/commands/init/scaffolders/agent-hooks/emitters/grok.js +41 -24
  129. package/dist/esm/cli/commands/init/scaffolders/agent-hooks/index.d.ts +2 -0
  130. package/dist/esm/cli/commands/init/scaffolders/agent-hooks/index.js +54 -24
  131. package/dist/esm/cli/commands/init/scaffolders/codex-mcp/index.d.ts +12 -31
  132. package/dist/esm/cli/commands/init/scaffolders/codex-mcp/index.js +288 -202
  133. package/dist/esm/cli/commands/init/scaffolders/file-transaction.d.ts +22 -0
  134. package/dist/esm/cli/commands/init/scaffolders/file-transaction.js +230 -0
  135. package/dist/esm/cli/commands/init/scaffolders/grok-mcp/index.d.ts +38 -0
  136. package/dist/esm/cli/commands/init/scaffolders/grok-mcp/index.js +73 -0
  137. package/dist/esm/cli/commands/init/scaffolders/opencode-plugin/index.d.ts +21 -0
  138. package/dist/esm/cli/commands/init/scaffolders/opencode-plugin/index.js +559 -63
  139. package/dist/esm/cli/commands/init/untracked-collision.d.ts +14 -0
  140. package/dist/esm/cli/commands/init/untracked-collision.js +42 -0
  141. package/dist/esm/cli/commands/opencode-probe.d.ts +107 -0
  142. package/dist/esm/cli/commands/opencode-probe.js +323 -0
  143. package/dist/esm/cli/commands/opencode-rotate.d.ts +72 -0
  144. package/dist/esm/cli/commands/opencode-rotate.js +147 -0
  145. package/dist/esm/cli/commands/public-readiness.d.ts +11 -0
  146. package/dist/esm/cli/commands/public-readiness.js +42 -0
  147. package/dist/esm/cli/commands/quality-runner.js +3 -3
  148. package/dist/esm/cli/commands/review.d.ts +35 -3
  149. package/dist/esm/cli/commands/review.js +751 -209
  150. package/dist/esm/cli/commands/run-wait.d.ts +2 -0
  151. package/dist/esm/cli/commands/run-wait.js +122 -0
  152. package/dist/esm/cli/commands/rust-check.d.ts +24 -0
  153. package/dist/esm/cli/commands/rust-check.js +110 -0
  154. package/dist/esm/cli/commands/setup-help.js +1 -1
  155. package/dist/esm/cli/commands/setup-repair-help.js +1 -1
  156. package/dist/esm/cli/commands/typecheck.d.ts +1 -0
  157. package/dist/esm/cli/commands/typecheck.js +30 -1
  158. package/dist/esm/cli/commands/worktree/router-dispatch.d.ts +6 -0
  159. package/dist/esm/cli/commands/worktree/router-dispatch.js +126 -9
  160. package/dist/esm/cli/commands/worktree/router.js +10 -0
  161. package/dist/esm/cli/direct-provider-launch.js +9 -5
  162. package/dist/esm/cli/optional-tool-freshness.d.ts +27 -0
  163. package/dist/esm/cli/optional-tool-freshness.js +219 -9
  164. package/dist/esm/daemon/domains/git-actions.d.ts +29 -0
  165. package/dist/esm/daemon/domains/git-actions.js +136 -0
  166. package/dist/esm/daemon/domains/run-registry-interop.d.ts +16 -0
  167. package/dist/esm/daemon/domains/run-registry-interop.js +45 -0
  168. package/dist/esm/daemon/domains/sessions-search.d.ts +11 -0
  169. package/dist/esm/daemon/domains/sessions-search.js +29 -0
  170. package/dist/esm/daemon/handlers/blueprints-handlers.d.ts +5 -0
  171. package/dist/esm/daemon/handlers/blueprints-handlers.js +36 -0
  172. package/dist/esm/daemon/handlers/deploy-handlers.d.ts +6 -0
  173. package/dist/esm/daemon/handlers/deploy-handlers.js +5 -0
  174. package/dist/esm/daemon/handlers/fleet-handlers.d.ts +15 -0
  175. package/dist/esm/daemon/handlers/fleet-handlers.js +91 -0
  176. package/dist/esm/daemon/handlers/git-handlers.d.ts +6 -0
  177. package/dist/esm/daemon/handlers/git-handlers.js +27 -0
  178. package/dist/esm/daemon/handlers/product.d.ts +7 -0
  179. package/dist/esm/daemon/handlers/product.js +10 -119
  180. package/dist/esm/daemon/handlers/sessions-handlers.d.ts +12 -0
  181. package/dist/esm/daemon/handlers/sessions-handlers.js +31 -0
  182. package/dist/esm/daemon/handlers/shared.d.ts +5 -0
  183. package/dist/esm/daemon/handlers/shared.js +16 -0
  184. package/dist/esm/daemon/methods.d.ts +8 -1
  185. package/dist/esm/daemon/methods.js +7 -0
  186. package/dist/esm/daemon/protocol/contract.d.ts +43 -0
  187. package/dist/esm/daemon/protocol/contract.js +26 -0
  188. package/dist/esm/daemon/protocol/index.d.ts +1 -1
  189. package/dist/esm/daemon/protocol/index.js +1 -1
  190. package/dist/esm/hooks/__conformance__/matrix.d.ts +6 -0
  191. package/dist/esm/hooks/__conformance__/matrix.js +137 -0
  192. package/dist/esm/hooks/conformance/batch.js +5 -0
  193. package/dist/esm/hooks/doctor.d.ts +5 -3
  194. package/dist/esm/hooks/doctor.js +67 -16
  195. package/dist/esm/hooks/permission-request/index.js +9 -3
  196. package/dist/esm/hooks/permission-request/policy.d.ts +9 -0
  197. package/dist/esm/hooks/permission-request/policy.js +13 -0
  198. package/dist/esm/hooks/pretool-guard/dev-routing.d.ts +9 -0
  199. package/dist/esm/hooks/pretool-guard/dev-routing.js +41 -5
  200. package/dist/esm/hooks/pretool-guard/logger.d.ts +7 -0
  201. package/dist/esm/hooks/pretool-guard/logger.js +16 -0
  202. package/dist/esm/hooks/pretool-guard/runner.d.ts +6 -0
  203. package/dist/esm/hooks/pretool-guard/runner.js +68 -16
  204. package/dist/esm/hooks/pretool-guard/validators/blueprint.js +30 -10
  205. package/dist/esm/hooks/pretool-guard/validators/forbidden-commands.js +54 -0
  206. package/dist/esm/hooks/pretool-guard/validators/index.d.ts +7 -0
  207. package/dist/esm/hooks/pretool-guard/validators/index.js +21 -0
  208. package/dist/esm/hooks/pretool-guard/validators/path-contract.d.ts +19 -0
  209. package/dist/esm/hooks/pretool-guard/validators/path-contract.js +25 -8
  210. package/dist/esm/hooks/pretool-guard/validators/worktree-discipline.js +6 -1
  211. package/dist/esm/hooks/shared/guard-outcome.d.ts +149 -0
  212. package/dist/esm/hooks/shared/guard-outcome.js +215 -0
  213. package/dist/esm/hooks/shared/hook-bootstrap.d.ts +26 -0
  214. package/dist/esm/hooks/shared/hook-bootstrap.js +64 -1
  215. package/dist/esm/hooks/shared/types.d.ts +8 -5
  216. package/dist/esm/hooks/shared/types.js +50 -9
  217. package/dist/esm/hooks/stop/qa-changed-files.d.ts +11 -0
  218. package/dist/esm/hooks/stop/qa-changed-files.js +92 -0
  219. package/dist/esm/mcp/blueprint/_shared/lifecycle.js +14 -1
  220. package/dist/esm/mcp/blueprint/handlers/document-mutations.d.ts +5 -0
  221. package/dist/esm/mcp/blueprint/handlers/document-mutations.js +109 -11
  222. package/dist/esm/mcp/blueprint/handlers/review-log.js +8 -1
  223. package/dist/esm/mcp/blueprint/handlers/task-advance.js +113 -54
  224. package/dist/esm/mcp/blueprint/handlers/task-verify.js +39 -19
  225. package/dist/esm/mcp/blueprint/registration.js +3 -2
  226. package/dist/esm/mcp/server.d.ts +1 -0
  227. package/dist/esm/mcp/server.js +27 -0
  228. package/dist/esm/mcp/tools/_names.d.ts +1 -1
  229. package/dist/esm/mcp/tools/_names.js +5 -0
  230. package/dist/esm/mcp/tools/_registry.js +10 -0
  231. package/dist/esm/mcp/tools/_shared/audit-kinds.d.ts +1 -1
  232. package/dist/esm/mcp/tools/_shared/result.js +44 -1
  233. package/dist/esm/mcp/tools/audit.d.ts +5 -1
  234. package/dist/esm/mcp/tools/audit.js +42 -0
  235. package/dist/esm/mcp/tools/audits.d.ts +4 -0
  236. package/dist/esm/mcp/tools/ci-preflight.d.ts +50 -0
  237. package/dist/esm/mcp/tools/ci-preflight.js +183 -0
  238. package/dist/esm/mcp/tools/pr-upsert.js +39 -1
  239. package/dist/esm/mcp/tools/review-run.d.ts +28 -0
  240. package/dist/esm/mcp/tools/review-run.js +216 -0
  241. package/dist/esm/mcp/tools/run-wait.d.ts +86 -0
  242. package/dist/esm/mcp/tools/run-wait.js +593 -0
  243. package/dist/esm/mcp/tools/session-fetch-and-index.d.ts +1 -1
  244. package/dist/esm/mcp/tools/session-id.d.ts +3 -0
  245. package/dist/esm/mcp/tools/session-id.js +45 -0
  246. package/dist/esm/mcp/tools/session-info.d.ts +3 -0
  247. package/dist/esm/mcp/tools/session-info.js +49 -0
  248. package/dist/esm/output-transforms/audit.d.ts +23 -0
  249. package/dist/esm/output-transforms/audit.js +47 -0
  250. package/dist/esm/output-transforms/index.js +2 -0
  251. package/dist/esm/package.json +2 -0
  252. package/dist/esm/platform/client.d.ts +7 -1
  253. package/dist/esm/platform/github-contract-source.d.ts +2 -1
  254. package/dist/esm/pr-description/contract.js +24 -4
  255. package/dist/esm/review/authority.js +27 -14
  256. package/dist/esm/review/availability.d.ts +33 -0
  257. package/dist/esm/review/availability.js +122 -20
  258. package/dist/esm/review/delivery-verifier.d.ts +27 -0
  259. package/dist/esm/review/delivery-verifier.js +115 -0
  260. package/dist/esm/review/events.d.ts +3 -2
  261. package/dist/esm/review/events.js +23 -3
  262. package/dist/esm/review/execution/adapters.d.ts +11 -1
  263. package/dist/esm/review/execution/adapters.js +36 -10
  264. package/dist/esm/review/execution/artifacts.d.ts +1 -1
  265. package/dist/esm/review/execution/output-policy.d.ts +2 -0
  266. package/dist/esm/review/execution/output-policy.js +12 -0
  267. package/dist/esm/review/execution/review-checkout.js +121 -21
  268. package/dist/esm/review/execution/supervisor.js +36 -4
  269. package/dist/esm/review/execution/types.d.ts +9 -0
  270. package/dist/esm/review/opencode-account.d.ts +24 -0
  271. package/dist/esm/review/opencode-account.js +68 -0
  272. package/dist/esm/review/opencode-auth.d.ts +33 -0
  273. package/dist/esm/review/opencode-auth.js +79 -0
  274. package/dist/esm/review/subject.d.ts +25 -0
  275. package/dist/esm/review/subject.js +116 -26
  276. package/dist/esm/runtime/opencode-account-materializer.d.ts +34 -0
  277. package/dist/esm/runtime/opencode-account-materializer.js +33 -0
  278. package/dist/esm/rust/affected-manifests.d.ts +38 -0
  279. package/dist/esm/rust/affected-manifests.js +69 -0
  280. package/dist/esm/session-memory/fetch-index.d.ts +1 -1
  281. package/dist/esm/status/snapshot.js +32 -25
  282. package/dist/esm/test/duration-sequencer.d.ts +20 -0
  283. package/dist/esm/test/duration-sequencer.js +54 -0
  284. package/dist/esm/test/shard-durations.json +922 -0
  285. package/dist/esm/test/worker-budget.d.ts +6 -0
  286. package/dist/esm/test/worker-budget.js +59 -1
  287. package/dist/esm/test-helpers/global-setup.d.ts +1 -2
  288. package/dist/esm/test-helpers/global-setup.js +79 -32
  289. package/dist/esm/typecheck/planner.d.ts +9 -1
  290. package/dist/esm/typecheck/planner.js +31 -0
  291. package/dist/esm/ultragoal/service.d.ts +7 -0
  292. package/dist/esm/ultragoal/service.js +42 -2
  293. package/dist/esm/utils/write-json-file.js +3 -1
  294. package/dist/esm/worktrees/codex-project-trust.d.ts +15 -0
  295. package/dist/esm/worktrees/codex-project-trust.js +56 -0
  296. package/dist/esm/worktrees/orphan-scan.d.ts +50 -0
  297. package/dist/esm/worktrees/orphan-scan.js +211 -0
  298. package/dist/esm/worktrees/registry.d.ts +8 -0
  299. package/dist/esm/worktrees/registry.js +18 -3
  300. package/package.json +18 -13
@@ -1,25 +1,48 @@
1
1
  import { buildRoadmapModel, planStatusSchema } from "#local";
2
+ export const BLUEPRINT_SUBCOMMANDS = [
3
+ { name: "list", usage: ["list [status]"] },
4
+ {
5
+ name: "new",
6
+ usage: ["new <goal> --complexity <XS|S|M|L|XL> [--type <blueprint|parent-roadmap>]"],
7
+ },
8
+ { name: "show", usage: ["show <slug>"] },
9
+ {
10
+ name: "exec",
11
+ usage: [
12
+ "exec <slug>",
13
+ "exec status <slug>",
14
+ "exec resume <slug>",
15
+ "exec stop <slug>",
16
+ "exec logs <slug>",
17
+ ],
18
+ },
19
+ { name: "start", usage: ["start <slug>"] },
20
+ { name: "park", usage: ["park <slug>"] },
21
+ {
22
+ name: "task",
23
+ usage: [
24
+ "task start <slug> <taskId>",
25
+ "task block <slug> <taskId> --reason <text>",
26
+ "task unblock <slug> <taskId>",
27
+ "task complete <slug> <taskId>",
28
+ ],
29
+ },
30
+ { name: "finalize", usage: ["finalize <slug>"] },
31
+ { name: "promote", usage: ["promote <slug> <planned|in-progress|completed|parked>"] },
32
+ { name: "audit", usage: ["audit [--staged|--all] [--strict]"] },
33
+ { name: "move", usage: ["move <slug> <status> --force-recovery"] },
34
+ { name: "canonicalize", usage: ["canonicalize <slug>"] },
35
+ { name: "control", usage: ["control <status|resume|stop> <slug>"] },
36
+ { name: "logs", usage: ["logs <slug>"] },
37
+ { name: "db", usage: ["db <verb> [...args]"] },
38
+ { name: "export", usage: ["export --format spec-kit <slug>"] },
39
+ { name: "trust-dossier", usage: ["trust-dossier"] },
40
+ ];
2
41
  const BLUEPRINT_HELP = [
3
42
  "Blueprint management",
4
43
  "",
5
44
  "Commands:",
6
- " list [status]",
7
- " new <goal> --complexity <XS|S|M|L|XL> [--type <blueprint|parent-roadmap>]",
8
- " show <slug>",
9
- " exec <slug>",
10
- " exec status <slug>",
11
- " exec resume <slug>",
12
- " exec stop <slug>",
13
- " exec logs <slug>",
14
- " start <slug>",
15
- " park <slug>",
16
- " task start <slug> <taskId>",
17
- " task block <slug> <taskId> --reason <text>",
18
- " task unblock <slug> <taskId>",
19
- " task complete <slug> <taskId>",
20
- " finalize <slug>",
21
- " audit [--staged|--all] [--strict]",
22
- " move <slug> <status> --force-recovery",
45
+ ...BLUEPRINT_SUBCOMMANDS.flatMap((spec) => spec.usage.map((line) => ` ${line}`)),
23
46
  ].join("\n");
24
47
  export function formatTaskLine(task) {
25
48
  const checkbox = task.status === "done" || task.status === "dropped" ? "x" : " ";
@@ -28,6 +51,14 @@ export function formatTaskLine(task) {
28
51
  export function getBlueprintHelpText() {
29
52
  return BLUEPRINT_HELP;
30
53
  }
54
+ /**
55
+ * Subcommand names in registry order, for the unknown-subcommand error
56
+ * message. Kept as a function (rather than exporting a derived constant)
57
+ * so the source of truth stays singular: `BLUEPRINT_SUBCOMMANDS`.
58
+ */
59
+ export function getBlueprintSubcommandNames() {
60
+ return BLUEPRINT_SUBCOMMANDS.map((spec) => spec.name);
61
+ }
31
62
  export function summarizeBlueprintInventory(summaries) {
32
63
  const byStatus = Object.fromEntries(planStatusSchema.options.toSorted().map((status) => [status, 0]));
33
64
  const byType = {
@@ -73,6 +73,12 @@ export interface BlueprintLifecycleMutationResult {
73
73
  status: string;
74
74
  taskId?: string;
75
75
  }
76
+ export interface BlueprintCanonicalizeResult {
77
+ from: string;
78
+ to: string;
79
+ moved: boolean;
80
+ message: string;
81
+ }
76
82
  export interface CreateBlueprintResult extends CreatedBlueprint {
77
83
  message: string;
78
84
  /** True when draft was auto-routed off a primary-like checkout (H-009 DX). */
@@ -123,6 +129,7 @@ export declare function exportBlueprint(slug: string, format: string, options?:
123
129
  export declare function advanceBlueprintTask(slug: string, taskId: string, toStatus: string, options?: BlueprintMoveOptions): Promise<AdvanceTaskResult>;
124
130
  export declare function promoteBlueprintToState(slug: string, toState: string, options?: BlueprintMoveOptions): Promise<PromoteBlueprintResult>;
125
131
  export declare function finalizeBlueprintBySlug(slug: string, options?: BlueprintMoveOptions): Promise<PromoteBlueprintResult>;
132
+ export declare function canonicalizeBlueprintBySlug(slug: string, options?: BlueprintMoveOptions): Promise<BlueprintCanonicalizeResult>;
126
133
  export declare function registerBlueprintRouter(cli: CAC): void;
127
134
  export declare function _setBlueprintExecCommandExistsForTests(probe: ((command: string) => boolean) | null): void;
128
135
  export declare function _setBlueprintExecStarterForTests(starter: ((slug: string, options: BlueprintMoveOptions) => Promise<BlueprintLifecycleMutationResult>) | null): void;
@@ -10,6 +10,7 @@ import { resolveCurrentManagedWorktreeContext } from "#worktrees/current.js";
10
10
  import { canonicalizeWorktreePath, WORKTREE_PROBE_TIMEOUT_MS } from "#worktrees/identity.js";
11
11
  import { resolveBlueprintRoot } from "#utils/blueprint-root";
12
12
  import { getBlueprintDocumentPaths } from "#utils/document-paths.js";
13
+ import { canonicalizeBlueprint } from "#lifecycle/canonicalize.js";
13
14
  import { applyBlueprintLifecycleToFile, BlueprintCreationService, BlueprintService, complexitySchema, relativeBlueprintSlug, parseBlueprint, planStatusSchema, runBlueprintAudit, resolveBlueprintFile, serializeBlueprint, validateAllTasksDone, } from "#local";
14
15
  import { resolvePackageAssetPreferred } from "#utils/package-assets";
15
16
  import { resolveDraftAuthoringRoot } from "#worktrees/draft-authoring-root.js";
@@ -512,9 +513,19 @@ export async function finalizeBlueprintBySlug(slug, options = {}) {
512
513
  const projectRoot = resolveProjectRoot(options.projectRoot);
513
514
  return finalizeBlueprintMutation(projectRoot, slug);
514
515
  }
516
+ export async function canonicalizeBlueprintBySlug(slug, options = {}) {
517
+ const projectRoot = resolveProjectRoot(options.projectRoot);
518
+ const result = await canonicalizeBlueprint(projectRoot, slug);
519
+ return {
520
+ ...result,
521
+ message: result.moved
522
+ ? `Canonicalized blueprint ${slug}: ${result.from} -> ${result.to}`
523
+ : `Blueprint ${slug} is already canonical: ${result.to}`,
524
+ };
525
+ }
515
526
  export function registerBlueprintRouter(cli) {
516
527
  cli
517
- .command("blueprint [subcommand] [...args]", "Manage blueprints. Use: wp blueprint <action> --help for action-specific options (new, list, show, audit, exec, move, finalize, start, task)")
528
+ .command("blueprint [subcommand] [...args]", "Manage blueprints. Use: wp blueprint <action> --help for action-specific options (new, list, show, audit, exec, move, finalize, start, task, trust-dossier)")
518
529
  .option("--json", "Print JSON output")
519
530
  .option("--no-tui", "Use plain terminal output")
520
531
  .option("--complexity <complexity>", "Blueprint complexity (XS|S|M|L|XL)")
@@ -535,6 +546,7 @@ export function registerBlueprintRouter(cli) {
535
546
  await executeBlueprintSubcommand(subcommand, args, options, {
536
547
  advanceBlueprintTask,
537
548
  auditBlueprints,
549
+ canonicalizeBlueprintBySlug,
538
550
  createBlueprint,
539
551
  controlBlueprintExec,
540
552
  executeBlueprint,
@@ -31,9 +31,20 @@ export interface CiPreflightDeps {
31
31
  readonly cwd?: string;
32
32
  readonly resolveRepoRoot?: (cwd: string) => string | null;
33
33
  readonly hasNodeModules?: (repoRoot: string) => boolean;
34
- readonly runCheck?: (check: CiPreflightCheck, repoRoot: string) => number;
34
+ readonly runCheck?: (check: CiPreflightCheck, repoRoot: string) => number | Promise<number>;
35
35
  readonly stdout?: Pick<typeof process.stdout, "write">;
36
36
  readonly stderr?: Pick<typeof process.stderr, "write">;
37
37
  }
38
- export declare function runCiPreflight(deps?: CiPreflightDeps): number;
38
+ /**
39
+ * Re-invoke the same `wp` runtime that is currently executing so each check
40
+ * runs the real verb (faithful CI parity) rather than a reimplemented copy of
41
+ * its affected-resolution logic. Prefers the repo-local `bin/wp` launcher when
42
+ * present so the exact source/compiled selection and NODE_PATH wiring apply;
43
+ * falls back to the running runtime for consumer repos with a global `wp`.
44
+ */
45
+ export declare function resolveWpLauncher(repoRoot: string): {
46
+ readonly command: string;
47
+ readonly prefixArgs: readonly string[];
48
+ };
49
+ export declare function runCiPreflight(deps?: CiPreflightDeps): Promise<number>;
39
50
  export declare function registerCiPreflightCommand(cli: CAC): void;
@@ -24,9 +24,12 @@ export const CI_PREFLIGHT_COMMAND_HELP = [
24
24
  "Runs, in order, stopping at the first failure:",
25
25
  " 1. wp format --affected --branch --check",
26
26
  " 2. wp audit guardrails --affected --branch",
27
- " 3. wp typecheck --affected --branch",
28
- " 4. wp lint --affected --branch",
29
- " 5. wp test --affected --branch",
27
+ " 3. wp audit changeset-required --affected --branch",
28
+ " 4. wp typecheck --affected --branch",
29
+ " 5. wp typecheck --tests",
30
+ " 6. wp lint --affected --branch",
31
+ " 7. wp rust-check --affected --branch",
32
+ " 8. wp test --affected --branch",
30
33
  "",
31
34
  "This is what `.husky/pre-push` runs. A normal `git push` (no --no-verify)",
32
35
  "must pass it. Network-bound / whole-repo gates (dependency freshness) and",
@@ -42,9 +45,27 @@ export const CI_PREFLIGHT_COMMAND_HELP = [
42
45
  export const CI_PREFLIGHT_CHECKS = [
43
46
  { label: "format", args: ["format", "--affected", "--branch", "--check"] },
44
47
  { label: "guardrails", args: ["audit", "guardrails", "--affected", "--branch"] },
48
+ // Mirrors the `changeset-missing` blocker `wp_pr_status` computes against a
49
+ // live PR (`#status/snapshot.js`), scoped to the local branch diff so a
50
+ // missing changeset surfaces before push instead of after — see
51
+ // `catalog/agent/rules/ci-cost-local-first.md`. Deliberately excluded from
52
+ // the `wp audit guardrails` composite (see `changeset-required`'s
53
+ // `includedInGuardrails: false` in `#audit/registry.js`), so it gets its own
54
+ // preflight step.
55
+ { label: "changeset", args: ["audit", "changeset-required", "--affected", "--branch"] },
45
56
  { label: "typecheck", args: ["typecheck", "--affected", "--branch"] },
57
+ // Required test-surface typecheck (tsconfig.test.json). Not branch-scoped:
58
+ // the tests lane is a single whole-repo tsc project and is the burn-down
59
+ // gate that keeps test/script types from rotting again.
60
+ { label: "typecheck-tests", args: ["typecheck", "--tests"] },
46
61
  // CI runs lint after typecheck in the Lint & typecheck job; mirror that order.
47
62
  { label: "lint", args: ["lint", "--affected", "--branch"] },
63
+ // TS/JS affectedness (above) says nothing about the Rust crates
64
+ // (native/session-memory-engine, native/dash-tui, apps/desktop/src-tauri) —
65
+ // without this stage a Rust-only branch reported every stage above as "no
66
+ // affected files" and exited green having proven nothing about the Rust
67
+ // (see `#rust/affected-manifests.js`).
68
+ { label: "rust", args: ["rust-check", "--affected", "--branch"] },
48
69
  { label: "test", args: ["test", "--affected", "--branch"] },
49
70
  ];
50
71
  function reproduceLine(check) {
@@ -57,7 +78,10 @@ function reproduceLine(check) {
57
78
  * present so the exact source/compiled selection and NODE_PATH wiring apply;
58
79
  * falls back to the running runtime for consumer repos with a global `wp`.
59
80
  */
60
- function resolveWpLauncher(repoRoot) {
81
+ // Exported so `src/mcp/tools/ci-preflight.ts` can re-invoke the exact same
82
+ // `wp` launcher when it substitutes an output-capturing `runCheck` for the
83
+ // default `stdio: "inherit"` spawn — do not duplicate this resolution logic.
84
+ export function resolveWpLauncher(repoRoot) {
61
85
  const localLauncher = path.join(repoRoot, "bin", process.platform === "win32" ? "wp.cmd" : "wp");
62
86
  if (existsSync(localLauncher))
63
87
  return { command: localLauncher, prefixArgs: [] };
@@ -82,7 +106,7 @@ function defaultRunCheck(check, repoRoot) {
82
106
  }
83
107
  return typeof result.status === "number" ? result.status : 1;
84
108
  }
85
- export function runCiPreflight(deps = {}) {
109
+ export async function runCiPreflight(deps = {}) {
86
110
  const cwd = deps.cwd ?? process.cwd();
87
111
  const stdout = deps.stdout ?? process.stdout;
88
112
  const stderr = deps.stderr ?? process.stderr;
@@ -100,7 +124,7 @@ export function runCiPreflight(deps = {}) {
100
124
  }
101
125
  for (const check of CI_PREFLIGHT_CHECKS) {
102
126
  stdout.write(`\nwp ci-preflight: running ${check.label} (${reproduceLine(check)})\n`);
103
- const exitCode = runCheck(check, repoRoot);
127
+ const exitCode = await runCheck(check, repoRoot);
104
128
  if (exitCode !== 0) {
105
129
  const normalizedExit = exitCode === 0 ? 1 : exitCode;
106
130
  stderr.write(`\nwp ci-preflight: ${check.label} failed (exit ${normalizedExit}).\n` +
@@ -247,22 +247,10 @@ export async function runCompile(options) {
247
247
  message: `wp compile: rulesync exited with code ${exitCode}`,
248
248
  };
249
249
  }
250
- // Step 4: Emit plugin manifests in parallel
251
- const skillNames = Object.keys(assets.skills);
252
- const commandNames = Object.keys(assets.commands);
253
- const pkgVersion = readPackageVersion(cwd);
254
- const manifestOpts = {
255
- agentDir,
256
- outDir: cwd,
257
- version: pkgVersion,
258
- skills: skillNames,
259
- commands: commandNames,
260
- };
261
- await Promise.all([
262
- import("#compiler/manifests/claude").then((m) => m.emitManifest(manifestOpts)),
263
- import("#compiler/manifests/codex").then((m) => m.emitManifest(manifestOpts)),
264
- ]);
265
- // Step 5: Run mergeAgentsMd to produce AGENTS.md at repo root
250
+ // Step 4: Run mergeAgentsMd to produce AGENTS.md at repo root
251
+ // (Plugin manifests are hand-maintained SSOT under packages/*-plugin/;
252
+ // wp compile no longer emits them — golden tests + version stamping own
253
+ // that surface.)
266
254
  const agentsLayers = collectAgentsLayers(agentDir);
267
255
  if (agentsLayers.length > 0) {
268
256
  const { mergeAgentsMd } = await import("#compiler/memory/merger");
@@ -278,11 +266,9 @@ export async function runCompile(options) {
278
266
  writeFileSync(join(cwd, "AGENTS.md"), mergeResult.content);
279
267
  }
280
268
  }
281
- // Step 6: Write .compile-manifest.json with content-hash sentinels
269
+ // Step 5: Write .compile-manifest.json with content-hash sentinels
282
270
  const outputHashes = {
283
271
  "AGENTS.md": hashFile(join(cwd, "AGENTS.md")),
284
- "packages/claude-plugin/.claude-plugin/plugin.json": hashFile(join(cwd, "packages", "claude-plugin", ".claude-plugin", "plugin.json")),
285
- "packages/codex-plugin/.codex-plugin/plugin.json": hashFile(join(cwd, "packages", "codex-plugin", ".codex-plugin", "plugin.json")),
286
272
  };
287
273
  const compileManifest = {
288
274
  version: COMPILE_MANIFEST_VERSION,
@@ -303,18 +289,6 @@ export async function runCompile(options) {
303
289
  cleanup();
304
290
  }
305
291
  }
306
- function readPackageVersion(cwd) {
307
- const pkgPath = join(cwd, "package.json");
308
- if (!existsSync(pkgPath))
309
- return "0.0.0";
310
- try {
311
- const parsed = JSON.parse(readFileSync(pkgPath, "utf-8"));
312
- return typeof parsed.version === "string" ? parsed.version : "0.0.0";
313
- }
314
- catch {
315
- return "0.0.0";
316
- }
317
- }
318
292
  function collectAgentsLayers(agentDir) {
319
293
  const agentsDir = join(agentDir, "agents");
320
294
  if (!existsSync(agentsDir))
@@ -56,3 +56,4 @@ export type DeliveryStatusOptions = {
56
56
  * prior values and expose a retryable adapter warning.
57
57
  */
58
58
  export declare function collectDeliveryStatus(options?: DeliveryStatusOptions): Promise<DeliveryStatus>;
59
+ export declare function blueprintDocumentPath(cwd: string, state: string, slug: string): string | null;
@@ -107,14 +107,21 @@ function checkState(value) {
107
107
  return "pending";
108
108
  return states.length > 0 ? "passing" : "unknown";
109
109
  }
110
+ export function blueprintDocumentPath(cwd, state, slug) {
111
+ const folder = join(cwd, "blueprints", state, slug, "_overview.md");
112
+ if (existsSync(folder))
113
+ return folder;
114
+ const flat = join(cwd, "blueprints", state, `${slug}.md`);
115
+ return existsSync(flat) ? flat : null;
116
+ }
110
117
  function readBlueprintDelivery(cwd) {
111
118
  const branch = run("git", ["branch", "--show-current"], cwd);
112
119
  if (!branch?.startsWith("bp/"))
113
120
  return null;
114
121
  const slug = branch.slice(3);
115
122
  for (const state of ["in-progress", "planned", "draft", "completed", "parked", "archived"]) {
116
- const path = join(cwd, "blueprints", state, slug, "_overview.md");
117
- if (!existsSync(path))
123
+ const path = blueprintDocumentPath(cwd, state, slug);
124
+ if (!path)
118
125
  continue;
119
126
  const raw = readFileSync(path, "utf8");
120
127
  return {
@@ -129,8 +136,8 @@ function readVerificationDelivery(cwd) {
129
136
  const blueprint = readBlueprintDelivery(cwd);
130
137
  if (!blueprint)
131
138
  return null;
132
- const path = join(cwd, "blueprints", blueprint.state, blueprint.slug, "_overview.md");
133
- if (!existsSync(path))
139
+ const path = blueprintDocumentPath(cwd, blueprint.state, blueprint.slug);
140
+ if (!path)
134
141
  return null;
135
142
  const raw = readFileSync(path, "utf8");
136
143
  const evidenceCount = (raw.match(/^\*\*Verification:\*\*/gmu) ?? []).length;
@@ -1,4 +1,5 @@
1
1
  import { auditBlueprintLifecycleSql } from "#audit/blueprint-lifecycle-sql";
2
+ import { auditCiGuardrailsWiring } from "#audit/ci-guardrails-wiring";
2
3
  import { readConfig } from "#cli/commands/init/config";
3
4
  import { auditCatalogDrift, auditDocsFrontmatter, formatRepoAuditReport, } from "#audit/repo-guardrails";
4
5
  import { countWorktreeLifecycleScripts } from "#worktrees/lifecycle-scripts.js";
@@ -7,6 +8,9 @@ const REMEDIATIONS = {
7
8
  "Catalog drift — single package (no workspace file)": "none needed",
8
9
  "Docs frontmatter": "wp audit docs-frontmatter --fix",
9
10
  "Blueprint lifecycle": "wp audit blueprint-lifecycle",
11
+ // Name the missing invocation explicitly so an operator sees which CI step to
12
+ // restore, not just a generic "drifted" signal.
13
+ "CI guardrails wiring": "restore the `wp audit guardrails` CI step (run `wp setup`)",
10
14
  };
11
15
  export async function runDoctor(options = {}) {
12
16
  try {
@@ -17,6 +21,7 @@ export async function runDoctor(options = {}) {
17
21
  docsRoot: options.docsRoot,
18
22
  fix: options.fix,
19
23
  }),
24
+ auditCiGuardrailsWiring(root),
20
25
  await auditBlueprintLifecycleSql(root, { includeRuntimePlans: options.runtimePlans }),
21
26
  ];
22
27
  let failed = false;
@@ -1,4 +1,9 @@
1
1
  import type { CAC } from "cac";
2
+ /**
3
+ * Registered GUARD_* codes emitted by the hook-command fail-closed path.
4
+ * Consumed by the guard-outcome registry-completeness test.
5
+ */
6
+ export declare const HOOK_FALLBACK_GUARD_CODES: readonly ["GUARD_PRETOOL_FAILURE"];
2
7
  declare const HOOK_NAMES: readonly ["pretool-guard", "post-tool", "stop-qa", "stop-ultragoal", "guard-switch", "sessionstart-routing", "precompact-snapshot", "permission-request", "test-quality-check"];
3
8
  export type HookName = (typeof HOOK_NAMES)[number];
4
9
  export declare function isHookName(value: string): value is HookName;
@@ -2,8 +2,16 @@ import { performance } from "node:perf_hooks";
2
2
  import { reportHookDegradation, takeHookDegradation, } from "#hooks/errors/index.js";
3
3
  import { recordHookInvocation, summarizeHookText, takeRememberedHookStdin, } from "#hooks/logs/store.js";
4
4
  import { createSyntheticProcessExit, isSyntheticProcessExit, } from "#hooks/shared/synthetic-process-exit.js";
5
- import { writeHookOutput } from "#hooks/shared/hook-bootstrap";
5
+ import { writeGuardStderr, writeHookOutput } from "#hooks/shared/hook-bootstrap";
6
+ import { formatGuardReason } from "#hooks/shared/guard-outcome.js";
6
7
  import { buildDenyEnvelope } from "#hooks/shared/types.js";
8
+ /**
9
+ * Registered GUARD_* codes emitted by the hook-command fail-closed path.
10
+ * Consumed by the guard-outcome registry-completeness test.
11
+ */
12
+ export const HOOK_FALLBACK_GUARD_CODES = [
13
+ "GUARD_PRETOOL_FAILURE",
14
+ ];
7
15
  import { resolveHookProjectDirFromText } from "#hooks/shared/project-dir.js";
8
16
  import { createManagedHookExecutionContext, } from "#hooks/shared/session-memory-deadline.js";
9
17
  const HOOK_NAMES = [
@@ -101,13 +109,9 @@ function exitCodeFrom(value) {
101
109
  }
102
110
  function writePretoolDeny(reason) {
103
111
  writeHookOutput(`${JSON.stringify(buildDenyEnvelope({ reason }))}\n`);
104
- // Best-effort stderr reason for Claude/Codex exit-2 UX (may be suppressed in some runners).
105
- try {
106
- process.stderr.write(`${reason}\n`);
107
- }
108
- catch {
109
- // ignore
110
- }
112
+ // Deliver to the REAL stderr too: Claude reads stderr on an exit-2 PreToolUse
113
+ // deny, and it is suppressed for decorative output.
114
+ writeGuardStderr(`${reason}\n`);
111
115
  }
112
116
  function emitFallback(name, error) {
113
117
  const metadata = HOOK_METADATA[name];
@@ -121,7 +125,9 @@ function emitFallback(name, error) {
121
125
  detail,
122
126
  });
123
127
  if (metadata.fallback === "fail-closed-deny") {
124
- writePretoolDeny(`webpresso pretool guard failed: ${detail}`);
128
+ // Coded fail-closed denial so the host still sees a stable GUARD_ code even
129
+ // when the guard handler itself threw.
130
+ writePretoolDeny(formatGuardReason("GUARD_PRETOOL_FAILURE", `webpresso pretool guard failed: ${detail}`));
125
131
  // Exit 2 so Grok (and exit-code runners) treat fail-closed as an explicit deny.
126
132
  return 2;
127
133
  }
@@ -4,7 +4,7 @@
4
4
  */
5
5
  import { existsSync, readFileSync, writeFileSync } from "node:fs";
6
6
  import { isAbsolute, join, normalize } from "node:path";
7
- import { REQUIRED_CORE_CAPABILITIES } from "./host-visibility.js";
7
+ import { AGENT_HOSTS, REQUIRED_CORE_CAPABILITIES } from "./host-visibility.js";
8
8
  export const CONFIG_VERSION = "1";
9
9
  export const CONFIG_FILENAME = ".webpressorc.json";
10
10
  export const LEGACY_CONFIG_FILENAME = ".agent-kitrc.json";
@@ -136,7 +136,7 @@ function parseConfigFile(path) {
136
136
  }
137
137
  : undefined;
138
138
  const selectedHosts = Array.isArray(hosts?.selected)
139
- ? hosts.selected.filter((s) => ["codex", "claude", "opencode"].includes(String(s)))
139
+ ? hosts.selected.filter((s) => AGENT_HOSTS.includes(String(s)))
140
140
  : [];
141
141
  const requiredCapabilities = Array.isArray(hosts?.requiredCapabilities)
142
142
  ? hosts.requiredCapabilities.filter((s) => typeof s === "string")
@@ -0,0 +1,88 @@
1
+ import { type ConvergeUnit } from "./convergence.js";
2
+ export { resolveUntrackedCollision } from "./untracked-collision.js";
3
+ /** Bounded timeout for non-hook Git probes (status, add, rev-parse, diff-tree). */
4
+ export declare const GIT_PROBE_TIMEOUT_MS = 15000;
5
+ /**
6
+ * Default wall for the single hookful `git commit`. Consumer pre-commit chains
7
+ * (format + audits) routinely exceed the probe budget; Node's spawnSync kills
8
+ * the child with SIGTERM when `timeout` elapses, which left staged residue and
9
+ * multi-line partial hook output that looked like success.
10
+ *
11
+ * 10 minutes is a durable consumer budget, not infinite hang. Operators can
12
+ * raise/lower via `WP_SETUP_COMMIT_TIMEOUT_MS` or `AuthorCommitOptions.commitTimeoutMs`.
13
+ */
14
+ export declare const DEFAULT_GIT_COMMIT_TIMEOUT_MS = 600000;
15
+ /**
16
+ * Resolve the hookful-commit timeout. Preference order:
17
+ * 1. explicit `commitTimeoutMs` option (tests / programmatic callers)
18
+ * 2. `WP_SETUP_COMMIT_TIMEOUT_MS` env (operator override)
19
+ * 3. {@link DEFAULT_GIT_COMMIT_TIMEOUT_MS}
20
+ *
21
+ * Values must be finite numbers ≥ 0. `0` disables the artificial wall (Node default).
22
+ */
23
+ export declare function resolveCommitTimeoutMs(options?: {
24
+ readonly commitTimeoutMs?: number;
25
+ readonly env?: NodeJS.ProcessEnv;
26
+ }): number;
27
+ /** First-class timeout diagnosis; partial hook stdout/stderr is diagnostic only. */
28
+ export declare function formatCommitTimeoutError(options: {
29
+ readonly timeoutMs: number;
30
+ readonly hookOutput?: string;
31
+ }): string;
32
+ /**
33
+ * First-class interrupt diagnosis for non-timeout signal kills (operator kill,
34
+ * external SIGTERM/SIGKILL). Must not surface raw hook "passed" lines as the
35
+ * leading operator message.
36
+ */
37
+ export declare function formatCommitInterruptError(options: {
38
+ readonly signal: NodeJS.Signals;
39
+ readonly hookOutput?: string;
40
+ }): string;
41
+ /**
42
+ * Classify a failed hookful `git commit` result.
43
+ *
44
+ * - `timedOut` (spawnSync ETIMEDOUT) → budget timeout diagnosis
45
+ * - non-null `signal` without timedOut → interrupt diagnosis (names the signal)
46
+ * - otherwise → hook/git stderr when present, else a generic preserved-index message
47
+ *
48
+ * Never lead with bare hook "passed" lines for timeout/interrupt paths.
49
+ */
50
+ export declare function classifyCommitFailure(result: {
51
+ readonly timedOut: boolean;
52
+ readonly signal: NodeJS.Signals | null;
53
+ readonly stderr: string;
54
+ readonly stdout: string;
55
+ }, timeoutMs: number): string;
56
+ /**
57
+ * Prefix every line of a setup failure so multi-line timeout diagnoses stay
58
+ * labeled when printed via console.error (avoids a single `wp setup: ` on the
59
+ * first line and bare hook "passed" lines after it).
60
+ */
61
+ export declare function formatWpSetupError(message: string): string;
62
+ export type AuthorCommitStatus = "committed" | "no-change" | "skipped-ci" | "failed" | "rolled-back";
63
+ export interface AuthorCommitResult {
64
+ readonly status: AuthorCommitStatus;
65
+ readonly ok: boolean;
66
+ readonly commit?: string;
67
+ readonly allowlist: readonly string[];
68
+ readonly unexpectedPaths?: readonly string[];
69
+ readonly missingPaths?: readonly string[];
70
+ readonly error?: string;
71
+ }
72
+ export interface AuthorCommitOptions {
73
+ readonly repoRoot: string;
74
+ readonly appliedUnits: readonly ConvergeUnit[];
75
+ readonly message: string;
76
+ readonly isCi?: boolean;
77
+ /**
78
+ * Override wall for the single hookful `git commit` (ms). Prefer this in tests.
79
+ * `0` disables the artificial timeout. Probe Git calls always stay on the short budget.
80
+ */
81
+ readonly commitTimeoutMs?: number;
82
+ }
83
+ export interface AppliedConvergenceCandidate {
84
+ readonly targetPath: string;
85
+ readonly reason: string;
86
+ }
87
+ export declare function collectAppliedConvergeUnits(repoRoot: string, candidates: readonly AppliedConvergenceCandidate[]): ConvergeUnit[];
88
+ export declare function authorConvergenceCommit(options: AuthorCommitOptions): AuthorCommitResult;