pr-checkmate 3.0.3 → 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.
Files changed (380) hide show
  1. package/dist/{cli.js → cjs/cli.js} +30 -30
  2. package/dist/{config → cjs/config}/index.d.ts +2 -2
  3. package/dist/{config → cjs/config}/index.js +8 -7
  4. package/dist/{config → cjs/config}/loader.d.ts +1 -1
  5. package/dist/{config → cjs/config}/loader.js +8 -8
  6. package/dist/{core → cjs/core}/checks/dependencies/banned-imports.d.ts +1 -1
  7. package/dist/{core → cjs/core}/checks/dependencies/banned-imports.js +10 -10
  8. package/dist/{core → cjs/core}/checks/dependencies/circular-deps.d.ts +1 -1
  9. package/dist/{core → cjs/core}/checks/dependencies/circular-deps.js +27 -27
  10. package/dist/{core → cjs/core}/checks/dependencies/dependency-check.d.ts +1 -1
  11. package/dist/{core → cjs/core}/checks/dependencies/dependency-check.js +17 -17
  12. package/dist/{core → cjs/core}/checks/dependencies/grype-scan.d.ts +1 -1
  13. package/dist/{core → cjs/core}/checks/dependencies/grype-scan.js +18 -18
  14. package/dist/{core → cjs/core}/checks/dependencies/license-check.d.ts +1 -1
  15. package/dist/{core → cjs/core}/checks/dependencies/license-check.js +12 -12
  16. package/dist/{core → cjs/core}/checks/dependencies/npm-audit.d.ts +1 -1
  17. package/dist/{core → cjs/core}/checks/dependencies/npm-audit.js +14 -14
  18. package/dist/{core → cjs/core}/checks/dependencies/outdated-deps.d.ts +1 -1
  19. package/dist/{core → cjs/core}/checks/dependencies/outdated-deps.js +14 -14
  20. package/dist/{core → cjs/core}/checks/dependencies/vuln-scan.d.ts +1 -1
  21. package/dist/{core → cjs/core}/checks/dependencies/vuln-scan.js +14 -14
  22. package/dist/{core → cjs/core}/checks/findings.d.ts +1 -1
  23. package/dist/{core → cjs/core}/checks/findings.js +16 -16
  24. package/dist/{core → cjs/core}/checks/git/custom-rules.d.ts +1 -1
  25. package/dist/{core → cjs/core}/checks/git/custom-rules.js +19 -19
  26. package/dist/{core → cjs/core}/checks/git/diff-smell.d.ts +2 -2
  27. package/dist/{core → cjs/core}/checks/git/diff-smell.js +13 -13
  28. package/dist/{core → cjs/core}/checks/git/large-files.d.ts +1 -1
  29. package/dist/{core → cjs/core}/checks/git/large-files.js +15 -15
  30. package/dist/{core → cjs/core}/checks/git/leftover-debug.d.ts +1 -1
  31. package/dist/{core → cjs/core}/checks/git/leftover-debug.js +13 -13
  32. package/dist/{core → cjs/core}/checks/git/lockfile-drift.d.ts +1 -1
  33. package/dist/{core → cjs/core}/checks/git/lockfile-drift.js +12 -12
  34. package/dist/{core → cjs/core}/checks/git/merge-conflict.d.ts +1 -1
  35. package/dist/{core → cjs/core}/checks/git/merge-conflict.js +15 -15
  36. package/dist/{core → cjs/core}/checks/git/missing-tests.d.ts +1 -1
  37. package/dist/{core → cjs/core}/checks/git/missing-tests.js +15 -15
  38. package/dist/{core → cjs/core}/checks/git/todo-fixme.d.ts +1 -1
  39. package/dist/{core → cjs/core}/checks/git/todo-fixme.js +11 -11
  40. package/dist/{core → cjs/core}/checks/languages/cpp-format.d.ts +1 -1
  41. package/dist/{core → cjs/core}/checks/languages/cpp-format.js +18 -18
  42. package/dist/{core → cjs/core}/checks/languages/external-checks.d.ts +9 -9
  43. package/dist/{core → cjs/core}/checks/languages/external-checks.js +10 -10
  44. package/dist/{core → cjs/core}/checks/languages/external-runner.d.ts +2 -2
  45. package/dist/{core → cjs/core}/checks/languages/external-runner.js +21 -21
  46. package/dist/{core → cjs/core}/checks/languages/go-format.d.ts +1 -1
  47. package/dist/cjs/core/checks/languages/go-format.js +202 -0
  48. package/dist/cjs/core/checks/languages/lint.d.ts +2 -0
  49. package/dist/{core → cjs/core}/checks/languages/lint.js +21 -21
  50. package/dist/{core → cjs/core}/checks/languages/prettier.d.ts +1 -1
  51. package/dist/{core → cjs/core}/checks/languages/prettier.js +18 -18
  52. package/dist/{core → cjs/core}/checks/languages/python-format.d.ts +1 -1
  53. package/dist/{core → cjs/core}/checks/languages/python-format.js +14 -14
  54. package/dist/{core → cjs/core}/checks/languages/python-lint.d.ts +1 -1
  55. package/dist/{core → cjs/core}/checks/languages/python-lint.js +13 -13
  56. package/dist/{core → cjs/core}/checks/languages/python-typecheck.d.ts +1 -1
  57. package/dist/{core → cjs/core}/checks/languages/python-typecheck.js +29 -29
  58. package/dist/{core → cjs/core}/checks/languages/typecheck.d.ts +1 -1
  59. package/dist/{core → cjs/core}/checks/languages/typecheck.js +13 -13
  60. package/dist/{core → cjs/core}/checks/pr/commitlint.d.ts +1 -1
  61. package/dist/{core → cjs/core}/checks/pr/commitlint.js +12 -12
  62. package/dist/{core → cjs/core}/checks/pr/pr-body.d.ts +1 -1
  63. package/dist/{core → cjs/core}/checks/pr/pr-body.js +8 -8
  64. package/dist/{core → cjs/core}/checks/pr/pr-size-check.d.ts +1 -1
  65. package/dist/{core → cjs/core}/checks/pr/pr-size-check.js +10 -10
  66. package/dist/{core → cjs/core}/checks/pr/pr-title-lint.d.ts +1 -1
  67. package/dist/{core → cjs/core}/checks/pr/pr-title-lint.js +8 -8
  68. package/dist/{core → cjs/core}/checks/quality/case-collision.d.ts +1 -1
  69. package/dist/{core → cjs/core}/checks/quality/case-collision.js +7 -7
  70. package/dist/{core → cjs/core}/checks/quality/config-validation.d.ts +1 -1
  71. package/dist/{core → cjs/core}/checks/quality/config-validation.js +9 -9
  72. package/dist/{core → cjs/core}/checks/quality/coverage.d.ts +1 -1
  73. package/dist/{core → cjs/core}/checks/quality/coverage.js +4 -4
  74. package/dist/{core → cjs/core}/checks/quality/dead-code.d.ts +1 -1
  75. package/dist/{core → cjs/core}/checks/quality/dead-code.js +23 -23
  76. package/dist/{core → cjs/core}/checks/quality/duplicate-check.d.ts +1 -1
  77. package/dist/{core → cjs/core}/checks/quality/duplicate-check.js +22 -22
  78. package/dist/{core → cjs/core}/checks/quality/license-header.d.ts +1 -1
  79. package/dist/{core → cjs/core}/checks/quality/license-header.js +16 -16
  80. package/dist/{core → cjs/core}/checks/quality/markdown-lint.d.ts +1 -1
  81. package/dist/{core → cjs/core}/checks/quality/markdown-lint.js +17 -17
  82. package/dist/{core → cjs/core}/checks/quality/package-size.d.ts +1 -1
  83. package/dist/{core → cjs/core}/checks/quality/package-size.js +12 -12
  84. package/dist/{core → cjs/core}/checks/quality/spellcheck.d.ts +2 -2
  85. package/dist/{core → cjs/core}/checks/quality/spellcheck.js +18 -18
  86. package/dist/{core → cjs/core}/checks/quality/symlinks.d.ts +1 -1
  87. package/dist/{core → cjs/core}/checks/quality/symlinks.js +8 -8
  88. package/dist/{core → cjs/core}/checks/quality/yaml-lint.d.ts +1 -1
  89. package/dist/{core → cjs/core}/checks/quality/yaml-lint.js +12 -12
  90. package/dist/{core → cjs/core}/checks/security/diff-security.d.ts +1 -1
  91. package/dist/{core → cjs/core}/checks/security/diff-security.js +15 -15
  92. package/dist/{core → cjs/core}/checks/security/dockerfile-security.d.ts +1 -1
  93. package/dist/{core → cjs/core}/checks/security/dockerfile-security.js +16 -16
  94. package/dist/{core → cjs/core}/checks/security/migration-safety.d.ts +1 -1
  95. package/dist/{core → cjs/core}/checks/security/migration-safety.js +17 -17
  96. package/dist/{core → cjs/core}/checks/security/security.d.ts +1 -1
  97. package/dist/{core → cjs/core}/checks/security/security.js +21 -21
  98. package/dist/{core → cjs/core}/checks/security/sensitive-file-guard.d.ts +1 -1
  99. package/dist/{core → cjs/core}/checks/security/sensitive-file-guard.js +14 -14
  100. package/dist/{core → cjs/core}/checks/security/workflow-security.d.ts +2 -2
  101. package/dist/{core → cjs/core}/checks/security/workflow-security.js +14 -14
  102. package/dist/{core → cjs/core}/checks/tool-install.d.ts +1 -1
  103. package/dist/{core → cjs/core}/checks/tool-install.js +2 -2
  104. package/dist/{core → cjs/core}/context.d.ts +1 -1
  105. package/dist/{core → cjs/core}/context.js +16 -16
  106. package/dist/cjs/core/index.d.ts +4 -0
  107. package/dist/{core → cjs/core}/index.js +7 -7
  108. package/dist/{core → cjs/core}/install/cache.js +2 -2
  109. package/dist/{core → cjs/core}/install/doctor.d.ts +4 -4
  110. package/dist/{core → cjs/core}/install/doctor.js +34 -34
  111. package/dist/{core → cjs/core}/install/ensure.d.ts +2 -2
  112. package/dist/{core → cjs/core}/install/ensure.js +15 -14
  113. package/dist/{core → cjs/core}/install/lock.js +4 -4
  114. package/dist/{core → cjs/core}/install/prepare.d.ts +4 -4
  115. package/dist/{core → cjs/core}/install/prepare.js +13 -13
  116. package/dist/{core → cjs/core}/install/profiles.d.ts +2 -2
  117. package/dist/{core → cjs/core}/install/reuse.d.ts +1 -1
  118. package/dist/{core → cjs/core}/install/reuse.js +4 -4
  119. package/dist/{core → cjs/core}/registry.d.ts +1 -1
  120. package/dist/cjs/core/registry.js +112 -0
  121. package/dist/{core → cjs/core}/reporters.d.ts +1 -1
  122. package/dist/{core → cjs/core}/reporters.js +28 -28
  123. package/dist/{core → cjs/core}/run-checks.d.ts +2 -2
  124. package/dist/{core → cjs/core}/run-checks.js +31 -31
  125. package/dist/{core → cjs/core}/targets.d.ts +1 -1
  126. package/dist/{core → cjs/core}/targets.js +20 -20
  127. package/dist/{core → cjs/core}/types.d.ts +3 -3
  128. package/dist/cjs/index.d.ts +12 -0
  129. package/dist/{index.js → cjs/index.js} +18 -18
  130. package/dist/{init.js → cjs/init.js} +68 -56
  131. package/dist/{interfaces → cjs/interfaces}/index.d.ts +3 -3
  132. package/dist/cjs/package.json +1 -0
  133. package/dist/{scripts → cjs/scripts}/copy-configs.js +22 -7
  134. package/dist/{scripts → cjs/scripts}/generate-install-manifests.js +2 -2
  135. package/dist/{scripts → cjs/scripts}/publish-github.js +4 -4
  136. package/dist/{utils → cjs/utils}/detect-language.js +12 -12
  137. package/dist/cjs/utils/execa.js +46 -0
  138. package/dist/{utils → cjs/utils}/git.js +2 -2
  139. package/dist/{utils → cjs/utils}/http.js +2 -2
  140. package/dist/cjs/utils/index.d.ts +15 -0
  141. package/dist/{utils → cjs/utils}/index.js +13 -13
  142. package/dist/{utils → cjs/utils}/own-deps.d.ts +2 -0
  143. package/dist/{utils → cjs/utils}/own-deps.js +1 -0
  144. package/dist/{utils → cjs/utils}/package-version.js +2 -1
  145. package/dist/{utils → cjs/utils}/resolve-bin.js +2 -1
  146. package/dist/{utils → cjs/utils}/update-notifier.js +4 -4
  147. package/dist/esm/cli.d.ts +2 -0
  148. package/dist/esm/cli.js +137 -0
  149. package/dist/esm/config/constants.d.ts +153 -0
  150. package/dist/esm/config/constants.js +360 -0
  151. package/dist/esm/config/index.d.ts +40 -0
  152. package/dist/esm/config/index.js +60 -0
  153. package/dist/esm/config/loader.d.ts +6 -0
  154. package/dist/esm/config/loader.js +191 -0
  155. package/dist/esm/config/pr-checkmate-workflow-docker.yml +79 -0
  156. package/dist/esm/config/pr-checkmate-workflow.yml +92 -0
  157. package/dist/esm/core/checks/dependencies/banned-imports.d.ts +2 -0
  158. package/dist/esm/core/checks/dependencies/banned-imports.js +70 -0
  159. package/dist/esm/core/checks/dependencies/circular-deps.d.ts +2 -0
  160. package/dist/esm/core/checks/dependencies/circular-deps.js +155 -0
  161. package/dist/esm/core/checks/dependencies/dependency-check.d.ts +43 -0
  162. package/dist/esm/core/checks/dependencies/dependency-check.js +174 -0
  163. package/dist/esm/core/checks/dependencies/grype-scan.d.ts +22 -0
  164. package/dist/esm/core/checks/dependencies/grype-scan.js +112 -0
  165. package/dist/esm/core/checks/dependencies/license-check.d.ts +2 -0
  166. package/dist/esm/core/checks/dependencies/license-check.js +61 -0
  167. package/dist/esm/core/checks/dependencies/npm-audit.d.ts +6 -0
  168. package/dist/esm/core/checks/dependencies/npm-audit.js +80 -0
  169. package/dist/esm/core/checks/dependencies/outdated-deps.d.ts +2 -0
  170. package/dist/esm/core/checks/dependencies/outdated-deps.js +66 -0
  171. package/dist/esm/core/checks/dependencies/vuln-scan.d.ts +2 -0
  172. package/dist/esm/core/checks/dependencies/vuln-scan.js +54 -0
  173. package/dist/esm/core/checks/findings.d.ts +299 -0
  174. package/dist/esm/core/checks/findings.js +701 -0
  175. package/dist/esm/core/checks/git/custom-rules.d.ts +2 -0
  176. package/dist/esm/core/checks/git/custom-rules.js +106 -0
  177. package/dist/esm/core/checks/git/diff-smell.d.ts +19 -0
  178. package/dist/esm/core/checks/git/diff-smell.js +69 -0
  179. package/dist/esm/core/checks/git/large-files.d.ts +2 -0
  180. package/dist/esm/core/checks/git/large-files.js +112 -0
  181. package/dist/esm/core/checks/git/leftover-debug.d.ts +2 -0
  182. package/dist/esm/core/checks/git/leftover-debug.js +89 -0
  183. package/dist/esm/core/checks/git/lockfile-drift.d.ts +2 -0
  184. package/dist/esm/core/checks/git/lockfile-drift.js +114 -0
  185. package/dist/esm/core/checks/git/merge-conflict.d.ts +2 -0
  186. package/dist/esm/core/checks/git/merge-conflict.js +117 -0
  187. package/dist/esm/core/checks/git/missing-tests.d.ts +2 -0
  188. package/dist/esm/core/checks/git/missing-tests.js +105 -0
  189. package/dist/esm/core/checks/git/todo-fixme.d.ts +7 -0
  190. package/dist/esm/core/checks/git/todo-fixme.js +80 -0
  191. package/dist/esm/core/checks/languages/cpp-format.d.ts +7 -0
  192. package/dist/esm/core/checks/languages/cpp-format.js +91 -0
  193. package/dist/esm/core/checks/languages/external-checks.d.ts +77 -0
  194. package/dist/esm/core/checks/languages/external-checks.js +197 -0
  195. package/dist/esm/core/checks/languages/external-runner.d.ts +119 -0
  196. package/dist/esm/core/checks/languages/external-runner.js +138 -0
  197. package/dist/esm/core/checks/languages/go-format.d.ts +8 -0
  198. package/dist/{core → esm/core}/checks/languages/go-format.js +29 -35
  199. package/dist/esm/core/checks/languages/lint.d.ts +2 -0
  200. package/dist/esm/core/checks/languages/lint.js +92 -0
  201. package/dist/esm/core/checks/languages/prettier.d.ts +2 -0
  202. package/dist/esm/core/checks/languages/prettier.js +85 -0
  203. package/dist/esm/core/checks/languages/python-format.d.ts +7 -0
  204. package/dist/esm/core/checks/languages/python-format.js +61 -0
  205. package/dist/esm/core/checks/languages/python-lint.d.ts +9 -0
  206. package/dist/esm/core/checks/languages/python-lint.js +55 -0
  207. package/dist/esm/core/checks/languages/python-typecheck.d.ts +14 -0
  208. package/dist/esm/core/checks/languages/python-typecheck.js +184 -0
  209. package/dist/esm/core/checks/languages/ruff-shared.d.ts +10 -0
  210. package/dist/esm/core/checks/languages/ruff-shared.js +35 -0
  211. package/dist/esm/core/checks/languages/typecheck.d.ts +2 -0
  212. package/dist/esm/core/checks/languages/typecheck.js +61 -0
  213. package/dist/esm/core/checks/pr/commitlint.d.ts +2 -0
  214. package/dist/esm/core/checks/pr/commitlint.js +102 -0
  215. package/dist/esm/core/checks/pr/pr-body.d.ts +2 -0
  216. package/dist/esm/core/checks/pr/pr-body.js +43 -0
  217. package/dist/esm/core/checks/pr/pr-size-check.d.ts +2 -0
  218. package/dist/esm/core/checks/pr/pr-size-check.js +42 -0
  219. package/dist/esm/core/checks/pr/pr-title-lint.d.ts +2 -0
  220. package/dist/esm/core/checks/pr/pr-title-lint.js +31 -0
  221. package/dist/esm/core/checks/quality/case-collision.d.ts +8 -0
  222. package/dist/esm/core/checks/quality/case-collision.js +39 -0
  223. package/dist/esm/core/checks/quality/config-validation.d.ts +11 -0
  224. package/dist/esm/core/checks/quality/config-validation.js +188 -0
  225. package/dist/esm/core/checks/quality/coverage.d.ts +2 -0
  226. package/dist/esm/core/checks/quality/coverage.js +62 -0
  227. package/dist/esm/core/checks/quality/dead-code.d.ts +2 -0
  228. package/dist/esm/core/checks/quality/dead-code.js +124 -0
  229. package/dist/esm/core/checks/quality/duplicate-check.d.ts +2 -0
  230. package/dist/esm/core/checks/quality/duplicate-check.js +141 -0
  231. package/dist/esm/core/checks/quality/license-header.d.ts +7 -0
  232. package/dist/esm/core/checks/quality/license-header.js +81 -0
  233. package/dist/esm/core/checks/quality/markdown-lint.d.ts +2 -0
  234. package/dist/esm/core/checks/quality/markdown-lint.js +104 -0
  235. package/dist/esm/core/checks/quality/package-size.d.ts +36 -0
  236. package/dist/esm/core/checks/quality/package-size.js +196 -0
  237. package/dist/esm/core/checks/quality/spellcheck.d.ts +77 -0
  238. package/dist/esm/core/checks/quality/spellcheck.js +296 -0
  239. package/dist/esm/core/checks/quality/symlinks.d.ts +16 -0
  240. package/dist/esm/core/checks/quality/symlinks.js +57 -0
  241. package/dist/esm/core/checks/quality/yaml-lint.d.ts +20 -0
  242. package/dist/esm/core/checks/quality/yaml-lint.js +116 -0
  243. package/dist/esm/core/checks/security/diff-security.d.ts +2 -0
  244. package/dist/esm/core/checks/security/diff-security.js +354 -0
  245. package/dist/esm/core/checks/security/dockerfile-security.d.ts +2 -0
  246. package/dist/esm/core/checks/security/dockerfile-security.js +98 -0
  247. package/dist/esm/core/checks/security/migration-safety.d.ts +2 -0
  248. package/dist/esm/core/checks/security/migration-safety.js +137 -0
  249. package/dist/esm/core/checks/security/security.d.ts +63 -0
  250. package/dist/esm/core/checks/security/security.js +201 -0
  251. package/dist/esm/core/checks/security/sensitive-file-guard.d.ts +2 -0
  252. package/dist/esm/core/checks/security/sensitive-file-guard.js +160 -0
  253. package/dist/esm/core/checks/security/workflow-security.d.ts +12 -0
  254. package/dist/esm/core/checks/security/workflow-security.js +100 -0
  255. package/dist/esm/core/checks/tool-install.d.ts +102 -0
  256. package/dist/esm/core/checks/tool-install.js +66 -0
  257. package/dist/esm/core/commands.d.ts +27 -0
  258. package/dist/esm/core/commands.js +89 -0
  259. package/dist/esm/core/context.d.ts +62 -0
  260. package/dist/esm/core/context.js +241 -0
  261. package/dist/esm/core/index.d.ts +4 -0
  262. package/dist/esm/core/index.js +4 -0
  263. package/dist/esm/core/install/cache.d.ts +58 -0
  264. package/dist/esm/core/install/cache.js +142 -0
  265. package/dist/esm/core/install/doctor.d.ts +35 -0
  266. package/dist/esm/core/install/doctor.js +164 -0
  267. package/dist/esm/core/install/ensure.d.ts +77 -0
  268. package/dist/esm/core/install/ensure.js +269 -0
  269. package/dist/esm/core/install/lock.d.ts +34 -0
  270. package/dist/esm/core/install/lock.js +92 -0
  271. package/dist/esm/core/install/merge.d.ts +47 -0
  272. package/dist/esm/core/install/merge.js +85 -0
  273. package/dist/esm/core/install/prepare.d.ts +76 -0
  274. package/dist/esm/core/install/prepare.js +142 -0
  275. package/dist/esm/core/install/profiles.d.ts +78 -0
  276. package/dist/esm/core/install/profiles.js +192 -0
  277. package/dist/esm/core/install/reuse.d.ts +41 -0
  278. package/dist/esm/core/install/reuse.js +100 -0
  279. package/dist/esm/core/registry.d.ts +6 -0
  280. package/dist/esm/core/registry.js +109 -0
  281. package/dist/esm/core/reporters.d.ts +18 -0
  282. package/dist/esm/core/reporters.js +266 -0
  283. package/dist/esm/core/run-checks.d.ts +33 -0
  284. package/dist/esm/core/run-checks.js +293 -0
  285. package/dist/esm/core/targets.d.ts +140 -0
  286. package/dist/esm/core/targets.js +213 -0
  287. package/dist/esm/core/types.d.ts +195 -0
  288. package/dist/esm/core/types.js +38 -0
  289. package/dist/esm/index.d.ts +12 -0
  290. package/dist/esm/index.js +15 -0
  291. package/dist/esm/init.d.ts +38 -0
  292. package/dist/esm/init.js +421 -0
  293. package/dist/esm/interfaces/index.d.ts +432 -0
  294. package/dist/esm/interfaces/index.js +2 -0
  295. package/dist/esm/package.json +1 -0
  296. package/dist/esm/scripts/copy-configs.d.ts +1 -0
  297. package/dist/esm/scripts/copy-configs.js +64 -0
  298. package/dist/esm/scripts/generate-install-manifests.d.ts +39 -0
  299. package/dist/esm/scripts/generate-install-manifests.js +115 -0
  300. package/dist/esm/scripts/publish-github.d.ts +1 -0
  301. package/dist/esm/scripts/publish-github.js +45 -0
  302. package/dist/esm/utils/ci.d.ts +11 -0
  303. package/dist/esm/utils/ci.js +40 -0
  304. package/dist/esm/utils/detect-language.d.ts +48 -0
  305. package/dist/esm/utils/detect-language.js +234 -0
  306. package/dist/esm/utils/direct-deps.d.ts +21 -0
  307. package/dist/esm/utils/direct-deps.js +220 -0
  308. package/dist/esm/utils/execa.d.ts +22 -0
  309. package/dist/{utils → esm/utils}/execa.js +1 -4
  310. package/dist/esm/utils/git.d.ts +14 -0
  311. package/dist/esm/utils/git.js +21 -0
  312. package/dist/esm/utils/glob.d.ts +24 -0
  313. package/dist/esm/utils/glob.js +40 -0
  314. package/dist/esm/utils/http.d.ts +59 -0
  315. package/dist/esm/utils/http.js +115 -0
  316. package/dist/esm/utils/index.d.ts +15 -0
  317. package/dist/esm/utils/index.js +26 -0
  318. package/dist/esm/utils/logger.d.ts +65 -0
  319. package/dist/esm/utils/logger.js +157 -0
  320. package/dist/esm/utils/own-deps.d.ts +16 -0
  321. package/dist/esm/utils/own-deps.js +107 -0
  322. package/dist/esm/utils/package-version.d.ts +4 -0
  323. package/dist/esm/utils/package-version.js +38 -0
  324. package/dist/esm/utils/pool.d.ts +49 -0
  325. package/dist/esm/utils/pool.js +113 -0
  326. package/dist/esm/utils/resolve-bin.d.ts +67 -0
  327. package/dist/esm/utils/resolve-bin.js +156 -0
  328. package/dist/esm/utils/result-collector.d.ts +33 -0
  329. package/dist/esm/utils/result-collector.js +44 -0
  330. package/dist/esm/utils/update-notifier.d.ts +19 -0
  331. package/dist/esm/utils/update-notifier.js +108 -0
  332. package/install-manifests/core/package-lock.json +4 -4
  333. package/install-manifests/core/package.json +1 -1
  334. package/install-manifests/cpp/package-lock.json +4 -4
  335. package/install-manifests/cpp/package.json +1 -1
  336. package/package.json +16 -14
  337. package/dist/core/checks/languages/lint.d.ts +0 -2
  338. package/dist/core/index.d.ts +0 -4
  339. package/dist/core/registry.js +0 -112
  340. package/dist/index.d.ts +0 -12
  341. package/dist/utils/index.d.ts +0 -15
  342. /package/dist/{cli.d.ts → cjs/cli.d.ts} +0 -0
  343. /package/dist/{config → cjs/config}/constants.d.ts +0 -0
  344. /package/dist/{config → cjs/config}/constants.js +0 -0
  345. /package/dist/{config → cjs/config}/pr-checkmate-workflow-docker.yml +0 -0
  346. /package/dist/{config → cjs/config}/pr-checkmate-workflow.yml +0 -0
  347. /package/dist/{core → cjs/core}/checks/languages/ruff-shared.d.ts +0 -0
  348. /package/dist/{core → cjs/core}/checks/languages/ruff-shared.js +0 -0
  349. /package/dist/{core → cjs/core}/commands.d.ts +0 -0
  350. /package/dist/{core → cjs/core}/commands.js +0 -0
  351. /package/dist/{core → cjs/core}/install/cache.d.ts +0 -0
  352. /package/dist/{core → cjs/core}/install/lock.d.ts +0 -0
  353. /package/dist/{core → cjs/core}/install/merge.d.ts +0 -0
  354. /package/dist/{core → cjs/core}/install/merge.js +0 -0
  355. /package/dist/{core → cjs/core}/install/profiles.js +0 -0
  356. /package/dist/{core → cjs/core}/types.js +0 -0
  357. /package/dist/{init.d.ts → cjs/init.d.ts} +0 -0
  358. /package/dist/{interfaces → cjs/interfaces}/index.js +0 -0
  359. /package/dist/{scripts → cjs/scripts}/copy-configs.d.ts +0 -0
  360. /package/dist/{scripts → cjs/scripts}/generate-install-manifests.d.ts +0 -0
  361. /package/dist/{scripts → cjs/scripts}/publish-github.d.ts +0 -0
  362. /package/dist/{utils → cjs/utils}/ci.d.ts +0 -0
  363. /package/dist/{utils → cjs/utils}/ci.js +0 -0
  364. /package/dist/{utils → cjs/utils}/detect-language.d.ts +0 -0
  365. /package/dist/{utils → cjs/utils}/direct-deps.d.ts +0 -0
  366. /package/dist/{utils → cjs/utils}/direct-deps.js +0 -0
  367. /package/dist/{utils → cjs/utils}/execa.d.ts +0 -0
  368. /package/dist/{utils → cjs/utils}/git.d.ts +0 -0
  369. /package/dist/{utils → cjs/utils}/glob.d.ts +0 -0
  370. /package/dist/{utils → cjs/utils}/glob.js +0 -0
  371. /package/dist/{utils → cjs/utils}/http.d.ts +0 -0
  372. /package/dist/{utils → cjs/utils}/logger.d.ts +0 -0
  373. /package/dist/{utils → cjs/utils}/logger.js +0 -0
  374. /package/dist/{utils → cjs/utils}/package-version.d.ts +0 -0
  375. /package/dist/{utils → cjs/utils}/pool.d.ts +0 -0
  376. /package/dist/{utils → cjs/utils}/pool.js +0 -0
  377. /package/dist/{utils → cjs/utils}/resolve-bin.d.ts +0 -0
  378. /package/dist/{utils → cjs/utils}/result-collector.d.ts +0 -0
  379. /package/dist/{utils → cjs/utils}/result-collector.js +0 -0
  380. /package/dist/{utils → cjs/utils}/update-notifier.d.ts +0 -0
