Skip to content

feat(cli): spar emit --format mermaid subcommand (v0.10.x M2)#222

Open
avrabe wants to merge 2 commits into
mainfrom
feat/v0.10.x-mermaid-cli-emit
Open

feat(cli): spar emit --format mermaid subcommand (v0.10.x M2)#222
avrabe wants to merge 2 commits into
mainfrom
feat/v0.10.x-mermaid-cli-emit

Conversation

@avrabe
Copy link
Copy Markdown
Contributor

@avrabe avrabe commented May 14, 2026

Motivation

Mermaid M1 (#220) landed spar-mermaid with emit_flowchart. This PR (M2) exposes it to users via a new spar emit CLI subcommand, completing the user-visible half of the Mermaid flowchart pipeline.

Scope

  • CLI only, flowchart only (classDiagram is M3; round-trip tests are M4; per-mode emission is v0.11.0)
  • Parallel to spar render (SVG via etch) — not combined with it

Changes

  1. crates/spar-cli/Cargo.toml — adds spar-mermaid.workspace = true
  2. crates/spar-cli/src/main.rs — dispatch entry "emit", cmd_emit function, parse_category helper, updated print_usage()
  3. crates/spar-cli/tests/emit_mermaid.rs — 2 integration tests (happy path + category filter)
  4. artifacts/requirements.yamlREQ-MERMAID-CLI-001
  5. artifacts/verification.yamlTEST-MERMAID-CLI

Example invocations

# Emit full flowchart to stdout
spar emit --root MyPkg::Sys.Impl path/to/file.aadl

# Filter to threads only, limit depth, write to file
spar emit --root MyPkg::Sys.Impl --format mermaid --category thread,processor --max-depth 2 file.aadl > diagram.md

# Suppress connection edges
spar emit --root MyPkg::Sys.Impl --no-connections file.aadl

Sample output (from integration test fixture)

flowchart TD
    TestSys["system: TestSys"]
    app["process: app"]
    cpu["processor: cpu"]
    worker["thread: worker"]

Links

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.7 noreply@anthropic.com

Add `spar emit` CLI subcommand that wraps spar_mermaid::emit_flowchart,
exposing flowchart generation to users via the existing parse/lower/instantiate
pipeline. Flags: --root (required), --format mermaid, --category, --max-depth,
--no-connections, -o/--output. Two integration tests added.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@avrabe avrabe enabled auto-merge (squash) May 14, 2026 15:46
# Conflicts:
#	artifacts/requirements.yaml
#	artifacts/verification.yaml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant