@boyingliu01/xp-gate 0.38.125 → 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 +45 -1
- package/adapters/gate-7.sh +15 -6
- package/adapters/python.sh +36 -38
- package/bin/xp-gate.js +35 -0
- package/build-integrity/gate-10-lines.ts +98 -0
- package/build-integrity/gate-10.ts +131 -117
- package/build-integrity/quote-masker.ts +17 -3
- package/gate-3.sh +45 -1
- package/gate-registry.sh +3 -1
- 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/deploy-manifest.sh +1 -0
- package/hooks/gate-3.sh +45 -1
- package/hooks/gate-entries/gate-1-entry.sh +44 -24
- package/hooks/gate-entries/gate-5-entry.sh +60 -20
- package/hooks/gate-entries/gate-6-entry.sh +15 -6
- package/hooks/gate-registry.sh +3 -1
- package/hooks/lib/gate-status.sh +164 -0
- package/hooks/lib/jscpd-run.sh +9 -1
- package/hooks/lib/native-path.sh +54 -0
- package/hooks/lib/toolchain-path.sh +38 -0
- package/hooks/lib/validate-code-walkthrough.cjs +324 -99
- package/hooks/pre-commit +52 -0
- package/hooks/pre-push +67 -7
- 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/deploy-manifest.js +1 -0
- package/lib/doctor-constants.js +43 -0
- package/lib/doctor-tool-checks.js +129 -0
- package/lib/doctor.js +2014 -1038
- package/lib/flaky.js +178 -79
- package/lib/gate-audit.ts +80 -0
- package/lib/gate-runner.js +115 -63
- package/lib/init.js +6 -0
- package/lib/language-capability-surfaces.js +75 -8
- package/lib/language-capability.js +3 -0
- package/lib/language-registry.js +608 -0
- package/lib/language-tools.js +679 -894
- 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-audit.js +729 -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/dsh/src/skills.test.ts +9 -0
- 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 -424
- 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__/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-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-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__/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 -291
- 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__/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,128 @@
|
|
|
1
|
+
import test from 'node:test';
|
|
2
|
+
import assert from 'node:assert/strict';
|
|
3
|
+
import fs from 'node:fs';
|
|
4
|
+
import path from 'node:path';
|
|
5
|
+
|
|
6
|
+
import { pruneBackups, BACKUP_KEEP } from '../scripts/lib/util.mjs';
|
|
7
|
+
import { classify } from '../scripts/lib/tools.mjs';
|
|
8
|
+
import { tmpDir } from './fixtures.mjs';
|
|
9
|
+
|
|
10
|
+
// pruneBackups bounds the backup directory every install grows. The bug it
|
|
11
|
+
// fixes was measured on this machine: 50 backups / 11 MB, dating back to v1.1.0,
|
|
12
|
+
// because nothing ever removed one. A pruner that deletes the WRONG entries is
|
|
13
|
+
// worse than no pruner, so the survivors are asserted, not just the count.
|
|
14
|
+
|
|
15
|
+
/** Create `<root>/<name>` directories, each holding a marker file. */
|
|
16
|
+
function seed(root, names) {
|
|
17
|
+
for (const name of names) {
|
|
18
|
+
fs.mkdirSync(path.join(root, name), { recursive: true });
|
|
19
|
+
fs.writeFileSync(path.join(root, name, 'marker.txt'), name);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
test('pruneBackups keeps the newest stamps per agent and removes the rest', (t) => {
|
|
24
|
+
const root = tmpDir(t);
|
|
25
|
+
const names = [
|
|
26
|
+
'DSH-20261110-174846',
|
|
27
|
+
'DSH-20261117-192150',
|
|
28
|
+
'DSH-20261120-225508',
|
|
29
|
+
'DSH-20261120-234926',
|
|
30
|
+
'DSH-20261121-072040',
|
|
31
|
+
];
|
|
32
|
+
seed(root, names);
|
|
33
|
+
|
|
34
|
+
const removed = pruneBackups(root, 3);
|
|
35
|
+
|
|
36
|
+
assert.deepEqual(removed.sort(), ['DSH-20261110-174846', 'DSH-20261117-192150']);
|
|
37
|
+
assert.deepEqual(fs.readdirSync(root).sort(), [
|
|
38
|
+
'DSH-20261120-225508',
|
|
39
|
+
'DSH-20261120-234926',
|
|
40
|
+
'DSH-20261121-072040',
|
|
41
|
+
]);
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
test('the cap is per agent, so one install run keeps every agent recoverable', (t) => {
|
|
45
|
+
// All nine agent copies are backed up with the same timestamp by a single
|
|
46
|
+
// install. A global cap of 3 would delete six of the backups that run had
|
|
47
|
+
// just written, so rolling one agent back would be impossible while its
|
|
48
|
+
// siblings survived -- the cap would be spent on simultaneity, not history.
|
|
49
|
+
const root = tmpDir(t);
|
|
50
|
+
const agents = ['CodeBuddy', 'DSH', 'DWS', 'Generic-agents', 'OpenCode', 'Qoder', 'Qoder-CN', 'Trae-CN', 'WorkBuddy'];
|
|
51
|
+
seed(root, agents.map((a) => `${a}-20261121-082907`));
|
|
52
|
+
|
|
53
|
+
assert.deepEqual(pruneBackups(root, 3), []);
|
|
54
|
+
assert.equal(fs.readdirSync(root).length, 9);
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
test('pruneBackups trims old runs of each agent independently', (t) => {
|
|
58
|
+
const root = tmpDir(t);
|
|
59
|
+
seed(root, [
|
|
60
|
+
'DSH-20261110-174846', 'DSH-20261117-192150', 'DSH-20261120-234926',
|
|
61
|
+
'WorkBuddy-20261111-101000', 'WorkBuddy-20261112-101000',
|
|
62
|
+
]);
|
|
63
|
+
|
|
64
|
+
const removed = pruneBackups(root, 1);
|
|
65
|
+
|
|
66
|
+
// Each label keeps its own newest entry; the busy label loses its older runs.
|
|
67
|
+
assert.deepEqual(removed.sort(), ['DSH-20261110-174846', 'DSH-20261117-192150', 'WorkBuddy-20261111-101000']);
|
|
68
|
+
assert.deepEqual(fs.readdirSync(root).sort(), ['DSH-20261120-234926', 'WorkBuddy-20261112-101000']);
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
test('pruneBackups sorts by the stamp in the name, not by mtime', (t) => {
|
|
72
|
+
// A restored or copied directory carries an mtime that says nothing about
|
|
73
|
+
// which backup is newer, so mtime ordering would delete the wrong one.
|
|
74
|
+
const root = tmpDir(t);
|
|
75
|
+
seed(root, ['WorkBuddy-20261120-234927', 'WorkBuddy-20261110-174846']);
|
|
76
|
+
const old = path.join(root, 'WorkBuddy-20261110-174846');
|
|
77
|
+
const now = new Date();
|
|
78
|
+
fs.utimesSync(old, now, now); // newest mtime, oldest stamp
|
|
79
|
+
|
|
80
|
+
assert.deepEqual(pruneBackups(root, 1), ['WorkBuddy-20261110-174846']);
|
|
81
|
+
assert.deepEqual(fs.readdirSync(root), ['WorkBuddy-20261120-234927']);
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
test('pruneBackups never touches a directory it does not recognise', (t) => {
|
|
85
|
+
// An operator's own directory under the same root must survive: this
|
|
86
|
+
// function deletes without a prompt, so "unknown shape" has to mean "leave
|
|
87
|
+
// alone", never "probably a backup".
|
|
88
|
+
const root = tmpDir(t);
|
|
89
|
+
seed(root, ['DSH-20261110-174846', 'DSH-20261111-174846', 'keep-me', 'notes', 'DSH-nodate']);
|
|
90
|
+
|
|
91
|
+
pruneBackups(root, 1);
|
|
92
|
+
|
|
93
|
+
const left = fs.readdirSync(root).sort();
|
|
94
|
+
assert.deepEqual(left, ['DSH-20261111-174846', 'DSH-nodate', 'keep-me', 'notes']);
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
test('pruneBackups is a no-op below the keep count or on a missing root', (t) => {
|
|
98
|
+
const root = tmpDir(t);
|
|
99
|
+
seed(root, ['DSH-20261110-174846']);
|
|
100
|
+
assert.deepEqual(pruneBackups(root, BACKUP_KEEP), []);
|
|
101
|
+
assert.equal(fs.readdirSync(root).length, 1);
|
|
102
|
+
|
|
103
|
+
assert.deepEqual(pruneBackups(path.join(root, 'does-not-exist')), []);
|
|
104
|
+
// keep < 1 would mean "delete everything"; refusing is safer than obeying.
|
|
105
|
+
seed(root, ['DSH-20261111-174846', 'DSH-20261112-174846', 'DSH-20261113-174846']);
|
|
106
|
+
assert.deepEqual(pruneBackups(root, 0), []);
|
|
107
|
+
assert.equal(fs.readdirSync(root).length, 4);
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
test('classify survives the (value, index, array) shape map passes', async () => {
|
|
111
|
+
// Regression: `rows.map(classify)` hands classify (value, index, array), so
|
|
112
|
+
// the index landed in the `lookup` parameter and every call threw
|
|
113
|
+
// "lookup is not a function". This test drives classify through map with a
|
|
114
|
+
// fake lookup instead of calling toolReport(), which would shell out to npm,
|
|
115
|
+
// pip and the network for all 8 tools -- that probe is measured in seconds
|
|
116
|
+
// and hung this suite once.
|
|
117
|
+
const rows = [
|
|
118
|
+
{ present: true, kind: 'npm', version: '1.0.0', latest: '' },
|
|
119
|
+
{ present: true, kind: 'npm', version: '2.0.0', latest: '' },
|
|
120
|
+
];
|
|
121
|
+
const looked = [];
|
|
122
|
+
const lookup = async (row) => { looked.push(row.version); return '2.0.0'; };
|
|
123
|
+
|
|
124
|
+
const out = await Promise.all(rows.map((row) => classify(row, lookup)));
|
|
125
|
+
|
|
126
|
+
assert.deepEqual(out.map((r) => r.status), ['outdated', 'ok']);
|
|
127
|
+
assert.deepEqual(looked, ['1.0.0', '2.0.0'], 'lookup must be the function, not the index');
|
|
128
|
+
});
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import test from 'node:test';
|
|
2
|
+
import assert from 'node:assert/strict';
|
|
3
|
+
|
|
4
|
+
import { reportLines, fileRow, istanbulEntry, stripDecoration } from '../scripts/coverage.mjs';
|
|
5
|
+
|
|
6
|
+
// These pin the translation between Node's textual coverage report and the
|
|
7
|
+
// istanbul artefact Gate 5 reads. Getting it wrong in the lenient direction
|
|
8
|
+
// reports 100% for a tree nothing measured -- the same failure as parsing zero
|
|
9
|
+
// lizard rows as "no complex functions".
|
|
10
|
+
|
|
11
|
+
/** Two real rows exactly as node 24 prints them, emoji prefix and all. */
|
|
12
|
+
const REAL = [
|
|
13
|
+
'\u2139 file | line % | branch % | funcs % | uncovered lines',
|
|
14
|
+
'\u2139 scripts | | | |',
|
|
15
|
+
'\u2139 lib | | | |',
|
|
16
|
+
'\u2139 ccn.mjs | 100.00 | 96.30 | 100.00 |',
|
|
17
|
+
'\u2139 tools.mjs | 43.33 | 100.00 | 15.79 | 35-38 40-42',
|
|
18
|
+
'\u2139 all files | 88.29 | 93.14 | 81.47 |',
|
|
19
|
+
];
|
|
20
|
+
|
|
21
|
+
test('reportLines keeps only per-file rows', () => {
|
|
22
|
+
// Directory headers (`lib |` with no number) and the summary separator must not
|
|
23
|
+
// become rows: they would contribute a phantom 0% file.
|
|
24
|
+
const rows = reportLines(REAL.join('\n')).map(fileRow).filter(Boolean);
|
|
25
|
+
assert.deepEqual(rows.map((r) => r.file), ['ccn.mjs', 'tools.mjs']);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
test('reportLines tolerates empty and malformed input', () => {
|
|
29
|
+
assert.deepEqual(reportLines(''), []);
|
|
30
|
+
assert.deepEqual(reportLines('no table here'), []);
|
|
31
|
+
assert.deepEqual(reportLines(null), []);
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
test('fileRow reads the three percentages in order', () => {
|
|
35
|
+
const row = fileRow(' tools.mjs | 43.33 | 100.00 | 15.79 | 35-38');
|
|
36
|
+
assert.deepEqual(row, { file: 'tools.mjs', lines: 43.33, branches: 100, funcs: 15.79 });
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
test('fileRow rejects a row whose percentage is not a number', () => {
|
|
40
|
+
// A column shift or a truncated line must be dropped, not read as 0%.
|
|
41
|
+
assert.equal(fileRow('lib | | | |'), null);
|
|
42
|
+
assert.equal(fileRow('ccn.mjs | n/a | n/a | n/a'), null);
|
|
43
|
+
assert.equal(fileRow('ccn.mjs'), null);
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
test('istanbulEntry emits the pct shape the gate reads', () => {
|
|
47
|
+
// Gate 5 reads `total.lines.pct`; the other three keys exist so a reader that
|
|
48
|
+
// asks for coverage other than lines gets a real number instead of undefined.
|
|
49
|
+
const entry = istanbulEntry({ lines: 88.29, branches: 93.14, funcs: 81.47 });
|
|
50
|
+
assert.equal(entry.lines.pct, 88.29);
|
|
51
|
+
assert.equal(entry.branches.pct, 93.14);
|
|
52
|
+
assert.equal(entry.functions.pct, 81.47);
|
|
53
|
+
assert.equal(entry.statements.pct, 88.29);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
test('stripDecoration handles both node report shapes', () => {
|
|
57
|
+
// CI runs node 22 while local dev here is node 24, and they decorate the table
|
|
58
|
+
// differently. Stripping only the emoji left "# tools.mjs" as a file name on
|
|
59
|
+
// CI: the row parsed and nothing failed, but the "worst file" line named a
|
|
60
|
+
// file that does not exist. Both shapes are pinned so that cannot regress.
|
|
61
|
+
assert.equal(stripDecoration('ℹ ccn.mjs | 100.00 |'), 'ccn.mjs | 100.00 |');
|
|
62
|
+
assert.equal(stripDecoration('ℹ # tools.mjs | 43.33 |'), 'tools.mjs | 43.33 |');
|
|
63
|
+
assert.equal(stripDecoration('ℹ ├─ util.mjs | 9 |'), 'util.mjs | 9 |');
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
test('node 22 tree rows survive the full parse', () => {
|
|
67
|
+
const rows = reportLines('ℹ # tools.mjs | 43.33 | 100.00 | 15.79 | 35-38').map(fileRow).filter(Boolean);
|
|
68
|
+
assert.deepEqual(rows.map((r) => r.file), ['tools.mjs']);
|
|
69
|
+
});
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import test from 'node:test';
|
|
2
|
+
import assert from 'node:assert/strict';
|
|
3
|
+
|
|
4
|
+
import { delphiSeats } from '../scripts/lib/delphi.mjs';
|
|
5
|
+
|
|
6
|
+
// ---------------------------------------------------------------------------
|
|
7
|
+
// Reading the Delphi seats out of .delphi-config.json.
|
|
8
|
+
//
|
|
9
|
+
// The check that reads them used to look only at a top-level `pinned_models`,
|
|
10
|
+
// but the shipped schema has no such key: seats live under
|
|
11
|
+
// profiles[active_profile].experts, each carrying provider + model, and that is
|
|
12
|
+
// how the product resolves them. A perfectly valid config therefore reported
|
|
13
|
+
// "pinned_models 只有 0 席" and failed every verify run -- which is how a check
|
|
14
|
+
// that is always red stops being read.
|
|
15
|
+
//
|
|
16
|
+
// These tests pin the shape the product actually uses, and keep the legacy
|
|
17
|
+
// top-level form working so an older file still verifies.
|
|
18
|
+
// ---------------------------------------------------------------------------
|
|
19
|
+
|
|
20
|
+
const profile = (experts) => ({
|
|
21
|
+
active_profile: 'p',
|
|
22
|
+
profiles: { p: { experts } },
|
|
23
|
+
channels: ['external'],
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
test('delphiSeats reads seats from the active profile, which is the shipped shape', () => {
|
|
27
|
+
const seats = delphiSeats(profile({
|
|
28
|
+
architecture: { provider: 'whalecloud', model: 's-deepseek-v4.1-flash' },
|
|
29
|
+
technical: { provider: 'whalecloud', model: 's-glm-5.3-flash' },
|
|
30
|
+
feasibility: { provider: 'whalecloud', model: 's-qwen3.8-flash' },
|
|
31
|
+
}));
|
|
32
|
+
assert.equal(seats.length, 3);
|
|
33
|
+
assert.deepEqual(seats.map(([role, s]) => [role, s.model]), [
|
|
34
|
+
['architecture', 's-deepseek-v4.1-flash'],
|
|
35
|
+
['technical', 's-glm-5.3-flash'],
|
|
36
|
+
['feasibility', 's-qwen3.8-flash'],
|
|
37
|
+
]);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
test('delphiSeats still accepts the legacy top-level pinned_models form', () => {
|
|
41
|
+
// An older file must keep verifying rather than be told to migrate.
|
|
42
|
+
const seats = delphiSeats({
|
|
43
|
+
active_profile: 'p',
|
|
44
|
+
pinned_models: { a: 'm-a', b: 'm-b', c: 'm-c' },
|
|
45
|
+
profiles: { p: { experts: { a: { model: 'ignored' } } } },
|
|
46
|
+
});
|
|
47
|
+
assert.deepEqual(seats.map(([, s]) => s.model), ['m-a', 'm-b', 'm-c']);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
test('delphiSeats ignores a profile that is not the active one', () => {
|
|
51
|
+
// Reading the wrong profile would report a stale roster as current.
|
|
52
|
+
const cfg = {
|
|
53
|
+
active_profile: 'live',
|
|
54
|
+
profiles: {
|
|
55
|
+
live: { experts: { a: { model: 'current' } } },
|
|
56
|
+
old: { experts: { a: { model: 'stale' }, b: { model: 's' }, c: { model: 's' } } },
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
assert.deepEqual(delphiSeats(cfg).map(([, s]) => s.model), ['current']);
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
test('delphiSeats returns empty for a missing config instead of throwing', () => {
|
|
63
|
+
// verify must report "0 seats", not crash, when the file was purged.
|
|
64
|
+
assert.deepEqual(delphiSeats(null), []);
|
|
65
|
+
assert.deepEqual(delphiSeats({}), []);
|
|
66
|
+
assert.deepEqual(delphiSeats({ active_profile: 'nope', profiles: {} }), []);
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
test('delphiSeats tolerates a seat with no model', () => {
|
|
70
|
+
// A half-written config should surface as a missing model, not as "3 seats".
|
|
71
|
+
const seats = delphiSeats(profile({
|
|
72
|
+
a: { provider: 'x', model: 'm-a' },
|
|
73
|
+
b: { provider: 'x' },
|
|
74
|
+
c: null,
|
|
75
|
+
}));
|
|
76
|
+
assert.equal(seats.length, 3);
|
|
77
|
+
assert.deepEqual(seats.map(([, s]) => s && s.model), ['m-a', undefined, undefined]);
|
|
78
|
+
});
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import os from 'node:os';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Shared fixtures for the test suite.
|
|
7
|
+
*
|
|
8
|
+
* The four helpers below were copy-pasted into each test file. That is cheap to
|
|
9
|
+
* write and expensive to keep correct: package layout, temp-dir cleanup and the
|
|
10
|
+
* drift simulation all have to change together, and a stale copy silently tests
|
|
11
|
+
* a layout the production code no longer produces.
|
|
12
|
+
*
|
|
13
|
+
* Each helper takes the `node:test` context so teardown is registered exactly
|
|
14
|
+
* once, by the test that owns the resource -- a helper that swallowed the
|
|
15
|
+
* context would leave every assertion after it running on a leaked tree.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/** Register `fn` for teardown on the test context, tolerating a bare object. */
|
|
19
|
+
function after(t, fn) {
|
|
20
|
+
if (t && typeof t.after === 'function') t.after(fn);
|
|
21
|
+
return fn;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** A temp dir registered for teardown, so a failing assertion still cleans up. */
|
|
25
|
+
export function tmpDir(t, prefix = 'xgr-test-') {
|
|
26
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), prefix));
|
|
27
|
+
after(t, () => fs.rmSync(dir, { recursive: true, force: true }));
|
|
28
|
+
return dir;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Build a fake xp-gate package dir with `<pkg>/skills/<name>/SKILL.md`.
|
|
33
|
+
*
|
|
34
|
+
* Mirrors the only layout the production code recognises; anything else is not
|
|
35
|
+
* a skill, and the tests assert that directories without SKILL.md are ignored.
|
|
36
|
+
*/
|
|
37
|
+
export function fakePkg(t, names, prefix = 'xgr-pkg-') {
|
|
38
|
+
const pkg = tmpDir(t, prefix);
|
|
39
|
+
for (const name of names) {
|
|
40
|
+
const dir = path.join(pkg, 'skills', name);
|
|
41
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
42
|
+
fs.writeFileSync(path.join(dir, 'SKILL.md'), `# ${name}\n`);
|
|
43
|
+
}
|
|
44
|
+
return pkg;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Copy a bundled skill from the fake package into an agent root.
|
|
49
|
+
* @returns {string} absolute path of the copy
|
|
50
|
+
*/
|
|
51
|
+
export function deploySkill(pkg, root, name, as = name) {
|
|
52
|
+
const src = path.join(pkg, 'skills', name);
|
|
53
|
+
const dest = path.join(root, as);
|
|
54
|
+
fs.cpSync(src, dest, { recursive: true });
|
|
55
|
+
return dest;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** Overwrite a deployed skill's SKILL.md to simulate a user-edited copy. */
|
|
59
|
+
export function editSkill(dir, content) {
|
|
60
|
+
fs.writeFileSync(path.join(dir, 'SKILL.md'), content);
|
|
61
|
+
}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import test from 'node:test';
|
|
2
|
+
import assert from 'node:assert/strict';
|
|
3
|
+
|
|
4
|
+
import { CASES, summarize } from '../scripts/lib/gatecheck.mjs';
|
|
5
|
+
|
|
6
|
+
// The audit is only useful if its own bookkeeping is right. These tests pin the
|
|
7
|
+
// three outcomes a case can have WITHOUT running a gate, because the expensive
|
|
8
|
+
// part (spawning git + xp-gate) is covered by `node scripts/audit.mjs --gates`.
|
|
9
|
+
// The bug this guards against was measured: Gate 2's CONTROL tree blocked (jscpd
|
|
10
|
+
// missing), the old summary counted that as a gate failure, and the report read
|
|
11
|
+
// as "the gates are broken" when the truth was "a tool is missing".
|
|
12
|
+
|
|
13
|
+
const ok = (id) => ({
|
|
14
|
+
id, name: `g${id}`, cleanVerdict: 'passed', dirtyVerdict: 'blocked', knownGap: false, ok: true, measurementValid: true,
|
|
15
|
+
});
|
|
16
|
+
const failed = (id) => ({
|
|
17
|
+
id, name: `g${id}`, cleanVerdict: 'passed', dirtyVerdict: 'passed', knownGap: false, ok: false, measurementValid: true,
|
|
18
|
+
});
|
|
19
|
+
const unmeasurable = (id) => ({
|
|
20
|
+
id, name: `g${id}`, cleanVerdict: 'blocked', dirtyVerdict: 'blocked', knownGap: false, ok: false, measurementValid: false,
|
|
21
|
+
});
|
|
22
|
+
const gap = (id) => ({
|
|
23
|
+
id, name: `g${id}`, cleanVerdict: 'passed', dirtyVerdict: 'unknown', knownGap: true, ok: false, measurementValid: true,
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
test('summarize passes when every measurable case separated clean from dirty', () => {
|
|
27
|
+
const s = summarize([ok(8), ok(3)]);
|
|
28
|
+
assert.equal(s.pass, true);
|
|
29
|
+
assert.equal(s.ok, 2);
|
|
30
|
+
assert.equal(s.failed, 0);
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
test('summarize fails when a gate passed a tree with a known defect in it', () => {
|
|
34
|
+
const s = summarize([ok(8), failed(3)]);
|
|
35
|
+
assert.equal(s.pass, false);
|
|
36
|
+
assert.equal(s.failed, 1);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
test('summarize reports a blocking control as invalid, not as a gate failure', () => {
|
|
40
|
+
// This is the measured upstream state: jscpd absent, so the clean tree blocked
|
|
41
|
+
// too. It must not be counted as "the gate is broken".
|
|
42
|
+
const s = summarize([ok(8), unmeasurable(2)]);
|
|
43
|
+
assert.equal(s.invalid, 1);
|
|
44
|
+
assert.equal(s.failed, 0, 'an unmeasurable case is not a gate failure');
|
|
45
|
+
assert.equal(s.pass, false, 'but the audit cannot claim a pass either');
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
test('summarize excludes known gaps from both counters', () => {
|
|
49
|
+
const s = summarize([ok(8), gap(12)]);
|
|
50
|
+
assert.equal(s.knownGaps, 1);
|
|
51
|
+
assert.equal(s.failed, 0);
|
|
52
|
+
assert.equal(s.pass, true, 'a documented upstream gap must not turn the audit permanently red');
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
test('summarize passes only when every case was measured', () => {
|
|
56
|
+
assert.equal(summarize([ok(1)]).pass, true);
|
|
57
|
+
assert.equal(summarize([]).pass, true);
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
test('every declared case states an explicit expected verdict', () => {
|
|
61
|
+
// A case without `expect` would compare against undefined and silently never
|
|
62
|
+
// be satisfiable, so it must be impossible to add one.
|
|
63
|
+
for (const c of CASES) {
|
|
64
|
+
assert.ok(['blocked', 'detected'].includes(c.expect), `${c.id} has an unsupported expectation: ${c.expect}`);
|
|
65
|
+
assert.equal(typeof c.plant, 'function', `${c.id} must plant a defect`);
|
|
66
|
+
assert.ok(c.name.length > 0, `${c.id} needs a name`);
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
test('Gate 2 is expected to block, because 0.38.75 added a threshold', () => {
|
|
71
|
+
// Pinned because the expectation silently rotted once already: until 0.38.74
|
|
72
|
+
// jscpd was invoked without --threshold and returns 0 no matter how much it
|
|
73
|
+
// finds, so Gate 2 could only ever 'detect'. When the audit kept expecting
|
|
74
|
+
// 'detected' after the gate started failing, a working gate was reported as
|
|
75
|
+
// FAILED -- the audit cried wolf on its own improvement.
|
|
76
|
+
const gate2 = CASES.find((c) => c.id === 2);
|
|
77
|
+
assert.equal(gate2.expect, 'blocked');
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
test('the gate ids under test are unique', () => {
|
|
81
|
+
const ids = CASES.map((c) => c.id);
|
|
82
|
+
assert.equal(new Set(ids).size, ids.length);
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
// ---------------------------------------------------------------------------
|
|
86
|
+
// Execution paths (TODO-2).
|
|
87
|
+
//
|
|
88
|
+
// The bookkeeping above was covered; what was not is the code that actually
|
|
89
|
+
// runs: tmpRepo/stageAll build the fixture, gateRun invokes the real CLI, and
|
|
90
|
+
// runCase/measure/erroredCase/evaluateCase turn two verdicts into a finding.
|
|
91
|
+
// These are exercised with a gate id that no fixture can satisfy, so the
|
|
92
|
+
// spawn path is real while the assertions stay about this module's bookkeeping.
|
|
93
|
+
// ---------------------------------------------------------------------------
|
|
94
|
+
|
|
95
|
+
import os from 'node:os';
|
|
96
|
+
import fs from 'node:fs';
|
|
97
|
+
|
|
98
|
+
import { runCase, auditGates } from '../scripts/lib/gatecheck.mjs';
|
|
99
|
+
|
|
100
|
+
/** A case whose plant() writes a marker file and whose id cannot match a gate. */
|
|
101
|
+
function probeCase(overrides = {}) {
|
|
102
|
+
return {
|
|
103
|
+
id: 404,
|
|
104
|
+
name: 'probe case',
|
|
105
|
+
plant: (dir) => fs.writeFileSync(`${dir}/planted.txt`, 'x'),
|
|
106
|
+
expect: 'blocked',
|
|
107
|
+
...overrides,
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
test('runCase returns a well-formed result even when the gate id does not exist', () => {
|
|
112
|
+
// This is the path that must never throw: a case that throws mid-flight has
|
|
113
|
+
// already created two temp repos, and the finally-block cleanup is the only
|
|
114
|
+
// thing keeping them from piling up in /tmp.
|
|
115
|
+
const r = runCase(probeCase());
|
|
116
|
+
assert.equal(r.id, 404);
|
|
117
|
+
assert.equal(typeof r.dirtyVerdict, 'string');
|
|
118
|
+
assert.equal(r.error, undefined, `runCase must not leak an error: ${r.error}`);
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
test('runCase leaves no temporary repo behind', () => {
|
|
122
|
+
const before = fs.readdirSync(os.tmpdir()).filter((n) => n.startsWith('xgr-gate-')).length;
|
|
123
|
+
runCase(probeCase());
|
|
124
|
+
const after = fs.readdirSync(os.tmpdir()).filter((n) => n.startsWith('xgr-gate-')).length;
|
|
125
|
+
assert.equal(after, before, 'every fixture repo must be removed, including on the dirty run');
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
test('runCase records a throwing plant() as unmeasurable instead of propagating', () => {
|
|
129
|
+
// A broken case must degrade to "could not measure", never crash the audit.
|
|
130
|
+
const r = runCase(probeCase({ plant: () => { throw new Error('plant exploded'); } }));
|
|
131
|
+
assert.equal(r.measurementValid, false);
|
|
132
|
+
assert.equal(r.ok, false);
|
|
133
|
+
assert.equal(r.dirtyVerdict, 'unknown');
|
|
134
|
+
assert.match(r.error, /plant exploded/);
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
test('runCase carries knownGap through to the result', () => {
|
|
138
|
+
// summarize() filters on this field, so losing it here would silently turn a
|
|
139
|
+
// documented upstream gap into a permanent audit failure.
|
|
140
|
+
const r = runCase(probeCase({ plant: () => {} , knownGap: true }));
|
|
141
|
+
assert.equal(r.knownGap, true);
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
test('runCase without a control reports the clean side as skipped, not as unknown', () => {
|
|
145
|
+
// control:false means "do not run the clean tree". Reporting 'unknown' would
|
|
146
|
+
// read as "we ran it and could not parse it", which is a different claim.
|
|
147
|
+
const r = runCase(probeCase({ plant: () => {} }), { control: false });
|
|
148
|
+
assert.equal(r.cleanVerdict, 'skipped');
|
|
149
|
+
assert.equal(r.measurementValid, true, 'with no control there is nothing that can invalidate the measurement');
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
test('auditGates runs every supplied case and summarises the results', async () => {
|
|
153
|
+
const { cases, summary } = await auditGates({ cases: [probeCase(), probeCase({ id: 405 })] });
|
|
154
|
+
assert.equal(cases.length, 2);
|
|
155
|
+
assert.equal(summary.total, 2);
|
|
156
|
+
assert.deepEqual(cases.map((c) => c.id), [404, 405]);
|
|
157
|
+
});
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import test from 'node:test';
|
|
2
|
+
import assert from 'node:assert/strict';
|
|
3
|
+
|
|
4
|
+
import { verdictOf } from '../scripts/lib/verdict.mjs';
|
|
5
|
+
|
|
6
|
+
// verdictOf is the only thing standing between a gate's output and the audit's
|
|
7
|
+
// verdict. Two failure modes matter:
|
|
8
|
+
// - reading a clean run as broken -> the audit cries wolf and gets ignored
|
|
9
|
+
// - reading a broken run as clean -> the audit certifies a dead gate
|
|
10
|
+
// Every case below pins one of those.
|
|
11
|
+
|
|
12
|
+
test('verdictOf reads the explicit block marker', () => {
|
|
13
|
+
assert.equal(verdictOf('❌ BLOCKED - Secrets detected in staged files.'), 'blocked');
|
|
14
|
+
assert.equal(verdictOf('Gate 8 FAILED: command failed'), 'blocked');
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
test('verdictOf reads the explicit pass marker', () => {
|
|
18
|
+
assert.equal(verdictOf(' ✅ PASSED - No secrets detected.'), 'passed');
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
test('verdictOf reads a skip, including the emoji xp-gate actually prints', () => {
|
|
22
|
+
assert.equal(verdictOf('⏭️ SKIPPED - Complexity (no source files to check).'), 'skipped');
|
|
23
|
+
assert.equal(verdictOf('SKIPPED - no supported language files changed'), 'skipped');
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
test('verdictOf treats "Found 0 clones" as passed, not unknown', () => {
|
|
27
|
+
// Gate 2 prints no ✅ marker at all. Without this branch a clean Gate 2 run
|
|
28
|
+
// reads as 'unknown', which is indistinguishable from a broken parser -- the
|
|
29
|
+
// audit would then be unable to tell "gate is fine" from "gate is unreadable".
|
|
30
|
+
assert.equal(verdictOf('Found 0 clones.\ntime: 14.541ms'), 'passed');
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
test('verdictOf reports duplication as detected, not blocked', () => {
|
|
34
|
+
// Measured: `xp-gate check 2` exits 0 with and without clones. Calling this
|
|
35
|
+
// 'blocked' would be a lie about the gate's severity policy.
|
|
36
|
+
assert.equal(verdictOf('Clone found (javascript)\nFound 1 clones.'), 'detected');
|
|
37
|
+
assert.equal(verdictOf('Found 3 clones.'), 'detected');
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
test('verdictOf prefers blocked over detected when both appear', () => {
|
|
41
|
+
// A gate that reports clones AND fails must be read as a failure; the
|
|
42
|
+
// ordering of the regex checks is what guarantees that.
|
|
43
|
+
assert.equal(verdictOf('Found 3 clones.\n❌ BLOCKED'), 'blocked');
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
test('verdictOf returns unknown for output it does not recognise', () => {
|
|
47
|
+
// Silence must never be mistaken for success.
|
|
48
|
+
assert.equal(verdictOf(''), 'unknown');
|
|
49
|
+
assert.equal(verdictOf('npm warn something unrelated'), 'unknown');
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
test('verdictOf does not treat the word FAILED in a path as a failure', () => {
|
|
53
|
+
// A conservative check: "FAILED" appearing as part of a filename is a real
|
|
54
|
+
// possibility in test fixtures, and a false 'blocked' is the safer error, but
|
|
55
|
+
// documenting the current behaviour stops someone "fixing" it blind.
|
|
56
|
+
assert.equal(verdictOf('PASSED - scanned ./failed-tests.js'), 'passed');
|
|
57
|
+
});
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import test from 'node:test';
|
|
2
|
+
import assert from 'node:assert/strict';
|
|
3
|
+
import fs from 'node:fs';
|
|
4
|
+
import path from 'node:path';
|
|
5
|
+
import { fileURLToPath } from 'node:url';
|
|
6
|
+
|
|
7
|
+
import { MUTATIONS } from '../scripts/lib/mutations.mjs';
|
|
8
|
+
|
|
9
|
+
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Every mutation must still point at code that exists.
|
|
13
|
+
*
|
|
14
|
+
* MEASURED: refactoring `util.mjs` into `fs-tree.mjs`, and moving `cmpVersion`
|
|
15
|
+
* to `version.mjs`, left eight mutations whose anchor text was no longer in the
|
|
16
|
+
* file they named. The mutator printed "[skip] anchor not found" for each, then
|
|
17
|
+
* reported "every mutated defect was caught" and exited 0 -- so a refactor could
|
|
18
|
+
* delete eight of nineteen property checks and make the gate look healthier
|
|
19
|
+
* than it did before. A skipped mutation is an unverified property, not a pass.
|
|
20
|
+
*
|
|
21
|
+
* The table lives in its own module precisely so this test can read it: the
|
|
22
|
+
* mutator has top-level side effects and cannot be imported.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
test('the mutation table is non-empty, or this test proves nothing', () => {
|
|
26
|
+
assert.ok(MUTATIONS.length >= 19, `table shrank to ${MUTATIONS.length} entries`);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
test('every mutation anchor is present in the file it names', () => {
|
|
30
|
+
const missing = [];
|
|
31
|
+
for (const m of MUTATIONS) {
|
|
32
|
+
const abs = path.join(root, m.file);
|
|
33
|
+
if (!fs.existsSync(abs)) {
|
|
34
|
+
missing.push(`${m.name}: file gone (${m.file})`);
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
if (!fs.readFileSync(abs, 'utf8').includes(m.from)) {
|
|
38
|
+
missing.push(`${m.name}: anchor not found in ${m.file}`);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
assert.deepEqual(missing, [], `stale mutations:\n ${missing.join('\n ')}`);
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
test('every mutation replaces its anchor with something different', () => {
|
|
45
|
+
// A `to` identical to `from` would apply cleanly and change nothing, which
|
|
46
|
+
// reads as a SURVIVED mutation and slanders the tests.
|
|
47
|
+
const noops = MUTATIONS.filter((m) => m.from === m.to).map((m) => m.name);
|
|
48
|
+
assert.deepEqual(noops, [], 'these mutations are no-ops');
|
|
49
|
+
});
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import test from 'node:test';
|
|
2
|
+
import assert from 'node:assert/strict';
|
|
3
|
+
|
|
4
|
+
import * as proc from '../scripts/lib/proc.mjs';
|
|
5
|
+
|
|
6
|
+
// ---------------------------------------------------------------------------
|
|
7
|
+
// proc.mjs is the module every other script imports from, so splitting it up
|
|
8
|
+
// must not move a single name off its public surface. These assertions pin the
|
|
9
|
+
// contract; the modules behind it are free to reorganise.
|
|
10
|
+
//
|
|
11
|
+
// Gate 4 flagged proc.mjs for "too many exports: 20 (maximum: 10)". The count
|
|
12
|
+
// is a symptom of one module owning three jobs: starting child processes,
|
|
13
|
+
// locating the xp-gate launcher, and abstracting the platform. Splitting by
|
|
14
|
+
// those jobs is the fix; changing the import sites is not, because they are
|
|
15
|
+
// correct -- the surface they see is one cohesive "process utilities" API.
|
|
16
|
+
// ---------------------------------------------------------------------------
|
|
17
|
+
|
|
18
|
+
const EXPECTED = [
|
|
19
|
+
'HOME',
|
|
20
|
+
'PROBE_TIMEOUT_MS',
|
|
21
|
+
'XP_GATE_SLOW_OP_TIMEOUT_MS',
|
|
22
|
+
'effectivePath',
|
|
23
|
+
'envWithPath',
|
|
24
|
+
'firstExisting',
|
|
25
|
+
'gitConfig',
|
|
26
|
+
'isWindowsShim',
|
|
27
|
+
'npmCli',
|
|
28
|
+
'packageDir',
|
|
29
|
+
'parseWhichOutput',
|
|
30
|
+
'probe',
|
|
31
|
+
'resetPackageDir',
|
|
32
|
+
'run',
|
|
33
|
+
'runNpm',
|
|
34
|
+
'toolVersion',
|
|
35
|
+
'which',
|
|
36
|
+
'withPlatform',
|
|
37
|
+
'xp',
|
|
38
|
+
'xpJson',
|
|
39
|
+
];
|
|
40
|
+
|
|
41
|
+
test('proc.mjs still exports exactly the documented surface', () => {
|
|
42
|
+
assert.deepEqual(Object.keys(proc).sort(), [...EXPECTED].sort());
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
test('every exported name is the right kind', () => {
|
|
46
|
+
for (const name of EXPECTED) {
|
|
47
|
+
assert.notEqual(proc[name], undefined, `${name} must not be undefined`);
|
|
48
|
+
}
|
|
49
|
+
assert.equal(typeof proc.HOME, 'string');
|
|
50
|
+
for (const fn of EXPECTED.filter((n) => !n.endsWith('_MS') && n !== 'HOME')) {
|
|
51
|
+
assert.equal(typeof proc[fn], 'function', `${fn} must stay callable`);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
test('the timeout budgets keep their values through the split', () => {
|
|
56
|
+
assert.equal(proc.PROBE_TIMEOUT_MS, 10000);
|
|
57
|
+
assert.equal(proc.XP_GATE_SLOW_OP_TIMEOUT_MS, 300000);
|
|
58
|
+
});
|