@@ -0,0 +1,360 @@
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 const IGNORED_DIRS = [
13
+ // VCS, editors, and CI/tooling config
14
+ '.git',
15
+ '.github',
16
+ '.gitlab',
17
+ '.vscode',
18
+ '.vs',
19
+ '.idea',
20
+ '.claude',
21
+ '.cursor',
22
+ '.husky',
23
+ '.circleci',
24
+ // Node / JS / web — build output & caches
25
+ 'node_modules',
26
+ 'dist',
27
+ 'build',
28
+ 'build-release',
29
+ 'out',
30
+ 'coverage',
31
+ '.next',
32
+ '.nuxt',
33
+ '.svelte-kit',
34
+ '.turbo',
35
+ '.cache',
36
+ '.parcel-cache',
37
+ '.vercel',
38
+ '.wrangler',
39
+ '.serverless',
40
+ '.terraform',
41
+ // Python
42
+ '__pycache__',
43
+ '.pytest_cache',
44
+ '.mypy_cache',
45
+ '.ruff_cache',
46
+ '.tox',
47
+ '.venv',
48
+ 'venv',
49
+ '.eggs',
50
+ 'htmlcov',
51
+ // Java / Kotlin / Gradle / Android
52
+ '.gradle',
53
+ '.kotlin',
54
+ 'target',
55
+ 'gen',
56
+ 'captures',
57
+ // Swift / iOS / Xcode
58
+ '.build',
59
+ '.swiftpm',
60
+ 'DerivedData',
61
+ 'Pods',
62
+ 'Carthage',
63
+ // C / C++ / CMake
64
+ 'CMakeFiles',
65
+ 'cmake-build-debug',
66
+ 'cmake-build-release',
67
+ '_deps',
68
+ // Test reports / results / logs / release artifacts
69
+ 'reports',
70
+ 'report',
71
+ 'test-reports',
72
+ 'test-report',
73
+ 'test-output',
74
+ 'test-results',
75
+ 'results',
76
+ 'result',
77
+ 'logs',
78
+ 'allure-report',
79
+ 'allure-results',
80
+ 'playwright-report',
81
+ '.wdio',
82
+ // Generated knowledge-graph output. Committed by repos that keep the graph in
83
+ // version control, and machine-written from end to end: a multi-megabyte
84
+ // `graph.json` trips the large-file check, and `GRAPH_REPORT.md` carries every
85
+ // identifier in the codebase past the spellchecker. Neither is anyone's source.
86
+ 'graphify-out',
87
+ ];
88
+ /**
89
+ * Glob form of the ignore list, for tools that take glob ignores directly
90
+ * (ESLint `--ignore-pattern`, cspell `--exclude`, the generated
91
+ * `.prettierignore`). Combines {@link IGNORED_DIRS} with a few tool-specific
92
+ * nested report globs that are not plain directory names.
93
+ */
94
+ export const IGNORE_PATTERNS = [
95
+ ...IGNORED_DIRS.map(dir => `**/${dir}/**`),
96
+ // Tool-specific nested report dirs / files (not bare directory names)
97
+ '**/jest-html-reporters-*/**',
98
+ '**/jest-stare/**',
99
+ '**/cypress/reports/**',
100
+ '**/cypress/videos/**',
101
+ '**/cypress/screenshots/**',
102
+ '**/mochawesome-report/**',
103
+ '**/mochawesome-reports/**',
104
+ '**/target/surefire-reports/**',
105
+ '**/target/failsafe-reports/**',
106
+ '**/wdio-logs/**',
107
+ '**/lint-report/**',
108
+ '**/audit-report/**',
109
+ ];
110
+ /**
111
+ * Where test code lives, as globs.
112
+ *
113
+ * Deliberately NOT part of {@link IGNORED_DIRS}: that list hides a directory from
114
+ * every check, and test code still wants linting, type-checking and formatting.
115
+ * What test code does not want is the handful of checks whose findings are noise
116
+ * on it — duplication (setup boilerplate repeats by design), unused exports (the
117
+ * runner consumes them), spelling (fixture identifiers) and the diff security
118
+ * scan (a test's whole job may be to call the dangerous thing). Each of those
119
+ * defaults to this list, and each lets a client replace it.
120
+ */
121
+ export const TEST_PATH_GLOBS = [
122
+ '**/__tests__/**',
123
+ '**/__mocks__/**',
124
+ '**/*.test.*',
125
+ '**/*.spec.*',
126
+ '**/test/**',
127
+ '**/tests/**',
128
+ ];
129
+ /**
130
+ * Test files/folders excluded from duplicate-code detection by default.
131
+ * Test suites legitimately repeat setup/arrange/assert boilerplate, so counting
132
+ * them as clones is noise that drowns out real production duplication. Clients can
133
+ * override this list via `duplicate.ignore` in pr-checkmate.json.
134
+ */
135
+ export const DUPLICATE_IGNORE_DEFAULTS = [...TEST_PATH_GLOBS];
136
+ /**
137
+ * Paths the diff security scan skips by default.
138
+ *
139
+ * A security test corpus is built out of the exact constructs the scan hunts for
140
+ * — `eval()`, `document.write()`, `__proto__` — so scanning it turns every added
141
+ * test case into a finding, and under `severity: error` into a blocked merge.
142
+ * Clients can override via `diffSecurity.ignorePaths` (which REPLACES this list).
143
+ */
144
+ export const DIFF_SECURITY_IGNORE_DEFAULTS = [...TEST_PATH_GLOBS];
145
+ /**
146
+ * Files written by a release tool rather than by a person.
147
+ *
148
+ * `CHANGELOG.md` is assembled from commit subjects, so every typo anyone has ever
149
+ * committed reappears in it — 39 of 42 spellcheck findings in one real repository
150
+ * came from that one file, none of them actionable: the text cannot be corrected
151
+ * without rewriting git history, and the next release regenerates it anyway.
152
+ *
153
+ * Matched at ANY depth, not just at the repository root. The root-only form was
154
+ * the original, and it left every nested changelog unhandled: a component-config
155
+ * repository with one per component produced 157 of 157 spelling findings and 240
156
+ * of 246 markdown findings from files nobody writes by hand. A generated file is
157
+ * generated wherever it sits.
158
+ */
159
+ export const GENERATED_DOC_FILES = ['**/CHANGELOG.md'];
160
+ /**
161
+ * Files excluded from the dead-code (unused-exports) report by default. These are
162
+ * REGEX sources (matched against each reported file path), not globs — dead-code's
163
+ * `ignoreFiles` is regex-based. Test and mock files legitimately export helpers and
164
+ * mocks consumed only by the test runner (jest.mock, dynamic imports), which
165
+ * ts-unused-exports cannot see as usage, so flagging them is noise. Clients can
166
+ * override via `deadCode.ignoreFiles` in pr-checkmate.json (setting it replaces
167
+ * this list).
168
+ */
169
+ export const DEAD_CODE_IGNORE_DEFAULTS = [
170
+ '/__tests__/',
171
+ '/__mocks__/',
172
+ '/__mock__/',
173
+ '/tests?/',
174
+ '\\.test\\.',
175
+ '\\.spec\\.',
176
+ ];
177
+ export const CONFIG_FILE_PATTERNS = [
178
+ '**/*.config.js',
179
+ '**/*.config.cjs',
180
+ '**/*.config.mjs',
181
+ '**/*.config.ts',
182
+ '**/.eslintrc.*',
183
+ '**/eslint.config.*',
184
+ '**/jest.config.*',
185
+ '**/wdio.config.*',
186
+ '**/playwright.config.*',
187
+ '**/cypress.config.*',
188
+ ];
189
+ /**
190
+ * jscpd formats the duplicate-CODE check scans. Restricting to code formats keeps
191
+ * config/CI YAML and JSON out of the report — they are data, not code, and their
192
+ * repetition is not meaningful duplication. This mirrors the code-only file set the
193
+ * check already uses when scanning a git diff, so full-tree and diff scans agree.
194
+ *
195
+ * One entry per language pr-checkmate detects, all of them verified against the
196
+ * jscpd binary rather than assumed: the list used to stop at C++ while the check
197
+ * only ever handed jscpd `.ts`/`.js` files, so the Go, Rust, C#, Ruby and PHP
198
+ * halves were unreachable and the Python one was decoration. Copy-paste is a
199
+ * language-independent smell, and the tokenizer behind this check has always been
200
+ * able to see it — the file list was the only thing in the way.
201
+ */
202
+ export const DUPLICATE_CODE_FORMATS = [
203
+ 'javascript',
204
+ 'typescript',
205
+ 'jsx',
206
+ 'tsx',
207
+ 'python',
208
+ 'kotlin',
209
+ 'swift',
210
+ 'c',
211
+ 'cpp',
212
+ 'csharp',
213
+ 'go',
214
+ 'php',
215
+ 'ruby',
216
+ 'rust',
217
+ ];
218
+ /**
219
+ * File extensions to check
220
+ */
221
+ export const SOURCE_EXTENSIONS = {
222
+ typescript: ['.ts', '.tsx'],
223
+ javascript: ['.js', '.jsx'],
224
+ markdown: ['.md', '.mdx'],
225
+ json: ['.json'],
226
+ all: ['.ts', '.tsx', '.js', '.jsx', '.json', '.md', '.mdx'],
227
+ };
228
+ export const DEFAULT_COMMANDS = {
229
+ 'npx pr-checkmate init': 'Create pr-checkmate.json and the CI workflow (first-run setup)',
230
+ 'npx pr-checkmate all': 'Run all checks over the changes — the PR diff in CI, your branch changes locally',
231
+ 'npx pr-checkmate all --full': 'Run all checks over every tracked file, CI included',
232
+ 'npx pr-checkmate lint': 'Lint code using ESLint',
233
+ 'npx pr-checkmate prettier': 'Format code using Prettier',
234
+ 'npx pr-checkmate deps': 'Check project dependencies',
235
+ 'npx pr-checkmate npm-audit': 'Run package vulnerabilities check',
236
+ 'npx pr-checkmate security': 'Security scan',
237
+ 'npx pr-checkmate spellcheck': 'Run spellcheck via cspell',
238
+ 'npx pr-checkmate typecheck': 'TypeScript type check (tsc --noEmit)',
239
+ 'npx pr-checkmate diff-smell': 'Scan git diff for code smells',
240
+ 'npx pr-checkmate pr-body': 'Validate PR description',
241
+ 'npx pr-checkmate duplicate': 'Detect duplicate code blocks (jscpd)',
242
+ };
243
+ /**
244
+ * Packages allow-listed for the license check by default.
245
+ *
246
+ * These are the optional cspell language dictionaries. Some ship under copyleft
247
+ * licenses (GPL/LGPL), and a client who installs one to spellcheck their own
248
+ * language should not have that turn into a licence finding: the dictionary is
249
+ * data for our check, not code they ship.
250
+ */
251
+ export const DEFAULT_ALLOW_PACKAGES = [
252
+ '@cspell/dict-es-es',
253
+ '@cspell/dict-fr-fr',
254
+ '@cspell/dict-he',
255
+ '@cspell/dict-ru_ru',
256
+ '@cspell/dict-uk-ua',
257
+ ];
258
+ /**
259
+ * Canonical entry point to the PR CheckMate docs. Single source of truth: it is
260
+ * written into every generated `pr-checkmate.json` (via {@link documentation})
261
+ * and printed in the "new version available" notice, so the two can never drift.
262
+ */
263
+ export const DOCS_URL = 'https://github.com/Mybono/pr_checkmate_public/tree/main/documentation';
264
+ /**
265
+ * The fully annotated configuration, with every option at its default value.
266
+ *
267
+ * A URL rather than a file inside the package on purpose: half the audience runs
268
+ * pr-checkmate through `npx` on a pipeline and has no `node_modules` at all, so
269
+ * a path into the installed package is a dead end for them. The release workflow
270
+ * publishes `src/config/pr-checkmate.template.json` to the public mirror under
271
+ * this name, which keeps one copy for everyone.
272
+ */
273
+ export const FULL_CONFIG_URL = 'https://github.com/Mybono/pr_checkmate_public/blob/main/pr-checkmate.json';
274
+ export const documentation = {
275
+ pr_checkmate: DOCS_URL,
276
+ eslint: 'https://eslint.org/docs/latest/rules/',
277
+ typescriptEslint: 'https://typescript-eslint.io/rules/',
278
+ prettier: 'https://prettier.io/docs/en/options.html',
279
+ cspell: 'https://cspell.org/configuration/',
280
+ };
281
+ /**
282
+ * Every top-level key PR CheckMate recognises in pr-checkmate.json — the union
283
+ * of the `PRCheckMateConfig` interface fields and the keys the `init` generator
284
+ * writes (which use `eslint`/`cspell`/`markdownlint` rather than the interface's
285
+ * `lint`/`spellcheck`). The Config Validation check warns on any key not in this
286
+ * set (typos), ignoring `//`-prefixed comment keys and `$schema`. Keep in sync
287
+ * when adding a new configurable check.
288
+ */
289
+ export const KNOWN_CONFIG_KEYS = new Set([
290
+ // core
291
+ 'sourcePath',
292
+ 'ignoreDirs',
293
+ 'excludePaths',
294
+ 'languages',
295
+ 'detect',
296
+ 'install',
297
+ 'severity',
298
+ 'severityDefaults',
299
+ 'run',
300
+ 'reporter',
301
+ 'log',
302
+ 'customRules',
303
+ '$schema',
304
+ 'commands',
305
+ 'documentation',
306
+ 'configValidation',
307
+ // linters/formatters (interface + init aliases)
308
+ 'lint',
309
+ 'eslint',
310
+ 'prettier',
311
+ 'spellcheck',
312
+ 'cspell',
313
+ 'markdownlint',
314
+ 'yamlLint',
315
+ 'shellcheck',
316
+ 'symlinks',
317
+ 'typecheck',
318
+ // security
319
+ 'security',
320
+ 'diffSecurity',
321
+ 'workflowSecurity',
322
+ 'dockerfileSecurity',
323
+ 'sensitiveFileGuard',
324
+ 'migrationSafety',
325
+ // dependencies
326
+ 'dependency',
327
+ 'circularDeps',
328
+ 'outdatedDeps',
329
+ 'licenseCheck',
330
+ 'vulnScan',
331
+ 'grypeScan',
332
+ 'bannedImports',
333
+ // git-diff / PR
334
+ 'mergeConflict',
335
+ 'diffSmell',
336
+ 'leftoverDebug',
337
+ 'todoFixme',
338
+ 'lockfileDrift',
339
+ 'largeFiles',
340
+ 'missingTests',
341
+ 'coverage',
342
+ 'caseCollision',
343
+ 'licenseHeader',
344
+ 'duplicate',
345
+ 'deadCode',
346
+ 'packageSize',
347
+ 'prBody',
348
+ 'prSize',
349
+ 'commitlint',
350
+ // languages
351
+ 'cpp',
352
+ 'python',
353
+ 'swift',
354
+ 'kotlin',
355
+ 'go',
356
+ 'rust',
357
+ 'csharp',
358
+ 'ruby',
359
+ 'php',
360
+ ]);
@@ -0,0 +1,40 @@
1
+ export * from './constants.js';
2
+ export { loadProjectConfig } from '../config/loader.js';
3
+ /**
4
+ * The configured source path(s), normalised to a list.
5
+ *
6
+ * Accepts a string or an array; empty and invalid values fall back to `['.']`,
7
+ * the whole repository. Clients narrow scanning to a subdirectory by setting
8
+ * `sourcePath`.
9
+ *
10
+ * `cwd` is a parameter rather than `process.cwd()` baked in, and that is the
11
+ * whole of ticket 074. This used to read a `CONFIG_FILE` constant resolved at
12
+ * *module load*, so the answer was fixed to whatever directory the process
13
+ * started in — `chdir` could not change it and neither could a caller. For the
14
+ * CLI that is harmless, since its working directory never moves; for
15
+ * `runChecks({ cwd })` it meant the SDK consumer's own `sourcePath` was applied
16
+ * to somebody else's repository, silently scoping every scoped check to a
17
+ * directory that may not exist there.
18
+ *
19
+ * It also read the file itself, duplicating `loadProjectConfig` with its own
20
+ * defaults. One reader is now the only reader.
21
+ */
22
+ export declare function getSourcePaths(cwd?: string): string[];
23
+ /**
24
+ * The first configured source path, for callers that only support one directory.
25
+ * Prefer {@link getSourcePaths} for scan targets.
26
+ */
27
+ export declare function getSourcePath(cwd?: string): string;
28
+ /**
29
+ * Get the effective list of directory names excluded from every check
30
+ * (client `ignoreDirs` in pr-checkmate.json, or the curated default).
31
+ */
32
+ export declare function getIgnoredDirs(cwd?: string): string[];
33
+ /**
34
+ * Get path to package config files
35
+ */
36
+ export declare function getPackageConfigPath(fileName: string): string;
37
+ /**
38
+ * Check if project has local config
39
+ */
40
+ export declare function hasLocalConfig(configNames: string[], cwd?: string): boolean;
@@ -0,0 +1,60 @@
1
+ import { fileURLToPath as __fileURLToPath } from 'node:url';
2
+ import { dirname as __dirnameFn } from 'node:path';
3
+ const __dirname = __dirnameFn(__fileURLToPath(import.meta.url));
4
+ import fs from 'node:fs';
5
+ import path from 'node:path';
6
+ import { loadProjectConfig } from '../config/loader.js';
7
+ import { findOwnPackageRoot } from '../utils/own-deps.js';
8
+ export * from './constants.js';
9
+ export { loadProjectConfig } from '../config/loader.js';
10
+ /**
11
+ * The configured source path(s), normalised to a list.
12
+ *
13
+ * Accepts a string or an array; empty and invalid values fall back to `['.']`,
14
+ * the whole repository. Clients narrow scanning to a subdirectory by setting
15
+ * `sourcePath`.
16
+ *
17
+ * `cwd` is a parameter rather than `process.cwd()` baked in, and that is the
18
+ * whole of ticket 074. This used to read a `CONFIG_FILE` constant resolved at
19
+ * *module load*, so the answer was fixed to whatever directory the process
20
+ * started in — `chdir` could not change it and neither could a caller. For the
21
+ * CLI that is harmless, since its working directory never moves; for
22
+ * `runChecks({ cwd })` it meant the SDK consumer's own `sourcePath` was applied
23
+ * to somebody else's repository, silently scoping every scoped check to a
24
+ * directory that may not exist there.
25
+ *
26
+ * It also read the file itself, duplicating `loadProjectConfig` with its own
27
+ * defaults. One reader is now the only reader.
28
+ */
29
+ export function getSourcePaths(cwd = process.cwd()) {
30
+ const { sourcePath } = loadProjectConfig(cwd);
31
+ const paths = (Array.isArray(sourcePath) ? sourcePath : [sourcePath]).filter((p) => typeof p === 'string' && p.trim().length > 0);
32
+ return paths.length > 0 ? paths : ['.'];
33
+ }
34
+ /**
35
+ * The first configured source path, for callers that only support one directory.
36
+ * Prefer {@link getSourcePaths} for scan targets.
37
+ */
38
+ export function getSourcePath(cwd) {
39
+ return getSourcePaths(cwd)[0];
40
+ }
41
+ /**
42
+ * Get the effective list of directory names excluded from every check
43
+ * (client `ignoreDirs` in pr-checkmate.json, or the curated default).
44
+ */
45
+ export function getIgnoredDirs(cwd) {
46
+ return loadProjectConfig(cwd).ignoreDirs ?? [];
47
+ }
48
+ /**
49
+ * Get path to package config files
50
+ */
51
+ export function getPackageConfigPath(fileName) {
52
+ const packageRoot = findOwnPackageRoot() ?? path.resolve(__dirname, '../../..');
53
+ return path.join(packageRoot, fileName);
54
+ }
55
+ /**
56
+ * Check if project has local config
57
+ */
58
+ export function hasLocalConfig(configNames, cwd = process.cwd()) {
59
+ return configNames.some(name => fs.existsSync(path.join(cwd, name)));
60
+ }
@@ -0,0 +1,6 @@
1
+ import { PRCheckMateConfig } from '../interfaces/index.js';
2
+ /**
3
+ * Load project configuration from pr-checkmate.json
4
+ * Falls back to defaults if not found
5
+ */
6
+ export declare function loadProjectConfig(cwd?: string): PRCheckMateConfig;
@@ -0,0 +1,191 @@
1
+ import fs from 'node:fs';
2
+ import path from 'node:path';
3
+ import { logger } from '../utils/index.js';
4
+ import { DEAD_CODE_IGNORE_DEFAULTS, DEFAULT_ALLOW_PACKAGES, DUPLICATE_CODE_FORMATS, DUPLICATE_IGNORE_DEFAULTS, IGNORED_DIRS, } from './constants.js';
5
+ /**
6
+ * Load project configuration from pr-checkmate.json
7
+ * Falls back to defaults if not found
8
+ */
9
+ export function loadProjectConfig(cwd = process.cwd()) {
10
+ const configPath = path.join(cwd, 'pr-checkmate.json');
11
+ if (fs.existsSync(configPath)) {
12
+ try {
13
+ const content = fs.readFileSync(configPath, 'utf-8');
14
+ const config = JSON.parse(content);
15
+ return mergeWithDefaults(config);
16
+ }
17
+ catch (err) {
18
+ logger.warn(`[loadProjectConfig]: ⚠️ Failed to parse pr-checkmate.json: ${err}`);
19
+ }
20
+ }
21
+ return getDefaultConfig();
22
+ }
23
+ /**
24
+ * Deep merge user config with defaults
25
+ */
26
+ function mergeWithDefaults(userConfig) {
27
+ const defaults = getDefaultConfig();
28
+ return {
29
+ // Preserve every key the user set — including opt-in checks (vulnScan,
30
+ // grypeScan) and controls with no default entry below (severity, customRules,
31
+ // prSize, caseCollision, go/rust/ruby/php, …). The explicitly-merged keys
32
+ // that follow override this spread with their default-merged values.
33
+ ...userConfig,
34
+ sourcePath: userConfig.sourcePath || defaults.sourcePath,
35
+ // Replace (not merge): the client sees the full default list in their
36
+ // generated config and edits it directly, so their list is authoritative.
37
+ ignoreDirs: userConfig.ignoreDirs ?? defaults.ignoreDirs,
38
+ lint: {
39
+ rules: { ...defaults.lint?.rules, ...userConfig.lint?.rules },
40
+ ignorePatterns: [
41
+ ...(defaults.lint?.ignorePatterns || []),
42
+ ...(userConfig.lint?.ignorePatterns || []),
43
+ ],
44
+ },
45
+ prettier: {
46
+ config: { ...defaults.prettier?.config, ...userConfig.prettier?.config },
47
+ },
48
+ spellcheck: {
49
+ words: [...(userConfig.spellcheck?.words || [])],
50
+ ignoreWords: [...(userConfig.spellcheck?.ignoreWords || [])],
51
+ ignorePaths: [
52
+ ...(defaults.spellcheck?.ignorePaths || []),
53
+ ...(userConfig.spellcheck?.ignorePaths || []),
54
+ ],
55
+ },
56
+ security: {
57
+ ...defaults.security,
58
+ ...userConfig.security,
59
+ gitleaks: { ...defaults.security?.gitleaks, ...userConfig.security?.gitleaks },
60
+ 'npm-audit': { ...defaults.security?.['npm-audit'], ...userConfig.security?.['npm-audit'] },
61
+ },
62
+ typecheck: { ...defaults.typecheck, ...userConfig.typecheck },
63
+ cpp: {
64
+ ...defaults.cpp,
65
+ ...userConfig.cpp,
66
+ clangFormat: { ...defaults.cpp?.clangFormat, ...userConfig.cpp?.clangFormat },
67
+ },
68
+ python: {
69
+ ...defaults.python,
70
+ ...userConfig.python,
71
+ ruff: { ...defaults.python?.ruff, ...userConfig.python?.ruff },
72
+ },
73
+ swift: { ...defaults.swift, ...userConfig.swift },
74
+ kotlin: { ...defaults.kotlin, ...userConfig.kotlin },
75
+ diffSmell: { ...defaults.diffSmell, ...userConfig.diffSmell },
76
+ prBody: { ...defaults.prBody, ...userConfig.prBody },
77
+ duplicate: { ...defaults.duplicate, ...userConfig.duplicate },
78
+ dependency: { ...defaults.dependency, ...userConfig.dependency },
79
+ outdatedDeps: { ...defaults.outdatedDeps, ...userConfig.outdatedDeps },
80
+ commitlint: { ...defaults.commitlint, ...userConfig.commitlint },
81
+ deadCode: { ...defaults.deadCode, ...userConfig.deadCode },
82
+ licenseCheck: {
83
+ allowPackages: [
84
+ ...(defaults.licenseCheck?.allowPackages || []),
85
+ ...(userConfig.licenseCheck?.allowPackages || []),
86
+ ],
87
+ allowLicenses: [
88
+ ...(defaults.licenseCheck?.allowLicenses || []),
89
+ ...(userConfig.licenseCheck?.allowLicenses || []),
90
+ ],
91
+ },
92
+ };
93
+ }
94
+ /**
95
+ * Get default configuration
96
+ */
97
+ function getDefaultConfig() {
98
+ return {
99
+ sourcePath: '.',
100
+ ignoreDirs: [...IGNORED_DIRS],
101
+ lint: {
102
+ rules: {
103
+ 'no-console': 'warn',
104
+ 'no-debugger': 'error',
105
+ 'prefer-const': 'error',
106
+ eqeqeq: ['error', 'always'],
107
+ '@typescript-eslint/no-unused-vars': [
108
+ 'error',
109
+ { argsIgnorePattern: '^_', varsIgnorePattern: '^_' },
110
+ ],
111
+ '@typescript-eslint/explicit-function-return-type': ['warn'],
112
+ '@typescript-eslint/no-explicit-any': ['warn'],
113
+ '@typescript-eslint/no-floating-promises': ['error'],
114
+ 'max-len': ['warn', { code: 100 }],
115
+ semi: ['error', 'always'],
116
+ quotes: ['error', 'single', { avoidEscape: true }],
117
+ 'object-curly-spacing': ['error', 'always'],
118
+ 'keyword-spacing': ['error', { before: true, after: true }],
119
+ },
120
+ ignorePatterns: [
121
+ '**/node_modules/**',
122
+ '**/dist/**',
123
+ '**/.git/**',
124
+ '**/build/**',
125
+ '**/coverage/**',
126
+ '**/.next/**',
127
+ ],
128
+ },
129
+ prettier: {
130
+ config: {
131
+ semi: true,
132
+ singleQuote: true,
133
+ trailingComma: 'all',
134
+ bracketSpacing: true,
135
+ arrowParens: 'avoid',
136
+ printWidth: 100,
137
+ tabWidth: 2,
138
+ },
139
+ },
140
+ spellcheck: {
141
+ words: [],
142
+ ignoreWords: [],
143
+ ignorePaths: ['**/node_modules/**', '**/dist/**', '**/.git/**', '**/build/**'],
144
+ },
145
+ security: {
146
+ gitleaks: { enabled: true },
147
+ 'npm-audit': { enabled: true, auditLevel: 'moderate' },
148
+ },
149
+ typecheck: { enabled: true },
150
+ cpp: { enabled: true, clangFormat: { style: 'LLVM' } },
151
+ python: { enabled: true, ruff: { lint: true, format: true } },
152
+ swift: { enabled: true },
153
+ kotlin: { enabled: true },
154
+ diffSmell: { enabled: true },
155
+ prBody: { enabled: true, minLength: 20, requireTicket: true },
156
+ duplicate: {
157
+ enabled: true,
158
+ minLines: 5,
159
+ minTokens: 50,
160
+ ignore: DUPLICATE_IGNORE_DEFAULTS,
161
+ formats: DUPLICATE_CODE_FORMATS,
162
+ },
163
+ dependency: { enabled: true, ignore: [] },
164
+ outdatedDeps: { enabled: true, ignore: [] },
165
+ deadCode: { enabled: true, ignoreFiles: DEAD_CODE_IGNORE_DEFAULTS },
166
+ commitlint: {
167
+ enabled: true,
168
+ types: [
169
+ 'feat',
170
+ 'fix',
171
+ 'docs',
172
+ 'chore',
173
+ 'ci',
174
+ 'refactor',
175
+ 'perf',
176
+ 'style',
177
+ 'revert',
178
+ 'test',
179
+ 'build',
180
+ ],
181
+ // Skip release PRs and squash-merge titles that don't follow conventional
182
+ // commits (e.g. "Release 15 (#114)"). commitlint already ignores literal
183
+ // "Merge"/"Revert" messages, but not GitHub squash-merge PR titles.
184
+ ignores: ['^Release\\b', '^chore\\(release\\):'],
185
+ },
186
+ licenseCheck: {
187
+ allowPackages: [...DEFAULT_ALLOW_PACKAGES],
188
+ allowLicenses: [],
189
+ },
190
+ };
191
+ }