@diagrammo/dgmo 0.34.0 → 0.36.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.
Files changed (55) hide show
  1. package/.claude/commands/dgmo.md +41 -43
  2. package/.github/copilot-instructions.md +1 -1
  3. package/README.md +7 -1
  4. package/SKILL.md +12 -7
  5. package/dist/advanced.cjs +460 -463
  6. package/dist/advanced.d.cts +2 -51
  7. package/dist/advanced.d.ts +2 -51
  8. package/dist/advanced.js +460 -464
  9. package/dist/auto.cjs +461 -140
  10. package/dist/auto.js +91 -91
  11. package/dist/auto.mjs +461 -140
  12. package/dist/cli.cjs +143 -326
  13. package/dist/index.cjs +460 -139
  14. package/dist/index.js +460 -139
  15. package/docs/ai-integration.md +47 -25
  16. package/docs/language-reference.md +2 -2
  17. package/package.json +2 -2
  18. package/src/advanced.ts +0 -12
  19. package/src/c4/parser.ts +15 -6
  20. package/src/chart.ts +1 -1
  21. package/src/class/parser.ts +6 -2
  22. package/src/cli-banner.ts +2 -3
  23. package/src/cli.ts +539 -1223
  24. package/src/cycle/parser.ts +4 -1
  25. package/src/dgmo-router.ts +16 -2
  26. package/src/diagnostics.ts +0 -0
  27. package/src/echarts.ts +5 -1
  28. package/src/er/parser.ts +5 -1
  29. package/src/gantt/parser.ts +13 -4
  30. package/src/graph/flowchart-parser.ts +5 -1
  31. package/src/graph/state-parser.ts +5 -1
  32. package/src/infra/parser.ts +10 -6
  33. package/src/journey-map/parser.ts +5 -2
  34. package/src/kanban/parser.ts +6 -2
  35. package/src/map/context-labels.ts +29 -19
  36. package/src/map/layout.ts +403 -108
  37. package/src/map/legend-band.ts +28 -0
  38. package/src/map/parser.ts +13 -4
  39. package/src/map/renderer.ts +74 -23
  40. package/src/map/resolver.ts +2 -2
  41. package/src/org/parser.ts +8 -2
  42. package/src/pyramid/parser.ts +4 -1
  43. package/src/raci/parser.ts +4 -1
  44. package/src/ring/parser.ts +4 -1
  45. package/src/sequence/parser.ts +6 -3
  46. package/src/sitemap/parser.ts +12 -3
  47. package/src/tech-radar/parser.ts +6 -3
  48. package/src/utils/parsing.ts +2 -2
  49. package/src/utils/tag-groups.ts +3 -3
  50. package/src/visualizations/parse.ts +9 -3
  51. package/src/migrate/data-comma.ts +0 -117
  52. package/src/migrate/embedded.ts +0 -238
  53. package/src/migrate/index.ts +0 -295
  54. package/src/migrate/line-classifier.ts +0 -128
  55. package/src/migrate/line-transformer.ts +0 -218
@@ -18,37 +18,15 @@ If the MCP tools are **not** available, run the setup flow below — do not ask
18
18
  which dgmo || npm install -g @diagrammo/dgmo
19
19
  ```
20
20
 
21
- ### Step 2 — Install the MCP server (if missing)
21
+ ### Step 2 — Run the one-step installer
22
22
 
23
23
  ```bash
