@danmoisan/drm-copilot-mcp 1.0.24 → 1.0.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/out/mcp-server.js +1045 -214
  2. package/package.json +1 -1
  3. package/resources/claude-customizations/.claude/agents/feature-review.md +5 -3
  4. package/resources/claude-customizations/.claude/agents/parallel-orchestrator.md +11 -4
  5. package/resources/claude-customizations/.claude/agents/parallel-planner.md +5 -2
  6. package/resources/claude-customizations/.claude/hooks/enforce-discovery-artifact-gate.ps1 +28 -8
  7. package/resources/claude-customizations/.claude/hooks/enforce-epic-merge-gate.ps1 +109 -5
  8. package/resources/claude-customizations/.claude/hooks/enforce-mermaid-validation.ps1 +390 -0
  9. package/resources/claude-customizations/.claude/hooks/validate-discovery-artifact-gate.ps1 +28 -8
  10. package/resources/claude-customizations/.claude/hooks/validate-orchestrator-output.ps1 +117 -46
  11. package/resources/claude-customizations/.claude/lib/bash/parallel-manifest-validate.sh +115 -3
  12. package/resources/claude-customizations/.claude/lib/blast-radius/BlastRadius.psm1 +105 -2
  13. package/resources/claude-customizations/.claude/lib/blast-radius/BlastRadiusConfig.psm1 +32 -52
  14. package/resources/claude-customizations/.claude/lib/blast-radius/BlastRadiusExtraction.psm1 +107 -99
  15. package/resources/claude-customizations/.claude/lib/blast-radius/BlastRadiusNormalization.psm1 +295 -0
  16. package/resources/claude-customizations/.claude/lib/blast-radius/BlastRadiusValidation.psm1 +9 -3
  17. package/resources/claude-customizations/.claude/lib/codex-routing/CodexDeployment.psm1 +312 -0
  18. package/resources/claude-customizations/.claude/lib/codex-routing/CodexTopology.psm1 +392 -0
  19. package/resources/claude-customizations/.claude/lib/discovery-validation/DiscoveryValidation.psm1 +500 -0
  20. package/resources/claude-customizations/.claude/lib/mermaid/MermaidGrammar.psm1 +491 -0
  21. package/resources/claude-customizations/.claude/lib/mermaid/MermaidLineScanner.psm1 +488 -0
  22. package/resources/claude-customizations/.claude/lib/mermaid/MermaidMarkdownFences.psm1 +298 -0
  23. package/resources/claude-customizations/.claude/lib/mermaid/MermaidValidation.psm1 +496 -0
  24. package/resources/claude-customizations/.claude/lib/orchestrator-state/OrchestratorState.psm1 +58 -67
  25. package/resources/claude-customizations/.claude/lib/orchestrator-state/OrchestratorStateCheckpointValue.psm1 +383 -0
  26. package/resources/claude-customizations/.claude/lib/orchestrator-state/OrchestratorStateCodexModelReceipts.psm1 +297 -0
  27. package/resources/claude-customizations/.claude/lib/orchestrator-state/OrchestratorStateCodexTopologyReceipts.psm1 +298 -0
  28. package/resources/claude-customizations/.claude/lib/orchestrator-state/OrchestratorStateCompletion.psm1 +232 -43
  29. package/resources/claude-customizations/.claude/lib/orchestrator-state/OrchestratorStateCompletionChecks.psm1 +416 -0
  30. package/resources/claude-customizations/.claude/lib/orchestrator-state/OrchestratorStateModelReceipts.psm1 +366 -0
  31. package/resources/claude-customizations/.claude/lib/orchestrator-state/OrchestratorStateReceipts.psm1 +408 -0
  32. package/resources/claude-customizations/.claude/lib/orchestrator-state/OrchestratorStateRoutingContract.psm1 +428 -0
  33. package/resources/claude-customizations/.claude/lib/orchestrator-state/OrchestratorStateRoutingMatrix.psm1 +377 -0
  34. package/resources/claude-customizations/.claude/lib/orchestrator-state/OrchestratorStateUnconditional.psm1 +166 -0
  35. package/resources/claude-customizations/.claude/rules/general-unit-test.md +1 -1
  36. package/resources/claude-customizations/.claude/rules/mermaid.md +142 -0
  37. package/resources/claude-customizations/.claude/rules/parallel-orchestration.md +88 -3
  38. package/resources/claude-customizations/.claude/rules/plan-acceptance-gates.md +116 -0
  39. package/resources/claude-customizations/.claude/rules/powershell.md +1 -1
  40. package/resources/claude-customizations/.claude/rules/quality-tiers.md +3 -3
  41. package/resources/claude-customizations/.claude/settings.json +5 -0
  42. package/resources/claude-customizations/.claude/skills/atomic-plan-contract/SKILL.md +15 -0
  43. package/resources/claude-customizations/.claude/skills/evidence-and-timestamp-conventions/SKILL.md +13 -0
  44. package/resources/claude-customizations/.claude/skills/feature-promotion-lifecycle/SKILL.md +6 -0
  45. package/resources/claude-customizations/.claude/skills/feature-review-workflow/SKILL.md +4 -4
  46. package/resources/claude-customizations/.claude/skills/mermaid-diagram/SKILL.md +184 -0
  47. package/resources/claude-customizations/.claude/skills/mermaid-diagram/references/c4.md +50 -0
  48. package/resources/claude-customizations/.claude/skills/mermaid-diagram/references/class.md +63 -0
  49. package/resources/claude-customizations/.claude/skills/mermaid-diagram/references/er.md +56 -0
  50. package/resources/claude-customizations/.claude/skills/mermaid-diagram/references/flowchart.md +68 -0
  51. package/resources/claude-customizations/.claude/skills/mermaid-diagram/references/gantt.md +51 -0
  52. package/resources/claude-customizations/.claude/skills/mermaid-diagram/references/other-types.md +82 -0
  53. package/resources/claude-customizations/.claude/skills/mermaid-diagram/references/pie.md +32 -0
  54. package/resources/claude-customizations/.claude/skills/mermaid-diagram/references/sequence.md +63 -0
  55. package/resources/claude-customizations/.claude/skills/mermaid-diagram/references/state.md +49 -0
  56. package/resources/claude-customizations/.claude/skills/parallel-add/SKILL.md +10 -5
  57. package/resources/claude-customizations/.claude/skills/parallel-orchestrate/SKILL.md +116 -41
  58. package/resources/claude-customizations/.claude/skills/parallel-plan/SKILL.md +95 -13
  59. package/resources/claude-customizations/.claude/skills/parallel-remove/SKILL.md +7 -3
  60. package/resources/claude-customizations/.claude/skills/powershell-qa-gate/SKILL.md +1 -1
  61. package/resources/claude-customizations/config/blast-radius.json +9 -3
  62. package/resources/claude-customizations/pack-manifests/core.json +31 -1
  63. package/resources/codex-and-agents-customizations/.agents/skills/evidence-and-timestamp-conventions/SKILL.md +13 -0
  64. package/resources/codex-and-agents-customizations/.agents/skills/general-unit-test/SKILL.md +1 -1
  65. package/resources/codex-and-agents-customizations/.agents/skills/quality-tiers/SKILL.md +3 -3
  66. package/resources/codex-and-agents-customizations/.codex/config.toml +1 -1
  67. package/resources/customizations/.github/skills/evidence-and-timestamp-conventions/SKILL.md +13 -0
  68. package/resources/powershell/PoshQC/settings/pester.runsettings.psd1 +37 -1
