Skip to content

Color-coded Mermaid for analysis templates + complete Article-Generation.md template map#2189

Merged
pethers merged 6 commits intomainfrom
copilot/improve-mermaid-templates-ui-ux
May 2, 2026
Merged

Color-coded Mermaid for analysis templates + complete Article-Generation.md template map#2189
pethers merged 6 commits intomainfrom
copilot/improve-mermaid-templates-ui-ux

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 2, 2026

Plan

  • Add color-coded Mermaid diagrams to cycle-trajectory.md, horizon-pir-rollforward.md, parliamentary-season.md
  • Document Mermaid colour-coding standard in analysis/templates/README.md
  • Rewrite Article-Generation.md template-to-artifact map to match AGGREGATION_ORDER
  • Review fix: Replace fake --primary-blue etc. CSS token names with hex + semantic role descriptions (README.md)
  • Review fix: Add election-2026-implications.md to the Election alias row (Article-Generation.md)
  • Review fix: Escape < 95 % and < 60 % as below 95 % / below 60 % in Mermaid node labels to avoid HTML parsing breakage (parliamentary-season.md)
  • Review fix: Replace non-canonical #90CAF9 with #FFBE0B in the watchlist diagram lineColor and classDef stroke (parliamentary-season.md)
  • Review fix: Update render-chain reference from deleted scripts/render-lib/markdown.ts to current scripts/render-lib/markdown/mermaid-preprocess.ts + pipeline.ts (README.md)
  • Review fix (round 2): Add secondaryColor/tertiaryColor to parliamentary-season.md init prologue to match canonical standard
  • Review fix (round 2): Fix PIR colour legend — cycle-spanning PIR uses teal #00897B, not blue
  • Review fix (round 2): Tighten gate Check 5 description to match actual GATE_SYNTH_LIST enforcement scope
  • Review fix (round 2): Correct op-template docs to reflect actual aggregator behavior (they ARE included alphabetically after core slots)
  • Review fix (round 3): Clarify phase ribbon shows structural pattern, not current phase — analyst adds :::current at runtime
  • Review fix (round 3): Fix classDef/gate wording: gate passes via themeVariables/%%{init}, not style regex
  • Review fix (round 3): Fix "29 core slots" → "31 entries including alias variants that collapse to 29 logical sections"
  • Review fix (round 3): Add note about stakeholder-impact.md → stakeholder-perspectives.md filename discrepancy

…md template-to-artifact map is complete

Agent-Logs-Url: https://github.com/Hack23/riksdagsmonitor/sessions/caca85e2-f64c-4c39-a40c-24f1a75c8546

Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
@pethers pethers marked this pull request as ready for review May 2, 2026 13:35
Copilot AI review requested due to automatic review settings May 2, 2026 13:35
@github-actions github-actions Bot added documentation Documentation updates size-m Medium change (50-250 lines) labels May 2, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 2, 2026

🏷️ Automatic Labeling Summary

This PR has been automatically labeled based on the files changed and PR metadata.

Applied Labels: documentation,size-m

Label Categories

  • 🗳️ Content: news, dashboard, visualization, intelligence
  • 💻 Technology: html-css, javascript, workflow, security
  • 📊 Data: cia-data, riksdag-data, data-pipeline, schema
  • 🌍 I18n: i18n, translation, rtl
  • 🔒 ISMS: isms, iso-27001, nist-csf, cis-controls
  • 🏗️ Infrastructure: ci-cd, deployment, performance, monitoring
  • 🔄 Quality: testing, accessibility, documentation, refactor
  • 🤖 AI: agent, skill, agentic-workflow

For more information, see .github/labeler.yml.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 2, 2026

🔍 Lighthouse Performance Audit

Category Score Status
Performance 85/100 🟡
Accessibility 95/100 🟢
Best Practices 90/100 🟢
SEO 95/100 🟢

📥 Download full Lighthouse report

Budget Compliance: Performance budgets enforced via budget.json

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 2, 2026

🔍 Lighthouse Performance Audit

Category Score Status
Performance 85/100 🟡
Accessibility 95/100 🟢
Best Practices 90/100 🟢
SEO 95/100 🟢

📥 Download full Lighthouse report

