All files / src/aggregator/artifacts types.ts

0% Statements 0/0
0% Branches 0/0
0% Functions 0/0
0% Lines 0/0

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 42 43 44 45 46 47 48 49 50 51 52 53                                                                                                         
// SPDX-FileCopyrightText: 2024-2026 Hack23 AB
// SPDX-License-Identifier: Apache-2.0
 
/**
 * @module Aggregator/Artifacts/Types
 * @description Strict type definitions for the artifacts bounded context.
 * Defines the shape of artifact content, section mappings, and sanitization
 * options used throughout the aggregator pipeline.
 */
 
import type { CleanArtifactResult } from '../clean-artifact.js';
 
/**
 * Represents raw artifact content read from an analysis run directory.
 * Carries the original Markdown body along with its provenance metadata.
 */
export interface ArtifactContent {
  /** Run-relative path of the artifact (e.g. `intelligence/synthesis-summary.md`). */
  readonly path: string;
  /** Raw Markdown body as read from disk. */
  readonly body: string;
  /** Byte length of the raw content (before cleaning). */
  readonly byteLength: number;
}
 
/**
 * A {@link CleanArtifactResult} extended with provenance (the run-relative
 * path of the source artifact). Use this type when you need to track which
 * artifact produced a given cleaned output — e.g. for telemetry or
 * source-mapping in `article-meta.json`.
 *
 * `CleanArtifactResult` is the raw return of `cleanArtifact()`;
 * `CleanedArtifactWithPath` adds the origin path for pipeline bookkeeping.
 */
export interface CleanedArtifactWithPath extends CleanArtifactResult {
  /** Run-relative path of the source artifact. */
  readonly path: string;
}
 
/**
 * Represents a fully resolved section in the aggregated article, mapping
 * from the canonical section definition to the actual artifact paths found
 * in the run directory.
 */
export interface ResolvedSection {
  /** Stable section id used for HTML anchors. */
  readonly id: string;
  /** English section title. */
  readonly title: string;
  /** Ordered list of resolved artifact paths present in this section. */
  readonly resolvedArtifacts: readonly string[];
}