tolkira 0.1.1 → 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.
package/dist/index.js CHANGED
@@ -7,8 +7,7 @@ import path2 from "node:path";
7
7
  import {
8
8
  AttachmentContentEncoding,
9
9
  HookType,
10
- TestStepResultStatus,
11
- version as messagesVersion
10
+ TestStepResultStatus
12
11
  } from "@cucumber/messages";
13
12
  function isRecord(value) {
14
13
  return value !== null && typeof value === "object" && !Array.isArray(value);
@@ -143,13 +142,13 @@ function createIdFactory(prefix) {
143
142
  }
144
143
  function normalizeUri(uri, index) {
145
144
  if (!uri) return `features/legacy-${index}.feature`;
146
- const slashed = uri.replace(/\\/g, "/");
145
+ const slashed = uri.replace(/\\/g, "/").replace(/^file:\/\/+/i, "");
147
146
  const normalized = slashed.replace(/^\.\//, "");
148
147
  if (/^[a-z]:\//i.test(normalized) || slashed.startsWith("/")) {
149
148
  const marker = slashed.lastIndexOf("/features/");
150
149
  if (marker >= 0) return slashed.slice(marker + 1);
151
150
  const parts = slashed.split("/").filter(Boolean);
152
- return parts.slice(-2).join("/") || `features/legacy-${index}.feature`;
151
+ return parts[parts.length - 1] ?? `features/legacy-${index}.feature`;
153
152
  }
154
153
  return normalized || `features/legacy-${index}.feature`;
155
154
  }
@@ -373,11 +372,11 @@ function parseLegacyValue(parsed, source, options = {}) {
373
372
  const statuses = [];
374
373
  let attachmentCounter = 0;
375
374
  const meta = {
376
- protocolVersion: messagesVersion,
375
+ protocolVersion: "",
377
376
  implementation: { name: "tolkira-legacy-json" },
378
- runtime: { name: "node.js", version: process.versions.node },
379
- os: { name: process.platform },
380
- cpu: { name: process.arch }
377
+ runtime: { name: "" },
378
+ os: { name: "" },
379
+ cpu: { name: "" }
381
380
  };
382
381
  envelopes.push({ meta });
383
382
  envelopes.push({ testRunStarted: { id: runId, timestamp: timestamp(startedAt) } });
@@ -589,7 +588,7 @@ function parseLegacyValue(parsed, source, options = {}) {
589
588
  envelopes.push({
590
589
  gherkinDocument: { uri, feature: featureNode, comments: [] }
591
590
  });
592
- envelopes.push(...scenarioEnvelopes);
591
+ for (const envelope of scenarioEnvelopes) envelopes.push(envelope);
593
592
  }
594
593
  const success = !statuses.some(
595
594
  (status) => status === TestStepResultStatus.FAILED || status === TestStepResultStatus.AMBIGUOUS || status === TestStepResultStatus.UNDEFINED
@@ -884,7 +883,7 @@ function looksLikeJUnit(content) {
884
883
  const trimmed = content.replace(/^\uFEFF/, "").trimStart();
885
884
  return trimmed.startsWith("<") && /<testsuites?\b/i.test(trimmed);
886
885
  }
887
- async function parseJUnitXml(content, source) {
886
+ async function parseJUnitXml(content, source, options = {}) {
888
887
  const { XMLParser, XMLValidator } = await import("fast-xml-parser");
889
888
  assertValidEntities(content, source);
890
889
  const validation = XMLValidator.validate(content);
@@ -900,6 +899,7 @@ async function parseJUnitXml(content, source) {
900
899
  attributeNamePrefix: "",
901
900
  parseTagValue: false,
902
901
  parseAttributeValue: false,
902
+ htmlEntities: true,
903
903
  isArray: (name) => ARRAY_TAGS.has(name)
904
904
  });
905
905
  let parsed;
@@ -920,7 +920,9 @@ async function parseJUnitXml(content, source) {
920
920
  const legacy = suites.map(
921
921
  (suite, index) => featureFromSuite(suite, source, index)
922
922
  );
923
- const envelopes = parseLegacyValue(legacy, source, { idPrefix: "junit" });
923
+ const envelopes = parseLegacyValue(legacy, source, {
924
+ idPrefix: options.idPrefix ?? "junit"
925
+ });
924
926
  for (const envelope of envelopes) {
925
927
  if (envelope.meta) {
926
928
  envelope.meta.implementation = { name: "JUnit XML", version: "" };
@@ -1164,7 +1166,7 @@ function sniffLegacy(content) {
1164
1166
  }
1165
1167
  }
1166
1168
  function looksLikeMessages(content) {
1167
- const firstLine = content.split(/\r?\n/).map((line) => line.replace(/^\uFEFF/, "").trim()).find(Boolean);
1169
+ const firstLine = content.replace(/^\uFEFF/, "").split(/\r?\n/, 20).map((line) => line.trim()).find(Boolean);
1168
1170
  if (!firstLine) return false;
1169
1171
  try {
1170
1172
  return isEnvelopeLike(JSON.parse(firstLine));
@@ -1188,7 +1190,23 @@ async function canonicalPath(file) {
1188
1190
  return path2.resolve(file);
1189
1191
  }
1190
1192
  }
1191
- async function loadEnvelopes(inputs) {
1193
+ function collectGherkinIds(value) {
1194
+ const ids = [];
1195
+ const visit = (node) => {
1196
+ if (Array.isArray(node)) {
1197
+ for (const child of node) visit(child);
1198
+ return;
1199
+ }
1200
+ if (!node || typeof node !== "object") return;
1201
+ for (const [key, child] of Object.entries(node)) {
1202
+ if (key === "id" && typeof child === "string") ids.push(child);
1203
+ else visit(child);
1204
+ }
1205
+ };
1206
+ visit(value);
1207
+ return ids;
1208
+ }
1209
+ async function loadInputs(inputs) {
1192
1210
  const requested = Array.isArray(inputs) ? inputs : [inputs];
1193
1211
  if (requested.length === 0) {
1194
1212
  throw new Error("No input files provided.");
@@ -1219,7 +1237,7 @@ async function loadEnvelopes(inputs) {
1219
1237
  const ordered = [...files.values()].sort(
1220
1238
  (a, b) => a.file.localeCompare(b.file)
1221
1239
  );
1222
- const envelopes = [];
1240
+ const groups = [];
1223
1241
  const seenContent = /* @__PURE__ */ new Set();
1224
1242
  let totalBytes = 0;
1225
1243
  for (const [index, input] of ordered.entries()) {
@@ -1236,41 +1254,105 @@ async function loadEnvelopes(inputs) {
1236
1254
  totalBytes += info.size;
1237
1255
  const extension = path2.extname(input.file).toLowerCase();
1238
1256
  const legacy = sniffLegacy(content);
1257
+ let parsed = [];
1239
1258
  if (legacy?.kind === "legacy") {
1240
- envelopes.push(
1241
- ...parseLegacyValue(legacy.parsed, input.file, {
1242
- idPrefix: `legacy-${index}`
1243
- })
1244
- );
1245
- continue;
1246
- }
1247
- if (legacy?.kind === "malformed") {
1259
+ parsed = parseLegacyValue(legacy.parsed, input.file, {
1260
+ idPrefix: `legacy-${index}`
1261
+ });
1262
+ } else if (legacy?.kind === "malformed") {
1248
1263
  parseLegacyJson(content, input.file, { idPrefix: `legacy-${index}` });
1249
- continue;
1250
- }
1251
- if (looksLikeJUnit(content)) {
1252
- envelopes.push(...await parseJUnitXml(content, input.file));
1253
- continue;
1264
+ } else if (looksLikeJUnit(content)) {
1265
+ parsed = await parseJUnitXml(content, input.file, {
1266
+ idPrefix: `junit-${index}`
1267
+ });
1268
+ } else if (looksLikeMessages(content)) {
1269
+ parsed = parseMessages(content, input.file);
1270
+ } else if (input.explicit && extension === ".xml") {
1271
+ await parseJUnitXml(content, input.file, { idPrefix: `junit-${index}` });
1272
+ } else {
1273
+ if (input.explicit && MESSAGES_EXTENSIONS.has(extension) && content.trim().length === 0) {
1274
+ throw new Error(`Input is empty: ${input.file}`);
1275
+ }
1276
+ if (input.explicit) {
1277
+ invalidJson(content, input.file);
1278
+ }
1279
+ if (MESSAGES_EXTENSIONS.has(extension)) {
1280
+ parseMessages(content, input.file);
1281
+ }
1254
1282
  }
1255
- if (looksLikeMessages(content)) {
1256
- envelopes.push(...parseMessages(content, input.file));
1257
- continue;
1283
+ groups.push({ file: input.file, envelopes: parsed });
1284
+ }
1285
+ if (groups.every((group) => group.envelopes.length === 0)) {
1286
+ throw new Error("No supported report files found.");
1287
+ }
1288
+ const seenIds = /* @__PURE__ */ new Map();
1289
+ for (const group of groups) {
1290
+ const file = path2.basename(group.file);
1291
+ for (const envelope of group.envelopes) {
1292
+ const ids = [
1293
+ ["pickle", envelope.pickle?.id],
1294
+ ["testCase", envelope.testCase?.id],
1295
+ ["testCaseStarted", envelope.testCaseStarted?.id],
1296
+ ["hook", envelope.hook?.id]
1297
+ ];
1298
+ for (const step of envelope.testCase?.testSteps ?? []) {
1299
+ ids.push(["testStep", step.id]);
1300
+ }
1301
+ for (const id of collectGherkinIds(envelope.gherkinDocument)) {
1302
+ ids.push(["gherkin", id]);
1303
+ }
1304
+ for (const [kind, id] of ids) {
1305
+ if (!id) continue;
1306
+ const key = `${kind}:${id}`;
1307
+ const previous = seenIds.get(key);
1308
+ if (previous) {
1309
+ throw new Error(
1310
+ `Duplicate Cucumber Messages ${kind} id in ${previous} and ${file}. Merge the streams before splitting or use unique ids.`
1311
+ );
1312
+ }
1313
+ seenIds.set(key, file);
1314
+ }
1258
1315
  }
1259
- if (input.explicit && extension === ".xml") {
1260
- await parseJUnitXml(content, input.file);
1316
+ }
1317
+ return groups;
1318
+ }
1319
+ async function loadEnvelopes(inputs) {
1320
+ return (await loadInputs(inputs)).flatMap((group) => group.envelopes);
1321
+ }
1322
+ function provenanceFor(groups) {
1323
+ const names = /* @__PURE__ */ new Map();
1324
+ for (const group of groups) {
1325
+ if (!group.envelopes.some(
1326
+ (envelope) => envelope.gherkinDocument || envelope.pickle
1327
+ )) {
1261
1328
  continue;
1262
1329
  }
1263
- if (input.explicit) {
1264
- invalidJson(content, input.file);
1265
- }
1266
- if (MESSAGES_EXTENSIONS.has(extension)) {
1267
- parseMessages(content, input.file);
1330
+ const name = path2.basename(group.file);
1331
+ const set = names.get(name) ?? /* @__PURE__ */ new Set();
1332
+ set.add(group.file);
1333
+ names.set(name, set);
1334
+ }
1335
+ const ambiguous = new Set(
1336
+ [...names.entries()].filter(([, files]) => files.size > 1).map(([name]) => name)
1337
+ );
1338
+ const uriFiles = /* @__PURE__ */ new Map();
1339
+ for (const group of groups) {
1340
+ const name = path2.basename(group.file);
1341
+ if (ambiguous.has(name)) continue;
1342
+ for (const envelope of group.envelopes) {
1343
+ for (const uri of [envelope.gherkinDocument?.uri, envelope.pickle?.uri]) {
1344
+ if (!uri) continue;
1345
+ const set = uriFiles.get(uri) ?? /* @__PURE__ */ new Set();
1346
+ set.add(name);
1347
+ uriFiles.set(uri, set);
1348
+ }
1268
1349
  }
1269
1350
  }
1270
- if (envelopes.length === 0) {
1271
- throw new Error("No supported report files found.");
1351
+ const provenance = /* @__PURE__ */ new Map();
1352
+ for (const [uri, files] of uriFiles) {
1353
+ if (files.size === 1) provenance.set(uri, [...files][0]);
1272
1354
  }
1273
- return envelopes;
1355
+ return provenance;
1274
1356
  }
1275
1357
 
1276
1358
  // src/render/html.ts
@@ -1381,6 +1463,9 @@ var STATUS_ORDER = [
1381
1463
  TestStepResultStatus3.AMBIGUOUS,
1382
1464
  TestStepResultStatus3.FAILED
1383
1465
  ];
1466
+ function statusSeverity(status) {
1467
+ return STATUS_ORDER.indexOf(status.toUpperCase());
1468
+ }
1384
1469
  var VALID_STATUS = /* @__PURE__ */ new Set([
1385
1470
  "passed",
1386
1471
  "failed",
@@ -1398,12 +1483,22 @@ function durationMs(duration2) {
1398
1483
  if (!duration2) return 0;
1399
1484
  const seconds = Number.isFinite(duration2.seconds) ? duration2.seconds : 0;
1400
1485
  const nanos = Number.isFinite(duration2.nanos) ? duration2.nanos : 0;
1401
- return Math.round((seconds * 1e3 + nanos / 1e6) * 1e3) / 1e3;
1486
+ const milliseconds = seconds * 1e3 + nanos / 1e6;
1487
+ if (!Number.isFinite(milliseconds) || milliseconds <= 0) return 0;
1488
+ const rounded = Math.round(milliseconds * 1e3) / 1e3;
1489
+ return Number.isFinite(rounded) ? rounded : 0;
1490
+ }
1491
+ function finiteDuration(value) {
1492
+ if (!Number.isFinite(value) || value <= 0) return 0;
1493
+ const rounded = Math.round(value * 1e3) / 1e3;
1494
+ return Number.isFinite(rounded) ? rounded : 0;
1402
1495
  }
1403
1496
  function timestampIso(timestamp2) {
1404
1497
  if (!timestamp2) return void 0;
1405
1498
  const milliseconds = timestamp2.seconds * 1e3 + timestamp2.nanos / 1e6;
1406
- return Number.isFinite(milliseconds) ? new Date(milliseconds).toISOString() : void 0;
1499
+ if (!Number.isFinite(milliseconds)) return void 0;
1500
+ const date = new Date(milliseconds);
1501
+ return Number.isNaN(date.getTime()) ? void 0 : date.toISOString();
1407
1502
  }
1408
1503
  function normalizeText2(value) {
1409
1504
  return (value ?? "").replace(/\r\n/g, "\n");
@@ -1539,8 +1634,10 @@ function featureTree(document) {
1539
1634
  visit(document.children ?? []);
1540
1635
  return map;
1541
1636
  }
1542
- function buildReportModel(envelopes) {
1637
+ function buildReportModel(envelopes, provenance) {
1543
1638
  const features = /* @__PURE__ */ new Map();
1639
+ const featureUris = /* @__PURE__ */ new Map();
1640
+ const featureSeen = /* @__PURE__ */ new Set();
1544
1641
  const featureOrder = [];
1545
1642
  const scenarioTree = /* @__PURE__ */ new Map();
1546
1643
  const featureByScenarioId = /* @__PURE__ */ new Map();
@@ -1588,8 +1685,12 @@ function buildReportModel(envelopes) {
1588
1685
  }
1589
1686
  if (envelope.gherkinDocument?.feature) {
1590
1687
  const feature = envelope.gherkinDocument.feature;
1591
- if (!features.has(envelope.gherkinDocument.uri ?? feature.name)) {
1592
- features.set(envelope.gherkinDocument.uri ?? feature.name, feature);
1688
+ const uri = envelope.gherkinDocument.uri;
1689
+ const key = uri ?? feature.name;
1690
+ if (!features.has(key)) features.set(key, feature);
1691
+ if (!featureSeen.has(feature)) {
1692
+ featureSeen.add(feature);
1693
+ if (uri) featureUris.set(feature, uri);
1593
1694
  featureOrder.push(feature);
1594
1695
  }
1595
1696
  for (const [id, value] of featureTree(feature)) {
@@ -1727,8 +1828,8 @@ function buildReportModel(envelopes) {
1727
1828
  featureName: feature?.name ?? pickle.uri,
1728
1829
  ...tree?.ruleName ? { ruleName: tree.ruleName } : {},
1729
1830
  status,
1730
- durationMs: Math.round(duration2 * 1e3) / 1e3,
1731
- attempt: latest.attempt,
1831
+ durationMs: finiteDuration(duration2),
1832
+ attempt: Number.isFinite(latest.attempt) ? latest.attempt : 0,
1732
1833
  ...timestampIso(latest.timestamp) ? { startedAt: timestampIso(latest.timestamp) } : {},
1733
1834
  tags: pickle.tags.map((tag) => tag.name),
1734
1835
  steps: stepRows,
@@ -1745,16 +1846,26 @@ function buildReportModel(envelopes) {
1745
1846
  }
1746
1847
  }
1747
1848
  const featureRows = [];
1849
+ const inInputOrder = new Set(featureOrder);
1748
1850
  const orderedFeatures = [
1749
1851
  ...featureOrder,
1750
- ...[...featureScenarios.keys()].filter((feature) => !featureOrder.includes(feature))
1852
+ ...[...featureScenarios.keys()].filter(
1853
+ (feature) => !inInputOrder.has(feature)
1854
+ )
1751
1855
  ];
1752
1856
  for (const feature of orderedFeatures) {
1753
1857
  const scenarios = featureScenarios.get(feature) ?? [];
1754
1858
  if (scenarios.length === 0) continue;
1755
- const status = scenarios.reduce((worst, scenario) => {
1756
- return STATUS_ORDER.indexOf(scenario.status.toUpperCase()) > STATUS_ORDER.indexOf(worst.toUpperCase()) ? scenario.status : worst;
1757
- }, "unknown");
1859
+ const status = scenarios.some((scenario) => scenario.status !== "passed") ? scenarios.reduce((worst, scenario) => {
1860
+ if (scenario.status === "passed") return worst;
1861
+ return statusSeverity(scenario.status) > statusSeverity(worst) ? scenario.status : worst;
1862
+ }, "unknown") : "passed";
1863
+ const featureUri = featureUris.get(feature) ?? scenarios[0]?.uri ?? "";
1864
+ const sourceFiles = /* @__PURE__ */ new Set([
1865
+ ...scenarios.map((scenario) => provenance?.get(scenario.uri)),
1866
+ provenance?.get(featureUri)
1867
+ ]);
1868
+ const sourceFile = sourceFiles.size === 1 && !sourceFiles.has(void 0) ? [...sourceFiles][0] : void 0;
1758
1869
  featureRows.push({
1759
1870
  id: `feature-${featureRows.length + 1}`,
1760
1871
  name: feature.name,
@@ -1763,11 +1874,17 @@ function buildReportModel(envelopes) {
1763
1874
  description: normalizeText2(feature.description),
1764
1875
  tags: feature.tags.map((tag) => tag.name),
1765
1876
  status,
1766
- durationMs: Math.round(scenarios.reduce((sum, scenario) => sum + scenario.durationMs, 0) * 1e3) / 1e3,
1877
+ durationMs: finiteDuration(
1878
+ scenarios.reduce((sum, scenario) => sum + scenario.durationMs, 0)
1879
+ ),
1767
1880
  scenarios,
1768
- attachments: scenarios.reduce((sum, scenario) => sum + scenario.attachments.length, 0)
1881
+ attachments: scenarios.reduce((sum, scenario) => sum + scenario.attachments.length, 0),
1882
+ ...sourceFile ? { sourceFile } : {}
1769
1883
  });
1770
1884
  }
1885
+ if (featureRows.some((feature) => !feature.sourceFile)) {
1886
+ for (const feature of featureRows) delete feature.sourceFile;
1887
+ }
1771
1888
  const attachmentRows = scenarioRows.flatMap((scenario) => scenario.attachments);
1772
1889
  const runAttachments = mapAttachments(attachments.get("") ?? []);
1773
1890
  const allAttachments = [...attachmentRows, ...runAttachments];
@@ -1782,7 +1899,9 @@ function buildReportModel(envelopes) {
1782
1899
  attachments: allAttachments.length,
1783
1900
  attachmentBytes: allAttachments.reduce((sum, attachment) => sum + attachment.bytes, 0)
1784
1901
  },
1785
- durationMs: Math.round(scenarioRows.reduce((sum, scenario) => sum + scenario.durationMs, 0) * 1e3) / 1e3,
1902
+ durationMs: finiteDuration(
1903
+ scenarioRows.reduce((sum, scenario) => sum + scenario.durationMs, 0)
1904
+ ),
1786
1905
  ...startedAt ? { startedAt } : {},
1787
1906
  ...finishedAt ? { finishedAt } : {},
1788
1907
  source,
@@ -1860,7 +1979,15 @@ function durationMs2(duration2) {
1860
1979
  if (!duration2) return 0;
1861
1980
  const seconds = Number.isFinite(duration2.seconds) ? duration2.seconds : 0;
1862
1981
  const nanos = Number.isFinite(duration2.nanos) ? duration2.nanos : 0;
1863
- return Math.round((seconds * 1e3 + nanos / 1e6) * 1e3) / 1e3;
1982
+ const milliseconds = seconds * 1e3 + nanos / 1e6;
1983
+ if (!Number.isFinite(milliseconds) || milliseconds <= 0) return 0;
1984
+ const rounded = Math.round(milliseconds * 1e3) / 1e3;
1985
+ return Number.isFinite(rounded) ? rounded : 0;
1986
+ }
1987
+ function finiteDuration2(value) {
1988
+ if (!Number.isFinite(value) || value <= 0) return 0;
1989
+ const rounded = Math.round(value * 1e3) / 1e3;
1990
+ return Number.isFinite(rounded) ? rounded : 0;
1864
1991
  }
1865
1992
  function scenarioStatus(results) {
1866
1993
  if (results.length === 0) return "unknown";
@@ -1870,13 +1997,14 @@ function statusOrdinal(status) {
1870
1997
  return STATUS_ORDER2.indexOf(status.toUpperCase());
1871
1998
  }
1872
1999
  function displayUri(uri) {
1873
- const normalized = uri.replace(/\\/g, "/");
2000
+ const normalized = uri.replace(/\\/g, "/").replace(/^file:\/\/+/i, "");
1874
2001
  if (!/^[a-z]:\//i.test(normalized) && !normalized.startsWith("/")) {
1875
2002
  return normalized;
1876
2003
  }
1877
2004
  const marker = normalized.lastIndexOf("/features/");
1878
2005
  if (marker >= 0) return normalized.slice(marker + 1);
1879
- return normalized.split("/").filter(Boolean).slice(-2).join("/");
2006
+ const parts = normalized.split("/").filter(Boolean);
2007
+ return parts[parts.length - 1] ?? uri;
1880
2008
  }
1881
2009
  function featureTree2(document) {
1882
2010
  const stepKeywords = /* @__PURE__ */ new Map();
@@ -2053,7 +2181,7 @@ function summarizeEnvelopes(input) {
2053
2181
  uri: displayUri(pickle.uri ?? ""),
2054
2182
  feature: tree.featureName,
2055
2183
  status,
2056
- durationMs: Math.round(scenarioDuration * 1e3) / 1e3,
2184
+ durationMs: finiteDuration2(scenarioDuration),
2057
2185
  attempt: started?.attempt ?? 0,
2058
2186
  tags: (pickle.tags ?? []).map((tag) => tag.name),
2059
2187
  attachments: scenarioAttachments.length,
@@ -2073,7 +2201,7 @@ function summarizeEnvelopes(input) {
2073
2201
  return {
2074
2202
  schemaVersion: SUMMARY_SCHEMA_VERSION,
2075
2203
  status: overall,
2076
- durationMs: Math.round(totalDuration * 1e3) / 1e3,
2204
+ durationMs: finiteDuration2(totalDuration),
2077
2205
  counts: {
2078
2206
  features: featureSet.size,
2079
2207
  scenarios: scenarioCounts,
@@ -2106,7 +2234,7 @@ function isLogoDataUri(value) {
2106
2234
 
2107
2235
  // src/render/escape.ts
2108
2236
  function escapeHtml(value) {
2109
- return value.replace(/[&<>"']/g, (character) => {
2237
+ return String(value ?? "").replace(/[&<>"']/g, (character) => {
2110
2238
  switch (character) {
2111
2239
  case "&":
2112
2240
  return "&amp;";
@@ -2203,7 +2331,7 @@ img, video { max-width: 100%; height: auto; }
2203
2331
  .search:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
2204
2332
  .tagFilter { display: flex; align-items: center; gap: 0.375rem; min-height: 2.125rem; max-width: 100%; }
2205
2333
  .tagFilter > span { color: var(--muted); font-size: 0.75rem; }
2206
- .tagFilter select { max-width: 100%; min-height: 1.875rem; padding: 0 1.5rem 0 0.5rem; border: 1px solid var(--line-strong); border-radius: var(--radius-control); background: var(--paper); color: var(--ink-2); font-size: 0.75rem; }
2334
+ .tagFilter select { max-width: 100%; min-width: 0; min-height: 1.875rem; padding: 0 1.5rem 0 0.5rem; border: 1px solid var(--line-strong); border-radius: var(--radius-control); background: var(--paper); color: var(--ink-2); font-size: 0.75rem; }
2207
2335
  .tagFilter select:hover { color: var(--ink); }
2208
2336
  .filters { display: flex; gap: 0.375rem; flex-wrap: wrap; }
2209
2337
  .filter { min-height: 1.875rem; padding: 0 0.5625rem; border: 1px solid var(--line-strong); border-radius: var(--radius-control); background: var(--paper); color: var(--ink-2); font-size: 0.75rem; }
@@ -2216,13 +2344,56 @@ img, video { max-width: 100%; height: auto; }
2216
2344
  .expand { display: flex; gap: 0.25rem; margin-left: auto; }
2217
2345
  .expand button { min-height: 1.875rem; padding: 0 0.5rem; border: 0; background: transparent; color: var(--muted); font-size: 0.75rem; text-decoration: underline; text-underline-offset: 0.16em; }
2218
2346
  .live { margin: 0.625rem 0 0; color: var(--muted); font-size: 0.75rem; }
2347
+ .searchNote { margin: 0.5rem 0 0; color: var(--muted); font-size: 0.75rem; }
2348
+ .triageBox { margin: 1.25rem 0 1.5rem; }
2349
+ .triageBox > summary { display: none; }
2350
+ .triageSummary { align-items: baseline; gap: 0.25rem 0.5rem; }
2351
+ .triageSummary .triageTitle { font-weight: 600; }
2352
+ .triageSummaryLead { color: var(--muted); font-size: 0.8125rem; }
2353
+ .triageSummary .chev { margin-left: auto; }
2354
+ .triageBox .triage { margin: 0; }
2355
+ .triage { margin: 1.25rem 0 1.5rem; padding: 1.125rem 1.25rem; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface-2); }
2356
+ .triage h2 { margin: 0; font-size: 1.125rem; line-height: 1.3; }
2357
+ .triageLead { margin: 0.25rem 0 0.875rem; color: var(--muted); font-size: 0.8125rem; }
2358
+ .triageList { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.875rem; }
2359
+ .triageItem { display: grid; gap: 0.25rem; min-width: 0; padding-top: 0.875rem; border-top: 1px solid var(--line); }
2360
+ .triageItem:first-child { padding-top: 0; border-top: 0; }
2361
+ .triageFeature { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 0.375rem 0.5rem; min-width: 0; min-height: 1.5rem; padding-block: 0.125rem; color: var(--ink); font-size: 0.875rem; font-weight: 600; text-decoration: none; overflow-wrap: anywhere; }
2362
+ .triageFeature:hover { text-decoration: underline; text-underline-offset: 0.16em; }
2363
+ .triageCounts { margin: 0; color: var(--muted); font-size: 0.75rem; font-variant-numeric: tabular-nums; }
2364
+ .triageScenarios { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 0.875rem; margin: 0.125rem 0 0; padding: 0; list-style: none; }
2365
+ .triageScenarios a { display: grid; grid-template-columns: max-content minmax(0, 1fr); align-items: baseline; gap: 0 0.375rem; min-width: 0; min-height: 1.5rem; padding-block: 0.125rem; color: var(--ink-2); font-size: 0.8125rem; text-decoration: underline; text-decoration-color: color-mix(in oklab, var(--line-strong) 70%, transparent); text-underline-offset: 0.16em; overflow-wrap: anywhere; }
2366
+ .triageScenarios a:hover { color: var(--ink); text-decoration-color: currentColor; }
2367
+ .triageStatus { flex: none; font-size: 0.6875rem; font-weight: 500; letter-spacing: 0.01em; }
2368
+ .triageStatus.pass { color: var(--pass); } .triageStatus.fail { color: var(--fail); } .triageStatus.pending { color: var(--pending); } .triageStatus.undefined { color: var(--undefined); } .triageStatus.ambiguous, .triageStatus.skipped, .triageStatus.unknown { color: var(--muted); }
2369
+ .triageMore { color: var(--muted); font-size: 0.75rem; }
2370
+ .triageReason { margin: 0.25rem 0 0; color: var(--muted); font-size: 0.75rem; overflow-wrap: anywhere; }
2371
+ .triageReasonLabel { color: var(--ink-2); font-weight: 500; }
2372
+ .triageRest { margin-top: 0.75rem; }
2373
+ .triageRest > summary { min-height: 1.5rem; padding-block: 0.125rem; color: var(--accent-text); font-size: 0.8125rem; cursor: pointer; }
2374
+ .triageRest .triageList { margin-top: 0.75rem; }
2375
+ .sources { margin: 0 0 1.5rem; }
2376
+ .sources h2 { margin: 0 0 0.5rem; color: var(--muted); font-size: 0.75rem; font-weight: 600; }
2377
+ .sourceList { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); gap: 0.75rem; margin: 0; padding: 0; list-style: none; }
2378
+ .sourceItem { min-width: 0; padding: 0.75rem 0.875rem; border: 1px solid var(--line); border-radius: var(--radius-control); background: var(--surface-2); }
2379
+ .sourceHead { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 0.5rem; }
2380
+ .sourceName { color: var(--ink); font-size: 0.8125rem; font-weight: 600; overflow-wrap: anywhere; }
2381
+ .sourceCounts { margin: 0.25rem 0 0.5rem; color: var(--muted); font-size: 0.75rem; font-variant-numeric: tabular-nums; }
2382
+ .sourceItem .bar { margin: 0; height: 0.25rem; }
2219
2383
  .feature { border-bottom: 1px solid var(--line-strong); background: transparent; container-type: inline-size; }
2220
- .feature > summary { display: grid; grid-template-columns: minmax(5.5rem, max-content) minmax(0, 1fr) auto 1.25rem; gap: 0.75rem; align-items: center; padding: 1rem 0; list-style: none; cursor: pointer; }
2384
+ .feature > summary { display: grid; grid-template-columns: minmax(5.5rem, max-content) minmax(0, 1fr) 1.25rem; gap: 0.25rem 0.75rem; align-items: start; padding: 1rem 0; list-style: none; cursor: pointer; }
2385
+ .feature > summary .statusCell { grid-column: 1; grid-row: 1 / span 2; align-self: start; }
2386
+ .feature > summary h2 { grid-column: 2; grid-row: 1; }
2387
+ .feature > summary .chev { grid-column: 3; grid-row: 1 / span 2; align-self: center; }
2388
+ .featureShape { grid-column: 2; grid-row: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.75rem; min-width: 0; }
2389
+ .featureCounts { color: var(--muted); font-size: 0.75rem; font-variant-numeric: tabular-nums; }
2390
+ .featureShape .bar { flex: 1 1 6rem; max-width: 16rem; margin: 0; height: 0.25rem; }
2391
+ .featureSource { color: var(--muted); font-size: 0.6875rem; }
2392
+ .featureUri { color: var(--muted); font-size: 0.6875rem; overflow-wrap: anywhere; }
2221
2393
  .feature > summary::-webkit-details-marker, .scenarioButton::-webkit-details-marker { display: none; }
2222
2394
  .feature > summary:focus-visible, .scenarioButton:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
2223
2395
  .feature > summary:hover { background: color-mix(in oklab, var(--surface-2) 70%, var(--paper)); }
2224
2396
  .feature h2 { margin: 0; min-width: 0; font-size: 1rem; line-height: 1.3; font-weight: 600; overflow-wrap: break-word; }
2225
- .feature .fmeta { color: var(--muted); font-size: 0.75rem; text-align: right; font-variant-numeric: tabular-nums; }
2226
2397
  .statusCell { display: flex; align-items: center; }
2227
2398
  .statusText { display: inline-flex; align-items: center; justify-content: center; min-width: 3.875rem; min-height: 1.375rem; padding: 0 0.4375rem; border: 1px solid var(--line-strong); border-radius: 5px; background: var(--surface-3); color: var(--muted); font-size: 0.6875rem; font-weight: 500; }
2228
2399
  .statusText.pass { color: var(--pass); border-color: color-mix(in oklab, var(--pass) 32%, var(--line)); background: var(--pass-soft); }
@@ -2236,7 +2407,7 @@ details[open] > summary .chev { transform: rotate(180deg); }
2236
2407
  .scenario:last-child { border-bottom: 0; }
2237
2408
  .scenarioButton { width: 100%; display: grid; grid-template-columns: minmax(5.5rem, max-content) 6rem minmax(0, 1fr) auto 1.25rem; gap: 0.75rem; align-items: center; padding: 0.75rem 0; border: 0; background: transparent; color: inherit; text-align: left; list-style: none; cursor: pointer; }
2238
2409
  .scenarioButton:hover { background: color-mix(in oklab, var(--surface-2) 70%, var(--paper)); }
2239
- details[open] > summary.scenarioButton { background: var(--accent-soft); }
2410
+ details[open] > summary.scenarioButton { background: var(--surface-2); }
2240
2411
  .scenarioMain { display: flex; flex-direction: column; gap: 0.25rem; min-width: 0; }
2241
2412
  .scenarioName { margin: 0; font-size: 0.875rem; line-height: 1.4; font-weight: 500; overflow-wrap: break-word; }
2242
2413
  .scenarioSub { display: block; color: var(--muted); font-size: 0.75rem; }
@@ -2281,7 +2452,7 @@ details[open] > summary.scenarioButton { background: var(--accent-soft); }
2281
2452
  .attachmentText summary { cursor: pointer; color: var(--accent-text); font-size: 0.75rem; }
2282
2453
  .attachmentText pre { margin: 0.5rem 0 0; white-space: pre-wrap; overflow-wrap: anywhere; font: 0.6875rem/1.45 var(--font-mono); color: var(--ink); }
2283
2454
  .fileLink { display: inline-block; margin: 0.3125rem 0; color: var(--accent-text); font-size: 0.75rem; }
2284
- .meta span, .feature .fmeta, .fileLink, .attachment figcaption, .attachmentText summary, .detailMeta span { overflow-wrap: anywhere; }
2455
+ .meta span, .path, .description, .step, .featureSource, .featureUri, .fileLink, .attachment figcaption, .attachmentText summary, .detailMeta span { overflow-wrap: anywhere; }
2285
2456
  .detailMeta { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; margin-top: 0.75rem; color: var(--muted); font-size: 0.6875rem; font-variant-numeric: tabular-nums; }
2286
2457
  .empty { margin: 1.5rem 0; padding: 1rem; border: 1px solid var(--line-strong); border-radius: var(--radius-control); background: var(--surface-2); color: var(--muted); font-size: 0.875rem; }
2287
2458
  .foot { margin-top: 1.75rem; color: var(--muted); font-size: 0.75rem; }
@@ -2292,12 +2463,19 @@ details[open] > summary.scenarioButton { background: var(--accent-soft); }
2292
2463
  .panel h2 { margin: 0 0 0.375rem; font-size: 1.125rem; }
2293
2464
  .panel h2.subhead { margin: 1.25rem 0 0.5rem; font-size: 1rem; }
2294
2465
  .panel p { margin: 0 0 0.75rem; color: var(--muted); font-size: 0.8125rem; }
2295
- .featureTable { width: 100%; min-width: 28rem; border-collapse: collapse; font-size: 0.8125rem; }
2466
+ .featureTable { width: 100%; min-width: 34rem; border-collapse: collapse; font-size: 0.8125rem; }
2296
2467
  .featureTable th { text-align: left; color: var(--muted); font-size: 0.6875rem; font-weight: 500; padding: 0.5rem 0.5rem 0.5rem 0; border-bottom: 1px solid var(--line-strong); }
2468
+ .featureTable th:not(:first-child) { text-align: right; }
2469
+ .featureTable th[scope="row"] { width: 38%; color: var(--ink); font-size: 0.8125rem; font-weight: 400; overflow-wrap: anywhere; }
2470
+ .featureTable .matrixName { display: block; }
2471
+ .featureTable .matrixUri { display: block; color: var(--muted); font-size: 0.6875rem; overflow-wrap: anywhere; }
2472
+ .featureTable th:first-child, .featureTable td:first-child { width: 38%; overflow-wrap: anywhere; }
2297
2473
  .featureTable td { padding: 0.5rem 0.5rem 0.5rem 0; border-bottom: 1px solid var(--line); }
2298
2474
  .featureTable td:last-child, .featureTable th:last-child { text-align: right; }
2299
2475
  .featureTable tr:last-child td { border-bottom: 0; }
2300
2476
  .featureTable .num { text-align: right; font-family: var(--font-mono); font-size: 0.75rem; font-variant-numeric: tabular-nums; }
2477
+ .featureTable .zero { color: var(--muted); }
2478
+ .matrixHint { display: none; }
2301
2479
  .legend { display: grid; gap: 0.375rem; margin-top: 0.625rem; }
2302
2480
  .legendRow { display: grid; grid-template-columns: 0.625rem minmax(0, 1fr) auto; gap: 0.5rem; align-items: center; font-size: 0.8125rem; border-radius: 5px; padding: 0.375rem 0.5rem; background: var(--surface-3); }
2303
2481
  .legendRow.pass { background: var(--pass-soft); } .legendRow.fail { background: var(--fail-soft); } .legendRow.pending { background: var(--pending-soft); } .legendRow.undefined { background: var(--undefined-soft); } .legendRow.ambiguous, .legendRow.skipped, .legendRow.unknown { background: var(--surface-3); }
@@ -2314,7 +2492,7 @@ details[open] > summary.scenarioButton { background: var(--accent-soft); }
2314
2492
  .runHead { grid-template-columns: 1fr; gap: 1.25rem; }
2315
2493
  .health { border-left: 0; border-top: 1px solid var(--line-strong); padding: 1rem 0 0; }
2316
2494
  .feature > summary { grid-template-columns: 4.75rem minmax(0, 1fr) 1.25rem; }
2317
- .fmeta { display: none; }
2495
+ .featureUri { display: none; }
2318
2496
  .scenarioButton { grid-template-columns: minmax(3.5rem, max-content) 2.75rem minmax(0, 1fr) 1.125rem; grid-template-areas: "status thumb title chev" "status thumb meta chev"; gap: 0.25rem 0.5rem; align-items: start; }
2319
2497
  .scenarioButton .statusCell { grid-area: status; align-self: start; }
2320
2498
  .scenarioButton .thumbCell { grid-area: thumb; align-self: start; }
@@ -2337,14 +2515,21 @@ details[open] > summary.scenarioButton { background: var(--accent-soft); }
2337
2515
  .thumb { width: 2.5rem; height: 1.875rem; }
2338
2516
  .statusText { min-width: 3.125rem; }
2339
2517
  .filter { min-height: 1.75rem; }
2518
+ .matrixHint { display: block; margin: 0 0 0.5rem; font-size: 0.75rem; }
2519
+ .triageBox > summary { display: flex; flex-wrap: wrap; padding: 0.875rem 1rem; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface-2); cursor: pointer; }
2520
+ .triageBox .triage { margin: 0.5rem 0 0; }
2521
+ .triageBox .triage h2, .triageBox .triage .triageLead { display: none; }
2522
+ .sources { display: none; }
2340
2523
  }
2341
2524
  @media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
2342
2525
  @container (max-width: 16rem) {
2343
2526
  .runHead h1 { font-size: 1.3rem; }
2344
- .feature > summary { grid-template-columns: auto 1fr auto; grid-template-areas: "status . chev" "title title title"; gap: 0.5rem; }
2527
+ .feature > summary { grid-template-columns: auto 1fr auto; grid-template-areas: "status . chev" "title title title" "shape shape shape"; gap: 0.5rem; }
2345
2528
  .feature > summary .statusCell { grid-area: status; }
2346
2529
  .feature > summary h2 { grid-area: title; }
2347
2530
  .feature > summary .chev { grid-area: chev; }
2531
+ .featureShape { grid-area: shape; }
2532
+ .triageScenarios a { grid-template-columns: minmax(0, 1fr); gap: 0.125rem; }
2348
2533
  .scenarioButton { grid-template-columns: auto auto 1fr auto; grid-template-areas: "status thumb . chev" "title title title title" "meta meta meta meta"; gap: 0.5rem; }
2349
2534
  .scenarioButton .statusCell { grid-area: status; }
2350
2535
  .scenarioButton .thumbCell { grid-area: thumb; }
@@ -2409,6 +2594,7 @@ var STEP_GLYPHS = {
2409
2594
  unknown: "\xB7"
2410
2595
  };
2411
2596
  function durationLabel(milliseconds) {
2597
+ if (!Number.isFinite(milliseconds) || milliseconds < 0) return "0 ms";
2412
2598
  if (milliseconds < 1e3) return `${Math.round(milliseconds * 100) / 100} ms`;
2413
2599
  return `${(milliseconds / 1e3).toFixed(2)} s`;
2414
2600
  }
@@ -2432,11 +2618,140 @@ function displayStatuses(model) {
2432
2618
  (status) => model.counts.scenarios[status] > 0
2433
2619
  );
2434
2620
  }
2621
+ var TRIAGE_FEATURE_LIMIT = 20;
2622
+ var TRIAGE_SCENARIO_LIMIT = 3;
2623
+ var SOURCE_LIMIT = 6;
2624
+ var SEARCH_MESSAGE_LIMIT = 2e3;
2625
+ function compareStatus(a, b) {
2626
+ const passed = Number(a === "passed") - Number(b === "passed");
2627
+ return passed !== 0 ? passed : statusSeverity(b) - statusSeverity(a);
2628
+ }
2629
+ function bySeverity(items) {
2630
+ return items.map((item, index) => ({ item, index })).sort((a, b) => {
2631
+ const status = compareStatus(a.item.status, b.item.status);
2632
+ return status !== 0 ? status : a.index - b.index;
2633
+ }).map(({ item }) => item);
2634
+ }
2635
+ function orderFeatures(features) {
2636
+ return bySeverity(features).map((feature) => ({
2637
+ feature,
2638
+ scenarios: bySeverity(feature.scenarios)
2639
+ }));
2640
+ }
2641
+ function countStatuses(scenarios) {
2642
+ const counts = {};
2643
+ for (const scenario of scenarios) {
2644
+ counts[scenario.status] = (counts[scenario.status] ?? 0) + 1;
2645
+ }
2646
+ return counts;
2647
+ }
2648
+ function barWidth(count2, total) {
2649
+ return total === 0 ? 0 : Math.round(count2 / total * 1e3) / 10;
2650
+ }
2651
+ function attentionCounts(scenarios) {
2652
+ const counts = /* @__PURE__ */ new Map();
2653
+ for (const scenario of scenarios) {
2654
+ if (scenario.status === "passed") continue;
2655
+ counts.set(scenario.status, (counts.get(scenario.status) ?? 0) + 1);
2656
+ }
2657
+ return [...counts.entries()].sort((a, b) => statusSeverity(b[0]) - statusSeverity(a[0])).map(([status, count2]) => `${count2} ${status}`).join(", ");
2658
+ }
2659
+ function featureBar(scenarios) {
2660
+ const total = scenarios.length;
2661
+ if (total === 0) return "";
2662
+ const counts = countStatuses(scenarios);
2663
+ const segments = ALL_STATUSES.filter((status) => counts[status]).map(
2664
+ (status) => `<i class="${statusClass(status)}" style="width:${barWidth(counts[status] ?? 0, total)}%"></i>`
2665
+ ).join("");
2666
+ return `<span class="bar" aria-hidden="true">${segments}</span>`;
2667
+ }
2668
+ function featureShape(feature, scenarios) {
2669
+ const passed = scenarios.filter(
2670
+ (scenario) => scenario.status === "passed"
2671
+ ).length;
2672
+ const attention = attentionCounts(scenarios);
2673
+ const counts = `${passed} of ${scenarios.length} passed${attention ? ` \xB7 ${attention}` : ""}`;
2674
+ const source = feature.sourceFile ? `<span class="featureSource">from ${escapeHtml(feature.sourceFile)}</span>` : "";
2675
+ return `<span class="featureShape"><span class="featureCounts">${counts}</span>${featureBar(scenarios)}${source}<span class="featureUri">${escapeHtml(displayUri(feature.uri))}</span></span>`;
2676
+ }
2677
+ function renderTriageRow({
2678
+ feature,
2679
+ scenarios,
2680
+ index
2681
+ }) {
2682
+ const failing = scenarios.filter(
2683
+ (scenario) => scenario.status !== "passed"
2684
+ );
2685
+ const links = failing.slice(0, TRIAGE_SCENARIO_LIMIT).map((scenario) => {
2686
+ const scenarioIndex = scenarios.indexOf(scenario) + 1;
2687
+ return `<li><a class="triageScenario" href="#scenario-${index + 1}-${scenarioIndex}"><span class="triageStatus ${statusClass(scenario.status)}">${statusLabel(scenario.status)}</span><span>${escapeHtml(scenario.name)}</span></a></li>`;
2688
+ }).join("");
2689
+ const more = failing.length > TRIAGE_SCENARIO_LIMIT ? `<li class="triageMore">+${failing.length - TRIAGE_SCENARIO_LIMIT} more in the report</li>` : "";
2690
+ const failed = scenarios.find((scenario) => scenario.status === "failed");
2691
+ const failedStep = failed?.steps.find(
2692
+ (step) => step.status === "failed" && step.message
2693
+ );
2694
+ const reason = failedStep?.message ? `${failedStep.keyword ? `${failedStep.keyword} ` : ""}${failedStep.text} \u2014 ${failedStep.message.split(/\r?\n/)[0].trim().slice(0, 120)}${failedStep.message.split(/\r?\n/)[0].trim().length > 120 ? "\u2026" : ""}` : "";
2695
+ return `<li class="triageItem"><a class="triageFeature" href="#feature-${index + 1}" title="${escapeHtml(displayUri(feature.uri))}"><span class="triageStatus ${statusClass(feature.status)}">${statusLabel(feature.status)}</span><span>${escapeHtml(feature.name)}</span></a><p class="triageCounts">${attentionCounts(scenarios)}</p><ul class="triageScenarios">${links}${more}</ul>${reason ? `<p class="triageReason"><span class="triageReasonLabel">First failure:</span> ${escapeHtml(reason)}</p>` : ""}</li>`;
2696
+ }
2697
+ function renderTriage(features) {
2698
+ const attention = features.map((entry, index) => ({ ...entry, index })).filter(
2699
+ ({ scenarios }) => scenarios.some((scenario) => scenario.status !== "passed")
2700
+ );
2701
+ if (attention.length === 0) return "";
2702
+ const shown = attention.slice(0, 5);
2703
+ const rest = attention.slice(5, TRIAGE_FEATURE_LIMIT);
2704
+ const total = features.reduce(
2705
+ (sum, entry) => sum + entry.scenarios.length,
2706
+ 0
2707
+ );
2708
+ const need = attention.reduce(
2709
+ (sum, entry) => sum + entry.scenarios.filter((scenario) => scenario.status !== "passed").length,
2710
+ 0
2711
+ );
2712
+ const rows = shown.map(renderTriageRow).join("");
2713
+ const restBlock = rest.length ? `<details class="triageRest"><summary>Show ${rest.length} more feature${rest.length === 1 ? "" : "s"}</summary><ol class="triageList">${rest.map(renderTriageRow).join("")}</ol></details>` : "";
2714
+ const remainder = attention.length > TRIAGE_FEATURE_LIMIT ? `<p class="triageMore">${attention.length - TRIAGE_FEATURE_LIMIT} more feature${attention.length - TRIAGE_FEATURE_LIMIT === 1 ? "" : "s"} below.</p>` : "";
2715
+ const lead = `${need} of ${total} scenario${total === 1 ? "" : "s"} ${need === 1 ? "needs" : "need"} attention.`;
2716
+ return `<details class="triageBox" data-triage open><summary class="triageSummary"><span class="triageTitle">Needs attention</span><span class="triageSummaryLead">${lead}</span><span class="chev" aria-hidden="true"></span></summary><nav class="triage" aria-label="Needs attention"><h2 id="triage-heading">Needs attention</h2><p class="triageLead">${lead}</p><ol class="triageList">${rows}</ol>${restBlock}${remainder}</nav></details>`;
2717
+ }
2718
+ function renderSourceStrip(model) {
2719
+ if (model.features.some((feature) => !feature.sourceFile)) return "";
2720
+ const groups = /* @__PURE__ */ new Map();
2721
+ model.features.forEach((feature, index) => {
2722
+ const file = feature.sourceFile;
2723
+ if (!file) return;
2724
+ const group = groups.get(file) ?? { features: [], order: index };
2725
+ group.features.push(feature);
2726
+ groups.set(file, group);
2727
+ });
2728
+ if (groups.size < 2) return "";
2729
+ const entries = [...groups.entries()].map(([file, group]) => ({
2730
+ file,
2731
+ features: group.features.length,
2732
+ scenarios: group.features.flatMap((feature) => feature.scenarios),
2733
+ status: bySeverity(group.features)[0]?.status ?? "unknown",
2734
+ order: group.order
2735
+ }));
2736
+ entries.sort((a, b) => {
2737
+ const status = compareStatus(a.status, b.status);
2738
+ return status !== 0 ? status : a.order - b.order;
2739
+ });
2740
+ const shown = entries.slice(0, SOURCE_LIMIT);
2741
+ const remainder = entries.length - shown.length;
2742
+ const items = shown.map((entry) => {
2743
+ const attention = attentionCounts(entry.scenarios);
2744
+ const counts = `${entry.features} feature${entry.features === 1 ? "" : "s"} \xB7 ${entry.scenarios.length} scenario${entry.scenarios.length === 1 ? "" : "s"}${attention ? ` \xB7 ${attention}` : ""}`;
2745
+ return `<li class="sourceItem"><div class="sourceHead"><span class="triageStatus ${statusClass(entry.status)}">${statusLabel(entry.status)}</span><span class="sourceName">${escapeHtml(entry.file)}</span></div><p class="sourceCounts">${counts}</p>${featureBar(entry.scenarios)}</li>`;
2746
+ }).join("");
2747
+ const more = remainder > 0 ? `<p class="triageMore">${remainder} more input${remainder === 1 ? "" : "s"}</p>` : "";
2748
+ return `<section class="sources" aria-labelledby="sources-heading" data-sources><h2 id="sources-heading">Sources</h2><ul class="sourceList">${items}</ul>${more}</section>`;
2749
+ }
2435
2750
  function statusBar(model) {
2436
2751
  const total = model.counts.scenarios.total;
2437
2752
  if (total === 0) return "";
2438
2753
  return `<div class="bar" aria-hidden="true">${displayStatuses(model).map(
2439
- (status) => `<i class="${statusClass(status)}" style="width:${model.counts.scenarios[status] / total * 100}%"></i>`
2754
+ (status) => `<i class="${statusClass(status)}" style="width:${barWidth(model.counts.scenarios[status], total)}%"></i>`
2440
2755
  ).join("")}</div>`;
2441
2756
  }
2442
2757
  function countPills(model) {
@@ -2487,14 +2802,14 @@ function scenarioText(scenario) {
2487
2802
  return [
2488
2803
  scenario.name,
2489
2804
  scenario.featureName,
2490
- scenario.uri,
2805
+ displayUri(scenario.uri),
2491
2806
  scenario.keyword,
2492
2807
  scenario.description,
2493
2808
  scenario.tags.join(" "),
2494
- scenario.steps.map((step) => `${step.keyword} ${step.text} ${step.message ?? ""}`).join(" ")
2809
+ scenario.steps.map((step) => `${step.keyword} ${step.text} ${(step.message ?? "").slice(0, SEARCH_MESSAGE_LIMIT)}`).join(" ")
2495
2810
  ].join(" ");
2496
2811
  }
2497
- function renderScenario(scenario) {
2812
+ function renderScenario(scenario, featureIndex, scenarioIndex) {
2498
2813
  const image = scenario.attachments.find(
2499
2814
  (attachment) => attachment.kind === "image" && attachment.dataUri
2500
2815
  );
@@ -2503,15 +2818,34 @@ function renderScenario(scenario) {
2503
2818
  const description = scenario.description ? `<p class="description">${escapeHtml(scenario.description)}</p>` : "";
2504
2819
  const extraAttachments = scenario.extraAttachments.length ? `<h4>Attachments</h4>${scenario.extraAttachments.map((attachment) => renderAttachment(attachment, scenario.name)).join("")}` : "";
2505
2820
  const copyFailure = scenario.status === "failed" ? '<button class="copyFailure" type="button" data-copy-failure>Copy failure</button>' : "";
2506
- return `<details class="scenario" data-scenario data-status="${scenario.status}" data-uri="${escapeHtml(scenario.uri)}" data-tags="${escapeHtml(scenario.tags.join(" "))}" data-search="${escapeHtml(scenarioText(scenario))}" ${open ? "open" : ""}><summary class="scenarioButton"><span class="statusCell"><span class="statusText ${statusClass(scenario.status)}">${statusLabel(scenario.status)}</span></span><span class="thumbCell">${image ? `<img class="thumb" src="${escapeHtml(image.dataUri ?? "")}" alt="" loading="lazy">` : ""}</span><span class="scenarioMain"><h3 class="scenarioName">${escapeHtml(scenario.name)}</h3><span class="scenarioSub">${scenario.steps.length} step${scenario.steps.length === 1 ? "" : "s"}${scenario.tags.length ? ` <span class="tags">${scenario.tags.map((tag) => `<span class="tag">${escapeHtml(tag)}</span>`).join("")}</span>` : ""}</span></span><span class="rowRight">${durationLabel(scenario.durationMs)}${scenario.attachments.length ? `<br>${scenario.attachments.length} attachment${scenario.attachments.length === 1 ? "" : "s"}` : ""}</span><span class="chev" aria-hidden="true"></span></summary><div class="detailInline">${description}<div class="stepsHead"><h4>Steps</h4>${copyFailure}</div><ol class="steps">${steps}</ol>${extraAttachments}<div class="detailMeta"><span>Feature: ${escapeHtml(scenario.featureName)}</span><span>Attempt: ${scenario.attempt + 1}</span>${scenario.startedAt ? `<span>Started: ${dateLabel(scenario.startedAt)}</span>` : ""}${scenario.ruleName ? `<span>Rule: ${escapeHtml(scenario.ruleName)}</span>` : ""}</div></div></details>`;
2821
+ return `<details class="scenario" id="scenario-${featureIndex + 1}-${scenarioIndex + 1}" data-scenario data-status="${scenario.status}" data-uri="${escapeHtml(displayUri(scenario.uri))}" data-tags="${escapeHtml(scenario.tags.join(" "))}" data-search="${escapeHtml(scenarioText(scenario))}" ${open ? "open" : ""}><summary class="scenarioButton"><span class="statusCell"><span class="statusText ${statusClass(scenario.status)}">${statusLabel(scenario.status)}</span></span><span class="thumbCell">${image ? `<img class="thumb" src="${escapeHtml(image.dataUri ?? "")}" alt="" loading="lazy">` : ""}</span><span class="scenarioMain"><h3 class="scenarioName">${escapeHtml(scenario.name)}</h3><span class="scenarioSub">${scenario.steps.length} step${scenario.steps.length === 1 ? "" : "s"}${scenario.tags.length ? ` <span class="tags">${scenario.tags.map((tag) => `<span class="tag">${escapeHtml(tag)}</span>`).join("")}</span>` : ""}</span></span><span class="rowRight">${durationLabel(scenario.durationMs)}${scenario.attachments.length ? `<br>${scenario.attachments.length} attachment${scenario.attachments.length === 1 ? "" : "s"}` : ""}</span><span class="chev" aria-hidden="true"></span></summary><div class="detailInline">${description}<div class="stepsHead"><h4>Steps</h4>${copyFailure}</div><ol class="steps">${steps}</ol>${extraAttachments}<div class="detailMeta"><span>Feature: ${escapeHtml(scenario.featureName)}</span><span>Attempt: ${scenario.attempt + 1}</span>${scenario.startedAt ? `<span>Started: ${dateLabel(scenario.startedAt)}</span>` : ""}${scenario.ruleName ? `<span>Rule: ${escapeHtml(scenario.ruleName)}</span>` : ""}</div></div></details>`;
2507
2822
  }
2508
- function renderFeature(feature) {
2509
- const passed = feature.scenarios.filter((scenario) => scenario.status === "passed").length;
2510
- const open = feature.status === "failed" || feature.scenarios.some(
2823
+ function renderFeature({ feature, scenarios }, featureIndex) {
2824
+ const open = feature.status === "failed" || scenarios.some(
2511
2825
  (scenario) => scenario.attachments.some((attachment) => attachment.kind === "image")
2512
2826
  );
2513
2827
  const description = feature.description ? `<p class="description">${escapeHtml(feature.description)}</p>` : "";
2514
- return `<details class="feature ${feature.status === "failed" ? "has-fail" : "has-pass"}" data-feature ${open ? "open" : ""}><summary><span class="statusCell"><span class="statusText ${statusClass(feature.status)}">${statusLabel(feature.status)}</span></span><h2>${escapeHtml(feature.name)}</h2><span class="fmeta">${passed} of ${feature.scenarios.length} passed, ${escapeHtml(feature.uri)}</span><span class="chev" aria-hidden="true"></span></summary>${description}<div class="rows">${feature.scenarios.map(renderScenario).join("")}</div></details>`;
2828
+ return `<details class="feature ${feature.status === "failed" ? "has-fail" : "has-pass"}" id="feature-${featureIndex + 1}" data-feature ${open ? "open" : ""}><summary><span class="statusCell"><span class="statusText ${statusClass(feature.status)}">${statusLabel(feature.status)}</span></span><h2>${escapeHtml(feature.name)}</h2><span class="chev" aria-hidden="true"></span>${featureShape(feature, scenarios)}</summary>${description}<div class="rows">${scenarios.map(
2829
+ (scenario, scenarioIndex) => renderScenario(scenario, featureIndex, scenarioIndex)
2830
+ ).join("")}</div></details>`;
2831
+ }
2832
+ function matrixStatuses(model) {
2833
+ return ALL_STATUSES.filter((status) => model.counts.scenarios[status] > 0).sort(
2834
+ compareStatus
2835
+ );
2836
+ }
2837
+ function renderFeatureMatrix(model) {
2838
+ const statuses = matrixStatuses(model);
2839
+ const head = `<tr><th>Feature</th><th>Total</th>${statuses.map((status) => `<th>${statusLabel(status)}</th>`).join("")}<th>Duration</th></tr>`;
2840
+ const rows = model.features.map((feature) => {
2841
+ const counts = countStatuses(feature.scenarios);
2842
+ const cells = statuses.map((status) => {
2843
+ const count2 = counts[status] ?? 0;
2844
+ return `<td class="num${count2 === 0 ? " zero" : ""}">${count2}</td>`;
2845
+ }).join("");
2846
+ return `<tr><th scope="row"><span class="matrixName">${escapeHtml(feature.name)}</span><span class="matrixUri">${escapeHtml(displayUri(feature.uri))}</span></th><td class="num">${feature.scenarios.length}</td>${cells}<td class="num">${durationLabel(feature.durationMs)}</td></tr>`;
2847
+ }).join("");
2848
+ return `<table class="featureTable"><thead>${head}</thead><tbody>${rows}</tbody></table>`;
2515
2849
  }
2516
2850
  function metadataLine(metadata) {
2517
2851
  return Object.entries(metadata ?? {}).filter(([key, value]) => key.length > 0 && value.length > 0).map(
@@ -2524,12 +2858,15 @@ function renderReportView(model, options) {
2524
2858
  const percent = total === 0 ? 0 : Math.round(passed / total * 1e3) / 10;
2525
2859
  const meta = metadataLine(options.metadata);
2526
2860
  const date = dateLabel(model.startedAt);
2527
- const features = model.features.map((feature) => renderFeature(feature)).join("");
2861
+ const ordered = orderFeatures(model.features);
2862
+ const features = ordered.map((feature, index) => renderFeature(feature, index)).join("");
2863
+ const triage = renderTriage(ordered);
2864
+ const sources = renderSourceStrip(model);
2528
2865
  const tags = scenarioTags(model);
2529
2866
  const tagFilter = tags.length ? `<label class="tagFilter"><span>Tag</span><select data-tag-filter><option value="">All tags</option>${tags.map((tag) => `<option value="${escapeHtml(tag)}">${escapeHtml(tag)}</option>`).join("")}</select></label>` : "";
2530
- return `<div class="tabPanel" id="report-view" role="tabpanel" aria-labelledby="view-report" tabindex="0"><main class="shell"><header class="runHead"><div><p class="path">${escapeHtml(model.source)} / ${escapeHtml(options.title)}</p><h1>${escapeHtml(options.title)}</h1><p class="meta">${date ? `<span>${date}</span>` : ""}<span>${model.counts.features} feature${model.counts.features === 1 ? "" : "s"}</span><span>${model.counts.scenarios.total} scenarios</span><span>${escapeHtml(model.source)}</span>${meta}</p></div><div class="health"><div class="healthTop"><strong>${percent}%</strong><span>${passed} of ${total} passed</span></div>${statusBar(model)}${countPills(model)}</div></header><div class="toolbar"><label class="search"><span aria-hidden="true">\u2315</span><input data-search type="search" placeholder="Search scenario, feature or tag" aria-label="Search scenarios"></label>${tagFilter}<div class="filters">${displayStatuses(model).map(
2867
+ return `<div class="tabPanel" id="report-view" role="tabpanel" aria-labelledby="view-report" tabindex="0"><main class="shell"><header class="runHead"><div><p class="path">${escapeHtml(model.source)} / ${escapeHtml(options.title)}</p><h1>${escapeHtml(options.title)}</h1><p class="meta">${date ? `<span>${date}</span>` : ""}<span>${model.counts.features} feature${model.counts.features === 1 ? "" : "s"}</span><span>${model.counts.scenarios.total} scenarios</span><span>${durationLabel(model.durationMs)}</span><span>${escapeHtml(model.source)}</span>${meta}</p></div><div class="health"><div class="healthTop"><strong>${percent}%</strong><span>${passed} of ${total} passed</span></div>${statusBar(model)}${countPills(model)}</div></header><div class="toolbar"><label class="search"><span aria-hidden="true">\u2315</span><input data-search type="search" placeholder="Search scenario, feature or tag" aria-label="Search scenarios"></label>${tagFilter}<div class="filters">${displayStatuses(model).map(
2531
2868
  (status) => `<button class="filter" type="button" data-status="${status}" aria-pressed="true">${statusLabel(status)} <b>${model.counts.scenarios[status]}</b></button>`
2532
- ).join("")}</div><div class="expand"><button type="button" data-expand="all">Expand all</button><button type="button" data-expand="none">Collapse all</button></div></div><p class="live sr" id="tolkira-live" role="status" aria-live="polite" data-total="${total}"></p><p class="sr" id="tolkira-copy-live" aria-live="polite"></p><div id="feature-list">${features || `<div class="empty">No scenarios in this report.</div>`}</div><div class="empty" id="empty-results" hidden>No scenarios match the current search or filters.</div><p class="foot">Generated by Tolkira. Single file. No network requests. Screenshots are embedded.</p></main></div>`;
2869
+ ).join("")}</div><div class="expand"><button type="button" data-expand="all">Expand all</button><button type="button" data-expand="none">Collapse all</button></div></div><p class="live sr" id="tolkira-live" role="status" aria-live="polite" data-total="${total}"></p><p class="sr" id="tolkira-copy-live" aria-live="polite"></p><p class="searchNote" id="tolkira-search-note" hidden></p>${triage}${sources}<div id="feature-list">${features || `<div class="empty">No scenarios in this report.</div>`}</div><div class="empty" id="empty-results" hidden>No scenarios match the current search or filters.</div><p class="foot">Generated by Tolkira. Single file. No network requests. Screenshots are embedded.</p></main></div>`;
2533
2870
  }
2534
2871
  function renderAnalysisView(model, options, summary) {
2535
2872
  const counts = model.counts.scenarios;
@@ -2550,9 +2887,7 @@ function renderAnalysisView(model, options, summary) {
2550
2887
  model.environment?.protocol ? `<dt>Protocol</dt><dd>${escapeHtml(model.environment.protocol)}</dd>` : ""
2551
2888
  ].join("");
2552
2889
  const runRows = `<dt>Duration</dt><dd>${durationLabel(model.durationMs)}</dd><dt>Features</dt><dd>${model.counts.features}</dd><dt>Scenarios</dt><dd>${counts.total}</dd><dt>Steps</dt><dd>${model.counts.steps.total}</dd><dt>Attachments</dt><dd>${model.counts.attachments}</dd><dt>Attachment size</dt><dd>${model.counts.attachmentBytes} bytes</dd><dt>Source</dt><dd>${escapeHtml(model.source)}</dd>`;
2553
- return `<div class="tabPanel" id="analysis-view" role="tabpanel" aria-labelledby="view-analysis" tabindex="0" hidden><main class="shell analysis"><header class="runHead"><div><p class="path">${escapeHtml(model.source)} / details</p><h1>Run details</h1><p class="meta">${dateLabel(model.startedAt) ? `<span>${dateLabel(model.startedAt)}</span>` : ""}<span>${escapeHtml(model.source)}</span></p></div><div class="health"><div class="healthTop"><strong>${counts.total === 0 ? 0 : Math.round(counts.passed / counts.total * 1e3) / 10}%</strong><span>${counts.passed} of ${counts.total} passed</span></div>${statusBar(model)}${countPills(model)}</div></header><div class="analysisGrid"><section class="panel"><h2>Features</h2><p>Where the run spent its scenarios and steps.</p><div class="tableWrap" tabindex="0" role="region" aria-label="Feature summary table"><table class="featureTable"><thead><tr><th>Feature</th><th>Scenarios</th><th>Passed</th><th>Failed</th><th>Duration</th></tr></thead><tbody>${model.features.map(
2554
- (feature) => `<tr><td>${escapeHtml(feature.name)}</td><td class="num">${feature.scenarios.length}</td><td class="num">${feature.scenarios.filter((scenario) => scenario.status === "passed").length}</td><td class="num">${feature.scenarios.filter((scenario) => scenario.status === "failed").length}</td><td class="num">${durationLabel(feature.durationMs)}</td></tr>`
2555
- ).join("")}</tbody></table></div></section><section class="panel"><h2>Status distribution</h2><p>All scenarios in the run.</p><div class="legend">${displayStatuses(model).map(
2890
+ return `<div class="tabPanel" id="analysis-view" role="tabpanel" aria-labelledby="view-analysis" tabindex="0" hidden><main class="shell analysis"><header class="runHead"><div><p class="path">${escapeHtml(model.source)} / details</p><h1>Run details</h1><p class="meta">${dateLabel(model.startedAt) ? `<span>${dateLabel(model.startedAt)}</span>` : ""}<span>${escapeHtml(model.source)}</span></p></div><div class="health"><div class="healthTop"><strong>${counts.total === 0 ? 0 : Math.round(counts.passed / counts.total * 1e3) / 10}%</strong><span>${counts.passed} of ${counts.total} passed</span></div>${statusBar(model)}${countPills(model)}</div></header><div class="analysisGrid"><section class="panel"><h2>Features</h2><p>Where the run spent its scenarios and steps.</p><p class="matrixHint">Scroll for all status columns.</p><div class="tableWrap" tabindex="0" role="region" aria-label="Feature status matrix">${renderFeatureMatrix(model)}</div></section><section class="panel"><h2>Status distribution</h2><p>All scenarios in the run.</p><div class="legend">${displayStatuses(model).map(
2556
2891
  (status) => `<div class="legendRow ${statusClass(status)}"><span class="marker ${statusClass(status)}"></span><span>${statusLabel(status)}</span><b>${counts[status]}</b></div>`
2557
2892
  ).join("")}</div><h2 class="subhead">Run</h2><dl class="metaList">${runRows}</dl>${environmentRows ? `<h2 class="subhead">Cucumber environment</h2><dl class="metaList">${environmentRows}</dl>` : ""}${customRows ? `<h2 class="subhead">Custom metadata</h2><dl class="metaList">${customRows}</dl>` : ""}</section></div>${model.runAttachments.length ? `<section class="panel" style="margin-top:16px"><h2>Run attachments</h2>${model.runAttachments.map((attachment) => renderAttachment(attachment, "Run attachments")).join("")}</section>` : ""}<section class="panel" style="margin-top:16px"><h2>Agent summary</h2><p>The same run as stable JSON for CI tools and agents.</p><pre class="json" tabindex="0" aria-label="Agent summary JSON">${escapeHtml(JSON.stringify(preview))}</pre></section><p class="foot">Full summary: <code>tolkira ... --json</code></p></main></div>`;
2558
2893
  }
@@ -2585,9 +2920,13 @@ var SCRIPT = `<script>
2585
2920
  showView(views[next].getAttribute('data-view'));
2586
2921
  });
2587
2922
  var state = { query: '', hidden: new Set(), tag: '' };
2923
+ var searchOpened = [];
2588
2924
  var scenarios = Array.prototype.slice.call(document.querySelectorAll('[data-scenario]'));
2589
2925
  var features = Array.prototype.slice.call(document.querySelectorAll('[data-feature]'));
2590
2926
  var live = document.getElementById('tolkira-live');
2927
+ var searchNote = document.getElementById('tolkira-search-note');
2928
+ var triage = document.querySelector('[data-triage]');
2929
+ var sources = document.querySelector('[data-sources]');
2591
2930
  function apply() {
2592
2931
  var query = state.query.toLowerCase();
2593
2932
  var tag = state.tag;
@@ -2607,14 +2946,32 @@ var SCRIPT = `<script>
2607
2946
  feature.hidden = !any;
2608
2947
  if (any && (query || state.hidden.size || tag)) feature.open = true;
2609
2948
  });
2949
+ searchOpened.forEach(function (scenario) { scenario.open = false; });
2950
+ searchOpened = [];
2610
2951
  if (query) {
2952
+ var opened = 0;
2611
2953
  scenarios.forEach(function (scenario) {
2612
- if (!scenario.hidden) scenario.open = true;
2954
+ if (!scenario.hidden && opened < 20) {
2955
+ if (!scenario.open) searchOpened.push(scenario);
2956
+ scenario.open = true;
2957
+ opened += 1;
2958
+ }
2613
2959
  });
2614
2960
  }
2615
2961
  if (live) live.textContent = visible + ' of ' + scenarios.length + ' scenarios visible';
2962
+ if (searchNote) {
2963
+ if (query && visible > 20) {
2964
+ searchNote.textContent = '20 of ' + visible + ' matches expanded. Use Expand all to open the rest.';
2965
+ searchNote.hidden = false;
2966
+ } else {
2967
+ searchNote.hidden = true;
2968
+ searchNote.textContent = '';
2969
+ }
2970
+ }
2616
2971
  var empty = document.getElementById('empty-results');
2617
2972
  if (empty) empty.hidden = visible !== 0;
2973
+ if (triage) triage.hidden = Boolean(query || tag || state.hidden.size);
2974
+ if (sources) sources.hidden = Boolean(query || tag || state.hidden.size);
2618
2975
  highlightSearch();
2619
2976
  }
2620
2977
  function clearHighlights() {
@@ -2809,7 +3166,32 @@ var SCRIPT = `<script>
2809
3166
  lightbox.addEventListener('click', function (event) { if (event.target === lightbox) closeDialog(); });
2810
3167
  lightbox.addEventListener('close', restoreLightbox);
2811
3168
  }
3169
+ function revealHash() {
3170
+ if (!location.hash) return;
3171
+ var id = '';
3172
+ try { id = decodeURIComponent(location.hash.slice(1)); } catch (error) { return; }
3173
+ var target = document.getElementById(id);
3174
+ if (!target) return;
3175
+ var node = target;
3176
+ while (node) {
3177
+ if (node.tagName === 'DETAILS') node.open = true;
3178
+ node = node.parentElement;
3179
+ }
3180
+ var focusTarget = target.tagName === 'DETAILS' ? target.querySelector('summary') : target;
3181
+ if (focusTarget) {
3182
+ try { focusTarget.focus({ preventScroll: true }); } catch (error) { focusTarget.focus(); }
3183
+ }
3184
+ target.scrollIntoView();
3185
+ }
3186
+ var compact = window.matchMedia('(max-width: 560px)');
3187
+ function syncCompact() {
3188
+ if (triage) triage.open = !compact.matches;
3189
+ }
3190
+ if (compact.addEventListener) compact.addEventListener('change', syncCompact);
3191
+ syncCompact();
3192
+ window.addEventListener('hashchange', revealHash);
2812
3193
  showView('report');
3194
+ revealHash();
2813
3195
  })();
2814
3196
  </script>`;
2815
3197
  function inlineScriptHashes(html) {
@@ -2827,7 +3209,7 @@ function csp(hashes) {
2827
3209
  }
2828
3210
  async function renderHtml(envelopes, options) {
2829
3211
  const safeEnvelopes = sanitizeEnvelopes(envelopes);
2830
- const model = buildReportModel(safeEnvelopes);
3212
+ const model = buildReportModel(safeEnvelopes, options.provenance);
2831
3213
  const summary = options.summary ?? summarizeEnvelopes(safeEnvelopes);
2832
3214
  const logo = isLogoDataUri(options.logo) ? `<img class="logo" src="${escapeHtml(options.logo)}" alt="">` : "";
2833
3215
  const accent = isValidAccent(options.accent) ? `<style>:root{--accent:${options.accent}}</style>` : "";
@@ -2847,10 +3229,11 @@ ${csp(hashes)}
2847
3229
  }
2848
3230
 
2849
3231
  // src/index.ts
2850
- var version = "0.1.1";
3232
+ var version = "0.2.0";
2851
3233
  var phase = "development";
2852
3234
  async function generateReport(inputs, options = {}) {
2853
- const envelopes = await loadEnvelopes(inputs);
3235
+ const groups = await loadInputs(inputs);
3236
+ const envelopes = groups.flatMap((group) => group.envelopes);
2854
3237
  const summary = summarizeEnvelopes(envelopes);
2855
3238
  return {
2856
3239
  html: await renderHtml(envelopes, {
@@ -2858,7 +3241,8 @@ async function generateReport(inputs, options = {}) {
2858
3241
  metadata: options.metadata,
2859
3242
  logo: options.logo,
2860
3243
  accent: options.accent,
2861
- summary
3244
+ summary,
3245
+ provenance: groups.length > 1 ? provenanceFor(groups) : void 0
2862
3246
  }),
2863
3247
  summary
2864
3248
  };