Repository navigation
Description
Problem or Motivation
The docs site shows 14 Mermaid blocks on 5 pages as code, not as diagrams. In the repository, 24 of 40 Mermaid blocks use the old graph keyword (10 use flowchart). src/devops_cli/ai/diagram.py writes graph TD and graph LR.
Proposed Solution & Architectural Design
- On the docs site: load the newest mermaid release that the docs site supports (12.3.0 of 2026-11-03 on 2026-11-11; no minimum release age) from jsDelivr with an SRI hash in
docs/_layouts/default.html. Use the themebasewiththemeVariablesthat read the token CSS variables throughgetComputedStyle:backgroundcolor-bg,primaryColorcolor-surface,primaryBorderColorcolor-border-strong,primaryTextColorcolor-fg,lineColorcolor-fg-muted,secondaryColorcolor-bg,tertiaryColorcolor-surface,fontFamilyfont-family-sans,fontSize14px. Draw the diagrams again when the theme changes. Do not use the built-in Mermaid themes. - On github.com: no init directive, no
classDef, nostyleand no hex in a block, because a fixed theme does not follow the GitHub dark mode. GitHub draws its own light and dark themes. - Change
graphtoflowchartin the 24 blocks and inai/diagram.py. Use sentence-case labels, 15 nodes or fewer, and one direction for each diagram. - Add a pre-commit
pygrephook that rejects a Mermaid block that starts withgraph.
Target Subsystem
Documentation (docs/_layouts/default.html, Markdown files) and src/devops_cli/ai/diagram.py.
Existing Tool Considered
Mermaid (MIT) has the base theme with themeVariables as its standard interface. pre-commit pygrep (in use) covers the keyword check. Custom code: about 20 lines of JavaScript for the init and the redraw. Cost (estimate): about 80,000 tokens and 0.5 day.
Acceptance Criteria
- A headless browser check finds 14 rendered SVG diagrams on the 5 pages in both themes, and the node fill equals the
color.surfacetoken. - The hook finds 0
graphheaders. - The
ai/diagram.pytests expectflowchart.
Dependencies
- feat(docs): build the docs site theme from the design tokens #4745 (the token CSS on the docs site and the theme toggle).
Source: #4735
Alternatives check of 2026-11-29: in-use.
The repository already uses this tool.
Tool: zensical/zensical (https://github.com/zensical/zensical), MIT, last activity 2026-11-28, maintained.
Reason: Zensical, the generator the docs site already uses, renders Mermaid fences to SVG and redraws them on a theme change, so it covers the rendering and token-theme part. It does not migrate the 24 graph blocks, change ai/diagram.py, or add the pre-commit hook.
Covers:
- Renders Mermaid fences as SVG on built pages
- Redraws diagrams when the light/dark theme changes
- Takes diagram colors from the theme token CSS variables
- Already builds the docs site, so no new dependency
Lacks:
- No migration of the 24
graphblocks toflowchart - No change to the
graph TD/graph LRoutput ofai/diagram.py - No pre-commit
pygrephook that rejectsgraphheaders - No test asserting node fill equals
color.surface
Proposed design
Problem statement
The docs site shows 14 Mermaid blocks on 5 pages as code, not as diagrams. 24 of 40 Mermaid blocks in the repository use the old graph keyword. src/devops_cli/ai/diagram.py writes graph TD and graph LR. The change uses Zensical Mermaid support, migrates graph to flowchart, and adds a pre-commit check.
Acceptance criteria
Requirement: Docs site renders Mermaid diagrams
The docs site SHALL render each Mermaid code block as an SVG diagram in the light theme and in the dark theme.
Scenario: Headless browser check of the built docs site
- WHEN
uv run devops docs site buildbuilds the site, and a headless browser loads each of the 5 pages that contain a Mermaid block in the light theme and in the dark theme. - THEN Each Mermaid block is an SVG element, and no Mermaid block remains as text.
Requirement: Diagram node fill follows the surface token
Each Mermaid diagram on the docs site SHALL take its node fill color from the color.surface token CSS variable.
Scenario: Node fill matches the surface token
- WHEN
uv run devops docs site buildbuilds the site, and a headless browser reads the computed fill of a diagram node in the light theme. - THEN The computed fill equals the computed color of the
color.surfaceCSS variable.
Requirement: Mermaid flowchart keyword migration
Every Mermaid flowchart block in tracked Markdown files SHALL start with the flowchart keyword and MUST NOT start with the graph keyword.
Scenario: Repository scan finds no graph headers
- WHEN A test scans all tracked Markdown files for Mermaid block headers.
- THEN The scan finds 0 Mermaid block headers that start with
graph.
Requirement: Diagram generator emits flowchart
src/devops_cli/ai/diagram.py SHALL generate Mermaid code that starts with flowchart TD for the architecture diagram and flowchart LR for the threat diagram.
Scenario: Generator tests assert flowchart headers
- WHEN The tests call
generate_architecture_diagramandgenerate_threat_diagram. - THEN Each returned
mermaid_codestarts with the expectedflowchartheader and contains nographheader.
Requirement: Pre-commit hook rejects graph headers
The pre-commit configuration SHALL reject a Mermaid block whose first line starts with graph.
Scenario: Hook rejects a graph block
- WHEN A test adds a temporary Markdown file with a Mermaid block that starts with
graph TDand runsuv run pre-commit run pygrep-mermaid-graph --files <file>. - THEN The command exits with a nonzero status and names the offending file.
Existing Tool Considered
Zensical (zensical/zensical, MIT, maintained) has the in-use verdict in the Alternatives check of 2026-11-23 in the issue body. The check lists what Zensical covers and lacks. The proposal adds the keyword migration in the 24 Markdown blocks and src/devops_cli/ai/diagram.py, and the pre-commit pygrep hook, which the check lists as lacks.
Key questions
- Which tool renders Mermaid diagrams on the docs site?: Use Zensical's built-in Mermaid fence. The Alternatives check of 2026-11-23 gives the in-use verdict for zensical/zensical. The proposal uses Zensical and adds the migration and hook. (best practice) [sources: docs/DESIGN.md:255]
- Chosen: Zensical built-in Mermaid support. It is already in use. It renders the fences and redraws on a theme change. It reads the CSS variables.
- Rejected: jsDelivr load with a custom init and redraw script. It duplicates Zensical. It needs an SRI pin. It adds code to keep and fix.
- Rejected: Mermaid built-in themes. A fixed theme does not follow the token CSS variables or the GitHub dark mode.
- Should diagram colors come from CSS variables or from Mermaid themeVariables in JavaScript?: Use the token CSS variables through the Zensical theme. Do not set
themeVariablesin JavaScript. (best practice) [sources: docs/DESIGN.md:255]- Chosen: Token CSS variables through the Zensical theme. The theme toggle updates the variables. Zensical redraws the diagrams. The colors follow both themes.
- Rejected: Mermaid
themeVariablesin JavaScript. It adds a custom init script. It does not follow the theme CSS variables directly. - Rejected: Mermaid built-in themes. A fixed theme does not follow the docs site tokens.
- Which Mermaid keyword should the repository use?: Use
flowchartin all flowchart diagrams. Change the 24graphblocks andsrc/devops_cli/ai/diagram.pytoflowchart. (best practice) [sources: docs/DESIGN.md:255, ARCHITECTURE.md:12, src/devops_cli/ai/diagram.py]- Chosen:
flowchart. The project design rule usesflowchart. It is the current Mermaid keyword. The hook can rejectgraph. - Rejected:
graph. It is the old keyword. 24 blocks still use it. The hook rejects it.
- Chosen:
- How should the repository reject a Mermaid block that starts with
graph?: Use the pre-commitpygrephook that the repository already uses. Add a hook with idpygrep-mermaid-graph. Use a multiline pattern that matches amermaidfence followed bygraph. (best practice) [sources: docs/DESIGN.md:255]- Chosen: pre-commit
pygrephook. The repository already uses pre-commitpygrep. It needs no custom script. - Rejected: custom Python script. It adds code to build, keep, and fix.
- Rejected: no hook. The migrated blocks can regress to
graph.
- Chosen: pre-commit
Fit
Fits in one pull request.
Suspected block
None.
Activity
dan-petty commentedon Nov 11, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
featprefix of the title gives the type.(docs)scope of the title gives the scope.It improves the docs reading experience but does not block a release or fix a defect.Users see rendered diagrams instead of raw code, which makes the docs easier to follow.It needs JavaScript init, CSS token wiring, 24 block edits, a Python file change, and a pre-commit hook.Both items work on Mermaid blocks in the docs, but #227 adds a lint and validation CLI while the candidate renders the diagrams and migrates the keyword.dan-petty commentedon Nov 11, 2026
Owner direction of 2026-11-11:
New rule: no minimum release age for dependencies, images, charts or tools. Pin the newest release that fixes the known security and bug issues and that the surrounding tools support (the tests pass).
Body changes: the docs site loads the newest mermaid release that it supports, 12.3.0 (2026-11-03) on 2026-11-11, not 12.2.0.
dan-petty commentedon Nov 12, 2026
Scope change from tracker #5151 (2026-11-12).
#5152 moves the docs site to Zensical 0.1.1 with the Mermaid custom fence of
pymdownx.superfences. Zensical loads Mermaid itself, draws the diagrams again on a theme change, and takes the fonts and colors from the theme CSS variables. A trial build of 2026-11-12 drew the Mermaid blocks on 6 pages with no extra script. When #5152 merges first, this item changes as follows:docs/_layouts/default.html(the file goes away) and the custom init and redraw script.themeVariablesin JavaScript.graphtoflowchartin the 24 blocks and insrc/devops_cli/ai/diagram.py, the label rules, and the pre-commitpygrephook.devops-cli-service commentedon Nov 14, 2026
Alternatives check: in-use
Reason: The searches found Zensical (zensical/zensical, MIT, maintained), whose built-in Mermaid support through the pymdownx.superfences custom fence initializes Mermaid automatically, redraws diagrams on a theme change and takes the fonts and colors from the theme CSS variables — exactly the docs-site rendering that this issue plans to build with a jsDelivr load and ~20 lines of custom init/redraw JavaScript (the reply says that load and script are dropped). It does not do the rest of the issue: the
graph→flowchartmigration in the 24 blocks andai/diagram.py, or the pre-commitpygrephook, so it covers only a part.The repository already uses this tool.
Tool: zensical/zensical (https://github.com/zensical/zensical)
Covers:
Lacks:
graphtoflowchartin the 24 blocks or insrc/devops_cli/ai/diagram.pypygrephook that rejects a Mermaid block starting withgraphTools considered:
Searches run:
Sources:
Checked on 2026-11-14. A person decides what this means for the item. The check changes no label and closes no issue.
devops-cli-service commentedon Nov 15, 2026
Refine cannot set this item to Ready at e5dfddb while the items below stay open. The next refine round looks at the item again when they close, or when a person replies in a comment or edits the body.
devops-cli-service commentedon Nov 26, 2026
Next step: the open items close, or a person replies in a comment or edits the body. See Dependencies in the section Proposed design of the body.