@diagrammo/dgmo 0.2.27 → 0.3.0
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.
- package/.claude/skills/dgmo-chart/SKILL.md +107 -0
- package/.claude/skills/dgmo-flowchart/SKILL.md +61 -0
- package/.claude/skills/dgmo-generate/SKILL.md +58 -0
- package/.claude/skills/dgmo-sequence/SKILL.md +83 -0
- package/.cursorrules +117 -0
- package/.github/copilot-instructions.md +117 -0
- package/.windsurfrules +117 -0
- package/README.md +10 -3
- package/dist/cli.cjs +366 -918
- package/dist/index.cjs +581 -396
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +39 -24
- package/dist/index.d.ts +39 -24
- package/dist/index.js +578 -395
- package/dist/index.js.map +1 -1
- package/docs/ai-integration.md +125 -0
- package/docs/language-reference.md +786 -0
- package/package.json +15 -8
- package/src/c4/parser.ts +90 -74
- package/src/c4/renderer.ts +13 -12
- package/src/c4/types.ts +6 -4
- package/src/chart.ts +3 -2
- package/src/class/layout.ts +17 -12
- package/src/class/parser.ts +22 -52
- package/src/class/renderer.ts +44 -46
- package/src/class/types.ts +1 -1
- package/src/cli.ts +130 -19
- package/src/d3.ts +1 -1
- package/src/dgmo-mermaid.ts +1 -1
- package/src/dgmo-router.ts +1 -1
- package/src/echarts.ts +33 -13
- package/src/er/parser.ts +34 -43
- package/src/er/types.ts +1 -1
- package/src/graph/flowchart-parser.ts +2 -25
- package/src/graph/types.ts +1 -1
- package/src/index.ts +5 -0
- package/src/initiative-status/parser.ts +36 -7
- package/src/initiative-status/types.ts +1 -1
- package/src/kanban/parser.ts +32 -53
- package/src/kanban/renderer.ts +9 -8
- package/src/kanban/types.ts +6 -14
- package/src/org/parser.ts +47 -87
- package/src/org/resolver.ts +11 -12
- package/src/sequence/parser.ts +97 -15
- package/src/sequence/renderer.ts +62 -69
- package/src/utils/arrows.ts +75 -0
- package/src/utils/inline-markdown.ts +75 -0
- package/src/utils/parsing.ts +67 -0
- package/src/utils/tag-groups.ts +76 -0
|
@@ -0,0 +1,786 @@
|
|
|
1
|
+
# DGMO Language Reference
|
|
2
|
+
|
|
3
|
+
DGMO is a text-based diagram markup language. Files use the `.dgmo` extension. Render with the `dgmo` CLI, the Diagrammo desktop app, or the `@diagrammo/dgmo` npm library.
|
|
4
|
+
|
|
5
|
+
## Common Patterns
|
|
6
|
+
|
|
7
|
+
Every `.dgmo` file can start with optional directives, followed by content.
|
|
8
|
+
|
|
9
|
+
### Directives
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
chart: bar // explicit chart type (optional — auto-detected)
|
|
13
|
+
title: My Diagram // diagram title
|
|
14
|
+
palette: nord // color palette
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### Comments
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
// This is a comment (only // is supported)
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Inline Colors
|
|
24
|
+
|
|
25
|
+
Append `(colorname)` to labels, nodes, or data points:
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
Port Royal(red): 850
|
|
29
|
+
[Process(blue)]
|
|
30
|
+
person Customer(green)
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Named colors: `red`, `orange`, `yellow`, `green`, `blue`, `purple`, `teal`, `cyan`, `gray`. Palette-specific colors also available.
|
|
34
|
+
|
|
35
|
+
### Palettes and Themes
|
|
36
|
+
|
|
37
|
+
8 palettes: `nord` (default), `solarized`, `catppuccin`, `rose-pine`, `gruvbox`, `tokyo-night`, `one-dark`, `bold`
|
|
38
|
+
|
|
39
|
+
3 themes per palette: `light`, `dark`, `transparent`
|
|
40
|
+
|
|
41
|
+
Set via CLI: `dgmo diagram.dgmo --palette catppuccin --theme dark`
|
|
42
|
+
|
|
43
|
+
### Inline Markdown
|
|
44
|
+
|
|
45
|
+
Text fields support: `*italic*`, `**bold**`, `` `code` ``, `[link text](url)`. Bare URLs are auto-linked.
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## Chart Types
|
|
50
|
+
|
|
51
|
+
### bar
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
chart: bar
|
|
55
|
+
title: Revenue by Region
|
|
56
|
+
series: Revenue
|
|
57
|
+
|
|
58
|
+
North: 850
|
|
59
|
+
South: 620
|
|
60
|
+
East: 1100
|
|
61
|
+
West: 430
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Options: `series`, `xlabel`, `ylabel`, `orientation` (`horizontal`/`vertical`), `labels` (`name`/`value`/`percent`/`full`), `color`.
|
|
65
|
+
|
|
66
|
+
Colors per item: `North(red): 850`
|
|
67
|
+
|
|
68
|
+
### line
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
title: Quarterly Performance
|
|
72
|
+
series: Sales(red), Costs(blue)
|
|
73
|
+
|
|
74
|
+
Q1: 100, 50
|
|
75
|
+
Q2: 120, 55
|
|
76
|
+
Q3: 110, 60
|
|
77
|
+
Q4: 130, 58
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Multi-series: comma-separated values matching the `series` list. Single series omits `series` directive. Also works as `chart: multi-line`.
|
|
81
|
+
|
|
82
|
+
Options: `series`, `xlabel`, `ylabel`, `labels`.
|
|
83
|
+
|
|
84
|
+
### area
|
|
85
|
+
|
|
86
|
+
Same syntax as `line`. Renders as a filled area chart.
|
|
87
|
+
|
|
88
|
+
### pie
|
|
89
|
+
|
|
90
|
+
```
|
|
91
|
+
chart: pie
|
|
92
|
+
title: Market Share
|
|
93
|
+
labels: percent
|
|
94
|
+
|
|
95
|
+
Company A: 40
|
|
96
|
+
Company B: 35
|
|
97
|
+
Company C: 25
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Options: `labels` (`name`/`value`/`percent`/`full`).
|
|
101
|
+
|
|
102
|
+
### doughnut
|
|
103
|
+
|
|
104
|
+
Same syntax as `pie`. Renders as a doughnut (ring) chart.
|
|
105
|
+
|
|
106
|
+
### polar-area
|
|
107
|
+
|
|
108
|
+
Same syntax as `pie`. Renders as a polar area (rose) chart.
|
|
109
|
+
|
|
110
|
+
### radar
|
|
111
|
+
|
|
112
|
+
```
|
|
113
|
+
chart: radar
|
|
114
|
+
title: Team Skills
|
|
115
|
+
|
|
116
|
+
Frontend: 85
|
|
117
|
+
Backend: 70
|
|
118
|
+
DevOps: 60
|
|
119
|
+
Design: 90
|
|
120
|
+
Testing: 75
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### bar-stacked
|
|
124
|
+
|
|
125
|
+
```
|
|
126
|
+
chart: bar-stacked
|
|
127
|
+
title: Budget Allocation
|
|
128
|
+
series: Engineering, Marketing, Sales
|
|
129
|
+
|
|
130
|
+
Q1: 100, 50, 30
|
|
131
|
+
Q2: 110, 55, 35
|
|
132
|
+
Q3: 105, 60, 40
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Options: `series` (required), `xlabel`, `ylabel`, `orientation`.
|
|
136
|
+
|
|
137
|
+
### scatter
|
|
138
|
+
|
|
139
|
+
```
|
|
140
|
+
chart: scatter
|
|
141
|
+
title: Performance Metrics
|
|
142
|
+
labels: on
|
|
143
|
+
xlabel: Experience (years)
|
|
144
|
+
ylabel: Output
|
|
145
|
+
|
|
146
|
+
Alice: 3, 85
|
|
147
|
+
Bob: 7, 92
|
|
148
|
+
Carol: 2, 70
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
Data: `Label: x, y` or `Label: x, y, size` (bubble chart). Group with `## Category(color)` headers.
|
|
152
|
+
|
|
153
|
+
Options: `labels` (`on`/`off`), `xlabel`, `ylabel`, `sizelabel`.
|
|
154
|
+
|
|
155
|
+
### heatmap
|
|
156
|
+
|
|
157
|
+
```
|
|
158
|
+
chart: heatmap
|
|
159
|
+
title: Activity by Month
|
|
160
|
+
columns: Jan, Feb, Mar, Apr, May, Jun
|
|
161
|
+
|
|
162
|
+
Team A: 5, 4, 5, 3, 4, 5
|
|
163
|
+
Team B: 2, 3, 2, 4, 3, 2
|
|
164
|
+
Team C: 3, 2, 1, 2, 3, 4
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
Options: `columns` (required).
|
|
168
|
+
|
|
169
|
+
### sankey
|
|
170
|
+
|
|
171
|
+
```
|
|
172
|
+
chart: sankey
|
|
173
|
+
title: Resource Flow
|
|
174
|
+
|
|
175
|
+
Source A -> Processing: 300
|
|
176
|
+
Source B -> Processing: 200
|
|
177
|
+
Processing -> Output X: 350
|
|
178
|
+
Processing -> Output Y: 150
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
Data: `Source -> Target: value`
|
|
182
|
+
|
|
183
|
+
### chord
|
|
184
|
+
|
|
185
|
+
Same syntax as `sankey`. Renders as a circular chord diagram.
|
|
186
|
+
|
|
187
|
+
### funnel
|
|
188
|
+
|
|
189
|
+
```
|
|
190
|
+
chart: funnel
|
|
191
|
+
title: Conversion Pipeline
|
|
192
|
+
|
|
193
|
+
Visitors: 1000
|
|
194
|
+
Signups: 500
|
|
195
|
+
Trials: 200
|
|
196
|
+
Customers: 100
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### function
|
|
200
|
+
|
|
201
|
+
```
|
|
202
|
+
chart: function
|
|
203
|
+
title: Trajectories
|
|
204
|
+
xlabel: Distance (m)
|
|
205
|
+
ylabel: Height (m)
|
|
206
|
+
x: 0 to 250
|
|
207
|
+
|
|
208
|
+
Low(blue): -0.001*x^2 + 0.27*x
|
|
209
|
+
High(red): -0.003*x^2 + 0.75*x
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
Options: `x: start to end` (required), `xlabel`, `ylabel`.
|
|
213
|
+
|
|
214
|
+
Expressions support: `+`, `-`, `*`, `/`, `^`, `sin`, `cos`, `sqrt`, `abs`, `log`, `exp`, `pi`, `e`.
|
|
215
|
+
|
|
216
|
+
### slope
|
|
217
|
+
|
|
218
|
+
```
|
|
219
|
+
chart: slope
|
|
220
|
+
title: Before vs After
|
|
221
|
+
|
|
222
|
+
Period A, Period B
|
|
223
|
+
|
|
224
|
+
Item 1: 40, 80
|
|
225
|
+
Item 2: 30, 50
|
|
226
|
+
Item 3: 60, 40
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
First data line defines the two period labels. Options: `orientation` (`horizontal`/`vertical`).
|
|
230
|
+
|
|
231
|
+
### wordcloud
|
|
232
|
+
|
|
233
|
+
```
|
|
234
|
+
chart: wordcloud
|
|
235
|
+
title: Top Terms
|
|
236
|
+
|
|
237
|
+
kubernetes: 95
|
|
238
|
+
docker: 80
|
|
239
|
+
terraform: 65
|
|
240
|
+
ansible: 50
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
Data: `word: weight` (higher = larger). Options: `rotate` (`none`/`mixed`/`angled`), `max` (word limit), `size: min, max` (font range).
|
|
244
|
+
|
|
245
|
+
### arc
|
|
246
|
+
|
|
247
|
+
```
|
|
248
|
+
chart: arc
|
|
249
|
+
title: Team Collaboration
|
|
250
|
+
|
|
251
|
+
## Frontend(blue)
|
|
252
|
+
Alice -> Bob: 8
|
|
253
|
+
Alice -> Carol: 5
|
|
254
|
+
|
|
255
|
+
## Backend(green)
|
|
256
|
+
Dave -> Carol: 10
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
Data: `Source -> Target: weight`. Group nodes with `## Group(color)` headers.
|
|
260
|
+
|
|
261
|
+
Options: `order` (`appearance`/`name`/`group`/`degree`), `orientation`.
|
|
262
|
+
|
|
263
|
+
### venn
|
|
264
|
+
|
|
265
|
+
```
|
|
266
|
+
chart: venn
|
|
267
|
+
title: Skill Overlap
|
|
268
|
+
|
|
269
|
+
dev(blue): 120 "Development"
|
|
270
|
+
ops(green): 100 "Operations"
|
|
271
|
+
sec(red): 80 "Security"
|
|
272
|
+
|
|
273
|
+
dev & ops: 35 "DevOps"
|
|
274
|
+
ops & sec: 40 "SecOps"
|
|
275
|
+
dev & sec: 30 "DevSec"
|
|
276
|
+
dev & ops & sec: 10 "DevSecOps"
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
Sets: `id(color): size "label"`. Overlaps: `id1 & id2: size "label"`. Options: `values` (`on`/`off`).
|
|
280
|
+
|
|
281
|
+
### quadrant
|
|
282
|
+
|
|
283
|
+
```
|
|
284
|
+
chart: quadrant
|
|
285
|
+
title: Priority Matrix
|
|
286
|
+
x-axis: Low Impact, High Impact
|
|
287
|
+
y-axis: Low Effort, High Effort
|
|
288
|
+
|
|
289
|
+
top-right: Quick Wins(green)
|
|
290
|
+
top-left: Big Bets(yellow)
|
|
291
|
+
bottom-left: Skip(red)
|
|
292
|
+
bottom-right: Reconsider(gray)
|
|
293
|
+
|
|
294
|
+
Task A: 0.9, 0.8
|
|
295
|
+
Task B: 0.2, 0.3
|
|
296
|
+
Task C: 0.7, 0.4
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
Options: `x-axis: low, high`, `y-axis: low, high`. Quadrant labels: `top-right`, `top-left`, `bottom-left`, `bottom-right`. Data: `Label: x, y` where x,y are 0–1.
|
|
300
|
+
|
|
301
|
+
### timeline
|
|
302
|
+
|
|
303
|
+
```
|
|
304
|
+
chart: timeline
|
|
305
|
+
title: Project History
|
|
306
|
+
|
|
307
|
+
era 2023->2024: Phase 1
|
|
308
|
+
marker 2023-06: Launch(orange)
|
|
309
|
+
|
|
310
|
+
## Team A(blue)
|
|
311
|
+
2023-01->2023-06: Planning
|
|
312
|
+
2023-06->2024-01: Development
|
|
313
|
+
2024-02: Release
|
|
314
|
+
|
|
315
|
+
## Team B(green)
|
|
316
|
+
2023-03->2023-09: Research
|
|
317
|
+
2023-09->2024-03?: Implementation
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
Date formats: `YYYY`, `YYYY-MM`, `YYYY-MM-DD`. Ranges: `start->end`. Durations: `start->1y`, `start->6m`, `start->2w`, `start->30d`. Uncertain end: append `?` (e.g., `2024-03?`).
|
|
321
|
+
|
|
322
|
+
Elements: `era start->end: Label(color)`, `marker date: Label(color)`, `## Group(color)` headers.
|
|
323
|
+
|
|
324
|
+
Options: `scale` (`on`/`off`), `sort` (`time`/`group`), `swimlanes` (`on`/`off`).
|
|
325
|
+
|
|
326
|
+
---
|
|
327
|
+
|
|
328
|
+
## Diagram Types
|
|
329
|
+
|
|
330
|
+
### sequence
|
|
331
|
+
|
|
332
|
+
Minimal example:
|
|
333
|
+
|
|
334
|
+
```
|
|
335
|
+
User -> API: login
|
|
336
|
+
API -> DB: findUser
|
|
337
|
+
DB -> API: <- user
|
|
338
|
+
API -> User: <- token
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
Full example:
|
|
342
|
+
|
|
343
|
+
```
|
|
344
|
+
chart: sequence
|
|
345
|
+
title: Authentication Flow
|
|
346
|
+
|
|
347
|
+
// participant declarations (optional)
|
|
348
|
+
User is an actor
|
|
349
|
+
API is a service
|
|
350
|
+
DB is a database
|
|
351
|
+
NotifyQueue is a queue aka Notifications
|
|
352
|
+
|
|
353
|
+
User -Login request-> API
|
|
354
|
+
API -Find user by email-> DB
|
|
355
|
+
DB -> API: <- user record
|
|
356
|
+
note on DB:
|
|
357
|
+
Indexed lookup on email column
|
|
358
|
+
|
|
359
|
+
if credentials valid
|
|
360
|
+
API -Create session-> DB
|
|
361
|
+
DB -> API: <- session token
|
|
362
|
+
API -> User: <- 200 OK + token
|
|
363
|
+
API ~session.created~> NotifyQueue
|
|
364
|
+
else
|
|
365
|
+
API -> User: <- 401 Unauthorized
|
|
366
|
+
|
|
367
|
+
== Logout ==
|
|
368
|
+
|
|
369
|
+
User -Logout-> API
|
|
370
|
+
API -Delete session-> DB
|
|
371
|
+
API -> User: <- 200 OK
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
**Participants**: Auto-inferred from message names. Declare explicitly for type/positioning:
|
|
375
|
+
- `Name is a [actor|service|database|queue|cache|gateway|external|networking|frontend]`
|
|
376
|
+
- `Name aka Display Label` — alias for display
|
|
377
|
+
- `Name at position 2` — manual left-to-right ordering (0-based; negative from right)
|
|
378
|
+
|
|
379
|
+
**Messages**:
|
|
380
|
+
- Sync: `A -> B: label` or `A -label-> B`
|
|
381
|
+
- Async: `A ~> B: label` or `A ~label~> B`
|
|
382
|
+
- Return: `B -> A: <- response` (on the calling line) or separate line
|
|
383
|
+
- Bidirectional: `A <-> B: label` or `A <-label-> B`
|
|
384
|
+
- Bidirectional async: `A <~> B: label` or `A <~label~> B`
|
|
385
|
+
|
|
386
|
+
**Blocks** (indentation-scoped):
|
|
387
|
+
- `if condition` ... `else` ... (no explicit `end` needed — indentation closes blocks)
|
|
388
|
+
- `loop label` ...
|
|
389
|
+
- `parallel label` ...
|
|
390
|
+
|
|
391
|
+
**Notes**:
|
|
392
|
+
- `note: text` — standalone
|
|
393
|
+
- `note on Participant: text` — anchored
|
|
394
|
+
- Multi-line: indent continuation lines under `note:`
|
|
395
|
+
|
|
396
|
+
**Sections**: `== Section Title ==` or `== Section Title(color) ==`
|
|
397
|
+
|
|
398
|
+
**Groups**: `## Group Name` — visual grouping box around messages
|
|
399
|
+
|
|
400
|
+
**Options**: `activations: off`, `collapse-notes: no`
|
|
401
|
+
|
|
402
|
+
### flowchart
|
|
403
|
+
|
|
404
|
+
Minimal example:
|
|
405
|
+
|
|
406
|
+
```
|
|
407
|
+
(Start) -> [Process] -> (End)
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
Full example:
|
|
411
|
+
|
|
412
|
+
```
|
|
413
|
+
chart: flowchart
|
|
414
|
+
title: Decision Process
|
|
415
|
+
|
|
416
|
+
(Start) -> <Valid Input?>
|
|
417
|
+
-yes-> [Process Data] -> [[Run Subroutine]]
|
|
418
|
+
-no-> /Get User Input/ -> <Valid Input?>
|
|
419
|
+
[[Run Subroutine]] -> [Document~] -> (Done)
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
**Node shapes**:
|
|
423
|
+
- `(Terminal)` — oval
|
|
424
|
+
- `[Process]` — rectangle
|
|
425
|
+
- `<Decision?>` — diamond
|
|
426
|
+
- `/Input Output/` — parallelogram
|
|
427
|
+
- `[[Subroutine]]` — double-bordered rectangle
|
|
428
|
+
- `[Document~]` — document (wavy bottom)
|
|
429
|
+
|
|
430
|
+
**Arrows**: `-label-> Target`, `-(color)-> Target`, `-label(color)-> Target`
|
|
431
|
+
|
|
432
|
+
Colors on nodes: `[Process(blue)]`
|
|
433
|
+
|
|
434
|
+
### class
|
|
435
|
+
|
|
436
|
+
Minimal example:
|
|
437
|
+
|
|
438
|
+
```
|
|
439
|
+
Animal
|
|
440
|
+
+ name: string
|
|
441
|
+
+ speak(): void
|
|
442
|
+
|
|
443
|
+
Dog extends Animal
|
|
444
|
+
+ breed: string
|
|
445
|
+
|
|
446
|
+
Cat extends Animal
|
|
447
|
+
+ indoor: boolean
|
|
448
|
+
```
|
|
449
|
+
|
|
450
|
+
Full example:
|
|
451
|
+
|
|
452
|
+
```
|
|
453
|
+
chart: class
|
|
454
|
+
title: Type Hierarchy
|
|
455
|
+
|
|
456
|
+
Printable [interface]
|
|
457
|
+
+ print(): void
|
|
458
|
+
|
|
459
|
+
Shape implements Printable [abstract]
|
|
460
|
+
# x: number
|
|
461
|
+
# y: number
|
|
462
|
+
+ area(): number
|
|
463
|
+
count: number {static}
|
|
464
|
+
|
|
465
|
+
Circle extends Shape
|
|
466
|
+
- radius: number
|
|
467
|
+
+ area(): number
|
|
468
|
+
|
|
469
|
+
Rectangle extends Shape
|
|
470
|
+
- width: number
|
|
471
|
+
- height: number
|
|
472
|
+
|
|
473
|
+
Shape *-- Circle : contains
|
|
474
|
+
```
|
|
475
|
+
|
|
476
|
+
**Class modifiers**: `[abstract]`, `[interface]`, `[enum]`
|
|
477
|
+
|
|
478
|
+
**Inheritance**: `ClassName extends Parent` or `ClassName implements Interface` — declared inline in the class header. Members are indented below.
|
|
479
|
+
|
|
480
|
+
**Member visibility**: `+` public, `#` protected, `-` private. Static: `{static}`.
|
|
481
|
+
|
|
482
|
+
**Relationships** (arrow syntax):
|
|
483
|
+
- Inheritance: `A --|> B`
|
|
484
|
+
- Implementation: `A ..|> B`
|
|
485
|
+
- Composition: `A *-- B`
|
|
486
|
+
- Aggregation: `A o-- B`
|
|
487
|
+
- Dependency: `A ..> B`
|
|
488
|
+
- Association: `A -> B`
|
|
489
|
+
- Optional label: `A *-- B : description`
|
|
490
|
+
|
|
491
|
+
### er
|
|
492
|
+
|
|
493
|
+
Minimal example:
|
|
494
|
+
|
|
495
|
+
```
|
|
496
|
+
users
|
|
497
|
+
id: int [pk]
|
|
498
|
+
name: varchar
|
|
499
|
+
|
|
500
|
+
posts
|
|
501
|
+
id: int [pk]
|
|
502
|
+
user_id: int [fk]
|
|
503
|
+
|
|
504
|
+
users 1--* posts : writes
|
|
505
|
+
```
|
|
506
|
+
|
|
507
|
+
Full example:
|
|
508
|
+
|
|
509
|
+
```
|
|
510
|
+
chart: er
|
|
511
|
+
title: Blog Schema
|
|
512
|
+
|
|
513
|
+
users
|
|
514
|
+
id: int [pk]
|
|
515
|
+
email: varchar [unique]
|
|
516
|
+
name: varchar
|
|
517
|
+
|
|
518
|
+
posts
|
|
519
|
+
id: int [pk]
|
|
520
|
+
title: varchar
|
|
521
|
+
body: text
|
|
522
|
+
author_id: int [fk]
|
|
523
|
+
category_id: int [fk, nullable]
|
|
524
|
+
|
|
525
|
+
categories
|
|
526
|
+
id: int [pk]
|
|
527
|
+
name: varchar [unique]
|
|
528
|
+
|
|
529
|
+
users 1--* posts : writes
|
|
530
|
+
categories 1--* posts : contains
|
|
531
|
+
users ?--* categories : moderates
|
|
532
|
+
```
|
|
533
|
+
|
|
534
|
+
**Columns**: `name: type [constraints]`. Constraints: `pk`, `fk`, `unique`, `nullable`. Multiple: `[fk, nullable]`.
|
|
535
|
+
|
|
536
|
+
**Relationships** (symbolic cardinality):
|
|
537
|
+
- `1--1` — one-to-one
|
|
538
|
+
- `1--*` — one-to-many
|
|
539
|
+
- `?--1` — zero-or-one to one
|
|
540
|
+
- `?--*` — zero-or-more
|
|
541
|
+
- Optional label: `table1 1--* table2 : description`
|
|
542
|
+
|
|
543
|
+
### c4
|
|
544
|
+
|
|
545
|
+
Minimal example:
|
|
546
|
+
|
|
547
|
+
```
|
|
548
|
+
chart: c4
|
|
549
|
+
|
|
550
|
+
person User
|
|
551
|
+
system MyApp | description: The main application
|
|
552
|
+
-Uses-> User
|
|
553
|
+
```
|
|
554
|
+
|
|
555
|
+
Full example:
|
|
556
|
+
|
|
557
|
+
```
|
|
558
|
+
chart: c4
|
|
559
|
+
title: Banking System
|
|
560
|
+
|
|
561
|
+
tag: Scope alias sc
|
|
562
|
+
Internal(blue) default
|
|
563
|
+
External(gray)
|
|
564
|
+
|
|
565
|
+
person Customer | description: A customer of the bank
|
|
566
|
+
|
|
567
|
+
system Internet Banking | description: Online banking portal
|
|
568
|
+
-Delivers content [HTTPS]-> Customer
|
|
569
|
+
-Sends emails [SMTP]-> Email
|
|
570
|
+
|
|
571
|
+
containers:
|
|
572
|
+
container Web App | description: SPA, tech: React
|
|
573
|
+
-API calls [JSON/HTTPS]-> API
|
|
574
|
+
|
|
575
|
+
container API | description: Backend, tech: Node.js
|
|
576
|
+
-Reads/writes [SQL]-> Database
|
|
577
|
+
|
|
578
|
+
container Database | description: Data store, tech: PostgreSQL
|
|
579
|
+
|
|
580
|
+
system Email | description: Email delivery, sc: External
|
|
581
|
+
~Sends emails~> Customer
|
|
582
|
+
|
|
583
|
+
deployment:
|
|
584
|
+
Vercel is a cloud
|
|
585
|
+
container Web App
|
|
586
|
+
Railway
|
|
587
|
+
container API
|
|
588
|
+
Neon is a database
|
|
589
|
+
container Database
|
|
590
|
+
```
|
|
591
|
+
|
|
592
|
+
**Element types**: `person`, `system`, `container`, `component`
|
|
593
|
+
|
|
594
|
+
**Metadata** (pipe-delimited): `element Name | description: text, tech: stack, tagalias: value`
|
|
595
|
+
|
|
596
|
+
**Sections**: `containers:` (inside system), `components:` (inside container), `deployment:`
|
|
597
|
+
|
|
598
|
+
**Deployment nodes**: `NodeName is a [cloud|database|cache|queue|external]`
|
|
599
|
+
|
|
600
|
+
**Relationships**:
|
|
601
|
+
- Sync: `-> Target` or `-label [tech]-> Target`
|
|
602
|
+
- Async: `~> Target` or `~label [tech]~> Target`
|
|
603
|
+
- Bidirectional: `<-> Target`, `<~> Target`
|
|
604
|
+
|
|
605
|
+
**Tag groups**: See tag group syntax below.
|
|
606
|
+
|
|
607
|
+
### org
|
|
608
|
+
|
|
609
|
+
Minimal example:
|
|
610
|
+
|
|
611
|
+
```
|
|
612
|
+
chart: org
|
|
613
|
+
|
|
614
|
+
CEO
|
|
615
|
+
VP Engineering
|
|
616
|
+
Team Lead
|
|
617
|
+
VP Marketing
|
|
618
|
+
```
|
|
619
|
+
|
|
620
|
+
Full example:
|
|
621
|
+
|
|
622
|
+
```
|
|
623
|
+
chart: org
|
|
624
|
+
title: Engineering Org
|
|
625
|
+
sub-node-label: Reports
|
|
626
|
+
show-sub-node-count: yes
|
|
627
|
+
|
|
628
|
+
tag: Level alias lv
|
|
629
|
+
Director(red)
|
|
630
|
+
Manager(blue)
|
|
631
|
+
IC(green) default
|
|
632
|
+
|
|
633
|
+
CTO | lv: Director
|
|
634
|
+
VP Engineering | lv: Director
|
|
635
|
+
[Platform]
|
|
636
|
+
Lead | lv: Manager
|
|
637
|
+
Dev 1
|
|
638
|
+
Dev 2
|
|
639
|
+
[Product]
|
|
640
|
+
Lead | lv: Manager
|
|
641
|
+
Dev 3
|
|
642
|
+
```
|
|
643
|
+
|
|
644
|
+
Hierarchy via indentation. `[Group Name]` creates collapsible sub-groups.
|
|
645
|
+
|
|
646
|
+
**Metadata**: `Name | tagalias: value, tag2: value2`
|
|
647
|
+
|
|
648
|
+
Options: `sub-node-label`, `show-sub-node-count` (`yes`/`no`).
|
|
649
|
+
|
|
650
|
+
**Imports**: `import: path/to/file.dgmo` (indented under a parent node), `tags: path/to/tags.dgmo` (top-level).
|
|
651
|
+
|
|
652
|
+
### kanban
|
|
653
|
+
|
|
654
|
+
Minimal example:
|
|
655
|
+
|
|
656
|
+
```
|
|
657
|
+
chart: kanban
|
|
658
|
+
|
|
659
|
+
== To Do ==
|
|
660
|
+
Task 1
|
|
661
|
+
Task 2
|
|
662
|
+
|
|
663
|
+
== Done ==
|
|
664
|
+
Task 3
|
|
665
|
+
```
|
|
666
|
+
|
|
667
|
+
Full example:
|
|
668
|
+
|
|
669
|
+
```
|
|
670
|
+
chart: kanban
|
|
671
|
+
title: Sprint Board
|
|
672
|
+
|
|
673
|
+
tag: Priority
|
|
674
|
+
Critical(red)
|
|
675
|
+
High(orange)
|
|
676
|
+
Low(green) default
|
|
677
|
+
|
|
678
|
+
tag: Owner alias o
|
|
679
|
+
Alice(blue)
|
|
680
|
+
Bob(green)
|
|
681
|
+
|
|
682
|
+
== Backlog(gray) ==
|
|
683
|
+
Research API options | priority: High, o: Alice
|
|
684
|
+
|
|
685
|
+
== In Progress [wip: 3](orange) ==
|
|
686
|
+
Build auth module | priority: Critical, o: Bob
|
|
687
|
+
Integrate OAuth2
|
|
688
|
+
Add session management
|
|
689
|
+
|
|
690
|
+
== Done(green) ==
|
|
691
|
+
Setup CI pipeline | priority: High, o: Alice
|
|
692
|
+
```
|
|
693
|
+
|
|
694
|
+
**Columns**: `== Column Name ==`, `== Column Name(color) ==`, `== Column Name [wip: N] ==`
|
|
695
|
+
|
|
696
|
+
**Cards**: `Card Title | tag: value`. Indented lines below become card details.
|
|
697
|
+
|
|
698
|
+
### initiative-status
|
|
699
|
+
|
|
700
|
+
Minimal example:
|
|
701
|
+
|
|
702
|
+
```
|
|
703
|
+
chart: initiative-status
|
|
704
|
+
|
|
705
|
+
Auth | done
|
|
706
|
+
-> UserService | wip
|
|
707
|
+
-> NotifyService | todo
|
|
708
|
+
UserService | wip
|
|
709
|
+
NotifyService | todo
|
|
710
|
+
```
|
|
711
|
+
|
|
712
|
+
Full example:
|
|
713
|
+
|
|
714
|
+
```
|
|
715
|
+
chart: initiative-status
|
|
716
|
+
title: Platform Roadmap
|
|
717
|
+
|
|
718
|
+
Auth | done
|
|
719
|
+
-depends-> UserService | wip
|
|
720
|
+
-feeds-> Dashboard | todo
|
|
721
|
+
Dashboard | todo
|
|
722
|
+
UserService | wip
|
|
723
|
+
-calls-> DBLayer | done
|
|
724
|
+
DBLayer | done
|
|
725
|
+
|
|
726
|
+
[External]
|
|
727
|
+
PaymentGW | na
|
|
728
|
+
EmailProvider | na
|
|
729
|
+
```
|
|
730
|
+
|
|
731
|
+
**Status values**: `done`, `wip`, `todo`, `na`
|
|
732
|
+
|
|
733
|
+
**Relationships**: `-label-> Target | status` or indented children.
|
|
734
|
+
|
|
735
|
+
**Groups**: `[Group Name]` for visual grouping.
|
|
736
|
+
|
|
737
|
+
---
|
|
738
|
+
|
|
739
|
+
## Tag Groups
|
|
740
|
+
|
|
741
|
+
Define reusable metadata categories for org charts, kanban boards, and C4 diagrams:
|
|
742
|
+
|
|
743
|
+
```
|
|
744
|
+
tag: Priority
|
|
745
|
+
Critical(red)
|
|
746
|
+
High(orange)
|
|
747
|
+
Medium(yellow)
|
|
748
|
+
Low(green) default
|
|
749
|
+
|
|
750
|
+
tag: Team alias t
|
|
751
|
+
Frontend(blue)
|
|
752
|
+
Backend(green)
|
|
753
|
+
```
|
|
754
|
+
|
|
755
|
+
- `tag:` keyword (case-insensitive)
|
|
756
|
+
- Optional `alias` for shorthand in metadata: `| t: Frontend`
|
|
757
|
+
- `default` keyword marks the fallback value
|
|
758
|
+
- Indented entries with `Value(color)`
|
|
759
|
+
|
|
760
|
+
Assign to elements via pipe metadata: `Element Name | priority: High, t: Frontend`
|
|
761
|
+
|
|
762
|
+
---
|
|
763
|
+
|
|
764
|
+
## Anti-Patterns
|
|
765
|
+
|
|
766
|
+
**Common mistakes to avoid:**
|
|
767
|
+
|
|
768
|
+
- `# comment` — wrong. Use `// comment`
|
|
769
|
+
- `async A -> B: msg` — wrong. Use `A ~> B: msg` or `A ~msg~> B`
|
|
770
|
+
- `parallel else` — not supported. Use separate `parallel` blocks
|
|
771
|
+
- Hex colors in sections `== Foo(#ff0000) ==` — wrong. Use named colors: `== Foo(red) ==`
|
|
772
|
+
- `->` inside labeled arrows `A -routes to /api-> B` — ambiguous. Rephrase the label
|
|
773
|
+
- Missing `chart:` for ambiguous content — when auto-detection picks the wrong type, add an explicit `chart:` directive
|
|
774
|
+
- `end` keyword in sequence blocks — not needed. Indentation closes blocks
|
|
775
|
+
|
|
776
|
+
---
|
|
777
|
+
|
|
778
|
+
## CLI Usage
|
|
779
|
+
|
|
780
|
+
```bash
|
|
781
|
+
dgmo diagram.dgmo # PNG output (default)
|
|
782
|
+
dgmo diagram.dgmo -o output.svg # SVG output
|
|
783
|
+
dgmo diagram.dgmo -o url # Shareable URL
|
|
784
|
+
dgmo diagram.dgmo --palette catppuccin --theme dark
|
|
785
|
+
dgmo diagram.dgmo -o output.png --palette bold
|
|
786
|
+
```
|