@boyingliu01/xp-gate 0.38.126 → 0.39.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 +93 -0
- package/adapters/gate-3.sh +13 -2
- package/adapters/python.sh +36 -38
- package/bin/xp-gate.js +11 -0
- package/build-integrity/gate-10-lines.ts +98 -0
- package/build-integrity/gate-10.ts +98 -109
- package/build-integrity/quote-masker.ts +17 -3
- package/gate-3.sh +13 -2
- package/gates/common-process.ts +116 -34
- package/gates/common.ts +51 -15
- package/gates/gate-3.ts +166 -61
- package/gates/gate-8.ts +76 -24
- package/gates/gate-9.ts +276 -82
- package/gates/pbt-detect.ts +70 -39
- package/gates/python-health.ts +236 -98
- package/gates/test-layers.ts +103 -30
- package/hooks/gate-3.sh +13 -2
- package/hooks/gate-entries/gate-1-entry.sh +10 -1
- package/hooks/gate-entries/gate-5-entry.sh +5 -1
- package/hooks/lib/validate-code-walkthrough.cjs +324 -99
- package/hooks/pre-commit +52 -0
- package/hooks/pre-push +54 -3
- package/lib/agent-runtime-journal.js +104 -37
- package/lib/arch.js +6 -0
- package/lib/baseline.js +329 -201
- package/lib/check.js +38 -2
- package/lib/doctor-constants.js +43 -0
- package/lib/doctor.js +2008 -1001
- package/lib/flaky.js +178 -79
- package/lib/gate-runner.js +110 -63
- package/lib/init.js +6 -0
- package/lib/language-capability-surfaces.js +5 -2
- package/lib/language-registry.js +608 -0
- package/lib/language-tools.js +487 -1018
- package/lib/phase-transition.js +646 -446
- package/lib/prepush-evidence.js +174 -0
- package/lib/sprint-audit.js +52 -22
- package/lib/sprint-discovery.js +66 -35
- package/lib/sprint-format.js +114 -0
- package/lib/sprint-init.js +372 -118
- package/lib/sprint-status.js +134 -90
- package/lib/star-notice.js +346 -0
- package/lib/tool-display.js +52 -0
- package/lib/tool-install.js +179 -0
- package/lib/uninstall.js +331 -188
- package/mock-policy/gate-m3.ts +74 -23
- package/mock-policy/mock-decision-engine.ts +21 -7
- package/mock-policy/scope-scanner.ts +128 -69
- package/mutation/detect-ai-test.ts +20 -12
- package/mutation/gate-m.ts +6 -2
- package/mutation/init-baseline.ts +49 -13
- package/mutation/runners/go-mutant-runner.ts +7 -49
- package/mutation/runners/gremlins-runner.ts +53 -18
- package/mutation/runners/mutmut-runner.ts +455 -163
- package/mutation/runners/pitest-runner.ts +85 -131
- package/mutation/runners/spawn-with-capture.ts +304 -0
- package/mutation/runners/stryker-runner.ts +14 -55
- package/mutation/update-baseline.ts +25 -18
- package/package.json +20 -8
- package/plugins/claude-code/.claude-plugin/plugin.json +1 -1
- package/plugins/claude-code/bin/delphi-review-guard.sh +12 -61
- package/plugins/claude-code/skills/delphi-review/.delphi-config.json.example +6 -11
- package/plugins/claude-code/skills/delphi-review/AGENTS.md +1 -1
- package/plugins/claude-code/skills/reinstall-xp-gate/.architecture-skip +8 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/.github/workflows/test.yml +106 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/CHANGELOG.md +379 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/LICENSE +21 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/QUALITY-OVERVIEW.md +173 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/README.md +167 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/SKILL.md +271 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/TODO.md +253 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/VERSION +1 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/package.json +28 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/scripts/audit.mjs +193 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/scripts/coverage.mjs +140 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/scripts/hp-gate.mjs +175 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/scripts/install.mjs +64 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/scripts/lib/agent-paths.mjs +67 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/scripts/lib/agents.mjs +247 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/scripts/lib/backups.mjs +96 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/scripts/lib/baseline.mjs +101 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/scripts/lib/ccn.mjs +124 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/scripts/lib/delphi.mjs +61 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/scripts/lib/fs-tree.mjs +108 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/scripts/lib/gatecheck.mjs +290 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/scripts/lib/json-file.mjs +37 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/scripts/lib/mutations.mjs +154 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/scripts/lib/platform.mjs +92 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/scripts/lib/probes.mjs +102 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/scripts/lib/proc.mjs +33 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/scripts/lib/report.mjs +29 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/scripts/lib/residue.mjs +188 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/scripts/lib/selfsync.mjs +75 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/scripts/lib/skills.mjs +121 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/scripts/lib/spawn.mjs +161 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/scripts/lib/testreport.mjs +26 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/scripts/lib/tools.mjs +238 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/scripts/lib/util.mjs +33 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/scripts/lib/verdict.mjs +45 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/scripts/lib/version.mjs +29 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/scripts/lib/xp-cli.mjs +66 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/scripts/mutation.mjs +132 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/scripts/preflight.mjs +75 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/scripts/reinstall.mjs +297 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/scripts/setup-wsl.sh +633 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/scripts/verify.mjs +222 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/tests/agents.test.mjs +168 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/tests/baseline.test.mjs +104 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/tests/ccn.test.mjs +87 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/tests/cleanup.test.mjs +128 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/tests/coverage.test.mjs +69 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/tests/delphi.test.mjs +78 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/tests/fixtures.mjs +61 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/tests/gatecheck-audit.test.mjs +157 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/tests/gatecheck.test.mjs +57 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/tests/mutation-anchors.test.mjs +49 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/tests/proc-contract.test.mjs +58 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/tests/proc.test.mjs +243 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/tests/report.test.mjs +66 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/tests/residue.test.mjs +278 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/tests/selfsync.test.mjs +70 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/tests/skills.test.mjs +171 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/tests/testreport.test.mjs +40 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/tests/timeout-budgets.test.mjs +38 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/tests/tools-leaf.test.mjs +323 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/tests/tools-probe.test.mjs +350 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/tests/tools.test.mjs +131 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/tests/util.test.mjs +154 -0
- package/plugins/claude-code/skills/sprint-flow/AGENTS.md +1 -1
- package/plugins/claude-code/skills/test-specification-alignment/AGENTS.md +1 -1
- package/plugins/dsh/package.json +1 -1
- package/plugins/dsh/scripts/prepack.cjs +43 -18
- package/plugins/dsh/scripts/verify-skill-provider.mjs +39 -14
- package/plugins/dsh/skills/delphi-review/.delphi-config.json.example +6 -11
- package/plugins/dsh/skills/delphi-review/AGENTS.md +1 -1
- package/plugins/dsh/skills/sprint-flow/AGENTS.md +1 -1
- package/plugins/dsh/skills/test-specification-alignment/AGENTS.md +1 -1
- package/plugins/opencode/index.ts +337 -123
- package/plugins/opencode/package.json +1 -1
- package/plugins/opencode/scripts/prepack.cjs +41 -16
- package/plugins/opencode/skills/delphi-review/.delphi-config.json.example +6 -11
- package/plugins/opencode/skills/delphi-review/AGENTS.md +1 -1
- package/plugins/opencode/skills/reinstall-xp-gate/.architecture-skip +8 -0
- package/plugins/opencode/skills/reinstall-xp-gate/.github/workflows/test.yml +106 -0
- package/plugins/opencode/skills/reinstall-xp-gate/CHANGELOG.md +379 -0
- package/plugins/opencode/skills/reinstall-xp-gate/LICENSE +21 -0
- package/plugins/opencode/skills/reinstall-xp-gate/QUALITY-OVERVIEW.md +173 -0
- package/plugins/opencode/skills/reinstall-xp-gate/README.md +167 -0
- package/plugins/opencode/skills/reinstall-xp-gate/SKILL.md +271 -0
- package/plugins/opencode/skills/reinstall-xp-gate/TODO.md +253 -0
- package/plugins/opencode/skills/reinstall-xp-gate/VERSION +1 -0
- package/plugins/opencode/skills/reinstall-xp-gate/package.json +28 -0
- package/plugins/opencode/skills/reinstall-xp-gate/scripts/audit.mjs +193 -0
- package/plugins/opencode/skills/reinstall-xp-gate/scripts/coverage.mjs +140 -0
- package/plugins/opencode/skills/reinstall-xp-gate/scripts/hp-gate.mjs +175 -0
- package/plugins/opencode/skills/reinstall-xp-gate/scripts/install.mjs +64 -0
- package/plugins/opencode/skills/reinstall-xp-gate/scripts/lib/agent-paths.mjs +67 -0
- package/plugins/opencode/skills/reinstall-xp-gate/scripts/lib/agents.mjs +247 -0
- package/plugins/opencode/skills/reinstall-xp-gate/scripts/lib/backups.mjs +96 -0
- package/plugins/opencode/skills/reinstall-xp-gate/scripts/lib/baseline.mjs +101 -0
- package/plugins/opencode/skills/reinstall-xp-gate/scripts/lib/ccn.mjs +124 -0
- package/plugins/opencode/skills/reinstall-xp-gate/scripts/lib/delphi.mjs +61 -0
- package/plugins/opencode/skills/reinstall-xp-gate/scripts/lib/fs-tree.mjs +108 -0
- package/plugins/opencode/skills/reinstall-xp-gate/scripts/lib/gatecheck.mjs +290 -0
- package/plugins/opencode/skills/reinstall-xp-gate/scripts/lib/json-file.mjs +37 -0
- package/plugins/opencode/skills/reinstall-xp-gate/scripts/lib/mutations.mjs +154 -0
- package/plugins/opencode/skills/reinstall-xp-gate/scripts/lib/platform.mjs +92 -0
- package/plugins/opencode/skills/reinstall-xp-gate/scripts/lib/probes.mjs +102 -0
- package/plugins/opencode/skills/reinstall-xp-gate/scripts/lib/proc.mjs +33 -0
- package/plugins/opencode/skills/reinstall-xp-gate/scripts/lib/report.mjs +29 -0
- package/plugins/opencode/skills/reinstall-xp-gate/scripts/lib/residue.mjs +188 -0
- package/plugins/opencode/skills/reinstall-xp-gate/scripts/lib/selfsync.mjs +75 -0
- package/plugins/opencode/skills/reinstall-xp-gate/scripts/lib/skills.mjs +121 -0
- package/plugins/opencode/skills/reinstall-xp-gate/scripts/lib/spawn.mjs +161 -0
- package/plugins/opencode/skills/reinstall-xp-gate/scripts/lib/testreport.mjs +26 -0
- package/plugins/opencode/skills/reinstall-xp-gate/scripts/lib/tools.mjs +238 -0
- package/plugins/opencode/skills/reinstall-xp-gate/scripts/lib/util.mjs +33 -0
- package/plugins/opencode/skills/reinstall-xp-gate/scripts/lib/verdict.mjs +45 -0
- package/plugins/opencode/skills/reinstall-xp-gate/scripts/lib/version.mjs +29 -0
- package/plugins/opencode/skills/reinstall-xp-gate/scripts/lib/xp-cli.mjs +66 -0
- package/plugins/opencode/skills/reinstall-xp-gate/scripts/mutation.mjs +132 -0
- package/plugins/opencode/skills/reinstall-xp-gate/scripts/preflight.mjs +75 -0
- package/plugins/opencode/skills/reinstall-xp-gate/scripts/reinstall.mjs +297 -0
- package/plugins/opencode/skills/reinstall-xp-gate/scripts/setup-wsl.sh +633 -0
- package/plugins/opencode/skills/reinstall-xp-gate/scripts/verify.mjs +222 -0
- package/plugins/opencode/skills/reinstall-xp-gate/tests/agents.test.mjs +168 -0
- package/plugins/opencode/skills/reinstall-xp-gate/tests/baseline.test.mjs +104 -0
- package/plugins/opencode/skills/reinstall-xp-gate/tests/ccn.test.mjs +87 -0
- package/plugins/opencode/skills/reinstall-xp-gate/tests/cleanup.test.mjs +128 -0
- package/plugins/opencode/skills/reinstall-xp-gate/tests/coverage.test.mjs +69 -0
- package/plugins/opencode/skills/reinstall-xp-gate/tests/delphi.test.mjs +78 -0
- package/plugins/opencode/skills/reinstall-xp-gate/tests/fixtures.mjs +61 -0
- package/plugins/opencode/skills/reinstall-xp-gate/tests/gatecheck-audit.test.mjs +157 -0
- package/plugins/opencode/skills/reinstall-xp-gate/tests/gatecheck.test.mjs +57 -0
- package/plugins/opencode/skills/reinstall-xp-gate/tests/mutation-anchors.test.mjs +49 -0
- package/plugins/opencode/skills/reinstall-xp-gate/tests/proc-contract.test.mjs +58 -0
- package/plugins/opencode/skills/reinstall-xp-gate/tests/proc.test.mjs +243 -0
- package/plugins/opencode/skills/reinstall-xp-gate/tests/report.test.mjs +66 -0
- package/plugins/opencode/skills/reinstall-xp-gate/tests/residue.test.mjs +278 -0
- package/plugins/opencode/skills/reinstall-xp-gate/tests/selfsync.test.mjs +70 -0
- package/plugins/opencode/skills/reinstall-xp-gate/tests/skills.test.mjs +171 -0
- package/plugins/opencode/skills/reinstall-xp-gate/tests/testreport.test.mjs +40 -0
- package/plugins/opencode/skills/reinstall-xp-gate/tests/timeout-budgets.test.mjs +38 -0
- package/plugins/opencode/skills/reinstall-xp-gate/tests/tools-leaf.test.mjs +323 -0
- package/plugins/opencode/skills/reinstall-xp-gate/tests/tools-probe.test.mjs +350 -0
- package/plugins/opencode/skills/reinstall-xp-gate/tests/tools.test.mjs +131 -0
- package/plugins/opencode/skills/reinstall-xp-gate/tests/util.test.mjs +154 -0
- package/plugins/opencode/skills/sprint-flow/AGENTS.md +1 -1
- package/plugins/opencode/skills/test-specification-alignment/AGENTS.md +1 -1
- package/plugins/qoder/bin/sprint-flow-guard.sh +12 -60
- package/plugins/qoder/plugin.json +1 -1
- package/plugins/qoder/skills/delphi-review/.delphi-config.json.example +6 -11
- package/plugins/qoder/skills/delphi-review/AGENTS.md +1 -1
- package/plugins/qoder/skills/sprint-flow/AGENTS.md +1 -1
- package/plugins/qoder/skills/test-specification-alignment/AGENTS.md +1 -1
- package/plugins/shared/README.md +3 -0
- package/plugins/shared/bin/delphi-review-guard.sh +68 -0
- package/principles/adapters/control-nesting.ts +481 -168
- package/principles/adapters/cpp.ts +61 -22
- package/principles/adapters/csharp.ts +183 -66
- package/principles/adapters/dart.ts +11 -1
- package/principles/adapters/duplication.ts +49 -16
- package/principles/adapters/import-clause.ts +62 -15
- package/principles/adapters/java.ts +199 -70
- package/principles/adapters/line-comment.ts +18 -0
- package/principles/adapters/member-scan.ts +50 -8
- package/principles/adapters/php.ts +232 -103
- package/principles/adapters/python.ts +25 -18
- package/principles/adapters/quote-state.ts +21 -8
- package/principles/adapters/typescript-mask.ts +276 -0
- package/principles/adapters/typescript.ts +206 -200
- package/principles/analyzer.ts +16 -6
- package/principles/baseline-prune.ts +18 -8
- package/principles/baseline.ts +28 -11
- package/principles/boy-scout-usage.ts +26 -0
- package/principles/boy-scout.ts +261 -180
- package/principles/config.ts +183 -57
- package/principles/direct-execution.ts +24 -12
- package/principles/lint-baseline.ts +235 -122
- package/principles/rules/arch/dependency.ts +34 -25
- package/principles/rules/arch/shared.ts +24 -20
- package/principles/rules/clean-code/deep-nesting.ts +23 -13
- package/principles/rules/clean-code/god-class.ts +67 -41
- package/principles/rules/clean-code/large-file.ts +30 -23
- package/principles/rules/clean-code/long-function.ts +51 -37
- package/principles/rules/clean-code/magic-numbers.ts +51 -36
- package/principles/rules/clean-code/many-exports.ts +46 -29
- package/principles/rules/clean-code/missing-error-handling.ts +38 -20
- package/principles/rules/clean-code/too-many-params.ts +41 -22
- package/principles/rules/function-source.ts +62 -0
- package/principles/rules/solid/dip.ts +10 -6
- package/principles/rules/solid/isp.ts +64 -24
- package/principles/rules/solid/lsp.ts +66 -18
- package/principles/rules/solid/ocp.ts +29 -13
- package/principles/rules/solid/srp.ts +34 -18
- package/principles/warnings-count.ts +43 -0
- package/scripts/__tests__/prepush-source-classification.test.js +129 -0
- package/scripts/delphi-config-read.cjs +245 -0
- package/scripts/delphi-external-review.cjs +410 -585
- package/scripts/delphi-json-extract.cjs +108 -0
- package/scripts/delphi-model-validation.cjs +297 -0
- package/scripts/delphi-prompts.cjs +55 -0
- package/scripts/delphi-repo-tools.cjs +273 -0
- package/scripts/delphi-seat-calibration.cjs +204 -0
- package/scripts/run-bats-ci.cjs +240 -97
- package/scripts/sync-package-content.js +18 -2
- package/skills/delphi-review/.delphi-config.json.example +6 -11
- package/skills/delphi-review/AGENTS.md +1 -1
- package/skills/sprint-flow/AGENTS.md +1 -1
- package/skills/test-specification-alignment/AGENTS.md +1 -1
- package/lib/__tests__/agent-runtime-journal.test.js +0 -326
- package/lib/__tests__/arch-config-template.test.js +0 -190
- package/lib/__tests__/arch.test.js +0 -430
- package/lib/__tests__/assertion-debt.test.js +0 -99
- package/lib/__tests__/audit-cli-contract.test.ts +0 -117
- package/lib/__tests__/audit-log.test.ts +0 -107
- package/lib/__tests__/audit-skip-reasons.test.ts +0 -143
- package/lib/__tests__/baseline-completeness.test.js +0 -264
- package/lib/__tests__/baseline-shell-scope.test.js +0 -60
- package/lib/__tests__/baseline-unevaluated.test.js +0 -142
- package/lib/__tests__/baseline.test.js +0 -212
- package/lib/__tests__/bootstrap.test.js +0 -60
- package/lib/__tests__/check-alignment-cli.test.mjs +0 -94
- package/lib/__tests__/check-alignment-reasons.test.mjs +0 -101
- package/lib/__tests__/check-all-skip-accounting.test.js +0 -171
- package/lib/__tests__/check-changed-brief.test.js +0 -63
- package/lib/__tests__/check-normalize-exit.test.js +0 -24
- package/lib/__tests__/check-single-file.test.js +0 -114
- package/lib/__tests__/check-tools-list.test.js +0 -155
- package/lib/__tests__/check-version.test.js +0 -463
- package/lib/__tests__/coverage-scope.test.js +0 -140
- package/lib/__tests__/coverage-threshold.test.js +0 -80
- package/lib/__tests__/crap-cli.test.js +0 -87
- package/lib/__tests__/crap.test.js +0 -494
- package/lib/__tests__/debt-classify.test.js +0 -78
- package/lib/__tests__/delphi-channel-doctor.test.js +0 -116
- package/lib/__tests__/delphi-channel-uninstall.test.js +0 -128
- package/lib/__tests__/delphi-channel.test.js +0 -109
- package/lib/__tests__/delphi-setup.test.js +0 -203
- package/lib/__tests__/deploy-manifest-check-wired.test.js +0 -138
- package/lib/__tests__/deploy-manifest-completeness.test.js +0 -151
- package/lib/__tests__/deploy-manifest-consumers-adapter-uninstall.test.js +0 -40
- package/lib/__tests__/deploy-manifest-consumers-no-private-lists.test.js +0 -74
- package/lib/__tests__/deploy-manifest-projection.test.js +0 -66
- package/lib/__tests__/deploy-manifest-shell-parity.test.js +0 -108
- package/lib/__tests__/deploy-manifest.test.js +0 -97
- package/lib/__tests__/detect-deps-dsh-profile.test.js +0 -323
- package/lib/__tests__/detect-deps-gate-identity.test.js +0 -135
- package/lib/__tests__/detect-deps.test.js +0 -655
- package/lib/__tests__/doctor-469-hook-env.test.js +0 -211
- package/lib/__tests__/doctor-arch-tools.test.js +0 -169
- package/lib/__tests__/doctor-audit-ledger.test.js +0 -61
- package/lib/__tests__/doctor-brief.test.js +0 -59
- package/lib/__tests__/doctor-delphi.test.js +0 -628
- package/lib/__tests__/doctor-drift-direction.test.js +0 -104
- package/lib/__tests__/doctor-drift-round2.test.js +0 -215
- package/lib/__tests__/doctor-exec-retry.test.js +0 -162
- package/lib/__tests__/doctor-executed-surface.test.js +0 -230
- package/lib/__tests__/doctor-helpers.test.js +0 -139
- package/lib/__tests__/doctor-hook-drift.test.js +0 -329
- package/lib/__tests__/doctor-hook-signatures.test.js +0 -65
- package/lib/__tests__/doctor-machine-mutation.test.js +0 -116
- package/lib/__tests__/doctor-module-drift.test.js +0 -212
- package/lib/__tests__/doctor-module-resolution-parity.test.js +0 -463
- package/lib/__tests__/doctor-path-equivalence.test.js +0 -70
- package/lib/__tests__/doctor-repair-boundary.test.js +0 -52
- package/lib/__tests__/doctor-signature-stability.test.js +0 -55
- package/lib/__tests__/doctor-spawn-capability.test.js +0 -116
- package/lib/__tests__/doctor-timeout-partial.test.js +0 -79
- package/lib/__tests__/doctor-tool-delegation.test.js +0 -156
- package/lib/__tests__/doctor-tui-skill-freshness.test.js +0 -385
- package/lib/__tests__/doctor.test.js +0 -1320
- package/lib/__tests__/find-bash-wsl.test.js +0 -121
- package/lib/__tests__/flaky.test.js +0 -128
- package/lib/__tests__/foreign-hooks-global.test.js +0 -125
- package/lib/__tests__/gate-audit-skip.test.ts +0 -81
- package/lib/__tests__/gate-audit.test.ts +0 -440
- package/lib/__tests__/gate-coverage-hook-floor.test.js +0 -94
- package/lib/__tests__/gate-coverage.test.js +0 -204
- package/lib/__tests__/gate-entry-provenance.test.js +0 -71
- package/lib/__tests__/gate-numbering.test.js +0 -79
- package/lib/__tests__/gate-rules.test.js +0 -58
- package/lib/__tests__/gate-runner-tsx-invocation.test.js +0 -149
- package/lib/__tests__/gate-runner-verdict.test.js +0 -105
- package/lib/__tests__/gate-runner.test.js +0 -371
- package/lib/__tests__/gate2-verdict.test.js +0 -183
- package/lib/__tests__/helpers/lib-sandbox.cjs +0 -55
- package/lib/__tests__/hook-health-path.test.js +0 -109
- package/lib/__tests__/hook-health.test.js +0 -85
- package/lib/__tests__/init-gitignore.test.js +0 -204
- package/lib/__tests__/init-gitleaks-notice.test.js +0 -57
- package/lib/__tests__/init.test.js +0 -530
- package/lib/__tests__/install-cmd.test.js +0 -6
- package/lib/__tests__/install-sh-deploy-manifest.test.js +0 -80
- package/lib/__tests__/install-skill-full-dir.test.js +0 -194
- package/lib/__tests__/install-skill.test.js +0 -416
- package/lib/__tests__/install-tools-repair.test.js +0 -263
- package/lib/__tests__/issue-519-phase-transition-guard.test.js +0 -233
- package/lib/__tests__/issue-566-sync-hooks-backup.test.js +0 -228
- package/lib/__tests__/issue-583-hook-deploy-log.test.js +0 -121
- package/lib/__tests__/issue-586-principles-cmdline.test.js +0 -218
- package/lib/__tests__/issue-589-check-all-gate3.test.js +0 -190
- package/lib/__tests__/issue-590-archlint-vacuous-pass.test.js +0 -138
- package/lib/__tests__/issue-618-gate-not-run.test.js +0 -100
- package/lib/__tests__/jscpd-entry-resolution.test.js +0 -143
- package/lib/__tests__/language-capability.test.js +0 -318
- package/lib/__tests__/language-tools-build-file-install.test.js +0 -82
- package/lib/__tests__/language-tools-detect.test.js +0 -301
- package/lib/__tests__/migrate.test.js +0 -232
- package/lib/__tests__/mirror-manifest.test.js +0 -64
- package/lib/__tests__/mirror-sync.test.js +0 -803
- package/lib/__tests__/next-sprint.test.js +0 -231
- package/lib/__tests__/npm-package.test.js +0 -140
- package/lib/__tests__/phase-transition.test.js +0 -1136
- package/lib/__tests__/principles-csharp-coverage.test.js +0 -227
- package/lib/__tests__/principles-directory.test.js +0 -87
- package/lib/__tests__/qoder-delphi-agents.test.js +0 -316
- package/lib/__tests__/retro-gate-m.test.js +0 -144
- package/lib/__tests__/retro.test.js +0 -131
- package/lib/__tests__/rework.test.js +0 -127
- package/lib/__tests__/rollback.test.js +0 -183
- package/lib/__tests__/runtime-journal.test.js +0 -164
- package/lib/__tests__/sastd-client.test.js +0 -514
- package/lib/__tests__/shared-paths-lazy-home.test.js +0 -67
- package/lib/__tests__/shared-paths.test.js +0 -130
- package/lib/__tests__/shared-utils-copyHooks-manifest.test.js +0 -69
- package/lib/__tests__/shared-utils.test.js +0 -180
- package/lib/__tests__/skill-flags.test.js +0 -48
- package/lib/__tests__/slo.test.js +0 -89
- package/lib/__tests__/sprint-audit.test.js +0 -207
- package/lib/__tests__/sprint-discovery.test.ts +0 -366
- package/lib/__tests__/sprint-state-manager.test.js +0 -310
- package/lib/__tests__/sprint-status-rework-704.test.js +0 -149
- package/lib/__tests__/sprint-status-rework.test.js +0 -329
- package/lib/__tests__/sprint-status.test.js +0 -193
- package/lib/__tests__/sprint-status.test.ts +0 -213
- package/lib/__tests__/test-alignment-java-702.test.ts +0 -177
- package/lib/__tests__/test-alignment-range-guard.test.ts +0 -82
- package/lib/__tests__/test-alignment.test.ts +0 -853
- package/lib/__tests__/tool-audit-collect.test.js +0 -184
- package/lib/__tests__/tool-audit-fixtures.js +0 -87
- package/lib/__tests__/tool-audit-latest.test.js +0 -84
- package/lib/__tests__/tool-audit.test.js +0 -428
- package/lib/__tests__/tsconfig.json +0 -8
- package/lib/__tests__/tsx-resolution.test.js +0 -89
- package/lib/__tests__/ui-detector.test.ts +0 -459
- package/lib/__tests__/ui-review.test.ts +0 -132
- package/lib/__tests__/uninstall-global-residue.test.js +0 -545
- package/lib/__tests__/uninstall-skill.test.js +0 -189
- package/lib/__tests__/uninstall.test.js +0 -717
- package/lib/__tests__/update-hooks.test.js +0 -737
- package/lib/__tests__/update-skill-flags.test.js +0 -78
- package/lib/__tests__/update-skill.test.js +0 -644
- package/lib/__tests__/upgrade-exec.test.js +0 -273
- package/lib/__tests__/upgrade-skill-sync.test.js +0 -65
- package/lib/__tests__/upgrade.test.js +0 -78
- package/lib/__tests__/windows-bash-probe.test.js +0 -123
- package/lib/check-alignment-runner.cjs +0 -97
- package/lib/coverage-total.sh +0 -92
- package/lib/layer-baseline.cjs +0 -94
- package/lib/mattpocock-license-verdict.json +0 -7
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
# TODO — WSL 迁移后状态
|
|
2
|
+
|
|
3
|
+
最近更新:2026-11-23(WSL2 + Ubuntu 22.04 环境首次全量验证)
|
|
4
|
+
上一版:2026-11-22(Windows 11 环境遗留事项)
|
|
5
|
+
|
|
6
|
+
读完这份文档就能接着干活。每条都标了「是否已验证」——**没验证的不要当成结论**。
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## 迁移后基线(2026-11-23 实测,WSL2 + Node 26.13.1 + xp-gate 0.38.125)
|
|
11
|
+
|
|
12
|
+
| 指标 | 迁移前(Windows) | 迁移后(WSL 首次) | 本次修复后 | 门槛 |
|
|
13
|
+
|---|---|---|---|---|
|
|
14
|
+
| 测试数 | 196 | 196 | **215** | — |
|
|
15
|
+
| 项目行覆盖 | 90.66% | 89.91% | **92.60%** | 80% |
|
|
16
|
+
| `gatecheck.mjs` | 70.34% | 70.34% | **94.14%** | — |
|
|
17
|
+
| `proc.mjs` | 75.23% | **64.68%** ↓ | **78.57%** | — |
|
|
18
|
+
| 最差文件 | `coverage.mjs` 67.86% | 同 | 同 | 80% |
|
|
19
|
+
| 函数复杂度 | 707 个全部 ≤ CCN 5 | 686 全合规 | **735 全合规** | 5 |
|
|
20
|
+
| 变异测试 | 19/19 | 19/19 | 19/19 | 全捕获 |
|
|
21
|
+
| 重复代码 | 0 clones | 0 clones | 0 clones | — |
|
|
22
|
+
| `xp-gate check . --all` | — | 10 passed / 9 skipped | 10 passed / 9 skipped | — |
|
|
23
|
+
| Gate 4 违规 | 78 条(58 INFO + 14 WARNING 等) | 21 WARNING | 21 WARNING(无新增) | — |
|
|
24
|
+
|
|
25
|
+
**注意 `proc.mjs` 那行**:迁移后覆盖率从 75.23% **掉到** 64.68%,这不是环境波动,是确定的回归——
|
|
26
|
+
Windows 分支在 Linux 上根本走不到。这正是 TODO-3 要解决的问题,见下文。
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## 本次已完成
|
|
31
|
+
|
|
32
|
+
### ✅ 环境搭建(WSL2)
|
|
33
|
+
|
|
34
|
+
- Node 26.13.1(nvm,`~/.npm-global/bin/node` 软链)、npm 11.20.0。
|
|
35
|
+
- xp-gate 0.38.125,Linux native 路径 `/home/bull/.npm-global/bin/xp-gate`。
|
|
36
|
+
- 所有门禁工具均在 Linux 侧解析(逐一 `which -a` 确认首条不是 `/mnt/c`):
|
|
37
|
+
`jscpd` `lizard` `checkov` `hadolint` `gitleaks` `semgrep` `jq`。
|
|
38
|
+
- 仓库在 Linux 原生路径,`git config core.autocrlf input`,无 CRLF 文件。
|
|
39
|
+
|
|
40
|
+
**修复了两个真实的 Windows→WSL 残留问题:**
|
|
41
|
+
|
|
42
|
+
1. `~/.zshrc:107` 硬编码了约 62 条 `/mnt/c` 的 Windows PATH 快照。`.bashrc` / `.profile`
|
|
43
|
+
已有 `__xp_gate_strip_mnt` 守卫,`.zshrc` 漏了。已替换为同样的守卫逻辑
|
|
44
|
+
(`path=(${path:#/mnt/*})`)。现新开 zsh 的 `PATH` 中 `/mnt` 条目为 0。
|
|
45
|
+
*症状本该是*:Windows shim 能被解析但执行失败(rc=126),门禁 probe 假通过。
|
|
46
|
+
|
|
47
|
+
2. **semgrep 完全不可用**(不是慢,是坏的),两个独立故障叠加:
|
|
48
|
+
- ocaml 主程序 `execvp pysemgrep` 找不到 —— `pysemgrep` 在 `~/.local/bin`,
|
|
49
|
+
而 ocaml 靠 PATH 查找。
|
|
50
|
+
- `pysemgrep` 加载到系统旧版 `zope.interface` 崩溃:
|
|
51
|
+
`InvalidInterface: Concrete attribute, __firstlineno__`。
|
|
52
|
+
根因是 `/usr/lib/python3/dist-packages/zope.interface-5.4.0-nspkg.pth` 在
|
|
53
|
+
`site` 启动时把 3.10 时代的 `zope` 命名空间抢先注册进 `sys.modules`,
|
|
54
|
+
用户 site 里的新版永远抢不过来。
|
|
55
|
+
- 修法:`~/.local/bin/pysemgrep` 改成 `#!/usr/bin/python3.14 -S`,跳过该 `.pth`,
|
|
56
|
+
再显式把 `zope` 命名空间指向用户 site(系统 dist-packages 保留作后备,
|
|
57
|
+
因为 `idna` 等只在系统侧有)。**未改动任何系统文件。**
|
|
58
|
+
- 现 `semgrep --version` → `1.186.0`。
|
|
59
|
+
|
|
60
|
+
### ✅ TODO-1 `proc.mjs` 的 shim 版本探测 —— 自然修复,已关闭
|
|
61
|
+
|
|
62
|
+
WSL 下 `which jscpd` 返回真实可执行文件:
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
{"path":"/home/bull/.npm-global/bin/jscpd","version":"jscpd 5.4.3"}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
`version` 非空,符合迁移前的预期(Linux 没有 `.cmd` shim)。无需改代码。
|
|
69
|
+
|
|
70
|
+
### 🔴 TODO-4 Gate 12 EOF 换行误报 —— **已定位根因,是上游缺陷,未关闭**
|
|
71
|
+
|
|
72
|
+
迁移前记录的误报在 0.38.125 上**只修了一半**。旧实现(`$(...)` 捕获内容、命令替换吃掉
|
|
73
|
+
结尾换行)确实修了,但还剩一个独立的缺陷:**只在含非 ASCII 字符的文件上发作**。
|
|
74
|
+
|
|
75
|
+
#### 根因(已实测到具体机制)
|
|
76
|
+
|
|
77
|
+
`~/.config/xp-gate/hooks/lib/gate-12-blob-scan.awk` 用 `git cat-file --batch` 报告的
|
|
78
|
+
**字节数** 来切分 blob,却用 `length($0)` 计算每行长度:
|
|
79
|
+
|
|
80
|
+
```awk
|
|
81
|
+
n = length(body) + 1 # 在 UTF-8 locale 下这是「字符数」,不是字节数
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
当 `LANG=C.UTF-8`(本机默认)时,`length()` 返回字符数;含中文的行字符数 < 字节数,
|
|
85
|
+
于是 `remaining` 永远减不到 0,`ends_nl` 被置 0 → 误报 `NOEOF`。
|
|
86
|
+
|
|
87
|
+
实测同一文件:
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
LC_ALL=C awk '{...}' -> 长度 14 / 9 / 12 (正确,字节)
|
|
91
|
+
awk '{...}' -> 长度 6 / 3 / 4 (字符)
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
#### 最小复现(已建,隔离环境)
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
ascii.md 结尾 0a -> 默认 locale 下 不报 ✅
|
|
98
|
+
chinese.md 结尾 0a -> 默认 locale 下 报 NOEOF ❌(误报)
|
|
99
|
+
两者在 LC_ALL=C 下都不报 ✅
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
**对照组仍有效**:把中文文件真的改成不带结尾换行,`LC_ALL=C` 下依然正确报 `NOEOF`。
|
|
103
|
+
所以这是误报的修复空间,不是检测能力问题。
|
|
104
|
+
|
|
105
|
+
#### 这也解释了迁移前「偶发」的观感
|
|
106
|
+
|
|
107
|
+
`tests/tools-leaf.test.mjs` / `scripts/lib/tools.mjs` 是纯 ASCII,当时没稳定复现;
|
|
108
|
+
一旦提交带中文的文档(如本文件)就必然中招。
|
|
109
|
+
|
|
110
|
+
#### 影响与现状
|
|
111
|
+
|
|
112
|
+
- Gate 12 是 WARN 不阻塞,代价是**每个含中文的提交都有一条噪声告警**。
|
|
113
|
+
- 本项目 `TODO.md` / `README.md` 都是中文,所以这条会持续出现。
|
|
114
|
+
- 规避:`LC_ALL=C git commit ...`(不改任何文件,已验证可消除误报)。
|
|
115
|
+
|
|
116
|
+
#### 待办
|
|
117
|
+
|
|
118
|
+
- [ ] 给 xp-gate 提 issue(**用户自己提,不提 PR**):awk 扫描器需 `LC_ALL=C`
|
|
119
|
+
或在 `BEGIN` 里设置字节语义。
|
|
120
|
+
- [ ] 决定是否长期用 `LC_ALL=C git commit` 规避。这是**使用决策**,未擅自更改全局配置。
|
|
121
|
+
|
|
122
|
+
### ✅ TODO-5 Gate 2 / jscpd —— WSL 下可测
|
|
123
|
+
|
|
124
|
+
`xp-gate check . --all` 的 Gate 2 输出 `Found 0 clones`,不再 `UNMEASURABLE`。
|
|
125
|
+
Linux 上不存在 `.cmd` shim / `npx ENOENT` 问题。(上游 `lib/gate-runner.js` 的
|
|
126
|
+
Windows 缺陷仍在,但只在 Windows 上发作。)
|
|
127
|
+
|
|
128
|
+
### ✅ TODO-6 Node 版本策略 —— 成立
|
|
129
|
+
|
|
130
|
+
- Node **26.13.1**(非奇数版),符合「只用一个 Node 26,不上版本管理器」的既有决定。
|
|
131
|
+
- `npm test` 在 Linux 上 **215/215 通过**(迁移时 196/196 已通过)。
|
|
132
|
+
- 无 CRLF 文件;`parseLizardCsv handles CRLF output` 仍有效(它测的是解析器对 CRLF
|
|
133
|
+
的容忍,与平台无关)。
|
|
134
|
+
- pre-commit hook 在 WSL 下正常执行(上表 Gate 12 即为实证)。
|
|
135
|
+
|
|
136
|
+
### ✅ TODO-3 平台判断抽成可注入参数(用户选定方案)
|
|
137
|
+
|
|
138
|
+
`proc.mjs` 新增 `withPlatform(platform, fn)`:在调用期间临时遮蔽
|
|
139
|
+
`process.platform`,`finally` 中还原原 descriptor(回调抛异常也不会泄漏)。
|
|
140
|
+
|
|
141
|
+
顺带把两处硬编码抽成可测函数:
|
|
142
|
+
|
|
143
|
+
- `firstExisting` / `isWindowsShim` 改为导出。
|
|
144
|
+
- `parseWhichOutput(stdout, exists)` —— `where` 输出解析,含 CRLF 容忍与
|
|
145
|
+
「跳过不可执行的首行」逻辑(正是迁移前 jscpd 那条 bug 的机制)。
|
|
146
|
+
- `probe` 的 comspec 与 `spawnOpts` 现在尊重 `opts.env`(此前被强制覆盖,
|
|
147
|
+
导致 comspec 分支无法注入测试)。
|
|
148
|
+
|
|
149
|
+
覆盖率:`proc.mjs` 64.68% → **78.57%**。**Windows 分支现在在 Linux 上也能测。**
|
|
150
|
+
|
|
151
|
+
### ✅ TODO-2 补 `gatecheck.mjs` 覆盖率
|
|
152
|
+
|
|
153
|
+
70.34% → **94.14%**(函数覆盖 40% → 85.71%)。
|
|
154
|
+
|
|
155
|
+
新增的是执行路径测试(`runCase` / `measure` / `erroredCase` / `evaluateCase` /
|
|
156
|
+
`auditGates`):用不存在的 gate id 驱动,spawn 路径真实、断言只针对本模块的记账逻辑。
|
|
157
|
+
其中一条专门守住临时仓库清理——`runCase` 抛异常时若 `finally` 失效,`/tmp` 会被
|
|
158
|
+
`xgr-gate-*` 塞满。
|
|
159
|
+
|
|
160
|
+
> 记账部分(`summarize`)**原本就有测试**,见 `tests/gatecheck-audit.test.mjs`。
|
|
161
|
+
> 第一轮我重复写了一组,已回滚——测试通过即说明在测已有行为。
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
## 仍未完成 / 需要决策
|
|
166
|
+
|
|
167
|
+
### ✅ TODO-7 CI 三线矩阵 —— 已验证全绿
|
|
168
|
+
|
|
169
|
+
`a04cf45` 推送后 CI run `45140237662` 全绿:
|
|
170
|
+
|
|
171
|
+
```
|
|
172
|
+
tests (node 22) success
|
|
173
|
+
tests (node 24) success
|
|
174
|
+
tests (node 26) success
|
|
175
|
+
complexity of .mjs sources success
|
|
176
|
+
mutation gate success
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
### `proc.mjs` 剩余 21.43% —— 可接受
|
|
180
|
+
|
|
181
|
+
剩余未覆盖是 `readRegPath` / `expandRegistryPath` / `registry PATH 合并`:
|
|
182
|
+
这些要读真实 Windows 注册表,`withPlatform` 也只能骗过 `platform` 判断,
|
|
183
|
+
骗不过「`C:\Windows\System32\reg.exe` 在 Linux 上不存在」。要覆盖它们得再抽一层
|
|
184
|
+
可注入的 `spawnSync`,收益低于成本,**建议接受现状**。
|
|
185
|
+
|
|
186
|
+
### 外部 issue 状态(2026-11-23 复核)
|
|
187
|
+
|
|
188
|
+
| # | 标题 | 状态 | 依据 |
|
|
189
|
+
|---|---|---|---|
|
|
190
|
+
| 5 | jscpd 版本恒为 `?` | **CLOSED** | WSL 下 `toolVersion` 返回 `jscpd 5.4.3`;根因是 Windows 专属的无扩展名 shim,Linux 用符号链接 |
|
|
191
|
+
| 4 | OpenCode 被自激判活 | **OPEN(有意保留)** | 本机不复现(CLI 证据命中),但 `idleDays` 读目录 mtime 的机制未改;实测 `idleDays` 仅 5 天,CLI 一消失就会误判 |
|
|
192
|
+
| 1 2 3 | — | CLOSED | — |
|
|
193
|
+
|
|
194
|
+
**#4 为何不关**:按"不复现就关闭"处理等于掩盖。已在 issue 内附实测证据与收口建议。
|
|
195
|
+
顺带修正了 issue 表述:`probeLiveness` 是短路求值,"自激"只在第二级(CLI)为假时成立。
|
|
196
|
+
|
|
197
|
+
### 本轮已清理的技术债
|
|
198
|
+
|
|
199
|
+
- **3 条未使用导入**已删(`hp-gate.mjs: fs`、`preflight.mjs: gitConfig`、`verify.mjs: item`),
|
|
200
|
+
逐条人工确认仅出现在 import 语句本身。
|
|
201
|
+
- **10 处 GitHub Actions 可变 tag → 钉 SHA**(`checkout@v4` / `setup-node@v4` /
|
|
202
|
+
`setup-python@v5`)。注意 `checkout@v4` 与 `setup-node@v4` 当时解析到的是
|
|
203
|
+
release 分支的 tip,即"tag 指向的内容"与"实际运行的内容"并不绑定。钉后
|
|
204
|
+
`semgrep --config=auto` 从 10 findings 降到 **0**。
|
|
205
|
+
|
|
206
|
+
### TODO-4 上游归档
|
|
207
|
+
|
|
208
|
+
**不要**按「已修复」留言——它在 0.38.125 上仍可复现(见上文根因与最小复现)。
|
|
209
|
+
这是一条**新的、可提交的缺陷报告**:`gate-12-blob-scan.awk` 混用字节数与字符数。
|
|
210
|
+
按既有规则:用户自己提 issue,不提 PR。
|
|
211
|
+
|
|
212
|
+
### 用户已明确不做的事
|
|
213
|
+
|
|
214
|
+
- **不向 xp-gate 提 PR**:用户自己在 XPGATE 仓库里修。只提 issue / 加评论 / 重开 issue。
|
|
215
|
+
- Gate 4 的魔数 INFO 违规:**判定为噪声,不修**。
|
|
216
|
+
|
|
217
|
+
---
|
|
218
|
+
|
|
219
|
+
## 环境速查(WSL2)
|
|
220
|
+
|
|
221
|
+
```bash
|
|
222
|
+
# 依赖:零第三方依赖,不需要 npm install
|
|
223
|
+
node --version # v26.13.1
|
|
224
|
+
|
|
225
|
+
# 门禁工具
|
|
226
|
+
which -a jscpd lizard checkov hadolint gitleaks semgrep jq # 首条必须是 Linux 路径
|
|
227
|
+
|
|
228
|
+
# xp-gate 本体
|
|
229
|
+
xp-gate --version # 0.38.125
|
|
230
|
+
|
|
231
|
+
# 全量检查
|
|
232
|
+
npm test && npm run coverage && npm run hp-gate && npm run mutation
|
|
233
|
+
npx --no-install jscpd --min-lines 5 --min-tokens 50 tests/*.mjs scripts/lib/*.mjs
|
|
234
|
+
xp-gate check . --all
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
已知限制(实测,非推测):
|
|
238
|
+
|
|
239
|
+
- `semgrep` 依赖 `~/.local/bin/pysemgrep` 这个定制 wrapper **必须在 PATH 上**,
|
|
240
|
+
因为 ocaml 主程序靠 `execvp` 找它。若把 `~/.local/bin` 移出 PATH,semgrep 立刻
|
|
241
|
+
回到 `execvp pysemgrep` 报错。
|
|
242
|
+
- `xp-gate check . --all` 里 Gate 0/1/5/9/11/12/12b/12c/13 无法从 CLI 调用
|
|
243
|
+
(`git commit` 时才跑)。**别把「CLI 显示 skipped」当成「门禁通过了」。**
|
|
244
|
+
- Gate 3 / Gate 10 的扩展名正则不含 `mjs`/`cjs`(上游缺陷),本项目纯 ESM,
|
|
245
|
+
所以 Gate 3 在 xp-gate 眼里整棵树不存在 —— 复杂度由 `npm run hp-gate` 独立兜底。
|
|
246
|
+
|
|
247
|
+
已知的项目约定:
|
|
248
|
+
|
|
249
|
+
- **`coverage/` 必须跟踪**,不要加进 `.gitignore`。Gate 5 从 **commit** 读
|
|
250
|
+
`coverage/coverage-summary.json`,忽略它会让地板线无法测量、每个 commit 都被
|
|
251
|
+
`not found` 拦住。跑完 `npm run coverage` 后要连同代码一起提交。
|
|
252
|
+
- 项目零依赖,**不要引入测试框架**(`node:test` 够用)。
|
|
253
|
+
- `git config core.autocrlf input` 已设置,保持。
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
2.0.2
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "reinstall-xp-gate",
|
|
3
|
+
"version": "2.0.2",
|
|
4
|
+
"private": true,
|
|
5
|
+
"description": "Agent skill: clean cross-agent reinstall of xp-gate with real verification of skills, plugins and hooks.",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"engines": {
|
|
9
|
+
"node": ">=22.0.0"
|
|
10
|
+
},
|
|
11
|
+
"scripts": {
|
|
12
|
+
"test": "node --test tests/*.test.mjs",
|
|
13
|
+
"test:watch": "node --test --watch tests/*.test.mjs",
|
|
14
|
+
"coverage": "node scripts/coverage.mjs",
|
|
15
|
+
"install-skill": "node scripts/install.mjs",
|
|
16
|
+
"preflight": "node scripts/preflight.mjs",
|
|
17
|
+
"reinstall": "node scripts/reinstall.mjs",
|
|
18
|
+
"verify": "node scripts/verify.mjs",
|
|
19
|
+
"audit": "node scripts/audit.mjs",
|
|
20
|
+
"hp-gate": "node scripts/hp-gate.mjs",
|
|
21
|
+
"mutation": "node scripts/mutation.mjs"
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"SKILL.md",
|
|
25
|
+
"scripts",
|
|
26
|
+
"tests"
|
|
27
|
+
]
|
|
28
|
+
}
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Standalone gate audit: answer "are the gates still effective right now"
|
|
4
|
+
* without reinstalling anything.
|
|
5
|
+
*
|
|
6
|
+
* `reinstall.mjs` was previously the only entry point, which meant the only way
|
|
7
|
+
* to ask whether the gates still block was to tear down and rebuild the
|
|
8
|
+
* installation. Those are different questions and should not share a command.
|
|
9
|
+
*
|
|
10
|
+
* Three layers, reported separately:
|
|
11
|
+
* 1. Static parity -- are the skills/plugins/hooks on disk the right ones
|
|
12
|
+
* (delegated to verify.mjs, unchanged)
|
|
13
|
+
* 2. Gray box -- do the gates actually reject a planted defect
|
|
14
|
+
* (lib/gatecheck.mjs; this is the part verify.mjs never had)
|
|
15
|
+
* 3. Blind spots -- sources xp-gate's own extension lists cannot see
|
|
16
|
+
* (hp-gate.mjs; xp-gate#732)
|
|
17
|
+
*
|
|
18
|
+
* Exit 1 if any layer fails, so it is usable as CI.
|
|
19
|
+
*
|
|
20
|
+
* Usage:
|
|
21
|
+
* node scripts/audit.mjs # all three layers
|
|
22
|
+
* node scripts/audit.mjs --static # parity only, no gate execution
|
|
23
|
+
* node scripts/audit.mjs --gates # gray box + blind spots only
|
|
24
|
+
* node scripts/audit.mjs --json
|
|
25
|
+
*/
|
|
26
|
+
import { spawnSync } from 'node:child_process';
|
|
27
|
+
import path from 'node:path';
|
|
28
|
+
import { fileURLToPath } from 'node:url';
|
|
29
|
+
|
|
30
|
+
import { auditGates } from './lib/gatecheck.mjs';
|
|
31
|
+
import { item, section, table, MARK } from './lib/report.mjs';
|
|
32
|
+
|
|
33
|
+
const here = path.dirname(fileURLToPath(import.meta.url));
|
|
34
|
+
const argv = process.argv.slice(2);
|
|
35
|
+
const has = (flag) => argv.includes(flag);
|
|
36
|
+
|
|
37
|
+
if (has('--help') || has('-h')) {
|
|
38
|
+
console.log(`Usage: node scripts/audit.mjs [--static] [--gates] [--json]
|
|
39
|
+
|
|
40
|
+
--static Only check on-disk parity (skills, plugins, hooks)
|
|
41
|
+
--gates Only check that gates block planted defects, and that the
|
|
42
|
+
.mjs blind spot xp-gate#732 leaves open is still covered
|
|
43
|
+
--json Machine-readable output
|
|
44
|
+
|
|
45
|
+
Exit code 1 if any check fails.`);
|
|
46
|
+
process.exit(0);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const wantStatic = !has('--gates');
|
|
50
|
+
const wantGates = !has('--static');
|
|
51
|
+
|
|
52
|
+
/** One script run, JSON out. Shared by the parity and blind-spot layers. */
|
|
53
|
+
function runScriptJson(script, args) {
|
|
54
|
+
const r = spawnSync(process.execPath, [path.join(here, script), ...args], {
|
|
55
|
+
encoding: 'utf8',
|
|
56
|
+
maxBuffer: 32 * 1024 * 1024,
|
|
57
|
+
});
|
|
58
|
+
const raw = String(r.stdout || '');
|
|
59
|
+
const start = raw.indexOf('{');
|
|
60
|
+
if (start < 0) return { error: (r.stderr || raw).slice(0, 300) };
|
|
61
|
+
try {
|
|
62
|
+
return JSON.parse(raw.slice(start));
|
|
63
|
+
} catch (error) {
|
|
64
|
+
return { error: `${script} output not parseable: ${error.message}` };
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function runStatic() {
|
|
69
|
+
// verify.mjs already knows how to compare the installed tree; reuse it via
|
|
70
|
+
// its --json mode rather than duplicating the parity logic here.
|
|
71
|
+
const out = runScriptJson('verify.mjs', ['--quick', '--json']);
|
|
72
|
+
if (out.error) return { ok: false, checks: [], error: out.error };
|
|
73
|
+
return out;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function printStatic(staticResult) {
|
|
77
|
+
section('Layer 1 — on-disk parity');
|
|
78
|
+
if (staticResult.error) {
|
|
79
|
+
item(MARK.FAIL, `verify.mjs did not produce results: ${staticResult.error}`);
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
const markFor = { FAIL: MARK.FAIL, WARN: MARK.WARN, SKIP: MARK.SKIP };
|
|
83
|
+
for (const c of staticResult.checks) {
|
|
84
|
+
item(markFor[c.status] || MARK.PASS, `${c.name}: ${c.detail}`);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function printGates(gates) {
|
|
89
|
+
section('Layer 2 — do the gates actually block');
|
|
90
|
+
console.log(' Each case runs twice: a clean tree (control) and the same tree with');
|
|
91
|
+
console.log(' a defect planted. A gate is trustworthy only if it separates them.\n');
|
|
92
|
+
table(
|
|
93
|
+
['Gate', 'Clean', 'Planted', 'Verdict'],
|
|
94
|
+
gates.cases.map((c) => [String(c.id), c.cleanVerdict, c.dirtyVerdict, verdictLabel(c)]),
|
|
95
|
+
);
|
|
96
|
+
const s = gates.summary;
|
|
97
|
+
console.log('');
|
|
98
|
+
if (s.invalid) {
|
|
99
|
+
item(MARK.WARN, `${s.invalid} case(s) unmeasurable: the control tree itself was blocked, so nothing can be concluded about the planted defect`);
|
|
100
|
+
}
|
|
101
|
+
if (s.failed) item(MARK.FAIL, `${s.failed}/${s.total} gate case(s) did not block a planted defect`);
|
|
102
|
+
else if (s.ok) item(MARK.PASS, `${s.ok}/${s.total} gate case(s) blocked the planted defect and passed the control`);
|
|
103
|
+
if (s.knownGaps) item(MARK.WARN, `${s.knownGaps} case(s) are known upstream gaps, reported but not counted`);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function verdictLabel(c) {
|
|
107
|
+
if (c.knownGap) return 'KNOWN GAP';
|
|
108
|
+
if (c.measurementValid === false) return 'UNMEASURABLE';
|
|
109
|
+
return c.ok ? 'ok' : 'FAILED';
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/** The five worst violations, formatted for a one-line report. */
|
|
113
|
+
function topViolations(violations) {
|
|
114
|
+
return violations
|
|
115
|
+
.slice()
|
|
116
|
+
.sort((a, b) => b.ccn - a.ccn)
|
|
117
|
+
.slice(0, 5)
|
|
118
|
+
.map((v) => `${v.name}@${v.ccn} (${v.file})`);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Is a blind-spot report clean? Three independent ways to be dirty, kept as one
|
|
123
|
+
* named predicate so the report and the exit code cannot disagree.
|
|
124
|
+
*/
|
|
125
|
+
function blindSpotOk(raw) {
|
|
126
|
+
return !raw.scanBroken && (raw.violations || []).length === 0 && (raw.syntax || []).length === 0;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/** Project hp-gate's full JSON down to the numbers the audit prints. */
|
|
130
|
+
function summarizeHp(raw) {
|
|
131
|
+
if (raw.error) return { error: raw.error };
|
|
132
|
+
const violations = raw.violations || [];
|
|
133
|
+
return {
|
|
134
|
+
files: raw.files || 0,
|
|
135
|
+
threshold: raw.threshold,
|
|
136
|
+
functionCount: list(raw.allFunctions).length,
|
|
137
|
+
violationCount: violations.length,
|
|
138
|
+
syntaxErrorCount: list(raw.syntax).length,
|
|
139
|
+
scanBroken: Boolean(raw.scanBroken),
|
|
140
|
+
topViolations: topViolations(violations),
|
|
141
|
+
ok: blindSpotOk(raw),
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/** hp-gate always emits these arrays, but a partial report must not throw. */
|
|
146
|
+
function list(value) {
|
|
147
|
+
return Array.isArray(value) ? value : [];
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function printBlindSpot(hp) {
|
|
151
|
+
section("Layer 3 — sources xp-gate's own extension list cannot see");
|
|
152
|
+
if (hp.error) {
|
|
153
|
+
item(MARK.WARN, `hp-gate could not run: ${hp.error}`);
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
item(MARK.INFO, `${hp.files} .mjs/.cjs file(s), ${hp.functionCount} function(s) analysed by lizard`);
|
|
157
|
+
if (hp.scanBroken) {
|
|
158
|
+
item(MARK.FAIL, 'lizard returned no functions for a non-empty source set -- the scan is broken, not the code');
|
|
159
|
+
} else if (hp.violationCount) {
|
|
160
|
+
item(MARK.FAIL, `${hp.violationCount} function(s) above CCN ${hp.threshold}: ${hp.topViolations.join(', ')}`);
|
|
161
|
+
} else {
|
|
162
|
+
item(MARK.PASS, `every function within CCN ${hp.threshold}`);
|
|
163
|
+
}
|
|
164
|
+
if (hp.syntaxErrorCount) item(MARK.FAIL, `${hp.syntaxErrorCount} unparseable file(s)`);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
const result = { ok: true, static: null, gates: null, blindSpot: null };
|
|
168
|
+
|
|
169
|
+
if (wantStatic) {
|
|
170
|
+
result.static = runStatic();
|
|
171
|
+
if (!result.static.ok) result.ok = false;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
if (wantGates) {
|
|
175
|
+
result.gates = await auditGates();
|
|
176
|
+
if (!result.gates.summary.pass) result.ok = false;
|
|
177
|
+
|
|
178
|
+
result.blindSpot = summarizeHp(runScriptJson('hp-gate.mjs', ['--json']));
|
|
179
|
+
if (!result.blindSpot.ok) result.ok = false;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
if (has('--json')) {
|
|
183
|
+
console.log(JSON.stringify(result, null, 2));
|
|
184
|
+
process.exit(result.ok ? 0 : 1);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
if (result.static) printStatic(result.static);
|
|
188
|
+
if (result.gates) printGates(result.gates);
|
|
189
|
+
if (result.blindSpot) printBlindSpot(result.blindSpot);
|
|
190
|
+
|
|
191
|
+
console.log('');
|
|
192
|
+
item(result.ok ? MARK.PASS : MARK.FAIL, result.ok ? 'audit passed' : 'audit FAILED');
|
|
193
|
+
process.exit(result.ok ? 0 : 1);
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Write `coverage/coverage-summary.json` from Node's built-in coverage report.
|
|
4
|
+
*
|
|
5
|
+
* WHY THIS EXISTS
|
|
6
|
+
* ---------------
|
|
7
|
+
* xp-gate's Gate 5 refuses a JavaScript commit with
|
|
8
|
+
* "coverage/coverage-summary.json not found", because it expects the istanbul
|
|
9
|
+
* shape that vitest and jest emit. This repo deliberately has no test framework
|
|
10
|
+
* (`node:test` is built in, zero dependencies), so nothing ever produced that
|
|
11
|
+
* file and the gate blocked every commit on an artefact the project could never
|
|
12
|
+
* generate.
|
|
13
|
+
*
|
|
14
|
+
* The options were to add vitest purely to satisfy a file-shape expectation, or
|
|
15
|
+
* to translate what Node already measures. Node 24's `--experimental-test-coverage`
|
|
16
|
+
* prints real per-file line/branch/function percentages, so the measurement is
|
|
17
|
+
* not the problem -- only its format is. Translating keeps the zero-dependency
|
|
18
|
+
* property and gives the gate an actual number instead of a hand-written
|
|
19
|
+
* constant.
|
|
20
|
+
*
|
|
21
|
+
* Usage:
|
|
22
|
+
* node scripts/coverage.mjs # write the summary, exit 1 below floor
|
|
23
|
+
* node scripts/coverage.mjs --json # machine-readable
|
|
24
|
+
*/
|
|
25
|
+
import fs from 'node:fs';
|
|
26
|
+
import path from 'node:path';
|
|
27
|
+
import { fileURLToPath } from 'node:url';
|
|
28
|
+
import { spawnSync } from 'node:child_process';
|
|
29
|
+
|
|
30
|
+
const LINE_FLOOR = 80;
|
|
31
|
+
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
|
|
32
|
+
|
|
33
|
+
/** A coverage cell: digits with an optional decimal part. */
|
|
34
|
+
function isPct(cell) {
|
|
35
|
+
return /^\d+(\.\d+)?$/.test(cell);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Remove node's report decoration from the front of a line.
|
|
40
|
+
*
|
|
41
|
+
* Node 24 prefixes rows with the information emoji; node 22 uses tree glyphs
|
|
42
|
+
* (`#`, `├─`, `│`) and indentation instead. Stripping only the emoji left the
|
|
43
|
+
* file name reading `# tools.mjs` on CI -- the row parsed, nothing failed, but
|
|
44
|
+
* the "worst file" line named a file that does not exist. Both CI shapes are
|
|
45
|
+
* pinned by tests/coverage.test.mjs.
|
|
46
|
+
*/
|
|
47
|
+
export function stripDecoration(line) {
|
|
48
|
+
return String(line || '').replace(/^[\u2139\s\u2502\u251c\u2514\u2500#]+/, '').trim();
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Keep only lines that look like `name.mjs | 12.3 | ...`.
|
|
53
|
+
*
|
|
54
|
+
* The decoration is stripped first; without that the file name of every row
|
|
55
|
+
* keeps a prefix and reports a path that matches nothing on disk.
|
|
56
|
+
*/
|
|
57
|
+
export function reportLines(text) {
|
|
58
|
+
return String(text || '')
|
|
59
|
+
.split(/\r?\n/)
|
|
60
|
+
.map(stripDecoration)
|
|
61
|
+
.filter((line) => line.includes('|') && /\.mjs\b/.test(line));
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** One `file | line% | branch% | funcs% | ...` row, or null if it is not one. */
|
|
65
|
+
export function fileRow(line) {
|
|
66
|
+
const cells = line.split('|').map((c) => c.trim());
|
|
67
|
+
if (cells.length < 4) return null;
|
|
68
|
+
const [file, lines, branches, funcs] = cells;
|
|
69
|
+
// A blank cell must not become 0%: `Number('')` is 0, not NaN, so an empty
|
|
70
|
+
// directory header would enter the average as a fully uncovered file and drag
|
|
71
|
+
// the total down for a reason that has nothing to do with the code.
|
|
72
|
+
if (!isPct(lines)) return null;
|
|
73
|
+
return { file: file.trim(), lines: Number(lines), branches: Number(branches) || 0, funcs: Number(funcs) || 0 };
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** istanbul's per-file shape; Gate 5 reads `lines.pct` and nothing else. */
|
|
77
|
+
export function istanbulEntry(row) {
|
|
78
|
+
return {
|
|
79
|
+
lines: { pct: row.lines },
|
|
80
|
+
branches: { pct: row.branches },
|
|
81
|
+
functions: { pct: row.funcs },
|
|
82
|
+
statements: { pct: row.lines },
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/** Average each column across files; a flat mean is what the gate's floor uses. */
|
|
87
|
+
export function meanOf(rows) {
|
|
88
|
+
const avg = (pick) => Number((rows.reduce((s, r) => s + pick(r), 0) / rows.length).toFixed(2));
|
|
89
|
+
return istanbulEntry({ lines: avg((r) => r.lines), branches: avg((r) => r.branches), funcs: avg((r) => r.funcs) });
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/** Run the suite with coverage and return the parsed rows. */
|
|
93
|
+
function collect() {
|
|
94
|
+
const files = fs.readdirSync(path.join(root, 'tests'))
|
|
95
|
+
.filter((f) => f.endsWith('.test.mjs'))
|
|
96
|
+
.map((f) => path.join('tests', f));
|
|
97
|
+
const r = spawnSync(process.execPath, ['--experimental-test-coverage', '--test', ...files], {
|
|
98
|
+
cwd: root,
|
|
99
|
+
encoding: 'utf8',
|
|
100
|
+
maxBuffer: 64 * 1024 * 1024,
|
|
101
|
+
});
|
|
102
|
+
const out = `${r.stdout || ''}${r.stderr || ''}`;
|
|
103
|
+
return { rows: reportLines(out).map(fileRow).filter(Boolean), exitCode: r.status, out };
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function main() {
|
|
107
|
+
const { rows, exitCode, out } = collect();
|
|
108
|
+
if (rows.length === 0) {
|
|
109
|
+
// Zero rows is a broken measurement, not full coverage. Saying so is the
|
|
110
|
+
// whole lesson of scripts/hp-gate.mjs, where an empty parse read as a clean
|
|
111
|
+
// pass and reported a tree with a CCN-22 function as compliant.
|
|
112
|
+
console.error('coverage: node produced no per-file rows -- cannot report a percentage');
|
|
113
|
+
console.error(out.split(/\r?\n/).slice(-15).join('\n'));
|
|
114
|
+
process.exit(1);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
const worst = rows.reduce((a, b) => (a.lines <= b.lines ? a : b));
|
|
118
|
+
// Relative paths only: an absolute one buries this machine's temp directory in
|
|
119
|
+
// a committed artefact, and the gate reads `total` anyway.
|
|
120
|
+
const summary = { total: meanOf(rows), ...Object.fromEntries(rows.map((r) => [r.file, istanbulEntry(r)])) };
|
|
121
|
+
|
|
122
|
+
fs.mkdirSync(path.join(root, 'coverage'), { recursive: true });
|
|
123
|
+
fs.writeFileSync(path.join(root, 'coverage', 'coverage-summary.json'), `${JSON.stringify(summary, null, 2)}\n`);
|
|
124
|
+
|
|
125
|
+
if (process.argv.includes('--json')) {
|
|
126
|
+
console.log(JSON.stringify({ total: summary.total.lines.pct, worst, files: rows.length }, null, 2));
|
|
127
|
+
} else {
|
|
128
|
+
console.log(`coverage: ${rows.length} files, lines ${summary.total.lines.pct}%`
|
|
129
|
+
+ ` (floor ${LINE_FLOOR}%), worst ${worst.file} at ${worst.lines}%`);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// The test run itself failing must fail this step too; the coverage gate is not
|
|
133
|
+
// a substitute for the suite.
|
|
134
|
+
process.exit(exitCode !== 0 || summary.total.lines.pct < LINE_FLOOR ? 1 : 0);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// Importing this module must be side-effect free: tests/coverage.test.mjs needs
|
|
138
|
+
// the parsers, and a bare import used to re-run the whole suite as a child
|
|
139
|
+
// process, which the test runner reports as a recursive run() and fails.
|
|
140
|
+
if (process.argv[1] && fileURLToPath(import.meta.url) === path.resolve(process.argv[1])) main();
|