Budget Compliance: Performance budgets enforced via budget.json

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR standardizes and expands Mermaid usage across long-horizon analysis templates and updates documentation so template/artifact ordering matches the aggregator’s canonical narrative sequence.

Changes:

  • Added new Mermaid diagrams to three long-horizon templates (cycle-trajectory.md, horizon-pir-rollforward.md, parliamentary-season.md).
  • Documented a “Mermaid colour-coding standard” in analysis/templates/README.md, including a canonical init prologue and palette guidance.
  • Rewrote Article-Generation.md’s template-to-artifact mapping table into an ordered, aggregator-aligned slot list, including operational supplementary templates.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
analysis/templates/parliamentary-season.md Adds “Riksmöte phase ribbon” and “Watchlist heat-map” Mermaid diagrams.
analysis/templates/horizon-pir-rollforward.md Adds a PIR genealogy Mermaid graph and colour-coding explanation.
analysis/templates/cycle-trajectory.md Adds a T+1y→T+5y trajectory-band Mermaid visual and colour semantics.
analysis/templates/README.md Documents the Mermaid colour-coding standard, palette, and render chain.
Article-Generation.md Replaces the old partial template map with an ordered, “exhaustive” aggregator-slot table plus supplementary templates.

Comment thread analysis/templates/README.md Outdated
Comment on lines +954 to +966
The analysis gate ([`05-analysis-gate.md` Check 5](../../.github/prompts/05-analysis-gate.md)) blocks any Family A or Family D synthesis file whose Mermaid blocks lack a `style` directive **or** a `themeVariables` / `%%{init …}` block. To keep colour semantics consistent across the 35 templates that already render Mermaid (and the 3 long-horizon templates that just received their first diagram — `cycle-trajectory.md`, `horizon-pir-rollforward.md`, `parliamentary-season.md`) every diagram MUST follow the palette below — derived from the cyberpunk article-chrome tokens documented in [`Article-Generation.md` §"Light and dark mode"](../../Article-Generation.md#light-and-dark-mode).

| Hex | Token / role | Colour use |
|---|---|---|
| `#1565C0` | `--primary-blue` | Structural / process / data-source nodes (BLUF anchor, ingest, predecessor run) |
| `#2E7D32` | `--success-green` | Strengths · opportunities · "active" · low-risk indicators |
| `#FF9800` | `--warning-orange` | Watch items · medium severity · mid-mandate years |
| `#D32F2F` | `--danger-red` | Threats · weaknesses · falsification triggers · high severity |
| `#7B1FA2` | `--strategic-purple` | Synthesis · scenarios · long-horizon projections |
| `#00897B` | `--data-teal` | Data products · cycle-spanning PIRs · IMF / SCB feeds |
| `#FFBE0B` | `--primary-yellow` | Edges, accents, stroke highlights, "this run" anchor |
| `#FF006E` | `--primary-magenta` | New PIRs, emphasis, election-anchor pivots |
| `#616161` | `--neutral-grey` | Archived / deprecated / pending nodes |
Comment thread Article-Generation.md Outdated
| 10 | Strategic | [`swot-analysis.md`](analysis/templates/swot-analysis.md) | Evidence-bound SWOT quadrant + TOWS moves (Mermaid quadrantChart). |
| 11 | Threat | [`threat-analysis.md`](analysis/templates/threat-analysis.md) | Political Threat Taxonomy + attack-tree Mermaid diagrams. |
| — | Per-document | [`per-file-political-intelligence.md`](analysis/templates/per-file-political-intelligence.md) → `documents/{dok_id}-analysis.md` | One subsection per primary-source document; required to cite the dok_id. |
| 12 | Election | [`election-2026-analysis.md`](analysis/templates/election-2026-analysis.md) / [`election-cycle-analysis.md`](analysis/templates/election-cycle-analysis.md) | Seat deltas, campaign implications; alias-deduplicated by `FILENAME_ALIASES`. |
Comment on lines +167 to +174
Q3["Coalition cohesion<br/>< 95 %"]:::high
end
subgraph YEAR["📅 Year horizon (≤ 365 d)"]
Y1["Lagrådet kritik rate<br/>> 35 %"]:::med
Y2["IMF WEO vintage drift<br/>> 0.3 pp"]:::low
end
subgraph CYCLE["🗳️ Cycle horizon (≤ 1460 d)"]
C1["Mandate fulfilment<br/>< 60 %"]:::high
Y2["IMF WEO vintage drift<br/>> 0.3 pp"]:::low
end
subgraph CYCLE["🗳️ Cycle horizon (≤ 1460 d)"]
C1["Mandate fulfilment<br/>< 60 %"]:::high
Comment on lines +161 to +163
```mermaid
%%{init: {"theme":"dark","themeVariables":{"primaryColor":"#1565C0","primaryTextColor":"#ffffff","lineColor":"#90CAF9","fontFamily":"Inter, Helvetica, Arial, sans-serif"}}}%%
flowchart TB
Comment thread analysis/templates/README.md Outdated
| `sequenceDiagram` | Coalition negotiations, KU referral cycles | `political-stride-assessment.md` |
| `mindmap` | PESTLE / stakeholder fan-outs | `pestle-analysis.md`, `stakeholder-impact.md` |

Mermaid renders **client-side** in the article HTML — the aggregator passes ` ```mermaid ` fences through untouched and `scripts/render-lib/markdown.ts` rewrites them to `<pre class="mermaid">` before the unified pipeline runs. `js/lib/mermaid-init.mjs` then upgrades each block to SVG after page load against the same-origin vendored runtime under `js/lib/mermaid/`. The full HTML rendering chain is documented in [`Article-Generation.md` §"Mermaid support"](../../Article-Generation.md#mermaid-support).
@pethers
Copy link
Copy Markdown
Member

pethers commented May 2, 2026

@copilot apply changes based on the comments in this thread

…iance, correct render-chain refs, add election-2026-implications alias

Agent-Logs-Url: https://github.com/Hack23/riksdagsmonitor/sessions/93aa8d9b-bbf5-4a79-90c2-02c1fe01ef70

Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 2, 2026

@copilot apply changes based on the comments in this thread

All 6 review comments addressed in 1fe3d6d:

  1. Token names — Replaced fake CSS custom property names (--primary-blue etc.) with hex + semantic role descriptions.
  2. Election alias — Added election-2026-implications.md to the Election row.
  3. HTML escaping — Rephrased < 95 % / < 60 % as below 95 % / below 60 % to avoid Mermaid HTML-label parsing issues.
  4. Canonical palette — Replaced non-canonical #90CAF9 with #FFBE0B in both lineColor and classDef low stroke.
  5. Render-chain ref — Updated from deleted scripts/render-lib/markdown.ts to current scripts/render-lib/markdown/mermaid-preprocess.ts + pipeline.ts.

Copilot finished work on behalf of pethers May 2, 2026 14:04
Copilot AI requested a review from pethers May 2, 2026 14:04
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 2, 2026

🔍 Lighthouse Performance Audit

Category Score Status
Performance 85/100 🟡
Accessibility 95/100 🟢
Best Practices 90/100 🟢
SEO 95/100 🟢

📥 Download full Lighthouse report

Budget Compliance: Performance budgets enforced via budget.json

@pethers pethers requested a review from Copilot May 2, 2026 14:08
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 2, 2026

🔍 Lighthouse Performance Audit

Category Score Status
Performance 85/100 🟡
Accessibility 95/100 🟢
Best Practices 90/100 🟢
SEO 95/100 🟢

📥 Download full Lighthouse report

Budget Compliance: Performance budgets enforced via budget.json

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

### Watchlist heat-map

```mermaid
%%{init: {"theme":"dark","themeVariables":{"primaryColor":"#1565C0","primaryTextColor":"#ffffff","lineColor":"#FFBE0B","fontFamily":"Inter, Helvetica, Arial, sans-serif"}}}%%
Comment on lines +119 to +120
Colour coding: 🟦 predecessor run · 🟣 this run · 🟢 active inherited PIR · 🟦-dashed cycle-spanning PIR (`inheritsCycle: true`) · 🟡 newly-created PIR · ⚫ archived PIR. Solid edges encode PIR provenance; dotted edges encode supersession (`PIR-X → PIR-X+1`). The graph must contain at least one node per row of the genealogy table above.

Comment thread analysis/templates/README.md Outdated

### 🎨 Mermaid colour-coding standard (canonical)

The analysis gate ([`05-analysis-gate.md` Check 5](../../.github/prompts/05-analysis-gate.md)) blocks any Family A or Family D synthesis file whose Mermaid blocks lack a `style` directive **or** a `themeVariables` / `%%{init …}` block. To keep colour semantics consistent across the 35 templates that already render Mermaid (and the 3 long-horizon templates that just received their first diagram — `cycle-trajectory.md`, `horizon-pir-rollforward.md`, `parliamentary-season.md`) every diagram MUST follow the palette below — derived from the cyberpunk article-chrome tokens documented in [`Article-Generation.md` §"Light and dark mode"](../../Article-Generation.md#light-and-dark-mode).
Comment thread Article-Generation.md Outdated
Comment on lines +409 to +417
| op | Run navigator | [`analysis-index.md`](analysis/templates/analysis-index.md) | Read-me-first run index; not aggregated into the article body but linked from the Reader Intelligence Guide. |
| op | Same-type baseline | [`session-baseline.md`](analysis/templates/session-baseline.md) | 30-day baseline for pattern recognition (operational supplementary). |
| op | Day-over-day | [`cross-run-diff.md`](analysis/templates/cross-run-diff.md) | Same-type delta (gate-required when `ANALYSIS_RUN_COUNT ≥ 2`). |
| op | Cross-session | [`cross-session-intelligence.md`](analysis/templates/cross-session-intelligence.md) | Week / month / quarter aggregation across Riksdag sessions. |
| op | MCP health | [`mcp-reliability-audit.md`](analysis/templates/mcp-reliability-audit.md) | MCP tool reliability snapshot (operational supplementary). |
| op | Threshold audit | [`reference-analysis-quality.md`](analysis/templates/reference-analysis-quality.md) | Threshold audit against `reference-quality-thresholds.json`. |
| op | Workflow audit | [`workflow-audit.md`](analysis/templates/workflow-audit.md) | End-to-end run audit: timing, cost, gate outcomes. |

Templates **not** mapped to a slot — `analysis/templates/README.md` is the templates-directory index; `election-cycle-analysis.md` is a filename alias of `election-2026-analysis.md` (de-duplicated at render time by `FILENAME_ALIASES`). Anything else not in `AGGREGATION_ORDER` is appended after the core sections in alphabetical order.
@pethers
Copy link
Copy Markdown
Member

pethers commented May 2, 2026

@copilot apply changes based on the comments in this thread

…our, tighten gate Check 5 wording, correct op-template aggregation docs

Agent-Logs-Url: https://github.com/Hack23/riksdagsmonitor/sessions/2fbf9a53-9fbc-41fd-a277-0907b35536c5

Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 2, 2026

@copilot apply changes based on the comments in this thread

All 4 review comments addressed in caa12c5:

  1. Canonical init prologue — Added secondaryColor/tertiaryColor to parliamentary-season.md to match the full canonical standard.
  2. PIR legend colour — Changed "🟦-dashed" to "🟢-dashed cycle-spanning PIR (teal #00897B)" matching the actual classDef cycle fill:#00897B.
  3. Gate Check 5 wording — Replaced "Family A or Family D" with precise description: iterates GATE_SYNTH_LIST (16 core synthesis files), checks once per file for presence of Mermaid block + colour config.
  4. Op-template aggregation — Corrected documentation to reflect that operational templates ARE included in the rendered article (alphabetically after core slots), not excluded.

Copilot finished work on behalf of pethers May 2, 2026 14:26
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 2, 2026

🔍 Lighthouse Performance Audit

Category Score Status
Performance 85/100 🟡
Accessibility 95/100 🟢
Best Practices 90/100 🟢
SEO 95/100 🟢

📥 Download full Lighthouse report

Budget Compliance: Performance budgets enforced via budget.json

@pethers pethers requested a review from Copilot May 2, 2026 16:38
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Comment on lines +57 to +61
H["🍂 Höstsession<br/>Sep → mid-Dec<br/>BP tabling · budget vote"]:::active
JR["🎄 Juluppehåll<br/>mid-Dec → mid-Jan<br/>KU filings only"]:::recess
V["🌱 Vårsession<br/>mid-Jan → mid-Jun<br/>VP · partiledardebatt"]:::active
SR["☀️ Sommaruppehåll<br/>mid-Jun → late-Aug<br/>Almedalen · KU report"]:::recess
H --> JR --> V --> SR --> H
Comment thread analysis/templates/README.md Outdated
%%{init: {"theme":"dark","themeVariables":{"primaryColor":"#1565C0","primaryTextColor":"#ffffff","lineColor":"#FFBE0B","secondaryColor":"#7B1FA2","tertiaryColor":"#2E7D32","fontFamily":"Inter, Helvetica, Arial, sans-serif"}}}%%
```

For multi-state diagrams (flowchart / state / sequence), prefer `classDef` blocks over per-node `style` directives so colour semantics stay consistent across the diagram and the validator's `style …` regex still matches:
Comment thread Article-Generation.md Outdated
| op | Threshold audit | [`reference-analysis-quality.md`](analysis/templates/reference-analysis-quality.md) | Threshold audit against `reference-quality-thresholds.json` (aggregated alphabetically after core slots). |
| op | Workflow audit | [`workflow-audit.md`](analysis/templates/workflow-audit.md) | End-to-end run audit: timing, cost, gate outcomes (aggregated alphabetically after core slots). |

> **Aggregation behavior for "op" templates:** The aggregator (step 4 in `aggregate.ts`) appends *any* remaining `*.md` file — excluding `README.md` and `article*.md` — in alphabetical order after the 29 core `AGGREGATION_ORDER` slots. This means operational templates listed above **will appear** in the rendered article if they exist in the analysis folder. They sit after the core narrative but before the Sources appendix. `analysis/templates/README.md` is the templates-directory index and is excluded by the `README.md` filter; `election-cycle-analysis.md` is a filename alias of `election-2026-analysis.md` (de-duplicated at render time by `FILENAME_ALIASES`).
Comment thread Article-Generation.md Outdated
| 3 | Key Judgments | [`intelligence-assessment.md`](analysis/templates/intelligence-assessment.md) | Provides ≥ 3 Key Judgments + PIRs + confidence labels (ICD 203). |
| 4 | Ranking | [`significance-scoring.md`](analysis/templates/significance-scoring.md) | DIW scoring + sensitivity analysis with evidence-tagged rows and ranked Mermaid bar chart. |
| 5 | Narrative contestation | [`media-framing-analysis.md`](analysis/templates/media-framing-analysis.md) | DISARM TTPs · CIB ABCDE · narrative-laundering chain · Outlet Bias Audit · L1–L5 counter-resilience ladder. |
| 6 | Stakeholders | [`stakeholder-impact.md`](analysis/templates/stakeholder-impact.md) → `stakeholder-perspectives.md` | Power × interest × position lens, named actors and influence network. |
@pethers
Copy link
Copy Markdown
Member

pethers commented May 2, 2026

@copilot apply changes based on the comments in this thread

…ng, AGGREGATION_ORDER count, stakeholder filename note

Agent-Logs-Url: https://github.com/Hack23/riksdagsmonitor/sessions/5755fbd0-3b6a-4df6-9ee9-e9224442f602

Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 2, 2026

@copilot apply changes based on the comments in this thread

All 4 review comments addressed in f8fe924:

  1. Phase ribbon — Clarified that the diagram shows structural alternation (session vs recess), not the current phase; analyst adds :::current override at runtime.
  2. classDef vs gate — Fixed wording: gate's colour-config check passes via the themeVariables/%%{init} prologue, not the style … regex.
  3. AGGREGATION_ORDER count — Changed "29 core slots" to "31 entries including alias variants that collapse to 29 logical sections".
  4. Stakeholder filename — Added explicit note that the template instructs stakeholder-impact.md but aggregator + gate require stakeholder-perspectives.md.

Copilot finished work on behalf of pethers May 2, 2026 16:56
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 2, 2026

🔍 Lighthouse Performance Audit

Category Score Status
Performance 85/100 🟡
Accessibility 95/100 🟢
Best Practices 90/100 🟢
SEO 95/100 🟢

📥 Download full Lighthouse report

Budget Compliance: Performance budgets enforced via budget.json

@pethers pethers merged commit 4f0db11 into main May 2, 2026
12 checks passed
@pethers pethers deleted the copilot/improve-mermaid-templates-ui-ux branch May 2, 2026 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Documentation updates size-m Medium change (50-250 lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants