Skip to content

Commit ea1c48f

Browse files
committed
fix(cynefin): address review feedback (#7535)
Review items addressed: - Add changeset for the cynefin feature (minor bump) - Add Cypress e2e visual regression tests covering basic, transitions, empty domains, many items, config overrides, theme overrides, zero amplitude, and accessibility - Wire all config values into the renderer (width, height, padding, showDomainDescriptions, boundaryAmplitude); these now flow from the schema through db.getConfig() at render time - Wire theme variables into the renderer for all colors (domain backgrounds, boundaries, cliff, arrows, text); item badges now use per-domain colors instead of hardcoded values - Pass boundaryAmplitude to the boundary path generators so users can control or disable waviness - Replace any[] with proper Langium AST types (DomainBlock, Transition) in cynefinDb.ts and the unit test helpers - Type getConfig() return as Required<CynefinDiagramConfig> - Add comprehensive syntax documentation at src/docs/syntax/cynefin.md with examples, config table, theme variable table, and accessibility notes - Add cynefin to the vitepress sidebar - Remove the dev-only test-cynefin.html file from the package root
1 parent 4a46bf1 commit ea1c48f

11 files changed

Lines changed: 863 additions & 271 deletions

File tree

‎.changeset/add-cynefin-diagram.md‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
'mermaid': minor
3+
---
4+
5+
Add Cynefin framework diagram type (beta)
6+
7+
Adds the Cynefin framework as a new diagram type to Mermaid (available as `cynefin-beta`). The Cynefin framework, created by Dave Snowden, is a decision-making framework that categorizes problems into five complexity domains, widely used in agile, incident management, strategy, and organizational design.
8+
9+
Features:
10+
11+
- Five fixed domains in canonical layout: Complex, Complicated, Clear, Chaotic, and Confusion
12+
- Wavy organic boundaries between domains using deterministic SVG bezier curves
13+
- The "cliff" between Clear and Chaotic (catastrophic transition indicator)
14+
- Confusion/Disorder center ellipse overlay
15+
- Domain metadata including decision models (Probe/Sense/Respond etc.) and practice types
16+
- Items placed as text badges within each domain
17+
- Transition arrows between domains with optional labels
18+
- Full theme integration across all five mermaid themes
19+
- Schema-driven configuration: width, height, padding, showDomainDescriptions, boundaryAmplitude
20+
- Accessibility: ARIA roles, labels, descriptions
21+
22+
This is the first text-based DSL for Cynefin diagrams in any diagramming tool.
23+
24+
Implementation includes Langium grammar, modular renderer, unit tests, integration tests, Cypress e2e tests, and comprehensive documentation.
Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
import { imgSnapshotTest } from '../../helpers/util';
2+
3+
describe('cynefin framework', () => {
4+
it('should render a simple cynefin diagram with all five domains', () => {
5+
imgSnapshotTest(
6+
`cynefin-beta
7+
title Incident Response
8+
9+
complex
10+
"Investigate root cause"
11+
"Run chaos experiment"
12+
13+
complicated
14+
"Analyze performance data"
15+
"Expert review needed"
16+
17+
clear
18+
"Restart service"
19+
"Apply known fix"
20+
21+
chaotic
22+
"Page on-call immediately"
23+
24+
confusion
25+
"Unknown failure mode"
26+
`
27+
);
28+
});
29+
30+
it('should render a cynefin diagram with transitions', () => {
31+
imgSnapshotTest(
32+
`cynefin-beta
33+
title Strategy Categorization
34+
35+
complex
36+
"Market research"
37+
38+
complicated
39+
"Competitive analysis"
40+
41+
clear
42+
"Standard pricing"
43+
44+
chaotic
45+
"Crisis management"
46+
47+
complex --> complicated : "Pattern identified"
48+
complicated --> clear : "Best practice codified"
49+
clear --> chaotic : "Complacency"
50+
chaotic --> complex : "Stabilized"
51+
`
52+
);
53+
});
54+
55+
it('should render an empty cynefin framework', () => {
56+
imgSnapshotTest(
57+
`cynefin-beta
58+
title Empty Framework
59+
60+
complex
61+
complicated
62+
clear
63+
chaotic
64+
`
65+
);
66+
});
67+
68+
it('should render cynefin with many items per domain', () => {
69+
imgSnapshotTest(
70+
`cynefin-beta
71+
title Software Delivery
72+
73+
complex
74+
"New product discovery"
75+
"User behavior analysis"
76+
"A/B testing strategy"
77+
78+
complicated
79+
"Performance optimization"
80+
"Security audit"
81+
"Database migration"
82+
83+
clear
84+
"Deploy to staging"
85+
"Run test suite"
86+
"Merge pull request"
87+
88+
chaotic
89+
"Production outage"
90+
"Data breach response"
91+
`
92+
);
93+
});
94+
95+
it('should render cynefin with config override', () => {
96+
imgSnapshotTest(
97+
`cynefin-beta
98+
complex
99+
"Adaptive work"
100+
clear
101+
"Standard work"
102+
`,
103+
{ cynefin: { width: 1000, height: 700, boundaryAmplitude: 15 } }
104+
);
105+
});
106+
107+
it('should render cynefin without domain descriptions', () => {
108+
imgSnapshotTest(
109+
`cynefin-beta
110+
title Minimal Labels
111+
112+
complex
113+
"Item A"
114+
clear
115+
"Item B"
116+
`,
117+
{ cynefin: { showDomainDescriptions: false } }
118+
);
119+
});
120+
121+
it('should render cynefin with theme override', () => {
122+
imgSnapshotTest(
123+
`cynefin-beta
124+
complex
125+
"Test item"
126+
clear
127+
"Standard"
128+
`,
129+
{
130+
theme: 'base',
131+
themeVariables: {
132+
cynefin: {
133+
complexBg: '#FFE4B5',
134+
clearBg: '#E6E6FA',
135+
boundaryColor: '#FF0000',
136+
},
137+
},
138+
}
139+
);
140+
});
141+
142+
it('should render cynefin with straight boundaries when amplitude is zero', () => {
143+
imgSnapshotTest(
144+
`cynefin-beta
145+
title Straight Boundaries
146+
147+
complex
148+
"Item A"
149+
complicated
150+
"Item B"
151+
clear
152+
"Item C"
153+
chaotic
154+
"Item D"
155+
`,
156+
{ cynefin: { boundaryAmplitude: 0 } }
157+
);
158+
});
159+
160+
it('should render cynefin with accessibility directives', () => {
161+
imgSnapshotTest(
162+
`cynefin-beta
163+
accTitle: Cynefin framework for software delivery
164+
accDescr: A Cynefin map categorizing software tasks by complexity domain
165+
166+
complex
167+
"Feature discovery"
168+
complicated
169+
"Refactoring"
170+
clear
171+
"Hotfix"
172+
chaotic
173+
"Incident"
174+
`
175+
);
176+
});
177+
});

0 commit comments

Comments
 (0)