@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
|
@@ -184,9 +184,19 @@ export function proposalFileNames(value) {
|
|
|
184
184
|
return files;
|
|
185
185
|
}
|
|
186
186
|
|
|
187
|
-
/**
|
|
188
|
-
|
|
189
|
-
|
|
187
|
+
/**
|
|
188
|
+
* The root install's inputs plus the proposal's own files must all survive the ordinary install unchanged.
|
|
189
|
+
* A Bun-only root (bun.lock, no package-lock.json) installs from bun.lock, and
|
|
190
|
+
* only a subdirectory proposal may run on one: the root npm project is absent.
|
|
191
|
+
*/
|
|
192
|
+
export function installInputs(value, rootManager = "npm") {
|
|
193
|
+
requireProof(
|
|
194
|
+
rootManager === "npm" ||
|
|
195
|
+
(rootManager === "bun" && directoryOf(value) !== "."),
|
|
196
|
+
"a Bun-only root supports only a subdirectory npm proposal"
|
|
197
|
+
);
|
|
198
|
+
const root = rootManager === "bun" ? [BUN_LOCK, MANIFEST] : FILES;
|
|
199
|
+
return [...new Set([...root, ...cohortNames(value)])];
|
|
190
200
|
}
|
|
191
201
|
|
|
192
202
|
/** Committed history paths in their historical order; the root command string never changes. */
|
|
@@ -208,6 +208,27 @@ export function proofSnapshot() {
|
|
|
208
208
|
return { paths, optional, bytes, bundleBytes, descriptor };
|
|
209
209
|
}
|
|
210
210
|
|
|
211
|
+
/** Ceiling on one canonical tracker read, whatever deadline is inherited. */
|
|
212
|
+
const RESOLVER_TIMEOUT_MS = 30_000;
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* The canonical resolver's per-read deadline. It deliberately ignores the
|
|
216
|
+
* inherited `LISA_WORK_ITEM_TIMEOUT_MS`, so a zero or a huge value there cannot
|
|
217
|
+
* unbound it. `LISA_PROVENANCE_RESOLVER_TIMEOUT_MS` may only shorten it (a
|
|
218
|
+
* shorter deadline can only refuse sooner), which lets a suite prove a hung
|
|
219
|
+
* resolver is refused without sitting out thirty seconds.
|
|
220
|
+
* @param {Readonly<Record<string, string | undefined>>} env Process environment.
|
|
221
|
+
* @returns {number} Deadline in milliseconds.
|
|
222
|
+
*/
|
|
223
|
+
export function resolverTimeoutMs(env = process.env) {
|
|
224
|
+
const requested = Number(env.LISA_PROVENANCE_RESOLVER_TIMEOUT_MS);
|
|
225
|
+
return Number.isSafeInteger(requested) &&
|
|
226
|
+
requested > 0 &&
|
|
227
|
+
requested < RESOLVER_TIMEOUT_MS
|
|
228
|
+
? requested
|
|
229
|
+
: RESOLVER_TIMEOUT_MS;
|
|
230
|
+
}
|
|
231
|
+
|
|
211
232
|
/** Reuse the shipped resolver and retain current canonical lifecycle requirements. */
|
|
212
233
|
export function canonicalContext(message, config, policy, descriptor) {
|
|
213
234
|
const context = resolveWorkItemContext(message, {
|
|
@@ -216,7 +237,7 @@ export function canonicalContext(message, config, policy, descriptor) {
|
|
|
216
237
|
execute: (command, args, options) =>
|
|
217
238
|
run(command === "gh" ? policy.ghExecutable : command, args, {
|
|
218
239
|
...options,
|
|
219
|
-
timeout:
|
|
240
|
+
timeout: resolverTimeoutMs(),
|
|
220
241
|
maxBuffer: 1_048_576,
|
|
221
242
|
env: { ...process.env, GH_HOST: "github.com" },
|
|
222
243
|
}),
|
|
@@ -0,0 +1,410 @@
|
|
|
1
|
+
// This file is managed by Lisa and IS replaced on each `lisa` run.
|
|
2
|
+
// Do not edit directly — durable changes belong upstream in Lisa.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Build once per push, and let later steps prove they may skip their own build.
|
|
6
|
+
*
|
|
7
|
+
* A push used to build the package two or three times: every test gate runs a
|
|
8
|
+
* build before testing, and the plugin drift check rebuilds again. Repeating a
|
|
9
|
+
* deterministic build against the same tree proves nothing new
|
|
10
|
+
* (CodySwannGT/lisa#4595).
|
|
11
|
+
*
|
|
12
|
+
* The gate runner builds once, up front, at `--moment=push`, and records WHAT it
|
|
13
|
+
* built in a marker: the tree hash of the working tree, the lockfile hash, and
|
|
14
|
+
* the node and bun versions. It exports the marker's path as
|
|
15
|
+
* `LISA_BUILD_MARKER`. A later step skips its build only when every recorded
|
|
16
|
+
* fact still matches the current tree. Any mismatch, a missing or unreadable
|
|
17
|
+
* marker, or no `LISA_BUILD_MARKER` at all means "build exactly as before", so a
|
|
18
|
+
* stale `dist/` is still rebuilt (CodySwannGT/lisa#3778).
|
|
19
|
+
*
|
|
20
|
+
* The behaviour is off unless `.lisa.config.json` sets
|
|
21
|
+
* `pushGate.buildOnce: true`. With it off nothing here runs.
|
|
22
|
+
* @module build-marker
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
import { spawnSync } from "node:child_process";
|
|
26
|
+
import { createHash } from "node:crypto";
|
|
27
|
+
import {
|
|
28
|
+
copyFileSync,
|
|
29
|
+
existsSync,
|
|
30
|
+
mkdirSync,
|
|
31
|
+
mkdtempSync,
|
|
32
|
+
readFileSync,
|
|
33
|
+
rmSync,
|
|
34
|
+
statSync,
|
|
35
|
+
utimesSync,
|
|
36
|
+
writeFileSync,
|
|
37
|
+
} from "node:fs";
|
|
38
|
+
import { tmpdir } from "node:os";
|
|
39
|
+
import { dirname, join, resolve } from "node:path";
|
|
40
|
+
|
|
41
|
+
/** The environment variable that hands the marker to every gate. */
|
|
42
|
+
export const BUILD_MARKER_ENV = "LISA_BUILD_MARKER";
|
|
43
|
+
|
|
44
|
+
/** Where the marker lives, relative to the project root (gitignored). */
|
|
45
|
+
export const BUILD_MARKER_PATH = ".lisa/build-marker.json";
|
|
46
|
+
|
|
47
|
+
/** The schema token a reader refuses to parse past. */
|
|
48
|
+
export const BUILD_MARKER_SCHEMA = "lisa.build-marker/v1";
|
|
49
|
+
|
|
50
|
+
/** The id of the build step in the push timing report. */
|
|
51
|
+
export const BUILD_ONCE_ID = "build-once";
|
|
52
|
+
|
|
53
|
+
/** Lockfiles in the order they are looked for. */
|
|
54
|
+
const LOCKFILES = Object.freeze([
|
|
55
|
+
"bun.lock",
|
|
56
|
+
"bun.lockb",
|
|
57
|
+
"package-lock.json",
|
|
58
|
+
"pnpm-lock.yaml",
|
|
59
|
+
"yarn.lock",
|
|
60
|
+
]);
|
|
61
|
+
|
|
62
|
+
/** Git's location variables, which a hook exports to its children. */
|
|
63
|
+
const GIT_LOCATION_ENV = new Set([
|
|
64
|
+
"GIT_DIR",
|
|
65
|
+
"GIT_WORK_TREE",
|
|
66
|
+
"GIT_INDEX_FILE",
|
|
67
|
+
"GIT_PREFIX",
|
|
68
|
+
]);
|
|
69
|
+
|
|
70
|
+
/** The generated-artifact manifest whose paths count as "plugin" output. */
|
|
71
|
+
const MATERIALIZED_MANIFEST = "plugins/materialized-artifacts.json";
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Read and validate `pushGate.buildOnce` from a parsed `.lisa.config.json`.
|
|
75
|
+
*
|
|
76
|
+
* An unrecognised value is refused rather than defaulted: a typo must not
|
|
77
|
+
* silently switch a behaviour on or off for the project that asked for it.
|
|
78
|
+
* @param {Record<string, unknown>|null|undefined} config Parsed config.
|
|
79
|
+
* @returns {boolean} Whether build-once is switched on (default `false`).
|
|
80
|
+
* @throws {Error} When `pushGate` or `pushGate.buildOnce` has the wrong type.
|
|
81
|
+
*/
|
|
82
|
+
export function buildOnceEnabled(config) {
|
|
83
|
+
const pushGate = config?.pushGate;
|
|
84
|
+
if (pushGate === undefined) return false;
|
|
85
|
+
if (
|
|
86
|
+
pushGate === null ||
|
|
87
|
+
typeof pushGate !== "object" ||
|
|
88
|
+
Array.isArray(pushGate)
|
|
89
|
+
) {
|
|
90
|
+
throw new Error(
|
|
91
|
+
`pushGate is ${JSON.stringify(pushGate)}; expected an object such as ` +
|
|
92
|
+
`{ "buildOnce": true }.`
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
const { buildOnce } = pushGate;
|
|
96
|
+
if (buildOnce === undefined) return false;
|
|
97
|
+
if (typeof buildOnce !== "boolean") {
|
|
98
|
+
throw new Error(
|
|
99
|
+
`pushGate.buildOnce is ${JSON.stringify(buildOnce)}; expected true or false.`
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
return buildOnce;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Run git and return trimmed stdout, or null when git fails.
|
|
107
|
+
* @param {string[]} args Git arguments.
|
|
108
|
+
* @param {object} [options] Options.
|
|
109
|
+
* @param {string} [options.cwd] Working directory.
|
|
110
|
+
* @param {NodeJS.ProcessEnv} [options.env] Extra environment.
|
|
111
|
+
* @returns {string|null} Output, or null on failure.
|
|
112
|
+
*/
|
|
113
|
+
function git(args, { cwd = process.cwd(), env = {} } = {}) {
|
|
114
|
+
// Git exports these to hook children. Inherited, they would point this at
|
|
115
|
+
// whatever repository and index the hook was invoked for instead of `cwd`'s,
|
|
116
|
+
// and an inherited GIT_INDEX_FILE would defeat the private index below.
|
|
117
|
+
const inherited = Object.fromEntries(
|
|
118
|
+
Object.entries(process.env).filter(([key]) => !GIT_LOCATION_ENV.has(key))
|
|
119
|
+
);
|
|
120
|
+
const child = spawnSync("git", args, {
|
|
121
|
+
cwd,
|
|
122
|
+
encoding: "utf8",
|
|
123
|
+
env: { ...inherited, ...env },
|
|
124
|
+
maxBuffer: 64 * 1024 * 1024,
|
|
125
|
+
});
|
|
126
|
+
// probe-direction: fail-closed — a null tree never matches a marker, and a
|
|
127
|
+
// null status is never clean, so a failed git always means "build".
|
|
128
|
+
if (child.status !== 0) return null;
|
|
129
|
+
return child.stdout.trim();
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* The tree hash of the working tree as it is now, tracked and untracked files
|
|
134
|
+
* alike (ignored files excluded), without touching the real index.
|
|
135
|
+
*
|
|
136
|
+
* A private copy of the index keeps git's stat cache, so this costs about as
|
|
137
|
+
* much as `git status`.
|
|
138
|
+
* @param {string} [cwd] Project root.
|
|
139
|
+
* @returns {string|null} The tree hash, or null when it cannot be computed.
|
|
140
|
+
*/
|
|
141
|
+
export function workingTreeHash(cwd = process.cwd()) {
|
|
142
|
+
const indexPath = git(
|
|
143
|
+
["rev-parse", "--path-format=absolute", "--git-path", "index"],
|
|
144
|
+
{
|
|
145
|
+
cwd,
|
|
146
|
+
}
|
|
147
|
+
);
|
|
148
|
+
if (!indexPath) return null;
|
|
149
|
+
const scratch = mkdtempSync(join(tmpdir(), "lisa-build-marker-"));
|
|
150
|
+
const tempIndex = join(scratch, "index");
|
|
151
|
+
try {
|
|
152
|
+
if (existsSync(indexPath)) {
|
|
153
|
+
copyFileSync(indexPath, tempIndex);
|
|
154
|
+
// Keep the index's own mtime. Git treats an entry modified in the same
|
|
155
|
+
// second as the index as "racily clean" and re-hashes it; a copy stamped
|
|
156
|
+
// NOW would make git trust that entry's stat data, so a same-size edit
|
|
157
|
+
// made within that second would hash as the old content.
|
|
158
|
+
const { atime, mtime } = statSync(indexPath);
|
|
159
|
+
utimesSync(tempIndex, atime, mtime);
|
|
160
|
+
}
|
|
161
|
+
const env = { GIT_INDEX_FILE: tempIndex };
|
|
162
|
+
if (git(["add", "-A", "--", "."], { cwd, env }) === null) return null;
|
|
163
|
+
return git(["write-tree"], { cwd, env });
|
|
164
|
+
} finally {
|
|
165
|
+
rmSync(scratch, { recursive: true, force: true });
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* The first lockfile present and the sha256 of its bytes.
|
|
171
|
+
* @param {string} [cwd] Project root.
|
|
172
|
+
* @returns {{file: string, sha256: string}|null} The lockfile, or null if none.
|
|
173
|
+
*/
|
|
174
|
+
export function lockfileHash(cwd = process.cwd()) {
|
|
175
|
+
const file = LOCKFILES.find(name => existsSync(join(cwd, name)));
|
|
176
|
+
if (!file) return null;
|
|
177
|
+
const sha256 = createHash("sha256")
|
|
178
|
+
.update(readFileSync(join(cwd, file)))
|
|
179
|
+
.digest("hex");
|
|
180
|
+
return { file, sha256 };
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* The bun version on PATH, or the running one, or null without bun.
|
|
185
|
+
* @returns {string|null} The version.
|
|
186
|
+
*/
|
|
187
|
+
function bunVersion() {
|
|
188
|
+
if (process.versions.bun) return process.versions.bun;
|
|
189
|
+
const child = spawnSync("bun", ["--version"], { encoding: "utf8" });
|
|
190
|
+
return child.status === 0 ? child.stdout.trim() : null;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Everything a marker records about the inputs of a build.
|
|
195
|
+
* @typedef {object} BuildFingerprint
|
|
196
|
+
* @property {string|null} tree Working-tree hash.
|
|
197
|
+
* @property {{file: string, sha256: string}|null} lockfile Lockfile hash.
|
|
198
|
+
* @property {string} node Node version.
|
|
199
|
+
* @property {string|null} bun Bun version.
|
|
200
|
+
*/
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Fingerprint the current working tree and toolchain.
|
|
204
|
+
* @param {string} [cwd] Project root.
|
|
205
|
+
* @returns {BuildFingerprint} The fingerprint.
|
|
206
|
+
*/
|
|
207
|
+
export function currentFingerprint(cwd = process.cwd()) {
|
|
208
|
+
return {
|
|
209
|
+
tree: workingTreeHash(cwd),
|
|
210
|
+
lockfile: lockfileHash(cwd),
|
|
211
|
+
node: process.versions.node,
|
|
212
|
+
bun: bunVersion(),
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Whether `plugins/` and every path the plugin build materializes outside it
|
|
218
|
+
* are clean against git.
|
|
219
|
+
* @param {string} [cwd] Project root.
|
|
220
|
+
* @returns {boolean} True when nothing there has uncommitted changes.
|
|
221
|
+
*/
|
|
222
|
+
export function pluginsClean(cwd = process.cwd()) {
|
|
223
|
+
const paths = ["plugins/"];
|
|
224
|
+
const manifest = join(cwd, MATERIALIZED_MANIFEST);
|
|
225
|
+
if (existsSync(manifest)) {
|
|
226
|
+
try {
|
|
227
|
+
const listed = JSON.parse(readFileSync(manifest, "utf8"));
|
|
228
|
+
if (Array.isArray(listed)) paths.push(...listed.filter(Boolean));
|
|
229
|
+
} catch {
|
|
230
|
+
return false;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
const status = git(["status", "--porcelain", "--", ...paths], { cwd });
|
|
234
|
+
return status === "";
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* Decide whether a marker describes the current tree and toolchain.
|
|
239
|
+
*
|
|
240
|
+
* The marker records the tree before the build (`tree`) and after it
|
|
241
|
+
* (`builtTree`). The current tree must equal `builtTree`: the build may itself
|
|
242
|
+
* regenerate tracked artifacts, and the outputs on disk correspond to the tree
|
|
243
|
+
* it left behind.
|
|
244
|
+
* @param {object|null} marker A parsed marker.
|
|
245
|
+
* @param {BuildFingerprint} current The current fingerprint.
|
|
246
|
+
* @returns {{match: boolean, reason: string}} The decision and why.
|
|
247
|
+
*/
|
|
248
|
+
export function markerMatches(marker, current) {
|
|
249
|
+
if (!marker || marker.schema !== BUILD_MARKER_SCHEMA) {
|
|
250
|
+
return { match: false, reason: "no readable build marker" };
|
|
251
|
+
}
|
|
252
|
+
if (!current.tree || current.tree !== marker.builtTree) {
|
|
253
|
+
return {
|
|
254
|
+
match: false,
|
|
255
|
+
reason: `tree ${current.tree ?? "unknown"} differs from built tree ${marker.builtTree}`,
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
if (
|
|
259
|
+
(current.lockfile?.file ?? null) !== (marker.lockfile?.file ?? null) ||
|
|
260
|
+
(current.lockfile?.sha256 ?? null) !== (marker.lockfile?.sha256 ?? null)
|
|
261
|
+
) {
|
|
262
|
+
return { match: false, reason: "lockfile changed" };
|
|
263
|
+
}
|
|
264
|
+
if (current.node !== marker.node) {
|
|
265
|
+
return {
|
|
266
|
+
match: false,
|
|
267
|
+
reason: `node ${current.node} differs from ${marker.node}`,
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
if ((current.bun ?? null) !== (marker.bun ?? null)) {
|
|
271
|
+
return {
|
|
272
|
+
match: false,
|
|
273
|
+
reason: `bun ${current.bun} differs from ${marker.bun}`,
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
return { match: true, reason: `marker matches tree ${current.tree}` };
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* Read a marker file, or null when it is absent or unreadable.
|
|
281
|
+
* @param {string|undefined} path Marker path.
|
|
282
|
+
* @returns {object|null} The parsed marker.
|
|
283
|
+
*/
|
|
284
|
+
export function readBuildMarker(path) {
|
|
285
|
+
if (!path || !existsSync(path)) return null;
|
|
286
|
+
try {
|
|
287
|
+
return JSON.parse(readFileSync(path, "utf8"));
|
|
288
|
+
} catch {
|
|
289
|
+
return null;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* Write a marker file.
|
|
295
|
+
* @param {string} path Marker path.
|
|
296
|
+
* @param {object} marker The marker.
|
|
297
|
+
*/
|
|
298
|
+
export function writeBuildMarker(path, marker) {
|
|
299
|
+
mkdirSync(dirname(path), { recursive: true });
|
|
300
|
+
writeFileSync(path, `${JSON.stringify(marker, null, 2)}\n`);
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* Whether `LISA_BUILD_MARKER` names a marker matching the current tree.
|
|
305
|
+
* @param {object} [options] Options.
|
|
306
|
+
* @param {string} [options.cwd] Project root.
|
|
307
|
+
* @param {NodeJS.ProcessEnv} [options.env] Environment to read the path from.
|
|
308
|
+
* @param {(cwd: string) => BuildFingerprint} [options.fingerprint] Fingerprinter.
|
|
309
|
+
* @returns {{match: boolean, reason: string, marker: object|null}} Decision.
|
|
310
|
+
*/
|
|
311
|
+
export function checkBuildMarker({
|
|
312
|
+
cwd = process.cwd(),
|
|
313
|
+
env = process.env,
|
|
314
|
+
fingerprint = currentFingerprint,
|
|
315
|
+
} = {}) {
|
|
316
|
+
const path = env[BUILD_MARKER_ENV];
|
|
317
|
+
if (!path) {
|
|
318
|
+
return {
|
|
319
|
+
match: false,
|
|
320
|
+
reason: `${BUILD_MARKER_ENV} is unset`,
|
|
321
|
+
marker: null,
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
const marker = readBuildMarker(resolve(cwd, path));
|
|
325
|
+
return { ...markerMatches(marker, fingerprint(cwd)), marker };
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* The build-once step's entry in the push timing report.
|
|
330
|
+
* @typedef {object} BuildOnceEntry
|
|
331
|
+
* @property {"build-once"} id Step id.
|
|
332
|
+
* @property {string} level Always `required`: a failing build fails the push.
|
|
333
|
+
* @property {string} command The command that ran.
|
|
334
|
+
* @property {"passed"|"failed"} state Outcome, in the runner's STATE words.
|
|
335
|
+
* @property {number|null} code Exit code.
|
|
336
|
+
* @property {string} startedAt ISO start time.
|
|
337
|
+
* @property {number} durationMs Wall time of the build.
|
|
338
|
+
* @property {null} provedBy Always null; the build proves itself.
|
|
339
|
+
*
|
|
340
|
+
* Shaped like a push-timing gate entry so the runner can hand it to the
|
|
341
|
+
* timing report (CodySwannGT/lisa#4591) as a pre-gate step.
|
|
342
|
+
*/
|
|
343
|
+
|
|
344
|
+
/**
|
|
345
|
+
* Run the project's `build` script once before the push gates and record it.
|
|
346
|
+
*
|
|
347
|
+
* Returns null when build-once is off or the project has no `build` script, so
|
|
348
|
+
* the push behaves exactly as before. On success the marker is written and its
|
|
349
|
+
* path exported to `env`; on failure the marker is removed and the caller
|
|
350
|
+
* fails the push.
|
|
351
|
+
* @param {object} options Options.
|
|
352
|
+
* @param {Record<string, unknown>|null|undefined} options.config Parsed config.
|
|
353
|
+
* @param {string} options.runner Task-runner prefix, e.g. `bun run`.
|
|
354
|
+
* @param {Record<string,string>|null} options.scripts Project scripts.
|
|
355
|
+
* @param {(command: string) => {code: number|null}} options.exec Executor.
|
|
356
|
+
* @param {string} [options.cwd] Project root.
|
|
357
|
+
* @param {NodeJS.ProcessEnv} [options.env] Environment to export into.
|
|
358
|
+
* @param {(cwd: string) => BuildFingerprint} [options.fingerprint] Fingerprinter.
|
|
359
|
+
* @param {(cwd: string) => boolean} [options.isPluginsClean] Plugin cleanliness probe.
|
|
360
|
+
* @param {() => number} [options.now] Clock in milliseconds.
|
|
361
|
+
* @returns {BuildOnceEntry|null} The step entry, or null when it did not run.
|
|
362
|
+
*/
|
|
363
|
+
export function runBuildOnce({
|
|
364
|
+
config,
|
|
365
|
+
runner,
|
|
366
|
+
scripts,
|
|
367
|
+
exec,
|
|
368
|
+
cwd = process.cwd(),
|
|
369
|
+
env = process.env,
|
|
370
|
+
fingerprint = currentFingerprint,
|
|
371
|
+
isPluginsClean = pluginsClean,
|
|
372
|
+
now = Date.now,
|
|
373
|
+
}) {
|
|
374
|
+
if (!buildOnceEnabled(config)) return null;
|
|
375
|
+
if (!scripts || typeof scripts.build !== "string") return null;
|
|
376
|
+
const markerPath = join(cwd, BUILD_MARKER_PATH);
|
|
377
|
+
rmSync(markerPath, { force: true });
|
|
378
|
+
delete env[BUILD_MARKER_ENV];
|
|
379
|
+
|
|
380
|
+
const before = fingerprint(cwd);
|
|
381
|
+
const cleanBefore = isPluginsClean(cwd);
|
|
382
|
+
const command = `${runner} build`;
|
|
383
|
+
const started = now();
|
|
384
|
+
const { code } = exec(command);
|
|
385
|
+
const durationMs = now() - started;
|
|
386
|
+
const entry = state => ({
|
|
387
|
+
id: BUILD_ONCE_ID,
|
|
388
|
+
level: "required",
|
|
389
|
+
command,
|
|
390
|
+
state,
|
|
391
|
+
code,
|
|
392
|
+
startedAt: new Date(started).toISOString(),
|
|
393
|
+
durationMs,
|
|
394
|
+
provedBy: null,
|
|
395
|
+
});
|
|
396
|
+
if (code !== 0) return entry("failed");
|
|
397
|
+
const after = fingerprint(cwd);
|
|
398
|
+
writeBuildMarker(markerPath, {
|
|
399
|
+
schema: BUILD_MARKER_SCHEMA,
|
|
400
|
+
tree: before.tree,
|
|
401
|
+
builtTree: after.tree,
|
|
402
|
+
lockfile: after.lockfile,
|
|
403
|
+
node: after.node,
|
|
404
|
+
bun: after.bun,
|
|
405
|
+
pluginsCleanBeforeBuild: cleanBefore,
|
|
406
|
+
builtAt: new Date().toISOString(),
|
|
407
|
+
});
|
|
408
|
+
env[BUILD_MARKER_ENV] = markerPath;
|
|
409
|
+
return entry("passed");
|
|
410
|
+
}
|