All files / src/aggregator artifact-order.ts

100% Statements 7/7
100% Branches 0/0
100% Functions 0/0
100% Lines 7/7

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 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182                                                                            2x                                                                                                                                                                                                                                                   2x     2x         2x     2x           2x     2x  
// SPDX-FileCopyrightText: 2024-2026 Hack23 AB
// SPDX-License-Identifier: Apache-2.0
 
/**
 * @module Aggregator/ArtifactOrder
 * @description Canonical ordering of analysis artifacts in the aggregated
 * article markdown. The order reads like an intelligence product:
 * boardroom summary → facts → forces → assessment → scenarios → self-audit.
 *
 * Every entry lists the artifact paths (relative to the analysis run dir)
 * that belong in that section, in priority order. Missing artifacts are
 * silently skipped. Artifacts that match no section go to the
 * "Supplementary intelligence" bucket so nothing is ever dropped.
 */
 
/** One section in the aggregated document. */
export interface ArtifactSection {
  /** Stable id used for HTML anchors (lowercase-kebab). */
  readonly id: string;
  /** English section title (other languages come from translated MD). */
  readonly title: string;
  /**
   * Ordered list of artifact paths relative to the run dir. May contain
   * either exact file paths (e.g. `intelligence/synthesis-summary.md`) or
   * directory prefixes ending with `/` (e.g. `threat-assessment/`) to
   * include every remaining `.md` under that folder in lexical order.
   */
  readonly artifacts: readonly string[];
}
 
/**
 * Canonical ordering. Order matches the plan:
 *  1. Executive brief   2. Synthesis   3. Significance   4. Actors & forces
 *  5. Coalitions        6. Stakeholders 7. PESTLE         8. Economic
 *  9. Risk             10. Threat      11. Scenarios     12. Continuity
 * 13. Deep analysis     14. Documents   15. Extended      16. MCP audit
 * 17. Quality & reflection.
 */
export const ARTIFACT_SECTIONS: readonly ArtifactSection[] = [
  {
    id: 'executive-brief',
    title: 'Executive Brief',
    artifacts: ['extended/executive-brief.md'],
  },
  {
    id: 'synthesis',
    title: 'Synthesis Summary',
    artifacts: ['intelligence/synthesis-summary.md'],
  },
  {
    id: 'significance',
    title: 'Significance',
    artifacts: [
      'classification/significance-classification.md',
      'intelligence/significance-scoring.md',
    ],
  },
  {
    id: 'actors-forces',
    title: 'Actors & Forces',
    artifacts: [
      'classification/actor-mapping.md',
      'classification/forces-analysis.md',
      'classification/impact-matrix.md',
    ],
  },
  {
    id: 'coalitions-voting',
    title: 'Coalitions & Voting',
    artifacts: [
      'intelligence/coalition-dynamics.md',
      'intelligence/voting-patterns.md',
      'existing/voting-patterns.md',
    ],
  },
  {
    id: 'stakeholder-map',
    title: 'Stakeholder Map',
    artifacts: ['intelligence/stakeholder-map.md', 'existing/stakeholder-impact.md'],
  },
  {
    id: 'pestle-context',
    title: 'PESTLE & Context',
    artifacts: ['intelligence/pestle-analysis.md', 'intelligence/historical-baseline.md'],
  },
  {
    id: 'economic-context',
    title: 'Economic Context',
    artifacts: ['intelligence/economic-context.md'],
  },
  {
    id: 'risk',
    title: 'Risk Assessment',
    artifacts: [
      'risk-scoring/risk-matrix.md',
      'risk-scoring/quantitative-swot.md',
      'risk-scoring/political-capital-risk.md',
      'risk-scoring/legislative-velocity-risk.md',
    ],
  },
  {
    id: 'threat',
    title: 'Threat Landscape',
    artifacts: [
      'intelligence/political-threat-landscape.md',
      'intelligence/threat-model.md',
      'threat-assessment/',
    ],
  },
  {
    id: 'scenarios',
    title: 'Scenarios & Wildcards',
    artifacts: ['intelligence/scenario-forecast.md', 'intelligence/wildcards-blackswans.md'],
  },
  {
    id: 'continuity',
    title: 'Cross-Run Continuity',
    artifacts: [
      'intelligence/cross-run-diff.md',
      'existing/cross-session-intelligence.md',
      'intelligence/cross-session-intelligence.md',
      'existing/session-baseline.md',
    ],
  },
  {
    id: 'deep-analysis',
    title: 'Deep Analysis',
    artifacts: ['existing/deep-analysis.md'],
  },
  {
    id: 'documents',
    title: 'Document Analysis',
    artifacts: [
      'documents/document-analysis-index.md',
      'documents/',
      'existing/per-file-political-intelligence.md',
    ],
  },
  {
    id: 'extended-intel',
    title: 'Extended Intelligence',
    artifacts: ['extended/'],
  },
  {
    id: 'mcp-reliability',
    title: 'MCP Reliability Audit',
    artifacts: ['intelligence/mcp-reliability-audit.md'],
  },
  {
    id: 'quality-reflection',
    title: 'Analytical Quality & Reflection',
    artifacts: [
      'intelligence/reference-analysis-quality.md',
      'intelligence/workflow-audit.md',
      'intelligence/methodology-reflection.md',
    ],
  },
];
 
/** Id of the catch-all bucket for artifacts not matched by any section. */
export const SUPPLEMENTARY_SECTION_ID = 'supplementary-intelligence';
 
/** Display title for the catch-all bucket. */
export const SUPPLEMENTARY_SECTION_TITLE = 'Supplementary Intelligence';
 
/** Id of the tradecraft references appendix. Prefixed with `aggregator-`
 * to avoid id collisions with artifact headings that happen to slug to
 * `tradecraft-references`. */
export const TRADECRAFT_SECTION_ID = 'aggregator-tradecraft-references';
 
/** Display title for the tradecraft references appendix. */
export const TRADECRAFT_SECTION_TITLE = 'Tradecraft References';
 
/** Id of the analysis index / manifest appendix. Prefixed with `aggregator-`
 * to avoid id collisions with artifact headings (e.g. an artifact literally
 * named `analysis-index.md` that contains its own `### Analysis Index`
 * heading, which markdown-it-anchor would slug to the same id). */
export const MANIFEST_SECTION_ID = 'aggregator-analysis-index';
 
/** Display title for the analysis index / manifest appendix. */
export const MANIFEST_SECTION_TITLE = 'Analysis Index';