repometry 0.5.0 → 0.6.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 (115) hide show
  1. package/README.md +35 -17
  2. package/package.json +1 -1
  3. package/target/main/resources/report/json/comparison-v1.schema.json +6 -6
  4. package/target/main/resources/report/json/file-metrics-v1.schema.json +7 -6
  5. package/target/main/resources/report/json/pull-review-v1.schema.json +5 -5
  6. package/target/main/resources/report/json/report-v2.schema.json +197 -10
  7. package/target/main/resources/report/json/repository-summary-v1.schema.json +161 -14
  8. package/target/main/resources/report/json/viewer-inspection-v1.schema.json +518 -6
  9. package/target/main/resources/viewer/styles.css +5 -0
  10. package/target/main/ts/api/git/changes.d.ts +1 -1
  11. package/target/main/ts/api/git/changes.js +3 -3
  12. package/target/main/ts/api/git/commit-metadata.js +6 -4
  13. package/target/main/ts/api/git/git.d.ts +1 -1
  14. package/target/main/ts/api/git/git.js +4 -4
  15. package/target/main/ts/api/git/inspection-source.d.ts +1 -1
  16. package/target/main/ts/api/git/inspection-source.js +3 -3
  17. package/target/main/ts/api/git/local.d.ts +1 -1
  18. package/target/main/ts/api/git/local.js +4 -4
  19. package/target/main/ts/api/worker/remote-executor.d.ts +1 -1
  20. package/target/main/ts/api/worker/remote-executor.js +2 -2
  21. package/target/main/ts/api/worker/worker-protocol.d.ts +2 -2
  22. package/target/main/ts/api/worker/worker-protocol.js +8 -8
  23. package/target/main/ts/api/worker/worker.d.ts +1 -1
  24. package/target/main/ts/api/worker/worker.js +4 -4
  25. package/target/main/ts/cli/main.js +4 -3
  26. package/target/main/ts/cli/reporting.d.ts +1 -1
  27. package/target/main/ts/cli/reporting.js +1 -1
  28. package/target/main/ts/compose/analysis-files.d.ts +13 -0
  29. package/target/main/ts/compose/analysis-files.js +95 -0
  30. package/target/main/ts/compose/analysis-imports.d.ts +7 -0
  31. package/target/main/ts/compose/analysis-imports.js +34 -0
  32. package/target/main/ts/compose/analysis-report.d.ts +5 -0
  33. package/target/main/ts/compose/analysis-report.js +78 -0
  34. package/target/main/ts/compose/analysis-repository.d.ts +6 -0
  35. package/target/main/ts/compose/analysis-repository.js +61 -0
  36. package/target/main/ts/compose/analysis-results.d.ts +38 -0
  37. package/target/main/ts/compose/analysis-results.js +78 -0
  38. package/target/main/ts/compose/analysis-sources.d.ts +73 -0
  39. package/target/main/ts/compose/analysis-sources.js +47 -0
  40. package/target/main/ts/compose/analyze-snapshot.d.ts +2 -2
  41. package/target/main/ts/compose/analyze-snapshot.js +19 -250
  42. package/target/main/ts/compose/diff-coverage.d.ts +2 -0
  43. package/target/main/ts/compose/diff-coverage.js +6 -4
  44. package/target/main/ts/compose/inspect.js +8 -5
  45. package/target/main/ts/compose/languages.d.ts +29 -0
  46. package/target/main/ts/compose/languages.js +87 -0
  47. package/target/main/ts/compose/sources.js +14 -12
  48. package/target/main/ts/core/engine/manifest.d.ts +2 -2
  49. package/target/main/ts/core/engine/manifest.js +25 -5
  50. package/target/main/ts/core/engine/plan.d.ts +2 -4
  51. package/target/main/ts/core/engine/plan.js +13 -15
  52. package/target/main/ts/core/engine/plugin.d.ts +2 -1
  53. package/target/main/ts/core/model/clone-source.d.ts +1 -0
  54. package/target/main/ts/core/model/clone-source.js +1 -0
  55. package/target/main/ts/core/model/code-structure.d.ts +2 -0
  56. package/target/main/ts/core/model/code-structure.js +6 -0
  57. package/target/main/ts/core/model/language.d.ts +10 -0
  58. package/target/main/ts/core/model/language.js +6 -0
  59. package/target/main/ts/core/model/measurement.d.ts +7 -6
  60. package/target/main/ts/core/model/measurement.js +17 -6
  61. package/target/main/ts/core/model/plugin-data.d.ts +3 -0
  62. package/target/main/ts/core/model/quality-summary.js +5 -4
  63. package/target/main/ts/core/model/report.d.ts +1 -2
  64. package/target/main/ts/core/model/report.js +0 -1
  65. package/target/main/ts/core/model/snapshot.d.ts +0 -2
  66. package/target/main/ts/core/model/snapshot.js +0 -6
  67. package/target/main/ts/core/usecases/compare.js +61 -17
  68. package/target/main/ts/core/usecases/inspect.js +2 -2
  69. package/target/main/ts/plugin.d.ts +3 -2
  70. package/target/main/ts/plugin.js +1 -1
  71. package/target/main/ts/plugins/duplication/duplication.js +10 -4
  72. package/target/main/ts/plugins/language-js/babel-provider.js +8 -2
  73. package/target/main/ts/plugins/language-js/extensions.d.ts +3 -0
  74. package/target/main/ts/plugins/language-js/extensions.js +4 -0
  75. package/target/main/ts/plugins/language-js/js-security.js +3 -2
  76. package/target/main/ts/report/html/app/viewer-data.d.ts +1 -1
  77. package/target/main/ts/report/html/app/viewer-data.js +2 -29
  78. package/target/main/ts/report/html/app/viewer-metric-registry.js +7 -7
  79. package/target/main/ts/report/html/app/viewer-overview-cards.js +8 -2
  80. package/target/main/ts/report/html/app/viewer-route.d.ts +2 -2
  81. package/target/main/ts/report/html/app/viewer-route.js +3 -3
  82. package/target/main/ts/report/html/app/viewer-trend-data.d.ts +6 -1
  83. package/target/main/ts/report/html/app/viewer-trend-data.js +6 -2
  84. package/target/main/ts/report/html/app/viewer.js +3 -3
  85. package/target/main/ts/report/html/site/export-site.d.ts +3 -4
  86. package/target/main/ts/report/html/site/export-site.js +24 -41
  87. package/target/main/ts/report/html/site/exported-server.js +2 -1
  88. package/target/main/ts/report/html/site/local-server.d.ts +1 -1
  89. package/target/main/ts/report/html/site/local-server.js +13 -19
  90. package/target/main/ts/report/html/site/projects.js +8 -17
  91. package/target/main/ts/report/json/projections/commit-summary.d.ts +2 -2
  92. package/target/main/ts/report/json/projections/commit-summary.js +18 -19
  93. package/target/main/ts/report/json/projections/file-metrics.js +31 -24
  94. package/target/main/ts/report/json/projections/inspection-context.js +10 -1
  95. package/target/main/ts/report/json/projections/inspection-details.d.ts +1 -1
  96. package/target/main/ts/report/json/projections/inspection-details.js +2 -2
  97. package/target/main/ts/report/json/projections/metric-values.d.ts +1 -0
  98. package/target/main/ts/report/json/projections/metric-values.js +15 -5
  99. package/target/main/ts/report/json/store/pull-review-store.js +1 -2
  100. package/target/main/ts/report/json/validation/report.d.ts +1 -1
  101. package/target/main/ts/report/json/validation/report.js +10 -8
  102. package/target/main/ts/report/json/validation/summary-validation.js +1 -3
  103. package/target/main/ts/report/json/wire/file-metrics-model.d.ts +2 -0
  104. package/target/main/ts/report/json/wire/inspection-details-model.d.ts +0 -5
  105. package/target/main/ts/report/json/wire/public-history-model.d.ts +0 -6
  106. package/target/main/ts/report/json/wire/public-history-model.js +0 -1
  107. package/target/main/ts/report.d.ts +2 -3
  108. package/target/main/ts/report.js +1 -2
  109. package/target/main/resources/report/json/inspection-context-v1.schema.json +0 -172
  110. package/target/main/resources/report/json/public-history-v1.schema.json +0 -50
  111. package/target/main/resources/report/json/quality-history-v1.schema.json +0 -51
  112. package/target/main/resources/report/json/report-v1.schema.json +0 -65
  113. package/target/main/resources/report/json/viewer-details-v1.schema.json +0 -346
  114. package/target/main/ts/report/json/projections/public-history.d.ts +0 -4
  115. package/target/main/ts/report/json/projections/public-history.js +0 -17
