repometry 0.0.0-stage → 0.2.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 (274) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +28 -2
  3. package/package.json +64 -4
  4. package/target/main/resources/report/json/compact-json-v1.schema.json +24 -0
  5. package/target/main/resources/report/json/comparison-v1.schema.json +65 -0
  6. package/target/main/resources/report/json/config-v1.schema.json +33 -0
  7. package/target/main/resources/report/json/diff-coverage-v1.schema.json +55 -0
  8. package/target/main/resources/report/json/file-metrics-v1.schema.json +134 -0
  9. package/target/main/resources/report/json/inspection-context-v1.schema.json +172 -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/public-history-v1.schema.json +50 -0
  13. package/target/main/resources/report/json/pull-review-v1.schema.json +97 -0
  14. package/target/main/resources/report/json/quality-history-v1.schema.json +51 -0
  15. package/target/main/resources/report/json/report-v1.schema.json +65 -0
  16. package/target/main/resources/report/json/report-v2.schema.json +252 -0
  17. package/target/main/resources/report/json/repository-summary-v1.schema.json +181 -0
  18. package/target/main/resources/report/json/viewer-details-v1.schema.json +343 -0
  19. package/target/main/resources/report/json/viewer-inspection-v1.schema.json +13 -0
  20. package/target/main/resources/viewer/files.css +578 -0
  21. package/target/main/resources/viewer/index.html +120 -0
  22. package/target/main/resources/viewer/projects.html +52 -0
  23. package/target/main/resources/viewer/styles.css +560 -0
  24. package/target/main/resources/viewer/viewer-pulls.css +64 -0
  25. package/target/main/ts/api/gh/github.d.ts +6 -0
  26. package/target/main/ts/api/gh/github.js +92 -0
  27. package/target/main/ts/api/git/blob-batch.d.ts +10 -0
  28. package/target/main/ts/api/git/blob-batch.js +106 -0
  29. package/target/main/ts/api/git/changes.d.ts +22 -0
  30. package/target/main/ts/api/git/changes.js +108 -0
  31. package/target/main/ts/api/git/commit-metadata.d.ts +3 -0
  32. package/target/main/ts/api/git/commit-metadata.js +53 -0
  33. package/target/main/ts/api/git/git-churn.d.ts +9 -0
  34. package/target/main/ts/api/git/git-churn.js +71 -0
  35. package/target/main/ts/api/git/git-reader.d.ts +16 -0
  36. package/target/main/ts/api/git/git-reader.js +74 -0
  37. package/target/main/ts/api/git/git.d.ts +21 -0
  38. package/target/main/ts/api/git/git.js +153 -0
  39. package/target/main/ts/api/git/inspection-source.d.ts +15 -0
  40. package/target/main/ts/api/git/inspection-source.js +31 -0
  41. package/target/main/ts/api/git/local-sources.d.ts +5 -0
  42. package/target/main/ts/api/git/local-sources.js +47 -0
  43. package/target/main/ts/api/git/local.d.ts +3 -0
  44. package/target/main/ts/api/git/local.js +36 -0
  45. package/target/main/ts/api/git/metabranch-worktree.d.ts +1 -0
  46. package/target/main/ts/api/git/metabranch-worktree.js +35 -0
  47. package/target/main/ts/api/git/source-cache.d.ts +3 -0
  48. package/target/main/ts/api/git/source-cache.js +57 -0
  49. package/target/main/ts/api/import/finding-import.d.ts +9 -0
  50. package/target/main/ts/api/import/finding-import.js +227 -0
  51. package/target/main/ts/api/import/lcov-files.d.ts +5 -0
  52. package/target/main/ts/api/import/lcov-files.js +14 -0
  53. package/target/main/ts/api/import/profile-file.d.ts +4 -0
  54. package/target/main/ts/api/import/profile-file.js +17 -0
  55. package/target/main/ts/api/worker/remote-executor.d.ts +2 -0
  56. package/target/main/ts/api/worker/remote-executor.js +46 -0
  57. package/target/main/ts/api/worker/worker-protocol.d.ts +7 -0
  58. package/target/main/ts/api/worker/worker-protocol.js +102 -0
  59. package/target/main/ts/api/worker/worker.d.ts +5 -0
  60. package/target/main/ts/api/worker/worker.js +86 -0
  61. package/target/main/ts/cli/arguments.d.ts +28 -0
  62. package/target/main/ts/cli/arguments.js +111 -0
  63. package/target/main/ts/cli/config.d.ts +13 -0
  64. package/target/main/ts/cli/config.js +58 -0
  65. package/target/main/ts/cli/imports.d.ts +7 -0
  66. package/target/main/ts/cli/imports.js +30 -0
  67. package/target/main/ts/cli/main.d.ts +2 -0
  68. package/target/main/ts/cli/main.js +379 -0
  69. package/target/main/ts/cli/reporting.d.ts +18 -0
  70. package/target/main/ts/cli/reporting.js +104 -0
  71. package/target/main/ts/cli/revisions.d.ts +6 -0
  72. package/target/main/ts/cli/revisions.js +16 -0
  73. package/target/main/ts/cli/store.d.ts +13 -0
  74. package/target/main/ts/cli/store.js +39 -0
  75. package/target/main/ts/compose/analyze-snapshot.d.ts +4 -0
  76. package/target/main/ts/compose/analyze-snapshot.js +164 -0
  77. package/target/main/ts/compose/attach-churn.d.ts +2 -0
  78. package/target/main/ts/compose/attach-churn.js +50 -0
  79. package/target/main/ts/compose/diff-coverage.d.ts +20 -0
  80. package/target/main/ts/compose/diff-coverage.js +57 -0
  81. package/target/main/ts/compose/inspect.d.ts +23 -0
  82. package/target/main/ts/compose/inspect.js +45 -0
  83. package/target/main/ts/compose/plugin-list.d.ts +6 -0
  84. package/target/main/ts/compose/plugin-list.js +10 -0
  85. package/target/main/ts/compose/prepare-metabranch.d.ts +9 -0
  86. package/target/main/ts/compose/prepare-metabranch.js +17 -0
  87. package/target/main/ts/compose/review.d.ts +16 -0
  88. package/target/main/ts/compose/review.js +39 -0
  89. package/target/main/ts/compose/sources.d.ts +3 -0
  90. package/target/main/ts/compose/sources.js +30 -0
  91. package/target/main/ts/core/engine/execute.d.ts +10 -0
  92. package/target/main/ts/core/engine/execute.js +50 -0
  93. package/target/main/ts/core/engine/manifest.d.ts +4 -0
  94. package/target/main/ts/core/engine/manifest.js +105 -0
  95. package/target/main/ts/core/engine/plan.d.ts +22 -0
  96. package/target/main/ts/core/engine/plan.js +107 -0
  97. package/target/main/ts/core/engine/plugin.d.ts +59 -0
  98. package/target/main/ts/core/engine/plugin.js +4 -0
  99. package/target/main/ts/core/engine/report-products.d.ts +16 -0
  100. package/target/main/ts/core/engine/report-products.js +86 -0
  101. package/target/main/ts/core/model/changes.d.ts +8 -0
  102. package/target/main/ts/core/model/changes.js +2 -0
  103. package/target/main/ts/core/model/churn.d.ts +11 -0
  104. package/target/main/ts/core/model/churn.js +5 -0
  105. package/target/main/ts/core/model/clone-source.d.ts +16 -0
  106. package/target/main/ts/core/model/clone-source.js +15 -0
  107. package/target/main/ts/core/model/code-structure.d.ts +30 -0
  108. package/target/main/ts/core/model/code-structure.js +32 -0
  109. package/target/main/ts/core/model/comparison.d.ts +24 -0
  110. package/target/main/ts/core/model/comparison.js +1 -0
  111. package/target/main/ts/core/model/diff-coverage.d.ts +23 -0
  112. package/target/main/ts/core/model/diff-coverage.js +1 -0
  113. package/target/main/ts/core/model/finding-ignore.d.ts +8 -0
  114. package/target/main/ts/core/model/finding-ignore.js +36 -0
  115. package/target/main/ts/core/model/finding.d.ts +28 -0
  116. package/target/main/ts/core/model/finding.js +29 -0
  117. package/target/main/ts/core/model/ignore-rule.d.ts +11 -0
  118. package/target/main/ts/core/model/ignore-rule.js +1 -0
  119. package/target/main/ts/core/model/measurement.d.ts +33 -0
  120. package/target/main/ts/core/model/measurement.js +30 -0
  121. package/target/main/ts/core/model/metric-descriptor.d.ts +17 -0
  122. package/target/main/ts/core/model/metric-descriptor.js +1 -0
  123. package/target/main/ts/core/model/plugin-data.d.ts +25 -0
  124. package/target/main/ts/core/model/plugin-data.js +1 -0
  125. package/target/main/ts/core/model/pull-review.d.ts +48 -0
  126. package/target/main/ts/core/model/pull-review.js +1 -0
  127. package/target/main/ts/core/model/quality-summary.d.ts +42 -0
  128. package/target/main/ts/core/model/quality-summary.js +64 -0
  129. package/target/main/ts/core/model/report.d.ts +40 -0
  130. package/target/main/ts/core/model/report.js +5 -0
  131. package/target/main/ts/core/model/scanner-import.d.ts +39 -0
  132. package/target/main/ts/core/model/scanner-import.js +29 -0
  133. package/target/main/ts/core/model/snapshot.d.ts +15 -0
  134. package/target/main/ts/core/model/snapshot.js +51 -0
  135. package/target/main/ts/core/model/source-locator.d.ts +7 -0
  136. package/target/main/ts/core/model/source-locator.js +1 -0
  137. package/target/main/ts/core/model/source.d.ts +23 -0
  138. package/target/main/ts/core/model/source.js +1 -0
  139. package/target/main/ts/core/ports/report.d.ts +9 -0
  140. package/target/main/ts/core/ports/report.js +2 -0
  141. package/target/main/ts/core/ports/source-provider.d.ts +14 -0
  142. package/target/main/ts/core/ports/source-provider.js +5 -0
  143. package/target/main/ts/core/profile/exclusions.d.ts +11 -0
  144. package/target/main/ts/core/profile/exclusions.js +58 -0
  145. package/target/main/ts/core/profile/maintainability.d.ts +31 -0
  146. package/target/main/ts/core/profile/maintainability.js +10 -0
  147. package/target/main/ts/core/profile/profile.d.ts +4 -0
  148. package/target/main/ts/core/profile/profile.js +11 -0
  149. package/target/main/ts/core/usecases/compare.d.ts +6 -0
  150. package/target/main/ts/core/usecases/compare.js +146 -0
  151. package/target/main/ts/core/usecases/diff-coverage-policy.d.ts +6 -0
  152. package/target/main/ts/core/usecases/diff-coverage-policy.js +11 -0
  153. package/target/main/ts/core/usecases/diff-coverage.d.ts +40 -0
  154. package/target/main/ts/core/usecases/diff-coverage.js +16 -0
  155. package/target/main/ts/core/usecases/inspect.d.ts +38 -0
  156. package/target/main/ts/core/usecases/inspect.js +42 -0
  157. package/target/main/ts/core/usecases/review.d.ts +31 -0
  158. package/target/main/ts/core/usecases/review.js +129 -0
  159. package/target/main/ts/index.d.ts +35 -0
  160. package/target/main/ts/index.js +18 -0
  161. package/target/main/ts/plugin.d.ts +14 -0
  162. package/target/main/ts/plugin.js +6 -0
  163. package/target/main/ts/plugins/coverage/coverage.d.ts +25 -0
  164. package/target/main/ts/plugins/coverage/coverage.js +199 -0
  165. package/target/main/ts/plugins/coverage/diff-coverage.d.ts +7 -0
  166. package/target/main/ts/plugins/coverage/diff-coverage.js +90 -0
  167. package/target/main/ts/plugins/duplication/duplication.d.ts +4 -0
  168. package/target/main/ts/plugins/duplication/duplication.js +94 -0
  169. package/target/main/ts/plugins/language-js/babel-provider.d.ts +10 -0
  170. package/target/main/ts/plugins/language-js/babel-provider.js +47 -0
  171. package/target/main/ts/plugins/language-js/clone-candidates.d.ts +3 -0
  172. package/target/main/ts/plugins/language-js/clone-candidates.js +65 -0
  173. package/target/main/ts/plugins/language-js/code-lines.d.ts +6 -0
  174. package/target/main/ts/plugins/language-js/code-lines.js +36 -0
  175. package/target/main/ts/plugins/language-js/function-facts.d.ts +8 -0
  176. package/target/main/ts/plugins/language-js/function-facts.js +61 -0
  177. package/target/main/ts/plugins/language-js/structural-observations.d.ts +8 -0
  178. package/target/main/ts/plugins/language-js/structural-observations.js +80 -0
  179. package/target/main/ts/plugins/maintainability/maintainability.d.ts +9 -0
  180. package/target/main/ts/plugins/maintainability/maintainability.js +43 -0
  181. package/target/main/ts/plugins/maintainability/structural-smells.d.ts +3 -0
  182. package/target/main/ts/plugins/maintainability/structural-smells.js +16 -0
  183. package/target/main/ts/plugins/source/forges.d.ts +4 -0
  184. package/target/main/ts/plugins/source/forges.js +80 -0
  185. package/target/main/ts/plugins/structure/structure.d.ts +2 -0
  186. package/target/main/ts/plugins/structure/structure.js +38 -0
  187. package/target/main/ts/report/html/app/viewer-chart.d.ts +101 -0
  188. package/target/main/ts/report/html/app/viewer-chart.js +711 -0
  189. package/target/main/ts/report/html/app/viewer-commits.d.ts +36 -0
  190. package/target/main/ts/report/html/app/viewer-commits.js +280 -0
  191. package/target/main/ts/report/html/app/viewer-data.d.ts +23 -0
  192. package/target/main/ts/report/html/app/viewer-data.js +105 -0
  193. package/target/main/ts/report/html/app/viewer-files.d.ts +117 -0
  194. package/target/main/ts/report/html/app/viewer-files.js +2104 -0
  195. package/target/main/ts/report/html/app/viewer-filter.d.ts +113 -0
  196. package/target/main/ts/report/html/app/viewer-filter.js +492 -0
  197. package/target/main/ts/report/html/app/viewer-metric-registry.d.ts +70 -0
  198. package/target/main/ts/report/html/app/viewer-metric-registry.js +224 -0
  199. package/target/main/ts/report/html/app/viewer-metrics.d.ts +44 -0
  200. package/target/main/ts/report/html/app/viewer-metrics.js +172 -0
  201. package/target/main/ts/report/html/app/viewer-profile.d.ts +17 -0
  202. package/target/main/ts/report/html/app/viewer-profile.js +401 -0
  203. package/target/main/ts/report/html/app/viewer-projects.d.ts +1 -0
  204. package/target/main/ts/report/html/app/viewer-projects.js +90 -0
  205. package/target/main/ts/report/html/app/viewer-pulls.d.ts +3 -0
  206. package/target/main/ts/report/html/app/viewer-pulls.js +242 -0
  207. package/target/main/ts/report/html/app/viewer-source.d.ts +75 -0
  208. package/target/main/ts/report/html/app/viewer-source.js +313 -0
  209. package/target/main/ts/report/html/app/viewer-trends.d.ts +73 -0
  210. package/target/main/ts/report/html/app/viewer-trends.js +423 -0
  211. package/target/main/ts/report/html/app/viewer.d.ts +1 -0
  212. package/target/main/ts/report/html/app/viewer.js +735 -0
  213. package/target/main/ts/report/html/site/badges.d.ts +14 -0
  214. package/target/main/ts/report/html/site/badges.js +40 -0
  215. package/target/main/ts/report/html/site/export-site.d.ts +22 -0
  216. package/target/main/ts/report/html/site/export-site.js +150 -0
  217. package/target/main/ts/report/html/site/exported-server.d.ts +6 -0
  218. package/target/main/ts/report/html/site/exported-server.js +71 -0
  219. package/target/main/ts/report/html/site/local-server.d.ts +7 -0
  220. package/target/main/ts/report/html/site/local-server.js +65 -0
  221. package/target/main/ts/report/html/site/projects.d.ts +3 -0
  222. package/target/main/ts/report/html/site/projects.js +80 -0
  223. package/target/main/ts/report/html/site/server.d.ts +4 -0
  224. package/target/main/ts/report/html/site/server.js +65 -0
  225. package/target/main/ts/report/html/site/source-route.d.ts +6 -0
  226. package/target/main/ts/report/html/site/source-route.js +23 -0
  227. package/target/main/ts/report/json/projections/commit-summary.d.ts +12 -0
  228. package/target/main/ts/report/json/projections/commit-summary.js +124 -0
  229. package/target/main/ts/report/json/projections/components.d.ts +4 -0
  230. package/target/main/ts/report/json/projections/components.js +30 -0
  231. package/target/main/ts/report/json/projections/file-metrics.d.ts +5 -0
  232. package/target/main/ts/report/json/projections/file-metrics.js +244 -0
  233. package/target/main/ts/report/json/projections/inspection-context.d.ts +6 -0
  234. package/target/main/ts/report/json/projections/inspection-context.js +93 -0
  235. package/target/main/ts/report/json/projections/inspection-details.d.ts +11 -0
  236. package/target/main/ts/report/json/projections/inspection-details.js +70 -0
  237. package/target/main/ts/report/json/projections/metric-values.d.ts +7 -0
  238. package/target/main/ts/report/json/projections/metric-values.js +58 -0
  239. package/target/main/ts/report/json/projections/public-history.d.ts +4 -0
  240. package/target/main/ts/report/json/projections/public-history.js +17 -0
  241. package/target/main/ts/report/json/store/components.d.ts +2 -0
  242. package/target/main/ts/report/json/store/components.js +32 -0
  243. package/target/main/ts/report/json/store/local-store.d.ts +13 -0
  244. package/target/main/ts/report/json/store/local-store.js +180 -0
  245. package/target/main/ts/report/json/store/pull-review-store.d.ts +3 -0
  246. package/target/main/ts/report/json/store/pull-review-store.js +52 -0
  247. package/target/main/ts/report/json/validation/metabranch.d.ts +4 -0
  248. package/target/main/ts/report/json/validation/metabranch.js +8 -0
  249. package/target/main/ts/report/json/validation/report.d.ts +15 -0
  250. package/target/main/ts/report/json/validation/report.js +65 -0
  251. package/target/main/ts/report/json/validation/summary-validation.d.ts +4 -0
  252. package/target/main/ts/report/json/validation/summary-validation.js +28 -0
  253. package/target/main/ts/report/json/wire/compact-json.d.ts +11 -0
  254. package/target/main/ts/report/json/wire/compact-json.js +76 -0
  255. package/target/main/ts/report/json/wire/component-model.d.ts +9 -0
  256. package/target/main/ts/report/json/wire/component-model.js +1 -0
  257. package/target/main/ts/report/json/wire/domain-types.d.ts +2 -0
  258. package/target/main/ts/report/json/wire/domain-types.js +1 -0
  259. package/target/main/ts/report/json/wire/file-metrics-model.d.ts +77 -0
  260. package/target/main/ts/report/json/wire/file-metrics-model.js +1 -0
  261. package/target/main/ts/report/json/wire/inspection-context-model.d.ts +26 -0
  262. package/target/main/ts/report/json/wire/inspection-context-model.js +1 -0
  263. package/target/main/ts/report/json/wire/inspection-details-model.d.ts +82 -0
  264. package/target/main/ts/report/json/wire/inspection-details-model.js +1 -0
  265. package/target/main/ts/report/json/wire/project-model.d.ts +7 -0
  266. package/target/main/ts/report/json/wire/project-model.js +1 -0
  267. package/target/main/ts/report/json/wire/public-history-model.d.ts +42 -0
  268. package/target/main/ts/report/json/wire/public-history-model.js +6 -0
  269. package/target/main/ts/report/json/wire/pull-review-model.d.ts +7 -0
  270. package/target/main/ts/report/json/wire/pull-review-model.js +1 -0
  271. package/target/main/ts/report/json/wire/summary-model.d.ts +45 -0
  272. package/target/main/ts/report/json/wire/summary-model.js +1 -0
  273. package/target/main/ts/report.d.ts +11 -0
  274. package/target/main/ts/report.js +6 -0
