@diagrammo/dgmo 0.6.1 → 0.6.2
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.md +76 -0
- package/dist/cli.cjs +160 -159
- package/dist/index.cjs +780 -147
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +780 -147
- package/dist/index.js.map +1 -1
- package/docs/ai-integration.md +33 -50
- package/package.json +4 -3
- package/src/c4/layout.ts +68 -5
- package/src/cli.ts +124 -2
- package/src/er/classify.ts +206 -0
- package/src/er/layout.ts +259 -94
- package/src/er/renderer.ts +231 -17
- package/src/infra/layout.ts +60 -13
- package/src/infra/renderer.ts +375 -32
- package/src/initiative-status/layout.ts +46 -30
- package/.claude/skills/dgmo-chart/SKILL.md +0 -141
- package/.claude/skills/dgmo-flowchart/SKILL.md +0 -61
- package/.claude/skills/dgmo-generate/SKILL.md +0 -59
- package/.claude/skills/dgmo-sequence/SKILL.md +0 -104
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: dgmo-chart
|
|
3
|
-
description: Generate a DGMO data chart (bar, line, pie, scatter, heatmap, etc.) from data or metrics.
|
|
4
|
-
argument-hint: <data description or chart type>
|
|
5
|
-
allowed-tools: Read, Write, Bash, Glob, Grep
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
# Generate DGMO Data Chart
|
|
9
|
-
|
|
10
|
-
Generate a data visualization chart from metrics, data, or a description.
|
|
11
|
-
|
|
12
|
-
## Instructions
|
|
13
|
-
|
|
14
|
-
1. Understand the data and visualization goal from `$ARGUMENTS`
|
|
15
|
-
2. If referencing data files, read them to extract the values
|
|
16
|
-
3. Choose the best chart type:
|
|
17
|
-
- Categorical comparisons → `bar` or `bar-stacked`
|
|
18
|
-
- Trends over time → `line` or `area`
|
|
19
|
-
- Proportions → `pie` or `doughnut`
|
|
20
|
-
- Multi-dimensional → `radar`
|
|
21
|
-
- Correlations → `scatter`
|
|
22
|
-
- Matrix data → `heatmap`
|
|
23
|
-
- Flows/allocations → `sankey`
|
|
24
|
-
- Conversion funnels → `funnel`
|
|
25
|
-
- Before/after → `slope`
|
|
26
|
-
- Math functions → `function`
|
|
27
|
-
- Set overlaps → `venn`
|
|
28
|
-
- Priority matrices → `quadrant`
|
|
29
|
-
4. Generate valid DGMO syntax
|
|
30
|
-
|
|
31
|
-
## Chart Syntax Examples
|
|
32
|
-
|
|
33
|
-
**Bar chart**:
|
|
34
|
-
```
|
|
35
|
-
chart: bar
|
|
36
|
-
title: Revenue by Region
|
|
37
|
-
series: Revenue
|
|
38
|
-
xlabel: Region
|
|
39
|
-
ylabel: USD
|
|
40
|
-
|
|
41
|
-
North: 850
|
|
42
|
-
South: 620
|
|
43
|
-
East: 1100
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
**Multi-series line**:
|
|
47
|
-
```
|
|
48
|
-
title: Quarterly Performance
|
|
49
|
-
series: Sales(red), Costs(blue)
|
|
50
|
-
|
|
51
|
-
Q1: 100, 50
|
|
52
|
-
Q2: 120, 55
|
|
53
|
-
Q3: 110, 60
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
**Pie chart**:
|
|
57
|
-
```
|
|
58
|
-
chart: pie
|
|
59
|
-
title: Market Share
|
|
60
|
-
labels: percent
|
|
61
|
-
|
|
62
|
-
Company A: 40
|
|
63
|
-
Company B: 35
|
|
64
|
-
Company C: 25
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
**Scatter plot** (with categories):
|
|
68
|
-
```
|
|
69
|
-
chart: scatter
|
|
70
|
-
title: Performance
|
|
71
|
-
xlabel: Experience
|
|
72
|
-
ylabel: Output
|
|
73
|
-
|
|
74
|
-
## Senior(blue)
|
|
75
|
-
Alice: 7, 92
|
|
76
|
-
Bob: 9, 88
|
|
77
|
-
|
|
78
|
-
## Junior(green)
|
|
79
|
-
Carol: 2, 70
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
**Sankey** (arrow syntax):
|
|
83
|
-
```
|
|
84
|
-
chart: sankey
|
|
85
|
-
title: Energy Flow
|
|
86
|
-
|
|
87
|
-
Coal -> Electricity: 50
|
|
88
|
-
Gas -> Electricity: 30
|
|
89
|
-
Electricity -> Industry: 45
|
|
90
|
-
Electricity -> Homes: 35
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
**Sankey** (indentation + colors):
|
|
94
|
-
```
|
|
95
|
-
chart: sankey
|
|
96
|
-
title: Budget Flow
|
|
97
|
-
|
|
98
|
-
Revenue (green)
|
|
99
|
-
Operating Costs (red): 600
|
|
100
|
-
R&D (blue): 250
|
|
101
|
-
Profit (green): 150
|
|
102
|
-
|
|
103
|
-
Operating Costs
|
|
104
|
-
Salaries: 400
|
|
105
|
-
Infrastructure: 200 (orange)
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
**Heatmap**:
|
|
109
|
-
```
|
|
110
|
-
chart: heatmap
|
|
111
|
-
title: Activity
|
|
112
|
-
columns: Mon, Tue, Wed, Thu, Fri
|
|
113
|
-
|
|
114
|
-
Team A: 5, 4, 5, 3, 4
|
|
115
|
-
Team B: 2, 3, 2, 4, 3
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
## Common patterns
|
|
119
|
-
|
|
120
|
-
- `series: Name1(color1), Name2(color2)` — multi-series with colors
|
|
121
|
-
- Multi-line values: leave the value empty and indent each entry on its own line
|
|
122
|
-
```
|
|
123
|
-
series:
|
|
124
|
-
Name1 (color1)
|
|
125
|
-
Name2 (color2)
|
|
126
|
-
```
|
|
127
|
-
- `Label(color): value` — per-item colors
|
|
128
|
-
- `labels: percent` — show percentages on pie/doughnut
|
|
129
|
-
- `orientation: horizontal` — rotate bar charts
|
|
130
|
-
- Data is always `Label: value` or `Label: v1, v2, v3` for multi-series
|
|
131
|
-
- Sankey: `Source -> Target: value` or indent targets under a bare source label
|
|
132
|
-
- Sankey colors: `Node (color)` for nodes, `value (color)` for links
|
|
133
|
-
|
|
134
|
-
## Output
|
|
135
|
-
|
|
136
|
-
Write to a descriptive `.dgmo` file, then check if `dgmo` CLI is available (`command -v dgmo`). If not installed, tell the user:
|
|
137
|
-
- `brew install diagrammo/dgmo/dgmo` (macOS, recommended)
|
|
138
|
-
- `npm install -g @diagrammo/dgmo`
|
|
139
|
-
- Or: `npx @diagrammo/dgmo <file>.dgmo`
|
|
140
|
-
|
|
141
|
-
If available, offer to render: `dgmo <file>.dgmo -o <file>.svg` or `dgmo <file>.dgmo -o url`
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: dgmo-flowchart
|
|
3
|
-
description: Generate a DGMO flowchart from a process description, decision tree, or code logic.
|
|
4
|
-
argument-hint: <process or logic to diagram>
|
|
5
|
-
allowed-tools: Read, Write, Bash, Glob, Grep
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
# Generate DGMO Flowchart
|
|
9
|
-
|
|
10
|
-
Analyze a process, decision tree, or code logic and generate a `.dgmo` flowchart.
|
|
11
|
-
|
|
12
|
-
## Instructions
|
|
13
|
-
|
|
14
|
-
1. Understand the process from `$ARGUMENTS`
|
|
15
|
-
2. If referencing code, explore the codebase to understand the logic
|
|
16
|
-
3. Generate a valid DGMO flowchart
|
|
17
|
-
|
|
18
|
-
## Flowchart Syntax
|
|
19
|
-
|
|
20
|
-
```
|
|
21
|
-
chart: flowchart
|
|
22
|
-
title: Process Name
|
|
23
|
-
|
|
24
|
-
(Start) -> <Decision?>
|
|
25
|
-
-yes-> [Process A] -> [[Subroutine]]
|
|
26
|
-
-no-> /Get Input/ -> <Decision?>
|
|
27
|
-
[[Subroutine]] -> [Document~] -> (Done)
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
**Node shapes**:
|
|
31
|
-
- `(Terminal)` — oval (start/end)
|
|
32
|
-
- `[Process]` — rectangle
|
|
33
|
-
- `<Decision?>` — diamond
|
|
34
|
-
- `/Input Output/` — parallelogram
|
|
35
|
-
- `[[Subroutine]]` — double-bordered rectangle
|
|
36
|
-
- `[Document~]` — document shape (wavy bottom, note the `~`)
|
|
37
|
-
|
|
38
|
-
**Arrows**:
|
|
39
|
-
- `-label-> Target` — labeled connection
|
|
40
|
-
- `-yes->`, `-no->` — decision branches
|
|
41
|
-
- `-(red)-> Target` — colored arrow
|
|
42
|
-
- `-label(red)-> Target` — labeled + colored
|
|
43
|
-
|
|
44
|
-
**Colors**: Append `(colorname)` to nodes: `[Process(blue)]`
|
|
45
|
-
|
|
46
|
-
**Chaining**: Multiple nodes on one line: `(Start) -> [A] -> [B] -> (End)`
|
|
47
|
-
|
|
48
|
-
**Key rules**:
|
|
49
|
-
- Use indentation for decision branches
|
|
50
|
-
- Each decision branch starts with `-label->`
|
|
51
|
-
- Node names can contain spaces
|
|
52
|
-
- Use named colors only (not hex)
|
|
53
|
-
|
|
54
|
-
## Output
|
|
55
|
-
|
|
56
|
-
Write to a descriptive `.dgmo` file, then check if `dgmo` CLI is available (`command -v dgmo`). If not installed, tell the user:
|
|
57
|
-
- `brew install diagrammo/dgmo/dgmo` (macOS, recommended)
|
|
58
|
-
- `npm install -g @diagrammo/dgmo`
|
|
59
|
-
- Or: `npx @diagrammo/dgmo <file>.dgmo`
|
|
60
|
-
|
|
61
|
-
If available, offer to render: `dgmo <file>.dgmo -o <file>.svg` or `dgmo <file>.dgmo -o url`
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: dgmo-generate
|
|
3
|
-
description: Generate a DGMO diagram from a natural language description. Picks the best chart/diagram type automatically.
|
|
4
|
-
argument-hint: <description of what to diagram>
|
|
5
|
-
allowed-tools: Read, Write, Bash
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
# Generate DGMO Diagram
|
|
9
|
-
|
|
10
|
-
Generate a `.dgmo` diagram file based on the user's description. Pick the best diagram type for what they're describing.
|
|
11
|
-
|
|
12
|
-
## Instructions
|
|
13
|
-
|
|
14
|
-
1. Read the user's description from `$ARGUMENTS`
|
|
15
|
-
2. Read the full DGMO language reference at `docs/language-reference.md` (relative to the repo root of the `dgmo` package, or find it via `npm root -g`/`node_modules/@diagrammo/dgmo/docs/language-reference.md`)
|
|
16
|
-
3. Choose the best chart/diagram type based on the description:
|
|
17
|
-
- Interactions between services/people → `sequence`
|
|
18
|
-
- Decision trees, processes → `flowchart`
|
|
19
|
-
- Hierarchies, org structures → `org`
|
|
20
|
-
- Database schemas → `er`
|
|
21
|
-
- Class/type hierarchies → `class`
|
|
22
|
-
- System architecture → `c4`
|
|
23
|
-
- Infrastructure traffic flow → `infra`
|
|
24
|
-
- Task boards → `kanban`
|
|
25
|
-
- Project roadmaps → `initiative-status`
|
|
26
|
-
- Comparisons, data → `bar`, `line`, `pie`, etc.
|
|
27
|
-
- Flows, allocations → `sankey`
|
|
28
|
-
- Relationships → `arc` or `chord`
|
|
29
|
-
- Timelines → `timeline`
|
|
30
|
-
- Set overlaps → `venn`
|
|
31
|
-
- Priority matrices → `quadrant`
|
|
32
|
-
4. Generate valid DGMO syntax following the language reference exactly
|
|
33
|
-
5. Write the output to a descriptive `.dgmo` file (e.g., `auth-flow.dgmo`, `db-schema.dgmo`)
|
|
34
|
-
|
|
35
|
-
## After generating
|
|
36
|
-
|
|
37
|
-
Check if `dgmo` CLI is available:
|
|
38
|
-
```bash
|
|
39
|
-
command -v dgmo 2>/dev/null
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
If **not installed**, tell the user how to install it:
|
|
43
|
-
- `brew install diagrammo/dgmo/dgmo` (macOS, recommended)
|
|
44
|
-
- `npm install -g @diagrammo/dgmo`
|
|
45
|
-
- Or run without installing: `npx @diagrammo/dgmo <file>.dgmo`
|
|
46
|
-
|
|
47
|
-
If available (or after install), offer to render:
|
|
48
|
-
```bash
|
|
49
|
-
dgmo <file>.dgmo -o <file>.svg
|
|
50
|
-
dgmo <file>.dgmo -o url # shareable link
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
## Common mistakes to avoid
|
|
54
|
-
|
|
55
|
-
- Don't use `#` for comments — use `//`
|
|
56
|
-
- Don't use `async` keyword — use `~>` for async messages
|
|
57
|
-
- Don't use `end` in sequence blocks — indentation closes blocks
|
|
58
|
-
- Don't use hex colors in section headers — use named colors
|
|
59
|
-
- Always include `chart:` directive when the type can't be inferred from content
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: dgmo-sequence
|
|
3
|
-
description: Generate a DGMO sequence diagram by analyzing a code flow, API interaction, or process description.
|
|
4
|
-
argument-hint: <flow or module to diagram>
|
|
5
|
-
allowed-tools: Read, Write, Bash, Glob, Grep
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
# Generate DGMO Sequence Diagram
|
|
9
|
-
|
|
10
|
-
Analyze a code flow, API interaction, or process and generate a `.dgmo` sequence diagram.
|
|
11
|
-
|
|
12
|
-
## Instructions
|
|
13
|
-
|
|
14
|
-
1. Understand what to diagram from `$ARGUMENTS` — this could be:
|
|
15
|
-
- A description of an interaction ("the login flow")
|
|
16
|
-
- A reference to code ("trace the checkout process in src/")
|
|
17
|
-
- An API flow ("POST /orders end-to-end")
|
|
18
|
-
2. If referencing code, explore the codebase to trace the actual flow
|
|
19
|
-
3. Generate a valid DGMO sequence diagram
|
|
20
|
-
|
|
21
|
-
## Sequence Diagram Syntax
|
|
22
|
-
|
|
23
|
-
```
|
|
24
|
-
chart: sequence
|
|
25
|
-
title: Flow Title
|
|
26
|
-
|
|
27
|
-
// Participant declarations (optional — auto-inferred from messages)
|
|
28
|
-
User is an actor
|
|
29
|
-
API is a service
|
|
30
|
-
DB is a database
|
|
31
|
-
Queue is a queue
|
|
32
|
-
|
|
33
|
-
// Messages — always left-to-right
|
|
34
|
-
User -Login-> API
|
|
35
|
-
API -Find user-> DB
|
|
36
|
-
DB -user record-> API
|
|
37
|
-
|
|
38
|
-
// Async messages
|
|
39
|
-
API ~event~> Queue
|
|
40
|
-
|
|
41
|
-
// Notes
|
|
42
|
-
note on DB:
|
|
43
|
-
Indexed lookup on email column
|
|
44
|
-
|
|
45
|
-
// Conditional blocks (indentation-scoped, no "end" needed)
|
|
46
|
-
if credentials valid
|
|
47
|
-
API -200 OK-> User
|
|
48
|
-
else
|
|
49
|
-
API -401 Unauthorized-> User
|
|
50
|
-
|
|
51
|
-
// Loops
|
|
52
|
-
loop retry 3 times
|
|
53
|
-
API -> ExternalService: request
|
|
54
|
-
|
|
55
|
-
// Sections (phase dividers)
|
|
56
|
-
== Phase 2 ==
|
|
57
|
-
|
|
58
|
-
// Visual groups
|
|
59
|
-
[Backend]
|
|
60
|
-
OrderAPI
|
|
61
|
-
DB
|
|
62
|
-
|
|
63
|
-
// Tag groups — define color-coded metadata dimensions
|
|
64
|
-
tag: Concern alias c
|
|
65
|
-
Caching(blue)
|
|
66
|
-
Auth(green)
|
|
67
|
-
|
|
68
|
-
// Pipe metadata — attach tags to participants and messages
|
|
69
|
-
API is a service | concern: Caching
|
|
70
|
-
User -login-> API | concern: Auth
|
|
71
|
-
[Backend | concern: Caching]
|
|
72
|
-
OrderAPI
|
|
73
|
-
DB
|
|
74
|
-
|
|
75
|
-
// Activate a tag group for recoloring
|
|
76
|
-
active-tag: Concern
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
**Participant types**: `actor`, `service`, `database`, `queue`, `cache`, `gateway`, `external`, `networking`, `frontend`
|
|
80
|
-
|
|
81
|
-
**Arrow types** (always left-to-right):
|
|
82
|
-
- Sync: `A -label-> B`
|
|
83
|
-
- Async: `A ~label~> B`
|
|
84
|
-
|
|
85
|
-
**Tag groups** — color-coded metadata for interactive recoloring:
|
|
86
|
-
- `tag: Name alias x` — declare a group with optional alias
|
|
87
|
-
- Entry: `Value(color)` — named color; add `default` for untagged elements
|
|
88
|
-
- Pipe metadata: `| key: value` on participants, messages, groups
|
|
89
|
-
- `active-tag: Name` — activate a group for CLI/export rendering
|
|
90
|
-
|
|
91
|
-
**Key rules**:
|
|
92
|
-
- Indentation closes blocks (no `end` keyword)
|
|
93
|
-
- Use `//` for comments (not `#`)
|
|
94
|
-
- `aka` for display names: `PaymentGW aka Payment Gateway`
|
|
95
|
-
- `at position N` for ordering: `DB at position 3`
|
|
96
|
-
|
|
97
|
-
## Output
|
|
98
|
-
|
|
99
|
-
Write to a descriptive `.dgmo` file, then check if `dgmo` CLI is available (`command -v dgmo`). If not installed, tell the user:
|
|
100
|
-
- `brew install diagrammo/dgmo/dgmo` (macOS, recommended)
|
|
101
|
-
- `npm install -g @diagrammo/dgmo`
|
|
102
|
-
- Or: `npx @diagrammo/dgmo <file>.dgmo`
|
|
103
|
-
|
|
104
|
-
If available, offer to render: `dgmo <file>.dgmo -o <file>.svg` or `dgmo <file>.dgmo -o url`
|