Generate mermaid-ascii compliant sequence diagrams
Generates mermaid-ascii compliant sequence diagrams from flow descriptions.
/plugin marketplace add kylesnowschwartz/SimpleClaude/plugin install sc-extras@simpleclaude[flow description]Generate a sequence diagram that renders correctly with mermaid-ascii.
Input: $ARGUMENTS
sequenceDiagram # REQUIRED first line
participant A as Alice # aliases (optional)
"Quoted Name" # spaces in names
A->>B: message # solid arrow (colon REQUIRED)
A-->>B: message # dotted arrow (colon REQUIRED)
A->>A: self # self-message (use for notes)
%% comment # ignored by parser
A->B: msg # wrong arrow (needs ->>)
A-->B: msg # wrong arrow (needs -->>)
A->>B # missing colon
Note over A # not implemented
loop/alt/opt # not implemented
activate A # not implemented
rect rgb() # not implemented
A->>B: text works, A->>B failsA->>A: (thinking) instead of Note%% Phase 1: or %% alt: if X then Ymermaid-ascii -f - to catch errors%% Flow: [title]
%% Render: cat <file> | mermaid-ascii -f -
%% Source: [file references if applicable]
sequenceDiagram
participant A as ActorOne
participant B as ActorTwo
%% Phase 1: [description]
A->>B: request
B-->>A: response
%% alt: [condition] -> [outcome]
%% Flow: API authentication
%% Render: cat api-auth.mmd | mermaid-ascii -f -
sequenceDiagram
participant C as Client
participant G as Gateway
participant A as Auth
participant S as Service
C->>G: POST /api/data
G->>A: validate token
A-->>G: valid
G->>S: forward request
S-->>G: response
G-->>C: 200 OK
%% alt: invalid token
%% A-->>G: 401
%% G-->>C: 401 Unauthorized
Renders as:
┌────────┐ ┌─────────┐ ┌──────┐ ┌─────────┐
│ Client │ │ Gateway │ │ Auth │ │ Service │
└───┬────┘ └────┬────┘ └──┬───┘ └────┬────┘
│ │ │ │
│ POST /api/data │ │
├───────────►│ │ │
│ │ validate token │
│ ├─────────►│ │
│ │ valid │ │
│ │◄┈┈┈┈┈┈┈┈┈┤ │
│ │ forward request │
│ ├─────────────────────►│
│ │ response │ │
│ │◄┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┤
│ 200 OK │ │ │
│◄┈┈┈┈┈┈┈┈┈┈┈┤ │ │
Before saving, ALWAYS test with:
cat <<'EOF' | mermaid-ascii -f -
[your diagram here]
EOF
If it errors, fix the syntax. Common fixes:
A->>B → A->>B:A->B: → A->>B: