@diagrammo/dgmo 0.8.23 → 0.8.26

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 (78) hide show
  1. package/.claude/commands/dgmo.md +43 -431
  2. package/.cursorrules +2 -2
  3. package/.windsurfrules +2 -2
  4. package/AGENTS.md +8 -5
  5. package/dist/cli.cjs +119 -114
  6. package/dist/editor.cjs +0 -2
  7. package/dist/editor.cjs.map +1 -1
  8. package/dist/editor.js +0 -2
  9. package/dist/editor.js.map +1 -1
  10. package/dist/highlight.cjs +0 -2
  11. package/dist/highlight.cjs.map +1 -1
  12. package/dist/highlight.js +0 -2
  13. package/dist/highlight.js.map +1 -1
  14. package/dist/index.cjs +719 -281
  15. package/dist/index.cjs.map +1 -1
  16. package/dist/index.d.cts +105 -18
  17. package/dist/index.d.ts +105 -18
  18. package/dist/index.js +709 -280
  19. package/dist/index.js.map +1 -1
  20. package/dist/internal.cjs +348 -51
  21. package/dist/internal.cjs.map +1 -1
  22. package/dist/internal.d.cts +93 -5
  23. package/dist/internal.d.ts +93 -5
  24. package/dist/internal.js +334 -38
  25. package/dist/internal.js.map +1 -1
  26. package/docs/guide/chart-area.md +17 -17
  27. package/docs/guide/chart-bar-stacked.md +12 -12
  28. package/docs/guide/chart-doughnut.md +10 -10
  29. package/docs/guide/chart-funnel.md +9 -9
  30. package/docs/guide/chart-heatmap.md +10 -10
  31. package/docs/guide/chart-kanban.md +2 -0
  32. package/docs/guide/chart-line.md +19 -19
  33. package/docs/guide/chart-multi-line.md +16 -16
  34. package/docs/guide/chart-pie.md +11 -11
  35. package/docs/guide/chart-polar-area.md +10 -10
  36. package/docs/guide/chart-radar.md +9 -9
  37. package/docs/guide/chart-scatter.md +24 -27
  38. package/docs/guide/index.md +3 -3
  39. package/docs/language-reference.md +46 -25
  40. package/fonts/Inter-Bold.ttf +0 -0
  41. package/fonts/Inter-Regular.ttf +0 -0
  42. package/fonts/LICENSE-Inter.txt +92 -0
  43. package/gallery/fixtures/bar-stacked.dgmo +12 -6
  44. package/gallery/fixtures/heatmap.dgmo +12 -6
  45. package/gallery/fixtures/multi-line.dgmo +11 -7
  46. package/gallery/fixtures/quadrant.dgmo +8 -8
  47. package/gallery/fixtures/scatter.dgmo +12 -12
  48. package/package.json +10 -3
  49. package/src/boxes-and-lines/parser.ts +13 -2
  50. package/src/boxes-and-lines/renderer.ts +22 -13
  51. package/src/chart-type-scoring.ts +162 -0
  52. package/src/chart-types.ts +437 -0
  53. package/src/cli.ts +147 -66
  54. package/src/completion.ts +0 -4
  55. package/src/d3.ts +40 -2
  56. package/src/dgmo-router.ts +85 -130
  57. package/src/editor/keywords.ts +0 -2
  58. package/src/fonts.ts +3 -2
  59. package/src/gantt/parser.ts +5 -1
  60. package/src/index.ts +24 -1
  61. package/src/infra/parser.ts +1 -1
  62. package/src/internal.ts +6 -2
  63. package/src/journey-map/layout.ts +8 -6
  64. package/src/journey-map/parser.ts +5 -1
  65. package/src/kanban/parser.ts +5 -1
  66. package/src/org/collapse.ts +1 -4
  67. package/src/org/parser.ts +1 -1
  68. package/src/org/renderer.ts +26 -17
  69. package/src/sequence/parser.ts +2 -2
  70. package/src/sequence/participant-inference.ts +0 -1
  71. package/src/sequence/renderer.ts +95 -263
  72. package/src/sharing.ts +0 -1
  73. package/src/sitemap/parser.ts +1 -1
  74. package/src/tech-radar/layout.ts +1 -2
  75. package/src/tech-radar/shared.ts +1 -37
  76. package/src/utils/tag-groups.ts +35 -5
  77. package/src/wireframe/parser.ts +3 -1
  78. package/src/tech-radar/index.ts +0 -14