@@ -2,12 +2,524 @@
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "$id": "urn:repometry:schema:viewer-inspection:1",
4
4
  "type": "object",
5
- "required": ["schema", "sha", "inspection"],
5
+ "required": [
6
+ "schema",
7
+ "sha",
8
+ "inspection"
9
+ ],
6
10
  "properties": {
7
- "schema": { "const": "urn:repometry:schema:viewer-inspection:1" },
8
- "sha": { "type": "string", "pattern": "^(?:[a-f0-9]{40}|[a-f0-9]{64})$" },
9
- "context": { "$ref": "urn:repometry:schema:inspection-context:1#/$defs/inspectionContext" },
10
- "inspection": { "$ref": "urn:repometry:schema:viewer-details:1#/$defs/inspection" }
11
+ "schema": {
12
+ "const": "urn:repometry:schema:viewer-inspection:1"
13
+ },
14
+ "sha": {
15
+ "type": "string",
16
+ "pattern": "^(?:[a-f0-9]{40}|[a-f0-9]{64})$"
17
+ },
18
+ "context": {
19
+ "$ref": "#/$defs/inspectionContext"
20
+ },
21
+ "inspection": {
22
+ "$ref": "#/$defs/inspection"
23
+ }
11
24
  },
12
- "additionalProperties": false
25
+ "additionalProperties": false,
26
+ "$defs": {
27
+ "inspection": {
28
+ "type": "object",
29
+ "required": [
30
+ "metrics",
31
+ "functions",
32
+ "diagnostics"
33
+ ],
34
+ "properties": {
35
+ "metrics": {
36
+ "$ref": "urn:repometry:schema:file-metrics:1"
37
+ },
38
+ "functions": {
39
+ "type": "array",
40
+ "items": {
41
+ "$ref": "#/$defs/function"
42
+ }
43
+ },
44
+ "diagnostics": {
45
+ "$ref": "urn:repometry:schema:report:2#/properties/diagnostics"
46
+ },
47
+ "findings": {
48
+ "$ref": "urn:repometry:schema:report:2#/properties/findings"
49
+ },
50
+ "lineCoverage": {
51
+ "$ref": "urn:repometry:schema:report:2#/$defs/lcovLines"
52
+ },
53
+ "components": {
54
+ "type": "array",
55
+ "items": {
56
+ "type": "object",
57
+ "required": [
58
+ "component",
59
+ "paths"
60
+ ],
61
+ "additionalProperties": false,
62
+ "properties": {
63
+ "component": {
64
+ "type": "object",
65
+ "required": [
66
+ "name",
67
+ "pathGlobs"
68
+ ],
69
+ "additionalProperties": false,
70
+ "properties": {
71
+ "name": {
72
+ "type": "string",
73
+ "minLength": 1,
74
+ "maxLength": 100
75
+ },
76
+ "description": {
77
+ "type": "string"
78
+ },
79
+ "pathGlobs": {
80
+ "type": "array",
81
+ "minItems": 1,
82
+ "items": {
83
+ "type": "string"
84
+ }
85
+ }
86
+ }
87
+ },
88
+ "paths": {
89
+ "type": "array",
90
+ "items": {
91
+ "type": "string"
92
+ }
93
+ }
94
+ }
95
+ }
96
+ },
97
+ "profile": {
98
+ "$ref": "#/$defs/profile"
99
+ },
100
+ "bands": {
101
+ "type": "object",
102
+ "additionalProperties": false,
103
+ "properties": {
104
+ "complexity": {
105
+ "type": "array",
106
+ "items": {
107
+ "type": "number"
108
+ }
109
+ },
110
+ "missedLines": {
111
+ "type": "array",
112
+ "items": {
113
+ "type": "number"
114
+ }
115
+ },
116
+ "duplication": {
117
+ "type": "array",
118
+ "items": {
119
+ "type": "number"
120
+ }
121
+ }
122
+ }
123
+ }
124
+ },
125
+ "additionalProperties": false
126
+ },
127
+ "profile": {
128
+ "type": "object",
129
+ "additionalProperties": false,
130
+ "required": [
131
+ "id",
132
+ "extensions",
133
+ "excludedPaths",
134
+ "excludedDirectories",
135
+ "rules",
136
+ "duplication",
137
+ "debtModel",
138
+ "churn",
139
+ "ignore",
140
+ "analyzers"
141
+ ],
142
+ "properties": {
143
+ "id": {
144
+ "type": [
145
+ "string",
146
+ "null"
147
+ ]
148
+ },
149
+ "extensions": {
150
+ "type": "array",
151
+ "items": {
152
+ "type": "string"
153
+ }
154
+ },
155
+ "excludedPaths": {
156
+ "type": "array",
157
+ "items": {
158
+ "type": "string"
159
+ }
160
+ },
161
+ "excludedDirectories": {
162
+ "type": "array",
163
+ "items": {
164
+ "type": "string"
165
+ }
166
+ },
167
+ "ruleCatalog": {
168
+ "type": "array",
169
+ "items": {
170
+ "type": "object",
171
+ "required": [
172
+ "source",
173
+ "kind",
174
+ "rule",
175
+ "category"
176
+ ],
177
+ "properties": {
178
+ "source": {
179
+ "type": "string"
180
+ },
181
+ "kind": {
182
+ "enum": [
183
+ "check",
184
+ "scanner"
185
+ ]
186
+ },
187
+ "rule": {
188
+ "type": "string"
189
+ },
190
+ "title": {
191
+ "type": "string"
192
+ },
193
+ "category": {
194
+ "type": "string"
195
+ },
196
+ "limit": {
197
+ "type": "number"
198
+ },
199
+ "minutesPerExcess": {
200
+ "type": "number"
201
+ },
202
+ "level": {
203
+ "type": "string"
204
+ },
205
+ "help": {
206
+ "type": "string"
207
+ }
208
+ },
209
+ "additionalProperties": false
210
+ }
211
+ },
212
+ "rules": {
213
+ "type": "array",
214
+ "items": {
215
+ "type": "object",
216
+ "additionalProperties": false,
217
+ "required": [
218
+ "plugin",
219
+ "rule",
220
+ "limit",
221
+ "minutesPerExcess"
222
+ ],
223
+ "properties": {
224
+ "rule": {
225
+ "type": "string"
226
+ },
227
+ "limit": {
228
+ "type": "number"
229
+ },
230
+ "minutesPerExcess": {
231
+ "type": "number"
232
+ },
233
+ "plugin": {
234
+ "type": "string"
235
+ }
236
+ }
237
+ }
238
+ },
239
+ "duplication": {
240
+ "oneOf": [
241
+ {
242
+ "type": "null"
243
+ },
244
+ {
245
+ "type": "object",
246
+ "additionalProperties": false,
247
+ "required": [
248
+ "minCodeLines",
249
+ "minNodes",
250
+ "minutesPerRepeatedLine"
251
+ ],
252
+ "properties": {
253
+ "minCodeLines": {
254
+ "type": "number"
255
+ },
256
+ "minNodes": {
257
+ "type": "number"
258
+ },
259
+ "minutesPerRepeatedLine": {
260
+ "type": "number"
261
+ }
262
+ }
263
+ }
264
+ ]
265
+ },
266
+ "debtModel": {
267
+ "oneOf": [
268
+ {
269
+ "type": "null"
270
+ },
271
+ {
272
+ "type": "object",
273
+ "additionalProperties": false,
274
+ "required": [
275
+ "name",
276
+ "scale",
277
+ "exponent",
278
+ "minutesPerPersonMonth"
279
+ ],
280
+ "properties": {
281
+ "name": {
282
+ "type": "string"
283
+ },
284
+ "scale": {
285
+ "type": "number"
286
+ },
287
+ "exponent": {
288
+ "type": "number"
289
+ },
290
+ "minutesPerPersonMonth": {
291
+ "type": "number"
292
+ }
293
+ }
294
+ }
295
+ ]
296
+ },
297
+ "churn": {
298
+ "oneOf": [
299
+ {
300
+ "type": "null"
301
+ },
302
+ {
303
+ "type": "object",
304
+ "additionalProperties": false,
305
+ "required": [
306
+ "lookbackDays",
307
+ "maxCommits"
308
+ ],
309
+ "properties": {
310
+ "lookbackDays": {
311
+ "type": "number"
312
+ },
313
+ "maxCommits": {
314
+ "type": "number"
315
+ }
316
+ }
317
+ }
318
+ ]
319
+ },
320
+ "ignore": {
321
+ "type": "array",
322
+ "items": {
323
+ "type": "object",
324
+ "additionalProperties": false,
325
+ "properties": {
326
+ "tool": {
327
+ "type": "string"
328
+ },
329
+ "rule": {
330
+ "type": "string"
331
+ },
332
+ "path": {
333
+ "type": "string"
334
+ },
335
+ "reason": {
336
+ "type": "string"
337
+ }
338
+ }
339
+ }
340
+ },
341
+ "analyzers": {
342
+ "type": "array",
343
+ "items": {
344
+ "type": "object",
345
+ "additionalProperties": false,
346
+ "required": [
347
+ "id",
348
+ "version",
349
+ "tools"
350
+ ],
351
+ "properties": {
352
+ "id": {
353
+ "type": "string"
354
+ },
355
+ "version": {
356
+ "type": "string"
357
+ },
358
+ "tools": {
359
+ "type": "object",
360
+ "additionalProperties": {
361
+ "type": "string"
362
+ }
363
+ }
364
+ }
365
+ }
366
+ }
367
+ }
368
+ },
369
+ "function": {
370
+ "type": "object",
371
+ "required": [
372
+ "name",
373
+ "path",
374
+ "line",
375
+ "complexity"
376
+ ],
377
+ "properties": {
378
+ "name": {
379
+ "type": "string"
380
+ },
381
+ "path": {
382
+ "type": "string"
383
+ },
384
+ "line": {
385
+ "type": [
386
+ "integer",
387
+ "null"
388
+ ],
389
+ "minimum": 1
390
+ },
391
+ "complexity": {
392
+ "type": "number"
393
+ }
394
+ },
395
+ "additionalProperties": false
396
+ },
397
+ "inspectionContext": {
398
+ "type": "object",
399
+ "required": [
400
+ "exclusions",
401
+ "boundary"
402
+ ],
403
+ "properties": {
404
+ "exclusions": {
405
+ "type": [
406
+ "object",
407
+ "null"
408
+ ],
409
+ "required": [
410
+ "paths",
411
+ "directories"
412
+ ],
413
+ "properties": {
414
+ "paths": {
415
+ "type": "array",
416
+ "items": {
417
+ "type": "string"
418
+ }
419
+ },
420
+ "directories": {
421
+ "type": "array",
422
+ "items": {
423
+ "type": "string"
424
+ }
425
+ }
426
+ },
427
+ "additionalProperties": false
428
+ },
429
+ "boundary": {
430
+ "enum": [
431
+ null,
432
+ "changed",
433
+ "unavailable"
434
+ ]
435
+ },
436
+ "scanners": {
437
+ "type": "array",
438
+ "items": {
439
+ "type": "object",
440
+ "required": [
441
+ "name",
442
+ "version"
443
+ ],
444
+ "properties": {
445
+ "name": {
446
+ "type": "string"
447
+ },
448
+ "version": {
449
+ "type": [
450
+ "string",
451
+ "null"
452
+ ]
453
+ }
454
+ },
455
+ "additionalProperties": false
456
+ }
457
+ },
458
+ "ignores": {
459
+ "type": "object",
460
+ "required": [
461
+ "rules",
462
+ "count"
463
+ ],
464
+ "properties": {
465
+ "count": {
466
+ "type": "integer",
467
+ "minimum": 0
468
+ },
469
+ "rules": {
470
+ "type": "array",
471
+ "items": {
472
+ "type": "object",
473
+ "properties": {
474
+ "tool": {
475
+ "type": "string"
476
+ },
477
+ "rule": {
478
+ "type": "string"
479
+ },
480
+ "path": {
481
+ "type": "string"
482
+ },
483
+ "reason": {
484
+ "type": "string"
485
+ }
486
+ },
487
+ "additionalProperties": false
488
+ }
489
+ }
490
+ },
491
+ "additionalProperties": false
492
+ },
493
+ "security": {
494
+ "type": "object",
495
+ "required": [
496
+ "low",
497
+ "medium",
498
+ "high",
499
+ "unknown"
500
+ ],
501
+ "properties": {
502
+ "low": {
503
+ "type": "integer",
504
+ "minimum": 0
505
+ },
506
+ "medium": {
507
+ "type": "integer",
508
+ "minimum": 0
509
+ },
510
+ "high": {
511
+ "type": "integer",
512
+ "minimum": 0
513
+ },
514
+ "unknown": {
515
+ "type": "integer",
516
+ "minimum": 0
517
+ }
518
+ },
519
+ "additionalProperties": false
520
+ }
521
+ },
522
+ "additionalProperties": false
523
+ }
524
+ }
13
525
  }
