Skip to content

feat(spar-sysml2): roundtrip generation — rivet YAML to SysML v2 (Phase 4 of #90)#100

Merged
avrabe merged 1 commit intomainfrom
feat/sysml2-roundtrip-phase4-90
Apr 3, 2026
Merged

feat(spar-sysml2): roundtrip generation — rivet YAML to SysML v2 (Phase 4 of #90)#100
avrabe merged 1 commit intomainfrom
feat/sysml2-roundtrip-phase4-90

Conversation

@avrabe
Copy link
Copy Markdown
Contributor

@avrabe avrabe commented Apr 2, 2026

Summary

Phase 4 of #90 — completes the SysML v2 ↔ rivet roundtrip.

```
SysML v2 → spar extract → rivet YAML → spar generate --from-rivet → SysML v2
```

CLI

```bash

Generate SysML v2 from rivet artifacts

spar generate --from-rivet artifacts/requirements.yaml -o requirements.sysml

Also available as spar sysml2 generate

spar sysml2 generate --from-rivet artifacts/sysml-extracted.yaml
```

Generated output

  • `requirement def` with doc strings for each requirement
  • `part def` / `action def` / `state def` for tagged components
  • All 5 relationship types: satisfy, verify, refine, allocate, derive

New API

  • `spar_sysml2::generate::parse_rivet_yaml(yaml) → Vec`
  • `spar_sysml2::generate::generate_sysml2(artifacts) → String`

Test plan

  • 12 tests (YAML parsing, generation, all relationship types, roundtrip)
  • Clippy clean, formatted
  • CI passes

🤖 Generated with Claude Code

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 2, 2026

Codecov Report

❌ Patch coverage is 82.89157% with 71 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
crates/spar-cli/src/main.rs 3.57% 54 Missing ⚠️
crates/spar-sysml2/src/generate.rs 95.26% 17 Missing ⚠️

📢 Thoughts on this report? Let us know!

…Phase 4)

Add `spar generate --from-rivet` command that reads rivet YAML artifacts
and generates SysML v2 source with:

- `requirement def` for each requirement artifact (with doc strings)
- `part def` / `action def` / `state def` for tagged components
- `satisfy`, `verify`, `refine`, `allocate`, `derive` relationships

The roundtrip is: SysML v2 → spar extract → rivet YAML → spar generate
→ SysML v2. Names are preserved via sanitize_sysml_name() and artifact
ID → title resolution.

New module: spar_sysml2::generate with parse_rivet_yaml() and
generate_sysml2() public API.

12 tests including a full roundtrip test (extract → YAML → generate →
verify output contains original constructs).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@avrabe avrabe force-pushed the feat/sysml2-roundtrip-phase4-90 branch from fd22517 to 6839d4b Compare April 2, 2026 23:48
@avrabe avrabe merged commit e8d196c into main Apr 3, 2026
10 of 11 checks passed
@avrabe avrabe deleted the feat/sysml2-roundtrip-phase4-90 branch April 3, 2026 00:51
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