@diagrammo/dgmo 0.61.0 → 0.62.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 (47) hide show
  1. package/README.md +1 -1
  2. package/dist/advanced.d.ts +382 -396
  3. package/dist/advanced.js +135 -21
  4. package/dist/auto.js +143 -142
  5. package/dist/block.js +6 -5
  6. package/dist/{chart-meta-gUwAzi7N.d.ts → chart-meta-D98NbYDp.d.ts} +1 -1
  7. package/dist/chart-meta.d.ts +2 -2
  8. package/dist/chart-meta.js +1 -1
  9. package/dist/{charts-d3-MN6QCYKU.js → charts-d3-3WMDA5Z5.js} +3 -3
  10. package/dist/{chunk-OPBZYISB.js → chunk-37EHGTQ2.js} +2204 -2018
  11. package/dist/{chunk-ZDFIY6WX.js → chunk-3PVUGECM.js} +1 -2
  12. package/dist/{chunk-6CWNVQPW.js → chunk-4C3BTTOL.js} +2 -2
  13. package/dist/{chunk-4B5YISOR.js → chunk-536EBUPG.js} +16 -1
  14. package/dist/{chunk-VHO3YBTB.js → chunk-CVVICCSB.js} +24 -2
  15. package/dist/{chunk-BSJIPMPG.js → chunk-DHIBVN2D.js} +28 -17
  16. package/dist/{chunk-MOT3NXB5.js → chunk-FVYHDZ6Q.js} +2 -2
  17. package/dist/{chunk-S23HOUJS.js → chunk-JU2VMFYC.js} +2 -2
  18. package/dist/{chunk-5PWIV7ZF.js → chunk-LFAQ4BLZ.js} +2 -2
  19. package/dist/{chunk-DNSEG6P2.js → chunk-PJDX4IKR.js} +2 -2
  20. package/dist/{chunk-2WPLOS4Q.js → chunk-USHDV2AF.js} +2 -2
  21. package/dist/{registry-Ch0Umdi1.d.ts → dgmo-router-Dd5PTjxl.d.ts} +98 -98
  22. package/dist/{dgmo-router-UVYAJCAF.js → dgmo-router-Z5N6QLIC.js} +2 -2
  23. package/dist/{dimensions-QCPOPPKE.js → dimensions-ES6O2T4H.js} +4 -4
  24. package/dist/element.js +144 -143
  25. package/dist/index.d.ts +21 -10
  26. package/dist/index.js +10 -20
  27. package/dist/{renderer-IYMA5W7X.js → renderer-A5GFW2XH.js} +4 -4
  28. package/dist/{renderer-R6OKKSVR.js → renderer-Q2YHQQSN.js} +4 -4
  29. package/dist/{resolver-W3WKLWDP.js → resolver-ZLYSMILY.js} +3 -3
  30. package/dist/{themes-DC6u80yr.d.ts → themes-DiUAG4Bf.d.ts} +37 -2
  31. package/docs/ai-integration.md +5 -5
  32. package/package.json +2 -21
  33. package/.claude/commands/dgmo-codebase-report.md +0 -172
  34. package/.claude/commands/dgmo-diagram-this.md +0 -60
  35. package/.claude/commands/dgmo-document-project.md +0 -128
  36. package/.claude/commands/dgmo.md +0 -313
  37. package/.cursorrules +0 -587
  38. package/.github/copilot-instructions.md +0 -597
  39. package/.windsurfrules +0 -587
  40. package/SKILL.md +0 -573
  41. package/dist/auto.d.ts +0 -60
  42. package/dist/auto.mjs +0 -88466
  43. package/dist/chunk-6MTWIQVO.js +0 -121
  44. package/dist/cli.cjs +0 -489
  45. package/dist/element.d.ts +0 -68
  46. package/dist/element.mjs +0 -88332
  47. package/dist/load-data-EHDDZ5ZS.js +0 -8