@@ -89,25 +89,18 @@ For **examples** of real diagrams, call `mcp__dgmo__get_examples("<type>")` —
89
89
 
90
90
  ### Creating a new diagram
91
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" → `gantt`
101
- - "boxes" / "nodes and edges" / "general diagram" → `boxes-and-lines`
102
- - "compare" / "metrics" / "data" → `bar`, `line`, `pie`, etc.
103
- - If genuinely ambiguous, suggest your best guess with a one-line rationale.
92
+ 1. **Pick the right chart type** — always call `mcp__dgmo__suggest_chart_type({ prompt: <user's request> })` first. It returns up to 3 ranked candidates with a confidence banner and matched trigger phrases. Use the top match unless you have a strong reason to override it. If the MCP tool is unavailable (Setup Check fallback path), run `dgmo --chart-types` in a terminal to list supported types and pick from that list.
104
93
  2. **Get syntax + examples** — call `mcp__dgmo__get_language_reference("<type>")` and `mcp__dgmo__get_examples("<type>")`.
105
94
  3. **Write the `.dgmo` content** — compose the markup.
106
95
  4. **Validate first** — call `mcp__dgmo__validate_diagram(dgmo)` to catch syntax errors before rendering. If errors come back, fix them and validate again.
107
- 5. **Open in browser** — call `mcp__dgmo__preview_diagram([{dgmo, title}])` without asking. This is always the right default.
96
+ 5. **Open on online.diagrammo.app** — the **default** visual output. Call `mcp__dgmo__share_diagram(dgmo)` to get a URL, then immediately run `open <url>` in the shell. This lands the user on the web editor where they see the chart AND the code side-by-side, can tweak the markup interactively, and can share the link as-is. Do NOT just print the URL — always `open` it.
97
+
98
+ **Exception — image-output intent detected:** if the user's prompt explicitly asks for an image or saved file (phrases like "save as PNG", "export to SVG", "make an image", "render to a file", "give me a png", "I need an SVG"), skip the share URL and go straight to `mcp__dgmo__render_diagram` (see "Image output" below). The detection is intent-based, not keyword-strict — if in doubt, default to share URL and offer "Want me to save as PNG/SVG instead?"
99
+
100
+ **Side-by-side variants** still use `mcp__dgmo__preview_diagram` (multi-diagram preview is its killer feature). See "Side-by-side variants" below.
108
101
  6. **Save the source file** (if working in a project) — write it to `<name>.dgmo` so the user has an editable copy.
109
102
 
110
- Do not ask the user how they want to view the diagram. Just open it. They can ask for other formats if they want.
103
+ Do not ask the user how they want to view the diagram. Just open the share URL. They can ask for other formats if they want.
111
104
 
112
105
  ### Editing an existing diagram
113
106
 
@@ -117,7 +110,7 @@ When the user asks to modify a `.dgmo` file or says "update this diagram":
117
110
  2. **Understand it** — identify the chart type, key elements, and structure.
118
111
  3. **Make the change** — edit the file using the Edit tool. Preserve the user's style and organization.
119
112
  4. **Validate** — call `mcp__dgmo__validate_diagram(dgmo)` on the updated content.
120
- 5. **Preview** — call `mcp__dgmo__preview_diagram` so the user sees the result immediately.
113
+ 5. **Preview** — call `mcp__dgmo__share_diagram(dgmo)` and `open <url>` so the user sees the result on online.diagrammo.app. (Image-output intent exception applies — if the user asked for a PNG/SVG file explicitly, render to file instead.)
121
114
 
122
115
  Keep the diff minimal — don't rewrite the whole file when adding one element.
123
116
 
@@ -142,7 +135,7 @@ When `validate_diagram` or `render_diagram` returns errors:
142
135
  1. **Read the error messages** — they include line numbers and descriptions.
143
136
  2. **Fix the specific issues** — don't regenerate from scratch unless there are many errors.
144
137
  3. **Validate again** — loop until clean.
145
- 4. **Then render** — only call `preview_diagram` or `render_diagram` after validation passes.
138
+ 4. **Then render** — only call `share_diagram` (default), `preview_diagram` (variants), or `render_diagram` (files) after validation passes.
146
139
 
147
140
  Common fixes:
