@codyswann/lisa 5.4.0 → 5.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (394) hide show
  1. package/README.md +60 -3
  2. package/all/copy-contents/gitignore +16 -0
  3. package/all/copy-contents/scripts/lisa-mutation.sh +4 -6
  4. package/all/copy-overwrite/scripts/fetch-test-access-map.d.mts +71 -0
  5. package/all/copy-overwrite/scripts/fetch-test-access-map.mjs +674 -0
  6. package/all/copy-overwrite/scripts/lib/affected-tests.mjs +818 -0
  7. package/all/copy-overwrite/scripts/lib/automation-provenance-local.mjs +48 -3
  8. package/all/copy-overwrite/scripts/lib/build-marker.mjs +410 -0
  9. package/all/copy-overwrite/scripts/lib/gate-pass-cache.mjs +537 -0
  10. package/all/copy-overwrite/scripts/lib/github-attestation-provider.mjs +68 -0
  11. package/all/copy-overwrite/scripts/lib/github-attestation-recovery.mjs +25 -10
  12. package/all/copy-overwrite/scripts/lib/github-attestation-verifier.mjs +4 -1
  13. package/all/copy-overwrite/scripts/lib/kill-marks.mjs +1 -2
  14. package/all/copy-overwrite/scripts/lib/lisa-cleanup-sweep-processes.mjs +3 -4
  15. package/all/copy-overwrite/scripts/lib/npm-update-allocate.mjs +1 -6
  16. package/all/copy-overwrite/scripts/lib/npm-update-authorization.mjs +25 -14
  17. package/all/copy-overwrite/scripts/lib/npm-update-cancel-origin.mjs +45 -11
  18. package/all/copy-overwrite/scripts/lib/npm-update-cancellation-proof.mjs +22 -11
  19. package/all/copy-overwrite/scripts/lib/npm-update-cancellation.mjs +29 -17
  20. package/all/copy-overwrite/scripts/lib/npm-update-controller-broker.mjs +1 -1
  21. package/all/copy-overwrite/scripts/lib/npm-update-controller-factory.mjs +19 -1
  22. package/all/copy-overwrite/scripts/lib/npm-update-gate-hooks.mjs +2 -1
  23. package/all/copy-overwrite/scripts/lib/npm-update-gate.mjs +5 -0
  24. package/all/copy-overwrite/scripts/lib/npm-update-gh-requests.mjs +57 -30
  25. package/all/copy-overwrite/scripts/lib/npm-update-helper-inventory.mjs +9 -1
  26. package/all/copy-overwrite/scripts/lib/npm-update-hosted-hook.mjs +1 -1
  27. package/all/copy-overwrite/scripts/lib/npm-update-leaf.mjs +6 -1
  28. package/all/copy-overwrite/scripts/lib/npm-update-policy.mjs +38 -0
  29. package/all/copy-overwrite/scripts/lib/npm-update-publication.mjs +21 -3
  30. package/all/copy-overwrite/scripts/lib/npm-update-publish.mjs +13 -1
  31. package/all/copy-overwrite/scripts/lib/npm-update-recovery.mjs +29 -4
  32. package/all/copy-overwrite/scripts/lib/npm-update-supersession.mjs +21 -7
  33. package/all/copy-overwrite/scripts/lib/npm-update-tool-launcher.mjs +1 -1
  34. package/all/copy-overwrite/scripts/lib/npm-update-tracker-cancel.mjs +139 -0
  35. package/all/copy-overwrite/scripts/lib/npm-update-tracker-jira.mjs +149 -19
  36. package/all/copy-overwrite/scripts/lib/npm-update-tracker-linear.mjs +72 -17
  37. package/all/copy-overwrite/scripts/lib/npm-update-tracker-wire.mjs +102 -12
  38. package/all/copy-overwrite/scripts/lib/npm-update-tracker.mjs +91 -13
  39. package/all/copy-overwrite/scripts/lib/push-admission.mjs +158 -0
  40. package/all/copy-overwrite/scripts/lib/push-gate-defaults.d.mts +34 -0
  41. package/all/copy-overwrite/scripts/lib/push-gate-defaults.mjs +147 -0
  42. package/all/copy-overwrite/scripts/lib/push-timing.mjs +323 -0
  43. package/all/copy-overwrite/scripts/lib/rspec-selection.mjs +672 -0
  44. package/all/copy-overwrite/scripts/lisa-affected-tests.mjs +566 -0
  45. package/all/copy-overwrite/scripts/lisa-automation-provenance.mjs +35 -8
  46. package/all/copy-overwrite/scripts/lisa-gates.mjs +29 -0
  47. package/all/copy-overwrite/scripts/lisa-lint-staged-preflight.mjs +10 -1
  48. package/all/copy-overwrite/scripts/lisa-npm-updater.mjs +8 -5
  49. package/all/copy-overwrite/scripts/lisa-push-timing-report.mjs +153 -0
  50. package/all/copy-overwrite/scripts/lisa-rspec-select.mjs +982 -0
  51. package/all/copy-overwrite/scripts/lisa-run-gates.mjs +231 -6
  52. package/all/copy-overwrite/scripts/npm-updater-helper-graph.json +148 -41
  53. package/all/deletions.json +11 -2
  54. package/cdk/create-only/vitest.config.local.ts +1 -7
  55. package/cdk/package-lisa/package.lisa.json +4 -4
  56. package/dist/cli/admit-cmd.d.ts +21 -0
  57. package/dist/cli/admit-cmd.d.ts.map +1 -0
  58. package/dist/cli/admit-cmd.js +142 -0
  59. package/dist/cli/admit-cmd.js.map +1 -0
  60. package/dist/cli/check-cmd.d.ts +72 -0
  61. package/dist/cli/check-cmd.d.ts.map +1 -0
  62. package/dist/cli/check-cmd.js +316 -0
  63. package/dist/cli/check-cmd.js.map +1 -0
  64. package/dist/cli/index.d.ts.map +1 -1
  65. package/dist/cli/index.js +6 -4
  66. package/dist/cli/index.js.map +1 -1
  67. package/dist/cli/lisa-test-run-admission.d.ts +18 -0
  68. package/dist/cli/lisa-test-run-admission.d.ts.map +1 -0
  69. package/dist/cli/lisa-test-run-admission.js +62 -0
  70. package/dist/cli/lisa-test-run-admission.js.map +1 -0
  71. package/dist/cli/lisa-test-run-payload.d.ts +37 -0
  72. package/dist/cli/lisa-test-run-payload.d.ts.map +1 -0
  73. package/dist/cli/lisa-test-run-payload.js +55 -0
  74. package/dist/cli/lisa-test-run-payload.js.map +1 -0
  75. package/dist/cli/lisa-test-run-shard-files.d.ts +89 -0
  76. package/dist/cli/lisa-test-run-shard-files.d.ts.map +1 -0
  77. package/dist/cli/lisa-test-run-shard-files.js +239 -0
  78. package/dist/cli/lisa-test-run-shard-files.js.map +1 -0
  79. package/dist/cli/lisa-test-run-shard.d.ts +6 -2
  80. package/dist/cli/lisa-test-run-shard.d.ts.map +1 -1
  81. package/dist/cli/lisa-test-run-shard.js +25 -13
  82. package/dist/cli/lisa-test-run-shard.js.map +1 -1
  83. package/dist/cli/lisa-test-run.d.ts +1 -1
  84. package/dist/cli/lisa-test-run.d.ts.map +1 -1
  85. package/dist/cli/lisa-test-run.js +47 -10
  86. package/dist/cli/lisa-test-run.js.map +1 -1
  87. package/dist/cli/update-check-hook.d.ts.map +1 -1
  88. package/dist/cli/update-check-hook.js +3 -0
  89. package/dist/cli/update-check-hook.js.map +1 -1
  90. package/dist/configs/vitest/base.d.ts +58 -135
  91. package/dist/configs/vitest/base.d.ts.map +1 -1
  92. package/dist/configs/vitest/base.js +76 -228
  93. package/dist/configs/vitest/base.js.map +1 -1
  94. package/dist/configs/vitest/cdk.d.ts.map +1 -1
  95. package/dist/configs/vitest/cdk.js +3 -2
  96. package/dist/configs/vitest/cdk.js.map +1 -1
  97. package/dist/configs/vitest/coverage-include-global-setup.d.ts.map +1 -1
  98. package/dist/configs/vitest/coverage-include-global-setup.js +3 -4
  99. package/dist/configs/vitest/coverage-include-global-setup.js.map +1 -1
  100. package/dist/configs/vitest/coverage-reports-directory.d.ts +27 -5
  101. package/dist/configs/vitest/coverage-reports-directory.d.ts.map +1 -1
  102. package/dist/configs/vitest/coverage-reports-directory.js +47 -10
  103. package/dist/configs/vitest/coverage-reports-directory.js.map +1 -1
  104. package/dist/configs/vitest/harper-fabric.d.ts.map +1 -1
  105. package/dist/configs/vitest/harper-fabric.js +3 -2
  106. package/dist/configs/vitest/harper-fabric.js.map +1 -1
  107. package/dist/configs/vitest/nestjs.d.ts.map +1 -1
  108. package/dist/configs/vitest/nestjs.js +3 -2
  109. package/dist/configs/vitest/nestjs.js.map +1 -1
  110. package/dist/configs/vitest/phaser.d.ts.map +1 -1
  111. package/dist/configs/vitest/phaser.js +3 -2
  112. package/dist/configs/vitest/phaser.js.map +1 -1
  113. package/dist/configs/vitest/refusal-announcement.d.ts +51 -0
  114. package/dist/configs/vitest/refusal-announcement.d.ts.map +1 -0
  115. package/dist/configs/vitest/refusal-announcement.js +97 -0
  116. package/dist/configs/vitest/refusal-announcement.js.map +1 -0
  117. package/dist/configs/vitest/socket-safe-temp-base.d.ts +3 -4
  118. package/dist/configs/vitest/socket-safe-temp-base.d.ts.map +1 -1
  119. package/dist/configs/vitest/socket-safe-temp-base.js +7 -6
  120. package/dist/configs/vitest/socket-safe-temp-base.js.map +1 -1
  121. package/dist/configs/vitest/typescript.d.ts.map +1 -1
  122. package/dist/configs/vitest/typescript.js +3 -2
  123. package/dist/configs/vitest/typescript.js.map +1 -1
  124. package/dist/core/admission-decision.d.ts +110 -0
  125. package/dist/core/admission-decision.d.ts.map +1 -0
  126. package/dist/core/admission-decision.js +91 -0
  127. package/dist/core/admission-decision.js.map +1 -0
  128. package/dist/core/admission-lock.d.ts +69 -0
  129. package/dist/core/admission-lock.d.ts.map +1 -0
  130. package/dist/core/admission-lock.js +278 -0
  131. package/dist/core/admission-lock.js.map +1 -0
  132. package/dist/core/admission-settings.d.ts +69 -0
  133. package/dist/core/admission-settings.d.ts.map +1 -0
  134. package/dist/core/admission-settings.js +204 -0
  135. package/dist/core/admission-settings.js.map +1 -0
  136. package/dist/core/admission-state.d.ts +50 -0
  137. package/dist/core/admission-state.d.ts.map +1 -0
  138. package/dist/core/admission-state.js +168 -0
  139. package/dist/core/admission-state.js.map +1 -0
  140. package/dist/core/admission.d.ts +70 -0
  141. package/dist/core/admission.d.ts.map +1 -0
  142. package/dist/core/admission.js +205 -0
  143. package/dist/core/admission.js.map +1 -0
  144. package/dist/core/lisa-owned-hash-ledger.d.ts.map +1 -1
  145. package/dist/core/lisa-owned-hash-ledger.js +440 -0
  146. package/dist/core/lisa-owned-hash-ledger.js.map +1 -1
  147. package/dist/core/nightly-e2e-guard-behavior-certificate.js +2 -2
  148. package/dist/core/project-config-push-gate.d.ts +66 -0
  149. package/dist/core/project-config-push-gate.d.ts.map +1 -0
  150. package/dist/core/project-config-push-gate.js +82 -0
  151. package/dist/core/project-config-push-gate.js.map +1 -0
  152. package/dist/core/project-config.d.ts +4 -0
  153. package/dist/core/project-config.d.ts.map +1 -1
  154. package/dist/core/project-config.js +14 -9
  155. package/dist/core/project-config.js.map +1 -1
  156. package/dist/core/upstream-evidence-manifest.d.ts.map +1 -1
  157. package/dist/core/upstream-evidence-manifest.js +234 -146
  158. package/dist/core/upstream-evidence-manifest.js.map +1 -1
  159. package/expo/package-lisa/package.lisa.json +2 -2
  160. package/harper-fabric/package-lisa/package.lisa.json +4 -4
  161. package/nestjs/create-only/vitest.config.local.ts +1 -7
  162. package/nestjs/package-lisa/package.lisa.json +4 -4
  163. package/npm-package/package-lisa/package.lisa.json +4 -4
  164. package/package.json +12 -11
  165. package/phaser/package-lisa/package.lisa.json +4 -4
  166. package/plugins/lisa/.claude-plugin/plugin.json +1 -1
  167. package/plugins/lisa/.codex-plugin/plugin.json +1 -1
  168. package/plugins/lisa/.codex-plugin/skills/lisa-drive-pr-to-merge/SKILL.md +16 -3
  169. package/plugins/lisa/.codex-plugin/skills/lisa-git-submit-pr/SKILL.md +1 -1
  170. package/plugins/lisa/.codex-plugin/skills/lisa-implement/SKILL.md +1 -1
  171. package/plugins/lisa/skills/lisa-drive-pr-to-merge/SKILL.md +16 -3
  172. package/plugins/lisa/skills/lisa-git-submit-pr/SKILL.md +1 -1
  173. package/plugins/lisa/skills/lisa-implement/SKILL.md +1 -1
  174. package/plugins/lisa-agy/plugin.json +1 -1
  175. package/plugins/lisa-agy/skills/lisa-drive-pr-to-merge/SKILL.md +16 -3
  176. package/plugins/lisa-agy/skills/lisa-git-submit-pr/SKILL.md +1 -1
  177. package/plugins/lisa-agy/skills/lisa-implement/SKILL.md +1 -1
  178. package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
  179. package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
  180. package/plugins/lisa-cdk-agy/plugin.json +1 -1
  181. package/plugins/lisa-cdk-copilot/.claude-plugin/plugin.json +1 -1
  182. package/plugins/lisa-cdk-cursor/.claude-plugin/plugin.json +1 -1
  183. package/plugins/lisa-cdk-devin/.claude-plugin/plugin.json +1 -1
  184. package/plugins/lisa-cdk-devin/.devin-plugin/plugin.json +1 -1
  185. package/plugins/lisa-copilot/.claude-plugin/plugin.json +1 -1
  186. package/plugins/lisa-copilot/skills/lisa-drive-pr-to-merge/SKILL.md +16 -3
  187. package/plugins/lisa-copilot/skills/lisa-git-submit-pr/SKILL.md +1 -1
  188. package/plugins/lisa-copilot/skills/lisa-implement/SKILL.md +1 -1
  189. package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
  190. package/plugins/lisa-cursor/skills/lisa-drive-pr-to-merge/SKILL.md +16 -3
  191. package/plugins/lisa-cursor/skills/lisa-git-submit-pr/SKILL.md +1 -1
  192. package/plugins/lisa-cursor/skills/lisa-implement/SKILL.md +1 -1
  193. package/plugins/lisa-devin/.claude-plugin/plugin.json +1 -1
  194. package/plugins/lisa-devin/.devin-plugin/plugin.json +1 -1
  195. package/plugins/lisa-devin/skills/lisa-drive-pr-to-merge/SKILL.md +16 -3
  196. package/plugins/lisa-devin/skills/lisa-git-submit-pr/SKILL.md +1 -1
  197. package/plugins/lisa-devin/skills/lisa-implement/SKILL.md +1 -1
  198. package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
  199. package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
  200. package/plugins/lisa-expo-agy/plugin.json +1 -1
  201. package/plugins/lisa-expo-copilot/.claude-plugin/plugin.json +1 -1
  202. package/plugins/lisa-expo-cursor/.claude-plugin/plugin.json +1 -1
  203. package/plugins/lisa-expo-devin/.claude-plugin/plugin.json +1 -1
  204. package/plugins/lisa-expo-devin/.devin-plugin/plugin.json +1 -1
  205. package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
  206. package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +1 -1
  207. package/plugins/lisa-harper-fabric-agy/plugin.json +1 -1
  208. package/plugins/lisa-harper-fabric-copilot/.claude-plugin/plugin.json +1 -1
  209. package/plugins/lisa-harper-fabric-cursor/.claude-plugin/plugin.json +1 -1
  210. package/plugins/lisa-harper-fabric-devin/.claude-plugin/plugin.json +1 -1
  211. package/plugins/lisa-harper-fabric-devin/.devin-plugin/plugin.json +1 -1
  212. package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
  213. package/plugins/lisa-nestjs/.codex-plugin/plugin.json +1 -1
  214. package/plugins/lisa-nestjs-agy/plugin.json +1 -1
  215. package/plugins/lisa-nestjs-copilot/.claude-plugin/plugin.json +1 -1
  216. package/plugins/lisa-nestjs-cursor/.claude-plugin/plugin.json +1 -1
  217. package/plugins/lisa-nestjs-devin/.claude-plugin/plugin.json +1 -1
  218. package/plugins/lisa-nestjs-devin/.devin-plugin/plugin.json +1 -1
  219. package/plugins/lisa-phaser/.claude-plugin/plugin.json +1 -1
  220. package/plugins/lisa-phaser/.codex-plugin/plugin.json +1 -1
  221. package/plugins/lisa-phaser-agy/plugin.json +1 -1
  222. package/plugins/lisa-phaser-copilot/.claude-plugin/plugin.json +1 -1
  223. package/plugins/lisa-phaser-cursor/.claude-plugin/plugin.json +1 -1
  224. package/plugins/lisa-phaser-devin/.claude-plugin/plugin.json +1 -1
  225. package/plugins/lisa-phaser-devin/.devin-plugin/plugin.json +1 -1
  226. package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
  227. package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
  228. package/plugins/lisa-rails-agy/plugin.json +1 -1
  229. package/plugins/lisa-rails-copilot/.claude-plugin/plugin.json +1 -1
  230. package/plugins/lisa-rails-cursor/.claude-plugin/plugin.json +1 -1
  231. package/plugins/lisa-rails-devin/.claude-plugin/plugin.json +1 -1
  232. package/plugins/lisa-rails-devin/.devin-plugin/plugin.json +1 -1
  233. package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
  234. package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
  235. package/plugins/lisa-typescript-agy/plugin.json +1 -1
  236. package/plugins/lisa-typescript-copilot/.claude-plugin/plugin.json +1 -1
  237. package/plugins/lisa-typescript-cursor/.claude-plugin/plugin.json +1 -1
  238. package/plugins/lisa-typescript-devin/.claude-plugin/plugin.json +1 -1
  239. package/plugins/lisa-typescript-devin/.devin-plugin/plugin.json +1 -1
  240. package/plugins/lisa-wiki/.claude-plugin/plugin.json +1 -1
  241. package/plugins/lisa-wiki/.codex-plugin/plugin.json +1 -1
  242. package/plugins/lisa-wiki-agy/plugin.json +1 -1
  243. package/plugins/lisa-wiki-copilot/.claude-plugin/plugin.json +1 -1
  244. package/plugins/lisa-wiki-cursor/.claude-plugin/plugin.json +1 -1
  245. package/plugins/lisa-wiki-devin/.claude-plugin/plugin.json +1 -1
  246. package/plugins/lisa-wiki-devin/.devin-plugin/plugin.json +1 -1
  247. package/plugins/src/base/skills/lisa-drive-pr-to-merge/SKILL.md +16 -3
  248. package/plugins/src/base/skills/lisa-git-submit-pr/SKILL.md +1 -1
  249. package/plugins/src/base/skills/lisa-implement/SKILL.md +1 -1
  250. package/rails/copy-overwrite/Gemfile.lisa +8 -0
  251. package/rails/copy-overwrite/lefthook.yml +25 -11
  252. package/rails/copy-overwrite/scripts/lisa-rails-gates.mjs +686 -0
  253. package/rails/copy-overwrite/scripts/lisa-rspec-shards.mjs +2 -2
  254. package/rails/copy-overwrite/scripts/lisa_crystalball_recorder.rb +239 -0
  255. package/rails/copy-overwrite/scripts/lisa_rspec_partial_coverage.rb +83 -0
  256. package/scripts/build-unless-marked.mjs +83 -0
  257. package/scripts/check-plugins-sync.sh +22 -5
  258. package/scripts/classify-markdown-assertions.mjs +141 -0
  259. package/scripts/integration-shard-build.mjs +143 -0
  260. package/scripts/lib/history-scanner-suites.mjs +19 -0
  261. package/scripts/lib/markdown-assertions/classify.mjs +289 -0
  262. package/scripts/lib/markdown-assertions/context.mjs +53 -0
  263. package/scripts/lib/markdown-assertions/corpus.mjs +222 -0
  264. package/scripts/lib/markdown-assertions/manifest-cull.mjs +86 -0
  265. package/scripts/lib/markdown-assertions/record-setup.mjs +265 -0
  266. package/scripts/lib/markdown-assertions/record.mjs +115 -0
  267. package/scripts/lib/markdown-assertions/record.vitest.config.mjs +24 -0
  268. package/scripts/lib/markdown-assertions/sites.mjs +273 -0
  269. package/scripts/lib/markdown-assertions/test-cull.mjs +768 -0
  270. package/scripts/lib/markdown-assertions/tokens.mjs +158 -0
  271. package/scripts/lib/shell-guard-trace.mjs +6 -0
  272. package/scripts/lib/test-access-map-setup.mjs +40 -0
  273. package/scripts/lib/test-access-map-tracer.mjs +205 -0
  274. package/scripts/lib/test-access-map.d.mts +72 -0
  275. package/scripts/lib/test-access-map.mjs +395 -0
  276. package/scripts/lib/test-timings-reporter.d.mts +17 -0
  277. package/scripts/lib/test-timings-reporter.mjs +99 -0
  278. package/scripts/plan-integration-shards.mjs +300 -0
  279. package/scripts/test-timing-report.d.mts +41 -0
  280. package/scripts/test-timing-report.mjs +361 -0
  281. package/scripts/two-channel-couplings.json +132 -36
  282. package/scripts/verify-npm-advisories-4333.mjs +3 -12
  283. package/typescript/copy-overwrite/.prettierignore +13 -0
  284. package/typescript/create-only/vitest.config.local.ts +1 -7
  285. package/typescript/package-lisa/package.lisa.json +4 -4
  286. package/all/copy-overwrite/scripts/lisa-scratch-run.sh +0 -1078
  287. package/dist/cli/lisa-test-run-bootstrap.d.ts +0 -3
  288. package/dist/cli/lisa-test-run-bootstrap.d.ts.map +0 -1
  289. package/dist/cli/lisa-test-run-bootstrap.js +0 -229
  290. package/dist/cli/lisa-test-run-bootstrap.js.map +0 -1
  291. package/dist/cli/lisa-test-run-ipc.d.ts +0 -49
  292. package/dist/cli/lisa-test-run-ipc.d.ts.map +0 -1
  293. package/dist/cli/lisa-test-run-ipc.js +0 -226
  294. package/dist/cli/lisa-test-run-ipc.js.map +0 -1
  295. package/dist/cli/lisa-test-run-process-group.d.ts +0 -30
  296. package/dist/cli/lisa-test-run-process-group.d.ts.map +0 -1
  297. package/dist/cli/lisa-test-run-process-group.js +0 -140
  298. package/dist/cli/lisa-test-run-process-group.js.map +0 -1
  299. package/dist/cli/lisa-test-run-reaper.d.ts +0 -3
  300. package/dist/cli/lisa-test-run-reaper.d.ts.map +0 -1
  301. package/dist/cli/lisa-test-run-reaper.js +0 -195
  302. package/dist/cli/lisa-test-run-reaper.js.map +0 -1
  303. package/dist/cli/lisa-test-run-runtime.d.ts +0 -46
  304. package/dist/cli/lisa-test-run-runtime.d.ts.map +0 -1
  305. package/dist/cli/lisa-test-run-runtime.js +0 -123
  306. package/dist/cli/lisa-test-run-runtime.js.map +0 -1
  307. package/dist/cli/lisa-test-run-supervisor.d.ts +0 -13
  308. package/dist/cli/lisa-test-run-supervisor.d.ts.map +0 -1
  309. package/dist/cli/lisa-test-run-supervisor.js +0 -265
  310. package/dist/cli/lisa-test-run-supervisor.js.map +0 -1
  311. package/dist/configs/vitest/fleet-admission-global-setup.d.ts +0 -34
  312. package/dist/configs/vitest/fleet-admission-global-setup.d.ts.map +0 -1
  313. package/dist/configs/vitest/fleet-admission-global-setup.js +0 -123
  314. package/dist/configs/vitest/fleet-admission-global-setup.js.map +0 -1
  315. package/dist/configs/vitest/fleet-admission.d.ts +0 -129
  316. package/dist/configs/vitest/fleet-admission.d.ts.map +0 -1
  317. package/dist/configs/vitest/fleet-admission.js +0 -239
  318. package/dist/configs/vitest/fleet-admission.js.map +0 -1
  319. package/dist/configs/vitest/scratch-authority.d.ts +0 -25
  320. package/dist/configs/vitest/scratch-authority.d.ts.map +0 -1
  321. package/dist/configs/vitest/scratch-authority.js +0 -107
  322. package/dist/configs/vitest/scratch-authority.js.map +0 -1
  323. package/dist/configs/vitest/scratch-bound-cleanup-programs.d.ts +0 -5
  324. package/dist/configs/vitest/scratch-bound-cleanup-programs.d.ts.map +0 -1
  325. package/dist/configs/vitest/scratch-bound-cleanup-programs.js +0 -219
  326. package/dist/configs/vitest/scratch-bound-cleanup-programs.js.map +0 -1
  327. package/dist/configs/vitest/scratch-bound-cleanup.d.ts +0 -28
  328. package/dist/configs/vitest/scratch-bound-cleanup.d.ts.map +0 -1
  329. package/dist/configs/vitest/scratch-bound-cleanup.js +0 -155
  330. package/dist/configs/vitest/scratch-bound-cleanup.js.map +0 -1
  331. package/dist/configs/vitest/scratch-bound-root-cleanup.d.ts +0 -17
  332. package/dist/configs/vitest/scratch-bound-root-cleanup.d.ts.map +0 -1
  333. package/dist/configs/vitest/scratch-bound-root-cleanup.js +0 -149
  334. package/dist/configs/vitest/scratch-bound-root-cleanup.js.map +0 -1
  335. package/dist/configs/vitest/scratch-global-setup.d.ts +0 -258
  336. package/dist/configs/vitest/scratch-global-setup.d.ts.map +0 -1
  337. package/dist/configs/vitest/scratch-global-setup.js +0 -505
  338. package/dist/configs/vitest/scratch-global-setup.js.map +0 -1
  339. package/dist/configs/vitest/scratch-leak-setup.d.ts +0 -2
  340. package/dist/configs/vitest/scratch-leak-setup.d.ts.map +0 -1
  341. package/dist/configs/vitest/scratch-leak-setup.js +0 -108
  342. package/dist/configs/vitest/scratch-leak-setup.js.map +0 -1
  343. package/dist/configs/vitest/scratch-namespace-authority.d.ts +0 -80
  344. package/dist/configs/vitest/scratch-namespace-authority.d.ts.map +0 -1
  345. package/dist/configs/vitest/scratch-namespace-authority.js +0 -291
  346. package/dist/configs/vitest/scratch-namespace-authority.js.map +0 -1
  347. package/dist/configs/vitest/scratch-owner.d.ts +0 -131
  348. package/dist/configs/vitest/scratch-owner.d.ts.map +0 -1
  349. package/dist/configs/vitest/scratch-owner.js +0 -297
  350. package/dist/configs/vitest/scratch-owner.js.map +0 -1
  351. package/dist/configs/vitest/scratch-route-profile.d.ts +0 -46
  352. package/dist/configs/vitest/scratch-route-profile.d.ts.map +0 -1
  353. package/dist/configs/vitest/scratch-route-profile.js +0 -233
  354. package/dist/configs/vitest/scratch-route-profile.js.map +0 -1
  355. package/dist/configs/vitest/scratch-run-root-compatibility.d.ts +0 -33
  356. package/dist/configs/vitest/scratch-run-root-compatibility.d.ts.map +0 -1
  357. package/dist/configs/vitest/scratch-run-root-compatibility.js +0 -137
  358. package/dist/configs/vitest/scratch-run-root-compatibility.js.map +0 -1
  359. package/dist/configs/vitest/scratch-run-root-intent.d.ts +0 -66
  360. package/dist/configs/vitest/scratch-run-root-intent.d.ts.map +0 -1
  361. package/dist/configs/vitest/scratch-run-root-intent.js +0 -183
  362. package/dist/configs/vitest/scratch-run-root-intent.js.map +0 -1
  363. package/dist/configs/vitest/scratch-setup.d.ts +0 -46
  364. package/dist/configs/vitest/scratch-setup.d.ts.map +0 -1
  365. package/dist/configs/vitest/scratch-setup.js +0 -226
  366. package/dist/configs/vitest/scratch-setup.js.map +0 -1
  367. package/dist/configs/vitest/scratch-supervision-intent.d.ts +0 -8
  368. package/dist/configs/vitest/scratch-supervision-intent.d.ts.map +0 -1
  369. package/dist/configs/vitest/scratch-supervision-intent.js +0 -125
  370. package/dist/configs/vitest/scratch-supervision-intent.js.map +0 -1
  371. package/dist/configs/vitest/scratch-supervision-protocol.d.ts +0 -12
  372. package/dist/configs/vitest/scratch-supervision-protocol.d.ts.map +0 -1
  373. package/dist/configs/vitest/scratch-supervision-protocol.js +0 -230
  374. package/dist/configs/vitest/scratch-supervision-protocol.js.map +0 -1
  375. package/dist/configs/vitest/scratch-supervision.d.ts +0 -69
  376. package/dist/configs/vitest/scratch-supervision.d.ts.map +0 -1
  377. package/dist/configs/vitest/scratch-supervision.js +0 -244
  378. package/dist/configs/vitest/scratch-supervision.js.map +0 -1
  379. package/dist/configs/vitest/scratch-sweep.d.ts +0 -66
  380. package/dist/configs/vitest/scratch-sweep.d.ts.map +0 -1
  381. package/dist/configs/vitest/scratch-sweep.js +0 -82
  382. package/dist/configs/vitest/scratch-sweep.js.map +0 -1
  383. package/dist/configs/vitest/scratch-tmpdir-trust.d.ts +0 -48
  384. package/dist/configs/vitest/scratch-tmpdir-trust.d.ts.map +0 -1
  385. package/dist/configs/vitest/scratch-tmpdir-trust.js +0 -194
  386. package/dist/configs/vitest/scratch-tmpdir-trust.js.map +0 -1
  387. package/dist/configs/vitest/scratch.d.ts +0 -19
  388. package/dist/configs/vitest/scratch.d.ts.map +0 -1
  389. package/dist/configs/vitest/scratch.js +0 -34
  390. package/dist/configs/vitest/scratch.js.map +0 -1
  391. package/dist/configs/vitest/synthesis-scratch-reclaim.d.ts +0 -86
  392. package/dist/configs/vitest/synthesis-scratch-reclaim.d.ts.map +0 -1
  393. package/dist/configs/vitest/synthesis-scratch-reclaim.js +0 -226
  394. package/dist/configs/vitest/synthesis-scratch-reclaim.js.map +0 -1