@@ -0,0 +1,184 @@
1
+ ---
2
+ name: mermaid-diagram
3
+ description: 'Generate, validate, and render Mermaid diagrams (flowchart, sequence, class, state, ER, C4, gantt, pie). Use when asked to create, edit, fix, or visualize a diagram, write a .mmd file, or embed a mermaid fence in Markdown. Bundles per-type syntax references and the generate-validate-render workflow enforced by the enforce-mermaid-validation hook.'
4
+ ---
5
+
6
+ # Mermaid Diagram
7
+
8
+ Authoring workflow for Mermaid diagrams on the Claude runtime. The constraints — file conventions,
9
+ the validation mandate, the managed-diagram rule, and the opt-out marker — are in
10
+ `.claude/rules/mermaid.md`. This skill carries the workflow and the generation recipes.
11
+
12
+ Pinned Mermaid documentation version: **11.17.0**.
13
+
14
+ ## Workflow: Generate, Validate, Render
15
+
16
+ 1. **Determine the diagram type.** Pick from the per-type references below. When the type is
17
+ unfamiliar, read its reference file before generating; when the reference does not answer the
18
+ question, `WebFetch` the pinned documentation page (see [Syntax References](#syntax-references)).
19
+ 2. **Generate the syntax.** Follow the reference's first-line keyword form and its arrow token set.
20
+ Keywords are case-sensitive.
21
+ 3. **Write the diagram.** A standalone diagram goes in a `.mmd` file; a diagram that belongs to
22
+ prose goes in a fenced ` ```mermaid ` block in that document.
23
+ 4. **Validate.** The `Write` is gated automatically by
24
+ `.claude/hooks/enforce-mermaid-validation.ps1`. A deny names the defect class, the line number,
25
+ and points back here. To check before writing, call the validator directly:
26
+
27
+ ```powershell
28
+ Import-Module ./.claude/lib/mermaid/MermaidValidation.psm1 -Force
29
+ Test-MermaidDiagram -Content $diagramText
30
+ ```
31
+
32
+ The result carries `Verdict` (`Valid`, `Invalid`, `NotJudged`), `DiagramType`, `Findings` (each
33
+ with `Class`, `Line`, `Message`), and `Warnings`.
34
+ 5. **Render** per [Rendering](#rendering). Rendering is a workflow step, never something the hook
35
+ does: a hook is a non-interactive subprocess whose stdout belongs to the hook protocol.
36
+
37
+ ### What "validated" means here
38
+
39
+ The gate rejects the defect classes listed in `.claude/rules/mermaid.md`. It does not parse and it
40
+ cannot prove a diagram renders. Do not report a diagram as "validated" without that qualifier; say
41
+ the structural gate accepted it. Semantic errors — an undefined node reference, a malformed gantt
42
+ date, an invalid `classDef` property — pass the gate and still fail to render.
43
+
44
+ ## Generation Recipes
45
+
46
+ Eight recipes, one per generation intent of the Copilot `@mermaid-chart` participant. Each names
47
+ the source to read, the diagram type to emit, and the shape that survives review.
48
+
49
+ ### 1. Diagram from code (`/generate_diagram_from_code`)
50
+
51
+ Read the entry point and follow control flow outward one level at a time. Emit a `flowchart`
52
+ whose nodes are functions or modules and whose edges are calls. Keep node labels to the symbol
53
+ name; put qualifiers in a quoted label rather than in the identifier. Stop at the first boundary
54
+ the reader does not need (framework internals, third-party libraries) and mark it as one node.
55
+
56
+ ### 2. Execution sequence (`/generate_execution_sequence`)
57
+
58
+ Emit a `sequenceDiagram`. One `participant` per process, service, or object that owns state;
59
+ messages in call order; the message text after the first colon carries the payload summary. Use
60
+ `-->>` for returns and `->>` for calls so the direction reads without the labels. Reserve `activate`
61
+ and `deactivate` for lifetimes the reader must see; they add noise otherwise.
62
+
63
+ ### 3. ER diagram (`/generate_er_diagram`)
64
+
65
+ Read the schema, ORM models, or migration files. Emit an `erDiagram`. One entity per table, the
66
+ cardinality token pair chosen from the reference table, and the relationship label as the verb the
67
+ domain uses. Include an attribute block only for the columns that carry the relationship (keys) or
68
+ that the reader must see; a full column dump defeats the diagram.
69
+
70
+ ### 4. Cloud or CI/CD architecture (`/generate_cloud_architecture_diagram`)
71
+
72
+ Read the infrastructure-as-code files and the workflow definitions. Emit a `flowchart` with one
73
+ `subgraph` per environment, account, or region boundary, and `-.->` for asynchronous or
74
+ event-driven edges against `-->` for synchronous ones. State the direction convention in a comment
75
+ so the next reader keeps it.
76
+
77
+ ### 5. Docker architecture (`/generate_docker_diagram`)
78
+
79
+ Read the Dockerfiles and the compose file. Emit a `flowchart` with one node per service, one
80
+ `subgraph` per compose network, and edges labelled with the published or internal port. Show
81
+ volumes as nodes only when a volume is shared between services.
82
+
83
+ ### 6. C4 top-down architecture (`/generate_c4_topdown_architecture`)
84
+
85
+ Emit `C4Context` for the system landscape, then `C4Container` for the chosen system, then
86
+ `C4Component` for the chosen container: one diagram per level, not one diagram with three levels.
87
+ Keywords carry a capital `C4`. Relationships use the `Rel(...)` call form rather than arrow tokens.
88
+ See `references/c4.md`.
89
+
90
+ ### 7. Code ownership (`/analyze_code_ownership`)
91
+
92
+ Read `CODEOWNERS`, or derive ownership from directory structure when no such file exists. Emit a
93
+ `flowchart` with one `subgraph` per owning team and the owned directories as nodes. When ownership
94
+ is derived rather than declared, say so in the diagram title; an inferred ownership map presented
95
+ as authoritative is worse than none.
96
+
97
+ ### 8. Dependency or security visualisation (`/generate_dependency_diagram`)
98
+
99
+ Read the manifest and lock files. Emit a `flowchart` for the dependency graph, direct dependencies
100
+ at the first level and transitive ones only where they matter to the question being asked. For a
101
+ security view, mark the affected node with a `classDef` and state the advisory identifier in the
102
+ label.
103
+
104
+ ## Rendering
105
+
106
+ `Artifact` and `SendUserFile` are harness-dependent and are absent from some sessions. Take the
107
+ first available path:
108
+
109
+ 1. **`Artifact` available.** Publish a Markdown artifact containing the ` ```mermaid ` fence. This
110
+ is the preferred path: no CSP handling and no theme handling, unlike an HTML artifact.
111
+ 2. **Else `SendUserFile` with `display: "render"` available.** Use it.
112
+ 3. **Else** state that the diagram was written to its path and name the viewing route: the Mermaid
113
+ Chart VS Code extension auto-previews `.mmd` and `.mermaid` files, the built-in VS Code Markdown
114
+ preview renders fenced blocks, and GitHub renders ` ```mermaid ` fences natively in Markdown,
115
+ pull requests, and issues.
116
+
117
+ Never claim a diagram was rendered when only path 3 was taken. Say where it was written and how to
118
+ view it.
119
+
120
+ ## Opt-Out Marker
121
+
122
+ To quote invalid Mermaid deliberately, place the exact HTML comment on the line immediately before
123
+ the fence:
124
+
125
+ ```text
126
+ <!-- mermaid-validator: ignore -->
127
+ ```
128
+
129
+ The marker suppresses validation for exactly that one block, must have no intervening line before
130
+ the fence, applies only to Markdown fences, and never suppresses the managed-diagram guard. Full
131
+ rules are in `.claude/rules/mermaid.md`.
132
+
133
+ ## Syntax References
134
+
135
+ Per-type references under `references/`, pinned to Mermaid 11.17.0:
136
+
137
+ | File | Covers |
138
+ | --- | --- |
139
+ | `references/flowchart.md` | `flowchart`, `graph`, `flowchart-elk` |
140
+ | `references/sequence.md` | `sequenceDiagram` |
141
+ | `references/class.md` | `classDiagram`, `classDiagram-v2` |
142
+ | `references/state.md` | `stateDiagram-v2`, `stateDiagram` |
143
+ | `references/er.md` | `erDiagram` |
144
+ | `references/c4.md` | `C4Context`, `C4Container`, `C4Component`, `C4Dynamic`, `C4Deployment` |
145
+ | `references/gantt.md` | `gantt` |
146
+ | `references/pie.md` | `pie` |
147
+ | `references/other-types.md` | every remaining keyword of the pinned table |
148
+
149
+ **`WebFetch` fallback.** The references are a snapshot, not the documentation. When a construct is
150
+ absent from them, or when a first-line keyword is not in the validator's allowlist, fetch the
151
+ pinned page and confirm the form before generating:
152
+
153
+ - entry point: `https://mermaid.js.org/intro/syntax-reference.html`
154
+ - per-type pages: `https://mermaid.js.org/syntax/<type>.html`
155
+
156
+ Confirming a keyword against the documentation is also the mechanism for updating
157
+ `.claude/lib/mermaid/MermaidGrammar.psm1` when Mermaid adds a diagram type: the validator warns
158
+ rather than blocks on an unknown keyword, so a warning is the signal to check and extend the table.
159
+
160
+ ## Out of Scope
161
+
162
+ The VS Code extension mechanisms the Copilot instruction pack relies on are not reachable from a
163
+ Claude Code session. The full disposition table, one row per mechanism with its reason and its
164
+ replacement, is in `.claude/rules/mermaid.md` under "Out of Scope: The Non-Portable Extension
165
+ Mechanisms". In summary: the three LM tools, the sixteen `mermaidChart.*` command IDs, the
166
+ `@mermaid-chart` chat participants, and the Mermaid Chart cloud login/sync/review flows are not
167
+ ported; validation, generation, preview, and sync cooperation are ported by substitution to the
168
+ hook, these recipes, the rendering paths above, and the `id:` guard. Deep `mmdc`/Chromium
169
+ validation in CI, and retrofitting the existing repository Mermaid emitters through this validator,
170
+ are recorded follow-ups.
171
+
172
+ ## Worked Example
173
+
174
+ ```mermaid
175
+ ---
176
+ title: Generate, validate, render
177
+ ---
178
+ flowchart LR
179
+ A[Pick diagram type] --> B[Read references type page]
180
+ B --> C[Generate syntax]
181
+ C --> D{Structural gate}
182
+ D -->|deny with class and line| C
183
+ D -->|allow| E[Render or state the path]
184
+ ```
@@ -0,0 +1,50 @@
1
+ # C4 Diagram Syntax Reference
2
+
3
+ Pinned to Mermaid **11.17.0**. Source: `https://mermaid.js.org/syntax/c4.html`.
4
+ When a construct is absent here, `WebFetch` that page and confirm the form before generating.
5
+
6
+ ## First-line keyword forms
7
+
8
+ `C4Context`, `C4Container`, `C4Component`, `C4Dynamic`, `C4Deployment`.
9
+
10
+ The capital `C4` is part of the keyword. `c4context` does not resolve, and the validator is
11
+ case-sensitive by design because Mermaid is.
12
+
13
+ Emit one diagram per C4 level rather than one diagram spanning levels: context first, then the
14
+ container view of the chosen system, then the component view of the chosen container.
15
+
16
+ ## Statement forms
17
+
18
+ C4 uses call-style statements, not arrow tokens. The validator therefore keyword-checks a C4
19
+ diagram and does not judge its body.
20
+
21
+ - Elements: `Person(alias, label, description)`, `Person_Ext(...)`,
22
+ `System(alias, label, description)`, `System_Ext(...)`, `SystemDb(...)`, `SystemQueue(...)`,
23
+ `Container(alias, label, technology, description)`, `ContainerDb(...)`, `ContainerQueue(...)`,
24
+ `Component(alias, label, technology, description)`.
25
+ - Boundaries: `Enterprise_Boundary(alias, label) { ... }`, `System_Boundary(...)`,
26
+ `Container_Boundary(...)`, `Boundary(alias, label, type)`. Braces are paired.
27
+ - Relationships: `Rel(from, to, label, technology)` plus the directional variants `Rel_U`, `Rel_D`,
28
+ `Rel_L`, `Rel_R`, and `BiRel(...)` for a two-way relationship.
29
+ - Layout: `UpdateLayoutConfig($c4ShapeInRow, $c4BoundaryInRow)`. Styling:
30
+ `UpdateElementStyle(alias, $bgColor, $fontColor, $borderColor)`,
31
+ `UpdateRelStyle(from, to, $offsetX, $offsetY)`.
32
+
33
+ ## Example
34
+
35
+ ```mermaid
36
+ C4Context
37
+ title System context for the order service
38
+ Person(customer, "Customer", "Places and tracks orders")
39
+ Enterprise_Boundary(company, "Retail company") {
40
+ System(orders, "Order service", "Accepts and tracks orders")
41
+ System(billing, "Billing service", "Charges cards and issues refunds")
42
+ SystemDb(orderdb, "Order store", "Durable order records")
43
+ }
44
+ System_Ext(psp, "Payment provider", "Third-party card processing")
45
+ Rel(customer, orders, "Places an order", "HTTPS/JSON")
46
+ Rel(orders, orderdb, "Reads and writes", "SQL")
47
+ Rel(orders, billing, "Requests a charge", "internal API")
48
+ Rel(billing, psp, "Authorises the card", "HTTPS")
49
+ UpdateLayoutConfig($c4ShapeInRow="3", $c4BoundaryInRow="1")
50
+ ```
@@ -0,0 +1,63 @@
1
+ # Class Diagram Syntax Reference
2
+
3
+ Pinned to Mermaid **11.17.0**. Source: `https://mermaid.js.org/syntax/classDiagram.html`.
4
+ When a construct is absent here, `WebFetch` that page and confirm the form before generating.
5
+
6
+ ## First-line keyword forms
7
+
8
+ `classDiagram`, or the legacy-accepted `classDiagram-v2`.
9
+
10
+ ## Relation tokens
11
+
12
+ A relation is composed as `<tail><line><head>`:
13
+
14
+ | Token | Meaning |
15
+ | --- | --- |
16
+ | `<|--` / `--|>` | inheritance |
17
+ | `*--` / `--*` | composition |
18
+ | `o--` / `--o` | aggregation |
19
+ | `-->` / `<--` | association |
20
+ | `--` | link, solid |
21
+ | `..>` / `<..` | dependency |
22
+ | `..|>` / `<|..` | realization |
23
+ | `..` | link, dashed |
24
+
25
+ Cardinalities are quoted and sit outside the token: `Customer "1" --> "0..*" Order`.
26
+ Generics use tilde runs: `List~T~`, and a tilde run is never an edge defect.
27
+
28
+ ## Structural conventions
29
+
30
+ - A member block is `class <Name> { ... }` with `+`, `-`, `#`, `~` visibility prefixes; methods
31
+ carry `()`. Brackets and braces are structural in a class diagram, so every opener needs a closer.
32
+ - A member may also be declared inline: `Animal : +String name`.
33
+ - `namespace <Name> { ... }` groups classes.
34
+ - Annotations use `<<interface>>` / `<<abstract>>` on their own line inside the block or after the
35
+ class name.
36
+ - `classDef`, `cssClass`, `click`, `style`, `note`, `note for <Class>` are statement lines exempt
37
+ from the edge rules.
38
+ - Text after the first `:` on a relation line is the relation label and is free text.
39
+
40
+ ## Example
41
+
42
+ ```mermaid
43
+ classDiagram
44
+ direction LR
45
+ class Repository~T~ {
46
+ <<interface>>
47
+ +findById(id) T
48
+ +save(entity) void
49
+ }
50
+ class OrderRepository {
51
+ -connection
52
+ +findById(id) Order
53
+ +save(order) void
54
+ }
55
+ class Order {
56
+ +String id
57
+ +decimal total
58
+ +addLine(line)
59
+ }
60
+ Repository~T~ <|.. OrderRepository
61
+ OrderRepository ..> Order : returns
62
+ Order "1" --* "0..*" OrderLine : contains
63
+ ```
@@ -0,0 +1,56 @@
1
+ # Entity Relationship Diagram Syntax Reference
2
+
3
+ Pinned to Mermaid **11.17.0**. Source: `https://mermaid.js.org/syntax/entityRelationshipDiagram.html`.
4
+ When a construct is absent here, `WebFetch` that page and confirm the form before generating.
5
+
6
+ ## First-line keyword form
7
+
8
+ `erDiagram`.
9
+
10
+ ## Cardinality tokens
11
+
12
+ A relationship token is `<left><line><right>`.
13
+
14
+ | Position | Options |
15
+ | --- | --- |
16
+ | left | `\|o` (zero or one), `\|\|` (exactly one), `}o` (zero or more), `}\|` (one or more) |
17
+ | line | `--` (identifying), `..` (non-identifying) |
18
+ | right | `o\|` (zero or one), `\|\|` (exactly one), `o{` (zero or more), `\|{` (one or more) |
19
+
20
+ Common complete forms: `||--||`, `||--o{`, `}o--o{`, `}|--|{`, `|o..o|`, `}|..|{`.
21
+
22
+ Word aliases are also accepted in place of the token: `one or zero`, `zero or more`, `only one`,
23
+ `1+`, `0+`, `many(0)`, `many(1)`, joined by `to` or `optionally to`.
24
+
25
+ The relationship label follows the first `:` and is free text.
26
+
27
+ ## Structural conventions
28
+
29
+ - An attribute block is `ENTITY { <type> <name> <key> "<comment>" }`. Braces are structural.
30
+ - Key markers are `PK`, `FK`, `UK`; several may be comma-separated.
31
+ - An entity name may be quoted when it is not identifier-shaped.
32
+ - `%%` comments and the statement keywords behave as in every other type.
33
+
34
+ ## Example
35
+
36
+ ```mermaid
37
+ erDiagram
38
+ CUSTOMER ||--o{ ORDER : places
39
+ ORDER ||--|{ ORDER_LINE : contains
40
+ PRODUCT }o--o{ ORDER_LINE : "appears in"
41
+ CUSTOMER {
42
+ string id PK
43
+ string email UK "lowercased on write"
44
+ string display_name
45
+ }
46
+ ORDER {
47
+ string id PK
48
+ string customer_id FK
49
+ decimal total
50
+ }
51
+ ORDER_LINE {
52
+ string order_id FK
53
+ string product_id FK
54
+ int quantity
55
+ }
56
+ ```
@@ -0,0 +1,68 @@
1
+ # Flowchart Syntax Reference
2
+
3
+ Pinned to Mermaid **11.17.0**. Source: `https://mermaid.js.org/syntax/flowchart.html`.
4
+ When a construct is absent here, `WebFetch` that page and confirm the form before generating.
5
+
6
+ ## First-line keyword forms
7
+
8
+ - `flowchart` followed optionally by a direction: `TB`, `TD`, `BT`, `LR`, `RL`. The direction is
9
+ optional and defaults to `TB`.
10
+ - `graph` with the same optional direction. Accepted and equivalent for the validator's purposes.
11
+ - `flowchart-elk` selects the ELK layout variant.
12
+ - A trailing `;` on the keyword line is accepted (`graph LR;`).
13
+
14
+ ## Edge tokens
15
+
16
+ | Token | Meaning |
17
+ | --- | --- |
18
+ | `-->` | arrow |
19
+ | `---` | open link |
20
+ | `-.->` | dotted arrow |
21
+ | `-.-` | dotted open link |
22
+ | `==>` | thick arrow |
23
+ | `===` | thick open link |
24
+ | `~~~` | invisible link |
25
+ | `--o` | circle edge |
26
+ | `--x` | cross edge |
27
+ | `o--o`, `x--x`, `<-->` | bidirectional forms |
28
+
29
+ Length variants extend the dash, dot, or equals run (`---->`, `====>`, `-...->`) and rank the edge
30
+ lower in layout. Text forms: `A -- text --> B`, `A -->|text| B`, `A -. text .-> B`,
31
+ `A == text ==> B`.
32
+
33
+ ## Node shapes
34
+
35
+ `A[rect]`, `A(round)`, `A([stadium])`, `A[[subroutine]]`, `A[(cylinder)]`, `A((circle))`,
36
+ `A>asymmetric]`, `A{rhombus}`, `A{{hexagon}}`, `A[/parallelogram/]`, `A[\parallelogram alt\]`,
37
+ `A[/trapezoid\]`, `A(((double circle)))`.
38
+
39
+ Brackets are structural in a flowchart, so every opener needs its closer. A bracket inside a quoted
40
+ label is content, not structure: `A["foo[bar](baz)"]` is valid.
41
+
42
+ ## Structural conventions
43
+
44
+ - `subgraph <id> [<free-text title>]` opens a block; `end` closes it. A `direction` statement inside
45
+ a subgraph sets that subgraph's direction.
46
+ - Statement lines are exempt from edge and bracket rules: `click`, `style`, `classDef`, `linkStyle`,
47
+ `class`, `accTitle`, `accDescr`, `title`.
48
+ - `%%` starts a comment outside a quoted span. `%%{init: {...}}%%` is a directive, not a comment.
49
+ - Labels may carry HTML (`<br/>`, `<b>`) and Markdown strings in backticks. Angle brackets are never
50
+ structural.
51
+ - Mermaid has no backslash escape; use the `#quot;` entity for a double quote inside a label.
52
+
53
+ ## Example
54
+
55
+ ```mermaid
56
+ flowchart LR
57
+ A[Client] --> B{Authenticated}
58
+ B -->|yes| C[Handler]
59
+ B -->|no| D((Reject))
60
+ subgraph backend [Backend services]
61
+ direction TB
62
+ C --> E[(Database)]
63
+ C -.-> F[Queue]
64
+ end
65
+ click C "https://example.com/handler" "Open the handler"
66
+ classDef hot fill:#f96,stroke:#333
67
+ class E hot
68
+ ```
@@ -0,0 +1,51 @@
1
+ # Gantt Chart Syntax Reference
2
+
3
+ Pinned to Mermaid **11.17.0**. Source: `https://mermaid.js.org/syntax/gantt.html`.
4
+ When a construct is absent here, `WebFetch` that page and confirm the form before generating.
5
+
6
+ ## First-line keyword form
7
+
8
+ `gantt`.
9
+
10
+ ## Body form
11
+
12
+ A gantt body is free text to the validator: it carries no edge tokens, and brackets and parentheses
13
+ are not structural. A task named `Deploy (phase 1` is accepted by the gate even though it is
14
+ untidy, because rejecting it would be a false positive. The date and duration grammar is not
15
+ structurally checkable either, so a malformed date passes the gate and fails to render — check
16
+ dates by reading them.
17
+
18
+ Statement lines:
19
+
20
+ - `title <free text>`
21
+ - `dateFormat <format>` — the input format of the task dates, for example `YYYY-MM-DD`.
22
+ - `axisFormat <format>` — the output format of the axis, for example `%Y-%m-%d`.
23
+ - `tickInterval <n><unit>` — for example `1week`, `2day`.
24
+ - `excludes <weekends|YYYY-MM-DD|monday..sunday>`
25
+ - `todayMarker <off|stroke:...>`
26
+ - `section <free text>` opens a section; sections need no closing statement.
27
+
28
+ ## Task form
29
+
30
+ `<task label> :<tags>, <id>, <start or dependency>, <duration or end>`
31
+
32
+ - Tags: `done`, `active`, `crit`, `milestone`.
33
+ - The start may be a literal date, `after <id>`, or omitted to continue from the previous task.
34
+ - The duration is a number with a unit (`3d`, `2w`, `12h`) or an explicit end date.
35
+
36
+ ## Example
37
+
38
+ ```mermaid
39
+ gantt
40
+ title Order service rollout
41
+ dateFormat YYYY-MM-DD
42
+ axisFormat %m-%d
43
+ excludes weekends
44
+ section Preparation
45
+ Schema migration :done, mig, 2026-01-05, 3d
46
+ Contract tests :active, ct, after mig, 4d
47
+ section Rollout
48
+ Deploy to staging :crit, stg, after ct, 2d
49
+ Soak (24 hours minimum) : soak, after stg, 1d
50
+ Production cutover :milestone, prod, after soak, 0d
51
+ ```
@@ -0,0 +1,82 @@
1
+ # Remaining Diagram Types
2
+
3
+ Pinned to Mermaid **11.17.0**. Entry point: `https://mermaid.js.org/intro/syntax-reference.html`;
4
+ per-type pages at `https://mermaid.js.org/syntax/<type>.html`. When a construct is absent here,
5
+ `WebFetch` the type's page and confirm the form before generating.
6
+
7
+ Every type on this page is **keyword-checked only** by the structural gate: the validator confirms
8
+ the first-line keyword and declines to judge the body, because these grammars are free text,
9
+ indentation-structured, CSV-like, or supplied by an external plugin. A body defect in one of these
10
+ types therefore passes the gate and fails to render. Read the body.
11
+
12
+ ## Verified keyword forms
13
+
14
+ | Keyword | Type | Body shape |
15
+ | --- | --- | --- |
16
+ | `journey` | User journey | `section <name>` then `Task: <score>: <Actor>, <Actor>` rows |
17
+ | `quadrantChart` | Quadrant chart | `x-axis`, `y-axis`, `quadrant-1`..`quadrant-4`, then `"<label>": [x, y]` points |
18
+ | `requirementDiagram` | Requirement diagram | `requirement`/`element` blocks in braces; relationships as `<a> - <verb> -> <b>` |
19
+ | `gitGraph` | Git graph | `commit`, `branch`, `checkout`, `merge`, `cherry-pick`. Accepts a direction and trailing colon: `gitGraph LR:`, `gitGraph TB:`, `gitGraph BT:` |
20
+ | `mindmap` | Mind map | indentation-structured; node shapes `((circle))`, `))cloud((`, `)bang(`, `{{hexagon}}` |
21
+ | `timeline` | Timeline | `title`, optional `section`, then `<period> : <event> : <event>` rows |
22
+ | `zenuml` | ZenUML sequence | requires the external `@mermaid-js/mermaid-zenuml` plugin even in browser Mermaid; the gate keyword-accepts and never judges the body |
23
+ | `sankey-beta` | Sankey diagram | CSV-like `source,target,value` rows |
24
+ | `xychart-beta` | XY chart | `title`, `x-axis`, `y-axis`, `bar [..]`, `line [..]`. Accepts the `horizontal` modifier: `xychart-beta horizontal` |
25
+ | `block-beta` | Block diagram | `columns <n>`, block ids, `space`, flowchart-style arrows between blocks |
26
+ | `packet` | Packet diagram | `<start>-<end>: "<name>"` rows. `packet-beta` was the earlier keyword and remains accepted |
27
+ | `kanban` | Kanban board | indentation-structured columns and cards |
28
+ | `architecture-beta` | Architecture diagram | `group`, `service`, `junction`; edges carry port syntax `L`/`R`/`T`/`B`, as in `db:L -- R:server` |
29
+ | `radar-beta` | Radar chart | axis list then per-series value rows |
30
+ | `treemap-beta` | Treemap | indentation plus `"<label>": <value>` rows |
31
+ | `info` | Version info | no body; renders the Mermaid version |
32
+
33
+ ## Keyword-accept rows: documented types, unverified keyword form
34
+
35
+ These types appear in the 11.x documentation sidebar, but their exact first-line keyword form was
36
+ not individually verified against the pinned pages. The validator resolves them and records a drift
37
+ warning rather than judging the body, so neither spelling costs a false rejection. Confirm the form
38
+ by `WebFetch` before relying on one.
39
+
40
+ `swimlanes`, `eventmodeling`, `venn`, `ishikawa`, `wardley`, `cynefin`, `treeView`, `railroad`
41
+ (`railroad-beta`).
42
+
43
+ ## Version drift
44
+
45
+ The allowlist in `.claude/lib/mermaid/MermaidGrammar.psm1` is a snapshot of 11.17.0, and Mermaid adds
46
+ diagram types several times a year. An unknown but keyword-shaped first-line token produces a drift
47
+ warning and is allowed. That warning is the signal to confirm the keyword against the documentation
48
+ and add it to the table; it is never a reason to abandon the diagram.
49
+
50
+ One exception: a token within a single character of a known keyword and at least five characters
51
+ long is reported as a misspelling and denied, because a typo is a defect the gate is required to
52
+ name. `flowchar TD` is a misspelling of `flowchart`, not a new diagram type.
53
+
54
+ ## Examples
55
+
56
+ ```mermaid
57
+ gitGraph LR:
58
+ commit id: "init"
59
+ branch feature
60
+ checkout feature
61
+ commit id: "work"
62
+ checkout main
63
+ merge feature
64
+ ```
65
+
66
+ ```mermaid
67
+ timeline
68
+ title Release history
69
+ 2026-01 : 1.0 shipped : docs published
70
+ 2026-02 : 1.1 shipped
71
+ ```
72
+
73
+ ```mermaid
74
+ journey
75
+ title Order placement
76
+ section Browse
77
+ Search catalogue: 4: Customer
78
+ Read reviews: 3: Customer
79
+ section Checkout
80
+ Enter payment: 2: Customer
81
+ Confirm order: 5: Customer, System
82
+ ```
@@ -0,0 +1,32 @@
1
+ # Pie Chart Syntax Reference
2
+
3
+ Pinned to Mermaid **11.17.0**. Source: `https://mermaid.js.org/syntax/pie.html`.
4
+ When a construct is absent here, `WebFetch` that page and confirm the form before generating.
5
+
6
+ ## First-line keyword forms
7
+
8
+ - `pie`
9
+ - `pie showData` — the modifier appends each slice's numeric value to its legend label.
10
+
11
+ ## Body form
12
+
13
+ - `title <free text>` is optional and appears above the chart.
14
+ - Each data row is `"<label>" : <number>`. The label is double-quoted; the value may be an integer
15
+ or a decimal. Mermaid computes the percentages, so values need not sum to 100.
16
+ - Up to twelve slices render with distinct default colours; beyond that the palette repeats, so
17
+ aggregate the tail into one slice rather than emitting twenty.
18
+
19
+ The body carries no edge tokens and no structural brackets, so the validator keyword-checks a pie
20
+ chart and does not judge the body. An unquoted label or a non-numeric value passes the gate and
21
+ fails to render; read the rows.
22
+
23
+ ## Example
24
+
25
+ ```mermaid
26
+ pie showData
27
+ title Test suite composition
28
+ "Unit" : 271
29
+ "Hook" : 28
30
+ "Contract" : 15
31
+ "Distribution" : 3
32
+ ```
@@ -0,0 +1,63 @@
1
+ # Sequence Diagram Syntax Reference
2
+
3
+ Pinned to Mermaid **11.17.0**. Source: `https://mermaid.js.org/syntax/sequenceDiagram.html`.
4
+ When a construct is absent here, `WebFetch` that page and confirm the form before generating.
5
+
6
+ ## First-line keyword form
7
+
8
+ `sequenceDiagram`. No direction modifier.
9
+
10
+ ## Message tokens
11
+
12
+ | Token | Meaning |
13
+ | --- | --- |
14
+ | `->` | solid line, no arrowhead |
15
+ | `-->` | dotted line, no arrowhead |
16
+ | `->>` | solid line with arrowhead |
17
+ | `-->>` | dotted line with arrowhead |
18
+ | `<<->>` | solid bidirectional |
19
+ | `<<-->>` | dotted bidirectional |
20
+ | `-x` | solid line with a cross (async, lost) |
21
+ | `--x` | dotted line with a cross |
22
+ | `-)` | solid line with an open arrow (async) |
23
+ | `--)` | dotted line with an open arrow |
24
+
25
+ Half-arrow variants (`-\`, `-/` families) were added in 11.12.3 and later.
26
+
27
+ Everything after the first `:` on a message line is free text: it may contain dashes, angle
28
+ brackets, and brackets, and it is never edge-checked. Only the pre-colon segment carries the
29
+ message token.
30
+
31
+ ## Structural conventions
32
+
33
+ - `participant <id> as <label>` and `actor <id>` declare lifelines; declaration order fixes the
34
+ left-to-right order.
35
+ - `activate <id>` / `deactivate <id>`, or a `+`/`-` suffix on the message token, mark activation.
36
+ - Block keywords: `loop`, `alt`, `else`, `opt`, `par`, `and`, `critical`, `break`, `rect`, `box`.
37
+ Each block is closed by `end`.
38
+ - `Note left of <id>`, `Note right of <id>`, `Note over <id>,<id>` place notes.
39
+ - `autonumber` numbers messages. `create participant <id>` and `destroy <id>` manage lifeline
40
+ lifetime.
41
+ - Brackets are NOT structural in a sequence diagram, because message text routinely contains them.
42
+
43
+ ## Example
44
+
45
+ ```mermaid
46
+ sequenceDiagram
47
+ autonumber
48
+ participant C as Client
49
+ participant A as API
50
+ participant D as Database
51
+ C->>A: POST /orders [payload 2 - 3 items]
52
+ activate A
53
+ A->>D: INSERT order
54
+ D-->>A: order id
55
+ A-->>C: 201 Created
56
+ deactivate A
57
+ alt payment declined
58
+ A-->>C: 402 Payment Required
59
+ else accepted
60
+ A-)C: webhook: order.confirmed
61
+ end
62
+ Note over C,A: Retry policy is 3 attempts
63
+ ```