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,92 @@
1
+ import { appendFile, realpath } from 'node:fs/promises';
2
+ import { isAbsolute, relative, resolve, sep } from 'node:path';
3
+ export async function writeGitHubResult(report) {
4
+ const { output, summary } = githubFiles();
5
+ await appendFile(output, `subject=${report.subject.id}\nstatus=${report.status}\n`);
6
+ await appendFile(summary, [
7
+ '## Repometry', '',
8
+ `**${report.status}** · \`${report.subject.id}\``, '',
9
+ `Parsed ${report.scope.parsed} of ${report.scope.files} files.`,
10
+ `Measurements: ${report.measurements.length}. Diagnostics: ${report.diagnostics.length}.`, '', '',
11
+ ].join('\n'));
12
+ }
13
+ export async function writeGitHubDiffCoverage(report) {
14
+ const { output, summary } = githubFiles();
15
+ const decision = report.decision?.status ?? '';
16
+ await appendFile(output, `status=${report.status}\npercent=${report.percent ?? ''}\ndecision=${decision}\n`);
17
+ const observed = report.percent === null ? '—' : `${report.percent.toFixed(2)}%`;
18
+ const policy = report.decision === null ? [] : [`Minimum ${report.decision.minimumPercent}% · **${report.decision.status}**`];
19
+ await appendFile(summary, ['## Repometry diff coverage', '',
20
+ `**${report.status}** · \`${report.base}\` → \`${report.head}\``, '',
21
+ `Observed coverage ${observed} (${report.covered}/${report.total} reported lines). Gaps: ${report.gaps.length}.`,
22
+ ...policy, '', '',
23
+ ].join('\n'));
24
+ }
25
+ export async function writeGitHubReview(report, repository) {
26
+ const { output, summary } = githubFiles();
27
+ const { diff, coverage, findings } = report;
28
+ await appendFile(output, [
29
+ `status=${diff.status}`, `percent=${diff.percent ?? ''}`, `decision=${diff.gate?.status ?? ''}`,
30
+ `review-base=${report.base}`, `review-head=${report.head}`, `diff-covered=${diff.covered}`, `diff-total=${diff.total}`,
31
+ `coverage-percent=${coverage.head?.value ?? ''}`, `coverage-delta=${coverage.delta ?? ''}`,
32
+ `coverage-decision=${coverage.gate?.status ?? ''}`,
33
+ `new-issues=${findings.qualityCount ?? ''}`, `issues-decision=${findings.gate?.status ?? ''}`, '',
34
+ ].join('\n'));
35
+ const label = report.number === null ? 'Repometry review' : `Repometry review · PR #${report.number}`;
36
+ const totals = [
37
+ '| Check | Result | Gate |',
38
+ '| --- | --- | --- |',
39
+ `| Total coverage | ${percent(coverage.base?.value)} → ${percent(coverage.head?.value)} | ${coverage.gate ? `${coverage.gate.status}, max drop ${coverage.gate.maxDrop} pp` : '—'} |`,
40
+ `| Changed-line coverage | ${percent(diff.percent)} (${diff.covered}/${diff.total}), ${diff.status} | ${diff.gate ? `${diff.gate.status}, min ${diff.gate.minimumPercent}% on ${diff.gate.minimumLines}+ lines` : '—'} |`,
41
+ `| New quality issues | ${findings.qualityCount ?? 'Unavailable'} | ${findings.gate ? `${findings.gate.status}, max ${findings.gate.maximum}` : '—'} |`,
42
+ ];
43
+ const files = diff.files.slice(0, 50).map(file => {
44
+ const result = file.covered === null || file.total === null ? '—' : `${file.covered}/${file.total}`;
45
+ const missed = file.covered === null || file.total === null ? '—' : String(file.total - file.covered);
46
+ return `| ${pathCode(file.path)} | ${file.addedLines} | ${result} | ${missed} |`;
47
+ });
48
+ const changes = files.length === 0 ? [] : ['', '### Changed files', '',
49
+ '| File | Added lines | Covered / measured | Missed |',
50
+ '| --- | ---: | ---: | ---: |', ...files,
51
+ ...(diff.files.length > files.length ? ['', `Showing ${files.length} of ${diff.files.length} files.`] : [])];
52
+ await appendFile(summary, [`## ${label}`, '', `\`${report.base}\` → \`${report.head}\``, '',
53
+ ...totals, ...(diff.gaps.length ? ['', `Coverage gaps in ${diff.gaps.length} records.`] : []), ...changes, '', '',
54
+ ].join('\n'));
55
+ if (repository !== undefined && diff.uncovered.length > 0)
56
+ await annotateUncovered(diff.uncovered, repository);
57
+ }
58
+ function percent(value) {
59
+ return value == null ? '—' : `${value.toFixed(2)}%`;
60
+ }
61
+ function pathCode(value) {
62
+ const clean = value.replaceAll('&', '&amp;').replaceAll('<', '&lt;').replaceAll('>', '&gt;')
63
+ .replaceAll('|', '&#124;').replaceAll('\r', ' ').replaceAll('\n', ' ');
64
+ return `<code>${clean}</code>`;
65
+ }
66
+ async function annotateUncovered(uncovered, repository) {
67
+ const [workspace, root] = await Promise.all([realpath(process.env.GITHUB_WORKSPACE ?? process.cwd()), realpath(repository)]);
68
+ const prefix = relative(workspace, root);
69
+ if (isAbsolute(prefix) || prefix.split(sep).includes('..'))
70
+ return;
71
+ let count = 0;
72
+ for (const { path, lines } of uncovered) {
73
+ const checkoutPath = relative(workspace, resolve(root, path));
74
+ if (isAbsolute(checkoutPath) || checkoutPath.split(sep).includes('..'))
75
+ continue;
76
+ const file = checkoutPath.split(sep).join('/').replaceAll('%', '%25').replaceAll('\r', '%0D')
77
+ .replaceAll('\n', '%0A').replaceAll(':', '%3A').replaceAll(',', '%2C');
78
+ for (const line of lines) {
79
+ process.stderr.write(`::warning file=${file},line=${line},title=Repometry diff coverage::Changed line is not covered\n`);
80
+ if (++count === 10)
81
+ return;
82
+ }
83
+ }
84
+ }
85
+ function githubFiles() {
86
+ const output = process.env.GITHUB_OUTPUT;
87
+ const summary = process.env.GITHUB_STEP_SUMMARY;
88
+ if (!output || !summary)
89
+ throw new Error('GitHub reporting requires GITHUB_OUTPUT and GITHUB_STEP_SUMMARY');
90
+ return { output, summary };
91
+ }
92
+ //# sourceMappingURL=github.js.map
@@ -0,0 +1,10 @@
1
+ export declare class GitBlobBatch {
2
+ private readonly directory;
3
+ private session?;
4
+ private tail;
5
+ private timer?;
6
+ constructor(directory: string);
7
+ read(oid: string, signal?: AbortSignal): Promise<Buffer | undefined>;
8
+ close(): void;
9
+ private readOne;
10
+ }
@@ -0,0 +1,106 @@
1
+ import { spawn } from 'node:child_process';
2
+ import { validSubjectId } from '../../core/model/report.js';
3
+ const idleTimeout = 10_000;
4
+ const maxBlobBytes = 64 * 1024 * 1024;
5
+ export class GitBlobBatch {
6
+ directory;
7
+ session;
8
+ tail = Promise.resolve();
9
+ timer;
10
+ constructor(directory) {
11
+ this.directory = directory;
12
+ }
13
+ read(oid, signal) {
14
+ if (!validSubjectId('commit', oid))
15
+ throw new Error('Invalid source blob ID');
16
+ const pending = this.tail.then(() => this.readOne(oid, signal));
17
+ this.tail = pending.catch(() => undefined);
18
+ return pending;
19
+ }
20
+ close() {
21
+ clearTimeout(this.timer);
22
+ this.session?.close();
23
+ this.session = undefined;
24
+ }
25
+ async readOne(oid, signal) {
26
+ signal?.throwIfAborted();
27
+ clearTimeout(this.timer);
28
+ const session = this.session ??= new BlobSession(this.directory);
29
+ const abort = () => this.close();
30
+ signal?.addEventListener('abort', abort, { once: true });
31
+ try {
32
+ return await session.read(oid);
33
+ }
34
+ catch (error) {
35
+ this.close();
36
+ throw error;
37
+ }
38
+ finally {
39
+ signal?.removeEventListener('abort', abort);
40
+ if (this.session)
41
+ this.timer = setTimeout(() => this.close(), idleTimeout).unref();
42
+ }
43
+ }
44
+ }
45
+ class BlobSession {
46
+ child;
47
+ chunks;
48
+ buffer = Buffer.alloc(0);
49
+ constructor(directory) {
50
+ this.child = spawn('git', ['--no-replace-objects', 'cat-file', '--batch'], { cwd: directory });
51
+ this.child.stderr.resume();
52
+ this.child.stdin.on('error', () => { });
53
+ this.child.on('error', error => this.child.stdout.destroy(error));
54
+ this.chunks = this.child.stdout[Symbol.asyncIterator]();
55
+ }
56
+ close() {
57
+ this.child.stdin.end();
58
+ this.child.kill();
59
+ }
60
+ async read(oid) {
61
+ await new Promise((resolve, reject) => this.child.stdin.write(oid + '\n', error => error ? reject(error) : resolve()));
62
+ const header = await this.header();
63
+ if (header === oid + ' missing')
64
+ return undefined;
65
+ const parsed = /^([a-f0-9]+) blob ([0-9]+)$/.exec(header);
66
+ const size = Number(parsed?.[2]);
67
+ if (parsed?.[1] !== oid || !Number.isSafeInteger(size))
68
+ throw new Error('Invalid Git source blob response');
69
+ if (size > maxBlobBytes)
70
+ throw new Error('Git source blob exceeds the read limit');
71
+ const bytes = Buffer.allocUnsafe(size);
72
+ let offset = 0;
73
+ while (offset < size) {
74
+ if (this.buffer.length === 0)
75
+ this.buffer = await this.chunk();
76
+ const copied = this.buffer.copy(bytes, offset, 0, size - offset);
77
+ offset += copied;
78
+ this.buffer = this.buffer.subarray(copied);
79
+ }
80
+ if (this.buffer.length === 0)
81
+ this.buffer = await this.chunk();
82
+ if (this.buffer[0] !== 10)
83
+ throw new Error('Invalid Git source blob terminator');
84
+ this.buffer = this.buffer.subarray(1);
85
+ return bytes;
86
+ }
87
+ async header() {
88
+ let index = this.buffer.indexOf(10);
89
+ while (index < 0) {
90
+ if (this.buffer.length > 256)
91
+ throw new Error('Invalid Git source blob header');
92
+ this.buffer = Buffer.concat([this.buffer, await this.chunk()]);
93
+ index = this.buffer.indexOf(10);
94
+ }
95
+ const header = this.buffer.toString('ascii', 0, index);
96
+ this.buffer = this.buffer.subarray(index + 1);
97
+ return header;
98
+ }
99
+ async chunk() {
100
+ const result = await this.chunks.next();
101
+ if (result.done)
102
+ throw new Error('Git source reader stopped');
103
+ return result.value;
104
+ }
105
+ }
106
+ //# sourceMappingURL=blob-batch.js.map
@@ -0,0 +1,22 @@
1
+ import type { SourceSnapshot } from '../../core/model/snapshot.js';
2
+ import type { GitChanges, LineRange } from '../../core/model/changes.js';
3
+ export type { GitChanges, LineRange } from '../../core/model/changes.js';
4
+ export declare const diffMethod: {
5
+ readonly algorithm: 'myers';
6
+ readonly indentHeuristic: false;
7
+ readonly renameThresholdPercent: 50;
8
+ readonly renameLimit: 1000;
9
+ };
10
+ export declare function findMergeBase(repository: string, base: string, head: string): Promise<string>;
11
+ export declare function readChanges(repository: string, base: string, head: SourceSnapshot, excludes: (path: string) => boolean): Promise<GitChanges>;
12
+ interface RawChange {
13
+ readonly path: string;
14
+ readonly mode: string;
15
+ readonly oid: string;
16
+ readonly previous?: {
17
+ readonly path: string;
18
+ readonly oid: string;
19
+ };
20
+ }
21
+ export declare function rawChanges(text: string): readonly RawChange[];
22
+ export declare function addedRanges(patch: string): readonly LineRange[];
@@ -0,0 +1,108 @@
1
+ import { gitText, gitUtf8 } from './git.js';
2
+ import { isSourcePath, physicalLines, utf8 } from '../../core/model/snapshot.js';
3
+ const oid = /^(?:[a-f0-9]{40}|[a-f0-9]{64})$/;
4
+ const regularFile = /^100(?:644|755)$/;
5
+ export const diffMethod = { algorithm: 'myers', indentHeuristic: false, renameThresholdPercent: 50, renameLimit: 1000 };
6
+ const stableDiff = ['--no-color', '--no-ext-diff', '--no-textconv', `--diff-algorithm=${diffMethod.algorithm}`, '--no-indent-heuristic'];
7
+ export async function findMergeBase(repository, base, head) {
8
+ if (!oid.test(base) || !oid.test(head))
9
+ throw new Error('Merge base requires full commit IDs');
10
+ let found;
11
+ try {
12
+ found = await gitText(repository, ['merge-base', '--all', base, head]);
13
+ }
14
+ catch (error) {
15
+ if (error instanceof Error && 'code' in error && error.code === 1) {
16
+ throw new Error('No merge base found. Make the histories for both commits available locally.');
17
+ }
18
+ throw error;
19
+ }
20
+ const candidates = found.trim().split(/\s+/);
21
+ const first = candidates[0];
22
+ if (candidates.length !== 1 || !first || !oid.test(first))
23
+ throw new Error('The selected commits need one unambiguous merge base');
24
+ return first;
25
+ }
26
+ export async function readChanges(repository, base, head, excludes) {
27
+ if (!oid.test(base) || head.subject.kind !== 'commit' || !oid.test(head.subject.id))
28
+ throw new Error('Git diff requires full commit IDs');
29
+ const files = new Map();
30
+ const gaps = new Map();
31
+ if (base === head.subject.id)
32
+ return { files, gaps };
33
+ const contents = new Map(head.files.map(file => [file.path, file.bytes]));
34
+ const raw = await gitUtf8(repository, ['diff', ...stableDiff, '--raw', '-z', '--no-abbrev',
35
+ `--find-renames=${diffMethod.renameThresholdPercent}%`, `-l${diffMethod.renameLimit}`, base, head.subject.id, '--']);
36
+ for (const change of rawChanges(raw)) {
37
+ const bytes = contents.get(change.path);
38
+ if (!bytes || !regularFile.test(change.mode))
39
+ continue;
40
+ const before = change.previous && isSourcePath(change.previous.path) && !excludes(change.previous.path)
41
+ ? change.previous.oid : undefined;
42
+ if (before === change.oid)
43
+ continue;
44
+ let source;
45
+ try {
46
+ source = utf8(bytes);
47
+ }
48
+ catch {
49
+ gaps.set(change.path, 'Changed source is not valid UTF-8');
50
+ continue;
51
+ }
52
+ if (/\0|\r(?!\n)|[\u2028\u2029]/.test(source)) {
53
+ gaps.set(change.path, 'Git and LCOV line coordinates may differ for this file');
54
+ continue;
55
+ }
56
+ const length = physicalLines(source);
57
+ const ranges = before
58
+ ? addedRanges(await gitText(repository, ['diff', ...stableDiff, '--text', '--unified=0', '--inter-hunk-context=0', before, change.oid, '--']))
59
+ : (length === 0 ? [] : [{ first: 1, last: length }]);
60
+ if (ranges.some(range => range.last > length))
61
+ throw new Error('Git reported changes beyond the source lines');
62
+ if (ranges.length > 0)
63
+ files.set(change.path, ranges);
64
+ }
65
+ return { files, gaps };
66
+ }
67
+ export function rawChanges(text) {
68
+ if (text === '')
69
+ return [];
70
+ const fields = text.split('\0');
71
+ if (fields.pop() !== '')
72
+ throw new Error('Invalid Git raw diff terminator');
73
+ const changes = [];
74
+ for (let i = 0; i < fields.length;) {
75
+ const header = /^:(\d{6}) (\d{6}) ([a-f0-9]+) ([a-f0-9]+) ([ACDMRT])\d*$/.exec(fields[i++] ?? '');
76
+ const oldPath = fields[i++];
77
+ const status = header?.[5];
78
+ const path = status === 'C' || status === 'R' ? fields[i++] : oldPath;
79
+ const oldId = header?.[3];
80
+ const newId = header?.[4];
81
+ const mode = header?.[2];
82
+ if (!oldPath || !path || !mode || !oldId || !newId || !oid.test(oldId) || !oid.test(newId)) {
83
+ throw new Error('Invalid Git raw diff entry');
84
+ }
85
+ const previous = status !== 'A' && status !== 'C' && regularFile.test(header[1])
86
+ ? { path: oldPath, oid: oldId } : undefined;
87
+ changes.push({ path, mode, oid: newId, previous });
88
+ }
89
+ return changes;
90
+ }
91
+ export function addedRanges(patch) {
92
+ const ranges = [];
93
+ for (const line of patch.split('\n')) {
94
+ const match = /^@@ -\d+(?:,\d+)? \+(\d+)(?:,(\d+))? @@(?: |$)/.exec(line);
95
+ if (!match)
96
+ continue;
97
+ const first = Number(match[1]);
98
+ const count = Number(match[2] ?? 1);
99
+ if (count === 0)
100
+ continue;
101
+ const last = first + count - 1;
102
+ if (first < 1 || !Number.isSafeInteger(last) || first <= (ranges.at(-1)?.last ?? 0))
103
+ throw new Error('Invalid Git diff hunk range');
104
+ ranges.push({ first, last });
105
+ }
106
+ return ranges;
107
+ }
108
+ //# sourceMappingURL=changes.js.map
@@ -0,0 +1,3 @@
1
+ import type { ReadCommitMetadata } from '../../report/json/projections/commit-summary.js';
2
+ export declare function commitMetadataReader(repository: string): ReadCommitMetadata;
3
+ export declare function resolveGitBranch(repository: string, name: string): Promise<string>;
@@ -0,0 +1,53 @@
1
+ import { gitText, resolveGitCommit } from './git.js';
2
+ export function commitMetadataReader(repository) {
3
+ return async (revisions) => {
4
+ const result = new Map();
5
+ for (let start = 0; start < revisions.length; start += 128) {
6
+ const batch = revisions.slice(start, start + 128);
7
+ const log = await gitText(repository, ['log', '--ignore-missing', '--no-walk=unsorted', '-z', '--no-show-signature',
8
+ '--format=%H%x00%an%x00%ae%x00%B', ...batch, '--']);
9
+ const fields = log.split('\0');
10
+ for (let index = 0; index + 3 < fields.length; index += 4) {
11
+ const [sha, name, email, message] = fields.slice(index, index + 4);
12
+ result.set(sha, { subject: message.split(/\r?\n/, 1)[0], author: { name, email } });
13
+ }
14
+ }
15
+ const requested = new Set(revisions);
16
+ for (const [sha, tags] of await tagsByCommit(repository)) {
17
+ if (requested.has(sha))
18
+ result.set(sha, { ...result.get(sha), tags });
19
+ }
20
+ return result;
21
+ };
22
+ }
23
+ async function tagsByCommit(repository) {
24
+ const refs = await gitText(repository, ['show-ref', '--tags', '--dereference']).catch((error) => {
25
+ if (error instanceof Error && 'code' in error && error.code === 1)
26
+ return '';
27
+ throw error;
28
+ });
29
+ const tags = new Map();
30
+ for (const line of refs.split('\n')) {
31
+ const match = /^([a-f0-9]+) refs\/tags\/(.+?)(?:\^\{\})?$/.exec(line);
32
+ if (match)
33
+ tags.set(match[2], match[1]);
34
+ }
35
+ const result = new Map();
36
+ for (const tag of [...tags.keys()].sort()) {
37
+ const sha = tags.get(tag);
38
+ const names = result.get(sha) ?? [];
39
+ names.push(tag);
40
+ result.set(sha, names);
41
+ }
42
+ return result;
43
+ }
44
+ export async function resolveGitBranch(repository, name) {
45
+ await gitText(repository, ['check-ref-format', `refs/heads/${name}`]);
46
+ try {
47
+ return await resolveGitCommit(repository, `refs/heads/${name}`);
48
+ }
49
+ catch {
50
+ return resolveGitCommit(repository, `refs/remotes/origin/${name}`);
51
+ }
52
+ }
53
+ //# sourceMappingURL=commit-metadata.js.map
@@ -0,0 +1,9 @@
1
+ import type { ChurnWindow } from '../../core/model/churn.js';
2
+ export { churnSettings } from '../../core/model/churn.js';
3
+ export type { ChurnWindow } from '../../core/model/churn.js';
4
+ interface Churn {
5
+ readonly touches: ReadonlyMap<string, number>;
6
+ readonly window: ChurnWindow;
7
+ }
8
+ export declare function gitChurn(directory: string, commit: string, paths: readonly string[]): Promise<Churn>;
9
+ export declare function summarizeGitHistory(log: string, commit: string, paths: readonly string[], shallow: boolean): Churn;
@@ -0,0 +1,71 @@
1
+ import { gitText, gitUtf8 } from './git.js';
2
+ import { churnSettings } from '../../core/model/churn.js';
3
+ export { churnSettings } from '../../core/model/churn.js';
4
+ const maxTimeMs = 8000;
5
+ const oid = /^(?:[a-f0-9]{40}|[a-f0-9]{64})$/;
6
+ export async function gitChurn(directory, commit, paths) {
7
+ if (!oid.test(commit))
8
+ throw new Error('Git history requires a full commit ID');
9
+ const [log, shallow] = await Promise.all([
10
+ gitUtf8(directory, ['-c', 'log.showRoot=false', 'log', '--first-parent', '--diff-merges=first-parent',
11
+ `--max-count=${churnSettings.maxCommits + 1}`, '--format=%x00%H %ct %P', '--name-only', '-z',
12
+ '--no-renames', '--no-notes', '--no-color', '--no-ext-diff', '--no-textconv', commit, '--'], maxTimeMs),
13
+ gitText(directory, ['rev-parse', '--is-shallow-repository'], maxTimeMs),
14
+ ]);
15
+ return summarizeGitHistory(log, commit, paths, shallow.trim() === 'true');
16
+ }
17
+ export function summarizeGitHistory(log, commit, paths, shallow) {
18
+ const fields = log.split('\0');
19
+ if (fields[0] !== '' || fields.at(-1) !== '')
20
+ throw new Error('Invalid Git history record');
21
+ const touches = new Map(paths.map(path => [path, 0]));
22
+ let index = 1;
23
+ let visited = 0;
24
+ let commits = 0;
25
+ let endingAt;
26
+ let capReached = false;
27
+ while (index < fields.length - 1) {
28
+ const [sha, date, ...parents] = fields[index++].split(' ');
29
+ const timestamp = Number(date);
30
+ const hasParent = parents.length > 0 && parents.every(parent => oid.test(parent));
31
+ const root = parents.length === 1 && parents[0] === '';
32
+ if (sha === undefined || !oid.test(sha) || date === undefined || !/^\d+$/.test(date) || !Number.isSafeInteger(timestamp) || (!hasParent && !root)) {
33
+ throw new Error('Invalid Git history record');
34
+ }
35
+ if (endingAt === undefined) {
36
+ if (sha !== commit)
37
+ throw new Error('Git history did not start at the inspected commit');
38
+ endingAt = timestamp;
39
+ }
40
+ if (visited >= churnSettings.maxCommits) {
41
+ capReached = true;
42
+ break;
43
+ }
44
+ visited++;
45
+ const cutoff = endingAt - churnSettings.lookbackDays * 86400;
46
+ const overlaps = hasParent && timestamp >= cutoff && timestamp <= endingAt;
47
+ const changed = new Set();
48
+ let first = true;
49
+ while (index < fields.length && fields[index] !== '') {
50
+ const path = fields[index++];
51
+ if (overlaps) {
52
+ const normalized = first ? path.replace(/^\n/, '') : path;
53
+ if (touches.has(normalized))
54
+ changed.add(normalized);
55
+ }
56
+ first = false;
57
+ }
58
+ index++;
59
+ if (overlaps)
60
+ commits++;
61
+ for (const path of changed)
62
+ touches.set(path, touches.get(path) + 1);
63
+ }
64
+ if (endingAt === undefined)
65
+ throw new Error('Empty Git history');
66
+ return {
67
+ touches: shallow && commits === 0 ? new Map() : touches,
68
+ window: { endingAt: new Date(endingAt * 1000).toISOString(), commits, shallow, capReached },
69
+ };
70
+ }
71
+ //# sourceMappingURL=git-churn.js.map
@@ -0,0 +1,16 @@
1
+ import type { Subject } from '../../core/model/snapshot.js';
2
+ import type { Report, ReportReader } from '../../report/json/validation/report.js';
3
+ import type { CommitSummary } from '../../report/json/wire/summary-model.js';
4
+ export declare class GitReportReader implements ReportReader {
5
+ private readonly directory;
6
+ private readonly revision;
7
+ private snapshot?;
8
+ constructor(directory: string, revision: string);
9
+ read(subject: Subject): Promise<Report>;
10
+ list(): Promise<readonly Report[]>;
11
+ listSummaries(): Promise<readonly CommitSummary[]>;
12
+ private reportEntries;
13
+ private readEntries;
14
+ private pinnedSnapshot;
15
+ private resolveSnapshot;
16
+ }
@@ -0,0 +1,74 @@
1
+ import { checkMetaManifest } from '../../report/json/validation/metabranch.js';
2
+ import { gitBlobText, gitTreeFiles, resolveGitCommit } from './git.js';
3
+ import { compareReports, readReportText, validSubjectId } from '../../report/json/validation/report.js';
4
+ import { commitSummary, expandSummaryCatalog, orderSummaries } from '../../report/json/projections/commit-summary.js';
5
+ import { validateSummaryIndex } from '../../report/json/validation/summary-validation.js';
6
+ export class GitReportReader {
7
+ directory;
8
+ revision;
9
+ snapshot;
10
+ constructor(directory, revision) {
11
+ this.directory = directory;
12
+ this.revision = revision;
13
+ }
14
+ async read(subject) {
15
+ if (subject.kind !== 'commit' || !validSubjectId('commit', subject.id))
16
+ throw new Error('Metabranch reports require a full source commit ID');
17
+ const commit = await this.pinnedSnapshot();
18
+ const path = `commits/${subject.id}/report.json`;
19
+ const entry = (await gitTreeFiles(this.directory, commit, path)).find(item => item.path === path);
20
+ if (!entry)
21
+ throw Object.assign(new Error(`No report for ${subject.id} in ${this.revision}`), { code: 'ENOENT' });
22
+ return readReportText(await gitBlobText(this.directory, entry.oid), subject);
23
+ }
24
+ async list() {
25
+ return this.readEntries(await this.reportEntries(await this.pinnedSnapshot()));
26
+ }
27
+ async listSummaries() {
28
+ const commit = await this.pinnedSnapshot();
29
+ const [entries, index] = await Promise.all([
30
+ this.reportEntries(commit),
31
+ gitTreeFiles(this.directory, commit, 'summary.json'),
32
+ ]);
33
+ const file = index.find(entry => entry.path === 'summary.json');
34
+ if (file) {
35
+ const value = JSON.parse(await gitBlobText(this.directory, file.oid));
36
+ if (!validateSummaryIndex(value))
37
+ throw new Error(`Invalid Repometry summary in ${this.revision}`);
38
+ const shas = new Set(value.commits.map(row => row.sha));
39
+ if (shas.size === value.commits.length && entries.length === shas.size && entries.every(({ id }) => shas.has(id))
40
+ && value.commits.every(row => row.revision && row.counts && !row.detail))
41
+ return expandSummaryCatalog(value);
42
+ }
43
+ return orderSummaries((await this.readEntries(entries)).map(commitSummary));
44
+ }
45
+ async reportEntries(commit) {
46
+ return (await gitTreeFiles(this.directory, commit, 'commits')).flatMap(({ path, oid }) => {
47
+ const id = /^commits\/([a-f0-9]+)\/report\.json$/.exec(path)?.[1];
48
+ return id && validSubjectId('commit', id) ? [{ id, oid }] : [];
49
+ });
50
+ }
51
+ async readEntries(entries) {
52
+ const reports = [];
53
+ for (const { id, oid } of entries) {
54
+ reports.push(readReportText(await gitBlobText(this.directory, oid), { kind: 'commit', id }));
55
+ }
56
+ return reports.sort(compareReports);
57
+ }
58
+ pinnedSnapshot() {
59
+ this.snapshot ??= this.resolveSnapshot().catch(error => {
60
+ this.snapshot = undefined;
61
+ throw error;
62
+ });
63
+ return this.snapshot;
64
+ }
65
+ async resolveSnapshot() {
66
+ const commit = await resolveGitCommit(this.directory, this.revision);
67
+ const entry = (await gitTreeFiles(this.directory, commit, 'manifest.json')).find(item => item.path === 'manifest.json');
68
+ if (!entry)
69
+ throw new Error(`No Repometry manifest in ${this.revision}`);
70
+ checkMetaManifest(await gitBlobText(this.directory, entry.oid));
71
+ return commit;
72
+ }
73
+ }
74
+ //# sourceMappingURL=git-reader.js.map
@@ -0,0 +1,21 @@
1
+ import type { SourceSnapshot } from '../../core/model/snapshot.js';
2
+ export declare function gitRoot(directory: string): Promise<string>;
3
+ export declare function physicalGitRoot(directory: string): Promise<string>;
4
+ export declare function gitText(directory: string, args: readonly string[], timeout?: number): Promise<string>;
5
+ export declare function gitUtf8(directory: string, args: readonly string[], timeout?: number): Promise<string>;
6
+ export declare function resolveGitCommit(directory: string, revision: string): Promise<string>;
7
+ /** Commits on the first-parent line of `head` after `base`, oldest first. */
8
+ export declare function firstParentRange(directory: string, base: string, head: string): Promise<{
9
+ readonly base: string;
10
+ readonly head: string;
11
+ readonly commits: readonly string[];
12
+ }>;
13
+ interface GitFile {
14
+ readonly path: string;
15
+ readonly oid: string;
16
+ readonly size?: number;
17
+ }
18
+ export declare function gitTreeFiles(directory: string, commit: string, prefix?: string, includeSize?: boolean): Promise<readonly GitFile[]>;
19
+ export declare function gitBlobText(directory: string, oid: string): Promise<string>;
20
+ export declare function readGitCommit(directory: string, revision: string, excludes: (path: string) => boolean): Promise<SourceSnapshot>;
21
+ export {};