148
141
  - "Unknown directive" → check spelling, remove colons from directives
@@ -165,17 +158,26 @@ This opens a single page with both diagrams. Use this for:
165
158
  - Different levels of detail
166
159
  - Alternative structures for the same data
167
160
 
168
- ### Other output options (only when explicitly requested)
161
+ ### Image output (when the user explicitly asks for an image/file)
169
162
 
170
- | What the user wants | How to do it |
163
+ Trigger phrases: "save as PNG", "export to SVG", "make an image", "render to a file", "give me a PNG", "I need an SVG", "generate an image". For these, skip the share URL and go straight to file output:
164
+
165
+ | Intent | How to do it |
171
166
  |---|---|
172
- | **Quick look in the desktop app** | `mcp__dgmo__open_in_app(dgmo)` — opens directly in Diagrammo (macOS) |
173
- | **View in macOS Preview** | `mcp__dgmo__render_diagram(dgmo, format:"png", theme:"dark", palette:"nord")` → get temp path → `open <path>` |
174
167
  | **Save as PNG** | `mcp__dgmo__render_diagram(dgmo, format:"png", theme:"dark", palette:"nord")` → returns temp path; offer to copy to their preferred location. Or CLI: `dgmo file.dgmo -o out.png --theme dark --palette nord` |
175
168
  | **Save as SVG** | `mcp__dgmo__render_diagram(dgmo, format:"svg", theme:"dark", palette:"nord")` returns SVG text — write it to the desired path. Or CLI: `dgmo file.dgmo -o out.svg --theme dark --palette nord` |
176
- | **Shareable URL** | `mcp__dgmo__share_diagram(dgmo)` → returns a URL; immediately run `open <url>` — do NOT just display the URL |
169
+ | **View in macOS Preview** | `mcp__dgmo__render_diagram(dgmo, format:"png", theme:"dark", palette:"nord")` → get temp path `open <path>` |
170
+
171
+ ### Other output options (when explicitly requested)
172
+
173
+ | What the user wants | How to do it |
174
+ |---|---|
175
+ | **Quick look in the desktop app** | `mcp__dgmo__open_in_app(dgmo)` — opens directly in Diagrammo (macOS) |
176
+ | **Local HTML preview (not online.diagrammo.app)** | `mcp__dgmo__preview_diagram([{dgmo, title}])` — useful when the user specifically wants a local file or is offline |
177
177
  | **Copy markup to clipboard** | Run `echo '<dgmo markup>' \| pbcopy` |
178
178
 
179
+ (The share URL — `mcp__dgmo__share_diagram` + `open` — is the DEFAULT visual output, not an alternative. See "Creating a new diagram → step 5" above.)
180
+
179
181
  ### Embedding diagrams in docs
180
182
 
181
183
  When the user wants a diagram in a README, PR description, or markdown file:
