@diagrammo/dgmo 0.8.3 → 0.8.5
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/commands/dgmo-diagram-this.md +60 -0
- package/.claude/commands/dgmo-document-project.md +128 -0
- package/.claude/commands/dgmo.md +452 -50
- package/.cursorrules +32 -37
- package/.github/copilot-instructions.md +35 -44
- package/.windsurfrules +32 -37
- package/README.md +4 -4
- package/dist/cli.cjs +188 -185
- package/dist/editor.cjs +338 -0
- package/dist/editor.cjs.map +1 -0
- package/dist/editor.d.cts +27 -0
- package/dist/editor.d.ts +27 -0
- package/dist/editor.js +307 -0
- package/dist/editor.js.map +1 -0
- package/dist/highlight.cjs +560 -0
- package/dist/highlight.cjs.map +1 -0
- package/dist/highlight.d.cts +32 -0
- package/dist/highlight.d.ts +32 -0
- package/dist/highlight.js +530 -0
- package/dist/highlight.js.map +1 -0
- package/dist/index.cjs +3467 -1078
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +22 -1
- package/dist/index.d.ts +22 -1
- package/dist/index.js +3466 -1078
- package/dist/index.js.map +1 -1
- package/docs/language-reference.md +46 -37
- package/gallery/fixtures/arc.dgmo +18 -0
- package/gallery/fixtures/area.dgmo +19 -0
- package/gallery/fixtures/bar-stacked.dgmo +10 -0
- package/gallery/fixtures/bar.dgmo +10 -0
- package/gallery/fixtures/c4-full.dgmo +52 -0
- package/gallery/fixtures/c4.dgmo +17 -0
- package/gallery/fixtures/chord.dgmo +12 -0
- package/gallery/fixtures/class-basic.dgmo +14 -0
- package/gallery/fixtures/class-full.dgmo +43 -0
- package/gallery/fixtures/doughnut.dgmo +8 -0
- package/gallery/fixtures/flowchart-basic.dgmo +3 -0
- package/gallery/fixtures/flowchart-colors.dgmo +5 -0
- package/gallery/fixtures/flowchart-complex.dgmo +17 -0
- package/gallery/fixtures/flowchart-decision.dgmo +5 -0
- package/gallery/fixtures/flowchart-full.dgmo +13 -0
- package/gallery/fixtures/flowchart-groups.dgmo +10 -0
- package/gallery/fixtures/flowchart-loop.dgmo +7 -0
- package/gallery/fixtures/flowchart-nested.dgmo +7 -0
- package/gallery/fixtures/flowchart-shapes.dgmo +5 -0
- package/gallery/fixtures/function.dgmo +8 -0
- package/gallery/fixtures/funnel.dgmo +7 -0
- package/gallery/fixtures/gantt-full.dgmo +49 -0
- package/gallery/fixtures/gantt.dgmo +42 -0
- package/gallery/fixtures/heatmap.dgmo +8 -0
- package/gallery/fixtures/infra-full.dgmo +78 -0
- package/gallery/fixtures/infra-overload.dgmo +25 -0
- package/gallery/fixtures/infra.dgmo +47 -0
- package/gallery/fixtures/initiative-status-full.dgmo +46 -0
- package/gallery/fixtures/initiative-status-phases.dgmo +29 -0
- package/gallery/fixtures/initiative-status.dgmo +9 -0
- package/gallery/fixtures/line.dgmo +19 -0
- package/gallery/fixtures/multi-line.dgmo +11 -0
- package/gallery/fixtures/org-basic.dgmo +16 -0
- package/gallery/fixtures/org-full.dgmo +69 -0
- package/gallery/fixtures/org-teams.dgmo +25 -0
- package/gallery/fixtures/pie.dgmo +9 -0
- package/gallery/fixtures/polar-area.dgmo +8 -0
- package/gallery/fixtures/quadrant.dgmo +18 -0
- package/gallery/fixtures/radar.dgmo +8 -0
- package/gallery/fixtures/sankey.dgmo +31 -0
- package/gallery/fixtures/scatter.dgmo +21 -0
- package/gallery/fixtures/sequence-tags-protocols.dgmo +45 -0
- package/gallery/fixtures/sequence-tags.dgmo +41 -0
- package/gallery/fixtures/sequence.dgmo +35 -0
- package/gallery/fixtures/sitemap-basic.dgmo +12 -0
- package/gallery/fixtures/sitemap-full.dgmo +156 -0
- package/gallery/fixtures/slope.dgmo +9 -0
- package/gallery/fixtures/spr-eras.dgmo +62 -0
- package/gallery/fixtures/state.dgmo +30 -0
- package/gallery/fixtures/timeline-intraday.dgmo +14 -0
- package/gallery/fixtures/timeline.dgmo +32 -0
- package/gallery/fixtures/venn.dgmo +10 -0
- package/gallery/fixtures/wordcloud.dgmo +24 -0
- package/package.json +71 -2
- package/src/c4/layout.ts +372 -90
- package/src/c4/parser.ts +100 -55
- package/src/chart.ts +91 -28
- package/src/class/parser.ts +41 -12
- package/src/cli.ts +211 -62
- package/src/completion.ts +378 -183
- package/src/d3.ts +1044 -303
- package/src/dgmo-mermaid.ts +16 -13
- package/src/dgmo-router.ts +69 -23
- package/src/echarts.ts +646 -153
- package/src/editor/dgmo.grammar +69 -0
- package/src/editor/dgmo.grammar.d.ts +2 -0
- package/src/editor/dgmo.grammar.js +18 -0
- package/src/editor/dgmo.grammar.terms.d.ts +5 -0
- package/src/editor/dgmo.grammar.terms.js +35 -0
- package/src/editor/highlight-api.ts +444 -0
- package/src/editor/highlight.ts +36 -0
- package/src/editor/index.ts +28 -0
- package/src/editor/keywords.ts +222 -0
- package/src/editor/tokens.ts +30 -0
- package/src/er/parser.ts +48 -14
- package/src/er/renderer.ts +112 -53
- package/src/gantt/calculator.ts +91 -29
- package/src/gantt/parser.ts +197 -71
- package/src/gantt/renderer.ts +1120 -350
- package/src/graph/flowchart-parser.ts +46 -25
- package/src/graph/state-parser.ts +47 -17
- package/src/index.ts +96 -31
- package/src/infra/parser.ts +157 -53
- package/src/infra/renderer.ts +723 -271
- package/src/initiative-status/parser.ts +138 -44
- package/src/kanban/parser.ts +25 -14
- package/src/org/layout.ts +111 -44
- package/src/org/parser.ts +69 -22
- package/src/palettes/index.ts +3 -2
- package/src/sequence/parser.ts +193 -61
- package/src/sitemap/parser.ts +65 -29
- package/src/utils/arrows.ts +2 -22
- package/src/utils/duration.ts +39 -21
- package/src/utils/legend-constants.ts +0 -2
- package/src/utils/parsing.ts +75 -31
package/.claude/commands/dgmo.md
CHANGED
|
@@ -58,6 +58,18 @@ Then proceed with the user's original request using CLI fallback (see "Other out
|
|
|
58
58
|
|
|
59
59
|
> **Note for future users:** To set up in one step from the terminal before starting a Claude Code session, run `dgmo --install-claude-code-integration`. It handles everything: installs `@diagrammo/dgmo-mcp`, writes the skill, and configures the MCP server.
|
|
60
60
|
|
|
61
|
+
## Project Awareness
|
|
62
|
+
|
|
63
|
+
At the start of a session (or when the user first invokes `/dgmo`), scan for existing `.dgmo` files:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
find . -name '*.dgmo' -not -path '*/node_modules/*' -not -path '*/.git/*' 2>/dev/null | head -20
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
If you find any, mention them briefly: "I see N diagrams in your project (e.g. `diagrams/auth-flow.dgmo`, `diagrams/er-schema.dgmo`). I can edit any of these or create new ones."
|
|
70
|
+
|
|
71
|
+
Don't block on this — if no files found, just proceed.
|
|
72
|
+
|
|
61
73
|
## Getting Syntax Help
|
|
62
74
|
|
|
63
75
|
**Always use the MCP tool first** if it's available in this session:
|
|
@@ -69,19 +81,89 @@ mcp__dgmo__get_language_reference("sequence") // specific chart type
|
|
|
69
81
|
|
|
70
82
|
This is the authoritative, always-up-to-date syntax reference. Use it before guessing syntax.
|
|
71
83
|
|
|
84
|
+
For **examples** of real diagrams, call `mcp__dgmo__get_examples("<type>")` — these are curated gallery fixtures that show idiomatic DGMO patterns. Use them as few-shot references when generating.
|
|
85
|
+
|
|
72
86
|
## Your Workflow
|
|
73
87
|
|
|
74
88
|
**Primary goal: get the user seeing a visualization as fast as possible.**
|
|
75
89
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
1. **
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
90
|
+
### Creating a new diagram
|
|
91
|
+
|
|
92
|
+
1. **Pick the right chart type** — don't ask the user. Use these heuristics:
|
|
93
|
+
- "show our API" / "how does X work" → `sequence`
|
|
94
|
+
- "architecture" / "system overview" → `c4`
|
|
95
|
+
- "database" / "schema" / "models" → `er`
|
|
96
|
+
- "infrastructure" / "deployment" / "traffic" → `infra`
|
|
97
|
+
- "process" / "decision" / "flow" → `flowchart`
|
|
98
|
+
- "states" / "lifecycle" / "transitions" → `state`
|
|
99
|
+
- "org" / "team" / "hierarchy" → `org`
|
|
100
|
+
- "roadmap" / "project status" → `initiative-status` or `gantt`
|
|
101
|
+
- "compare" / "metrics" / "data" → `bar`, `line`, `pie`, etc.
|
|
102
|
+
- If genuinely ambiguous, suggest your best guess with a one-line rationale.
|
|
103
|
+
2. **Get syntax + examples** — call `mcp__dgmo__get_language_reference("<type>")` and `mcp__dgmo__get_examples("<type>")`.
|
|
104
|
+
3. **Write the `.dgmo` content** — compose the markup.
|
|
105
|
+
4. **Validate first** — call `mcp__dgmo__validate_diagram(dgmo)` to catch syntax errors before rendering. If errors come back, fix them and validate again.
|
|
106
|
+
5. **Open in browser** — call `mcp__dgmo__preview_diagram([{dgmo, title}])` without asking. This is always the right default.
|
|
107
|
+
6. **Save the source file** (if working in a project) — write it to `<name>.dgmo` so the user has an editable copy.
|
|
82
108
|
|
|
83
109
|
Do not ask the user how they want to view the diagram. Just open it. They can ask for other formats if they want.
|
|
84
110
|
|
|
111
|
+
### Editing an existing diagram
|
|
112
|
+
|
|
113
|
+
When the user asks to modify a `.dgmo` file or says "update this diagram":
|
|
114
|
+
|
|
115
|
+
1. **Read the file** — use the Read tool to get the current content.
|
|
116
|
+
2. **Understand it** — identify the chart type, key elements, and structure.
|
|
117
|
+
3. **Make the change** — edit the file using the Edit tool. Preserve the user's style and organization.
|
|
118
|
+
4. **Validate** — call `mcp__dgmo__validate_diagram(dgmo)` on the updated content.
|
|
119
|
+
5. **Preview** — call `mcp__dgmo__preview_diagram` so the user sees the result immediately.
|
|
120
|
+
|
|
121
|
+
Keep the diff minimal — don't rewrite the whole file when adding one element.
|
|
122
|
+
|
|
123
|
+
### Diagramming from code
|
|
124
|
+
|
|
125
|
+
When the user says "diagram this", "diagram this file", or "show me how X works":
|
|
126
|
+
|
|
127
|
+
1. **Read the relevant source code** — the file, function, or module they're pointing at.
|
|
128
|
+
2. **Choose the best diagram type** based on what the code does:
|
|
129
|
+
- API handler / controller → `sequence` showing the request flow
|
|
130
|
+
- Database models / ORM entities → `er` showing relationships
|
|
131
|
+
- State machine / status enum → `state` showing transitions
|
|
132
|
+
- Module imports / service dependencies → `c4` or `flowchart`
|
|
133
|
+
- Infrastructure config (Docker, k8s, terraform) → `infra`
|
|
134
|
+
3. **Extract real names** — use actual function names, service names, model names from the code.
|
|
135
|
+
4. **Generate, validate, preview** — same as creating a new diagram.
|
|
136
|
+
|
|
137
|
+
### Error recovery
|
|
138
|
+
|
|
139
|
+
When `validate_diagram` or `render_diagram` returns errors:
|
|
140
|
+
|
|
141
|
+
1. **Read the error messages** — they include line numbers and descriptions.
|
|
142
|
+
2. **Fix the specific issues** — don't regenerate from scratch unless there are many errors.
|
|
143
|
+
3. **Validate again** — loop until clean.
|
|
144
|
+
4. **Then render** — only call `preview_diagram` or `render_diagram` after validation passes.
|
|
145
|
+
|
|
146
|
+
Common fixes:
|
|
147
|
+
- "Unknown directive" → check spelling, remove colons from directives
|
|
148
|
+
- "Expected number" → data rows use spaces not colons: `Label 100` not `Label: 100`
|
|
149
|
+
- Duplicate name → parentheses strip color from display name; `App (TS)` and `App (Rust)` both become `App`
|
|
150
|
+
|
|
151
|
+
### Side-by-side variants
|
|
152
|
+
|
|
153
|
+
When the user asks to compare layouts, themes, or approaches:
|
|
154
|
+
|
|
155
|
+
```
|
|
156
|
+
mcp__dgmo__preview_diagram([
|
|
157
|
+
{ title: "Option A — Detailed", dgmo: "..." },
|
|
158
|
+
{ title: "Option B — Simplified", dgmo: "..." }
|
|
159
|
+
])
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
This opens a single page with both diagrams. Use this for:
|
|
163
|
+
- Light vs dark theme comparisons
|
|
164
|
+
- Different levels of detail
|
|
165
|
+
- Alternative structures for the same data
|
|
166
|
+
|
|
85
167
|
### Other output options (only when explicitly requested)
|
|
86
168
|
|
|
87
169
|
| What the user wants | How to do it |
|
|
@@ -93,6 +175,39 @@ Do not ask the user how they want to view the diagram. Just open it. They can as
|
|
|
93
175
|
| **Shareable URL** | `mcp__dgmo__share_diagram(dgmo)` → returns a URL; immediately run `open <url>` — do NOT just display the URL |
|
|
94
176
|
| **Copy markup to clipboard** | Run `echo '<dgmo markup>' \| pbcopy` |
|
|
95
177
|
|
|
178
|
+
### Embedding diagrams in docs
|
|
179
|
+
|
|
180
|
+
When the user wants a diagram in a README, PR description, or markdown file:
|
|
181
|
+
|
|
182
|
+
1. **Generate a share URL** — `mcp__dgmo__share_diagram(dgmo)` returns a `diagrammo.app` URL.
|
|
183
|
+
2. **Render a PNG** — `mcp__dgmo__render_diagram(dgmo, format:"png", theme:"light", palette:"nord")` returns a temp path.
|
|
184
|
+
3. **Insert into markdown** — either:
|
|
185
|
+
- Copy the PNG to the project (e.g. `docs/images/auth-flow.png`) and reference it: ``
|
|
186
|
+
- Use the share URL directly: ``
|
|
187
|
+
4. **For PRs** — prefer share URLs (no binary file to commit). For README/docs — prefer committed PNGs (they work offline).
|
|
188
|
+
|
|
189
|
+
Always generate both light and dark variants if the doc will be viewed in both modes, or use `theme:"transparent"` for universal backgrounds.
|
|
190
|
+
|
|
191
|
+
### Batch rendering
|
|
192
|
+
|
|
193
|
+
When the user asks to render all diagrams in a directory:
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
for f in diagrams/*.dgmo; do dgmo "$f" -o "${f%.dgmo}.png" --theme dark --palette nord; done
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
Or for SVG: replace `.png` with `.svg` in the output.
|
|
200
|
+
|
|
201
|
+
### Share link to clipboard
|
|
202
|
+
|
|
203
|
+
After generating a share link, always copy it to the clipboard automatically:
|
|
204
|
+
|
|
205
|
+
```bash
|
|
206
|
+
echo '<url>' | pbcopy
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
Then tell the user it's been copied.
|
|
210
|
+
|
|
96
211
|
## CLI Reference
|
|
97
212
|
|
|
98
213
|
```
|
|
@@ -141,37 +256,31 @@ Key options:
|
|
|
141
256
|
| `initiative-status` | Project roadmap with dependency tracking |
|
|
142
257
|
| `sitemap` | Website / app navigation structure |
|
|
143
258
|
| `infra` | Infrastructure traffic flow with rps computation |
|
|
259
|
+
| `gantt` | Project scheduling with dependencies |
|
|
144
260
|
|
|
145
261
|
## Key Syntax Patterns
|
|
146
262
|
|
|
147
263
|
### Common to all diagrams
|
|
148
264
|
|
|
149
265
|
```
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
palette: catppuccin // override palette
|
|
266
|
+
sequence Auth Flow // first line: chart type + optional title
|
|
267
|
+
palette catppuccin // directives are space-separated (no colon)
|
|
153
268
|
|
|
154
269
|
// This is a comment (only // syntax — not #)
|
|
155
270
|
```
|
|
156
271
|
|
|
157
|
-
Inline colors on most elements: append `(colorname)` — e.g. `North(red)
|
|
272
|
+
Inline colors on most elements: append `(colorname)` — e.g. `North(red) 850`, `[Process(blue)]`.
|
|
158
273
|
Named colors: `red`, `orange`, `yellow`, `green`, `blue`, `purple`, `teal`, `cyan`, `gray`.
|
|
159
274
|
|
|
160
275
|
### sequence (most commonly used)
|
|
161
276
|
|
|
162
277
|
```
|
|
163
|
-
|
|
164
|
-
title: Auth Flow
|
|
165
|
-
|
|
166
|
-
// Participants auto-inferred, or declare explicitly:
|
|
167
|
-
User is an actor
|
|
168
|
-
API is a service
|
|
169
|
-
DB is a database
|
|
278
|
+
sequence Auth Flow
|
|
170
279
|
|
|
171
280
|
User -Login-> API
|
|
172
281
|
API -Find user-> DB
|
|
173
282
|
DB -user record-> API
|
|
174
|
-
note
|
|
283
|
+
note
|
|
175
284
|
Indexed lookup on email column
|
|
176
285
|
|
|
177
286
|
if credentials valid
|
|
@@ -181,16 +290,17 @@ else
|
|
|
181
290
|
|
|
182
291
|
== Logout ==
|
|
183
292
|
|
|
184
|
-
note
|
|
293
|
+
note session cleanup
|
|
185
294
|
User -Logout-> API
|
|
186
295
|
API -Delete session-> DB
|
|
187
296
|
```
|
|
188
297
|
|
|
189
298
|
- Sync: `A -label-> B` · Async: `A ~label~> B` · Unlabeled: `A -> B`
|
|
190
299
|
- Blocks: `if` / `else`, `loop`, `parallel` — closed by indentation (no `end` keyword)
|
|
191
|
-
- Notes: place `note
|
|
192
|
-
- Single-line: `note
|
|
193
|
-
- Multi-line: `note
|
|
300
|
+
- Notes: place `note text` after a message — it naturally associates with that position.
|
|
301
|
+
- Single-line: `note text`
|
|
302
|
+
- Multi-line: `note` then indent continuation lines beneath it
|
|
303
|
+
- Anchored: `note right of API` then indent continuation lines
|
|
194
304
|
- Sections: `== Title ==`
|
|
195
305
|
- Groups: `[Group Name]` with indented participants
|
|
196
306
|
|
|
@@ -208,34 +318,34 @@ Shapes: `(oval)` `[rect]` `<diamond>` `/parallelogram/` `[[subroutine]]` `[docum
|
|
|
208
318
|
|
|
209
319
|
```
|
|
210
320
|
// bar
|
|
211
|
-
|
|
212
|
-
series
|
|
213
|
-
North
|
|
214
|
-
South
|
|
321
|
+
bar Revenue by Region
|
|
322
|
+
series Revenue
|
|
323
|
+
North 850
|
|
324
|
+
South 620
|
|
215
325
|
|
|
216
326
|
// line (multi-series)
|
|
217
|
-
series
|
|
218
|
-
Q1
|
|
219
|
-
Q2
|
|
327
|
+
series Sales(red), Costs(blue)
|
|
328
|
+
Q1 100, 50
|
|
329
|
+
Q2 120, 55
|
|
220
330
|
|
|
221
331
|
// pie
|
|
222
|
-
|
|
223
|
-
labels
|
|
224
|
-
Company A
|
|
225
|
-
Company B
|
|
332
|
+
pie Market Share
|
|
333
|
+
labels percent
|
|
334
|
+
Company A 40
|
|
335
|
+
Company B 35
|
|
226
336
|
```
|
|
227
337
|
|
|
228
338
|
### er
|
|
229
339
|
|
|
230
340
|
```
|
|
231
341
|
users
|
|
232
|
-
id
|
|
233
|
-
email
|
|
342
|
+
id int [pk]
|
|
343
|
+
email varchar [unique]
|
|
234
344
|
1-writes-* posts
|
|
235
345
|
|
|
236
346
|
posts
|
|
237
|
-
id
|
|
238
|
-
author_id
|
|
347
|
+
id int [pk]
|
|
348
|
+
author_id int [fk]
|
|
239
349
|
```
|
|
240
350
|
|
|
241
351
|
### org
|
|
@@ -253,21 +363,289 @@ CEO
|
|
|
253
363
|
### infra
|
|
254
364
|
|
|
255
365
|
```
|
|
256
|
-
|
|
366
|
+
infra
|
|
367
|
+
|
|
257
368
|
edge
|
|
258
|
-
rps
|
|
369
|
+
rps 10000
|
|
259
370
|
-> CDN
|
|
260
371
|
|
|
261
372
|
CDN
|
|
262
|
-
cache-hit
|
|
373
|
+
cache-hit 80%
|
|
263
374
|
-> API
|
|
264
375
|
|
|
265
376
|
API
|
|
266
|
-
instances
|
|
267
|
-
max-rps
|
|
268
|
-
latency-ms
|
|
377
|
+
instances 3
|
|
378
|
+
max-rps 500
|
|
379
|
+
latency-ms 45
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
### slope
|
|
383
|
+
|
|
384
|
+
```
|
|
385
|
+
slope Fleet Strength
|
|
386
|
+
|
|
387
|
+
period 1715 1725
|
|
388
|
+
|
|
389
|
+
Blackbeard 40 4
|
|
390
|
+
Roberts 12 52
|
|
391
|
+
Anne Bonny (red) 8 15
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
- `period` directive required before data rows (one-line or indented block for multi-token labels)
|
|
395
|
+
- Data rows: `Label value1 value2` — space-separated, no colons
|
|
396
|
+
- Right-scan: parser takes numeric values from the right, everything left is the label
|
|
397
|
+
- Color annotations: `Label (color) value1 value2`
|
|
398
|
+
|
|
399
|
+
### timeline
|
|
400
|
+
|
|
401
|
+
```
|
|
402
|
+
timeline Product Roadmap
|
|
403
|
+
sort tag:Team
|
|
404
|
+
|
|
405
|
+
tag Team alias t
|
|
406
|
+
Engineering(blue)
|
|
407
|
+
Design(purple)
|
|
408
|
+
|
|
409
|
+
era 2024-01 -> 2024-06 Phase 1
|
|
410
|
+
marker 2024-03 Beta Launch
|
|
411
|
+
|
|
412
|
+
2024-01->2024-03 Core API | t: Engineering
|
|
413
|
+
2024-02->2024-05 UX Research | t: Design
|
|
414
|
+
2024-06 GA Release | t: Engineering
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
- Dates: `YYYY`, `YYYY-MM`, `YYYY-MM-DD`. Ranges: `start->end`. Durations: `start->6m`, `->2w`, `->30d`
|
|
418
|
+
- Uncertain end: `2024-03?`. Point events: single date, no range
|
|
419
|
+
- `era start -> end Label` — background band. `marker date Label` — vertical line
|
|
420
|
+
- `## Group(color)` headers for manual grouping, or `tag` + `sort tag:Name` for swimlanes
|
|
421
|
+
- Pipe metadata: `| tagalias: Value`
|
|
422
|
+
|
|
423
|
+
### gantt
|
|
424
|
+
|
|
425
|
+
```
|
|
426
|
+
gantt Sprint Plan
|
|
427
|
+
start 2024-01-15
|
|
428
|
+
today-marker 2024-03-01
|
|
429
|
+
critical-path
|
|
430
|
+
dependencies
|
|
431
|
+
|
|
432
|
+
10bd Design | 80%
|
|
433
|
+
parallel
|
|
434
|
+
[Backend]
|
|
435
|
+
15bd API Layer
|
|
436
|
+
5bd? Auth Module
|
|
437
|
+
-> Frontend.Integration | offset: -3bd
|
|
438
|
+
[Frontend]
|
|
439
|
+
10bd Components
|
|
440
|
+
5bd Integration
|
|
441
|
+
5bd QA Testing
|
|
442
|
+
0d Release
|
|
443
|
+
```
|
|
444
|
+
|
|
445
|
+
- `start YYYY-MM-DD` — project start date (required)
|
|
446
|
+
- Duration: `10bd Task Name` (business days). Uncertain: `5bd?`. Milestone: `0d`
|
|
447
|
+
- `parallel` block for concurrent tracks. `[Group]` for named sections
|
|
448
|
+
- Progress: `| 80%` or trailing `80%`
|
|
449
|
+
- Dependencies: `-> Target.Task` or `-blocks-> Target.Task`. `offset: -3bd` for overlap
|
|
450
|
+
- `today-marker`, `critical-path`, `dependencies` — top-level directives
|
|
451
|
+
- Tags + eras + markers same as timeline
|
|
452
|
+
|
|
453
|
+
### c4
|
|
454
|
+
|
|
455
|
+
```
|
|
456
|
+
c4 Banking System
|
|
457
|
+
|
|
458
|
+
Customer is a person
|
|
459
|
+
description: A customer of the bank
|
|
460
|
+
|
|
461
|
+
Banking is a system
|
|
462
|
+
description: Online banking portal
|
|
463
|
+
containers
|
|
464
|
+
WebApp is a container | tech: React
|
|
465
|
+
API is a container | tech: Node.js
|
|
466
|
+
DB is a container is a database | tech: PostgreSQL
|
|
467
|
+
|
|
468
|
+
Email is a system
|
|
469
|
+
description: External email service
|
|
470
|
+
|
|
471
|
+
Customer -Uses-> Banking
|
|
472
|
+
Banking -Sends emails [SMTP]-> Email
|
|
473
|
+
```
|
|
474
|
+
|
|
475
|
+
- Elements: `Name is a person|system|container|component`
|
|
476
|
+
- Metadata (pipe-delimited): `| description: text, tech: stack`
|
|
477
|
+
- Indented `description:` also works (no pipe needed)
|
|
478
|
+
- Sections: `containers` (inside system), `components` (inside container), `deployment`
|
|
479
|
+
- Deployment: `NodeName is a cloud|database|cache|queue`
|
|
480
|
+
- Arrows: sync `-label [tech]->`, async `~label [tech]~>`, bidirectional `<->`, `<~>`
|
|
481
|
+
|
|
482
|
+
### class
|
|
483
|
+
|
|
484
|
+
```
|
|
485
|
+
class Type Hierarchy
|
|
486
|
+
|
|
487
|
+
Drawable [interface]
|
|
488
|
+
+ draw(): void
|
|
489
|
+
|
|
490
|
+
Shape implements Drawable [abstract]
|
|
491
|
+
# x: number
|
|
492
|
+
+ area(): number
|
|
493
|
+
count: number {static}
|
|
494
|
+
|
|
495
|
+
Circle extends Shape
|
|
496
|
+
- radius: number
|
|
497
|
+
|
|
498
|
+
Color [enum]
|
|
499
|
+
Red
|
|
500
|
+
Green
|
|
501
|
+
Blue
|
|
502
|
+
|
|
503
|
+
Canvas
|
|
504
|
+
*-- Shape : contains
|
|
505
|
+
..> Logger : uses
|
|
269
506
|
```
|
|
270
507
|
|
|
508
|
+
- Modifiers: `[abstract]`, `[interface]`, `[enum]`
|
|
509
|
+
- Inheritance: `Child extends Parent`, `Child implements Interface`
|
|
510
|
+
- Visibility: `+` public, `#` protected, `-` private. Static: `{static}`
|
|
511
|
+
- Relationships: `A *-- B` (composition), `A o-- B` (aggregation), `A --|> B` (inheritance), `A ..|> B` (implementation), `A ..> B` (dependency), `A -> B` (association)
|
|
512
|
+
- Optional label: `A *-- B : description`
|
|
513
|
+
|
|
514
|
+
### initiative-status
|
|
515
|
+
|
|
516
|
+
```
|
|
517
|
+
initiative-status Q2 Roadmap
|
|
518
|
+
|
|
519
|
+
[Identity]
|
|
520
|
+
Auth Service | done
|
|
521
|
+
SSO Integration | doing
|
|
522
|
+
-> Auth Service | done
|
|
523
|
+
MFA Rollout | blocked
|
|
524
|
+
-> SSO Integration | doing
|
|
525
|
+
|
|
526
|
+
[Payments]
|
|
527
|
+
Payment Gateway | doing
|
|
528
|
+
Billing UI | todo
|
|
529
|
+
-> Payment Gateway | doing
|
|
530
|
+
|
|
531
|
+
Auth Service -> Payment Gateway: validates | done
|
|
532
|
+
```
|
|
533
|
+
|
|
534
|
+
- Status values: `done`, `doing`, `todo`, `blocked`, `na`
|
|
535
|
+
- Dependencies: `-> Target | status` (indented) or `Source -> Target: label | status`
|
|
536
|
+
- Groups: `[Group Name]` with indented items
|
|
537
|
+
- Tags supported for phase/team coloring
|
|
538
|
+
|
|
539
|
+
### venn
|
|
540
|
+
|
|
541
|
+
```
|
|
542
|
+
venn Full-Stack Skills
|
|
543
|
+
|
|
544
|
+
Frontend(blue) alias fe
|
|
545
|
+
Backend(green) alias be
|
|
546
|
+
DevOps(orange) alias de
|
|
547
|
+
|
|
548
|
+
fe + be Web Systems
|
|
549
|
+
be + de Platform Ops
|
|
550
|
+
fe + be + de Full Stack
|
|
551
|
+
```
|
|
552
|
+
|
|
553
|
+
- Sets: `Name(color) alias id` — declares a circle
|
|
554
|
+
- Overlaps: `id + id Label` — names the intersection region
|
|
555
|
+
- Option: `values on` to show sizes. Sized form: `id(color): 120 "Label"`
|
|
556
|
+
|
|
557
|
+
### quadrant
|
|
558
|
+
|
|
559
|
+
```
|
|
560
|
+
quadrant Feature Priorities
|
|
561
|
+
|
|
562
|
+
x-label Low Effort, High Effort
|
|
563
|
+
y-label Low Impact, High Impact
|
|
564
|
+
|
|
565
|
+
top-left Quick Wins(green)
|
|
566
|
+
top-right Major Projects
|
|
567
|
+
bottom-left Fill-ins
|
|
568
|
+
bottom-right Avoid(red)
|
|
569
|
+
|
|
570
|
+
Dark Mode (blue) 0.25, 0.85
|
|
571
|
+
API v2 0.8, 0.9
|
|
572
|
+
Fix Typos 0.1, 0.15
|
|
573
|
+
```
|
|
574
|
+
|
|
575
|
+
- Axis labels: `x-label Low, High` and `y-label Low, High`
|
|
576
|
+
- Quadrant labels: `top-left`, `top-right`, `bottom-left`, `bottom-right`
|
|
577
|
+
- Data: `Label (color) x, y` where x,y are 0–1
|
|
578
|
+
|
|
579
|
+
### sankey / chord
|
|
580
|
+
|
|
581
|
+
```
|
|
582
|
+
// sankey — flow diagram
|
|
583
|
+
sankey Budget Allocation
|
|
584
|
+
|
|
585
|
+
Revenue (green)
|
|
586
|
+
Costs: 600
|
|
587
|
+
Profit (blue): 400
|
|
588
|
+
|
|
589
|
+
// arrow syntax also works
|
|
590
|
+
Revenue -> Marketing: 200
|
|
591
|
+
|
|
592
|
+
// chord — same syntax, circular layout
|
|
593
|
+
chord Team Collaboration
|
|
594
|
+
Engineering -> Design 85
|
|
595
|
+
Design -> Product 68
|
|
596
|
+
```
|
|
597
|
+
|
|
598
|
+
- Indented syntax: parent → child with `Target: weight`
|
|
599
|
+
- Arrow syntax: `Source -> Target: weight` (sankey) or `Source -> Target weight` (chord)
|
|
600
|
+
- Node colors: `Name (color)`. Link colors: `Target: 600 (red)`
|
|
601
|
+
|
|
602
|
+
### state
|
|
603
|
+
|
|
604
|
+
```
|
|
605
|
+
state Order Lifecycle
|
|
606
|
+
direction LR
|
|
607
|
+
|
|
608
|
+
[*] -> Pending -submit-> Validating
|
|
609
|
+
|
|
610
|
+
Validating
|
|
611
|
+
-approved-> Processing
|
|
612
|
+
-rejected-> Cancelled(red)
|
|
613
|
+
|
|
614
|
+
## Fulfillment(blue)
|
|
615
|
+
Processing -ship-> Shipped
|
|
616
|
+
Shipped -delivered-> Done
|
|
617
|
+
|
|
618
|
+
Cancelled -> [*]
|
|
619
|
+
Done -> [*]
|
|
620
|
+
```
|
|
621
|
+
|
|
622
|
+
- `[*]` — start/end pseudostate (filled circle)
|
|
623
|
+
- Transitions: `A -> B`, `A -label-> B`, `A -(color)-> B`
|
|
624
|
+
- Chains: `A -> B -> C` on one line
|
|
625
|
+
- Indented transitions use parent as source
|
|
626
|
+
- Groups: `## GroupName(color)` with indented states
|
|
627
|
+
- Options: `direction LR` (left-right) or `TB` (top-bottom, default)
|
|
628
|
+
|
|
629
|
+
### scatter
|
|
630
|
+
|
|
631
|
+
```
|
|
632
|
+
scatter Funding vs Revenue
|
|
633
|
+
x-label Funding ($M)
|
|
634
|
+
y-label Revenue ($M)
|
|
635
|
+
|
|
636
|
+
[SaaS](blue)
|
|
637
|
+
Acme 12, 8.5
|
|
638
|
+
DataSync 5.2, 3.1
|
|
639
|
+
|
|
640
|
+
[Fintech](green)
|
|
641
|
+
PayFlow 45, 32
|
|
642
|
+
LendTech 18, 12.5
|
|
643
|
+
```
|
|
644
|
+
|
|
645
|
+
- Data: `Label x, y` or `Label x, y, size` (bubble chart)
|
|
646
|
+
- Groups: `[Category](color)` headers
|
|
647
|
+
- Options: `labels on`, `xlabel`, `ylabel`, `sizelabel`
|
|
648
|
+
|
|
271
649
|
## Anti-Patterns
|
|
272
650
|
|
|
273
651
|
```
|
|
@@ -278,17 +656,41 @@ parallel else ❌ not supported — use separate parallel blocks
|
|
|
278
656
|
== Foo(#ff0000) == ❌ hex colors not supported — use named colors: == Foo(red) ==
|
|
279
657
|
A -routes to /api-> B ❌ -> inside a label is ambiguous — rephrase the label
|
|
280
658
|
end ❌ not needed — indentation closes blocks in sequence diagrams
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
659
|
+
chart: sequence ❌ use `sequence Title` as the first line (no colon)
|
|
660
|
+
title: My Diagram ❌ title goes on the first line after chart type
|
|
661
|
+
series: A, B ❌ use `series A, B` (no colon)
|
|
662
|
+
Label: 100 ❌ use `Label 100` (no colon in data rows)
|
|
663
|
+
tag: Group ❌ use `tag Group` (no colon)
|
|
664
|
+
note: text ❌ use `note text` (no colon)
|
|
286
665
|
```
|
|
287
666
|
|
|
288
667
|
## Tips
|
|
289
668
|
|
|
290
|
-
- Default theme: `dark`, default palette: `nord`
|
|
669
|
+
- Default theme: `dark`, default palette: `nord` — use these unless the user requests otherwise.
|
|
670
|
+
- Always validate before rendering — `validate_diagram` is much faster than a failed render.
|
|
671
|
+
- Always call `get_examples` before generating an unfamiliar chart type — real examples beat guessing.
|
|
291
672
|
- Stdin mode for quick renders: `echo "..." | dgmo -o out.png`
|
|
292
673
|
- For C4, `--c4-level` drills from context → containers → components → deployment.
|
|
293
|
-
- When auto-detection picks the wrong chart type, add an explicit
|
|
674
|
+
- When auto-detection picks the wrong chart type, add an explicit type as the first word on the first line.
|
|
294
675
|
- `mcp__dgmo__preview_diagram` accepts multiple diagrams at once — useful for showing variants side by side.
|
|
676
|
+
- When the user says "diagram this" while looking at code, read the code first and pick the chart type yourself — don't ask.
|
|
677
|
+
|
|
678
|
+
## Related Commands
|
|
679
|
+
|
|
680
|
+
Tell the user about these when relevant:
|
|
681
|
+
|
|
682
|
+
- **`/dgmo-diagram-this`** — Point it at a file, function, or module and it generates the right diagram from the code. Use when the user says "diagram this" or "how does this work?"
|
|
683
|
+
- **`/dgmo-document-project`** — Scans the entire codebase and generates a suite of 3–6 architecture diagrams (C4, sequence, ER, infra) as an HTML report. Use when the user wants project documentation.
|
|
684
|
+
|
|
685
|
+
## AI Integrations Beyond Claude Code
|
|
686
|
+
|
|
687
|
+
DGMO works with other AI tools too. If the user asks about using Diagrammo with other editors or AI assistants, point them to **https://diagrammo.app/ai** which covers:
|
|
688
|
+
|
|
689
|
+
- **Cursor** — `.cursorrules` file provides DGMO syntax context to the AI
|
|
690
|
+
- **Windsurf** — `.windsurfrules` file works the same way with Cascade
|
|
691
|
+
- **GitHub Copilot** — `.github/copilot-instructions.md` teaches Copilot the syntax
|
|
692
|
+
- **OpenAI Codex CLI** — `AGENTS.md` + `.codex/config.toml` configuration
|
|
693
|
+
|
|
694
|
+
These context files are already included in the `@diagrammo/dgmo` npm package. For any project using dgmo as a dependency, the AI tool picks them up automatically.
|
|
695
|
+
|
|
696
|
+
The MCP server (`@diagrammo/dgmo-mcp`) also works with **Claude Desktop** and any MCP-compatible client — not just Claude Code.
|