@planu/cli 4.14.1 → 5.1.1

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 (452) hide show
  1. package/CHANGELOG.md +82 -0
  2. package/LICENSE +55 -12
  3. package/README.md +10 -2
  4. package/dist/cli/commands/install.d.ts +1 -12
  5. package/dist/cli/commands/install.js +9 -65
  6. package/dist/cli/commands/job.js +4 -3
  7. package/dist/cli/commands/spec.js +12 -3
  8. package/dist/cli/commands/validate.js +2 -2
  9. package/dist/cli/router.js +1 -3
  10. package/dist/config/environment-schema.json +1 -3
  11. package/dist/config/official-sdd-tools.d.ts +4 -0
  12. package/dist/config/official-sdd-tools.js +35 -0
  13. package/dist/config/product-public.d.ts +139 -3
  14. package/dist/config/product-public.js +8 -1
  15. package/dist/config/product-public.json +7 -36
  16. package/dist/config/registries/hosts/codex.json +20 -363
  17. package/dist/config/release-policy.json +84 -2
  18. package/dist/config/runtime-policy.json +12 -1
  19. package/dist/config/skill-templates/planu-resume-work.md +2 -2
  20. package/dist/core/index.d.ts +1 -1
  21. package/dist/core/spec-validator.d.ts +4 -4
  22. package/dist/core/spec-validator.js +33 -19
  23. package/dist/engine/abortable-process-runner.d.ts +20 -2
  24. package/dist/engine/abortable-process-runner.js +243 -74
  25. package/dist/engine/ambiguity-scorer.js +4 -26
  26. package/dist/engine/auth/scope-mapper.js +1 -7
  27. package/dist/engine/autopilot/state-updater.js +4 -4
  28. package/dist/engine/cascade-hooks/hooks/review-enricher.hook.js +9 -6
  29. package/dist/engine/cascade-hooks/state-drift-detector.d.ts +3 -3
  30. package/dist/engine/cascade-hooks/state-drift-detector.js +1 -1
  31. package/dist/engine/ci-generator/planu-config.js +1 -7
  32. package/dist/engine/clarification-gate/gate.d.ts +3 -3
  33. package/dist/engine/code-scanner/layer-scanner.js +6 -22
  34. package/dist/engine/core-bridge.d.ts +3 -3
  35. package/dist/engine/cost-guardrails.d.ts +1 -1
  36. package/dist/engine/cost-guardrails.js +1 -1
  37. package/dist/engine/criterion-identity.d.ts +1 -0
  38. package/dist/engine/criterion-identity.js +7 -0
  39. package/dist/engine/dashboard/data-loader.js +2 -7
  40. package/dist/engine/dashboard/templates-layout.js +0 -3
  41. package/dist/engine/dashboard/templates-project.js +1 -13
  42. package/dist/engine/docs-site-generator/data-collector.d.ts +1 -1
  43. package/dist/engine/docs-site-generator/data-collector.js +7 -28
  44. package/dist/engine/docs-site-generator/tools-renderer.js +3 -10
  45. package/dist/engine/evidence-gates/artifact-reader.d.ts +12 -1
  46. package/dist/engine/evidence-gates/artifact-reader.js +174 -4
  47. package/dist/engine/evidence-gates/evidence-autofill.d.ts +10 -0
  48. package/dist/engine/evidence-gates/evidence-autofill.js +148 -0
  49. package/dist/engine/evidence-gates/evidence-skeletons.d.ts +19 -0
  50. package/dist/engine/evidence-gates/evidence-skeletons.js +69 -0
  51. package/dist/engine/evidence-gates/lifecycle-gate.js +4 -3
  52. package/dist/engine/evidence-gates/reconciliation-freshness.d.ts +11 -0
  53. package/dist/engine/evidence-gates/reconciliation-freshness.js +72 -0
  54. package/dist/engine/evidence-index/done-drift.d.ts +1 -1
  55. package/dist/engine/evidence-index/done-drift.js +40 -18
  56. package/dist/engine/execution/context.js +3 -0
  57. package/dist/engine/execution/durable-job-heartbeat-runtime.d.ts +4 -0
  58. package/dist/engine/execution/durable-job-heartbeat-runtime.js +400 -0
  59. package/dist/engine/execution/job-runtime.d.ts +30 -0
  60. package/dist/engine/execution/job-runtime.js +114 -6
  61. package/dist/engine/execution/operation-journal.js +10 -4
  62. package/dist/engine/execution/public-job-sanitizer.d.ts +4 -0
  63. package/dist/engine/execution/public-job-sanitizer.js +31 -0
  64. package/dist/engine/execution/validate-job-executor.d.ts +12 -1
  65. package/dist/engine/execution/validate-job-executor.js +549 -86
  66. package/dist/engine/execution/validate-job-payload.js +107 -50
  67. package/dist/engine/execution/validate-job-recovery.js +1 -1
  68. package/dist/engine/execution/validate-worker-runtime.d.ts +5 -0
  69. package/dist/engine/execution/validate-worker-runtime.js +90 -2
  70. package/dist/engine/execution/validate-worker-thread.js +17 -24
  71. package/dist/engine/handoff-artifacts/schemas.d.ts +2 -1
  72. package/dist/engine/handoff-artifacts/schemas.js +33 -0
  73. package/dist/engine/handoff-packager.d.ts +19 -0
  74. package/dist/engine/handoff-packager.js +415 -13
  75. package/dist/engine/hooks/effort-configurator.js +1 -1
  76. package/dist/engine/impact-detector/test-break-predictor.js +3 -3
  77. package/dist/engine/impact-detector/tool-registration.js +1 -1
  78. package/dist/engine/implementation-contract/renderer.js +23 -8
  79. package/dist/engine/lifecycle-reconciliation-io.d.ts +11 -0
  80. package/dist/engine/lifecycle-reconciliation-io.js +180 -0
  81. package/dist/engine/lifecycle-reconciliation.d.ts +16 -0
  82. package/dist/engine/lifecycle-reconciliation.js +406 -0
  83. package/dist/engine/local-first/tool-classification.js +2 -0
  84. package/dist/engine/macos-keychain-native-port.d.ts +5 -0
  85. package/dist/engine/macos-keychain-native-port.js +19 -7
  86. package/dist/engine/migrations/remove-commercial-state.d.ts +3 -0
  87. package/dist/engine/migrations/remove-commercial-state.js +343 -0
  88. package/dist/engine/minimality/policy-loader.js +247 -6
  89. package/dist/engine/network-policy.js +1 -0
  90. package/dist/engine/planu-core.darwin-arm64.node.manifest.json +7 -7
  91. package/dist/engine/planu-core.darwin-arm64.node.sbom.json +20 -20
  92. package/dist/engine/planu-core.darwin-x64.node.manifest.json +7 -7
  93. package/dist/engine/planu-core.darwin-x64.node.sbom.json +20 -20
  94. package/dist/engine/planu-core.linux-arm64-gnu.node.manifest.json +7 -7
  95. package/dist/engine/planu-core.linux-arm64-gnu.node.sbom.json +20 -20
  96. package/dist/engine/planu-core.linux-arm64-musl.node.manifest.json +7 -7
  97. package/dist/engine/planu-core.linux-arm64-musl.node.sbom.json +20 -20
  98. package/dist/engine/planu-core.linux-x64-gnu.node.manifest.json +7 -7
  99. package/dist/engine/planu-core.linux-x64-gnu.node.sbom.json +20 -20
  100. package/dist/engine/planu-core.linux-x64-musl.node.manifest.json +7 -7
  101. package/dist/engine/planu-core.linux-x64-musl.node.sbom.json +20 -20
  102. package/dist/engine/planu-core.win32-arm64-msvc.node.manifest.json +7 -7
  103. package/dist/engine/planu-core.win32-arm64-msvc.node.sbom.json +20 -20
  104. package/dist/engine/planu-core.win32-x64-msvc.node.manifest.json +7 -7
  105. package/dist/engine/planu-core.win32-x64-msvc.node.sbom.json +20 -20
  106. package/dist/engine/readiness-checker.d.ts +1 -16
  107. package/dist/engine/readiness-checker.js +27 -88
  108. package/dist/engine/reverse-engineer/api-detector.js +2 -13
  109. package/dist/engine/reverse-engineer/complexity-analyzer.js +2 -13
  110. package/dist/engine/reverse-engineer/config-analyzer.js +2 -13
  111. package/dist/engine/reverse-engineer/dependency-graph.js +2 -13
  112. package/dist/engine/reverse-engineer/test-analyzer.js +2 -13
  113. package/dist/engine/reverse-engineer/walk-ignore.d.ts +3 -0
  114. package/dist/engine/reverse-engineer/walk-ignore.js +26 -0
  115. package/dist/engine/runtime-policy.d.ts +2 -0
  116. package/dist/engine/runtime-policy.js +42 -5
  117. package/dist/engine/runtime-security/rate-limiter.js +0 -1
  118. package/dist/engine/safety/contained-project-file.d.ts +3 -0
  119. package/dist/engine/safety/contained-project-file.js +23 -0
  120. package/dist/engine/scope-boundaries/contradiction-checker.js +63 -1
  121. package/dist/engine/scope-boundaries/scope-validator.js +45 -7
  122. package/dist/engine/session/checkpoint-writer.js +0 -9
  123. package/dist/engine/spec-format/acceptance-criteria.d.ts +6 -2
  124. package/dist/engine/spec-format/acceptance-criteria.js +82 -22
  125. package/dist/engine/spec-format/markdown-sections.d.ts +14 -0
  126. package/dist/engine/spec-format/markdown-sections.js +105 -0
  127. package/dist/engine/spec-format/read-technical-section.js +33 -5
  128. package/dist/engine/spec-format/technical-md-populator.js +3 -2
  129. package/dist/engine/spec-format/text-fences.js +20 -2
  130. package/dist/engine/spec-format/unified-spec-builder.d.ts +7 -0
  131. package/dist/engine/spec-format/unified-spec-builder.js +202 -0
  132. package/dist/engine/spec-migrator/canonical-deduplicator.d.ts +18 -0
  133. package/dist/engine/spec-migrator/canonical-deduplicator.js +479 -0
  134. package/dist/engine/spec-migrator/filesystem-import.d.ts +4 -8
  135. package/dist/engine/spec-migrator/filesystem-import.js +121 -14
  136. package/dist/engine/spec-migrator/frontmatter-parser.js +32 -15
  137. package/dist/engine/spec-migrator/index.d.ts +1 -0
  138. package/dist/engine/spec-migrator/index.js +1 -0
  139. package/dist/engine/spec-state-machine/transition-spec.d.ts +6 -1
  140. package/dist/engine/spec-state-machine/transition-spec.js +10 -1
  141. package/dist/engine/spec-state-syncer.js +1 -1
  142. package/dist/engine/technical-enricher/index.js +16 -8
  143. package/dist/engine/technical-enricher/render-enriched.d.ts +1 -0
  144. package/dist/engine/technical-enricher/render-enriched.js +42 -14
  145. package/dist/engine/telemetry/health-checker.js +53 -17
  146. package/dist/engine/telemetry/telemetry-client.js +26 -8
  147. package/dist/engine/text-signal-boundaries.d.ts +2 -0
  148. package/dist/engine/text-signal-boundaries.js +25 -2
  149. package/dist/engine/time/relative-date.d.ts +3 -0
  150. package/dist/engine/time/relative-date.js +16 -0
  151. package/dist/engine/timing/budget.d.ts +11 -0
  152. package/dist/engine/timing/budget.js +31 -9
  153. package/dist/engine/token-optimizer/analytics.d.ts +1 -1
  154. package/dist/engine/token-optimizer/analytics.js +5 -6
  155. package/dist/engine/usage-tracker/core.d.ts +2 -2
  156. package/dist/engine/usage-tracker/core.js +1 -2
  157. package/dist/engine/usage-tracker/index.d.ts +0 -3
  158. package/dist/engine/usage-tracker/index.js +0 -3
  159. package/dist/engine/usage-tracker/stats.d.ts +2 -2
  160. package/dist/engine/usage-tracker/stats.js +1 -28
  161. package/dist/engine/validation/durable-validation.d.ts +1 -1
  162. package/dist/engine/validation/durable-validation.js +3 -82
  163. package/dist/engine/validation/validation-freshness.d.ts +11 -1
  164. package/dist/engine/validation/validation-freshness.js +231 -91
  165. package/dist/engine/validation/validation-receipt.d.ts +9 -6
  166. package/dist/engine/validation/validation-receipt.js +84 -24
  167. package/dist/engine/validation/validation-source-digest.d.ts +2 -0
  168. package/dist/engine/validation/validation-source-digest.js +86 -0
  169. package/dist/engine/validation/validation-submission.d.ts +5 -4
  170. package/dist/engine/validation/validation-submission.js +25 -11
  171. package/dist/engine/validation/validation-worktree.d.ts +21 -0
  172. package/dist/engine/validation/validation-worktree.js +260 -0
  173. package/dist/engine/validation-impact-planner.d.ts +14 -2
  174. package/dist/engine/validation-impact-planner.js +0 -3
  175. package/dist/engine/validator/dor-dod.d.ts +1 -0
  176. package/dist/engine/validator/dor-dod.js +5 -3
  177. package/dist/engine/validator/extractors.d.ts +1 -5
  178. package/dist/engine/validator/extractors.js +24 -69
  179. package/dist/engine/validator/spec-compliance-runner.d.ts +12 -24
  180. package/dist/engine/validator/spec-compliance-runner.js +429 -211
  181. package/dist/engine/validator.js +35 -22
  182. package/dist/index.js +4 -16
  183. package/dist/resources/usage-stats-resource.js +2 -18
  184. package/dist/security/adapters/linux-secret-service.js +7 -3
  185. package/dist/security/adapters/windows-credential-manager.js +6 -4
  186. package/dist/server/routes/specs.js +13 -1
  187. package/dist/storage/base-store.d.ts +1 -1
  188. package/dist/storage/base-store.js +1 -1
  189. package/dist/storage/feedback-remote.d.ts +2 -3
  190. package/dist/storage/feedback-remote.js +45 -31
  191. package/dist/storage/global-store.d.ts +1 -17
  192. package/dist/storage/global-store.js +1 -42
  193. package/dist/storage/index.d.ts +0 -2
  194. package/dist/storage/index.js +0 -2
  195. package/dist/storage/migrations/canonical-storage.js +124 -11
  196. package/dist/storage/runtime-db.d.ts +9 -0
  197. package/dist/storage/runtime-db.js +64 -8
  198. package/dist/storage/spec-store.d.ts +14 -2
  199. package/dist/storage/spec-store.js +104 -14
  200. package/dist/storage/status-store/atomic-status-write.d.ts +5 -0
  201. package/dist/storage/status-store/atomic-status-write.js +57 -0
  202. package/dist/storage/status-store/file-lock.js +30 -11
  203. package/dist/storage/status-store/self-healing.js +3 -3
  204. package/dist/storage/status-store/version-sync.d.ts +2 -1
  205. package/dist/storage/status-store/version-sync.js +35 -40
  206. package/dist/storage/usage-store.d.ts +1 -5
  207. package/dist/storage/usage-store.js +0 -35
  208. package/dist/tools/auto-update-handler.d.ts +3 -3
  209. package/dist/tools/auto-update-handler.js +3 -3
  210. package/dist/tools/challenge-spec/resilience-challenge-scenarios.d.ts +2 -1
  211. package/dist/tools/challenge-spec/resilience-challenge-scenarios.js +10 -7
  212. package/dist/tools/challenge-spec/scenario-collector.js +1 -1
  213. package/dist/tools/challenge-spec/scenarios-data.js +1 -1
  214. package/dist/tools/challenge-spec/scenarios-utils.d.ts +1 -1
  215. package/dist/tools/challenge-spec/scenarios-utils.js +35 -11
  216. package/dist/tools/challenge-spec-helpers.d.ts +10 -1
  217. package/dist/tools/challenge-spec-helpers.js +63 -22
  218. package/dist/tools/challenge-spec.js +23 -8
  219. package/dist/tools/check-readiness.js +38 -14
  220. package/dist/tools/configure-telemetry.js +30 -2
  221. package/dist/tools/create-spec/spec-builder.d.ts +7 -0
  222. package/dist/tools/create-spec/spec-builder.js +19 -15
  223. package/dist/tools/create-spec.d.ts +1 -0
  224. package/dist/tools/create-spec.js +584 -309
  225. package/dist/tools/git/branch-ops.d.ts +1 -1
  226. package/dist/tools/git/branch-ops.js +3 -2
  227. package/dist/tools/init-project/handler.js +10 -12
  228. package/dist/tools/init-project/host-assets-writer.js +26 -1
  229. package/dist/tools/init-project/lint-scaffolder.d.ts +3 -3
  230. package/dist/tools/init-project/migration-runner.d.ts +2 -4
  231. package/dist/tools/init-project/migration-runner.js +3 -2
  232. package/dist/tools/init-project/portable-index-reconciler.d.ts +4 -0
  233. package/dist/tools/init-project/portable-index-reconciler.js +14 -0
  234. package/dist/tools/init-project/result-builder.js +1 -3
  235. package/dist/tools/jobs/handlers.js +38 -6
  236. package/dist/tools/list-specs.js +5 -26
  237. package/dist/tools/merge-risk-handler.js +2 -2
  238. package/dist/tools/package-handoff.js +2 -0
  239. package/dist/tools/reconcile-spec.js +0 -27
  240. package/dist/tools/register-agent-squad-tools.js +2 -2
  241. package/dist/tools/register-platform-tools/design-stack-tools.js +11 -11
  242. package/dist/tools/register-platform-tools/lifecycle-infra-tools.js +7 -7
  243. package/dist/tools/register-sdd-tools.d.ts +1 -1
  244. package/dist/tools/register-sdd-tools.js +2 -29
  245. package/dist/tools/register-spec-tools/analysis-tools.js +8 -8
  246. package/dist/tools/register-spec-tools/core-spec-tools.js +29 -19
  247. package/dist/tools/safe-handler.d.ts +5 -13
  248. package/dist/tools/safe-handler.js +7 -23
  249. package/dist/tools/schemas/index.d.ts +1 -1
  250. package/dist/tools/schemas/index.js +1 -1
  251. package/dist/tools/schemas/output-schemas.d.ts +0 -23
  252. package/dist/tools/schemas/output-schemas.js +0 -28
  253. package/dist/tools/schemas/spec.d.ts +4 -0
  254. package/dist/tools/schemas/spec.js +3 -0
  255. package/dist/tools/schemas/validate-output-schema.d.ts +11 -0
  256. package/dist/tools/schemas/validate-output-schema.js +7 -0
  257. package/dist/tools/spec-prompt-handler.js +3 -3
  258. package/dist/tools/sync-spec-state-handler.d.ts +1 -1
  259. package/dist/tools/sync-spec-state-handler.js +50 -2
  260. package/dist/tools/tool-entry.d.ts +4 -4
  261. package/dist/tools/tool-entry.js +3 -3
  262. package/dist/tools/tool-registry/core-tools.js +31 -15
  263. package/dist/tools/tool-registry/group-infra.js +27 -110
  264. package/dist/tools/tool-registry/group-quality-compliance.js +26 -26
  265. package/dist/tools/tool-registry/inventory.d.ts +2 -0
  266. package/dist/tools/tool-registry/inventory.js +2 -0
  267. package/dist/tools/tool-registry-helpers.d.ts +3 -3
  268. package/dist/tools/tool-registry-helpers.js +3 -3
  269. package/dist/tools/tool-usage-report/registered-tools.d.ts +1 -1
  270. package/dist/tools/tool-usage-report/registered-tools.js +3 -15
  271. package/dist/tools/update-status/approval-gates.js +3 -0
  272. package/dist/tools/update-status/batch.d.ts +6 -2
  273. package/dist/tools/update-status/batch.js +58 -1
  274. package/dist/tools/update-status/dod-gates.d.ts +16 -1
  275. package/dist/tools/update-status/dod-gates.js +191 -1
  276. package/dist/tools/update-status/done-receipt-verifier.d.ts +8 -0
  277. package/dist/tools/update-status/done-receipt-verifier.js +75 -27
  278. package/dist/tools/update-status/evidence-gate.d.ts +4 -0
  279. package/dist/tools/update-status/evidence-gate.js +103 -3
  280. package/dist/tools/update-status/file-sync.d.ts +4 -3
  281. package/dist/tools/update-status/file-sync.js +57 -6
  282. package/dist/tools/update-status/index.d.ts +25 -1
  283. package/dist/tools/update-status/index.js +292 -78
  284. package/dist/tools/update-status/response-builder.js +3 -3
  285. package/dist/tools/update-status/side-effects.d.ts +2 -0
  286. package/dist/tools/update-status/side-effects.js +2 -2
  287. package/dist/tools/update-status/transition-guard.js +45 -16
  288. package/dist/tools/update-status-actions.d.ts +4 -2
  289. package/dist/tools/update-status-actions.js +16 -14
  290. package/dist/tools/usage-report.js +1 -16
  291. package/dist/tools/usage-stats.js +1 -18
  292. package/dist/tools/usage-tracking.d.ts +4 -0
  293. package/dist/tools/usage-tracking.js +20 -0
  294. package/dist/tools/validate-lint.d.ts +1 -0
  295. package/dist/tools/validate-lint.js +1 -1
  296. package/dist/tools/validate.d.ts +2 -1
  297. package/dist/tools/validate.js +114 -34
  298. package/dist/tools/workspace-dashboard-handler.js +38 -0
  299. package/dist/transports/http-transport.js +6 -8
  300. package/dist/transports/mcp-types.d.ts +0 -2
  301. package/dist/transports/session-context.js +1 -1
  302. package/dist/types/cascade-hooks.d.ts +1 -1
  303. package/dist/types/ci.d.ts +0 -4
  304. package/dist/types/clarification-token.d.ts +1 -1
  305. package/dist/types/claude-code-runtime.d.ts +0 -27
  306. package/dist/types/commercial-migration.d.ts +17 -0
  307. package/dist/types/commercial-migration.js +2 -0
  308. package/dist/types/common/primitives.d.ts +0 -2
  309. package/dist/types/core-bridge.d.ts +4 -10
  310. package/dist/types/dashboard.d.ts +3 -7
  311. package/dist/types/docs.d.ts +0 -1
  312. package/dist/types/durable-job.d.ts +4 -4
  313. package/dist/types/durable-validation.d.ts +100 -2
  314. package/dist/types/durable-validation.js +165 -1
  315. package/dist/types/errors/structured-error.d.ts +3 -3
  316. package/dist/types/estimation.d.ts +2 -0
  317. package/dist/types/evidence-autofill.d.ts +34 -0
  318. package/dist/types/evidence-autofill.js +2 -0
  319. package/dist/types/evidence-gates.d.ts +9 -1
  320. package/dist/types/execution.d.ts +2 -0
  321. package/dist/types/gemini-integration.d.ts +0 -11
  322. package/dist/types/handoff-artifacts.d.ts +41 -0
  323. package/dist/types/hooks-advanced.d.ts +0 -13
  324. package/dist/types/impact-detection.d.ts +2 -2
  325. package/dist/types/index.d.ts +3 -6
  326. package/dist/types/index.js +2 -5
  327. package/dist/types/kiro-integration.d.ts +0 -6
  328. package/dist/types/network-policy.d.ts +1 -1
  329. package/dist/types/project/lint-scaffolder.d.ts +1 -1
  330. package/dist/types/runtime-policy.d.ts +11 -0
  331. package/dist/types/session-safeguard.d.ts +0 -31
  332. package/dist/types/spec/canonical-repair.d.ts +81 -0
  333. package/dist/types/spec/canonical-repair.js +2 -0
  334. package/dist/types/spec/core.d.ts +20 -0
  335. package/dist/types/spec/index.d.ts +1 -0
  336. package/dist/types/spec/index.js +1 -0
  337. package/dist/types/spec/inputs.d.ts +35 -1
  338. package/dist/types/spec-format.d.ts +25 -1
  339. package/dist/types/telemetry.d.ts +4 -1
  340. package/dist/types/transition-log.d.ts +1 -1
  341. package/dist/types/transport.d.ts +0 -2
  342. package/dist/types/usage.d.ts +1 -36
  343. package/dist/types/usage.js +1 -1
  344. package/dist/types/validate-worker.d.ts +6 -0
  345. package/dist/types/validation-receipt.d.ts +1 -1
  346. package/dist/types/validation.d.ts +10 -4
  347. package/package.json +17 -12
  348. package/planu-native.json +1 -1
  349. package/planu-plugin.json +23 -40
  350. package/scripts/lib/pending-release-file.mjs +93 -0
  351. package/src/i18n/messages/en.json +0 -41
  352. package/src/i18n/messages/es.json +0 -41
  353. package/src/i18n/messages/pt.json +0 -41
  354. package/dist/cli/commands/activate.d.ts +0 -14
  355. package/dist/cli/commands/activate.js +0 -174
  356. package/dist/config/license-plans.json +0 -251
  357. package/dist/config/product-public.ts +0 -148
  358. package/dist/config/server-instructions.ts +0 -121
  359. package/dist/config/version-defaults.ts +0 -76
  360. package/dist/config/version.ts +0 -21
  361. package/dist/engine/ai-integration/gemini/settings-generator.d.ts +0 -4
  362. package/dist/engine/ai-integration/gemini/settings-generator.js +0 -195
  363. package/dist/engine/ai-integration/kiro/hooks-generator.d.ts +0 -6
  364. package/dist/engine/ai-integration/kiro/hooks-generator.js +0 -75
  365. package/dist/engine/hooks/full-spectrum-generator.d.ts +0 -32
  366. package/dist/engine/hooks/full-spectrum-generator.js +0 -117
  367. package/dist/engine/license-validator/config-loader.d.ts +0 -5
  368. package/dist/engine/license-validator/config-loader.js +0 -16
  369. package/dist/engine/license-validator/core.d.ts +0 -15
  370. package/dist/engine/license-validator/core.js +0 -151
  371. package/dist/engine/license-validator/fingerprint.d.ts +0 -3
  372. package/dist/engine/license-validator/fingerprint.js +0 -17
  373. package/dist/engine/license-validator/lemon-squeezy.d.ts +0 -5
  374. package/dist/engine/license-validator/lemon-squeezy.js +0 -55
  375. package/dist/engine/license-validator.d.ts +0 -5
  376. package/dist/engine/license-validator.js +0 -6
  377. package/dist/engine/product-intelligence/index.d.ts +0 -7
  378. package/dist/engine/product-intelligence/index.js +0 -211
  379. package/dist/engine/session/auto-save.d.ts +0 -18
  380. package/dist/engine/session/auto-save.js +0 -98
  381. package/dist/engine/session/context-snapshot.d.ts +0 -8
  382. package/dist/engine/session/context-snapshot.js +0 -49
  383. package/dist/engine/session/memory-sync.d.ts +0 -12
  384. package/dist/engine/session/memory-sync.js +0 -34
  385. package/dist/engine/session/session-diff.d.ts +0 -11
  386. package/dist/engine/session/session-diff.js +0 -42
  387. package/dist/engine/session/session-merge.d.ts +0 -12
  388. package/dist/engine/session/session-merge.js +0 -55
  389. package/dist/engine/session-safeguard/checkpoint-runner.d.ts +0 -4
  390. package/dist/engine/session-safeguard/checkpoint-runner.js +0 -70
  391. package/dist/engine/session-safeguard/learnings-buffer.d.ts +0 -15
  392. package/dist/engine/session-safeguard/learnings-buffer.js +0 -91
  393. package/dist/engine/session-safeguard/precompaction-drain.d.ts +0 -10
  394. package/dist/engine/session-safeguard/precompaction-drain.js +0 -82
  395. package/dist/engine/session-safeguard/unpushed-detector.d.ts +0 -7
  396. package/dist/engine/session-safeguard/unpushed-detector.js +0 -59
  397. package/dist/engine/spec-changelog/core.d.ts +0 -16
  398. package/dist/engine/spec-changelog/core.js +0 -176
  399. package/dist/engine/spec-changelog/diff.d.ts +0 -18
  400. package/dist/engine/spec-changelog/diff.js +0 -121
  401. package/dist/engine/spec-changelog/index.d.ts +0 -3
  402. package/dist/engine/spec-changelog/index.js +0 -4
  403. package/dist/engine/trial-engine.d.ts +0 -5
  404. package/dist/engine/trial-engine.js +0 -14
  405. package/dist/engine/usage-tracker/rate-check.d.ts +0 -7
  406. package/dist/engine/usage-tracker/rate-check.js +0 -18
  407. package/dist/engine/usage-tracker/rate-limiter.d.ts +0 -14
  408. package/dist/engine/usage-tracker/rate-limiter.js +0 -73
  409. package/dist/engine/usage-tracker/trial.d.ts +0 -27
  410. package/dist/engine/usage-tracker/trial.js +0 -49
  411. package/dist/engine/webhook/event-handlers.d.ts +0 -25
  412. package/dist/engine/webhook/event-handlers.js +0 -89
  413. package/dist/engine/webhook/index.d.ts +0 -4
  414. package/dist/engine/webhook/index.js +0 -5
  415. package/dist/engine/webhook/server.d.ts +0 -12
  416. package/dist/engine/webhook/server.js +0 -249
  417. package/dist/engine/webhook/signature.d.ts +0 -16
  418. package/dist/engine/webhook/signature.js +0 -49
  419. package/dist/storage/license-store.d.ts +0 -6
  420. package/dist/storage/license-store.js +0 -63
  421. package/dist/storage/session-store.d.ts +0 -20
  422. package/dist/storage/session-store.js +0 -136
  423. package/dist/tools/activate-license.d.ts +0 -6
  424. package/dist/tools/activate-license.js +0 -132
  425. package/dist/tools/checkpoint-handler.d.ts +0 -3
  426. package/dist/tools/checkpoint-handler.js +0 -130
  427. package/dist/tools/export-session.d.ts +0 -3
  428. package/dist/tools/export-session.js +0 -90
  429. package/dist/tools/license-gate.d.ts +0 -18
  430. package/dist/tools/license-gate.js +0 -222
  431. package/dist/tools/license-status.d.ts +0 -3
  432. package/dist/tools/license-status.js +0 -93
  433. package/dist/tools/list-sessions.d.ts +0 -3
  434. package/dist/tools/list-sessions.js +0 -46
  435. package/dist/tools/planu-session-checkpoint.d.ts +0 -6
  436. package/dist/tools/planu-session-checkpoint.js +0 -42
  437. package/dist/tools/restore-session.d.ts +0 -3
  438. package/dist/tools/restore-session.js +0 -71
  439. package/dist/tools/spec-history.d.ts +0 -3
  440. package/dist/tools/spec-history.js +0 -59
  441. package/dist/tools/webhook.d.ts +0 -6
  442. package/dist/tools/webhook.js +0 -150
  443. package/dist/types/changelog.d.ts +0 -49
  444. package/dist/types/changelog.js +0 -3
  445. package/dist/types/licensing.d.ts +0 -109
  446. package/dist/types/licensing.js +0 -4
  447. package/dist/types/product-intelligence.d.ts +0 -60
  448. package/dist/types/product-intelligence.js +0 -3
  449. package/dist/types/session.d.ts +0 -84
  450. package/dist/types/session.js +0 -3
  451. package/dist/types/webhook.d.ts +0 -62
  452. package/dist/types/webhook.js +0 -4