@@ -199,15 +201,15 @@ for f in diagrams/*.dgmo; do dgmo "$f" -o "${f%.dgmo}.png" --theme dark --palett
199
201
 
200
202
  Or for SVG: replace `.png` with `.svg` in the output.
201
203
 
202
- ### Share link to clipboard
204
+ ### Share link to clipboard (when the user asks for the URL without opening)
203
205
 
204
- After generating a share link, always copy it to the clipboard automatically:
206
+ If the user wants the link in clipboard rather than opened (e.g., they want to paste it into Slack themselves), after generating the share link:
205
207
 
206
208
  ```bash
207
209
  echo '<url>' | pbcopy
208
210
  ```
209
211
 
210
- Then tell the user it's been copied.
212
+ Then tell the user it's been copied. Otherwise, the default is always `open <url>` — that's what step 5 of the main workflow does.
211
213
 
212
214
  ## CLI Reference
213
215
 
@@ -222,42 +224,11 @@ Key options:
222
224
  - `--theme <theme>` — `light` (default), `dark`, `transparent`
223
225
  - `--palette <name>` — `nord` (default), `solarized`, `catppuccin`, `rose-pine`, `gruvbox`, `tokyo-night`, `one-dark`, `bold`
224
226
  - `--copy` — copy the URL to clipboard (use with `-o url`)
225
- - `--no-branding` — omit diagrammo.app branding from exports
226
227
  - `--chart-types` — list all supported chart types
227
228
 
228
229
  ## Supported Chart Types
229
230
 
230
- | Type | Use case |
231
- |------|----------|
232
- | `bar` | Categorical comparisons |
233
- | `line` / `multi-line` / `area` | Trends over time |
234
- | `pie` / `doughnut` | Part-to-whole |
235
- | `radar` / `polar-area` | Multi-dimensional metrics |
236
- | `bar-stacked` | Multi-series categorical |
237
- | `scatter` | 2D data points or bubble chart |
238
- | `sankey` | Flow / allocation |
239
- | `chord` | Circular flow relationships |
240
- | `function` | Mathematical expressions |
241
- | `heatmap` | Matrix intensity |
242
- | `funnel` | Conversion pipeline |
243
- | `slope` | Change between two periods |
244
- | `wordcloud` | Term frequency |
245
- | `arc` | Network relationships |
246
- | `timeline` | Events, eras, date ranges |
247
- | `venn` | Set overlaps |
248
- | `quadrant` | 2x2 positioning matrix |
249
- | `sequence` | Message / interaction flows |
250
- | `flowchart` | Decision trees, process flows |
251
- | `state` | State machine / lifecycle |
252
- | `class` | UML class hierarchies |
253
- | `er` | Database schemas |
254
- | `org` | Hierarchical tree structures |
255
- | `kanban` | Task / workflow columns |
256
- | `c4` | System architecture (context → container → component → deployment) |
257
- | `sitemap` | Website / app navigation structure |
258
- | `infra` | Infrastructure traffic flow with rps computation |
259
- | `gantt` | Project scheduling with dependencies |
260
- | `boxes-and-lines` | General-purpose node-edge diagrams with groups and tags |
231
+ Call `mcp__dgmo__list_chart_types` to see every supported type with descriptions, or `dgmo --chart-types` in a terminal as a CLI fallback. When picking for a new diagram, use `mcp__dgmo__suggest_chart_type` — it scores the full list against the user's prompt (see "Creating a new diagram → step 1").
261
232
 
262
233
  ## Key Syntax Patterns
263
234
 
@@ -273,385 +244,16 @@ palette catppuccin // directives are space-separated (no colon)
273
244
  Inline colors on most elements: append `(colorname)` — e.g. `North(red) 850`, `[Process(blue)]`.
274
245
  Named colors: `red`, `orange`, `yellow`, `green`, `blue`, `purple`, `teal`, `cyan`, `gray`.
275
246
 
276
- ### sequence (most commonly used)
277
-
278
- ```
279
- sequence Auth Flow
280
-
281
- User -Login-> API
282
- API -Find user-> DB
283
- DB -user record-> API
284
- note
285
- Indexed lookup on email column
286
-
287
- if credentials valid
288
- API -200 OK + token-> User
289
- else
290
- API -401 Unauthorized-> User
291
-
292
- == Logout ==
293
-
294
- note session cleanup
295
- User -Logout-> API
296
- API -Delete session-> DB
297
- ```
298
-
299
- - Sync: `A -label-> B` · Async: `A ~label~> B` · Unlabeled: `A -> B`
300
- - Blocks: `if` / `else`, `loop`, `parallel` — closed by indentation (no `end` keyword)
301
- - Notes: place `note text` after a message — it naturally associates with that position.
302
- - Single-line: `note text`
303
- - Multi-line: `note` then indent continuation lines beneath it
304
- - Anchored: `note right of API` then indent continuation lines
305
- - Sections: `== Title ==`
306
- - Groups: `[Group Name]` with indented participants
307
-
308
- ### flowchart
309
-
310
- ```
311
- (Start) -> <Valid Input?>
312
- -yes-> [Process Data] -> (Done)
313
- -no-> /Get Input/ -> <Valid Input?>
314
- ```
315
-
316
- Shapes: `(oval)` `[rect]` `<diamond>` `/parallelogram/` `[[subroutine]]` `[document~]`
317
-
318
- ### bar / line / pie (data charts)
319
-
320
- ```
321
- // bar
322
- bar Revenue by Region
323
- series Revenue
324
- North 850
325
- South 620
326
-
327
- // line (multi-series)
328
- series Sales(red), Costs(blue)
329
- Q1 100, 50
330
- Q2 120, 55
331
-
332
- // pie
333
- pie Market Share
334
- labels percent
335
- Company A 40
336
- Company B 35
337
- ```
338
-
339
- ### er
340
-
341
- ```
342
- users
343
- id int [pk]
344
- email varchar [unique]
345
- 1-writes-* posts
346
-
347
- posts
348
- id int [pk]
349
- author_id int [fk]
350
- ```
351
-
352
- ### org
353
-
354
- ```
355
- CEO
356
- VP Engineering
357
- [Platform Team]
358
- Lead
359
- Dev 1
360
- Dev 2
361
- VP Marketing
362
- ```
363
-
364
- ### infra
365
-
366
- ```
367
- infra
368
-
369
- edge
370
- rps 10000
371
- -> CDN
372
-
373
- CDN
374
- cache-hit 80%
375
- -> API
376
-
377
- API
378
- instances 3
379
- max-rps 500
380
- latency-ms 45
381
- ```
382
-
383
- ### slope
384
-
385
- ```
386
- slope Fleet Strength
387
-
388
- period 1715 1725
389
-
390
- Blackbeard 40 4
391
- Roberts 12 52
392
- Anne Bonny (red) 8 15
393
- ```
394
-
395
- - `period` directive required before data rows (one-line or indented block for multi-token labels)
396
- - Data rows: `Label value1 value2` — space-separated, no colons
397
- - Right-scan: parser takes numeric values from the right, everything left is the label
398
- - Color annotations: `Label (color) value1 value2`
399
-
400
- ### timeline
401
-
402
- ```
403
- timeline Product Roadmap
404
- sort tag:Team
405
-
406
- tag Team alias t
407
- Engineering(blue)
408
- Design(purple)
409
-
410
- era 2024-01 -> 2024-06 Phase 1
411
- marker 2024-03 Beta Launch
412
-
413
- 2024-01->2024-03 Core API | t: Engineering
414
- 2024-02->2024-05 UX Research | t: Design
415
- 2024-06 GA Release | t: Engineering
416
- ```
417
-
418
- - Dates: `YYYY`, `YYYY-MM`, `YYYY-MM-DD`. Ranges: `start->end`. Durations: `start->6m`, `->2w`, `->30d`
419
- - Uncertain end: `2024-03?`. Point events: single date, no range
420
- - `era start -> end Label` — background band. `marker date Label` — vertical line
421
- - `## Group(color)` headers for manual grouping, or `tag` + `sort tag:Name` for swimlanes
422
- - Pipe metadata: `| tagalias: Value`
423
-
424
- ### gantt
425
-
426
- ```
427
- gantt Sprint Plan
428
- start 2024-01-15
429
- today-marker 2024-03-01
430
- critical-path
431
- dependencies
432
-
433
- 10bd Design | 80%
434
- parallel
435
- [Backend]
436
- 15bd API Layer
437
- 5bd? Auth Module
438
- -> Frontend.Integration | offset: -3bd
439
- [Frontend]
440
- 10bd Components
441
- 5bd Integration
442
- 5bd QA Testing
443
- 0d Release
444
- ```
445
-
446
- - `start YYYY-MM-DD` — project start date (required)
447
- - Duration: `10bd Task Name` (business days). Uncertain: `5bd?`. Milestone: `0d`
448
- - `parallel` block for concurrent tracks. `[Group]` for named sections
449
- - Progress: `| 80%` or trailing `80%`
450
- - Dependencies: `-> Target.Task` or `-blocks-> Target.Task`. `offset: -3bd` for overlap
451
- - `today-marker`, `critical-path`, `dependencies` — top-level directives
452
- - Tags + eras + markers same as timeline
453
-
454
- ### c4
247
+ ### Per-chart-type syntax
455
248
 
456
- ```
457
- c4 Banking System
458
-
459
- Customer is a person
460
- description: A customer of the bank
461
-
462
- Banking is a system
463
- description: Online banking portal
464
- containers
465
- WebApp is a container | tech: React
466
- API is a container | tech: Node.js
467
- DB is a container is a database | tech: PostgreSQL
468
-
469
- Email is a system
470
- description: External email service
471
-
472
- Customer -Uses-> Banking
473
- Banking -Sends emails [SMTP]-> Email
474
- ```
475
-
476
- - Elements: `Name is a person|system|container|component`
477
- - Metadata (pipe-delimited): `| description: text, tech: stack`
478
- - Indented `description:` also works (no pipe needed)
479
- - Sections: `containers` (inside system), `components` (inside container), `deployment`
480
- - Deployment: `NodeName is a cloud|database|cache|queue`
481
- - Arrows: sync `-label [tech]->`, async `~label [tech]~>`, bidirectional `<->`, `<~>`
482
-
483
- ### class
484
-
485
- ```
486
- class Type Hierarchy
487
-
488
- Drawable [interface]
489
- + draw(): void
490
-
491
- Shape implements Drawable [abstract]
492
- # x: number
493
- + area(): number
494
- count: number {static}
495
-
496
- Circle extends Shape
497
- - radius: number
498
-
499
- Color [enum]
500
- Red
501
- Green
502
- Blue
503
-
504
- Canvas
505
- *-- Shape : contains
506
- ..> Logger : uses
507
- ```
508
-
509
- - Modifiers: `[abstract]`, `[interface]`, `[enum]`
510
- - Inheritance: `Child extends Parent`, `Child implements Interface`
511
- - Visibility: `+` public, `#` protected, `-` private. Static: `{static}`
512
- - Relationships: `A *-- B` (composition), `A o-- B` (aggregation), `A --|> B` (inheritance), `A ..|> B` (implementation), `A ..> B` (dependency), `A -> B` (association)
513
- - Optional label: `A *-- B : description`
514
-
515
- ### venn
516
-
517
- ```
518
- venn Full-Stack Skills
519
-
520
- Frontend(blue) alias fe
521
- Backend(green) alias be
522
- DevOps(orange) alias de
523
-
524
- fe + be Web Systems
525
- be + de Platform Ops
526
- fe + be + de Full Stack
527
- ```
528
-
529
- - Sets: `Name(color) alias id` — declares a circle
530
- - Overlaps: `id + id Label` — names the intersection region
531
- - Option: `values on` to show sizes. Sized form: `id(color): 120 "Label"`
532
-
533
- ### quadrant
534
-
535
- ```
536
- quadrant Feature Priorities
537
-
538
- x-label Low Effort, High Effort
539
- y-label Low Impact, High Impact
540
-
541
- top-left Quick Wins(green)
542
- top-right Major Projects
543
- bottom-left Fill-ins
544
- bottom-right Avoid(red)
545
-
546
- Dark Mode (blue) 0.25, 0.85
547
- API v2 0.8, 0.9
548
- Fix Typos 0.1, 0.15
549
- ```
550
-
551
- - Axis labels: `x-label Low, High` and `y-label Low, High`
552
- - Quadrant labels: `top-left`, `top-right`, `bottom-left`, `bottom-right`
553
- - Data: `Label (color) x, y` where x,y are 0–1
554
-
555
- ### sankey / chord
249
+ For every specific chart type (sequence, flowchart, bar/line/pie, scatter, er, org, infra, slope, timeline, gantt, c4, class, venn, quadrant, sankey/chord, state, boxes-and-lines, and the rest), do not guess from prior knowledge — call the MCP tools:
556
250
 
557
251
  ```
558
- // sankey flow diagram
559
- sankey Budget Allocation
560
-
561
- Revenue (green)
562
- Costs: 600
563
- Profit (blue): 400
564
-
565
- // arrow syntax also works
566
- Revenue -> Marketing: 200
567
-
568
- // chord — same syntax, circular layout
569
- chord Team Collaboration
570
- Engineering -> Design 85
571
- Design -> Product 68
252
+ mcp__dgmo__get_language_reference("<type>") // authoritative grammar + directives
253
+ mcp__dgmo__get_examples("<type>") // real starter templates from the gallery
572
254
  ```
573
255
 
574
- - Indented syntax: parent child with `Target: weight`
575
- - Arrow syntax: `Source -> Target: weight` (sankey) or `Source -> Target weight` (chord)
576
- - Node colors: `Name (color)`. Link colors: `Target: 600 (red)`
577
-
578
- ### state
579
-
580
- ```
581
- state Order Lifecycle
582
- direction LR
583
-
584
- [*] -> Pending -submit-> Validating
585
-
586
- Validating
587
- -approved-> Processing
588
- -rejected-> Cancelled(red)
589
-
590
- ## Fulfillment(blue)
591
- Processing -ship-> Shipped
592
- Shipped -delivered-> Done
593
-
594
- Cancelled -> [*]
595
- Done -> [*]
596
- ```
597
-
598
- - `[*]` — start/end pseudostate (filled circle)
599
- - Transitions: `A -> B`, `A -label-> B`, `A -(color)-> B`
600
- - Chains: `A -> B -> C` on one line
601
- - Indented transitions use parent as source
602
- - Groups: `## GroupName(color)` with indented states
603
- - Options: `direction LR` (left-right) or `TB` (top-bottom, default)
604
-
605
- ### scatter
606
-
607
- ```
608
- scatter Funding vs Revenue
609
- x-label Funding ($M)
610
- y-label Revenue ($M)
611
-
612
- [SaaS](blue)
613
- Acme 12, 8.5
614
- DataSync 5.2, 3.1
615
-
616
- [Fintech](green)
617
- PayFlow 45, 32
618
- LendTech 18, 12.5
619
- ```
620
-
621
- - Data: `Label x, y` or `Label x, y, size` (bubble chart)
622
- - Groups: `[Category](color)` headers
623
- - Options: `labels on`, `xlabel`, `ylabel`, `sizelabel`
624
-
625
- ### boxes-and-lines
626
-
627
- ```
628
- boxes-and-lines Architecture
629
-
630
- tag Team t Backend(blue), Frontend(green), Platform(purple)
631
- active-tag Team
632
- direction LR
633
-
634
- API Gateway | t: Backend
635
- -routes-> AuthService
636
- -queries-> DB
637
-
638
- AuthService | t: Backend
639
- DB | t: Platform
640
-
641
- [Cloud]
642
- API Gateway
643
- AuthService
644
-
645
- Redis <-syncs-> DB | t: Platform
646
- ```
647
-
648
- - Nodes: explicit `Name | metadata` or implicit from edges
649
- - Edges: `A -label-> B` (directed), `A <-label-> B` (bidirectional)
650
- - Indented edges use parent as source: `Parent` then ` -label-> Target`
651
- - Groups: `[Name]` with indented children (max 2 levels deep)
652
- - Tags: `tag Name alias Value1(color), Value2(color)` + `active-tag Name` + `hide alias:value`
653
- - Options: `direction LR` (left-right) or `TB` (top-bottom, default)
654
- - Shape inference: names containing DB/database → cylinder, Cache/Redis → diamond, Queue → hexagon, etc.
256
+ Both ship inside `@diagrammo/dgmo` and always reflect the installed version, so they never drift from the actual parsers. This replaces the per-type sections that used to live here and went stale every time a chart type's syntax evolved.
655
257
 
656
258
  ## Anti-Patterns
657
259
 
@@ -671,13 +273,23 @@ tag: Group ❌ use `tag Group` (no colon)
671
273
  note: text ❌ use `note text` (no colon)
672
274
  ```
673
275
 
276
+ **Data-chart style (back-compat tolerated, but not idiomatic — don't generate these):**
277
+
278
+ ```
279
+ Q1 100, 200, 300 ⚠ prefer space-separated: `Q1 100 200 300`
280
+ series A (red), B (blue), C (green) ⚠ for ≥2 series, prefer the indented block:
281
+ series
282
+ A (red)
283
+ B (blue)
284
+ C (green)
285
+ ```
286
+
674
287
  ## Tips
675
288
 
676
289
  - Default theme: `dark`, default palette: `nord` — use these unless the user requests otherwise.
677
290
  - Always validate before rendering — `validate_diagram` is much faster than a failed render.
678
291
  - Always call `get_examples` before generating an unfamiliar chart type — real examples beat guessing.
679
292
  - Stdin mode for quick renders: `echo "..." | dgmo -o out.png`
680
- - For C4, `--c4-level` drills from context → containers → components → deployment.
681
293
  - When auto-detection picks the wrong chart type, add an explicit type as the first word on the first line.
682
294
  - `mcp__dgmo__preview_diagram` accepts multiple diagrams at once — useful for showing variants side by side.
683
295
  - When the user says "diagram this" while looking at code, read the code first and pick the chart type yourself — don't ask.
package/.cursorrules CHANGED
@@ -121,9 +121,9 @@ API Gateway | t: Backend
121
121
 
122
122
  Nodes: implicit from edges or explicit with `| metadata`. Edges: `A -label-> B`, `A <-label-> B` (bidi). Groups: `[Name]` with indented children (max 2 levels). Tags: `tag Name alias values`, `active-tag`, `hide`. Options: `direction LR|TB`.
123
123
 
124
- ## All 33 chart types
124
+ ## Supported chart types
125
125
 
126
- bar, line, multi-line, area, pie, doughnut, radar, polar-area, bar-stacked, scatter, sankey, chord, function, heatmap, funnel, slope, wordcloud, arc, timeline, venn, quadrant, sequence, flowchart, state, class, er, org, kanban, c4, sitemap, infra, gantt, boxes-and-lines
126
+ If the dgmo MCP server is configured, call `list_chart_types` for the authoritative list (with descriptions) and `suggest_chart_type({ prompt })` to pick the best match for a request. Otherwise run `dgmo --chart-types` in a terminal. The static list previously here drifted with every new chart type the MCP tool / CLI is the source of truth.
127
127
 
128
128
  ## Common patterns
129
129
 
package/.windsurfrules CHANGED
@@ -121,9 +121,9 @@ API Gateway | t: Backend
121
121
 
122
122
  Nodes: implicit from edges or explicit with `| metadata`. Edges: `A -label-> B`, `A <-label-> B` (bidi). Groups: `[Name]` with indented children (max 2 levels). Tags: `tag Name alias values`, `active-tag`, `hide`. Options: `direction LR|TB`.
123
123
 
124
- ## All 33 chart types
124
+ ## Supported chart types
125
125
 
126
- bar, line, multi-line, area, pie, doughnut, radar, polar-area, bar-stacked, scatter, sankey, chord, function, heatmap, funnel, slope, wordcloud, arc, timeline, venn, quadrant, sequence, flowchart, state, class, er, org, kanban, c4, sitemap, infra, gantt, boxes-and-lines
126
+ If the dgmo MCP server is configured, call `list_chart_types` for the authoritative list (with descriptions) and `suggest_chart_type({ prompt })` to pick the best match for a request. Otherwise run `dgmo --chart-types` in a terminal. The static list previously here drifted with every new chart type the MCP tool / CLI is the source of truth.
127
127
 
128
128
  ## Common patterns
129
129
 
package/AGENTS.md CHANGED
@@ -15,12 +15,15 @@ This installs the MCP server and writes the dgmo config to `.codex/config.toml`.
15
15
  ## MCP Tools
16
16
 
17
17
  When the `dgmo` MCP server is configured, use these tools directly:
18
- - `preview_diagram` — renders diagram(s) and opens a live HTML preview in the browser (default for showing diagrams)
18
+ - `suggest_chart_type` — first call when creating a new diagram; ranks the best chart types for a plain-English prompt
19
+ - `list_chart_types` — lists every supported chart type with descriptions
20
+ - `get_language_reference` — fetches full syntax for any chart type (call this before generating an unfamiliar chart type)
21
+ - `get_examples` — real example diagrams from the gallery; useful as few-shot references
22
+ - `validate_diagram` — fast syntax check before rendering (much cheaper than a failed render)
19
23
  - `render_diagram` — renders to PNG or SVG, returns file path
24
+ - `preview_diagram` — renders diagram(s) and opens a live HTML preview in the browser
20
25
  - `share_diagram` — creates a shareable diagrammo.app URL
21
26
  - `open_in_app` — opens diagram in Diagrammo desktop app (macOS)
22
- - `list_chart_types` — lists all 34 supported chart types with descriptions
23
- - `get_language_reference` — fetches full syntax for any chart type (call this before generating an unfamiliar chart type)
24
27
  - `generate_report` — renders multiple diagrams into an HTML report with table of contents
25
28
 
26
29
  ## When to use dgmo
@@ -113,9 +116,9 @@ API
113
116
  latency-ms: 45
114
117
  ```
115
118
 
116
- ## All 33 chart types
119
+ ## Supported chart types
117
120
 
118
- bar, line, multi-line, area, pie, doughnut, radar, polar-area, bar-stacked, scatter, sankey, chord, function, heatmap, funnel, slope, wordcloud, arc, timeline, venn, quadrant, sequence, flowchart, state, class, er, org, kanban, c4, sitemap, infra, gantt, boxes-and-lines
121
+ Call `list_chart_types` for the authoritative list with descriptions, or `suggest_chart_type({ prompt })` to rank candidates against a user request. The static list previously here drifted with every new chart type the MCP tool is the source of truth.
119
122
 
120
123
  ### Boxes and lines
121
124
  ```