@@ -286,6 +286,11 @@ main:focus { outline: none; }
286
286
  .ring svg { width: 2.5rem; height: 2.5rem; }
287
287
  .ring-track { fill: none; stroke: var(--rule); stroke-width: 4.5; }
288
288
  .ring-arc { fill: none; stroke: var(--grade-a); stroke-width: 4.5; stroke-linecap: butt; transform: rotate(-90deg); transform-origin: 20px 20px; }
289
+ /* The ring takes the coverage grade's colour, as the coverage badge does. */
290
+ .ring[data-grade="B"] .ring-arc { stroke: var(--grade-b); }
291
+ .ring[data-grade="C"] .ring-arc { stroke: var(--grade-c); }
292
+ .ring[data-grade="D"] .ring-arc { stroke: var(--grade-d); }
293
+ .ring[data-grade="F"] .ring-arc { stroke: var(--grade-f); }
289
294
  .ring-label { fill: var(--ink); font-size: 12.5px; font-weight: 650; text-anchor: middle; }
290
295
  .severity { background: var(--grade-a); font-size: 1.125rem; }
291
296
  .severity[data-severity="none"] { background: var(--grade-none); }
@@ -8,7 +8,7 @@ export declare const diffMethod: {
8
8
  readonly renameLimit: 1000;
9
9
  };
