The wiremap command
wiremap checks, formats, reports on and draws the model of one repository, as the format describes it.
wiremap check [--root <dir>]
wiremap fmt [--root <dir>]
wiremap report --base <dir> [--link] [--root <dir>]
wiremap view [--base <dir>] [--out <file> | --link] [--no-open] [--root <dir>]Every command works on the repository root given by --root, the current directory by default. It doesn't look for wiremap/ in parent directories, but check reads an anchor path that starts with / from the git root at or above it, so --root services/billing checks the model of one directory of a monorepo. Each problem's location and each file fmt prints start with --root as given, or with --base for the base's problems, so they hold from the current directory.
The exit status is 0 on success, 1 when a model has problems or a directory or file can't be read or written, and 2 on a wrong command line. wiremap --help prints the usage and wiremap --version the version.
check
check validates the model and evidence against the repository. It prints one file:line: message line per problem, then the number of problems. A rule violation is followed by the anchors of the edge that breaks the rule, and an anchor that doesn't hold by its text, each on an indented line. On a valid model it prints nothing.
fmt
fmt rewrites wiremap/model.txt and wiremap/evidence.txt in canonical form and prints each file it changed. It changes only layout and order. When either file doesn't parse, it prints the syntax problems and changes neither file. There is no check mode: check already fails on a file that isn't canonical.
report
report --base <dir> prints, in Markdown on stdout, what changed from the model of the repository root <dir> to the model at --root. Both are directories, such as two checkouts. A base without wiremap/ is an empty model, so the change that adopts Wiremap reports everything as added. Only the files need to parse: report doesn't validate them.
The report starts with # Architecture change and a summary line, then these sections, each left out when it is empty:
- Nodes: nodes added, removed and changed.
- Edges: Added, Removed and Changed.
- Groups: groups added, removed and changed, with their members and inner groups.
- Rules: rules added and removed.
- Anchors moved: the anchors gained and lost by nodes, edges and groups that both models have and the head doesn't change.
Items are written in model syntax and each change as name: before → after, followed by the item's anchors in evidence syntax: the head's for added and changed items, the base's for removed ones. When only anchors changed, the summary line is "No architecture change." followed by what moved. The same inputs always give the same bytes. A report, like a viewer page or link, holds the anchors' snippets, lines copied from the repository's files: anyone who has it can read those lines.
With --link, the report ends with a line [Open in the viewer](<link>), which opens the change on the Change tab of the viewer that the docs site hosts, https://ghostdogpr.github.io/wiremap/view/. The link carries the whole page's data, compressed, after its #: browsers never send that part to a server, and the hosted page loads nothing else. It also carries the version of the data, and the hosted page opens only links of its own version, so a link made by an older or newer wiremap says so and asks for view instead. The model of the OpenTelemetry demo, about 20 nodes with their anchors, gives a link of 6 to 10 KB.
view
view writes the viewer page, a self-contained HTML file, and prints its path. With --base <dir>, the page also shows the change from the model at <dir>, which may have no wiremap/, as for report. The page goes to --out, or wiremap.html in the current directory. Only the files need to parse.
When the model has no groups, at least one outside node and at least two nodes that aren't outside, actors aside, the Map draws a boundary around those nodes, named after the directory --root names. The boundary is not part of the model: no other tab, and no report, shows it.
The Map draws three or more outside externals that the same nodes reach in the same ways, with no edges of their own and in no group, as one node such as "31 outside systems", whose panel lists each of them, and the Change tab bundles only those the change leaves as they were. A service, job, store or channel with no name and a dotted id is labelled on the Map and the Change tab with the last segments of its id, as few as keep labels apart, such as Order for net.example.orders.domain.Order.
view then opens the page in the default browser, through xdg-open, open or start, except with --no-open or when the CI environment variable is set. If the browser can't be opened, the path printed is all there is, and the exit status is still 0.
With --link, view writes no page and opens nothing: it prints the link to the hosted viewer that report --link prints, on the Change tab with --base and on the Map without it.