24
- which dgmo-mcp || npm install -g @diagrammo/dgmo-mcp
24
+ dgmo install claude-code
25
25
  ```
26
26
 
27
- ### Step 3 — Configure the MCP server
27
+ That single command writes this skill, configures the MCP server in `~/.claude/settings.json` (entry: `{ "command": "dgmo", "args": ["mcp"] }`), and ensures the server is available — no prompts, no separate `dgmo-mcp` package to install. (Use `--scope project` to write `.mcp.json` in the current directory instead of the global settings.)
28
28
 
29
- Ask the user:
30
-
31
- > "Where should I configure the MCP server?
32
- > 1) This project only — write `.mcp.json` here [default]
33
- > 2) Globally — add to `~/.claude/settings.json` (works in all projects)"
34
-
35
- **Option 1 (default):** Create or update `.mcp.json` in the current working directory:
36
-
37
- ```json
38
- {
39
- "mcpServers": {
40
- "dgmo": {
41
- "command": "dgmo-mcp"
42
- }
43
- }
44
- }
45
- ```
46
-
47
- If `.mcp.json` already exists and has other servers, merge the `dgmo` entry in — do not overwrite the file.
48
-
49
- **Option 2 (global):** Add the `dgmo` entry to the `mcpServers` object in `~/.claude/settings.json`. Read the file first and merge — do not overwrite other keys.
50
-
51
- ### Step 4 — Prompt restart
29
+ ### Step 3 — Prompt restart
52
30
 
53
31
  Tell the user:
54
32
 
@@ -56,7 +34,7 @@ Tell the user:
56
34
 
57
35
  Then proceed with the user's original request using CLI fallback (see "Other output options" below).
58
36
 
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.
37
+ > **One-step from a fresh machine:** `dgmo install` with no target auto-detects and sets up every AI assistant you have (Claude Code, Codex, Claude Desktop, Cursor, Windsurf, Copilot) at once.
60
38
 
61
39
  ## Project Awareness
62
40
 
@@ -85,22 +63,33 @@ For **examples** of real diagrams, call `mcp__dgmo__get_examples("<type>")` —
85
63
 
86
64
  ## Your Workflow
87
65
 
88
- **Primary goal: get the user seeing a visualization as fast as possible.**
66
+ **Primary goal: get the user seeing a visualization as fast as possible — in the desktop app if they have it, otherwise on the web.**
67
+
68
+ ### Where the diagram goes — decide this once per session
69
+
70
+ Before showing the first diagram, call `mcp__dgmo__check_app_installed()` **once** and remember the answer for the rest of the session. It decides your default visual output:
71
+
72
+ - **App installed → open the saved file live in the app.** Save the `.dgmo` source first (see "Always save the source"), then `mcp__dgmo__open_in_app({ dgmo, filePath: "<absolute path to the saved file>" })`. The app opens *that file*, so the user edits it in the app and changes autosave back to the same file — one source of truth, live re-render. Do NOT open an online URL and do NOT render a PNG.
73
+ - **App not installed → open the online editor.** `mcp__dgmo__share_diagram(dgmo)` then `open <url>` in the shell. This lands the user on online.diagrammo.app with the chart and the code side-by-side, tweakable and shareable. Don't just print the URL — always `open` it.
74
+
75
+ **Always save the source.** Whether or not the app is installed, write the diagram to `<name>.dgmo` in the current project/working directory so the user always has one editable artifact. Use a short kebab-case name from the diagram's title (e.g. `checkout-flow.dgmo`). This file IS the deliverable; the app or URL just displays it.
76
+
77
+ **Never render an image unless the user explicitly asks** (see "Image output"). A PNG/SVG is not a default output — don't create files the user didn't request.
78
+
79
+ Don't ask the user how they want to view the diagram — the check above decides it. They can ask for a PNG, the desktop app, or a share URL explicitly if they want something else.
89
80
 
90
81
  ### Creating a new diagram
91
82
 
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.
83
+ 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 types` in a terminal and pick from that list — do not pick from memory or assume a requested type is unsupported (see "Supported Chart Types" below).
93
84
  2. **Get syntax + examples** — call `mcp__dgmo__get_language_reference("<type>")` and `mcp__dgmo__get_examples("<type>")`.
94
85
  3. **Write the `.dgmo` content** — compose the markup.
95
86
  4. **Validate first** — call `mcp__dgmo__validate_diagram(dgmo)` to catch syntax errors before rendering. If errors come back, fix them and validate again.
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.
87
+ 5. **Save the source** — write the validated markup to `<name>.dgmo` in the working directory.
88
+ 6. **Show it** — per "Where the diagram goes": app installed → `mcp__dgmo__open_in_app({ dgmo, filePath })`; not installed → `mcp__dgmo__share_diagram(dgmo)` + `open <url>`.
97
89
 
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?"
90
+ **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"), still save the `.dgmo` source, then go to `mcp__dgmo__render_diagram` (see "Image output") instead of step 6. Detection is intent-based — if in doubt, use the step-6 default and offer "Want me to save as PNG/SVG instead?"
99
91
 
100
- **Side-by-side variants** still use `mcp__dgmo__preview_diagram` (multi-diagram preview is its killer feature). See "Side-by-side variants" below.
101
- 6. **Save the source file** (if working in a project) — write it to `<name>.dgmo` so the user has an editable copy.
102
-
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.
92
+ **Side-by-side variants** use `mcp__dgmo__preview_diagram` (multi-diagram preview is its killer feature). See "Side-by-side variants" below.
104
93
 
105
94
  ### Editing an existing diagram
106
95
 
@@ -110,7 +99,7 @@ When the user asks to modify a `.dgmo` file or says "update this diagram":
110
99
  2. **Understand it** — identify the chart type, key elements, and structure.
111
100
  3. **Make the change** — edit the file using the Edit tool. Preserve the user's style and organization.