10
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>;
11
+ export declare function readChanges(repository: string, base: string, head: SourceSnapshot, excludes: (path: string) => boolean, isSource: (path: string) => boolean): Promise<GitChanges>;
12
12
  interface RawChange {
13
13
  readonly path: string;
14
14
  readonly mode: string;
@@ -1,5 +1,5 @@
1
1
  import { gitText, gitUtf8 } from './git.js';
2
- import { isSourcePath, physicalLines, utf8 } from '../../core/model/snapshot.js';
2
+ import { physicalLines, utf8 } from '../../core/model/snapshot.js';
3
3
  const oid = /^(?:[a-f0-9]{40}|[a-f0-9]{64})$/;
4
4
  const regularFile = /^100(?:644|755)$/;
5
5
  export const diffMethod = { algorithm: 'myers', indentHeuristic: false, renameThresholdPercent: 50, renameLimit: 1000 };
@@ -23,7 +23,7 @@ export async function findMergeBase(repository, base, head) {
23
23
  throw new Error('The selected commits need one unambiguous merge base');
24
24
  return first;
25
25
  }
26
- export async function readChanges(repository, base, head, excludes) {
26
+ export async function readChanges(repository, base, head, excludes, isSource) {
27
27
  if (!oid.test(base) || head.subject.kind !== 'commit' || !oid.test(head.subject.id))
28
28
  throw new Error('Git diff requires full commit IDs');
29
29
  const files = new Map();
@@ -37,7 +37,7 @@ export async function readChanges(repository, base, head, excludes) {
37
37
  const bytes = contents.get(change.path);
38
38
  if (!bytes || !regularFile.test(change.mode))
39
39
  continue;
40
- const before = change.previous && isSourcePath(change.previous.path) && !excludes(change.previous.path)
40
+ const before = change.previous && isSource(change.previous.path) && !excludes(change.previous.path)
41
41
  ? change.previous.oid : undefined;
42
42
  if (before === change.oid)
43
43
  continue;
@@ -5,11 +5,13 @@ export function commitMetadataReader(repository) {
5
5
  for (let start = 0; start < revisions.length; start += 128) {
6
6
  const batch = revisions.slice(start, start + 128);
7
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, '--']);
8
+ '--format=%H%x00%cI%x00%an%x00%ae%x00%B', ...batch, '--']);
9
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 } });
10
+ for (let index = 0; index + 4 < fields.length; index += 5) {
11
+ const [sha, date, name, email, message] = fields.slice(index, index + 5);
12
+ const time = Date.parse(date);
13
+ result.set(sha, { ...(Number.isFinite(time) ? { committedAt: new Date(time).toISOString() } : {}),
14
+ subject: message.split(/\r?\n/, 1)[0], author: { name, email } });
13
15
  }
