Skip to content

Commit 5778c93

Browse files
authored
Merge pull request #77 from codervisor/copilot/add-mermaid-diagram-test-spec
Create test spec for Mermaid diagram rendering validation
2 parents 74a4db7 + c4af5e2 commit 5778c93

File tree

2 files changed

+217
-1
lines changed

2 files changed

+217
-1
lines changed

specs/119-ui-diagram-rendering/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,16 @@ tags:
88
- visualization
99
priority: high
1010
created_at: '2025-11-25T09:18:07.795Z'
11-
updated_at: '2025-11-25T09:50:35.092Z'
11+
updated_at: '2025-11-25T12:53:39.163Z'
1212
transitions:
1313
- status: in-progress
1414
at: '2025-11-25T09:46:08.354Z'
1515
- status: complete
1616
at: '2025-11-25T09:50:35.092Z'
1717
completed_at: '2025-11-25T09:50:35.092Z'
1818
completed: '2025-11-25'
19+
related:
20+
- 120-mermaid-diagram-showcase
1921
---
2022

2123
# Native Diagram Rendering in Spec Detail View
Lines changed: 214 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,214 @@
1+
---
2+
status: planned
3+
created: '2025-11-25'
4+
tags:
5+
- test
6+
- ui
7+
- mermaid
8+
- visualization
9+
priority: medium
10+
created_at: '2025-11-25T12:52:24.676Z'
11+
related:
12+
- 119-ui-diagram-rendering
13+
updated_at: '2025-11-25T12:53:39.169Z'
14+
---
15+
16+
# Mermaid Diagram Showcase
17+
18+
> **Status**: 🗓️ Planned · **Priority**: Medium · **Created**: 2025-11-25 · **Tags**: test, ui, mermaid, visualization
19+
20+
**Project**: lean-spec
21+
**Team**: Core Development
22+
23+
## Overview
24+
25+
This spec serves as a test fixture for validating Mermaid diagram rendering in the LeanSpec UI. It contains various diagram types to ensure the `@leanspec/ui` package correctly renders all supported Mermaid diagram formats.
26+
27+
**Related**: See spec 119 (UI Diagram Rendering) for the implementation details.
28+
29+
## Diagram Examples
30+
31+
### Flowchart
32+
33+
A basic flowchart showing a decision process:
34+
35+
```mermaid
36+
flowchart TD
37+
A[Start] --> B{Is it working?}
38+
B -->|Yes| C[Great!]
39+
B -->|No| D[Debug]
40+
D --> B
41+
C --> E[End]
42+
```
43+
44+
### Sequence Diagram
45+
46+
Illustrating component interactions:
47+
48+
```mermaid
49+
sequenceDiagram
50+
participant User
51+
participant CLI
52+
participant Core
53+
participant FileSystem
54+
55+
User->>CLI: lean-spec create my-feature
56+
CLI->>Core: createSpec(name, options)
57+
Core->>FileSystem: mkdir(specsDir/name)
58+
FileSystem-->>Core: success
59+
Core->>FileSystem: writeFile(README.md)
60+
FileSystem-->>Core: success
61+
Core-->>CLI: Spec created
62+
CLI-->>User: ✓ Created: specs/my-feature/
63+
```
64+
65+
### Class Diagram
66+
67+
Showing the core architecture:
68+
69+
```mermaid
70+
classDiagram
71+
class Spec {
72+
+string id
73+
+string name
74+
+string status
75+
+string[] tags
76+
+string priority
77+
+getContent()
78+
+updateMetadata()
79+
}
80+
81+
class SpecManager {
82+
+Spec[] specs
83+
+create(name)
84+
+update(id, data)
85+
+delete(id)
86+
+search(query)
87+
}
88+
89+
class FileSystem {
90+
+read(path)
91+
+write(path, content)
92+
+exists(path)
93+
}
94+
95+
SpecManager --> Spec
96+
SpecManager --> FileSystem
97+
```
98+
99+
### State Diagram
100+
101+
Spec lifecycle states:
102+
103+
```mermaid
104+
stateDiagram-v2
105+
[*] --> Planned: create
106+
Planned --> InProgress: start work
107+
InProgress --> Complete: finish
108+
InProgress --> Blocked: issue found
109+
Blocked --> InProgress: resolved
110+
Complete --> Archived: archive
111+
Archived --> [*]
112+
```
113+
114+
### Entity Relationship Diagram
115+
116+
Spec relationships model:
117+
118+
```mermaid
119+
erDiagram
120+
SPEC ||--o{ TAG : has
121+
SPEC ||--o{ TRANSITION : records
122+
SPEC }o--o{ SPEC : depends_on
123+
SPEC }o--o{ SPEC : related_to
124+
125+
SPEC {
126+
string id
127+
string name
128+
string status
129+
string priority
130+
datetime created_at
131+
datetime updated_at
132+
}
133+
134+
TAG {
135+
string name
136+
}
137+
138+
TRANSITION {
139+
string status
140+
datetime at
141+
}
142+
```
143+
144+
### Gantt Chart
145+
146+
Project timeline visualization:
147+
148+
```mermaid
149+
gantt
150+
title Sample Feature Development
151+
dateFormat YYYY-MM-DD
152+
section Phase 1
153+
Research :done, p1, 2024-01-01, 14d
154+
Design :done, p2, after p1, 7d
155+
section Phase 2
156+
Implementation :active, p3, after p2, 21d
157+
Testing :p4, after p3, 14d
158+
section Phase 3
159+
Documentation :p5, after p4, 7d
160+
Release :milestone, after p5, 0d
161+
```
162+
163+
### Pie Chart
164+
165+
Spec status distribution:
166+
167+
```mermaid
168+
pie title Spec Status Distribution
169+
"Complete" : 45
170+
"In Progress" : 8
171+
"Planned" : 12
172+
"Archived" : 35
173+
```
174+
175+
### Git Graph
176+
177+
Branch and merge visualization:
178+
179+
```mermaid
180+
gitGraph
181+
commit id: "init"
182+
branch feature/mermaid
183+
checkout feature/mermaid
184+
commit id: "add mermaid"
185+
commit id: "add themes"
186+
checkout main
187+
merge feature/mermaid
188+
commit id: "release"
189+
```
190+
191+
## Test Criteria
192+
193+
### Rendering Tests
194+
- [ ] Flowchart renders with correct node shapes and arrows
195+
- [ ] Sequence diagram shows all participants and messages
196+
- [ ] Class diagram displays classes with attributes and methods
197+
- [ ] State diagram shows states and transitions
198+
- [ ] ER diagram renders entities and relationships
199+
- [ ] Gantt chart displays timeline correctly
200+
- [ ] Pie chart shows segments with labels
201+
- [ ] Git graph shows branches and commits
202+
203+
### Theme Support
204+
- [ ] Diagrams render correctly in light mode
205+
- [ ] Diagrams render correctly in dark mode
206+
- [ ] Theme switching updates diagram colors
207+
208+
### Error Handling
209+
- [ ] Invalid syntax shows error message
210+
- [ ] Fallback to code block on render failure
211+
212+
## Notes
213+
214+
This spec is intentionally kept as a test fixture and should not be marked as complete or archived. It serves as a living reference for validating diagram rendering functionality in the UI package.

0 commit comments

Comments
 (0)