sysml2kit 0.1.0__tar.gz → 0.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. sysml2kit-0.3.0/CHANGELOG.md +82 -0
  2. {sysml2kit-0.1.0 → sysml2kit-0.3.0}/PKG-INFO +51 -11
  3. {sysml2kit-0.1.0 → sysml2kit-0.3.0}/README.md +46 -10
  4. {sysml2kit-0.1.0 → sysml2kit-0.3.0}/SPEC.md +48 -0
  5. sysml2kit-0.3.0/docker/compose.yaml +35 -0
  6. sysml2kit-0.3.0/docs/api-client.md +49 -0
  7. {sysml2kit-0.1.0 → sysml2kit-0.3.0}/docs/backends.md +13 -8
  8. {sysml2kit-0.1.0 → sysml2kit-0.3.0}/docs/cli.md +6 -1
  9. sysml2kit-0.3.0/docs/mcp.md +34 -0
  10. {sysml2kit-0.1.0 → sysml2kit-0.3.0}/docs/quickstart.md +8 -5
  11. sysml2kit-0.3.0/docs/verification.md +87 -0
  12. sysml2kit-0.3.0/docs/views.md +24 -0
  13. {sysml2kit-0.1.0 → sysml2kit-0.3.0}/mkdocs.yml +3 -0
  14. {sysml2kit-0.1.0 → sysml2kit-0.3.0}/pyproject.toml +23 -3
  15. sysml2kit-0.3.0/scripts/wait_for_api.sh +17 -0
  16. {sysml2kit-0.1.0 → sysml2kit-0.3.0}/src/sysml2kit/_version.py +2 -2
  17. {sysml2kit-0.1.0 → sysml2kit-0.3.0}/src/sysml2kit/api/client.py +42 -1
  18. sysml2kit-0.3.0/src/sysml2kit/backends/sysmlpy.py +445 -0
  19. sysml2kit-0.3.0/src/sysml2kit/cli.py +401 -0
  20. {sysml2kit-0.1.0 → sysml2kit-0.3.0}/src/sysml2kit/interchange/reader.py +30 -2
  21. sysml2kit-0.3.0/src/sysml2kit/mcp/__init__.py +1 -0
  22. sysml2kit-0.3.0/src/sysml2kit/mcp/_common.py +23 -0
  23. sysml2kit-0.3.0/src/sysml2kit/mcp/server.py +57 -0
  24. sysml2kit-0.3.0/src/sysml2kit/mcp/tools_model.py +240 -0
  25. sysml2kit-0.3.0/src/sysml2kit/mcp/tools_requirements.py +133 -0
  26. sysml2kit-0.3.0/src/sysml2kit/verify/__init__.py +33 -0
  27. sysml2kit-0.3.0/src/sysml2kit/verify/binding.py +120 -0
  28. sysml2kit-0.3.0/src/sysml2kit/verify/engines.py +81 -0
  29. sysml2kit-0.3.0/src/sysml2kit/verify/runner.py +251 -0
  30. sysml2kit-0.3.0/src/sysml2kit/views.py +92 -0
  31. sysml2kit-0.3.0/src/sysml2kit/workspace.py +22 -0
  32. sysml2kit-0.3.0/tests/fixtures/RFParts.sysml +36 -0
  33. sysml2kit-0.3.0/tests/fixtures/RFRequirements.sysml +33 -0
  34. sysml2kit-0.3.0/tests/fixtures/SatcomTerminal28GHz.sysml +109 -0
  35. sysml2kit-0.3.0/tests/test_api_live.py +123 -0
  36. sysml2kit-0.3.0/tests/test_backend_fidelity.py +172 -0
  37. sysml2kit-0.3.0/tests/test_cli_api.py +70 -0
  38. sysml2kit-0.3.0/tests/test_cli_fmt.py +99 -0
  39. sysml2kit-0.3.0/tests/test_cli_verify.py +120 -0
  40. {sysml2kit-0.1.0 → sysml2kit-0.3.0}/tests/test_interop.py +24 -0
  41. sysml2kit-0.3.0/tests/test_mcp.py +135 -0
  42. sysml2kit-0.3.0/tests/test_text_writer/test_vehicle_golden.sysml +27 -0
  43. sysml2kit-0.3.0/tests/test_verify.py +216 -0
  44. sysml2kit-0.3.0/tests/test_views/test_trace_contains_all_edge_kinds.trace.mmd +9 -0
  45. sysml2kit-0.3.0/tests/test_views/test_tree_contains_hierarchy.tree.mmd +10 -0
  46. sysml2kit-0.3.0/tests/test_views.py +37 -0
  47. sysml2kit-0.3.0/tests/test_workspace.py +24 -0
  48. sysml2kit-0.3.0/tools/conformance/run_oracle.py +100 -0
  49. {sysml2kit-0.1.0 → sysml2kit-0.3.0}/uv.lock +515 -2
  50. sysml2kit-0.1.0/CHANGELOG.md +0 -33
  51. sysml2kit-0.1.0/docs/api-client.md +0 -28
  52. sysml2kit-0.1.0/src/sysml2kit/backends/sysmlpy.py +0 -119
  53. sysml2kit-0.1.0/src/sysml2kit/cli.py +0 -143
  54. sysml2kit-0.1.0/tools/conformance/run_oracle.py +0 -70
  55. {sysml2kit-0.1.0 → sysml2kit-0.3.0}/.gitignore +0 -0
  56. {sysml2kit-0.1.0 → sysml2kit-0.3.0}/.pre-commit-config.yaml +0 -0
  57. {sysml2kit-0.1.0 → sysml2kit-0.3.0}/.python-version +0 -0
  58. {sysml2kit-0.1.0 → sysml2kit-0.3.0}/CITATION.cff +0 -0
  59. {sysml2kit-0.1.0 → sysml2kit-0.3.0}/CLAUDE.md +0 -0
  60. {sysml2kit-0.1.0 → sysml2kit-0.3.0}/CONTRIBUTING.md +0 -0
  61. {sysml2kit-0.1.0 → sysml2kit-0.3.0}/LICENSE +0 -0
  62. {sysml2kit-0.1.0 → sysml2kit-0.3.0}/NOTICE +0 -0
  63. {sysml2kit-0.1.0 → sysml2kit-0.3.0}/SECURITY.md +0 -0
  64. {sysml2kit-0.1.0 → sysml2kit-0.3.0}/docs/concepts.md +0 -0
  65. {sysml2kit-0.1.0 → sysml2kit-0.3.0}/docs/index.md +0 -0
  66. {sysml2kit-0.1.0 → sysml2kit-0.3.0}/docs/interchange.md +0 -0
  67. {sysml2kit-0.1.0 → sysml2kit-0.3.0}/docs/reference.md +0 -0
  68. {sysml2kit-0.1.0 → sysml2kit-0.3.0}/docs/rf-library.md +0 -0
  69. {sysml2kit-0.1.0 → sysml2kit-0.3.0}/docs/traceability.md +0 -0
  70. {sysml2kit-0.1.0 → sysml2kit-0.3.0}/scripts/slopcheck.sh +0 -0
  71. {sysml2kit-0.1.0 → sysml2kit-0.3.0}/src/sysml2kit/__init__.py +0 -0
  72. {sysml2kit-0.1.0 → sysml2kit-0.3.0}/src/sysml2kit/api/__init__.py +0 -0
  73. {sysml2kit-0.1.0 → sysml2kit-0.3.0}/src/sysml2kit/api/errors.py +0 -0
  74. {sysml2kit-0.1.0 → sysml2kit-0.3.0}/src/sysml2kit/api/models.py +0 -0
  75. {sysml2kit-0.1.0 → sysml2kit-0.3.0}/src/sysml2kit/backends/__init__.py +0 -0
  76. {sysml2kit-0.1.0 → sysml2kit-0.3.0}/src/sysml2kit/backends/protocol.py +0 -0
  77. {sysml2kit-0.1.0 → sysml2kit-0.3.0}/src/sysml2kit/diff.py +0 -0
  78. {sysml2kit-0.1.0 → sysml2kit-0.3.0}/src/sysml2kit/graph.py +0 -0
  79. {sysml2kit-0.1.0 → sysml2kit-0.3.0}/src/sysml2kit/interchange/__init__.py +0 -0
  80. {sysml2kit-0.1.0 → sysml2kit-0.3.0}/src/sysml2kit/interchange/typemap.py +0 -0
  81. {sysml2kit-0.1.0 → sysml2kit-0.3.0}/src/sysml2kit/interchange/writer.py +0 -0
  82. {sysml2kit-0.1.0 → sysml2kit-0.3.0}/src/sysml2kit/interop/__init__.py +0 -0
  83. {sysml2kit-0.1.0 → sysml2kit-0.3.0}/src/sysml2kit/interop/requirements.py +0 -0
  84. {sysml2kit-0.1.0 → sysml2kit-0.3.0}/src/sysml2kit/model/__init__.py +0 -0
  85. {sysml2kit-0.1.0 → sysml2kit-0.3.0}/src/sysml2kit/model/analysis.py +0 -0
  86. {sysml2kit-0.1.0 → sysml2kit-0.3.0}/src/sysml2kit/model/base.py +0 -0
  87. {sysml2kit-0.1.0 → sysml2kit-0.3.0}/src/sysml2kit/model/builder.py +0 -0
  88. {sysml2kit-0.1.0 → sysml2kit-0.3.0}/src/sysml2kit/model/container.py +0 -0
  89. {sysml2kit-0.1.0 → sysml2kit-0.3.0}/src/sysml2kit/model/metadata.py +0 -0
  90. {sysml2kit-0.1.0 → sysml2kit-0.3.0}/src/sysml2kit/model/relations.py +0 -0
  91. {sysml2kit-0.1.0 → sysml2kit-0.3.0}/src/sysml2kit/model/requirements.py +0 -0
  92. {sysml2kit-0.1.0 → sysml2kit-0.3.0}/src/sysml2kit/model/structure.py +0 -0
  93. {sysml2kit-0.1.0 → sysml2kit-0.3.0}/src/sysml2kit/model/values.py +0 -0
  94. {sysml2kit-0.1.0 → sysml2kit-0.3.0}/src/sysml2kit/py.typed +0 -0
  95. {sysml2kit-0.1.0 → sysml2kit-0.3.0}/src/sysml2kit/query.py +0 -0
  96. {sysml2kit-0.1.0 → sysml2kit-0.3.0}/src/sysml2kit/text/__init__.py +0 -0
  97. {sysml2kit-0.1.0 → sysml2kit-0.3.0}/src/sysml2kit/text/keywords.py +0 -0
  98. {sysml2kit-0.1.0 → sysml2kit-0.3.0}/src/sysml2kit/text/writer.py +0 -0
  99. {sysml2kit-0.1.0 → sysml2kit-0.3.0}/src/sysml2kit/units.py +0 -0
  100. {sysml2kit-0.1.0 → sysml2kit-0.3.0}/src/sysml2kit/validation.py +0 -0
  101. {sysml2kit-0.1.0 → sysml2kit-0.3.0}/tests/conftest.py +0 -0
  102. /sysml2kit-0.1.0/tests/test_text_writer/test_vehicle_golden.sysml → /sysml2kit-0.3.0/tests/fixtures/vehicle.sysml +0 -0
  103. {sysml2kit-0.1.0 → sysml2kit-0.3.0}/tests/test_api_client.py +0 -0
  104. {sysml2kit-0.1.0 → sysml2kit-0.3.0}/tests/test_backend_sysmlpy.py +0 -0
  105. {sysml2kit-0.1.0 → sysml2kit-0.3.0}/tests/test_cli.py +0 -0
  106. {sysml2kit-0.1.0 → sysml2kit-0.3.0}/tests/test_diff.py +0 -0
  107. {sysml2kit-0.1.0 → sysml2kit-0.3.0}/tests/test_interchange.py +0 -0
  108. {sysml2kit-0.1.0 → sysml2kit-0.3.0}/tests/test_model.py +0 -0
  109. {sysml2kit-0.1.0 → sysml2kit-0.3.0}/tests/test_package.py +0 -0
  110. {sysml2kit-0.1.0 → sysml2kit-0.3.0}/tests/test_query.py +0 -0
  111. {sysml2kit-0.1.0 → sysml2kit-0.3.0}/tests/test_roundtrip_json.py +0 -0
  112. {sysml2kit-0.1.0 → sysml2kit-0.3.0}/tests/test_roundtrip_text.py +0 -0
  113. {sysml2kit-0.1.0 → sysml2kit-0.3.0}/tests/test_text_writer.py +0 -0
  114. {sysml2kit-0.1.0 → sysml2kit-0.3.0}/tests/test_validation.py +0 -0
  115. {sysml2kit-0.1.0 → sysml2kit-0.3.0}/tests/test_values_units.py +0 -0
@@ -0,0 +1,82 @@
1
+ # Changelog
2
+
3
+ ## 0.3.0 — 2026-08-21
4
+
5
+ - **Verification execution** (`sysml2kit.verify`): `verificationBinding`
6
+ metadata binds an analysis case to an engine resolved by name from the
7
+ `sysml2kit.engines` entry-point group (model text never names code paths).
8
+ `run_verification` executes bound analyses and checks each metricKey
9
+ requirement with margins; `apply_results` writes metrics and verdicts back
10
+ into the model with provenance, idempotently. CLI `sysml2kit verify`, MCP
11
+ tool `requirements_verify` (nine tools now), `verify` extra for YAML
12
+ configs, and a `docs/verification.md` flagship page. First engine:
13
+ phased-array-systems (PR #2 there).
14
+ - **Live-server harness**: `docker/compose.yaml` runs the pilot
15
+ implementation (digest-pinned) + postgres; `api`-marked round-trip tests
16
+ pass against the real server; weekly advisory `live-api` workflow. Live
17
+ testing hardened the client and reader for the pilot dialect: list-typed
18
+ endpoints/typing/text adapted on push and tolerated on read, verify/derive
19
+ pushed as Dependency, multiplicity/doc dropped by the server, server-minted
20
+ element ids; known-@type records that do not fit the profile now degrade to
21
+ OpaqueElement instead of failing the read.
22
+ - **`api` CLI group**: `projects`, `pull` (newest commit by default),
23
+ `push --create`; `SYSML2KIT_API_URL`/`SYSML2KIT_API_TOKEN` env vars;
24
+ `SysMLApiClient.head_commit`.
25
+ - **Diagrams docs page** and a README refresh for the 0.3 surface.
26
+ - Upstream sysmlpy fixes submitted for the two pinned parse losses:
27
+ dependency statements (mycr0ft/sysmlpy#7) and allocate endpoints
28
+ (mycr0ft/sysmlpy#6).
29
+
30
+ ## 0.2.0 — 2026-08-21
31
+
32
+ - **Parse fidelity**: the sysmlpy backend now walks the raw ANTLR dict
33
+ (`load_grammar_antlr`) instead of the lossy wrapper objects. Short names,
34
+ feature typing (incl. cross-package), multiplicity, attribute values with
35
+ units, requirement subjects and text, docs, and satisfy statements survive
36
+ a text parse. Upstream visitor losses (dependency statements, allocate and
37
+ connect endpoints, verification cases) are pinned by tests, documented in
38
+ SPEC.md, and filed upstream (sysmlpy #4, #5).
39
+ - **MCP server** (`pip install sysml2kit[mcp]`; `sysml2kit mcp serve`):
40
+ eight tools — model_show, model_validate, model_diff, model_export,
41
+ model_diagram, requirements_trace, requirements_extract, library_load.
42
+ - **`fmt` command** with a loss-refusing safety gate (grammar-signature and
43
+ model-diff comparison; `--lossy` to override, `--check` for CI).
44
+ - **Mermaid views** (`sysml2kit.views`): ownership tree and requirement
45
+ trace diagrams; `export --to mermaid` and the model_diagram tool.
46
+ - **Conformance oracle** pinned to windtrader-java 0.1.1 (sha256-verified,
47
+ out-of-process pilot parser); weekly workflow green.
48
+ - Downstream bridges landed as PRs: phased-array-systems#1 (op-form
49
+ RequirementSet) and aedl#1 (bound-form requirements); the RequirementSpec
50
+ field set is now frozen by a schema test.
51
+
52
+ ## 0.1.0 — 2026-08-21
53
+
54
+ First working release.
55
+
56
+ - Object model: the pragmatic profile (~20 element kinds) as pydantic
57
+ classes, `Model` container with identity/ownership/qualified names,
58
+ `assign_stable_ids()` (UUIDv5), fluent builder API, `AttributeValue` with
59
+ unit text and provenance, pint-backed unit helpers.
60
+ - JSON interchange: Systems Modeling API serialization reader/writer,
61
+ deterministic output, `OpaqueElement` passthrough for unknown `@type`s;
62
+ json→model→json fixpoint property-tested.
63
+ - Textual notation writer: deterministic `.sysml` output; verified against
64
+ the sysmlpy parser (write → parse → structural compare).
65
+ - Traceability queries: satisfied_by/verified_by/derived_from,
66
+ unsatisfied/unverified requirements, allocation table, trace matrix.
67
+ - Validation: rules S2K001–S2K009 with severities and stable ids.
68
+ - Diff: element-level with `--by-name` matching for regenerated ids.
69
+ - API client: hand-written httpx client for the Systems Modeling API
70
+ (projects/branches/commits/elements reads, create_project, push_model).
71
+ - Parser backends: `ParserBackend` protocol; sysmlpy adapter behind the
72
+ `parse` extra.
73
+ - Interop: `extract_requirements` reading the metricKey convention, with
74
+ dual-form thresholds for operator-style and bound-style engines.
75
+ - CLI: `show` (`--traceability`), `validate`, `diff`, `export`
76
+ (`--stable-ids`), `version`.
77
+ - Docs site, conformance-oracle workflow scaffold, prose lint tooling.
78
+
79
+ ## 0.0.1 — 2026-08-21
80
+
81
+ - Package skeleton published to claim the PyPI name. Importable, no usable
82
+ functionality yet.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sysml2kit
3
- Version: 0.1.0
3
+ Version: 0.3.0
4
4
  Summary: API-first Python tooling for building, querying, validating, and automating SysML v2 models
5
5
  Project-URL: Homepage, https://github.com/jman4162/sysml2kit
6
6
  Project-URL: Source, https://github.com/jman4162/sysml2kit
@@ -30,8 +30,12 @@ Requires-Dist: pydantic>=2.7
30
30
  Requires-Dist: typer>=0.12
31
31
  Provides-Extra: graph
32
32
  Requires-Dist: networkx>=3.2; extra == 'graph'
33
+ Provides-Extra: mcp
34
+ Requires-Dist: mcp<2,>=1.26; extra == 'mcp'
33
35
  Provides-Extra: parse
34
36
  Requires-Dist: sysmlpy<0.37,>=0.36.2; extra == 'parse'
37
+ Provides-Extra: verify
38
+ Requires-Dist: pyyaml>=6.0; extra == 'verify'
35
39
  Description-Content-Type: text/markdown
36
40
 
37
41
  # sysml2kit
@@ -40,20 +44,25 @@ Description-Content-Type: text/markdown
40
44
  [![PyPI](https://img.shields.io/pypi/v/sysml2kit)](https://pypi.org/project/sysml2kit/)
41
45
  [![Python](https://img.shields.io/pypi/pyversions/sysml2kit)](https://pypi.org/project/sysml2kit/)
42
46
  [![License](https://img.shields.io/badge/license-Apache--2.0-blue)](LICENSE)
47
+ [![Docs](https://img.shields.io/badge/docs-jman4162.github.io-blue)](https://jman4162.github.io/sysml2kit/)
43
48
 
44
49
  API-first Python tooling for building, querying, validating, and automating
45
50
  SysML v2 models.
46
51
 
47
- > **Status: pre-alpha.** The 0.1.x line has a working core (model, writer,
48
- > interchange, queries, validation, diff, API client, parse backend); the API
49
- > may still move between minor versions. Pin an exact version if you depend
50
- > on it.
52
+ > **Status: pre-alpha.** The 0.3.x line covers the full loop: model, writer,
53
+ > interchange, queries, validation, diff, mermaid views, parse backend, MCP
54
+ > server, API client with a live-server harness, and verification execution.
55
+ > The API may still move between minor versions; pin an exact version if you
56
+ > depend on it. Changes: [CHANGELOG.md](CHANGELOG.md).
51
57
 
52
58
  `sysml2kit` is the requirements/architecture/traceability layer for
53
59
  engineering automation stacks: build a system model in Python, emit standard
54
60
  SysML v2 textual notation and Systems Modeling API JSON, run traceability
55
61
  queries (which requirements are unsatisfied? unverified? allocated where?),
56
- validate, and diff. It targets the OMG SysML v2 standard, not any vendor tool.
62
+ validate, diff, and **execute verification**: analyses bound to registered
63
+ engines run for real, and their metrics check the model's requirements. It
64
+ targets the OMG SysML v2 standard, not any vendor tool. Docs:
65
+ https://jman4162.github.io/sysml2kit/
57
66
 
58
67
  ## What it does
59
68
 
@@ -70,8 +79,15 @@ validate, and diff. It targets the OMG SysML v2 standard, not any vendor tool.
70
79
  - **Traceability queries**: unsatisfied/unverified requirements, allocation
71
80
  tables, requirement-to-part trace matrices.
72
81
  - **Validation and diff**: rule-based model checks and element-level diffs.
82
+ - **Verification execution**: `verificationBinding` metadata binds an
83
+ analysis case to an engine from the `sysml2kit.engines` entry-point group;
84
+ `sysml2kit verify` runs it and checks each requirement with margins, and
85
+ can write results back into the model with provenance.
86
+ - **Mermaid views**: ownership-tree and requirement-trace diagrams.
87
+ - **MCP server**: nine tools for agents (`sysml2kit mcp serve`).
73
88
  - **API client**: a thin HTTP client for the OMG Systems Modeling API and
74
- Services endpoints.
89
+ Services endpoints, plus a docker compose harness running the pilot
90
+ implementation for live round-trip testing.
75
91
 
76
92
  ## Install
77
93
 
@@ -79,6 +95,8 @@ validate, and diff. It targets the OMG SysML v2 standard, not any vendor tool.
79
95
  pip install sysml2kit # core: build, write, query, validate, diff
80
96
  pip install "sysml2kit[parse]" # + read .sysml files (sysmlpy backend)
81
97
  pip install "sysml2kit[graph]" # + NetworkX export
98
+ pip install "sysml2kit[mcp]" # + MCP server for agents
99
+ pip install "sysml2kit[verify]" # + YAML verification-binding configs
82
100
  ```
83
101
 
84
102
  ## Quick start
@@ -117,9 +135,13 @@ sysml2kit
117
135
  ├── query # traceability queries
118
136
  ├── validation # rule-based checks (S2K001...)
119
137
  ├── diff # element-level model diff
138
+ ├── views # mermaid diagrams (trace, tree)
139
+ ├── verify # verification bindings, engine registry, runner
120
140
  ├── api # Systems Modeling API HTTP client
121
141
  ├── backends # parser backends (sysmlpy behind the [parse] extra)
122
142
  ├── interop # tool-agnostic requirement extraction
143
+ ├── mcp # MCP server (behind the [mcp] extra)
144
+ ├── graph, units, workspace # NetworkX export, pint helpers, path safety
123
145
  └── cli # `sysml2kit` command line
124
146
  ```
125
147
 
@@ -129,13 +151,31 @@ The spec pin, element subset, and known deviations are documented in
129
151
 
130
152
  Domain content lives outside the kit. For antenna/RF systems engineering, see
131
153
  [sysml2kit-rf-library](https://github.com/jman4162/sysml2kit-rf-library), a
132
- SysML v2 model library consumed through this package.
154
+ SysML v2 model library consumed through this package. Downstream bridges are
155
+ merged in [phased-array-systems](https://github.com/jman4162/phased-array-systems)
156
+ (`interop.sysml`: requirement sets and the `phased-array-systems` verification
157
+ engine) and [aedl](https://github.com/jman4162/aedl-electromagnetic-design-agent)
158
+ (`aedl.interop`: bound-form requirements).
133
159
 
134
160
  ## For agents
135
161
 
136
- The CLI (`sysml2kit show | validate | diff | export`) is the current
137
- automation surface. An MCP server is planned for v0.2 under
138
- `sysml2kit.mcp`.
162
+ An MCP server ships behind the `mcp` extra with nine tools: `model_show`,
163
+ `model_validate`, `model_diff`, `model_export`, `model_diagram`,
164
+ `requirements_trace`, `requirements_extract`, `requirements_verify`, `library_load`. Artifacts are
165
+ returned as file paths, not payloads.
166
+
167
+ ```bash
168
+ pip install "sysml2kit[mcp,parse]"
169
+ sysml2kit mcp serve # stdio; --transport http also supported
170
+ ```
171
+
172
+ ```json
173
+ {"mcpServers": {"sysml2kit": {"command": "sysml2kit", "args": ["mcp", "serve"]}}}
174
+ ```
175
+
176
+ The CLI covers the same operations for shell use:
177
+ `sysml2kit show | validate | diff | export | fmt | verify | api | mcp serve`
178
+ (`export --to mermaid` renders diagrams).
139
179
 
140
180
  ## Development
141
181
 
@@ -4,20 +4,25 @@
4
4
  [![PyPI](https://img.shields.io/pypi/v/sysml2kit)](https://pypi.org/project/sysml2kit/)
5
5
  [![Python](https://img.shields.io/pypi/pyversions/sysml2kit)](https://pypi.org/project/sysml2kit/)
6
6
  [![License](https://img.shields.io/badge/license-Apache--2.0-blue)](LICENSE)
7
+ [![Docs](https://img.shields.io/badge/docs-jman4162.github.io-blue)](https://jman4162.github.io/sysml2kit/)
7
8
 
8
9
  API-first Python tooling for building, querying, validating, and automating
9
10
  SysML v2 models.
10
11
 
11
- > **Status: pre-alpha.** The 0.1.x line has a working core (model, writer,
12
- > interchange, queries, validation, diff, API client, parse backend); the API
13
- > may still move between minor versions. Pin an exact version if you depend
14
- > on it.
12
+ > **Status: pre-alpha.** The 0.3.x line covers the full loop: model, writer,
13
+ > interchange, queries, validation, diff, mermaid views, parse backend, MCP
14
+ > server, API client with a live-server harness, and verification execution.
15
+ > The API may still move between minor versions; pin an exact version if you
16
+ > depend on it. Changes: [CHANGELOG.md](CHANGELOG.md).
15
17
 
16
18
  `sysml2kit` is the requirements/architecture/traceability layer for
17
19
  engineering automation stacks: build a system model in Python, emit standard
18
20
  SysML v2 textual notation and Systems Modeling API JSON, run traceability
19
21
  queries (which requirements are unsatisfied? unverified? allocated where?),
20
- validate, and diff. It targets the OMG SysML v2 standard, not any vendor tool.
22
+ validate, diff, and **execute verification**: analyses bound to registered
23
+ engines run for real, and their metrics check the model's requirements. It
24
+ targets the OMG SysML v2 standard, not any vendor tool. Docs:
25
+ https://jman4162.github.io/sysml2kit/
21
26
 
22
27
  ## What it does
23
28
 
@@ -34,8 +39,15 @@ validate, and diff. It targets the OMG SysML v2 standard, not any vendor tool.
34
39
  - **Traceability queries**: unsatisfied/unverified requirements, allocation
35
40
  tables, requirement-to-part trace matrices.
36
41
  - **Validation and diff**: rule-based model checks and element-level diffs.
42
+ - **Verification execution**: `verificationBinding` metadata binds an
43
+ analysis case to an engine from the `sysml2kit.engines` entry-point group;
44
+ `sysml2kit verify` runs it and checks each requirement with margins, and
45
+ can write results back into the model with provenance.
46
+ - **Mermaid views**: ownership-tree and requirement-trace diagrams.
47
+ - **MCP server**: nine tools for agents (`sysml2kit mcp serve`).
37
48
  - **API client**: a thin HTTP client for the OMG Systems Modeling API and
38
- Services endpoints.
49
+ Services endpoints, plus a docker compose harness running the pilot
50
+ implementation for live round-trip testing.
39
51
 
40
52
  ## Install
41
53
 
@@ -43,6 +55,8 @@ validate, and diff. It targets the OMG SysML v2 standard, not any vendor tool.
43
55
  pip install sysml2kit # core: build, write, query, validate, diff
44
56
  pip install "sysml2kit[parse]" # + read .sysml files (sysmlpy backend)
45
57
  pip install "sysml2kit[graph]" # + NetworkX export
58
+ pip install "sysml2kit[mcp]" # + MCP server for agents
59
+ pip install "sysml2kit[verify]" # + YAML verification-binding configs
46
60
  ```
47
61
 
48
62
  ## Quick start
@@ -81,9 +95,13 @@ sysml2kit
81
95
  ├── query # traceability queries
82
96
  ├── validation # rule-based checks (S2K001...)
83
97
  ├── diff # element-level model diff
98
+ ├── views # mermaid diagrams (trace, tree)
99
+ ├── verify # verification bindings, engine registry, runner
84
100
  ├── api # Systems Modeling API HTTP client
85
101
  ├── backends # parser backends (sysmlpy behind the [parse] extra)
86
102
  ├── interop # tool-agnostic requirement extraction
103
+ ├── mcp # MCP server (behind the [mcp] extra)
104
+ ├── graph, units, workspace # NetworkX export, pint helpers, path safety
87
105
  └── cli # `sysml2kit` command line
88
106
  ```
89
107
 
@@ -93,13 +111,31 @@ The spec pin, element subset, and known deviations are documented in
93
111
 
94
112
  Domain content lives outside the kit. For antenna/RF systems engineering, see
95
113
  [sysml2kit-rf-library](https://github.com/jman4162/sysml2kit-rf-library), a
96
- SysML v2 model library consumed through this package.
114
+ SysML v2 model library consumed through this package. Downstream bridges are
115
+ merged in [phased-array-systems](https://github.com/jman4162/phased-array-systems)
116
+ (`interop.sysml`: requirement sets and the `phased-array-systems` verification
117
+ engine) and [aedl](https://github.com/jman4162/aedl-electromagnetic-design-agent)
118
+ (`aedl.interop`: bound-form requirements).
97
119
 
98
120
  ## For agents
99
121
 
100
- The CLI (`sysml2kit show | validate | diff | export`) is the current
101
- automation surface. An MCP server is planned for v0.2 under
102
- `sysml2kit.mcp`.
122
+ An MCP server ships behind the `mcp` extra with nine tools: `model_show`,
123
+ `model_validate`, `model_diff`, `model_export`, `model_diagram`,
124
+ `requirements_trace`, `requirements_extract`, `requirements_verify`, `library_load`. Artifacts are
125
+ returned as file paths, not payloads.
126
+
127
+ ```bash
128
+ pip install "sysml2kit[mcp,parse]"
129
+ sysml2kit mcp serve # stdio; --transport http also supported
130
+ ```
131
+
132
+ ```json
133
+ {"mcpServers": {"sysml2kit": {"command": "sysml2kit", "args": ["mcp", "serve"]}}}
134
+ ```
135
+
136
+ The CLI covers the same operations for shell use:
137
+ `sysml2kit show | validate | diff | export | fmt | verify | api | mcp serve`
138
+ (`export --to mermaid` renders diagrams).
103
139
 
104
140
  ## Development
105
141
 
@@ -46,6 +46,27 @@ not drop elements the profile lacks classes for.
46
46
  - **Documentation is a field** (`Element.doc`), not an owned `Documentation`
47
47
  element; the writer emits `doc /* ... */` bodies.
48
48
 
49
+ ## Text parse fidelity (sysmlpy backend, 0.36.x)
50
+
51
+ The backend parses via ``sysmlpy.load_grammar_antlr`` and walks the raw
52
+ ANTLR dict (the wrapper-object loader rebuilds usage bodies lossily and is
53
+ not used). What survives a text round trip:
54
+
55
+ | Round-trips | Lost upstream (sysmlpy visitor discards it) |
56
+ |---|---|
57
+ | names, short names | `dependency A to B;` statements (how the writer emits verify/derive) |
58
+ | docs (package/part/requirement scope) | `allocate X to Y;` endpoints |
59
+ | feature typing, incl. cross-package | `connect a.pa to b.pb;` endpoints |
60
+ | multiplicity | `verification` case usages (dropped entirely) |
61
+ | attribute values with units | value provenance (`source`/`confidence` have no textual slot) |
62
+ | requirement subject and text | |
63
+ | satisfy (package level and inside part bodies) | |
64
+
65
+ Consequence: **satisfy traceability survives text; verify/derive/allocate
66
+ require the JSON interchange.** The losses are pinned by tests in
67
+ `tests/test_backend_fidelity.py` so an upstream sysmlpy fix surfaces as a
68
+ test failure.
69
+
49
70
  ## Identity and ownership
50
71
 
51
72
  - Every element has a UUID `element_id`, mapping to the API JSON `@id`.
@@ -56,6 +77,33 @@ not drop elements the profile lacks classes for.
56
77
  - `Model.assign_stable_ids()` rewrites ids as UUIDv5 hashes of qualified
57
78
  names so generated interchange files diff cleanly under version control.
58
79
 
80
+ ## Verification binding convention
81
+
82
+ A ``MetadataUsage`` named ``verificationBinding`` annotating an
83
+ ``AnalysisCaseUsage`` binds that analysis to an executable engine. Values
84
+ (flat scalars, per the metadata model):
85
+
86
+ | key | type | meaning |
87
+ |---|---|---|
88
+ | ``engine`` | str, required | registry name, e.g. ``"phased-array-systems"`` |
89
+ | ``configRef`` | str, optional | ``.yaml``/``.yml``/``.json`` payload file next to the model file (resolved relative to its directory, containment-checked; no ``..``) |
90
+ | ``payload.<dotted>`` | scalar, optional | override deep-merged over the loaded config; dotted keys expand to nested dicts |
91
+
92
+ Engines resolve **by name** against a registry populated from the
93
+ ``sysml2kit.engines`` entry-point group and explicit caller registration.
94
+ Model text never names importable code paths — models are data. The runner
95
+ does not interpret payload contents; each engine owns its payload schema
96
+ (engines needing a config plus scalar arguments define reserved top-level
97
+ keys such as ``config``/``args``).
98
+
99
+ Results written back by ``sysml2kit.verify.apply_results`` are attributes on
100
+ the analysis (``source`` starts with ``sysml2kit.verify``) and a
101
+ ``verificationVerdict`` metadata on each requirement; both replace prior
102
+ same-named results, so reruns do not accumulate.
103
+
104
+ Bindings are an interchange-JSON feature: metadata values round-trip through
105
+ JSON, while textual-notation fidelity for metadata is not yet pinned.
106
+
59
107
  ## Provenance on values
60
108
 
61
109
  `AttributeValue` carries optional `source` and `confidence` fields, following
@@ -0,0 +1,35 @@
1
+ # Local Systems Modeling API server (the OMG pilot implementation) for
2
+ # live-client testing: docker compose -f docker/compose.yaml up -d
3
+ # then scripts/wait_for_api.sh and pytest -m api with
4
+ # SYSML2KIT_API_URL=http://localhost:9000.
5
+ #
6
+ # The app image is the MBSE-mashup containerization of the pilot, pinned by
7
+ # digest (tag 244c221a..., pushed 2025-12-12). Its entrypoint rewrites
8
+ # persistence.xml from the JDBC_*/HIBERNATE_* env vars; hbm2ddl=update
9
+ # creates the schema on first boot. amd64-only: Apple-silicon hosts run it
10
+ # under emulation (the platform key below).
11
+ services:
12
+ db:
13
+ image: postgres:16
14
+ environment:
15
+ POSTGRES_PASSWORD: mysecretpassword
16
+ POSTGRES_DB: sysml2
17
+ healthcheck:
18
+ test: ["CMD-SHELL", "pg_isready -U postgres -d sysml2"]
19
+ interval: 5s
20
+ timeout: 3s
21
+ retries: 24
22
+
23
+ api:
24
+ image: mbsemashup/sysmlv2-api.pilotimpl@sha256:ac5607986dd529fc98a55aa391ac9f51b275c36f74f946285121c896f7e914c6
25
+ platform: linux/amd64
26
+ depends_on:
27
+ db:
28
+ condition: service_healthy
29
+ ports:
30
+ - "9000:9000"
31
+ environment:
32
+ JDBC_URL: jdbc:postgresql://db:5432/sysml2
33
+ JDBC_USER: postgres
34
+ JDBC_PASSWORD: mysecretpassword
35
+ HIBERNATE_HBM2DDL: update
@@ -0,0 +1,49 @@
1
+ # API client
2
+
3
+ `sysml2kit.api.SysMLApiClient` is a hand-written httpx client for the OMG
4
+ Systems Modeling API and Services endpoints (the REST binding any conformant
5
+ model server exposes).
6
+
7
+ ```python
8
+ from sysml2kit.api import SysMLApiClient
9
+
10
+ with SysMLApiClient("https://models.example.com", token="…") as client:
11
+ for project in client.list_projects():
12
+ print(project.id, project.name)
13
+ model = client.list_elements(project_id, commit_id) # -> sysml2kit Model
14
+ client.push_model(project_id, model, message="update")
15
+ ```
16
+
17
+ Covered in v0.1: `list_projects`, `get_project`, `list_branches`,
18
+ `list_commits`, `get_commit`, `get_element`, `list_elements` (returns a
19
+ `Model` via the interchange reader), `create_project`, and `push_model`
20
+ (POSTs a commit whose change set inserts the model's records). Branch
21
+ management and merges are not covered yet.
22
+
23
+ Failures raise `ApiError(status, detail)`. The client sends the bearer token
24
+ to whatever base URL you configure; use HTTPS.
25
+
26
+ ## Local live server and the pilot dialect
27
+
28
+ `docker compose -f docker/compose.yaml up -d` starts the pilot
29
+ implementation (sha-pinned image + postgres); `scripts/wait_for_api.sh`
30
+ polls until it answers, and `SYSML2KIT_API_URL=http://localhost:9000
31
+ pytest -m api` runs the live round-trip suite (a weekly advisory workflow
32
+ does the same in CI). The CLI mirrors the client:
33
+
34
+ ```bash
35
+ export SYSML2KIT_API_URL=http://localhost:9000
36
+ sysml2kit api projects
37
+ sysml2kit api push model.json --project demo --create
38
+ sysml2kit api pull demo -o pulled.json
39
+ ```
40
+
41
+ The pilot speaks the full abstract syntax, so `push_model` adapts records on
42
+ the way out and the interchange reader tolerates the differences on the way
43
+ back. What survives a server round trip: element kinds, names, short names,
44
+ requirement text. What does not (documented degradations — full fidelity
45
+ lives in interchange JSON files): ownership (the pilot models it as
46
+ OwningMembership elements and ignores our owner key), verify/derive kinds
47
+ (pushed as `Dependency`), multiplicity and doc strings (dropped), and
48
+ element ids (the server mints its own, so stable-id workflows are
49
+ local-file-only).
@@ -15,14 +15,19 @@ model = backend.parse_files([path_a, path_b])
15
15
 
16
16
  `pip install sysml2kit[parse]` installs
17
17
  [sysmlpy](https://github.com/mycr0ft/sysmlpy) (MIT, ANTLR4-based). The
18
- adapter maps its parse tree into the pragmatic profile; constructs the
19
- profile lacks come back as `OpaqueElement` with a logged warning.
20
-
21
- Fidelity: sysmlpy 0.36 does not surface typing, multiplicity, or attribute
22
- values on its wrapper objects, so those fields are empty after a parse.
23
- Names, kinds, docs, and ownership round-trip; the writer-emit → parse →
24
- compare test in CI pins exactly that contract. Use JSON interchange when you
25
- need full fidelity.
18
+ backend parses with `sysmlpy.load_grammar_antlr` and walks the raw ANTLR
19
+ dict sysmlpy's own wrapper loader rebuilds usage bodies lossily, so the
20
+ wrappers are not used.
21
+
22
+ Fidelity: names, short names, docs, feature typing (including
23
+ cross-package), multiplicity, attribute values with units, requirement
24
+ subjects, and satisfy statements survive a text parse. What cannot
25
+ round-trip is what sysmlpy's visitor discards before we see it: `dependency`
26
+ statements (how the writer emits verify/derive), `allocate` and `connect`
27
+ endpoints, and `verification` cases (filed upstream as sysmlpy #4 and #5).
28
+ The fidelity table lives in SPEC.md and is pinned by
29
+ `tests/test_backend_fidelity.py`. Use JSON interchange when you need the
30
+ full traceability graph.
26
31
 
27
32
  The dependency is capped (`sysmlpy>=0.36.2,<0.37`) because it has a single
28
33
  maintainer; bumps are deliberate, after reading the release notes.
@@ -12,8 +12,13 @@ sysml2kit diff old.json new.json --by-name # match by qualified name, not id
12
12
  sysml2kit export model.sysml --to json -o model.json
13
13
  sysml2kit export model.json --to sysml
14
14
  sysml2kit export model.json --to json --stable-ids # UUIDv5 ids for committing
15
+ sysml2kit export model.json --to mermaid --diagram trace # or tree
16
+ sysml2kit fmt model.sysml # refuses lossy rewrites; --lossy overrides
17
+ sysml2kit fmt model.sysml --check # CI mode: exit 1 if it would change
18
+ sysml2kit mcp serve # MCP server (mcp extra)
15
19
  sysml2kit version
16
20
  ```
17
21
 
18
22
  Exit codes: `validate` returns 1 when any error-severity issue is found;
19
- `diff` returns 1 when the models differ. Both suit CI gates.
23
+ `diff` returns 1 when the models differ; `fmt --check` returns 1 when the
24
+ file would change. All suit CI gates.
@@ -0,0 +1,34 @@
1
+ # MCP server
2
+
3
+ `pip install "sysml2kit[mcp]"` and run:
4
+
5
+ ```bash
6
+ sysml2kit mcp serve # stdio (default)
7
+ sysml2kit mcp serve --transport http # streamable HTTP
8
+ ```
9
+
10
+ Client config:
11
+
12
+ ```json
13
+ {"mcpServers": {"sysml2kit": {"command": "sysml2kit", "args": ["mcp", "serve"]}}}
14
+ ```
15
+
16
+ Every tool takes model file paths (`.json` interchange always works;
17
+ `.sysml` needs the `parse` extra), returns a JSON dict with a `status` key,
18
+ and reports failures as `{"error": ..., "status": "failed"}` instead of
19
+ raising. Artifacts are returned as file paths, not payloads.
20
+
21
+ | Tool | What it does |
22
+ |---|---|
23
+ | `model_show(path, traceability)` | Element tree, kind counts, optional trace matrix |
24
+ | `model_validate(path)` | S2K rule issues with severity counts |
25
+ | `model_diff(path_a, path_b, by_name)` | Element-level differences (capped list) |
26
+ | `model_export(path, out, to, stable_ids)` | Convert to interchange JSON or `.sysml` |
27
+ | `model_diagram(path, out, kind)` | Write a mermaid `.mmd` (trace or tree view) |
28
+ | `requirements_trace(path)` | Matrix plus unsatisfied/unverified lists |
29
+ | `requirements_extract(path)` | `RequirementSpec` list (the adapter payload) |
30
+ | `library_load(name, out)` | Write a packaged rf-library model as JSON |
31
+
32
+ A typical agent loop: write a `.sysml` file, `model_validate` it, fix issues,
33
+ `requirements_trace` to check coverage, `model_export --stable-ids` to commit
34
+ the interchange form, `model_diagram` to explain the result.
@@ -13,18 +13,21 @@ model = Model()
13
13
  pkg = builder.pkg(model, "Vehicle")
14
14
  battery = builder.part(model, "battery", owner=pkg)
15
15
  range_req = builder.req(
16
- model, "REQ-001", "Range", owner=pkg,
16
+ model,
17
+ "REQ-001",
18
+ "Range",
19
+ owner=pkg,
17
20
  text="The vehicle shall travel at least 400 km on one charge.",
18
21
  )
19
22
  builder.satisfy(model, source=battery, target=range_req)
20
23
 
21
- print(unverified_requirements(model)) # [REQ-001] - nothing verifies it yet
22
- print(trace_matrix(model).render()) # requirement-by-part grid
24
+ print(unverified_requirements(model)) # [REQ-001] - nothing verifies it yet
25
+ print(trace_matrix(model).render()) # requirement-by-part grid
23
26
  for issue in validate(model):
24
27
  print(issue.rule_id, issue.severity, issue.message)
25
28
 
26
- print(write_model(model)) # SysML v2 textual notation
27
- write_json(model, "vehicle.json") # Systems Modeling API interchange
29
+ print(write_model(model)) # SysML v2 textual notation
30
+ write_json(model, "vehicle.json") # Systems Modeling API interchange
28
31
  ```
29
32
 
30
33
  The same operations from the command line:
@@ -0,0 +1,87 @@
1
+ # Verification execution
2
+
3
+ `sysml2kit.verify` closes the loop the traceability queries only describe:
4
+ it runs the analyses a model's verify links point at and checks each
5
+ requirement against real metrics.
6
+
7
+ ## The binding convention
8
+
9
+ An analysis case becomes executable when it carries a `verificationBinding`
10
+ metadata (see SPEC.md for the normative statement):
11
+
12
+ ```python
13
+ from sysml2kit.model import builder
14
+
15
+ analysis = builder.analysis(model, "pasStudy", owner=pkg, subject=terminal)
16
+ builder.verify(model, source=analysis, target=link_margin_req, owner=pkg)
17
+ builder.metadata(
18
+ model,
19
+ analysis,
20
+ {"engine": "phased-array-systems", "configRef": "study.yaml"},
21
+ name="verificationBinding",
22
+ )
23
+ ```
24
+
25
+ - `engine` names an entry in the engine registry — never a code path.
26
+ Models are data; the registry decides what runs.
27
+ - `configRef` points at a YAML/JSON payload next to the model file.
28
+ - `payload.<dotted>` values override entries in the loaded config
29
+ (`payload.scenario.range_km: 500`).
30
+
31
+ ## Engines
32
+
33
+ An engine is a callable: payload dict in, flat metrics mapping out.
34
+ Packages ship engines through the `sysml2kit.engines` entry-point group:
35
+
36
+ ```toml
37
+ [project.entry-points."sysml2kit.engines"]
38
+ phased-array-systems = "phased_array_systems.interop.sysml:run_study"
39
+ ```
40
+
41
+ Installing such a package makes its engine available by name. The CLI also
42
+ accepts operator-supplied engines (`--engine name=module:function`), and
43
+ library callers register directly on an `EngineRegistry`.
44
+
45
+ ## Running
46
+
47
+ ```bash
48
+ sysml2kit verify model.json --report run.json
49
+ sysml2kit verify model.json --write-back -o annotated.json
50
+ ```
51
+
52
+ ```python
53
+ from sysml2kit.verify import run_verification, apply_results
54
+
55
+ run = run_verification(model, model_path=path)
56
+ print(run.passed)
57
+ for verdict in run.requirements:
58
+ print(verdict.requirement_id, verdict.status, verdict.margin)
59
+ apply_results(model, run) # record results into the model, idempotent
60
+ ```
61
+
62
+ Each requirement verdict carries the metric key, operator, threshold,
63
+ actual value, and margin; `passed` is true only when every must-severity
64
+ requirement passes and no engine errored. Metrics that are absent or
65
+ non-numeric yield `unknown`, which does not pass. Engine exceptions are
66
+ captured per analysis, never raised.
67
+
68
+ Write-back records each checked metric as an attribute on its analysis with
69
+ a provenance `source` (`sysml2kit.verify <engine>==<version> <timestamp>`)
70
+ and a `verificationVerdict` metadata on each requirement, replacing prior
71
+ results so reruns do not accumulate.
72
+
73
+ Over MCP, the `requirements_verify` tool runs the same flow with
74
+ entry-point engines only, returning `passed`, must-failures, and the report
75
+ path.
76
+
77
+ ## End to end with the RF library
78
+
79
+ With `phased-array-systems` and `sysml2kit-rf-library` installed:
80
+
81
+ ```bash
82
+ MODEL=$(python -c 'import sysml2kit_rf_library as m; print(m.models_dir())')/interchange/satcom_terminal_pas.json
83
+ sysml2kit verify "$MODEL" --report run.json
84
+ ```
85
+
86
+ runs a phased-array study and checks link margin, EIRP, sidelobes, prime
87
+ power, and cost against the model's thresholds.