CLI

Every archgram command and option, with what each does.

As archgram prints it. archgram --help prints it for the version you have.

archgram build <spec>#

Draws the diagram. A spec named <name>.archgram.yaml (or .yml, .json) draws <name>.svg beside it. It says the size it drew and the direction, and warns, still drawing, when the drawing is wider than keeps its text readable where it is shown: 1,300 px in a README on GitHub, or the ratio of shownWidth when the spec says it is shown elsewhere. With direction: auto in the spec, archgram keeps left to right while it fits, and otherwise the narrower direction (the spec).

npm exec -- archgram build docs/diagrams/linkshort.archgram.yaml
OptionWhat it does
-o <file.svg>Writes another file, and creates its folder when it does not exist
--theme auto|light|darkWhich theme the file carries: auto, the default, both, following the reader's dark mode; light or dark one only
--split-themesWrites <name>.light.svg and <name>.dark.svg, for a page that picks one per reader
--theme-file <archgram.theme.json>Draws in your design system's colours, from its design tokens (W3C Design Tokens)
--system-fontLeaves the text to the reader's font instead of embedding Geist

archgram check <spec>#

Checks a spec without drawing it, and lists every problem at its line and column, with the nearest id or logo when one is misspelt. When a node or an edge names the code behind it (source), it also says which of that code is gone: a part or a line whose code was removed is reported, and archgram build warns of the same and still draws.

npm exec -- archgram check docs/diagrams/linkshort.archgram.yaml

archgram spec#

Prints the spec format this archgram reads: every field, node kind and rule. --brief prints its short part, one complete spec and what each other section covers; --section <name> prints one section, such as theme-file.

npm exec -- archgram spec --brief

archgram theme check <archgram.theme.json>#

Reads your design tokens as the theme and shows each colour role in light and dark, or every problem, such as a pair that falls short of contrast.

npm exec -- archgram theme check archgram.theme.json

archgram --version, archgram --help#

Print the version, or every command and option.

Every option at a glance#

archgram --help prints this.

archgram: architecture diagrams from a spec

Usage:
  archgram build <spec> [-o <out.svg>] [--theme auto|light|dark | --split-themes] [--system-font]
                     [--theme-file <archgram.theme.json>]
                               Draw the diagram (default output: the spec's name with .svg)
  archgram check <spec>        Check a spec and list every problem, a source the code
                               no longer has among them
  archgram spec [--brief | --section <name>]
                               Print the spec format this archgram reads (docs/SPEC.md): all
                               of it, its short part, or one section, such as theme-file
  archgram theme check <archgram.theme.json>
                               Read a project's design tokens as the theme and show each role's colour
  archgram --version           Print the version
  archgram --help              Print this help

A spec is JSON (.json) or YAML (.yaml, .yml); YAML problems are shown at
their line and column. A spec named <name>.archgram.yaml (or .yml, .json)
draws <name>.svg beside it. -o names another file, and creates its folder
when it does not exist.

Themes: auto (light, dark under the reader's dark mode; the default), light, dark.
--split-themes writes <out>.light.svg and <out>.dark.svg from one layout, for a
  page that picks one per reader (GitHub's <picture> with prefers-color-scheme).
--system-font leaves the text to the reader's font instead of embedding Geist.
  The text is still measured with Geist, so a wider system font can crowd or
  overflow a card; embedding (the default) draws exactly what was measured.
--theme-file draws in a project's own colours: a mapping file names the
  project's DTCG resolver, its light and dark inputs, and the token for each
  role (docs/SPEC.md, Theme file).

A node or an edge may name the code behind it (source, a path from the spec's
folder). check fails, and build warns, when that code is not there
(docs/SPEC.md, Sources).