@@ -0,0 +1,28 @@
1
+ import type { DataContract } from '../engine/plugin.js';
2
+ import type { Measurement } from './measurement.js';
3
+ export declare const findingCategories: readonly ['structure', 'duplication', 'lint', 'security', 'dependency', 'secret', 'infrastructure'];
4
+ export declare const findingLevels: readonly ['low', 'medium', 'high', 'unknown'];
5
+ export interface FindingLocation {
6
+ readonly path: string;
7
+ readonly line: number;
8
+ readonly endLine: number;
9
+ }
10
+ export interface Finding {
11
+ readonly tool: string;
12
+ readonly rule: string;
13
+ readonly category: typeof findingCategories[number];
14
+ readonly level: typeof findingLevels[number];
15
+ readonly message: string;
16
+ readonly path?: string;
17
+ readonly line?: number;
18
+ readonly endLine?: number;
19
+ readonly effortMinutes?: number;
20
+ readonly related?: readonly FindingLocation[];
21
+ }
22
+ export declare function isSensitiveFinding(category: Finding['category']): boolean;
23
+ export declare function isFinding(value: unknown): value is Finding;
24
+ export interface FindingResult {
25
+ readonly measurements: readonly Measurement[];
26
+ readonly findings: readonly Finding[];
27
+ }
28
+ export declare const findingResult: DataContract<FindingResult>;
@@ -0,0 +1,29 @@
1
+ import { isRecord } from '../engine/plugin.js';
2
+ import { measurements } from './measurement.js';
3
+ export const findingCategories = ['structure', 'duplication', 'lint', 'security', 'dependency', 'secret', 'infrastructure'];
4
+ export const findingLevels = ['low', 'medium', 'high', 'unknown'];
5
+ export function isSensitiveFinding(category) {
6
+ return category === 'security' || category === 'dependency' || category === 'secret' || category === 'infrastructure';
7
+ }
8
+ function count(value, minimum) {
9
+ return typeof value === 'number' && Number.isSafeInteger(value) && value >= minimum;
10
+ }
11
+ function isLocation(value) {
12
+ return isRecord(value) && typeof value.path === 'string' && value.path.length > 0
13
+ && count(value.line, 1) && count(value.endLine, value.line);
14
+ }
15
+ export function isFinding(value) {
16
+ return isRecord(value) && typeof value.tool === 'string' && value.tool.length > 0
17
+ && typeof value.rule === 'string' && value.rule.length > 0 && typeof value.message === 'string' && value.message.length > 0
18
+ && findingCategories.some(category => category === value.category) && findingLevels.some(level => level === value.level)
19
+ && (value.path === undefined || (typeof value.path === 'string' && value.path.length > 0))
20
+ && (value.line === undefined || (value.path !== undefined && count(value.line, 1)))
21
+ && (value.endLine === undefined || (typeof value.line === 'number' && count(value.endLine, value.line)))
22
+ && (value.effortMinutes === undefined || count(value.effortMinutes, 0))
23
+ && (value.related === undefined || (Array.isArray(value.related) && value.related.every(isLocation)));
24
+ }
25
+ export const findingResult = {
26
+ id: 'repometry.findings-and-measurements/v1',
27
+ accepts: (value) => isRecord(value) && measurements.accepts(value.measurements)
28
+ && Array.isArray(value.findings) && value.findings.every(isFinding),
29
+ };
@@ -0,0 +1,11 @@
1
+ import type { Finding } from './finding.js';
2
+ export interface FindingIgnoreRule {
3
+ readonly tool?: string;
4
+ readonly rule?: string;
5
+ readonly path?: string;
6
+ readonly reason?: string;
7
+ }
8
+ export interface IgnoredFinding {
9
+ readonly finding: Finding;
10
+ readonly matchedRule: number;
11
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,33 @@
1
+ import type { DataContract } from '../engine/plugin.js';
2
+ export declare const definitions: {
3
+ readonly lines: 'repometry.physical-lines/v1';
4
+ readonly functions: 'repometry.functions/v1';
5
+ readonly complexity: 'repometry.cyclomatic-babel/v1';
6
+ readonly coverage: 'repometry.lcov-line-coverage/v1';
7
+ readonly coveredLines: 'repometry.lcov-covered-lines/v1';
8
+ readonly coverableLines: 'repometry.lcov-coverable-lines/v1';
9
+ readonly branchCoverage: 'repometry.lcov-branch-coverage/v1';
10
+ readonly coveredBranches: 'repometry.lcov-covered-branches/v1';
11
+ readonly coverableBranches: 'repometry.lcov-coverable-branches/v1';
12
+ readonly functionCoverage: 'repometry.lcov-function-coverage/v1';
13
+ readonly coveredFunctions: 'repometry.lcov-covered-functions/v1';
14
+ readonly coverableFunctions: 'repometry.lcov-coverable-functions/v1';
15
+ readonly codeLines: 'repometry.code-lines-babel/v1';
16
+ readonly comments: 'repometry.comment-lines-babel/v1';
17
+ readonly classes: 'repometry.classes-babel/v1';
18
+ readonly cognitiveComplexity: 'repometry.cognitive-babel/v1';
19
+ readonly duplicatedLines: 'repometry.duplicated-lines-babel/v1';
20
+ readonly churn: 'repometry.git-change-frequency/v1';
21
+ };
22
+ export interface Measurement {
23
+ readonly definition: string;
24
+ readonly target: 'repository' | 'file' | 'function';
25
+ readonly value: number | null;
26
+ readonly path?: string;
27
+ readonly line?: number;
28
+ readonly column?: number;
29
+ readonly name?: string;
30
+ readonly covered?: number;
31
+ readonly total?: number;
32
+ }
33
+ export declare const measurements: DataContract<readonly Measurement[]>;
@@ -0,0 +1,30 @@
1
+ import { isRecord } from '../engine/plugin.js';
2
+ export const definitions = {
3
+ lines: 'repometry.physical-lines/v1',
4
+ functions: 'repometry.functions/v1',
5
+ complexity: 'repometry.cyclomatic-babel/v1',
6
+ coverage: 'repometry.lcov-line-coverage/v1',
7
+ coveredLines: 'repometry.lcov-covered-lines/v1',
8
+ coverableLines: 'repometry.lcov-coverable-lines/v1',
9
+ branchCoverage: 'repometry.lcov-branch-coverage/v1',
10
+ coveredBranches: 'repometry.lcov-covered-branches/v1',
11
+ coverableBranches: 'repometry.lcov-coverable-branches/v1',
12
+ functionCoverage: 'repometry.lcov-function-coverage/v1',
13
+ coveredFunctions: 'repometry.lcov-covered-functions/v1',
14
+ coverableFunctions: 'repometry.lcov-coverable-functions/v1',
15
+ codeLines: 'repometry.code-lines-babel/v1',
16
+ comments: 'repometry.comment-lines-babel/v1',
17
+ classes: 'repometry.classes-babel/v1',
18
+ cognitiveComplexity: 'repometry.cognitive-babel/v1',
19
+ duplicatedLines: 'repometry.duplicated-lines-babel/v1',
20
+ churn: 'repometry.git-change-frequency/v1',
21
+ };
22
+ function isMeasurement(value) {
23
+ return isRecord(value) && typeof value.definition === 'string'
24
+ && (value.target === 'repository' || value.target === 'file' || value.target === 'function')
25
+ && (value.value === null || (typeof value.value === 'number' && Number.isFinite(value.value)));
26
+ }
27
+ export const measurements = {
28
+ id: 'repometry.measurements/v1',
29
+ accepts: (value) => Array.isArray(value) && value.every(isMeasurement),
30
+ };
@@ -0,0 +1,17 @@
1
+ export type MetricScope = 'repository' | 'file' | 'function';
2
+ export interface MetricDescriptor {
3
+ readonly id: string;
4
+ readonly label: string;
5
+ readonly short?: string;
6
+ readonly description?: string;
7
+ readonly unit: 'count' | 'ratio' | 'minutes';
8
+ readonly scope: MetricScope;
9
+ readonly aggregate: 'sum' | 'max' | 'none';
10
+ readonly ratio?: {
11
+ readonly of: string;
12
+ readonly over: string;
13
+ };
14
+ readonly better: 'lower' | 'higher' | 'none';
15
+ readonly bands?: readonly [number, number, number, number];
16
+ readonly group?: string;
17
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,25 @@
1
+ import type { MetricDescriptor, PluginConfigSchema, RuleDescriptor } from '../engine/plugin.js';
2
+ import type { InventoryFile } from './source.js';
3
+ export type JsonValue = null | boolean | number | string | readonly JsonValue[] | {
4
+ readonly [key: string]: JsonValue;
5
+ };
6
+ export interface PersistedProduct {
7
+ readonly operation: string;
8
+ readonly path?: string;
9
+ readonly value: JsonValue;
10
+ }
11
+ export interface PluginData {
12
+ readonly metrics: readonly MetricDescriptor[];
13
+ readonly measured: readonly string[];
14
+ readonly privateMetrics?: readonly string[];
15
+ readonly rules: readonly {
16
+ readonly plugin: string;
17
+ readonly rules: readonly RuleDescriptor[];
18
+ }[];
19
+ readonly products: Readonly<Record<string, readonly PersistedProduct[]>>;
20
+ readonly contracts?: Readonly<Record<string, PluginConfigSchema>>;
21
+ readonly inventory?: readonly (InventoryFile & {
22
+ readonly language: string;
23
+ readonly analysed: boolean;
24
+ })[];
25
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,48 @@
1
+ import type { DiffCoverage } from './diff-coverage.js';
2
+ import type { InspectionComparison } from './comparison.js';
3
+ import type { Finding } from './finding.js';
4
+ export declare const pullReviewSchema = "urn:repometry:schema:pull-review:1";
5
+ type LineCoverage = InspectionComparison['metrics']['lineCoverage'];
6
+ type GateStatus = 'passed' | 'failed' | 'not-applicable' | 'indeterminate';
7
+ export interface PullReview {
8
+ readonly schema: typeof pullReviewSchema;
9
+ readonly number: number | null;
10
+ readonly generatedAt: string;
11
+ readonly base: string;
12
+ readonly mergeBase: string;
13
+ readonly head: string;
14
+ readonly coverage: {
15
+ readonly base: LineCoverage['baseline'] | null;
16
+ readonly head: LineCoverage['current'] | null;
17
+ readonly delta: number | null;
18
+ readonly reason: LineCoverage['reason'] | 'reports-unavailable' | 'head-coverage-changed';
19
+ readonly gate: {
20
+ readonly status: GateStatus;
21
+ readonly maxDrop: number;
22
+ } | null;
23
+ };
24
+ readonly diff: Pick<DiffCoverage, 'covered' | 'total' | 'percent' | 'files' | 'gaps'> & {
25
+ readonly status: DiffCoverage['status'] | 'unavailable';
26
+ readonly excludedPaths: readonly string[] | null;
27
+ readonly coverageInputDigest: string | null;
28
+ readonly uncovered: readonly {
29
+ readonly path: string;
30
+ readonly lines: readonly number[];
31
+ }[];
32
+ readonly gate: {
33
+ readonly status: GateStatus;
34
+ readonly minimumPercent: number;
35
+ readonly minimumLines: number;
36
+ } | null;
37
+ };
38
+ readonly findings: {
39
+ readonly added: readonly Finding[] | null;
40
+ readonly qualityCount: number | null;
41
+ readonly reason: 'reports-unavailable' | 'findings-unavailable' | 'partial-inspection' | 'analysis-changed' | null;
42
+ readonly gate: {
43
+ readonly status: GateStatus;
44
+ readonly maximum: number;
45
+ } | null;
46
+ };
47
+ }
48
+ export {};
@@ -0,0 +1 @@
1
+ export const pullReviewSchema = 'urn:repometry:schema:pull-review:1';
@@ -0,0 +1,42 @@
1
+ import type { Report } from './report.js';
2
+ export type Grade = 'A' | 'B' | 'C' | 'D' | 'F';
3
+ export interface QualitySummary {
4
+ readonly codeLines: number | null;
5
+ readonly comments: number | null;
6
+ readonly classes: number | null;
7
+ readonly cognitiveComplexity: number | null;
8
+ readonly duplication: {
9
+ readonly duplicatedLines: number;
10
+ readonly codeLines: number;
11
+ readonly ratio: number | null;
12
+ } | null;
13
+ readonly maintainability: {
14
+ readonly smells: number;
15
+ readonly effortMinutes: number;
16
+ readonly debtRatio: number | null;
17
+ readonly grade: Grade | null;
18
+ } | null;
19
+ }
20
+ interface DebtModel {
21
+ readonly name: 'basic-cocomo-organic';
22
+ readonly scale: number;
23
+ readonly exponent: number;
24
+ readonly minutesPerPersonMonth: number;
25
+ }
26
+ export declare const debtModel: DebtModel;
27
+ export declare function qualitySummary(report: Report): QualitySummary;
28
+ export declare function technicalDebtRatio(effortMinutes: number, codeLines: number, model?: DebtModel): number | null;
29
+ export declare function maintainabilityGrade(debtRatio: number): Grade;
30
+ export declare function coverageGrade(ratio: number): Grade;
31
+ /**
32
+ * Security as a grade, not a risk level: A with no findings, then B, C, D and F by the worst severity found
33
+ * (low or unclassified, medium, high, critical). A high risk is a low grade.
34
+ */
35
+ export declare function securityGrade(counts: {
36
+ readonly critical?: number;
37
+ readonly high: number;
38
+ readonly medium: number;
39
+ readonly low: number;
40
+ readonly unknown: number;
41
+ }): Grade;
42
+ export {};
@@ -0,0 +1,64 @@
1
+ import { isRecord } from '../engine/plugin.js';
2
+ import { definitions } from './measurement.js';
3
+ export const debtModel = { name: 'basic-cocomo-organic', scale: 2.4, exponent: 1.05, minutesPerPersonMonth: 9600 };
4
+ export function qualitySummary(report) {
5
+ const totals = new Map();
6
+ let codeMeasuredFiles = 0;
7
+ let duplicationMeasuredFiles = 0;
8
+ for (const item of report.measurements) {
9
+ if (item.target !== 'file' || item.value === null || !Number.isSafeInteger(item.value) || item.value < 0)
10
+ continue;
11
+ if (item.definition === definitions.codeLines)
12
+ codeMeasuredFiles++;
13
+ if (item.definition === definitions.duplicatedLines)
14
+ duplicationMeasuredFiles++;
15
+ totals.set(item.definition, (totals.get(item.definition) ?? 0) + item.value);
16
+ }
17
+ const codeLines = totals.get(definitions.codeLines) ?? null;
18
+ const duplicatedLines = totals.get(definitions.duplicatedLines) ?? null;
19
+ const smells = report.findings?.filter(finding => finding.category === 'duplication' || finding.category === 'structure');
20
+ const effortMinutes = smells?.reduce((sum, finding) => sum + (finding.effortMinutes ?? 0), 0) ?? 0;
21
+ const hasCompleteData = codeMeasuredFiles === report.scope.files && duplicationMeasuredFiles === report.scope.files;
22
+ const savedConfig = report.appliedConfig.maintainability;
23
+ const model = isRecord(savedConfig) ? readDebtModel(savedConfig.debtModel) : null;
24
+ const debtRatio = !hasCompleteData || codeLines === null || model === null || smells?.some(finding => finding.effortMinutes === undefined)
25
+ ? null : technicalDebtRatio(effortMinutes, codeLines, model);
26
+ return {
27
+ codeLines,
28
+ comments: totals.get(definitions.comments) ?? null,
29
+ classes: totals.get(definitions.classes) ?? null,
30
+ cognitiveComplexity: totals.get(definitions.cognitiveComplexity) ?? null,
31
+ duplication: duplicatedLines === null || codeLines === null || codeMeasuredFiles !== duplicationMeasuredFiles
32
+ ? null : { duplicatedLines, codeLines, ratio: codeLines === 0 || duplicatedLines > codeLines ? null : duplicatedLines / codeLines },
33
+ maintainability: smells === undefined || codeLines === null ? null : { smells: smells.length, effortMinutes, debtRatio,
34
+ grade: debtRatio === null ? null : maintainabilityGrade(debtRatio) },
35
+ };
36
+ }
37
+ export function technicalDebtRatio(effortMinutes, codeLines, model = debtModel) {
38
+ if (codeLines <= 0)
39
+ return null;
40
+ const ratio = effortMinutes / (model.scale * (codeLines / 1000) ** model.exponent * model.minutesPerPersonMonth);
41
+ return Number.isFinite(ratio) ? ratio : null;
42
+ }
43
+ export function maintainabilityGrade(debtRatio) {
44
+ return debtRatio < 0.05 ? 'A' : debtRatio < 0.1 ? 'B' : debtRatio < 0.2 ? 'C' : debtRatio < 0.5 ? 'D' : 'F';
45
+ }
46
+ export function coverageGrade(ratio) {
47
+ return ratio >= 0.9 ? 'A' : ratio >= 0.8 ? 'B' : ratio >= 0.7 ? 'C' : ratio >= 0.6 ? 'D' : 'F';
48
+ }
49
+ /**
50
+ * Security as a grade, not a risk level: A with no findings, then B, C, D and F by the worst severity found
51
+ * (low or unclassified, medium, high, critical). A high risk is a low grade.
52
+ */
53
+ export function securityGrade(counts) {
54
+ return counts.critical ? 'F' : counts.high ? 'D' : counts.medium ? 'C' : counts.low || counts.unknown ? 'B' : 'A';
55
+ }
56
+ function readDebtModel(model) {
57
+ if (!isRecord(model) || model.name !== 'basic-cocomo-organic' || !positiveNumber(model.scale)
58
+ || !positiveNumber(model.exponent) || !positiveNumber(model.minutesPerPersonMonth))
59
+ return null;
60
+ return { name: model.name, scale: model.scale, exponent: model.exponent, minutesPerPersonMonth: model.minutesPerPersonMonth };
61
+ }
62
+ function positiveNumber(value) {
63
+ return typeof value === 'number' && Number.isFinite(value) && value > 0;
64
+ }
@@ -0,0 +1,40 @@
1
+ import type { Measurement } from './measurement.js';
2
+ import type { Finding } from './finding.js';
3
+ import type { IgnoredFinding } from './ignore-rule.js';
4
+ import type { PluginData } from './plugin-data.js';
5
+ import type { Subject } from './source.js';
6
+ export declare const legacyReportSchema = "urn:repometry:schema:report:1";
7
+ export declare const reportSchema = "urn:repometry:schema:report:2";
8
+ export interface Diagnostic {
9
+ readonly operation: string;
10
+ readonly state: 'failed' | 'blocked' | 'partial';
11
+ readonly message: string;
12
+ readonly path?: string;
13
+ }
14
+ export interface Report {
15
+ readonly schema: typeof reportSchema | typeof legacyReportSchema;
16
+ readonly subject: Subject;
17
+ readonly generatedAt: string;
18
+ readonly committedAt?: string;
19
+ /** The inspected commit's message title and author, recorded at analysis so the store alone can describe it. */
20
+ readonly commit?: {
21
+ readonly subject: string;
22
+ readonly author: {
23
+ readonly name: string;
24
+ readonly email: string;
25
+ };
26
+ };
27
+ readonly appliedConfig: Readonly<Record<string, unknown>>;
28
+ readonly definitions: Readonly<Record<string, string>>;
29
+ readonly scope: {
30
+ readonly files: number;
31
+ readonly parsed: number;
32
+ };
33
+ readonly status: 'complete' | 'partial' | 'not-applicable';
34
+ readonly measurements: readonly Measurement[];
35
+ readonly diagnostics: readonly Diagnostic[];
36
+ readonly findings?: readonly Finding[];
37
+ readonly ignoredFindings?: readonly IgnoredFinding[];
38
+ readonly pluginData?: PluginData;
39
+ }
40
+ export declare function validSubjectId(kind: Subject['kind'], id: string): boolean;
@@ -0,0 +1,5 @@
1
+ export const legacyReportSchema = 'urn:repometry:schema:report:1';
2
+ export const reportSchema = 'urn:repometry:schema:report:2';
3
+ export function validSubjectId(kind, id) {
4
+ return /^[a-f0-9]{64}$/.test(id) || (kind === 'commit' && /^[a-f0-9]{40}$/.test(id));
5
+ }
@@ -0,0 +1,39 @@
1
+ import type { Finding } from './finding.js';
2
+ export type FindingInput = {
3
+ readonly file: string;
4
+ readonly toolVersion?: string;
5
+ readonly settingsDigest?: string;
6
+ readonly scope?: string;
7
+ } & ({
8
+ readonly format: 'sarif';
9
+ readonly category: 'lint' | 'security' | 'secret';
10
+ } | {
11
+ readonly format: 'eslint';
12
+ readonly category: 'lint';
13
+ } | {
14
+ readonly format: 'osv';
15
+ readonly category: 'dependency';
16
+ });
17
+ export interface Scanner {
18
+ readonly name: string;
19
+ readonly version: string | null;
20
+ }
21
+ interface ImportMethod {
22
+ readonly format: FindingInput['format'];
23
+ readonly category: Finding['category'];
24
+ readonly tools: readonly Scanner[];
25
+ readonly settingsDigest: string | null;
26
+ readonly scope: string | null;
27
+ }
28
+ export interface ImportMetadata extends ImportMethod {
29
+ readonly inputDigest: string;
30
+ readonly reported: number;
31
+ readonly imported: number;
32
+ readonly unmapped: number;
33
+ readonly units: number;
34
+ }
35
+ /** Keep scanner identity in profile comparisons while dropping the per-snapshot inputs and counts. */
36
+ export declare function findingImportMethods(value: unknown): readonly ImportMethod[];
37
+ export declare function uniqueScanners(tools: readonly Scanner[]): Scanner[];
38
+ export declare function scannerText(value: unknown): string | undefined;
39
+ export {};
@@ -0,0 +1,29 @@
1
+ import { isRecord } from '../engine/plugin.js';
2
+ import { findingCategories } from './finding.js';
3
+ /** Keep scanner identity in profile comparisons while dropping the per-snapshot inputs and counts. */
4
+ export function findingImportMethods(value) {
5
+ if (!Array.isArray(value))
6
+ return [];
7
+ const methods = new Map();
8
+ for (const item of value) {
9
+ if (!isRecord(item) || (item.format !== 'sarif' && item.format !== 'eslint' && item.format !== 'osv'))
10
+ continue;
11
+ const category = findingCategories.find(candidate => candidate === item.category);
12
+ if (!category || !Array.isArray(item.tools))
13
+ continue;
14
+ const tools = item.tools.filter((tool) => isRecord(tool) && typeof tool.name === 'string'
15
+ && (tool.version === null || typeof tool.version === 'string'));
16
+ const method = { category, format: item.format, tools: uniqueScanners(tools),
17
+ settingsDigest: scannerText(item.settingsDigest) ?? null, scope: scannerText(item.scope) ?? null };
18
+ methods.set(JSON.stringify(method), method);
19
+ }
20
+ return [...methods].sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0).map(([, value]) => value);
21
+ }
22
+ export function uniqueScanners(tools) {
23
+ return [...new Map(tools.map(({ name, version }) => [JSON.stringify([name, version]), { name, version }]))]
24
+ .sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0).map(([, tool]) => tool);
25
+ }
26
+ export function scannerText(value) {
27
+ return typeof value === 'string' && value.trim() !== '' ? value : undefined;
28
+ }
29
+ //# sourceMappingURL=scanner-import.js.map
@@ -0,0 +1,15 @@
1
+ import type { DataContract } from '../engine/plugin.js';
2
+ import type { SourceFile, SourceSnapshot } from './source.js';
3
+ export type { Subject, SourceFile, SourceSnapshot } from './source.js';
4
+ export declare const sourceFile: DataContract<SourceFile>;
5
+ export declare const sourceDirectoriesExcluded: readonly ['.git', '.repometry', 'node_modules', 'target'];
6
+ export declare const sourceExtensions: readonly ['.js', '.mjs', '.cjs', '.jsx', '.ts', '.mts', '.cts', '.tsx'];
7
+ export declare function isSourcePath(path: string): boolean;
8
+ export declare function isExcludedDirectory(name: string): boolean;
9
+ export declare function digest(bytes: Uint8Array | string): string;
10
+ export declare function utf8(bytes: Uint8Array): string;
11
+ export declare function physicalLines(text: string): number;
12
+ export declare function sourceLineCounts(files: readonly SourceFile[]): ReadonlyMap<string, number>;
13
+ export declare function textLineCount(bytes: Uint8Array): number | null;
14
+ export declare function comparePaths(left: string, right: string): number;
15
+ export declare function workingSnapshot(files: SourceFile[]): SourceSnapshot;
@@ -0,0 +1,51 @@
1
+ import { createHash } from 'node:crypto';
2
+ import { extname } from 'node:path';
3
+ import { isRecord } from '../engine/plugin.js';
4
+ export const sourceFile = {
5
+ id: 'repometry.source-file/v1',
6
+ accepts: (value) => isRecord(value) && typeof value.path === 'string' && value.bytes instanceof Uint8Array,
7
+ };
8
+ export const sourceDirectoriesExcluded = ['.git', '.repometry', 'node_modules', 'target'];
9
+ export const sourceExtensions = ['.js', '.mjs', '.cjs', '.jsx', '.ts', '.mts', '.cts', '.tsx'];
10
+ const excluded = new Set(sourceDirectoriesExcluded);
11
+ const extensions = new Set(sourceExtensions);
12
+ export function isSourcePath(path) {
13
+ return extensions.has(extname(path)) && !path.split('/').slice(0, -1).some(isExcludedDirectory);
14
+ }
15
+ export function isExcludedDirectory(name) {
16
+ return excluded.has(name);
17
+ }
18
+ export function digest(bytes) {
19
+ return createHash('sha256').update(bytes).digest('hex');
20
+ }
21
+ export function utf8(bytes) {
22
+ return new TextDecoder('utf-8', { fatal: true, ignoreBOM: true }).decode(bytes);
23
+ }
24
+ export function physicalLines(text) {
25
+ if (text === '')
26
+ return 0;
27
+ return text.split(/\r\n|[\n\r\u2028\u2029]/).length - Number(/[\n\r\u2028\u2029]$/.test(text));
28
+ }
29
+ export function sourceLineCounts(files) {
30
+ const decoder = new TextDecoder('utf-8', { ignoreBOM: true });
31
+ return new Map(files.map(file => [file.path, physicalLines(decoder.decode(file.bytes))]));
32
+ }
33
+ export function textLineCount(bytes) {
34
+ if (bytes.includes(0))
35
+ return null;
36
+ try {
37
+ return physicalLines(utf8(bytes));
38
+ }
39
+ catch {
40
+ return null;
41
+ }
42
+ }
43
+ export function comparePaths(left, right) {
44
+ return left < right ? -1 : left > right ? 1 : 0;
45
+ }
46
+ export function workingSnapshot(files) {
47
+ files.sort((left, right) => comparePaths(left.path, right.path));
48
+ const id = digest(JSON.stringify(files.map(file => [file.path, digest(file.bytes)])));
49
+ return { subject: { kind: 'working-tree', id }, files };
50
+ }
51
+ //# sourceMappingURL=snapshot.js.map
@@ -0,0 +1,7 @@
1
+ export interface SourceLocator {
2
+ readonly provider: string;
3
+ /** A fetch URL with {revision} and either {path} or {path:component}. */
4
+ readonly url: string;
5
+ /** An optional forge page URL, which can also use {line}. */
6
+ readonly web?: string;
7
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,23 @@
1
+ export type Subject = {
2
+ readonly kind: 'commit';
3
+ readonly id: string;
4
+ } | {
5
+ readonly kind: 'working-tree';
6
+ readonly id: string;
7
+ };
8
+ export interface SourceFile {
9
+ readonly path: string;
10
+ readonly bytes: Uint8Array;
11
+ }
12
+ export interface InventoryFile {
13
+ readonly path: string;
14
+ readonly lines: number | null;
15
+ /** Size in bytes, from Git or the file system; independent of formatting, unlike lines. */
16
+ readonly bytes?: number;
17
+ }
18
+ export interface SourceSnapshot {
19
+ readonly subject: Subject;
20
+ readonly files: readonly SourceFile[];
21
+ readonly inventory?: readonly InventoryFile[];
22
+ readonly generatedExcluded?: readonly string[];
23
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,9 @@
1
+ import type { Report } from '../model/report.js';
2
+ import type { Subject } from '../model/source.js';
3
+ export interface ReportReader {
4
+ read(subject: Subject): Promise<Report>;
5
+ list(): Promise<readonly Report[]>;
6
+ }
7
+ export interface ReportWriter {
8
+ save(report: Report): Promise<void>;
9
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=report.js.map
@@ -0,0 +1,14 @@
1
+ import type { Plugin } from '../engine/plugin.js';
2
+ import type { SourceLocator } from '../model/source-locator.js';
3
+ export interface SourceContext {
4
+ readonly option?: string;
5
+ readonly remotes: readonly string[];
6
+ readonly env: Readonly<Record<string, string | undefined>>;
7
+ }
8
+ export interface SourceProvider {
9
+ readonly id: string;
10
+ locate(context: SourceContext): SourceLocator | undefined;
11
+ read?(revision: string, path: string, signal?: AbortSignal): Promise<Uint8Array | undefined>;
12
+ }
13
+ export type SourcePlugin = Plugin & SourceProvider;
14
+ export declare function isSourcePathname(path: string): boolean;
@@ -0,0 +1,5 @@
1
+ export function isSourcePathname(path) {
2
+ return !/^[A-Za-z]:/.test(path) && !/[\\\0\r\n]/.test(path)
3
+ && path.split('/').every(segment => segment !== '' && segment !== '.' && segment !== '..');
4
+ }
5
+ //# sourceMappingURL=source-provider.js.map
@@ -0,0 +1,11 @@
1
+ export declare const defaultSourceExclusions: readonly ['**/.yarn', '**/.pnp.{js,cjs,loader.mjs}', '**/vendor', '**/third_party', '**/*.min.{js,cjs,mjs}', '**/*{.,-}bundle.{js,cjs,mjs}'];
2
+ export declare function sourceExclusionMatcher(patterns: readonly string[], generated?: readonly string[]): (path: string) => boolean;
3
+ export declare const generatedSourcePolicy: {
4
+ readonly version: 1;
5
+ readonly minBytes: 1024;
6
+ readonly minMeanLineLength: 300;
7
+ };
8
+ /** Detect generated text by its source-map trailer or the density of its nonblank lines. */
9
+ export declare function isGeneratedSource(bytes: Uint8Array): boolean;
10
+ export declare function normalizeExclusions(value: unknown): readonly string[];
11
+ export declare function exclusionMatcher(patterns: readonly string[]): (path: string) => boolean;