Draw a local catalogue with Node.js 22 or later, from this checkout:
npm ci
npm run build
node dist/cli.js map examples/northwind --date 2027-06-01 > map.svg
node dist/cli.js map examples/northwind --theme dark --date 2027-06-01 > map-dark.svgstackledger map <folder> [--view full|staff] [--theme light|dark] [--backdrop neutral|london] [--date YYYY-MM-DD] prints one self-contained SVG followed by a newline. --view staff is deprecated (ADR 13): it still draws, and prints one line on stderr saying so. Defaults are full, light, the catalogue's spec.map.backdrop (neutral without it) and the machine's local calendar date. --help anywhere prints usage and exits 0, even alongside invalid arguments. An invalid option, impossible date, missing folder, extra folder or unreadable/non-directory folder exits 2 with the reason and usage on stderr and no stdout. A catalogue with errors still draws its served documents and exits 0. An unexpected failure while laying out or drawing the map is a bug in stackledger: it exits 1 with one internal error line on stderr, no usage text and no stdout. Run stackledger validate to gate a catalogue on validity.
The command reads local files only. It does not write the catalogue, open network connections or send telemetry. Shell redirection in these examples writes the SVG you requested. Recoverable problem counts, suggested positions and unrouted hops go to stderr. Counts appear only in full, and only when there are errors or warnings. When an invalid layout is excluded, both views explain that its stored positions are not used.
A line is an ordered journey; a station is a component on a drawn journey. Components on no journey remain in the catalogue. Missing or invalid components are skipped, a stop repeated back to back counts once, and journeys with fewer than two served stops disappear. Codes sort before uncoded lines, by uppercase Unicode code point, with names breaking ties. The legend follows that order.
A single-line station is a circle on its line; a shared station is an interchange, a capsule spanning its lines. Each terminal has a badge with its line's code, or the first character of its name in uppercase. The badge sits beyond the station along the line's last segment. Lines ending at one station in the same direction share a row, stacked when they end horizontally and side by side otherwise. The row moves outwards until it clears station and licence markers, strokes and other badges. A deprecated component has a muted station and label. Its journeys keep their colours.
A solid green disc (the package's licenceMark, owned) means a served dependency licence is active or to-confirm. A hollow white disc (toBuy) means to-buy when there is no solid licence. Cost, currency and billing cycle never change that glyph. An orange ring (renewalRing) in full means an active or to-confirm licence renews between the map date and 30 days later, inclusive; overdue licences get no ring. staff never draws renewal rings and ignores the map date completely, even with custom Settings that expose renewal dates. It reads only the served view; if status is hidden, no licence marker can be inferred.
Labels use the component title or name, wrapped at spaces into rows of at most 18 Unicode code points, each row taking as many words as fit. Nothing is cut: a label takes as many rows as it needs. A word longer than a row starts a new row and breaks after its last -, _, . or / that fits, as CSS breaks after a hyphen (openspec-archive-change becomes openspec-archive- and change), or after 18 code points when it has none; its last piece continues the row. The full text also stays in each station's SVG title. Fixed character widths keep placement independent of installed fonts. Interchanges are labelled first, then references. Eight positions are tried: right, left, above, below, upper right, lower right, upper left, lower left. The first without overlap wins; crowded stations use the least intersected area. Labels avoid other labels, station markers (with licence markers and, on a skills map, rule counts), terminal badges, zone titles and the stroke-width rectangle of every segment.
See the catalogue format for Line, MapLayout and Settings. A stored [column, row] becomes (64 × column, 64 × row) in map units. The viewBox includes padding, header and legend; it does not shift the station's coordinates. Changing a journey never moves placed stations. Routes can change.
Unplaced stations receive suggested positions, in reference order. The target is the mean of distinct placed or earlier-suggested neighbours, taken from every place the station appears on every line. The nearest free nonnegative cell wins by octile distance, ties by row then column. With no neighbour, the station starts in row 0 after every stored/suggested column, or at [0, 0] when none exists. The search uses only nonnegative safe-integer coordinates and looks at most R cells from its target, where R is 64 or, with n cells already taken, ceil(√n) + 2 when that is larger. A window that size always holds a free cell, so the nearest-cell rule is exact. Only when coordinates leave the safe-integer range (a stored position near 2^53), so that no safe free cell is found or the column after the largest one is unsafe, does the station fall back to the free cell in row 0 with the smallest column; it is still listed with the other suggestions on stderr. Every stored cell is reserved, including undrawn items. For conflicting keys, the first component key and the first occupant of a cell win; other drawn stations receive suggestions. A layout with a field error supplies no positions.
A suggested station keeps its circle or interchange and gains a dashed hollow disc. stderr prints a header and entries such as component:editor: [3, 2], ready to copy into spec.stations. Suggestions are never saved automatically.
Zones follow declaration order. Components join through metadata.labels["stackledger/zone"], matched ignoring case. A zone with drawn members is their convex hull, expanded by 32 units with round corners, with its declared title and colour. It can cover unrelated stations. Move stored positions when a crowded map needs more room.
The software map sits on a flat panel (neutral, the default) or over a city (london). Choose it for both stackledger map and stackledger build with spec.map.backdrop in the Settings; --backdrop overrides it for one drawing. An unknown spec.map.backdrop is a catalogue error and the map falls back to neutral; an unknown --backdrop is a usage error (exit 2). The skills map, the neighbourhood diagrams, the strips and the relation diagram never take a backdrop.
london draws the Thames, the docks and lakes, and the large parks of central London (Hammersmith to Greenwich) in one group between the background and the grid: the water path first, then the parks. It is a decoration: the city is scaled to cover the whole viewBox (s = max(W / w, H / h), centred), cropped by the viewBox, and nothing lines up with the stations. Points are written with one decimal; holes are wound opposite to their outer ring, so no fill-rule, transform or clip-path is needed and the writer's allow-lists are unchanged. The map ends with © OpenStreetMap contributors in its bottom-right corner, clear of the legend. A map drawn with neutral is byte for byte the map of 0.5.1 and carries no credit.
The London shapes ship inside the package as a generated module (dist/map/backdrops/london.js, under 16 KB); drawing reads no file and opens no connection. They come from OpenStreetMap, © OpenStreetMap contributors, under the Open Database License; the module's header names the extract date. Maintainers refresh them by hand: node scripts/backdrops/refresh.mjs runs the Overpass query in scripts/backdrops/london.overpassql (network) and writes scripts/backdrops/london-extract.json; node scripts/backdrops/build.mjs (offline: it runs the pinned mapshaper from the npm cache with npx --offline, so provision it once with npx --yes mapshaper@0.7.98 -v) regenerates src/map/backdrops/london.ts from that extract, byte for byte the same on every run. Neither script is published.
The colours come from the design system's surface tokens, one set per theme and no opacity: the water is filled with surface.<theme>.backdropWater and outlined (2 units) with backdropWaterEdge, the parks are filled with backdropPark, and the credit is written in backdropCredit. On light that is #C9D8FF, #B5C7F5, #D4F2DF and #5A6385; on dark #1E3175, #2A3F8A, #183F52 and #9AA6D6.
Routes use horizontal, vertical and 45-degree grid steps. Every station except a hop's endpoints is blocked. A hop stays inside its endpoint box expanded by three cells and never turns more than 90 degrees. Searches use A* with a binary heap and a 50,000-state limit. A hop takes the shortest route; among routes of equal length it prefers, in order, fewer cells beside other stations, fewer and gentler bends, fewer diagonal crossings of used corridors, running straight through its end stations, and reusing edges other hops already use. A failed hop is drawn straight and reported with its line and endpoints on stderr. Shared hops use one route. Lines sharing any grid edge occupy separate slots in line order, independent of travel direction. When every line on an edge continues together onto the next edge, the bundle keeps each line on the same side through the bend instead of re-sorting it by the new edge's direction, so a bundle never crosses itself at a corner. A 45- or 90-degree bend away from stations turns round: every line of the bundle follows a circular arc around one centre, map.bendRadius (32) from the bundle's centre line, so the lines stay parallel through the curve. A bend keeps the mitred corner (the two offset segments meet where their lines intersect) at a station, where a bundle splits or merges, in a bundle of four lines or more (its inner line would turn too tight), and where the arc has no room on its straight segments; the decision covers every bend at once, so it does not depend on line order. Labels and terminal badges avoid the arcs as they avoid straight segments. The theme's bendRadius must be the token's. A slot change on a straight run uses one short 45-degree connector. Fixed slot order can still introduce crossings where bundles split or merge at interchanges.
The light and dark themes preserve the catalogue's line and zone colours. Every other colour and measure comes from the tokens of @brunosouzas/signwright, the visual identity of brunosouzas.com: each theme reads its surface (light or dark), the map measures and the fixed color meanings; the zone opacity is surface.<theme>.zoneOpacity and the dark title tint map.zoneTitleTint. Stations, interchanges, lines, terminal badges, rule counts, licence markers, renewal rings, the dashed suggested-position halo and zones are drawn by the package's pieces (stationMarker, pipe, lineBadge, countBadge, licenceMark, renewalRing, suggestedHalo, zone), written through this map's own SVG writer so the rules below apply to them. Both themes follow the illustrated diagrams of brunosouzas.com: lines are thick pipes (12 units of line colour in an ink #121212 casing 6 units wider, round caps and joins, the same on both surfaces; bundled lines sit side by side without overlapping); stations are white circles wider than the pipe, interchanges white capsules spanning all their lines, terminal badges pills; stations, badges, licence markers, renewal rings and the legend panel have an outline, ink (color.ink) in light and the dark surface's muted colour (#ADA79D) in dark, where ink vanishes. A sticker shadow (a shifted copy of the shape, no transform or filter) is drawn only when the package's map.shadow is above 0; it is 0 in the pinned package, so none is drawn, and no theme has a rim. light sits on the cream page #F6F3EC with an ink header band; dark sits on #121110 with the dark panel colour (#1D1C1A) as its header band. Licence, renewal and the neighbourhood's centre read color.state.healthy, color.state.blocked and color.state.caller. Text uses the package's font.sans stack as it is, quotes included ('Source Sans 3', 'Helvetica Neue', Helvetica, Arial, sans-serif; a family name ending in a digit must be quoted in CSS), and labels are bold. The SVG writer writes each ' as ' and allows an apostrophe only in font-family and in the attributes that carry catalogue text. On the site, a CSS rule points the map at the face the site ships; a standalone SVG names the stack and falls back to system fonts when Source Sans 3 is not installed. Label and badge placement count the ink: segments are as wide as their casing, and markers and badges grow by their outline and shadow (layoutMap(model, theme.lineWidth, inkOf(theme))); with map.shadow at 0 they grow by the outline only, so a label may sit closer to a marker than with the 0.6.0 shadow. Zone titles use the zone colour in light and a lighter tint of it in dark (zoneTitleTint), so they stay readable on the dark background. The renderer consumes Theme data without branching on a theme name. No font or other resource is fetched.
A theme's ink must be its surface's. The renderers (renderSvg and the diagram renderers) throw before drawing when outline, outlineWidth, shadow, rim, casing, lineWidth, licence, renewal, zoneOpacity or zoneTitleTint differs from the design system's values for the theme's surface, and the error names the first such field (Theme shadow must be the design system's for the dark surface). The pieces paint that ink and those colours from the tokens, while the layout counts the theme's values, so a different value would misplace labels or be ignored. Other fields, such as background or font, stay free. A zone title of only spaces draws the zone without a title. A renewal ring or suggested halo with a radius above 10,000 map units (an interchange across about 1,200 parallel lines) or a zone of more than 10,000 hull points is refused by the pieces, and drawing fails. To start a custom theme, copy themes.light or themes.dark and change only those.
The output has a fixed element/attribute vocabulary, escaped XML text, validated hex colours and finite numbers rounded to two decimals. It contains no links, scripts, CSS, external references, document types or processing instructions. Identical served documents, theme and date yield byte-identical SVG, regardless of file names or document order.
buildMapModel(view, date) reduces a served view to drawing inputs. layoutMap(model, theme.lineWidth, inkOf(theme)) produces plain geometry (the ink argument defaults to the light theme's); renderSvg(geometry, theme) serializes it. All three, their types, themes and inkOf are exported from src/index.ts. Geometry carries suggestions and unrouted hops for consumers to report.
examples/northwind is a fictitious company using the spike's product titles, journeys, positions and finance zone, with synthetic licences and Settings. It validates with zero errors and warnings and has no label collisions with other labels, stations or terminal badges, and no terminal badge covers another badge, a station or a licence marker. The hero SVGs are generated by the real command:
node dist/cli.js map examples/northwind --theme light --date 2027-06-01 > docs/images/map-light.svg
node dist/cli.js map examples/northwind --theme dark --date 2027-06-01 > docs/images/map-dark.svgTests cover scenario-named numeric geometry, independently parsed hostile SVG, staff/full differential output, read-only execution under Node's permission model, example collisions and a seeded 200-station, 20-line fixture required to render within 5 seconds.
The site's Skills division draws a second metro map with the same engine, from a skill set's stackledger-skills.yaml (docs/skills.md). Its stations are skills, playbooks and agents, named plugin:name when they come from a plugin; its lines are journeys; its zones are marketplaces, loose or playbooks and may overlap (a playbook's title sits next to its station, a marketplace's at the corner of its area); a station of two or more journeys is an interchange; its legend has only the interchange and suggested-position symbols, and it depends on no view or date. Station references use the item's page name (skill:writer, skill:_577269746572 for Writer). The software map does not change with it: the same catalogue, view, theme and date place every station and line where 0.2.0 placed them; only the painting (the design system's pieces since 0.5.0) and the round bends differ.