Repository navigation
v0.7.0
This release comes out of a review of the whole codebase. Several changes reject input that v0.6.0
accepted, change exit codes, or change what a render draws: read the breaking changes before you
upgrade a script that calls diago.
Breaking changes:
- Every invalid spec exits 1 in every verb (render, diff, check, import), with a structured error
naming the field: input that is not JSON, empty input (exit 2 before), a missing or unknown type,
a field of the wrong JSON type, or a validation error. - Ids are stricter. A node, group, class or package id may not contain
->or end in@and
digits (db@2), which read as derived edge ids and layout slots, and no id may hold a control
character, U+FFFE or U+FFFF. direction: UNDEFINEDis rejected (exit 1, fielddirection): writeAUTOor leave the
direction out. This holds for a-previousspec and for an old version read from git too.- A spec's top-level
formatandstorekeys are unknown fields:checkreports them as
unknown-field,renderanddiffwarn, andcheck -strictandscripts/diago-render --strict
fail on them. Delete the keys, or add"ignore": ["unknown-field"]to the spec. - Sequence fragments: a fragment's sections run in order without overlapping, and two fragments
either nest or stay apart; ranges that cross are a validation error. A section'sstartand
endkeys match in any case, like every other key, and anullbound is an error ("must be
given") instead of reading as 0. - Themes: a theme name is a plain file name, and a name with a path is rejected (exit 1 on the
spec'stheme, exit 2 for-theme). Text art draws no theme, but a theme it is given must still
load, andcheckvalidates the theme too. renderanddiffstop after 10 seconds, exit 2, with a message naming the limit. The limit
starts once the spec and the-previousfile are read.- A failed write to stdout (a full disk, a closed pipe) exits 2 with
error: write output
instead of exit 0 with a truncated file. diago diff -format drawioor-format excalidrawis a usage error (exit 2), not a
validation error.- A Windows drive path (
C:\specs\arch.json,c:/specs/arch.json) is a path on every system,
never REV:PATH, so a missing one reports the missing file. A one-letter git revision followed by
an absolute path (v:/abs/arch.json) is read as a file too: use a relative path, or another
spelling of the revision (v~0:...).
What a render draws:
- Hops (SVG and PNG): every hop bulges up off a horizontal wire and left off a vertical one,
whichever way the wire runs; a wire running left bulged down, and one running down bulged right.
Crossings whose hops would overlap share one hop, a half ellipse no higher than a lone hop. The
sketch theme draws hops too. - Every element id in a flow or class SVG is unique: an element whose id would repeat another's
gets-2,-3. A spec without such a collision keeps every id. - Text art:
- Sequence frame headers sit on the frame line (
╔══ alt [guard] ══╗,╟╌╌ [guard] ╌╌╢),
frame sides keep two blank columns from every lifeline, and a frame leaves six blank columns
before its first lifeline. - A message across several actors gets room for its label instead of writing over its wire.
- A dashed, dotted or thick vertical wire keeps its style where it crosses another wire.
- An edge label the layout could not place beside a vertical wire is tried in its own row first.
- Sequence frame headers sit on the frame line (
- A newline, tab or other control character in a single-line text field prints as its escape
(\n) instead of tearing text art or breaking the SVG. A flow node's label still breaks into
lines at\n. - A back edge straightens onto its pinned side column past other wires instead of jogging.
- Exports (beta): every id the exporter makes has a kind prefix, so it never collides with a
spec's id (draw.io's root and layer cells arerootandlayer); a self-loop binds its shape
once; and draw.io and Excalidraw files end in a newline.
Diffs and anchoring:
- A sequence diff keeps the new spec's message order.
- An id that changes kind (a node that becomes a group) is named in the change list by each
side's own label. - A removed edge whose generated name collides with a spec's own
__removedid is named once, by
its own ends, andflat-edge-rankednames the rightbefore.edges[i]. edge-without-id(underdiffandrender -previous) fires on an edge or class relation
without anidthat shares both its ends with another, labelled or not, since only then can an
edit hand its derived id (from->to#n) to another edge. It no longer fires on a lone labelled
edge or a lone relation, and its message says why.checkdoes not change.
Errors and messages:
render -previouschecks the spec first. A field error, an unknown-format, or
-format drawio|excalidrawon a class or sequence diagram is reported as it is without
-previous(exit 1 for a field, 2 for a format), and a field error beside-theme nopeis the
field's (exit 1). A-previousfile that is missing, or a Mermaid one that does not translate,
is still reported first.- Text art reports a spec's field error before its theme, as every other format does.
- Group nesting errors name the group's own field (
groups[i]) and come in spec order. - Validation errors and
check -jsonprint<,>and&as written. - A diff's unknown theme reads
error: diff: theme "x" not found. - A custom theme with a wrongly typed key names it as
Theme.<key>. -h,--h,-helpand--helpprint a usage on stdout with exit 0 wherever they stand:
alone, afterhelp, and afterversion,--versionor-version.
PNG:
- Works with resvg 0.26 to 0.41. Those versions printed a warning ahead of the image, so every
PNG they made was corrupt (exit 0). PNG output needs resvg 0.26 or newer. - A failed resvg run reports resvg's error alone, a run stopped by the 10-second limit reports the
limit, andDIAGO_RESVG_PATHnaming a directory says so.
Mermaid import:
- An
@inside an edge label,%%inside a quoted label, nested generics (List~List~int~~)
and generics of non-identifiers (Result~[]User~) import correctly, and the import's JSON keeps
<,>and&as written.
Plugin:
- The SessionStart hook prints valid JSON when the plugin's path holds a tab, a newline or
another control character. - The diagramming skill and its cheatsheet state the new exit codes, id rules, theme check and
fragment rules.