"""Transport for `atlas map` — the Reach map, the ladder's top rung (D-191, D-243). Two verbs, both RENDERS of the committed star-map.json. What does not appear here is deliberate: the generator that produced star-map.json in the first place, and the sculpt/tune passes that shaped its topology, are archived (tooling/archive/map-bootstrap/). They are keyed on the retired S-NNN ids, and the generator overwrites docs/design/star-map.json unconditionally from its seed — re-running it would replace the GJ-keyed, hand-maintained map (T-1293). """ from __future__ import annotations import json from pathlib import Path import typer from tooling.core import cli, console from tooling.core.command import command app = cli.domain("map", "The Reach map — client star-map data and the concentric SVG.") @app.callback() def _rung() -> None: """Keeps `map` a group (Typer collapses a single-command app).""" @app.command("data") @command def data( check: bool = typer.Option(False, "--check", help="Fail if the committed JSON is stale; write nothing."), ) -> None: """Regenerate client/data/star_map_data.json from star-map.json + systems.db + wiki.""" from tooling.domains.atlas.map import data as service result = service.run(check=check) if check: console.verdict(f"star-map data: {result['path']} is up to date") else: console.out(json.dumps(result)) console.verdict(f"star-map data: wrote {result['nodes']} nodes, {result['edges']} edges") @app.command("svg") @command def svg( output: Path = typer.Argument(None, help="SVG path (default: docs/diagrams/design/star-map-concentric.svg)."), ) -> None: """Render the concentric-ring Reach map SVG (and a PNG beside it).""" from tooling.domains.atlas.map import svg as service result = service.render(str(output) if output else service.DEFAULT_OUTPUT) console.out(json.dumps(result))