Skip to content

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

Merged
avrabe merged 2 commits into
mainfrom
feat/v0.10.x-mermaid-cli-emit
May 15, 2026
Merged

feat(cli): spar emit --format mermaid subcommand (v0.10.x M2)#222
avrabe merged 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
@github-actions
Copy link
Copy Markdown

Rivet verification gate

14/14 passed

count
Passed 14
Failed 0
Skipped (no steps) 0

Filter: (and (= type "feature") (or (has-tag "v093") (has-tag "v0100")))

Failed artifacts

(none)

Updated automatically by tools/post_verification_comment.py. Source of truth: artifacts/verification.yaml.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 15, 2026

Codecov Report

❌ Patch coverage is 57.46269% with 57 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
crates/spar-cli/src/main.rs 57.46% 57 Missing ⚠️

📢 Thoughts on this report? Let us know!

@avrabe avrabe merged commit 51330bb into main May 15, 2026
17 of 18 checks passed
@avrabe avrabe deleted the feat/v0.10.x-mermaid-cli-emit branch May 15, 2026 23:31
avrabe added a commit that referenced this pull request May 20, 2026
v0.10.0 ships:

**Mermaid emission (M1 + M2 + M3)**
- spar-mermaid foundation crate with `emit_flowchart` (#220)
- `spar emit --format mermaid` CLI subcommand (#222)
- `emit_class_diagram` + `emit_requirement_diagram` + matching CLI
  flags `--format mermaid-class` / `mermaid-req` (#228)

**Soundness deepening**
- Lean 4 sorry-free proofs of end-to-end latency monotonicity and
  ARINC 653 partition isolation, alongside the pre-existing RTA / EDF /
  Network Calculus proofs (#223)
- Kani BMC harnesses on generated-code AADL contract preservation
  (thread Period, port Direction, bus access right) — spar's
  Logika-equivalent strategy for verified codegen (#224)

**Safety analysis**
- EMV2 error-propagation traversal across the AADL connection graph
  (closes the #1 gap vs OSATE/HAMR in safety-case reviews) (#225)

**Verification infrastructure**
- Rivet-driven verification gate that executes every artifact's
  `fields.steps[].run` commands and posts a sticky PR comment with
  pass/fail counts and failed artifact IDs (#221)
- Workflow tuning: gate timeout 30→60 min for future Mathlib-heavy
  workloads; TEST-PROOF-* stay on sorry-grep until lake cache lands
  (#227, #229, #230)

**Chore**
- Pruned stale dev artifacts (.playwright-mcp logs + dashboard-render
  PNGs) and tightened gitignore (#226)

Bumps Cargo.toml + vscode-spar/package.json from 0.9.3 → 0.10.0.
The release workflow's `check-versions` job enforces tag/Cargo/vsix
agreement, so these must move together with the v0.10.0 tag push.

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
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