@@ -84,7 +84,7 @@ export function buildStatusResponse(result, specId, currentStatus, newStatus, re
84
84
  const toEmoji = STATUS_EMOJIS[newStatus];
85
85
  const r = result;
86
86
  const lines = [
87
- `**SPEC-${specId}** moved: ${fromEmoji} \`${currentStatus}\` → ${toEmoji} \`${newStatus}\``,
87
+ `**${specId}** moved: ${fromEmoji} \`${currentStatus}\` → ${toEmoji} \`${newStatus}\``,
88
88
  ];
89
89
  if (r.committed && r.transitionId) {
90
90
  lines.push(`\nTransition committed: \`${r.transitionId}\``);
@@ -125,7 +125,7 @@ export function buildStatusResponse(result, specId, currentStatus, newStatus, re
125
125
  lines.push(`\n✅ Validate score: ${String(r.validateScore)}/100${sourceSuffix}`);
126
126
  }
127
127
  if (r.cascade.affectedSpecs.length > 0) {
128
- lines.push(`\n🔗 Downstream specs affected: ${r.cascade.affectedSpecs.map((s) => `SPEC-${s}`).join(', ')}`);
128
+ lines.push(`\n🔗 Downstream specs affected: ${r.cascade.affectedSpecs.join(', ')}`);
129
129
  }
130
130
  if (r.codeRealityWarning) {
131
131
  lines.push(`\n${r.codeRealityWarning}`);
@@ -200,7 +200,7 @@ export function buildStatusResponse(result, specId, currentStatus, newStatus, re
200
200
  const markdownText = reconciliationMarkdown
201
201
  ? `${withNextSteps}\n\n${reconciliationMarkdown}`
202
202
  : withNextSteps;
203
- const displayTitle = specTitle ?? `SPEC-${specId}`;
203
+ const displayTitle = specTitle ?? specId;
204
204
  const humanSummary = buildUpdateStatusSummary(displayTitle, newStatus);
205
205
  const warningItems = [
206
206
  r.protectedBranchWarning,
@@ -35,6 +35,7 @@ export declare function fireAndForgetSideEffects(params: {
35
35
  projectId: string;
36
36
  spec: Spec;
37
37
  currentStatus: SpecStatus;
38
+ projectPath?: string;
38
39
  }): void;
39
40
  /**
40
41
  * SPEC-772: Run cascade and await fast hooks (fast: true) within a 2s window.
@@ -50,5 +51,6 @@ export declare function runCascadeForResponse(params: {
50
51
  projectId: string;
51
52
  spec: Spec;
52
53
  currentStatus: SpecStatus;
54
+ projectPath?: string;
53
55
  }): Promise<RunCascadeResult | null>;
54
56
  //# sourceMappingURL=side-effects.d.ts.map
@@ -193,7 +193,7 @@ function readDisabledByEnv() {
193
193
  /** Fire-and-forget side effects after a successful status transition. */
194
194
  export function fireAndForgetSideEffects(params) {
195
195
  const { knowledge, allSpecs, specId, newStatus, validateScore, projectId, spec, currentStatus } = params;
196
- const projectPath = knowledge?.projectPath;
196
+ const projectPath = params.projectPath ?? knowledge?.projectPath;
197
197
  const ctx = {
198
198
  specId,
199
199
  spec,
@@ -223,7 +223,7 @@ export function fireAndForgetSideEffects(params) {
223
223
  */
224
224
  export async function runCascadeForResponse(params) {
225
225
  const { knowledge, allSpecs, specId, newStatus, validateScore, projectId, spec, currentStatus } = params;
226
- const projectPath = knowledge?.projectPath;
226
+ const projectPath = params.projectPath ?? knowledge?.projectPath;
227
227
  const ctx = {
228
228
  specId,
229
229
  spec,
@@ -4,7 +4,7 @@ import { ti } from '../../i18n/index.js';
4
4
  import { validateDoR } from '../../engine/dor-dod.js';
5
5
  import { dispatchFeedbackEvent } from '../learn.js';
6
6
  import { scoreAmbiguityFromPath } from '../../engine/ambiguity-scorer.js';
7
- import { checkReadinessInternal } from '../../engine/readiness-checker.js';
7
+ import { checkSpecReadiness } from '../../engine/readiness-checker.js';
8
8
  import { validateEnglishOnlySpecText } from '../../engine/spec-language/english-only.js';
9
9
  import { checkGroundedSpecContract } from '../../engine/spec-grounding/contract.js';
10
10
  import { checkGenericSpecOutput } from '../../engine/spec-quality/generic-output-gate.js';
@@ -255,7 +255,19 @@ export async function checkReadinessGate(spec, newStatus, forceApprove) {
255
255
  catch (error) {
256
256
  /* reliability-optional: READINESS_SPEC_UNREADABLE — transition fails closed below */
257
257
  reportClassifiedDegradation('READINESS_SPEC_UNREADABLE', error);
258
- return readinessUnavailable('READINESS_SPEC_UNREADABLE', error instanceof Error ? error.message : 'spec.md could not be read');
258
+ // SPEC-1351 (AC4): a missing spec.md (ENOENT) is a distinct, recoverable
259
+ // situation — surface an actionable message instead of the raw fs error
260
+ // ("ENOENT: no such file or directory, open '<path>'") that update_status
261
+ // was previously appending "Transition blocked..." to verbatim.
262
+ const isMissingFile = typeof error === 'object' &&
263
+ error !== null &&
264
+ 'code' in error &&
265
+ error.code === 'ENOENT';
266
+ return readinessUnavailable('READINESS_SPEC_UNREADABLE', isMissingFile
267
+ ? `spec.md is missing at ${spec.specPath}. Recreate the spec via create_spec or restore spec.md from git/backup before retrying this transition.`
268
+ : error instanceof Error
269
+ ? error.message
270
+ : 'spec.md could not be read');
259
271
  }
260
272
  // Guard: mock environments return undefined; unreadable files return non-string
261
273
  if (typeof body !== 'string') {
@@ -331,18 +343,21 @@ export async function checkReadinessGate(spec, newStatus, forceApprove) {
331
343
  qualityWarnings: [],
332
344
  };
333
345
  }
334
- let score;
335
- let warnings;
336
- let criteriaCount;
346
+ let readiness;
337
347
  try {
338
- ({ score, warnings, criteriaCount } = checkReadinessInternal(body));
348
+ readiness = await checkSpecReadiness(spec, 'strict');
339
349
  }
340
350
  catch (error) {
341
351
  /* reliability-optional: READINESS_EVALUATION_FAILED — transition fails closed below */
342
352
  reportClassifiedDegradation('READINESS_EVALUATION_FAILED', error);
343
353
  return readinessUnavailable('READINESS_EVALUATION_FAILED', error instanceof Error ? error.message : 'readiness evaluation failed');
344
354
  }
345
- if (criteriaCount === 0) {
355
+ const { score } = readiness;
356
+ const blockers = [...readiness.issues.blockers];
357
+ const warnings = [...readiness.issues.warnings];
358
+ const issues = [...blockers, ...warnings];
359
+ const hasNoCriteria = readiness.issues.breakdown.criteria === 0;
360
+ if (hasNoCriteria) {
346
361
  if (newStatus === 'review') {
347
362
  return {
348
363
  blockResult: {
@@ -357,6 +372,7 @@ export async function checkReadinessGate(spec, newStatus, forceApprove) {
357
372
  error: 'READINESS_GATE_BLOCKED',
358
373
  score,
359
374
  threshold: 70,
375
+ blockers,
360
376
  warnings,
361
377
  fixHint: 'Add at least 3 testable acceptance criteria before moving to review.',
362
378
  },
@@ -388,24 +404,32 @@ export async function checkReadinessGate(spec, newStatus, forceApprove) {
388
404
  },
389
405
  ],
390
406
  structuredContent: {
407
+ error: 'READINESS_GATE_BLOCKED',
408
+ score,
409
+ threshold: 70,
410
+ blockers,
411
+ warnings,
391
412
  interactiveQuestions: [question],
392
413
  },
393
414
  },
394
415
  qualityWarnings: [],
395
416
  };
396
417
  }
397
- if (score >= 70) {
418
+ if (readiness.ready) {
398
419
  return { blockResult: null, qualityWarnings: [] };
399
420
  }
421
+ const diagnostic = score < 70
422
+ ? `score ${String(score)}/100 is below the 70 threshold`
423
+ : `score ${String(score)}/100 meets the threshold, but ${String(blockers.length)} canonical blocker(s) remain`;
424
+ const issuesSummary = issues.slice(0, 3).join('; ');
400
425
  if (newStatus === 'review') {
401
- const warningsSummary = warnings.slice(0, 3).join('; ');
402
426
  return {
403
427
  blockResult: {
404
428
  content: [
405
429
  {
406
430
  type: 'text',
407
- text: `Readiness gate blocked transition to review: score ${String(score)}/100 — below 70 threshold. ` +
408
- `Warnings: ${warningsSummary}`,
431
+ text: `Readiness gate blocked transition to review: ${diagnostic}. ` +
432
+ `Issues: ${issuesSummary}`,
409
433
  },
410
434
  ],
411
435
  isError: true,
@@ -413,6 +437,7 @@ export async function checkReadinessGate(spec, newStatus, forceApprove) {
413
437
  error: 'READINESS_GATE_BLOCKED',
414
438
  score,
415
439
  threshold: 70,
440
+ blockers,
416
441
  warnings,
417
442
  fixHint: 'Complete the spec before moving from draft to review.',
418
443
  },
@@ -423,12 +448,11 @@ export async function checkReadinessGate(spec, newStatus, forceApprove) {
423
448
  // Score < 70
424
449
  if (forceApprove) {
425
450
  // Caller wants to force through — proceed with warnings attached
426
- return { blockResult: null, qualityWarnings: warnings };
451
+ return { blockResult: null, qualityWarnings: issues };
427
452
  }
428
- const warningsSummary = warnings.slice(0, 3).join('; ');
429
453
  const question = {
430
454
  header: 'Readiness gate',
431
- question: `Spec readiness score ${String(score)}/100 (threshold: 70). How to proceed?`,
455
+ question: `Spec readiness ${diagnostic}. How to proceed?`,
432
456
  multiSelect: false,
433
457
  options: [
434
458
  {
@@ -437,7 +461,7 @@ export async function checkReadinessGate(spec, newStatus, forceApprove) {
437
461
  },
438
462
  {
439
463
  label: 'view_missing',
440
- description: `View missing items: ${warningsSummary}`,
464
+ description: `View missing items: ${issuesSummary}`,
441
465
  },
442
466
  {
443
467
  label: 'force_approve',
@@ -450,10 +474,15 @@ export async function checkReadinessGate(spec, newStatus, forceApprove) {
450
474
  content: [
451
475
  {
452
476
  type: 'text',
453
- text: `Readiness gate: score ${String(score)}/100 — below 70 threshold. Warnings: ${warningsSummary}`,
477
+ text: `Readiness gate: ${diagnostic}. Issues: ${issuesSummary}`,
454
478
  },
455
479
  ],
456
480
  structuredContent: {
481
+ error: 'READINESS_GATE_BLOCKED',
482
+ score,
483
+ threshold: 70,
484
+ blockers,
485
+ warnings,
457
486
  interactiveQuestions: [question],
458
487
  },
459
488
  },
@@ -1,6 +1,7 @@
1
1
  import type { ConstitutionViolation } from '../types/index.js';
2
2
  export declare function runImplementingActions(projectId: string, specId: string, options?: {
3
3
  deferSideEffects?: boolean;
4
+ projectPath?: string;
4
5
  }): Promise<{
5
6
  autoBranch: string | undefined;
6
7
  protectedBranchWarning: string | null;
@@ -8,9 +9,10 @@ export declare function runImplementingActions(projectId: string, specId: string
8
9
  autopilotSummary: string[];
9
10
  }>;
10
11
  /** Create the implementation branch and refresh derived context after commit. */
11
- export declare function runImplementingSideEffects(projectId: string, specId: string): Promise<string | undefined>;
12
+ export declare function runImplementingSideEffects(projectId: string, specId: string, transitionProjectPath?: string): Promise<string | undefined>;
12
13
  export declare function runDoneActions(projectId: string, specId: string, gitBranch: string | undefined, options?: {
13
14
  deferSideEffects?: boolean;
15
+ projectPath?: string;
14
16
  }): Promise<{
15
17
  mergeWarning: string | null;
16
18
  prSuggestion: {
@@ -22,7 +24,7 @@ export declare function runDoneActions(projectId: string, specId: string, gitBra
22
24
  autopilotSummary: string[];
23
25
  }>;
24
26
  /** Run cleanup and state refreshes only after the done transition is durable. */
25
- export declare function runDoneSideEffects(projectId: string, specId: string, gitBranch: string | undefined): Promise<void>;
27
+ export declare function runDoneSideEffects(projectId: string, specId: string, gitBranch: string | undefined, transitionProjectPath?: string): Promise<void>;
26
28
  /**
27
29
  * Best-effort constitution compliance check for status transitions.
28
30
  * Returns warnings (never blocks the transition).
@@ -8,13 +8,17 @@ function normalizeRejectedReasons(results) {
8
8
  return reason instanceof Error ? reason : new Error(String(reason));
9
9
  });
10
10
  }
11
+ function suppliedProjectPath(value) {
12
+ const trimmed = value?.trim();
13
+ return trimmed && trimmed.length > 0 ? trimmed : undefined;
14
+ }
11
15
  export async function runImplementingActions(projectId, specId, options = {}) {
12
16
  let autoBranch;
13
17
  let protectedBranchWarning = null;
14
18
  // Check if on a protected branch
15
19
  try {
16
20
  const { resolveProjectPath, git: gitCmd } = await import('./git/git-helpers.js');
17
- const projectPath = await resolveProjectPath(projectId);
21
+ const projectPath = suppliedProjectPath(options.projectPath) ?? (await resolveProjectPath(projectId));
18
22
  const { stdout } = await gitCmd(projectPath, ['rev-parse', '--abbrev-ref', 'HEAD']);
19
23
  const currentBranch = stdout.trim();
20
24
  const protectedBranches = ['main', 'master', 'develop', 'production'];
@@ -27,7 +31,7 @@ export async function runImplementingActions(projectId, specId, options = {}) {
27
31
  }
28
32
  if (!options.deferSideEffects) {
29
33
  try {
30
- autoBranch = await runImplementingSideEffects(projectId, specId);
34
+ autoBranch = await runImplementingSideEffects(projectId, specId, options.projectPath);
31
35
  }
32
36
  catch {
33
37
  // Legacy direct callers keep best-effort behavior.
@@ -41,20 +45,20 @@ export async function runImplementingActions(projectId, specId, options = {}) {
41
45
  };
42
46
  }
43
47
  /** Create the implementation branch and refresh derived context after commit. */
44
- export async function runImplementingSideEffects(projectId, specId) {
48
+ export async function runImplementingSideEffects(projectId, specId, transitionProjectPath) {
49
+ const { resolveProjectPath } = await import('./git/git-helpers.js');
50
+ const projectPath = suppliedProjectPath(transitionProjectPath) ?? (await resolveProjectPath(projectId));
45
51
  let autoBranch;
46
52
  const foundSpec = await specStore.getSpec(projectId, specId);
47
53
  if (foundSpec && !foundSpec.gitBranch) {
48
54
  let branchResult;
49
55
  try {
50
- const { resolveProjectPath: resolveBranchPath } = await import('./git/git-helpers.js');
51
56
  const { handleCreateBranch } = await import('./git/branch-ops.js');
52
- const branchProjectPath = await resolveBranchPath(projectId);
53
- branchResult = await withAudit(branchProjectPath, 'update_status(implementing)', 'handleCreateBranch', () => handleCreateBranch(projectId, specId), (r) => ({ isError: r.isError }));
57
+ branchResult = await withAudit(projectPath, 'update_status(implementing)', 'handleCreateBranch', () => handleCreateBranch(projectId, specId, undefined, projectPath), (r) => ({ isError: r.isError }));
54
58
  }
55
59
  catch {
56
60
  const { handleCreateBranch } = await import('./git/branch-ops.js');
57
- branchResult = await handleCreateBranch(projectId, specId);
61
+ branchResult = await handleCreateBranch(projectId, specId, undefined, projectPath);
58
62
  }
59
63
  if (!branchResult.isError) {
60
64
  try {
@@ -70,8 +74,6 @@ export async function runImplementingSideEffects(projectId, specId) {
70
74
  // SPEC-600: Fire-and-forget cascade — recommend_model, orchestration plan, context check
71
75
  // -------------------------------------------------------------------------
72
76
  try {
73
- const { resolveProjectPath: resolveCascadePath } = await import('./git/git-helpers.js');
74
- const projectPath = await resolveCascadePath(projectId);
75
77
  const spec = foundSpec ?? (await specStore.getSpec(projectId, specId));
76
78
  const results = await Promise.allSettled([
77
79
  // SPEC-633: Write session state when spec moves to implementing
@@ -161,7 +163,7 @@ export async function runDoneActions(projectId, specId, gitBranch, options = {})
161
163
  (async () => {
162
164
  try {
163
165
  const { resolveProjectPath, git: gitCmd } = await import('./git/git-helpers.js');
164
- const projectPath = await resolveProjectPath(projectId);
166
+ const projectPath = suppliedProjectPath(options.projectPath) ?? (await resolveProjectPath(projectId));
165
167
  if (process.env.PLANU_ENABLE_AUTOCOMMIT === 'true') {
166
168
  await gitCmd(projectPath, ['add', 'planu/']);
167
169
  const { planuAutoCommit } = await import('../engine/git/planu-autocommit.js');
@@ -193,7 +195,7 @@ export async function runDoneActions(projectId, specId, gitBranch, options = {})
193
195
  const mergeResult = await Promise.resolve((async () => {
194
196
  try {
195
197
  const { resolveProjectPath, resolveBaseBranch, git: gitCmd, } = await import('./git/git-helpers.js');
196
- const projectPath = await resolveProjectPath(projectId);
198
+ const projectPath = suppliedProjectPath(options.projectPath) ?? (await resolveProjectPath(projectId));
197
199
  await gitCmd(projectPath, ['rev-parse', '--verify', gitBranch]);
198
200
  const baseBranch = await resolveBaseBranch(projectPath);
199
201
  if (!baseBranch) {
@@ -213,7 +215,7 @@ export async function runDoneActions(projectId, specId, gitBranch, options = {})
213
215
  mergeWarning = mergeResult;
214
216
  }
215
217
  if (!options.deferSideEffects) {
216
- void runDoneSideEffects(projectId, specId, gitBranch).catch(() => {
218
+ void runDoneSideEffects(projectId, specId, gitBranch, options.projectPath).catch(() => {
217
219
  // Legacy direct callers keep best-effort behavior.
218
220
  });
219
221
  }
@@ -231,9 +233,9 @@ export async function runDoneActions(projectId, specId, gitBranch, options = {})
231
233
  };
232
234
  }
233
235
  /** Run cleanup and state refreshes only after the done transition is durable. */
234
- export async function runDoneSideEffects(projectId, specId, gitBranch) {
236
+ export async function runDoneSideEffects(projectId, specId, gitBranch, transitionProjectPath) {
235
237
  const { resolveProjectPath } = await import('./git/git-helpers.js');
236
- const projectPath = await resolveProjectPath(projectId);
238
+ const projectPath = suppliedProjectPath(transitionProjectPath) ?? (await resolveProjectPath(projectId));
237
239
  const results = await Promise.allSettled([
238
240
  (async () => {
239
241
  const { cleanupSpecOnDone } = await import('./git/cleanup-ops.js');
@@ -3,28 +3,13 @@
3
3
  import { usageStore } from '../storage/index.js';
4
4
  import { filterEventsByPeriod } from '../engine/usage-tracker/core.js';
5
5
  import { calculateUsageStats, formatStatsAsMarkdown } from '../engine/usage-tracker/stats.js';
6
- import { calculateDaysSinceFirstRun, isTrialActive } from '../engine/usage-tracker/trial.js';
7
- import { getCurrentTier } from './license-gate.js';
8
6
  import { compactJson, compactResult } from './output-formatter.js';
9
7
  export async function handleUsageReport(args) {
10
8
  const format = args.format ?? 'markdown';
11
- const tier = await getCurrentTier();
12
- // Gather data from storage
13
9
  const usageLog = await usageStore.getUsageLog();
14
- const trialState = await usageStore.ensureTrialState();
15
- const today = new Date().toISOString().slice(0, 10);
16
- const todayCount = await usageStore.getDailyCallCount(today);
17
- // Compute context values
18
- const daysSinceFirstRun = calculateDaysSinceFirstRun(trialState.firstRunAt);
19
- const trialActive = isTrialActive(trialState.firstRunAt);
20
- let remainingDailyCalls = -1;
21
- if (tier === 'free') {
22
- const dailyLimit = trialActive ? 50 : 30;
23
- remainingDailyCalls = Math.max(0, dailyLimit - todayCount);
24
- }
25
10
  // Full report uses all events
26
11
  const allEvents = filterEventsByPeriod(usageLog.events, 'all');
27
- const stats = calculateUsageStats(allEvents, 0, 0, tier, daysSinceFirstRun, trialActive, remainingDailyCalls);
12
+ const stats = calculateUsageStats(allEvents, 0, 0);
28
13
  if (format === 'json') {
29
14
  return compactResult(compactJson(stats));
30
15
  }
@@ -3,32 +3,15 @@
3
3
  import { usageStore } from '../storage/index.js';
4
4
  import { filterEventsByPeriod } from '../engine/usage-tracker/core.js';
5
5
  import { calculateUsageStats, formatStatsAsMarkdown } from '../engine/usage-tracker/stats.js';
6
- import { calculateDaysSinceFirstRun, isTrialActive } from '../engine/usage-tracker/trial.js';
7
- import { getCurrentTier } from './license-gate.js';
8
6
  import { addNextSteps } from './response-helpers.js';
9
7
  import { t } from '../i18n/index.js';
10
8
  export async function handleUsageStats(args) {
11
9
  const period = args.period ?? '30d';
12
- const tier = await getCurrentTier();
13
- // Gather data from storage
14
10
  const usageLog = await usageStore.getUsageLog();
15
- const trialState = await usageStore.ensureTrialState();
16
- const today = new Date().toISOString().slice(0, 10);
17
- const todayCount = await usageStore.getDailyCallCount(today);
18
- // Compute context values
19
- const daysSinceFirstRun = calculateDaysSinceFirstRun(trialState.firstRunAt);
20
- const trialActive = isTrialActive(trialState.firstRunAt);
21
- // Remaining daily calls: only relevant for Starter tier
22
- let remainingDailyCalls = -1;
23
- if (tier === 'free') {
24
- const dailyLimit = trialActive ? 50 : 30;
25
- remainingDailyCalls = Math.max(0, dailyLimit - todayCount);
26
- }
27
11
  // Filter events by period and calculate stats
28
12
  const filteredEvents = filterEventsByPeriod(usageLog.events, period);
29
13
  const stats = calculateUsageStats(filteredEvents, 0, // activeSpecs — placeholder, no cross-layer access to spec store
30
- 0, // activeProjects — placeholder
31
- tier, daysSinceFirstRun, trialActive, remainingDailyCalls);
14
+ 0);
32
15
  const markdown = formatStatsAsMarkdown(stats);
33
16
  const header = t('tools.response.statsTitle');
34
17
  const withHeader = `${header}\n\n${markdown}`;
@@ -0,0 +1,4 @@
1
+ import type { ToolResult } from '../types/index.js';
2
+ /** Record local tool health without entitlement, tier, trial, or quota behavior. */
3
+ export declare function withUsageTracking<T>(toolName: string, handler: (args: T, extra?: unknown) => Promise<ToolResult>): (args: T, extra?: unknown) => Promise<ToolResult>;
4
+ //# sourceMappingURL=usage-tracking.d.ts.map
@@ -0,0 +1,20 @@
1
+ import { recordUsageEvent } from '../engine/usage-tracker/index.js';
2
+ import * as usageStore from '../storage/usage-store.js';
3
+ import { reportClassifiedDegradation } from '../errors/classified-degradation.js';
4
+ /** Record local tool health without entitlement, tier, trial, or quota behavior. */
5
+ export function withUsageTracking(toolName, handler) {
6
+ return async (args, extra) => {
7
+ const rawResult = (await handler(args, extra));
8
+ const result = rawResult ?? {
9
+ content: [{ type: 'text', text: 'Internal error: tool handler returned no result' }],
10
+ isError: true,
11
+ };
12
+ void usageStore
13
+ .appendUsageEvent(recordUsageEvent(toolName, result.isError !== true))
14
+ .catch((error) => {
15
+ reportClassifiedDegradation('USAGE_EVENT_WRITE_FAILED', error);
16
+ });
17
+ return result;
18
+ };
19
+ }
20
+ //# sourceMappingURL=usage-tracking.js.map
@@ -2,6 +2,7 @@ import type { LintCheckResult } from '../types/index.js';
2
2
  interface LintCheckContext {
3
3
  projectId?: string;
4
4
  specId?: string;
5
+ maximumTimeoutMs?: number;
5
6
  }
6
7
  export declare function runLintCheck(projectPath: string, lintCommand: string | null, context?: LintCheckContext): Promise<LintCheckResult>;
7
8
  export {};
@@ -80,7 +80,7 @@ export async function runLintCheck(projectPath, lintCommand, context = {}) {
80
80
  };
81
81
  }
82
82
  }
83
- const timeoutMs = lintCheckTimeoutMs();
83
+ const timeoutMs = Math.min(lintCheckTimeoutMs(), context.maximumTimeoutMs ?? Number.MAX_SAFE_INTEGER);
84
84
  try {
85
85
  const startedAt = Date.now();
86
86
  const processResult = await runProjectCommandPlan(plan, projectPath, timeoutMs, getToolExecutionSignal());
@@ -1,9 +1,10 @@
1
1
  import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
2
  import { validateContractCompliance } from '../engine/test-scaffold-generator.js';
3
3
  import type { ValidateInput, ToolResult, ContractSpec, ContractValidation } from '../types/index.js';
4
+ import type { ValidateWorkerProgress } from '../types/validate-worker.js';
4
5
  export { validateContractCompliance };
5
6
  export type { ContractSpec, ContractValidation };
6
7
  /** Public MCP boundary: persist and acknowledge validation work without running it inline. */
7
8
  export declare function handleValidate(args: ValidateInput): Promise<ToolResult>;
8
- export declare function executeValidate(args: ValidateInput, server?: McpServer): Promise<ToolResult>;
9
+ export declare function executeValidate(args: ValidateInput, server?: McpServer, onProgress?: (progress: ValidateWorkerProgress) => void): Promise<ToolResult>;
9
10
  //# sourceMappingURL=validate.d.ts.map