@codyswann/lisa 5.4.0 → 5.5.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 (370) 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 +22 -1
  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/kill-marks.mjs +1 -2
  11. package/all/copy-overwrite/scripts/lib/lisa-cleanup-sweep-processes.mjs +3 -4
  12. package/all/copy-overwrite/scripts/lib/npm-update-controller-broker.mjs +1 -1
  13. package/all/copy-overwrite/scripts/lib/npm-update-gate-hooks.mjs +2 -1
  14. package/all/copy-overwrite/scripts/lib/npm-update-helper-inventory.mjs +8 -1
  15. package/all/copy-overwrite/scripts/lib/npm-update-hosted-hook.mjs +1 -1
  16. package/all/copy-overwrite/scripts/lib/npm-update-tool-launcher.mjs +1 -1
  17. package/all/copy-overwrite/scripts/lib/push-admission.mjs +158 -0
  18. package/all/copy-overwrite/scripts/lib/push-gate-defaults.d.mts +34 -0
  19. package/all/copy-overwrite/scripts/lib/push-gate-defaults.mjs +147 -0
  20. package/all/copy-overwrite/scripts/lib/push-timing.mjs +323 -0
  21. package/all/copy-overwrite/scripts/lib/rspec-selection.mjs +672 -0
  22. package/all/copy-overwrite/scripts/lisa-affected-tests.mjs +566 -0
  23. package/all/copy-overwrite/scripts/lisa-gates.mjs +29 -0
  24. package/all/copy-overwrite/scripts/lisa-lint-staged-preflight.mjs +10 -1
  25. package/all/copy-overwrite/scripts/lisa-push-timing-report.mjs +153 -0
  26. package/all/copy-overwrite/scripts/lisa-rspec-select.mjs +982 -0
  27. package/all/copy-overwrite/scripts/lisa-run-gates.mjs +231 -6
  28. package/all/copy-overwrite/scripts/npm-updater-helper-graph.json +105 -17
  29. package/all/deletions.json +11 -2
  30. package/cdk/create-only/vitest.config.local.ts +1 -7
  31. package/cdk/package-lisa/package.lisa.json +4 -4
  32. package/dist/cli/admit-cmd.d.ts +21 -0
  33. package/dist/cli/admit-cmd.d.ts.map +1 -0
  34. package/dist/cli/admit-cmd.js +142 -0
  35. package/dist/cli/admit-cmd.js.map +1 -0
  36. package/dist/cli/check-cmd.d.ts +72 -0
  37. package/dist/cli/check-cmd.d.ts.map +1 -0
  38. package/dist/cli/check-cmd.js +316 -0
  39. package/dist/cli/check-cmd.js.map +1 -0
  40. package/dist/cli/index.d.ts.map +1 -1
  41. package/dist/cli/index.js +6 -4
  42. package/dist/cli/index.js.map +1 -1
  43. package/dist/cli/lisa-test-run-admission.d.ts +18 -0
  44. package/dist/cli/lisa-test-run-admission.d.ts.map +1 -0
  45. package/dist/cli/lisa-test-run-admission.js +62 -0
  46. package/dist/cli/lisa-test-run-admission.js.map +1 -0
  47. package/dist/cli/lisa-test-run-payload.d.ts +37 -0
  48. package/dist/cli/lisa-test-run-payload.d.ts.map +1 -0
  49. package/dist/cli/lisa-test-run-payload.js +55 -0
  50. package/dist/cli/lisa-test-run-payload.js.map +1 -0
  51. package/dist/cli/lisa-test-run-shard-files.d.ts +89 -0
  52. package/dist/cli/lisa-test-run-shard-files.d.ts.map +1 -0
  53. package/dist/cli/lisa-test-run-shard-files.js +239 -0
  54. package/dist/cli/lisa-test-run-shard-files.js.map +1 -0
  55. package/dist/cli/lisa-test-run-shard.d.ts +6 -2
  56. package/dist/cli/lisa-test-run-shard.d.ts.map +1 -1
  57. package/dist/cli/lisa-test-run-shard.js +25 -13
  58. package/dist/cli/lisa-test-run-shard.js.map +1 -1
  59. package/dist/cli/lisa-test-run.d.ts +1 -1
  60. package/dist/cli/lisa-test-run.d.ts.map +1 -1
  61. package/dist/cli/lisa-test-run.js +47 -10
  62. package/dist/cli/lisa-test-run.js.map +1 -1
  63. package/dist/cli/update-check-hook.d.ts.map +1 -1
  64. package/dist/cli/update-check-hook.js +3 -0
  65. package/dist/cli/update-check-hook.js.map +1 -1
  66. package/dist/configs/vitest/base.d.ts +58 -135
  67. package/dist/configs/vitest/base.d.ts.map +1 -1
  68. package/dist/configs/vitest/base.js +76 -228
  69. package/dist/configs/vitest/base.js.map +1 -1
  70. package/dist/configs/vitest/cdk.d.ts.map +1 -1
  71. package/dist/configs/vitest/cdk.js +3 -2
  72. package/dist/configs/vitest/cdk.js.map +1 -1
  73. package/dist/configs/vitest/coverage-include-global-setup.d.ts.map +1 -1
  74. package/dist/configs/vitest/coverage-include-global-setup.js +3 -4
  75. package/dist/configs/vitest/coverage-include-global-setup.js.map +1 -1
  76. package/dist/configs/vitest/coverage-reports-directory.d.ts +27 -5
  77. package/dist/configs/vitest/coverage-reports-directory.d.ts.map +1 -1
  78. package/dist/configs/vitest/coverage-reports-directory.js +47 -10
  79. package/dist/configs/vitest/coverage-reports-directory.js.map +1 -1
  80. package/dist/configs/vitest/harper-fabric.d.ts.map +1 -1
  81. package/dist/configs/vitest/harper-fabric.js +3 -2
  82. package/dist/configs/vitest/harper-fabric.js.map +1 -1
  83. package/dist/configs/vitest/nestjs.d.ts.map +1 -1
  84. package/dist/configs/vitest/nestjs.js +3 -2
  85. package/dist/configs/vitest/nestjs.js.map +1 -1
  86. package/dist/configs/vitest/phaser.d.ts.map +1 -1
  87. package/dist/configs/vitest/phaser.js +3 -2
  88. package/dist/configs/vitest/phaser.js.map +1 -1
  89. package/dist/configs/vitest/refusal-announcement.d.ts +51 -0
  90. package/dist/configs/vitest/refusal-announcement.d.ts.map +1 -0
  91. package/dist/configs/vitest/refusal-announcement.js +97 -0
  92. package/dist/configs/vitest/refusal-announcement.js.map +1 -0
  93. package/dist/configs/vitest/socket-safe-temp-base.d.ts +3 -4
  94. package/dist/configs/vitest/socket-safe-temp-base.d.ts.map +1 -1
  95. package/dist/configs/vitest/socket-safe-temp-base.js +7 -6
  96. package/dist/configs/vitest/socket-safe-temp-base.js.map +1 -1
  97. package/dist/configs/vitest/typescript.d.ts.map +1 -1
  98. package/dist/configs/vitest/typescript.js +3 -2
  99. package/dist/configs/vitest/typescript.js.map +1 -1
  100. package/dist/core/admission-decision.d.ts +110 -0
  101. package/dist/core/admission-decision.d.ts.map +1 -0
  102. package/dist/core/admission-decision.js +91 -0
  103. package/dist/core/admission-decision.js.map +1 -0
  104. package/dist/core/admission-lock.d.ts +69 -0
  105. package/dist/core/admission-lock.d.ts.map +1 -0
  106. package/dist/core/admission-lock.js +278 -0
  107. package/dist/core/admission-lock.js.map +1 -0
  108. package/dist/core/admission-settings.d.ts +69 -0
  109. package/dist/core/admission-settings.d.ts.map +1 -0
  110. package/dist/core/admission-settings.js +204 -0
  111. package/dist/core/admission-settings.js.map +1 -0
  112. package/dist/core/admission-state.d.ts +50 -0
  113. package/dist/core/admission-state.d.ts.map +1 -0
  114. package/dist/core/admission-state.js +168 -0
  115. package/dist/core/admission-state.js.map +1 -0
  116. package/dist/core/admission.d.ts +70 -0
  117. package/dist/core/admission.d.ts.map +1 -0
  118. package/dist/core/admission.js +205 -0
  119. package/dist/core/admission.js.map +1 -0
  120. package/dist/core/lisa-owned-hash-ledger.d.ts.map +1 -1
  121. package/dist/core/lisa-owned-hash-ledger.js +318 -0
  122. package/dist/core/lisa-owned-hash-ledger.js.map +1 -1
  123. package/dist/core/nightly-e2e-guard-behavior-certificate.js +2 -2
  124. package/dist/core/project-config-push-gate.d.ts +66 -0
  125. package/dist/core/project-config-push-gate.d.ts.map +1 -0
  126. package/dist/core/project-config-push-gate.js +82 -0
  127. package/dist/core/project-config-push-gate.js.map +1 -0
  128. package/dist/core/project-config.d.ts +4 -0
  129. package/dist/core/project-config.d.ts.map +1 -1
  130. package/dist/core/project-config.js +14 -9
  131. package/dist/core/project-config.js.map +1 -1
  132. package/dist/core/upstream-evidence-manifest.d.ts.map +1 -1
  133. package/dist/core/upstream-evidence-manifest.js +197 -123
  134. package/dist/core/upstream-evidence-manifest.js.map +1 -1
  135. package/expo/package-lisa/package.lisa.json +2 -2
  136. package/harper-fabric/package-lisa/package.lisa.json +4 -4
  137. package/nestjs/create-only/vitest.config.local.ts +1 -7
  138. package/nestjs/package-lisa/package.lisa.json +4 -4
  139. package/npm-package/package-lisa/package.lisa.json +4 -4
  140. package/package.json +12 -11
  141. package/phaser/package-lisa/package.lisa.json +4 -4
  142. package/plugins/lisa/.claude-plugin/plugin.json +1 -1
  143. package/plugins/lisa/.codex-plugin/plugin.json +1 -1
  144. package/plugins/lisa/.codex-plugin/skills/lisa-drive-pr-to-merge/SKILL.md +16 -3
  145. package/plugins/lisa/.codex-plugin/skills/lisa-git-submit-pr/SKILL.md +1 -1
  146. package/plugins/lisa/.codex-plugin/skills/lisa-implement/SKILL.md +1 -1
  147. package/plugins/lisa/skills/lisa-drive-pr-to-merge/SKILL.md +16 -3
  148. package/plugins/lisa/skills/lisa-git-submit-pr/SKILL.md +1 -1
  149. package/plugins/lisa/skills/lisa-implement/SKILL.md +1 -1
  150. package/plugins/lisa-agy/plugin.json +1 -1
  151. package/plugins/lisa-agy/skills/lisa-drive-pr-to-merge/SKILL.md +16 -3
  152. package/plugins/lisa-agy/skills/lisa-git-submit-pr/SKILL.md +1 -1
  153. package/plugins/lisa-agy/skills/lisa-implement/SKILL.md +1 -1
  154. package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
  155. package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
  156. package/plugins/lisa-cdk-agy/plugin.json +1 -1
  157. package/plugins/lisa-cdk-copilot/.claude-plugin/plugin.json +1 -1
  158. package/plugins/lisa-cdk-cursor/.claude-plugin/plugin.json +1 -1
  159. package/plugins/lisa-cdk-devin/.claude-plugin/plugin.json +1 -1
  160. package/plugins/lisa-cdk-devin/.devin-plugin/plugin.json +1 -1
  161. package/plugins/lisa-copilot/.claude-plugin/plugin.json +1 -1
  162. package/plugins/lisa-copilot/skills/lisa-drive-pr-to-merge/SKILL.md +16 -3
  163. package/plugins/lisa-copilot/skills/lisa-git-submit-pr/SKILL.md +1 -1
  164. package/plugins/lisa-copilot/skills/lisa-implement/SKILL.md +1 -1
  165. package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
  166. package/plugins/lisa-cursor/skills/lisa-drive-pr-to-merge/SKILL.md +16 -3
  167. package/plugins/lisa-cursor/skills/lisa-git-submit-pr/SKILL.md +1 -1
  168. package/plugins/lisa-cursor/skills/lisa-implement/SKILL.md +1 -1
  169. package/plugins/lisa-devin/.claude-plugin/plugin.json +1 -1
  170. package/plugins/lisa-devin/.devin-plugin/plugin.json +1 -1
  171. package/plugins/lisa-devin/skills/lisa-drive-pr-to-merge/SKILL.md +16 -3
  172. package/plugins/lisa-devin/skills/lisa-git-submit-pr/SKILL.md +1 -1
  173. package/plugins/lisa-devin/skills/lisa-implement/SKILL.md +1 -1
  174. package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
  175. package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
  176. package/plugins/lisa-expo-agy/plugin.json +1 -1
  177. package/plugins/lisa-expo-copilot/.claude-plugin/plugin.json +1 -1
  178. package/plugins/lisa-expo-cursor/.claude-plugin/plugin.json +1 -1
  179. package/plugins/lisa-expo-devin/.claude-plugin/plugin.json +1 -1
  180. package/plugins/lisa-expo-devin/.devin-plugin/plugin.json +1 -1
  181. package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
  182. package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +1 -1
  183. package/plugins/lisa-harper-fabric-agy/plugin.json +1 -1
  184. package/plugins/lisa-harper-fabric-copilot/.claude-plugin/plugin.json +1 -1
  185. package/plugins/lisa-harper-fabric-cursor/.claude-plugin/plugin.json +1 -1
  186. package/plugins/lisa-harper-fabric-devin/.claude-plugin/plugin.json +1 -1
  187. package/plugins/lisa-harper-fabric-devin/.devin-plugin/plugin.json +1 -1
  188. package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
  189. package/plugins/lisa-nestjs/.codex-plugin/plugin.json +1 -1
  190. package/plugins/lisa-nestjs-agy/plugin.json +1 -1
  191. package/plugins/lisa-nestjs-copilot/.claude-plugin/plugin.json +1 -1
  192. package/plugins/lisa-nestjs-cursor/.claude-plugin/plugin.json +1 -1
  193. package/plugins/lisa-nestjs-devin/.claude-plugin/plugin.json +1 -1
  194. package/plugins/lisa-nestjs-devin/.devin-plugin/plugin.json +1 -1
  195. package/plugins/lisa-phaser/.claude-plugin/plugin.json +1 -1
  196. package/plugins/lisa-phaser/.codex-plugin/plugin.json +1 -1
  197. package/plugins/lisa-phaser-agy/plugin.json +1 -1
  198. package/plugins/lisa-phaser-copilot/.claude-plugin/plugin.json +1 -1
  199. package/plugins/lisa-phaser-cursor/.claude-plugin/plugin.json +1 -1
  200. package/plugins/lisa-phaser-devin/.claude-plugin/plugin.json +1 -1
  201. package/plugins/lisa-phaser-devin/.devin-plugin/plugin.json +1 -1
  202. package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
  203. package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
  204. package/plugins/lisa-rails-agy/plugin.json +1 -1
  205. package/plugins/lisa-rails-copilot/.claude-plugin/plugin.json +1 -1
  206. package/plugins/lisa-rails-cursor/.claude-plugin/plugin.json +1 -1
  207. package/plugins/lisa-rails-devin/.claude-plugin/plugin.json +1 -1
  208. package/plugins/lisa-rails-devin/.devin-plugin/plugin.json +1 -1
  209. package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
  210. package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
  211. package/plugins/lisa-typescript-agy/plugin.json +1 -1
  212. package/plugins/lisa-typescript-copilot/.claude-plugin/plugin.json +1 -1
  213. package/plugins/lisa-typescript-cursor/.claude-plugin/plugin.json +1 -1
  214. package/plugins/lisa-typescript-devin/.claude-plugin/plugin.json +1 -1
  215. package/plugins/lisa-typescript-devin/.devin-plugin/plugin.json +1 -1
  216. package/plugins/lisa-wiki/.claude-plugin/plugin.json +1 -1
  217. package/plugins/lisa-wiki/.codex-plugin/plugin.json +1 -1
  218. package/plugins/lisa-wiki-agy/plugin.json +1 -1
  219. package/plugins/lisa-wiki-copilot/.claude-plugin/plugin.json +1 -1
  220. package/plugins/lisa-wiki-cursor/.claude-plugin/plugin.json +1 -1
  221. package/plugins/lisa-wiki-devin/.claude-plugin/plugin.json +1 -1
  222. package/plugins/lisa-wiki-devin/.devin-plugin/plugin.json +1 -1
  223. package/plugins/src/base/skills/lisa-drive-pr-to-merge/SKILL.md +16 -3
  224. package/plugins/src/base/skills/lisa-git-submit-pr/SKILL.md +1 -1
  225. package/plugins/src/base/skills/lisa-implement/SKILL.md +1 -1
  226. package/rails/copy-overwrite/Gemfile.lisa +8 -0
  227. package/rails/copy-overwrite/lefthook.yml +25 -11
  228. package/rails/copy-overwrite/scripts/lisa-rails-gates.mjs +686 -0
  229. package/rails/copy-overwrite/scripts/lisa-rspec-shards.mjs +2 -2
  230. package/rails/copy-overwrite/scripts/lisa_crystalball_recorder.rb +239 -0
  231. package/rails/copy-overwrite/scripts/lisa_rspec_partial_coverage.rb +83 -0
  232. package/scripts/build-unless-marked.mjs +83 -0
  233. package/scripts/check-plugins-sync.sh +22 -5
  234. package/scripts/classify-markdown-assertions.mjs +141 -0
  235. package/scripts/integration-shard-build.mjs +143 -0
  236. package/scripts/lib/history-scanner-suites.mjs +19 -0
  237. package/scripts/lib/markdown-assertions/classify.mjs +289 -0
  238. package/scripts/lib/markdown-assertions/context.mjs +53 -0
  239. package/scripts/lib/markdown-assertions/corpus.mjs +222 -0
  240. package/scripts/lib/markdown-assertions/manifest-cull.mjs +86 -0
  241. package/scripts/lib/markdown-assertions/record-setup.mjs +265 -0
  242. package/scripts/lib/markdown-assertions/record.mjs +115 -0
  243. package/scripts/lib/markdown-assertions/record.vitest.config.mjs +24 -0
  244. package/scripts/lib/markdown-assertions/sites.mjs +273 -0
  245. package/scripts/lib/markdown-assertions/test-cull.mjs +768 -0
  246. package/scripts/lib/markdown-assertions/tokens.mjs +158 -0
  247. package/scripts/lib/shell-guard-trace.mjs +6 -0
  248. package/scripts/lib/test-access-map-setup.mjs +40 -0
  249. package/scripts/lib/test-access-map-tracer.mjs +205 -0
  250. package/scripts/lib/test-access-map.d.mts +72 -0
  251. package/scripts/lib/test-access-map.mjs +395 -0
  252. package/scripts/lib/test-timings-reporter.d.mts +17 -0
  253. package/scripts/lib/test-timings-reporter.mjs +99 -0
  254. package/scripts/plan-integration-shards.mjs +300 -0
  255. package/scripts/test-timing-report.d.mts +41 -0
  256. package/scripts/test-timing-report.mjs +361 -0
  257. package/scripts/two-channel-couplings.json +132 -36
  258. package/scripts/verify-npm-advisories-4333.mjs +3 -12
  259. package/typescript/copy-overwrite/.prettierignore +12 -0
  260. package/typescript/create-only/vitest.config.local.ts +1 -7
  261. package/typescript/package-lisa/package.lisa.json +4 -4
  262. package/all/copy-overwrite/scripts/lisa-scratch-run.sh +0 -1078
  263. package/dist/cli/lisa-test-run-bootstrap.d.ts +0 -3
  264. package/dist/cli/lisa-test-run-bootstrap.d.ts.map +0 -1
  265. package/dist/cli/lisa-test-run-bootstrap.js +0 -229
  266. package/dist/cli/lisa-test-run-bootstrap.js.map +0 -1
  267. package/dist/cli/lisa-test-run-ipc.d.ts +0 -49
  268. package/dist/cli/lisa-test-run-ipc.d.ts.map +0 -1
  269. package/dist/cli/lisa-test-run-ipc.js +0 -226
  270. package/dist/cli/lisa-test-run-ipc.js.map +0 -1
  271. package/dist/cli/lisa-test-run-process-group.d.ts +0 -30
  272. package/dist/cli/lisa-test-run-process-group.d.ts.map +0 -1
  273. package/dist/cli/lisa-test-run-process-group.js +0 -140
  274. package/dist/cli/lisa-test-run-process-group.js.map +0 -1
  275. package/dist/cli/lisa-test-run-reaper.d.ts +0 -3
  276. package/dist/cli/lisa-test-run-reaper.d.ts.map +0 -1
  277. package/dist/cli/lisa-test-run-reaper.js +0 -195
  278. package/dist/cli/lisa-test-run-reaper.js.map +0 -1
  279. package/dist/cli/lisa-test-run-runtime.d.ts +0 -46
  280. package/dist/cli/lisa-test-run-runtime.d.ts.map +0 -1
  281. package/dist/cli/lisa-test-run-runtime.js +0 -123
  282. package/dist/cli/lisa-test-run-runtime.js.map +0 -1
  283. package/dist/cli/lisa-test-run-supervisor.d.ts +0 -13
  284. package/dist/cli/lisa-test-run-supervisor.d.ts.map +0 -1
  285. package/dist/cli/lisa-test-run-supervisor.js +0 -265
  286. package/dist/cli/lisa-test-run-supervisor.js.map +0 -1
  287. package/dist/configs/vitest/fleet-admission-global-setup.d.ts +0 -34
  288. package/dist/configs/vitest/fleet-admission-global-setup.d.ts.map +0 -1
  289. package/dist/configs/vitest/fleet-admission-global-setup.js +0 -123
  290. package/dist/configs/vitest/fleet-admission-global-setup.js.map +0 -1
  291. package/dist/configs/vitest/fleet-admission.d.ts +0 -129
  292. package/dist/configs/vitest/fleet-admission.d.ts.map +0 -1
  293. package/dist/configs/vitest/fleet-admission.js +0 -239
  294. package/dist/configs/vitest/fleet-admission.js.map +0 -1
  295. package/dist/configs/vitest/scratch-authority.d.ts +0 -25
  296. package/dist/configs/vitest/scratch-authority.d.ts.map +0 -1
  297. package/dist/configs/vitest/scratch-authority.js +0 -107
  298. package/dist/configs/vitest/scratch-authority.js.map +0 -1
  299. package/dist/configs/vitest/scratch-bound-cleanup-programs.d.ts +0 -5
  300. package/dist/configs/vitest/scratch-bound-cleanup-programs.d.ts.map +0 -1
  301. package/dist/configs/vitest/scratch-bound-cleanup-programs.js +0 -219
  302. package/dist/configs/vitest/scratch-bound-cleanup-programs.js.map +0 -1
  303. package/dist/configs/vitest/scratch-bound-cleanup.d.ts +0 -28
  304. package/dist/configs/vitest/scratch-bound-cleanup.d.ts.map +0 -1
  305. package/dist/configs/vitest/scratch-bound-cleanup.js +0 -155
  306. package/dist/configs/vitest/scratch-bound-cleanup.js.map +0 -1
  307. package/dist/configs/vitest/scratch-bound-root-cleanup.d.ts +0 -17
  308. package/dist/configs/vitest/scratch-bound-root-cleanup.d.ts.map +0 -1
  309. package/dist/configs/vitest/scratch-bound-root-cleanup.js +0 -149
  310. package/dist/configs/vitest/scratch-bound-root-cleanup.js.map +0 -1
  311. package/dist/configs/vitest/scratch-global-setup.d.ts +0 -258
  312. package/dist/configs/vitest/scratch-global-setup.d.ts.map +0 -1
  313. package/dist/configs/vitest/scratch-global-setup.js +0 -505
  314. package/dist/configs/vitest/scratch-global-setup.js.map +0 -1
  315. package/dist/configs/vitest/scratch-leak-setup.d.ts +0 -2
  316. package/dist/configs/vitest/scratch-leak-setup.d.ts.map +0 -1
  317. package/dist/configs/vitest/scratch-leak-setup.js +0 -108
  318. package/dist/configs/vitest/scratch-leak-setup.js.map +0 -1
  319. package/dist/configs/vitest/scratch-namespace-authority.d.ts +0 -80
  320. package/dist/configs/vitest/scratch-namespace-authority.d.ts.map +0 -1
  321. package/dist/configs/vitest/scratch-namespace-authority.js +0 -291
  322. package/dist/configs/vitest/scratch-namespace-authority.js.map +0 -1
  323. package/dist/configs/vitest/scratch-owner.d.ts +0 -131
  324. package/dist/configs/vitest/scratch-owner.d.ts.map +0 -1
  325. package/dist/configs/vitest/scratch-owner.js +0 -297
  326. package/dist/configs/vitest/scratch-owner.js.map +0 -1
  327. package/dist/configs/vitest/scratch-route-profile.d.ts +0 -46
  328. package/dist/configs/vitest/scratch-route-profile.d.ts.map +0 -1
  329. package/dist/configs/vitest/scratch-route-profile.js +0 -233
  330. package/dist/configs/vitest/scratch-route-profile.js.map +0 -1
  331. package/dist/configs/vitest/scratch-run-root-compatibility.d.ts +0 -33
  332. package/dist/configs/vitest/scratch-run-root-compatibility.d.ts.map +0 -1
  333. package/dist/configs/vitest/scratch-run-root-compatibility.js +0 -137
  334. package/dist/configs/vitest/scratch-run-root-compatibility.js.map +0 -1
  335. package/dist/configs/vitest/scratch-run-root-intent.d.ts +0 -66
  336. package/dist/configs/vitest/scratch-run-root-intent.d.ts.map +0 -1
  337. package/dist/configs/vitest/scratch-run-root-intent.js +0 -183
  338. package/dist/configs/vitest/scratch-run-root-intent.js.map +0 -1
  339. package/dist/configs/vitest/scratch-setup.d.ts +0 -46
  340. package/dist/configs/vitest/scratch-setup.d.ts.map +0 -1
  341. package/dist/configs/vitest/scratch-setup.js +0 -226
  342. package/dist/configs/vitest/scratch-setup.js.map +0 -1
  343. package/dist/configs/vitest/scratch-supervision-intent.d.ts +0 -8
  344. package/dist/configs/vitest/scratch-supervision-intent.d.ts.map +0 -1
  345. package/dist/configs/vitest/scratch-supervision-intent.js +0 -125
  346. package/dist/configs/vitest/scratch-supervision-intent.js.map +0 -1
  347. package/dist/configs/vitest/scratch-supervision-protocol.d.ts +0 -12
  348. package/dist/configs/vitest/scratch-supervision-protocol.d.ts.map +0 -1
  349. package/dist/configs/vitest/scratch-supervision-protocol.js +0 -230
  350. package/dist/configs/vitest/scratch-supervision-protocol.js.map +0 -1
  351. package/dist/configs/vitest/scratch-supervision.d.ts +0 -69
  352. package/dist/configs/vitest/scratch-supervision.d.ts.map +0 -1
  353. package/dist/configs/vitest/scratch-supervision.js +0 -244
  354. package/dist/configs/vitest/scratch-supervision.js.map +0 -1
  355. package/dist/configs/vitest/scratch-sweep.d.ts +0 -66
  356. package/dist/configs/vitest/scratch-sweep.d.ts.map +0 -1
  357. package/dist/configs/vitest/scratch-sweep.js +0 -82
  358. package/dist/configs/vitest/scratch-sweep.js.map +0 -1
  359. package/dist/configs/vitest/scratch-tmpdir-trust.d.ts +0 -48
  360. package/dist/configs/vitest/scratch-tmpdir-trust.d.ts.map +0 -1
  361. package/dist/configs/vitest/scratch-tmpdir-trust.js +0 -194
  362. package/dist/configs/vitest/scratch-tmpdir-trust.js.map +0 -1
  363. package/dist/configs/vitest/scratch.d.ts +0 -19
  364. package/dist/configs/vitest/scratch.d.ts.map +0 -1
  365. package/dist/configs/vitest/scratch.js +0 -34
  366. package/dist/configs/vitest/scratch.js.map +0 -1
  367. package/dist/configs/vitest/synthesis-scratch-reclaim.d.ts +0 -86
  368. package/dist/configs/vitest/synthesis-scratch-reclaim.d.ts.map +0 -1
  369. package/dist/configs/vitest/synthesis-scratch-reclaim.js +0 -226
  370. package/dist/configs/vitest/synthesis-scratch-reclaim.js.map +0 -1