@@ -1,128 +0,0 @@
1
- # /dgmo-document-project — Generate Diagrams for a Codebase
2
-
3
- You are generating a suite of DGMO diagrams that document the user's project. Your goal is to read the codebase, understand its architecture, and produce 3–6 diagrams that capture how the system works.
4
-
5
- ## Prerequisites
6
-
7
- Before starting, verify that the DGMO MCP tools are available by calling `mcp__dgmo__list_chart_types`. If the tools are not available, tell the user to run `/dgmo` first to set up the MCP server, then come back to this command.
8
-
9
- ## Step 1 — Understand the Project
10
-
11
- Read these files (skip any that don't exist):
12
-
13
- 1. **README.md** or **README** — project purpose and overview
14
- 2. **package.json** / **Cargo.toml** / **go.mod** / **pyproject.toml** / **requirements.txt** — tech stack and dependencies
15
- 3. **docker-compose.yml** / **Dockerfile** / **k8s/** / **terraform/** — infrastructure
16
- 4. **src/** or **app/** directory listing — code structure
17
- 5. **.env.example** or config files — external services and integrations
18
-
19
- From this, determine:
20
- - What the project does (one sentence)
21
- - The tech stack (language, framework, database, message broker, etc.)
22
- - Key modules or services
23
- - External dependencies and integrations
24
- - Data models (if database-backed)
25
-
26
- ## Step 2 — Decide Which Diagrams to Generate
27
-
28
- Pick 3–6 diagrams based on what the project actually has. Don't force a diagram type that doesn't fit. Use this decision matrix:
29
-
30
- | Signal in codebase | Diagram type | What to show |
31
- |---|---|---|
32
- | Multiple services, APIs, or modules | **c4** (context or container) | System components and their relationships |
33
- | REST/GraphQL endpoints, API handlers | **sequence** | 1–2 key request flows (e.g., auth, main business operation) |
34
- | Database models, ORM entities, schema files | **er** | Entity relationships and key fields |
35
- | Docker, k8s, cloud infra, load balancers | **infra** | Traffic flow and infrastructure components |
36
- | State machines, workflow engines, status fields | **state** | Key state transitions |
37
- | Multiple packages or layers | **flowchart** | Request lifecycle or data flow |
38
- | Microservices with message queues | **sequence** | Async event flow between services |
39
-
40
- **Rules:**
41
- - Always include a C4 context or container diagram — every project benefits from a high-level view
42
- - Prefer sequence diagrams for showing **behavior** (how things interact at runtime)
43
- - Prefer ER diagrams only if there's a real database schema to document
44
- - Don't generate infra diagrams for projects without infrastructure config
45
- - Don't generate more than 2 sequence diagrams — pick the most important flows
46
-
47
- ## Step 3 — Get Syntax Help
48
-
49
- For each diagram type you'll generate, call:
50
-
51
- ```
52
- mcp__dgmo__get_language_reference("<type>")
53
- ```
54
-
55
- Also call `mcp__dgmo__get_examples("<type>")` to see real examples of that chart type. Use these as patterns — they show idiomatic DGMO style.
56
-
57
- ## Step 4 — Generate the Diagrams
58
-
59
- Write the DGMO markup for each diagram. Follow these rules:
60
-
61
- - **Keep diagrams focused** — a C4 diagram with 5–8 components is better than one with 20
62
- - **Use real names from the codebase** — actual service names, model names, endpoint paths
63
- - **Lean on inference** — don't declare participant types unless the name doesn't match (e.g., `User` auto-infers as actor, `PostgresDB` as database)
64
- - **Add tags for color coding** when there are natural groupings (teams, domains, layers)
65
- - **Title every diagram** — the title goes on the first line after the chart type
66
-
67
- ### Syntax reminders (no colons in directives or data):
68
- ```
69
- sequence Auth Flow // first line: type + title
70
- tag Layer as l // tag declaration (use `as`)
71
- Frontend blue // color is trailing token (no parens)
72
- Backend green
73
-
74
- User -POST /login-> API // sync arrow
75
- API ~publish~> Queue // async arrow
76
- note Validates JWT // note (no colon)
77
- ```
78
-
79
- ## Step 5 — Validate Before Rendering
80
-
81
- For each diagram, call `mcp__dgmo__validate_diagram(dgmo)` to check for errors. Fix any issues before proceeding.
82
-
83
- ## Step 6 — Generate the Report
84
-
85
- Once all diagrams validate, bundle them into a report:
86
-
87
- ```
88
- mcp__dgmo__generate_report({
89
- title: "<Project Name> — Architecture Diagrams",
90
- subtitle: "Auto-generated from codebase analysis",
91
- sections: [
92
- { title: "System Context (C4)", description: "High-level view of ...", dgmo: "..." },
93
- { title: "Auth Flow", description: "How authentication works", dgmo: "..." },
94
- ...
95
- ],
96
- theme: "dark",
97
- palette: "slate",
98
- include_source: true,
99
- open: true
100
- })
101
- ```
102
-
103
- ## Step 7 — Save Source Files
104
-
105
- Write each diagram to a `diagrams/` directory in the project root:
106
-
107
- - `diagrams/c4-context.dgmo`
108
- - `diagrams/sequence-auth.dgmo`
109
- - `diagrams/er-schema.dgmo`
110
- - etc.
111
-
112
- Use descriptive filenames. Create the `diagrams/` directory if it doesn't exist.
113
-
114
- ## Step 8 — Report to the User
115
-
116
- Summarize what was generated:
117
-
118
- 1. List each diagram with a one-line description
119
- 2. Mention the HTML report was opened in the browser
120
- 3. Note the saved `.dgmo` files in `diagrams/`
121
- 4. Suggest which diagrams might be worth expanding or adding next
122
-
123
- ## Important Notes
124
-
125
- - This skill works with **any** project — not just TypeScript or JavaScript
126
- - Don't ask the user what diagrams to generate — make the decision based on what you find in the code. They can request changes after.
127
- - If the project is very small (single file, script), generate just 1–2 diagrams instead of forcing 6
128
- - If you can't determine the project structure, ask the user to point you at the main source directory
@@ -1,313 +0,0 @@
1
- # dgmo — Diagrammo Diagram Assistant
2
-
3
- You are helping the user author, render, and share diagrams using the `dgmo` CLI and `.dgmo` file format.
4
-
5
- ## What is dgmo?
6
-
7
- `dgmo` is a CLI tool and library that renders `.dgmo` diagram files to PNG, SVG, or shareable URLs. Diagrams are written in a plain-text DSL.
8
-
9
- ## Setup Check — Run This First
10
-
11
- **Before doing anything else**, check whether the MCP tools are available in this session by attempting to call `mcp__dgmo__list_chart_types`. If that tool exists and succeeds, skip this section entirely.
12
-
13
- If the MCP tools are **not** available, run the setup flow below — do not ask the user, just do it:
14
-
15
- ### Step 1 — Install the CLI (if missing)
16
-
17
- ```bash
18
- which dgmo || npm install -g @diagrammo/dgmo
19
- ```
20
-
21
- ### Step 2 — Run the one-step installer
22
-
23
- ```bash
24
- dgmo install claude-code
25
- ```
26
-
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
-
29
- ### Step 3 — Prompt restart
30
-
31
- Tell the user:
32
-
33
- > "Done. **Restart Claude Code** to activate the MCP server — diagram preview and rendering will be available in the next session."
34
-
35
- Then proceed with the user's original request using CLI fallback (see "Other output options" below).
36
-
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.
38
-
39
- ## Project Awareness
40
-
41
- At the start of a session (or when the user first invokes `/dgmo`), scan for existing `.dgmo` files:
42
-
43
- ```bash
44
- find . -name '*.dgmo' -not -path '*/node_modules/*' -not -path '*/.git/*' 2>/dev/null | head -20
45
- ```
46
-
47
- 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."
48
-
49
- Don't block on this — if no files found, just proceed.
50
-
51
- ## Getting Syntax Help
52
-
53
- **Always use the MCP tool first** if it's available in this session:
54
-
55
- ```
56
- mcp__dgmo__get_language_reference // full reference
57
- mcp__dgmo__get_language_reference("sequence") // specific chart type
58
- ```
59
-
60
- This is the authoritative, always-up-to-date syntax reference. Use it before guessing syntax.
61
-
62
- 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.
63
-
64
- ## Your Workflow
65
-
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.
80
-
81
- ### Creating a new diagram
82
-
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).
84
- 2. **Get syntax + examples** — call `mcp__dgmo__get_language_reference("<type>")` and `mcp__dgmo__get_examples("<type>")`.
85
- 3. **Write the `.dgmo` content** — compose the markup.
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.
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>`.
89
-
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?"
91
-
92
- **Side-by-side variants** use `mcp__dgmo__preview_diagram` (multi-diagram preview is its killer feature). See "Side-by-side variants" below.
93
-
94
- ### Editing an existing diagram
95
-
96
- When the user asks to modify a `.dgmo` file or says "update this diagram":
97
-
98
- 1. **Read the file** — use the Read tool to get the current content.
99
- 2. **Understand it** — identify the chart type, key elements, and structure.
100
- 3. **Make the change** — edit the file using the Edit tool. Preserve the user's style and organization.
101
- 4. **Validate** — call `mcp__dgmo__validate_diagram(dgmo)` on the updated content.
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.)
103
-
104
- Keep the diff minimal — don't rewrite the whole file when adding one element.
105
-
106
- ### Diagramming from code
107
-
108
- When the user says "diagram this", "diagram this file", or "show me how X works":
109
-
110
- 1. **Read the relevant source code** — the file, function, or module they're pointing at.
111
- 2. **Choose the best diagram type** based on what the code does:
112
- - API handler / controller → `sequence` showing the request flow
113
- - Database models / ORM entities → `er` showing relationships
114
- - State machine / status enum → `state` showing transitions
115
- - Module imports / service dependencies → `c4` or `flowchart`
116
- - Infrastructure config (Docker, k8s, terraform) → `infra`
117
- 3. **Extract real names** — use actual function names, service names, model names from the code.
118
- 4. **Generate, validate, preview** — same as creating a new diagram.
119
-
120
- ### Error recovery
121
-
122
- When `validate_diagram` or `render_diagram` returns errors:
123
-
124
- 1. **Read the error messages** — they include line numbers and descriptions.
125
- 2. **Fix the specific issues** — don't regenerate from scratch unless there are many errors.
126
- 3. **Validate again** — loop until clean.
127
- 4. **Then render** — only call `share_diagram` (default), `preview_diagram` (variants), or `render_diagram` (files) after validation passes.
128
-
129
- Common fixes:
130
- - "Unknown directive" → check spelling, remove colons from directives
131
- - "Expected number" → data rows use spaces not colons: `Label 100` not `Label: 100`
132
- - Duplicate name → parentheses strip color from display name; `App (TS)` and `App (Rust)` both become `App`
133
-
134
- ### Side-by-side variants
135
-
136
- When the user asks to compare layouts, themes, or approaches:
137
-
138
- ```
139
- mcp__dgmo__preview_diagram([
140
- { title: "Option A — Detailed", dgmo: "..." },
141
- { title: "Option B — Simplified", dgmo: "..." }
142
- ])
143
- ```
144
-
145
- This opens a single page with both diagrams. Use this for:
146
- - Light vs dark theme comparisons
147
- - Different levels of detail
148
- - Alternative structures for the same data
149
-
150
- ### Image output (when the user explicitly asks for an image/file)
151
-
152
- 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:
153
-
154
- | Intent | How to do it |
155
- |---|---|
156
- | **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` |
157
- | **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` |
158
- | **View in macOS Preview** | `mcp__dgmo__render_diagram(dgmo, format:"png", theme:"dark", palette:"nord")` → get temp path → `open <path>` |
159
-
160
- ### Other output options (when explicitly requested)
161
-
162
- | What the user wants | How to do it |
163
- |---|---|
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>` |
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 |
167
- | **Copy markup to clipboard** | Run `echo '<dgmo markup>' \| pbcopy` |
168
-
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.)
170
-
171
- ### Embedding diagrams in docs
172
-
173
- When the user wants a diagram in a README, PR description, or markdown file:
174
-
175
- 1. **Generate a share URL** — `mcp__dgmo__share_diagram(dgmo)` returns a `diagrammo.app` URL.
176
- 2. **Render a PNG** — `mcp__dgmo__render_diagram(dgmo, format:"png", theme:"light", palette:"nord")` returns a temp path.
177
- 3. **Insert into markdown** — either:
178
- - Copy the PNG to the project (e.g. `docs/images/auth-flow.png`) and reference it: `![Auth Flow](docs/images/auth-flow.png)`
179
- - Use the share URL directly: `![Auth Flow](https://diagrammo.app/d#...)`
180
- 4. **For PRs** — prefer share URLs (no binary file to commit). For README/docs — prefer committed PNGs (they work offline).
181
-
182
- Always generate both light and dark variants if the doc will be viewed in both modes, or use `theme:"transparent"` for universal backgrounds.
183
-
184
- ### Batch rendering
185
-
186
- When the user asks to render all diagrams in a directory:
187
-
188
- ```bash
189
- for f in diagrams/*.dgmo; do dgmo "$f" -o "${f%.dgmo}.png" --theme dark --palette nord; done
190
- ```
191
-
192
- Or for SVG: replace `.png` with `.svg` in the output.
193
-
194
- ### Share link to clipboard (when the user asks for the URL without opening)
195
-
196
- 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:
197
-
198
- ```bash
199
- echo '<url>' | pbcopy
200
- ```
201
-
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>`).
203
-
204
- ## CLI Reference
205
-
206
- ```
207
- dgmo <input.dgmo> [options]
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
211
- ```
212
-
213
- Key options:
214
- - `-o <file>` — output file; format inferred from extension (`.svg` → SVG, else PNG)
215
- - `--theme <theme>` — `light` (default), `dark`, `transparent`
216
- - `--palette <name>` — `slate` (default), `atlas`, `blueprint`, `catppuccin`, `nord`, `tidewater`, `tokyo-night`
217
- - `--json` — output structured JSON
218
-
219
- ## Supported Chart Types
220
-
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.
229
-
230
- ## Key Syntax Patterns
231
-
232
- ### Common to all diagrams
233
-
234
- ```
235
- sequence Auth Flow // first line: chart type + optional title
236
- palette catppuccin // directives are space-separated (no colon)
237
-
238
- // This is a comment (only // syntax — not #)
239
- ```
240
-
241
- Inline colors on most elements: append `(colorname)` — e.g. `North(red) 850`, `[Process(blue)]`.
242
- Named colors: `red`, `orange`, `yellow`, `green`, `blue`, `purple`, `teal`, `cyan`, `gray`.
243
-
244
- ### Per-chart-type syntax
245
-
246
- 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:
247
-
248
- ```
249
- mcp__dgmo__get_language_reference("<type>") // authoritative grammar + directives
250
- mcp__dgmo__get_examples("<type>") // real starter templates from the gallery
251
- ```
252
-
253
- 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.
254
-
255
- ## Anti-Patterns
256
-
257
- ```
258
- # comment ❌ use // comment
259
- async A -> B: msg ❌ use A ~msg~> B
260
- A <- B ❌ left-pointing arrows removed — use B -> A
261
- parallel else ❌ not supported — use separate parallel blocks
262
- == Foo(#ff0000) == ❌ hex colors not supported — use named colors: == Foo(red) ==
263
- A -routes to /api-> B ❌ -> inside a label is ambiguous — rephrase the label
264
- end ❌ not needed — indentation closes blocks in sequence diagrams
265
- chart: sequence ❌ use `sequence Title` as the first line (no colon)
266
- title: My Diagram ❌ title goes on the first line after chart type
267
- series: A, B ❌ use `series A, B` (no colon)
268
- Label: 100 ❌ use `Label 100` (no colon in data rows)
269
- tag: Group ❌ use `tag Group` (no colon)
270
- note: text ❌ use `note text` (no colon)
271
- ```
272
-
273
- **Data-chart style (back-compat tolerated, but not idiomatic — don't generate these):**
274
-
275
- ```
276
- Q1 100, 200, 300 ⚠ prefer space-separated: `Q1 100 200 300`
277
- series A (red), B (blue), C (green) ⚠ for ≥2 series, prefer the indented block:
278
- series
279
- A (red)
280
- B (blue)
281
- C (green)
282
- ```
283
-
284
- ## Tips
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.
287
- - Default palette: `slate` — use it unless the user requests otherwise.
288
- - Always validate before rendering — `validate_diagram` is much faster than a failed render.
289
- - Always call `get_examples` before generating an unfamiliar chart type — real examples beat guessing.
290
- - Stdin mode for quick renders: `echo "..." | dgmo -o out.png`
291
- - When auto-detection picks the wrong chart type, add an explicit type as the first word on the first line.
292
- - `mcp__dgmo__preview_diagram` accepts multiple diagrams at once — useful for showing variants side by side.
293
- - When the user says "diagram this" while looking at code, read the code first and pick the chart type yourself — don't ask.
294
-
295
- ## Related Commands
296
-
297
- Tell the user about these when relevant:
298
-
299
- - **`/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?"
300
- - **`/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.
301
-
302
- ## AI Integrations Beyond Claude Code
303
-
304
- 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:
305
-
306
- - **Cursor** — `.cursorrules` file provides DGMO syntax context to the AI
307
- - **Windsurf** — `.windsurfrules` file works the same way with Cascade
308
- - **GitHub Copilot** — `.github/copilot-instructions.md` teaches Copilot the syntax
309
- - **OpenAI Codex CLI** — `AGENTS.md` + `.codex/config.toml` configuration
310
-
311
- 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.
312
-
313
- The MCP server (`@diagrammo/dgmo-mcp`) also works with **Claude Desktop** and any MCP-compatible client — not just Claude Code.