@diagrammo/dgmo 0.4.2 → 0.4.4

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 (60) hide show
  1. package/.claude/skills/dgmo-chart/SKILL.md +28 -0
  2. package/.claude/skills/dgmo-generate/SKILL.md +1 -0
  3. package/.claude/skills/dgmo-sequence/SKILL.md +24 -1
  4. package/.cursorrules +27 -2
  5. package/.github/copilot-instructions.md +36 -3
  6. package/.windsurfrules +27 -2
  7. package/README.md +12 -3
  8. package/dist/cli.cjs +197 -154
  9. package/dist/index.cjs +8647 -3447
  10. package/dist/index.cjs.map +1 -1
  11. package/dist/index.d.cts +503 -58
  12. package/dist/index.d.ts +503 -58
  13. package/dist/index.js +8379 -3200
  14. package/dist/index.js.map +1 -1
  15. package/docs/ai-integration.md +1 -1
  16. package/docs/language-reference.md +336 -17
  17. package/docs/migration-sequence-color-to-tags.md +98 -0
  18. package/package.json +1 -1
  19. package/src/c4/renderer.ts +1 -20
  20. package/src/class/renderer.ts +1 -11
  21. package/src/cli.ts +40 -0
  22. package/src/d3.ts +92 -2
  23. package/src/dgmo-router.ts +11 -0
  24. package/src/echarts.ts +74 -8
  25. package/src/er/parser.ts +29 -3
  26. package/src/er/renderer.ts +1 -15
  27. package/src/graph/flowchart-parser.ts +7 -30
  28. package/src/graph/flowchart-renderer.ts +62 -69
  29. package/src/graph/layout.ts +5 -0
  30. package/src/graph/state-parser.ts +388 -0
  31. package/src/graph/state-renderer.ts +496 -0
  32. package/src/graph/types.ts +4 -2
  33. package/src/index.ts +42 -1
  34. package/src/infra/compute.ts +1113 -0
  35. package/src/infra/layout.ts +578 -0
  36. package/src/infra/parser.ts +559 -0
  37. package/src/infra/renderer.ts +1553 -0
  38. package/src/infra/roles.ts +60 -0
  39. package/src/infra/serialize.ts +67 -0
  40. package/src/infra/types.ts +221 -0
  41. package/src/infra/validation.ts +192 -0
  42. package/src/initiative-status/layout.ts +56 -61
  43. package/src/initiative-status/renderer.ts +13 -13
  44. package/src/kanban/renderer.ts +1 -24
  45. package/src/org/layout.ts +28 -37
  46. package/src/org/parser.ts +16 -1
  47. package/src/org/renderer.ts +159 -121
  48. package/src/org/resolver.ts +90 -23
  49. package/src/palettes/color-utils.ts +30 -0
  50. package/src/render.ts +2 -0
  51. package/src/sequence/parser.ts +202 -42
  52. package/src/sequence/renderer.ts +576 -113
  53. package/src/sequence/tag-resolution.ts +163 -0
  54. package/src/sharing.ts +8 -0
  55. package/src/sitemap/collapse.ts +187 -0
  56. package/src/sitemap/layout.ts +738 -0
  57. package/src/sitemap/parser.ts +489 -0
  58. package/src/sitemap/renderer.ts +774 -0
  59. package/src/sitemap/types.ts +42 -0
  60. package/src/utils/tag-groups.ts +119 -0
@@ -79,6 +79,32 @@ Bob: 9, 88
79
79
  Carol: 2, 70
80
80
  ```
81
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
+
82
108
  **Heatmap**:
83
109
  ```
84
110
  chart: heatmap
@@ -102,6 +128,8 @@ Team B: 2, 3, 2, 4, 3
102
128
  - `labels: percent` — show percentages on pie/doughnut
103
129
  - `orientation: horizontal` — rotate bar charts
104
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
105
133
 
106
134
  ## Output
107
135
 
@@ -20,6 +20,7 @@ Generate a `.dgmo` diagram file based on the user's description. Pick the best d
20
20
  - Database schemas → `er`
21
21
  - Class/type hierarchies → `class`
22
22
  - System architecture → `c4`
23
+ - Infrastructure traffic flow → `infra`
23
24
  - Task boards → `kanban`
24
25
  - Project roadmaps → `initiative-status`
25
26
  - Comparisons, data → `bar`, `line`, `pie`, etc.
@@ -56,7 +56,24 @@ note on DB:
56
56
  == Phase 2 ==
57
57
 
58
58
  // Visual groups
59
- ## Authentication
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
60
77
  ```
61
78
 
62
79
  **Participant types**: `actor`, `service`, `database`, `queue`, `cache`, `gateway`, `external`, `networking`, `frontend`
@@ -65,6 +82,12 @@ note on DB:
65
82
  - Sync: `A -label-> B`
66
83
  - Async: `A ~label~> B`
67
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
+
68
91
  **Key rules**:
69
92
  - Indentation closes blocks (no `end` keyword)
70
93
  - Use `//` for comments (not `#`)
package/.cursorrules CHANGED
@@ -83,9 +83,34 @@ system App | description: Main application
83
83
  -Uses-> User
