@diagrammo/dgmo 0.2.27 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/skills/dgmo-chart/SKILL.md +107 -0
- package/.claude/skills/dgmo-flowchart/SKILL.md +61 -0
- package/.claude/skills/dgmo-generate/SKILL.md +58 -0
- package/.claude/skills/dgmo-sequence/SKILL.md +83 -0
- package/.cursorrules +117 -0
- package/.github/copilot-instructions.md +117 -0
- package/.windsurfrules +117 -0
- package/README.md +10 -3
- package/dist/cli.cjs +366 -918
- package/dist/index.cjs +581 -396
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +39 -24
- package/dist/index.d.ts +39 -24
- package/dist/index.js +578 -395
- package/dist/index.js.map +1 -1
- package/docs/ai-integration.md +125 -0
- package/docs/language-reference.md +786 -0
- package/package.json +15 -8
- package/src/c4/parser.ts +90 -74
- package/src/c4/renderer.ts +13 -12
- package/src/c4/types.ts +6 -4
- package/src/chart.ts +3 -2
- package/src/class/layout.ts +17 -12
- package/src/class/parser.ts +22 -52
- package/src/class/renderer.ts +44 -46
- package/src/class/types.ts +1 -1
- package/src/cli.ts +130 -19
- package/src/d3.ts +1 -1
- package/src/dgmo-mermaid.ts +1 -1
- package/src/dgmo-router.ts +1 -1
- package/src/echarts.ts +33 -13
- package/src/er/parser.ts +34 -43
- package/src/er/types.ts +1 -1
- package/src/graph/flowchart-parser.ts +2 -25
- package/src/graph/types.ts +1 -1
- package/src/index.ts +5 -0
- package/src/initiative-status/parser.ts +36 -7
- package/src/initiative-status/types.ts +1 -1
- package/src/kanban/parser.ts +32 -53
- package/src/kanban/renderer.ts +9 -8
- package/src/kanban/types.ts +6 -14
- package/src/org/parser.ts +47 -87
- package/src/org/resolver.ts +11 -12
- package/src/sequence/parser.ts +97 -15
- package/src/sequence/renderer.ts +62 -69
- package/src/utils/arrows.ts +75 -0
- package/src/utils/inline-markdown.ts +75 -0
- package/src/utils/parsing.ts +67 -0
- package/src/utils/tag-groups.ts +76 -0
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# DGMO AI Integration Guide
|
|
2
|
+
|
|
3
|
+
Use AI coding tools to generate `.dgmo` diagrams. This guide covers Claude Code, Copilot, Cursor, and other AI tools.
|
|
4
|
+
|
|
5
|
+
## MCP Server
|
|
6
|
+
|
|
7
|
+
`@diagrammo/dgmo-mcp` provides an MCP server that exposes DGMO rendering, sharing, and documentation tools. Works with Claude Desktop, Claude Code, and any MCP-compatible client.
|
|
8
|
+
|
|
9
|
+
5 tools: `render_diagram`, `share_diagram`, `open_in_app`, `list_chart_types`, `get_language_reference`.
|
|
10
|
+
|
|
11
|
+
Setup (Claude Code — add to `.claude/settings.local.json`):
|
|
12
|
+
|
|
13
|
+
```json
|
|
14
|
+
{
|
|
15
|
+
"mcpServers": {
|
|
16
|
+
"dgmo": {
|
|
17
|
+
"command": "npx",
|
|
18
|
+
"args": ["-y", "@diagrammo/dgmo-mcp"]
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
See `dgmo-mcp/README.md` for full configuration options.
|
|
25
|
+
|
|
26
|
+
## Claude Code — Skills
|
|
27
|
+
|
|
28
|
+
Copy the `.claude/skills/dgmo-*` directories from this repo into your project's `.claude/skills/` directory. This gives you four slash commands:
|
|
29
|
+
|
|
30
|
+
| Command | What it does |
|
|
31
|
+
|---------|-------------|
|
|
32
|
+
| `/dgmo-generate <description>` | Picks the best diagram type automatically |
|
|
33
|
+
| `/dgmo-sequence <flow>` | Generates a sequence diagram |
|
|
34
|
+
| `/dgmo-flowchart <process>` | Generates a flowchart |
|
|
35
|
+
| `/dgmo-chart <data description>` | Generates a data chart |
|
|
36
|
+
|
|
37
|
+
### Setup
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
# Copy skills into your project
|
|
41
|
+
cp -r node_modules/@diagrammo/dgmo/.claude/skills/dgmo-* .claude/skills/
|
|
42
|
+
|
|
43
|
+
# Or if dgmo is installed globally
|
|
44
|
+
cp -r $(npm root -g)/@diagrammo/dgmo/.claude/skills/dgmo-* .claude/skills/
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Usage examples
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
/dgmo-generate an ER diagram for a blog with users, posts, and comments
|
|
51
|
+
/dgmo-sequence the OAuth2 authorization code flow
|
|
52
|
+
/dgmo-flowchart CI/CD pipeline with build, test, and deploy stages
|
|
53
|
+
/dgmo-chart quarterly revenue: Q1 100, Q2 120, Q3 110, Q4 130
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Claude Code — CLAUDE.md snippet
|
|
57
|
+
|
|
58
|
+
Add this to your project's `CLAUDE.md` to teach Claude about DGMO without installing skills:
|
|
59
|
+
|
|
60
|
+
```markdown
|
|
61
|
+
## DGMO Diagrams
|
|
62
|
+
|
|
63
|
+
When the user asks for a diagram, generate a `.dgmo` file. DGMO is a text-based diagram language.
|
|
64
|
+
|
|
65
|
+
Quick reference:
|
|
66
|
+
- Sequence: `A -> B: message` or `A -message-> B`
|
|
67
|
+
- Flowchart: `(Start) -> [Process] -> <Decision?> -yes-> (End)`
|
|
68
|
+
- Bar chart: `chart: bar` then `Label: value` lines
|
|
69
|
+
- ER diagram: `chart: er` then table definitions and `table1 1--* table2` relationships
|
|
70
|
+
- Org chart: `chart: org` then indented hierarchy
|
|
71
|
+
|
|
72
|
+
Full reference: see `node_modules/@diagrammo/dgmo/docs/language-reference.md`
|
|
73
|
+
|
|
74
|
+
Render with: `dgmo file.dgmo -o output.svg` or `dgmo file.dgmo -o url` for shareable link.
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Other AI Tools — Prompt Files
|
|
78
|
+
|
|
79
|
+
DGMO ships prompt files for popular AI coding tools. These are included in the npm package:
|
|
80
|
+
|
|
81
|
+
| File | Tool | How it works |
|
|
82
|
+
|------|------|-------------|
|
|
83
|
+
| `.github/copilot-instructions.md` | GitHub Copilot | Auto-loaded in repos with this file |
|
|
84
|
+
| `.cursorrules` | Cursor | Auto-loaded when present in project root |
|
|
85
|
+
| `.windsurfrules` | Windsurf | Auto-loaded when present in project root |
|
|
86
|
+
|
|
87
|
+
### Setup
|
|
88
|
+
|
|
89
|
+
Copy the relevant file into your project root:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
# From node_modules
|
|
93
|
+
cp node_modules/@diagrammo/dgmo/.cursorrules .
|
|
94
|
+
cp node_modules/@diagrammo/dgmo/.windsurfrules .
|
|
95
|
+
mkdir -p .github && cp node_modules/@diagrammo/dgmo/.github/copilot-instructions.md .github/
|
|
96
|
+
|
|
97
|
+
# Or from global install
|
|
98
|
+
cp $(npm root -g)/@diagrammo/dgmo/.cursorrules .
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Each file contains a condensed DGMO syntax reference with examples for the most common diagram types, all 29 chart types listed, rendering commands, and common mistakes to avoid.
|
|
102
|
+
|
|
103
|
+
## Rendering
|
|
104
|
+
|
|
105
|
+
If the `dgmo` CLI is installed, diagrams can be rendered:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
# Install
|
|
109
|
+
npm install -g @diagrammo/dgmo # or: brew install diagrammo/dgmo/dgmo
|
|
110
|
+
|
|
111
|
+
# Render
|
|
112
|
+
dgmo diagram.dgmo # PNG output
|
|
113
|
+
dgmo diagram.dgmo -o output.svg # SVG output
|
|
114
|
+
dgmo diagram.dgmo -o url # Shareable URL
|
|
115
|
+
|
|
116
|
+
# AI-friendly JSON output
|
|
117
|
+
dgmo diagram.dgmo -o output.svg --json
|
|
118
|
+
dgmo --chart-types --json # List all chart types
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Supported chart types
|
|
122
|
+
|
|
123
|
+
Run `dgmo --chart-types` for the full list, or see `docs/language-reference.md`.
|
|
124
|
+
|
|
125
|
+
29 types: bar, line, area, pie, doughnut, radar, polar-area, bar-stacked, scatter, sankey, chord, function, heatmap, funnel, slope, wordcloud, arc, timeline, venn, quadrant, sequence, flowchart, class, er, org, kanban, c4, initiative-status.
|