@repometry/cli 0.0.0-stage → 0.0.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 (415) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +70 -2
  3. package/package.json +75 -4
  4. package/target/main/resources/language-catalog.json +61 -0
  5. package/target/main/resources/report/json/compact-json-v1.schema.json +24 -0
  6. package/target/main/resources/report/json/comparison-v1.schema.json +65 -0
  7. package/target/main/resources/report/json/config-v2.schema.json +224 -0
  8. package/target/main/resources/report/json/diff-coverage-v1.schema.json +55 -0
  9. package/target/main/resources/report/json/file-metrics-v1.schema.json +157 -0
  10. package/target/main/resources/report/json/metabranch-v1.schema.json +9 -0
  11. package/target/main/resources/report/json/metric-catalog-v1.schema.json +31 -0
  12. package/target/main/resources/report/json/pull-review-v1.schema.json +97 -0
  13. package/target/main/resources/report/json/pull-review-v2.schema.json +100 -0
  14. package/target/main/resources/report/json/report-v2.schema.json +530 -0
  15. package/target/main/resources/report/json/repository-summary-v1.schema.json +337 -0
  16. package/target/main/resources/report/json/viewer-inspection-v1.schema.json +534 -0
  17. package/target/main/resources/viewer/files.css +616 -0
  18. package/target/main/resources/viewer/index.html +120 -0
  19. package/target/main/resources/viewer/projects.html +52 -0
  20. package/target/main/resources/viewer/styles.css +579 -0
  21. package/target/main/resources/viewer/viewer-pulls.css +64 -0
  22. package/target/main/ts/api/cache/root.d.ts +2 -0
  23. package/target/main/ts/api/cache/root.js +21 -0
  24. package/target/main/ts/api/gh/github.d.ts +4 -0
  25. package/target/main/ts/api/gh/github.js +47 -0
  26. package/target/main/ts/api/git/blob-batch.d.ts +10 -0
  27. package/target/main/ts/api/git/blob-batch.js +107 -0
  28. package/target/main/ts/api/git/blob-history.d.ts +20 -0
  29. package/target/main/ts/api/git/blob-history.js +54 -0
  30. package/target/main/ts/api/git/changes.d.ts +27 -0
  31. package/target/main/ts/api/git/changes.js +117 -0
  32. package/target/main/ts/api/git/commit-metadata.d.ts +2 -0
  33. package/target/main/ts/api/git/commit-metadata.js +46 -0
  34. package/target/main/ts/api/git/git-churn.d.ts +9 -0
  35. package/target/main/ts/api/git/git-churn.js +72 -0
  36. package/target/main/ts/api/git/git-executable.d.ts +1 -0
  37. package/target/main/ts/api/git/git-executable.js +31 -0
  38. package/target/main/ts/api/git/git-reader.d.ts +24 -0
  39. package/target/main/ts/api/git/git-reader.js +113 -0
  40. package/target/main/ts/api/git/git.d.ts +47 -0
  41. package/target/main/ts/api/git/git.js +289 -0
  42. package/target/main/ts/api/git/inspection-source.d.ts +17 -0
  43. package/target/main/ts/api/git/inspection-source.js +36 -0
  44. package/target/main/ts/api/git/line-changes.d.ts +6 -0
  45. package/target/main/ts/api/git/line-changes.js +57 -0
  46. package/target/main/ts/api/git/local-sources.d.ts +5 -0
  47. package/target/main/ts/api/git/local-sources.js +48 -0
  48. package/target/main/ts/api/git/local.d.ts +7 -0
  49. package/target/main/ts/api/git/local.js +106 -0
  50. package/target/main/ts/api/git/source-cache.d.ts +1 -0
  51. package/target/main/ts/api/git/source-cache.js +42 -0
  52. package/target/main/ts/api/import/cobertura.d.ts +2 -0
  53. package/target/main/ts/api/import/cobertura.js +160 -0
  54. package/target/main/ts/api/import/coverage-xml.d.ts +7 -0
  55. package/target/main/ts/api/import/coverage-xml.js +135 -0
  56. package/target/main/ts/api/import/finding-import.d.ts +9 -0
  57. package/target/main/ts/api/import/finding-import.js +227 -0
  58. package/target/main/ts/api/import/go-cover.d.ts +13 -0
  59. package/target/main/ts/api/import/go-cover.js +150 -0
  60. package/target/main/ts/api/import/lcov-files.d.ts +12 -0
  61. package/target/main/ts/api/import/lcov-files.js +53 -0
  62. package/target/main/ts/api/import/profile-file.d.ts +4 -0
  63. package/target/main/ts/api/import/profile-file.js +17 -0
  64. package/target/main/ts/api/process/docker-tool-runner.d.ts +13 -0
  65. package/target/main/ts/api/process/docker-tool-runner.js +92 -0
  66. package/target/main/ts/api/process/failure.d.ts +1 -0
  67. package/target/main/ts/api/process/failure.js +12 -0
  68. package/target/main/ts/api/process/plugin.d.ts +13 -0
  69. package/target/main/ts/api/process/plugin.js +100 -0
  70. package/target/main/ts/api/process/tool-snapshot.d.ts +3 -0
  71. package/target/main/ts/api/process/tool-snapshot.js +26 -0
  72. package/target/main/ts/cli/arguments.d.ts +28 -0
  73. package/target/main/ts/cli/arguments.js +109 -0
  74. package/target/main/ts/cli/config.d.ts +63 -0
  75. package/target/main/ts/cli/config.js +165 -0
  76. package/target/main/ts/cli/imports.d.ts +9 -0
  77. package/target/main/ts/cli/imports.js +37 -0
  78. package/target/main/ts/cli/main.d.ts +2 -0
  79. package/target/main/ts/cli/main.js +4 -0
  80. package/target/main/ts/cli/range-inspection.d.ts +38 -0
  81. package/target/main/ts/cli/range-inspection.js +34 -0
  82. package/target/main/ts/cli/range-jobs.d.ts +23 -0
  83. package/target/main/ts/cli/range-jobs.js +152 -0
  84. package/target/main/ts/cli/range-worker.d.ts +1 -0
  85. package/target/main/ts/cli/range-worker.js +40 -0
  86. package/target/main/ts/cli/reporting.d.ts +42 -0
  87. package/target/main/ts/cli/reporting.js +98 -0
  88. package/target/main/ts/cli/revisions.d.ts +6 -0
  89. package/target/main/ts/cli/revisions.js +16 -0
  90. package/target/main/ts/cli/run.d.ts +2 -0
  91. package/target/main/ts/cli/run.js +306 -0
  92. package/target/main/ts/cli/store.d.ts +13 -0
  93. package/target/main/ts/cli/store.js +39 -0
  94. package/target/main/ts/compose/analysis-report.d.ts +6 -0
  95. package/target/main/ts/compose/analysis-report.js +131 -0
  96. package/target/main/ts/compose/analysis-results.d.ts +42 -0
  97. package/target/main/ts/compose/analysis-results.js +84 -0
  98. package/target/main/ts/compose/analysis-steps.d.ts +23 -0
  99. package/target/main/ts/compose/analysis-steps.js +217 -0
  100. package/target/main/ts/compose/analyze-snapshot.d.ts +7 -0
  101. package/target/main/ts/compose/analyze-snapshot.js +21 -0
  102. package/target/main/ts/compose/attach-churn.d.ts +2 -0
  103. package/target/main/ts/compose/attach-churn.js +50 -0
  104. package/target/main/ts/compose/built-ins.d.ts +6 -0
  105. package/target/main/ts/compose/built-ins.js +12 -0
  106. package/target/main/ts/compose/diff-coverage.d.ts +25 -0
  107. package/target/main/ts/compose/diff-coverage.js +82 -0
  108. package/target/main/ts/compose/distribution.d.ts +17 -0
  109. package/target/main/ts/compose/distribution.js +13 -0
  110. package/target/main/ts/compose/docker-image.d.ts +5 -0
  111. package/target/main/ts/compose/docker-image.js +49 -0
  112. package/target/main/ts/compose/file-selection.d.ts +9 -0
  113. package/target/main/ts/compose/file-selection.js +38 -0
  114. package/target/main/ts/compose/history-cache.d.ts +31 -0
  115. package/target/main/ts/compose/history-cache.js +62 -0
  116. package/target/main/ts/compose/inspect.d.ts +34 -0
  117. package/target/main/ts/compose/inspect.js +51 -0
  118. package/target/main/ts/compose/inspection-coverage.d.ts +9 -0
  119. package/target/main/ts/compose/inspection-coverage.js +9 -0
  120. package/target/main/ts/compose/js-plugin.d.ts +113 -0
  121. package/target/main/ts/compose/js-plugin.js +99 -0
  122. package/target/main/ts/compose/language-discovery.d.ts +12 -0
  123. package/target/main/ts/compose/language-discovery.js +51 -0
  124. package/target/main/ts/compose/languages.d.ts +64 -0
  125. package/target/main/ts/compose/languages.js +98 -0
  126. package/target/main/ts/compose/load-plugins.d.ts +6 -0
  127. package/target/main/ts/compose/load-plugins.js +71 -0
  128. package/target/main/ts/compose/parser-order.d.ts +20 -0
  129. package/target/main/ts/compose/parser-order.js +90 -0
  130. package/target/main/ts/compose/phases.d.ts +140 -0
  131. package/target/main/ts/compose/phases.js +147 -0
  132. package/target/main/ts/compose/plugin-list.d.ts +37 -0
  133. package/target/main/ts/compose/plugin-list.js +30 -0
  134. package/target/main/ts/compose/plugin-manifest.d.ts +14 -0
  135. package/target/main/ts/compose/plugin-manifest.js +50 -0
  136. package/target/main/ts/compose/plugin-options.d.ts +2 -0
  137. package/target/main/ts/compose/plugin-options.js +29 -0
  138. package/target/main/ts/compose/plugin-reference.d.ts +9 -0
  139. package/target/main/ts/compose/plugin-reference.js +40 -0
  140. package/target/main/ts/compose/plugin-requirements.d.ts +5 -0
  141. package/target/main/ts/compose/plugin-requirements.js +83 -0
  142. package/target/main/ts/compose/plugin-scope.d.ts +9 -0
  143. package/target/main/ts/compose/plugin-scope.js +60 -0
  144. package/target/main/ts/compose/process-plugins.d.ts +89 -0
  145. package/target/main/ts/compose/process-plugins.js +74 -0
  146. package/target/main/ts/compose/registered-plugin.d.ts +17 -0
  147. package/target/main/ts/compose/registered-plugin.js +8 -0
  148. package/target/main/ts/compose/review.d.ts +26 -0
  149. package/target/main/ts/compose/review.js +54 -0
  150. package/target/main/ts/compose/schema-error.d.ts +2 -0
  151. package/target/main/ts/compose/schema-error.js +16 -0
  152. package/target/main/ts/compose/sources.d.ts +2 -0
  153. package/target/main/ts/compose/sources.js +32 -0
  154. package/target/main/ts/compose/structure-measures.d.ts +9 -0
  155. package/target/main/ts/compose/structure-measures.js +63 -0
  156. package/target/main/ts/index.d.ts +8 -0
  157. package/target/main/ts/index.js +5 -0
  158. package/target/main/ts/plugin.d.ts +2 -0
  159. package/target/main/ts/plugin.js +2 -0
  160. package/target/main/ts/plugins/built-in.d.ts +3 -0
  161. package/target/main/ts/plugins/built-in.js +19 -0
  162. package/target/main/ts/plugins/coverage/coverage.d.ts +11 -0
  163. package/target/main/ts/plugins/coverage/coverage.js +289 -0
  164. package/target/main/ts/plugins/coverage/diff-coverage.d.ts +3 -0
  165. package/target/main/ts/plugins/coverage/diff-coverage.js +85 -0
  166. package/target/main/ts/plugins/duplication/duplication.d.ts +2 -0
  167. package/target/main/ts/plugins/duplication/duplication.js +95 -0
  168. package/target/main/ts/plugins/language-js/babel-provider.d.ts +10 -0
  169. package/target/main/ts/plugins/language-js/babel-provider.js +54 -0
  170. package/target/main/ts/plugins/language-js/clone-candidates.d.ts +3 -0
  171. package/target/main/ts/plugins/language-js/clone-candidates.js +65 -0
  172. package/target/main/ts/plugins/language-js/code-lines.d.ts +6 -0
  173. package/target/main/ts/plugins/language-js/code-lines.js +36 -0
  174. package/target/main/ts/plugins/language-js/extensions.d.ts +1 -0
  175. package/target/main/ts/plugins/language-js/extensions.js +3 -0
  176. package/target/main/ts/plugins/language-js/function-facts.d.ts +9 -0
  177. package/target/main/ts/plugins/language-js/function-facts.js +74 -0
  178. package/target/main/ts/plugins/language-js/js-security.d.ts +4 -0
  179. package/target/main/ts/plugins/language-js/js-security.js +497 -0
  180. package/target/main/ts/plugins/language-js/qualified-names.d.ts +11 -0
  181. package/target/main/ts/plugins/language-js/qualified-names.js +63 -0
  182. package/target/main/ts/plugins/language-js/structural-observations.d.ts +9 -0
  183. package/target/main/ts/plugins/language-js/structural-observations.js +85 -0
  184. package/target/main/ts/plugins/language-js/syntax.d.ts +2 -0
  185. package/target/main/ts/plugins/language-js/syntax.js +11 -0
  186. package/target/main/ts/plugins/maintainability/maintainability.d.ts +2 -0
  187. package/target/main/ts/plugins/maintainability/maintainability.js +38 -0
  188. package/target/main/ts/plugins/maintainability/structural-smells.d.ts +3 -0
  189. package/target/main/ts/plugins/maintainability/structural-smells.js +17 -0
  190. package/target/main/ts/plugins/security/actions-security.d.ts +2 -0
  191. package/target/main/ts/plugins/security/actions-security.js +581 -0
  192. package/target/main/ts/plugins/security/dockerfile.d.ts +2 -0
  193. package/target/main/ts/plugins/security/dockerfile.js +487 -0
  194. package/target/main/ts/plugins/security/npm-supply-chain.d.ts +4 -0
  195. package/target/main/ts/plugins/security/npm-supply-chain.js +368 -0
  196. package/target/main/ts/plugins/security/secrets.d.ts +12 -0
  197. package/target/main/ts/plugins/security/secrets.js +254 -0
  198. package/target/main/ts/plugins/source/forges.d.ts +4 -0
  199. package/target/main/ts/plugins/source/forges.js +80 -0
  200. package/target/main/ts/plugins/structure/structure.d.ts +2 -0
  201. package/target/main/ts/plugins/structure/structure.js +42 -0
  202. package/target/main/ts/report/html/app/viewer-chart-bars.d.ts +13 -0
  203. package/target/main/ts/report/html/app/viewer-chart-bars.js +59 -0
  204. package/target/main/ts/report/html/app/viewer-chart-label.d.ts +15 -0
  205. package/target/main/ts/report/html/app/viewer-chart-label.js +43 -0
  206. package/target/main/ts/report/html/app/viewer-chart-line.d.ts +33 -0
  207. package/target/main/ts/report/html/app/viewer-chart-line.js +88 -0
  208. package/target/main/ts/report/html/app/viewer-chart-points.d.ts +52 -0
  209. package/target/main/ts/report/html/app/viewer-chart-points.js +65 -0
  210. package/target/main/ts/report/html/app/viewer-chart-scale.d.ts +21 -0
  211. package/target/main/ts/report/html/app/viewer-chart-scale.js +93 -0
  212. package/target/main/ts/report/html/app/viewer-chart-svg.d.ts +28 -0
  213. package/target/main/ts/report/html/app/viewer-chart-svg.js +41 -0
  214. package/target/main/ts/report/html/app/viewer-chart-time.d.ts +26 -0
  215. package/target/main/ts/report/html/app/viewer-chart-time.js +150 -0
  216. package/target/main/ts/report/html/app/viewer-chart-tip.d.ts +4 -0
  217. package/target/main/ts/report/html/app/viewer-chart-tip.js +210 -0
  218. package/target/main/ts/report/html/app/viewer-chart-x.d.ts +12 -0
  219. package/target/main/ts/report/html/app/viewer-chart-x.js +50 -0
  220. package/target/main/ts/report/html/app/viewer-chart.d.ts +7 -0
  221. package/target/main/ts/report/html/app/viewer-chart.js +50 -0
  222. package/target/main/ts/report/html/app/viewer-code-map.d.ts +27 -0
  223. package/target/main/ts/report/html/app/viewer-code-map.js +176 -0
  224. package/target/main/ts/report/html/app/viewer-columns.d.ts +40 -0
  225. package/target/main/ts/report/html/app/viewer-columns.js +97 -0
  226. package/target/main/ts/report/html/app/viewer-commit-picker.d.ts +12 -0
  227. package/target/main/ts/report/html/app/viewer-commit-picker.js +229 -0
  228. package/target/main/ts/report/html/app/viewer-commits.d.ts +32 -0
  229. package/target/main/ts/report/html/app/viewer-commits.js +81 -0
  230. package/target/main/ts/report/html/app/viewer-controls.d.ts +43 -0
  231. package/target/main/ts/report/html/app/viewer-controls.js +141 -0
  232. package/target/main/ts/report/html/app/viewer-copy.d.ts +17 -0
  233. package/target/main/ts/report/html/app/viewer-copy.js +64 -0
  234. package/target/main/ts/report/html/app/viewer-data.d.ts +24 -0
  235. package/target/main/ts/report/html/app/viewer-data.js +78 -0
  236. package/target/main/ts/report/html/app/viewer-diagnostics.d.ts +4 -0
  237. package/target/main/ts/report/html/app/viewer-diagnostics.js +60 -0
  238. package/target/main/ts/report/html/app/viewer-dom.d.ts +27 -0
  239. package/target/main/ts/report/html/app/viewer-dom.js +99 -0
  240. package/target/main/ts/report/html/app/viewer-file-aside.d.ts +15 -0
  241. package/target/main/ts/report/html/app/viewer-file-aside.js +134 -0
  242. package/target/main/ts/report/html/app/viewer-file-figures.d.ts +17 -0
  243. package/target/main/ts/report/html/app/viewer-file-figures.js +65 -0
  244. package/target/main/ts/report/html/app/viewer-file-source.d.ts +7 -0
  245. package/target/main/ts/report/html/app/viewer-file-source.js +119 -0
  246. package/target/main/ts/report/html/app/viewer-files.d.ts +11 -0
  247. package/target/main/ts/report/html/app/viewer-files.js +40 -0
  248. package/target/main/ts/report/html/app/viewer-filter.d.ts +65 -0
  249. package/target/main/ts/report/html/app/viewer-filter.js +161 -0
  250. package/target/main/ts/report/html/app/viewer-hotspots.d.ts +4 -0
  251. package/target/main/ts/report/html/app/viewer-hotspots.js +133 -0
  252. package/target/main/ts/report/html/app/viewer-inspection.d.ts +69 -0
  253. package/target/main/ts/report/html/app/viewer-inspection.js +38 -0
  254. package/target/main/ts/report/html/app/viewer-issue-group.d.ts +27 -0
  255. package/target/main/ts/report/html/app/viewer-issue-group.js +174 -0
  256. package/target/main/ts/report/html/app/viewer-issues.d.ts +4 -0
  257. package/target/main/ts/report/html/app/viewer-issues.js +173 -0
  258. package/target/main/ts/report/html/app/viewer-language-bar.d.ts +11 -0
  259. package/target/main/ts/report/html/app/viewer-language-bar.js +76 -0
  260. package/target/main/ts/report/html/app/viewer-languages.d.ts +35 -0
  261. package/target/main/ts/report/html/app/viewer-languages.js +97 -0
  262. package/target/main/ts/report/html/app/viewer-layout.d.ts +14 -0
  263. package/target/main/ts/report/html/app/viewer-layout.js +134 -0
  264. package/target/main/ts/report/html/app/viewer-line-coverage.d.ts +47 -0
  265. package/target/main/ts/report/html/app/viewer-line-coverage.js +108 -0
  266. package/target/main/ts/report/html/app/viewer-locations.d.ts +16 -0
  267. package/target/main/ts/report/html/app/viewer-locations.js +31 -0
  268. package/target/main/ts/report/html/app/viewer-map-scale.d.ts +26 -0
  269. package/target/main/ts/report/html/app/viewer-map-scale.js +147 -0
  270. package/target/main/ts/report/html/app/viewer-map-shape.d.ts +42 -0
  271. package/target/main/ts/report/html/app/viewer-map-shape.js +102 -0
  272. package/target/main/ts/report/html/app/viewer-metric-format.d.ts +23 -0
  273. package/target/main/ts/report/html/app/viewer-metric-format.js +93 -0
  274. package/target/main/ts/report/html/app/viewer-metric-registry.d.ts +47 -0
  275. package/target/main/ts/report/html/app/viewer-metric-registry.js +138 -0
  276. package/target/main/ts/report/html/app/viewer-metrics-view.d.ts +4 -0
  277. package/target/main/ts/report/html/app/viewer-metrics-view.js +159 -0
  278. package/target/main/ts/report/html/app/viewer-metrics.d.ts +51 -0
  279. package/target/main/ts/report/html/app/viewer-metrics.js +195 -0
  280. package/target/main/ts/report/html/app/viewer-overview-cards.d.ts +12 -0
  281. package/target/main/ts/report/html/app/viewer-overview-cards.js +121 -0
  282. package/target/main/ts/report/html/app/viewer-overview-hotspots.d.ts +9 -0
  283. package/target/main/ts/report/html/app/viewer-overview-hotspots.js +173 -0
  284. package/target/main/ts/report/html/app/viewer-overview-lead.d.ts +12 -0
  285. package/target/main/ts/report/html/app/viewer-overview-lead.js +116 -0
  286. package/target/main/ts/report/html/app/viewer-profile-badges.d.ts +11 -0
  287. package/target/main/ts/report/html/app/viewer-profile-badges.js +119 -0
  288. package/target/main/ts/report/html/app/viewer-profile-table.d.ts +29 -0
  289. package/target/main/ts/report/html/app/viewer-profile-table.js +124 -0
  290. package/target/main/ts/report/html/app/viewer-profile.d.ts +13 -0
  291. package/target/main/ts/report/html/app/viewer-profile.js +180 -0
  292. package/target/main/ts/report/html/app/viewer-projects.d.ts +1 -0
  293. package/target/main/ts/report/html/app/viewer-projects.js +90 -0
  294. package/target/main/ts/report/html/app/viewer-pull-sections.d.ts +4 -0
  295. package/target/main/ts/report/html/app/viewer-pull-sections.js +118 -0
  296. package/target/main/ts/report/html/app/viewer-pull-trend.d.ts +5 -0
  297. package/target/main/ts/report/html/app/viewer-pull-trend.js +63 -0
  298. package/target/main/ts/report/html/app/viewer-pulls.d.ts +2 -0
  299. package/target/main/ts/report/html/app/viewer-pulls.js +92 -0
  300. package/target/main/ts/report/html/app/viewer-query-field.d.ts +19 -0
  301. package/target/main/ts/report/html/app/viewer-query-field.js +203 -0
  302. package/target/main/ts/report/html/app/viewer-route.d.ts +34 -0
  303. package/target/main/ts/report/html/app/viewer-route.js +55 -0
  304. package/target/main/ts/report/html/app/viewer-shell.d.ts +20 -0
  305. package/target/main/ts/report/html/app/viewer-shell.js +113 -0
  306. package/target/main/ts/report/html/app/viewer-source-view.d.ts +49 -0
  307. package/target/main/ts/report/html/app/viewer-source-view.js +150 -0
  308. package/target/main/ts/report/html/app/viewer-source.d.ts +27 -0
  309. package/target/main/ts/report/html/app/viewer-source.js +57 -0
  310. package/target/main/ts/report/html/app/viewer-suggest.d.ts +13 -0
  311. package/target/main/ts/report/html/app/viewer-suggest.js +91 -0
  312. package/target/main/ts/report/html/app/viewer-sunburst.d.ts +5 -0
  313. package/target/main/ts/report/html/app/viewer-sunburst.js +40 -0
  314. package/target/main/ts/report/html/app/viewer-table-cells.d.ts +25 -0
  315. package/target/main/ts/report/html/app/viewer-table-cells.js +135 -0
  316. package/target/main/ts/report/html/app/viewer-table-rows.d.ts +56 -0
  317. package/target/main/ts/report/html/app/viewer-table-rows.js +97 -0
  318. package/target/main/ts/report/html/app/viewer-tokenizer.d.ts +15 -0
  319. package/target/main/ts/report/html/app/viewer-tokenizer.js +241 -0
  320. package/target/main/ts/report/html/app/viewer-totals.d.ts +20 -0
  321. package/target/main/ts/report/html/app/viewer-totals.js +100 -0
  322. package/target/main/ts/report/html/app/viewer-treemap.d.ts +24 -0
  323. package/target/main/ts/report/html/app/viewer-treemap.js +112 -0
  324. package/target/main/ts/report/html/app/viewer-trend-data.d.ts +54 -0
  325. package/target/main/ts/report/html/app/viewer-trend-data.js +109 -0
  326. package/target/main/ts/report/html/app/viewer-trend-nav.d.ts +5 -0
  327. package/target/main/ts/report/html/app/viewer-trend-nav.js +86 -0
  328. package/target/main/ts/report/html/app/viewer-trend-points.d.ts +30 -0
  329. package/target/main/ts/report/html/app/viewer-trend-points.js +128 -0
  330. package/target/main/ts/report/html/app/viewer-trend-series.d.ts +32 -0
  331. package/target/main/ts/report/html/app/viewer-trend-series.js +128 -0
  332. package/target/main/ts/report/html/app/viewer-trends.d.ts +5 -0
  333. package/target/main/ts/report/html/app/viewer-trends.js +89 -0
  334. package/target/main/ts/report/html/app/viewer.d.ts +1 -0
  335. package/target/main/ts/report/html/app/viewer.js +222 -0
  336. package/target/main/ts/report/html/site/badges.d.ts +11 -0
  337. package/target/main/ts/report/html/site/badges.js +72 -0
  338. package/target/main/ts/report/html/site/export-site.d.ts +16 -0
  339. package/target/main/ts/report/html/site/export-site.js +129 -0
  340. package/target/main/ts/report/html/site/exported-server.d.ts +6 -0
  341. package/target/main/ts/report/html/site/exported-server.js +72 -0
  342. package/target/main/ts/report/html/site/local-server.d.ts +7 -0
  343. package/target/main/ts/report/html/site/local-server.js +59 -0
  344. package/target/main/ts/report/html/site/projects.d.ts +1 -0
  345. package/target/main/ts/report/html/site/projects.js +69 -0
  346. package/target/main/ts/report/html/site/server.d.ts +4 -0
  347. package/target/main/ts/report/html/site/server.js +65 -0
  348. package/target/main/ts/report/html/site/source-route.d.ts +6 -0
  349. package/target/main/ts/report/html/site/source-route.js +23 -0
  350. package/target/main/ts/report/json/projections/commit-summary.d.ts +13 -0
  351. package/target/main/ts/report/json/projections/commit-summary.js +125 -0
  352. package/target/main/ts/report/json/projections/components.d.ts +4 -0
  353. package/target/main/ts/report/json/projections/components.js +30 -0
  354. package/target/main/ts/report/json/projections/file-metrics.d.ts +4 -0
  355. package/target/main/ts/report/json/projections/file-metrics.js +260 -0
  356. package/target/main/ts/report/json/projections/ignore-view.d.ts +2 -0
  357. package/target/main/ts/report/json/projections/ignore-view.js +13 -0
  358. package/target/main/ts/report/json/projections/inspection-context.d.ts +5 -0
  359. package/target/main/ts/report/json/projections/inspection-context.js +104 -0
  360. package/target/main/ts/report/json/projections/inspection-details.d.ts +14 -0
  361. package/target/main/ts/report/json/projections/inspection-details.js +98 -0
  362. package/target/main/ts/report/json/projections/metric-values.d.ts +14 -0
  363. package/target/main/ts/report/json/projections/metric-values.js +104 -0
  364. package/target/main/ts/report/json/projections/profile-selectors.d.ts +8 -0
  365. package/target/main/ts/report/json/projections/profile-selectors.js +34 -0
  366. package/target/main/ts/report/json/projections/security-summary.d.ts +11 -0
  367. package/target/main/ts/report/json/projections/security-summary.js +22 -0
  368. package/target/main/ts/report/json/store/directory.d.ts +3 -0
  369. package/target/main/ts/report/json/store/directory.js +19 -0
  370. package/target/main/ts/report/json/store/local-store.d.ts +25 -0
  371. package/target/main/ts/report/json/store/local-store.js +214 -0
  372. package/target/main/ts/report/json/store/object-store.d.ts +14 -0
  373. package/target/main/ts/report/json/store/object-store.js +73 -0
  374. package/target/main/ts/report/json/store/operation-cache.d.ts +8 -0
  375. package/target/main/ts/report/json/store/operation-cache.js +32 -0
  376. package/target/main/ts/report/json/store/pull-review-store.d.ts +2 -0
  377. package/target/main/ts/report/json/store/pull-review-store.js +33 -0
  378. package/target/main/ts/report/json/store/replace-file.d.ts +1 -0
  379. package/target/main/ts/report/json/store/replace-file.js +35 -0
  380. package/target/main/ts/report/json/store/report-tree.d.ts +46 -0
  381. package/target/main/ts/report/json/store/report-tree.js +295 -0
  382. package/target/main/ts/report/json/store/store-check.d.ts +32 -0
  383. package/target/main/ts/report/json/store/store-check.js +153 -0
  384. package/target/main/ts/report/json/validation/metabranch.d.ts +4 -0
  385. package/target/main/ts/report/json/validation/metabranch.js +11 -0
  386. package/target/main/ts/report/json/validation/report.d.ts +20 -0
  387. package/target/main/ts/report/json/validation/report.js +77 -0
  388. package/target/main/ts/report/json/validation/summary-validation.d.ts +4 -0
  389. package/target/main/ts/report/json/validation/summary-validation.js +26 -0
  390. package/target/main/ts/report/json/wire/compact-json.d.ts +11 -0
  391. package/target/main/ts/report/json/wire/compact-json.js +76 -0
  392. package/target/main/ts/report/json/wire/component-model.d.ts +9 -0
  393. package/target/main/ts/report/json/wire/component-model.js +1 -0
  394. package/target/main/ts/report/json/wire/domain-types.d.ts +2 -0
  395. package/target/main/ts/report/json/wire/domain-types.js +1 -0
  396. package/target/main/ts/report/json/wire/file-metrics-model.d.ts +81 -0
  397. package/target/main/ts/report/json/wire/file-metrics-model.js +1 -0
  398. package/target/main/ts/report/json/wire/inspection-context-model.d.ts +31 -0
  399. package/target/main/ts/report/json/wire/inspection-context-model.js +1 -0
  400. package/target/main/ts/report/json/wire/inspection-details-model.d.ts +87 -0
  401. package/target/main/ts/report/json/wire/inspection-details-model.js +1 -0
  402. package/target/main/ts/report/json/wire/project-model.d.ts +7 -0
  403. package/target/main/ts/report/json/wire/project-model.js +1 -0
  404. package/target/main/ts/report/json/wire/public-history-model.d.ts +36 -0
  405. package/target/main/ts/report/json/wire/public-history-model.js +5 -0
  406. package/target/main/ts/report/json/wire/pull-review-model.d.ts +54 -0
  407. package/target/main/ts/report/json/wire/pull-review-model.js +3 -0
  408. package/target/main/ts/report/json/wire/summary-model.d.ts +45 -0
  409. package/target/main/ts/report/json/wire/summary-model.js +1 -0
  410. package/target/main/ts/report/markdown/pull-review.d.ts +5 -0
  411. package/target/main/ts/report/markdown/pull-review.js +132 -0
  412. package/target/main/ts/report.d.ts +23 -0
  413. package/target/main/ts/report.js +12 -0
  414. package/target/main/ts/runtime.d.ts +17 -0
  415. package/target/main/ts/runtime.js +30 -0
@@ -0,0 +1,71 @@
1
+ import { dirname, resolve } from 'node:path';
2
+ import { builtInPlugins } from './built-ins.js';
3
+ import { installedModule, javaScriptManifest, localModule } from './js-plugin.js';
4
+ import { validatePluginOptions } from './plugin-options.js';
5
+ import { dockerPluginFile, dockerPluginImage } from './process-plugins.js';
6
+ import { registeredPlugin } from './registered-plugin.js';
7
+ import { slimDistribution } from './distribution.js';
8
+ export async function loadPlugins(entries, root, configFile, metadataOnly = false, distribution = slimDistribution) {
9
+ const plugins = [];
10
+ const configured = new Map();
11
+ const builtIns = new Map([...builtInPlugins, ...distribution.bundled].map(plugin => [plugin.id, plugin]));
12
+ const folder = configFile === undefined ? root : dirname(configFile);
13
+ for (const [index, input] of entries.entries()) {
14
+ const base = 'Config plugins/' + index;
15
+ const entry = referenceOf(input);
16
+ const { use, include, exclude } = entry;
17
+ const { plugin, builtIn, versionSource, include: defaultInclude, exclude: defaultExclude, requires, image } = await resolvePlugin(input, entry, folder, { root, base, metadataOnly, distribution }, builtIns);
18
+ const previous = configured.get(plugin.id) ?? (!builtIn && builtIns.has(plugin.id) ? plugin.id + ' (built-in)' : undefined);
19
+ if (previous !== undefined)
20
+ throw new Error(base + ' plugin ' + plugin.id + ' from ' + use + ' duplicates ' + previous);
21
+ configured.set(plugin.id, use);
22
+ plugins.push(registeredPlugin(plugin, { use, include: include ?? defaultInclude, exclude: exclude ?? defaultExclude,
23
+ builtIn, versionSource, requires, image }));
24
+ }
25
+ return withBundled(distribution, plugins);
26
+ }
27
+ function withBundled({ bundled }, plugins) {
28
+ if (bundled.length === 0)
29
+ return [...plugins];
30
+ const byId = new Map(plugins.map(plugin => [plugin.id, plugin]));
31
+ const defaults = bundled.map(plugin => {
32
+ const configured = byId.get(plugin.id);
33
+ byId.delete(plugin.id);
34
+ return configured ?? registeredPlugin(plugin, { use: plugin.id, builtIn: true, versionSource: 'built-in' });
35
+ });
36
+ return [...defaults, ...byId.values()];
37
+ }
38
+ function referenceOf(input) {
39
+ if (typeof input === 'string')
40
+ return { use: input };
41
+ return 'use' in input ? input : { use: 'manifest:' + input.id };
42
+ }
43
+ async function resolvePlugin(input, entry, folder, context, builtIns) {
44
+ const { use } = entry;
45
+ const { base } = context;
46
+ if (typeof input === 'object' && !('use' in input)) {
47
+ return { ...await javaScriptManifest(input, entry, context), builtIn: false };
48
+ }
49
+ if (use.startsWith('docker:')) {
50
+ return { ...await dockerPluginImage(use.slice(7), entry, { base, packageUrl: context.distribution?.packageUrl }), builtIn: false };
51
+ }
52
+ if (use.startsWith('./') || use.startsWith('../') || use.startsWith('/')) {
53
+ const path = resolve(folder, use);
54
+ if (path.endsWith('.json')) {
55
+ return { ...await dockerPluginFile(path, entry, { base, packageUrl: context.distribution?.packageUrl }), builtIn: false };
56
+ }
57
+ return { ...await localModule(path, entry, context), builtIn: false };
58
+ }
59
+ const pkg = use.startsWith('npm:') ? use.slice(4) : use;
60
+ const alias = pkg.startsWith('@repometry/language-') ? builtIns.get(pkg.slice('@repometry/'.length)) : undefined;
61
+ const builtIn = builtIns.get(use) ?? alias;
62
+ if (builtIn !== undefined) {
63
+ validatePluginOptions(builtIn.config, entry.options, base);
64
+ return { plugin: builtIn, versionSource: 'built-in', builtIn: true, include: undefined, exclude: undefined, requires: undefined };
65
+ }
66
+ const installed = await installedModule(pkg, entry, context);
67
+ const plugin = pkg.startsWith('@repometry/language-') && pkg === '@repometry/' + installed.plugin.id
68
+ ? { ...installed.plugin, languageProvenanceRequiresSource: true } : installed.plugin;
69
+ return { ...installed, plugin, builtIn: false };
70
+ }
71
+ //# sourceMappingURL=load-plugins.js.map
@@ -0,0 +1,20 @@
1
+ import type { Plugin } from '@repometry/core/internal/engine/plugin.js';
2
+ import type { LanguageSyntax, ProvidedLanguage } from '@repometry/core/internal/model/language.js';
3
+ export interface ParserPlugin extends Plugin {
4
+ readonly unavailableReason?: string;
5
+ }
6
+ export type ParserOrder = Readonly<Record<string, readonly string[]>>;
7
+ type Candidate = {
8
+ readonly plugin: ParserPlugin;
9
+ readonly language: ProvidedLanguage;
10
+ };
11
+ export declare function readParserOrder(value: unknown, label?: string): ParserOrder | undefined;
12
+ export declare function selectParsers(plugins: readonly ParserPlugin[], order: ParserOrder | undefined, label: string): {
13
+ selection: Map<string, Candidate>;
14
+ competing: Set<string>;
15
+ };
16
+ export declare function inspectionClaims({ claims, providesLanguages }: Plugin): Plugin['claims'];
17
+ export declare function selectedSyntax(selection: ReadonlyMap<string, Candidate>): Map<string, LanguageSyntax>;
18
+ /** Uncontested declarations keep their existing report bytes. Contested parsers record their effective scope. */
19
+ export declare function describeProvider(plugin: ParserPlugin, assignments: ReadonlyMap<string, readonly ProvidedLanguage[]>, competing: ReadonlySet<string>): ParserPlugin;
20
+ export {};
@@ -0,0 +1,90 @@
1
+ import { isRecord } from '@repometry/core/internal/engine/plugin.js';
2
+ const languageId = /^[a-z][a-z0-9-]*$/;
3
+ export function readParserOrder(value, label = 'parsers') {
4
+ if (value === undefined)
5
+ return undefined;
6
+ if (!isRecord(value))
7
+ throw new Error(label + ' must map language IDs to lists of plugin IDs');
8
+ for (const [id, names] of Object.entries(value)) {
9
+ if (!languageId.test(id))
10
+ throw new Error(label + '/' + id + ' must use a language ID');
11
+ if (!Array.isArray(names) || !names.length || !names.every(name => typeof name === 'string' && name.length > 0)
12
+ || new Set(names).size !== names.length) {
13
+ throw new Error(label + '/' + id + ' must be a nonempty list of unique plugin IDs');
14
+ }
15
+ }
16
+ return value;
17
+ }
18
+ export function selectParsers(plugins, order, label) {
19
+ const providers = languageCandidates(plugins);
20
+ const known = new Set(plugins.map(({ id }) => id));
21
+ const competing = new Set([...providers.values()].filter(candidates => candidates.length > 1).flatMap(candidates => candidates.map(({ plugin }) => plugin.id)));
22
+ const selection = new Map();
23
+ const configured = readParserOrder(order, label) ?? {};
24
+ for (const id of Object.keys(configured).sort()) {
25
+ const options = providers.get(id);
26
+ if (!options)
27
+ throw new Error(label + '/' + id + ' names an unknown language');
28
+ const candidates = configured[id].map((name, index) => matchParser(options, known, name, id, label + '/' + id + '/' + index));
29
+ selection.set(id, candidates.find(({ plugin }) => plugin.unavailableReason === undefined) ?? candidates[0]);
30
+ }
31
+ for (const [id, candidates] of providers) {
32
+ if (selection.has(id))
33
+ continue;
34
+ if (candidates.length > 1) {
35
+ throw new Error(label + '/' + id + ' is required to choose among ' + candidates.map(({ plugin }) => plugin.id).join(', '));
36
+ }
37
+ selection.set(id, candidates[0]);
38
+ }
39
+ return { selection, competing };
40
+ }
41
+ export function inspectionClaims({ claims, providesLanguages }) {
42
+ return claims ?? (providesLanguages && claimsForLanguages(providesLanguages));
43
+ }
44
+ export function selectedSyntax(selection) {
45
+ const syntax = new Map();
46
+ for (const [id, { language }] of selection)
47
+ if (language.syntax !== undefined)
48
+ syntax.set(id, language.syntax);
49
+ return syntax;
50
+ }
51
+ /** Uncontested declarations keep their existing report bytes. Contested parsers record their effective scope. */
52
+ export function describeProvider(plugin, assignments, competing) {
53
+ if (!competing.has(plugin.id))
54
+ return plugin;
55
+ const chosen = assignments.get(plugin.id);
56
+ const providesLanguages = plugin.providesLanguages?.filter(language => chosen?.includes(language));
57
+ if (providesLanguages?.length) {
58
+ const claims = { languages: providesLanguages.map(({ id }) => id), ...claimsForLanguages(providesLanguages) };
59
+ return { ...plugin, claims, providesLanguages };
60
+ }
61
+ const claims = plugin.operations.some(({ role }) => role === 'inspection') ? inspectionClaims(plugin) : undefined;
62
+ return { ...plugin, claims, providesLanguages: undefined };
63
+ }
64
+ function claimsForLanguages(languages) {
65
+ return {
66
+ extensions: [...new Set(languages.flatMap(language => language.extensions ?? []))],
67
+ globs: [...new Set(languages.flatMap(language => language.globs ?? []))],
68
+ };
69
+ }
70
+ function languageCandidates(plugins) {
71
+ const providers = new Map();
72
+ for (const plugin of plugins.filter(candidate => candidate.kinds.includes('language'))) {
73
+ const languages = plugin.providesLanguages ?? [];
74
+ for (const language of languages) {
75
+ const candidates = providers.get(language.id) ?? [];
76
+ candidates.push({ plugin, language });
77
+ providers.set(language.id, candidates);
78
+ }
79
+ }
80
+ return providers;
81
+ }
82
+ function matchParser(options, known, name, id, path) {
83
+ const candidate = options.find(({ plugin }) => plugin.id === name);
84
+ if (candidate)
85
+ return candidate;
86
+ const available = '; ' + id + ' is provided by ' + options.map(({ plugin }) => plugin.id).join(', ');
87
+ const problem = known.has(name) ? ' names plugin ' + name + ', which does not provide ' + id : ' names unknown plugin ' + name;
88
+ throw new Error(path + problem + available);
89
+ }
90
+ //# sourceMappingURL=parser-order.js.map
@@ -0,0 +1,140 @@
1
+ import type { DataContract, Operation, Plugin } from '@repometry/core/internal/engine/plugin.js';
2
+ import type { SourceFile, SourceSnapshot } from '@repometry/core/internal/model/source.js';
3
+ import type { LanguageProvider, LanguageRegistry } from './languages.js';
4
+ /**
5
+ * A phase of a run: the host inputs it offers by external port name, and what one of its tasks covers: one file, the files
6
+ * one plugin claims, or the whole run once. An operation runs only where the task matches its scope; a run task takes any.
7
+ */
8
+ export type Phase = Readonly<{
9
+ offers: Readonly<Record<string, DataContract>>;
10
+ task: 'file' | 'repository' | 'run';
11
+ }>;
12
+ /** The phases of an analysis in run order. The coverage input is offered only when coverage is given. */
13
+ export declare function analysisPhases(withCoverage: boolean): {
14
+ readonly files: {
15
+ readonly task: 'file';
16
+ readonly offers: {
17
+ readonly file: DataContract<SourceFile>;
18
+ readonly syntax: DataContract<import("@repometry/core/internal/model/code-structure.js").CodeStructure>;
19
+ };
20
+ };
21
+ readonly repository: {
22
+ readonly task: 'repository';
23
+ readonly offers: {
24
+ readonly files: DataContract<readonly SourceFile[]>;
25
+ };
26
+ };
27
+ readonly afterFiles: {
28
+ readonly task: 'run';
29
+ readonly offers: {
30
+ readonly sources: DataContract<readonly import("@repometry/core/internal/model/clone-source.js").CloneSource[]>;
31
+ readonly lcov?: DataContract<import("@repometry/core/internal/model/coverage-input.js").CoverageInput> | undefined;
32
+ };
33
+ };
34
+ };
35
+ /** The one phase of a diff coverage run. */
36
+ export declare const diffCoveragePhases: {
37
+ readonly changedLines: {
38
+ readonly task: 'run';
39
+ readonly offers: {
40
+ readonly changes: DataContract<import("@repometry/core/internal/model/changes.js").GitChanges>;
41
+ readonly lcov: DataContract<import("@repometry/core/internal/model/coverage-input.js").CoverageInput>;
42
+ };
43
+ };
44
+ };
45
+ export type ActiveOperation = Readonly<{
46
+ plugin: Plugin;
47
+ operation: Operation;
48
+ key: string;
49
+ }>;
50
+ /**
51
+ * The one rule for every plugin. An input is satisfied in a phase by a host input the phase offers, or by the output of
52
+ * any operation satisfied in that phase; more than one candidate is the planner's ambiguity. An operation runs in the
53
+ * first phase of this run that satisfies all its inputs. One that no phase of any run satisfies is an error; one that
54
+ * only another run, or this run with coverage, satisfies is inactive here. Host contracts come from the host only: no
55
+ * operation outputs one, except the parse of a language provider (`parsers`, by key), which is how the host gets it.
56
+ */
57
+ export declare function selectOperations<Name extends string>(plugins: readonly Plugin[], phases: Readonly<Record<Name, Phase>>, parsers: ReadonlySet<string>): Record<Name, Readonly<{
58
+ plugin: Plugin;
59
+ operation: Operation;
60
+ key: string;
61
+ }>[]>;
62
+ /** An active inspection and the files it runs on: those its plugin claims, and only parsed ones when it reads code structure. */
63
+ export type Inspection = ActiveOperation & {
64
+ readonly parsed: boolean;
65
+ readonly matches: (path: string, parsed: boolean) => boolean;
66
+ };
67
+ /** One step of the pipeline: the plugins the planner may choose from, and the inspections to plan. */
68
+ export type Step = Readonly<{
69
+ candidates: readonly Plugin[];
70
+ inspections: readonly Inspection[];
71
+ }>;
72
+ /** The plugins restricted to the given operations, in their order, for the planner to choose from. */
73
+ export declare function candidatesOf(operations: readonly ActiveOperation[], matches?: ReadonlyMap<string, (path: string) => boolean>): Plugin[];
74
+ /** The external inputs of a phase as the planner reads them, by port name. */
75
+ export declare function phaseInputs({ offers }: Phase, omit?: DataContract): ReadonlyMap<string, string>;
76
+ export type SelectedSource = Readonly<{
77
+ file: SourceFile;
78
+ provider: LanguageProvider | undefined;
79
+ }>;
80
+ /** Whether a file is claimed by an inspection that runs on claimed files rather than on every parsed one. */
81
+ export declare function inspectionFileMatcher(languages: LanguageRegistry): (path: string) => boolean;
82
+ /** The files of a snapshot with their language providers, and the steps that analyse them. */
83
+ export declare function selectAnalysisSources(snapshot: SourceSnapshot, withCoverage: boolean, languages: LanguageRegistry): {
84
+ languages: {
85
+ select: (path: string) => LanguageProvider | undefined;
86
+ isSource: (path: string) => boolean;
87
+ id: (path: string) => string;
88
+ extensions: string[];
89
+ globs: string[];
90
+ catalog: {
91
+ id: string;
92
+ label: string;
93
+ color?: string | undefined;
94
+ }[];
95
+ providers: LanguageProvider[];
96
+ plugins: readonly import("./parser-order.js").ParserPlugin[];
97
+ reportSelection: (present: ReadonlySet<string>) => {
98
+ extensions: string[];
99
+ globs: string[];
100
+ catalog: {
101
+ id: string;
102
+ label: string;
103
+ color?: string | undefined;
104
+ }[];
105
+ };
106
+ describe: (plugin: import("./parser-order.js").ParserPlugin) => import("./parser-order.js").ParserPlugin;
107
+ syntax: (id: string) => import("@repometry/core").LanguageSyntax | undefined;
108
+ skipped: (path: string) => boolean;
109
+ };
110
+ sources: Readonly<{
111
+ file: SourceFile;
112
+ provider: LanguageProvider | undefined;
113
+ }>[];
114
+ sourceFiles: SourceFile[];
115
+ unavailableFiles: Set<string>;
116
+ providersByPath: Map<string, LanguageProvider>;
117
+ steps: {
118
+ plugins: Plugin[];
119
+ repositorySyntax: {
120
+ candidates: readonly Plugin[];
121
+ inspections: readonly Inspection[];
122
+ provider: LanguageProvider;
123
+ }[];
124
+ files: Readonly<{
125
+ candidates: readonly Plugin[];
126
+ inspections: readonly Inspection[];
127
+ }>;
128
+ repository: Readonly<{
129
+ candidates: readonly Plugin[];
130
+ inspections: readonly Inspection[];
131
+ }>;
132
+ afterFiles: Readonly<{
133
+ candidates: readonly Plugin[];
134
+ inspections: readonly Inspection[];
135
+ }>;
136
+ claims: (plugin: Plugin, path: string) => boolean;
137
+ };
138
+ plugins: Plugin[];
139
+ };
140
+ export type AnalysisSources = ReturnType<typeof selectAnalysisSources>;
@@ -0,0 +1,147 @@
1
+ import { changesInput } from '@repometry/core/internal/model/changes.js';
2
+ import { cloneSources } from '@repometry/core/internal/model/clone-source.js';
3
+ import { codeStructure, codeStructures } from '@repometry/core/internal/model/code-structure.js';
4
+ import { lcovInput } from '@repometry/core/internal/model/coverage-input.js';
5
+ import { sourceFile, sourceFiles } from '@repometry/core/internal/model/snapshot.js';
6
+ import { builtInPluginIds } from './built-ins.js';
7
+ import { claimMatcher } from './languages.js';
8
+ import { inspectionClaims } from './parser-order.js';
9
+ import { scopedMatcher, scopeOperation } from './plugin-scope.js';
10
+ /** The phases of an analysis in run order. The coverage input is offered only when coverage is given. */
11
+ export function analysisPhases(withCoverage) {
12
+ return {
13
+ files: { task: 'file', offers: { file: sourceFile, syntax: codeStructure } },
14
+ repository: { task: 'repository', offers: { files: sourceFiles } },
15
+ afterFiles: { task: 'run', offers: { sources: cloneSources, ...(withCoverage ? { lcov: lcovInput } : {}) } },
16
+ };
17
+ }
18
+ /** The one phase of a diff coverage run. */
19
+ export const diffCoveragePhases = { changedLines: { task: 'run', offers: { changes: changesInput, lcov: lcovInput } } };
20
+ /** The phases of each kind of run, with all their optional host inputs. Every plugin takes part in an analysis; only built-ins in diff coverage. */
21
+ const analysisRun = Object.values(analysisPhases(true));
22
+ const diffCoverageRun = Object.values(diffCoveragePhases);
23
+ /** The closed list of host contracts: every contract some host run offers. */
24
+ const hostContracts = new Set([...analysisRun, ...diffCoverageRun].flatMap(({ offers }) => Object.values(offers).map(({ id }) => id)));
25
+ // Reserve both parse outputs. The host supplies per-file structure directly to phases.
26
+ const languageOutputs = new Set([codeStructure.id, codeStructures.id]);
27
+ /**
28
+ * The one rule for every plugin. An input is satisfied in a phase by a host input the phase offers, or by the output of
29
+ * any operation satisfied in that phase; more than one candidate is the planner's ambiguity. An operation runs in the
30
+ * first phase of this run that satisfies all its inputs. One that no phase of any run satisfies is an error; one that
31
+ * only another run, or this run with coverage, satisfies is inactive here. Host contracts come from the host only: no
32
+ * operation outputs one, except the parse of a language provider (`parsers`, by key), which is how the host gets it.
33
+ */
34
+ export function selectOperations(plugins, phases, parsers) {
35
+ const all = plugins.flatMap(plugin => plugin.operations.map(operation => ({ plugin, operation, key: `${plugin.id}/${operation.id}` })));
36
+ const supplier = all.find(({ key, operation: { output } }) => (hostContracts.has(output.id) || languageOutputs.has(output.id)) && !parsers.has(key));
37
+ if (supplier) {
38
+ const { id } = supplier.operation.output;
39
+ const only = languageOutputs.has(id) ? 'a language provider' : 'the host';
40
+ throw new Error(`${supplier.key} outputs ${id}, which only ${only} supplies`);
41
+ }
42
+ rejectUnsatisfiable(all);
43
+ const selected = {};
44
+ let waiting = all;
45
+ for (const [name, phase] of Object.entries(phases)) {
46
+ selected[name] = satisfiedIn(phase, waiting);
47
+ waiting = waiting.filter(candidate => !selected[name].includes(candidate));
48
+ }
49
+ return selected;
50
+ }
51
+ /** The operations a phase satisfies: those of its task's scope whose inputs it offers or satisfied operations output. */
52
+ function satisfiedIn(phase, candidates) {
53
+ const inScope = candidates.filter(({ operation }) => [operation.scope ?? 'file', 'run'].includes(phase.task));
54
+ return reached(inScope, Object.values(phase.offers).map(({ id }) => id), 'every');
55
+ }
56
+ /** The operations reached from some contracts: each reads every (or some) of its inputs from them or from earlier ones' outputs. */
57
+ function reached(operations, contracts, reads, found = []) {
58
+ const next = operations.filter(item => !found.includes(item) && Object.values(item.operation.inputs)[reads](({ id }) => contracts.includes(id)));
59
+ if (!next.length)
60
+ return operations.filter(item => found.includes(item));
61
+ return reached(operations, [...contracts, ...next.map(({ operation }) => operation.output.id)], reads, [...found, ...next]);
62
+ }
63
+ /** Rejects an operation that no phase satisfies in any run its plugin takes part in, naming the root cause first. */
64
+ function rejectUnsatisfiable(all) {
65
+ const satisfiable = new Set([...analysisRun.flatMap(phase => satisfiedIn(phase, all)),
66
+ ...diffCoverageRun.flatMap(phase => satisfiedIn(phase, all.filter(({ plugin }) => builtInPluginIds.has(plugin.id))))]);
67
+ const unsatisfiable = all.filter(candidate => !satisfiable.has(candidate));
68
+ const ids = (contracts) => [...contracts].map(({ id }) => id);
69
+ const known = [...hostContracts, ...ids(all.map(({ operation }) => operation.output))];
70
+ const reachable = [...hostContracts, ...ids([...satisfiable].map(({ operation }) => operation.output))];
71
+ const unread = ({ operation }, offered) => ids(Object.values(operation.inputs)).filter(id => !offered.includes(id));
72
+ const unknown = unsatisfiable.find(candidate => unread(candidate, known).length);
73
+ if (unknown)
74
+ throw new Error(`${unknown.key} reads ${unread(unknown, known).join(', ')}, which no plugin outputs`);
75
+ // The root cause before what depends on it: an operation whose inputs are all on offer, but in no single phase.
76
+ const root = unsatisfiable.find(candidate => !unread(candidate, reachable).length);
77
+ if (root)
78
+ throw new Error(`${root.key} reads ${ids(Object.values(root.operation.inputs)).join(', ')}, which no phase of its runs offers together`);
79
+ // What is left reads only the products of unsatisfiable operations, as in a dependency cycle.
80
+ const [dependent] = unsatisfiable;
81
+ if (dependent)
82
+ throw new Error(`${dependent.key} reads ${unread(dependent, reachable).join(', ')}, which only operations that never run output`);
83
+ }
84
+ /** What runs where in an analysis: the active plugins and the four steps. */
85
+ function analysisSteps(plugins, languages, withCoverage) {
86
+ const { files, repository, afterFiles } = selectOperations(plugins, analysisPhases(withCoverage), new Set(languages.providers.map(({ key }) => key)));
87
+ // Those that read the code structure, directly or through the products of others, run on the parsed files their plugin claims.
88
+ const readers = new Set(reached(files, [codeStructure.id], 'some'));
89
+ const claims = new Map(plugins.map(plugin => [plugin.id, claimsOf(plugin, languages)]));
90
+ const step = (operations) => ({ candidates: candidatesOf(operations, claims),
91
+ inspections: operations.filter(({ operation }) => operation.role === 'inspection').map(active => ({ ...active, parsed: readers.has(active),
92
+ matches: (path, isParsed) => (!readers.has(active) || isParsed) && claims.get(active.plugin.id)(path) })) });
93
+ const parsers = repositoryParsers(plugins, languages);
94
+ const active = new Set([...files, ...repository, ...afterFiles].map(({ plugin }) => plugin));
95
+ return {
96
+ plugins: plugins.filter(plugin => active.has(plugin)),
97
+ repositorySyntax: [...parsers].map(([plugin, provider]) => ({ provider, ...step(repository.filter(operation => operation.plugin === plugin)) })),
98
+ files: step(files),
99
+ repository: step(repository.filter(({ plugin }) => !parsers.has(plugin))),
100
+ afterFiles: step(afterFiles),
101
+ claims: (plugin, path) => claims.get(plugin.id)(path),
102
+ };
103
+ }
104
+ /** Plugins that parse a language over the whole repository: their repository operations run first, since the files read the structures. */
105
+ function repositoryParsers(plugins, languages) {
106
+ return new Map(plugins.flatMap(plugin => languages.providers.filter(provider => provider.batch && provider.plugin === plugin)
107
+ .map(provider => [plugin, provider])));
108
+ }
109
+ /** A chosen parser inspects its parsed files. Other inspections use their plugin's claims. */
110
+ function claimsOf(plugin, languages) {
111
+ return languages.providers.some(provider => provider.plugin === plugin)
112
+ ? path => languages.select(path)?.plugin === plugin : scopedMatcher(plugin, claimMatcher(inspectionClaims(plugin), languages.id));
113
+ }
114
+ /** The plugins restricted to the given operations, in their order, for the planner to choose from. */
115
+ export function candidatesOf(operations, matches) {
116
+ const byPlugin = new Map();
117
+ for (const { plugin, operation } of operations)
118
+ byPlugin.set(plugin, [...byPlugin.get(plugin) ?? [], operation]);
119
+ return [...byPlugin].map(([plugin, chosen]) => bindOperations(plugin, chosen, matches?.get(plugin.id)));
120
+ }
121
+ function bindOperations(plugin, chosen, matches) {
122
+ const operations = matches ? chosen.map(operation => scopeOperation(plugin, operation, matches)) : chosen;
123
+ if (operations.length === plugin.operations.length && operations.every((operation, index) => operation === plugin.operations[index]))
124
+ return plugin;
125
+ return { ...plugin, operations };
126
+ }
127
+ /** The external inputs of a phase as the planner reads them, by port name. */
128
+ export function phaseInputs({ offers }, omit) {
129
+ return new Map(Object.entries(offers).filter(([, contract]) => contract !== omit).map(([port, { id }]) => [port, id]));
130
+ }
131
+ /** Whether a file is claimed by an inspection that runs on claimed files rather than on every parsed one. */
132
+ export function inspectionFileMatcher(languages) {
133
+ const { files, repository } = analysisSteps(languages.plugins, languages, false);
134
+ const claimed = [...files.inspections, ...repository.inspections].filter(({ parsed }) => !parsed);
135
+ return path => claimed.some(({ matches }) => matches(path, false));
136
+ }
137
+ /** The files of a snapshot with their language providers, and the steps that analyse them. */
138
+ export function selectAnalysisSources(snapshot, withCoverage, languages) {
139
+ const sources = snapshot.files.map(file => ({ file, provider: languages.select(file.path) }));
140
+ const providersByPath = new Map(sources.flatMap(({ file, provider }) => provider ? [[file.path, provider]] : []));
141
+ const unavailableFiles = new Set(sources.filter(({ file, provider }) => !provider && languages.skipped(file.path))
142
+ .map(({ file }) => file.path));
143
+ const sourceFiles = sources.flatMap(({ file, provider }) => provider ? [file] : []);
144
+ const steps = analysisSteps(languages.plugins, languages, withCoverage);
145
+ return { languages, sources, sourceFiles, unavailableFiles, providersByPath, steps, plugins: steps.plugins };
146
+ }
147
+ //# sourceMappingURL=phases.js.map
@@ -0,0 +1,37 @@
1
+ import type { Plugin } from '@repometry/core/internal/engine/plugin.js';
2
+ import type { ParserOrder } from './parser-order.js';
3
+ export declare function effectivePlugins(additional: readonly Plugin[], parsers?: ParserOrder): {
4
+ id: string;
5
+ version: string;
6
+ category: import("@repometry/core/internal/model/inspection-category.js").PluginCategory;
7
+ use: string;
8
+ versionSource: string;
9
+ available: boolean;
10
+ tools?: Readonly<Record<string, string>> | undefined;
11
+ include?: readonly string[] | undefined;
12
+ languages?: {
13
+ id: string;
14
+ label: string;
15
+ color?: string;
16
+ include: readonly string[];
17
+ measures?: ("checks" | "classes" | "codeLines" | "cognitiveComplexity" | "commentLines" | "cyclomaticComplexity" | "duplication" | "functions")[] | undefined;
18
+ }[] | undefined;
19
+ checks?: {
20
+ id: string;
21
+ description?: string;
22
+ defaults?: {
23
+ readonly limit?: number;
24
+ readonly cost?: number;
25
+ };
26
+ measure?: string;
27
+ per?: readonly [singular: string, plural: string];
28
+ }[] | undefined;
29
+ optionsSchema?: import("@repometry/core/internal/engine/plugin.js").PluginConfigSchema | undefined;
30
+ requires?: {
31
+ readonly node?: string;
32
+ readonly repometry?: string;
33
+ readonly tools?: readonly string[];
34
+ } | undefined;
35
+ exclude?: readonly string[] | undefined;
36
+ reason?: string | undefined;
37
+ }[];
@@ -0,0 +1,30 @@
1
+ import { pluginCategory } from '@repometry/core/internal/engine/plugin-manifest.js';
2
+ import { selectParsers } from './parser-order.js';
3
+ import { registeredPlugins } from './built-ins.js';
4
+ import { pluginRegistration } from './registered-plugin.js';
5
+ export function effectivePlugins(additional, parsers) {
6
+ const plugins = registeredPlugins(additional);
7
+ selectParsers(plugins, parsers, 'Config parsers');
8
+ return plugins.map(describePlugin);
9
+ }
10
+ function describePlugin(plugin) {
11
+ const { id, version, claims, providesLanguages, unavailableReason, config, rules, tools } = plugin;
12
+ const category = pluginCategory(plugin);
13
+ const registration = pluginRegistration(plugin);
14
+ const include = registration?.include ?? includeGlobs(claims);
15
+ return { id, version, category, use: registration?.use ?? id,
16
+ versionSource: registration?.versionSource ?? 'built-in', available: unavailableReason === undefined,
17
+ ...(category === 'language' && tools !== undefined ? { tools } : {}),
18
+ ...(include === undefined ? {} : { include }),
19
+ ...(providesLanguages ? { languages: providesLanguages.map(({ syntax, extensions, globs, measures, ...language }) => ({ ...language, include: includeGlobs({ extensions, globs }) ?? [],
20
+ ...(measures === undefined ? {} : { measures: measures.map(measure => measure === 'structuralRules' ? 'checks' : measure) }) })) } : {}),
21
+ ...(rules === undefined ? {} : { checks: rules.map(({ category, ...check }) => check) }),
22
+ ...(config === undefined ? {} : { optionsSchema: config }),
23
+ ...(registration?.requires === undefined ? {} : { requires: registration.requires }),
24
+ ...(registration?.exclude === undefined ? {} : { exclude: registration.exclude }),
25
+ ...(unavailableReason === undefined ? {} : { reason: unavailableReason }) };
26
+ }
27
+ function includeGlobs(claims) {
28
+ return claims === undefined ? undefined : [...new Set([...(claims.extensions ?? []).map(ext => '**/*' + ext), ...claims.globs ?? []])];
29
+ }
30
+ //# sourceMappingURL=plugin-list.js.map
@@ -0,0 +1,14 @@
1
+ import type { PluginManifest } from '@repometry/core/internal/engine/plugin-manifest.js';
2
+ export type Manifest = Omit<PluginManifest, 'create'> & {
3
+ readonly image?: string;
4
+ readonly command?: readonly string[];
5
+ readonly scope?: 'file' | 'repository';
6
+ readonly fileIndependent?: boolean;
7
+ readonly limits?: Readonly<Partial<Record<'timeoutMs' | 'maxOutputBytes' | 'memoryBytes' | 'pidsLimit', number>>>;
8
+ };
9
+ export declare const dockerFields: readonly ['image', 'command', 'scope', 'fileIndependent', 'limits'];
10
+ export declare function checkManifest(value: unknown, base: string): Manifest;
11
+ export declare function manifestScope({ include, exclude }: Manifest, base: string): {
12
+ include: readonly string[] | undefined;
13
+ exclude: readonly string[] | undefined;
14
+ };
@@ -0,0 +1,50 @@
1
+ import { Ajv2020 } from 'ajv/dist/2020.js';
2
+ import { pluginManifestSchema } from '@repometry/core/internal/engine/plugin-manifest.js';
3
+ import { isRecord } from '@repometry/core/internal/engine/plugin.js';
4
+ import { category } from '@repometry/core/internal/model/inspection-category.js';
5
+ import schema from '@repometry/core/plugin-v1.schema.json' with { type: 'json' };
6
+ import { schemaError } from './schema-error.js';
7
+ import { pluginPatterns } from './plugin-reference.js';
8
+ export const dockerFields = ['image', 'command', 'scope', 'fileIndependent', 'limits'];
9
+ let check;
10
+ const retiredFields = {
11
+ api: 'schema', kinds: 'category', claims: 'include', settings: 'options',
12
+ rules: 'checks', config: 'optionsSchema', providesLanguages: 'languages',
13
+ };
14
+ export function checkManifest(value, base) {
15
+ const path = base + '/manifest';
16
+ if (isRecord(value))
17
+ explainManifest(value, path);
18
+ const validate = check ??= new Ajv2020().compile(schema);
19
+ if (!validate(value))
20
+ throw schemaError(path, validate.errors?.[0]);
21
+ distinctIds(value.languages, base + '/manifest/languages');
22
+ distinctIds(value.checks, base + '/manifest/checks');
23
+ for (const [index, language] of (value.languages ?? []).entries()) {
24
+ pluginPatterns(language.include, base + '/manifest/languages/' + index + '/include');
25
+ }
26
+ return value;
27
+ }
28
+ function explainManifest(value, path) {
29
+ for (const [field, replacement] of Object.entries(retiredFields)) {
30
+ if (Object.hasOwn(value, field))
31
+ throw new Error(path + '/' + field + ' is retired. Write ' + replacement + '.');
32
+ }
33
+ if (value.schema !== pluginManifestSchema)
34
+ throw new Error(path + '/schema must be ' + pluginManifestSchema);
35
+ if (typeof value.category !== 'string' || !Object.hasOwn(category, value.category)) {
36
+ throw new Error(path + '/category must be one of ' + Object.keys(category).join(', '));
37
+ }
38
+ }
39
+ function distinctIds(entries, base) {
40
+ const ids = new Set();
41
+ for (const [index, { id }] of (entries ?? []).entries()) {
42
+ if (ids.has(id))
43
+ throw new Error(base + '/' + index + '/id duplicates ' + id);
44
+ ids.add(id);
45
+ }
46
+ }
47
+ export function manifestScope({ include, exclude }, base) {
48
+ return { include: pluginPatterns(include, base + '/manifest/include'), exclude: pluginPatterns(exclude, base + '/manifest/exclude') };
49
+ }
50
+ //# sourceMappingURL=plugin-manifest.js.map
@@ -0,0 +1,2 @@
1
+ import type { JsonValue } from '@repometry/core/internal/model/plugin-data.js';
2
+ export declare function validatePluginOptions(schema: unknown, value: JsonValue | undefined, base: string): JsonValue | undefined;
@@ -0,0 +1,29 @@
1
+ import { Ajv2020 } from 'ajv/dist/2020.js';
2
+ import { isRecord } from '@repometry/core/internal/engine/plugin.js';
3
+ import { schemaError } from './schema-error.js';
4
+ export function validatePluginOptions(schema, value, base) {
5
+ if (schema === undefined) {
6
+ if (value !== undefined)
7
+ throw new Error(base + '/options is not accepted by this plugin');
8
+ return undefined;
9
+ }
10
+ if (value === undefined && schema === false)
11
+ return undefined;
12
+ const validate = compileSchema(schema, base);
13
+ const options = value === undefined ? {} : value;
14
+ if (!validate(options))
15
+ throw schemaError(base + '/options', validate.errors?.[0]);
16
+ return options;
17
+ }
18
+ function compileSchema(schema, base) {
19
+ if (typeof schema !== 'boolean' && !isRecord(schema))
20
+ throw new Error(base + ' declares an invalid options schema');
21
+ try {
22
+ return new Ajv2020({ strict: false, ownProperties: true }).compile(schema);
23
+ }
24
+ catch (error) {
25
+ const message = error instanceof Error ? error.message : String(error);
26
+ throw new Error(base + ' declares an invalid options schema: ' + message, { cause: error });
27
+ }
28
+ }
29
+ //# sourceMappingURL=plugin-options.js.map
@@ -0,0 +1,9 @@
1
+ import type { JsonValue } from '@repometry/core/internal/model/plugin-data.js';
2
+ export interface PluginReference {
3
+ readonly use: string;
4
+ readonly options?: JsonValue;
5
+ readonly include?: readonly string[];
6
+ readonly exclude?: readonly string[];
7
+ }
8
+ export declare function readPluginReferences(value: unknown): readonly PluginReference[];
9
+ export declare function pluginPatterns(value: unknown, field: string): readonly string[] | undefined;