@@ -93,7 +93,13 @@ function originalBun(descriptor) {
93
93
  }
94
94
 
95
95
  /** Match complete message and Git metadata before any network/proof acceptance. */
96
- export function localDescriptor(descriptor, messageBytes, reference, policy) {
96
+ export function localDescriptor(
97
+ descriptor,
98
+ messageBytes,
99
+ reference,
100
+ policy,
101
+ tracker = "github"
102
+ ) {
97
103
  // Parsing never supplies the signed digest. Reject malformed UTF8 only on
98
104
  // this present-proof path; preserve any BOM as part of the actual message.
99
105
  const message = new TextDecoder("utf-8", {
@@ -120,9 +126,15 @@ export function localDescriptor(descriptor, messageBytes, reference, policy) {
120
126
  ].every(value => typeof value === "string" && HEX.test(value)),
121
127
  "invalid descriptor digest"
122
128
  );
129
+ // A Jira/Linear claim id is an opaque tracker comment id (the adapter proves the
130
+ // comment itself); only an explicit Jira/Linear tracker relaxes GitHub's decimal grammar. The committed tracker,
131
+ // read from HEAD, decides which grammar applies (#4873).
123
132
  requireProof(
124
133
  typeof descriptor.claimCommentId === "string" &&
125
- /^[1-9]\d*$/.test(descriptor.claimCommentId),
134
+ (["jira", "linear"].includes(tracker)
135
+ ? /^[A-Za-z0-9-]{1,64}$/
136
+ : /^[1-9]\d*$/
137
+ ).test(descriptor.claimCommentId),
126
138
  "invalid claim reference"
127
139
  );
128
140
  requireProof(
@@ -208,15 +220,48 @@ export function proofSnapshot() {
208
220
  return { paths, optional, bytes, bundleBytes, descriptor };
209
221
  }
210
222
 
223
+ /** Ceiling on one canonical tracker read, whatever deadline is inherited. */
224
+ const RESOLVER_TIMEOUT_MS = 30_000;
225
+
226
+ /**
227
+ * The canonical resolver's per-read deadline. It deliberately ignores the
228
+ * inherited `LISA_WORK_ITEM_TIMEOUT_MS`, so a zero or a huge value there cannot
229
+ * unbound it. `LISA_PROVENANCE_RESOLVER_TIMEOUT_MS` may only shorten it (a
230
+ * shorter deadline can only refuse sooner), which lets a suite prove a hung
231
+ * resolver is refused without sitting out thirty seconds.
232
+ * @param {Readonly<Record<string, string | undefined>>} env Process environment.
233
+ * @returns {number} Deadline in milliseconds.
234
+ */
235
+ export function resolverTimeoutMs(env = process.env) {
236
+ const requested = Number(env.LISA_PROVENANCE_RESOLVER_TIMEOUT_MS);
237
+ return Number.isSafeInteger(requested) &&
238
+ requested > 0 &&
239
+ requested < RESOLVER_TIMEOUT_MS
240
+ ? requested
241
+ : RESOLVER_TIMEOUT_MS;
242
+ }
243
+
211
244
  /** Reuse the shipped resolver and retain current canonical lifecycle requirements. */
212
245
  export function canonicalContext(message, config, policy, descriptor) {
246
+ // A Jira/Linear item is bound offline here: the hooks hold no tracker credential,
247
+ // and the publisher proves the live claim through its adapter (#4873).
248
+ if (["jira", "linear"].includes(config.tracker)) {
249
+ const vendor = resolveWorkItemContext(message, { config });
250
+ requireProof(
251
+ vendor.provider === config.tracker &&
252
+ vendor.ref === descriptor.workItem &&
253
+ descriptor.queue === policy.repository,
254
+ "canonical tracker scope differs"
255
+ );
256
+ return vendor;
257
+ }
213
258
  const context = resolveWorkItemContext(message, {
214
259
  config,
215
260
  requireLive: true,
216
261
  execute: (command, args, options) =>
217
262
  run(command === "gh" ? policy.ghExecutable : command, args, {
218
263
  ...options,
219
- timeout: 30_000,
264
+ timeout: resolverTimeoutMs(),
220
265
  maxBuffer: 1_048_576,
221
266
  env: { ...process.env, GH_HOST: "github.com" },
222
267
  }),
@@ -0,0 +1,410 @@
1
+ // This file is managed by Lisa and IS replaced on each `lisa` run.
2
+ // Do not edit directly — durable changes belong upstream in Lisa.
3
+
4
+ /**
5
+ * Build once per push, and let later steps prove they may skip their own build.
6
+ *
7
+ * A push used to build the package two or three times: every test gate runs a
8
+ * build before testing, and the plugin drift check rebuilds again. Repeating a
9
+ * deterministic build against the same tree proves nothing new
10
+ * (CodySwannGT/lisa#4595).
11
+ *
12
+ * The gate runner builds once, up front, at `--moment=push`, and records WHAT it
13
+ * built in a marker: the tree hash of the working tree, the lockfile hash, and
14
+ * the node and bun versions. It exports the marker's path as
15
+ * `LISA_BUILD_MARKER`. A later step skips its build only when every recorded
16
+ * fact still matches the current tree. Any mismatch, a missing or unreadable
17
+ * marker, or no `LISA_BUILD_MARKER` at all means "build exactly as before", so a
18
+ * stale `dist/` is still rebuilt (CodySwannGT/lisa#3778).
19
+ *
20
+ * The behaviour is off unless `.lisa.config.json` sets
21
+ * `pushGate.buildOnce: true`. With it off nothing here runs.
22
+ * @module build-marker
23
+ */
24
+
25
+ import { spawnSync } from "node:child_process";
26
+ import { createHash } from "node:crypto";
27
+ import {
28
+ copyFileSync,
29
+ existsSync,
30
+ mkdirSync,
31
+ mkdtempSync,
32
+ readFileSync,
33
+ rmSync,
34
+ statSync,
35
+ utimesSync,
36
+ writeFileSync,
37
+ } from "node:fs";
38
+ import { tmpdir } from "node:os";
39
+ import { dirname, join, resolve } from "node:path";
40
+
41
+ /** The environment variable that hands the marker to every gate. */
42
+ export const BUILD_MARKER_ENV = "LISA_BUILD_MARKER";
43
+
44
+ /** Where the marker lives, relative to the project root (gitignored). */
45
+ export const BUILD_MARKER_PATH = ".lisa/build-marker.json";
46
+
47
+ /** The schema token a reader refuses to parse past. */
48
+ export const BUILD_MARKER_SCHEMA = "lisa.build-marker/v1";
49
+
50
+ /** The id of the build step in the push timing report. */
51
+ export const BUILD_ONCE_ID = "build-once";
52
+
53
+ /** Lockfiles in the order they are looked for. */
54
+ const LOCKFILES = Object.freeze([
55
+ "bun.lock",
56
+ "bun.lockb",
57
+ "package-lock.json",
58
+ "pnpm-lock.yaml",
59
+ "yarn.lock",
60
+ ]);
61
+
62
+ /** Git's location variables, which a hook exports to its children. */
63
+ const GIT_LOCATION_ENV = new Set([
64
+ "GIT_DIR",
65
+ "GIT_WORK_TREE",
66
+ "GIT_INDEX_FILE",
67
+ "GIT_PREFIX",
68
+ ]);
69
+
70
+ /** The generated-artifact manifest whose paths count as "plugin" output. */
71
+ const MATERIALIZED_MANIFEST = "plugins/materialized-artifacts.json";
72
+
73
+ /**
74
+ * Read and validate `pushGate.buildOnce` from a parsed `.lisa.config.json`.
75
+ *
76
+ * An unrecognised value is refused rather than defaulted: a typo must not
77
+ * silently switch a behaviour on or off for the project that asked for it.
78
+ * @param {Record<string, unknown>|null|undefined} config Parsed config.
79
+ * @returns {boolean} Whether build-once is switched on (default `false`).
80
+ * @throws {Error} When `pushGate` or `pushGate.buildOnce` has the wrong type.
81
+ */
82
+ export function buildOnceEnabled(config) {
83
+ const pushGate = config?.pushGate;
84
+ if (pushGate === undefined) return false;
85
+ if (
86
+ pushGate === null ||
87
+ typeof pushGate !== "object" ||
88
+ Array.isArray(pushGate)
89
+ ) {
90
+ throw new Error(
91
+ `pushGate is ${JSON.stringify(pushGate)}; expected an object such as ` +
92
+ `{ "buildOnce": true }.`
93
+ );
94
+ }
95
+ const { buildOnce } = pushGate;
96
+ if (buildOnce === undefined) return false;
97
+ if (typeof buildOnce !== "boolean") {
98
+ throw new Error(
99
+ `pushGate.buildOnce is ${JSON.stringify(buildOnce)}; expected true or false.`
100
+ );
101
+ }
102
+ return buildOnce;
103
+ }
104
+
105
+ /**
106
+ * Run git and return trimmed stdout, or null when git fails.
107
+ * @param {string[]} args Git arguments.
108
+ * @param {object} [options] Options.
109
+ * @param {string} [options.cwd] Working directory.
110
+ * @param {NodeJS.ProcessEnv} [options.env] Extra environment.
111
+ * @returns {string|null} Output, or null on failure.
112
+ */
113
+ function git(args, { cwd = process.cwd(), env = {} } = {}) {
114
+ // Git exports these to hook children. Inherited, they would point this at
115
+ // whatever repository and index the hook was invoked for instead of `cwd`'s,
116
+ // and an inherited GIT_INDEX_FILE would defeat the private index below.
117
+ const inherited = Object.fromEntries(
118
+ Object.entries(process.env).filter(([key]) => !GIT_LOCATION_ENV.has(key))
119
+ );
120
+ const child = spawnSync("git", args, {
121
+ cwd,
122
+ encoding: "utf8",
123
+ env: { ...inherited, ...env },
124
+ maxBuffer: 64 * 1024 * 1024,
125
+ });
126
+ // probe-direction: fail-closed — a null tree never matches a marker, and a
127
+ // null status is never clean, so a failed git always means "build".
128
+ if (child.status !== 0) return null;
129
+ return child.stdout.trim();
130
+ }
131
+
132
+ /**
133
+ * The tree hash of the working tree as it is now, tracked and untracked files
134
+ * alike (ignored files excluded), without touching the real index.
135
+ *
136
+ * A private copy of the index keeps git's stat cache, so this costs about as
137
+ * much as `git status`.
138
+ * @param {string} [cwd] Project root.
139
+ * @returns {string|null} The tree hash, or null when it cannot be computed.
140
+ */
141
+ export function workingTreeHash(cwd = process.cwd()) {
142
+ const indexPath = git(
143
+ ["rev-parse", "--path-format=absolute", "--git-path", "index"],
144
+ {
145
+ cwd,
146
+ }
147
+ );
148
+ if (!indexPath) return null;
149
+ const scratch = mkdtempSync(join(tmpdir(), "lisa-build-marker-"));
150
+ const tempIndex = join(scratch, "index");
151
+ try {
152
+ if (existsSync(indexPath)) {
153
+ copyFileSync(indexPath, tempIndex);
154
+ // Keep the index's own mtime. Git treats an entry modified in the same
155
+ // second as the index as "racily clean" and re-hashes it; a copy stamped
156
+ // NOW would make git trust that entry's stat data, so a same-size edit
157
+ // made within that second would hash as the old content.
158
+ const { atime, mtime } = statSync(indexPath);
159
+ utimesSync(tempIndex, atime, mtime);
160
+ }
161
+ const env = { GIT_INDEX_FILE: tempIndex };
162
+ if (git(["add", "-A", "--", "."], { cwd, env }) === null) return null;
163
+ return git(["write-tree"], { cwd, env });
164
+ } finally {
165
+ rmSync(scratch, { recursive: true, force: true });
166
+ }
167
+ }
168
+
169
+ /**
170
+ * The first lockfile present and the sha256 of its bytes.
171
+ * @param {string} [cwd] Project root.
172
+ * @returns {{file: string, sha256: string}|null} The lockfile, or null if none.
173
+ */
174
+ export function lockfileHash(cwd = process.cwd()) {
175
+ const file = LOCKFILES.find(name => existsSync(join(cwd, name)));
176
+ if (!file) return null;
177
+ const sha256 = createHash("sha256")
178
+ .update(readFileSync(join(cwd, file)))
179
+ .digest("hex");
180
+ return { file, sha256 };
181
+ }
182
+
183
+ /**
184
+ * The bun version on PATH, or the running one, or null without bun.
185
+ * @returns {string|null} The version.
186
+ */
187
+ function bunVersion() {
188
+ if (process.versions.bun) return process.versions.bun;
189
+ const child = spawnSync("bun", ["--version"], { encoding: "utf8" });
190
+ return child.status === 0 ? child.stdout.trim() : null;
191
+ }
192
+
193
+ /**
194
+ * Everything a marker records about the inputs of a build.
195
+ * @typedef {object} BuildFingerprint
196
+ * @property {string|null} tree Working-tree hash.
197
+ * @property {{file: string, sha256: string}|null} lockfile Lockfile hash.
198
+ * @property {string} node Node version.
199
+ * @property {string|null} bun Bun version.
200
+ */
201
+
202
+ /**
203
+ * Fingerprint the current working tree and toolchain.
204
+ * @param {string} [cwd] Project root.
205
+ * @returns {BuildFingerprint} The fingerprint.
206
+ */
207
+ export function currentFingerprint(cwd = process.cwd()) {
208
+ return {
209
+ tree: workingTreeHash(cwd),
210
+ lockfile: lockfileHash(cwd),
211
+ node: process.versions.node,
212
+ bun: bunVersion(),
213
+ };
214
+ }
215
+
216
+ /**
217
+ * Whether `plugins/` and every path the plugin build materializes outside it
218
+ * are clean against git.
219
+ * @param {string} [cwd] Project root.
220
+ * @returns {boolean} True when nothing there has uncommitted changes.
221
+ */
222
+ export function pluginsClean(cwd = process.cwd()) {
223
+ const paths = ["plugins/"];
224
+ const manifest = join(cwd, MATERIALIZED_MANIFEST);
225
+ if (existsSync(manifest)) {
226
+ try {
227
+ const listed = JSON.parse(readFileSync(manifest, "utf8"));
228
+ if (Array.isArray(listed)) paths.push(...listed.filter(Boolean));
229
+ } catch {
230
+ return false;
231
+ }
232
+ }
233
+ const status = git(["status", "--porcelain", "--", ...paths], { cwd });
234
+ return status === "";
235
+ }
236
+
237
+ /**
238
+ * Decide whether a marker describes the current tree and toolchain.
239
+ *
240
+ * The marker records the tree before the build (`tree`) and after it
241
+ * (`builtTree`). The current tree must equal `builtTree`: the build may itself
242
+ * regenerate tracked artifacts, and the outputs on disk correspond to the tree
243
+ * it left behind.
244
+ * @param {object|null} marker A parsed marker.
245
+ * @param {BuildFingerprint} current The current fingerprint.
246
+ * @returns {{match: boolean, reason: string}} The decision and why.
247
+ */
248
+ export function markerMatches(marker, current) {
249
+ if (!marker || marker.schema !== BUILD_MARKER_SCHEMA) {
250
+ return { match: false, reason: "no readable build marker" };
251
+ }
252
+ if (!current.tree || current.tree !== marker.builtTree) {
253
+ return {
254
+ match: false,
255
+ reason: `tree ${current.tree ?? "unknown"} differs from built tree ${marker.builtTree}`,
256
+ };
257
+ }
258
+ if (
259
+ (current.lockfile?.file ?? null) !== (marker.lockfile?.file ?? null) ||
260
+ (current.lockfile?.sha256 ?? null) !== (marker.lockfile?.sha256 ?? null)
261
+ ) {
262
+ return { match: false, reason: "lockfile changed" };
263
+ }
264
+ if (current.node !== marker.node) {
265
+ return {
266
+ match: false,
267
+ reason: `node ${current.node} differs from ${marker.node}`,
268
+ };
269
+ }
270
+ if ((current.bun ?? null) !== (marker.bun ?? null)) {
271
+ return {
272
+ match: false,
273
+ reason: `bun ${current.bun} differs from ${marker.bun}`,
274
+ };
275
+ }
276
+ return { match: true, reason: `marker matches tree ${current.tree}` };
277
+ }
278
+
279
+ /**
280
+ * Read a marker file, or null when it is absent or unreadable.
281
+ * @param {string|undefined} path Marker path.
282
+ * @returns {object|null} The parsed marker.
283
+ */
284
+ export function readBuildMarker(path) {
285
+ if (!path || !existsSync(path)) return null;
286
+ try {
287
+ return JSON.parse(readFileSync(path, "utf8"));
288
+ } catch {
289
+ return null;
290
+ }
291
+ }
292
+
293
+ /**
294
+ * Write a marker file.
295
+ * @param {string} path Marker path.
296
+ * @param {object} marker The marker.
297
+ */
298
+ export function writeBuildMarker(path, marker) {
299
+ mkdirSync(dirname(path), { recursive: true });
300
+ writeFileSync(path, `${JSON.stringify(marker, null, 2)}\n`);
301
+ }
302
+
303
+ /**
304
+ * Whether `LISA_BUILD_MARKER` names a marker matching the current tree.
305
+ * @param {object} [options] Options.
306
+ * @param {string} [options.cwd] Project root.
307
+ * @param {NodeJS.ProcessEnv} [options.env] Environment to read the path from.
308
+ * @param {(cwd: string) => BuildFingerprint} [options.fingerprint] Fingerprinter.
309
+ * @returns {{match: boolean, reason: string, marker: object|null}} Decision.
310
+ */
311
+ export function checkBuildMarker({
312
+ cwd = process.cwd(),
313
+ env = process.env,
314
+ fingerprint = currentFingerprint,
315
+ } = {}) {
316
+ const path = env[BUILD_MARKER_ENV];
317
+ if (!path) {
318
+ return {
319
+ match: false,
320
+ reason: `${BUILD_MARKER_ENV} is unset`,
321
+ marker: null,
322
+ };
323
+ }
324
+ const marker = readBuildMarker(resolve(cwd, path));
325
+ return { ...markerMatches(marker, fingerprint(cwd)), marker };
326
+ }
327
+
328
+ /**
329
+ * The build-once step's entry in the push timing report.
330
+ * @typedef {object} BuildOnceEntry
331
+ * @property {"build-once"} id Step id.
332
+ * @property {string} level Always `required`: a failing build fails the push.
333
+ * @property {string} command The command that ran.
334
+ * @property {"passed"|"failed"} state Outcome, in the runner's STATE words.
335
+ * @property {number|null} code Exit code.
336
+ * @property {string} startedAt ISO start time.
337
+ * @property {number} durationMs Wall time of the build.
338
+ * @property {null} provedBy Always null; the build proves itself.
339
+ *
340
+ * Shaped like a push-timing gate entry so the runner can hand it to the
341
+ * timing report (CodySwannGT/lisa#4591) as a pre-gate step.
342
+ */
343
+
344
+ /**
345
+ * Run the project's `build` script once before the push gates and record it.
346
+ *
347
+ * Returns null when build-once is off or the project has no `build` script, so
348
+ * the push behaves exactly as before. On success the marker is written and its
349
+ * path exported to `env`; on failure the marker is removed and the caller
350
+ * fails the push.
351
+ * @param {object} options Options.
352
+ * @param {Record<string, unknown>|null|undefined} options.config Parsed config.
353
+ * @param {string} options.runner Task-runner prefix, e.g. `bun run`.
354
+ * @param {Record<string,string>|null} options.scripts Project scripts.
355
+ * @param {(command: string) => {code: number|null}} options.exec Executor.
356
+ * @param {string} [options.cwd] Project root.
357
+ * @param {NodeJS.ProcessEnv} [options.env] Environment to export into.
358
+ * @param {(cwd: string) => BuildFingerprint} [options.fingerprint] Fingerprinter.
359
+ * @param {(cwd: string) => boolean} [options.isPluginsClean] Plugin cleanliness probe.
360
+ * @param {() => number} [options.now] Clock in milliseconds.
361
+ * @returns {BuildOnceEntry|null} The step entry, or null when it did not run.
362
+ */
363
+ export function runBuildOnce({
364
+ config,
365
+ runner,
366
+ scripts,
367
+ exec,
368
+ cwd = process.cwd(),
369
+ env = process.env,
370
+ fingerprint = currentFingerprint,
371
+ isPluginsClean = pluginsClean,
372
+ now = Date.now,
373
+ }) {
374
+ if (!buildOnceEnabled(config)) return null;
375
+ if (!scripts || typeof scripts.build !== "string") return null;
376
+ const markerPath = join(cwd, BUILD_MARKER_PATH);
377
+ rmSync(markerPath, { force: true });
378
+ delete env[BUILD_MARKER_ENV];
379
+
380
+ const before = fingerprint(cwd);
381
+ const cleanBefore = isPluginsClean(cwd);
382
+ const command = `${runner} build`;
383
+ const started = now();
384
+ const { code } = exec(command);
385
+ const durationMs = now() - started;
386
+ const entry = state => ({
387
+ id: BUILD_ONCE_ID,
388
+ level: "required",
389
+ command,
390
+ state,
391
+ code,
392
+ startedAt: new Date(started).toISOString(),
393
+ durationMs,
394
+ provedBy: null,
395
+ });
396
+ if (code !== 0) return entry("failed");
397
+ const after = fingerprint(cwd);
398
+ writeBuildMarker(markerPath, {
399
+ schema: BUILD_MARKER_SCHEMA,
400
+ tree: before.tree,
401
+ builtTree: after.tree,
402
+ lockfile: after.lockfile,
403
+ node: after.node,
404
+ bun: after.bun,
405
+ pluginsCleanBeforeBuild: cleanBefore,
406
+ builtAt: new Date().toISOString(),
407
+ });
408
+ env[BUILD_MARKER_ENV] = markerPath;
409
+ return entry("passed");
410
+ }