@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
@@ -0,0 +1,239 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This file is managed by Lisa and IS replaced on each `lisa` run.
4
+ # Do not edit directly — durable changes belong upstream in Lisa.
5
+ # -----------------------------------------------------------------------------
6
+ # Crystalball map recorder for `quality-rails.yml` (CodySwannGT/lisa#4612).
7
+ #
8
+ # Loaded into CI's full RSpec run (and into every shard leg) with
9
+ # `rspec --require`, so the host's own spec_helper needs no edit. It runs
10
+ # gitlab-crystalball's map generator with its coverage strategy and writes
11
+ # which application files each spec file executed, as JSON:
12
+ #
13
+ # { "meta": { "baseSha", "createdAt", "runId", "job", "tool", ... },
14
+ # "map": { "spec/models/user_spec.rb": ["app/models/user.rb", ...] },
15
+ # "alwaysRun": ["spec/requests/js_spec.rb", ...] }
16
+ #
17
+ # The push-time selector (scripts/lisa-rspec-select.mjs) downloads that JSON
18
+ # and runs only the specs a change can reach. The map never decides what CI
19
+ # runs: CI always runs every spec.
20
+ #
21
+ # Two Crystalball strategies feed the map:
22
+ #
23
+ # - the coverage strategy: the files whose lines an example executed. It
24
+ # starts at `before(:suite)`, after the project's spec_helper has started
25
+ # SimpleCov, and reads the same `Coverage` measurement SimpleCov does, so
26
+ # the coverage numbers are unchanged.
27
+ # - the described-class strategy: the files that define the class a spec
28
+ # describes (`RSpec.describe User` -> app/models/user.rb and its
29
+ # ancestors'). Line coverage cannot see what runs only when a class loads,
30
+ # such as `validates`, `scope`, `has_many`, `attr_reader` or a one-line
31
+ # `def x = y`, so without it a model spec would not be linked to its model
32
+ # file. Its class-definition tracer starts when this file is required,
33
+ # before the application loads.
34
+ #
35
+ # A spec that relies on such a declaration of a class it does not describe
36
+ # can still be missing from the map. CI runs every spec, so that gap costs
37
+ # push-time feedback, never merge protection; tag the spec
38
+ # `lisa_always_run: true` to run it on every partial push.
39
+ #
40
+ # When nothing measures coverage at `before(:suite)` (no SimpleCov, or
41
+ # coverage started in legacy array mode), it records nothing and
42
+ # says why: application files loaded before a late `Coverage.start` would be
43
+ # missing from the map, and a map that misses files would let a push skip
44
+ # specs that can see a change. No map means pushes run the full suite.
45
+ #
46
+ # Crystalball's ActionView strategy is deliberately not registered: it sees a
47
+ # view only when the view is first compiled, so a view rendered by several
48
+ # specs would be linked to the first one alone. Views are left out of the map,
49
+ # and a changed view therefore runs the full suite.
50
+ #
51
+ # Loaded from inside the project, this file would itself be measured; the
52
+ # workflow copies it outside the project root first, as it does the shard
53
+ # recorder.
54
+ #
55
+ # ENVIRONMENT
56
+ # LISA_CRYSTALBALL_MAP_OUT Path of the JSON map to write. Unset = no-op.
57
+ # LISA_CRYSTALBALL_BASE_SHA The pull request's base commit the map is for.
58
+ # LISA_CRYSTALBALL_JOB Optional label of the job or shard leg.
59
+ # LISA_CRYSTALBALL_HEAD_SHA The commit this run tested (the pull request's
60
+ # head), which the push checks against GitHub.
61
+ # LISA_CRYSTALBALL_PIECE This leg's zero-based index among the legs.
62
+ # LISA_CRYSTALBALL_PIECES How many legs the suite ran in (1 unsharded).
63
+ # The push uses a map only when every piece is present and names the run,
64
+ # base and head commit GitHub reports for it; a map without them (an older
65
+ # workflow) is refused and the push runs the full suite.
66
+ # -----------------------------------------------------------------------------
67
+
68
+ require 'fileutils'
69
+ require 'json'
70
+ require 'pathname'
71
+ require 'set'
72
+ require 'time'
73
+
74
+ # Records a Crystalball execution map as the JSON the push selector reads.
75
+ module LisaCrystalballRecorder
76
+ SCHEMA_VERSION = 1
77
+
78
+ # Crystalball map storage that folds example ids into spec files as the
79
+ # generator dumps them, so memory stays bounded on a large suite.
80
+ class FileMapStorage
81
+ attr_reader :map
82
+
83
+ def initialize
84
+ @map = Hash.new { |hash, key| hash[key] = Set.new }
85
+ end
86
+
87
+ def clear!; end
88
+
89
+ # Crystalball dumps its metadata (a Hash with :type) first, then example
90
+ # groups: `{ "./spec/x_spec.rb[1:2]" => ["app/x.rb", ...] }`.
91
+ def dump(data)
92
+ return if data.key?(:type) || data.key?('type')
93
+
94
+ data.each do |example_id, files|
95
+ spec = LisaCrystalballRecorder.spec_file(example_id)
96
+ @map[spec].merge(Array(files).map(&:to_s))
97
+ end
98
+ end
99
+ end
100
+
101
+ module_function
102
+
103
+ def out_path
104
+ ENV.fetch('LISA_CRYSTALBALL_MAP_OUT', '')
105
+ end
106
+
107
+ def enabled?
108
+ !out_path.empty?
109
+ end
110
+
111
+ # "./spec/models/user_spec.rb[1:2]" -> "spec/models/user_spec.rb"
112
+ def spec_file(example_id)
113
+ example_id.to_s.sub(/\[[\d:]*\]\z/, '').sub(%r{\A\./}, '')
114
+ end
115
+
116
+ def relative(path)
117
+ absolute = Pathname.new(File.expand_path(path.to_s))
118
+ absolute.relative_path_from(Pathname.new(Dir.pwd)).to_s
119
+ end
120
+
121
+ # A non-negative integer from the environment, or nil when unset or not one.
122
+ def integer_env(name)
123
+ value = ENV.fetch(name, '')
124
+ value.match?(/\A\d+\z/) ? value.to_i : nil
125
+ end
126
+
127
+ def note(message)
128
+ warn "lisa-crystalball-recorder: #{message}"
129
+ end
130
+
131
+ # The reason no map can be recorded, or nil when one can.
132
+ def unusable_reason
133
+ return 'gitlab-crystalball is not installed (Lisa\'s Gemfile.lisa adds it)' unless load_crystalball
134
+
135
+ require 'coverage'
136
+ return 'nothing measures coverage at the start of the suite (start SimpleCov in spec_helper)' unless ::Coverage.running?
137
+
138
+ sample = ::Coverage.peek_result.each_value.first
139
+ return 'coverage runs in legacy array mode, which Crystalball cannot read' if sample && !sample.is_a?(Hash)
140
+
141
+ nil
142
+ end
143
+
144
+ def load_crystalball
145
+ require 'crystalball'
146
+ true
147
+ rescue LoadError
148
+ false
149
+ end
150
+
151
+ # Start tracing class definitions now, while this file is required and the
152
+ # application has not loaded yet; a tracer started at `before(:suite)` would
153
+ # miss every class an eager-loading test environment already defined.
154
+ def arm_definition_tracer!
155
+ return unless enabled? && load_crystalball
156
+
157
+ @sources = ::Crystalball::MapGenerator::ObjectSourcesDetector.new(root_path: Dir.pwd)
158
+ @sources.after_register
159
+ end
160
+
161
+ def start!
162
+ return unless enabled?
163
+
164
+ reason = unusable_reason
165
+ if reason
166
+ @sources&.before_finalize
167
+ note("no map recorded: #{reason}. Pushes will run the full suite.")
168
+ return
169
+ end
170
+
171
+ @storage = FileMapStorage.new
172
+ @always_run = Set.new
173
+ sources = @sources
174
+ @generator = ::Crystalball::MapGenerator.new do |config|
175
+ config.map_storage = @storage
176
+ config.compact_map = false
177
+ config.register ::Crystalball::MapGenerator::CoverageStrategy.new
178
+ config.register ::Crystalball::MapGenerator::DescribedClassStrategy.new(execution_detector: sources)
179
+ end
180
+ @generator.start!
181
+ end
182
+
183
+ def before_example(example)
184
+ @generator&.execute_before(example)
185
+ end
186
+
187
+ def after_example(example)
188
+ return unless @generator
189
+
190
+ @generator.execute_after(example)
191
+ metadata = example.metadata
192
+ return unless metadata[:js] || metadata[:lisa_always_run]
193
+
194
+ @always_run << relative(metadata[:rerun_file_path] || example.file_path)
195
+ end
196
+
197
+ def finish!
198
+ return unless @generator
199
+
200
+ @generator.finalize!
201
+ write_map
202
+ end
203
+
204
+ def write_map
205
+ path = File.expand_path(out_path)
206
+ FileUtils.mkdir_p(File.dirname(path))
207
+ File.write(path, "#{JSON.pretty_generate(document)}\n")
208
+ note("wrote #{@storage.map.size} spec file(s) to #{path}")
209
+ end
210
+
211
+ def document
212
+ {
213
+ 'meta' => {
214
+ 'version' => SCHEMA_VERSION,
215
+ 'tool' => 'gitlab-crystalball',
216
+ 'toolVersion' => defined?(::Crystalball::VERSION) ? ::Crystalball::VERSION : nil,
217
+ 'baseSha' => ENV.fetch('LISA_CRYSTALBALL_BASE_SHA', ''),
218
+ 'runId' => ENV.fetch('GITHUB_RUN_ID', ''),
219
+ 'job' => ENV.fetch('LISA_CRYSTALBALL_JOB', ''),
220
+ 'headSha' => ENV.fetch('LISA_CRYSTALBALL_HEAD_SHA', ''),
221
+ 'piece' => integer_env('LISA_CRYSTALBALL_PIECE'),
222
+ 'pieces' => integer_env('LISA_CRYSTALBALL_PIECES'),
223
+ 'createdAt' => Time.now.utc.iso8601
224
+ },
225
+ 'map' => @storage.map.keys.sort.to_h { |spec| [spec, @storage.map[spec].to_a.sort] },
226
+ 'alwaysRun' => @always_run.to_a.sort
227
+ }
228
+ end
229
+ end
230
+
231
+ if LisaCrystalballRecorder.enabled?
232
+ LisaCrystalballRecorder.arm_definition_tracer!
233
+ RSpec.configure do |config|
234
+ config.before(:suite) { LisaCrystalballRecorder.start! }
235
+ config.prepend_before(:example) { |example| LisaCrystalballRecorder.before_example(example) }
236
+ config.append_after(:example) { |example| LisaCrystalballRecorder.after_example(example) }
237
+ config.after(:suite) { LisaCrystalballRecorder.finish! }
238
+ end
239
+ end
@@ -0,0 +1,83 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This file is managed by Lisa and IS replaced on each `lisa` run.
4
+ # Do not edit directly — durable changes belong upstream in Lisa.
5
+ # -----------------------------------------------------------------------------
6
+ # Coverage hand-off for a PARTIAL push-time RSpec run (CodySwannGT/lisa#4612).
7
+ #
8
+ # When scripts/lisa-rspec-select.mjs runs only the specs a change can reach,
9
+ # the project's SimpleCov minimums would be checked against that slice and
10
+ # fail. Loaded with `rspec --require`, this file does what the CI shard
11
+ # recorder does at `before(:suite)`, once the project's spec_helper has
12
+ # started SimpleCov:
13
+ #
14
+ # 1. `SimpleCov.finalize_merge false`: store the resultset and stop there,
15
+ # with no report and no minimum check against the slice.
16
+ # 2. Write that resultset to a fresh directory the selector names, never to
17
+ # the project's own coverage/, so a partial result cannot merge with or
18
+ # replace a full run's.
19
+ #
20
+ # The selector then holds each CHANGED file to simplecov.thresholds.json on
21
+ # its own (pushGate.affectedCoverage "changed-files"). A file below its floor
22
+ # does not fail the push: the selector runs the full suite with whole-repo
23
+ # coverage and that verdict decides (CodySwannGT/lisa#4600: a push is never
24
+ # stricter than whole-repo coverage). CI still runs every spec and enforces
25
+ # the project's thresholds on the whole suite.
26
+ #
27
+ # It writes `status.json` beside the resultset, saying whether SimpleCov was
28
+ # measuring, so "this project measures no coverage" and "the run lost its
29
+ # coverage" cannot look alike. When it cannot hand off safely it writes
30
+ # `escalate` with the reason, and the selector runs the full suite.
31
+ #
32
+ # ENVIRONMENT
33
+ # LISA_RSPEC_PARTIAL_COVERAGE_DIR Fresh directory for the resultset. Required.
34
+ # -----------------------------------------------------------------------------
35
+
36
+ require 'fileutils'
37
+ require 'json'
38
+
39
+ # Moves a partial run's coverage out of the project's threshold check.
40
+ module LisaRspecPartialCoverage
41
+ # Why a partial run asks for the full suite instead (status.json `escalate`).
42
+ ESCALATE_NO_FINALIZE_MERGE = "this SimpleCov has no finalize_merge, so the slice cannot skip the project's minimums"
43
+
44
+ module_function
45
+
46
+ def directory
47
+ value = ENV.fetch('LISA_RSPEC_PARTIAL_COVERAGE_DIR', '')
48
+ raise ArgumentError, 'lisa-rspec-partial-coverage: LISA_RSPEC_PARTIAL_COVERAGE_DIR is not set' if value.empty?
49
+
50
+ File.expand_path(value)
51
+ end
52
+
53
+ def measuring?
54
+ defined?(::SimpleCov) && defined?(::Coverage) && ::Coverage.running?
55
+ end
56
+
57
+ def status(state)
58
+ FileUtils.mkdir_p(directory)
59
+ File.write(File.join(directory, 'status.json'), "#{JSON.generate(state)}\n")
60
+ end
61
+
62
+ def hand_off!
63
+ return status('measuring' => false) unless measuring?
64
+
65
+ unless ::SimpleCov.respond_to?(:finalize_merge)
66
+ # Never stricter than whole-repo coverage (CodySwannGT/lisa#4600): the
67
+ # slice cannot be measured safely, so ask the selector for the full
68
+ # suite, whose verdict decides the push, and stop the slice here.
69
+ status('measuring' => true, 'escalate' => ESCALATE_NO_FINALIZE_MERGE)
70
+ raise "lisa-rspec-partial-coverage: #{ESCALATE_NO_FINALIZE_MERGE}; the selector runs the full suite instead. " \
71
+ "Upgrade simplecov (Lisa's Gemfile.lisa pins >= 1.3.2) to keep partial pushes fast."
72
+ end
73
+
74
+ ::SimpleCov.coverage_path(directory)
75
+ ::SimpleCov.finalize_merge(false)
76
+ ::SimpleCov.command_name('Lisa partial push run')
77
+ status('measuring' => true, 'resultset' => File.join(directory, '.resultset.json'))
78
+ end
79
+ end
80
+
81
+ RSpec.configure do |config|
82
+ config.before(:suite) { LisaRspecPartialCoverage.hand_off! }
83
+ end
@@ -0,0 +1,83 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Build Lisa unless the push's build-once marker proves the build is current.
4
+ *
5
+ * `lisa-test-run` used to run `bun run build` unconditionally, so a push that
6
+ * ran two test gates built twice more after the gate runner's own build
7
+ * (CodySwannGT/lisa#4595). This skips the build only when `LISA_BUILD_MARKER`
8
+ * names a marker whose tree, lockfile and tool versions match the current
9
+ * working tree. Anything else — no variable, a missing or unreadable marker, a
10
+ * different tree — builds exactly as before, so a stale `dist/` is still rebuilt
11
+ * (CodySwannGT/lisa#3778).
12
+ *
13
+ * `--probe-plugins` builds nothing. It exits 0 when the marker matches AND
14
+ * records `plugins/` (with every materialized path) as clean before the
15
+ * up-front build, which is what lets `check:plugins` skip its own rebuild and
16
+ * go straight to the diff; it exits 1 otherwise.
17
+ * @module build-unless-marked
18
+ */
19
+
20
+ import { spawnSync } from "node:child_process";
21
+
22
+ import { checkBuildMarker } from "../all/copy-overwrite/scripts/lib/build-marker.mjs";
23
+ import { invokedAsScript } from "./lib/invoked-as-script.mjs";
24
+
25
+ /**
26
+ * Run the build, or skip it when the marker matches.
27
+ * @param {string[]} [argv] Arguments.
28
+ * @param {object} [options] Options.
29
+ * @param {string} [options.cwd] Project root.
30
+ * @param {NodeJS.ProcessEnv} [options.env] Environment.
31
+ * @param {(cwd: string) => import("../all/copy-overwrite/scripts/lib/build-marker.mjs").BuildFingerprint} [options.fingerprint] Fingerprinter.
32
+ * @param {(cwd: string) => number|null} [options.build] Build runner.
33
+ * @param {(line: string) => void} [options.log] Logger.
34
+ * @returns {number} Exit code.
35
+ */
36
+ export function main(
37
+ argv = process.argv.slice(2),
38
+ {
39
+ cwd = process.cwd(),
40
+ env = process.env,
41
+ fingerprint,
42
+ build = runBuild,
43
+ log = line => console.log(line),
44
+ } = {}
45
+ ) {
46
+ const decision = checkBuildMarker({
47
+ cwd,
48
+ env,
49
+ ...(fingerprint ? { fingerprint } : {}),
50
+ });
51
+ if (argv.includes("--probe-plugins")) {
52
+ if (decision.match && decision.marker?.pluginsCleanBeforeBuild === true) {
53
+ log(`build skipped: ${decision.reason}`);
54
+ return 0;
55
+ }
56
+ if (env.LISA_BUILD_MARKER) {
57
+ const why = decision.match
58
+ ? "plugins were dirty before the build"
59
+ : decision.reason;
60
+ log(`rebuilding plugins: ${why}`);
61
+ }
62
+ return 1;
63
+ }
64
+ if (decision.match) {
65
+ log(`build skipped: ${decision.reason}`);
66
+ return 0;
67
+ }
68
+ if (env.LISA_BUILD_MARKER) log(`building: ${decision.reason}`);
69
+ return build(cwd) ?? 1;
70
+ }
71
+
72
+ /**
73
+ * Run `bun run build` with inherited stdio.
74
+ * @param {string} cwd Project root.
75
+ * @returns {number|null} Exit code.
76
+ */
77
+ function runBuild(cwd) {
78
+ return spawnSync("bun", ["run", "build"], { cwd, stdio: "inherit" }).status;
79
+ }
80
+
81
+ if (invokedAsScript(import.meta.url)) {
82
+ process.exit(main());
83
+ }
@@ -22,7 +22,21 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
22
22
  ROOT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
23
23
  cd "$ROOT_DIR"
24
24
 
25
- if [ -n "$(git status --porcelain -- plugins/ 2>/dev/null)" ]; then
25
+ # Build once per push (CodySwannGT/lisa#4595). When the gate runner already
26
+ # built this exact tree and its marker records plugins/ and every materialized
27
+ # path as CLEAN before that build, the build it ran is the rebuild this check
28
+ # would run: skip both the pre-build refusals (any dirt now is the build's own
29
+ # output, which is precisely what the diff below must see) and the rebuild, and
30
+ # go straight to the diff. Without a matching marker this behaves as before.
31
+ MATERIALIZED_MANIFEST="$ROOT_DIR/plugins/materialized-artifacts.json"
32
+ marker_built=0
33
+ if [ -n "${LISA_BUILD_MARKER:-}" ] &&
34
+ node "$ROOT_DIR/scripts/build-unless-marked.mjs" --probe-plugins; then
35
+ marker_built=1
36
+ committed_manifest_paths="$(git show HEAD:plugins/materialized-artifacts.json 2>/dev/null | jq -r '.[]' | LC_ALL=C sort)"
37
+ fi
38
+
39
+ if [ "$marker_built" -eq 0 ] && [ -n "$(git status --porcelain -- plugins/ 2>/dev/null)" ]; then
26
40
  echo "✗ plugins/ has uncommitted changes before the sync check could run." >&2
27
41
  echo " Commit them, then re-run: bun run check:plugins" >&2
28
42
  echo " (To set them aside instead, save a patch under your own TMPDIR — not" >&2
@@ -39,9 +53,10 @@ fi
39
53
  # silently discarded the edit, which is the precise failure the plugins/
40
54
  # pre-check exists to prevent. Absent on a first run, before any manifest has
41
55
  # been committed; the post-build check covers that case.
42
- MATERIALIZED_MANIFEST="$ROOT_DIR/plugins/materialized-artifacts.json"
43
- committed_manifest_paths=""
44
- if [ -f "$MATERIALIZED_MANIFEST" ]; then
56
+ if [ "$marker_built" -eq 0 ]; then
57
+ committed_manifest_paths=""
58
+ fi
59
+ if [ "$marker_built" -eq 0 ] && [ -f "$MATERIALIZED_MANIFEST" ]; then
45
60
  committed_manifest_paths="$(jq -r '.[]' "$MATERIALIZED_MANIFEST" | LC_ALL=C sort)"
46
61
  committed_generated=()
47
62
  while IFS= read -r committed_path; do
@@ -67,7 +82,9 @@ if [ -f "$MATERIALIZED_MANIFEST" ]; then
67
82
  fi
68
83
  fi
69
84
 
70
- bun run build:plugins >/dev/null
85
+ if [ "$marker_built" -eq 0 ]; then
86
+ bun run build:plugins >/dev/null
87
+ fi
71
88
 
72
89
  # Did the SET of destinations change? Asked before the plugins/ diff below,
73
90
  # because the manifest lives under plugins/ and that diff would otherwise
@@ -0,0 +1,141 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Classify every Markdown assertion as STRUCTURAL, MACHINE-TOKEN or WORDING
4
+ * and cull the WORDING ones (CodySwannGT/lisa#4867). The rules live in
5
+ * `lib/markdown-assertions/classify.mjs`.
6
+ *
7
+ * Usage:
8
+ * node scripts/classify-markdown-assertions.mjs manifest # counts per class
9
+ * node scripts/classify-markdown-assertions.mjs manifest --check # exit 1 if any WORDING remains
10
+ * node scripts/classify-markdown-assertions.mjs manifest --apply # write the evidence file, drop WORDING
11
+ *
12
+ * `--apply` writes the classification of the manifest as it stood to
13
+ * `tests/phrase-manifest/classification/manifest.json` (the committed
14
+ * evidence) and rewrites `tests/phrase-manifest/required-phrases.json` with
15
+ * only the STRUCTURAL and MACHINE-TOKEN entries.
16
+ * @module scripts/classify-markdown-assertions
17
+ */
18
+ import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
19
+ import path from "node:path";
20
+
21
+ import { createClassifier } from "./lib/markdown-assertions/context.mjs";
22
+ import { cullManifest } from "./lib/markdown-assertions/manifest-cull.mjs";
23
+ import {
24
+ candidateTestFiles,
25
+ recordAssertions,
26
+ } from "./lib/markdown-assertions/record.mjs";
27
+ import {
28
+ classifySites,
29
+ evidenceSites,
30
+ siteCounts,
31
+ } from "./lib/markdown-assertions/sites.mjs";
32
+ import { cullTestFiles } from "./lib/markdown-assertions/test-cull.mjs";
33
+ import { REPO_ROOT } from "./lib/phrase-tests/repo.mjs";
34
+ import { MANIFEST_PATH } from "./lib/phrase-tests/manifest.mjs";
35
+
36
+ /** Where the committed classification evidence lives. */
37
+ const EVIDENCE_DIR = "tests/phrase-manifest/classification";
38
+
39
+ const [command, ...rest] = process.argv.slice(2);
40
+ const flags = new Set(rest);
41
+
42
+ /**
43
+ * Write a JSON file with a trailing newline.
44
+ * @param {string} file - Repository-relative path.
45
+ * @param {unknown} value - The value.
46
+ */
47
+ function writeJson(file, value) {
48
+ const absolute = path.join(REPO_ROOT, file);
49
+ mkdirSync(path.dirname(absolute), { recursive: true });
50
+ writeFileSync(absolute, `${JSON.stringify(value, null, 2)}\n`);
51
+ }
52
+
53
+ /**
54
+ * Write evidence JSON with one classified entry per line, so the file stays
55
+ * small and diffs line by line.
56
+ * @param {string} file - Repository-relative path.
57
+ * @param {unknown} value - The evidence.
58
+ */
59
+ function writeEvidence(file, value) {
60
+ const absolute = path.join(REPO_ROOT, file);
61
+ mkdirSync(path.dirname(absolute), { recursive: true });
62
+ const text = JSON.stringify(
63
+ value,
64
+ (_key, item) =>
65
+ item && typeof item === "object" && ("polarity" in item || "site" in item)
66
+ ? `\u0000${JSON.stringify(item)}`
67
+ : item,
68
+ 1
69
+ ).replaceAll(/"\\u0000((?:[^"\\]|\\.)*)"/gu, (_match, inner) =>
70
+ JSON.parse(`"${inner}"`)
71
+ );
72
+ writeFileSync(absolute, `${text}\n`);
73
+ }
74
+
75
+ if (command === "manifest") {
76
+ const manifestFile = path.join(REPO_ROOT, MANIFEST_PATH);
77
+ const manifest = JSON.parse(readFileSync(manifestFile, "utf8"));
78
+ const { evidence, culled, counts } = cullManifest(
79
+ manifest,
80
+ createClassifier(REPO_ROOT)
81
+ );
82
+ console.log(JSON.stringify(counts, null, 2));
83
+ if (flags.has("--apply")) {
84
+ writeEvidence(`${EVIDENCE_DIR}/manifest.json`, evidence);
85
+ writeJson(MANIFEST_PATH, culled);
86
+ } else if (flags.has("--check") && counts.WORDING > 0) {
87
+ console.error(
88
+ `${counts.WORDING} WORDING entries remain in ${MANIFEST_PATH}`
89
+ );
90
+ process.exit(1);
91
+ }
92
+ } else if (command === "record") {
93
+ const out = rest[0];
94
+ if (!out) usage();
95
+ const files = candidateTestFiles(REPO_ROOT);
96
+ console.log(`recording ${files.length} test files`);
97
+ const { rows, status } = recordAssertions(REPO_ROOT, files);
98
+ writeFileSync(path.resolve(out), JSON.stringify({ files, status, rows }));
99
+ console.log(`${rows.length} assertion runs recorded (vitest exit ${status})`);
100
+ } else if (command === "tests") {
101
+ const rowsAt = rest.indexOf("--rows");
102
+ const rowsFile = rowsAt === -1 ? undefined : rest[rowsAt + 1];
103
+ if (!rowsFile) usage();
104
+ const recording = JSON.parse(readFileSync(path.resolve(rowsFile), "utf8"));
105
+ const sites = classifySites(
106
+ recording.rows,
107
+ REPO_ROOT,
108
+ createClassifier(REPO_ROOT)
109
+ );
110
+ const result = flags.has("--apply")
111
+ ? cullTestFiles(REPO_ROOT, sites)
112
+ : undefined;
113
+ const counts = siteCounts(sites, recording.files.length, result);
114
+ console.log(JSON.stringify(counts, null, 2));
115
+ if (result) {
116
+ writeEvidence(`${EVIDENCE_DIR}/test-assertions.json`, {
117
+ $comment: [
118
+ "Classification of every recorded toContain/toMatch site in the unit test files that read Markdown, before the CodySwannGT/lisa#4867 cull.",
119
+ "Produced by `node scripts/classify-markdown-assertions.mjs record <rows.json>` then `tests --rows <rows.json> --apply`; rules in scripts/lib/markdown-assertions/sites.mjs.",
120
+ "A site is deleted only when every run of it checked a Markdown document and classified WORDING; `edits` lists what each test file lost.",
121
+ ],
122
+ counts,
123
+ edits: result.edits,
124
+ sites: evidenceSites(sites),
125
+ });
126
+ }
127
+ } else {
128
+ usage();
129
+ }
130
+
131
+ /** Print usage and exit. */
132
+ function usage() {
133
+ console.error(
134
+ [
135
+ "usage: classify-markdown-assertions.mjs manifest [--check | --apply]",
136
+ " classify-markdown-assertions.mjs record <rows.json>",
137
+ " classify-markdown-assertions.mjs tests --rows <rows.json> [--apply]",
138
+ ].join("\n")
139
+ );
140
+ process.exit(2);
141
+ }