@@ -0,0 +1,158 @@
1
+ /**
2
+ * Machine-token candidates inside a pinned phrase (CodySwannGT/lisa#4867).
3
+ *
4
+ * A Markdown assertion pins either WORDING (prose an agent reads) or a token
5
+ * that something mechanical consumes: a marker, a trailer key, a flag, an
6
+ * identifier, a path. This module only finds the token-shaped substrings of a
7
+ * phrase; `classify.mjs` then decides whether shipped code actually reads any
8
+ * of them. Plain English — including kebab-case words such as `re-request`
9
+ * and emphasis capitals such as `NEVER` — is deliberately not token-shaped.
10
+ * @module scripts/lib/markdown-assertions/tokens
11
+ */
12
+
13
+ /** Capitalised emphasis words that are prose, not identifiers. */
14
+ const EMPHASIS_WORDS = new Set(
15
+ (
16
+ "ALL ALSO ALWAYS AND ANY ARE AFTER BEFORE BOTH CANNOT DO DOES DONE EACH EVER EVERY " +
17
+ "FIRST FROM HAVE INTO JUST LAST MUST NEVER NONE ONCE ONLY OUTSIDE OVER SAME SHOULD " +
18
+ "SOME STOP THAT THEN THERE THIS THOSE UNLESS UNTIL WHAT WHEN WHERE WHICH WILL WITH " +
19
+ "WITHOUT NOT NOTE ONE TWO YOUR YOU THEY EXACTLY STILL HERE ITSELF REQUIRED OPTIONAL " +
20
+ "IMPORTANT CRITICAL WARNING HARD RULE RULES TRUE FALSE NEXT ELSE BUT CAN MAY"
21
+ ).split(" ")
22
+ );
23
+
24
+ /** Token shapes, each a global regular expression. */
25
+ const TOKEN_SHAPES = Object.freeze([
26
+ // [lisa-human-gate], [EVIDENCE-REF: ...] — bracketed markers.
27
+ /\[[A-Za-z][\w:-]*\w(?=[\]:])/gu,
28
+ // <!-- lisa:review-substitute — HTML-comment markers.
29
+ /<!--\s*[\w.:-]+/gu,
30
+ // Work-Item:, Co-Authored-By: — multi-word trailer keys.
31
+ /\b[A-Z][a-z]+(?:-[A-Za-z][a-z]+)+:/gu,
32
+ // snake_case and SCREAMING_SNAKE identifiers.
33
+ /\b[A-Za-z][A-Za-z0-9]*_\w+\b/gu,
34
+ // camelCase identifiers.
35
+ /\b[a-z]+[A-Z][A-Za-z0-9]*\b/gu,
36
+ // SCREAMING-KEBAB identifiers.
37
+ /\b[A-Z][A-Z0-9]+(?:-[A-Z0-9]+)+\b/gu,
38
+ // --cli-flags.
39
+ /(?<![\w-])--[a-z][a-z0-9-]+/gu,
40
+ // $VARIABLES and ${...} expansions.
41
+ /\$\{?[A-Za-z_]\w*/gu,
42
+ // file names with a code or config extension.
43
+ /[\w.-]*\w\.(?:mjs|cjs|js|ts|json|jsonc|sh|md|mdc|yml|yaml|toml|py)\b/gu,
44
+ // repository paths.
45
+ /\b[\w.-]+\/[\w.-]+(?:\/[\w.-]*)*/gu,
46
+ // lisa skill / command references: /lisa-x, lisa:x, $lisa-x.
47
+ /\blisa[-:][a-z0-9][a-z0-9:-]*/gu,
48
+ // namespaced labels such as status:ready or type:Bug.
49
+ /\b[a-z]+:[A-Za-z][A-Za-z0-9-]+\b/gu,
50
+ ]);
51
+
52
+ /** All-capital words of four or more letters (filtered by EMPHASIS_WORDS). */
53
+ const CAPITAL_WORD = /(?<![\w-])[A-Z]{4,}(?![\w-])/gu;
54
+
55
+ /** A code span's content that reads as code: one word with code punctuation, or all capitals. */
56
+ const CODE_SPAN_TOKEN =
57
+ /^(?:[\w$.[<@/-][^\s]*[_\-./:$@#=<>[\]][^\s]*|[A-Z][A-Z0-9_]+)$/u;
58
+
59
+ /** Characters that mark a phrase as a code snippet rather than prose. */
60
+ const CODE_PUNCTUATION = /[={}|]|\(\)|=>|&&|\$\(/u;
61
+
62
+ /** Backtick code spans. */
63
+ const CODE_SPAN = /`([^`\n]+)`/gu;
64
+
65
+ /** Shortest token worth looking up; shorter ones match code by accident. */
66
+ export const MIN_TOKEN_LENGTH = 4;
67
+
68
+ /**
69
+ * Token-shaped substrings of a phrase.
70
+ * @param {string} text - The phrase (for a pattern, its literal text).
71
+ * @returns {string[]} Unique tokens, longest first.
72
+ */
73
+ export function tokenCandidates(text) {
74
+ const found = new Set(
75
+ TOKEN_SHAPES.flatMap(shape => [...text.matchAll(shape)].map(m => m[0]))
76
+ );
77
+ for (const match of text.matchAll(CAPITAL_WORD)) {
78
+ if (!EMPHASIS_WORDS.has(match[0])) found.add(match[0]);
79
+ }
80
+ for (const match of text.matchAll(CODE_SPAN)) {
81
+ const inner = match[1] ?? "";
82
+ if (CODE_SPAN_TOKEN.test(inner)) found.add(inner);
83
+ }
84
+ const trimmed = text.trim();
85
+ if (CODE_PUNCTUATION.test(trimmed)) found.add(trimmed);
86
+ return [...found]
87
+ .map(token =>
88
+ token.replace(/[.,;:)]+$/u, match => (match === ":" ? match : ""))
89
+ )
90
+ .filter(token => token.length >= MIN_TOKEN_LENGTH)
91
+ .filter((token, index, all) => all.indexOf(token) === index)
92
+ .sort((a, b) => b.length - a.length);
93
+ }
94
+
95
+ /** Escapes that stand for a class of characters, not a literal. */
96
+ const CLASS_ESCAPES = new Set(["S", "b", "B", "d", "D", "w", "W", "n", "t"]);
97
+
98
+ /**
99
+ * A character class's literal stand-in: `[Ee]` (one letter in two cases)
100
+ * reads as its first letter; any other class breaks the fragment.
101
+ * @param {string} body - The class body between the brackets.
102
+ * @returns {string} The stand-in.
103
+ */
104
+ function classStandIn(body) {
105
+ return body.length === 2 &&
106
+ /^[A-Za-z]{2}$/u.test(body) &&
107
+ body[0]?.toLowerCase() === body[1]?.toLowerCase()
108
+ ? (body[0] ?? "")
109
+ : "\n";
110
+ }
111
+
112
+ /**
113
+ * The literal text a regular expression source spells, close enough to find
114
+ * its tokens: escapes are unescaped, `\s` becomes a space, a case class such
115
+ * as `[Ee]` becomes its first letter, and alternation, groups, wildcards and
116
+ * other classes become line breaks between fragments.
117
+ * @param {string} source - A RegExp source.
118
+ * @returns {string} Literal fragments separated by newlines.
119
+ */
120
+ export function patternLiteral(source) {
121
+ return [...source.matchAll(REGEX_PIECE)]
122
+ .map(([piece]) => literalPiece(piece))
123
+ .join("")
124
+ .replaceAll(/[ \t]+/gu, " ");
125
+ }
126
+
127
+ /** One syntactic piece of a RegExp source, in matching priority. */
128
+ const REGEX_PIECE = new RegExp(
129
+ [
130
+ /\\[\s\S]/u, // an escape
131
+ /\[(?:\\[\s\S]|[^\]\\])*\]/u, // a character class
132
+ /\{\d+(?:,\d*)?\}/u, // a counted quantifier
133
+ /\(\?(?:[:=!]|<[=!]|<\w+>)/u, // a group prefix
134
+ /[\s\S]/u, // any other character
135
+ ]
136
+ .map(piece => piece.source)
137
+ .join("|"),
138
+ "gu"
139
+ );
140
+
141
+ /**
142
+ * The literal stand-in for one RegExp piece.
143
+ * @param {string} piece - A piece matched by REGEX_PIECE.
144
+ * @returns {string} Its literal text, a fragment break, or nothing.
145
+ */
146
+ function literalPiece(piece) {
147
+ if (piece.startsWith("\\")) {
148
+ const next = piece.slice(1);
149
+ if (next === "s") return " ";
150
+ return CLASS_ESCAPES.has(next) ? "\n" : next;
151
+ }
152
+ if (piece.length > 1 && piece.startsWith("[")) {
153
+ return classStandIn(piece.slice(1, -1));
154
+ }
155
+ if (piece.startsWith("{") && piece.length > 1) return "";
156
+ if (piece.startsWith("(?") || "()|^$.".includes(piece)) return "\n";
157
+ return "*+?".includes(piece) ? "" : piece;
158
+ }
@@ -271,4 +271,10 @@ function install(trace, index) {
271
271
  }
272
272
  };
273
273
  }
274
+ // Push the patch to every ESM `import { spawnSync }` from here on. Without
275
+ // this the patch reached ESM only when nothing had built the builtin's ESM
276
+ // facade yet. On CI the access-map tracer (#4593) is preloaded through
277
+ // NODE_OPTIONS, imports `node:child_process` as ESM and syncs first, so the
278
+ // facade already held ITS wrappers, and every guard run escaped this trace.
279
+ createRequire(import.meta.url)("node:module").syncBuiltinESMExports();
274
280
  }
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Vitest setup file for the test access map (CodySwannGT/lisa#4593).
3
+ *
4
+ * Runs before each test file in the worker. It names the file for the tracer
5
+ * through `LISA_ACCESS_MAP_TEST_FILE`, which every child the test spawns
6
+ * inherits, and after the file adds every module Vitest's own module runner
7
+ * evaluated for it. Those modules (the test file, its TypeScript imports) are
8
+ * transformed in the main process and never reach a Node loader hook, so the
9
+ * tracer alone would miss them. Then it flushes the tracer's records.
10
+ *
11
+ * Only the worker that first claimed attribution renames the file: a nested
12
+ * Vitest run a test spawns inherits the outer test's name, so what the nested
13
+ * run touches is charged to the test that started it.
14
+ *
15
+ * No-op when the tracer is not loaded.
16
+ * @module test-access-map-setup
17
+ */
18
+ import { isAbsolute } from "node:path";
19
+
20
+ import { afterAll } from "vitest";
21
+
22
+ const tracer = globalThis[Symbol.for("lisa.testAccessMap")];
23
+ const state = globalThis.__vitest_worker__;
24
+ const owner = process.env["LISA_ACCESS_MAP_OWNER_PID"];
25
+ const mine = owner === undefined || owner === String(process.pid);
26
+
27
+ if (tracer !== undefined && state?.filepath && mine) {
28
+ const testFile = state.filepath;
29
+
30
+ process.env["LISA_ACCESS_MAP_OWNER_PID"] = String(process.pid);
31
+ process.env["LISA_ACCESS_MAP_TEST_FILE"] = testFile;
32
+
33
+ afterAll(() => {
34
+ const modules = state.evaluatedModules?.fileToModulesMap;
35
+ // Builtins are keyed by bare name ("fs"); only absolute ids are files.
36
+ if (modules !== undefined)
37
+ [...modules.keys()].filter(id => isAbsolute(id)).forEach(tracer.record);
38
+ tracer.flush();
39
+ });
40
+ }
@@ -0,0 +1,205 @@
1
+ /**
2
+ * Access-map tracer (CodySwannGT/lisa#4593), preloaded into every test worker
3
+ * and every Node child through `NODE_OPTIONS=--import`, so grandchildren
4
+ * inherit it. It records, against the test file named by
5
+ * `LISA_ACCESS_MAP_TEST_FILE`:
6
+ *
7
+ * - module loads, through `module.registerHooks` (ESM imports and `require`);
8
+ * - file reads: `fs.readFile*`, `fs.promises.readFile`, `fs.createReadStream`,
9
+ * and `fs.openSync` with a read flag;
10
+ * - process spawns: the executable and every argument that names an existing
11
+ * file, so `spawnSync("bash", ["plugins/…/hook.sh"])` records the script.
12
+ *
13
+ * Records are kept in memory and appended as NDJSON to a per-process file
14
+ * under `LISA_ACCESS_MAP_DIR` on `flush()` (the setup file calls it after each
15
+ * test file) and at exit. It never writes to stdout or stderr: tests compare
16
+ * child output byte for byte. Without `LISA_ACCESS_MAP=1` it does nothing.
17
+ * @module test-access-map-tracer
18
+ */
19
+ import childProcess from "node:child_process";
20
+ import { randomUUID } from "node:crypto";
21
+ import fs from "node:fs";
22
+ import module from "node:module";
23
+ import path from "node:path";
24
+ import { fileURLToPath } from "node:url";
25
+
26
+ const TRACER_KEY = Symbol.for("lisa.testAccessMap");
27
+
28
+ const env = process.env;
29
+ const enabled =
30
+ env["LISA_ACCESS_MAP"] === "1" &&
31
+ typeof env["LISA_ACCESS_MAP_DIR"] === "string" &&
32
+ typeof env["LISA_ACCESS_MAP_ROOT"] === "string" &&
33
+ globalThis[TRACER_KEY] === undefined;
34
+
35
+ if (enabled) install(env["LISA_ACCESS_MAP_DIR"], env["LISA_ACCESS_MAP_ROOT"]);
36
+
37
+ /**
38
+ * Patch the process and expose `globalThis[Symbol.for("lisa.testAccessMap")]`.
39
+ * @param {string} directory - Raw-record directory
40
+ * @param {string} root - Repository root
41
+ * @returns {void}
42
+ */
43
+ function install(directory, root) {
44
+ const original = {
45
+ statSync: fs.statSync,
46
+ appendFileSync: fs.appendFileSync,
47
+ mkdirSync: fs.mkdirSync,
48
+ };
49
+ const output = path.join(directory, `${process.pid}-${randomUUID()}.ndjson`);
50
+ /** @type {Map<string, Set<string>>} */
51
+ const records = new Map();
52
+ const rootPrefix = `${root}${path.sep}`;
53
+
54
+ /**
55
+ * Record one absolute path against the current test file.
56
+ * @param {unknown} target - Path, URL or Buffer
57
+ * @returns {void}
58
+ */
59
+ function record(target) {
60
+ const test = env["LISA_ACCESS_MAP_TEST_FILE"];
61
+ if (!test) return;
62
+ const file = toPath(target);
63
+ if (file === undefined) return;
64
+ const absolute = path.resolve(file);
65
+ if (!absolute.startsWith(rootPrefix)) return;
66
+ const set = records.get(test) ?? new Set();
67
+ set.add(absolute);
68
+ records.set(test, set);
69
+ }
70
+
71
+ /**
72
+ * Record a spawned command and every argument that names an existing file.
73
+ * @param {unknown} command - Executable
74
+ * @param {ReadonlyArray<unknown>} args - Arguments
75
+ * @param {unknown} options - Spawn options (for `cwd`)
76
+ * @returns {void}
77
+ */
78
+ function recordSpawn(command, args, options) {
79
+ if (!env["LISA_ACCESS_MAP_TEST_FILE"]) return;
80
+ const cwd =
81
+ options && typeof options === "object" && "cwd" in options
82
+ ? toPath(options.cwd)
83
+ : undefined;
84
+ const base = cwd ?? process.cwd();
85
+ [command, ...args].forEach(candidate => {
86
+ if (typeof candidate !== "string" || candidate.length > 4096) return;
87
+ const absolute = path.resolve(base, candidate);
88
+ if (!absolute.startsWith(rootPrefix)) return;
89
+ const stat = original.statSync(absolute, { throwIfNoEntry: false });
90
+ if (stat?.isFile()) record(absolute);
91
+ });
92
+ }
93
+
94
+ /**
95
+ * Split a shell command string into the words that might be paths.
96
+ * @param {unknown} command - Shell command
97
+ * @returns {ReadonlyArray<string>} Words
98
+ */
99
+ function shellWords(command) {
100
+ return typeof command === "string"
101
+ ? command.split(/[\s'"`;|&<>()]+/).filter(Boolean)
102
+ : [];
103
+ }
104
+
105
+ /**
106
+ * Flush in-memory records to this process's NDJSON file.
107
+ * @returns {void}
108
+ */
109
+ function flush() {
110
+ if (records.size === 0) return;
111
+ const lines = [...records].map(
112
+ ([test, files]) => `${JSON.stringify({ test, files: [...files] })}\n`
113
+ );
114
+ records.clear();
115
+ try {
116
+ original.mkdirSync(directory, { recursive: true });
117
+ original.appendFileSync(output, lines.join(""));
118
+ } catch {
119
+ // A lost record only widens what B4 runs; never fail the test for it.
120
+ }
121
+ }
122
+
123
+ /**
124
+ * Replace `target[name]` with a wrapper that records, then calls through.
125
+ * Own symbol properties are carried over, so `util.promisify(exec)` keeps
126
+ * resolving `{ stdout, stderr }` through `util.promisify.custom`.
127
+ * @param {Record<string | symbol, unknown>} target - Module object
128
+ * @param {string} name - Function name
129
+ * @param {(...args: unknown[]) => void} before - Recorder
130
+ * @returns {void}
131
+ */
132
+ const patchFs = (target, name, before) => {
133
+ const originalFunction = target[name];
134
+ if (typeof originalFunction !== "function") return;
135
+ function traced(...args) {
136
+ try {
137
+ before(...args);
138
+ } catch {
139
+ // Recording must never change the call it observes.
140
+ }
141
+ return originalFunction.apply(this, args);
142
+ }
143
+ Object.getOwnPropertySymbols(originalFunction).forEach(symbol => {
144
+ traced[symbol] = originalFunction[symbol];
145
+ });
146
+ target[name] = traced;
147
+ };
148
+
149
+ const readFirst = file => record(file);
150
+ patchFs(fs, "readFileSync", readFirst);
151
+ patchFs(fs, "readFile", readFirst);
152
+ patchFs(fs, "createReadStream", readFirst);
153
+ patchFs(fs.promises, "readFile", readFirst);
154
+ patchFs(fs, "openSync", (file, flags) => {
155
+ if (flags === undefined || String(flags).startsWith("r") || flags === 0)
156
+ record(file);
157
+ });
158
+
159
+ const spawnLike = (command, args, options) =>
160
+ Array.isArray(args)
161
+ ? recordSpawn(command, args, options)
162
+ : recordSpawn(command, [], args);
163
+ ["spawn", "spawnSync", "execFile", "execFileSync", "fork"].forEach(name =>
164
+ patchFs(childProcess, name, spawnLike)
165
+ );
166
+ ["exec", "execSync"].forEach(name =>
167
+ patchFs(childProcess, name, (command, options) =>
168
+ recordSpawn(shellWords(command)[0], shellWords(command).slice(1), options)
169
+ )
170
+ );
171
+ module.syncBuiltinESMExports();
172
+
173
+ if (typeof module.registerHooks === "function") {
174
+ // A resolve hook only. A `load` hook moves `require` of CommonJS onto
175
+ // the ESM loader on Node 22: `require.cache` disappears (ESLint's
176
+ // eslint-comments plugin reads it) and CommonJS loaded through it fails
177
+ // with ERR_INVALID_RETURN_PROPERTY_VALUE. Every load is resolved first,
178
+ // so recording the resolved URL sees the same files.
179
+ module.registerHooks({
180
+ resolve(specifier, context, nextResolve) {
181
+ const resolved = nextResolve(specifier, context);
182
+ if (resolved?.url?.startsWith("file:")) record(resolved.url);
183
+ return resolved;
184
+ },
185
+ });
186
+ }
187
+
188
+ process.on("exit", flush);
189
+ globalThis[TRACER_KEY] = { flush, record };
190
+ }
191
+
192
+ /**
193
+ * A path-like value as a filesystem path, or undefined (file descriptors,
194
+ * non-file URLs, anything else).
195
+ * @param {unknown} target - Candidate
196
+ * @returns {string | undefined} Path
197
+ */
198
+ function toPath(target) {
199
+ if (typeof target === "string")
200
+ return target.startsWith("file:") ? fileURLToPath(target) : target;
201
+ if (target instanceof URL)
202
+ return target.protocol === "file:" ? fileURLToPath(target) : undefined;
203
+ if (Buffer.isBuffer(target)) return target.toString();
204
+ return undefined;
205
+ }
@@ -0,0 +1,72 @@
1
+ type Env = Readonly<Record<string, string | undefined>>;
2
+ type AccessMap = Readonly<Record<string, readonly string[]>>;
3
+ export interface TestAccessMapReporter {
4
+ readonly lisaTestAccessMap: true;
5
+ readonly onTestRunEnd: (
6
+ testModules: readonly {
7
+ readonly moduleId: string;
8
+ readonly state: () => string;
9
+ }[]
10
+ ) => void;
11
+ }
12
+ export declare const TEST_ACCESS_MAP_DIRECTORY: "tmp/test-access-map";
13
+ export declare const TEST_ACCESS_MAP_TRACER_VERSION: number;
14
+ export declare const TEST_ACCESS_MAP_SETUP_FILE: string;
15
+ export declare const ACCESS_MAP_ENV: Readonly<{
16
+ enabled: "LISA_ACCESS_MAP";
17
+ directory: "LISA_ACCESS_MAP_DIR";
18
+ root: "LISA_ACCESS_MAP_ROOT";
19
+ testFile: "LISA_ACCESS_MAP_TEST_FILE";
20
+ owner: "LISA_ACCESS_MAP_OWNER_PID";
21
+ }>;
22
+ export declare function testAccessMapEnabled(env: Env): boolean;
23
+ export declare function testAccessMapScope(
24
+ env: Env
25
+ ): "unit" | "integration" | undefined;
26
+ export declare function repositoryFile(
27
+ root: string,
28
+ file: string
29
+ ): string | undefined;
30
+ export declare function mergeAccessRecords(input: {
31
+ readonly root: string;
32
+ readonly lines: readonly string[];
33
+ readonly testFiles: readonly string[];
34
+ }): AccessMap;
35
+ export declare function accessMapMetadata(
36
+ env: Env,
37
+ scope: string,
38
+ now: Date,
39
+ triggers?: readonly string[]
40
+ ): Readonly<Record<string, unknown>>;
41
+ export declare function configuredTriggers(
42
+ root: string,
43
+ config: {
44
+ readonly forceRerunTriggers?: unknown;
45
+ readonly setupFiles?: unknown;
46
+ readonly globalSetup?: unknown;
47
+ }
48
+ ): readonly string[];
49
+ export declare function accessMapWanted(root: string): boolean;
50
+ export declare function armTestAccessMap(
51
+ env: Record<string, string | undefined>,
52
+ root: string
53
+ ): string | undefined;
54
+ export declare function testAccessMapReporter(input: {
55
+ readonly root: string;
56
+ readonly directory: string;
57
+ readonly env: Env;
58
+ readonly triggers?: readonly string[];
59
+ }): TestAccessMapReporter;
60
+ export declare function withTestAccessMapReporter<T>(
61
+ reporters: readonly T[],
62
+ reporter: TestAccessMapReporter
63
+ ): readonly (T | TestAccessMapReporter)[];
64
+ export declare function testAccessMapSetupFiles(env: Env): readonly string[];
65
+ export declare function testAccessMapPlugin(
66
+ env?: Record<string, string | undefined>
67
+ ): {
68
+ readonly name: string;
69
+ readonly configureVitest: (context: {
70
+ readonly vitest: { config: { root: string; reporters: unknown[] } };
71
+ }) => void;
72
+ };