pr-checkmate 3.0.4 → 3.1.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/dist/{cli.js → cjs/cli.js} +30 -30
- package/dist/{config → cjs/config}/index.d.ts +2 -2
- package/dist/{config → cjs/config}/index.js +8 -7
- package/dist/{config → cjs/config}/loader.d.ts +1 -1
- package/dist/{config → cjs/config}/loader.js +8 -8
- package/dist/{core → cjs/core}/checks/dependencies/banned-imports.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/dependencies/banned-imports.js +10 -10
- package/dist/{core → cjs/core}/checks/dependencies/circular-deps.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/dependencies/circular-deps.js +27 -27
- package/dist/{core → cjs/core}/checks/dependencies/dependency-check.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/dependencies/dependency-check.js +17 -17
- package/dist/{core → cjs/core}/checks/dependencies/grype-scan.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/dependencies/grype-scan.js +18 -18
- package/dist/{core → cjs/core}/checks/dependencies/license-check.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/dependencies/license-check.js +12 -12
- package/dist/{core → cjs/core}/checks/dependencies/npm-audit.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/dependencies/npm-audit.js +14 -14
- package/dist/{core → cjs/core}/checks/dependencies/outdated-deps.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/dependencies/outdated-deps.js +14 -14
- package/dist/{core → cjs/core}/checks/dependencies/vuln-scan.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/dependencies/vuln-scan.js +14 -14
- package/dist/{core → cjs/core}/checks/findings.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/findings.js +16 -16
- package/dist/{core → cjs/core}/checks/git/custom-rules.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/git/custom-rules.js +19 -19
- package/dist/{core → cjs/core}/checks/git/diff-smell.d.ts +2 -2
- package/dist/{core → cjs/core}/checks/git/diff-smell.js +13 -13
- package/dist/{core → cjs/core}/checks/git/large-files.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/git/large-files.js +15 -15
- package/dist/{core → cjs/core}/checks/git/leftover-debug.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/git/leftover-debug.js +13 -13
- package/dist/{core → cjs/core}/checks/git/lockfile-drift.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/git/lockfile-drift.js +12 -12
- package/dist/{core → cjs/core}/checks/git/merge-conflict.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/git/merge-conflict.js +15 -15
- package/dist/{core → cjs/core}/checks/git/missing-tests.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/git/missing-tests.js +15 -15
- package/dist/{core → cjs/core}/checks/git/todo-fixme.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/git/todo-fixme.js +11 -11
- package/dist/{core → cjs/core}/checks/languages/cpp-format.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/languages/cpp-format.js +18 -18
- package/dist/{core → cjs/core}/checks/languages/external-checks.d.ts +9 -9
- package/dist/{core → cjs/core}/checks/languages/external-checks.js +10 -10
- package/dist/{core → cjs/core}/checks/languages/external-runner.d.ts +2 -2
- package/dist/{core → cjs/core}/checks/languages/external-runner.js +21 -21
- package/dist/{core → cjs/core}/checks/languages/go-format.d.ts +1 -1
- package/dist/cjs/core/checks/languages/go-format.js +202 -0
- package/dist/cjs/core/checks/languages/lint.d.ts +2 -0
- package/dist/{core → cjs/core}/checks/languages/lint.js +21 -21
- package/dist/{core → cjs/core}/checks/languages/prettier.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/languages/prettier.js +18 -18
- package/dist/{core → cjs/core}/checks/languages/python-format.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/languages/python-format.js +14 -14
- package/dist/{core → cjs/core}/checks/languages/python-lint.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/languages/python-lint.js +13 -13
- package/dist/{core → cjs/core}/checks/languages/python-typecheck.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/languages/python-typecheck.js +29 -29
- package/dist/{core → cjs/core}/checks/languages/typecheck.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/languages/typecheck.js +13 -13
- package/dist/{core → cjs/core}/checks/pr/commitlint.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/pr/commitlint.js +12 -12
- package/dist/{core → cjs/core}/checks/pr/pr-body.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/pr/pr-body.js +8 -8
- package/dist/{core → cjs/core}/checks/pr/pr-size-check.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/pr/pr-size-check.js +10 -10
- package/dist/{core → cjs/core}/checks/pr/pr-title-lint.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/pr/pr-title-lint.js +8 -8
- package/dist/{core → cjs/core}/checks/quality/case-collision.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/quality/case-collision.js +7 -7
- package/dist/{core → cjs/core}/checks/quality/config-validation.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/quality/config-validation.js +9 -9
- package/dist/{core → cjs/core}/checks/quality/coverage.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/quality/coverage.js +4 -4
- package/dist/{core → cjs/core}/checks/quality/dead-code.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/quality/dead-code.js +23 -23
- package/dist/{core → cjs/core}/checks/quality/duplicate-check.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/quality/duplicate-check.js +22 -22
- package/dist/{core → cjs/core}/checks/quality/license-header.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/quality/license-header.js +16 -16
- package/dist/{core → cjs/core}/checks/quality/markdown-lint.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/quality/markdown-lint.js +17 -17
- package/dist/{core → cjs/core}/checks/quality/package-size.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/quality/package-size.js +12 -12
- package/dist/{core → cjs/core}/checks/quality/spellcheck.d.ts +2 -2
- package/dist/{core → cjs/core}/checks/quality/spellcheck.js +18 -18
- package/dist/{core → cjs/core}/checks/quality/symlinks.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/quality/symlinks.js +8 -8
- package/dist/{core → cjs/core}/checks/quality/yaml-lint.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/quality/yaml-lint.js +12 -12
- package/dist/{core → cjs/core}/checks/security/diff-security.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/security/diff-security.js +15 -15
- package/dist/{core → cjs/core}/checks/security/dockerfile-security.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/security/dockerfile-security.js +16 -16
- package/dist/{core → cjs/core}/checks/security/migration-safety.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/security/migration-safety.js +17 -17
- package/dist/{core → cjs/core}/checks/security/security.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/security/security.js +21 -21
- package/dist/{core → cjs/core}/checks/security/sensitive-file-guard.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/security/sensitive-file-guard.js +14 -14
- package/dist/{core → cjs/core}/checks/security/workflow-security.d.ts +2 -2
- package/dist/{core → cjs/core}/checks/security/workflow-security.js +14 -14
- package/dist/{core → cjs/core}/checks/tool-install.d.ts +1 -1
- package/dist/{core → cjs/core}/checks/tool-install.js +2 -2
- package/dist/{core → cjs/core}/context.d.ts +1 -1
- package/dist/{core → cjs/core}/context.js +16 -16
- package/dist/cjs/core/index.d.ts +4 -0
- package/dist/{core → cjs/core}/index.js +7 -7
- package/dist/{core → cjs/core}/install/cache.js +2 -2
- package/dist/{core → cjs/core}/install/doctor.d.ts +4 -4
- package/dist/{core → cjs/core}/install/doctor.js +34 -34
- package/dist/{core → cjs/core}/install/ensure.d.ts +2 -2
- package/dist/{core → cjs/core}/install/ensure.js +15 -14
- package/dist/{core → cjs/core}/install/lock.js +4 -4
- package/dist/{core → cjs/core}/install/prepare.d.ts +4 -4
- package/dist/{core → cjs/core}/install/prepare.js +13 -13
- package/dist/{core → cjs/core}/install/profiles.d.ts +2 -2
- package/dist/{core → cjs/core}/install/reuse.d.ts +1 -1
- package/dist/{core → cjs/core}/install/reuse.js +4 -4
- package/dist/{core → cjs/core}/registry.d.ts +1 -1
- package/dist/cjs/core/registry.js +112 -0
- package/dist/{core → cjs/core}/reporters.d.ts +1 -1
- package/dist/{core → cjs/core}/reporters.js +28 -28
- package/dist/{core → cjs/core}/run-checks.d.ts +2 -2
- package/dist/{core → cjs/core}/run-checks.js +31 -31
- package/dist/{core → cjs/core}/targets.d.ts +1 -1
- package/dist/{core → cjs/core}/targets.js +20 -20
- package/dist/{core → cjs/core}/types.d.ts +3 -3
- package/dist/cjs/index.d.ts +12 -0
- package/dist/{index.js → cjs/index.js} +18 -18
- package/dist/{init.js → cjs/init.js} +68 -56
- package/dist/{interfaces → cjs/interfaces}/index.d.ts +3 -3
- package/dist/cjs/package.json +1 -0
- package/dist/{scripts → cjs/scripts}/copy-configs.js +22 -7
- package/dist/{scripts → cjs/scripts}/generate-install-manifests.js +2 -2
- package/dist/{scripts → cjs/scripts}/publish-github.js +4 -4
- package/dist/{utils → cjs/utils}/detect-language.js +12 -12
- package/dist/cjs/utils/execa.js +46 -0
- package/dist/{utils → cjs/utils}/git.js +2 -2
- package/dist/{utils → cjs/utils}/http.js +2 -2
- package/dist/cjs/utils/index.d.ts +15 -0
- package/dist/{utils → cjs/utils}/index.js +13 -13
- package/dist/{utils → cjs/utils}/own-deps.d.ts +2 -0
- package/dist/{utils → cjs/utils}/own-deps.js +1 -0
- package/dist/{utils → cjs/utils}/package-version.js +2 -1
- package/dist/{utils → cjs/utils}/resolve-bin.js +2 -1
- package/dist/{utils → cjs/utils}/update-notifier.js +4 -4
- package/dist/esm/cli.d.ts +2 -0
- package/dist/esm/cli.js +137 -0
- package/dist/esm/config/constants.d.ts +153 -0
- package/dist/esm/config/constants.js +360 -0
- package/dist/esm/config/index.d.ts +40 -0
- package/dist/esm/config/index.js +60 -0
- package/dist/esm/config/loader.d.ts +6 -0
- package/dist/esm/config/loader.js +191 -0
- package/dist/esm/config/pr-checkmate-workflow-docker.yml +79 -0
- package/dist/esm/config/pr-checkmate-workflow.yml +92 -0
- package/dist/esm/core/checks/dependencies/banned-imports.d.ts +2 -0
- package/dist/esm/core/checks/dependencies/banned-imports.js +70 -0
- package/dist/esm/core/checks/dependencies/circular-deps.d.ts +2 -0
- package/dist/esm/core/checks/dependencies/circular-deps.js +155 -0
- package/dist/esm/core/checks/dependencies/dependency-check.d.ts +43 -0
- package/dist/esm/core/checks/dependencies/dependency-check.js +174 -0
- package/dist/esm/core/checks/dependencies/grype-scan.d.ts +22 -0
- package/dist/esm/core/checks/dependencies/grype-scan.js +112 -0
- package/dist/esm/core/checks/dependencies/license-check.d.ts +2 -0
- package/dist/esm/core/checks/dependencies/license-check.js +61 -0
- package/dist/esm/core/checks/dependencies/npm-audit.d.ts +6 -0
- package/dist/esm/core/checks/dependencies/npm-audit.js +80 -0
- package/dist/esm/core/checks/dependencies/outdated-deps.d.ts +2 -0
- package/dist/esm/core/checks/dependencies/outdated-deps.js +66 -0
- package/dist/esm/core/checks/dependencies/vuln-scan.d.ts +2 -0
- package/dist/esm/core/checks/dependencies/vuln-scan.js +54 -0
- package/dist/esm/core/checks/findings.d.ts +299 -0
- package/dist/esm/core/checks/findings.js +701 -0
- package/dist/esm/core/checks/git/custom-rules.d.ts +2 -0
- package/dist/esm/core/checks/git/custom-rules.js +106 -0
- package/dist/esm/core/checks/git/diff-smell.d.ts +19 -0
- package/dist/esm/core/checks/git/diff-smell.js +69 -0
- package/dist/esm/core/checks/git/large-files.d.ts +2 -0
- package/dist/esm/core/checks/git/large-files.js +112 -0
- package/dist/esm/core/checks/git/leftover-debug.d.ts +2 -0
- package/dist/esm/core/checks/git/leftover-debug.js +89 -0
- package/dist/esm/core/checks/git/lockfile-drift.d.ts +2 -0
- package/dist/esm/core/checks/git/lockfile-drift.js +114 -0
- package/dist/esm/core/checks/git/merge-conflict.d.ts +2 -0
- package/dist/esm/core/checks/git/merge-conflict.js +117 -0
- package/dist/esm/core/checks/git/missing-tests.d.ts +2 -0
- package/dist/esm/core/checks/git/missing-tests.js +105 -0
- package/dist/esm/core/checks/git/todo-fixme.d.ts +7 -0
- package/dist/esm/core/checks/git/todo-fixme.js +80 -0
- package/dist/esm/core/checks/languages/cpp-format.d.ts +7 -0
- package/dist/esm/core/checks/languages/cpp-format.js +91 -0
- package/dist/esm/core/checks/languages/external-checks.d.ts +77 -0
- package/dist/esm/core/checks/languages/external-checks.js +197 -0
- package/dist/esm/core/checks/languages/external-runner.d.ts +119 -0
- package/dist/esm/core/checks/languages/external-runner.js +138 -0
- package/dist/esm/core/checks/languages/go-format.d.ts +8 -0
- package/dist/{core → esm/core}/checks/languages/go-format.js +29 -35
- package/dist/esm/core/checks/languages/lint.d.ts +2 -0
- package/dist/esm/core/checks/languages/lint.js +92 -0
- package/dist/esm/core/checks/languages/prettier.d.ts +2 -0
- package/dist/esm/core/checks/languages/prettier.js +85 -0
- package/dist/esm/core/checks/languages/python-format.d.ts +7 -0
- package/dist/esm/core/checks/languages/python-format.js +61 -0
- package/dist/esm/core/checks/languages/python-lint.d.ts +9 -0
- package/dist/esm/core/checks/languages/python-lint.js +55 -0
- package/dist/esm/core/checks/languages/python-typecheck.d.ts +14 -0
- package/dist/esm/core/checks/languages/python-typecheck.js +184 -0
- package/dist/esm/core/checks/languages/ruff-shared.d.ts +10 -0
- package/dist/esm/core/checks/languages/ruff-shared.js +35 -0
- package/dist/esm/core/checks/languages/typecheck.d.ts +2 -0
- package/dist/esm/core/checks/languages/typecheck.js +61 -0
- package/dist/esm/core/checks/pr/commitlint.d.ts +2 -0
- package/dist/esm/core/checks/pr/commitlint.js +102 -0
- package/dist/esm/core/checks/pr/pr-body.d.ts +2 -0
- package/dist/esm/core/checks/pr/pr-body.js +43 -0
- package/dist/esm/core/checks/pr/pr-size-check.d.ts +2 -0
- package/dist/esm/core/checks/pr/pr-size-check.js +42 -0
- package/dist/esm/core/checks/pr/pr-title-lint.d.ts +2 -0
- package/dist/esm/core/checks/pr/pr-title-lint.js +31 -0
- package/dist/esm/core/checks/quality/case-collision.d.ts +8 -0
- package/dist/esm/core/checks/quality/case-collision.js +39 -0
- package/dist/esm/core/checks/quality/config-validation.d.ts +11 -0
- package/dist/esm/core/checks/quality/config-validation.js +188 -0
- package/dist/esm/core/checks/quality/coverage.d.ts +2 -0
- package/dist/esm/core/checks/quality/coverage.js +62 -0
- package/dist/esm/core/checks/quality/dead-code.d.ts +2 -0
- package/dist/esm/core/checks/quality/dead-code.js +124 -0
- package/dist/esm/core/checks/quality/duplicate-check.d.ts +2 -0
- package/dist/esm/core/checks/quality/duplicate-check.js +141 -0
- package/dist/esm/core/checks/quality/license-header.d.ts +7 -0
- package/dist/esm/core/checks/quality/license-header.js +81 -0
- package/dist/esm/core/checks/quality/markdown-lint.d.ts +2 -0
- package/dist/esm/core/checks/quality/markdown-lint.js +104 -0
- package/dist/esm/core/checks/quality/package-size.d.ts +36 -0
- package/dist/esm/core/checks/quality/package-size.js +196 -0
- package/dist/esm/core/checks/quality/spellcheck.d.ts +77 -0
- package/dist/esm/core/checks/quality/spellcheck.js +296 -0
- package/dist/esm/core/checks/quality/symlinks.d.ts +16 -0
- package/dist/esm/core/checks/quality/symlinks.js +57 -0
- package/dist/esm/core/checks/quality/yaml-lint.d.ts +20 -0
- package/dist/esm/core/checks/quality/yaml-lint.js +116 -0
- package/dist/esm/core/checks/security/diff-security.d.ts +2 -0
- package/dist/esm/core/checks/security/diff-security.js +354 -0
- package/dist/esm/core/checks/security/dockerfile-security.d.ts +2 -0
- package/dist/esm/core/checks/security/dockerfile-security.js +98 -0
- package/dist/esm/core/checks/security/migration-safety.d.ts +2 -0
- package/dist/esm/core/checks/security/migration-safety.js +137 -0
- package/dist/esm/core/checks/security/security.d.ts +63 -0
- package/dist/esm/core/checks/security/security.js +201 -0
- package/dist/esm/core/checks/security/sensitive-file-guard.d.ts +2 -0
- package/dist/esm/core/checks/security/sensitive-file-guard.js +160 -0
- package/dist/esm/core/checks/security/workflow-security.d.ts +12 -0
- package/dist/esm/core/checks/security/workflow-security.js +100 -0
- package/dist/esm/core/checks/tool-install.d.ts +102 -0
- package/dist/esm/core/checks/tool-install.js +66 -0
- package/dist/esm/core/commands.d.ts +27 -0
- package/dist/esm/core/commands.js +89 -0
- package/dist/esm/core/context.d.ts +62 -0
- package/dist/esm/core/context.js +241 -0
- package/dist/esm/core/index.d.ts +4 -0
- package/dist/esm/core/index.js +4 -0
- package/dist/esm/core/install/cache.d.ts +58 -0
- package/dist/esm/core/install/cache.js +142 -0
- package/dist/esm/core/install/doctor.d.ts +35 -0
- package/dist/esm/core/install/doctor.js +164 -0
- package/dist/esm/core/install/ensure.d.ts +77 -0
- package/dist/esm/core/install/ensure.js +269 -0
- package/dist/esm/core/install/lock.d.ts +34 -0
- package/dist/esm/core/install/lock.js +92 -0
- package/dist/esm/core/install/merge.d.ts +47 -0
- package/dist/esm/core/install/merge.js +85 -0
- package/dist/esm/core/install/prepare.d.ts +76 -0
- package/dist/esm/core/install/prepare.js +142 -0
- package/dist/esm/core/install/profiles.d.ts +78 -0
- package/dist/esm/core/install/profiles.js +192 -0
- package/dist/esm/core/install/reuse.d.ts +41 -0
- package/dist/esm/core/install/reuse.js +100 -0
- package/dist/esm/core/registry.d.ts +6 -0
- package/dist/esm/core/registry.js +109 -0
- package/dist/esm/core/reporters.d.ts +18 -0
- package/dist/esm/core/reporters.js +266 -0
- package/dist/esm/core/run-checks.d.ts +33 -0
- package/dist/esm/core/run-checks.js +293 -0
- package/dist/esm/core/targets.d.ts +140 -0
- package/dist/esm/core/targets.js +213 -0
- package/dist/esm/core/types.d.ts +195 -0
- package/dist/esm/core/types.js +38 -0
- package/dist/esm/index.d.ts +12 -0
- package/dist/esm/index.js +15 -0
- package/dist/esm/init.d.ts +38 -0
- package/dist/esm/init.js +421 -0
- package/dist/esm/interfaces/index.d.ts +432 -0
- package/dist/esm/interfaces/index.js +2 -0
- package/dist/esm/package.json +1 -0
- package/dist/esm/scripts/copy-configs.d.ts +1 -0
- package/dist/esm/scripts/copy-configs.js +64 -0
- package/dist/esm/scripts/generate-install-manifests.d.ts +39 -0
- package/dist/esm/scripts/generate-install-manifests.js +115 -0
- package/dist/esm/scripts/publish-github.d.ts +1 -0
- package/dist/esm/scripts/publish-github.js +45 -0
- package/dist/esm/utils/ci.d.ts +11 -0
- package/dist/esm/utils/ci.js +40 -0
- package/dist/esm/utils/detect-language.d.ts +48 -0
- package/dist/esm/utils/detect-language.js +234 -0
- package/dist/esm/utils/direct-deps.d.ts +21 -0
- package/dist/esm/utils/direct-deps.js +220 -0
- package/dist/esm/utils/execa.d.ts +22 -0
- package/dist/{utils → esm/utils}/execa.js +1 -4
- package/dist/esm/utils/git.d.ts +14 -0
- package/dist/esm/utils/git.js +21 -0
- package/dist/esm/utils/glob.d.ts +24 -0
- package/dist/esm/utils/glob.js +40 -0
- package/dist/esm/utils/http.d.ts +59 -0
- package/dist/esm/utils/http.js +115 -0
- package/dist/esm/utils/index.d.ts +15 -0
- package/dist/esm/utils/index.js +26 -0
- package/dist/esm/utils/logger.d.ts +65 -0
- package/dist/esm/utils/logger.js +157 -0
- package/dist/esm/utils/own-deps.d.ts +16 -0
- package/dist/esm/utils/own-deps.js +107 -0
- package/dist/esm/utils/package-version.d.ts +4 -0
- package/dist/esm/utils/package-version.js +38 -0
- package/dist/esm/utils/pool.d.ts +49 -0
- package/dist/esm/utils/pool.js +113 -0
- package/dist/esm/utils/resolve-bin.d.ts +67 -0
- package/dist/esm/utils/resolve-bin.js +156 -0
- package/dist/esm/utils/result-collector.d.ts +33 -0
- package/dist/esm/utils/result-collector.js +44 -0
- package/dist/esm/utils/update-notifier.d.ts +19 -0
- package/dist/esm/utils/update-notifier.js +108 -0
- package/install-manifests/core/package-lock.json +4 -4
- package/install-manifests/core/package.json +1 -1
- package/package.json +15 -13
- package/dist/core/checks/languages/lint.d.ts +0 -2
- package/dist/core/index.d.ts +0 -4
- package/dist/core/registry.js +0 -112
- package/dist/index.d.ts +0 -12
- package/dist/utils/index.d.ts +0 -15
- /package/dist/{cli.d.ts → cjs/cli.d.ts} +0 -0
- /package/dist/{config → cjs/config}/constants.d.ts +0 -0
- /package/dist/{config → cjs/config}/constants.js +0 -0
- /package/dist/{config → cjs/config}/pr-checkmate-workflow-docker.yml +0 -0
- /package/dist/{config → cjs/config}/pr-checkmate-workflow.yml +0 -0
- /package/dist/{core → cjs/core}/checks/languages/ruff-shared.d.ts +0 -0
- /package/dist/{core → cjs/core}/checks/languages/ruff-shared.js +0 -0
- /package/dist/{core → cjs/core}/commands.d.ts +0 -0
- /package/dist/{core → cjs/core}/commands.js +0 -0
- /package/dist/{core → cjs/core}/install/cache.d.ts +0 -0
- /package/dist/{core → cjs/core}/install/lock.d.ts +0 -0
- /package/dist/{core → cjs/core}/install/merge.d.ts +0 -0
- /package/dist/{core → cjs/core}/install/merge.js +0 -0
- /package/dist/{core → cjs/core}/install/profiles.js +0 -0
- /package/dist/{core → cjs/core}/types.js +0 -0
- /package/dist/{init.d.ts → cjs/init.d.ts} +0 -0
- /package/dist/{interfaces → cjs/interfaces}/index.js +0 -0
- /package/dist/{scripts → cjs/scripts}/copy-configs.d.ts +0 -0
- /package/dist/{scripts → cjs/scripts}/generate-install-manifests.d.ts +0 -0
- /package/dist/{scripts → cjs/scripts}/publish-github.d.ts +0 -0
- /package/dist/{utils → cjs/utils}/ci.d.ts +0 -0
- /package/dist/{utils → cjs/utils}/ci.js +0 -0
- /package/dist/{utils → cjs/utils}/detect-language.d.ts +0 -0
- /package/dist/{utils → cjs/utils}/direct-deps.d.ts +0 -0
- /package/dist/{utils → cjs/utils}/direct-deps.js +0 -0
- /package/dist/{utils → cjs/utils}/execa.d.ts +0 -0
- /package/dist/{utils → cjs/utils}/git.d.ts +0 -0
- /package/dist/{utils → cjs/utils}/glob.d.ts +0 -0
- /package/dist/{utils → cjs/utils}/glob.js +0 -0
- /package/dist/{utils → cjs/utils}/http.d.ts +0 -0
- /package/dist/{utils → cjs/utils}/logger.d.ts +0 -0
- /package/dist/{utils → cjs/utils}/logger.js +0 -0
- /package/dist/{utils → cjs/utils}/package-version.d.ts +0 -0
- /package/dist/{utils → cjs/utils}/pool.d.ts +0 -0
- /package/dist/{utils → cjs/utils}/pool.js +0 -0
- /package/dist/{utils → cjs/utils}/resolve-bin.d.ts +0 -0
- /package/dist/{utils → cjs/utils}/result-collector.d.ts +0 -0
- /package/dist/{utils → cjs/utils}/result-collector.js +0 -0
- /package/dist/{utils → cjs/utils}/update-notifier.d.ts +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.sensitiveFileGuardCheck = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
4
|
+
const execa_js_1 = require("../../../utils/execa.js");
|
|
5
|
+
const index_js_1 = require("../../../utils/index.js");
|
|
6
|
+
const targets_js_1 = require("../../targets.js");
|
|
7
|
+
const types_js_1 = require("../../types.js");
|
|
8
|
+
const findings_js_1 = require("../findings.js");
|
|
9
9
|
/**
|
|
10
10
|
* The committed template, in the names every ecosystem uses for it.
|
|
11
11
|
*
|
|
@@ -111,15 +111,15 @@ exports.sensitiveFileGuardCheck = {
|
|
|
111
111
|
? ['diff', '--name-only', '--diff-filter=ACMRD', ctx.baseSha, ctx.headSha ?? 'HEAD']
|
|
112
112
|
: ['ls-files'];
|
|
113
113
|
if (!ctx.baseSha && ctx.config.run?.fullScanBehaviour === 'skip')
|
|
114
|
-
return (0,
|
|
114
|
+
return (0, types_js_1.pass)();
|
|
115
115
|
// `reject: false` so a directory that is not a repository is an ordinary
|
|
116
116
|
// outcome rather than a thrown error whose message carries git's raw
|
|
117
117
|
// `fatal: not a git repository` into the log. The check still skips — but
|
|
118
118
|
// a skip with a reason reads as a decision, while a bare `fatal:` reads as
|
|
119
119
|
// a crash, and someone has to spend time proving it was not one.
|
|
120
|
-
const result = await (0,
|
|
120
|
+
const result = await (0, execa_js_1.execa)('git', args, { cwd: ctx.cwd, reject: false });
|
|
121
121
|
if (result.exitCode !== 0)
|
|
122
|
-
return (0,
|
|
122
|
+
return (0, types_js_1.skip)('git unavailable');
|
|
123
123
|
const cfg = ctx.config.sensitiveFileGuard ?? {};
|
|
124
124
|
// Path exclusions are applied before categorising, so one false positive —
|
|
125
125
|
// a `.pem` test fixture, a committed `.env.example` — is excused by name.
|
|
@@ -137,11 +137,11 @@ exports.sensitiveFileGuardCheck = {
|
|
|
137
137
|
// exclusion that reaches every check. It did not reach this one, which
|
|
138
138
|
// meant a `.pem` test fixture failed the build and the key the docs told
|
|
139
139
|
// people to reach for did nothing (ticket 080).
|
|
140
|
-
const changedFiles = (0,
|
|
140
|
+
const changedFiles = (0, targets_js_1.excludeClientPaths)(result.stdout.split('\n').filter(Boolean), ctx.cwd).filter(file => !(0, index_js_1.matchesAnyGlob)(file, cfg.ignorePaths ?? []));
|
|
141
141
|
if (changedFiles.length === 0)
|
|
142
|
-
return (0,
|
|
142
|
+
return (0, types_js_1.pass)();
|
|
143
143
|
const { errors, warnings } = categorizeFiles(changedFiles);
|
|
144
|
-
return (0,
|
|
144
|
+
return (0, findings_js_1.reportSeverityBuckets)(errors, warnings, {
|
|
145
145
|
prefix: 'Sensitive Files',
|
|
146
146
|
// "changed" is only true of a diff; a full scan is answering a different
|
|
147
147
|
// question — what the repository contains — and saying otherwise would
|
|
@@ -149,15 +149,15 @@ exports.sensitiveFileGuardCheck = {
|
|
|
149
149
|
errorSummary: n => `${n} sensitive file(s) ${ctx.baseSha ? 'changed' : 'in the repo'}`,
|
|
150
150
|
warningSummary: n => `${n} notable file(s) ${ctx.baseSha ? 'changed' : 'in the repo'}`,
|
|
151
151
|
showCount: false,
|
|
152
|
-
...(0,
|
|
152
|
+
...(0, findings_js_1.clientFindingOptions)(ctx, cfg),
|
|
153
153
|
// Every sensitive path is listed rather than sampled: knowing that eight
|
|
154
154
|
// files are in play but only which three is not an answer anyone can act on.
|
|
155
155
|
sampleLimit: undefined,
|
|
156
156
|
});
|
|
157
157
|
}
|
|
158
158
|
catch (err) {
|
|
159
|
-
|
|
160
|
-
return (0,
|
|
159
|
+
index_js_1.logger.warn(`[Sensitive Files]: ⚠️ Could not check file changes\n${err}`);
|
|
160
|
+
return (0, types_js_1.skip)('diff unavailable');
|
|
161
161
|
}
|
|
162
162
|
},
|
|
163
163
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Check } from '../../types';
|
|
2
|
-
import { DiffPattern } from '../findings';
|
|
1
|
+
import { Check } from '../../types.js';
|
|
2
|
+
import { DiffPattern } from '../findings.js';
|
|
3
3
|
/**
|
|
4
4
|
* GitHub Actions workflow risks, matched on added diff lines of workflow files.
|
|
5
5
|
* These are the high-frequency supply-chain / injection footguns.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.workflowSecurityCheck = exports.WORKFLOW_PATTERNS = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
4
|
+
const index_js_1 = require("../../../utils/index.js");
|
|
5
|
+
const targets_js_1 = require("../../targets.js");
|
|
6
|
+
const types_js_1 = require("../../types.js");
|
|
7
|
+
const findings_js_1 = require("../findings.js");
|
|
8
8
|
/**
|
|
9
9
|
* A YAML key binding — `HEAD_REF: ${{ … }}`, `ref: ${{ … }}` — rather than an
|
|
10
10
|
* interpolation inside a script body.
|
|
@@ -69,35 +69,35 @@ exports.workflowSecurityCheck = {
|
|
|
69
69
|
try {
|
|
70
70
|
const globs = ['.github/workflows/*.yml', '.github/workflows/*.yaml'];
|
|
71
71
|
const cfg = ctx.config.workflowSecurity ?? {};
|
|
72
|
-
const found = (0,
|
|
72
|
+
const found = (0, findings_js_1.emptyBuckets)();
|
|
73
73
|
const scanInto = (stdout) => {
|
|
74
74
|
// `diffAddedLines` already dropped `pr-checkmate-ignore` lines, and
|
|
75
75
|
// `scanTrackedFiles` does the same for the whole-file path.
|
|
76
|
-
(0,
|
|
76
|
+
(0, findings_js_1.mergeSeverityBuckets)(found, (0, findings_js_1.scanDiffPatterns)(stdout, exports.WORKFLOW_PATTERNS, { ignorePaths: cfg.ignorePaths }));
|
|
77
77
|
};
|
|
78
78
|
if (ctx.baseSha) {
|
|
79
|
-
scanInto(await (0,
|
|
79
|
+
scanInto(await (0, findings_js_1.diffAddedLines)(ctx, globs));
|
|
80
80
|
}
|
|
81
81
|
else if (ctx.config.run?.fullScanBehaviour !== 'skip') {
|
|
82
82
|
// `.github` is globally ignored and is the only place these files live,
|
|
83
83
|
// so this caller has to un-ignore it or scan nothing.
|
|
84
|
-
const files = await (0,
|
|
84
|
+
const files = await (0, targets_js_1.listTrackedFiles)(ctx, globs, ['.'], {
|
|
85
85
|
keepDirs: ['.github', '.gitlab', '.circleci'],
|
|
86
86
|
});
|
|
87
87
|
if (files === null)
|
|
88
|
-
return (0,
|
|
89
|
-
await (0,
|
|
88
|
+
return (0, types_js_1.skip)('git unavailable');
|
|
89
|
+
await (0, findings_js_1.scanTrackedFiles)(ctx, files, scanInto);
|
|
90
90
|
}
|
|
91
|
-
return (0,
|
|
91
|
+
return (0, findings_js_1.reportSeverityBuckets)(found.errors, found.warnings, {
|
|
92
92
|
prefix: 'Workflow Security',
|
|
93
93
|
errorSummary: n => `${n} issue(s)`,
|
|
94
94
|
warningSummary: n => `${n} warning(s)`,
|
|
95
|
-
...(0,
|
|
95
|
+
...(0, findings_js_1.clientFindingOptions)(ctx, cfg),
|
|
96
96
|
});
|
|
97
97
|
}
|
|
98
98
|
catch (err) {
|
|
99
|
-
|
|
100
|
-
return (0,
|
|
99
|
+
index_js_1.logger.warn(`[Workflow Security]: ⚠️ Could not analyze diff\n${err}`);
|
|
100
|
+
return (0, types_js_1.skip)('diff unavailable');
|
|
101
101
|
}
|
|
102
102
|
},
|
|
103
103
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.notInstalled = notInstalled;
|
|
4
|
-
const
|
|
4
|
+
const types_js_1 = require("../types.js");
|
|
5
5
|
/**
|
|
6
6
|
* Where to get the external runners we deliberately do not ship.
|
|
7
7
|
*
|
|
@@ -65,5 +65,5 @@ const INSTALL_HINTS = {
|
|
|
65
65
|
function notInstalled(tool, label) {
|
|
66
66
|
const { command, url } = INSTALL_HINTS[tool];
|
|
67
67
|
const subject = label ? `${label} not installed` : 'not installed';
|
|
68
|
-
return (0,
|
|
68
|
+
return (0, types_js_1.skip)(command ? `${subject} — ${command} · ${url}` : `${subject} — ${url}`);
|
|
69
69
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CheckContext, RunOptions } from './types';
|
|
1
|
+
import type { CheckContext, RunOptions } from './types.js';
|
|
2
2
|
/**
|
|
3
3
|
* What a run should look at, before any git call is made. Separated from
|
|
4
4
|
* {@link resolveDiffRange} so the precedence rules are a pure function of the
|
|
@@ -6,10 +6,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.planDiffRange = planDiffRange;
|
|
7
7
|
exports.buildContext = buildContext;
|
|
8
8
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
9
|
+
const loader_js_1 = require("../config/loader.js");
|
|
10
|
+
const detect_language_js_1 = require("../utils/detect-language.js");
|
|
11
|
+
const execa_js_1 = require("../utils/execa.js");
|
|
12
|
+
const index_js_1 = require("../utils/index.js");
|
|
13
13
|
/**
|
|
14
14
|
* Decide what to look at. Order matters and is the contract:
|
|
15
15
|
*
|
|
@@ -52,7 +52,7 @@ function planDiffRange(opts, env = process.env) {
|
|
|
52
52
|
reason: 'PR build',
|
|
53
53
|
};
|
|
54
54
|
}
|
|
55
|
-
if ((0,
|
|
55
|
+
if ((0, index_js_1.isCiEnvironment)(env))
|
|
56
56
|
return { kind: 'ref', ref: 'HEAD^', reason: 'CI build, no PR context' };
|
|
57
57
|
return { kind: 'branch' };
|
|
58
58
|
}
|
|
@@ -83,8 +83,8 @@ async function resolveDiffRange(cwd, opts) {
|
|
|
83
83
|
// diffs baseSha..headSha sees exactly the staged changes — no per-check code.
|
|
84
84
|
if (plan.kind === 'staged') {
|
|
85
85
|
try {
|
|
86
|
-
const head = (await (0,
|
|
87
|
-
const tree = (await (0,
|
|
86
|
+
const head = (await (0, execa_js_1.execa)('git', ['rev-parse', 'HEAD'], { cwd })).stdout.trim();
|
|
87
|
+
const tree = (await (0, execa_js_1.execa)('git', ['write-tree'], { cwd })).stdout.trim();
|
|
88
88
|
return { baseSha: head, headSha: tree, scope: { kind: 'staged', degraded: false } };
|
|
89
89
|
}
|
|
90
90
|
catch {
|
|
@@ -100,7 +100,7 @@ async function resolveDiffRange(cwd, opts) {
|
|
|
100
100
|
}
|
|
101
101
|
let headSha;
|
|
102
102
|
try {
|
|
103
|
-
const { stdout } = await (0,
|
|
103
|
+
const { stdout } = await (0, execa_js_1.execa)('git', ['rev-parse', 'HEAD'], { cwd });
|
|
104
104
|
headSha = stdout.trim();
|
|
105
105
|
}
|
|
106
106
|
catch {
|
|
@@ -115,7 +115,7 @@ async function resolveDiffRange(cwd, opts) {
|
|
|
115
115
|
const eventBase = event?.pull_request?.base?.sha;
|
|
116
116
|
// Only use it if the commit is actually present in this clone; otherwise
|
|
117
117
|
// fall through so a shallow clone degrades to a full scan, not 0 files.
|
|
118
|
-
const baseSha = eventBase ? await (0,
|
|
118
|
+
const baseSha = eventBase ? await (0, index_js_1.resolveGitRef)(cwd, eventBase) : undefined;
|
|
119
119
|
if (baseSha) {
|
|
120
120
|
return { baseSha, headSha, scope: { kind: 'delta', reason: 'PR event', degraded: false } };
|
|
121
121
|
}
|
|
@@ -127,7 +127,7 @@ async function resolveDiffRange(cwd, opts) {
|
|
|
127
127
|
}
|
|
128
128
|
if (plan.kind === 'branch')
|
|
129
129
|
return resolveBranchRange(cwd, headSha);
|
|
130
|
-
const baseSha = await (0,
|
|
130
|
+
const baseSha = await (0, index_js_1.resolveGitRef)(cwd, plan.ref);
|
|
131
131
|
if (!baseSha)
|
|
132
132
|
return { headSha, scope: degraded(`${plan.ref} unresolvable`) };
|
|
133
133
|
return {
|
|
@@ -151,11 +151,11 @@ async function findMergeBase(cwd, headSha) {
|
|
|
151
151
|
for (const name of DEFAULT_BRANCHES)
|
|
152
152
|
candidates.push(`origin/${name}`, name);
|
|
153
153
|
for (const candidate of candidates) {
|
|
154
|
-
const ref = await (0,
|
|
154
|
+
const ref = await (0, index_js_1.resolveGitRef)(cwd, candidate);
|
|
155
155
|
// A candidate that resolves to HEAD is the branch we are on, not a base.
|
|
156
156
|
if (!ref || ref === headSha)
|
|
157
157
|
continue;
|
|
158
|
-
const { stdout } = await (0,
|
|
158
|
+
const { stdout } = await (0, execa_js_1.execa)('git', ['merge-base', headSha, ref], { cwd, reject: false });
|
|
159
159
|
const base = stdout.trim();
|
|
160
160
|
// An unrelated history has no merge base, and a base equal to HEAD means the
|
|
161
161
|
// branch is behind rather than ahead — neither describes local changes.
|
|
@@ -187,7 +187,7 @@ async function resolveBranchRange(cwd, headSha) {
|
|
|
187
187
|
*/
|
|
188
188
|
async function buildContext(opts = {}) {
|
|
189
189
|
const cwd = opts.cwd ?? process.cwd();
|
|
190
|
-
const config = opts.config ?? (0,
|
|
190
|
+
const config = opts.config ?? (0, loader_js_1.loadProjectConfig)();
|
|
191
191
|
// Detection reads the client's `ignoreDirs` from the config already loaded here,
|
|
192
192
|
// rather than calling getIgnoredDirs() — that one resolves against process.cwd(),
|
|
193
193
|
// which is not necessarily the `cwd` under review.
|
|
@@ -198,13 +198,13 @@ async function buildContext(opts = {}) {
|
|
|
198
198
|
// enough to download a toolchain — see `detectLanguageUsage`.
|
|
199
199
|
const usage = opts.languages
|
|
200
200
|
? opts.languages.map(lang => ({ lang, files: 1, marker: true }))
|
|
201
|
-
: await (0,
|
|
201
|
+
: await (0, detect_language_js_1.detectLanguageUsage)(cwd, config.ignoreDirs, config.detect);
|
|
202
202
|
const languages = usage.map(u => u.lang);
|
|
203
203
|
const { baseSha, headSha, scope } = await resolveDiffRange(cwd, opts);
|
|
204
204
|
// `scope` is logged because it decides what the whole run looks at, and getting
|
|
205
205
|
// it wrong is invisible in the results: a run that reviewed one commit and one
|
|
206
206
|
// that reviewed the repository both just print passes.
|
|
207
|
-
|
|
207
|
+
index_js_1.logger.info(`[buildContext]: cwd=${cwd} languages=[${languages.join(', ') || 'none'}] write=${opts.write ?? false} scope=${describeScope(scope)}`);
|
|
208
208
|
return {
|
|
209
209
|
cwd,
|
|
210
210
|
languages,
|
|
@@ -238,7 +238,7 @@ function applyLogConfig(config) {
|
|
|
238
238
|
const log = config.log ?? {};
|
|
239
239
|
const level = process.env.PR_CHECKMATE_LOG_LEVEL ?? log.level;
|
|
240
240
|
const format = process.env.PR_CHECKMATE_LOG_FORMAT ?? log.format;
|
|
241
|
-
|
|
241
|
+
index_js_1.logger.configure({
|
|
242
242
|
...(level ? { level } : {}),
|
|
243
243
|
...(format ? { format } : {}),
|
|
244
244
|
...(log.color ? { color: log.color } : {}),
|
|
@@ -15,10 +15,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.REGISTRY = exports.buildContext = exports.runChecks = void 0;
|
|
18
|
-
var
|
|
19
|
-
Object.defineProperty(exports, "runChecks", { enumerable: true, get: function () { return
|
|
20
|
-
var
|
|
21
|
-
Object.defineProperty(exports, "buildContext", { enumerable: true, get: function () { return
|
|
22
|
-
var
|
|
23
|
-
Object.defineProperty(exports, "REGISTRY", { enumerable: true, get: function () { return
|
|
24
|
-
__exportStar(require("./types"), exports);
|
|
18
|
+
var run_checks_js_1 = require("./run-checks.js");
|
|
19
|
+
Object.defineProperty(exports, "runChecks", { enumerable: true, get: function () { return run_checks_js_1.runChecks; } });
|
|
20
|
+
var context_js_1 = require("./context.js");
|
|
21
|
+
Object.defineProperty(exports, "buildContext", { enumerable: true, get: function () { return context_js_1.buildContext; } });
|
|
22
|
+
var registry_js_1 = require("./registry.js");
|
|
23
|
+
Object.defineProperty(exports, "REGISTRY", { enumerable: true, get: function () { return registry_js_1.REGISTRY; } });
|
|
24
|
+
__exportStar(require("./types.js"), exports);
|
|
@@ -11,7 +11,7 @@ exports.stalePaths = stalePaths;
|
|
|
11
11
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
12
12
|
const node_os_1 = __importDefault(require("node:os"));
|
|
13
13
|
const node_path_1 = __importDefault(require("node:path"));
|
|
14
|
-
const
|
|
14
|
+
const logger_js_1 = require("../../utils/logger.js");
|
|
15
15
|
/**
|
|
16
16
|
* Expand a leading `~`.
|
|
17
17
|
*
|
|
@@ -88,7 +88,7 @@ function resolveCacheDir(version, configured, env = process.env) {
|
|
|
88
88
|
const dir = node_path_1.default.join(candidate.dir, version);
|
|
89
89
|
if (writable(dir)) {
|
|
90
90
|
if (index > 0) {
|
|
91
|
-
|
|
91
|
+
logger_js_1.logger.warn(`[install]: ⚠️ cache directory "${candidates[0].dir}" is not writable — using ${candidate.reason} (${dir}). Fetched tooling will not survive a container rebuild.`);
|
|
92
92
|
}
|
|
93
93
|
return { dir, preferred: index === 0, reason: candidate.reason };
|
|
94
94
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { type LanguageUsage } from '../../utils/detect-language';
|
|
2
|
-
import { packageVersion } from '../../utils/package-version';
|
|
3
|
-
import { type EnsureResult } from './ensure';
|
|
4
|
-
import { type ProfileDecision } from './profiles';
|
|
1
|
+
import { type LanguageUsage } from '../../utils/detect-language.js';
|
|
2
|
+
import { packageVersion } from '../../utils/package-version.js';
|
|
3
|
+
import { type EnsureResult } from './ensure.js';
|
|
4
|
+
import { type ProfileDecision } from './profiles.js';
|
|
5
5
|
export { packageVersion };
|
|
6
6
|
/**
|
|
7
7
|
* Everything the install layer knows about this repository, in one shot.
|
|
@@ -9,15 +9,15 @@ exports.installProfiles = installProfiles;
|
|
|
9
9
|
exports.runDoctor = runDoctor;
|
|
10
10
|
exports.pruneCache = pruneCache;
|
|
11
11
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
Object.defineProperty(exports, "packageVersion", { enumerable: true, get: function () { return
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
const
|
|
12
|
+
const loader_js_1 = require("../../config/loader.js");
|
|
13
|
+
const detect_language_js_1 = require("../../utils/detect-language.js");
|
|
14
|
+
const logger_js_1 = require("../../utils/logger.js");
|
|
15
|
+
const package_version_js_1 = require("../../utils/package-version.js");
|
|
16
|
+
Object.defineProperty(exports, "packageVersion", { enumerable: true, get: function () { return package_version_js_1.packageVersion; } });
|
|
17
|
+
const cache_js_1 = require("./cache.js");
|
|
18
|
+
const ensure_js_1 = require("./ensure.js");
|
|
19
|
+
const prepare_js_1 = require("./prepare.js");
|
|
20
|
+
const profiles_js_1 = require("./profiles.js");
|
|
21
21
|
/**
|
|
22
22
|
* Everything the install layer knows about this repository, in one shot.
|
|
23
23
|
*
|
|
@@ -26,10 +26,10 @@ const profiles_1 = require("./profiles");
|
|
|
26
26
|
* log two contradictory-looking detection lines for one command.
|
|
27
27
|
*/
|
|
28
28
|
async function planInstall(cwd = process.cwd(), usage) {
|
|
29
|
-
const config = (0,
|
|
30
|
-
const detected = usage ?? (await (0,
|
|
31
|
-
const location = (0,
|
|
32
|
-
return { decisions: (0,
|
|
29
|
+
const config = (0, loader_js_1.loadProjectConfig)();
|
|
30
|
+
const detected = usage ?? (await (0, detect_language_js_1.detectLanguageUsage)(cwd, config.ignoreDirs, config.detect));
|
|
31
|
+
const location = (0, cache_js_1.resolveCacheDir)((0, package_version_js_1.packageVersion)(), config.install?.cacheDir);
|
|
32
|
+
return { decisions: (0, profiles_js_1.planProfiles)(detected, config), cacheDir: location?.dir ?? null };
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
35
35
|
* Which profiles are usable right now, and why — fetched, or shipped with us.
|
|
@@ -47,12 +47,12 @@ async function planInstall(cwd = process.cwd(), usage) {
|
|
|
47
47
|
*/
|
|
48
48
|
function installedProfiles(cacheDir) {
|
|
49
49
|
const present = new Map();
|
|
50
|
-
for (const profile of
|
|
51
|
-
if ((0,
|
|
50
|
+
for (const profile of profiles_js_1.PROFILES) {
|
|
51
|
+
if ((0, prepare_js_1.profileSatisfiedLocally)(profile))
|
|
52
52
|
present.set(profile.name, 'ships with the package');
|
|
53
53
|
}
|
|
54
54
|
if (cacheDir) {
|
|
55
|
-
for (const name of (0,
|
|
55
|
+
for (const name of (0, ensure_js_1.cachedProfiles)(cacheDir))
|
|
56
56
|
present.set(name, 'fetched');
|
|
57
57
|
}
|
|
58
58
|
return present;
|
|
@@ -66,32 +66,32 @@ function installedProfiles(cacheDir) {
|
|
|
66
66
|
* happens to contain.
|
|
67
67
|
*/
|
|
68
68
|
async function installProfiles(cwd = process.cwd(), all = false) {
|
|
69
|
-
const config = (0,
|
|
69
|
+
const config = (0, loader_js_1.loadProjectConfig)();
|
|
70
70
|
const install = config.install ?? {};
|
|
71
71
|
const { decisions } = await planInstall(cwd);
|
|
72
72
|
const denied = new Set(install.deny ?? []);
|
|
73
|
-
const wanted = (all ?
|
|
74
|
-
const profile =
|
|
73
|
+
const wanted = (all ? profiles_js_1.PROFILES.map(p => p.name) : decisions.filter(d => d.required).map(d => d.profile)).filter(name => {
|
|
74
|
+
const profile = profiles_js_1.PROFILES.find(p => p.name === name);
|
|
75
75
|
// Nothing to fetch for a profile whose packages already ship with us, and
|
|
76
76
|
// fetching it anyway is not merely wasted: `--all` downloaded a second copy
|
|
77
77
|
// of every bundled profile — some 800 packages — beside the ones already in
|
|
78
78
|
// `node_modules`. On a container build that lands in the image (ticket 083).
|
|
79
|
-
if (profile && (0,
|
|
80
|
-
|
|
79
|
+
if (profile && (0, prepare_js_1.profileSatisfiedLocally)(profile)) {
|
|
80
|
+
logger_js_1.logger.info(`[install]: profile "${name}" already ships with the package`);
|
|
81
81
|
return false;
|
|
82
82
|
}
|
|
83
83
|
const blocked = profile?.packages.filter(pkg => denied.has(pkg)) ?? [];
|
|
84
84
|
if (blocked.length === 0)
|
|
85
85
|
return true;
|
|
86
|
-
|
|
86
|
+
logger_js_1.logger.info(`[install]: profile "${name}" skipped — install.deny lists ${blocked.join(', ')}`);
|
|
87
87
|
return false;
|
|
88
88
|
});
|
|
89
89
|
// One install for the whole set. Profiles that share hundreds of packages used
|
|
90
90
|
// to be fetched into a tree each, which fought over npm's cache and downloaded
|
|
91
91
|
// the shared half once per profile (ticket 087).
|
|
92
|
-
const result = await (0,
|
|
92
|
+
const result = await (0, ensure_js_1.ensureTooling)(wanted, {
|
|
93
93
|
cwd,
|
|
94
|
-
version: (0,
|
|
94
|
+
version: (0, package_version_js_1.packageVersion)(),
|
|
95
95
|
install,
|
|
96
96
|
});
|
|
97
97
|
return [result];
|
|
@@ -104,14 +104,14 @@ async function installProfiles(cwd = process.cwd(), all = false) {
|
|
|
104
104
|
* reading of our source.
|
|
105
105
|
*/
|
|
106
106
|
async function runDoctor(cwd = process.cwd()) {
|
|
107
|
-
const config = (0,
|
|
108
|
-
const usage = await (0,
|
|
107
|
+
const config = (0, loader_js_1.loadProjectConfig)();
|
|
108
|
+
const usage = await (0, detect_language_js_1.detectLanguageUsage)(cwd, config.ignoreDirs, config.detect);
|
|
109
109
|
const { decisions, cacheDir } = await planInstall(cwd, usage);
|
|
110
110
|
const present = installedProfiles(cacheDir);
|
|
111
111
|
const lines = [];
|
|
112
112
|
lines.push('PR CheckMate — install doctor');
|
|
113
113
|
lines.push('');
|
|
114
|
-
lines.push(` version ${(0,
|
|
114
|
+
lines.push(` version ${(0, package_version_js_1.packageVersion)()}`);
|
|
115
115
|
lines.push(` repository ${cwd}`);
|
|
116
116
|
lines.push(` cache ${cacheDir ?? 'unavailable (no writable directory)'}`);
|
|
117
117
|
lines.push(` strategy ${config.install?.strategy ?? 'adaptive'}`);
|
|
@@ -142,30 +142,30 @@ async function runDoctor(cwd = process.cwd()) {
|
|
|
142
142
|
lines.push(` ${missing.length} profile(s) not installed yet. They are fetched on the next`);
|
|
143
143
|
lines.push(' run, or now with: npx pr-checkmate install');
|
|
144
144
|
}
|
|
145
|
-
const stale = (0,
|
|
145
|
+
const stale = (0, cache_js_1.stalePaths)((0, package_version_js_1.packageVersion)(), config.install?.cacheDir);
|
|
146
146
|
if (stale.length > 0) {
|
|
147
147
|
lines.push('');
|
|
148
148
|
lines.push(` ${stale.length} directory(ies) from other versions: npx pr-checkmate cache-prune`);
|
|
149
149
|
}
|
|
150
|
-
|
|
150
|
+
logger_js_1.logger.print(lines.join('\n'));
|
|
151
151
|
}
|
|
152
152
|
/** Remove cached tooling belonging to other versions of pr-checkmate. */
|
|
153
153
|
function pruneCache() {
|
|
154
|
-
const config = (0,
|
|
155
|
-
const stale = (0,
|
|
154
|
+
const config = (0, loader_js_1.loadProjectConfig)();
|
|
155
|
+
const stale = (0, cache_js_1.stalePaths)((0, package_version_js_1.packageVersion)(), config.install?.cacheDir);
|
|
156
156
|
if (stale.length === 0) {
|
|
157
|
-
|
|
157
|
+
logger_js_1.logger.print('Nothing to prune — no tooling from other versions is cached.');
|
|
158
158
|
return;
|
|
159
159
|
}
|
|
160
160
|
for (const dir of stale) {
|
|
161
161
|
try {
|
|
162
162
|
node_fs_1.default.rmSync(dir, { recursive: true, force: true });
|
|
163
|
-
|
|
163
|
+
logger_js_1.logger.print(`removed ${dir}`);
|
|
164
164
|
}
|
|
165
165
|
catch (err) {
|
|
166
166
|
// Another version may be running right now; refusing to delete its
|
|
167
167
|
// tooling is the correct outcome, not an error worth failing on.
|
|
168
|
-
|
|
168
|
+
logger_js_1.logger.warn(`[cache-prune]: could not remove ${dir}: ${err.message}`);
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
171
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { InstallConfig } from '../../interfaces';
|
|
2
|
-
import type { ProfileName } from './profiles';
|
|
1
|
+
import type { InstallConfig } from '../../interfaces/index.js';
|
|
2
|
+
import type { ProfileName } from './profiles.js';
|
|
3
3
|
/**
|
|
4
4
|
* What happened to the tooling cache, in the words the report and `doctor` use.
|
|
5
5
|
*
|
|
@@ -9,14 +9,15 @@ exports.ensureTooling = ensureTooling;
|
|
|
9
9
|
const node_crypto_1 = __importDefault(require("node:crypto"));
|
|
10
10
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
11
11
|
const node_path_1 = __importDefault(require("node:path"));
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
12
|
+
const execa_js_1 = require("../../utils/execa.js");
|
|
13
|
+
const logger_js_1 = require("../../utils/logger.js");
|
|
14
|
+
const own_deps_js_1 = require("../../utils/own-deps.js");
|
|
15
|
+
const cache_js_1 = require("./cache.js");
|
|
16
|
+
const lock_js_1 = require("./lock.js");
|
|
17
|
+
const merge_js_1 = require("./merge.js");
|
|
17
18
|
/** Where the shipped manifests live inside the installed package. */
|
|
18
19
|
function manifestDir(profile) {
|
|
19
|
-
return node_path_1.default.resolve(__dirname, '../../..', 'install-manifests', profile);
|
|
20
|
+
return node_path_1.default.join((0, own_deps_js_1.findOwnPackageRoot)() ?? node_path_1.default.resolve(__dirname, '../../..'), 'install-manifests', profile);
|
|
20
21
|
}
|
|
21
22
|
const stampPath = (dir) => node_path_1.default.join(dir, '.pr-checkmate-installed');
|
|
22
23
|
const MANIFEST = 'package.json';
|
|
@@ -33,7 +34,7 @@ function manifestFor(profiles) {
|
|
|
33
34
|
const dirs = profiles.map(name => ({ name, dir: manifestDir(name) }));
|
|
34
35
|
if (dirs.some(d => !node_fs_1.default.existsSync(node_path_1.default.join(d.dir, LOCKFILE))))
|
|
35
36
|
return null;
|
|
36
|
-
return (0,
|
|
37
|
+
return (0, merge_js_1.mergeManifests)(dirs);
|
|
37
38
|
}
|
|
38
39
|
/**
|
|
39
40
|
* A fingerprint of the manifest a tooling directory was installed from.
|
|
@@ -94,7 +95,7 @@ const normalise = (profiles) => [...new Set(profiles)].sort();
|
|
|
94
95
|
* readable from the directory layout.
|
|
95
96
|
*/
|
|
96
97
|
function cachedProfiles(cacheDir) {
|
|
97
|
-
const dir = (0,
|
|
98
|
+
const dir = (0, cache_js_1.toolingDir)(cacheDir);
|
|
98
99
|
if (!node_fs_1.default.existsSync(node_path_1.default.join(dir, 'node_modules')))
|
|
99
100
|
return [];
|
|
100
101
|
return readStamp(dir)?.profiles ?? [];
|
|
@@ -128,7 +129,7 @@ async function ensureTooling(wanted, opts) {
|
|
|
128
129
|
if (needed.length === 0) {
|
|
129
130
|
return { status: 'cached', reason: 'nothing to fetch', profiles: [] };
|
|
130
131
|
}
|
|
131
|
-
const location = (0,
|
|
132
|
+
const location = (0, cache_js_1.resolveCacheDir)(opts.version, install.cacheDir);
|
|
132
133
|
if (!location) {
|
|
133
134
|
return {
|
|
134
135
|
status: 'failed',
|
|
@@ -136,7 +137,7 @@ async function ensureTooling(wanted, opts) {
|
|
|
136
137
|
profiles: [],
|
|
137
138
|
};
|
|
138
139
|
}
|
|
139
|
-
const dir = (0,
|
|
140
|
+
const dir = (0, cache_js_1.toolingDir)(location.dir);
|
|
140
141
|
const stamp = readStamp(dir);
|
|
141
142
|
if (holdsAll(dir, stamp, needed)) {
|
|
142
143
|
return { status: 'cached', reason: 'already installed', dir, profiles: stamp?.profiles ?? [] };
|
|
@@ -203,7 +204,7 @@ async function ensureTooling(wanted, opts) {
|
|
|
203
204
|
profiles: [],
|
|
204
205
|
};
|
|
205
206
|
}
|
|
206
|
-
const release = await (0,
|
|
207
|
+
const release = await (0, lock_js_1.withLock)(dir, install.waitTimeoutMs ?? 120000);
|
|
207
208
|
if (!release) {
|
|
208
209
|
return { status: 'failed', reason: `cannot write to ${dir}`, dir, profiles: [] };
|
|
209
210
|
}
|
|
@@ -233,7 +234,7 @@ async function ensureTooling(wanted, opts) {
|
|
|
233
234
|
* `--ignore-scripts` is not negotiable in a supply-chain tool.
|
|
234
235
|
*/
|
|
235
236
|
async function npmCi(dir, opts) {
|
|
236
|
-
const result = await (0,
|
|
237
|
+
const result = await (0, execa_js_1.execa)('npm', ['ci', '--prefix', dir, '--ignore-scripts', '--no-audit', '--no-fund', '--loglevel', 'error'], { cwd: opts.cwd, reject: false, timeout: opts.install.installTimeoutMs ?? 300000 });
|
|
237
238
|
if (result.exitCode === 0)
|
|
238
239
|
return { ok: true };
|
|
239
240
|
const detail = (result.stderr || result.stdout || '').split('\n').slice(-3).join(' ').trim();
|
|
@@ -247,7 +248,7 @@ async function runInstall(profiles, manifest, dir, opts) {
|
|
|
247
248
|
const count = Object.keys(manifest.lockfile.packages).length - 1;
|
|
248
249
|
// Always logged, never behind --debug: this is a security tool downloading
|
|
249
250
|
// code at run time, and that must be visible in every CI log by default.
|
|
250
|
-
|
|
251
|
+
logger_js_1.logger.info(`[install]: 📦 fetching tooling for ${named} (${count} packages) → ${dir}`);
|
|
251
252
|
try {
|
|
252
253
|
const install = opts.installer ?? ((target) => npmCi(target, opts));
|
|
253
254
|
const result = await install(dir);
|
|
@@ -257,7 +258,7 @@ async function runInstall(profiles, manifest, dir, opts) {
|
|
|
257
258
|
const stamp = { hash: hashOf(manifest), profiles };
|
|
258
259
|
node_fs_1.default.writeFileSync(stampPath(dir), JSON.stringify(stamp));
|
|
259
260
|
const durationMs = Date.now() - started;
|
|
260
|
-
|
|
261
|
+
logger_js_1.logger.info(`[install]: ✅ tooling ready in ${(durationMs / 1000).toFixed(1)}s (${named})`);
|
|
261
262
|
return { status: 'installed', reason: `${count} packages`, dir, profiles, durationMs };
|
|
262
263
|
}
|
|
263
264
|
catch (err) {
|
|
@@ -7,7 +7,7 @@ exports.processAlive = processAlive;
|
|
|
7
7
|
exports.withLock = withLock;
|
|
8
8
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
9
9
|
const node_path_1 = __importDefault(require("node:path"));
|
|
10
|
-
const
|
|
10
|
+
const logger_js_1 = require("../../utils/logger.js");
|
|
11
11
|
const lockPath = (dir) => node_path_1.default.join(dir, '.pr-checkmate-install.lock');
|
|
12
12
|
function readLock(file) {
|
|
13
13
|
try {
|
|
@@ -63,7 +63,7 @@ async function withLock(dir, timeoutMs, deps = {}) {
|
|
|
63
63
|
// would otherwise block every later run forever. Breaking it needs to be
|
|
64
64
|
// loud: it is the one case where two installs could genuinely overlap.
|
|
65
65
|
if (held && !alive(held.pid)) {
|
|
66
|
-
|
|
66
|
+
logger_js_1.logger.warn(`[install]: ⚠️ removing a stale lock left by process ${held.pid}, which is no longer running.`);
|
|
67
67
|
try {
|
|
68
68
|
node_fs_1.default.unlinkSync(file);
|
|
69
69
|
}
|
|
@@ -79,7 +79,7 @@ async function withLock(dir, timeoutMs, deps = {}) {
|
|
|
79
79
|
continue;
|
|
80
80
|
}
|
|
81
81
|
if (now() >= deadline) {
|
|
82
|
-
|
|
82
|
+
logger_js_1.logger.warn(`[install]: ⚠️ waited ${Math.round(timeoutMs / 1000)}s for another process to finish installing — taking over.`);
|
|
83
83
|
try {
|
|
84
84
|
node_fs_1.default.unlinkSync(file);
|
|
85
85
|
}
|
|
@@ -91,7 +91,7 @@ async function withLock(dir, timeoutMs, deps = {}) {
|
|
|
91
91
|
}
|
|
92
92
|
if (!announced) {
|
|
93
93
|
const age = held ? Math.round((now() - held.startedAt) / 1000) : 0;
|
|
94
|
-
|
|
94
|
+
logger_js_1.logger.info(`[install]: ⏳ another process is installing into ${node_path_1.default.basename(dir)} (started ${age}s ago) — waiting up to ${Math.round(timeoutMs / 1000)}s`);
|
|
95
95
|
announced = true;
|
|
96
96
|
}
|
|
97
97
|
await sleep(500);
|