14
16
  }
15
17
  const requested = new Set(revisions);
@@ -18,5 +18,5 @@ interface GitFile {
18
18
  }
19
19
  export declare function gitTreeFiles(directory: string, commit: string, prefix?: string, includeSize?: boolean): Promise<readonly GitFile[]>;
20
20
  export declare function gitBlobText(directory: string, oid: string): Promise<string>;
21
- export declare function readGitCommit(directory: string, revision: string, excludes: (path: string) => boolean, claims?: (path: string) => boolean): Promise<SourceSnapshot>;
21
+ export declare function readGitCommit(directory: string, revision: string, excludes: (path: string) => boolean, isSource: (path: string) => boolean, claims?: (path: string) => boolean): Promise<SourceSnapshot>;
22
22
  export {};
@@ -1,7 +1,7 @@
1
1
  import { realpath } from 'node:fs/promises';
2
2
  import { execFile, spawnSync } from 'node:child_process';
3
3
  import { promisify } from 'node:util';
4
- import { comparePaths, isExcludedDirectory, isSourcePath, textLineCount, utf8 } from '../../core/model/snapshot.js';
4
+ import { comparePaths, isExcludedDirectory, textLineCount, utf8 } from '../../core/model/snapshot.js';
5
5
  import { isClaimedText, maxClaimedFileBytes } from '../../core/model/source.js';