84
84
  ```
85
85
 
86
- ## All 29 chart types
86
+ ### Infra chart
87
+ ```
88
+ chart: infra
89
+ direction: LR
90
+
91
+ edge
92
+ rps: 10000
93
+ -> CDN
94
+
95
+ CDN
96
+ cache-hit: 80%
97
+ -> LB
98
+
99
+ LB
100
+ -/api-> API | split: 70%
101
+ -/web-> Web | split: 30%
102
+
103
+ API
104
+ instances: 3
105
+ max-rps: 500
106
+ latency-ms: 45
107
+ ```
108
+
109
+ Properties: `cache-hit`, `firewall-block`, `ratelimit-rps`, `bot-filter`, `max-rps`, `instances` (N or N-M), `latency-ms`, `cb-error-threshold`. Groups: `[Name]` with children. Roles are inferred from behavior.
110
+
111
+ ## All 32 chart types
87
112
 
88
- 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, class, er, org, kanban, c4, initiative-status
113
+ 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, initiative-status, sitemap, infra
89
114
 
90
115
  ## Common patterns
91
116
 
@@ -16,8 +16,16 @@ When the user asks for a diagram, visualization, or chart, generate a `.dgmo` fi
16
16
  chart: sequence
17
17
  title: Auth Flow
18
18
 
19
+ tag: Concern alias c
20
+ Auth(green)
21
+ Data(blue)
22
+
23
+ User is an actor
24
+ API is a service | c: Auth
25
+ DB is a database | c: Data
26
+
19
27
  User -Login-> API
20
- API -Find user-> DB
28
+ API -Find user-> DB | c: Data
21
29
  DB -user-> API
22
30
  if valid
23
31
  API -200 OK-> User
@@ -83,9 +91,34 @@ system App | description: Main application
83
91
  -Uses-> User
84
92
  ```
85
93
 
86
- ## All 29 chart types
94
+ ## Infra chart
95
+ ```
96
+ chart: infra
97
+ direction: LR
98
+
99
+ edge
100
+ rps: 10000
101
+ -> CDN
102
+
103
+ CDN
104
+ cache-hit: 80%
105
+ -> LB
106
+
107
+ LB
108
+ -/api-> API | split: 70%
109
+ -/web-> Web | split: 30%
110
+
111
+ API
112
+ instances: 3
113
+ max-rps: 500
114
+ latency-ms: 45
115
+ ```
116
+
117
+ Properties: `cache-hit`, `firewall-block`, `ratelimit-rps`, `bot-filter`, `max-rps`, `instances` (N or N-M), `latency-ms`, `cb-error-threshold`. Groups: `[Name]` with children. Roles are inferred from behavior.
118
+
119
+ ## All 32 chart types
87
120
 
88
- 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, class, er, org, kanban, c4, initiative-status
121
+ 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, initiative-status, sitemap, infra
89
122
 
90
123
  ## Common patterns
91
124
 
package/.windsurfrules CHANGED
@@ -83,9 +83,34 @@ system App | description: Main application
83
83
  -Uses-> User
84
84
  ```
85
85
 
86
- ## All 29 chart types
86
+ ### Infra chart
87
+ ```
88
+ chart: infra
89
+ direction: LR
90
+
91
+ edge
92
+ rps: 10000
93
+ -> CDN
94
+
95
+ CDN
96
+ cache-hit: 80%
97
+ -> LB
98
+
99
+ LB
100
+ -/api-> API | split: 70%
101
+ -/web-> Web | split: 30%
102
+
103
+ API
104
+ instances: 3
105
+ max-rps: 500
106
+ latency-ms: 45
107
+ ```
108
+
109
+ Properties: `cache-hit`, `firewall-block`, `ratelimit-rps`, `bot-filter`, `max-rps`, `instances` (N or N-M), `latency-ms`, `cb-error-threshold`. Groups: `[Name]` with children. Roles are inferred from behavior.
110
+
111
+ ## All 32 chart types
87
112
 
88
- 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, class, er, org, kanban, c4, initiative-status
113
+ 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, initiative-status, sitemap, infra
89
114
 
90
115
  ## Common patterns
91
116
 
package/README.md CHANGED
@@ -139,8 +139,10 @@ const content = `
139
139
  chart: sankey
140
140
  title: Energy Flow
141
141
 
142
- Coal -> Electricity: 50
143
- Gas -> Electricity: 30
142
+ Coal (orange)
143
+ Electricity: 50
144
+ Gas (blue)
145
+ Electricity: 30
144
146
  Electricity -> Industry: 45
145
147
  Electricity -> Homes: 35
146
148
  `;
@@ -207,10 +209,12 @@ renderSequenceDiagram(container, parsed, colors, false, (lineNum) => {
207
209
  - `loop condition` / `end` — loop blocks
208
210
  - `parallel` / `else` / `end` — concurrent branches
209
211
  - `== Section ==` — horizontal dividers (collapsible in the desktop app)
210
- - `## GroupName(color)` — participant grouping with optional color
212
+ - `[GroupName]` — participant grouping
211
213
  - `Name is a database` — explicit type declaration
212
214
  - `Name position 0` — explicit ordering
213
215
  - `activations: off` — disable activation bars
216
+ - `tag: Name` + `Value(color)` entries — color-coded metadata dimensions with interactive legend
217
+ - `| key: value` — attach tag metadata to participants, messages, or groups
214
218
 
215
219
  **Participant type inference** — 104 rules map names to shapes automatically:
216
220
 
@@ -425,6 +429,11 @@ Label: value1, value2
425
429
 
426
430
  # Connections (sankey, chord, arc)
427
431
  Source -> Target: weight
432
+ Source (color) -> Target (color): weight (linkcolor)
433
+
434
+ # Indentation syntax (sankey)
435
+ Source (color)
436
+ Target (color): weight (linkcolor)
428
437
 
429
438
  # Groups
430
439
  ## Category Name