@boyingliu01/xp-gate 0.38.126 → 0.39.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +93 -0
- package/adapters/gate-3.sh +13 -2
- package/adapters/python.sh +36 -38
- package/bin/xp-gate.js +11 -0
- package/build-integrity/gate-10-lines.ts +98 -0
- package/build-integrity/gate-10.ts +98 -109
- package/build-integrity/quote-masker.ts +17 -3
- package/gate-3.sh +13 -2
- package/gates/common-process.ts +116 -34
- package/gates/common.ts +51 -15
- package/gates/gate-3.ts +166 -61
- package/gates/gate-8.ts +76 -24
- package/gates/gate-9.ts +276 -82
- package/gates/pbt-detect.ts +70 -39
- package/gates/python-health.ts +236 -98
- package/gates/test-layers.ts +103 -30
- package/hooks/gate-3.sh +13 -2
- package/hooks/gate-entries/gate-1-entry.sh +10 -1
- package/hooks/gate-entries/gate-5-entry.sh +5 -1
- package/hooks/lib/validate-code-walkthrough.cjs +324 -99
- package/hooks/pre-commit +52 -0
- package/hooks/pre-push +54 -3
- package/lib/agent-runtime-journal.js +104 -37
- package/lib/arch.js +6 -0
- package/lib/baseline.js +329 -201
- package/lib/check.js +38 -2
- package/lib/doctor-constants.js +43 -0
- package/lib/doctor.js +2008 -1001
- package/lib/flaky.js +178 -79
- package/lib/gate-runner.js +110 -63
- package/lib/init.js +6 -0
- package/lib/language-capability-surfaces.js +5 -2
- package/lib/language-registry.js +608 -0
- package/lib/language-tools.js +487 -1018
- package/lib/phase-transition.js +646 -446
- package/lib/prepush-evidence.js +174 -0
- package/lib/sprint-audit.js +52 -22
- package/lib/sprint-discovery.js +66 -35
- package/lib/sprint-format.js +114 -0
- package/lib/sprint-init.js +372 -118
- package/lib/sprint-status.js +134 -90
- package/lib/star-notice.js +346 -0
- package/lib/tool-display.js +52 -0
- package/lib/tool-install.js +179 -0
- package/lib/uninstall.js +331 -188
- package/mock-policy/gate-m3.ts +74 -23
- package/mock-policy/mock-decision-engine.ts +21 -7
- package/mock-policy/scope-scanner.ts +128 -69
- package/mutation/detect-ai-test.ts +20 -12
- package/mutation/gate-m.ts +6 -2
- package/mutation/init-baseline.ts +49 -13
- package/mutation/runners/go-mutant-runner.ts +7 -49
- package/mutation/runners/gremlins-runner.ts +53 -18
- package/mutation/runners/mutmut-runner.ts +455 -163
- package/mutation/runners/pitest-runner.ts +85 -131
- package/mutation/runners/spawn-with-capture.ts +304 -0
- package/mutation/runners/stryker-runner.ts +14 -55
- package/mutation/update-baseline.ts +25 -18
- package/package.json +20 -8
- package/plugins/claude-code/.claude-plugin/plugin.json +1 -1
- package/plugins/claude-code/bin/delphi-review-guard.sh +12 -61
- package/plugins/claude-code/skills/delphi-review/.delphi-config.json.example +6 -11
- package/plugins/claude-code/skills/delphi-review/AGENTS.md +1 -1
- package/plugins/claude-code/skills/reinstall-xp-gate/.architecture-skip +8 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/.github/workflows/test.yml +106 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/CHANGELOG.md +379 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/LICENSE +21 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/QUALITY-OVERVIEW.md +173 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/README.md +167 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/SKILL.md +271 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/TODO.md +253 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/VERSION +1 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/package.json +28 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/scripts/audit.mjs +193 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/scripts/coverage.mjs +140 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/scripts/hp-gate.mjs +175 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/scripts/install.mjs +64 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/scripts/lib/agent-paths.mjs +67 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/scripts/lib/agents.mjs +247 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/scripts/lib/backups.mjs +96 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/scripts/lib/baseline.mjs +101 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/scripts/lib/ccn.mjs +124 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/scripts/lib/delphi.mjs +61 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/scripts/lib/fs-tree.mjs +108 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/scripts/lib/gatecheck.mjs +290 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/scripts/lib/json-file.mjs +37 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/scripts/lib/mutations.mjs +154 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/scripts/lib/platform.mjs +92 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/scripts/lib/probes.mjs +102 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/scripts/lib/proc.mjs +33 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/scripts/lib/report.mjs +29 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/scripts/lib/residue.mjs +188 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/scripts/lib/selfsync.mjs +75 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/scripts/lib/skills.mjs +121 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/scripts/lib/spawn.mjs +161 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/scripts/lib/testreport.mjs +26 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/scripts/lib/tools.mjs +238 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/scripts/lib/util.mjs +33 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/scripts/lib/verdict.mjs +45 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/scripts/lib/version.mjs +29 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/scripts/lib/xp-cli.mjs +66 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/scripts/mutation.mjs +132 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/scripts/preflight.mjs +75 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/scripts/reinstall.mjs +297 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/scripts/setup-wsl.sh +633 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/scripts/verify.mjs +222 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/tests/agents.test.mjs +168 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/tests/baseline.test.mjs +104 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/tests/ccn.test.mjs +87 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/tests/cleanup.test.mjs +128 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/tests/coverage.test.mjs +69 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/tests/delphi.test.mjs +78 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/tests/fixtures.mjs +61 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/tests/gatecheck-audit.test.mjs +157 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/tests/gatecheck.test.mjs +57 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/tests/mutation-anchors.test.mjs +49 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/tests/proc-contract.test.mjs +58 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/tests/proc.test.mjs +243 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/tests/report.test.mjs +66 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/tests/residue.test.mjs +278 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/tests/selfsync.test.mjs +70 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/tests/skills.test.mjs +171 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/tests/testreport.test.mjs +40 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/tests/timeout-budgets.test.mjs +38 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/tests/tools-leaf.test.mjs +323 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/tests/tools-probe.test.mjs +350 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/tests/tools.test.mjs +131 -0
- package/plugins/claude-code/skills/reinstall-xp-gate/tests/util.test.mjs +154 -0
- package/plugins/claude-code/skills/sprint-flow/AGENTS.md +1 -1
- package/plugins/claude-code/skills/test-specification-alignment/AGENTS.md +1 -1
- package/plugins/dsh/package.json +1 -1
- package/plugins/dsh/scripts/prepack.cjs +43 -18
- package/plugins/dsh/scripts/verify-skill-provider.mjs +39 -14
- package/plugins/dsh/skills/delphi-review/.delphi-config.json.example +6 -11
- package/plugins/dsh/skills/delphi-review/AGENTS.md +1 -1
- package/plugins/dsh/skills/sprint-flow/AGENTS.md +1 -1
- package/plugins/dsh/skills/test-specification-alignment/AGENTS.md +1 -1
- package/plugins/opencode/index.ts +337 -123
- package/plugins/opencode/package.json +1 -1
- package/plugins/opencode/scripts/prepack.cjs +41 -16
- package/plugins/opencode/skills/delphi-review/.delphi-config.json.example +6 -11
- package/plugins/opencode/skills/delphi-review/AGENTS.md +1 -1
- package/plugins/opencode/skills/reinstall-xp-gate/.architecture-skip +8 -0
- package/plugins/opencode/skills/reinstall-xp-gate/.github/workflows/test.yml +106 -0
- package/plugins/opencode/skills/reinstall-xp-gate/CHANGELOG.md +379 -0
- package/plugins/opencode/skills/reinstall-xp-gate/LICENSE +21 -0
- package/plugins/opencode/skills/reinstall-xp-gate/QUALITY-OVERVIEW.md +173 -0
- package/plugins/opencode/skills/reinstall-xp-gate/README.md +167 -0
- package/plugins/opencode/skills/reinstall-xp-gate/SKILL.md +271 -0
- package/plugins/opencode/skills/reinstall-xp-gate/TODO.md +253 -0
- package/plugins/opencode/skills/reinstall-xp-gate/VERSION +1 -0
- package/plugins/opencode/skills/reinstall-xp-gate/package.json +28 -0
- package/plugins/opencode/skills/reinstall-xp-gate/scripts/audit.mjs +193 -0
- package/plugins/opencode/skills/reinstall-xp-gate/scripts/coverage.mjs +140 -0
- package/plugins/opencode/skills/reinstall-xp-gate/scripts/hp-gate.mjs +175 -0
- package/plugins/opencode/skills/reinstall-xp-gate/scripts/install.mjs +64 -0
- package/plugins/opencode/skills/reinstall-xp-gate/scripts/lib/agent-paths.mjs +67 -0
- package/plugins/opencode/skills/reinstall-xp-gate/scripts/lib/agents.mjs +247 -0
- package/plugins/opencode/skills/reinstall-xp-gate/scripts/lib/backups.mjs +96 -0
- package/plugins/opencode/skills/reinstall-xp-gate/scripts/lib/baseline.mjs +101 -0
- package/plugins/opencode/skills/reinstall-xp-gate/scripts/lib/ccn.mjs +124 -0
- package/plugins/opencode/skills/reinstall-xp-gate/scripts/lib/delphi.mjs +61 -0
- package/plugins/opencode/skills/reinstall-xp-gate/scripts/lib/fs-tree.mjs +108 -0
- package/plugins/opencode/skills/reinstall-xp-gate/scripts/lib/gatecheck.mjs +290 -0
- package/plugins/opencode/skills/reinstall-xp-gate/scripts/lib/json-file.mjs +37 -0
- package/plugins/opencode/skills/reinstall-xp-gate/scripts/lib/mutations.mjs +154 -0
- package/plugins/opencode/skills/reinstall-xp-gate/scripts/lib/platform.mjs +92 -0
- package/plugins/opencode/skills/reinstall-xp-gate/scripts/lib/probes.mjs +102 -0
- package/plugins/opencode/skills/reinstall-xp-gate/scripts/lib/proc.mjs +33 -0
- package/plugins/opencode/skills/reinstall-xp-gate/scripts/lib/report.mjs +29 -0
- package/plugins/opencode/skills/reinstall-xp-gate/scripts/lib/residue.mjs +188 -0
- package/plugins/opencode/skills/reinstall-xp-gate/scripts/lib/selfsync.mjs +75 -0
- package/plugins/opencode/skills/reinstall-xp-gate/scripts/lib/skills.mjs +121 -0
- package/plugins/opencode/skills/reinstall-xp-gate/scripts/lib/spawn.mjs +161 -0
- package/plugins/opencode/skills/reinstall-xp-gate/scripts/lib/testreport.mjs +26 -0
- package/plugins/opencode/skills/reinstall-xp-gate/scripts/lib/tools.mjs +238 -0
- package/plugins/opencode/skills/reinstall-xp-gate/scripts/lib/util.mjs +33 -0
- package/plugins/opencode/skills/reinstall-xp-gate/scripts/lib/verdict.mjs +45 -0
- package/plugins/opencode/skills/reinstall-xp-gate/scripts/lib/version.mjs +29 -0
- package/plugins/opencode/skills/reinstall-xp-gate/scripts/lib/xp-cli.mjs +66 -0
- package/plugins/opencode/skills/reinstall-xp-gate/scripts/mutation.mjs +132 -0
- package/plugins/opencode/skills/reinstall-xp-gate/scripts/preflight.mjs +75 -0
- package/plugins/opencode/skills/reinstall-xp-gate/scripts/reinstall.mjs +297 -0
- package/plugins/opencode/skills/reinstall-xp-gate/scripts/setup-wsl.sh +633 -0
- package/plugins/opencode/skills/reinstall-xp-gate/scripts/verify.mjs +222 -0
- package/plugins/opencode/skills/reinstall-xp-gate/tests/agents.test.mjs +168 -0
- package/plugins/opencode/skills/reinstall-xp-gate/tests/baseline.test.mjs +104 -0
- package/plugins/opencode/skills/reinstall-xp-gate/tests/ccn.test.mjs +87 -0
- package/plugins/opencode/skills/reinstall-xp-gate/tests/cleanup.test.mjs +128 -0
- package/plugins/opencode/skills/reinstall-xp-gate/tests/coverage.test.mjs +69 -0
- package/plugins/opencode/skills/reinstall-xp-gate/tests/delphi.test.mjs +78 -0
- package/plugins/opencode/skills/reinstall-xp-gate/tests/fixtures.mjs +61 -0
- package/plugins/opencode/skills/reinstall-xp-gate/tests/gatecheck-audit.test.mjs +157 -0
- package/plugins/opencode/skills/reinstall-xp-gate/tests/gatecheck.test.mjs +57 -0
- package/plugins/opencode/skills/reinstall-xp-gate/tests/mutation-anchors.test.mjs +49 -0
- package/plugins/opencode/skills/reinstall-xp-gate/tests/proc-contract.test.mjs +58 -0
- package/plugins/opencode/skills/reinstall-xp-gate/tests/proc.test.mjs +243 -0
- package/plugins/opencode/skills/reinstall-xp-gate/tests/report.test.mjs +66 -0
- package/plugins/opencode/skills/reinstall-xp-gate/tests/residue.test.mjs +278 -0
- package/plugins/opencode/skills/reinstall-xp-gate/tests/selfsync.test.mjs +70 -0
- package/plugins/opencode/skills/reinstall-xp-gate/tests/skills.test.mjs +171 -0
- package/plugins/opencode/skills/reinstall-xp-gate/tests/testreport.test.mjs +40 -0
- package/plugins/opencode/skills/reinstall-xp-gate/tests/timeout-budgets.test.mjs +38 -0
- package/plugins/opencode/skills/reinstall-xp-gate/tests/tools-leaf.test.mjs +323 -0
- package/plugins/opencode/skills/reinstall-xp-gate/tests/tools-probe.test.mjs +350 -0
- package/plugins/opencode/skills/reinstall-xp-gate/tests/tools.test.mjs +131 -0
- package/plugins/opencode/skills/reinstall-xp-gate/tests/util.test.mjs +154 -0
- package/plugins/opencode/skills/sprint-flow/AGENTS.md +1 -1
- package/plugins/opencode/skills/test-specification-alignment/AGENTS.md +1 -1
- package/plugins/qoder/bin/sprint-flow-guard.sh +12 -60
- package/plugins/qoder/plugin.json +1 -1
- package/plugins/qoder/skills/delphi-review/.delphi-config.json.example +6 -11
- package/plugins/qoder/skills/delphi-review/AGENTS.md +1 -1
- package/plugins/qoder/skills/sprint-flow/AGENTS.md +1 -1
- package/plugins/qoder/skills/test-specification-alignment/AGENTS.md +1 -1
- package/plugins/shared/README.md +3 -0
- package/plugins/shared/bin/delphi-review-guard.sh +68 -0
- package/principles/adapters/control-nesting.ts +481 -168
- package/principles/adapters/cpp.ts +61 -22
- package/principles/adapters/csharp.ts +183 -66
- package/principles/adapters/dart.ts +11 -1
- package/principles/adapters/duplication.ts +49 -16
- package/principles/adapters/import-clause.ts +62 -15
- package/principles/adapters/java.ts +199 -70
- package/principles/adapters/line-comment.ts +18 -0
- package/principles/adapters/member-scan.ts +50 -8
- package/principles/adapters/php.ts +232 -103
- package/principles/adapters/python.ts +25 -18
- package/principles/adapters/quote-state.ts +21 -8
- package/principles/adapters/typescript-mask.ts +276 -0
- package/principles/adapters/typescript.ts +206 -200
- package/principles/analyzer.ts +16 -6
- package/principles/baseline-prune.ts +18 -8
- package/principles/baseline.ts +28 -11
- package/principles/boy-scout-usage.ts +26 -0
- package/principles/boy-scout.ts +261 -180
- package/principles/config.ts +183 -57
- package/principles/direct-execution.ts +24 -12
- package/principles/lint-baseline.ts +235 -122
- package/principles/rules/arch/dependency.ts +34 -25
- package/principles/rules/arch/shared.ts +24 -20
- package/principles/rules/clean-code/deep-nesting.ts +23 -13
- package/principles/rules/clean-code/god-class.ts +67 -41
- package/principles/rules/clean-code/large-file.ts +30 -23
- package/principles/rules/clean-code/long-function.ts +51 -37
- package/principles/rules/clean-code/magic-numbers.ts +51 -36
- package/principles/rules/clean-code/many-exports.ts +46 -29
- package/principles/rules/clean-code/missing-error-handling.ts +38 -20
- package/principles/rules/clean-code/too-many-params.ts +41 -22
- package/principles/rules/function-source.ts +62 -0
- package/principles/rules/solid/dip.ts +10 -6
- package/principles/rules/solid/isp.ts +64 -24
- package/principles/rules/solid/lsp.ts +66 -18
- package/principles/rules/solid/ocp.ts +29 -13
- package/principles/rules/solid/srp.ts +34 -18
- package/principles/warnings-count.ts +43 -0
- package/scripts/__tests__/prepush-source-classification.test.js +129 -0
- package/scripts/delphi-config-read.cjs +245 -0
- package/scripts/delphi-external-review.cjs +410 -585
- package/scripts/delphi-json-extract.cjs +108 -0
- package/scripts/delphi-model-validation.cjs +297 -0
- package/scripts/delphi-prompts.cjs +55 -0
- package/scripts/delphi-repo-tools.cjs +273 -0
- package/scripts/delphi-seat-calibration.cjs +204 -0
- package/scripts/run-bats-ci.cjs +240 -97
- package/scripts/sync-package-content.js +18 -2
- package/skills/delphi-review/.delphi-config.json.example +6 -11
- package/skills/delphi-review/AGENTS.md +1 -1
- package/skills/sprint-flow/AGENTS.md +1 -1
- package/skills/test-specification-alignment/AGENTS.md +1 -1
- package/lib/__tests__/agent-runtime-journal.test.js +0 -326
- package/lib/__tests__/arch-config-template.test.js +0 -190
- package/lib/__tests__/arch.test.js +0 -430
- package/lib/__tests__/assertion-debt.test.js +0 -99
- package/lib/__tests__/audit-cli-contract.test.ts +0 -117
- package/lib/__tests__/audit-log.test.ts +0 -107
- package/lib/__tests__/audit-skip-reasons.test.ts +0 -143
- package/lib/__tests__/baseline-completeness.test.js +0 -264
- package/lib/__tests__/baseline-shell-scope.test.js +0 -60
- package/lib/__tests__/baseline-unevaluated.test.js +0 -142
- package/lib/__tests__/baseline.test.js +0 -212
- package/lib/__tests__/bootstrap.test.js +0 -60
- package/lib/__tests__/check-alignment-cli.test.mjs +0 -94
- package/lib/__tests__/check-alignment-reasons.test.mjs +0 -101
- package/lib/__tests__/check-all-skip-accounting.test.js +0 -171
- package/lib/__tests__/check-changed-brief.test.js +0 -63
- package/lib/__tests__/check-normalize-exit.test.js +0 -24
- package/lib/__tests__/check-single-file.test.js +0 -114
- package/lib/__tests__/check-tools-list.test.js +0 -155
- package/lib/__tests__/check-version.test.js +0 -463
- package/lib/__tests__/coverage-scope.test.js +0 -140
- package/lib/__tests__/coverage-threshold.test.js +0 -80
- package/lib/__tests__/crap-cli.test.js +0 -87
- package/lib/__tests__/crap.test.js +0 -494
- package/lib/__tests__/debt-classify.test.js +0 -78
- package/lib/__tests__/delphi-channel-doctor.test.js +0 -116
- package/lib/__tests__/delphi-channel-uninstall.test.js +0 -128
- package/lib/__tests__/delphi-channel.test.js +0 -109
- package/lib/__tests__/delphi-setup.test.js +0 -203
- package/lib/__tests__/deploy-manifest-check-wired.test.js +0 -138
- package/lib/__tests__/deploy-manifest-completeness.test.js +0 -151
- package/lib/__tests__/deploy-manifest-consumers-adapter-uninstall.test.js +0 -40
- package/lib/__tests__/deploy-manifest-consumers-no-private-lists.test.js +0 -74
- package/lib/__tests__/deploy-manifest-projection.test.js +0 -66
- package/lib/__tests__/deploy-manifest-shell-parity.test.js +0 -108
- package/lib/__tests__/deploy-manifest.test.js +0 -97
- package/lib/__tests__/detect-deps-dsh-profile.test.js +0 -323
- package/lib/__tests__/detect-deps-gate-identity.test.js +0 -135
- package/lib/__tests__/detect-deps.test.js +0 -655
- package/lib/__tests__/doctor-469-hook-env.test.js +0 -211
- package/lib/__tests__/doctor-arch-tools.test.js +0 -169
- package/lib/__tests__/doctor-audit-ledger.test.js +0 -61
- package/lib/__tests__/doctor-brief.test.js +0 -59
- package/lib/__tests__/doctor-delphi.test.js +0 -628
- package/lib/__tests__/doctor-drift-direction.test.js +0 -104
- package/lib/__tests__/doctor-drift-round2.test.js +0 -215
- package/lib/__tests__/doctor-exec-retry.test.js +0 -162
- package/lib/__tests__/doctor-executed-surface.test.js +0 -230
- package/lib/__tests__/doctor-helpers.test.js +0 -139
- package/lib/__tests__/doctor-hook-drift.test.js +0 -329
- package/lib/__tests__/doctor-hook-signatures.test.js +0 -65
- package/lib/__tests__/doctor-machine-mutation.test.js +0 -116
- package/lib/__tests__/doctor-module-drift.test.js +0 -212
- package/lib/__tests__/doctor-module-resolution-parity.test.js +0 -463
- package/lib/__tests__/doctor-path-equivalence.test.js +0 -70
- package/lib/__tests__/doctor-repair-boundary.test.js +0 -52
- package/lib/__tests__/doctor-signature-stability.test.js +0 -55
- package/lib/__tests__/doctor-spawn-capability.test.js +0 -116
- package/lib/__tests__/doctor-timeout-partial.test.js +0 -79
- package/lib/__tests__/doctor-tool-delegation.test.js +0 -156
- package/lib/__tests__/doctor-tui-skill-freshness.test.js +0 -385
- package/lib/__tests__/doctor.test.js +0 -1320
- package/lib/__tests__/find-bash-wsl.test.js +0 -121
- package/lib/__tests__/flaky.test.js +0 -128
- package/lib/__tests__/foreign-hooks-global.test.js +0 -125
- package/lib/__tests__/gate-audit-skip.test.ts +0 -81
- package/lib/__tests__/gate-audit.test.ts +0 -440
- package/lib/__tests__/gate-coverage-hook-floor.test.js +0 -94
- package/lib/__tests__/gate-coverage.test.js +0 -204
- package/lib/__tests__/gate-entry-provenance.test.js +0 -71
- package/lib/__tests__/gate-numbering.test.js +0 -79
- package/lib/__tests__/gate-rules.test.js +0 -58
- package/lib/__tests__/gate-runner-tsx-invocation.test.js +0 -149
- package/lib/__tests__/gate-runner-verdict.test.js +0 -105
- package/lib/__tests__/gate-runner.test.js +0 -371
- package/lib/__tests__/gate2-verdict.test.js +0 -183
- package/lib/__tests__/helpers/lib-sandbox.cjs +0 -55
- package/lib/__tests__/hook-health-path.test.js +0 -109
- package/lib/__tests__/hook-health.test.js +0 -85
- package/lib/__tests__/init-gitignore.test.js +0 -204
- package/lib/__tests__/init-gitleaks-notice.test.js +0 -57
- package/lib/__tests__/init.test.js +0 -530
- package/lib/__tests__/install-cmd.test.js +0 -6
- package/lib/__tests__/install-sh-deploy-manifest.test.js +0 -80
- package/lib/__tests__/install-skill-full-dir.test.js +0 -194
- package/lib/__tests__/install-skill.test.js +0 -416
- package/lib/__tests__/install-tools-repair.test.js +0 -263
- package/lib/__tests__/issue-519-phase-transition-guard.test.js +0 -233
- package/lib/__tests__/issue-566-sync-hooks-backup.test.js +0 -228
- package/lib/__tests__/issue-583-hook-deploy-log.test.js +0 -121
- package/lib/__tests__/issue-586-principles-cmdline.test.js +0 -218
- package/lib/__tests__/issue-589-check-all-gate3.test.js +0 -190
- package/lib/__tests__/issue-590-archlint-vacuous-pass.test.js +0 -138
- package/lib/__tests__/issue-618-gate-not-run.test.js +0 -100
- package/lib/__tests__/jscpd-entry-resolution.test.js +0 -143
- package/lib/__tests__/language-capability.test.js +0 -318
- package/lib/__tests__/language-tools-build-file-install.test.js +0 -82
- package/lib/__tests__/language-tools-detect.test.js +0 -301
- package/lib/__tests__/migrate.test.js +0 -232
- package/lib/__tests__/mirror-manifest.test.js +0 -64
- package/lib/__tests__/mirror-sync.test.js +0 -803
- package/lib/__tests__/next-sprint.test.js +0 -231
- package/lib/__tests__/npm-package.test.js +0 -140
- package/lib/__tests__/phase-transition.test.js +0 -1136
- package/lib/__tests__/principles-csharp-coverage.test.js +0 -227
- package/lib/__tests__/principles-directory.test.js +0 -87
- package/lib/__tests__/qoder-delphi-agents.test.js +0 -316
- package/lib/__tests__/retro-gate-m.test.js +0 -144
- package/lib/__tests__/retro.test.js +0 -131
- package/lib/__tests__/rework.test.js +0 -127
- package/lib/__tests__/rollback.test.js +0 -183
- package/lib/__tests__/runtime-journal.test.js +0 -164
- package/lib/__tests__/sastd-client.test.js +0 -514
- package/lib/__tests__/shared-paths-lazy-home.test.js +0 -67
- package/lib/__tests__/shared-paths.test.js +0 -130
- package/lib/__tests__/shared-utils-copyHooks-manifest.test.js +0 -69
- package/lib/__tests__/shared-utils.test.js +0 -180
- package/lib/__tests__/skill-flags.test.js +0 -48
- package/lib/__tests__/slo.test.js +0 -89
- package/lib/__tests__/sprint-audit.test.js +0 -207
- package/lib/__tests__/sprint-discovery.test.ts +0 -366
- package/lib/__tests__/sprint-state-manager.test.js +0 -310
- package/lib/__tests__/sprint-status-rework-704.test.js +0 -149
- package/lib/__tests__/sprint-status-rework.test.js +0 -329
- package/lib/__tests__/sprint-status.test.js +0 -193
- package/lib/__tests__/sprint-status.test.ts +0 -213
- package/lib/__tests__/test-alignment-java-702.test.ts +0 -177
- package/lib/__tests__/test-alignment-range-guard.test.ts +0 -82
- package/lib/__tests__/test-alignment.test.ts +0 -853
- package/lib/__tests__/tool-audit-collect.test.js +0 -184
- package/lib/__tests__/tool-audit-fixtures.js +0 -87
- package/lib/__tests__/tool-audit-latest.test.js +0 -84
- package/lib/__tests__/tool-audit.test.js +0 -428
- package/lib/__tests__/tsconfig.json +0 -8
- package/lib/__tests__/tsx-resolution.test.js +0 -89
- package/lib/__tests__/ui-detector.test.ts +0 -459
- package/lib/__tests__/ui-review.test.ts +0 -132
- package/lib/__tests__/uninstall-global-residue.test.js +0 -545
- package/lib/__tests__/uninstall-skill.test.js +0 -189
- package/lib/__tests__/uninstall.test.js +0 -717
- package/lib/__tests__/update-hooks.test.js +0 -737
- package/lib/__tests__/update-skill-flags.test.js +0 -78
- package/lib/__tests__/update-skill.test.js +0 -644
- package/lib/__tests__/upgrade-exec.test.js +0 -273
- package/lib/__tests__/upgrade-skill-sync.test.js +0 -65
- package/lib/__tests__/upgrade.test.js +0 -78
- package/lib/__tests__/windows-bash-probe.test.js +0 -123
- package/lib/check-alignment-runner.cjs +0 -97
- package/lib/coverage-total.sh +0 -92
- package/lib/layer-baseline.cjs +0 -94
- package/lib/mattpocock-license-verdict.json +0 -7
package/lib/language-tools.js
CHANGED
|
@@ -45,592 +45,7 @@ const { GATE_CLI_TOOLS } = require('./detect-deps.js');
|
|
|
45
45
|
/**
|
|
46
46
|
* Registry of all supported languages and their tools.
|
|
47
47
|
*/
|
|
48
|
-
const LANGUAGE_REGISTRY =
|
|
49
|
-
typescript: {
|
|
50
|
-
name: 'TypeScript/JavaScript',
|
|
51
|
-
extensions: ['ts', 'tsx', 'js', 'jsx', 'mjs'],
|
|
52
|
-
configFiles: ['package.json', 'tsconfig.json'],
|
|
53
|
-
tools: [
|
|
54
|
-
{
|
|
55
|
-
name: 'eslint',
|
|
56
|
-
checkCmd: 'eslint --version',
|
|
57
|
-
install: {
|
|
58
|
-
darwin: 'npm install -g eslint',
|
|
59
|
-
linux: 'npm install -g eslint',
|
|
60
|
-
win32: 'npm install -g eslint',
|
|
61
|
-
},
|
|
62
|
-
optional: false,
|
|
63
|
-
gates: ['Gate 1 (Code Quality)'],
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
name: '@archlinter/cli',
|
|
67
|
-
checkCmd: 'npx --no-install archlint --version',
|
|
68
|
-
install: {
|
|
69
|
-
darwin: 'npm install --save-dev @archlinter/cli',
|
|
70
|
-
linux: 'npm install --save-dev @archlinter/cli',
|
|
71
|
-
win32: 'npm install --save-dev @archlinter/cli',
|
|
72
|
-
},
|
|
73
|
-
optional: true,
|
|
74
|
-
gates: ['Gate 4 (Architecture)'],
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
name: 'dependency-cruiser',
|
|
78
|
-
checkCmd: 'npx --no-install depcruise --version',
|
|
79
|
-
install: {
|
|
80
|
-
darwin: 'npm install --save-dev dependency-cruiser',
|
|
81
|
-
linux: 'npm install --save-dev dependency-cruiser',
|
|
82
|
-
win32: 'npm install --save-dev dependency-cruiser',
|
|
83
|
-
},
|
|
84
|
-
optional: true,
|
|
85
|
-
gates: ['Gate 4 (Architecture)'],
|
|
86
|
-
},
|
|
87
|
-
],
|
|
88
|
-
},
|
|
89
|
-
|
|
90
|
-
python: {
|
|
91
|
-
name: 'Python',
|
|
92
|
-
extensions: ['py'],
|
|
93
|
-
configFiles: ['pyproject.toml', 'setup.py', 'requirements.txt', 'Pipfile'],
|
|
94
|
-
tools: [
|
|
95
|
-
{
|
|
96
|
-
name: 'mypy',
|
|
97
|
-
checkCmd: 'mypy --version',
|
|
98
|
-
install: {
|
|
99
|
-
darwin: 'pip install mypy',
|
|
100
|
-
linux: 'pip install mypy',
|
|
101
|
-
win32: 'pip install mypy',
|
|
102
|
-
},
|
|
103
|
-
optional: false,
|
|
104
|
-
gates: ['Gate 1 (Code Quality)'],
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
name: 'ruff',
|
|
108
|
-
checkCmd: 'ruff --version',
|
|
109
|
-
install: {
|
|
110
|
-
darwin: 'pip install ruff',
|
|
111
|
-
linux: 'pip install ruff',
|
|
112
|
-
win32: 'pip install ruff',
|
|
113
|
-
},
|
|
114
|
-
optional: true, // fallback to flake8
|
|
115
|
-
gates: ['Gate 1 (Code Quality)'],
|
|
116
|
-
},
|
|
117
|
-
{
|
|
118
|
-
name: 'flake8',
|
|
119
|
-
checkCmd: 'flake8 --version',
|
|
120
|
-
install: {
|
|
121
|
-
darwin: 'pip install flake8',
|
|
122
|
-
linux: 'pip install flake8',
|
|
123
|
-
win32: 'pip install flake8',
|
|
124
|
-
},
|
|
125
|
-
optional: true, // fallback if no ruff
|
|
126
|
-
gates: ['Gate 1 (Code Quality)'],
|
|
127
|
-
},
|
|
128
|
-
{
|
|
129
|
-
name: 'pytest',
|
|
130
|
-
checkCmd: 'pytest --version',
|
|
131
|
-
install: {
|
|
132
|
-
darwin: 'pip install pytest',
|
|
133
|
-
linux: 'pip install pytest',
|
|
134
|
-
win32: 'pip install pytest',
|
|
135
|
-
},
|
|
136
|
-
optional: false,
|
|
137
|
-
gates: ['Gate 5 (Tests + Coverage)'],
|
|
138
|
-
},
|
|
139
|
-
{
|
|
140
|
-
name: 'black',
|
|
141
|
-
checkCmd: 'black --version',
|
|
142
|
-
install: {
|
|
143
|
-
darwin: 'pip install black',
|
|
144
|
-
linux: 'pip install black',
|
|
145
|
-
win32: 'pip install black',
|
|
146
|
-
},
|
|
147
|
-
optional: true,
|
|
148
|
-
gates: ['Gate 1 (Code Formatting)'],
|
|
149
|
-
},
|
|
150
|
-
{
|
|
151
|
-
name: 'import-linter',
|
|
152
|
-
checkCmd: 'lint-imports --version',
|
|
153
|
-
install: {
|
|
154
|
-
darwin: 'pip install import-linter',
|
|
155
|
-
linux: 'pip install import-linter',
|
|
156
|
-
win32: 'pip install import-linter',
|
|
157
|
-
},
|
|
158
|
-
optional: true,
|
|
159
|
-
gates: ['Gate 4 (Architecture)'],
|
|
160
|
-
},
|
|
161
|
-
],
|
|
162
|
-
},
|
|
163
|
-
|
|
164
|
-
java: {
|
|
165
|
-
name: 'Java',
|
|
166
|
-
extensions: ['java'],
|
|
167
|
-
configFiles: ['pom.xml', 'build.gradle', 'build.gradle.kts'],
|
|
168
|
-
tools: [
|
|
169
|
-
{
|
|
170
|
-
name: 'mvn',
|
|
171
|
-
checkCmd: 'mvn --version',
|
|
172
|
-
install: {
|
|
173
|
-
darwin: 'brew install maven',
|
|
174
|
-
linux: 'apt-get install maven || yum install maven',
|
|
175
|
-
win32: 'winget install Apache.Maven',
|
|
176
|
-
},
|
|
177
|
-
optional: true, // only if Maven project
|
|
178
|
-
gates: ['Gate 1 (Build)'],
|
|
179
|
-
},
|
|
180
|
-
{
|
|
181
|
-
name: 'gradle',
|
|
182
|
-
checkCmd: 'gradle --version',
|
|
183
|
-
install: {
|
|
184
|
-
darwin: 'brew install gradle',
|
|
185
|
-
linux: 'apt-get install gradle || yum install gradle',
|
|
186
|
-
win32: 'winget install Gradle.Gradle',
|
|
187
|
-
},
|
|
188
|
-
optional: true, // only if Gradle project
|
|
189
|
-
gates: ['Gate 1 (Build)'],
|
|
190
|
-
},
|
|
191
|
-
{
|
|
192
|
-
name: 'checkstyle',
|
|
193
|
-
checkCmd: 'checkstyle --version',
|
|
194
|
-
install: {
|
|
195
|
-
darwin: 'brew install checkstyle',
|
|
196
|
-
linux: 'apt-get install checkstyle',
|
|
197
|
-
win32: 'choco install checkstyle',
|
|
198
|
-
},
|
|
199
|
-
optional: true,
|
|
200
|
-
gates: ['Gate 1 (Code Quality)'],
|
|
201
|
-
},
|
|
202
|
-
{
|
|
203
|
-
name: 'pmd',
|
|
204
|
-
checkCmd: 'pmd --version',
|
|
205
|
-
install: {
|
|
206
|
-
darwin: 'brew install pmd',
|
|
207
|
-
linux: 'apt-get install pmd',
|
|
208
|
-
win32: 'choco install pmd',
|
|
209
|
-
},
|
|
210
|
-
optional: true,
|
|
211
|
-
gates: ['Gate 1 (Code Quality)'],
|
|
212
|
-
},
|
|
213
|
-
{
|
|
214
|
-
// A BUILD dependency, not a CLI: there is no `archunit` binary to probe,
|
|
215
|
-
// so checkCmd cannot work here. Detected by scanning the build files.
|
|
216
|
-
name: 'archunit',
|
|
217
|
-
detectBy: 'build-file',
|
|
218
|
-
install: {
|
|
219
|
-
darwin: 'add "com.tngtech.archunit:archunit-junit5" to pom.xml / build.gradle',
|
|
220
|
-
linux: 'add "com.tngtech.archunit:archunit-junit5" to pom.xml / build.gradle',
|
|
221
|
-
win32: 'add "com.tngtech.archunit:archunit-junit5" to pom.xml / build.gradle',
|
|
222
|
-
},
|
|
223
|
-
optional: true,
|
|
224
|
-
gates: ['Gate 4 (Architecture)'],
|
|
225
|
-
},
|
|
226
|
-
],
|
|
227
|
-
},
|
|
228
|
-
|
|
229
|
-
go: {
|
|
230
|
-
name: 'Go',
|
|
231
|
-
extensions: ['go'],
|
|
232
|
-
configFiles: ['go.mod', 'go.sum'],
|
|
233
|
-
tools: [
|
|
234
|
-
{
|
|
235
|
-
name: 'go',
|
|
236
|
-
checkCmd: 'go version',
|
|
237
|
-
install: {
|
|
238
|
-
darwin: 'brew install go',
|
|
239
|
-
linux: 'apt-get install golang || yum install golang',
|
|
240
|
-
win32: 'winget install GoLang.Go',
|
|
241
|
-
},
|
|
242
|
-
optional: false,
|
|
243
|
-
gates: ['Gate 1 (Build + Quality)'],
|
|
244
|
-
},
|
|
245
|
-
{
|
|
246
|
-
name: 'golangci-lint',
|
|
247
|
-
checkCmd: 'golangci-lint --version',
|
|
248
|
-
install: {
|
|
249
|
-
darwin: 'brew install golangci-lint',
|
|
250
|
-
linux: 'go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest',
|
|
251
|
-
win32: 'go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest',
|
|
252
|
-
},
|
|
253
|
-
optional: true,
|
|
254
|
-
gates: ['Gate 1 (Code Quality)'],
|
|
255
|
-
},
|
|
256
|
-
{
|
|
257
|
-
name: 'arch-go',
|
|
258
|
-
checkCmd: 'arch-go --version',
|
|
259
|
-
install: {
|
|
260
|
-
darwin: 'go install github.com/fdaines/arch-go@latest',
|
|
261
|
-
linux: 'go install github.com/fdaines/arch-go@latest',
|
|
262
|
-
win32: 'go install github.com/fdaines/arch-go@latest',
|
|
263
|
-
},
|
|
264
|
-
optional: true,
|
|
265
|
-
gates: ['Gate 4 (Architecture)'],
|
|
266
|
-
},
|
|
267
|
-
],
|
|
268
|
-
},
|
|
269
|
-
|
|
270
|
-
kotlin: {
|
|
271
|
-
name: 'Kotlin',
|
|
272
|
-
extensions: ['kt', 'kts'],
|
|
273
|
-
configFiles: ['build.gradle', 'build.gradle.kts', 'pom.xml'],
|
|
274
|
-
tools: [
|
|
275
|
-
{
|
|
276
|
-
name: 'gradle',
|
|
277
|
-
checkCmd: 'gradle --version',
|
|
278
|
-
install: {
|
|
279
|
-
darwin: 'brew install gradle',
|
|
280
|
-
linux: 'apt-get install gradle',
|
|
281
|
-
win32: 'winget install Gradle.Gradle',
|
|
282
|
-
},
|
|
283
|
-
optional: true,
|
|
284
|
-
gates: ['Gate 1 (Build)'],
|
|
285
|
-
},
|
|
286
|
-
{
|
|
287
|
-
name: 'ktlint',
|
|
288
|
-
checkCmd: 'ktlint --version',
|
|
289
|
-
install: {
|
|
290
|
-
darwin: 'brew install ktlint',
|
|
291
|
-
linux: 'curl -sSLO https://github.com/pinterest/ktlint/releases/latest/download/ktlint && chmod +x ktlint',
|
|
292
|
-
win32: 'choco install ktlint',
|
|
293
|
-
},
|
|
294
|
-
optional: true,
|
|
295
|
-
gates: ['Gate 1 (Code Quality)'],
|
|
296
|
-
},
|
|
297
|
-
{
|
|
298
|
-
// Konsist is a build dependency too -- see the Java ArchUnit note above.
|
|
299
|
-
name: 'konsist',
|
|
300
|
-
detectBy: 'build-file',
|
|
301
|
-
install: {
|
|
302
|
-
darwin: 'add "com.lemonappdev:konsist" to build.gradle(.kts)',
|
|
303
|
-
linux: 'add "com.lemonappdev:konsist" to build.gradle(.kts)',
|
|
304
|
-
win32: 'add "com.lemonappdev:konsist" to build.gradle(.kts)',
|
|
305
|
-
},
|
|
306
|
-
optional: true,
|
|
307
|
-
gates: ['Gate 4 (Architecture)'],
|
|
308
|
-
},
|
|
309
|
-
],
|
|
310
|
-
},
|
|
311
|
-
|
|
312
|
-
// #730: C# was supported by every gate (adapter, principles engine, Gate 4/5/6/10/13
|
|
313
|
-
// arms) but absent here, so `detect-languages` produced a config WITHOUT csharp.
|
|
314
|
-
// A hook that reads the generated config trusts it and does not fall back to
|
|
315
|
-
// extension sniffing, so C# was never routed — the whole feature was invisible in
|
|
316
|
-
// exactly the mixed .NET+JS repos it targets (the dsh-aot-runner shape: .csproj plus
|
|
317
|
-
// ~900 lines of JS). Registry membership is what makes detection emit the entry.
|
|
318
|
-
csharp: {
|
|
319
|
-
name: 'C#/.NET',
|
|
320
|
-
extensions: ['cs', 'csx'],
|
|
321
|
-
// `.csproj`/`.sln` are SUFFIXES of project-specific filenames (Foo.csproj), so
|
|
322
|
-
// they must be written as globs — the matcher only globs entries containing '*'
|
|
323
|
-
// and otherwise stats the exact name, which would never find DshAotRunner.csproj.
|
|
324
|
-
// Directory.Build.props carries repo-wide MSBuild settings; global.json pins the
|
|
325
|
-
// SDK, so a repo with only that plus sources still deserves the C# arm.
|
|
326
|
-
configFiles: ['*.csproj', '*.sln', '*.csproj.user', 'Directory.Build.props', 'global.json'],
|
|
327
|
-
tools: [
|
|
328
|
-
{
|
|
329
|
-
// The adapter drives everything through the SDK: `dotnet format` for Gate 1,
|
|
330
|
-
// `dotnet build -warnaserror` for Gate 13, `dotnet test` for Gate 5.
|
|
331
|
-
name: 'dotnet',
|
|
332
|
-
checkCmd: 'dotnet --version',
|
|
333
|
-
install: {
|
|
334
|
-
darwin: 'brew install --cask dotnet-sdk',
|
|
335
|
-
linux: 'See https://learn.microsoft.com/dotnet/core/install/linux',
|
|
336
|
-
win32: 'winget install Microsoft.DotNet.SDK.8',
|
|
337
|
-
},
|
|
338
|
-
optional: false,
|
|
339
|
-
gates: ['Gate 1 (Code Quality)', 'Gate 5 (Tests + Coverage)', 'Gate 13 (Compiler Strictness)'],
|
|
340
|
-
},
|
|
341
|
-
// No second C# entry for coverage. `dotnet test --collect` supplies it, and
|
|
342
|
-
// the only project-provided detector this module implements is
|
|
343
|
-
// `detectBy: 'build-file'`, which reads ARCH_DEPENDENCY_COORDINATES — a table
|
|
344
|
-
// with no C# entry. Listing coverlet under a detectBy value nothing consumes
|
|
345
|
-
// would make check-tools probe a tool with no checkCmd and report a
|
|
346
|
-
// permanently-missing entry for a dependency that is already satisfied.
|
|
347
|
-
],
|
|
348
|
-
},
|
|
349
|
-
|
|
350
|
-
swift: {
|
|
351
|
-
name: 'Swift',
|
|
352
|
-
extensions: ['swift'],
|
|
353
|
-
configFiles: ['Package.swift', 'project.xcodeproj', 'project.pbxproj'],
|
|
354
|
-
tools: [
|
|
355
|
-
{
|
|
356
|
-
name: 'swift',
|
|
357
|
-
checkCmd: 'swift --version',
|
|
358
|
-
install: {
|
|
359
|
-
darwin: 'xcode-select --install',
|
|
360
|
-
linux: 'See https://swift.org/download/',
|
|
361
|
-
win32: 'See https://swift.org/download/',
|
|
362
|
-
},
|
|
363
|
-
optional: false,
|
|
364
|
-
gates: ['Gate 1 (Build + Quality)'],
|
|
365
|
-
},
|
|
366
|
-
{
|
|
367
|
-
name: 'swiftlint',
|
|
368
|
-
checkCmd: 'swiftlint --version',
|
|
369
|
-
install: {
|
|
370
|
-
darwin: 'brew install swiftlint',
|
|
371
|
-
linux: 'See https://github.com/realm/SwiftLint',
|
|
372
|
-
win32: 'See https://github.com/realm/SwiftLint',
|
|
373
|
-
},
|
|
374
|
-
optional: true,
|
|
375
|
-
gates: ['Gate 1 (Code Quality)'],
|
|
376
|
-
},
|
|
377
|
-
],
|
|
378
|
-
},
|
|
379
|
-
|
|
380
|
-
// #846: Objective-C had a full runtime (githooks/adapters/objectivec.sh) and
|
|
381
|
-
// was recognised by every GATE-layer list -- Gate 1's short-circuit, Gate 3's
|
|
382
|
-
// lizard population, Gate 4's PRINCIPLES_FILES, Gate 5's CODE_EXTENSIONS,
|
|
383
|
-
// Gate 10's SEMGREP_FILES, lib/docs-only.sh -- yet was absent HERE. That is
|
|
384
|
-
// #730's shape exactly: `detect-languages` writes a config without it, the
|
|
385
|
-
// hook trusts that config and does NOT fall back to extension sniffing, so an
|
|
386
|
-
// Objective-C repo was never routed. Registry membership, not gate support, is
|
|
387
|
-
// what makes a language reachable.
|
|
388
|
-
//
|
|
389
|
-
// Detection keys off Xcode manifests and NOT off the `.m`/`.mm` extension.
|
|
390
|
-
// `.m` is also MATLAB's, and `configFiles` is non-empty here on purpose:
|
|
391
|
-
// detectProjectLanguages only consults the extension fallback when
|
|
392
|
-
// `configFiles.length === 0`, so listing a manifest both enables detection and
|
|
393
|
-
// structurally prevents a MATLAB checkout from being reported as Objective-C.
|
|
394
|
-
// `*.pbxproj` is globbed because the project file lives inside
|
|
395
|
-
// `<name>.xcodeproj/`, not at the repo root.
|
|
396
|
-
objectivec: {
|
|
397
|
-
name: 'Objective-C',
|
|
398
|
-
extensions: ['m', 'mm'],
|
|
399
|
-
configFiles: ['Podfile', 'Package.swift', '*.xcodeproj', '*.pbxproj'],
|
|
400
|
-
tools: [
|
|
401
|
-
{
|
|
402
|
-
name: 'clang',
|
|
403
|
-
checkCmd: 'clang --version',
|
|
404
|
-
install: {
|
|
405
|
-
darwin: 'xcode-select --install',
|
|
406
|
-
linux: 'apt install clang',
|
|
407
|
-
win32: 'See https://clang.llvm.org/get_started.html',
|
|
408
|
-
},
|
|
409
|
-
optional: false,
|
|
410
|
-
gates: ['Gate 1 (Build + Quality)'],
|
|
411
|
-
},
|
|
412
|
-
],
|
|
413
|
-
},
|
|
414
|
-
|
|
415
|
-
// #731: PHP. `configFiles` is non-empty on purpose, for the same structural
|
|
416
|
-
// reason as objectivec below -- detectProjectLanguages only consults the
|
|
417
|
-
// extension fallback when `configFiles.length === 0`, so a manifest keeps the
|
|
418
|
-
// signal anchored to a real project rather than to a stray .php file.
|
|
419
|
-
// composer.json is listed first but is NOT treated as exclusive: unlike a
|
|
420
|
-
// .csproj, it coexists happily with package.json in JS repos that shell out for
|
|
421
|
-
// one build step. The Gate 0 detection arm keys off `.php` extensions instead.
|
|
422
|
-
php: {
|
|
423
|
-
name: 'PHP',
|
|
424
|
-
extensions: ['php', 'phtml'],
|
|
425
|
-
configFiles: ['composer.json', 'phpunit.xml', 'phpunit.xml.dist', 'phpstan.neon'],
|
|
426
|
-
tools: [
|
|
427
|
-
{
|
|
428
|
-
name: 'php',
|
|
429
|
-
checkCmd: 'php --version',
|
|
430
|
-
install: {
|
|
431
|
-
darwin: 'brew install php',
|
|
432
|
-
linux: 'sudo apt install php-cli composer',
|
|
433
|
-
win32: 'scoop install php composer',
|
|
434
|
-
},
|
|
435
|
-
optional: false,
|
|
436
|
-
gates: ['Gate 1 (Build + Quality)', 'Gate 5 (Coverage)'],
|
|
437
|
-
},
|
|
438
|
-
{
|
|
439
|
-
name: 'composer',
|
|
440
|
-
checkCmd: 'composer --version',
|
|
441
|
-
install: {
|
|
442
|
-
darwin: 'brew install composer',
|
|
443
|
-
linux: 'See https://getcomposer.org/download/',
|
|
444
|
-
win32: 'scoop install composer',
|
|
445
|
-
},
|
|
446
|
-
optional: false,
|
|
447
|
-
gates: ['Gate 1 (Build + Quality)'],
|
|
448
|
-
},
|
|
449
|
-
{
|
|
450
|
-
name: 'phpstan',
|
|
451
|
-
checkCmd: 'php vendor/bin/phpstan --version',
|
|
452
|
-
install: {
|
|
453
|
-
darwin: 'composer require --dev phpstan/phpstan',
|
|
454
|
-
linux: 'composer require --dev phpstan/phpstan',
|
|
455
|
-
win32: 'composer require --dev phpstan/phpstan',
|
|
456
|
-
},
|
|
457
|
-
optional: false,
|
|
458
|
-
gates: ['Gate 1 (Build + Quality)'],
|
|
459
|
-
},
|
|
460
|
-
{
|
|
461
|
-
name: 'phpcs',
|
|
462
|
-
checkCmd: 'php vendor/bin/phpcs --version',
|
|
463
|
-
install: {
|
|
464
|
-
darwin: 'composer require --dev squizlabs/php_codesniffer',
|
|
465
|
-
linux: 'composer require --dev squizlabs/php_codesniffer',
|
|
466
|
-
win32: 'composer require --dev squizlabs/php_codesniffer',
|
|
467
|
-
},
|
|
468
|
-
optional: false,
|
|
469
|
-
gates: ['Gate 1 (Build + Quality)'],
|
|
470
|
-
},
|
|
471
|
-
{
|
|
472
|
-
name: 'pcov',
|
|
473
|
-
checkCmd: 'php -r "exit(extension_loaded(\'pcov\')?0:1);"',
|
|
474
|
-
install: {
|
|
475
|
-
darwin: 'pecl install pcov',
|
|
476
|
-
linux: 'pecl install pcov',
|
|
477
|
-
win32: 'php_pcov.dll from https://windows.php.net/downloads/pecl/releases/pcov/ (must match the PHP build: ts vs nts)',
|
|
478
|
-
},
|
|
479
|
-
// Coverage is Gate 5's business; a missing driver makes coverage
|
|
480
|
-
// unmeasurable, which the adapter reports as BLOCK rather than 0%.
|
|
481
|
-
optional: true,
|
|
482
|
-
gates: ['Gate 5 (Coverage)'],
|
|
483
|
-
},
|
|
484
|
-
],
|
|
485
|
-
},
|
|
486
|
-
|
|
487
|
-
dart: {
|
|
488
|
-
name: 'Dart',
|
|
489
|
-
extensions: ['dart'],
|
|
490
|
-
configFiles: ['pubspec.yaml'],
|
|
491
|
-
tools: [
|
|
492
|
-
{
|
|
493
|
-
name: 'dart',
|
|
494
|
-
checkCmd: 'dart --version',
|
|
495
|
-
install: {
|
|
496
|
-
darwin: 'brew tap dart-lang/dart && brew install dart',
|
|
497
|
-
linux: 'See https://dart.dev/get-dart',
|
|
498
|
-
win32: 'winget install Dart-Dart.dart',
|
|
499
|
-
},
|
|
500
|
-
optional: false,
|
|
501
|
-
gates: ['Gate 1 (Build + Quality)'],
|
|
502
|
-
},
|
|
503
|
-
],
|
|
504
|
-
},
|
|
505
|
-
|
|
506
|
-
flutter: {
|
|
507
|
-
name: 'Flutter',
|
|
508
|
-
extensions: ['dart'],
|
|
509
|
-
configFiles: ['pubspec.yaml'],
|
|
510
|
-
tools: [
|
|
511
|
-
{
|
|
512
|
-
name: 'flutter',
|
|
513
|
-
checkCmd: 'flutter --version',
|
|
514
|
-
install: {
|
|
515
|
-
darwin: 'brew install --cask flutter',
|
|
516
|
-
linux: 'See https://flutter.dev/docs/get-started/install',
|
|
517
|
-
win32: 'winget install Flutter.Flutter',
|
|
518
|
-
},
|
|
519
|
-
optional: false,
|
|
520
|
-
gates: ['Gate 1 (Build + Quality)'],
|
|
521
|
-
},
|
|
522
|
-
],
|
|
523
|
-
},
|
|
524
|
-
|
|
525
|
-
cpp: {
|
|
526
|
-
name: 'C/C++',
|
|
527
|
-
extensions: ['cpp', 'cxx', 'cc', 'c', 'hpp', 'h'],
|
|
528
|
-
configFiles: ['CMakeLists.txt', 'Makefile', 'conanfile.txt', 'vcpkg.json'],
|
|
529
|
-
tools: [
|
|
530
|
-
{
|
|
531
|
-
name: 'cmake',
|
|
532
|
-
checkCmd: 'cmake --version',
|
|
533
|
-
install: {
|
|
534
|
-
darwin: 'brew install cmake',
|
|
535
|
-
linux: 'apt-get install cmake || yum install cmake',
|
|
536
|
-
win32: 'winget install Kitware.CMake',
|
|
537
|
-
},
|
|
538
|
-
optional: true,
|
|
539
|
-
gates: ['Gate 1 (Build)'],
|
|
540
|
-
},
|
|
541
|
-
{
|
|
542
|
-
name: 'clang-tidy',
|
|
543
|
-
checkCmd: 'clang-tidy --version',
|
|
544
|
-
install: {
|
|
545
|
-
darwin: 'brew install llvm',
|
|
546
|
-
linux: 'apt-get install clang-tidy',
|
|
547
|
-
win32: 'See LLVM installer',
|
|
548
|
-
},
|
|
549
|
-
optional: true,
|
|
550
|
-
gates: ['Gate 1 (Code Quality)'],
|
|
551
|
-
},
|
|
552
|
-
],
|
|
553
|
-
},
|
|
554
|
-
|
|
555
|
-
shell: {
|
|
556
|
-
name: 'Shell',
|
|
557
|
-
extensions: ['sh', 'bash'],
|
|
558
|
-
configFiles: [],
|
|
559
|
-
tools: [
|
|
560
|
-
{
|
|
561
|
-
name: 'shellcheck',
|
|
562
|
-
checkCmd: 'shellcheck --version',
|
|
563
|
-
install: {
|
|
564
|
-
darwin: 'brew install shellcheck',
|
|
565
|
-
linux: 'apt-get install shellcheck || yum install shellcheck',
|
|
566
|
-
win32: 'winget install ShellCheck.ShellCheck',
|
|
567
|
-
},
|
|
568
|
-
optional: true,
|
|
569
|
-
gates: ['Gate 1 (Code Quality)'],
|
|
570
|
-
},
|
|
571
|
-
],
|
|
572
|
-
},
|
|
573
|
-
|
|
574
|
-
powershell: {
|
|
575
|
-
name: 'PowerShell',
|
|
576
|
-
extensions: ['ps1', 'psm1', 'psd1'],
|
|
577
|
-
configFiles: [],
|
|
578
|
-
tools: [
|
|
579
|
-
{
|
|
580
|
-
name: 'pwsh',
|
|
581
|
-
checkCmd: 'pwsh --version',
|
|
582
|
-
install: {
|
|
583
|
-
darwin: 'brew install --cask powershell',
|
|
584
|
-
linux: 'apt-get install powershell || yum install powershell',
|
|
585
|
-
win32: 'winget install Microsoft.PowerShell',
|
|
586
|
-
},
|
|
587
|
-
optional: false,
|
|
588
|
-
gates: ['Gate 1 (Build + Quality)'],
|
|
589
|
-
},
|
|
590
|
-
{
|
|
591
|
-
name: 'psscriptanalyzer',
|
|
592
|
-
checkCmd: 'pwsh -Command "Get-Module -List PSScriptAnalyzer"',
|
|
593
|
-
install: {
|
|
594
|
-
darwin: 'pwsh -Command "Install-Module -Name PSScriptAnalyzer -Force"',
|
|
595
|
-
linux: 'pwsh -Command "Install-Module -Name PSScriptAnalyzer -Force"',
|
|
596
|
-
win32: 'pwsh -Command "Install-Module -Name PSScriptAnalyzer -Force"',
|
|
597
|
-
},
|
|
598
|
-
optional: true,
|
|
599
|
-
gates: ['Gate 1 (Code Quality)'],
|
|
600
|
-
},
|
|
601
|
-
],
|
|
602
|
-
},
|
|
603
|
-
|
|
604
|
-
iac: {
|
|
605
|
-
name: 'Infrastructure as Code',
|
|
606
|
-
extensions: ['tf', 'tfvars', 'yaml', 'yml'],
|
|
607
|
-
configFiles: ['*.tf', 'docker-compose*.yaml', 'k8s/*.yaml'],
|
|
608
|
-
tools: [
|
|
609
|
-
{
|
|
610
|
-
name: 'terraform',
|
|
611
|
-
checkCmd: 'terraform --version',
|
|
612
|
-
install: {
|
|
613
|
-
darwin: 'brew install terraform',
|
|
614
|
-
linux: 'See https://developer.hashicorp.com/terraform/downloads',
|
|
615
|
-
win32: 'winget install Hashicorp.Terraform',
|
|
616
|
-
},
|
|
617
|
-
optional: true,
|
|
618
|
-
gates: ['Gate 7 (IaC Security)'],
|
|
619
|
-
},
|
|
620
|
-
{
|
|
621
|
-
name: 'tflint',
|
|
622
|
-
checkCmd: 'tflint --version',
|
|
623
|
-
install: {
|
|
624
|
-
darwin: 'brew install tflint',
|
|
625
|
-
linux: 'See https://github.com/terraform-linters/tflint',
|
|
626
|
-
win32: 'See https://github.com/terraform-linters/tflint',
|
|
627
|
-
},
|
|
628
|
-
optional: true,
|
|
629
|
-
gates: ['Gate 7 (IaC Security)'],
|
|
630
|
-
},
|
|
631
|
-
],
|
|
632
|
-
},
|
|
633
|
-
};
|
|
48
|
+
const { LANGUAGE_REGISTRY } = require('./language-registry.js');
|
|
634
49
|
|
|
635
50
|
/**
|
|
636
51
|
* Directories that must never drive language detection: dependency trees ship
|
|
@@ -703,213 +118,135 @@ function parseLanguageFlag(args) {
|
|
|
703
118
|
* @param {string} projectRoot - Project root directory
|
|
704
119
|
* @returns {{detected: string[], configFiles: Object.<string, string[]>}}
|
|
705
120
|
*/
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
const foundConfigs = [];
|
|
720
|
-
|
|
721
|
-
for (const configFile of def.configFiles) {
|
|
722
|
-
// Handle glob patterns
|
|
723
|
-
if (configFile.includes('*')) {
|
|
724
|
-
// Simple glob matching
|
|
725
|
-
const pattern = configFile.replace(/\*/g, '.*');
|
|
726
|
-
const regex = new RegExp(pattern);
|
|
727
|
-
try {
|
|
728
|
-
const files = fs.readdirSync(projectRoot);
|
|
729
|
-
for (const file of files) {
|
|
730
|
-
if (regex.test(file)) {
|
|
731
|
-
foundConfigs.push(file);
|
|
732
|
-
}
|
|
733
|
-
}
|
|
734
|
-
} catch { /* ignore */ }
|
|
735
|
-
} else {
|
|
736
|
-
const configPath = path.join(projectRoot, configFile);
|
|
737
|
-
if (fs.existsSync(configPath)) {
|
|
738
|
-
foundConfigs.push(configFile);
|
|
739
|
-
}
|
|
740
|
-
}
|
|
741
|
-
}
|
|
742
|
-
|
|
743
|
-
if (foundConfigs.length > 0) {
|
|
744
|
-
detected.add(lang);
|
|
745
|
-
configFiles[lang] = foundConfigs;
|
|
746
|
-
} else if (def.configFiles.length === 0 && def.extensions.some(extensionSeen)) {
|
|
747
|
-
// Shell and PowerShell have no package-manager manifest to key off, so file
|
|
748
|
-
// extensions are their only possible signal (#468). Languages that do have
|
|
749
|
-
// config files keep using them: their extension lists are broad (IaC lists
|
|
750
|
-
// yaml/yml), and matching on those would make every repo with a CI YAML an
|
|
751
|
-
// Infrastructure-as-Code project.
|
|
752
|
-
detected.add(lang);
|
|
753
|
-
}
|
|
754
|
-
}
|
|
755
|
-
|
|
756
|
-
// Special case: Flutter vs Dart
|
|
757
|
-
if (detected.has('flutter') && detected.has('dart')) {
|
|
758
|
-
detected.delete('dart'); // Flutter implies Dart
|
|
759
|
-
}
|
|
121
|
+
/**
|
|
122
|
+
* Decide between Flutter and Dart, which are not independent answers.
|
|
123
|
+
*
|
|
124
|
+
* Flutter IMPLIES Dart: reporting both makes a Flutter app look like a Dart project
|
|
125
|
+
* that happens to use Flutter. A `pubspec.yaml` mentioning flutter is the
|
|
126
|
+
* authoritative signal, so it overrides the extension-based guess rather than
|
|
127
|
+
* adding to it.
|
|
128
|
+
*
|
|
129
|
+
* @param {Set<string>} detected mutated in place
|
|
130
|
+
* @param {string} projectRoot
|
|
131
|
+
*/
|
|
132
|
+
function resolveFlutterVersusDart(detected, projectRoot) {
|
|
133
|
+
if (detected.has('flutter') && detected.has('dart')) detected.delete('dart');
|
|
760
134
|
|
|
761
|
-
// Check for Flutter specifically
|
|
762
135
|
const pubspecPath = path.join(projectRoot, 'pubspec.yaml');
|
|
763
|
-
if (fs.existsSync(pubspecPath))
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
136
|
+
if (!fs.existsSync(pubspecPath)) return;
|
|
137
|
+
try {
|
|
138
|
+
if (fs.readFileSync(pubspecPath, 'utf8').includes('flutter:')) {
|
|
139
|
+
detected.delete('dart');
|
|
140
|
+
detected.add('flutter');
|
|
141
|
+
}
|
|
142
|
+
} catch {
|
|
143
|
+
// An unreadable pubspec leaves the extension-based detection as it stands.
|
|
771
144
|
}
|
|
772
|
-
|
|
773
|
-
return {
|
|
774
|
-
detected: Array.from(detected),
|
|
775
|
-
configFiles,
|
|
776
|
-
};
|
|
777
145
|
}
|
|
778
146
|
|
|
779
147
|
/**
|
|
780
|
-
*
|
|
781
|
-
*
|
|
782
|
-
*
|
|
783
|
-
*
|
|
148
|
+
* A predicate over the file extensions present in a project, scanned on first use.
|
|
149
|
+
*
|
|
150
|
+
* Lazy on purpose: the extension fallback is only consulted for languages that have
|
|
151
|
+
* no config file to look for, and the scan is bounded rather than a full walk. On a
|
|
152
|
+
* config-heavy project it never runs at all; on an extension-only one it runs once,
|
|
153
|
+
* not once per language.
|
|
154
|
+
*
|
|
155
|
+
* @param {string} projectRoot
|
|
156
|
+
* @returns {(ext: string) => boolean}
|
|
784
157
|
*/
|
|
785
|
-
function
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
encoding: 'utf8',
|
|
791
|
-
stdio: ['ignore', 'pipe', 'pipe'],
|
|
792
|
-
shell,
|
|
793
|
-
timeout: 10000
|
|
158
|
+
function makeLazyExtensionScanner(projectRoot) {
|
|
159
|
+
let scanned = null;
|
|
160
|
+
return (ext) => {
|
|
161
|
+
if (scanned === null) scanned = extensionsPresentIn(projectRoot);
|
|
162
|
+
return scanned.has(ext);
|
|
794
163
|
};
|
|
164
|
+
}
|
|
795
165
|
|
|
166
|
+
/**
|
|
167
|
+
* Walk the registry and record every language the project shows evidence of.
|
|
168
|
+
*
|
|
169
|
+
* A language is detected by a config file OR, when it has none to look for, by its
|
|
170
|
+
* extension. Config files take precedence because extension lists are broad -- IaC
|
|
171
|
+
* lists yaml/yml, and matching on those would make every repo with a CI YAML an
|
|
172
|
+
* Infrastructure-as-Code project (#468).
|
|
173
|
+
*/
|
|
174
|
+
/**
|
|
175
|
+
* The config files this entry matches: the literal name, or every file a `*` glob hits.
|
|
176
|
+
*
|
|
177
|
+
* A glob's directory listing is read once per pattern, and an unreadable project root
|
|
178
|
+
* yields no matches rather than throwing -- detection is a report about what was
|
|
179
|
+
* SEEN, and a directory we cannot list was not seen.
|
|
180
|
+
*
|
|
181
|
+
* @param {string} projectRoot
|
|
182
|
+
* @param {string} configFile a literal name or a pattern containing `*`
|
|
183
|
+
* @returns {string[]} matched names, relative to the project root
|
|
184
|
+
*/
|
|
185
|
+
function matchConfigFile(projectRoot, configFile) {
|
|
186
|
+
if (!configFile.includes('*')) {
|
|
187
|
+
return fs.existsSync(path.join(projectRoot, configFile)) ? [configFile] : [];
|
|
188
|
+
}
|
|
189
|
+
const regex = new RegExp(configFile.replace(/\*/g, '.*'));
|
|
796
190
|
try {
|
|
797
|
-
|
|
798
|
-
return { available: true, version: result.trim().split('\n')[0] };
|
|
191
|
+
return fs.readdirSync(projectRoot).filter((file) => regex.test(file));
|
|
799
192
|
} catch {
|
|
800
|
-
return
|
|
193
|
+
return [];
|
|
801
194
|
}
|
|
802
195
|
}
|
|
803
196
|
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
const result = {};
|
|
811
|
-
|
|
812
|
-
for (const lang of languages) {
|
|
813
|
-
const langDef = LANGUAGE_REGISTRY[lang];
|
|
814
|
-
if (!langDef) continue;
|
|
815
|
-
|
|
816
|
-
result[lang] = [];
|
|
817
|
-
|
|
818
|
-
for (const tool of langDef.tools) {
|
|
819
|
-
// Build-file tools have no binary to probe; running checkCmd on them
|
|
820
|
-
// would report "missing" permanently (#689 AC-3).
|
|
821
|
-
const status = tool.detectBy === 'build-file'
|
|
822
|
-
? detectBuildFileDependency(lang)
|
|
823
|
-
: checkTool(tool.name, tool.checkCmd);
|
|
824
|
-
result[lang].push({
|
|
825
|
-
tool,
|
|
826
|
-
status: status.available ? 'available' : 'missing',
|
|
827
|
-
version: status.version,
|
|
828
|
-
});
|
|
829
|
-
}
|
|
197
|
+
function scanRegistryForLanguages(projectRoot, detected, configFiles, extensionSeen) {
|
|
198
|
+
for (const [lang, def] of Object.entries(LANGUAGE_REGISTRY)) {
|
|
199
|
+
const foundConfigs = [];
|
|
200
|
+
|
|
201
|
+
for (const configFile of def.configFiles) {
|
|
202
|
+
foundConfigs.push(...matchConfigFile(projectRoot, configFile));
|
|
830
203
|
}
|
|
831
204
|
|
|
832
|
-
|
|
205
|
+
if (foundConfigs.length > 0) {
|
|
206
|
+
detected.add(lang);
|
|
207
|
+
configFiles[lang] = foundConfigs;
|
|
208
|
+
} else if (def.configFiles.length === 0 && def.extensions.some(extensionSeen)) {
|
|
209
|
+
// Shell and PowerShell have no package-manager manifest to key off, so file
|
|
210
|
+
// extensions are their only possible signal (#468). Languages that do have
|
|
211
|
+
// config files keep using them: their extension lists are broad (IaC lists
|
|
212
|
+
// yaml/yml), and matching on those would make every repo with a CI YAML an
|
|
213
|
+
// Infrastructure-as-Code project.
|
|
214
|
+
detected.add(lang);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
833
217
|
}
|
|
834
218
|
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
* @returns {{success: boolean, message: string}}
|
|
839
|
-
*/
|
|
840
|
-
function installTool(toolDef) {
|
|
841
|
-
// A build-file tool has no installer to run: `detectBy: 'build-file'` exists
|
|
842
|
-
// because ArchUnit and Konsist are libraries with no CLI to probe, and their
|
|
843
|
-
// `install` field holds an instruction written for a human. Handing that
|
|
844
|
-
// prose to execSync made `doctor --fix --install-tools` print
|
|
845
|
-
// `'add' is not recognized as an internal or external command` on every Java
|
|
846
|
-
// machine, and on POSIX actually shell it. Report the guidance and start no
|
|
847
|
-
// process (#689 review, found by Delphi Round 1).
|
|
848
|
-
if (toolDef.detectBy === 'build-file') {
|
|
849
|
-
const guidance = toolDef.install[process.platform] || toolDef.install.linux || '';
|
|
850
|
-
return {
|
|
851
|
-
success: false,
|
|
852
|
-
message:
|
|
853
|
-
`${toolDef.name} is a build-file library, not a CLI: no install command is runnable. ` +
|
|
854
|
-
`Add it manually -- ${guidance}`,
|
|
855
|
-
};
|
|
856
|
-
}
|
|
219
|
+
function detectProjectLanguages(projectRoot) {
|
|
220
|
+
const detected = new Set();
|
|
221
|
+
const configFiles = {};
|
|
857
222
|
|
|
858
|
-
const
|
|
859
|
-
const installCmd = toolDef.install[platform] || toolDef.install.linux;
|
|
223
|
+
const extensionSeen = makeLazyExtensionScanner(projectRoot);
|
|
860
224
|
|
|
861
|
-
|
|
862
|
-
return { success: false, message: `No install command for platform ${platform}` };
|
|
863
|
-
}
|
|
225
|
+
scanRegistryForLanguages(projectRoot, detected, configFiles, extensionSeen);
|
|
864
226
|
|
|
865
|
-
|
|
866
|
-
const shell = isWindows ? 'cmd.exe' : '/bin/sh';
|
|
867
|
-
const execOpts = {
|
|
868
|
-
encoding: 'utf8',
|
|
869
|
-
stdio: 'inherit',
|
|
870
|
-
shell,
|
|
871
|
-
timeout: 120000
|
|
872
|
-
};
|
|
227
|
+
resolveFlutterVersusDart(detected, projectRoot);
|
|
873
228
|
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
} catch (error) {
|
|
879
|
-
return { success: false, message: `Failed to install ${toolDef.name}: ${error.message}` };
|
|
880
|
-
}
|
|
229
|
+
return {
|
|
230
|
+
detected: Array.from(detected),
|
|
231
|
+
configFiles,
|
|
232
|
+
};
|
|
881
233
|
}
|
|
882
234
|
|
|
883
235
|
/**
|
|
884
|
-
*
|
|
885
|
-
* @param {string}
|
|
886
|
-
* @param {string
|
|
887
|
-
* @
|
|
236
|
+
* Check if a CLI tool is available.
|
|
237
|
+
* @param {string} toolName - Tool name
|
|
238
|
+
* @param {string} checkCmd - Command to check version
|
|
239
|
+
* @returns {{available: boolean, version?: string}}
|
|
888
240
|
*/
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
status: t.status,
|
|
899
|
-
optional: t.tool.optional,
|
|
900
|
-
gates: t.tool.gates,
|
|
901
|
-
})),
|
|
902
|
-
};
|
|
903
|
-
return acc;
|
|
904
|
-
}, {}),
|
|
905
|
-
lastDetected: new Date().toISOString(),
|
|
906
|
-
};
|
|
907
|
-
|
|
908
|
-
const configPath = path.join(projectRoot, '.xp-gate-config.json');
|
|
909
|
-
fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
|
|
910
|
-
|
|
911
|
-
return configPath;
|
|
912
|
-
}
|
|
241
|
+
const {
|
|
242
|
+
checkTool,
|
|
243
|
+
getToolsForLanguages,
|
|
244
|
+
installTool,
|
|
245
|
+
generateProjectConfig,
|
|
246
|
+
TOOL_PROBE_TIMEOUT_MS,
|
|
247
|
+
INSTALL_EXEC_TIMEOUT_MS,
|
|
248
|
+
} = require('./tool-install.js');
|
|
249
|
+
const { statusOfRow, iconOfRow, qualifiersOfRow } = require('./tool-display.js');
|
|
913
250
|
|
|
914
251
|
/**
|
|
915
252
|
* Read existing project config if present.
|
|
@@ -1017,6 +354,8 @@ function getArchitectureTools() {
|
|
|
1017
354
|
|
|
1018
355
|
module.exports = {
|
|
1019
356
|
LANGUAGE_REGISTRY,
|
|
357
|
+
extensionsPresentIn,
|
|
358
|
+
makeLazyExtensionScanner,
|
|
1020
359
|
detectProjectLanguages,
|
|
1021
360
|
checkTool,
|
|
1022
361
|
getToolsForLanguages,
|
|
@@ -1027,6 +366,17 @@ module.exports = {
|
|
|
1027
366
|
handleCheckTools,
|
|
1028
367
|
handleInstallTools,
|
|
1029
368
|
planToolRepairs,
|
|
369
|
+
describeAction,
|
|
370
|
+
statusOfRow,
|
|
371
|
+
iconOfRow,
|
|
372
|
+
qualifiersOfRow,
|
|
373
|
+
printAuditReport,
|
|
374
|
+
toolEntry,
|
|
375
|
+
buildDetectionResult,
|
|
376
|
+
printAuditJson,
|
|
377
|
+
reportSelfCancellingPlan,
|
|
378
|
+
applyPlanActions,
|
|
379
|
+
buildInstallPlan,
|
|
1030
380
|
getArchitectureTools,
|
|
1031
381
|
detectBuildFileDependency,
|
|
1032
382
|
};
|
|
@@ -1036,42 +386,81 @@ module.exports = {
|
|
|
1036
386
|
* @param {string[]} args - Command arguments
|
|
1037
387
|
* @returns {Promise<number>} Exit code
|
|
1038
388
|
*/
|
|
1039
|
-
|
|
1040
|
-
|
|
389
|
+
/**
|
|
390
|
+
* The JSON shape of a detection result: languages, where they were found, tools.
|
|
391
|
+
*
|
|
392
|
+
* `tools` is keyed by language, so a consumer can answer "what is missing for Rust"
|
|
393
|
+
* without re-deriving the language list.
|
|
394
|
+
*/
|
|
395
|
+
function buildDetectionResult(detected, configFiles, toolStatus) {
|
|
396
|
+
const tools = {};
|
|
397
|
+
for (const [lang, list] of Object.entries(toolStatus)) {
|
|
398
|
+
tools[lang] = list.map((t) => ({
|
|
399
|
+
name: t.tool.name,
|
|
400
|
+
status: t.status,
|
|
401
|
+
optional: t.tool.optional,
|
|
402
|
+
version: t.version,
|
|
403
|
+
}));
|
|
404
|
+
}
|
|
405
|
+
return { languages: detected, configFiles, tools };
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
/**
|
|
409
|
+
* Report that nothing was detected, in whichever shape the caller asked for.
|
|
410
|
+
*
|
|
411
|
+
* An empty result is a valid answer, not a failure: a directory with no recognisable
|
|
412
|
+
* project has no languages, and exiting non-zero would make a legitimate "nothing
|
|
413
|
+
* here" look like an error.
|
|
414
|
+
*
|
|
415
|
+
* @param {boolean} jsonOutput
|
|
416
|
+
* @returns {number} exit code
|
|
417
|
+
*/
|
|
418
|
+
function reportNoLanguages(jsonOutput) {
|
|
419
|
+
if (jsonOutput) {
|
|
420
|
+
console.log(JSON.stringify({ languages: [], configFiles: {} }, null, 2));
|
|
421
|
+
} else {
|
|
422
|
+
console.log('No languages detected.');
|
|
423
|
+
}
|
|
424
|
+
return 0;
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
/**
|
|
428
|
+
* Write the project language config and say WHERE it landed.
|
|
429
|
+
*
|
|
430
|
+
* The path is printed because the file is gitignored-by-convention in some projects
|
|
431
|
+
* and tracked in others; without it a reader cannot tell whether the write is
|
|
432
|
+
* something they need to commit.
|
|
433
|
+
*/
|
|
434
|
+
function writeProjectConfig(projectRoot, detected, toolStatus) {
|
|
435
|
+
const configPath = generateProjectConfig(projectRoot, detected, toolStatus);
|
|
436
|
+
console.log(`\nGenerated config: ${configPath}`);
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
async function handleDetectLanguages(args, options = {}) {
|
|
440
|
+
// Injectable like the other handle* functions in this file. It defaulted to
|
|
441
|
+
// `process.cwd()` with no seam, so the only way to test it was to chdir --
|
|
442
|
+
// which vitest workers do not allow, and which made the whole command
|
|
443
|
+
// untestable rather than merely untested.
|
|
444
|
+
const projectRoot = options.projectRoot || process.cwd();
|
|
1041
445
|
const jsonOutput = args.includes('--json');
|
|
1042
446
|
const writeConfig = args.includes('--write') || !jsonOutput;
|
|
1043
447
|
|
|
1044
|
-
|
|
1045
|
-
|
|
448
|
+
// Human progress lines ONLY in human mode. Under `--json` stdout must hold exactly
|
|
449
|
+
// one document, and a leading "Detecting project languages..." makes it unparseable
|
|
450
|
+
// -- `jq` reports a syntax error pointing at the word, not at this line.
|
|
451
|
+
if (!jsonOutput) {
|
|
452
|
+
console.log('Detecting project languages...');
|
|
453
|
+
console.log(`Project root: ${projectRoot}\n`);
|
|
454
|
+
}
|
|
1046
455
|
|
|
1047
456
|
const { detected, configFiles } = detectProjectLanguages(projectRoot);
|
|
1048
457
|
|
|
1049
|
-
if (detected.length === 0)
|
|
1050
|
-
if (jsonOutput) {
|
|
1051
|
-
console.log(JSON.stringify({ languages: [], configFiles: {} }, null, 2));
|
|
1052
|
-
} else {
|
|
1053
|
-
console.log('No languages detected.');
|
|
1054
|
-
}
|
|
1055
|
-
return 0;
|
|
1056
|
-
}
|
|
458
|
+
if (detected.length === 0) return reportNoLanguages(jsonOutput);
|
|
1057
459
|
|
|
1058
460
|
const toolStatus = getToolsForLanguages(detected);
|
|
1059
461
|
|
|
1060
462
|
if (jsonOutput) {
|
|
1061
|
-
|
|
1062
|
-
languages: detected,
|
|
1063
|
-
configFiles,
|
|
1064
|
-
tools: {},
|
|
1065
|
-
};
|
|
1066
|
-
for (const [lang, tools] of Object.entries(toolStatus)) {
|
|
1067
|
-
result.tools[lang] = tools.map(t => ({
|
|
1068
|
-
name: t.tool.name,
|
|
1069
|
-
status: t.status,
|
|
1070
|
-
optional: t.tool.optional,
|
|
1071
|
-
version: t.version,
|
|
1072
|
-
}));
|
|
1073
|
-
}
|
|
1074
|
-
console.log(JSON.stringify(result, null, 2));
|
|
463
|
+
console.log(JSON.stringify(buildDetectionResult(detected, configFiles, toolStatus), null, 2));
|
|
1075
464
|
} else {
|
|
1076
465
|
console.log('Detected languages:');
|
|
1077
466
|
for (const lang of detected) {
|
|
@@ -1093,55 +482,10 @@ async function handleDetectLanguages(args) {
|
|
|
1093
482
|
}
|
|
1094
483
|
}
|
|
1095
484
|
|
|
1096
|
-
if (writeConfig)
|
|
1097
|
-
const configPath = generateProjectConfig(projectRoot, detected, toolStatus);
|
|
1098
|
-
console.log(`\nGenerated config: ${configPath}`);
|
|
1099
|
-
}
|
|
1100
|
-
|
|
485
|
+
if (writeConfig) writeProjectConfig(projectRoot, detected, toolStatus);
|
|
1101
486
|
return 0;
|
|
1102
487
|
}
|
|
1103
488
|
|
|
1104
|
-
/**
|
|
1105
|
-
* Handle check-tools CLI command.
|
|
1106
|
-
* @param {string[]} args - Command arguments
|
|
1107
|
-
* @returns {Promise<number>} Exit code
|
|
1108
|
-
*/
|
|
1109
|
-
/**
|
|
1110
|
-
* Render one audit row as the status the CLI contract uses.
|
|
1111
|
-
*
|
|
1112
|
-
* A row is unusable for two different reasons and they must not be merged:
|
|
1113
|
-
* the probe failed (missing/broken), or the probe could not be interpreted.
|
|
1114
|
-
* Both are "not usable", but only the first is "not installed".
|
|
1115
|
-
*/
|
|
1116
|
-
function statusOfRow(row) {
|
|
1117
|
-
return row.available ? 'available' : 'missing';
|
|
1118
|
-
}
|
|
1119
|
-
|
|
1120
|
-
/** Icon for a row: present, present-but-flagged, or absent. */
|
|
1121
|
-
function iconOfRow(row) {
|
|
1122
|
-
if (!row.available) return '✗';
|
|
1123
|
-
if (row.duplicated || row.outdated) return '⚠';
|
|
1124
|
-
return '✓';
|
|
1125
|
-
}
|
|
1126
|
-
|
|
1127
|
-
/** Extra qualifiers appended to a human line, e.g. "duplicate ×2, 2.14.0 → 2.15.1". */
|
|
1128
|
-
function qualifiersOfRow(row) {
|
|
1129
|
-
const parts = [];
|
|
1130
|
-
if (row.duplicated) parts.push(`DUPLICATE ×${row.distinctRealPaths.length}`);
|
|
1131
|
-
if (row.outdated && row.installedVersion && row.latestVersion) {
|
|
1132
|
-
parts.push(`${row.installedVersion} → ${row.latestVersion} available`);
|
|
1133
|
-
} else if (row.currency === 'unknown') {
|
|
1134
|
-
parts.push('version currency unknown');
|
|
1135
|
-
}
|
|
1136
|
-
// #843: say WHERE the binary was found. "Installed but not on PATH" and
|
|
1137
|
-
// "not installed" look identical in a pass/fail column and call for opposite
|
|
1138
|
-
// actions -- add it to PATH (or symlink it), versus install it.
|
|
1139
|
-
if (row.available && row.resolution === 'fallback' && row.resolvedPath) {
|
|
1140
|
-
parts.push(`found at ${row.resolvedPath} (not on PATH)`);
|
|
1141
|
-
}
|
|
1142
|
-
if (!row.available && row.validityReason) parts.push(row.validityReason);
|
|
1143
|
-
return parts.join('; ');
|
|
1144
|
-
}
|
|
1145
489
|
|
|
1146
490
|
/**
|
|
1147
491
|
* Print the audit as a human-readable list.
|
|
@@ -1186,6 +530,123 @@ function printAuditReport(rows, summary) {
|
|
|
1186
530
|
* }} [options]
|
|
1187
531
|
* @returns {Promise<number>} Exit code
|
|
1188
532
|
*/
|
|
533
|
+
/**
|
|
534
|
+
* Collect the tools the question covers, then audit each through the gate's resolver.
|
|
535
|
+
*
|
|
536
|
+
* Resolving through the SAME helper the gates use (#843) is the point: a binary in
|
|
537
|
+
* `~/.local/bin` IS installed even when the hook's PATH omits it, and reporting it
|
|
538
|
+
* missing sends the reader off to install what is already there.
|
|
539
|
+
*
|
|
540
|
+
* `--all` passes null languages, meaning "every registered tool" rather than "this
|
|
541
|
+
* project's".
|
|
542
|
+
*/
|
|
543
|
+
function auditRequestedTools(args, selection, options) {
|
|
544
|
+
const { languages, includeCrossLanguage } = selection;
|
|
545
|
+
const tools = collectGateTools({
|
|
546
|
+
registry: LANGUAGE_REGISTRY,
|
|
547
|
+
cliTools: GATE_CLI_TOOLS,
|
|
548
|
+
// `--all` asks about every registered tool, not just this project's.
|
|
549
|
+
languages: args.includes('--all') ? null : (languages.length ? languages : null),
|
|
550
|
+
}).filter((t) => includeCrossLanguage || (t.languages && t.languages.length > 0));
|
|
551
|
+
|
|
552
|
+
const audit = options.audit || ((list, deps) => auditAllTools(list, deps));
|
|
553
|
+
// Resolve tools through the SAME helper the gates use (#843): a binary in
|
|
554
|
+
// ~/.local/bin is installed even when the hook's PATH omits it, and reporting
|
|
555
|
+
// it missing sends the reader off to install what is already there.
|
|
556
|
+
const rows = audit(tools, {
|
|
557
|
+
resolveLatest: options.resolveLatest || ((n) => resolveLatestVersion(n)),
|
|
558
|
+
resolveTool: options.resolveTool || ((name) => resolveToolViaShell(name)),
|
|
559
|
+
});
|
|
560
|
+
const summary = summarizeAudit(rows);
|
|
561
|
+
return { rows, summary };
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
/**
|
|
565
|
+
* Emit the audit as JSON in the shape callers expect.
|
|
566
|
+
*
|
|
567
|
+
* CONTRACT, preserved from #468: the TOP LEVEL is keyed by language name, each value
|
|
568
|
+
* being that language's tool list. Callers parse it that way and a shape change here
|
|
569
|
+
* silently broke them once. The audit's newer facts (duplicates, currency,
|
|
570
|
+
* cross-language tools) ride ALONGSIDE in `summary` and `crossLanguage` rather than
|
|
571
|
+
* replacing the old shape.
|
|
572
|
+
*/
|
|
573
|
+
/**
|
|
574
|
+
* The JSON shape of one audited tool.
|
|
575
|
+
*
|
|
576
|
+
* One factory for both call sites. They had drifted already -- the cross-language
|
|
577
|
+
* copy carried `npxInvoked` and the per-language one did not -- which is exactly the
|
|
578
|
+
* kind of divergence a second hand-written literal produces.
|
|
579
|
+
*
|
|
580
|
+
* `reason` is `undefined` when absent rather than omitted, so the key is stable for
|
|
581
|
+
* consumers that read it.
|
|
582
|
+
*/
|
|
583
|
+
function toolEntry(row) {
|
|
584
|
+
return {
|
|
585
|
+
name: row.name,
|
|
586
|
+
status: statusOfRow(row),
|
|
587
|
+
optional: row.optional,
|
|
588
|
+
version: row.version,
|
|
589
|
+
gates: row.gates,
|
|
590
|
+
duplicated: row.duplicated,
|
|
591
|
+
paths: row.paths,
|
|
592
|
+
outdated: row.outdated,
|
|
593
|
+
latestVersion: row.latestVersion,
|
|
594
|
+
currency: row.currency,
|
|
595
|
+
reason: row.validityReason || undefined,
|
|
596
|
+
};
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
function printAuditJson(rows, summary, args) {
|
|
600
|
+
// CONTRACT, preserved from #468: the top level is keyed by language name and
|
|
601
|
+
// each value is that language's tool list. Callers parse it that way, and a
|
|
602
|
+
// shape change here silently broke them once already. The audit's new facts
|
|
603
|
+
// (duplicates, currency, cross-language tools) therefore ride alongside in
|
|
604
|
+
// `summary` and `crossLanguage` rather than replacing the old shape.
|
|
605
|
+
const byLanguage = {};
|
|
606
|
+
for (const row of rows) {
|
|
607
|
+
for (const lang of (row.languages && row.languages.length ? row.languages : ['(cross-language)'])) {
|
|
608
|
+
if (!byLanguage[lang]) byLanguage[lang] = [];
|
|
609
|
+
byLanguage[lang].push(toolEntry(row));
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
// Tools the gate scripts call directly; reported once, not per language.
|
|
613
|
+
// Only emitted when such tools exist: an always-present empty group would
|
|
614
|
+
// add a key to a contract callers compare exactly (#468).
|
|
615
|
+
const crossLanguage = rows
|
|
616
|
+
.filter((r) => !r.languages || r.languages.length === 0)
|
|
617
|
+
.map((r) => ({ ...toolEntry(r), npxInvoked: r.npxInvoked }));
|
|
618
|
+
if (crossLanguage.length > 0) byLanguage['(cross-language)'] = crossLanguage;
|
|
619
|
+
|
|
620
|
+
// `summary` and the flat view are additive: they appear only when asked
|
|
621
|
+
// for, so the historical shape ({ <language>: [...] }) stays byte-identical
|
|
622
|
+
// for callers that parse it exactly (#468).
|
|
623
|
+
const wantsAuditFields = args.includes('--audit') || args.includes('--flat');
|
|
624
|
+
// The flat view uses the SAME field names as the grouped view (`status`,
|
|
625
|
+
// `version`), so a consumer can switch between them without remapping.
|
|
626
|
+
const flatView = rows.map((r) => ({
|
|
627
|
+
name: r.name,
|
|
628
|
+
status: statusOfRow(r),
|
|
629
|
+
optional: r.optional,
|
|
630
|
+
version: r.version,
|
|
631
|
+
installedVersion: r.installedVersion,
|
|
632
|
+
gates: r.gates,
|
|
633
|
+
languages: r.languages,
|
|
634
|
+
duplicated: r.duplicated,
|
|
635
|
+
paths: r.paths,
|
|
636
|
+
distinctRealPaths: r.distinctRealPaths,
|
|
637
|
+
outdated: r.outdated,
|
|
638
|
+
latestVersion: r.latestVersion,
|
|
639
|
+
currency: r.currency,
|
|
640
|
+
npxInvoked: r.npxInvoked,
|
|
641
|
+
reason: r.validityReason || undefined,
|
|
642
|
+
}));
|
|
643
|
+
console.log(JSON.stringify({
|
|
644
|
+
...byLanguage,
|
|
645
|
+
...(wantsAuditFields ? { summary } : {}),
|
|
646
|
+
...(args.includes('--flat') ? { tools: flatView } : {}),
|
|
647
|
+
}, null, 2));
|
|
648
|
+
}
|
|
649
|
+
|
|
1189
650
|
async function handleCheckTools(args, options = {}) {
|
|
1190
651
|
const projectRoot = options.projectRoot || process.cwd();
|
|
1191
652
|
const jsonOutput = args.includes('--json');
|
|
@@ -1210,100 +671,10 @@ async function handleCheckTools(args, options = {}) {
|
|
|
1210
671
|
const includeCrossLanguage = !explicitSelection || explicitSelection.length === 0
|
|
1211
672
|
|| args.includes('--all');
|
|
1212
673
|
|
|
1213
|
-
const
|
|
1214
|
-
registry: LANGUAGE_REGISTRY,
|
|
1215
|
-
cliTools: GATE_CLI_TOOLS,
|
|
1216
|
-
// `--all` asks about every registered tool, not just this project's.
|
|
1217
|
-
languages: args.includes('--all') ? null : (languages.length ? languages : null),
|
|
1218
|
-
}).filter((t) => includeCrossLanguage || (t.languages && t.languages.length > 0));
|
|
1219
|
-
|
|
1220
|
-
const audit = options.audit || ((list, deps) => auditAllTools(list, deps));
|
|
1221
|
-
// Resolve tools through the SAME helper the gates use (#843): a binary in
|
|
1222
|
-
// ~/.local/bin is installed even when the hook's PATH omits it, and reporting
|
|
1223
|
-
// it missing sends the reader off to install what is already there.
|
|
1224
|
-
const rows = audit(tools, {
|
|
1225
|
-
resolveLatest: options.resolveLatest || ((n) => resolveLatestVersion(n)),
|
|
1226
|
-
resolveTool: options.resolveTool || ((name) => resolveToolViaShell(name)),
|
|
1227
|
-
});
|
|
1228
|
-
const summary = summarizeAudit(rows);
|
|
674
|
+
const { rows, summary } = auditRequestedTools(args, { languages, includeCrossLanguage }, options);
|
|
1229
675
|
|
|
1230
|
-
if (jsonOutput)
|
|
1231
|
-
|
|
1232
|
-
// each value is that language's tool list. Callers parse it that way, and a
|
|
1233
|
-
// shape change here silently broke them once already. The audit's new facts
|
|
1234
|
-
// (duplicates, currency, cross-language tools) therefore ride alongside in
|
|
1235
|
-
// `summary` and `crossLanguage` rather than replacing the old shape.
|
|
1236
|
-
const byLanguage = {};
|
|
1237
|
-
for (const row of rows) {
|
|
1238
|
-
for (const lang of (row.languages && row.languages.length ? row.languages : ['(cross-language)'])) {
|
|
1239
|
-
if (!byLanguage[lang]) byLanguage[lang] = [];
|
|
1240
|
-
byLanguage[lang].push({
|
|
1241
|
-
name: row.name,
|
|
1242
|
-
status: statusOfRow(row),
|
|
1243
|
-
optional: row.optional,
|
|
1244
|
-
version: row.version,
|
|
1245
|
-
gates: row.gates,
|
|
1246
|
-
duplicated: row.duplicated,
|
|
1247
|
-
paths: row.paths,
|
|
1248
|
-
outdated: row.outdated,
|
|
1249
|
-
latestVersion: row.latestVersion,
|
|
1250
|
-
currency: row.currency,
|
|
1251
|
-
reason: row.validityReason || undefined,
|
|
1252
|
-
});
|
|
1253
|
-
}
|
|
1254
|
-
}
|
|
1255
|
-
// Tools the gate scripts call directly; reported once, not per language.
|
|
1256
|
-
// Only emitted when such tools exist: an always-present empty group would
|
|
1257
|
-
// add a key to a contract callers compare exactly (#468).
|
|
1258
|
-
const crossLanguage = rows
|
|
1259
|
-
.filter((r) => !r.languages || r.languages.length === 0)
|
|
1260
|
-
.map((r) => ({
|
|
1261
|
-
name: r.name,
|
|
1262
|
-
status: statusOfRow(r),
|
|
1263
|
-
optional: r.optional,
|
|
1264
|
-
version: r.version,
|
|
1265
|
-
gates: r.gates,
|
|
1266
|
-
duplicated: r.duplicated,
|
|
1267
|
-
paths: r.paths,
|
|
1268
|
-
outdated: r.outdated,
|
|
1269
|
-
latestVersion: r.latestVersion,
|
|
1270
|
-
currency: r.currency,
|
|
1271
|
-
npxInvoked: r.npxInvoked,
|
|
1272
|
-
reason: r.validityReason || undefined,
|
|
1273
|
-
}));
|
|
1274
|
-
if (crossLanguage.length > 0) byLanguage['(cross-language)'] = crossLanguage;
|
|
1275
|
-
|
|
1276
|
-
// `summary` and the flat view are additive: they appear only when asked
|
|
1277
|
-
// for, so the historical shape ({ <language>: [...] }) stays byte-identical
|
|
1278
|
-
// for callers that parse it exactly (#468).
|
|
1279
|
-
const wantsAuditFields = args.includes('--audit') || args.includes('--flat');
|
|
1280
|
-
// The flat view uses the SAME field names as the grouped view (`status`,
|
|
1281
|
-
// `version`), so a consumer can switch between them without remapping.
|
|
1282
|
-
const flatView = rows.map((r) => ({
|
|
1283
|
-
name: r.name,
|
|
1284
|
-
status: statusOfRow(r),
|
|
1285
|
-
optional: r.optional,
|
|
1286
|
-
version: r.version,
|
|
1287
|
-
installedVersion: r.installedVersion,
|
|
1288
|
-
gates: r.gates,
|
|
1289
|
-
languages: r.languages,
|
|
1290
|
-
duplicated: r.duplicated,
|
|
1291
|
-
paths: r.paths,
|
|
1292
|
-
distinctRealPaths: r.distinctRealPaths,
|
|
1293
|
-
outdated: r.outdated,
|
|
1294
|
-
latestVersion: r.latestVersion,
|
|
1295
|
-
currency: r.currency,
|
|
1296
|
-
npxInvoked: r.npxInvoked,
|
|
1297
|
-
reason: r.validityReason || undefined,
|
|
1298
|
-
}));
|
|
1299
|
-
console.log(JSON.stringify({
|
|
1300
|
-
...byLanguage,
|
|
1301
|
-
...(wantsAuditFields ? { summary } : {}),
|
|
1302
|
-
...(args.includes('--flat') ? { tools: flatView } : {}),
|
|
1303
|
-
}, null, 2));
|
|
1304
|
-
} else {
|
|
1305
|
-
printAuditReport(rows, summary);
|
|
1306
|
-
}
|
|
676
|
+
if (jsonOutput) printAuditJson(rows, summary, args);
|
|
677
|
+
else printAuditReport(rows, summary);
|
|
1307
678
|
|
|
1308
679
|
return 0;
|
|
1309
680
|
}
|
|
@@ -1330,6 +701,83 @@ const { SYSTEM_PATH_PREFIXES } = require('./tool-audit.js');
|
|
|
1330
701
|
* @param {{definitions?: Array, systemPrefixes?: string[], platform?: string}} [options]
|
|
1331
702
|
* @returns {{actions: Array, clean: boolean}}
|
|
1332
703
|
*/
|
|
704
|
+
/**
|
|
705
|
+
* Plan an upgrade, and detect the plan that cancels itself.
|
|
706
|
+
*
|
|
707
|
+
* MEASURED DEFECT (2026-11-23): hadolint was duplicated AND outdated. The plan removed
|
|
708
|
+
* `~/.local/bin/hadolint`, then ran an installer whose command writes to that exact
|
|
709
|
+
* path -- so the duplicate came straight back and the repair silently achieved
|
|
710
|
+
* nothing. `writesToRemovedPath` names that case instead of reporting a success that
|
|
711
|
+
* is not one.
|
|
712
|
+
*/
|
|
713
|
+
function planUpgrade(row, installCmd, actions) {
|
|
714
|
+
if (row.outdated === true) {
|
|
715
|
+
// MEASURED DEFECT (2026-11-23): hadolint was duplicated AND outdated. The
|
|
716
|
+
// plan removed ~/.local/bin/hadolint, then ran an installer whose command
|
|
717
|
+
// writes to that exact path — so the duplicate came straight back and the
|
|
718
|
+
// repair silently achieved nothing. Detect it and say so loudly instead of
|
|
719
|
+
// reporting a success that is not one.
|
|
720
|
+
const removedHere = actions
|
|
721
|
+
.filter((a) => a.kind === 'remove-duplicate' && a.tool === row.name)
|
|
722
|
+
.map((a) => a.path);
|
|
723
|
+
const writesToRemovedPath = Boolean(installCmd)
|
|
724
|
+
&& removedHere.some((removedPath) => String(installCmd).includes(removedPath));
|
|
725
|
+
actions.push({
|
|
726
|
+
kind: 'upgrade',
|
|
727
|
+
tool: row.name,
|
|
728
|
+
command: installCmd,
|
|
729
|
+
from: row.installedVersion,
|
|
730
|
+
to: row.latestVersion,
|
|
731
|
+
writesToRemovedPath,
|
|
732
|
+
conflictsWith: writesToRemovedPath ? removedHere : undefined,
|
|
733
|
+
});
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
/**
|
|
738
|
+
* Plan removal of a duplicated tool's extra copies.
|
|
739
|
+
*
|
|
740
|
+
* Only USER-owned duplicates are a repair. A distro copy plus a user copy is
|
|
741
|
+
* coexistence (jq from apt vs a newer ~/.local/bin/jq), and removing either is not a
|
|
742
|
+
* fix: the distro one can drag dependencies with it, the user one is what the reader
|
|
743
|
+
* installed on purpose.
|
|
744
|
+
*
|
|
745
|
+
* The KEEP copy is the one the resolver hands to the gates, not whichever path came
|
|
746
|
+
* first. Measured 2026-11-24: with the same tool and the same two paths, listing the
|
|
747
|
+
* installer's copy FIRST made `writesToRemovedPath` false and listing it SECOND made
|
|
748
|
+
* it true -- the self-cancelling guard depended on the order of `distinctRealPaths`,
|
|
749
|
+
* which follows however the locator walked PATH. A guard that only fires for half the
|
|
750
|
+
* callers is not a guard.
|
|
751
|
+
*
|
|
752
|
+
* @returns {boolean} true when the row is fully handled and needs no further action
|
|
753
|
+
*/
|
|
754
|
+
function planDuplicateRemoval(row, userCopies, actions) {
|
|
755
|
+
if (row.duplicated && userCopies.length > 1) {
|
|
756
|
+
// Keep the copy the resolver actually hands to the gates, not whichever
|
|
757
|
+
// path happened to come first.
|
|
758
|
+
//
|
|
759
|
+
// Measured 2026-11-24: with the same tool and the same two paths, listing
|
|
760
|
+
// the copy the installer writes to FIRST made `writesToRemovedPath` false
|
|
761
|
+
// and listing it SECOND made it true -- the self-cancelling-plan guard
|
|
762
|
+
// therefore depended on the order of `distinctRealPaths`, which comes from
|
|
763
|
+
// however the locator walked PATH. A guard that only fires for half the
|
|
764
|
+
// callers is not a guard.
|
|
765
|
+
const preferred = row.resolvedPath && userCopies.includes(row.resolvedPath)
|
|
766
|
+
? row.resolvedPath
|
|
767
|
+
: userCopies[0];
|
|
768
|
+
const keep = preferred;
|
|
769
|
+
const rest = userCopies.filter((p) => p !== keep);
|
|
770
|
+
actions.push({ kind: 'keep', tool: row.name, path: keep });
|
|
771
|
+
for (const dup of rest) {
|
|
772
|
+
actions.push({ kind: 'remove-duplicate', tool: row.name, path: dup, keepPath: keep });
|
|
773
|
+
}
|
|
774
|
+
// A tool that is duplicated but otherwise current needs no install step.
|
|
775
|
+
if (row.available && !row.outdated) return true;
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
return false;
|
|
779
|
+
}
|
|
780
|
+
|
|
1333
781
|
function planToolRepairs(rows, options = {}) {
|
|
1334
782
|
const definitions = options.definitions || [];
|
|
1335
783
|
const platform = options.platform || process.platform;
|
|
@@ -1350,16 +798,13 @@ function planToolRepairs(rows, options = {}) {
|
|
|
1350
798
|
// coexistence (jq from apt vs a newer ~/.local/bin/jq), and removing either
|
|
1351
799
|
// is not a fix: the distro one can drag dependencies with it, the user one is
|
|
1352
800
|
// what the reader installed on purpose.
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
// A tool that is duplicated but otherwise current needs no install step.
|
|
1361
|
-
if (row.available && !row.outdated) continue;
|
|
1362
|
-
}
|
|
801
|
+
// `distinctRealPaths` is only present on rows that were actually located on
|
|
802
|
+
// disk; a row can be flagged `duplicated` by another producer (or by a
|
|
803
|
+
// caller assembling rows by hand) without that list. Defaulting to [] keeps
|
|
804
|
+
// the plan honest -- no copies means no duplicate to remove -- instead of
|
|
805
|
+
// throwing out of a planning function.
|
|
806
|
+
const userCopies = (row.userCopies || (row.distinctRealPaths || []).filter((p) => !isSystemOwned(p)));
|
|
807
|
+
if (planDuplicateRemoval(row, userCopies, actions)) continue;
|
|
1363
808
|
|
|
1364
809
|
if (!row.available) {
|
|
1365
810
|
if (row.optional) {
|
|
@@ -1370,27 +815,7 @@ function planToolRepairs(rows, options = {}) {
|
|
|
1370
815
|
continue;
|
|
1371
816
|
}
|
|
1372
817
|
|
|
1373
|
-
|
|
1374
|
-
// MEASURED DEFECT (2026-11-23): hadolint was duplicated AND outdated. The
|
|
1375
|
-
// plan removed ~/.local/bin/hadolint, then ran an installer whose command
|
|
1376
|
-
// writes to that exact path — so the duplicate came straight back and the
|
|
1377
|
-
// repair silently achieved nothing. Detect it and say so loudly instead of
|
|
1378
|
-
// reporting a success that is not one.
|
|
1379
|
-
const removedHere = actions
|
|
1380
|
-
.filter((a) => a.kind === 'remove-duplicate' && a.tool === row.name)
|
|
1381
|
-
.map((a) => a.path);
|
|
1382
|
-
const writesToRemovedPath = Boolean(installCmd)
|
|
1383
|
-
&& removedHere.some((removedPath) => String(installCmd).includes(removedPath));
|
|
1384
|
-
actions.push({
|
|
1385
|
-
kind: 'upgrade',
|
|
1386
|
-
tool: row.name,
|
|
1387
|
-
command: installCmd,
|
|
1388
|
-
from: row.installedVersion,
|
|
1389
|
-
to: row.latestVersion,
|
|
1390
|
-
writesToRemovedPath,
|
|
1391
|
-
conflictsWith: writesToRemovedPath ? removedHere : undefined,
|
|
1392
|
-
});
|
|
1393
|
-
}
|
|
818
|
+
planUpgrade(row, installCmd, actions);
|
|
1394
819
|
}
|
|
1395
820
|
|
|
1396
821
|
return { actions, clean: actions.length === 0 };
|
|
@@ -1420,7 +845,7 @@ function describeAction(action) {
|
|
|
1420
845
|
function defaultRunCommand(command) {
|
|
1421
846
|
if (!command) return { status: 1, error: 'no installer command' };
|
|
1422
847
|
try {
|
|
1423
|
-
execSync(command, { stdio: 'inherit', timeout:
|
|
848
|
+
execSync(command, { stdio: 'inherit', timeout: INSTALL_EXEC_TIMEOUT_MS, shell: true });
|
|
1424
849
|
return { status: 0 };
|
|
1425
850
|
} catch (err) {
|
|
1426
851
|
return { status: typeof err.status === 'number' ? err.status : 1, error: String(err.message || err) };
|
|
@@ -1458,34 +883,108 @@ function defaultRemoveFile(target) {
|
|
|
1458
883
|
* }} [options]
|
|
1459
884
|
* @returns {Promise<number>} Exit code
|
|
1460
885
|
*/
|
|
886
|
+
/**
|
|
887
|
+
* Build the repair plan for this project's toolchain.
|
|
888
|
+
*
|
|
889
|
+
* Installer commands come from the registry entry (a language tool) or the CLI entry,
|
|
890
|
+
* which is why `definitions` concatenates both: a tool reachable from either side must
|
|
891
|
+
* be installable, and `planToolRepairs` looks definitions up by name alone.
|
|
892
|
+
*/
|
|
893
|
+
function buildInstallPlan(args, options, projectRoot) {
|
|
894
|
+
let languages = options.languages !== undefined ? options.languages : parseLanguageFlag(args);
|
|
895
|
+
if (languages === undefined || languages === null) {
|
|
896
|
+
languages = detectProjectLanguages(projectRoot).detected;
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
const tools = collectGateTools({
|
|
900
|
+
registry: LANGUAGE_REGISTRY,
|
|
901
|
+
cliTools: GATE_CLI_TOOLS,
|
|
902
|
+
languages: args.includes('--all') || !languages.length ? null : languages,
|
|
903
|
+
});
|
|
904
|
+
|
|
905
|
+
const audit = options.audit || ((list, deps) => auditAllTools(list, deps));
|
|
906
|
+
const rows = audit(tools, { resolveLatest: options.resolveLatest || ((n) => resolveLatestVersion(n)) });
|
|
907
|
+
|
|
908
|
+
// Installer commands come from the registry entry (language) or the CLI entry.
|
|
909
|
+
const definitions = options.definitions
|
|
910
|
+
|| [
|
|
911
|
+
...tools,
|
|
912
|
+
...GATE_CLI_TOOLS.map((c) => ({ name: c.tool, install: c.install, optional: false })),
|
|
913
|
+
];
|
|
914
|
+
|
|
915
|
+
const plan = planToolRepairs(rows, { definitions });
|
|
916
|
+
|
|
917
|
+
return planToolRepairs(rows, { definitions });
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
/**
|
|
921
|
+
* Report a plan whose parts undo each other, and say whether it must be refused.
|
|
922
|
+
*
|
|
923
|
+
* A repair whose parts cancel is not a repair. Refusing -- rather than running it and
|
|
924
|
+
* watching a duplicate survive a "successful" run -- points the operator at the
|
|
925
|
+
* installer command, which is the thing that actually needs fixing.
|
|
926
|
+
*
|
|
927
|
+
* @param {{actions: Array}} plan
|
|
928
|
+
* @returns {boolean} true when the plan is self-cancelling
|
|
929
|
+
*/
|
|
930
|
+
function reportSelfCancellingPlan(plan) {
|
|
931
|
+
// A repair whose parts undo each other is not a repair. Refuse to run it and
|
|
932
|
+
// say which action conflicts, so the operator can fix the installer instead of
|
|
933
|
+
// watching a duplicate survive a "successful" run.
|
|
934
|
+
const conflicting = plan.actions.filter((a) => a.kind === 'upgrade' && a.writesToRemovedPath);
|
|
935
|
+
if (conflicting.length) {
|
|
936
|
+
for (const a of conflicting) {
|
|
937
|
+
console.log(`CONFLICT ${a.tool}: its installer writes to ${(a.conflictsWith || []).join(', ')},`);
|
|
938
|
+
console.log(' which this same plan removes — the duplicate would come back.');
|
|
939
|
+
}
|
|
940
|
+
console.log('Refusing to apply a self-cancelling plan. Fix the installer command first.');
|
|
941
|
+
return 1;
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
return false;
|
|
945
|
+
}
|
|
946
|
+
|
|
947
|
+
/**
|
|
948
|
+
* Run the mutating actions, counting failures without stopping.
|
|
949
|
+
*
|
|
950
|
+
* One failed install must not strand the rest -- the operator wants to see every
|
|
951
|
+
* outcome in one pass, not discover them one re-run at a time. A missing installer
|
|
952
|
+
* command counts as a failure rather than being skipped silently: the tool stays
|
|
953
|
+
* broken either way, and only one of those tells the reader.
|
|
954
|
+
*/
|
|
955
|
+
function applyPlanActions(actions, io) {
|
|
956
|
+
const { run, removeFile } = io;
|
|
957
|
+
let failed = 0;
|
|
958
|
+
for (const action of actions) {
|
|
959
|
+
if (action.kind === 'remove-duplicate') {
|
|
960
|
+
const ok = removeFile(action.path);
|
|
961
|
+
if (!ok) failed += 1;
|
|
962
|
+
console.log(`${ok ? 'removed' : 'FAILED to remove'} ${action.path}`);
|
|
963
|
+
continue;
|
|
964
|
+
}
|
|
965
|
+
if (!action.command) {
|
|
966
|
+
failed += 1;
|
|
967
|
+
console.log(`FAILED ${action.tool}: no installer command for this platform`);
|
|
968
|
+
continue;
|
|
969
|
+
}
|
|
970
|
+
console.log(`> ${action.command}`);
|
|
971
|
+
const result = run(action.command) || { status: 1 };
|
|
972
|
+
if (result.status !== 0) {
|
|
973
|
+
failed += 1;
|
|
974
|
+
console.log(`FAILED ${action.tool} (exit ${result.status})`);
|
|
975
|
+
}
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
return failed;
|
|
979
|
+
}
|
|
980
|
+
|
|
1461
981
|
async function handleInstallTools(args, options = {}) {
|
|
1462
982
|
const projectRoot = options.projectRoot || process.cwd();
|
|
1463
983
|
const autoYes = args.includes('--yes') || args.includes('-y');
|
|
1464
984
|
const run = options.run || defaultRunCommand;
|
|
1465
985
|
const removeFile = options.removeFile || defaultRemoveFile;
|
|
1466
986
|
|
|
1467
|
-
|
|
1468
|
-
if (languages === undefined || languages === null) {
|
|
1469
|
-
languages = detectProjectLanguages(projectRoot).detected;
|
|
1470
|
-
}
|
|
1471
|
-
|
|
1472
|
-
const tools = collectGateTools({
|
|
1473
|
-
registry: LANGUAGE_REGISTRY,
|
|
1474
|
-
cliTools: GATE_CLI_TOOLS,
|
|
1475
|
-
languages: args.includes('--all') || !languages.length ? null : languages,
|
|
1476
|
-
});
|
|
1477
|
-
|
|
1478
|
-
const audit = options.audit || ((list, deps) => auditAllTools(list, deps));
|
|
1479
|
-
const rows = audit(tools, { resolveLatest: options.resolveLatest || ((n) => resolveLatestVersion(n)) });
|
|
1480
|
-
|
|
1481
|
-
// Installer commands come from the registry entry (language) or the CLI entry.
|
|
1482
|
-
const definitions = options.definitions
|
|
1483
|
-
|| [
|
|
1484
|
-
...tools,
|
|
1485
|
-
...GATE_CLI_TOOLS.map((c) => ({ name: c.tool, install: c.install, optional: false })),
|
|
1486
|
-
];
|
|
1487
|
-
|
|
1488
|
-
const plan = planToolRepairs(rows, { definitions });
|
|
987
|
+
const plan = buildInstallPlan(args, options, projectRoot);
|
|
1489
988
|
if (plan.clean) {
|
|
1490
989
|
console.log('Toolchain is already up to date: nothing to install, upgrade or remove.');
|
|
1491
990
|
return 0;
|
|
@@ -1495,18 +994,7 @@ async function handleInstallTools(args, options = {}) {
|
|
|
1495
994
|
for (const action of plan.actions) console.log(` • ${describeAction(action)}`);
|
|
1496
995
|
console.log('');
|
|
1497
996
|
|
|
1498
|
-
|
|
1499
|
-
// say which action conflicts, so the operator can fix the installer instead of
|
|
1500
|
-
// watching a duplicate survive a "successful" run.
|
|
1501
|
-
const conflicting = plan.actions.filter((a) => a.kind === 'upgrade' && a.writesToRemovedPath);
|
|
1502
|
-
if (conflicting.length) {
|
|
1503
|
-
for (const a of conflicting) {
|
|
1504
|
-
console.log(`CONFLICT ${a.tool}: its installer writes to ${(a.conflictsWith || []).join(', ')},`);
|
|
1505
|
-
console.log(' which this same plan removes — the duplicate would come back.');
|
|
1506
|
-
}
|
|
1507
|
-
console.log('Refusing to apply a self-cancelling plan. Fix the installer command first.');
|
|
1508
|
-
return 1;
|
|
1509
|
-
}
|
|
997
|
+
if (reportSelfCancellingPlan(plan)) return 1;
|
|
1510
998
|
|
|
1511
999
|
const mutating = plan.actions.filter((a) =>
|
|
1512
1000
|
a.kind === 'install' || a.kind === 'upgrade' || a.kind === 'remove-duplicate');
|
|
@@ -1520,26 +1008,7 @@ async function handleInstallTools(args, options = {}) {
|
|
|
1520
1008
|
return 0;
|
|
1521
1009
|
}
|
|
1522
1010
|
|
|
1523
|
-
|
|
1524
|
-
for (const action of mutating) {
|
|
1525
|
-
if (action.kind === 'remove-duplicate') {
|
|
1526
|
-
const ok = removeFile(action.path);
|
|
1527
|
-
if (!ok) failed += 1;
|
|
1528
|
-
console.log(`${ok ? 'removed' : 'FAILED to remove'} ${action.path}`);
|
|
1529
|
-
continue;
|
|
1530
|
-
}
|
|
1531
|
-
if (!action.command) {
|
|
1532
|
-
failed += 1;
|
|
1533
|
-
console.log(`FAILED ${action.tool}: no installer command for this platform`);
|
|
1534
|
-
continue;
|
|
1535
|
-
}
|
|
1536
|
-
console.log(`> ${action.command}`);
|
|
1537
|
-
const result = run(action.command) || { status: 1 };
|
|
1538
|
-
if (result.status !== 0) {
|
|
1539
|
-
failed += 1;
|
|
1540
|
-
console.log(`FAILED ${action.tool} (exit ${result.status})`);
|
|
1541
|
-
}
|
|
1542
|
-
}
|
|
1011
|
+
const failed = applyPlanActions(mutating, { run, removeFile });
|
|
1543
1012
|
|
|
1544
1013
|
console.log('');
|
|
1545
1014
|
if (failed > 0) {
|