6
6
  import { isGeneratedSource } from '../../core/profile/exclusions.js';
7
7
  const git = promisify(execFile);
@@ -95,10 +95,10 @@ export async function gitBlobText(directory, oid) {
95
95
  const result = await git('git', ['--no-replace-objects', 'cat-file', 'blob', oid], { cwd: directory, env, encoding: 'buffer', maxBuffer });
96
96
  return utf8(result.stdout);
97
97
  }
98
- export async function readGitCommit(directory, revision, excludes, claims) {
98
+ export async function readGitCommit(directory, revision, excludes, isSource, claims) {
99
99
  const id = await resolveGitCommit(directory, revision);
100
100
  const tracked = (await gitTreeFiles(directory, id, undefined, true)).filter(({ path }) => !path.split('/').slice(0, -1).some(isExcludedDirectory) && !excludes(path));
101
- const entries = tracked.filter(entry => isSourcePath(entry.path));
101
+ const entries = tracked.filter(entry => isSource(entry.path));
102
102
  const blobs = readBlobs(directory, [...new Set(entries.map(entry => entry.oid))]);
103
103
  const generated = new Set();
104
104
  const files = entries.flatMap(({ path, oid }) => {
@@ -110,7 +110,7 @@ export async function readGitCommit(directory, revision, excludes, claims) {
110
110
  generated.add(path);
111
111
  return [];
112
112
  });
113
- const claimed = tracked.filter(({ path }) => !isSourcePath(path) && claims?.(path));
113
+ const claimed = tracked.filter(({ path }) => !isSource(path) && claims?.(path));
114
114
  const oversized = new Set(claimed.filter(({ size }) => size !== undefined && size > maxClaimedFileBytes).map(({ path }) => path));
115
115
  const requested = new Set(claimed.filter(({ path }) => !oversized.has(path)).map(({ oid }) => oid));
116
116
  const claimedBlobs = new Map();
@@ -7,7 +7,7 @@ export interface SourceSelection {
7
7
  readonly revision: string;
8
8
  };
9
9
  }
10
- export declare function readInspectionSource(request: SourceSelection, excludes: (path: string) => boolean, claims?: (path: string) => boolean): Promise<{
10
+ export declare function readInspectionSource(request: SourceSelection, excludes: (path: string) => boolean, isSource: (path: string) => boolean, claims?: (path: string) => boolean): Promise<{
11
11
  root: string;
12
12
  snapshot: import("../../plugin.js").SourceSnapshot;
13
13
  excludedOutput: string | null;
@@ -2,15 +2,15 @@ import { realpath } from 'node:fs/promises';
2
2
  import { basename, dirname, join, relative, resolve, sep } from 'node:path';
3
3
  import { gitRoot, gitWorkingTreePaths, readGitCommit } from './git.js';
4
4
  import { containsPath, readWorkingTree } from './local.js';
5
- export async function readInspectionSource(request, excludes, claims) {
5
+ export async function readInspectionSource(request, excludes, isSource, claims) {
6
6
  const root = await realpath('workingTree' in request.source ? request.directory : await gitRoot(request.directory));
7
7
  const output = await physicalPath(resolve(request.output));
8
8
  if (containsPath(output, root) || output.split(sep).includes('.git')) {
9
9
  throw new Error('Choose a dedicated report directory outside Git metadata');
10
10
  }
11
11
  const snapshot = 'workingTree' in request.source
12
- ? await readWorkingTree(root, output, excludes, claims, await gitWorkingTreePaths(root))
13
- : await readGitCommit(root, request.source.revision, excludes, claims);
12
+ ? await readWorkingTree(root, output, excludes, isSource, claims, await gitWorkingTreePaths(root))
13
+ : await readGitCommit(root, request.source.revision, excludes, isSource, claims);
14
14
  const excludedOutput = snapshot.subject.kind === 'working-tree' && containsPath(root, output)
15
15
  ? relative(root, output).split(sep).join('/') : null;
16
16
  return { root, snapshot, excludedOutput, output };
@@ -1,3 +1,3 @@
1
1
  import type { SourceSnapshot } from '../../core/model/snapshot.js';
2
2
  export declare function containsPath(parent: string, path: string): boolean;
3
- export declare function readWorkingTree(directory: string, output: string, excludes: (path: string) => boolean, claims?: (path: string) => boolean, gitPaths?: readonly string[]): Promise<SourceSnapshot>;
3
+ export declare function readWorkingTree(directory: string, output: string, excludes: (path: string) => boolean, isSource: (path: string) => boolean, claims?: (path: string) => boolean, gitPaths?: readonly string[]): Promise<SourceSnapshot>;