@codyswann/lisa 7.1.5 → 8.0.1
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/all/copy-overwrite/scripts/check-npm-publish-landed.mjs +0 -2
- package/all/copy-overwrite/scripts/lib/push-timing.mjs +3 -6
- package/all/copy-overwrite/scripts/lisa-enforcement-fallback.sh +31 -32
- package/all/copy-overwrite/scripts/lisa-hooks/block-managed-file-edits.sh +201 -20
- package/all/copy-overwrite/scripts/npm-updater-helper-graph.json +3 -2
- package/dist/cli/admit-cmd.d.ts.map +1 -1
- package/dist/cli/admit-cmd.js +16 -10
- package/dist/cli/admit-cmd.js.map +1 -1
- package/dist/cli/apply.d.ts.map +1 -1
- package/dist/cli/apply.js +2 -2
- package/dist/cli/apply.js.map +1 -1
- package/dist/cli/check-cmd.d.ts.map +1 -1
- package/dist/cli/check-cmd.js +8 -4
- package/dist/cli/check-cmd.js.map +1 -1
- package/dist/cli/doctor-coderabbit.js +2 -2
- package/dist/cli/doctor-coderabbit.js.map +1 -1
- package/dist/cli/doctor-readiness-supply-chain-python.d.ts +5 -1
- package/dist/cli/doctor-readiness-supply-chain-python.d.ts.map +1 -1
- package/dist/cli/doctor-readiness-supply-chain-python.js +44 -10
- package/dist/cli/doctor-readiness-supply-chain-python.js.map +1 -1
- package/dist/cli/doctor-readiness.js +2 -2
- package/dist/cli/doctor-readiness.js.map +1 -1
- package/dist/cli/doctor-worker-journey.js +2 -2
- package/dist/cli/doctor-worker-journey.js.map +1 -1
- package/dist/cli/doctor.d.ts.map +1 -1
- package/dist/cli/doctor.js +7 -4
- package/dist/cli/doctor.js.map +1 -1
- package/dist/cli/file-upstream-cmd.d.ts.map +1 -1
- package/dist/cli/file-upstream-cmd.js +20 -25
- package/dist/cli/file-upstream-cmd.js.map +1 -1
- package/dist/cli/gh-cli.d.ts +2 -2
- package/dist/cli/gh-cli.d.ts.map +1 -1
- package/dist/cli/gh-cli.js +13 -6
- package/dist/cli/gh-cli.js.map +1 -1
- package/dist/cli/health-cmd.d.ts.map +1 -1
- package/dist/cli/health-cmd.js +7 -19
- package/dist/cli/health-cmd.js.map +1 -1
- package/dist/cli/lisa-test-run-jest-merge.js +5 -5
- package/dist/cli/lisa-test-run-jest-merge.js.map +1 -1
- package/dist/cli/lisa-test-run.js +8 -4
- package/dist/cli/lisa-test-run.js.map +1 -1
- package/dist/cli/pr-landing.js +2 -2
- package/dist/cli/pr-landing.js.map +1 -1
- package/dist/cli/update-check.d.ts.map +1 -1
- package/dist/cli/update-check.js +7 -4
- package/dist/cli/update-check.js.map +1 -1
- package/dist/cli/update-cmd.d.ts.map +1 -1
- package/dist/cli/update-cmd.js +7 -4
- package/dist/cli/update-cmd.js.map +1 -1
- package/dist/cli/worktree-ownership.d.ts.map +1 -1
- package/dist/cli/worktree-ownership.js +3 -3
- package/dist/cli/worktree-ownership.js.map +1 -1
- package/dist/codex/hooks-catalog.d.ts +151 -0
- package/dist/codex/hooks-catalog.d.ts.map +1 -0
- package/dist/codex/hooks-catalog.js +315 -0
- package/dist/codex/hooks-catalog.js.map +1 -0
- package/dist/codex/hooks-compatibility.d.ts +14 -0
- package/dist/codex/hooks-compatibility.d.ts.map +1 -0
- package/dist/codex/hooks-compatibility.js +196 -0
- package/dist/codex/hooks-compatibility.js.map +1 -0
- package/dist/codex/hooks-installer.d.ts +2 -49
- package/dist/codex/hooks-installer.d.ts.map +1 -1
- package/dist/codex/hooks-installer.js +5 -546
- package/dist/codex/hooks-installer.js.map +1 -1
- package/dist/codex/hooks-source-links.d.ts +11 -0
- package/dist/codex/hooks-source-links.d.ts.map +1 -0
- package/dist/codex/hooks-source-links.js +74 -0
- package/dist/codex/hooks-source-links.js.map +1 -0
- package/dist/codex/scripts/block-migration-edits.sh +2 -2
- package/dist/codex/scripts/block-suppress-directives.sh +3 -3
- package/dist/codex/scripts/format-on-edit.sh +2 -2
- package/dist/codex/scripts/lint-on-edit.sh +2 -2
- package/dist/codex/scripts/lisa-edit-gate.sh +19 -15
- package/dist/codex/scripts/rubocop-on-edit.sh +2 -2
- package/dist/codex/scripts/sg-scan-on-edit.sh +2 -2
- package/dist/configs/coverage-scope.d.ts +0 -23
- package/dist/configs/coverage-scope.d.ts.map +1 -1
- package/dist/configs/coverage-scope.js +2 -3
- package/dist/configs/coverage-scope.js.map +1 -1
- package/dist/configs/eslint/base.d.ts +2 -113
- package/dist/configs/eslint/base.d.ts.map +1 -1
- package/dist/configs/eslint/base.js +2 -165
- package/dist/configs/eslint/base.js.map +1 -1
- package/dist/configs/eslint/cdk.d.ts.map +1 -1
- package/dist/configs/eslint/cdk.js +82 -66
- package/dist/configs/eslint/cdk.js.map +1 -1
- package/dist/configs/eslint/expo-overrides.d.ts +103 -0
- package/dist/configs/eslint/expo-overrides.d.ts.map +1 -0
- package/dist/configs/eslint/expo-overrides.js +187 -0
- package/dist/configs/eslint/expo-overrides.js.map +1 -0
- package/dist/configs/eslint/expo.d.ts +2 -7
- package/dist/configs/eslint/expo.d.ts.map +1 -1
- package/dist/configs/eslint/expo.js +186 -258
- package/dist/configs/eslint/expo.js.map +1 -1
- package/dist/configs/eslint/nestjs.d.ts.map +1 -1
- package/dist/configs/eslint/nestjs.js +86 -70
- package/dist/configs/eslint/nestjs.js.map +1 -1
- package/dist/configs/eslint/process-environment-bans.d.ts +41 -0
- package/dist/configs/eslint/process-environment-bans.d.ts.map +1 -0
- package/dist/configs/eslint/process-environment-bans.js +50 -0
- package/dist/configs/eslint/process-environment-bans.js.map +1 -0
- package/dist/configs/eslint/shared-rules.d.ts +130 -0
- package/dist/configs/eslint/shared-rules.d.ts.map +1 -0
- package/dist/configs/eslint/shared-rules.js +233 -0
- package/dist/configs/eslint/shared-rules.js.map +1 -0
- package/dist/configs/eslint/typescript.d.ts.map +1 -1
- package/dist/configs/eslint/typescript.js +2 -4
- package/dist/configs/eslint/typescript.js.map +1 -1
- package/dist/configs/vitest/base.d.ts +2 -2
- package/dist/configs/vitest/base.d.ts.map +1 -1
- package/dist/configs/vitest/base.js +5 -5
- package/dist/configs/vitest/base.js.map +1 -1
- package/dist/configs/vitest/coverage-reports-directory.d.ts.map +1 -1
- package/dist/configs/vitest/coverage-reports-directory.js +3 -2
- package/dist/configs/vitest/coverage-reports-directory.js.map +1 -1
- package/dist/configs/vitest/refusal-announcement.js +2 -2
- package/dist/configs/vitest/refusal-announcement.js.map +1 -1
- package/dist/core/admission-lock.js +2 -3
- package/dist/core/admission-lock.js.map +1 -1
- package/dist/core/admission-state.d.ts.map +1 -1
- package/dist/core/admission-state.js +11 -5
- package/dist/core/admission-state.js.map +1 -1
- package/dist/core/admission.d.ts.map +1 -1
- package/dist/core/admission.js +2 -2
- package/dist/core/admission.js.map +1 -1
- package/dist/core/bootstrap-environment.d.ts.map +1 -1
- package/dist/core/bootstrap-environment.js +8 -5
- package/dist/core/bootstrap-environment.js.map +1 -1
- package/dist/core/downstream-names.d.ts.map +1 -1
- package/dist/core/downstream-names.js +48 -47
- package/dist/core/downstream-names.js.map +1 -1
- package/dist/core/effectiveness-store.d.ts.map +1 -1
- package/dist/core/effectiveness-store.js +3 -5
- package/dist/core/effectiveness-store.js.map +1 -1
- package/dist/core/gate-declaration-drift.d.ts.map +1 -1
- package/dist/core/gate-declaration-drift.js +46 -27
- package/dist/core/gate-declaration-drift.js.map +1 -1
- package/dist/core/kane-cli-process.d.ts.map +1 -1
- package/dist/core/kane-cli-process.js +46 -33
- package/dist/core/kane-cli-process.js.map +1 -1
- package/dist/core/kane-cli.d.ts.map +1 -1
- package/dist/core/kane-cli.js +3 -4
- package/dist/core/kane-cli.js.map +1 -1
- package/dist/core/lisa-agent-emit-extra.d.ts +75 -0
- package/dist/core/lisa-agent-emit-extra.d.ts.map +1 -0
- package/dist/core/lisa-agent-emit-extra.js +231 -0
- package/dist/core/lisa-agent-emit-extra.js.map +1 -0
- package/dist/core/lisa-agent-emit.d.ts +79 -0
- package/dist/core/lisa-agent-emit.d.ts.map +1 -0
- package/dist/core/lisa-agent-emit.js +224 -0
- package/dist/core/lisa-agent-emit.js.map +1 -0
- package/dist/core/lisa-deletions.d.ts +116 -0
- package/dist/core/lisa-deletions.d.ts.map +1 -0
- package/dist/core/lisa-deletions.js +316 -0
- package/dist/core/lisa-deletions.js.map +1 -0
- package/dist/core/lisa-file-results.d.ts +58 -0
- package/dist/core/lisa-file-results.d.ts.map +1 -0
- package/dist/core/lisa-file-results.js +173 -0
- package/dist/core/lisa-file-results.js.map +1 -0
- package/dist/core/lisa-maintenance.d.ts +139 -0
- package/dist/core/lisa-maintenance.d.ts.map +1 -0
- package/dist/core/lisa-maintenance.js +324 -0
- package/dist/core/lisa-maintenance.js.map +1 -0
- package/dist/core/lisa-owned-hash-ledger.d.ts +7 -5
- package/dist/core/lisa-owned-hash-ledger.d.ts.map +1 -1
- package/dist/core/lisa-owned-hash-ledger.js +44 -6036
- package/dist/core/lisa-owned-hash-ledger.js.map +1 -1
- package/dist/core/lisa-owned-hash-ledger.json +6021 -0
- package/dist/core/lisa-plugin-sync.d.ts +96 -0
- package/dist/core/lisa-plugin-sync.d.ts.map +1 -0
- package/dist/core/lisa-plugin-sync.js +216 -0
- package/dist/core/lisa-plugin-sync.js.map +1 -0
- package/dist/core/lisa-plugins.d.ts +42 -0
- package/dist/core/lisa-plugins.d.ts.map +1 -0
- package/dist/core/lisa-plugins.js +155 -0
- package/dist/core/lisa-plugins.js.map +1 -0
- package/dist/core/lisa-state.d.ts +202 -0
- package/dist/core/lisa-state.d.ts.map +1 -0
- package/dist/core/lisa-state.js +205 -0
- package/dist/core/lisa-state.js.map +1 -0
- package/dist/core/lisa-summary-stats.d.ts +74 -0
- package/dist/core/lisa-summary-stats.d.ts.map +1 -0
- package/dist/core/lisa-summary-stats.js +189 -0
- package/dist/core/lisa-summary-stats.js.map +1 -0
- package/dist/core/lisa-summary.d.ts +34 -0
- package/dist/core/lisa-summary.d.ts.map +1 -0
- package/dist/core/lisa-summary.js +144 -0
- package/dist/core/lisa-summary.js.map +1 -0
- package/dist/core/lisa-templates.d.ts +98 -0
- package/dist/core/lisa-templates.d.ts.map +1 -0
- package/dist/core/lisa-templates.js +251 -0
- package/dist/core/lisa-templates.js.map +1 -0
- package/dist/core/lisa.d.ts +14 -903
- package/dist/core/lisa.d.ts.map +1 -1
- package/dist/core/lisa.js +30 -2275
- package/dist/core/lisa.js.map +1 -1
- package/dist/core/nightly-e2e-guard-behavior-certificate.js +2 -2
- package/dist/core/plugin-command.d.ts.map +1 -1
- package/dist/core/plugin-command.js +117 -61
- package/dist/core/plugin-command.js.map +1 -1
- package/dist/core/template-ownership.d.ts.map +1 -1
- package/dist/core/template-ownership.js +0 -1
- package/dist/core/template-ownership.js.map +1 -1
- package/dist/core/upstream-attribution-body.d.ts +4 -11
- package/dist/core/upstream-attribution-body.d.ts.map +1 -1
- package/dist/core/upstream-attribution-body.js +61 -373
- package/dist/core/upstream-attribution-body.js.map +1 -1
- package/dist/core/upstream-attribution-fields.d.ts +40 -0
- package/dist/core/upstream-attribution-fields.d.ts.map +1 -0
- package/dist/core/upstream-attribution-fields.js +167 -0
- package/dist/core/upstream-attribution-fields.js.map +1 -0
- package/dist/core/upstream-attribution-files.d.ts +15 -0
- package/dist/core/upstream-attribution-files.d.ts.map +1 -0
- package/dist/core/upstream-attribution-files.js +156 -0
- package/dist/core/upstream-attribution-files.js.map +1 -0
- package/dist/core/upstream-attribution-guards.d.ts +80 -0
- package/dist/core/upstream-attribution-guards.d.ts.map +1 -0
- package/dist/core/upstream-attribution-guards.js +284 -0
- package/dist/core/upstream-attribution-guards.js.map +1 -0
- package/dist/core/upstream-evidence-manifest.d.ts +1 -1
- package/dist/core/upstream-evidence-manifest.d.ts.map +1 -1
- package/dist/core/upstream-evidence-manifest.js +67 -30435
- package/dist/core/upstream-evidence-manifest.js.map +1 -1
- package/dist/core/upstream-evidence-manifest.json +30520 -0
- package/dist/health/agentic-contract.d.ts +94 -0
- package/dist/health/agentic-contract.d.ts.map +1 -0
- package/dist/health/agentic-contract.js +2 -0
- package/dist/health/agentic-contract.js.map +1 -0
- package/dist/health/agentic-evidence.d.ts +16 -0
- package/dist/health/agentic-evidence.d.ts.map +1 -0
- package/dist/health/agentic-evidence.js +213 -0
- package/dist/health/agentic-evidence.js.map +1 -0
- package/dist/health/agentic.d.ts +11 -74
- package/dist/health/agentic.d.ts.map +1 -1
- package/dist/health/agentic.js +42 -216
- package/dist/health/agentic.js.map +1 -1
- package/dist/health/deadline.d.ts +4 -1
- package/dist/health/deadline.d.ts.map +1 -1
- package/dist/health/deadline.js +4 -3
- package/dist/health/deadline.js.map +1 -1
- package/dist/health/deterministic-inputs.d.ts.map +1 -1
- package/dist/health/deterministic-inputs.js +3 -11
- package/dist/health/deterministic-inputs.js.map +1 -1
- package/dist/health/deterministic-probes.d.ts +52 -0
- package/dist/health/deterministic-probes.d.ts.map +1 -0
- package/dist/health/deterministic-probes.js +142 -0
- package/dist/health/deterministic-probes.js.map +1 -0
- package/dist/health/deterministic.d.ts +2 -25
- package/dist/health/deterministic.d.ts.map +1 -1
- package/dist/health/deterministic.js +14 -106
- package/dist/health/deterministic.js.map +1 -1
- package/dist/health/finding-utils.d.ts +4 -3
- package/dist/health/finding-utils.d.ts.map +1 -1
- package/dist/health/finding-utils.js +4 -4
- package/dist/health/finding-utils.js.map +1 -1
- package/dist/health/governance-probes.d.ts +29 -24
- package/dist/health/governance-probes.d.ts.map +1 -1
- package/dist/health/governance-probes.js +29 -25
- package/dist/health/governance-probes.js.map +1 -1
- package/dist/health/hook-inspection.d.ts +4 -3
- package/dist/health/hook-inspection.d.ts.map +1 -1
- package/dist/health/hook-inspection.js +17 -11
- package/dist/health/hook-inspection.js.map +1 -1
- package/dist/health/plugin-inspection.d.ts +6 -4
- package/dist/health/plugin-inspection.d.ts.map +1 -1
- package/dist/health/plugin-inspection.js +10 -9
- package/dist/health/plugin-inspection.js.map +1 -1
- package/dist/health/prepare.js +24 -8
- package/dist/health/prepare.js.map +1 -1
- package/dist/health/project-probes.d.ts +14 -7
- package/dist/health/project-probes.d.ts.map +1 -1
- package/dist/health/project-probes.js +14 -9
- package/dist/health/project-probes.js.map +1 -1
- package/dist/health/ruleset-compare.d.ts +30 -0
- package/dist/health/ruleset-compare.d.ts.map +1 -0
- package/dist/health/ruleset-compare.js +143 -0
- package/dist/health/ruleset-compare.js.map +1 -0
- package/dist/health/ruleset-config-checks.d.ts +66 -0
- package/dist/health/ruleset-config-checks.d.ts.map +1 -0
- package/dist/health/ruleset-config-checks.js +190 -0
- package/dist/health/ruleset-config-checks.js.map +1 -0
- package/dist/health/ruleset-expected.d.ts +39 -0
- package/dist/health/ruleset-expected.d.ts.map +1 -0
- package/dist/health/ruleset-expected.js +181 -0
- package/dist/health/ruleset-expected.js.map +1 -0
- package/dist/health/ruleset-gh.d.ts +85 -0
- package/dist/health/ruleset-gh.d.ts.map +1 -0
- package/dist/health/ruleset-gh.js +177 -0
- package/dist/health/ruleset-gh.js.map +1 -0
- package/dist/health/ruleset-inspection.d.ts +13 -117
- package/dist/health/ruleset-inspection.d.ts.map +1 -1
- package/dist/health/ruleset-inspection.js +8 -738
- package/dist/health/ruleset-inspection.js.map +1 -1
- package/dist/health/ruleset-normalize.d.ts +32 -0
- package/dist/health/ruleset-normalize.d.ts.map +1 -0
- package/dist/health/ruleset-normalize.js +160 -0
- package/dist/health/ruleset-normalize.js.map +1 -0
- package/dist/health/template-compose.d.ts +9 -0
- package/dist/health/template-compose.d.ts.map +1 -0
- package/dist/health/template-compose.js +105 -0
- package/dist/health/template-compose.js.map +1 -0
- package/dist/health/template-inspection.d.ts +5 -52
- package/dist/health/template-inspection.d.ts.map +1 -1
- package/dist/health/template-inspection.js +13 -435
- package/dist/health/template-inspection.js.map +1 -1
- package/dist/health/template-plan.d.ts +33 -0
- package/dist/health/template-plan.d.ts.map +1 -0
- package/dist/health/template-plan.js +154 -0
- package/dist/health/template-plan.js.map +1 -0
- package/dist/health/template-shape.d.ts +19 -0
- package/dist/health/template-shape.d.ts.map +1 -0
- package/dist/health/template-shape.js +122 -0
- package/dist/health/template-shape.js.map +1 -0
- package/dist/health/workflow-excerpt.d.ts +15 -0
- package/dist/health/workflow-excerpt.d.ts.map +1 -0
- package/dist/health/workflow-excerpt.js +88 -0
- package/dist/health/workflow-excerpt.js.map +1 -0
- package/dist/health/workflow-inputs-inspection.d.ts +16 -0
- package/dist/health/workflow-inputs-inspection.d.ts.map +1 -0
- package/dist/health/workflow-inputs-inspection.js +116 -0
- package/dist/health/workflow-inputs-inspection.js.map +1 -0
- package/dist/opencode/plugin-templates/block-managed-file-edits.sh +201 -20
- package/dist/standards/capture.d.ts.map +1 -1
- package/dist/standards/capture.js +73 -25
- package/dist/standards/capture.js.map +1 -1
- package/dist/standards/contract.d.ts.map +1 -1
- package/dist/standards/contract.js +26 -9
- package/dist/standards/contract.js.map +1 -1
- package/dist/standards/git-state.d.ts.map +1 -1
- package/dist/standards/git-state.js +2 -2
- package/dist/standards/git-state.js.map +1 -1
- package/dist/standards/registry-checks.d.ts +34 -0
- package/dist/standards/registry-checks.d.ts.map +1 -0
- package/dist/standards/registry-checks.js +137 -0
- package/dist/standards/registry-checks.js.map +1 -0
- package/dist/standards/registry.d.ts +3 -13
- package/dist/standards/registry.d.ts.map +1 -1
- package/dist/standards/registry.js +105 -194
- package/dist/standards/registry.js.map +1 -1
- package/dist/standards/storage.js +8 -10
- package/dist/standards/storage.js.map +1 -1
- package/dist/strategies/deduplicate-arrays.d.ts +18 -0
- package/dist/strategies/deduplicate-arrays.d.ts.map +1 -0
- package/dist/strategies/deduplicate-arrays.js +25 -0
- package/dist/strategies/deduplicate-arrays.js.map +1 -0
- package/dist/strategies/package-lisa-detect.d.ts +10 -0
- package/dist/strategies/package-lisa-detect.d.ts.map +1 -0
- package/dist/strategies/package-lisa-detect.js +178 -0
- package/dist/strategies/package-lisa-detect.js.map +1 -0
- package/dist/strategies/package-lisa-direct-floors.d.ts +16 -0
- package/dist/strategies/package-lisa-direct-floors.d.ts.map +1 -0
- package/dist/strategies/package-lisa-direct-floors.js +37 -0
- package/dist/strategies/package-lisa-direct-floors.js.map +1 -0
- package/dist/strategies/package-lisa-host-pins.d.ts +43 -0
- package/dist/strategies/package-lisa-host-pins.d.ts.map +1 -0
- package/dist/strategies/package-lisa-host-pins.js +254 -0
- package/dist/strategies/package-lisa-host-pins.js.map +1 -0
- package/dist/strategies/package-lisa-manifest-guards.d.ts +59 -0
- package/dist/strategies/package-lisa-manifest-guards.d.ts.map +1 -0
- package/dist/strategies/package-lisa-manifest-guards.js +234 -0
- package/dist/strategies/package-lisa-manifest-guards.js.map +1 -0
- package/dist/strategies/package-lisa-pin-alignment.d.ts +34 -0
- package/dist/strategies/package-lisa-pin-alignment.d.ts.map +1 -0
- package/dist/strategies/package-lisa-pin-alignment.js +106 -0
- package/dist/strategies/package-lisa-pin-alignment.js.map +1 -0
- package/dist/strategies/package-lisa-script-notes.d.ts +19 -0
- package/dist/strategies/package-lisa-script-notes.d.ts.map +1 -0
- package/dist/strategies/package-lisa-script-notes.js +145 -0
- package/dist/strategies/package-lisa-script-notes.js.map +1 -0
- package/dist/strategies/package-lisa-template-apply.d.ts +53 -0
- package/dist/strategies/package-lisa-template-apply.d.ts.map +1 -0
- package/dist/strategies/package-lisa-template-apply.js +216 -0
- package/dist/strategies/package-lisa-template-apply.js.map +1 -0
- package/dist/strategies/package-lisa-template-merge.d.ts +42 -0
- package/dist/strategies/package-lisa-template-merge.d.ts.map +1 -0
- package/dist/strategies/package-lisa-template-merge.js +202 -0
- package/dist/strategies/package-lisa-template-merge.js.map +1 -0
- package/dist/strategies/package-lisa-types.d.ts +5 -0
- package/dist/strategies/package-lisa-types.d.ts.map +1 -1
- package/dist/strategies/package-lisa.d.ts +1 -195
- package/dist/strategies/package-lisa.d.ts.map +1 -1
- package/dist/strategies/package-lisa.js +27 -1333
- package/dist/strategies/package-lisa.js.map +1 -1
- package/dist/strategies/tagged-merge-sections.d.ts +68 -0
- package/dist/strategies/tagged-merge-sections.d.ts.map +1 -0
- package/dist/strategies/tagged-merge-sections.js +113 -0
- package/dist/strategies/tagged-merge-sections.js.map +1 -0
- package/dist/strategies/tagged-merge.d.ts +1 -90
- package/dist/strategies/tagged-merge.d.ts.map +1 -1
- package/dist/strategies/tagged-merge.js +19 -190
- package/dist/strategies/tagged-merge.js.map +1 -1
- package/dist/utils/bounded-stream.d.ts +30 -0
- package/dist/utils/bounded-stream.d.ts.map +1 -0
- package/dist/utils/bounded-stream.js +63 -0
- package/dist/utils/bounded-stream.js.map +1 -0
- package/dist/utils/fibonacci.d.ts +3 -3
- package/dist/utils/fibonacci.d.ts.map +1 -1
- package/dist/utils/fibonacci.js +48 -10
- package/dist/utils/fibonacci.js.map +1 -1
- package/dist/utils/memo.d.ts +25 -0
- package/dist/utils/memo.d.ts.map +1 -0
- package/dist/utils/memo.js +32 -0
- package/dist/utils/memo.js.map +1 -0
- package/dist/utils/postinstall-trampoline.d.ts.map +1 -1
- package/dist/utils/postinstall-trampoline.js +3 -20
- package/dist/utils/postinstall-trampoline.js.map +1 -1
- package/dist/utils/process-environment.d.ts +42 -0
- package/dist/utils/process-environment.d.ts.map +1 -0
- package/dist/utils/process-environment.js +52 -0
- package/dist/utils/process-environment.js.map +1 -0
- package/dist/utils/resolve-executable.d.ts +89 -0
- package/dist/utils/resolve-executable.d.ts.map +1 -0
- package/dist/utils/resolve-executable.js +224 -0
- package/dist/utils/resolve-executable.js.map +1 -0
- package/dist/utils/shell-command-line.d.ts +9 -0
- package/dist/utils/shell-command-line.d.ts.map +1 -0
- package/dist/utils/shell-command-line.js +43 -0
- package/dist/utils/shell-command-line.js.map +1 -0
- package/dist/utils/usage-accounting-totals.d.ts +19 -0
- package/dist/utils/usage-accounting-totals.d.ts.map +1 -0
- package/dist/utils/usage-accounting-totals.js +145 -0
- package/dist/utils/usage-accounting-totals.js.map +1 -0
- package/dist/utils/usage-accounting.d.ts +2 -14
- package/dist/utils/usage-accounting.d.ts.map +1 -1
- package/dist/utils/usage-accounting.js +2 -169
- package/dist/utils/usage-accounting.js.map +1 -1
- package/eslint-plugin-code-organization/__tests__/enforce-statement-order-react-violations.test.js +213 -0
- package/eslint-plugin-code-organization/__tests__/enforce-statement-order-valid.test.js +251 -0
- package/eslint-plugin-code-organization/__tests__/enforce-statement-order-violations.test.js +222 -0
- package/eslint-plugin-code-organization/__tests__/statement-order-tester.js +42 -0
- package/eslint-plugin-code-organization/rules/enforce-statement-order.js +6 -8
- package/expo/copy-overwrite/jest.setup.ts +11 -10
- package/expo/create-only/scripts/zap-baseline.sh +6 -18
- package/harper-fabric/create-only/scripts/zap-baseline.sh +7 -9
- package/nestjs/create-only/scripts/zap-baseline.sh +6 -7
- package/package.json +5 -5
- package/phaser/copy-overwrite/.husky/pre-push.verify +2 -0
- 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-setup-remote-env/assets/session-start.sh +18 -5
- package/plugins/lisa/hooks/block-managed-file-edits.sh +201 -20
- package/plugins/lisa/hooks/block-masked-exit-status.sh +1 -1
- package/plugins/lisa/hooks/block-no-verify.agy.sh +1 -1
- package/plugins/lisa/hooks/enforce-verification-gate.sh +1 -2
- package/plugins/lisa/hooks/ticket-sync-reminder.sh +2 -17
- package/plugins/lisa/hooks/track-plan-sessions.sh +7 -131
- package/plugins/lisa/scripts/remote-agent-aws-setup.sh +3 -1
- package/plugins/lisa/skills/lisa-setup-remote-env/assets/session-start.sh +18 -5
- package/plugins/lisa-agy/hooks/block-managed-file-edits.sh +201 -20
- package/plugins/lisa-agy/hooks/block-no-verify.agy.sh +1 -1
- package/plugins/lisa-agy/plugin.json +1 -1
- package/plugins/lisa-agy/scripts/remote-agent-aws-setup.sh +3 -1
- package/plugins/lisa-agy/skills/lisa-setup-remote-env/assets/session-start.sh +18 -5
- 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/hooks/block-managed-file-edits.sh +201 -20
- package/plugins/lisa-copilot/hooks/block-masked-exit-status.sh +1 -1
- package/plugins/lisa-copilot/hooks/enforce-verification-gate.sh +1 -2
- package/plugins/lisa-copilot/scripts/remote-agent-aws-setup.sh +3 -1
- package/plugins/lisa-copilot/skills/lisa-setup-remote-env/assets/session-start.sh +18 -5
- package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cursor/hooks/block-managed-file-edits.sh +201 -20
- package/plugins/lisa-cursor/hooks/block-masked-exit-status.sh +1 -1
- package/plugins/lisa-cursor/hooks/enforce-verification-gate.sh +1 -2
- package/plugins/lisa-cursor/scripts/remote-agent-aws-setup.sh +3 -1
- package/plugins/lisa-cursor/skills/lisa-setup-remote-env/assets/session-start.sh +18 -5
- package/plugins/lisa-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-devin/hooks/block-managed-file-edits.sh +201 -20
- package/plugins/lisa-devin/hooks/block-masked-exit-status.sh +1 -1
- package/plugins/lisa-devin/hooks/enforce-verification-gate.sh +1 -2
- package/plugins/lisa-devin/scripts/remote-agent-aws-setup.sh +3 -1
- package/plugins/lisa-devin/skills/lisa-setup-remote-env/assets/session-start.sh +18 -5
- package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-expo/.codex-plugin/skills/building-native-ui/references/webgpu-three.md +19 -9
- package/plugins/lisa-expo/.codex-plugin/skills/expo-tailwind-setup/SKILL.md +15 -4
- package/plugins/lisa-expo/skills/building-native-ui/references/webgpu-three.md +19 -9
- package/plugins/lisa-expo/skills/expo-tailwind-setup/SKILL.md +15 -4
- package/plugins/lisa-expo-agy/plugin.json +1 -1
- package/plugins/lisa-expo-agy/skills/building-native-ui/references/webgpu-three.md +19 -9
- package/plugins/lisa-expo-agy/skills/expo-tailwind-setup/SKILL.md +15 -4
- package/plugins/lisa-expo-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-copilot/skills/building-native-ui/references/webgpu-three.md +19 -9
- package/plugins/lisa-expo-copilot/skills/expo-tailwind-setup/SKILL.md +15 -4
- package/plugins/lisa-expo-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-cursor/skills/building-native-ui/references/webgpu-three.md +19 -9
- package/plugins/lisa-expo-cursor/skills/expo-tailwind-setup/SKILL.md +15 -4
- 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-expo-devin/skills/building-native-ui/references/webgpu-three.md +19 -9
- package/plugins/lisa-expo-devin/skills/expo-tailwind-setup/SKILL.md +15 -4
- 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/hooks/block-generated-artifact-edits.sh +196 -11
- package/plugins/lisa-harper-fabric/hooks/enforce-config-extensions.sh +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-copilot/hooks/block-generated-artifact-edits.sh +196 -11
- package/plugins/lisa-harper-fabric-copilot/hooks/enforce-config-extensions.sh +1 -1
- package/plugins/lisa-harper-fabric-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-cursor/hooks/block-generated-artifact-edits.sh +196 -11
- package/plugins/lisa-harper-fabric-cursor/hooks/enforce-config-extensions.sh +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-harper-fabric-devin/hooks/block-generated-artifact-edits.sh +196 -11
- package/plugins/lisa-harper-fabric-devin/hooks/enforce-config-extensions.sh +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/.codex-plugin/skills/nestjs-rules/SKILL.md +39 -26
- package/plugins/lisa-nestjs/.codex-plugin/skills/typeorm-patterns/references/observability-patterns.md +18 -58
- package/plugins/lisa-nestjs/hooks/block-migration-edits.sh +1 -1
- package/plugins/lisa-nestjs/hooks/lisa-edit-gate.sh +19 -15
- package/plugins/lisa-nestjs/skills/nestjs-rules/SKILL.md +39 -26
- package/plugins/lisa-nestjs/skills/typeorm-patterns/references/observability-patterns.md +18 -58
- package/plugins/lisa-nestjs-agy/plugin.json +1 -1
- package/plugins/lisa-nestjs-agy/skills/nestjs-rules/SKILL.md +39 -26
- package/plugins/lisa-nestjs-agy/skills/typeorm-patterns/references/observability-patterns.md +18 -58
- package/plugins/lisa-nestjs-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-copilot/hooks/block-migration-edits.sh +1 -1
- package/plugins/lisa-nestjs-copilot/hooks/lisa-edit-gate.sh +19 -15
- package/plugins/lisa-nestjs-copilot/skills/nestjs-rules/SKILL.md +39 -26
- package/plugins/lisa-nestjs-copilot/skills/typeorm-patterns/references/observability-patterns.md +18 -58
- package/plugins/lisa-nestjs-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-cursor/hooks/block-migration-edits.sh +1 -1
- package/plugins/lisa-nestjs-cursor/hooks/lisa-edit-gate.sh +19 -15
- package/plugins/lisa-nestjs-cursor/skills/nestjs-rules/SKILL.md +39 -26
- package/plugins/lisa-nestjs-cursor/skills/typeorm-patterns/references/observability-patterns.md +18 -58
- 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-nestjs-devin/hooks/block-migration-edits.sh +1 -1
- package/plugins/lisa-nestjs-devin/hooks/lisa-edit-gate.sh +19 -15
- package/plugins/lisa-nestjs-devin/skills/nestjs-rules/SKILL.md +39 -26
- package/plugins/lisa-nestjs-devin/skills/typeorm-patterns/references/observability-patterns.md +18 -58
- 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/hooks/lisa-edit-gate.sh +19 -15
- package/plugins/lisa-rails/hooks/rubocop-on-edit.sh +2 -2
- package/plugins/lisa-rails/hooks/sg-scan-on-edit.sh +3 -3
- package/plugins/lisa-rails-agy/plugin.json +1 -1
- package/plugins/lisa-rails-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-copilot/hooks/lisa-edit-gate.sh +19 -15
- package/plugins/lisa-rails-copilot/hooks/rubocop-on-edit.sh +2 -2
- package/plugins/lisa-rails-copilot/hooks/sg-scan-on-edit.sh +3 -3
- package/plugins/lisa-rails-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-cursor/hooks/lisa-edit-gate.sh +19 -15
- package/plugins/lisa-rails-cursor/hooks/rubocop-on-edit.sh +2 -2
- package/plugins/lisa-rails-cursor/hooks/sg-scan-on-edit.sh +3 -3
- 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-rails-devin/hooks/lisa-edit-gate.sh +19 -15
- package/plugins/lisa-rails-devin/hooks/rubocop-on-edit.sh +2 -2
- package/plugins/lisa-rails-devin/hooks/sg-scan-on-edit.sh +3 -3
- package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript/hooks/block-suppress-directives.sh +2 -2
- package/plugins/lisa-typescript/hooks/format-on-edit.sh +2 -2
- package/plugins/lisa-typescript/hooks/lint-on-edit.sh +2 -2
- package/plugins/lisa-typescript/hooks/lisa-edit-gate.sh +19 -15
- package/plugins/lisa-typescript/hooks/sg-scan-on-edit.sh +3 -3
- package/plugins/lisa-typescript-agy/plugin.json +1 -1
- package/plugins/lisa-typescript-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-copilot/hooks/block-suppress-directives.sh +2 -2
- package/plugins/lisa-typescript-copilot/hooks/format-on-edit.sh +2 -2
- package/plugins/lisa-typescript-copilot/hooks/lint-on-edit.sh +2 -2
- package/plugins/lisa-typescript-copilot/hooks/lisa-edit-gate.sh +19 -15
- package/plugins/lisa-typescript-copilot/hooks/sg-scan-on-edit.sh +3 -3
- package/plugins/lisa-typescript-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-cursor/hooks/block-suppress-directives.sh +2 -2
- package/plugins/lisa-typescript-cursor/hooks/format-on-edit.sh +2 -2
- package/plugins/lisa-typescript-cursor/hooks/lint-on-edit.sh +2 -2
- package/plugins/lisa-typescript-cursor/hooks/lisa-edit-gate.sh +19 -15
- package/plugins/lisa-typescript-cursor/hooks/sg-scan-on-edit.sh +3 -3
- 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-typescript-devin/hooks/block-suppress-directives.sh +2 -2
- package/plugins/lisa-typescript-devin/hooks/format-on-edit.sh +2 -2
- package/plugins/lisa-typescript-devin/hooks/lint-on-edit.sh +2 -2
- package/plugins/lisa-typescript-devin/hooks/lisa-edit-gate.sh +19 -15
- package/plugins/lisa-typescript-devin/hooks/sg-scan-on-edit.sh +3 -3
- 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/hooks/block-managed-file-edits.sh +201 -20
- package/plugins/src/base/hooks/block-masked-exit-status.sh +1 -1
- package/plugins/src/base/hooks/block-no-verify.agy.sh +1 -1
- package/plugins/src/base/hooks/enforce-verification-gate.sh +1 -2
- package/plugins/src/base/hooks/ticket-sync-reminder.sh +2 -17
- package/plugins/src/base/hooks/track-plan-sessions.sh +7 -131
- package/plugins/src/base/scripts/remote-agent-aws-setup.sh +3 -1
- package/plugins/src/base/skills/lisa-setup-remote-env/assets/session-start.sh +18 -5
- package/plugins/src/expo/skills/building-native-ui/references/webgpu-three.md +19 -9
- package/plugins/src/expo/skills/expo-tailwind-setup/SKILL.md +15 -4
- package/plugins/src/harper-fabric/hooks/block-generated-artifact-edits.sh +196 -11
- package/plugins/src/harper-fabric/hooks/enforce-config-extensions.sh +1 -1
- package/plugins/src/nestjs/hooks/block-migration-edits.sh +1 -1
- package/plugins/src/nestjs/hooks/lisa-edit-gate.sh +19 -15
- package/plugins/src/nestjs/skills/nestjs-rules/SKILL.md +39 -26
- package/plugins/src/nestjs/skills/typeorm-patterns/references/observability-patterns.md +18 -58
- package/plugins/src/rails/hooks/lisa-edit-gate.sh +19 -15
- package/plugins/src/rails/hooks/rubocop-on-edit.sh +2 -2
- package/plugins/src/rails/hooks/sg-scan-on-edit.sh +3 -3
- package/plugins/src/typescript/hooks/block-suppress-directives.sh +2 -2
- package/plugins/src/typescript/hooks/format-on-edit.sh +2 -2
- package/plugins/src/typescript/hooks/lint-on-edit.sh +2 -2
- package/plugins/src/typescript/hooks/lisa-edit-gate.sh +19 -15
- package/plugins/src/typescript/hooks/sg-scan-on-edit.sh +3 -3
- package/scripts/build-plugins.sh +1 -1
- package/scripts/check-derived-artifacts.mjs +2 -2
- package/scripts/check-generated-artifact-merge-coverage.mjs +45 -4
- package/scripts/check-orphan-test-processes.mjs +0 -1
- package/scripts/check-self-dependency-pin.mjs +0 -2
- package/scripts/claude-remote-setup.sh +12 -7
- package/scripts/cleanup-amplify-branches.sh +0 -1
- package/scripts/generate-export-surface.mjs +131 -61
- package/scripts/generate-lisa-owned-hash-ledger.mjs +87 -102
- package/scripts/generate-upstream-evidence-manifest.mjs +56 -49
- package/scripts/github-status-check.sh +5 -25
- package/scripts/install-claude-plugins.sh +10 -8
- package/scripts/lib/merge-generated-json.mjs +274 -0
- package/scripts/lib/upstream-manifest-staleness.mjs +38 -34
- package/scripts/lib/upstream-public-commits.mjs +35 -18
- package/scripts/lisa-commit-and-pr-local.sh +1 -1
- package/scripts/lisa-enforcement-fallback.sh +31 -32
- package/scripts/lisa-github-environments.sh +5 -1
- package/scripts/lisa-github-repo-settings.sh +5 -1
- package/scripts/lisa-github-repo-setup.sh +1 -2
- package/scripts/lisa-github-rulesets.sh +8 -8
- package/scripts/lisa-remote-env/session-start.sh +18 -5
- package/scripts/lisa-rollback-release.mjs +0 -2
- package/scripts/lisa-update-local.sh +1 -1
- package/scripts/merge-generated-artifact.mjs +18 -6
- package/scripts/raise-self-dependency-pin.mjs +0 -2
- package/scripts/run-artifact-checks.mjs +1 -1
- package/scripts/verify-packed-learnings-contract.mjs +36 -3
- package/scripts/verify-self-pin-raise.mjs +0 -2
- package/typescript/copy-contents/.husky/commit-msg +8 -2
- package/typescript/copy-contents/.husky/post-checkout +2 -0
- package/typescript/copy-contents/.husky/post-merge +2 -0
- package/typescript/copy-contents/.husky/pre-commit +10 -3
- package/typescript/copy-contents/.husky/pre-push +29 -16
- package/typescript/copy-contents/.husky/prepare-commit-msg +2 -0
- package/typescript/create-only/.husky/pre-push.local +2 -0
- package/eslint-plugin-code-organization/__tests__/enforce-statement-order.test.js +0 -643
|
@@ -1,746 +1,17 @@
|
|
|
1
|
-
/** Structured, bounded GitHub ruleset collection and canonical comparison. */
|
|
2
|
-
/* eslint-disable jsdoc/require-param-description, jsdoc/require-returns, max-lines -- structured collection and normalization stay colocated */
|
|
3
|
-
import { execFile } from "node:child_process";
|
|
4
|
-
import { readFile } from "node:fs/promises";
|
|
5
|
-
import path from "node:path";
|
|
6
|
-
import { pathToFileURL } from "node:url";
|
|
7
|
-
import { listFilesRecursive } from "../utils/file-operations.js";
|
|
8
1
|
import { deterministicFinding, namedReason } from "./finding-utils.js";
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
*
|
|
16
|
-
* This is the one bound on how many rulesets are read, and it is the same
|
|
17
|
-
* one `readLivePolicy` in `lisa-reconcile-policy.mjs` applies. The two must
|
|
18
|
-
* agree: `lisa controls protect` reads the rulesets with that script before a
|
|
19
|
-
* change and with this reader after it, and a list the first read accepted
|
|
20
|
-
* and the second refused left every change on such a repository reported as
|
|
21
|
-
* not confirmed. `tests/unit/controls/protect-many-rulesets.test.ts` holds
|
|
22
|
-
* the two to the same line.
|
|
23
|
-
*/
|
|
24
|
-
export const RULESET_PAGE_SIZE = 100;
|
|
25
|
-
/**
|
|
26
|
-
* How many ruleset details are read at once. It is the most this reader ever
|
|
27
|
-
* started together, kept so that reading a longer list does not start more
|
|
28
|
-
* requests at one time than reading a short one did.
|
|
29
|
-
*/
|
|
30
|
-
const DETAIL_READS_AT_ONCE = 32;
|
|
31
|
-
/** The id GitHub gives its own Actions app, which reports workflow checks. */
|
|
32
|
-
export const ACTIONS_INTEGRATION_ID = 15_368;
|
|
33
|
-
const QUALITY_RULESET_NAME = "quality checks";
|
|
34
|
-
const QUALITY_WORKFLOW_NAME = "🔍 Quality Checks";
|
|
2
|
+
import { compareRulesets, requiredContextDrift } from "./ruleset-compare.js";
|
|
3
|
+
import { expectedRulesets } from "./ruleset-expected.js";
|
|
4
|
+
export { compareRulesets } from "./ruleset-compare.js";
|
|
5
|
+
export { expectedRequiredContexts, expectedRulesets, liveRequiredContexts, } from "./ruleset-expected.js";
|
|
6
|
+
export { isWholeRulesetList, readGhText, readGithubRulesets, RULESET_PAGE_SIZE, rulesetReaderOver, } from "./ruleset-gh.js";
|
|
7
|
+
export { ACTIONS_INTEGRATION_ID } from "./ruleset-normalize.js";
|
|
35
8
|
const REPOSITORY_PART = /^[A-Za-z0-9_.-]{1,100}$/u;
|
|
36
9
|
const RULESET_CHECK = "github.rulesets";
|
|
37
10
|
const WARN = "warn";
|
|
38
|
-
/** Where a per-repo required-check opt-in is declared. */
|
|
39
|
-
const CONFIGURED_CHECK_SOURCE = ".lisa.config.json \u2192 github.rulesets.requiredChecks";
|
|
40
|
-
/** Where a required run-gate context is declared. */
|
|
41
|
-
const DERIVED_RUN_GATE_SOURCE = ".lisa.config.json \u2192 gates (derived run-gate context)";
|
|
42
|
-
/** The declarative key, and the additive one it replaced. */
|
|
43
|
-
const CHECK_KEYS = ["requiredChecks", "addRequiredChecks"];
|
|
44
|
-
/** Where a live requirement was read from. */
|
|
45
|
-
const LIVE_CHECK_SOURCE = "the repository's live rulesets";
|
|
46
|
-
/**
|
|
47
|
-
* Return a sorted copy without mutating caller-owned input.
|
|
48
|
-
* @param items - Caller-owned items
|
|
49
|
-
* @param compare - Stable comparator
|
|
50
|
-
*/
|
|
51
|
-
function sortedCopy(items, compare) {
|
|
52
|
-
const copy = [...items];
|
|
53
|
-
// eslint-disable-next-line functional/immutable-data -- only the detached copy is sorted
|
|
54
|
-
return copy.sort(compare);
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Run one fixed-argv bounded gh read, answering its stdout.
|
|
58
|
-
*
|
|
59
|
-
* Text rather than JSON, because not every bounded read this package makes is
|
|
60
|
-
* one JSON document: `gh api --paginate` emits one array PER PAGE, so a
|
|
61
|
-
* paginated read is a stream of values and its `--jq` output is lines. Shared
|
|
62
|
-
* so there is one `gh` invocation site in this package rather than a second
|
|
63
|
-
* one beside it.
|
|
64
|
-
* @param argv
|
|
65
|
-
* @param cwd
|
|
66
|
-
* @param timeoutMs
|
|
67
|
-
* @param signal
|
|
68
|
-
*/
|
|
69
|
-
export function readGhText(argv, cwd, timeoutMs, signal) {
|
|
70
|
-
return new Promise((resolve, reject) => {
|
|
71
|
-
execFile(
|
|
72
|
-
// eslint-disable-next-line sonarjs/no-os-command-from-path -- fixed user-installed gh executable
|
|
73
|
-
"gh", [...argv], {
|
|
74
|
-
cwd,
|
|
75
|
-
encoding: "utf8",
|
|
76
|
-
maxBuffer: MAX_GH_OUTPUT_BYTES,
|
|
77
|
-
signal,
|
|
78
|
-
killSignal: "SIGKILL",
|
|
79
|
-
timeout: Math.max(1, Math.min(timeoutMs, GH_TIMEOUT_MS)),
|
|
80
|
-
}, (error, stdout) => {
|
|
81
|
-
if (error !== null) {
|
|
82
|
-
reject(error);
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
resolve(stdout);
|
|
86
|
-
});
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Run one fixed-argv bounded gh JSON read.
|
|
91
|
-
* @param argv
|
|
92
|
-
* @param cwd
|
|
93
|
-
* @param timeoutMs
|
|
94
|
-
* @param signal
|
|
95
|
-
*/
|
|
96
|
-
async function readGhJson(argv, cwd, timeoutMs, signal) {
|
|
97
|
-
return JSON.parse(await readGhText(argv, cwd, timeoutMs, signal));
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* Validate and project one detailed GitHub ruleset response.
|
|
101
|
-
* @param candidate
|
|
102
|
-
*/
|
|
103
|
-
function projectRuleset(candidate) {
|
|
104
|
-
if (candidate === null || typeof candidate !== "object") {
|
|
105
|
-
throw new Error("Ruleset detail was not an object");
|
|
106
|
-
}
|
|
107
|
-
const name = Reflect.get(candidate, "name");
|
|
108
|
-
if (typeof name !== "string" || name.trim().length === 0) {
|
|
109
|
-
throw new Error("Ruleset detail omitted its name");
|
|
110
|
-
}
|
|
111
|
-
return {
|
|
112
|
-
name,
|
|
113
|
-
target: Reflect.get(candidate, "target"),
|
|
114
|
-
enforcement: Reflect.get(candidate, "enforcement"),
|
|
115
|
-
conditions: Reflect.get(candidate, "conditions"),
|
|
116
|
-
rules: Reflect.get(candidate, "rules"),
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* Tell whether a ruleset list of some length can be taken for the whole list.
|
|
121
|
-
*
|
|
122
|
-
* The list is asked for one page at a time, at the largest page the platform
|
|
123
|
-
* gives. A page that comes back full cannot be told from a list that goes
|
|
124
|
-
* on, so only a shorter one is the whole list. A caller that is about to
|
|
125
|
-
* make the list longer asks this first, about the length it would then have.
|
|
126
|
-
* @param length - How many rulesets the list holds, or would hold
|
|
127
|
-
*/
|
|
128
|
-
export function isWholeRulesetList(length) {
|
|
129
|
-
return length < RULESET_PAGE_SIZE;
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* Split a list into runs of at most some length, in order.
|
|
133
|
-
* @param items - The list
|
|
134
|
-
* @param size - The longest a run may be
|
|
135
|
-
*/
|
|
136
|
-
function inRunsOf(items, size) {
|
|
137
|
-
return Array.from({ length: Math.ceil(items.length / size) }, (_, run) => items.slice(run * size, (run + 1) * size));
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* Build a detailed ruleset reader over one JSON read function.
|
|
141
|
-
*
|
|
142
|
-
* The walk — list the rulesets, read each one's detail, keep the material
|
|
143
|
-
* fields, sort by name — is the same whoever makes the requests. A caller
|
|
144
|
-
* that has to account for every request it sends (`lisa controls protect`
|
|
145
|
-
* reads the settings back after changing them) hands in its own read function
|
|
146
|
-
* and gets this walk rather than a second copy of it.
|
|
147
|
-
* @param readJson - Makes one read and answers the parsed document
|
|
148
|
-
*/
|
|
149
|
-
export function rulesetReaderOver(readJson) {
|
|
150
|
-
return async (owner, repo, projectRoot, timeoutMs, signal) => {
|
|
151
|
-
// The platform lists thirty rulesets unless a request asks for more, so
|
|
152
|
-
// a read without a page size dropped the thirty-first ruleset and read
|
|
153
|
-
// the list as whole. The largest page is asked for, and a page that
|
|
154
|
-
// comes back full is refused: see `isWholeRulesetList`.
|
|
155
|
-
const listed = await readJson([
|
|
156
|
-
"api",
|
|
157
|
-
"-X",
|
|
158
|
-
"GET",
|
|
159
|
-
`repos/${owner}/${repo}/rulesets?per_page=${String(RULESET_PAGE_SIZE)}`,
|
|
160
|
-
], projectRoot, timeoutMs, signal);
|
|
161
|
-
if (!Array.isArray(listed)) {
|
|
162
|
-
throw new TypeError("The ruleset list was not a list");
|
|
163
|
-
}
|
|
164
|
-
if (!isWholeRulesetList(listed.length)) {
|
|
165
|
-
throw new Error(`The ruleset list came back as a full page of ${String(listed.length)}, so there may be more rulesets than were read`);
|
|
166
|
-
}
|
|
167
|
-
const readDetail = async (entry) => {
|
|
168
|
-
if (entry === null || typeof entry !== "object") {
|
|
169
|
-
throw new Error("Ruleset list entry was not an object");
|
|
170
|
-
}
|
|
171
|
-
const id = Reflect.get(entry, "id");
|
|
172
|
-
if (!Number.isSafeInteger(id)) {
|
|
173
|
-
throw new Error("Ruleset list entry omitted its id");
|
|
174
|
-
}
|
|
175
|
-
return projectRuleset(await readJson(["api", "-X", "GET", `repos/${owner}/${repo}/rulesets/${String(id)}`], projectRoot, timeoutMs, signal));
|
|
176
|
-
};
|
|
177
|
-
// One run of reads at a time, each run started only when the one before
|
|
178
|
-
// it has answered, so a long list never has more requests under way than
|
|
179
|
-
// a short one could.
|
|
180
|
-
const details = await inRunsOf(listed, DETAIL_READS_AT_ONCE).reduce(async (earlier, run) => [
|
|
181
|
-
...(await earlier),
|
|
182
|
-
...(await Promise.all(run.map(readDetail))),
|
|
183
|
-
], Promise.resolve([]));
|
|
184
|
-
return sortedCopy(details, (left, right) => left.name.localeCompare(right.name));
|
|
185
|
-
};
|
|
186
|
-
}
|
|
187
|
-
/** Default fixed-argv detailed GitHub ruleset reader. */
|
|
188
|
-
export const readGithubRulesets = rulesetReaderOver(readGhJson);
|
|
189
|
-
/**
|
|
190
|
-
* Read configured required-check opt-outs without exposing their values.
|
|
191
|
-
* @param config
|
|
192
|
-
*/
|
|
193
|
-
function droppedChecks(config) {
|
|
194
|
-
const github = config.github;
|
|
195
|
-
const rulesets = github !== null && typeof github === "object" && !Array.isArray(github)
|
|
196
|
-
? Reflect.get(github, "rulesets")
|
|
197
|
-
: undefined;
|
|
198
|
-
const dropped = rulesets !== null &&
|
|
199
|
-
typeof rulesets === "object" &&
|
|
200
|
-
!Array.isArray(rulesets)
|
|
201
|
-
? Reflect.get(rulesets, "dropRequiredChecks")
|
|
202
|
-
: undefined;
|
|
203
|
-
return new Set(Array.isArray(dropped)
|
|
204
|
-
? dropped.filter(item => typeof item === "string")
|
|
205
|
-
: []);
|
|
206
|
-
}
|
|
207
|
-
/**
|
|
208
|
-
* Read the per-repo required-check opt-INs for one ruleset.
|
|
209
|
-
*
|
|
210
|
-
* Mirrors `add_config_required_checks` in scripts/lisa-github-rulesets.sh. A
|
|
211
|
-
* repository-specific high-signal check cannot live in a shared template — host
|
|
212
|
-
* projects would inherit a context they never report, and a required check that
|
|
213
|
-
* never reports blocks every pull request (#2476). It is declared per repo
|
|
214
|
-
* instead, and this reader is what keeps `lisa health` from calling the
|
|
215
|
-
* resulting live ruleset "drifted".
|
|
216
|
-
*
|
|
217
|
-
* Both keys are read. `requiredChecks` is the declarative one; `addRequiredChecks`
|
|
218
|
-
* is the additive one it replaced, still honoured so an installed project keeps
|
|
219
|
-
* reporting truthfully until it renames the key. Reading only the new name
|
|
220
|
-
* would make every not-yet-migrated repository's live ruleset read as drifted,
|
|
221
|
-
* which is a false alarm whose obvious fix is deleting a real requirement.
|
|
222
|
-
* @param config
|
|
223
|
-
* @param rulesetName
|
|
224
|
-
*/
|
|
225
|
-
function addedChecks(config, rulesetName) {
|
|
226
|
-
const github = config.github;
|
|
227
|
-
const rulesets = github !== null && typeof github === "object" && !Array.isArray(github)
|
|
228
|
-
? Reflect.get(github, "rulesets")
|
|
229
|
-
: undefined;
|
|
230
|
-
const declarations = rulesets !== null &&
|
|
231
|
-
typeof rulesets === "object" &&
|
|
232
|
-
!Array.isArray(rulesets)
|
|
233
|
-
? CHECK_KEYS.map(key => Reflect.get(rulesets, key))
|
|
234
|
-
: [];
|
|
235
|
-
const forRuleset = declarations
|
|
236
|
-
.map(additions => additions !== null &&
|
|
237
|
-
typeof additions === "object" &&
|
|
238
|
-
!Array.isArray(additions)
|
|
239
|
-
? Reflect.get(additions, rulesetName)
|
|
240
|
-
: undefined)
|
|
241
|
-
.find(entry => Array.isArray(entry));
|
|
242
|
-
if (!Array.isArray(forRuleset))
|
|
243
|
-
return [];
|
|
244
|
-
return forRuleset.flatMap(entry => {
|
|
245
|
-
if (entry === null || typeof entry !== "object" || Array.isArray(entry)) {
|
|
246
|
-
return [];
|
|
247
|
-
}
|
|
248
|
-
const context = Reflect.get(entry, "context");
|
|
249
|
-
if (typeof context !== "string")
|
|
250
|
-
return [];
|
|
251
|
-
const integration = Reflect.get(entry, "integration_id");
|
|
252
|
-
return [
|
|
253
|
-
{
|
|
254
|
-
context,
|
|
255
|
-
integration_id: typeof integration === "number"
|
|
256
|
-
? integration
|
|
257
|
-
: ACTIONS_INTEGRATION_ID,
|
|
258
|
-
},
|
|
259
|
-
];
|
|
260
|
-
});
|
|
261
|
-
}
|
|
262
|
-
/**
|
|
263
|
-
* Merge per-repo additions into a template's rules, exactly as apply does.
|
|
264
|
-
*
|
|
265
|
-
* Runs BEFORE the no-workflows strip and before `dropRequiredChecks`, so both
|
|
266
|
-
* of those still win over an addition — matching the shell applier's ordering.
|
|
267
|
-
* @param rules
|
|
268
|
-
* @param added
|
|
269
|
-
*/
|
|
270
|
-
function withAddedChecks(rules, added) {
|
|
271
|
-
if (added.length === 0)
|
|
272
|
-
return rules;
|
|
273
|
-
const existing = Array.isArray(rules) ? rules : [];
|
|
274
|
-
const hasRequiredRule = existing.some(rule => rule !== null &&
|
|
275
|
-
typeof rule === "object" &&
|
|
276
|
-
Reflect.get(rule, "type") === "required_status_checks");
|
|
277
|
-
if (!hasRequiredRule) {
|
|
278
|
-
return [
|
|
279
|
-
...existing,
|
|
280
|
-
{
|
|
281
|
-
type: "required_status_checks",
|
|
282
|
-
parameters: {
|
|
283
|
-
strict_required_status_checks_policy: false,
|
|
284
|
-
do_not_enforce_on_create: true,
|
|
285
|
-
required_status_checks: added,
|
|
286
|
-
},
|
|
287
|
-
},
|
|
288
|
-
];
|
|
289
|
-
}
|
|
290
|
-
return existing.map(rule => {
|
|
291
|
-
if (rule === null ||
|
|
292
|
-
typeof rule !== "object" ||
|
|
293
|
-
Reflect.get(rule, "type") !== "required_status_checks") {
|
|
294
|
-
return rule;
|
|
295
|
-
}
|
|
296
|
-
const parameters = Reflect.get(rule, "parameters");
|
|
297
|
-
if (parameters === null || typeof parameters !== "object")
|
|
298
|
-
return rule;
|
|
299
|
-
const checks = Reflect.get(parameters, "required_status_checks");
|
|
300
|
-
if (!Array.isArray(checks))
|
|
301
|
-
return rule;
|
|
302
|
-
const present = new Set(checks.flatMap(check => {
|
|
303
|
-
const context = check !== null && typeof check === "object"
|
|
304
|
-
? Reflect.get(check, "context")
|
|
305
|
-
: undefined;
|
|
306
|
-
return typeof context === "string" ? [context] : [];
|
|
307
|
-
}));
|
|
308
|
-
return {
|
|
309
|
-
...rule,
|
|
310
|
-
parameters: {
|
|
311
|
-
...parameters,
|
|
312
|
-
required_status_checks: [
|
|
313
|
-
...checks,
|
|
314
|
-
...added.filter(check => !present.has(String(check.context))),
|
|
315
|
-
],
|
|
316
|
-
},
|
|
317
|
-
};
|
|
318
|
-
});
|
|
319
|
-
}
|
|
320
|
-
/**
|
|
321
|
-
* Derive the Actions contexts required run gates post through the quality
|
|
322
|
-
* workflow. Awaited gates remain in the generated base ruleset so their
|
|
323
|
-
* external integration pin is preserved rather than replaced with Actions.
|
|
324
|
-
* @param lisaRoot
|
|
325
|
-
* @param config
|
|
326
|
-
*/
|
|
327
|
-
async function derivedRunGateChecks(lisaRoot, config) {
|
|
328
|
-
const entry = pathToFileURL(path.join(lisaRoot, "all", "copy-overwrite", "scripts", "lisa-gates.mjs")).href;
|
|
329
|
-
const loaded = await import(entry).catch(() => null);
|
|
330
|
-
if (typeof loaded?.contextsFor !== "function")
|
|
331
|
-
return [];
|
|
332
|
-
const { runner: _runner, ...gates } = (config.gates ?? {});
|
|
333
|
-
try {
|
|
334
|
-
const contexts = loaded.contextsFor(gates, {
|
|
335
|
-
moment: "pull-request",
|
|
336
|
-
workflowName: QUALITY_WORKFLOW_NAME,
|
|
337
|
-
mode: "run",
|
|
338
|
-
});
|
|
339
|
-
if (!Array.isArray(contexts))
|
|
340
|
-
return [];
|
|
341
|
-
return contexts.flatMap(context => typeof context === "string"
|
|
342
|
-
? [{ context, integration_id: ACTIONS_INTEGRATION_ID }]
|
|
343
|
-
: []);
|
|
344
|
-
}
|
|
345
|
-
catch {
|
|
346
|
-
return [];
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
/**
|
|
350
|
-
* Add derived checks only to the ruleset that owns the quality workflow.
|
|
351
|
-
* @param rules - Candidate ruleset rules
|
|
352
|
-
* @param rulesetName - Ruleset receiving the candidate rules
|
|
353
|
-
* @param checks - Derived workflow-posted checks
|
|
354
|
-
*/
|
|
355
|
-
function withDerivedRunGateChecks(rules, rulesetName, checks) {
|
|
356
|
-
return rulesetName === QUALITY_RULESET_NAME
|
|
357
|
-
? withAddedChecks(rules, checks)
|
|
358
|
-
: rules;
|
|
359
|
-
}
|
|
360
|
-
/**
|
|
361
|
-
* Normalize one ruleset exactly as the applier does.
|
|
362
|
-
* @param projected - Projected ruleset document
|
|
363
|
-
* @param configured - Per-repository configured additions
|
|
364
|
-
* @param derived - Required contexts derived from run gates
|
|
365
|
-
* @param hasWorkflows - Whether Actions contexts can report
|
|
366
|
-
* @param dropped - Contexts the repository explicitly drops
|
|
367
|
-
*/
|
|
368
|
-
function normalizedProjectRules(projected, configured, derived, hasWorkflows, dropped) {
|
|
369
|
-
return normalizeExpectedRules(withAddedChecks(withDerivedRunGateChecks(projected.rules, projected.name, derived), configured), hasWorkflows, dropped);
|
|
370
|
-
}
|
|
371
|
-
/**
|
|
372
|
-
* Attribute one normalized context to the declaration that supplied it.
|
|
373
|
-
* @param context - Required status context
|
|
374
|
-
* @param configured - Per-repository configured checks
|
|
375
|
-
* @param derived - Checks derived from run-gate declarations
|
|
376
|
-
* @param template - Shipped template source path
|
|
377
|
-
*/
|
|
378
|
-
function enforcementSource(context, configured, derived, template) {
|
|
379
|
-
if (configured.some(check => check.context === context)) {
|
|
380
|
-
return CONFIGURED_CHECK_SOURCE;
|
|
381
|
-
}
|
|
382
|
-
return derived.some(check => check.context === context)
|
|
383
|
-
? DERIVED_RUN_GATE_SOURCE
|
|
384
|
-
: template;
|
|
385
|
-
}
|
|
386
|
-
/**
|
|
387
|
-
* Apply workflow and configured required-check normalization used by apply.
|
|
388
|
-
* @param rules
|
|
389
|
-
* @param hasWorkflows
|
|
390
|
-
* @param dropped
|
|
391
|
-
*/
|
|
392
|
-
function normalizeExpectedRules(rules, hasWorkflows, dropped) {
|
|
393
|
-
if (!Array.isArray(rules))
|
|
394
|
-
return rules;
|
|
395
|
-
return rules.flatMap(rule => {
|
|
396
|
-
if (rule === null ||
|
|
397
|
-
typeof rule !== "object" ||
|
|
398
|
-
Reflect.get(rule, "type") !== "required_status_checks") {
|
|
399
|
-
return [rule];
|
|
400
|
-
}
|
|
401
|
-
const parameters = Reflect.get(rule, "parameters");
|
|
402
|
-
if (parameters === null || typeof parameters !== "object")
|
|
403
|
-
return [rule];
|
|
404
|
-
const checks = Reflect.get(parameters, "required_status_checks");
|
|
405
|
-
if (!Array.isArray(checks))
|
|
406
|
-
return [rule];
|
|
407
|
-
const retained = checks.filter(check => {
|
|
408
|
-
if (check === null || typeof check !== "object")
|
|
409
|
-
return true;
|
|
410
|
-
const integration = Reflect.get(check, "integration_id");
|
|
411
|
-
const context = Reflect.get(check, "context");
|
|
412
|
-
return ((hasWorkflows || integration !== ACTIONS_INTEGRATION_ID) &&
|
|
413
|
-
(typeof context !== "string" || !dropped.has(context)));
|
|
414
|
-
});
|
|
415
|
-
if (retained.length === 0)
|
|
416
|
-
return [];
|
|
417
|
-
return [
|
|
418
|
-
{
|
|
419
|
-
...rule,
|
|
420
|
-
parameters: { ...parameters, required_status_checks: retained },
|
|
421
|
-
},
|
|
422
|
-
];
|
|
423
|
-
});
|
|
424
|
-
}
|
|
425
|
-
/** Where the `base` ruleset comes from now that no template ships it. */
|
|
426
|
-
const GENERATED_BASE_SOURCE = ".lisa.config.json (generated base ruleset)";
|
|
427
|
-
/**
|
|
428
|
-
* The `base` ruleset the applier will generate for this project.
|
|
429
|
-
*
|
|
430
|
-
* `all/github-rulesets/base.json` was deleted: seven of its fields duplicated
|
|
431
|
-
* the `policy` block, four more could not be declared at all, and it pinned two
|
|
432
|
-
* vendor status checks every repository inherited. The applier builds the
|
|
433
|
-
* payload from config now, so a health reader that only walked
|
|
434
|
-
* `<type>/github-rulesets/` would go blind to the one ruleset that carries a
|
|
435
|
-
* repository's branch protection — and report its live contexts as owned by
|
|
436
|
-
* nobody.
|
|
437
|
-
*
|
|
438
|
-
* Loaded from the installed Lisa package at runtime rather than reimplemented
|
|
439
|
-
* here. A second implementation of the payload is the exact defect this
|
|
440
|
-
* replaced: two writers for one setting, with nothing comparing them.
|
|
441
|
-
* @param lisaRoot - Lisa package root
|
|
442
|
-
* @param config - Safe project config
|
|
443
|
-
* @returns The generated ruleset, or nothing when the generator is unavailable
|
|
444
|
-
*/
|
|
445
|
-
async function generatedBaseRuleset(lisaRoot, config) {
|
|
446
|
-
const entry = pathToFileURL(path.join(lisaRoot, "scripts", "lisa-ruleset-payload.mjs")).href;
|
|
447
|
-
const loaded = await import(entry).catch(() => null);
|
|
448
|
-
const build = loaded?.buildRulesetPayload;
|
|
449
|
-
if (typeof build !== "function")
|
|
450
|
-
return [];
|
|
451
|
-
const { runner: _runner, ...gates } = (config.gates ?? {});
|
|
452
|
-
try {
|
|
453
|
-
return [projectRuleset(build({ gates, policy: config.policy ?? {} }))];
|
|
454
|
-
}
|
|
455
|
-
catch {
|
|
456
|
-
return [];
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
/**
|
|
460
|
-
* Read expected material rulesets after the same per-project normalization as apply.
|
|
461
|
-
* @param lisaRoot - Lisa package root
|
|
462
|
-
* @param projectRoot - Canonical host root
|
|
463
|
-
* @param types - Canonically ordered project types
|
|
464
|
-
* @param config - Safe project config
|
|
465
|
-
* @returns Expected rulesets sorted by name
|
|
466
|
-
*/
|
|
467
|
-
// eslint-disable-next-line sonarjs/cognitive-complexity -- normalization mirrors the apply contract explicitly
|
|
468
|
-
export async function expectedRulesets(lisaRoot, projectRoot, types, config) {
|
|
469
|
-
const hasWorkflows = (await projectPathKind(projectRoot, path.join(".github", "workflows"))) ===
|
|
470
|
-
"directory";
|
|
471
|
-
const dropped = droppedChecks(config);
|
|
472
|
-
const derivedRunChecks = await derivedRunGateChecks(lisaRoot, config);
|
|
473
|
-
const byName = new Map();
|
|
474
|
-
for (const parsed of await generatedBaseRuleset(lisaRoot, config)) {
|
|
475
|
-
const projected = projectRuleset(parsed);
|
|
476
|
-
const normalized = {
|
|
477
|
-
...projected,
|
|
478
|
-
rules: normalizedProjectRules(projected, addedChecks(config, projected.name), derivedRunChecks, hasWorkflows, dropped),
|
|
479
|
-
};
|
|
480
|
-
if (!Array.isArray(normalized.rules) || normalized.rules.length > 0) {
|
|
481
|
-
// eslint-disable-next-line functional/immutable-data -- most-specific stack wins in the bounded plan
|
|
482
|
-
byName.set(normalized.name, normalized);
|
|
483
|
-
}
|
|
484
|
-
}
|
|
485
|
-
for (const type of ["all", ...types]) {
|
|
486
|
-
const directory = path.join(lisaRoot, type, "github-rulesets");
|
|
487
|
-
try {
|
|
488
|
-
for (const file of await listFilesRecursive(directory)) {
|
|
489
|
-
const parsed = JSON.parse(await readFile(file, "utf8"));
|
|
490
|
-
const projected = projectRuleset(parsed);
|
|
491
|
-
const normalized = {
|
|
492
|
-
...projected,
|
|
493
|
-
rules: normalizedProjectRules(projected, addedChecks(config, projected.name), derivedRunChecks, hasWorkflows, dropped),
|
|
494
|
-
};
|
|
495
|
-
if (!Array.isArray(normalized.rules) || normalized.rules.length > 0) {
|
|
496
|
-
// eslint-disable-next-line functional/immutable-data -- most-specific stack wins in the bounded plan
|
|
497
|
-
byName.set(normalized.name, normalized);
|
|
498
|
-
}
|
|
499
|
-
}
|
|
500
|
-
}
|
|
501
|
-
catch (error) {
|
|
502
|
-
if (error.code !== "ENOENT")
|
|
503
|
-
throw error;
|
|
504
|
-
}
|
|
505
|
-
}
|
|
506
|
-
return [...byName.values()].sort((left, right) => left.name.localeCompare(right.name));
|
|
507
|
-
}
|
|
508
|
-
/**
|
|
509
|
-
* The required status contexts one project's ruleset templates name, with the
|
|
510
|
-
* file each requirement was read from.
|
|
511
|
-
*
|
|
512
|
-
* `expectedRulesets` already normalizes templates the way apply does, but it
|
|
513
|
-
* answers with whole ruleset documents and loses which file said what. The
|
|
514
|
-
* declaration comparison has to name the template file — "this context is
|
|
515
|
-
* required and no declaration asks for it" is not actionable without it — so
|
|
516
|
-
* this walk keeps the attribution instead.
|
|
517
|
-
*
|
|
518
|
-
* Returning an empty list is meaningful and must not be read as "nothing is
|
|
519
|
-
* enforced": callers treat an empty result as a source they could not reach,
|
|
520
|
-
* because a comparison against nothing reports every declaration as unenforced.
|
|
521
|
-
* @param lisaRoot - Lisa package root
|
|
522
|
-
* @param projectRoot - Canonical host root
|
|
523
|
-
* @param types - Canonically ordered project types
|
|
524
|
-
* @param config - Safe project config
|
|
525
|
-
* @returns Required contexts with their ruleset and source file
|
|
526
|
-
*/
|
|
527
|
-
export async function expectedRequiredContexts(lisaRoot, projectRoot, types, config) {
|
|
528
|
-
const hasWorkflows = (await projectPathKind(projectRoot, path.join(".github", "workflows"))) ===
|
|
529
|
-
"directory";
|
|
530
|
-
const dropped = droppedChecks(config);
|
|
531
|
-
const derivedRunChecks = await derivedRunGateChecks(lisaRoot, config);
|
|
532
|
-
const byName = new Map();
|
|
533
|
-
for (const parsed of await generatedBaseRuleset(lisaRoot, config)) {
|
|
534
|
-
const projected = projectRuleset(parsed);
|
|
535
|
-
const added = addedChecks(config, projected.name);
|
|
536
|
-
const rules = normalizedProjectRules(projected, added, derivedRunChecks, hasWorkflows, dropped);
|
|
537
|
-
// eslint-disable-next-line functional/immutable-data -- most-specific stack wins, matching expectedRulesets
|
|
538
|
-
byName.set(projected.name, [...requiredStatusChecksByContext(rules).keys()].map(context => ({
|
|
539
|
-
context,
|
|
540
|
-
ruleset: projected.name,
|
|
541
|
-
source: GENERATED_BASE_SOURCE,
|
|
542
|
-
})));
|
|
543
|
-
}
|
|
544
|
-
for (const type of ["all", ...types]) {
|
|
545
|
-
const directory = path.join(lisaRoot, type, "github-rulesets");
|
|
546
|
-
try {
|
|
547
|
-
for (const file of await listFilesRecursive(directory)) {
|
|
548
|
-
const parsed = JSON.parse(await readFile(file, "utf8"));
|
|
549
|
-
const projected = projectRuleset(parsed);
|
|
550
|
-
const added = addedChecks(config, projected.name);
|
|
551
|
-
const rules = normalizedProjectRules(projected, added, derivedRunChecks, hasWorkflows, dropped);
|
|
552
|
-
const template = path
|
|
553
|
-
.relative(lisaRoot, file)
|
|
554
|
-
.split(path.sep)
|
|
555
|
-
.join(path.posix.sep);
|
|
556
|
-
// eslint-disable-next-line functional/immutable-data -- most-specific stack wins, matching expectedRulesets
|
|
557
|
-
byName.set(projected.name, [...requiredStatusChecksByContext(rules).keys()].map(context => ({
|
|
558
|
-
context,
|
|
559
|
-
ruleset: projected.name,
|
|
560
|
-
source: enforcementSource(context, added, derivedRunChecks, template),
|
|
561
|
-
})));
|
|
562
|
-
}
|
|
563
|
-
}
|
|
564
|
-
catch (error) {
|
|
565
|
-
if (error.code !== "ENOENT")
|
|
566
|
-
throw error;
|
|
567
|
-
}
|
|
568
|
-
}
|
|
569
|
-
return sortedCopy([...byName.values()].flat(), (left, right) => left.context.localeCompare(right.context));
|
|
570
|
-
}
|
|
571
|
-
/**
|
|
572
|
-
* The required status contexts a live ruleset payload names.
|
|
573
|
-
* @param actual - Rulesets as the repository actually holds them
|
|
574
|
-
* @returns Required contexts with their ruleset, sorted
|
|
575
|
-
*/
|
|
576
|
-
export function liveRequiredContexts(actual) {
|
|
577
|
-
return sortedCopy(actual.flatMap(ruleset => [...requiredStatusChecksByContext(ruleset.rules).keys()].map(context => ({
|
|
578
|
-
context,
|
|
579
|
-
ruleset: ruleset.name,
|
|
580
|
-
source: LIVE_CHECK_SOURCE,
|
|
581
|
-
}))), (left, right) => left.context.localeCompare(right.context));
|
|
582
|
-
}
|
|
583
|
-
/**
|
|
584
|
-
* Canonicalize semantically unordered JSON objects and arrays.
|
|
585
|
-
* @param value
|
|
586
|
-
*/
|
|
587
|
-
function canonical(value) {
|
|
588
|
-
if (Array.isArray(value)) {
|
|
589
|
-
return value
|
|
590
|
-
.map(canonical)
|
|
591
|
-
.sort((left, right) => JSON.stringify(left).localeCompare(JSON.stringify(right)));
|
|
592
|
-
}
|
|
593
|
-
if (value !== null && typeof value === "object") {
|
|
594
|
-
return Object.fromEntries(Object.entries(value)
|
|
595
|
-
.sort(([left], [right]) => left.localeCompare(right))
|
|
596
|
-
.map(([key, item]) => [key, canonical(item)]));
|
|
597
|
-
}
|
|
598
|
-
return value;
|
|
599
|
-
}
|
|
600
|
-
/**
|
|
601
|
-
* Remove read-only defaults GitHub may add to otherwise equivalent rules.
|
|
602
|
-
* This projection is applied symmetrically so authored non-default values
|
|
603
|
-
* remain material.
|
|
604
|
-
* @param value
|
|
605
|
-
*/
|
|
606
|
-
function withoutGithubDefaults(value) {
|
|
607
|
-
if (Array.isArray(value))
|
|
608
|
-
return value.map(withoutGithubDefaults);
|
|
609
|
-
if (value !== null && typeof value === "object") {
|
|
610
|
-
return Object.fromEntries(Object.entries(value).flatMap(([key, item]) => key === "required_reviewers" && Array.isArray(item) && item.length === 0
|
|
611
|
-
? []
|
|
612
|
-
: [[key, withoutGithubDefaults(item)]]));
|
|
613
|
-
}
|
|
614
|
-
return value;
|
|
615
|
-
}
|
|
616
|
-
/**
|
|
617
|
-
* Extract required status checks by context from a material ruleset.
|
|
618
|
-
* @param rules
|
|
619
|
-
*/
|
|
620
|
-
function requiredStatusChecksByContext(rules) {
|
|
621
|
-
if (!Array.isArray(rules))
|
|
622
|
-
return new Map();
|
|
623
|
-
const entries = rules.flatMap(rule => {
|
|
624
|
-
if (rule === null ||
|
|
625
|
-
typeof rule !== "object" ||
|
|
626
|
-
Reflect.get(rule, "type") !== "required_status_checks") {
|
|
627
|
-
return [];
|
|
628
|
-
}
|
|
629
|
-
const parameters = Reflect.get(rule, "parameters");
|
|
630
|
-
if (parameters === null || typeof parameters !== "object")
|
|
631
|
-
return [];
|
|
632
|
-
const checks = Reflect.get(parameters, "required_status_checks");
|
|
633
|
-
if (!Array.isArray(checks))
|
|
634
|
-
return [];
|
|
635
|
-
return checks.flatMap(check => {
|
|
636
|
-
if (check === null || typeof check !== "object")
|
|
637
|
-
return [];
|
|
638
|
-
const context = Reflect.get(check, "context");
|
|
639
|
-
return typeof context === "string" ? [[context, check]] : [];
|
|
640
|
-
});
|
|
641
|
-
});
|
|
642
|
-
return new Map(entries);
|
|
643
|
-
}
|
|
644
|
-
/**
|
|
645
|
-
* Project actual rules onto expected required-check contexts.
|
|
646
|
-
*
|
|
647
|
-
* Host-added required contexts are enforcement, not drift. Comparing the whole
|
|
648
|
-
* live list would make doctor pressure operators to remove checks Lisa cannot
|
|
649
|
-
* preserve safely.
|
|
650
|
-
* @param actualRules
|
|
651
|
-
* @param expectedRules
|
|
652
|
-
*/
|
|
653
|
-
function comparableActualRules(actualRules, expectedRules) {
|
|
654
|
-
const expectedContexts = new Set(requiredStatusChecksByContext(expectedRules).keys());
|
|
655
|
-
if (!Array.isArray(actualRules) || expectedContexts.size === 0) {
|
|
656
|
-
return actualRules;
|
|
657
|
-
}
|
|
658
|
-
return actualRules.map(rule => {
|
|
659
|
-
if (rule === null ||
|
|
660
|
-
typeof rule !== "object" ||
|
|
661
|
-
Reflect.get(rule, "type") !== "required_status_checks") {
|
|
662
|
-
return rule;
|
|
663
|
-
}
|
|
664
|
-
const parameters = Reflect.get(rule, "parameters");
|
|
665
|
-
if (parameters === null || typeof parameters !== "object")
|
|
666
|
-
return rule;
|
|
667
|
-
const checks = Reflect.get(parameters, "required_status_checks");
|
|
668
|
-
if (!Array.isArray(checks))
|
|
669
|
-
return rule;
|
|
670
|
-
return {
|
|
671
|
-
...rule,
|
|
672
|
-
parameters: {
|
|
673
|
-
...parameters,
|
|
674
|
-
required_status_checks: checks.filter(check => {
|
|
675
|
-
if (check === null || typeof check !== "object")
|
|
676
|
-
return true;
|
|
677
|
-
const context = Reflect.get(check, "context");
|
|
678
|
-
return typeof context !== "string" || expectedContexts.has(context);
|
|
679
|
-
}),
|
|
680
|
-
},
|
|
681
|
-
};
|
|
682
|
-
});
|
|
683
|
-
}
|
|
684
|
-
/**
|
|
685
|
-
* List Lisa-required checks absent from a live ruleset.
|
|
686
|
-
* @param expected
|
|
687
|
-
* @param actual
|
|
688
|
-
*/
|
|
689
|
-
function missingRequiredContexts(expected, actual) {
|
|
690
|
-
const actualContexts = requiredStatusChecksByContext(actual?.rules);
|
|
691
|
-
return sortedCopy([...requiredStatusChecksByContext(expected.rules).keys()].filter(context => !actualContexts.has(context)), (left, right) => left.localeCompare(right));
|
|
692
|
-
}
|
|
693
|
-
/**
|
|
694
|
-
* Name missing required-check enforcement by ruleset.
|
|
695
|
-
* @param expected
|
|
696
|
-
* @param actual
|
|
697
|
-
*/
|
|
698
|
-
function requiredContextDrift(expected, actual) {
|
|
699
|
-
const observed = new Map(actual.map(item => [item.name, item]));
|
|
700
|
-
return expected.flatMap(item => {
|
|
701
|
-
const contexts = missingRequiredContexts(item, observed.get(item.name));
|
|
702
|
-
return contexts.length === 0 ? [] : [{ ruleset: item.name, contexts }];
|
|
703
|
-
});
|
|
704
|
-
}
|
|
705
|
-
/**
|
|
706
|
-
* Compare expected and observed material ruleset documents.
|
|
707
|
-
* @param expected
|
|
708
|
-
* @param actual
|
|
709
|
-
*/
|
|
710
|
-
export function compareRulesets(expected, actual) {
|
|
711
|
-
const observed = new Map(actual.map(item => [item.name, item]));
|
|
712
|
-
const missing = expected
|
|
713
|
-
.filter(item => !observed.has(item.name))
|
|
714
|
-
.map(item => item.name);
|
|
715
|
-
const drifted = expected.flatMap(item => {
|
|
716
|
-
const present = observed.get(item.name);
|
|
717
|
-
if (present === undefined)
|
|
718
|
-
return [];
|
|
719
|
-
const expectedMaterial = canonical(withoutGithubDefaults({
|
|
720
|
-
target: item.target,
|
|
721
|
-
enforcement: item.enforcement,
|
|
722
|
-
conditions: item.conditions,
|
|
723
|
-
rules: item.rules,
|
|
724
|
-
}));
|
|
725
|
-
const actualMaterial = canonical(withoutGithubDefaults({
|
|
726
|
-
target: present.target,
|
|
727
|
-
enforcement: present.enforcement,
|
|
728
|
-
conditions: present.conditions,
|
|
729
|
-
rules: comparableActualRules(present.rules, item.rules),
|
|
730
|
-
}));
|
|
731
|
-
if (JSON.stringify(expectedMaterial) !== JSON.stringify(actualMaterial)) {
|
|
732
|
-
return [item.name];
|
|
733
|
-
}
|
|
734
|
-
return [];
|
|
735
|
-
});
|
|
736
|
-
return {
|
|
737
|
-
missing: sortedCopy(missing, (left, right) => left.localeCompare(right)),
|
|
738
|
-
drifted: sortedCopy(drifted, (left, right) => left.localeCompare(right)),
|
|
739
|
-
};
|
|
740
|
-
}
|
|
741
11
|
/**
|
|
742
12
|
* Extract a safe GitHub target without reporting configured values.
|
|
743
|
-
* @param config
|
|
13
|
+
* @param config - Safe project config
|
|
14
|
+
* @returns The owner and repository, or undefined when not safely configured
|
|
744
15
|
*/
|
|
745
16
|
function githubTarget(config) {
|
|
746
17
|
const github = config.github;
|
|
@@ -798,5 +69,4 @@ export async function rulesetFinding(lisaRoot, projectRoot, types, config, reade
|
|
|
798
69
|
? deterministicFinding(RULESET_CHECK, "pass", "Required GitHub rulesets are active and materially current.")
|
|
799
70
|
: deterministicFinding(RULESET_CHECK, "fail", namedReason("GitHub ruleset drift", names));
|
|
800
71
|
}
|
|
801
|
-
/* eslint-enable jsdoc/require-param-description, jsdoc/require-returns, max-lines -- restore repository defaults */
|
|
802
72
|
//# sourceMappingURL=ruleset-inspection.js.map
|