@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,62 @@
1
+ import { pluginScope } from './plugin-scope.js';
2
+ import { GitBlobHistory } from '../api/git/blob-history.js';
3
+ import { debtModel } from '@repometry/core/internal/model/quality-summary.js';
4
+ import { digest, sourceDirectoriesExcluded } from '@repometry/core/internal/model/snapshot.js';
5
+ import { defaultSourceExclusions, generatedSourcePolicy } from '@repometry/core/internal/profile/exclusions.js';
6
+ import { duplicationSettings, structuralRules } from '@repometry/core/internal/profile/maintainability.js';
7
+ import { analysisProfile } from './analysis-report.js';
8
+ export class HistoryFiles {
9
+ ids;
10
+ previous;
11
+ current = new Map();
12
+ constructor(ids, previous) {
13
+ this.ids = ids;
14
+ this.previous = previous;
15
+ }
16
+ read(path) {
17
+ const result = this.previous?.get(path);
18
+ return result?.blob === this.ids.get(path) ? result : undefined;
19
+ }
20
+ retain(path, result) {
21
+ const blob = this.ids.get(path);
22
+ if (blob !== undefined)
23
+ this.current.set(path, { ...this.current.get(path), ...result, blob });
24
+ }
25
+ }
26
+ /** One range keeps at most two adjacent snapshots' results during inspection. */
27
+ export class HistoryCache {
28
+ configuration;
29
+ blobs = new GitBlobHistory();
30
+ previous;
31
+ constructor(configuration) {
32
+ this.configuration = configuration;
33
+ }
34
+ begin(snapshot, profile) {
35
+ if (snapshot.subject.kind !== 'commit' || snapshot.blobIds === undefined)
36
+ return undefined;
37
+ const key = digest(JSON.stringify([this.configuration, profile]));
38
+ const files = new HistoryFiles(snapshot.blobIds, this.previous?.profile === key ? this.previous.files.current : undefined);
39
+ this.previous = { profile: key, files };
40
+ return files;
41
+ }
42
+ }
43
+ export function historyProfile(input, sources, operationConfiguration) {
44
+ return JSON.stringify([process.version, analysisProfile, input.excludedPaths, input.excludedOutput,
45
+ sourceDirectoriesExcluded, defaultSourceExclusions, generatedSourcePolicy, structuralRules, duplicationSettings, debtModel,
46
+ operationConfiguration, sources.plugins.map(pluginIdentity),
47
+ sources.languages.plugins.filter(plugin => plugin.unavailableReason !== undefined).map(pluginIdentity),
48
+ sources.languages.providers.map(({ plugin }) => sources.languages.describe(plugin).providesLanguages?.map(({ id }) => id))]);
49
+ }
50
+ function pluginIdentity(plugin) {
51
+ const { operations, ...manifest } = plugin;
52
+ return { ...manifest, ...pluginScope(plugin), operations: operations.map(({ execute, inputs, output, ...operation }) => ({ ...operation,
53
+ inputs: Object.entries(inputs).map(([port, contract]) => [port, contract.id]), output: output.id,
54
+ implementation: operation.implementation ?? execute.toString(),
55
+ })) };
56
+ }
57
+ export function canReuseBatch(provider) {
58
+ return provider.operation.fileIndependent === true
59
+ && !provider.plugin.operations.some(operation => operation.scope === 'repository' && operation.role === 'inspection')
60
+ && provider.plugin.produces.some(product => product.contract === provider.operation.output.id && product.persistence === 'transient');
61
+ }
62
+ //# sourceMappingURL=history-cache.js.map
@@ -0,0 +1,34 @@
1
+ import type { InventoryObserver } from '../api/git/local.js';
2
+ import type { CoverageInputs } from '../api/import/lcov-files.js';
3
+ import type { OperationCacheOptions } from '@repometry/core/internal/engine/operation-cache.js';
4
+ import type { Plugin } from '@repometry/core/internal/engine/plugin.js';
5
+ import type { FindingIgnoreRule } from '@repometry/core/internal/model/finding-ignore.js';
6
+ import type { Report } from '@repometry/core/internal/model/report.js';
7
+ import type { FindingInput } from '@repometry/core/internal/model/scanner-import.js';
8
+ import type { HistoryCache } from './history-cache.js';
9
+ import type { ParserOrder } from './parser-order.js';
10
+ export interface InspectRequest extends CoverageInputs {
11
+ readonly directory: string;
12
+ readonly output: string;
13
+ readonly source: {
14
+ readonly workingTree: true;
15
+ } | {
16
+ readonly revision: string;
17
+ };
18
+ readonly exclude?: readonly string[];
19
+ readonly findingInputs?: readonly FindingInput[];
20
+ readonly findingRoot?: string;
21
+ readonly ignore?: readonly FindingIgnoreRule[];
22
+ /** Trusted in-process plugins. */
23
+ readonly plugins?: readonly Plugin[];
24
+ readonly parsers?: ParserOrder;
25
+ readonly operationCache?: OperationCacheOptions;
26
+ }
27
+ export declare function inspect(request: InspectRequest): Promise<Report>;
28
+ export declare function inspectWithOptions(request: InspectRequest, { history, deferSummary, recordChurn, inventory }?: {
29
+ history?: HistoryCache;
30
+ deferSummary?: boolean;
31
+ recordChurn?: boolean;
32
+ inventory?: InventoryObserver;
33
+ }): Promise<Report>;
34
+ export declare function attachFindings(report: Report, inputs: readonly FindingInput[], root: string, findingRoot: string, excludes: (path: string) => boolean): Promise<Report>;
@@ -0,0 +1,51 @@
1
+ import { resolve } from 'node:path';
2
+ import { gitTreeFiles } from '../api/git/git.js';
3
+ import { readInspectionSource } from '../api/git/inspection-source.js';
4
+ import { importFindings } from '../api/import/finding-import.js';
5
+ import { hasCoverageInputs } from '../api/import/lcov-files.js';
6
+ import { readInspectionCoverage } from './inspection-coverage.js';
7
+ import { reportSchema } from '@repometry/core/internal/model/report.js';
8
+ import { isExcludedDirectory } from '@repometry/core/internal/model/snapshot.js';
9
+ import { executeInspection } from '@repometry/core/internal/usecases/inspect.js';
10
+ import { LocalReportStore } from '../report/json/store/local-store.js';
11
+ import { analyzeSnapshot, inspectionFileMatcher } from './analyze-snapshot.js';
12
+ import { attachChurn } from './attach-churn.js';
13
+ import { languageRegistry } from './languages.js';
14
+ export function inspect(request) {
15
+ return inspectWithOptions(request);
16
+ }
17
+ export async function inspectWithOptions(request, { history, deferSummary = false, recordChurn = true, inventory } = {}) {
18
+ const { findingInputs = [], plugins = [], operationCache } = request;
19
+ const languages = languageRegistry(plugins, request.parsers);
20
+ const claims = inspectionFileMatcher(languages);
21
+ const { isSource } = languages;
22
+ const ports = {
23
+ readSource: excludes => readSource(request, { excludes, isSource, claims, history: history?.blobs }, deferSummary, inventory),
24
+ analyze: input => analyzeSnapshot(input, languages, operationCache, history),
25
+ ...(hasCoverageInputs(request) ? { readCoverage: source => readInspectionCoverage(request, source) } : {}),
26
+ ...(findingInputs.length === 0 ? {} : { importFindings: (report, root, excludes) => attachFindings(report, findingInputs, root, request.findingRoot === undefined ? root : resolve(request.findingRoot), excludes) }),
27
+ recordChurn: recordChurn ? (report, root, paths) => attachChurn(report, root, paths.filter(isSource)) : undefined,
28
+ };
29
+ return executeInspection(request, ports);
30
+ }
31
+ async function readSource(request, selection, deferSummary, inventory) {
32
+ const source = await readInspectionSource(request, selection, inventory);
33
+ const store = new LocalReportStore(source.output);
34
+ return { ...source, save: (report) => store.save(report, { deferSummary }) };
35
+ }
36
+ export async function attachFindings(report, inputs, root, findingRoot, excludes) {
37
+ const known = report.subject.kind === 'commit'
38
+ ? new Set((await gitTreeFiles(root, report.subject.id)).map(entry => entry.path)) : undefined;
39
+ const isExcluded = (path) => path.split('/').slice(0, -1).some(isExcludedDirectory) || excludes(path);
40
+ const imports = await Promise.all(inputs.map(input => importFindings(input, findingRoot, isExcluded, known)));
41
+ const findingImports = imports.map(({ metadata }) => metadata);
42
+ const gaps = findingImports.filter(({ unmapped }) => unmapped > 0).map(({ category, format, unmapped }) => ({
43
+ operation: `findings/${category}/${format}`, state: 'partial', message: `${unmapped} finding locations could not be mapped to the source`,
44
+ }));
45
+ const findings = [...report.findings ?? [], ...imports.flatMap(({ findings }) => findings)];
46
+ // Import provenance identifies the normalized finding set and does not store an analyzer's raw report or host path.
47
+ return { ...report, schema: reportSchema, findings, appliedConfig: { ...report.appliedConfig, findingImports },
48
+ status: gaps.length > 0 ? 'partial' : report.status === 'not-applicable' && findingImports.some(item => item.units > 0)
49
+ ? 'complete' : report.status, diagnostics: [...report.diagnostics, ...gaps] };
50
+ }
51
+ //# sourceMappingURL=inspect.js.map
@@ -0,0 +1,9 @@
1
+ import type { CoverageInputs } from '../api/import/lcov-files.js';
2
+ import type { SourceSnapshot } from '@repometry/core/internal/model/source.js';
3
+ export declare function readInspectionCoverage(inputs: CoverageInputs, { root, snapshot }: {
4
+ root: string;
5
+ snapshot: SourceSnapshot;
6
+ }): Promise<{
7
+ text: string;
8
+ inputDigests: string[];
9
+ }>;
@@ -0,0 +1,9 @@
1
+ import { gitText } from '../api/git/git.js';
2
+ import { readCoverageFiles } from '../api/import/lcov-files.js';
3
+ export function readInspectionCoverage(inputs, { root, snapshot }) {
4
+ const { subject } = snapshot;
5
+ const readCommittedManifest = subject.kind === 'commit'
6
+ ? (path) => gitText(root, ['cat-file', 'blob', `${subject.id}:${path}`]) : undefined;
7
+ return readCoverageFiles(inputs, { root, snapshot, readCommittedManifest });
8
+ }
9
+ //# sourceMappingURL=inspection-coverage.js.map
@@ -0,0 +1,113 @@
1
+ import type { PluginReference } from './plugin-reference.js';
2
+ import type { Distribution } from './distribution.js';
3
+ export interface PluginContext {
4
+ readonly root: string;
5
+ readonly base: string;
6
+ readonly metadataOnly: boolean;
7
+ readonly distribution?: Distribution;
8
+ }
9
+ export declare function localModule(path: string, entry: PluginReference, context: PluginContext): Promise<{
10
+ include: readonly string[] | undefined;
11
+ exclude: readonly string[] | undefined;
12
+ plugin: {
13
+ id: string;
14
+ version: string;
15
+ api: string;
16
+ tools?: Readonly<Record<string, string>>;
17
+ rules?: readonly import("@repometry/core/internal/engine/plugin.js").RuleDescriptor[];
18
+ config?: import("@repometry/core/internal/engine/plugin.js").PluginConfigSchema;
19
+ kinds: readonly import("@repometry/core/internal/engine/plugin.js").PluginKind[];
20
+ claims?: import("@repometry/core/internal/engine/plugin.js").FileClaims;
21
+ providesLanguages?: readonly import("@repometry/core/internal/model/language.js").ProvidedLanguage[];
22
+ languageProvenanceRequiresSource?: true;
23
+ operations: import("@repometry/core/internal/engine/plugin.js").Operation[];
24
+ produces: ({
25
+ contract: string;
26
+ persistence: 'report' | 'cache' | 'transient';
27
+ metrics?: readonly import("@repometry/core/internal/model/metric-descriptor.js").MetricDescriptor[];
28
+ } | {
29
+ contract: string;
30
+ persistence: 'report' | 'cache' | 'transient';
31
+ metrics?: readonly import("@repometry/core/internal/model/metric-descriptor.js").MetricDescriptor[];
32
+ schema: boolean | Readonly<Record<string, unknown>>;
33
+ })[];
34
+ settings?: import("@repometry/core/internal/model/plugin-data.js").JsonValue | undefined;
35
+ unavailableReason?: string | undefined;
36
+ };
37
+ versionSource: string;
38
+ requires: {
39
+ readonly node?: string;
40
+ readonly repometry?: string;
41
+ readonly tools?: readonly string[];
42
+ } | undefined;
43
+ }>;
44
+ export declare function installedModule(name: string, entry: PluginReference, context: PluginContext): Promise<{
45
+ include: readonly string[] | undefined;
46
+ exclude: readonly string[] | undefined;
47
+ plugin: {
48
+ id: string;
49
+ version: string;
50
+ api: string;
51
+ tools?: Readonly<Record<string, string>>;
52
+ rules?: readonly import("@repometry/core/internal/engine/plugin.js").RuleDescriptor[];
53
+ config?: import("@repometry/core/internal/engine/plugin.js").PluginConfigSchema;
54
+ kinds: readonly import("@repometry/core/internal/engine/plugin.js").PluginKind[];
55
+ claims?: import("@repometry/core/internal/engine/plugin.js").FileClaims;
56
+ providesLanguages?: readonly import("@repometry/core/internal/model/language.js").ProvidedLanguage[];
57
+ languageProvenanceRequiresSource?: true;
58
+ operations: import("@repometry/core/internal/engine/plugin.js").Operation[];
59
+ produces: ({
60
+ contract: string;
61
+ persistence: 'report' | 'cache' | 'transient';
62
+ metrics?: readonly import("@repometry/core/internal/model/metric-descriptor.js").MetricDescriptor[];
63
+ } | {
64
+ contract: string;
65
+ persistence: 'report' | 'cache' | 'transient';
66
+ metrics?: readonly import("@repometry/core/internal/model/metric-descriptor.js").MetricDescriptor[];
67
+ schema: boolean | Readonly<Record<string, unknown>>;
68
+ })[];
69
+ settings?: import("@repometry/core/internal/model/plugin-data.js").JsonValue | undefined;
70
+ unavailableReason?: string | undefined;
71
+ };
72
+ versionSource: string;
73
+ requires: {
74
+ readonly node?: string;
75
+ readonly repometry?: string;
76
+ readonly tools?: readonly string[];
77
+ } | undefined;
78
+ }>;
79
+ export declare function javaScriptManifest(value: unknown, entry: PluginReference, context: PluginContext, packageFile?: string): Promise<{
80
+ include: readonly string[] | undefined;
81
+ exclude: readonly string[] | undefined;
82
+ plugin: {
83
+ id: string;
84
+ version: string;
85
+ api: string;
86
+ tools?: Readonly<Record<string, string>>;
87
+ rules?: readonly import("@repometry/core/internal/engine/plugin.js").RuleDescriptor[];
88
+ config?: import("@repometry/core/internal/engine/plugin.js").PluginConfigSchema;
89
+ kinds: readonly import("@repometry/core/internal/engine/plugin.js").PluginKind[];
90
+ claims?: import("@repometry/core/internal/engine/plugin.js").FileClaims;
91
+ providesLanguages?: readonly import("@repometry/core/internal/model/language.js").ProvidedLanguage[];
92
+ languageProvenanceRequiresSource?: true;
93
+ operations: import("@repometry/core/internal/engine/plugin.js").Operation[];
94
+ produces: ({
95
+ contract: string;
96
+ persistence: 'report' | 'cache' | 'transient';
97
+ metrics?: readonly import("@repometry/core/internal/model/metric-descriptor.js").MetricDescriptor[];
98
+ } | {
99
+ contract: string;
100
+ persistence: 'report' | 'cache' | 'transient';
101
+ metrics?: readonly import("@repometry/core/internal/model/metric-descriptor.js").MetricDescriptor[];
102
+ schema: boolean | Readonly<Record<string, unknown>>;
103
+ })[];
104
+ settings?: import("@repometry/core/internal/model/plugin-data.js").JsonValue | undefined;
105
+ unavailableReason?: string | undefined;
106
+ };
107
+ versionSource: string;
108
+ requires: {
109
+ readonly node?: string;
110
+ readonly repometry?: string;
111
+ readonly tools?: readonly string[];
112
+ } | undefined;
113
+ }>;
@@ -0,0 +1,99 @@
1
+ import { manifestOperations, manifestPlugin } from '@repometry/core/internal/engine/plugin-manifest.js';
2
+ import { readFile } from 'node:fs/promises';
3
+ import { findPackageJSON } from 'node:module';
4
+ import { fileURLToPath, pathToFileURL } from 'node:url';
5
+ import { isRecord } from '@repometry/core/internal/engine/plugin.js';
6
+ import { checkManifest, dockerFields, manifestScope } from './plugin-manifest.js';
7
+ import { validatePluginOptions } from './plugin-options.js';
8
+ import { readRequirements, unmetRequirement } from './plugin-requirements.js';
9
+ const packageName = /^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/i;
10
+ const installFrom = new URL('../../../../', import.meta.url);
11
+ export function localModule(path, entry, context) {
12
+ if (!/\.[cm]?js$/.test(path))
13
+ throw new Error(context.base + ' must reference a JavaScript module or a Docker manifest JSON file');
14
+ return loadJavaScript(pathToFileURL(path).href, entry, context);
15
+ }
16
+ export function installedModule(name, entry, context) {
17
+ const { base, distribution } = context;
18
+ if (!packageName.test(name))
19
+ throw new Error(base + ' must name an installed npm package');
20
+ try {
21
+ const { url, manifest } = resolveInstalled(name, distribution);
22
+ if (manifest !== undefined)
23
+ return loadJavaScript(url, entry, context, { name, manifest });
24
+ }
25
+ catch (error) {
26
+ throw unresolvedPackage(name, context, error);
27
+ }
28
+ throw unresolvedPackage(name, context);
29
+ }
30
+ function resolveInstalled(name, distribution) {
31
+ const fallback = distribution?.resolvePackage;
32
+ try {
33
+ const url = import.meta.resolve(name);
34
+ const manifest = url.startsWith('file:') ? findPackageJSON(name, import.meta.url) : undefined;
35
+ if (manifest !== undefined || fallback === undefined)
36
+ return { url, manifest };
37
+ }
38
+ catch (error) {
39
+ if (fallback === undefined)
40
+ throw error;
41
+ }
42
+ return fallback(name);
43
+ }
44
+ function unresolvedPackage(name, { base, distribution }, cause) {
45
+ const anchor = distribution?.packageUrl;
46
+ const extra = anchor === undefined ? '' : ' or ' + fileURLToPath(anchor);
47
+ return new Error(base + ' could not resolve npm package ' + name + ' from Repometry at ' +
48
+ fileURLToPath(installFrom) + extra + '. Install it with your package manager.', { cause });
49
+ }
50
+ async function loadJavaScript(url, entry, context, installed) {
51
+ let value;
52
+ try {
53
+ value = (await import(url)).default;
54
+ }
55
+ catch (error) {
56
+ const message = error instanceof Error ? error.message : String(error);
57
+ const plugin = installed === undefined ? 'its JavaScript plugin' : 'npm package ' + installed.name + ' at ' + installed.manifest;
58
+ throw new Error(context.base + ' could not load ' + plugin + ': ' + message, { cause: error });
59
+ }
60
+ return javaScriptManifest(value, entry, context, installed?.manifest);
61
+ }
62
+ export async function javaScriptManifest(value, entry, context, packageFile) {
63
+ const { base, metadataOnly } = context;
64
+ if (!isRecord(value) || typeof value.create !== 'function') {
65
+ throw new Error(base + '/manifest/create must create the plugin operations');
66
+ }
67
+ const { create, ...metadata } = value;
68
+ const manifest = checkManifest(metadata, base);
69
+ const dockerField = dockerFields.find(key => Object.hasOwn(manifest, key));
70
+ if (dockerField)
71
+ throw new Error(base + '/manifest/' + dockerField + ' belongs in a Docker manifest');
72
+ const options = validatePluginOptions(manifest.optionsSchema, entry.options, base);
73
+ const unavailableReason = await unmetRequirement(readRequirements(manifest.requires, base + '/manifest/requires'), context.distribution?.packageUrl);
74
+ const version = packageFile === undefined ? manifest.version ?? '0.0.0' : await packageVersion(packageFile, base);
75
+ const versionSource = packageFile === undefined ? (manifest.version === undefined ? 'default' : 'manifest') : 'package.json';
76
+ const factory = !metadataOnly && unavailableReason === undefined
77
+ ? await createPlugin(manifest, create, options, context)
78
+ : { operations: [], produces: [] };
79
+ const plugin = { ...manifestPlugin(manifest, version), ...factory,
80
+ ...(options === undefined ? {} : { settings: options }), ...(unavailableReason === undefined ? {} : { unavailableReason }) };
81
+ return { plugin, versionSource, requires: manifest.requires, ...manifestScope(manifest, base) };
82
+ }
83
+ async function createPlugin(manifest, create, options, { root, base }) {
84
+ const created = await create(structuredClone(options), { root });
85
+ if (!isRecord(created) || !Array.isArray(created.operations) || !Array.isArray(created.produces)
86
+ || Object.keys(created).some(key => !['operations', 'produces'].includes(key))
87
+ || created.operations.some(operation => !isRecord(operation) || typeof operation.execute !== 'function')) {
88
+ throw new Error(base + '/manifest/create must return executable operations and declared products');
89
+ }
90
+ return manifestOperations(manifest, created);
91
+ }
92
+ async function packageVersion(path, base) {
93
+ const manifest = JSON.parse(await readFile(path, 'utf8'));
94
+ if (!isRecord(manifest) || typeof manifest.version !== 'string' || !manifest.version.trim()) {
95
+ throw new Error(base + ' has no version in ' + path);
96
+ }
97
+ return manifest.version;
98
+ }
99
+ //# sourceMappingURL=js-plugin.js.map
@@ -0,0 +1,12 @@
1
+ import type { Plugin } from '@repometry/core/internal/engine/plugin.js';
2
+ export interface MissingLanguagePlugin {
3
+ readonly language: string;
4
+ readonly files: number;
5
+ readonly packages: readonly string[];
6
+ }
7
+ export declare function detectMissingLanguages(plugins: readonly Plugin[]): {
8
+ candidate: (path: string) => boolean;
9
+ record(path: string): void;
10
+ results(): readonly MissingLanguagePlugin[];
11
+ };
12
+ export declare function missingLanguageNotice({ language, files, packages }: MissingLanguagePlugin): string;
@@ -0,0 +1,51 @@
1
+ import { posix } from 'node:path';
2
+ import { fileTypes } from '@repometry/core/internal/model/file-types.js';
3
+ import catalog from '../../resources/language-catalog.json' with { type: 'json' };
4
+ import { registeredPlugins } from './built-ins.js';
5
+ import { languageFileSelection } from './file-selection.js';
6
+ const fileTypesByExtension = new Map(fileTypes.flatMap(type => (type.extensions ?? []).map(extension => [extension, type.id])));
7
+ const officialByExtension = new Map();
8
+ const packagesByLanguage = new Map();
9
+ const labels = new Map(catalog.map(({ language, label }) => [language, label]));
10
+ for (const entry of catalog) {
11
+ const packages = packagesByLanguage.get(entry.language) ?? new Set();
12
+ packages.add(entry.package);
13
+ packagesByLanguage.set(entry.language, packages);
14
+ for (const extension of entry.extensions) {
15
+ if (fileTypesByExtension.get(extension) === entry.language)
16
+ officialByExtension.set(extension, entry.language);
17
+ }
18
+ }
19
+ export function detectMissingLanguages(plugins) {
20
+ const providers = registeredPlugins(plugins).filter(plugin => plugin.kinds.includes('language'));
21
+ const configured = new Set(providers.flatMap(plugin => plugin.providesLanguages?.map(({ id }) => id) ?? []));
22
+ const matchers = providers.filter(plugin => plugin.providesLanguages?.length || plugin.claims).map(plugin => languageFileSelection(plugin, plugin.providesLanguages ?? []).matches);
23
+ const counts = new Map();
24
+ function candidateLanguage(path) {
25
+ const language = officialByExtension.get(posix.extname(path));
26
+ return language === undefined || configured.has(language) ? undefined : language;
27
+ }
28
+ return {
29
+ candidate: (path) => candidateLanguage(path) !== undefined,
30
+ record(path) {
31
+ const language = candidateLanguage(path);
32
+ if (language === undefined || matchers.some(matches => matches(path)))
33
+ return;
34
+ counts.set(language, (counts.get(language) ?? 0) + 1);
35
+ },
36
+ results() {
37
+ return [...packagesByLanguage].flatMap(([language, packages]) => {
38
+ const files = counts.get(language);
39
+ return files === undefined ? [] : [{ language, files, packages: [...packages] }];
40
+ });
41
+ },
42
+ };
43
+ }
44
+ export function missingLanguageNotice({ language, files, packages }) {
45
+ const label = labels.get(language) ?? language;
46
+ const choices = packages.join(' or ');
47
+ const install = packages.map(name => 'npm install -D ' + name).join(' or ');
48
+ const noun = files === 1 ? 'file has' : 'files have';
49
+ return `${label}: ${files} ${noun} no configured parser. Install ${choices} next to Repometry (${install}) and add it to plugins in repometry.config.json.`;
50
+ }
51
+ //# sourceMappingURL=language-discovery.js.map
@@ -0,0 +1,64 @@
1
+ import type { Operation, Plugin } from '@repometry/core/internal/engine/plugin.js';
2
+ import type { ParserOrder, ParserPlugin } from './parser-order.js';
3
+ export { claimMatcher } from './file-selection.js';
4
+ export interface LanguageProvider {
5
+ readonly plugin: Plugin;
6
+ readonly operation: Operation;
7
+ readonly key: string;
8
+ readonly batch: boolean;
9
+ readonly language: (path: string) => string | undefined;
10
+ readonly implementationFor: (present: ReadonlySet<string>) => string | undefined;
11
+ }
12
+ export declare const defaultLanguages: {
13
+ select: (path: string) => LanguageProvider | undefined;
14
+ isSource: (path: string) => boolean;
15
+ id: (path: string) => string;
16
+ extensions: string[];
17
+ globs: string[];
18
+ catalog: {
19
+ id: string;
20
+ label: string;
21
+ color?: string | undefined;
22
+ }[];
23
+ providers: LanguageProvider[];
24
+ plugins: readonly ParserPlugin[];
25
+ reportSelection: (present: ReadonlySet<string>) => {
26
+ extensions: string[];
27
+ globs: string[];
28
+ catalog: {
29
+ id: string;
30
+ label: string;
31
+ color?: string | undefined;
32
+ }[];
33
+ };
34
+ describe: (plugin: ParserPlugin) => ParserPlugin;
35
+ syntax: (id: string) => import("@repometry/core/internal/model/language.js").LanguageSyntax | undefined;
36
+ skipped: (path: string) => boolean;
37
+ };
38
+ export type LanguageRegistry = ReturnType<typeof languageRegistry>;
39
+ export declare function languageRegistry(plugins: readonly Plugin[], parsers?: ParserOrder, label?: string): {
40
+ select: (path: string) => LanguageProvider | undefined;
41
+ isSource: (path: string) => boolean;
42
+ id: (path: string) => string;
43
+ extensions: string[];
44
+ globs: string[];
45
+ catalog: {
46
+ id: string;
47
+ label: string;
48
+ color?: string | undefined;
49
+ }[];
50
+ providers: LanguageProvider[];
51
+ plugins: readonly ParserPlugin[];
52
+ reportSelection: (present: ReadonlySet<string>) => {
53
+ extensions: string[];
54
+ globs: string[];
55
+ catalog: {
56
+ id: string;
57
+ label: string;
58
+ color?: string | undefined;
59
+ }[];
60
+ };
61
+ describe: (plugin: ParserPlugin) => ParserPlugin;
62
+ syntax: (id: string) => import("@repometry/core/internal/model/language.js").LanguageSyntax | undefined;
63
+ skipped: (path: string) => boolean;
64
+ };
@@ -0,0 +1,98 @@
1
+ import { plan } from '@repometry/core/internal/engine/plan.js';
2
+ import { fileTypeId, fileTypes } from '@repometry/core/internal/model/file-types.js';
3
+ import { codeStructure, codeStructures } from '@repometry/core/internal/model/code-structure.js';
4
+ import { isExcludedDirectory } from '@repometry/core/internal/model/snapshot.js';
5
+ import { describeProvider, selectedSyntax, selectParsers } from './parser-order.js';
6
+ import { languageMeasures, restrictStructureMeasures, structureImplementation } from './structure-measures.js';
7
+ import { builtInPluginIds, builtInPlugins, registeredPlugins } from './built-ins.js';
8
+ import { pluginRegistration } from './registered-plugin.js';
9
+ import { languageFileSelection } from './file-selection.js';
10
+ export { claimMatcher } from './file-selection.js';
11
+ const fileTypeSyntax = new Map(fileTypes.flatMap(({ id, syntax }) => syntax === undefined ? [] : [[id, syntax]]));
12
+ export const defaultLanguages = languageRegistry([]);
13
+ export function languageRegistry(plugins, parsers, label = 'parsers') {
14
+ const registered = registeredPlugins(plugins);
15
+ if (plugins.length)
16
+ validateRegistrations(plugins, registered);
17
+ const { selection, competing } = selectParsers(registered, parsers, label);
18
+ const byProvider = new Map();
19
+ for (const { plugin, language } of selection.values())
20
+ byProvider.set(plugin.id, [...byProvider.get(plugin.id) ?? [], language]);
21
+ const bindings = new Map();
22
+ const entries = registered.filter(plugin => plugin.kinds.includes('language')).flatMap(plugin => languageEntry(plugin, byProvider.get(plugin.id) ?? [], bindings));
23
+ const active = entries.flatMap(({ provider }) => provider ?? []);
24
+ const { extensions, globs, catalog } = languageSelection(entries);
25
+ const syntaxById = selectedSyntax(selection);
26
+ const bound = registered.map(plugin => bindings.get(plugin) ?? plugin);
27
+ return { select: (path) => match(path)?.provider, isSource: (path) => match(path) !== undefined,
28
+ id: (path) => match(path)?.identify(path) ?? fileTypeId(path), extensions, globs, catalog,
29
+ providers: active, plugins: bound,
30
+ reportSelection: (present) => languageSelection(entries.filter(entry => !entry.requiresSource || present.has(entry.id))),
31
+ describe: (plugin) => describeProvider(plugin, byProvider, competing),
32
+ syntax: (id) => selection.has(id) ? syntaxById.get(id) : fileTypeSyntax.get(id), skipped };
33
+ function skipped(path) {
34
+ const entry = match(path);
35
+ return entry !== undefined && entry.provider === undefined;
36
+ }
37
+ function match(path) {
38
+ let matched;
39
+ for (const entry of entries) {
40
+ if (!entry.matches(path))
41
+ continue;
42
+ if (matched)
43
+ throw new Error(`Parsers ${matched.id} and ${entry.id} both include ${path}`);
44
+ if (path.split('/').slice(0, -1).some(isExcludedDirectory))
45
+ return undefined;
46
+ matched = entry;
47
+ }
48
+ return matched;
49
+ }
50
+ }
51
+ function validateRegistrations(plugins, registered) {
52
+ if (plugins.some(plugin => builtInPluginIds.has(plugin.id) && !builtInPlugins.includes(plugin) && !pluginRegistration(plugin)?.builtIn)) {
53
+ throw new Error('An additional plugin uses a built-in plugin ID');
54
+ }
55
+ plan({ plugins: registered, select: [], inputs: new Map() });
56
+ }
57
+ function languageEntry(plugin, chosen, bindings) {
58
+ const declared = (plugin.providesLanguages ?? []).filter(language => chosen.includes(language));
59
+ const selected = !plugin.providesLanguages || declared.length > 0;
60
+ const available = plugin.unavailableReason === undefined;
61
+ const operation = available || plugin.operations.length ? parserOperation(plugin) : undefined;
62
+ if (operation && (!selected || !available)) {
63
+ bindings.set(plugin, { ...plugin, operations: plugin.operations.filter(item => item !== operation) });
64
+ }
65
+ if (!selected)
66
+ return [];
67
+ const { claims, matches, identify } = languageFileSelection(plugin, declared);
68
+ const provider = available && operation ? bindParser(plugin, operation, declared, identify) : undefined;
69
+ if (provider)
70
+ bindings.set(plugin, provider.plugin);
71
+ return [{ id: plugin.id, provider, declared, claims, matches, identify, requiresSource: plugin.languageProvenanceRequiresSource }];
72
+ }
73
+ function languageSelection(entries) {
74
+ const available = entries.filter(({ provider }) => provider !== undefined);
75
+ const unavailable = entries.filter(({ provider }) => provider === undefined);
76
+ const claims = [...available, ...unavailable].flatMap(entry => entry.claims);
77
+ const extensions = [...new Set(claims.flatMap(entry => entry.extensions ?? []))];
78
+ const globs = [...new Set(claims.flatMap(entry => entry.globs ?? []))];
79
+ const catalog = available.flatMap(({ declared }) => declared.map(({ id, label, color }) => ({ id, label, ...(color === undefined ? {} : { color }) })));
80
+ return { extensions, globs, catalog };
81
+ }
82
+ function parserOperation(plugin) {
83
+ const operations = plugin.operations.filter(operation => operation.role === 'provider'
84
+ && operation.output.id === (operation.scope === 'repository' ? codeStructures.id : codeStructure.id));
85
+ const [operation] = operations;
86
+ if (!operation || operations.length !== 1 || (!plugin.claims && !plugin.providesLanguages?.length)) {
87
+ throw new Error(`Language plugin ${plugin.id} must declare languages with include patterns and provide exactly one code structure operation`);
88
+ }
89
+ return operation;
90
+ }
91
+ function bindParser(plugin, operation, declared, language) {
92
+ const measured = languageMeasures(declared);
93
+ const bound = restrictStructureMeasures(operation, measured, language);
94
+ const executable = bound === operation ? plugin : { ...plugin, operations: plugin.operations.map(item => item === operation ? bound : item) };
95
+ return { plugin: executable, operation: bound, key: `${plugin.id}/${operation.id}`, batch: operation.scope === 'repository', language,
96
+ implementationFor: present => structureImplementation(operation, new Map([...measured].filter(([id]) => present.has(id)))) };
97
+ }
98
+ //# sourceMappingURL=languages.js.map
@@ -0,0 +1,6 @@
1
+ import type { PluginReference } from './plugin-reference.js';
2
+ import type { RegisteredPlugin } from './registered-plugin.js';
3
+ import type { PluginManifest } from '@repometry/core/internal/engine/plugin-manifest.js';
4
+ import type { Distribution } from './distribution.js';
5
+ export type PluginInput = string | PluginReference | PluginManifest;
6
+ export declare function loadPlugins(entries: readonly PluginInput[], root: string, configFile: string | undefined, metadataOnly?: boolean, distribution?: Distribution): Promise<RegisteredPlugin[]>;