112
101
  4. **Validate** — call `mcp__dgmo__validate_diagram(dgmo)` on the updated content.
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.)
102
+ 5. **Show it** — per "Where the diagram goes": app installed → `mcp__dgmo__open_in_app({ dgmo, filePath: "<the file you just edited>" })` so it re-renders live in the app; not installed → `mcp__dgmo__share_diagram(dgmo)` + `open <url>`. (Image-output exception applies — if the user asked for a PNG/SVG file explicitly, render to file instead.)
114
103
 
115
104
  Keep the diff minimal — don't rewrite the whole file when adding one element.
116
105
 
@@ -172,11 +161,12 @@ Trigger phrases: "save as PNG", "export to SVG", "make an image", "render to a f
172
161
 
173
162
  | What the user wants | How to do it |
174
163
  |---|---|
175
- | **Quick look in the desktop app** | `mcp__dgmo__open_in_app(dgmo)` — opens directly in Diagrammo (macOS) |
164
+ | **Open in the desktop app (no saved file)** | `mcp__dgmo__open_in_app({ dgmo })` — deep-links an ephemeral copy into Diagrammo. Prefer the `filePath` form (open the saved file) whenever you've saved the source. |
165
+ | **Force the online editor even though the app is installed** | `mcp__dgmo__share_diagram(dgmo)` + `open <url>` |
176
166
  | **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
167
  | **Copy markup to clipboard** | Run `echo '<dgmo markup>' \| pbcopy` |
178
168
 
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.)
169
+ (The default visual output is decided by `check_app_installed` — open the saved file in the app when installed, otherwise the online share URL. See "Where the diagram goes" above. The options here are for when the user explicitly asks for something else.)
180
170
 
181
171
  ### Embedding diagrams in docs
182
172
 
