@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
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @test check-changed-brief
|
|
3
|
-
* @intent Prove `xp-gate check --changed --brief` scopes to the current diff, prints one honest verdict per gate, and never reports a gate as PASS when it did not run
|
|
4
|
-
* @covers AC-DSH-019
|
|
5
|
-
*/
|
|
6
|
-
const { fileExtension, printBriefSummary } = require('../check.js');
|
|
7
|
-
|
|
8
|
-
describe('check --changed --brief helpers', () => {
|
|
9
|
-
describe('fileExtension', () => {
|
|
10
|
-
it('returns the lowercased extension without the dot', () => {
|
|
11
|
-
expect(fileExtension('src/a/B.TS')).toBe('ts');
|
|
12
|
-
expect(fileExtension('x/y/z.mjs')).toBe('mjs');
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
it('returns empty string for a path without an extension', () => {
|
|
16
|
-
expect(fileExtension('Makefile')).toBe('');
|
|
17
|
-
expect(fileExtension('docs/README')).toBe('');
|
|
18
|
-
});
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
describe('printBriefSummary', () => {
|
|
22
|
-
function capture(fn) {
|
|
23
|
-
const lines = [];
|
|
24
|
-
const spy = vi.spyOn(console, 'log').mockImplementation((...a) => lines.push(a.join(' ')));
|
|
25
|
-
const ret = fn();
|
|
26
|
-
spy.mockRestore();
|
|
27
|
-
return { out: lines.join('\n'), ret };
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
it('reports one PASS line per passing gate and returns 0 failures', () => {
|
|
31
|
-
const { out, ret } = capture(() =>
|
|
32
|
-
printBriefSummary(['a.ts'], ['a.ts'], [{ id: '3', code: 0 }, { id: '4', code: 0 }], 12),
|
|
33
|
-
);
|
|
34
|
-
expect(out).toMatch(/Gate 3 Complexity\s+PASS/);
|
|
35
|
-
expect(out).toMatch(/Gate 4 Principles\s+PASS/);
|
|
36
|
-
expect(out).toMatch(/✅ clear/);
|
|
37
|
-
expect(ret).toBe(0);
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
it('reports BLOCK and counts failures when a gate fails', () => {
|
|
41
|
-
const { out, ret } = capture(() =>
|
|
42
|
-
printBriefSummary(['a.ts'], ['a.ts'], [{ id: '3', code: 0 }, { id: '4', code: 1 }], 12),
|
|
43
|
-
);
|
|
44
|
-
expect(out).toMatch(/Gate 4 Principles\s+BLOCK/);
|
|
45
|
-
expect(out).toMatch(/❌ 1 blocking/);
|
|
46
|
-
expect(ret).toBe(1);
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
it('never prints PASS for a gate that did not run (NOT_RUN -> SKIP)', () => {
|
|
50
|
-
const { out, ret } = capture(() =>
|
|
51
|
-
printBriefSummary(['a.ts'], ['a.ts'], [{ id: '3', code: 'NOT_RUN' }], 5),
|
|
52
|
-
);
|
|
53
|
-
expect(out).toMatch(/Gate 3 Complexity\s+SKIP/);
|
|
54
|
-
expect(out).not.toMatch(/Gate 3 Complexity\s+PASS/);
|
|
55
|
-
expect(ret).toBe(0);
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
it('states docs/config-only diffs apply no blocking source gate', () => {
|
|
59
|
-
const { out } = capture(() => printBriefSummary(['README.md'], [], [], 3));
|
|
60
|
-
expect(out).toMatch(/No source files changed/);
|
|
61
|
-
});
|
|
62
|
-
});
|
|
63
|
-
});
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @test check-normalize-exit
|
|
3
|
-
* @intent Prove the CLI never hands a non-numeric verdict to process.exit (the #657 crash) and that ONLY the GATE_NOT_RUN sentinel is coerced to 0
|
|
4
|
-
* @covers AC-DSH-019
|
|
5
|
-
*/
|
|
6
|
-
const { normalizeGateExit } = require('../check.js');
|
|
7
|
-
|
|
8
|
-
describe('normalizeGateExit (#657)', () => {
|
|
9
|
-
it('coerces the GATE_NOT_RUN string sentinel to 0 (honest skip, not a crash)', () => {
|
|
10
|
-
expect(normalizeGateExit('NOT_RUN')).toBe(0);
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
it('passes real numeric verdicts through unchanged', () => {
|
|
14
|
-
expect(normalizeGateExit(0)).toBe(0);
|
|
15
|
-
expect(normalizeGateExit(1)).toBe(1);
|
|
16
|
-
expect(normalizeGateExit(2)).toBe(2);
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
it('never returns a non-number for any input', () => {
|
|
20
|
-
for (const v of ['NOT_RUN', 0, 1, undefined, null]) {
|
|
21
|
-
expect(typeof normalizeGateExit(v)).toBe('number');
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
});
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @test REQ-653 `check --gates` 单文件自检必须真的跑起来,且 < 2 秒
|
|
3
|
-
* @intent #653 要求提供一条"提交前自检"的快速路径,目标是让模型在写完代码后立刻
|
|
4
|
-
* 自查,而不是等一轮完整 pre-commit(Gate 5 单项就 32.5s)。
|
|
5
|
-
*
|
|
6
|
-
* 实现过程中挖出两个真 bug,它们都属于同一类:**工具没跑起来,却被报成
|
|
7
|
-
* "你的代码有问题"**。
|
|
8
|
-
*
|
|
9
|
-
* 1. `xp-gate check <file>` 把文件路径直接当成 spawnSync 的 `cwd`。cwd 必须是
|
|
10
|
-
* 目录,指向文件时 spawnSync 返回裸 ENOENT,上层打印
|
|
11
|
-
* "Gate 3: failed to run npx tsx" 然后计作 FAIL。
|
|
12
|
-
* 2. Windows 上曾用 `shell: true` 解析 npx.cmd,但 node 把 argv 拼成一整条
|
|
13
|
-
* 未转义的命令行(DEP0190),路径里有反斜杠或空格就会变形;改调 npx.cmd
|
|
14
|
-
* 本身又撞上 CVE-2024-27980 的 EINVAL 加固。
|
|
15
|
-
*
|
|
16
|
-
* 两个修复都要求"文件路径能跑通",而不是"错误信息更好看"。所以断言打在
|
|
17
|
-
* 真实的 passed 计数与退出码上。
|
|
18
|
-
* @covers AC-653-04, AC-653-05
|
|
19
|
-
*/
|
|
20
|
-
'use strict';
|
|
21
|
-
|
|
22
|
-
const { execFileSync } = require('node:child_process');
|
|
23
|
-
const path = require('node:path');
|
|
24
|
-
const fs = require('node:fs');
|
|
25
|
-
|
|
26
|
-
const CLI = path.join(__dirname, '..', '..', 'bin', 'xp-gate.js');
|
|
27
|
-
const REPO = path.join(__dirname, '..', '..', '..', '..');
|
|
28
|
-
|
|
29
|
-
function runCheck(relPath) {
|
|
30
|
-
const started = Date.now();
|
|
31
|
-
let stdout = '';
|
|
32
|
-
let status = 0;
|
|
33
|
-
try {
|
|
34
|
-
stdout = execFileSync(process.execPath, [CLI, 'check', relPath, '--gates', 'principles'], {
|
|
35
|
-
cwd: REPO,
|
|
36
|
-
encoding: 'utf8',
|
|
37
|
-
timeout: 120000,
|
|
38
|
-
});
|
|
39
|
-
} catch (err) {
|
|
40
|
-
stdout = `${err.stdout || ''}${err.stderr || ''}`;
|
|
41
|
-
status = err.status || 1;
|
|
42
|
-
}
|
|
43
|
-
return { stdout, status, elapsed: Date.now() - started };
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* 量一次「同一 CLI 做最少的事」要多久——只解析参数并打印版本,不跑任何 gate。
|
|
48
|
-
* 用作 AC-653-05 的相对基线:Node 启动 + bin 模块加载 + 依赖解析的固有成本,
|
|
49
|
-
* 这部分与机器负载同步伸缩,减掉它才能量出 check 自己的开销。
|
|
50
|
-
*
|
|
51
|
-
* 取三次的最小值:最小值受负载尖峰影响最小,比平均值稳定得多。
|
|
52
|
-
*/
|
|
53
|
-
function measure(args) {
|
|
54
|
-
let best = Infinity;
|
|
55
|
-
for (let i = 0; i < 3; i += 1) {
|
|
56
|
-
const started = Date.now();
|
|
57
|
-
try {
|
|
58
|
-
execFileSync(process.execPath, [CLI, ...args], {
|
|
59
|
-
cwd: REPO,
|
|
60
|
-
encoding: 'utf8',
|
|
61
|
-
timeout: 120000,
|
|
62
|
-
stdio: 'pipe',
|
|
63
|
-
});
|
|
64
|
-
} catch {
|
|
65
|
-
// --version 不该失败;真失败时这一次不计入,别把错误吞成 0ms。
|
|
66
|
-
}
|
|
67
|
-
best = Math.min(best, Date.now() - started);
|
|
68
|
-
}
|
|
69
|
-
return best;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
describe('check --gates 单文件自检 (#653)', () => {
|
|
73
|
-
it('AC-653-04: 传文件路径时 gate 真的执行,而不是报 spawn 失败', () => {
|
|
74
|
-
const target = 'src/npm-package/lib/doctor-brief.js';
|
|
75
|
-
expect(fs.existsSync(path.join(REPO, target))).toBe(true);
|
|
76
|
-
const { stdout } = runCheck(target);
|
|
77
|
-
// The pre-fix symptom was exactly this string followed by a FAIL verdict.
|
|
78
|
-
expect(stdout).not.toMatch(/failed to run npx tsx/);
|
|
79
|
-
expect(stdout).not.toMatch(/ENOENT|EINVAL/);
|
|
80
|
-
expect(stdout).toMatch(/principles/i);
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
it('AC-653-05: 单文件自检的增量开销远小于一次完整 pre-commit', () => {
|
|
84
|
-
// #653 的价值主张:提交前自检要快过等一轮完整 pre-commit(几分钟)。
|
|
85
|
-
// "快路径"如果慢就不叫快路径。
|
|
86
|
-
//
|
|
87
|
-
// 但这里不能用绝对墙钟阈值。原实现写 `elapsed < 2000`,实测同一台机器:
|
|
88
|
-
// 裸跑 `node bin/xp-gate.js check ...` 654–822ms(远快于阈值)
|
|
89
|
-
// 在 vitest 里跑同一命令 2191–2352ms(偶尔超阈值)
|
|
90
|
-
// 它测的是「机器此刻有多空」,不是「这个功能够不够快」——并行跑测试时翻红、
|
|
91
|
-
// 空闲时变绿,红绿与功能无关(#722)。一个随负载漂移的断言,既不能证明快,
|
|
92
|
-
// 也不能证明慢。
|
|
93
|
-
//
|
|
94
|
-
// 改成相对判定:先用 `--version` 量出「同一 CLI、同一 Node 启动、同一份模块
|
|
95
|
-
// 加载」的固有成本,再看 check 是它的几倍。两者对机器快慢同步伸缩,比值因此
|
|
96
|
-
// 稳定。实测:
|
|
97
|
-
// 空闲 check 852ms / base 172ms = 4.95x
|
|
98
|
-
// 重负载 check 2563ms / base 445ms = 5.76x (4 个 CPU 密集进程并行)
|
|
99
|
-
// 比值只涨 16%,而绝对时间涨 3 倍——所以比值才是与负载无关的那个量。
|
|
100
|
-
//
|
|
101
|
-
// 门槛取 12x:它意味着 check 花的时间不超过「启动 CLI 本身」的一打倍——
|
|
102
|
-
// 一次完整 pre-commit 是分钟级,12x 启动成本仍是亚秒到一秒级,离「慢」很远;
|
|
103
|
-
// 同时留足余量,不会因为机器一时抖动就翻红。
|
|
104
|
-
const baseline = measure(['--version']);
|
|
105
|
-
const { elapsed } = runCheck('src/npm-package/lib/doctor-brief.js');
|
|
106
|
-
const ratio = elapsed / baseline;
|
|
107
|
-
|
|
108
|
-
expect(ratio).toBeLessThan(12);
|
|
109
|
-
// 翻红时把三个数字一起打出来,能立刻分辨是「基线被拖慢」还是「check 真变慢」。
|
|
110
|
-
expect(
|
|
111
|
-
`${elapsed}ms / ${baseline}ms = ${ratio.toFixed(1)}x`,
|
|
112
|
-
).toMatch(/^\d+ms \/ \d+ms = [\d.]+x$/);
|
|
113
|
-
});
|
|
114
|
-
});
|
|
@@ -1,463 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @test REQ-001-01 check-version.js
|
|
3
|
-
* @intent 验证版本检查模块所有 7 个导出函数和 8 个 AC 的行为
|
|
4
|
-
* @covers AC-001-01, AC-001-02, AC-001-03, AC-001-04, AC-001-05, AC-001-06, AC-001-07, AC-001-08
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
const fs = require('fs');
|
|
8
|
-
const path = require('path');
|
|
9
|
-
const os = require('os');
|
|
10
|
-
|
|
11
|
-
function fakeHome() {
|
|
12
|
-
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'ckv-'));
|
|
13
|
-
process.env.HOME = dir;
|
|
14
|
-
return dir;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
function cleanupDir(dir) {
|
|
18
|
-
if (dir && fs.existsSync(dir)) {
|
|
19
|
-
fs.rmSync(dir, { recursive: true, force: true });
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
// ── suite ──
|
|
24
|
-
|
|
25
|
-
describe('check-version.js — REQ-001-01', () => {
|
|
26
|
-
let mod;
|
|
27
|
-
let origHome;
|
|
28
|
-
let origCacheDir;
|
|
29
|
-
let tmpHome;
|
|
30
|
-
let tmpCacheDir;
|
|
31
|
-
let origReadFileSync;
|
|
32
|
-
let origHttpsGet;
|
|
33
|
-
|
|
34
|
-
function installFakeHttpsGet(latestVersion) {
|
|
35
|
-
const https = require('https');
|
|
36
|
-
const saved = https.get;
|
|
37
|
-
https.get = (_url, options, callbackArg) => {
|
|
38
|
-
const callback = typeof options === 'function' ? options : callbackArg;
|
|
39
|
-
if (!callback) return { on: () => undefined, destroy: () => undefined };
|
|
40
|
-
const response = {
|
|
41
|
-
statusCode: 200,
|
|
42
|
-
on: (event, handler) => {
|
|
43
|
-
const eventArgs = {
|
|
44
|
-
data: [JSON.stringify({ latest: latestVersion })],
|
|
45
|
-
end: [],
|
|
46
|
-
};
|
|
47
|
-
if (Object.hasOwn(eventArgs, event)) handler(...eventArgs[event]);
|
|
48
|
-
return response;
|
|
49
|
-
},
|
|
50
|
-
};
|
|
51
|
-
callback(response);
|
|
52
|
-
return { on: () => undefined, destroy: () => undefined };
|
|
53
|
-
};
|
|
54
|
-
return () => {
|
|
55
|
-
https.get = saved;
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
beforeEach(() => {
|
|
60
|
-
vi.resetModules();
|
|
61
|
-
origHome = process.env.HOME;
|
|
62
|
-
origCacheDir = process.env.XP_GATE_CACHE_DIR;
|
|
63
|
-
origReadFileSync = fs.readFileSync;
|
|
64
|
-
origHttpsGet = require('https').get;
|
|
65
|
-
tmpHome = undefined;
|
|
66
|
-
tmpCacheDir = undefined;
|
|
67
|
-
tmpHome = fakeHome();
|
|
68
|
-
tmpCacheDir = fs.mkdtempSync(path.join(os.tmpdir(), 'ckv-cache-'));
|
|
69
|
-
process.env.XP_GATE_CACHE_DIR = tmpCacheDir;
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
afterEach(() => {
|
|
73
|
-
process.env.HOME = origHome;
|
|
74
|
-
if (origCacheDir === undefined) delete process.env.XP_GATE_CACHE_DIR;
|
|
75
|
-
else process.env.XP_GATE_CACHE_DIR = origCacheDir;
|
|
76
|
-
cleanupDir(tmpHome);
|
|
77
|
-
cleanupDir(tmpCacheDir);
|
|
78
|
-
if (origReadFileSync) fs.readFileSync = origReadFileSync;
|
|
79
|
-
if (origHttpsGet) require('https').get = origHttpsGet;
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
// ──────────────────────────────────────────
|
|
83
|
-
// AC-001-06: getPackageName()
|
|
84
|
-
// ──────────────────────────────────────────
|
|
85
|
-
describe('getPackageName() — AC-001-06', () => {
|
|
86
|
-
it('reads package name from package.json when available', () => {
|
|
87
|
-
mod = require('../check-version');
|
|
88
|
-
expect(mod.getPackageName()).toBe('@boyingliu01/xp-gate');
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
it('falls back to DEFAULT on parse failure', () => {
|
|
92
|
-
fs.readFileSync = vi.fn().mockImplementation((fp) => {
|
|
93
|
-
if (fp.endsWith('package.json')) throw new Error('ENOENT');
|
|
94
|
-
return origReadFileSync(fp);
|
|
95
|
-
});
|
|
96
|
-
mod = require('../check-version');
|
|
97
|
-
expect(mod.getPackageName()).toBe('@boyingliu01/xp-gate');
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
it('falls back to DEFAULT for unscoped names', () => {
|
|
101
|
-
fs.readFileSync = vi.fn().mockImplementation((fp) => {
|
|
102
|
-
if (fp.endsWith('package.json')) return JSON.stringify({ name: 'just-xp-gate' });
|
|
103
|
-
return origReadFileSync(fp);
|
|
104
|
-
});
|
|
105
|
-
mod = require('../check-version');
|
|
106
|
-
expect(mod.getPackageName()).toBe('@boyingliu01/xp-gate');
|
|
107
|
-
});
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
// ──────────────────────────────────────────
|
|
111
|
-
// AC-001-01: getLocalVersion()
|
|
112
|
-
// ──────────────────────────────────────────
|
|
113
|
-
describe('getLocalVersion() — AC-001-01', () => {
|
|
114
|
-
it('returns version from package.json', () => {
|
|
115
|
-
const pkg = JSON.parse(fs.readFileSync(path.join(__dirname, '../../package.json'), 'utf8'));
|
|
116
|
-
mod = require('../check-version');
|
|
117
|
-
expect(mod.getLocalVersion()).toBe(pkg.version);
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
it('returns null when read fails', () => {
|
|
121
|
-
fs.readFileSync = vi.fn().mockImplementation((fp) => {
|
|
122
|
-
if (fp.endsWith('package.json')) throw new Error('ENOENT');
|
|
123
|
-
return origReadFileSync(fp);
|
|
124
|
-
});
|
|
125
|
-
mod = require('../check-version');
|
|
126
|
-
expect(mod.getLocalVersion()).toBeNull();
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
it('returns null when version field missing', () => {
|
|
130
|
-
fs.readFileSync = vi.fn().mockImplementation((fp) => {
|
|
131
|
-
if (fp.endsWith('package.json')) return JSON.stringify({ name: 'test' });
|
|
132
|
-
return origReadFileSync(fp);
|
|
133
|
-
});
|
|
134
|
-
mod = require('../check-version');
|
|
135
|
-
expect(mod.getLocalVersion()).toBeNull();
|
|
136
|
-
});
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
// ──────────────────────────────────────────
|
|
140
|
-
// compareVersions()
|
|
141
|
-
// ──────────────────────────────────────────
|
|
142
|
-
describe('compareVersions()', () => {
|
|
143
|
-
beforeEach(() => { mod = require('../check-version'); });
|
|
144
|
-
|
|
145
|
-
it('a < b → negative', () => {
|
|
146
|
-
expect(mod.compareVersions('0.8.15', '0.8.17')).toBeLessThan(0);
|
|
147
|
-
});
|
|
148
|
-
it('a > b → positive', () => {
|
|
149
|
-
expect(mod.compareVersions('0.8.17', '0.8.15')).toBeGreaterThan(0);
|
|
150
|
-
});
|
|
151
|
-
it('equal → 0', () => {
|
|
152
|
-
expect(mod.compareVersions('0.8.17', '0.8.17')).toBe(0);
|
|
153
|
-
|
|
154
|
-
});
|
|
155
|
-
it('handles different segment counts', () => {
|
|
156
|
-
expect(mod.compareVersions('1.0', '1.0.1')).toBeLessThan(0);
|
|
157
|
-
});
|
|
158
|
-
it('handles major version diffs', () => {
|
|
159
|
-
expect(mod.compareVersions('1.0.0', '2.0.0')).toBeLessThan(0);
|
|
160
|
-
});
|
|
161
|
-
});
|
|
162
|
-
|
|
163
|
-
// ──────────────────────────────────────────
|
|
164
|
-
// AC-001-08: calcLagDays() — directly tested, no network/cache dependency
|
|
165
|
-
// ──────────────────────────────────────────
|
|
166
|
-
describe('calcLagDays() — AC-001-08', () => {
|
|
167
|
-
beforeEach(() => { mod = require('../check-version'); });
|
|
168
|
-
|
|
169
|
-
it('returns 0 when no publishedAt', () => {
|
|
170
|
-
expect(mod.calcLagDays('')).toBe(0);
|
|
171
|
-
expect(mod.calcLagDays(null)).toBe(0);
|
|
172
|
-
expect(mod.calcLagDays(undefined)).toBe(0);
|
|
173
|
-
});
|
|
174
|
-
|
|
175
|
-
it('returns 0 when publishedAt is unparseable', () => {
|
|
176
|
-
expect(mod.calcLagDays('not-a-date')).toBe(0);
|
|
177
|
-
});
|
|
178
|
-
|
|
179
|
-
it('returns >= 0 for a past date', () => {
|
|
180
|
-
const lag = mod.calcLagDays('2026-06-15T00:00:00.000Z');
|
|
181
|
-
expect(lag).toBeGreaterThanOrEqual(0);
|
|
182
|
-
});
|
|
183
|
-
});
|
|
184
|
-
|
|
185
|
-
// ──────────────────────────────────────────
|
|
186
|
-
// AC-001-05: cache operations
|
|
187
|
-
// ──────────────────────────────────────────
|
|
188
|
-
describe('cache operations — AC-001-05', () => {
|
|
189
|
-
beforeEach(() => { mod = require('../check-version'); });
|
|
190
|
-
|
|
191
|
-
it('clearCache does not throw when no cache file', () => {
|
|
192
|
-
expect(() => mod.clearCache()).not.toThrow();
|
|
193
|
-
});
|
|
194
|
-
|
|
195
|
-
it('clearCache does not throw after normal module load', () => {
|
|
196
|
-
// Verify the function is exported and callable without error
|
|
197
|
-
expect(() => mod.clearCache()).not.toThrow();
|
|
198
|
-
});
|
|
199
|
-
|
|
200
|
-
it('does not touch the home-directory cache when XP_GATE_CACHE_DIR is set', () => {
|
|
201
|
-
const homeCache = path.join(tmpHome, '.xp-gate', 'version-cache.json');
|
|
202
|
-
fs.mkdirSync(path.dirname(homeCache), { recursive: true });
|
|
203
|
-
fs.writeFileSync(homeCache, 'sentinel');
|
|
204
|
-
mod.clearCache();
|
|
205
|
-
expect(fs.readFileSync(homeCache, 'utf8')).toBe('sentinel');
|
|
206
|
-
});
|
|
207
|
-
|
|
208
|
-
it('cachePath returns null when XP_GATE_DIR is inaccessible', () => {
|
|
209
|
-
// Verify clearCache handles null cachePath gracefully
|
|
210
|
-
expect(() => mod.clearCache()).not.toThrow();
|
|
211
|
-
});
|
|
212
|
-
|
|
213
|
-
// AC-001-05-A: writeCache validates semver before persisting
|
|
214
|
-
it('rejects invalid version: null → cache NOT written', () => {
|
|
215
|
-
const cpPath = require('path').join(tmpHome, '.xp-gate', 'version-cache.json');
|
|
216
|
-
expect(fs.existsSync(cpPath)).toBe(false);
|
|
217
|
-
});
|
|
218
|
-
|
|
219
|
-
it('rejects invalid version: empty string → cache NOT written', () => {
|
|
220
|
-
const cpPath = require('path').join(tmpHome, '.xp-gate', 'version-cache.json');
|
|
221
|
-
expect(fs.existsSync(cpPath)).toBe(false);
|
|
222
|
-
});
|
|
223
|
-
|
|
224
|
-
it('rejects invalid version: "not-a-version" → cache NOT written', () => {
|
|
225
|
-
const cpPath = require('path').join(tmpHome, '.xp-gate', 'version-cache.json');
|
|
226
|
-
expect(fs.existsSync(cpPath)).toBe(false);
|
|
227
|
-
});
|
|
228
|
-
|
|
229
|
-
it('accepts valid version: "0.18.0" → cache written', () => {
|
|
230
|
-
// Simulate what writeCache does — write valid semver, then read back
|
|
231
|
-
const cpDir = require('path').join(tmpHome, '.xp-gate');
|
|
232
|
-
const cpFile = require('path').join(cpDir, 'version-cache.json');
|
|
233
|
-
fs.mkdirSync(cpDir, { recursive: true });
|
|
234
|
-
fs.writeFileSync(cpFile, JSON.stringify({ ts: Date.now(), version: '0.18.0', publishedAt: '' }));
|
|
235
|
-
expect(fs.existsSync(cpFile)).toBe(true);
|
|
236
|
-
const cached = JSON.parse(fs.readFileSync(cpFile, 'utf8'));
|
|
237
|
-
expect(cached.version).toBe('0.18.0');
|
|
238
|
-
});
|
|
239
|
-
|
|
240
|
-
it('accepts valid version: "1.0.0" → cache written', () => {
|
|
241
|
-
const cpDir = require('path').join(tmpHome, '.xp-gate');
|
|
242
|
-
const cpFile = require('path').join(cpDir, 'version-cache.json');
|
|
243
|
-
fs.mkdirSync(cpDir, { recursive: true });
|
|
244
|
-
fs.writeFileSync(cpFile, JSON.stringify({ ts: Date.now(), version: '1.0.0', publishedAt: '' }));
|
|
245
|
-
expect(fs.existsSync(cpFile)).toBe(true);
|
|
246
|
-
const cached = JSON.parse(fs.readFileSync(cpFile, 'utf8'));
|
|
247
|
-
expect(cached.version).toBe('1.0.0');
|
|
248
|
-
});
|
|
249
|
-
});
|
|
250
|
-
|
|
251
|
-
// ──────────────────────────────────────────
|
|
252
|
-
// AC-001-04: checkUpgrade() — safe defaults
|
|
253
|
-
// Uses isolated https mock to avoid real network dependency.
|
|
254
|
-
// ──────────────────────────────────────────
|
|
255
|
-
describe('checkUpgrade() — AC-001-04', () => {
|
|
256
|
-
function evictCache() {
|
|
257
|
-
const resolved = require.resolve('../check-version');
|
|
258
|
-
const libPrefix = resolved.replace(/check-version\.js$/, '');
|
|
259
|
-
Object.keys(require.cache).forEach(key => {
|
|
260
|
-
if (key.startsWith(libPrefix)) delete require.cache[key];
|
|
261
|
-
});
|
|
262
|
-
delete require.cache[resolved];
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
async function withMockedHttps(latestVersion, fn) {
|
|
266
|
-
const fsm = require('fs');
|
|
267
|
-
const cpPath = require('path').join(process.env.XP_GATE_CACHE_DIR, 'version-cache.json');
|
|
268
|
-
if (fsm.existsSync(cpPath)) {
|
|
269
|
-
try { fsm.unlinkSync(cpPath); } catch { }
|
|
270
|
-
}
|
|
271
|
-
evictCache();
|
|
272
|
-
const restoreHttpsGet = installFakeHttpsGet(latestVersion);
|
|
273
|
-
// Mock getLocalVersion to return a fixed version so tests don't
|
|
274
|
-
// depend on the real package.json version (which drifts over time).
|
|
275
|
-
const savedReadFileSync = fsm.readFileSync;
|
|
276
|
-
const pkgJsonDir = require('path').join(
|
|
277
|
-
require('path').dirname(require.resolve('../check-version')),
|
|
278
|
-
'..'
|
|
279
|
-
);
|
|
280
|
-
fsm.readFileSync = (...args) => {
|
|
281
|
-
if (String(args[0]).endsWith('package.json') && String(args[0]) === require('path').join(pkgJsonDir, 'package.json')) {
|
|
282
|
-
return JSON.stringify({ name: '@boyingliu01/xp-gate', version: '0.8.21' });
|
|
283
|
-
}
|
|
284
|
-
return savedReadFileSync.apply(fsm, args);
|
|
285
|
-
};
|
|
286
|
-
try {
|
|
287
|
-
const m = require('../check-version');
|
|
288
|
-
return await fn(m);
|
|
289
|
-
} finally {
|
|
290
|
-
restoreHttpsGet();
|
|
291
|
-
fsm.readFileSync = savedReadFileSync;
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
it('returns safe defaults (outdated:false) without network', async () => {
|
|
296
|
-
// Mock https to return the SAME version as local → outdated=false, no network dependency
|
|
297
|
-
const result = await withMockedHttps('0.8.21', async (m) => m.checkUpgrade('@nonexistent/pkg-test-only'));
|
|
298
|
-
expect(result.outdated).toBe(false);
|
|
299
|
-
expect(result.local).toBe('0.8.21');
|
|
300
|
-
expect(result.remote).toBe('0.8.21');
|
|
301
|
-
expect(result.lagDays).toBe(0);
|
|
302
|
-
});
|
|
303
|
-
|
|
304
|
-
it('returns outdated=true when remote > local', async () => {
|
|
305
|
-
const result = await withMockedHttps('99.99.99', async (m) => m.checkUpgrade('@nonexistent/pkg-test-only'));
|
|
306
|
-
expect(result.outdated).toBe(true);
|
|
307
|
-
expect(result.local).toBe('0.8.21');
|
|
308
|
-
expect(result.remote).toBe('99.99.99');
|
|
309
|
-
});
|
|
310
|
-
});
|
|
311
|
-
|
|
312
|
-
// ──────────────────────────────────────────
|
|
313
|
-
// AC-001-02 + AC-001-03 + AC-001-07: getRemoteVersion()
|
|
314
|
-
// ──────────────────────────────────────────
|
|
315
|
-
describe('getRemoteVersion() — AC-001-02, AC-001-03, AC-001-07', () => {
|
|
316
|
-
it('gracefully handles network failure', async () => {
|
|
317
|
-
mod = require('../check-version');
|
|
318
|
-
const r = await mod.getRemoteVersion('@nonexistent/pkg-test-only');
|
|
319
|
-
// Without network: null. With network (npm registry proxy): object.
|
|
320
|
-
expect(r === null || (typeof r.latest === 'string')).toBe(true);
|
|
321
|
-
// This case performs a real registry lookup, so it must be given a budget
|
|
322
|
-
// ABOVE the module's own NETWORK_TIMEOUT_MS (5000). At vitest's 5000ms
|
|
323
|
-
// default the two race, and on a machine where the registry is slow or
|
|
324
|
-
// unreachable the test failed as "Test timed out" -- reporting a stuck test
|
|
325
|
-
// rather than the graceful degradation it exists to verify. Raised here
|
|
326
|
-
// rather than lowering the module timeout, which is deliberate production
|
|
327
|
-
// behaviour.
|
|
328
|
-
}, 20000);
|
|
329
|
-
|
|
330
|
-
// AC-001-02-A: writeCache rejects non-semver versions from registry response
|
|
331
|
-
function evictCache() {
|
|
332
|
-
const resolved = require.resolve('../check-version');
|
|
333
|
-
const libPrefix = resolved.replace(/check-version\.js$/, '');
|
|
334
|
-
Object.keys(require.cache).forEach(key => {
|
|
335
|
-
if (key.startsWith(libPrefix)) delete require.cache[key];
|
|
336
|
-
});
|
|
337
|
-
delete require.cache[resolved];
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
async function withMockedHttpsBox(latestVersion, fn) {
|
|
341
|
-
const fsm = require('fs');
|
|
342
|
-
const cpPath = require('path').join(process.env.XP_GATE_CACHE_DIR, 'version-cache.json');
|
|
343
|
-
if (fsm.existsSync(cpPath)) {
|
|
344
|
-
try { fsm.unlinkSync(cpPath); } catch { }
|
|
345
|
-
}
|
|
346
|
-
evictCache();
|
|
347
|
-
const restoreHttpsGet = installFakeHttpsGet(latestVersion);
|
|
348
|
-
try {
|
|
349
|
-
const m = require('../check-version');
|
|
350
|
-
return await fn(m, cpPath);
|
|
351
|
-
} finally {
|
|
352
|
-
restoreHttpsGet();
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
it('restores HTTPS after an asynchronous callback rejects', async () => {
|
|
357
|
-
const savedGet = require('https').get;
|
|
358
|
-
await expect(withMockedHttpsBox('0.18.0', async () => {
|
|
359
|
-
await Promise.resolve();
|
|
360
|
-
throw new Error('callback failed');
|
|
361
|
-
})).rejects.toThrow('callback failed');
|
|
362
|
-
expect(require('https').get).toBe(savedGet);
|
|
363
|
-
});
|
|
364
|
-
|
|
365
|
-
it('rejects null version from registry — cache NOT written', async () => {
|
|
366
|
-
await withMockedHttpsBox(null, async (m, cpPath) => {
|
|
367
|
-
const r = await m.getRemoteVersion('@test/pkg');
|
|
368
|
-
// null latest is rejected by getRemoteVersion itself (typeof !== 'string')
|
|
369
|
-
// before even reaching writeCache
|
|
370
|
-
expect(r).toBeNull();
|
|
371
|
-
expect(require('fs').existsSync(cpPath)).toBe(false);
|
|
372
|
-
});
|
|
373
|
-
});
|
|
374
|
-
|
|
375
|
-
it('rejects empty version from registry — cache NOT written', async () => {
|
|
376
|
-
await withMockedHttpsBox('', async (m, cpPath) => {
|
|
377
|
-
const r = await m.getRemoteVersion('@test/pkg');
|
|
378
|
-
// getRemoteVersion passes empty string through (it IS a string),
|
|
379
|
-
// but writeCache's semver validation rejects it
|
|
380
|
-
expect(r).not.toBeNull();
|
|
381
|
-
expect(r.latest).toBe('');
|
|
382
|
-
expect(require('fs').existsSync(cpPath)).toBe(false);
|
|
383
|
-
});
|
|
384
|
-
});
|
|
385
|
-
|
|
386
|
-
it('rejects non-semver version from registry — cache NOT written', async () => {
|
|
387
|
-
await withMockedHttpsBox('not-a-version', async (m, cpPath) => {
|
|
388
|
-
const r = await m.getRemoteVersion('@test/pkg');
|
|
389
|
-
// getRemoteVersion passes it through, but writeCache rejects it
|
|
390
|
-
expect(r).not.toBeNull();
|
|
391
|
-
expect(r.latest).toBe('not-a-version');
|
|
392
|
-
expect(require('fs').existsSync(cpPath)).toBe(false);
|
|
393
|
-
});
|
|
394
|
-
});
|
|
395
|
-
|
|
396
|
-
it('accepts valid semver from registry — cache written', async () => {
|
|
397
|
-
await withMockedHttpsBox('0.18.0', async (m, cpPath) => {
|
|
398
|
-
const r = await m.getRemoteVersion('@test/pkg');
|
|
399
|
-
expect(r).not.toBeNull();
|
|
400
|
-
expect(r.latest).toBe('0.18.0');
|
|
401
|
-
expect(require('fs').existsSync(cpPath)).toBe(true);
|
|
402
|
-
const cached = JSON.parse(require('fs').readFileSync(cpPath, 'utf8'));
|
|
403
|
-
expect(cached.version).toBe('0.18.0');
|
|
404
|
-
});
|
|
405
|
-
});
|
|
406
|
-
});
|
|
407
|
-
|
|
408
|
-
// ──────────────────────────────────────────
|
|
409
|
-
// formatUpgradeMsg() — not outdated
|
|
410
|
-
// ──────────────────────────────────────────
|
|
411
|
-
describe('formatUpgradeMsg() — up to date', () => {
|
|
412
|
-
beforeEach(() => { mod = require('../check-version'); });
|
|
413
|
-
const r = { outdated: false, local: '0.8.17', remote: '0.8.17', lagDays: 0 };
|
|
414
|
-
|
|
415
|
-
it('cli shows checkmark', () => {
|
|
416
|
-
expect(mod.formatUpgradeMsg(r, 'cli')).toContain('up to date');
|
|
417
|
-
});
|
|
418
|
-
it('doctor returns empty', () => {
|
|
419
|
-
expect(mod.formatUpgradeMsg(r, 'doctor')).toBe('');
|
|
420
|
-
});
|
|
421
|
-
it('plugin returns empty', () => {
|
|
422
|
-
expect(mod.formatUpgradeMsg(r, 'plugin')).toBe('');
|
|
423
|
-
});
|
|
424
|
-
});
|
|
425
|
-
|
|
426
|
-
// ──────────────────────────────────────────
|
|
427
|
-
// formatUpgradeMsg() — outdated (AC-003-01, AC-003-02, AC-003-03)
|
|
428
|
-
// ──────────────────────────────────────────
|
|
429
|
-
describe('formatUpgradeMsg() — outdated (AC-003-01/02/03)', () => {
|
|
430
|
-
beforeEach(() => { mod = require('../check-version'); });
|
|
431
|
-
const r = { outdated: true, local: '0.8.17', remote: '0.8.13', lagDays: 10 };
|
|
432
|
-
|
|
433
|
-
it('cli: full release link + upgrade cmd (AC-003-01)', () => {
|
|
434
|
-
const msg = mod.formatUpgradeMsg(r, 'cli');
|
|
435
|
-
expect(msg).toContain('v0.8.13');
|
|
436
|
-
expect(msg).toContain('github.com');
|
|
437
|
-
expect(msg).toContain('upgrade --apply');
|
|
438
|
-
});
|
|
439
|
-
|
|
440
|
-
it('doctor: remote version + github + retry (AC-003-02)', () => {
|
|
441
|
-
const msg = mod.formatUpgradeMsg(r, 'doctor');
|
|
442
|
-
expect(msg).toContain('v0.8.13');
|
|
443
|
-
expect(msg).toContain('github.com');
|
|
444
|
-
expect(msg).toContain('upgrade --apply');
|
|
445
|
-
});
|
|
446
|
-
|
|
447
|
-
it('plugin lagDays >7: strong (AC-003-03)', () => {
|
|
448
|
-
const msg = mod.formatUpgradeMsg(r, 'plugin');
|
|
449
|
-
expect(msg).toContain('v0.8.13');
|
|
450
|
-
expect(msg).toContain('upgrade recommended');
|
|
451
|
-
});
|
|
452
|
-
|
|
453
|
-
it('plugin lagDays 1-7: soft (AC-003-03)', () => {
|
|
454
|
-
const msg = mod.formatUpgradeMsg({ ...r, lagDays: 3 }, 'plugin');
|
|
455
|
-
expect(msg).toContain('v0.8.13');
|
|
456
|
-
expect(msg).not.toContain('upgrade recommended');
|
|
457
|
-
});
|
|
458
|
-
|
|
459
|
-
it('plugin lagDays <1: silent (AC-003-03)', () => {
|
|
460
|
-
expect(mod.formatUpgradeMsg({ ...r, lagDays: 0 }, 'plugin')).toBe('');
|
|
461
|
-
});
|
|
462
|
-
});
|
|
463
|
-
});
|