@codyswann/lisa 5.3.2 → 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.
- package/README.md +60 -3
- package/all/copy-contents/gitignore +16 -0
- package/all/copy-contents/scripts/lisa-mutation.sh +4 -6
- package/all/copy-overwrite/scripts/fetch-test-access-map.d.mts +71 -0
- package/all/copy-overwrite/scripts/fetch-test-access-map.mjs +674 -0
- package/all/copy-overwrite/scripts/lib/affected-tests.mjs +818 -0
- package/all/copy-overwrite/scripts/lib/automation-provenance-contract.mjs +13 -3
- package/all/copy-overwrite/scripts/lib/automation-provenance-local.mjs +22 -1
- package/all/copy-overwrite/scripts/lib/build-marker.mjs +410 -0
- package/all/copy-overwrite/scripts/lib/gate-pass-cache.mjs +537 -0
- package/all/copy-overwrite/scripts/lib/kill-marks.mjs +1 -2
- package/all/copy-overwrite/scripts/lib/lisa-cleanup-sweep-processes.mjs +3 -4
- package/all/copy-overwrite/scripts/lib/npm-update-bun.mjs +39 -14
- package/all/copy-overwrite/scripts/lib/npm-update-controller-broker.mjs +1 -1
- package/all/copy-overwrite/scripts/lib/npm-update-gate-hooks.mjs +2 -1
- package/all/copy-overwrite/scripts/lib/npm-update-helper-inventory.mjs +8 -1
- package/all/copy-overwrite/scripts/lib/npm-update-hosted-gate.mjs +25 -9
- package/all/copy-overwrite/scripts/lib/npm-update-hosted-hook.mjs +1 -1
- package/all/copy-overwrite/scripts/lib/npm-update-tool-launcher.mjs +1 -1
- package/all/copy-overwrite/scripts/lib/push-admission.mjs +158 -0
- package/all/copy-overwrite/scripts/lib/push-gate-defaults.d.mts +34 -0
- package/all/copy-overwrite/scripts/lib/push-gate-defaults.mjs +147 -0
- package/all/copy-overwrite/scripts/lib/push-timing.mjs +323 -0
- package/all/copy-overwrite/scripts/lib/rspec-selection.mjs +672 -0
- package/all/copy-overwrite/scripts/lisa-affected-tests.mjs +566 -0
- package/all/copy-overwrite/scripts/lisa-gates.mjs +29 -0
- package/all/copy-overwrite/scripts/lisa-lint-staged-preflight.mjs +10 -1
- package/all/copy-overwrite/scripts/lisa-push-timing-report.mjs +153 -0
- package/all/copy-overwrite/scripts/lisa-rspec-select.mjs +982 -0
- package/all/copy-overwrite/scripts/lisa-run-gates.mjs +231 -6
- package/all/copy-overwrite/scripts/npm-updater-helper-graph.json +108 -20
- package/all/deletions.json +11 -2
- package/cdk/create-only/vitest.config.local.ts +1 -7
- package/cdk/package-lisa/package.lisa.json +4 -4
- package/dist/cli/admit-cmd.d.ts +21 -0
- package/dist/cli/admit-cmd.d.ts.map +1 -0
- package/dist/cli/admit-cmd.js +142 -0
- package/dist/cli/admit-cmd.js.map +1 -0
- package/dist/cli/check-cmd.d.ts +72 -0
- package/dist/cli/check-cmd.d.ts.map +1 -0
- package/dist/cli/check-cmd.js +316 -0
- package/dist/cli/check-cmd.js.map +1 -0
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +6 -4
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/lisa-test-run-admission.d.ts +18 -0
- package/dist/cli/lisa-test-run-admission.d.ts.map +1 -0
- package/dist/cli/lisa-test-run-admission.js +62 -0
- package/dist/cli/lisa-test-run-admission.js.map +1 -0
- package/dist/cli/lisa-test-run-payload.d.ts +37 -0
- package/dist/cli/lisa-test-run-payload.d.ts.map +1 -0
- package/dist/cli/lisa-test-run-payload.js +55 -0
- package/dist/cli/lisa-test-run-payload.js.map +1 -0
- package/dist/cli/lisa-test-run-shard-files.d.ts +89 -0
- package/dist/cli/lisa-test-run-shard-files.d.ts.map +1 -0
- package/dist/cli/lisa-test-run-shard-files.js +239 -0
- package/dist/cli/lisa-test-run-shard-files.js.map +1 -0
- package/dist/cli/lisa-test-run-shard.d.ts +6 -2
- package/dist/cli/lisa-test-run-shard.d.ts.map +1 -1
- package/dist/cli/lisa-test-run-shard.js +25 -13
- package/dist/cli/lisa-test-run-shard.js.map +1 -1
- package/dist/cli/lisa-test-run.d.ts +1 -1
- package/dist/cli/lisa-test-run.d.ts.map +1 -1
- package/dist/cli/lisa-test-run.js +47 -10
- package/dist/cli/lisa-test-run.js.map +1 -1
- package/dist/cli/update-check-hook.d.ts.map +1 -1
- package/dist/cli/update-check-hook.js +3 -0
- package/dist/cli/update-check-hook.js.map +1 -1
- package/dist/configs/vitest/base.d.ts +58 -135
- package/dist/configs/vitest/base.d.ts.map +1 -1
- package/dist/configs/vitest/base.js +76 -228
- package/dist/configs/vitest/base.js.map +1 -1
- package/dist/configs/vitest/cdk.d.ts.map +1 -1
- package/dist/configs/vitest/cdk.js +3 -2
- package/dist/configs/vitest/cdk.js.map +1 -1
- package/dist/configs/vitest/coverage-include-global-setup.d.ts.map +1 -1
- package/dist/configs/vitest/coverage-include-global-setup.js +3 -4
- package/dist/configs/vitest/coverage-include-global-setup.js.map +1 -1
- package/dist/configs/vitest/coverage-reports-directory.d.ts +27 -5
- package/dist/configs/vitest/coverage-reports-directory.d.ts.map +1 -1
- package/dist/configs/vitest/coverage-reports-directory.js +47 -10
- package/dist/configs/vitest/coverage-reports-directory.js.map +1 -1
- package/dist/configs/vitest/harper-fabric.d.ts.map +1 -1
- package/dist/configs/vitest/harper-fabric.js +3 -2
- package/dist/configs/vitest/harper-fabric.js.map +1 -1
- package/dist/configs/vitest/nestjs.d.ts.map +1 -1
- package/dist/configs/vitest/nestjs.js +3 -2
- package/dist/configs/vitest/nestjs.js.map +1 -1
- package/dist/configs/vitest/phaser.d.ts.map +1 -1
- package/dist/configs/vitest/phaser.js +3 -2
- package/dist/configs/vitest/phaser.js.map +1 -1
- package/dist/configs/vitest/refusal-announcement.d.ts +51 -0
- package/dist/configs/vitest/refusal-announcement.d.ts.map +1 -0
- package/dist/configs/vitest/refusal-announcement.js +97 -0
- package/dist/configs/vitest/refusal-announcement.js.map +1 -0
- package/dist/configs/vitest/socket-safe-temp-base.d.ts +3 -4
- package/dist/configs/vitest/socket-safe-temp-base.d.ts.map +1 -1
- package/dist/configs/vitest/socket-safe-temp-base.js +7 -6
- package/dist/configs/vitest/socket-safe-temp-base.js.map +1 -1
- package/dist/configs/vitest/typescript.d.ts.map +1 -1
- package/dist/configs/vitest/typescript.js +3 -2
- package/dist/configs/vitest/typescript.js.map +1 -1
- package/dist/core/admission-decision.d.ts +110 -0
- package/dist/core/admission-decision.d.ts.map +1 -0
- package/dist/core/admission-decision.js +91 -0
- package/dist/core/admission-decision.js.map +1 -0
- package/dist/core/admission-lock.d.ts +69 -0
- package/dist/core/admission-lock.d.ts.map +1 -0
- package/dist/core/admission-lock.js +278 -0
- package/dist/core/admission-lock.js.map +1 -0
- package/dist/core/admission-settings.d.ts +69 -0
- package/dist/core/admission-settings.d.ts.map +1 -0
- package/dist/core/admission-settings.js +204 -0
- package/dist/core/admission-settings.js.map +1 -0
- package/dist/core/admission-state.d.ts +50 -0
- package/dist/core/admission-state.d.ts.map +1 -0
- package/dist/core/admission-state.js +168 -0
- package/dist/core/admission-state.js.map +1 -0
- package/dist/core/admission.d.ts +70 -0
- package/dist/core/admission.d.ts.map +1 -0
- package/dist/core/admission.js +205 -0
- package/dist/core/admission.js.map +1 -0
- package/dist/core/lisa-owned-hash-ledger.d.ts.map +1 -1
- package/dist/core/lisa-owned-hash-ledger.js +336 -0
- package/dist/core/lisa-owned-hash-ledger.js.map +1 -1
- package/dist/core/nightly-e2e-guard-behavior-certificate.js +2 -2
- package/dist/core/project-config-push-gate.d.ts +66 -0
- package/dist/core/project-config-push-gate.d.ts.map +1 -0
- package/dist/core/project-config-push-gate.js +82 -0
- package/dist/core/project-config-push-gate.js.map +1 -0
- package/dist/core/project-config.d.ts +4 -0
- package/dist/core/project-config.d.ts.map +1 -1
- package/dist/core/project-config.js +14 -9
- package/dist/core/project-config.js.map +1 -1
- package/dist/core/upstream-evidence-manifest.d.ts.map +1 -1
- package/dist/core/upstream-evidence-manifest.js +207 -126
- package/dist/core/upstream-evidence-manifest.js.map +1 -1
- package/expo/package-lisa/package.lisa.json +2 -2
- package/harper-fabric/package-lisa/package.lisa.json +4 -4
- package/nestjs/create-only/vitest.config.local.ts +1 -7
- package/nestjs/package-lisa/package.lisa.json +4 -4
- package/npm-package/package-lisa/package.lisa.json +4 -4
- package/package.json +12 -11
- package/phaser/package-lisa/package.lisa.json +4 -4
- package/plugins/lisa/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa/.codex-plugin/skills/lisa-drive-pr-to-merge/SKILL.md +16 -3
- package/plugins/lisa/.codex-plugin/skills/lisa-git-submit-pr/SKILL.md +1 -1
- package/plugins/lisa/.codex-plugin/skills/lisa-implement/SKILL.md +1 -1
- package/plugins/lisa/skills/lisa-drive-pr-to-merge/SKILL.md +16 -3
- package/plugins/lisa/skills/lisa-git-submit-pr/SKILL.md +1 -1
- package/plugins/lisa/skills/lisa-implement/SKILL.md +1 -1
- package/plugins/lisa-agy/plugin.json +1 -1
- package/plugins/lisa-agy/skills/lisa-drive-pr-to-merge/SKILL.md +16 -3
- package/plugins/lisa-agy/skills/lisa-git-submit-pr/SKILL.md +1 -1
- package/plugins/lisa-agy/skills/lisa-implement/SKILL.md +1 -1
- package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-agy/plugin.json +1 -1
- package/plugins/lisa-cdk-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-copilot/skills/lisa-drive-pr-to-merge/SKILL.md +16 -3
- package/plugins/lisa-copilot/skills/lisa-git-submit-pr/SKILL.md +1 -1
- package/plugins/lisa-copilot/skills/lisa-implement/SKILL.md +1 -1
- package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cursor/skills/lisa-drive-pr-to-merge/SKILL.md +16 -3
- package/plugins/lisa-cursor/skills/lisa-git-submit-pr/SKILL.md +1 -1
- package/plugins/lisa-cursor/skills/lisa-implement/SKILL.md +1 -1
- package/plugins/lisa-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-devin/skills/lisa-drive-pr-to-merge/SKILL.md +16 -3
- package/plugins/lisa-devin/skills/lisa-git-submit-pr/SKILL.md +1 -1
- package/plugins/lisa-devin/skills/lisa-implement/SKILL.md +1 -1
- package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-agy/plugin.json +1 -1
- package/plugins/lisa-expo-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-agy/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-agy/plugin.json +1 -1
- package/plugins/lisa-nestjs-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-agy/plugin.json +1 -1
- package/plugins/lisa-phaser-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-agy/plugin.json +1 -1
- package/plugins/lisa-rails-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-agy/plugin.json +1 -1
- package/plugins/lisa-typescript-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-agy/plugin.json +1 -1
- package/plugins/lisa-wiki-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/src/base/skills/lisa-drive-pr-to-merge/SKILL.md +16 -3
- package/plugins/src/base/skills/lisa-git-submit-pr/SKILL.md +1 -1
- package/plugins/src/base/skills/lisa-implement/SKILL.md +1 -1
- package/rails/copy-overwrite/Gemfile.lisa +8 -0
- package/rails/copy-overwrite/lefthook.yml +25 -11
- package/rails/copy-overwrite/scripts/lisa-rails-gates.mjs +686 -0
- package/rails/copy-overwrite/scripts/lisa-rspec-shards.mjs +2 -2
- package/rails/copy-overwrite/scripts/lisa_crystalball_recorder.rb +239 -0
- package/rails/copy-overwrite/scripts/lisa_rspec_partial_coverage.rb +83 -0
- package/scripts/build-unless-marked.mjs +83 -0
- package/scripts/check-plugins-sync.sh +22 -5
- package/scripts/classify-markdown-assertions.mjs +141 -0
- package/scripts/integration-shard-build.mjs +143 -0
- package/scripts/lib/history-scanner-suites.mjs +19 -0
- package/scripts/lib/markdown-assertions/classify.mjs +289 -0
- package/scripts/lib/markdown-assertions/context.mjs +53 -0
- package/scripts/lib/markdown-assertions/corpus.mjs +222 -0
- package/scripts/lib/markdown-assertions/manifest-cull.mjs +86 -0
- package/scripts/lib/markdown-assertions/record-setup.mjs +265 -0
- package/scripts/lib/markdown-assertions/record.mjs +115 -0
- package/scripts/lib/markdown-assertions/record.vitest.config.mjs +24 -0
- package/scripts/lib/markdown-assertions/sites.mjs +273 -0
- package/scripts/lib/markdown-assertions/test-cull.mjs +768 -0
- package/scripts/lib/markdown-assertions/tokens.mjs +158 -0
- package/scripts/lib/shell-guard-trace.mjs +6 -0
- package/scripts/lib/test-access-map-setup.mjs +40 -0
- package/scripts/lib/test-access-map-tracer.mjs +205 -0
- package/scripts/lib/test-access-map.d.mts +72 -0
- package/scripts/lib/test-access-map.mjs +395 -0
- package/scripts/lib/test-timings-reporter.d.mts +17 -0
- package/scripts/lib/test-timings-reporter.mjs +99 -0
- package/scripts/plan-integration-shards.mjs +300 -0
- package/scripts/test-timing-report.d.mts +41 -0
- package/scripts/test-timing-report.mjs +361 -0
- package/scripts/two-channel-couplings.json +132 -36
- package/scripts/verify-npm-advisories-4333.mjs +3 -12
- package/typescript/copy-overwrite/.prettierignore +12 -0
- package/typescript/create-only/vitest.config.local.ts +1 -7
- package/typescript/package-lisa/package.lisa.json +4 -4
- package/all/copy-overwrite/scripts/lisa-scratch-run.sh +0 -1078
- package/dist/cli/lisa-test-run-bootstrap.d.ts +0 -3
- package/dist/cli/lisa-test-run-bootstrap.d.ts.map +0 -1
- package/dist/cli/lisa-test-run-bootstrap.js +0 -229
- package/dist/cli/lisa-test-run-bootstrap.js.map +0 -1
- package/dist/cli/lisa-test-run-ipc.d.ts +0 -49
- package/dist/cli/lisa-test-run-ipc.d.ts.map +0 -1
- package/dist/cli/lisa-test-run-ipc.js +0 -226
- package/dist/cli/lisa-test-run-ipc.js.map +0 -1
- package/dist/cli/lisa-test-run-process-group.d.ts +0 -30
- package/dist/cli/lisa-test-run-process-group.d.ts.map +0 -1
- package/dist/cli/lisa-test-run-process-group.js +0 -140
- package/dist/cli/lisa-test-run-process-group.js.map +0 -1
- package/dist/cli/lisa-test-run-reaper.d.ts +0 -3
- package/dist/cli/lisa-test-run-reaper.d.ts.map +0 -1
- package/dist/cli/lisa-test-run-reaper.js +0 -195
- package/dist/cli/lisa-test-run-reaper.js.map +0 -1
- package/dist/cli/lisa-test-run-runtime.d.ts +0 -46
- package/dist/cli/lisa-test-run-runtime.d.ts.map +0 -1
- package/dist/cli/lisa-test-run-runtime.js +0 -123
- package/dist/cli/lisa-test-run-runtime.js.map +0 -1
- package/dist/cli/lisa-test-run-supervisor.d.ts +0 -13
- package/dist/cli/lisa-test-run-supervisor.d.ts.map +0 -1
- package/dist/cli/lisa-test-run-supervisor.js +0 -265
- package/dist/cli/lisa-test-run-supervisor.js.map +0 -1
- package/dist/configs/vitest/fleet-admission-global-setup.d.ts +0 -34
- package/dist/configs/vitest/fleet-admission-global-setup.d.ts.map +0 -1
- package/dist/configs/vitest/fleet-admission-global-setup.js +0 -123
- package/dist/configs/vitest/fleet-admission-global-setup.js.map +0 -1
- package/dist/configs/vitest/fleet-admission.d.ts +0 -129
- package/dist/configs/vitest/fleet-admission.d.ts.map +0 -1
- package/dist/configs/vitest/fleet-admission.js +0 -239
- package/dist/configs/vitest/fleet-admission.js.map +0 -1
- package/dist/configs/vitest/scratch-authority.d.ts +0 -25
- package/dist/configs/vitest/scratch-authority.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-authority.js +0 -107
- package/dist/configs/vitest/scratch-authority.js.map +0 -1
- package/dist/configs/vitest/scratch-bound-cleanup-programs.d.ts +0 -5
- package/dist/configs/vitest/scratch-bound-cleanup-programs.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-bound-cleanup-programs.js +0 -219
- package/dist/configs/vitest/scratch-bound-cleanup-programs.js.map +0 -1
- package/dist/configs/vitest/scratch-bound-cleanup.d.ts +0 -28
- package/dist/configs/vitest/scratch-bound-cleanup.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-bound-cleanup.js +0 -155
- package/dist/configs/vitest/scratch-bound-cleanup.js.map +0 -1
- package/dist/configs/vitest/scratch-bound-root-cleanup.d.ts +0 -17
- package/dist/configs/vitest/scratch-bound-root-cleanup.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-bound-root-cleanup.js +0 -149
- package/dist/configs/vitest/scratch-bound-root-cleanup.js.map +0 -1
- package/dist/configs/vitest/scratch-global-setup.d.ts +0 -258
- package/dist/configs/vitest/scratch-global-setup.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-global-setup.js +0 -505
- package/dist/configs/vitest/scratch-global-setup.js.map +0 -1
- package/dist/configs/vitest/scratch-leak-setup.d.ts +0 -2
- package/dist/configs/vitest/scratch-leak-setup.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-leak-setup.js +0 -108
- package/dist/configs/vitest/scratch-leak-setup.js.map +0 -1
- package/dist/configs/vitest/scratch-namespace-authority.d.ts +0 -80
- package/dist/configs/vitest/scratch-namespace-authority.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-namespace-authority.js +0 -291
- package/dist/configs/vitest/scratch-namespace-authority.js.map +0 -1
- package/dist/configs/vitest/scratch-owner.d.ts +0 -131
- package/dist/configs/vitest/scratch-owner.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-owner.js +0 -297
- package/dist/configs/vitest/scratch-owner.js.map +0 -1
- package/dist/configs/vitest/scratch-route-profile.d.ts +0 -46
- package/dist/configs/vitest/scratch-route-profile.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-route-profile.js +0 -233
- package/dist/configs/vitest/scratch-route-profile.js.map +0 -1
- package/dist/configs/vitest/scratch-run-root-compatibility.d.ts +0 -33
- package/dist/configs/vitest/scratch-run-root-compatibility.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-run-root-compatibility.js +0 -137
- package/dist/configs/vitest/scratch-run-root-compatibility.js.map +0 -1
- package/dist/configs/vitest/scratch-run-root-intent.d.ts +0 -66
- package/dist/configs/vitest/scratch-run-root-intent.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-run-root-intent.js +0 -183
- package/dist/configs/vitest/scratch-run-root-intent.js.map +0 -1
- package/dist/configs/vitest/scratch-setup.d.ts +0 -46
- package/dist/configs/vitest/scratch-setup.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-setup.js +0 -226
- package/dist/configs/vitest/scratch-setup.js.map +0 -1
- package/dist/configs/vitest/scratch-supervision-intent.d.ts +0 -8
- package/dist/configs/vitest/scratch-supervision-intent.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-supervision-intent.js +0 -125
- package/dist/configs/vitest/scratch-supervision-intent.js.map +0 -1
- package/dist/configs/vitest/scratch-supervision-protocol.d.ts +0 -12
- package/dist/configs/vitest/scratch-supervision-protocol.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-supervision-protocol.js +0 -230
- package/dist/configs/vitest/scratch-supervision-protocol.js.map +0 -1
- package/dist/configs/vitest/scratch-supervision.d.ts +0 -69
- package/dist/configs/vitest/scratch-supervision.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-supervision.js +0 -244
- package/dist/configs/vitest/scratch-supervision.js.map +0 -1
- package/dist/configs/vitest/scratch-sweep.d.ts +0 -66
- package/dist/configs/vitest/scratch-sweep.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-sweep.js +0 -82
- package/dist/configs/vitest/scratch-sweep.js.map +0 -1
- package/dist/configs/vitest/scratch-tmpdir-trust.d.ts +0 -48
- package/dist/configs/vitest/scratch-tmpdir-trust.d.ts.map +0 -1
- package/dist/configs/vitest/scratch-tmpdir-trust.js +0 -194
- package/dist/configs/vitest/scratch-tmpdir-trust.js.map +0 -1
- package/dist/configs/vitest/scratch.d.ts +0 -19
- package/dist/configs/vitest/scratch.d.ts.map +0 -1
- package/dist/configs/vitest/scratch.js +0 -34
- package/dist/configs/vitest/scratch.js.map +0 -1
- package/dist/configs/vitest/synthesis-scratch-reclaim.d.ts +0 -86
- package/dist/configs/vitest/synthesis-scratch-reclaim.d.ts.map +0 -1
- package/dist/configs/vitest/synthesis-scratch-reclaim.js +0 -226
- 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
|
+
};
|