@@ -209,26 +199,33 @@ If the user wants the link in clipboard rather than opened (e.g., they want to p
209
199
  echo '<url>' | pbcopy
210
200
  ```
211
201
 
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.
202
+ Then tell the user it's been copied. Otherwise, the default visual output is the app-aware behavior from "Where the diagram goes" (open the saved file in the app when installed, else `open <url>`).
213
203
 
214
204
  ## CLI Reference
215
205
 
216
206
  ```
217
207
  dgmo <input.dgmo> [options]
218
208
  cat input.dgmo | dgmo [options]
209
+ dgmo share <input.dgmo> # shareable diagrammo.app URL (copies to clipboard)
210
+ dgmo types # list all supported chart types
219
211
  ```
220
212
 
221
213
  Key options:
222
214
  - `-o <file>` — output file; format inferred from extension (`.svg` → SVG, else PNG)
223
- - `-o url` — output a shareable diagrammo.app URL
224
215
  - `--theme <theme>` — `light` (default), `dark`, `transparent`
225
216
  - `--palette <name>` — `slate` (default), `atlas`, `blueprint`, `catppuccin`, `nord`, `tidewater`, `tokyo-night`
226
- - `--copy` — copy the URL to clipboard (use with `-o url`)
227
- - `--chart-types` — list all supported chart types
217
+ - `--json` — output structured JSON
228
218
 
229
219
  ## Supported Chart Types
230
220
 
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").
221
+ **There are ~45 chart types. The authoritative, complete list comes ONLY from the live tool — never from memory and never from any prose list in this skill.** Any chart types named elsewhere in this document (in examples, tips, or the "diagram this" table) are illustrative, NOT the full set. dgmo supports many specialized types people don't expect — including `journey-map`, `mindmap`, `pert`, `raci`, `pyramid`, `wireframe`, `ring`, `tech-radar`, `cycle`, and more.
222
+
223
+ **Hard rule:** before telling the user a chart type "doesn't exist," isn't supported, or that you'll use "the closest fit instead" — you MUST first query the live list:
224
+
225
+ - MCP active: `mcp__dgmo__list_chart_types` (full list + descriptions), and `mcp__dgmo__suggest_chart_type({ prompt })` to pick.
226
+ - MCP unavailable: run `dgmo types` in a terminal.
227
+
228
+ If the user asks for a named visualization (e.g. "user journey", "mind map", "RACI matrix"), assume dgmo supports it and verify against the live list — do not substitute a different type unless the list confirms the requested one is genuinely absent.
232
229
 
233
230
  ## Key Syntax Patterns
234
231
 
@@ -286,6 +283,7 @@ series A (red), B (blue), C (green) ⚠ for ≥2 series, prefer the indented b
286
283
 
287
284
  ## Tips
288
285
 
286
+ - Output target: call `mcp__dgmo__check_app_installed()` once per session. App installed → save the `.dgmo` and open that file live in the app (`open_in_app` with `filePath`); not installed → online share URL. Always save the source either way; never render a PNG unless asked.
289
287
  - Default palette: `slate` — use it unless the user requests otherwise.
290
288
  - Always validate before rendering — `validate_diagram` is much faster than a failed render.
291
289
  - Always call `get_examples` before generating an unfamiliar chart type — real examples beat guessing.
@@ -573,7 +573,7 @@ The canonical, ordered list lives in `src/chart-types.ts`.
573
573
 
574
574
  ```bash
575
575
  dgmo file.dgmo -o output.svg # SVG
576
- dgmo file.dgmo -o url # shareable link
576
+ dgmo share file.dgmo # shareable link (copied to clipboard)
577
577
  dgmo file.dgmo --json # structured JSON output
578
578
  ```
579
579
 
package/README.md CHANGED
@@ -110,7 +110,13 @@ Using a docs framework? First-class plugins wrap all of this:
110
110
 
111
111
  ## Use it from your AI tool
112
112
 
113
- There's an MCP server ([`@diagrammo/dgmo-mcp`](https://www.npmjs.com/package/@diagrammo/dgmo-mcp)) so Claude, Cursor, and other agents can author and render DGMO directly. Setup: **[diagrammo.app/ai](https://diagrammo.app/ai)**.
113
+ Claude, Cursor, Codex, and other agents can author and render DGMO directly. One command sets up every assistant you have — no second package, no prompts:
114
+
115
+ ```bash
116
+ dgmo install
117
+ ```
118
+
119
+ It auto-detects Claude Code, Codex, Claude Desktop, Cursor, Windsurf, and Copilot and wires each one to the bundled MCP server. More: **[diagrammo.app/ai](https://diagrammo.app/ai)**.
114
120
 
115
121
  ## Chart types
116
122
 
package/SKILL.md CHANGED
@@ -429,14 +429,19 @@ era 1718-05-08 -> 1718-05-17 Blockade Active blue
429
429
  **Fetch more:** call `get_language_reference(type)` for a type's full syntax and `get_examples(type)` for starter templates. `suggest_chart_type` returns the chosen type's reference automatically.
430
430
  <!-- DGMO-AI-CORE:END -->
431
431
 
432
- ## MCP Tools — preferred order
432
+ ## Output — where the diagram goes
433
433
 
434
- When the `dgmo` MCP server is configured, prefer tools in this order:
435
- 1. `open_in_app` — opens the diagram in the Diagrammo desktop app (macOS). **Best UX** — chart + editor side-by-side, full editing.
436
- 2. `share_diagram` — returns a `https://online.diagrammo.app/...` URL. Tell the user to open it; same chart + editor view in the browser. **Preferred fallback** when the desktop app is not available.
437
- 3. `render_diagram` — renders to PNG or SVG and returns a file path. Use when the user wants an image artifact (export, embed, attach).
434
+ **Always save the `.dgmo` source** to `<name>.dgmo` in the working directory — it's the editable deliverable; the app/URL just displays it. **Never render a PNG/SVG unless the user explicitly asks** for an image.
435
+
436
+ Decide the visual output **once per session** with `check_app_installed`:
437
+
438
+ 1. **App installed →** save the source, then `open_in_app({ dgmo, filePath: "<abs path to the saved file>" })`. The app opens *that file*, so in-app edits autosave back to it — one source of truth, live re-render. **Best UX.** Don't open an online URL and don't render a PNG.
439
+ 2. **App not installed →** `share_diagram` returns a `https://online.diagrammo.app/...` URL; `open` it. Same chart + editor view in the browser. **Preferred fallback.**
440
+
441
+ Other tools (use only when the user asks for them):
442
+ 3. `render_diagram` — PNG or SVG to a file path. Use when the user wants an image artifact (export, embed, attach).
438
443
  4. `generate_report` — renders multiple diagrams into an HTML report with table of contents.
439
- 5. `preview_diagram` — local HTML preview in the browser. Last resort — only when none of the above fit.
444
+ 5. `preview_diagram` — local HTML preview in the browser; also the multi-diagram side-by-side tool.
440
445
  6. `list_chart_types` / `get_language_reference` — discovery; call `get_language_reference` before generating an unfamiliar chart type.
441
446
 
442
447
  ## When to use dgmo
@@ -548,7 +553,7 @@ API
548
553
 
549
554
  ```bash
550
555
  dgmo file.dgmo -o output.svg # SVG
551
- dgmo file.dgmo -o url # shareable link
556
+ dgmo share file.dgmo # shareable link (copied to clipboard)
552
557
  dgmo file.dgmo --json # structured JSON output
553
558
  ```
554
559