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
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.execa = execa;
|
|
37
|
+
/**
|
|
38
|
+
* Run a command via execa, loading the module lazily on first call.
|
|
39
|
+
*
|
|
40
|
+
* Drop-in replacement for `execa(file, args, options)` at every call site in
|
|
41
|
+
* this package — all of which await the result and read it synchronously.
|
|
42
|
+
*/
|
|
43
|
+
async function execa(file, args, options) {
|
|
44
|
+
const { execa: run } = await Promise.resolve().then(() => __importStar(require('execa')));
|
|
45
|
+
return (await run(file, args, options));
|
|
46
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.resolveGitRef = resolveGitRef;
|
|
4
|
-
const
|
|
4
|
+
const execa_js_1 = require("./execa.js");
|
|
5
5
|
/**
|
|
6
6
|
* Resolve a git ref to a concrete commit SHA, or `undefined` when this clone
|
|
7
7
|
* cannot resolve it.
|
|
@@ -16,7 +16,7 @@ const execa_1 = require("./execa");
|
|
|
16
16
|
* missing base means "review everything", never "review nothing".
|
|
17
17
|
*/
|
|
18
18
|
async function resolveGitRef(cwd, ref) {
|
|
19
|
-
const { stdout } = await (0,
|
|
19
|
+
const { stdout } = await (0, execa_js_1.execa)('git', ['rev-parse', '--verify', '--quiet', `${ref}^{commit}`], {
|
|
20
20
|
cwd,
|
|
21
21
|
reject: false,
|
|
22
22
|
});
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.request = request;
|
|
4
4
|
exports.paginate = paginate;
|
|
5
|
-
const
|
|
5
|
+
const logger_js_1 = require("./logger.js");
|
|
6
6
|
const DEFAULT_TIMEOUT_MS = 10000;
|
|
7
7
|
const DEFAULT_RETRIES = 3;
|
|
8
8
|
/** 5xx and 429 are worth another attempt; a 4xx will fail identically forever. */
|
|
@@ -60,7 +60,7 @@ async function request(url, init = {}, opts = {}) {
|
|
|
60
60
|
if (attempt < attempts) {
|
|
61
61
|
// Exponential backoff, capped so three attempts stay well inside a CI step.
|
|
62
62
|
const waitMs = Math.min(2000, 250 * 2 ** (attempt - 1));
|
|
63
|
-
|
|
63
|
+
logger_js_1.logger.warn(`${label}retrying after ${last.error} (attempt ${attempt}/${attempts})`);
|
|
64
64
|
await new Promise(resolve => setTimeout(resolve, waitMs));
|
|
65
65
|
}
|
|
66
66
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export * from './logger.js';
|
|
2
|
+
export * from './result-collector.js';
|
|
3
|
+
export * from './resolve-bin.js';
|
|
4
|
+
export * from './own-deps.js';
|
|
5
|
+
export * from './direct-deps.js';
|
|
6
|
+
export * from './detect-language.js';
|
|
7
|
+
export * from './glob.js';
|
|
8
|
+
export * from './update-notifier.js';
|
|
9
|
+
export * from './package-version.js';
|
|
10
|
+
export * from './ci.js';
|
|
11
|
+
export * from './git.js';
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
*/
|
|
15
|
+
export declare function cleanupTempFile(filePath: string): void;
|
|
@@ -19,18 +19,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
20
|
exports.cleanupTempFile = cleanupTempFile;
|
|
21
21
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
22
|
-
const
|
|
23
|
-
__exportStar(require("./logger"), exports);
|
|
24
|
-
__exportStar(require("./result-collector"), exports);
|
|
25
|
-
__exportStar(require("./resolve-bin"), exports);
|
|
26
|
-
__exportStar(require("./own-deps"), exports);
|
|
27
|
-
__exportStar(require("./direct-deps"), exports);
|
|
28
|
-
__exportStar(require("./detect-language"), exports);
|
|
29
|
-
__exportStar(require("./glob"), exports);
|
|
30
|
-
__exportStar(require("./update-notifier"), exports);
|
|
31
|
-
__exportStar(require("./package-version"), exports);
|
|
32
|
-
__exportStar(require("./ci"), exports);
|
|
33
|
-
__exportStar(require("./git"), exports);
|
|
22
|
+
const logger_js_1 = require("./logger.js");
|
|
23
|
+
__exportStar(require("./logger.js"), exports);
|
|
24
|
+
__exportStar(require("./result-collector.js"), exports);
|
|
25
|
+
__exportStar(require("./resolve-bin.js"), exports);
|
|
26
|
+
__exportStar(require("./own-deps.js"), exports);
|
|
27
|
+
__exportStar(require("./direct-deps.js"), exports);
|
|
28
|
+
__exportStar(require("./detect-language.js"), exports);
|
|
29
|
+
__exportStar(require("./glob.js"), exports);
|
|
30
|
+
__exportStar(require("./update-notifier.js"), exports);
|
|
31
|
+
__exportStar(require("./package-version.js"), exports);
|
|
32
|
+
__exportStar(require("./ci.js"), exports);
|
|
33
|
+
__exportStar(require("./git.js"), exports);
|
|
34
34
|
/**
|
|
35
35
|
*
|
|
36
36
|
*/
|
|
@@ -41,6 +41,6 @@ function cleanupTempFile(filePath) {
|
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
catch (err) {
|
|
44
|
-
|
|
44
|
+
logger_js_1.logger.warn(`[cleanupTempFile]: ⚠️ Failed cleanup: ${filePath}\n${err}`);
|
|
45
45
|
}
|
|
46
46
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/** Walk up from this module until we find pr-checkmate's own package root. */
|
|
2
|
+
export declare function findOwnPackageRoot(): string | null;
|
|
1
3
|
/**
|
|
2
4
|
* Compute the full set of package names in pr-checkmate's own dependency
|
|
3
5
|
* closure (direct + transitive runtime dependencies), plus pr-checkmate itself.
|
|
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.findOwnPackageRoot = findOwnPackageRoot;
|
|
6
7
|
exports.getOwnDependencyClosure = getOwnDependencyClosure;
|
|
7
8
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
8
9
|
const node_path_1 = __importDefault(require("node:path"));
|
|
@@ -7,6 +7,7 @@ exports.packageVersion = packageVersion;
|
|
|
7
7
|
exports.packageName = packageName;
|
|
8
8
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
9
9
|
const node_path_1 = __importDefault(require("node:path"));
|
|
10
|
+
const own_deps_js_1 = require("./own-deps.js");
|
|
10
11
|
/**
|
|
11
12
|
* Our own name and version, read from the manifest that ships inside the package.
|
|
12
13
|
*
|
|
@@ -23,7 +24,7 @@ const node_path_1 = __importDefault(require("node:path"));
|
|
|
23
24
|
*/
|
|
24
25
|
function readManifest() {
|
|
25
26
|
try {
|
|
26
|
-
const manifest = node_path_1.default.resolve(__dirname, '
|
|
27
|
+
const manifest = node_path_1.default.join((0, own_deps_js_1.findOwnPackageRoot)() ?? node_path_1.default.resolve(__dirname, '../../..'), 'package.json');
|
|
27
28
|
const parsed = JSON.parse(node_fs_1.default.readFileSync(manifest, 'utf-8'));
|
|
28
29
|
return { name: parsed.name ?? 'pr-checkmate', version: parsed.version ?? '0.0.0' };
|
|
29
30
|
}
|
|
@@ -11,6 +11,7 @@ exports.resolveTool = resolveTool;
|
|
|
11
11
|
exports.resolvePackageBin = resolvePackageBin;
|
|
12
12
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
13
13
|
const node_path_1 = __importDefault(require("node:path"));
|
|
14
|
+
const own_deps_js_1 = require("./own-deps.js");
|
|
14
15
|
/**
|
|
15
16
|
* Extra roots to search, registered once per run by the install layer.
|
|
16
17
|
*
|
|
@@ -38,7 +39,7 @@ function clearToolPaths() {
|
|
|
38
39
|
}
|
|
39
40
|
/** The root of the installed pr-checkmate package — where our own tooling lives. */
|
|
40
41
|
function ownPackageRoot() {
|
|
41
|
-
return node_path_1.default.resolve(__dirname, '
|
|
42
|
+
return (0, own_deps_js_1.findOwnPackageRoot)() ?? node_path_1.default.resolve(__dirname, '../../..');
|
|
42
43
|
}
|
|
43
44
|
/**
|
|
44
45
|
* Whether a package is physically present in our own dependency tree.
|
|
@@ -5,8 +5,8 @@ exports.getUpdateNotice = getUpdateNotice;
|
|
|
5
5
|
// Imported from the module rather than the `../config` barrel on purpose:
|
|
6
6
|
// `config/index.ts` imports `../utils`, so going through the barrel would make
|
|
7
7
|
// utils ⇄ config circular. `constants.ts` itself pulls in nothing from utils.
|
|
8
|
-
const
|
|
9
|
-
const
|
|
8
|
+
const constants_js_1 = require("../config/constants.js");
|
|
9
|
+
const package_version_js_1 = require("./package-version.js");
|
|
10
10
|
// Same widths as the run summary in `reporters.ts`, so the two boxes line up
|
|
11
11
|
// when both are printed at the end of a run.
|
|
12
12
|
const NOTICE_BORDER = '═'.repeat(63);
|
|
@@ -71,7 +71,7 @@ async function getUpdateNotice(timeoutMs = 2500) {
|
|
|
71
71
|
// The *running* copy's identity, not the project's declared dependency. A
|
|
72
72
|
// stale global install shadows the local one on `PATH`, and it is the stale
|
|
73
73
|
// copy that must own the notice it prints.
|
|
74
|
-
const pkg = { name: (0,
|
|
74
|
+
const pkg = { name: (0, package_version_js_1.packageName)(), version: (0, package_version_js_1.packageVersion)() };
|
|
75
75
|
const controller = new AbortController();
|
|
76
76
|
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
77
77
|
let latest;
|
|
@@ -98,7 +98,7 @@ async function getUpdateNotice(timeoutMs = 2500) {
|
|
|
98
98
|
' own — your pr-checkmate.json holds only what you changed, and nothing',
|
|
99
99
|
' in it needs topping up.',
|
|
100
100
|
NOTICE_RULE,
|
|
101
|
-
` 📚 Docs: ${
|
|
101
|
+
` 📚 Docs: ${constants_js_1.DOCS_URL}`,
|
|
102
102
|
` 📦 Release: https://www.npmjs.com/package/${pkg.name}`,
|
|
103
103
|
NOTICE_BORDER,
|
|
104
104
|
];
|
package/dist/esm/cli.js
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { COMMAND_TO_CHECK, FLAGS, STANDALONE_COMMANDS, TOOLING_COMMANDS } from './core/commands.js';
|
|
3
|
+
import { runChecks } from './core/index.js';
|
|
4
|
+
import { installProfiles, pruneCache, runDoctor } from './core/install/doctor.js';
|
|
5
|
+
import { init } from './init.js';
|
|
6
|
+
import { logger, getUpdateNotice } from './utils/index.js';
|
|
7
|
+
const argv = process.argv.slice(2);
|
|
8
|
+
/**
|
|
9
|
+
* Flags are separated from positional arguments so they compose with every command
|
|
10
|
+
* — scope is orthogonal to which checks run, hence `pr-checkmate lint --full` as
|
|
11
|
+
* well as `pr-checkmate all --full`.
|
|
12
|
+
*/
|
|
13
|
+
const flags = argv.filter(arg => arg.startsWith('-'));
|
|
14
|
+
const args = argv.filter(arg => !arg.startsWith('-'));
|
|
15
|
+
const cmd = args[0];
|
|
16
|
+
/**
|
|
17
|
+
* An unrecognised flag aborts the run. Ignoring it would report success for a scope
|
|
18
|
+
* the user did not ask for: a misspelling of `--full` must not quietly review the
|
|
19
|
+
* diff and print a green summary.
|
|
20
|
+
*/
|
|
21
|
+
function rejectUnknownFlags() {
|
|
22
|
+
const unknown = flags.filter(flag => !FLAGS[flag]);
|
|
23
|
+
if (unknown.length === 0)
|
|
24
|
+
return;
|
|
25
|
+
const known = Object.entries(FLAGS)
|
|
26
|
+
.map(([flag, help]) => `${flag} (${help})`)
|
|
27
|
+
.join(', ');
|
|
28
|
+
logger.error(`[cli]: Unknown flag(s) "${unknown.join('", "')}". Available: ${known}`);
|
|
29
|
+
process.exit(1);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* `--full` and `precommit` ask for different things — every tracked file versus the
|
|
33
|
+
* staged changes only. `planDiffRange` resolves the conflict in favour of `--full`,
|
|
34
|
+
* which would silently turn a pre-commit hook into a whole-repo scan, so the
|
|
35
|
+
* contradiction is refused here instead.
|
|
36
|
+
*/
|
|
37
|
+
function rejectConflictingScope() {
|
|
38
|
+
if (cmd === 'precommit' && flags.includes('--full')) {
|
|
39
|
+
logger.error('[cli]: "precommit --full" is contradictory — precommit reviews the staged changes. Run "pr-checkmate all --full" for a whole-repo review.');
|
|
40
|
+
process.exit(1);
|
|
41
|
+
}
|
|
42
|
+
if (cmd === 'init' && flags.length > 0) {
|
|
43
|
+
logger.error(`[cli]: "init" takes no flags, got: ${flags.join(', ')}.`);
|
|
44
|
+
process.exit(1);
|
|
45
|
+
}
|
|
46
|
+
// `--all` belongs to `install` alone. Accepting it elsewhere would look like a
|
|
47
|
+
// scope flag and quietly do nothing, which is the failure mode
|
|
48
|
+
// `rejectUnknownFlags` exists to prevent.
|
|
49
|
+
if (flags.includes('--all') && cmd !== 'install') {
|
|
50
|
+
logger.error('[cli]: "--all" applies only to "install". Did you mean "--full"?');
|
|
51
|
+
process.exit(1);
|
|
52
|
+
}
|
|
53
|
+
if (flags.includes('--full') && TOOLING_COMMANDS.includes(cmd ?? '')) {
|
|
54
|
+
logger.error(`[cli]: "${cmd}" manages tooling and reviews nothing, so "--full" has no meaning.`);
|
|
55
|
+
process.exit(1);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
const full = flags.includes('--full');
|
|
59
|
+
/**
|
|
60
|
+
* Reject extra arguments after a standalone command. Silently ignoring them would
|
|
61
|
+
* report success for work that never ran — `pr-checkmate init lint` must not look
|
|
62
|
+
* like it linted anything.
|
|
63
|
+
*
|
|
64
|
+
* Driven by {@link STANDALONE_COMMANDS} so the list stays the single source of truth:
|
|
65
|
+
* a per-branch guard would leave the next standalone command unguarded the day it is
|
|
66
|
+
* added to the list but not to the branch.
|
|
67
|
+
*/
|
|
68
|
+
function rejectExtraArgs() {
|
|
69
|
+
if (!cmd || !STANDALONE_COMMANDS.includes(cmd) || args.length <= 1)
|
|
70
|
+
return;
|
|
71
|
+
logger.error(`[cli]: "${cmd}" takes no other arguments, got: ${args.slice(1).join(', ')}. Run them as a separate command.`);
|
|
72
|
+
process.exit(1);
|
|
73
|
+
}
|
|
74
|
+
void (async () => {
|
|
75
|
+
try {
|
|
76
|
+
rejectUnknownFlags();
|
|
77
|
+
rejectConflictingScope();
|
|
78
|
+
rejectExtraArgs();
|
|
79
|
+
if (cmd === 'init') {
|
|
80
|
+
await init();
|
|
81
|
+
process.exit(0);
|
|
82
|
+
}
|
|
83
|
+
// Tooling management. These run no checks — they prepare, inspect or clean
|
|
84
|
+
// up what the checks need, so they never touch the diff or the reporter.
|
|
85
|
+
if (cmd === 'install') {
|
|
86
|
+
const results = await installProfiles(process.cwd(), flags.includes('--all'));
|
|
87
|
+
const failed = results.filter(r => r.status === 'failed');
|
|
88
|
+
for (const result of failed) {
|
|
89
|
+
logger.error(`[install]: ❌ ${result.profiles.join(', ') || 'tooling'}: ${result.reason}`);
|
|
90
|
+
}
|
|
91
|
+
process.exit(failed.length > 0 ? 1 : 0);
|
|
92
|
+
}
|
|
93
|
+
if (cmd === 'doctor') {
|
|
94
|
+
await runDoctor();
|
|
95
|
+
process.exit(0);
|
|
96
|
+
}
|
|
97
|
+
if (cmd === 'cache-prune') {
|
|
98
|
+
pruneCache();
|
|
99
|
+
process.exit(0);
|
|
100
|
+
}
|
|
101
|
+
// Full run: auto-detect the CI platform (GitHub/GitLab/Bitbucket), post the
|
|
102
|
+
// summary to its PR/MR, and allow formatters to write.
|
|
103
|
+
if (!cmd || cmd === 'all') {
|
|
104
|
+
// Fetch the update notice concurrently (best-effort, never blocks/affects
|
|
105
|
+
// the exit code), but print it LAST — after the summary — so it's noticeable.
|
|
106
|
+
const noticePromise = getUpdateNotice();
|
|
107
|
+
const report = await runChecks({ reporter: 'auto', write: true, full });
|
|
108
|
+
const notice = await noticePromise.catch(() => null);
|
|
109
|
+
if (notice) {
|
|
110
|
+
logger.info('');
|
|
111
|
+
notice.forEach(line => logger.info(line));
|
|
112
|
+
}
|
|
113
|
+
process.exit(report.ok ? 0 : 1);
|
|
114
|
+
}
|
|
115
|
+
// Local pre-commit: check the staged changes (index vs HEAD), print to
|
|
116
|
+
// stdout, never modify files. Exits non-zero on failure to block the commit.
|
|
117
|
+
if (cmd === 'precommit') {
|
|
118
|
+
const report = await runChecks({ staged: true, reporter: 'stdout', write: false });
|
|
119
|
+
process.exit(report.ok ? 0 : 1);
|
|
120
|
+
}
|
|
121
|
+
// Every remaining argument is a check name, so `pr-checkmate lint spellcheck`
|
|
122
|
+
// runs both in one pass. Unknown names abort the whole run — a typo must never
|
|
123
|
+
// shrink the requested check set silently.
|
|
124
|
+
const unknown = args.filter(arg => !COMMAND_TO_CHECK[arg]);
|
|
125
|
+
if (unknown.length > 0) {
|
|
126
|
+
logger.error(`[cli]: Unknown command(s) "${unknown.join('", "')}". Available: ${STANDALONE_COMMANDS.join(', ')}, ${Object.keys(COMMAND_TO_CHECK).join(', ')}`);
|
|
127
|
+
process.exit(1);
|
|
128
|
+
}
|
|
129
|
+
const checkNames = [...new Set(args.map(arg => COMMAND_TO_CHECK[arg]))];
|
|
130
|
+
const report = await runChecks({ only: checkNames, reporter: 'stdout', write: true, full });
|
|
131
|
+
process.exit(report.ok ? 0 : 1);
|
|
132
|
+
}
|
|
133
|
+
catch (err) {
|
|
134
|
+
logger.error(`❌ CLI failed: ${err}`);
|
|
135
|
+
process.exit(1);
|
|
136
|
+
}
|
|
137
|
+
})();
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Build output, dependency, tooling, and report directories that are never
|
|
3
|
+
* product code. Every check excludes them by directory-name segment match (see
|
|
4
|
+
* `targets.ts`): a match on any segment of a path drops the file. Untracked
|
|
5
|
+
* build dirs are already excluded because checks read git-tracked files only —
|
|
6
|
+
* this list additionally covers dirs that repos commonly *commit* (`.github`,
|
|
7
|
+
* `.vscode`, `.idea`, `.claude`) and any checked-in build artifacts.
|
|
8
|
+
*
|
|
9
|
+
* Covers the common ecosystems: Node/JS/web, Python, Java/Kotlin/Gradle/Android,
|
|
10
|
+
* Swift/iOS/Xcode, and C/C++/CMake. Add more here.
|
|
11
|
+
*/
|
|
12
|
+
export declare const IGNORED_DIRS: string[];
|
|
13
|
+
/**
|
|
14
|
+
* Glob form of the ignore list, for tools that take glob ignores directly
|
|
15
|
+
* (ESLint `--ignore-pattern`, cspell `--exclude`, the generated
|
|
16
|
+
* `.prettierignore`). Combines {@link IGNORED_DIRS} with a few tool-specific
|
|
17
|
+
* nested report globs that are not plain directory names.
|
|
18
|
+
*/
|
|
19
|
+
export declare const IGNORE_PATTERNS: string[];
|
|
20
|
+
/**
|
|
21
|
+
* Where test code lives, as globs.
|
|
22
|
+
*
|
|
23
|
+
* Deliberately NOT part of {@link IGNORED_DIRS}: that list hides a directory from
|
|
24
|
+
* every check, and test code still wants linting, type-checking and formatting.
|
|
25
|
+
* What test code does not want is the handful of checks whose findings are noise
|
|
26
|
+
* on it — duplication (setup boilerplate repeats by design), unused exports (the
|
|
27
|
+
* runner consumes them), spelling (fixture identifiers) and the diff security
|
|
28
|
+
* scan (a test's whole job may be to call the dangerous thing). Each of those
|
|
29
|
+
* defaults to this list, and each lets a client replace it.
|
|
30
|
+
*/
|
|
31
|
+
export declare const TEST_PATH_GLOBS: string[];
|
|
32
|
+
/**
|
|
33
|
+
* Test files/folders excluded from duplicate-code detection by default.
|
|
34
|
+
* Test suites legitimately repeat setup/arrange/assert boilerplate, so counting
|
|
35
|
+
* them as clones is noise that drowns out real production duplication. Clients can
|
|
36
|
+
* override this list via `duplicate.ignore` in pr-checkmate.json.
|
|
37
|
+
*/
|
|
38
|
+
export declare const DUPLICATE_IGNORE_DEFAULTS: string[];
|
|
39
|
+
/**
|
|
40
|
+
* Paths the diff security scan skips by default.
|
|
41
|
+
*
|
|
42
|
+
* A security test corpus is built out of the exact constructs the scan hunts for
|
|
43
|
+
* — `eval()`, `document.write()`, `__proto__` — so scanning it turns every added
|
|
44
|
+
* test case into a finding, and under `severity: error` into a blocked merge.
|
|
45
|
+
* Clients can override via `diffSecurity.ignorePaths` (which REPLACES this list).
|
|
46
|
+
*/
|
|
47
|
+
export declare const DIFF_SECURITY_IGNORE_DEFAULTS: string[];
|
|
48
|
+
/**
|
|
49
|
+
* Files written by a release tool rather than by a person.
|
|
50
|
+
*
|
|
51
|
+
* `CHANGELOG.md` is assembled from commit subjects, so every typo anyone has ever
|
|
52
|
+
* committed reappears in it — 39 of 42 spellcheck findings in one real repository
|
|
53
|
+
* came from that one file, none of them actionable: the text cannot be corrected
|
|
54
|
+
* without rewriting git history, and the next release regenerates it anyway.
|
|
55
|
+
*
|
|
56
|
+
* Matched at ANY depth, not just at the repository root. The root-only form was
|
|
57
|
+
* the original, and it left every nested changelog unhandled: a component-config
|
|
58
|
+
* repository with one per component produced 157 of 157 spelling findings and 240
|
|
59
|
+
* of 246 markdown findings from files nobody writes by hand. A generated file is
|
|
60
|
+
* generated wherever it sits.
|
|
61
|
+
*/
|
|
62
|
+
export declare const GENERATED_DOC_FILES: string[];
|
|
63
|
+
/**
|
|
64
|
+
* Files excluded from the dead-code (unused-exports) report by default. These are
|
|
65
|
+
* REGEX sources (matched against each reported file path), not globs — dead-code's
|
|
66
|
+
* `ignoreFiles` is regex-based. Test and mock files legitimately export helpers and
|
|
67
|
+
* mocks consumed only by the test runner (jest.mock, dynamic imports), which
|
|
68
|
+
* ts-unused-exports cannot see as usage, so flagging them is noise. Clients can
|
|
69
|
+
* override via `deadCode.ignoreFiles` in pr-checkmate.json (setting it replaces
|
|
70
|
+
* this list).
|
|
71
|
+
*/
|
|
72
|
+
export declare const DEAD_CODE_IGNORE_DEFAULTS: string[];
|
|
73
|
+
export declare const CONFIG_FILE_PATTERNS: string[];
|
|
74
|
+
/**
|
|
75
|
+
* jscpd formats the duplicate-CODE check scans. Restricting to code formats keeps
|
|
76
|
+
* config/CI YAML and JSON out of the report — they are data, not code, and their
|
|
77
|
+
* repetition is not meaningful duplication. This mirrors the code-only file set the
|
|
78
|
+
* check already uses when scanning a git diff, so full-tree and diff scans agree.
|
|
79
|
+
*
|
|
80
|
+
* One entry per language pr-checkmate detects, all of them verified against the
|
|
81
|
+
* jscpd binary rather than assumed: the list used to stop at C++ while the check
|
|
82
|
+
* only ever handed jscpd `.ts`/`.js` files, so the Go, Rust, C#, Ruby and PHP
|
|
83
|
+
* halves were unreachable and the Python one was decoration. Copy-paste is a
|
|
84
|
+
* language-independent smell, and the tokenizer behind this check has always been
|
|
85
|
+
* able to see it — the file list was the only thing in the way.
|
|
86
|
+
*/
|
|
87
|
+
export declare const DUPLICATE_CODE_FORMATS: string[];
|
|
88
|
+
/**
|
|
89
|
+
* File extensions to check
|
|
90
|
+
*/
|
|
91
|
+
export declare const SOURCE_EXTENSIONS: {
|
|
92
|
+
typescript: string[];
|
|
93
|
+
javascript: string[];
|
|
94
|
+
markdown: string[];
|
|
95
|
+
json: string[];
|
|
96
|
+
all: string[];
|
|
97
|
+
};
|
|
98
|
+
export declare const DEFAULT_COMMANDS: {
|
|
99
|
+
'npx pr-checkmate init': string;
|
|
100
|
+
'npx pr-checkmate all': string;
|
|
101
|
+
'npx pr-checkmate all --full': string;
|
|
102
|
+
'npx pr-checkmate lint': string;
|
|
103
|
+
'npx pr-checkmate prettier': string;
|
|
104
|
+
'npx pr-checkmate deps': string;
|
|
105
|
+
'npx pr-checkmate npm-audit': string;
|
|
106
|
+
'npx pr-checkmate security': string;
|
|
107
|
+
'npx pr-checkmate spellcheck': string;
|
|
108
|
+
'npx pr-checkmate typecheck': string;
|
|
109
|
+
'npx pr-checkmate diff-smell': string;
|
|
110
|
+
'npx pr-checkmate pr-body': string;
|
|
111
|
+
'npx pr-checkmate duplicate': string;
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* Packages allow-listed for the license check by default.
|
|
115
|
+
*
|
|
116
|
+
* These are the optional cspell language dictionaries. Some ship under copyleft
|
|
117
|
+
* licenses (GPL/LGPL), and a client who installs one to spellcheck their own
|
|
118
|
+
* language should not have that turn into a licence finding: the dictionary is
|
|
119
|
+
* data for our check, not code they ship.
|
|
120
|
+
*/
|
|
121
|
+
export declare const DEFAULT_ALLOW_PACKAGES: string[];
|
|
122
|
+
/**
|
|
123
|
+
* Canonical entry point to the PR CheckMate docs. Single source of truth: it is
|
|
124
|
+
* written into every generated `pr-checkmate.json` (via {@link documentation})
|
|
125
|
+
* and printed in the "new version available" notice, so the two can never drift.
|
|
126
|
+
*/
|
|
127
|
+
export declare const DOCS_URL = "https://github.com/Mybono/pr_checkmate_public/tree/main/documentation";
|
|
128
|
+
/**
|
|
129
|
+
* The fully annotated configuration, with every option at its default value.
|
|
130
|
+
*
|
|
131
|
+
* A URL rather than a file inside the package on purpose: half the audience runs
|
|
132
|
+
* pr-checkmate through `npx` on a pipeline and has no `node_modules` at all, so
|
|
133
|
+
* a path into the installed package is a dead end for them. The release workflow
|
|
134
|
+
* publishes `src/config/pr-checkmate.template.json` to the public mirror under
|
|
135
|
+
* this name, which keeps one copy for everyone.
|
|
136
|
+
*/
|
|
137
|
+
export declare const FULL_CONFIG_URL = "https://github.com/Mybono/pr_checkmate_public/blob/main/pr-checkmate.json";
|
|
138
|
+
export declare const documentation: {
|
|
139
|
+
pr_checkmate: string;
|
|
140
|
+
eslint: string;
|
|
141
|
+
typescriptEslint: string;
|
|
142
|
+
prettier: string;
|
|
143
|
+
cspell: string;
|
|
144
|
+
};
|
|
145
|
+
/**
|
|
146
|
+
* Every top-level key PR CheckMate recognises in pr-checkmate.json — the union
|
|
147
|
+
* of the `PRCheckMateConfig` interface fields and the keys the `init` generator
|
|
148
|
+
* writes (which use `eslint`/`cspell`/`markdownlint` rather than the interface's
|
|
149
|
+
* `lint`/`spellcheck`). The Config Validation check warns on any key not in this
|
|
150
|
+
* set (typos), ignoring `//`-prefixed comment keys and `$schema`. Keep in sync
|
|
151
|
+
* when adding a new configurable check.
|
|
152
|
+
*/
|
|
153
|
+
export declare const KNOWN_CONFIG_KEYS: Set<string>;
|