Swamp Diagrams
Diagrams of swamp workflows and of behaviors' state machines, drawn as a light and dark SVG pair (or as Mermaid). workflow draws workflows as flowcharts: a box per job, a node per step, and dependsOn arrows labelled with their condition. stateMachine draws a behavior's phases and the methods that move between them, from the transition lines in a published extension's description (such as @swamp/issue-lifecycle), a file or passed in, with the main path down the middle, failure and detour phases beside it, loops, retries and human-only gates marked, and notes alongside. Diagrams are written next to Markdown docs and embedded in marked blocks with a that follows GitHub's light and dark modes; with format=mermaid they can be rendered to SVG or PNG with the mermaid-cli container.
Global Arguments
| Argument | Type | Description |
|---|---|---|
| format? | enum | svg: a light and dark SVG pair drawn with a fixed, hand-drawn-style layout, shown with a <picture> element; mermaid: Mermaid source that GitHub draws itself |
| theme? | enum | Colours: auto (reads on light and dark pages; GitHub draws it in the reader's mode), dark (teal on black), light, both (auto source, images rendered as a -dark and -light pair), or none (Mermaid's default theme, no colours) |
| direction? | enum | Layout: TD (top-down) or LR (left-to-right) |
| render? | enum | format mermaid only: also render an image with the mermaid-cli container (needs Docker) |
| outputDir? | string | Folder, relative to the repository, to also copy the diagram files into (empty = keep them in swamp data only) |
| embedIn? | string | Markdown file or folder, relative to the repository, whose <!-- swamp-diagram: <name> --> … <!-- /swamp-diagram --> blocks get the diagram: a <picture> of the SVG pair (saved in a diagrams/ folder beside the Markdown file) or a mermaid code block (empty = none) |
| copyFiles? | array | Which files to copy into outputDir |
| registryUrl? | string | swamp extension registry that stateMachine reads descriptions from |
| dockerPath? | string | Docker CLI binary |
| mermaidImage? | string | mermaid-cli container image used to render SVG or PNG |
| Argument | Type | Description |
|---|---|---|
| name? | string | Workflow name, ID or file name (empty = every workflow found) |
| dir? | string | Folder to look for workflows in, relative to the repository: it and every workflows/ folder beneath it (e.g. .. to draw every extension's workflows in a monorepo) |
| path? | string | A workflow YAML file to draw instead, relative to the repository or absolute |
| title? | string | Diagram title (defaults to the workflow name) |
| Argument | Type | Description |
|---|---|---|
| extension? | string | Published extension whose description holds the transitions, e.g. @swamp/issue-lifecycle |
| transitions? | string | Transition lines to draw instead, one per line: 'from ──[method]──> to' |
| path? | string | A file to read the transition lines from instead, relative to the repository (other lines are ignored, so it can be the docs page itself) |
| backEdges? | enum | A step back to an earlier phase: retry (red, labelled '(retry)') or normal (routine, like start after stop) |
| title? | string | Diagram title (defaults to the extension name) |
| subtitle? | string | A line shown under the title |
| hideStates? | array | Phases to leave out; their transitions become entry or exit arrows (e.g. created) |
| collapseStates? | array | Phases to skip over: each way in is joined to each way out (e.g. verifying) |
| omitMethods? | array | Methods whose transitions are left out, to keep the diagram to the main path |
| humanGates? | array | Methods only a person may run, drawn as thick green arrows (e.g. approve) |
| highlightStates? | array | Phases to emphasise, besides the final ones (which always are) |
| failureStates? | array | Phases to draw as failures, besides any whose name contains 'fail' |
| notes? | record | A short note to show under a phase, keyed by phase |
| showComments? | boolean | Add each transition's parenthetical comment to its arrow |
Resources
Files
- Has README or module doc2/2earned
- README has a code example1/1earned
- README is substantive1/1earned
- Most symbols documented1/1earned
- No slow types (deprecated)1/1earned
- Dependencies pass trust audit2/2earned
- Docs keep secrets in a vault1/1earned
- Has description1/1earned
- Platform support declared (or universal)2/2earned
- License2/2earned
- Verified public repository2/2earned
Spawns a subprocess with Deno.Command().
- models/swamp_diagram.ts:233 — no reason given
- models/swamp_diagram.ts:264 — no reason given