@repometry/cli 0.0.0-dev.0 → 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 -3
  3. package/package.json +65 -2
  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,40 @@
1
+ import { isRecord } from '@repometry/core/internal/engine/plugin.js';
2
+ import { isJsonValue } from '@repometry/core/internal/model/plugin-data.js';
3
+ import { normalizeExclusions } from '@repometry/core/internal/profile/exclusions.js';
4
+ export function readPluginReferences(value) {
5
+ if (value === undefined)
6
+ return [];
7
+ if (!Array.isArray(value))
8
+ throw new Error('Config plugins must be an array');
9
+ return value.map(readReference);
10
+ }
11
+ function readReference(value, index) {
12
+ const base = 'Config plugins/' + index;
13
+ if (typeof value === 'string')
14
+ return { use: reference(value, base) };
15
+ if (isRecord(value) && ['id', 'image', 'command'].some(key => Object.hasOwn(value, key))) {
16
+ throw new Error(base + ' describes a plugin inline. Move it into a manifest file and reference it with { "use": "./plugin.json" }.');
17
+ }
18
+ if (!isRecord(value) || !Object.hasOwn(value, 'use')
19
+ || Object.keys(value).some(key => !['use', 'options', 'include', 'exclude'].includes(key))) {
20
+ throw new Error(base + ' must be a reference string or an object with use, options, include and exclude');
21
+ }
22
+ const { use, options, include, exclude } = value;
23
+ if (options !== undefined && !isJsonValue(options))
24
+ throw new Error(base + '/options must be JSON data');
25
+ const included = pluginPatterns(include, base + '/include');
26
+ const excluded = pluginPatterns(exclude, base + '/exclude');
27
+ return { use: reference(use, base + '/use'), ...(options === undefined ? {} : { options }),
28
+ ...(included === undefined ? {} : { include: included }), ...(excluded === undefined ? {} : { exclude: excluded }) };
29
+ }
30
+ function reference(value, field) {
31
+ if (typeof value !== 'string' || !value.trim() || value.includes("\0"))
32
+ throw new Error(field + ' must be a nonempty plugin reference');
33
+ return value;
34
+ }
35
+ export function pluginPatterns(value, field) {
36
+ if (value === undefined)
37
+ return undefined;
38
+ return normalizeExclusions(value, field);
39
+ }
40
+ //# sourceMappingURL=plugin-reference.js.map
@@ -0,0 +1,5 @@
1
+ import type { PluginManifest } from '@repometry/core/internal/engine/plugin-manifest.js';
2
+ type Requirements = NonNullable<PluginManifest['requires']>;
3
+ export declare function readRequirements(value: unknown, field: string): Requirements;
4
+ export declare function unmetRequirement({ node, repometry, tools }: Requirements, packageUrl?: string): Promise<string | undefined>;
5
+ export {};
@@ -0,0 +1,83 @@
1
+ import { constants } from 'node:fs';
2
+ import { access, readFile, stat } from 'node:fs/promises';
3
+ import { delimiter, resolve } from 'node:path';
4
+ import { satisfies, validRange } from 'semver';
5
+ import { isRecord } from '@repometry/core/internal/engine/plugin.js';
6
+ const packageFile = new URL('../../../../package.json', import.meta.url);
7
+ const hostVersions = new Map();
8
+ const versionFields = ['node', 'repometry'];
9
+ export function readRequirements(value, field) {
10
+ if (value === undefined)
11
+ return {};
12
+ if (!isRecord(value) || Object.keys(value).some(key => !['node', 'repometry', 'tools'].includes(key))) {
13
+ throw new Error(field + ' must declare node, repometry or tools');
14
+ }
15
+ const ranges = Object.fromEntries(versionFields.flatMap(key => {
16
+ const range = value[key];
17
+ if (range === undefined)
18
+ return [];
19
+ if (typeof range !== 'string' || !range.trim() || validRange(range) === null) {
20
+ throw new Error(field + '/' + key + ' must be a semver range');
21
+ }
22
+ return [[key, range]];
23
+ }));
24
+ const tools = value.tools;
25
+ if (tools === undefined)
26
+ return ranges;
27
+ if (!Array.isArray(tools) || !tools.every(executableName) || new Set(tools).size !== tools.length) {
28
+ throw new Error(field + '/tools must be a list of unique executable names');
29
+ }
30
+ return { ...ranges, tools };
31
+ }
32
+ function executableName(value) {
33
+ return typeof value === 'string' && /^[^\s/\\\0]+$/.test(value) && !['.', '..'].includes(value);
34
+ }
35
+ export async function unmetRequirement({ node, repometry, tools = [] }, packageUrl = packageFile.href) {
36
+ if (node !== undefined && !satisfies(process.version, node))
37
+ return 'requires Node.js ' + node + ', found ' + process.version;
38
+ if (repometry !== undefined) {
39
+ const version = await hostVersion(packageUrl);
40
+ if (!satisfies(version, repometry))
41
+ return 'requires Repometry ' + repometry + ', found ' + version;
42
+ }
43
+ for (const tool of tools) {
44
+ if (!await executableOnPath(tool))
45
+ return 'required executable ' + tool + ' is not on PATH';
46
+ }
47
+ return undefined;
48
+ }
49
+ function hostVersion(packageUrl) {
50
+ const cached = hostVersions.get(packageUrl);
51
+ if (cached !== undefined)
52
+ return cached;
53
+ const pending = readFile(new URL(packageUrl), 'utf8').then(json => JSON.parse(json).version);
54
+ hostVersions.set(packageUrl, pending);
55
+ return pending;
56
+ }
57
+ async function executableOnPath(name) {
58
+ const windows = process.platform === 'win32';
59
+ const extensions = windows ? (process.env.PATHEXT ?? '.COM;.EXE;.BAT;.CMD').split(';') : [''];
60
+ const directories = (process.env.PATH ?? '').split(delimiter);
61
+ for (const directory of directories) {
62
+ for (const extension of extensions) {
63
+ const candidate = resolve(directory, name + extension);
64
+ if (await isExecutableFile(candidate, windows))
65
+ return true;
66
+ }
67
+ }
68
+ return false;
69
+ }
70
+ async function isExecutableFile(path, windows) {
71
+ try {
72
+ if (!(await stat(path)).isFile())
73
+ return false;
74
+ await access(path, windows ? constants.F_OK : constants.X_OK);
75
+ return true;
76
+ }
77
+ catch (error) {
78
+ if (isRecord(error) && ['ENOENT', 'ENOTDIR', 'EACCES', 'EPERM', 'ELOOP'].includes(String(error.code)))
79
+ return false;
80
+ throw error;
81
+ }
82
+ }
83
+ //# sourceMappingURL=plugin-requirements.js.map
@@ -0,0 +1,9 @@
1
+ import type { Operation, Plugin } from '@repometry/core/internal/engine/plugin.js';
2
+ type Matches = (path: string) => boolean;
3
+ export declare function pluginScope(plugin: Plugin): {
4
+ include?: readonly string[] | undefined;
5
+ exclude?: readonly string[] | undefined;
6
+ } | undefined;
7
+ export declare function scopedMatcher(plugin: Plugin, defaultMatches: Matches): Matches;
8
+ export declare function scopeOperation(plugin: Plugin, operation: Operation, matches: Matches): Operation;
9
+ export {};
@@ -0,0 +1,60 @@
1
+ import { changesInput } from '@repometry/core/internal/model/changes.js';
2
+ import { cloneSources } from '@repometry/core/internal/model/clone-source.js';
3
+ import { codeStructures } from '@repometry/core/internal/model/code-structure.js';
4
+ import { lcovInput } from '@repometry/core/internal/model/coverage-input.js';
5
+ import { digest, sourceFiles } from '@repometry/core/internal/model/snapshot.js';
6
+ import { exclusionMatcher } from '@repometry/core/internal/profile/exclusions.js';
7
+ import { pluginRegistration } from './registered-plugin.js';
8
+ const fileCollections = new Set([sourceFiles.id, codeStructures.id, cloneSources.id]);
9
+ export function pluginScope(plugin) {
10
+ const { include, exclude } = pluginRegistration(plugin) ?? {};
11
+ if (include === undefined && exclude === undefined)
12
+ return undefined;
13
+ return { ...(include === undefined ? {} : { include }), ...(exclude === undefined ? {} : { exclude }) };
14
+ }
15
+ export function scopedMatcher(plugin, defaultMatches) {
16
+ const scope = pluginScope(plugin);
17
+ if (!scope)
18
+ return defaultMatches;
19
+ const included = scope.include === undefined ? defaultMatches : exclusionMatcher(scope.include);
20
+ const excluded = exclusionMatcher(scope.exclude ?? []);
21
+ return path => included(path) && !excluded(path);
22
+ }
23
+ export function scopeOperation(plugin, operation, matches) {
24
+ const scope = pluginScope(plugin);
25
+ if (!scope || !Object.values(operation.inputs).some(({ id }) => canProject(id)))
26
+ return operation;
27
+ return {
28
+ ...operation,
29
+ implementation: digest(JSON.stringify([operation.implementation, scope])),
30
+ execute(context) {
31
+ return operation.execute({ ...context, read: (port, contract) => project(context.read(port, contract), contract.id, matches) });
32
+ },
33
+ };
34
+ }
35
+ function canProject(contract) {
36
+ return fileCollections.has(contract) || contract === changesInput.id || contract === lcovInput.id;
37
+ }
38
+ function project(value, contract, matches) {
39
+ // The operation runner has already validated the input against its contract.
40
+ if (fileCollections.has(contract))
41
+ return value.filter(({ path }) => matches(path));
42
+ if (contract === lcovInput.id)
43
+ return coverageFiles(value, matches);
44
+ if (contract === changesInput.id) {
45
+ const changes = value;
46
+ return { files: paths(changes.files, matches), gaps: paths(changes.gaps, matches) };
47
+ }
48
+ return value;
49
+ }
50
+ function coverageFiles(input, matches) {
51
+ return { ...input, sourceLines: paths(input.sourceLines, matches),
52
+ ...(input.codeLines === undefined ? {} : { codeLines: paths(input.codeLines, matches) }),
53
+ ...(input.functionBodies === undefined ? {} : { functionBodies: paths(input.functionBodies, matches) }),
54
+ ...(input.unclassified === undefined ? {} : { unclassified: new Set([...input.unclassified].filter(matches)) }),
55
+ excludes: path => !matches(path) || input.excludes?.(path) === true };
56
+ }
57
+ function paths(entries, matches) {
58
+ return new Map([...entries].filter(([path]) => matches(path)));
59
+ }
60
+ //# sourceMappingURL=plugin-scope.js.map
@@ -0,0 +1,89 @@
1
+ import type { JsonValue } from '@repometry/core/internal/model/plugin-data.js';
2
+ import type { PluginReference } from './plugin-reference.js';
3
+ interface DockerPluginContext {
4
+ readonly base: string;
5
+ readonly packageUrl?: string;
6
+ }
7
+ export declare function dockerPluginFile(path: string, entry: PluginReference, context: DockerPluginContext): Promise<{
8
+ include: readonly string[] | undefined;
9
+ exclude: readonly string[] | undefined;
10
+ versionSource: string;
11
+ requires: {
12
+ readonly node?: string;
13
+ readonly repometry?: string;
14
+ readonly tools?: readonly string[];
15
+ } | undefined;
16
+ image: string | undefined;
17
+ plugin: {
18
+ id: string;
19
+ version: string;
20
+ api: string;
21
+ tools?: Readonly<Record<string, string>>;
22
+ rules?: readonly import("@repometry/core/internal/engine/plugin.js").RuleDescriptor[];
23
+ config?: import("@repometry/core/internal/engine/plugin.js").PluginConfigSchema;
24
+ settings?: JsonValue;
25
+ kinds: readonly import("@repometry/core/internal/engine/plugin.js").PluginKind[];
26
+ claims?: import("@repometry/core/internal/engine/plugin.js").FileClaims;
27
+ providesLanguages?: readonly import("@repometry/core/internal/model/language.js").ProvidedLanguage[];
28
+ languageProvenanceRequiresSource?: true;
29
+ produces: readonly import("@repometry/core/internal/engine/plugin.js").ProductDeclaration[];
30
+ operations: never[];
31
+ unavailableReason: string;
32
+ } | {
33
+ id: string;
34
+ version: string;
35
+ api: string;
36
+ tools?: Readonly<Record<string, string>>;
37
+ rules?: readonly import("@repometry/core/internal/engine/plugin.js").RuleDescriptor[];
38
+ config?: import("@repometry/core/internal/engine/plugin.js").PluginConfigSchema;
39
+ settings?: JsonValue;
40
+ kinds: readonly import("@repometry/core/internal/engine/plugin.js").PluginKind[];
41
+ claims?: import("@repometry/core/internal/engine/plugin.js").FileClaims;
42
+ providesLanguages?: readonly import("@repometry/core/internal/model/language.js").ProvidedLanguage[];
43
+ languageProvenanceRequiresSource?: true;
44
+ produces: readonly import("@repometry/core/internal/engine/plugin.js").ProductDeclaration[];
45
+ operations: import("@repometry/core/internal/engine/plugin.js").Operation[];
46
+ };
47
+ }>;
48
+ export declare function dockerPluginImage(image: string, entry: PluginReference, context: DockerPluginContext): Promise<{
49
+ include: readonly string[] | undefined;
50
+ exclude: readonly string[] | undefined;
51
+ versionSource: string;
52
+ requires: {
53
+ readonly node?: string;
54
+ readonly repometry?: string;
55
+ readonly tools?: readonly string[];
56
+ } | undefined;
57
+ image: string | undefined;
58
+ plugin: {
59
+ id: string;
60
+ version: string;
61
+ api: string;
62
+ tools?: Readonly<Record<string, string>>;
63
+ rules?: readonly import("@repometry/core/internal/engine/plugin.js").RuleDescriptor[];
64
+ config?: import("@repometry/core/internal/engine/plugin.js").PluginConfigSchema;
65
+ settings?: JsonValue;
66
+ kinds: readonly import("@repometry/core/internal/engine/plugin.js").PluginKind[];
67
+ claims?: import("@repometry/core/internal/engine/plugin.js").FileClaims;
68
+ providesLanguages?: readonly import("@repometry/core/internal/model/language.js").ProvidedLanguage[];
69
+ languageProvenanceRequiresSource?: true;
70
+ produces: readonly import("@repometry/core/internal/engine/plugin.js").ProductDeclaration[];
71
+ operations: never[];
72
+ unavailableReason: string;
73
+ } | {
74
+ id: string;
75
+ version: string;
76
+ api: string;
77
+ tools?: Readonly<Record<string, string>>;
78
+ rules?: readonly import("@repometry/core/internal/engine/plugin.js").RuleDescriptor[];
79
+ config?: import("@repometry/core/internal/engine/plugin.js").PluginConfigSchema;
80
+ settings?: JsonValue;
81
+ kinds: readonly import("@repometry/core/internal/engine/plugin.js").PluginKind[];
82
+ claims?: import("@repometry/core/internal/engine/plugin.js").FileClaims;
83
+ providesLanguages?: readonly import("@repometry/core/internal/model/language.js").ProvidedLanguage[];
84
+ languageProvenanceRequiresSource?: true;
85
+ produces: readonly import("@repometry/core/internal/engine/plugin.js").ProductDeclaration[];
86
+ operations: import("@repometry/core/internal/engine/plugin.js").Operation[];
87
+ };
88
+ }>;
89
+ export {};
@@ -0,0 +1,74 @@
1
+ import { manifestPlugin } from '@repometry/core/internal/engine/plugin-manifest.js';
2
+ import { readFile } from 'node:fs/promises';
3
+ import { isRecord } from '@repometry/core/internal/engine/plugin.js';
4
+ import { codeStructure, codeStructures } from '@repometry/core/internal/model/code-structure.js';
5
+ import { findingResult } from '@repometry/core/internal/model/finding.js';
6
+ import { sourceFile, sourceFiles } from '@repometry/core/internal/model/snapshot.js';
7
+ import { DockerToolRunner } from '../api/process/docker-tool-runner.js';
8
+ import { processPlugin } from '../api/process/plugin.js';
9
+ import { dockerLabel, inspectDockerImage } from './docker-image.js';
10
+ import { authorOperation } from '@repometry/core/internal/engine/author-operation.js';
11
+ import { checkManifest, manifestScope } from './plugin-manifest.js';
12
+ import { validatePluginOptions } from './plugin-options.js';
13
+ import { readRequirements, unmetRequirement } from './plugin-requirements.js';
14
+ export async function dockerPluginFile(path, entry, context) {
15
+ const { base } = context;
16
+ let value;
17
+ try {
18
+ value = JSON.parse(await readFile(path, 'utf8'));
19
+ }
20
+ catch (error) {
21
+ throw new Error(base + '/manifest could not read ' + path, { cause: error });
22
+ }
23
+ if (!isRecord(value) || typeof value.image !== 'string')
24
+ throw new Error(base + '/manifest/image is required');
25
+ return loadDockerPlugin(value, value.image, entry, context, true);
26
+ }
27
+ export async function dockerPluginImage(image, entry, context) {
28
+ const { base } = context;
29
+ const inspected = await inspectDockerImage(image, base);
30
+ const value = dockerLabel(inspected.config, base);
31
+ if (isRecord(value) && Object.hasOwn(value, 'image'))
32
+ throw new Error(base + '/manifest/image belongs in a manifest file');
33
+ return loadDockerPlugin(value, inspected.id, entry, context, false);
34
+ }
35
+ async function loadDockerPlugin(value, image, entry, { base, packageUrl }, inspectTag) {
36
+ const manifest = checkManifest(value, base);
37
+ const transport = checkTransport(manifest, base);
38
+ const options = validatePluginOptions(manifest.optionsSchema, entry.options, base);
39
+ const requirements = readRequirements(manifest.requires, base + '/manifest/requires');
40
+ const unavailableReason = await unmetRequirement({ ...requirements, tools: [...new Set(['docker', ...(requirements.tools ?? [])])] }, packageUrl);
41
+ const resolvedImage = inspectTag && unavailableReason === undefined && !/(^|@)sha256:[a-f0-9]{64}$/.test(image)
42
+ ? (await inspectDockerImage(image, base)).id : image;
43
+ const plugin = configuredPlugin(transport, resolvedImage, options);
44
+ return { ...manifestScope(manifest, base), versionSource: 'manifest', requires: manifest.requires,
45
+ image: unavailableReason === undefined ? resolvedImage : undefined,
46
+ plugin: unavailableReason === undefined ? plugin : { ...plugin, operations: [], unavailableReason } };
47
+ }
48
+ function checkTransport(manifest, base) {
49
+ const { version, command, scope, tools } = manifest;
50
+ if (version === undefined)
51
+ throw new Error(base + '/manifest/version is required');
52
+ if (!command?.[0]?.trim())
53
+ throw new Error(base + '/manifest/command/0 must name an executable');
54
+ if (scope === undefined)
55
+ throw new Error(base + '/manifest/scope is required');
56
+ if (tools === undefined)
57
+ throw new Error(base + '/manifest/tools must identify executable versions');
58
+ return { ...manifest, version, command, scope, tools };
59
+ }
60
+ function configuredPlugin(manifest, image, options) {
61
+ const { version, command, scope, fileIndependent, limits = {}, tools } = manifest;
62
+ const language = manifest.category === 'language';
63
+ const repository = scope === 'repository';
64
+ const output = language ? (repository ? codeStructures : codeStructure) : findingResult;
65
+ const plugin = processPlugin({ ...manifestPlugin(manifest, version), tools,
66
+ ...(options === undefined ? {} : { settings: options }),
67
+ produces: [{ contract: output.id, persistence: language ? 'transient' : 'report' }],
68
+ operations: [{ id: language ? 'parse' : 'inspect', role: language ? 'provider' : 'inspection',
69
+ scope, fileIndependent, inputs: repository ? { files: sourceFiles } : { source: sourceFile }, output,
70
+ argv: command, timeoutMs: limits.timeoutMs ?? 30_000, maxOutputBytes: limits.maxOutputBytes ?? 8 * 1024 * 1024 }],
71
+ }, new DockerToolRunner(image, { memoryBytes: limits.memoryBytes ?? 512 * 1024 * 1024, pidsLimit: limits.pidsLimit ?? 128 }));
72
+ return { ...plugin, operations: plugin.operations.map(operation => authorOperation(plugin.id, manifest.category, operation)) };
73
+ }
74
+ //# sourceMappingURL=process-plugins.js.map
@@ -0,0 +1,17 @@
1
+ import type { Plugin } from '@repometry/core/internal/engine/plugin.js';
2
+ import type { PluginManifest } from '@repometry/core/internal/engine/plugin-manifest.js';
3
+ import type { PluginReference } from './plugin-reference.js';
4
+ import type { ParserPlugin } from './parser-order.js';
5
+ declare const registration: unique symbol;
6
+ type Registration = Omit<PluginReference, 'options'> & {
7
+ readonly builtIn: boolean;
8
+ readonly versionSource: string;
9
+ readonly image?: string;
10
+ readonly requires?: PluginManifest['requires'];
11
+ };
12
+ export type RegisteredPlugin = ParserPlugin & {
13
+ readonly [registration]: Registration;
14
+ };
15
+ export declare function registeredPlugin(plugin: ParserPlugin, metadata: Registration): RegisteredPlugin;
16
+ export declare function pluginRegistration(plugin: Plugin): Registration | undefined;
17
+ export {};
@@ -0,0 +1,8 @@
1
+ const registration = Symbol('repometry.configured-plugin');
2
+ export function registeredPlugin(plugin, metadata) {
3
+ return { ...plugin, [registration]: metadata };
4
+ }
5
+ export function pluginRegistration(plugin) {
6
+ return plugin[registration];
7
+ }
8
+ //# sourceMappingURL=registered-plugin.js.map
@@ -0,0 +1,26 @@
1
+ import type { CoverageInputs } from '../api/import/lcov-files.js';
2
+ import type { Plugin } from '@repometry/core/internal/engine/plugin.js';
3
+ import type { FindingIgnoreRule } from '@repometry/core/internal/model/ignore-rule.js';
4
+ import type { PullReview } from '@repometry/core/internal/model/pull-review.js';
5
+ import type { ReviewOptions } from '@repometry/core/internal/usecases/review.js';
6
+ import type { ParserOrder } from './parser-order.js';
7
+ export { projectReview, reviewExitCode, reviewReason } from '@repometry/core/internal/usecases/review.js';
8
+ export interface ReviewRequest extends ReviewOptions, CoverageInputs {
9
+ /** The repository root. */
10
+ readonly directory: string;
11
+ readonly base: string;
12
+ readonly revision?: string;
13
+ readonly exclude?: readonly string[];
14
+ readonly ignore?: readonly FindingIgnoreRule[];
15
+ readonly plugins?: readonly Plugin[];
16
+ readonly parsers?: ParserOrder;
17
+ /** The settings that shaped both inspections, which keeps the second one's reuse of unchanged files honest. */
18
+ readonly profile?: unknown;
19
+ /** The settings file's repository path; a change to it is noted. */
20
+ readonly profilePath?: string;
21
+ }
22
+ /**
23
+ * Analyses the merge base and the head with the same settings, in a temporary store, and reports what the change did
24
+ * on the lines it changed. The repository's own store is neither read nor written.
25
+ */
26
+ export declare function review(request: ReviewRequest): Promise<PullReview>;
@@ -0,0 +1,54 @@
1
+ import { mkdtemp, rm } from 'node:fs/promises';
2
+ import { tmpdir } from 'node:os';
3
+ import { join } from 'node:path';
4
+ import { findMergeBase } from '../api/git/changes.js';
5
+ import { GitBlobReader, resolveGitCommit } from '../api/git/git.js';
6
+ import { readLineChanges } from '../api/git/line-changes.js';
7
+ import { hasCoverageInputs } from '../api/import/lcov-files.js';
8
+ import { checkOptions, projectReview } from '@repometry/core/internal/usecases/review.js';
9
+ import { measureChangedLines } from './diff-coverage.js';
10
+ import { HistoryCache } from './history-cache.js';
11
+ import { inspectWithOptions } from './inspect.js';
12
+ export { projectReview, reviewExitCode, reviewReason } from '@repometry/core/internal/usecases/review.js';
13
+ /**
14
+ * Analyses the merge base and the head with the same settings, in a temporary store, and reports what the change did
15
+ * on the lines it changed. The repository's own store is neither read nor written.
16
+ */
17
+ export async function review(request) {
18
+ const { directory, lcov, goCover, cobertura, exclude, ignore, plugins, parsers } = request;
19
+ const inputs = { lcov, goCover, cobertura };
20
+ const withCoverage = hasCoverageInputs(inputs);
21
+ checkOptions(request, withCoverage);
22
+ const [head, requested] = await Promise.all([resolveGitCommit(directory, request.revision ?? 'HEAD'),
23
+ resolveGitCommit(directory, request.base).catch((error) => {
24
+ throw new Error(`${error instanceof Error ? error.message : String(error)}. A review needs the base's history: fetch it, `
25
+ + 'for example with fetch-depth: 0 on actions/checkout.', { cause: error });
26
+ })]);
27
+ const mergeBase = await findMergeBase(directory, requested, head);
28
+ const output = await mkdtemp(join(tmpdir(), 'repometry-review-'));
29
+ try {
30
+ const history = new HistoryCache(request.profile);
31
+ const inspectCommit = (id, coverage) => inspectWithOptions({ directory, output, source: { revision: id }, exclude, ignore, plugins, parsers,
32
+ ...coverage ? inputs : {} }, { history, deferSummary: true, recordChurn: false });
33
+ const base = await inspectCommit(mergeBase, false);
34
+ const headReport = await inspectCommit(head, true);
35
+ const changes = await readLineChanges(directory, mergeBase, head);
36
+ const coverage = withCoverage
37
+ ? await measureChangedLines({ directory, base: mergeBase, revision: head, ...inputs, exclude, ignore, plugins, parsers }) : null;
38
+ const sources = { base: await sourceLines(directory, mergeBase, changes, 'previous'), head: await sourceLines(directory, head, changes, 'path') };
39
+ const settingsChanged = request.profilePath !== undefined
40
+ && changes.files.some(file => file.path === request.profilePath || file.previous === request.profilePath);
41
+ return projectReview(request, { requestedBase: request.base, base, head: headReport, changes, sources, coverage, settingsChanged });
42
+ }
43
+ finally {
44
+ await rm(output, { recursive: true, force: true });
45
+ }
46
+ }
47
+ /** The text of one side's changed files, which scope and matching read line by line. */
48
+ async function sourceLines(directory, commit, changes, side) {
49
+ const paths = changes.files.flatMap(file => file[side] === null || file.whole ? [] : [file[side]]);
50
+ const blobs = await new GitBlobReader(directory).read(paths.map(path => `${commit}:${path}`));
51
+ const texts = new Map(paths.map((path, index) => [path, blobs[index]?.toString('utf8').split('\n').map(line => line.replace(/\r$/, ''))]));
52
+ return { line: (path, line) => line >= 1 ? texts.get(path)?.[line - 1] : undefined };
53
+ }
54
+ //# sourceMappingURL=review.js.map
@@ -0,0 +1,2 @@
1
+ import type { ErrorObject } from 'ajv';
2
+ export declare function schemaError(base: string, error: ErrorObject | undefined): Error;
@@ -0,0 +1,16 @@
1
+ export function schemaError(base, error) {
2
+ const path = base + (error?.instancePath ?? '');
3
+ if (error?.keyword === 'required')
4
+ return new Error(path + '/' + pointer(error.params.missingProperty) + ' is required');
5
+ if (error?.keyword === 'additionalProperties')
6
+ return new Error(path + '/' + pointer(error.params.additionalProperty) + ' is not allowed');
7
+ if (error?.keyword === 'enum') {
8
+ const values = error.params.allowedValues;
9
+ return new Error(path + ' must be one of ' + values.map(value => JSON.stringify(value)).join(', '));
10
+ }
11
+ return new Error(path + ' ' + (error?.message ?? 'is invalid'));
12
+ }
13
+ function pointer(value) {
14
+ return value.replaceAll('~', '~0').replaceAll('/', '~1');
15
+ }
16
+ //# sourceMappingURL=schema-error.js.map
@@ -0,0 +1,2 @@
1
+ import type { SourceContext, SourcePlugin } from '@repometry/core/internal/ports/source-provider.js';
2
+ export declare function resolveSourceLocator(option: string | undefined, context: Omit<SourceContext, 'option'>, providers?: SourcePlugin[]): import("@repometry/core/internal/model/source-locator.js").SourceLocator | undefined;
@@ -0,0 +1,32 @@
1
+ import { plan } from '@repometry/core/internal/engine/plan.js';
2
+ import { builtInPlugins } from './built-ins.js';
3
+ export function resolveSourceLocator(option, context, providers = builtInPlugins.filter((plugin) => plugin.kinds.includes('source'))) {
4
+ plan({ plugins: providers, select: [], inputs: new Map() });
5
+ if (option === 'none')
6
+ return undefined;
7
+ if (option && option !== 'auto')
8
+ return namedSourceLocator(option, context, providers);
9
+ // A provider that locates sources without CI variables or remotes is the fallback, tried last.
10
+ const fallback = providers.find(provider => provider.locate({ env: {}, remotes: [] }) !== undefined);
11
+ for (const candidate of [{ env: context.env, remotes: [] }, { env: {}, remotes: context.remotes }]) {
12
+ for (const provider of providers) {
13
+ const locator = provider === fallback ? undefined : provider.locate(candidate);
14
+ if (locator)
15
+ return locator;
16
+ }
17
+ }
18
+ return fallback?.locate(context);
19
+ }
20
+ function namedSourceLocator(option, context, providers) {
21
+ const colon = option.indexOf(':');
22
+ const id = colon < 0 ? option : option.slice(0, colon);
23
+ const spec = colon < 0 ? undefined : option.slice(colon + 1);
24
+ const provider = providers.find(item => item.id === id);
25
+ if (!provider)
26
+ throw new Error(`Unknown source provider: ${id}. Choose ${providers.map(item => item.id).join(', ')}.`);
27
+ const locator = provider.locate({ ...context, option: spec });
28
+ if (!locator)
29
+ throw new Error(`Cannot locate source files for ${id}. Name the repository as ${id}:OWNER/REPO.`);
30
+ return locator;
31
+ }
32
+ //# sourceMappingURL=sources.js.map
@@ -0,0 +1,9 @@
1
+ import type { Operation } from '@repometry/core/internal/engine/plugin.js';
2
+ import type { CodeStructure, StructureMeasure } from '@repometry/core/internal/model/code-structure.js';
3
+ import type { ProvidedLanguage } from '@repometry/core/internal/model/language.js';
4
+ type LanguageMeasures = ReadonlyMap<string, readonly StructureMeasure[]>;
5
+ export declare function languageMeasures(declared: readonly ProvidedLanguage[]): LanguageMeasures;
6
+ export declare function structureImplementation(operation: Operation, measured: LanguageMeasures): string | undefined;
7
+ export declare function restrictStructureMeasures(operation: Operation, measured: LanguageMeasures, language: (path: string) => string | undefined): Operation;
8
+ export declare function unmeasuredStructure(facts: CodeStructure): readonly StructureMeasure[];
9
+ export {};
@@ -0,0 +1,63 @@
1
+ import { codeStructure, codeStructures, structureCodeLines } from '@repometry/core/internal/model/code-structure.js';
2
+ import { digest } from '@repometry/core/internal/model/snapshot.js';
3
+ export function languageMeasures(declared) {
4
+ return new Map(declared.flatMap(entry => entry.measures === undefined ? [] : [[entry.id, entry.measures]]));
5
+ }
6
+ export function structureImplementation(operation, measured) {
7
+ return measured.size ? digest(JSON.stringify([operation.implementation ?? operation.execute.toString(), [...measured]]))
8
+ : operation.implementation;
9
+ }
10
+ export function restrictStructureMeasures(operation, measured, language) {
11
+ if (!measured.size)
12
+ return operation;
13
+ const implementation = structureImplementation(operation, measured);
14
+ return { ...operation, implementation, async execute(inputs) {
15
+ const value = await operation.execute(inputs);
16
+ if (operation.scope === 'repository')
17
+ return codeStructures.accepts(value) ? value.map(project) : value;
18
+ return codeStructure.accepts(value) ? project(value) : value;
19
+ } };
20
+ function project(facts) {
21
+ const id = language(facts.path);
22
+ const measures = id === undefined ? undefined : measured.get(id);
23
+ return measures === undefined ? facts : selectMeasures(facts, measures);
24
+ }
25
+ }
26
+ function selectMeasures(facts, measures) {
27
+ const selected = { ...facts };
28
+ if (!measures.includes('functions'))
29
+ delete selected.functions;
30
+ if (!measures.includes('cyclomaticComplexity'))
31
+ delete selected.cyclomaticFunctions;
32
+ if (!measures.includes('cognitiveComplexity')) {
33
+ delete selected.cognitiveComplexity;
34
+ delete selected.cognitiveFunctions;
35
+ }
36
+ if (!measures.includes('classes'))
37
+ delete selected.classes;
38
+ if (!measures.includes('commentLines'))
39
+ delete selected.commentLines;
40
+ if (measures.includes('codeLines'))
41
+ selected.codeLines = structureCodeLines(facts);
42
+ else
43
+ delete selected.codeLines;
44
+ if (!measures.includes('duplication'))
45
+ delete selected.clones;
46
+ if (!measures.includes('structuralRules'))
47
+ delete selected.observations;
48
+ return selected;
49
+ }
50
+ export function unmeasuredStructure(facts) {
51
+ const values = {
52
+ functions: facts.functions,
53
+ cyclomaticComplexity: facts.cyclomaticFunctions,
54
+ cognitiveComplexity: facts.cognitiveComplexity,
55
+ classes: facts.classes,
56
+ commentLines: facts.commentLines,
57
+ codeLines: structureCodeLines(facts),
58
+ duplication: facts.clones,
59
+ structuralRules: facts.observations,
60
+ };
61
+ return Object.keys(values).filter(key => values[key] === undefined);
62
+ }
63
+ //# sourceMappingURL=structure-measures.js.map
@@ -0,0 +1,8 @@
1
+ declare const inspect: ({ plugins, ...request }: import("./runtime.js").InspectRequest) => Promise<import("@repometry/core/internal/model/report.js").Report>, measureDiffCoverage: ({ plugins, ...request }: import("./runtime.js").DiffCoverageRequest) => Promise<import("@repometry/core/internal/usecases/diff-coverage.js").DiffCoverageReport>, review: ({ plugins, ...request }: import("./runtime.js").ReviewRequest) => Promise<import("@repometry/core/internal/model/pull-review.js").PullReview>;
2
+ export { inspect, measureDiffCoverage, review };
3
+ export type { InspectRequest, DiffCoverageRequest, ReviewRequest } from './runtime.js';
4
+ export { reviewExitCode } from './compose/review.js';
5
+ export type { DiffCoveragePorts, DiffCoverageSource } from '@repometry/core/internal/usecases/diff-coverage.js';
6
+ export type { ReviewOptions } from '@repometry/core/internal/usecases/review.js';
7
+ export type { FindingInput } from './api/import/finding-import.js';
8
+ export type { FindingIgnoreRule as IgnoreEntry } from '@repometry/core/internal/model/ignore-rule.js';
@@ -0,0 +1,5 @@
1
+ import { createRepometry } from './runtime.js';
2
+ const { inspect, measureDiffCoverage, review } = createRepometry();
3
+ export { inspect, measureDiffCoverage, review };
4
+ export { reviewExitCode } from './compose/review.js';
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,2 @@
1
+ export { codeStructure, codeStructures, findingResult, measurements, pluginManifestSchema, sourceFile, sourceFiles } from '@repometry/core';
2
+ export type { Candidate, Check, CloneSource, CodeStructure, DataContract, Finding, FindingLocation, FindingResult, FunctionComplexity, InspectionInputs, LanguageDisplay, LanguageSyntax, Measurement, MetricDescriptor, MetricScope, Operation, PluginCategory, PluginManifest, ProductOutput, SourceFile, StructuralCheck, StructuralObservation } from '@repometry/core';
@@ -0,0 +1,2 @@
1
+ export { codeStructure, codeStructures, findingResult, measurements, pluginManifestSchema, sourceFile, sourceFiles } from '@repometry/core';
2
+ //# sourceMappingURL=plugin.js.map