@diagrammo/dgmo 0.3.2 → 0.4.1
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-sequence/SKILL.md +7 -9
- package/.cursorrules +4 -4
- package/.github/copilot-instructions.md +4 -4
- package/.windsurfrules +4 -4
- package/README.md +11 -14
- package/dist/cli.cjs +150 -150
- package/dist/index.cjs +336 -891
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -7
- package/dist/index.d.ts +3 -7
- package/dist/index.js +335 -891
- package/dist/index.js.map +1 -1
- package/docs/language-reference.md +16 -19
- package/package.json +1 -1
- package/src/chart.ts +8 -39
- package/src/cli.ts +6 -6
- package/src/d3.ts +198 -674
- package/src/dgmo-router.ts +21 -42
- package/src/echarts.ts +80 -220
- package/src/index.ts +1 -0
- package/src/sequence/parser.ts +53 -133
- package/src/sequence/renderer.ts +4 -82
- package/src/utils/arrows.ts +37 -17
- package/src/utils/parsing.ts +43 -0
|
@@ -30,10 +30,10 @@ API is a service
|
|
|
30
30
|
DB is a database
|
|
31
31
|
Queue is a queue
|
|
32
32
|
|
|
33
|
-
// Messages
|
|
33
|
+
// Messages — always left-to-right
|
|
34
34
|
User -Login-> API
|
|
35
35
|
API -Find user-> DB
|
|
36
|
-
DB -> API
|
|
36
|
+
DB -user record-> API
|
|
37
37
|
|
|
38
38
|
// Async messages
|
|
39
39
|
API ~event~> Queue
|
|
@@ -44,9 +44,9 @@ note on DB:
|
|
|
44
44
|
|
|
45
45
|
// Conditional blocks (indentation-scoped, no "end" needed)
|
|
46
46
|
if credentials valid
|
|
47
|
-
API -> User
|
|
47
|
+
API -200 OK-> User
|
|
48
48
|
else
|
|
49
|
-
API -> User
|
|
49
|
+
API -401 Unauthorized-> User
|
|
50
50
|
|
|
51
51
|
// Loops
|
|
52
52
|
loop retry 3 times
|
|
@@ -61,11 +61,9 @@ note on DB:
|
|
|
61
61
|
|
|
62
62
|
**Participant types**: `actor`, `service`, `database`, `queue`, `cache`, `gateway`, `external`, `networking`, `frontend`
|
|
63
63
|
|
|
64
|
-
**Arrow types
|
|
65
|
-
- Sync: `A
|
|
66
|
-
- Async: `A
|
|
67
|
-
- Return: `B -> A: <- response`
|
|
68
|
-
- Bidirectional: `A <-> B: label`
|
|
64
|
+
**Arrow types** (always left-to-right):
|
|
65
|
+
- Sync: `A -label-> B`
|
|
66
|
+
- Async: `A ~label~> B`
|
|
69
67
|
|
|
70
68
|
**Key rules**:
|
|
71
69
|
- Indentation closes blocks (no `end` keyword)
|
package/.cursorrules
CHANGED
|
@@ -18,11 +18,11 @@ title: Auth Flow
|
|
|
18
18
|
|
|
19
19
|
User -Login-> API
|
|
20
20
|
API -Find user-> DB
|
|
21
|
-
DB -> API
|
|
21
|
+
DB -user-> API
|
|
22
22
|
if valid
|
|
23
|
-
API -> User
|
|
23
|
+
API -200 OK-> User
|
|
24
24
|
else
|
|
25
|
-
API -> User
|
|
25
|
+
API -401-> User
|
|
26
26
|
```
|
|
27
27
|
|
|
28
28
|
### Flowchart
|
|
@@ -112,6 +112,6 @@ Install: `brew install diagrammo/dgmo/dgmo` or `npm install -g @diagrammo/dgmo`
|
|
|
112
112
|
- Don't use `end` to close sequence blocks — indentation closes them
|
|
113
113
|
- Don't use hex colors in section headers — use named colors
|
|
114
114
|
- Don't forget `chart:` directive when content is ambiguous
|
|
115
|
-
- Sequence arrows: `->` (sync), `~>` (async)
|
|
115
|
+
- Sequence arrows: `->` (sync), `~>` (async) — always left-to-right
|
|
116
116
|
|
|
117
117
|
Full reference: `docs/language-reference.md`
|
|
@@ -18,11 +18,11 @@ title: Auth Flow
|
|
|
18
18
|
|
|
19
19
|
User -Login-> API
|
|
20
20
|
API -Find user-> DB
|
|
21
|
-
DB -> API
|
|
21
|
+
DB -user-> API
|
|
22
22
|
if valid
|
|
23
|
-
API -> User
|
|
23
|
+
API -200 OK-> User
|
|
24
24
|
else
|
|
25
|
-
API -> User
|
|
25
|
+
API -401-> User
|
|
26
26
|
```
|
|
27
27
|
|
|
28
28
|
### Flowchart
|
|
@@ -112,6 +112,6 @@ Install: `brew install diagrammo/dgmo/dgmo` or `npm install -g @diagrammo/dgmo`
|
|
|
112
112
|
- Don't use `end` to close sequence blocks — indentation closes them
|
|
113
113
|
- Don't use hex colors in section headers — use named colors
|
|
114
114
|
- Don't forget `chart:` directive when content is ambiguous
|
|
115
|
-
- Sequence arrows: `->` (sync), `~>` (async)
|
|
115
|
+
- Sequence arrows: `->` (sync), `~>` (async) — always left-to-right
|
|
116
116
|
|
|
117
117
|
Full reference: `docs/language-reference.md`
|
package/.windsurfrules
CHANGED
|
@@ -18,11 +18,11 @@ title: Auth Flow
|
|
|
18
18
|
|
|
19
19
|
User -Login-> API
|
|
20
20
|
API -Find user-> DB
|
|
21
|
-
DB -> API
|
|
21
|
+
DB -user-> API
|
|
22
22
|
if valid
|
|
23
|
-
API -> User
|
|
23
|
+
API -200 OK-> User
|
|
24
24
|
else
|
|
25
|
-
API -> User
|
|
25
|
+
API -401-> User
|
|
26
26
|
```
|
|
27
27
|
|
|
28
28
|
### Flowchart
|
|
@@ -112,6 +112,6 @@ Install: `brew install diagrammo/dgmo/dgmo` or `npm install -g @diagrammo/dgmo`
|
|
|
112
112
|
- Don't use `end` to close sequence blocks — indentation closes them
|
|
113
113
|
- Don't use hex colors in section headers — use named colors
|
|
114
114
|
- Don't forget `chart:` directive when content is ambiguous
|
|
115
|
-
- Sequence arrows: `->` (sync), `~>` (async)
|
|
115
|
+
- Sequence arrows: `->` (sync), `~>` (async) — always left-to-right
|
|
116
116
|
|
|
117
117
|
Full reference: `docs/language-reference.md`
|
package/README.md
CHANGED
|
@@ -182,10 +182,10 @@ const colors = getPalette('nord').light;
|
|
|
182
182
|
const content = `
|
|
183
183
|
title: Login Flow
|
|
184
184
|
|
|
185
|
-
User
|
|
186
|
-
AuthService
|
|
187
|
-
|
|
188
|
-
|
|
185
|
+
User -login(email, pass)-> AuthService
|
|
186
|
+
AuthService -findByEmail(email)-> UserDB
|
|
187
|
+
AuthService <-user- UserDB
|
|
188
|
+
User <-token- AuthService
|
|
189
189
|
`;
|
|
190
190
|
|
|
191
191
|
const parsed = parseSequenceDgmo(content);
|
|
@@ -196,16 +196,13 @@ renderSequenceDiagram(container, parsed, colors, false, (lineNum) => {
|
|
|
196
196
|
|
|
197
197
|
**Sequence syntax:**
|
|
198
198
|
|
|
199
|
-
- `A -> B
|
|
200
|
-
- `A
|
|
201
|
-
- `A ~> B
|
|
202
|
-
- `A
|
|
203
|
-
- `A
|
|
204
|
-
- `A <-
|
|
205
|
-
- `A
|
|
206
|
-
- `A <~message~> B` — bidirectional async with inline label
|
|
207
|
-
- `A -> B: method(): returnValue` — call with return
|
|
208
|
-
- `B -> A: <- response` — explicit return
|
|
199
|
+
- `A -message-> B` — synchronous call
|
|
200
|
+
- `A -> B` — unlabeled synchronous call
|
|
201
|
+
- `A ~message~> B` — async/fire-and-forget call
|
|
202
|
+
- `A ~> B` — unlabeled async call
|
|
203
|
+
- `A <-message- B` — synchronous return (dashed arrow, from B to A)
|
|
204
|
+
- `A <- B` — unlabeled return
|
|
205
|
+
- `A <~message~ B` — async return
|
|
209
206
|
- `if condition` / `else` / `end` — conditional blocks
|
|
210
207
|
- `loop condition` / `end` — loop blocks
|
|
211
208
|
- `parallel` / `else` / `end` — concurrent branches
|