Skip to content

feat(mermaid): classDiagram + requirementDiagram emitters + CLI flags (v0.10.x M3)#228

Merged
avrabe merged 2 commits into
mainfrom
feat/v0.10.x-mermaid-m3-class-req
May 18, 2026
Merged

feat(mermaid): classDiagram + requirementDiagram emitters + CLI flags (v0.10.x M3)#228
avrabe merged 2 commits into
mainfrom
feat/v0.10.x-mermaid-m3-class-req

Conversation

@avrabe
Copy link
Copy Markdown
Contributor

@avrabe avrabe commented May 18, 2026

Summary

  • Adds emit_class_diagram(instance, opts) to spar-mermaid: one Mermaid class block per distinct AADL component type, with category stereotypes (<<system>>, <<thread>>, etc.) and feature attributes (+in data port foo). Respects categories / max_depth filters from MermaidOptions.
  • Adds emit_requirement_diagram(yaml_path) to spar-mermaid: line-oriented parser (no new deps — mirrors the pattern in spar-sysml2) reads rivet requirements.yaml and emits Mermaid requirementDiagram blocks with satisfies/verifies/derives edges. Non-requirement types (e.g. design-decision) are silently skipped.
  • Extends spar emit --format to accept mermaid (default, flowchart, unchanged), mermaid-class (calls emit_class_diagram), and mermaid-req (calls emit_requirement_diagram against artifacts/requirements.yaml — no AADL files or --root needed).
  • 6 new library unit tests + 2 new CLI integration tests; all green.
  • Appends REQ-MERMAID-CLASS-001, REQ-MERMAID-REQ-001, TEST-MERMAID-CLASS, TEST-MERMAID-REQ artifacts; rivet validate clean.

Sample emitted Mermaid

classDiagram (spar emit --format mermaid-class --root Emit_Test::TestSys.Impl):

classDiagram
    class App {
        <<process>>
    }
    class TestCpu {
        <<processor>>
    }
    class TestSys {
        <<system>>
    }
    class Worker {
        <<thread>>
    }
    App --|> TestSys
    TestCpu --|> TestSys
    Worker --|> App

requirementDiagram (spar emit --format mermaid-req, excerpt):

requirementDiagram

    requirement REQ_PARSE_001 {
        id: "REQ-PARSE-001"
        text: "AADL v2.2 lexical and syntactic parsing"
        risk: undefined
        verifymethod: analysis
    }

    requirement REQ_MERMAID_CLASS_001 {
        id: "REQ-MERMAID-CLASS-001"
        text: "classDiagram emitter for AADL component types"
        risk: undefined
        verifymethod: analysis
    }

Test plan

  • cargo test -p spar-mermaid — 12 tests pass (6 original + 6 new)
  • cargo test -p spar --test emit_mermaid — 4 tests pass (2 original + 2 new)
  • cargo clippy --workspace -- -D warnings — clean
  • cargo fmt --check — clean
  • rivet validate — no errors (pre-existing WARNs only, unchanged)

Follow-on to #220 / #222 (M3 milestone).

🤖 Generated with Claude Code

… (v0.10.x M3)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@avrabe avrabe enabled auto-merge (squash) May 18, 2026 05:20
@github-actions
Copy link
Copy Markdown

Rivet verification gate

19/19 passed

count
Passed 19
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 18, 2026

Codecov Report

❌ Patch coverage is 86.88525% with 48 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
crates/spar-mermaid/src/lib.rs 87.75% 42 Missing ⚠️
crates/spar-cli/src/main.rs 73.91% 6 Missing ⚠️

📢 Thoughts on this report? Let us know!

@avrabe avrabe merged commit 6509c77 into main May 18, 2026
15 of 18 checks passed
@avrabe avrabe deleted the feat/v0.10.x-mermaid-m3-class-req branch May 18, 2026 21:36
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