Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | 58x 248x 248x 58x | // SPDX-FileCopyrightText: 2024-2026 Hack23 AB
// SPDX-License-Identifier: Apache-2.0
/**
* @module Aggregator/Run/AnalysisIndex
* @description Renders the analysis-index appendix listing every artifact
* that contributed to the aggregated document.
*/
import { MANIFEST_SECTION_ID, MANIFEST_SECTION_TITLE } from '../artifact-order.js';
import { githubBlobUrl } from '../clean-artifact.js';
import type { IncludedArtifact } from '../reader-guide-constants.js';
/**
* Render the analysis-index appendix — a compact table of every included
* artifact and its section, plus a direct link to the manifest.
*
* @param included - Artifacts that contributed to the aggregated document
* @param manifestRelPath - Repo-relative path of `manifest.json`
* @returns Markdown block with the index table
*/
export function renderAnalysisIndex(
included: readonly IncludedArtifact[],
manifestRelPath: string
): string {
const rows = included.map((a) => {
const stem = a.runRelPath.split('/').pop()?.replace(/\.md$/i, '') ?? a.runRelPath;
return `| ${a.sectionId} | [${stem}](${githubBlobUrl(a.repoRelPath)}) | \`${a.runRelPath}\` |`;
});
return [
`<h2 id="${MANIFEST_SECTION_ID}">${MANIFEST_SECTION_TITLE}</h2>`,
'',
`Every artifact below was read by the aggregator and contributed to this article. The raw [manifest.json](${githubBlobUrl(manifestRelPath)}) carries the full machine-readable list, including gate-result history.`,
'',
'| Section | Artifact | Path |',
'|---|---|---|',
...rows,
'',
].join('\n');
}
|