domainforge 0.13.0
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.
- package/.cargo/config.toml +6 -0
- package/.claude/settings.local.json +18 -0
- package/.coderabbit.yml +43 -0
- package/.codex/skills/release-management/SKILL.md +151 -0
- package/.codex/skills/release-management/agents/openai.yaml +4 -0
- package/.github/actions/decrypt-secrets/action.yml +121 -0
- package/.github/agents/Coder.agent.md +97 -0
- package/.github/agents/DeepResearch.agent.md +61 -0
- package/.github/chatmodes/tdd.vibepro.chatmode.md +1183 -0
- package/.github/copilot-instructions.md +13 -0
- package/.github/dependabot.yml +68 -0
- package/.github/workflows/README.md +165 -0
- package/.github/workflows/ci.yml +335 -0
- package/.github/workflows/dependabot-automerge.yml +114 -0
- package/.github/workflows/dependency-review.yml +27 -0
- package/.github/workflows/deploy.yml +87 -0
- package/.github/workflows/prepare-release.yml +168 -0
- package/.github/workflows/release-crates.yml +42 -0
- package/.github/workflows/release-npm.yml +137 -0
- package/.github/workflows/release-please.yml +29 -0
- package/.github/workflows/release-pypi.yml +96 -0
- package/.gitkeep +1 -0
- package/.release-please-manifest.json +5 -0
- package/.sea-registry.toml +10 -0
- package/.serena/project.yml +133 -0
- package/.sops.yaml +10 -0
- package/AGENTS.md +216 -0
- package/CHANGELOG.md +400 -0
- package/CLAUDE.md +62 -0
- package/CONTRIBUTING.md +323 -0
- package/Cargo.lock +3612 -0
- package/Cargo.toml +12 -0
- package/LICENSE +201 -0
- package/README.md +660 -0
- package/README_PYTHON.md +256 -0
- package/README_TYPESCRIPT.md +305 -0
- package/README_WASM.md +329 -0
- package/RELEASE_NOTES.md +41 -0
- package/bun.lock +378 -0
- package/bunfig.toml +11 -0
- package/check_output.txt +83 -0
- package/clippy_output.txt +80 -0
- package/commitlint.config.cjs +8 -0
- package/deny.toml +42 -0
- package/devbox.json +14 -0
- package/devbox.lock +76 -0
- package/docs/RELEASE_PROCESS.md +360 -0
- package/docs/diagnostics.md +161 -0
- package/docs/doc_guidelines.md +53 -0
- package/docs/explanations/README.md +21 -0
- package/docs/explanations/architecture-overview.md +109 -0
- package/docs/explanations/cross-language-binding-strategy.md +68 -0
- package/docs/explanations/graph-store-design.md +47 -0
- package/docs/explanations/performance-benchmarks.md +63 -0
- package/docs/explanations/policy-evaluation-logic.md +106 -0
- package/docs/explanations/semantic-modeling-concepts.md +109 -0
- package/docs/explanations/three-valued-logic.md +66 -0
- package/docs/explanations/versioning-strategy.md +45 -0
- package/docs/governance.md +168 -0
- package/docs/how-tos/README.md +46 -0
- package/docs/how-tos/ci-cd-validation.md +93 -0
- package/docs/how-tos/create-custom-units.md +125 -0
- package/docs/how-tos/define-policies.md +119 -0
- package/docs/how-tos/export-to-calm.md +110 -0
- package/docs/how-tos/export-to-protobuf.md +312 -0
- package/docs/how-tos/extend-grammar.md +133 -0
- package/docs/how-tos/generate-rdf-turtle.md +106 -0
- package/docs/how-tos/import-from-calm.md +114 -0
- package/docs/how-tos/import-from-sbvr.md +249 -0
- package/docs/how-tos/install-cli.md +126 -0
- package/docs/how-tos/parse-sea-files.md +132 -0
- package/docs/how-tos/policy-evaluation-modes.md +30 -0
- package/docs/how-tos/run-cross-language-tests.md +115 -0
- package/docs/how-tos/troubleshoot-napi-builds.md +55 -0
- package/docs/how-tos/use-modules-imports.md +285 -0
- package/docs/index.md +13 -0
- package/docs/plans/canonical-normalizer.md +121 -0
- package/docs/plans/cd_improvement.md +112 -0
- package/docs/plans/cli-ast.md +29 -0
- package/docs/plans/expression-bindings-and-normalizer-integration.md +174 -0
- package/docs/plans/protobuf_advanced_features_plan.md +597 -0
- package/docs/plans/protobuf_plan.yml +525 -0
- package/docs/plans/refactor_dsl_architecture.md +131 -0
- package/docs/plans/release-plan.md +163 -0
- package/docs/plans/sea_fmt_implementation_plan.md +516 -0
- package/docs/playbooks/README.md +18 -0
- package/docs/playbooks/adding-new-primitive.md +68 -0
- package/docs/playbooks/debugging-parser-failures.md +42 -0
- package/docs/playbooks/local-release-preparation.md +139 -0
- package/docs/playbooks/migrating-schema-versions.md +43 -0
- package/docs/playbooks/onboarding-contributors.md +64 -0
- package/docs/playbooks/releasing-beta.md +86 -0
- package/docs/playbooks/secret-management.md +64 -0
- package/docs/reference/README.md +199 -0
- package/docs/reference/ast-json-api.md +427 -0
- package/docs/reference/calm-mapping.md +519 -0
- package/docs/reference/cli-commands.md +588 -0
- package/docs/reference/configuration.md +202 -0
- package/docs/reference/error-codes.md +664 -0
- package/docs/reference/generated-artifacts-policy.md +53 -0
- package/docs/reference/grammar-spec.md +255 -0
- package/docs/reference/primitives-api.md +317 -0
- package/docs/reference/protobuf-api.md +426 -0
- package/docs/reference/python-api.md +485 -0
- package/docs/reference/registry.md +50 -0
- package/docs/reference/sea-dsl-ai-cheatsheet.yaml +913 -0
- package/docs/reference/security-model.md +74 -0
- package/docs/reference/typescript-api.md +508 -0
- package/docs/reference/wasm-api.md +420 -0
- package/docs/semantic-pack-review.md +144 -0
- package/docs/semantic-pack-signing.md +234 -0
- package/docs/semantic-packs.md +284 -0
- package/docs/specs/ADR-001-sea-dsl-semantic-source-of-truth.md +33 -0
- package/docs/specs/ADR-002-projection-first-class-construct.md +50 -0
- package/docs/specs/ADR-003-protobuf-projection-target.md +51 -0
- package/docs/specs/ADR-004-projection-compatibility-semantics.md +57 -0
- package/docs/specs/ADR-005-multi-language-support-strategy.md +112 -0
- package/docs/specs/ADR-006-error-handling-strategy.md +115 -0
- package/docs/specs/ADR-007-policy-evaluation-engine.md +95 -0
- package/docs/specs/ADR-008-knowledge-graph-integration.md +90 -0
- package/docs/specs/ADR-009-module-resolution-strategy.md +115 -0
- package/docs/specs/ADR-010-unit-system.md +106 -0
- package/docs/specs/PRD-001-sea-projection-framework.md +155 -0
- package/docs/specs/PRD-002-sea-cli-tooling.md +169 -0
- package/docs/specs/PRD-003-dsl-core-capabilities.md +275 -0
- package/docs/specs/README.md +62 -0
- package/docs/specs/SDS-001-protobuf-projection-engine.md +451 -0
- package/docs/specs/SDS-002-sea-core-architecture.md +268 -0
- package/docs/specs/SDS-003-parser-semantic-graph.md +377 -0
- package/docs/specs/SDS-004-policy-engine-design.md +362 -0
- package/docs/specs/SDS-005-knowledge-graph-module.md +364 -0
- package/docs/specs/SDS-006-calm-integration.md +367 -0
- package/docs/specs/SDS-007-sbvr-import.md +347 -0
- package/docs/templates/template_explanation.md +14 -0
- package/docs/templates/template_howto.md +21 -0
- package/docs/templates/template_playbook.md +21 -0
- package/docs/templates/template_reference.md +17 -0
- package/docs/templates/template_tutorial.md +24 -0
- package/docs/tutorials/README.md +12 -0
- package/docs/tutorials/first-sea-model.md +85 -0
- package/docs/tutorials/getting-started.md +98 -0
- package/docs/tutorials/python-binding-quickstart.md +107 -0
- package/docs/tutorials/typescript-binding-quickstart.md +91 -0
- package/docs/tutorials/wasm-in-browser.md +75 -0
- package/domainforge-core/CHANGELOG.md +138 -0
- package/domainforge-core/Cargo.toml +101 -0
- package/domainforge-core/MIGRATING.md +32 -0
- package/domainforge-core/README.md +197 -0
- package/domainforge-core/benchmark_results.txt +51 -0
- package/domainforge-core/build.rs +6 -0
- package/domainforge-core/deny.toml +31 -0
- package/domainforge-core/docs/specs/projections/sbvr_kg_mapping.md +43 -0
- package/domainforge-core/examples/basic.sea +7 -0
- package/domainforge-core/examples/cli/import_export_workflow.sh +38 -0
- package/domainforge-core/examples/cli/validate_example.sh +30 -0
- package/domainforge-core/examples/evolution_semantics.sea +31 -0
- package/domainforge-core/examples/parser_demo.rs +203 -0
- package/domainforge-core/grammar/sea.pest +408 -0
- package/domainforge-core/schemas/calm-v1.schema.json +170 -0
- package/domainforge-core/schemas/shacl/sea_shapes.ttl +19 -0
- package/domainforge-core/src/authority/compiler.rs +309 -0
- package/domainforge-core/src/authority/environment.rs +203 -0
- package/domainforge-core/src/authority/error.rs +164 -0
- package/domainforge-core/src/authority/fact_resolver.rs +224 -0
- package/domainforge-core/src/authority/mod.rs +25 -0
- package/domainforge-core/src/authority/pack.rs +133 -0
- package/domainforge-core/src/authority/policy.rs +224 -0
- package/domainforge-core/src/authority/resolver.rs +446 -0
- package/domainforge-core/src/authority/trace.rs +217 -0
- package/domainforge-core/src/authority/transform.rs +168 -0
- package/domainforge-core/src/authority/types.rs +617 -0
- package/domainforge-core/src/bin/domainforge.rs +25 -0
- package/domainforge-core/src/calm/export.rs +538 -0
- package/domainforge-core/src/calm/import.rs +1220 -0
- package/domainforge-core/src/calm/mod.rs +9 -0
- package/domainforge-core/src/calm/models.rs +108 -0
- package/domainforge-core/src/calm/sbvr_import.rs +9 -0
- package/domainforge-core/src/cli/authority.rs +149 -0
- package/domainforge-core/src/cli/format.rs +85 -0
- package/domainforge-core/src/cli/import.rs +133 -0
- package/domainforge-core/src/cli/mod.rs +64 -0
- package/domainforge-core/src/cli/normalize.rs +180 -0
- package/domainforge-core/src/cli/pack.rs +904 -0
- package/domainforge-core/src/cli/parse.rs +112 -0
- package/domainforge-core/src/cli/project.rs +294 -0
- package/domainforge-core/src/cli/registry.rs +41 -0
- package/domainforge-core/src/cli/test.rs +12 -0
- package/domainforge-core/src/cli/validate.rs +195 -0
- package/domainforge-core/src/cli/validate_kg.rs +80 -0
- package/domainforge-core/src/concept_id.rs +89 -0
- package/domainforge-core/src/error/diagnostics.rs +426 -0
- package/domainforge-core/src/error/fuzzy.rs +253 -0
- package/domainforge-core/src/error/mod.rs +13 -0
- package/domainforge-core/src/formatter/comments.rs +223 -0
- package/domainforge-core/src/formatter/config.rs +114 -0
- package/domainforge-core/src/formatter/mod.rs +22 -0
- package/domainforge-core/src/formatter/printer.rs +906 -0
- package/domainforge-core/src/graph/mod.rs +858 -0
- package/domainforge-core/src/graph/to_ast.rs +66 -0
- package/domainforge-core/src/kg.rs +1476 -0
- package/domainforge-core/src/kg_import.rs +251 -0
- package/domainforge-core/src/lib.rs +203 -0
- package/domainforge-core/src/module/mod.rs +1 -0
- package/domainforge-core/src/module/resolver.rs +260 -0
- package/domainforge-core/src/parser/ast.rs +2919 -0
- package/domainforge-core/src/parser/ast_convert.rs +494 -0
- package/domainforge-core/src/parser/ast_schema.rs +491 -0
- package/domainforge-core/src/parser/error.rs +291 -0
- package/domainforge-core/src/parser/lint.rs +39 -0
- package/domainforge-core/src/parser/mod.rs +193 -0
- package/domainforge-core/src/parser/printer.rs +702 -0
- package/domainforge-core/src/parser/profiles.rs +71 -0
- package/domainforge-core/src/parser/string_utils.rs +138 -0
- package/domainforge-core/src/patterns.rs +68 -0
- package/domainforge-core/src/policy/core.rs +1148 -0
- package/domainforge-core/src/policy/expression.rs +399 -0
- package/domainforge-core/src/policy/mod.rs +18 -0
- package/domainforge-core/src/policy/normalize.rs +1028 -0
- package/domainforge-core/src/policy/quantifier.rs +940 -0
- package/domainforge-core/src/policy/three_valued.rs +140 -0
- package/domainforge-core/src/policy/three_valued_microbench.rs +104 -0
- package/domainforge-core/src/policy/type_inference.rs +67 -0
- package/domainforge-core/src/policy/violation.rs +36 -0
- package/domainforge-core/src/primitives/concept_change.rs +61 -0
- package/domainforge-core/src/primitives/entity.rs +224 -0
- package/domainforge-core/src/primitives/flow.rs +111 -0
- package/domainforge-core/src/primitives/instance.rs +93 -0
- package/domainforge-core/src/primitives/mapping_contract.rs +50 -0
- package/domainforge-core/src/primitives/metric.rs +79 -0
- package/domainforge-core/src/primitives/mod.rs +25 -0
- package/domainforge-core/src/primitives/projection_contract.rs +50 -0
- package/domainforge-core/src/primitives/quantity.rs +56 -0
- package/domainforge-core/src/primitives/relation.rs +68 -0
- package/domainforge-core/src/primitives/resource.rs +237 -0
- package/domainforge-core/src/primitives/resource_instance.rs +88 -0
- package/domainforge-core/src/primitives/role.rs +49 -0
- package/domainforge-core/src/projection/buf.rs +404 -0
- package/domainforge-core/src/projection/contracts.rs +22 -0
- package/domainforge-core/src/projection/engine.rs +19 -0
- package/domainforge-core/src/projection/mod.rs +16 -0
- package/domainforge-core/src/projection/protobuf.rs +3331 -0
- package/domainforge-core/src/projection/registry.rs +43 -0
- package/domainforge-core/src/python/authority.rs +253 -0
- package/domainforge-core/src/python/error.rs +227 -0
- package/domainforge-core/src/python/formatter.rs +86 -0
- package/domainforge-core/src/python/graph.rs +366 -0
- package/domainforge-core/src/python/mod.rs +9 -0
- package/domainforge-core/src/python/policy.rs +651 -0
- package/domainforge-core/src/python/primitives.rs +796 -0
- package/domainforge-core/src/python/registry.rs +98 -0
- package/domainforge-core/src/python/semantic_pack.rs +619 -0
- package/domainforge-core/src/python/units.rs +96 -0
- package/domainforge-core/src/registry/mod.rs +432 -0
- package/domainforge-core/src/registry/tests.rs +210 -0
- package/domainforge-core/src/sbvr.rs +744 -0
- package/domainforge-core/src/semantic_pack/builder.rs +470 -0
- package/domainforge-core/src/semantic_pack/canonical_json.rs +184 -0
- package/domainforge-core/src/semantic_pack/diagnostics.rs +214 -0
- package/domainforge-core/src/semantic_pack/diff.rs +216 -0
- package/domainforge-core/src/semantic_pack/mod.rs +31 -0
- package/domainforge-core/src/semantic_pack/pack_set.rs +240 -0
- package/domainforge-core/src/semantic_pack/resolver.rs +437 -0
- package/domainforge-core/src/semantic_pack/review.rs +125 -0
- package/domainforge-core/src/semantic_pack/schema.rs +342 -0
- package/domainforge-core/src/semantic_pack/signing.rs +105 -0
- package/domainforge-core/src/semantic_pack/validator.rs +368 -0
- package/domainforge-core/src/semantic_version.rs +140 -0
- package/domainforge-core/src/test_utils.rs +12 -0
- package/domainforge-core/src/typescript/authority.rs +184 -0
- package/domainforge-core/src/typescript/error.rs +146 -0
- package/domainforge-core/src/typescript/formatter.rs +76 -0
- package/domainforge-core/src/typescript/graph.rs +391 -0
- package/domainforge-core/src/typescript/mod.rs +9 -0
- package/domainforge-core/src/typescript/policy.rs +564 -0
- package/domainforge-core/src/typescript/primitives.rs +784 -0
- package/domainforge-core/src/typescript/registry.rs +88 -0
- package/domainforge-core/src/typescript/semantic_pack.rs +470 -0
- package/domainforge-core/src/typescript/units.rs +76 -0
- package/domainforge-core/src/units/mod.rs +462 -0
- package/domainforge-core/src/uuid_module.rs +42 -0
- package/domainforge-core/src/validation_error.rs +818 -0
- package/domainforge-core/src/validation_result.rs +30 -0
- package/domainforge-core/src/wasm/authority.rs +192 -0
- package/domainforge-core/src/wasm/error.rs +145 -0
- package/domainforge-core/src/wasm/formatter.rs +69 -0
- package/domainforge-core/src/wasm/graph.rs +471 -0
- package/domainforge-core/src/wasm/mod.rs +16 -0
- package/domainforge-core/src/wasm/policy.rs +607 -0
- package/domainforge-core/src/wasm/primitives.rs +295 -0
- package/domainforge-core/src/wasm/semantic_pack.rs +471 -0
- package/domainforge-core/src/wasm/units.rs +62 -0
- package/domainforge-core/std/aws.sea +6 -0
- package/domainforge-core/std/core.sea +6 -0
- package/domainforge-core/std/http.sea +27 -0
- package/domainforge-core/tests/aggregation_enhanced_tests.rs +162 -0
- package/domainforge-core/tests/aggregation_eval_tests.rs +248 -0
- package/domainforge-core/tests/aggregation_integration_tests.rs +379 -0
- package/domainforge-core/tests/aggregation_parser_tests.rs +92 -0
- package/domainforge-core/tests/aggregation_tests.rs +102 -0
- package/domainforge-core/tests/authority_conformance_tests.rs +1173 -0
- package/domainforge-core/tests/calm_round_trip_tests.rs +283 -0
- package/domainforge-core/tests/calm_schema_validation_tests.rs +137 -0
- package/domainforge-core/tests/cast_operator_tests.rs +85 -0
- package/domainforge-core/tests/cli_binary_check.rs +37 -0
- package/domainforge-core/tests/cli_import_tests.rs +291 -0
- package/domainforge-core/tests/cli_path_traversal_tests.rs +124 -0
- package/domainforge-core/tests/cli_tests.rs +63 -0
- package/domainforge-core/tests/diagnostics_tests.rs +203 -0
- package/domainforge-core/tests/dimension_unit_tests.rs +80 -0
- package/domainforge-core/tests/entity_tests.rs +69 -0
- package/domainforge-core/tests/evolution_semantics_tests.rs +157 -0
- package/domainforge-core/tests/flow_tests.rs +78 -0
- package/domainforge-core/tests/flow_unit_validation_tests.rs +31 -0
- package/domainforge-core/tests/graph_integration_tests.rs +218 -0
- package/domainforge-core/tests/graph_tests.rs +626 -0
- package/domainforge-core/tests/import_parsing_tests.rs +23 -0
- package/domainforge-core/tests/instance_integration_tests.rs +98 -0
- package/domainforge-core/tests/instance_parsing_tests.rs +58 -0
- package/domainforge-core/tests/instance_tests.rs +61 -0
- package/domainforge-core/tests/kg_uri_encoding_tests.rs +53 -0
- package/domainforge-core/tests/lint_tests.rs +19 -0
- package/domainforge-core/tests/metric_tests.rs +143 -0
- package/domainforge-core/tests/module_resolution_tests.rs +100 -0
- package/domainforge-core/tests/namespace_registry_tests.rs +247 -0
- package/domainforge-core/tests/null_handling_tests.rs +26 -0
- package/domainforge-core/tests/parser_ast_v3.rs +53 -0
- package/domainforge-core/tests/parser_dimension_registry_tests.rs +20 -0
- package/domainforge-core/tests/parser_integration_tests.rs +294 -0
- package/domainforge-core/tests/parser_metadata_tests.rs +97 -0
- package/domainforge-core/tests/parser_resource_domain_only_graph_test.rs +21 -0
- package/domainforge-core/tests/parser_resource_limits_tests.rs +122 -0
- package/domainforge-core/tests/parser_tests.rs +512 -0
- package/domainforge-core/tests/pattern_semantics_tests.rs +87 -0
- package/domainforge-core/tests/phase_14_determinism_tests.rs +166 -0
- package/domainforge-core/tests/phase_15_validation_error_tests.rs +136 -0
- package/domainforge-core/tests/phase_16_unicode_tests.rs +248 -0
- package/domainforge-core/tests/phase_17_export_tests.rs +285 -0
- package/domainforge-core/tests/phase_17_round_trip_tests.rs +264 -0
- package/domainforge-core/tests/policy_tests.rs +635 -0
- package/domainforge-core/tests/primitives_integration_tests.rs +151 -0
- package/domainforge-core/tests/print_rdf_xml.rs +14 -0
- package/domainforge-core/tests/printer_tests.rs +204 -0
- package/domainforge-core/tests/profile_tests.rs +35 -0
- package/domainforge-core/tests/projection_contracts_tests.rs +154 -0
- package/domainforge-core/tests/protobuf_projection_tests.rs +199 -0
- package/domainforge-core/tests/quantity_tests.rs +41 -0
- package/domainforge-core/tests/rdf_xml_typed_literal_tests.rs +105 -0
- package/domainforge-core/tests/registry_schema_tests.rs +33 -0
- package/domainforge-core/tests/resource_tests.rs +50 -0
- package/domainforge-core/tests/resource_unit_tests.rs +24 -0
- package/domainforge-core/tests/roles_relations_tests.rs +61 -0
- package/domainforge-core/tests/round_trip_tests.rs +34 -0
- package/domainforge-core/tests/runtime_toggle_tests.rs +70 -0
- package/domainforge-core/tests/sbvr_fact_schema_tests.rs +60 -0
- package/domainforge-core/tests/sbvr_flow_facts_tests.rs +55 -0
- package/domainforge-core/tests/sbvr_parsing_tests.rs +53 -0
- package/domainforge-core/tests/semantic_pack_alias_resolution.rs +197 -0
- package/domainforge-core/tests/semantic_pack_build.rs +302 -0
- package/domainforge-core/tests/semantic_pack_consumer_smoke.rs +150 -0
- package/domainforge-core/tests/semantic_pack_pack_set.rs +160 -0
- package/domainforge-core/tests/semantic_pack_signing.rs +157 -0
- package/domainforge-core/tests/semantic_pack_three_valued.rs +250 -0
- package/domainforge-core/tests/semantic_pack_validate.rs +196 -0
- package/domainforge-core/tests/std_lib_tests.rs +37 -0
- package/domainforge-core/tests/temporal_evaluation_tests.rs +159 -0
- package/domainforge-core/tests/temporal_semantics_tests.rs +214 -0
- package/domainforge-core/tests/three_valued_quantifiers_tests.rs +164 -0
- package/domainforge-core/tests/turtle_entity_export_tests.rs +38 -0
- package/domainforge-core/tests/turtle_escaping_tests.rs +53 -0
- package/domainforge-core/tests/turtle_resource_export_tests.rs +34 -0
- package/domainforge-core/tests/type_inference_tests.rs +40 -0
- package/domainforge-core/tests/unicode_validation_tests.rs +169 -0
- package/domainforge-core/tests/unit_tests.rs +81 -0
- package/domainforge-core/tests/validate_tests.rs +38 -0
- package/domainforge-core/tests/validation_unit_mismatch_tests.rs +83 -0
- package/domainforge-core/tests/wasm_tests.rs +229 -0
- package/domainforge-python/CHANGELOG-python.md +12 -0
- package/domainforge-python/MIGRATING.md +24 -0
- package/domainforge-python/README.md +256 -0
- package/domainforge-python/domainforge/__init__.py +95 -0
- package/domainforge-python/domainforge/domainforge.pyi +519 -0
- package/domainforge-python/pyproject.toml +36 -0
- package/domainforge-typescript/CHANGELOG-typescript.md +12 -0
- package/domainforge-typescript/LICENSE +201 -0
- package/domainforge-typescript/MIGRATING.md +24 -0
- package/domainforge-typescript/README.md +305 -0
- package/domainforge-typescript/index.d.ts +452 -0
- package/domainforge-typescript/index.js +361 -0
- package/domainforge-typescript/package.json +60 -0
- package/example.js +61 -0
- package/examples/browser.html +366 -0
- package/examples/namespaces/finance/cashflow.sea +5 -0
- package/examples/namespaces/logistics/core.sea +7 -0
- package/examples/observability_metrics.sea +38 -0
- package/fixtures/semantic_packs/acme_procurement/domain/entities.sea +39 -0
- package/fixtures/semantic_packs/acme_procurement/domain/metrics.sea +11 -0
- package/fixtures/semantic_packs/acme_procurement/domain/relations.sea +7 -0
- package/fixtures/semantic_packs/acme_procurement/domain/resources.sea +9 -0
- package/fixtures/semantic_packs/acme_procurement/review/acme.procurement.semantic-review.jsonl +7 -0
- package/fixtures/semantic_packs/acme_procurement/tests/ambiguous_vendor_alias.sea +8 -0
- package/fixtures/semantic_packs/acme_procurement/tests/deprecated_vendor_alias.sea +8 -0
- package/fixtures/semantic_packs/acme_procurement/tests/invalid_relation.sea +3 -0
- package/fixtures/semantic_packs/acme_procurement/tests/proposed_concept.sea +8 -0
- package/fixtures/semantic_packs/acme_procurement/tests/rejected_concept.sea +8 -0
- package/fixtures/semantic_packs/acme_procurement/tests/unit_mismatch.sea +7 -0
- package/fixtures/semantic_packs/acme_procurement/tests/unknown_vendor_policy.sea +8 -0
- package/fixtures/semantic_packs/acme_procurement/tests/valid_purchase_policy.sea +8 -0
- package/index.d.ts +2 -0
- package/index.js +8 -0
- package/justfile +200 -0
- package/lefthook.yml +13 -0
- package/lib/validate_native_exports.d.ts +4 -0
- package/lib/validate_native_exports.js +12 -0
- package/package.json +22 -0
- package/pytest.ini +5 -0
- package/python/tests/test_registry.py +75 -0
- package/python/tests/test_units.py +18 -0
- package/release-please-config.json +49 -0
- package/requirements-dev.txt +3 -0
- package/requirements.txt +3 -0
- package/rust-toolchain.toml +3 -0
- package/schemas/ast-v1.schema.json +72 -0
- package/schemas/ast-v2.schema.json +1200 -0
- package/schemas/ast-v3.schema.json +1200 -0
- package/schemas/sea-registry.schema.json +45 -0
- package/scripts/build-python.sh +37 -0
- package/scripts/build-release.sh +279 -0
- package/scripts/build-typescript.sh +13 -0
- package/scripts/build-wasm.sh +113 -0
- package/scripts/bump-version.sh +245 -0
- package/scripts/check_unused_test_imports.py +85 -0
- package/scripts/ci_tasks.py +379 -0
- package/scripts/clear_debug_test.sh +10 -0
- package/scripts/create-github-release.sh +262 -0
- package/scripts/create-tag.sh +203 -0
- package/scripts/find_and_link_test_binary.sh +70 -0
- package/scripts/generate-changelog.sh +271 -0
- package/scripts/generate-release-notes.sh +205 -0
- package/scripts/lint_release_security.py +96 -0
- package/scripts/lint_release_workflows.py +82 -0
- package/scripts/lint_workflow_gates.py +113 -0
- package/scripts/optimized-wasm-build.sh +61 -0
- package/scripts/patch_napi_types.py +62 -0
- package/scripts/pre-release-check.sh +289 -0
- package/scripts/prepare_rust_debug.sh +52 -0
- package/scripts/release.sh +373 -0
- package/scripts/resolve_rust_binary.py +230 -0
- package/scripts/run_commitlint.sh +29 -0
- package/scripts/test-all.sh +77 -0
- package/scripts/update_launch_program.py +93 -0
- package/secrets/README.md +27 -0
- package/secrets/secrets.yaml +21 -0
- package/test_integration.py +67 -0
- package/tests/test_authority.py +328 -0
- package/tests/test_ci_tasks.py +143 -0
- package/tests/test_expression.py +256 -0
- package/tests/test_golden_payment_flow.py +42 -0
- package/tests/test_graph.py +127 -0
- package/tests/test_instance.py +136 -0
- package/tests/test_parser.py +82 -0
- package/tests/test_primitives.py +68 -0
- package/tests/test_role_relation_parity.py +56 -0
- package/tests/test_runtime_toggle.py +156 -0
- package/tests/test_semantic_pack.py +639 -0
- package/tests/test_three_valued_eval.py +159 -0
- package/tsconfig.json +30 -0
- package/typescript-tests/advanced.test.ts +165 -0
- package/typescript-tests/authority.test.ts +216 -0
- package/typescript-tests/expression.test.ts +228 -0
- package/typescript-tests/golden-payment-flow.test.ts +51 -0
- package/typescript-tests/graph.test.ts +142 -0
- package/typescript-tests/native-binding.test.ts +20 -0
- package/typescript-tests/primitives.test.ts +88 -0
- package/typescript-tests/registry.test.ts +122 -0
- package/typescript-tests/role_relation.test.ts +63 -0
- package/typescript-tests/runtime_toggle.test.ts +141 -0
- package/typescript-tests/semantic-pack.test.ts +556 -0
- package/typescript-tests/three_valued_eval.test.ts +135 -0
- package/typescript-tests/units.test.ts +36 -0
- package/vitest.config.ts +13 -0
- package/wasm_demo.html +225 -0
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# Import from CALM
|
|
2
|
+
|
|
3
|
+
Goal: Import a FINOS CALM representation into DomainForge, verify integrity, and convert it back to SEA DSL constructs.
|
|
4
|
+
|
|
5
|
+
## Prerequisites
|
|
6
|
+
|
|
7
|
+
- SEA CLI built from source (`cargo install --path domainforge-core --features cli`) for validating the imported graph.
|
|
8
|
+
- Access to a CALM JSON file that conforms to the FINOS Architecture-as-Code schema (version `2.0` recommended).
|
|
9
|
+
- Optional bindings:
|
|
10
|
+
- Python package (`domainforge`) built via `maturin develop` for programmatic import.
|
|
11
|
+
- TypeScript package (`@godspeedai/domainforge`) built via `npm run build`.
|
|
12
|
+
|
|
13
|
+
## Steps (be concise)
|
|
14
|
+
|
|
15
|
+
1. **Inspect the CALM file**
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
jq '.version, .metadata["sea:version"], (.models[0].roles | length)' calm.json
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
- Confirm the CALM version is `2.0` and that `sea:version` matches the expected SEA baseline (e.g., `0.1.0`).
|
|
22
|
+
|
|
23
|
+
2. **Import programmatically in Python**
|
|
24
|
+
|
|
25
|
+
```python
|
|
26
|
+
from domainforge import Graph
|
|
27
|
+
import json
|
|
28
|
+
|
|
29
|
+
calm_json = open("calm.json").read()
|
|
30
|
+
graph = Graph.import_calm(calm_json)
|
|
31
|
+
|
|
32
|
+
print("Entities", graph.entity_count())
|
|
33
|
+
print("Roles", graph.role_count())
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
- Use `graph.all_relations()` to confirm relation predicates survived the import.
|
|
37
|
+
- Call `graph.export_calm()` immediately after import to verify round-trip stability (the output should still be valid CALM JSON).
|
|
38
|
+
|
|
39
|
+
3. **Import programmatically in TypeScript**
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
import { Graph } from "@godspeedai/domainforge";
|
|
43
|
+
import { readFileSync } from "fs";
|
|
44
|
+
|
|
45
|
+
const calm = readFileSync("calm.json", "utf8");
|
|
46
|
+
const graph = Graph.importCalm(calm);
|
|
47
|
+
|
|
48
|
+
console.log("Flows", graph.flowCount());
|
|
49
|
+
console.log("Relations", graph.relationCount());
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
- Re-export with `graph.exportCalm()` to prove the importer produced a valid graph.
|
|
53
|
+
|
|
54
|
+
4. **Validate the imported graph with the CLI**
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
# Export the imported graph back to CALM then re-parse
|
|
58
|
+
python - <<'PY'
|
|
59
|
+
from domainforge import Graph
|
|
60
|
+
with open('calm.json') as f:
|
|
61
|
+
data = f.read()
|
|
62
|
+
graph = Graph.import_calm(data)
|
|
63
|
+
with open('/tmp/roundtrip.calm.json', 'w') as out:
|
|
64
|
+
out.write(graph.export_calm())
|
|
65
|
+
PY
|
|
66
|
+
|
|
67
|
+
domainforge import --format kg /tmp/roundtrip.calm.json
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
- The second command exercises the CLI import pipeline (Turtle/RDF) to ensure the graph can be converted downstream.
|
|
71
|
+
|
|
72
|
+
5. **Convert CALM to SEA DSL text (Rust)**
|
|
73
|
+
|
|
74
|
+
```rust
|
|
75
|
+
use domainforge_core::calm::{import, export};
|
|
76
|
+
|
|
77
|
+
let calm_json = std::fs::read_to_string("calm.json")?;
|
|
78
|
+
let graph = import(serde_json::from_str(&calm_json)?)?;
|
|
79
|
+
// You can now traverse primitives or export to KG/SBVR
|
|
80
|
+
let exported = export(&graph)?;
|
|
81
|
+
assert_eq!(exported["metadata"]["sea:version"], domainforge_core::VERSION);
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
- Although there is no direct CLI flag for CALM → SEA text, the Rust API lets you transform CALM into a `Graph` and then emit other projections (`project --format kg` for Turtle/RDF).
|
|
85
|
+
|
|
86
|
+
6. **Round-trip verification**
|
|
87
|
+
|
|
88
|
+
- Import CALM → Export CALM → Import again. Check that counts for entities/resources/flows/roles/relations remain stable.
|
|
89
|
+
- Validate units: ensure every `quantity` in CALM includes `unit`; missing units will fail the SEA validator when exporting to DSL.
|
|
90
|
+
|
|
91
|
+
## Mapping and Normalisation Notes
|
|
92
|
+
|
|
93
|
+
- Namespaces default to `"default"` when not present; CALM models often omit them. SEA accepts missing namespaces but can enrich them during export.
|
|
94
|
+
- Relations map to `subjectRole`, `predicate`, and `objectRole`; confirm that role IDs in CALM exist in the `roles` array before import.
|
|
95
|
+
- Flows require UUIDs; if a CALM file omits them, the importer will generate deterministic IDs but may warn in the bindings logs.
|
|
96
|
+
- Metadata fields `sea:exported`, `sea:version`, and `sea:timestamp` are preserved; adjust them only if you intentionally re-sign the payload.
|
|
97
|
+
|
|
98
|
+
## Error Handling and Diagnostics
|
|
99
|
+
|
|
100
|
+
- **Schema mismatch**: If parsing fails due to a missing field, validate the CALM file against the upstream schema (`ajv validate -s calm.schema.json -d calm.json`).
|
|
101
|
+
- **Unknown role IDs**: Importers raise a `ValueError`/`Error` when a relation references a missing role. Add the role or correct the relation IDs.
|
|
102
|
+
- **Unit conversion failures**: Ensure that every resource or flow quantity uses a defined unit; otherwise, normalization to SEA quantities will fail.
|
|
103
|
+
- **Encoding issues**: CALM must be UTF-8. Re-save files with `iconv -f <encoding> -t utf-8` if you see decoding errors.
|
|
104
|
+
|
|
105
|
+
## Common Pitfalls / Troubleshooting
|
|
106
|
+
|
|
107
|
+
- Importing CALM via the CLI is not yet available; use Python/TypeScript/Rust APIs instead, then rely on `domainforge project --format kg` for downstream exports.
|
|
108
|
+
- When working with large models, load the JSON with streaming (`ijson` in Python) if memory is constrained; construct the `Graph` once you validate the structure.
|
|
109
|
+
- Keep the SEA version consistent across files; mixing CALM payloads exported from older SEA versions can surface validation differences.
|
|
110
|
+
|
|
111
|
+
## Links
|
|
112
|
+
|
|
113
|
+
- Tutorials: [Getting Started](../tutorials/getting-started.md)
|
|
114
|
+
- Reference: [CALM Mapping](../reference/calm-mapping.md), [CLI Commands](../reference/cli-commands.md), [Python API](../reference/python-api.md), [TypeScript API](../reference/typescript-api.md)
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
# Import from SBVR
|
|
2
|
+
|
|
3
|
+
This guide explains how to import SBVR (Semantics of Business Vocabulary and Rules) XMI files into SEA graphs.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
SBVR is an OMG standard for expressing business vocabularies and rules in natural language with formal semantics. DomainForge can import SBVR XMI files and convert them to SEA primitives:
|
|
8
|
+
|
|
9
|
+
| SBVR Concept | SEA Mapping |
|
|
10
|
+
| ------------- | ------------------- |
|
|
11
|
+
| Noun Concept | Entity |
|
|
12
|
+
| Verb Concept | Relation |
|
|
13
|
+
| Fact Type | Role-based Relation |
|
|
14
|
+
| Business Rule | Policy |
|
|
15
|
+
| Definition | Entity description |
|
|
16
|
+
|
|
17
|
+
## Prerequisites
|
|
18
|
+
|
|
19
|
+
- `sea` CLI installed with `cli` feature
|
|
20
|
+
- An SBVR XMI file (e.g., exported from business rule tools)
|
|
21
|
+
|
|
22
|
+
## Quick Start
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
# Import SBVR XMI to SEA DSL
|
|
26
|
+
domainforge import --format sbvr vocabulary.xmi > model.sea
|
|
27
|
+
|
|
28
|
+
# Import with custom namespace
|
|
29
|
+
domainforge import --format sbvr --namespace my-domain vocabulary.xmi
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Example
|
|
33
|
+
|
|
34
|
+
### Input: SBVR XMI
|
|
35
|
+
|
|
36
|
+
```xml
|
|
37
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
38
|
+
<sbvr:Vocabulary xmlns:sbvr="http://www.omg.org/spec/SBVR">
|
|
39
|
+
<nounConcept xmi:id="nc1" name="Customer">
|
|
40
|
+
<definition>A person or organization that purchases products</definition>
|
|
41
|
+
</nounConcept>
|
|
42
|
+
|
|
43
|
+
<nounConcept xmi:id="nc2" name="Order">
|
|
44
|
+
<definition>A request to purchase products</definition>
|
|
45
|
+
</nounConcept>
|
|
46
|
+
|
|
47
|
+
<verbConcept xmi:id="vc1" name="places">
|
|
48
|
+
<role name="placer" nounConceptRef="nc1"/>
|
|
49
|
+
<role name="placed" nounConceptRef="nc2"/>
|
|
50
|
+
</verbConcept>
|
|
51
|
+
|
|
52
|
+
<factType xmi:id="ft1" reading="Customer places Order" verbConceptRef="vc1"/>
|
|
53
|
+
|
|
54
|
+
<businessRule xmi:id="br1" name="OrderLimit">
|
|
55
|
+
<statement>Each Customer must have at most 10 pending Orders</statement>
|
|
56
|
+
<ruleType>OperativeRule</ruleType>
|
|
57
|
+
</businessRule>
|
|
58
|
+
</sbvr:Vocabulary>
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Output: SEA DSL
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
domainforge import --format sbvr vocabulary.xmi
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Produces:
|
|
68
|
+
|
|
69
|
+
```sea
|
|
70
|
+
Namespace "sbvr"
|
|
71
|
+
|
|
72
|
+
// Entities from Noun Concepts
|
|
73
|
+
Entity "Customer" {
|
|
74
|
+
@description "A person or organization that purchases products"
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
Entity "Order" {
|
|
78
|
+
@description "A request to purchase products"
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// Roles from Verb Concepts
|
|
82
|
+
Role "placer"
|
|
83
|
+
Role "placed"
|
|
84
|
+
|
|
85
|
+
// Relations from Fact Types
|
|
86
|
+
Relation "places" from placer to placed {
|
|
87
|
+
@reading "Customer places Order"
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// Policies from Business Rules
|
|
91
|
+
Policy "OrderLimit" {
|
|
92
|
+
severity: error
|
|
93
|
+
expression: "Each Customer must have at most 10 pending Orders"
|
|
94
|
+
@original_sbvr true
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## SBVR Concept Mapping
|
|
99
|
+
|
|
100
|
+
### Noun Concepts → Entities
|
|
101
|
+
|
|
102
|
+
SBVR noun concepts become SEA entities. Concept hierarchies are preserved via the `@generalizes` attribute:
|
|
103
|
+
|
|
104
|
+
```xml
|
|
105
|
+
<nounConcept xmi:id="nc1" name="Person"/>
|
|
106
|
+
<nounConcept xmi:id="nc2" name="Customer" generalConcept="nc1"/>
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Becomes:
|
|
110
|
+
|
|
111
|
+
```sea
|
|
112
|
+
Entity "Person"
|
|
113
|
+
Entity "Customer" {
|
|
114
|
+
@generalizes "Person"
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Verb Concepts → Roles and Relations
|
|
119
|
+
|
|
120
|
+
Binary verb concepts become role definitions and relations:
|
|
121
|
+
|
|
122
|
+
```xml
|
|
123
|
+
<verbConcept name="manages">
|
|
124
|
+
<role name="manager" nounConceptRef="Person"/>
|
|
125
|
+
<role name="managed" nounConceptRef="Team"/>
|
|
126
|
+
</verbConcept>
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Becomes:
|
|
130
|
+
|
|
131
|
+
```sea
|
|
132
|
+
Role "manager"
|
|
133
|
+
Role "managed"
|
|
134
|
+
Relation "manages" from manager to managed
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### Business Rules → Policies
|
|
138
|
+
|
|
139
|
+
Business rules are converted based on their type:
|
|
140
|
+
|
|
141
|
+
| SBVR Rule Type | SEA Severity |
|
|
142
|
+
| -------------- | ------------ |
|
|
143
|
+
| StructuralRule | error |
|
|
144
|
+
| OperativeRule | warning |
|
|
145
|
+
| DerivationRule | info |
|
|
146
|
+
|
|
147
|
+
### Supported Statement Patterns
|
|
148
|
+
|
|
149
|
+
| SBVR Pattern | SEA Expression |
|
|
150
|
+
| -------------------------- | -------------------------- |
|
|
151
|
+
| "Each X must Y" | `forall x in X: Y(x)` |
|
|
152
|
+
| "At most one X per Y" | Cardinality constraint |
|
|
153
|
+
| "It is necessary that..." | Policy with error severity |
|
|
154
|
+
| "It is obligatory that..." | Policy with error severity |
|
|
155
|
+
| "It is permitted that..." | No policy (allowed) |
|
|
156
|
+
|
|
157
|
+
## Programmatic Usage
|
|
158
|
+
|
|
159
|
+
### Rust
|
|
160
|
+
|
|
161
|
+
```rust
|
|
162
|
+
use domainforge_core::sbvr::SbvrModel;
|
|
163
|
+
|
|
164
|
+
let xmi = std::fs::read_to_string("vocabulary.xmi")?;
|
|
165
|
+
let sbvr_model = SbvrModel::from_xmi(&xmi)?;
|
|
166
|
+
let graph = sbvr_model.to_graph()?;
|
|
167
|
+
|
|
168
|
+
println!("Imported {} entities", graph.all_entities().count());
|
|
169
|
+
println!("Imported {} policies", graph.all_policies().count());
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### Python
|
|
173
|
+
|
|
174
|
+
```python
|
|
175
|
+
from domainforge import Graph
|
|
176
|
+
|
|
177
|
+
# Import SBVR via CLI subprocess
|
|
178
|
+
import subprocess
|
|
179
|
+
result = subprocess.run(
|
|
180
|
+
["domainforge", "import", "--format", "sbvr", "vocabulary.xmi"],
|
|
181
|
+
capture_output=True,
|
|
182
|
+
text=True
|
|
183
|
+
)
|
|
184
|
+
domainforge = result.stdout
|
|
185
|
+
|
|
186
|
+
# Parse the resulting SEA DSL
|
|
187
|
+
graph = Graph.parse(domainforge)
|
|
188
|
+
print(f"Imported {len(graph.entities())} entities")
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
## Limitations
|
|
192
|
+
|
|
193
|
+
| Limitation | Workaround |
|
|
194
|
+
| -------------------- | ------------------------------------ |
|
|
195
|
+
| Complex quantifiers | Manual policy authoring after import |
|
|
196
|
+
| Computed derivations | Not supported (logged as warning) |
|
|
197
|
+
| Temporal rules | Limited support |
|
|
198
|
+
| Modal logic | Mapped to severity levels |
|
|
199
|
+
|
|
200
|
+
Some SBVR statements cannot be automatically converted to SEA expressions. These are imported with `@original_sbvr true` attribute for manual review.
|
|
201
|
+
|
|
202
|
+
## Post-Import Workflow
|
|
203
|
+
|
|
204
|
+
1. **Review imported policies**: Check for `@original_sbvr` markers indicating statements that need manual conversion
|
|
205
|
+
2. **Validate the model**: Run `domainforge validate model.sea` to check for semantic errors
|
|
206
|
+
3. **Refine expressions**: Convert natural language statements to formal SEA expressions
|
|
207
|
+
4. **Add missing details**: SBVR may not capture all attributes needed for your domain
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
# Validate imported model
|
|
211
|
+
domainforge validate model.sea
|
|
212
|
+
|
|
213
|
+
# Export to other formats
|
|
214
|
+
domainforge project --format calm model.sea architecture.json
|
|
215
|
+
domainforge project --format protobuf model.sea contracts.proto
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
## Troubleshooting
|
|
219
|
+
|
|
220
|
+
### Parse Error: Invalid XMI
|
|
221
|
+
|
|
222
|
+
Ensure your SBVR file is valid XMI format:
|
|
223
|
+
|
|
224
|
+
- Must have proper XML declaration
|
|
225
|
+
- Must use SBVR namespace
|
|
226
|
+
- Element names must match expected tags
|
|
227
|
+
|
|
228
|
+
### Missing Noun Concepts
|
|
229
|
+
|
|
230
|
+
If relations reference undefined noun concepts:
|
|
231
|
+
|
|
232
|
+
1. Check the XMI for `nounConceptRef` values
|
|
233
|
+
2. Ensure all referenced concepts are defined
|
|
234
|
+
3. Use `--allow-unknown` flag to import partial models
|
|
235
|
+
|
|
236
|
+
### Unsupported Rule Type
|
|
237
|
+
|
|
238
|
+
Some SBVR rule patterns are not automatically converted:
|
|
239
|
+
|
|
240
|
+
- The import will succeed with a warning
|
|
241
|
+
- Review the `@original_sbvr` policies manually
|
|
242
|
+
- Convert to formal SEA expressions as needed
|
|
243
|
+
|
|
244
|
+
## See Also
|
|
245
|
+
|
|
246
|
+
- [SDS-007: SBVR Import](../specs/SDS-007-sbvr-import.md) - System design spec
|
|
247
|
+
- [Define Policies](./define-policies.md) - Writing SEA policies
|
|
248
|
+
- [CLI Commands](../reference/cli-commands.md) - Import command reference
|
|
249
|
+
- [Grammar Spec](../reference/grammar-spec.md) - SEA syntax reference
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# Install the SEA CLI
|
|
2
|
+
|
|
3
|
+
Goal: Install and verify the DomainForge SEA CLI on Linux, macOS, and Windows.
|
|
4
|
+
|
|
5
|
+
## Prerequisites
|
|
6
|
+
|
|
7
|
+
- Rust toolchain 1.77+ installed via `rustup` (recommended target triples: `x86_64-unknown-linux-gnu`, `x86_64-apple-darwin`, `x86_64-pc-windows-msvc`).
|
|
8
|
+
- Build essentials for your OS (gcc/clang + make on Linux, Xcode CLTs on macOS, Build Tools for Visual Studio on Windows).
|
|
9
|
+
- Optional: `just` for running test recipes.
|
|
10
|
+
|
|
11
|
+
## Install from Source (recommended until binary releases are published)
|
|
12
|
+
|
|
13
|
+
1. Clone the repo and install:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
git clone https://github.com/GodSpeedAI/DomainForge.git
|
|
17
|
+
cd DomainForge
|
|
18
|
+
# For the CLI only
|
|
19
|
+
cargo install --path domainforge-core --features cli
|
|
20
|
+
# If you need SHACL validation (validate-kg), include the shacl feature as well
|
|
21
|
+
cargo install --path domainforge-core --features "cli,shacl"
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
2. Ensure Cargo bin is on PATH (Linux/macOS):
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
export PATH="$HOME/.cargo/bin:$PATH"
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
3. Verify the binary:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
domainforge --version
|
|
34
|
+
domainforge validate --format human domainforge-core/examples/basic.sea
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
- Expected: version prints `domainforge-core 0.1.0` (or newer) and validation exits successfully.
|
|
38
|
+
|
|
39
|
+
## Install via GitHub Release (when artifacts are available)
|
|
40
|
+
|
|
41
|
+
- Download the archive that matches your OS/arch (e.g., `sea-x86_64-unknown-linux-gnu.tar.gz`).
|
|
42
|
+
- Extract and place the `sea` binary on your PATH (`/usr/local/bin` or `%USERPROFILE%\.cargo\bin`).
|
|
43
|
+
- Run `domainforge --version` to confirm the binary is executable.
|
|
44
|
+
|
|
45
|
+
## Windows-specific Notes
|
|
46
|
+
|
|
47
|
+
- Use **Developer PowerShell** or **x64 Native Tools Command Prompt** to ensure MSVC is available.
|
|
48
|
+
- Set the default toolchain: `rustup default stable-x86_64-pc-windows-msvc`.
|
|
49
|
+
- If OpenSSL build errors appear, install `vcpkg` and ensure `VCPKGRS_DYNAMIC=1` before running `cargo install`.
|
|
50
|
+
- Ensure Rust binaries are on your PATH in PowerShell:
|
|
51
|
+
|
|
52
|
+
```powershell
|
|
53
|
+
$env:PATH += ";$HOME\.cargo\bin"
|
|
54
|
+
# Or persist for current user
|
|
55
|
+
setx PATH "$env:PATH;$HOME\.cargo\bin"
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## macOS-specific Notes
|
|
59
|
+
|
|
60
|
+
- Install Xcode Command Line Tools: `xcode-select --install`.
|
|
61
|
+
- On Apple Silicon, prefer the native toolchain; if you need x86_64 binaries, use Rosetta with `arch -x86_64 cargo install ...`.
|
|
62
|
+
|
|
63
|
+
## Linux-specific Notes
|
|
64
|
+
|
|
65
|
+
- Ensure `pkg-config` and `openssl-dev` are installed (`sudo apt-get install build-essential pkg-config libssl-dev`).
|
|
66
|
+
- If building inside a container, mount a writable `$CARGO_HOME` to avoid permission errors.
|
|
67
|
+
|
|
68
|
+
## Running Smoke Tests after Installation
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
# For users installing from source (developer/local builds):
|
|
72
|
+
domainforge validate --format human domainforge-core/examples/basic.sea
|
|
73
|
+
domainforge project --format calm domainforge-core/examples/basic.sea /tmp/basic.calm.json
|
|
74
|
+
domainforge project --format kg domainforge-core/examples/basic.sea /tmp/basic.ttl
|
|
75
|
+
|
|
76
|
+
# For users installing from a release binary: if `sea` provides a built-in self-check command, run it; otherwise validate using a minimal inline example:
|
|
77
|
+
# Example (if no self-check command exists):
|
|
78
|
+
echo 'entity A {}' > /tmp/minimal.sea
|
|
79
|
+
domainforge validate --format human /tmp/minimal.sea
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
- These commands confirm parsing, CALM export, and KG export paths.
|
|
83
|
+
|
|
84
|
+
## Upgrading or Reinstalling
|
|
85
|
+
|
|
86
|
+
- To force an upgrade after changes: `cargo install --path domainforge-core --features cli --force`.
|
|
87
|
+
- Remove old binaries from other PATH locations to avoid running stale versions.
|
|
88
|
+
|
|
89
|
+
## Troubleshooting
|
|
90
|
+
|
|
91
|
+
- **Linker errors on Windows**: reinstall the MSVC build tools and re-run `rustup update`.
|
|
92
|
+
- **Python interference (macOS/Homebrew)**: unset `PYTHONHOME` and rebuild; or create a fresh virtualenv before invoking Cargo to avoid conflicting headers.
|
|
93
|
+
- **Missing OpenSSL**: install `libssl-dev` (Debian/Ubuntu) or `openssl@3` (Homebrew) and set `PKG_CONFIG_PATH` accordingly.
|
|
94
|
+
- **Permission denied**: install to a user-writable directory or run `cargo install` without `sudo`.
|
|
95
|
+
|
|
96
|
+
## Verification Checklist
|
|
97
|
+
|
|
98
|
+
- [ ] `domainforge --version` prints the expected version string.
|
|
99
|
+
- [ ] `domainforge validate` succeeds against `domainforge-core/examples/basic.sea`.
|
|
100
|
+
- [ ] `domainforge project --format calm` produces a CALM file containing `sea:version` metadata.
|
|
101
|
+
- [ ] `domainforge project --format kg` generates Turtle without SHACL errors when run through `domainforge validate-kg` (requires installing with the `shacl` feature: `--features cli,shacl`).
|
|
102
|
+
|
|
103
|
+
## Links
|
|
104
|
+
|
|
105
|
+
- Tutorials: [Getting Started](../tutorials/getting-started.md)
|
|
106
|
+
- Reference: [CLI Commands](../reference/cli-commands.md), [Configuration](../reference/configuration.md), [Versioning Strategy](../explanations/versioning-strategy.md)
|
|
107
|
+
|
|
108
|
+
## Post-install Configuration
|
|
109
|
+
|
|
110
|
+
- Configure logging verbosity with CLI flags: `--verbose` or `--quiet` (mutually exclusive).
|
|
111
|
+
- Set `SEA_COLOR=always` to force colorized output if your terminal strips ANSI codes.
|
|
112
|
+
- Use `.sea-registry.toml` in your project root to manage namespaces; the CLI discovers it automatically during parse/validate/project commands.
|
|
113
|
+
|
|
114
|
+
## Example CI Step
|
|
115
|
+
|
|
116
|
+
```yaml
|
|
117
|
+
- name: Install SEA CLI
|
|
118
|
+
run: |
|
|
119
|
+
rustup override set stable
|
|
120
|
+
cargo install --path domainforge-core --features cli --force
|
|
121
|
+
- name: Validate models
|
|
122
|
+
run: |
|
|
123
|
+
domainforge validate --format human models/**/*.sea
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
- Cache `$CARGO_HOME` between runs to speed up subsequent installs.
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# Parse SEA Files
|
|
2
|
+
|
|
3
|
+
Goal: Parse `.sea` models using the CLI and programmatic bindings while catching syntax/semantic errors early.
|
|
4
|
+
|
|
5
|
+
## Prerequisites
|
|
6
|
+
|
|
7
|
+
- Rust toolchain 1.77+ and the SEA CLI installed.
|
|
8
|
+
|
|
9
|
+
- For developers building from this repo: `cargo install --path domainforge-core --features cli` (produces the `sea` binary).
|
|
10
|
+
- For users installing from crates.io or binaries: use the published `sea` or release artifact; confirm with `domainforge --version`.
|
|
11
|
+
|
|
12
|
+
- Optional: Python bindings (install locally via `maturin develop --features python` or via PyPI when published) and TypeScript package (`npm install @godspeedai/domainforge` then `npm run build`).
|
|
13
|
+
- A `.sea` source file. Use `domainforge-core/examples/basic.sea` or any model under `examples/` to follow along.
|
|
14
|
+
|
|
15
|
+
## Steps (be concise)
|
|
16
|
+
|
|
17
|
+
1. **Validate and parse a single file (CLI)**
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
domainforge validate --format human domainforge-core/examples/basic.sea
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
- The command parses the file, resolves namespaces from `.sea-registry.toml` when present, and reports semantic errors (unknown entities/resources, unit mismatches).
|
|
24
|
+
- Use `--format json` for machine-readable diagnostics that include error codes from `validation_error.rs`.
|
|
25
|
+
|
|
26
|
+
2. **Parse and project to an intermediate representation (CLI)**
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
domainforge project --format calm domainforge-core/examples/basic.sea /tmp/basic.calm.json
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
- `project` parses the DSL, builds a `Graph`, then exports to CALM JSON. Swap `--format calm` with `--format kg` to emit RDF/Turtle or RDF/XML (auto-detected by extension).
|
|
33
|
+
- The command fails fast if parsing fails; the error message cites the offending line/column.
|
|
34
|
+
|
|
35
|
+
3. **Batch-validate multiple files (CLI)**
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
for f in examples/*.sea; do
|
|
39
|
+
echo "Checking $f"
|
|
40
|
+
domainforge validate --format human "$f" || exit 1
|
|
41
|
+
done
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
- This pattern stops on the first failure. Add `|| true` to continue despite errors.
|
|
45
|
+
|
|
46
|
+
4. **Generate AST JSON (CLI)**
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
domainforge parse --ast --format json domainforge-core/examples/basic.sea > basic.ast.json
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
- Produces raw AST JSON preserving source structure and location info.
|
|
53
|
+
- Useful for feeding tools like `tools/ast_to_ir.py` or writing custom linters.
|
|
54
|
+
|
|
55
|
+
5. **Parse programmatically in Rust**
|
|
56
|
+
|
|
57
|
+
```rust
|
|
58
|
+
use domainforge_core::parser::parse_to_graph;
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
let source = std::fs::read_to_string("domainforge-core/examples/basic.sea")?;
|
|
62
|
+
let graph = parse_to_graph(&source)?;
|
|
63
|
+
assert!(graph.entity_count() >= 1);
|
|
64
|
+
|
|
65
|
+
````
|
|
66
|
+
|
|
67
|
+
- Prefer `parse_to_graph_with_options` if you need namespace resolution using `NamespaceRegistry::discover`.
|
|
68
|
+
|
|
69
|
+
6. **Parse programmatically in Python**
|
|
70
|
+
|
|
71
|
+
```python
|
|
72
|
+
from pathlib import Path
|
|
73
|
+
from domainforge import Graph
|
|
74
|
+
|
|
75
|
+
text = Path("domainforge-core/examples/basic.sea").read_text()
|
|
76
|
+
|
|
77
|
+
# Semantic graph parsing
|
|
78
|
+
graph = Graph.parse(text)
|
|
79
|
+
assert graph.resource_count() >= 1
|
|
80
|
+
|
|
81
|
+
# Raw AST parsing (e.g., for tooling)
|
|
82
|
+
ast_json = Graph.parse_to_ast_json(text)
|
|
83
|
+
````
|
|
84
|
+
|
|
85
|
+
- Call `graph.all_entities()` or `graph.find_entity_by_name("Customer")` to inspect the parsed model.
|
|
86
|
+
- Errors raise `ValueError` with the same message as the Rust parser.
|
|
87
|
+
|
|
88
|
+
7. **Parse programmatically in TypeScript**
|
|
89
|
+
|
|
90
|
+
```ts
|
|
91
|
+
import { readFileSync } from "fs";
|
|
92
|
+
import { Graph } from "@godspeedai/domainforge";
|
|
93
|
+
|
|
94
|
+
const source = readFileSync("domainforge-core/examples/basic.sea", "utf8");
|
|
95
|
+
|
|
96
|
+
// Semantic graph parsing
|
|
97
|
+
const graph = Graph.parse(source);
|
|
98
|
+
console.log(graph.entityCount());
|
|
99
|
+
|
|
100
|
+
// Raw AST parsing
|
|
101
|
+
const astJson = Graph.parseToAstJson(source);
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
- Use `graph.allResources()` or `graph.findRoleByName("Payer")` after parsing relation-enabled models.
|
|
105
|
+
|
|
106
|
+
8. **Handle parse warnings and errors**
|
|
107
|
+
|
|
108
|
+
- **Unknown identifiers**: The parser emits `UnknownEntity` or `UnknownResource` errors; add missing declarations or fix typos.
|
|
109
|
+
- **Unit mismatches**: If a flow references an undefined unit, define it in the `Dimension/Unit` section before the flow.
|
|
110
|
+
- **Namespace resolution**: If you see `NamespaceMissing`, create `.sea-registry.toml` near the entry file or pass fully qualified names (e.g., `finance/Invoice`).
|
|
111
|
+
|
|
112
|
+
9. **Integrate parsing into CI**
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
just rust-test # runs `cargo test -p domainforge-core --features cli` and exercises parser paths
|
|
116
|
+
just python-test # rebuilds bindings (maturin develop) and parses DSL fixtures
|
|
117
|
+
just ts-test # runs Vitest against `Graph.parse`
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
- Combine with `cargo fmt --all -- --check` and `cargo clippy -p domainforge-core -- -D warnings` for full validation.
|
|
121
|
+
|
|
122
|
+
## Common Pitfalls / Troubleshooting
|
|
123
|
+
|
|
124
|
+
- **Using stale bindings**: After editing grammar or parser code, rebuild Python (`maturin develop`) and TypeScript (`npm run build`) bindings so `Graph.parse` reflects the changes.
|
|
125
|
+
- **File encoding**: Ensure `.sea` files are UTF-8; unusual whitespace can trigger unexpected token errors around indentation-sensitive sections.
|
|
126
|
+
- **Entry path awareness**: When parsing embedded strings (not files), namespace discovery cannot infer the path; pass `ParseOptions` with `entry_path` if you rely on registry lookups.
|
|
127
|
+
- **Large batches**: Wrap CLI calls with `xargs -P` or `GNU parallel` to speed up validation across many files; keep an eye on memory if models are very large.
|
|
128
|
+
|
|
129
|
+
## Links
|
|
130
|
+
|
|
131
|
+
- Tutorials: [Getting Started](../tutorials/getting-started.md), [First SEA Model](../tutorials/first-sea-model.md)
|
|
132
|
+
- Reference: [Grammar Spec](../reference/grammar-spec.md), [CLI Commands](../reference/cli-commands.md), [Primitives API](../reference/primitives-api.md)
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Policy Evaluation Modes (Three-Valued vs Boolean)
|
|
2
|
+
|
|
3
|
+
Goal: choose and troubleshoot the runtime evaluation mode for policies.
|
|
4
|
+
|
|
5
|
+
## Defaults and toggle
|
|
6
|
+
|
|
7
|
+
- Three-valued logic is **enabled by default** (returns `Unknown` when data is missing).
|
|
8
|
+
- Switch to strict boolean mode when you need binary pass/fail:
|
|
9
|
+
- Rust: `graph.set_evaluation_mode(false)`
|
|
10
|
+
- Python: `graph.set_evaluation_mode(False)`
|
|
11
|
+
- TypeScript/WASM: `graph.setEvaluationMode(false)`
|
|
12
|
+
|
|
13
|
+
Return to three-valued logic with `true/True`.
|
|
14
|
+
|
|
15
|
+
## When to use which mode
|
|
16
|
+
|
|
17
|
+
- **Three-valued (default)**: modeling in-progress systems; want Unknown instead of false negatives.
|
|
18
|
+
- **Boolean**: production gates that must fail on any missing data; CI pipelines that treat Unknown as failure.
|
|
19
|
+
|
|
20
|
+
## Symptoms and fixes
|
|
21
|
+
|
|
22
|
+
- Seeing `Unknown` results when you expect pass/fail: enable boolean mode for that run or complete the missing fields.
|
|
23
|
+
- Tests failing after switching modes: ensure fixtures set `graph.set_evaluation_mode(true/false)` explicitly.
|
|
24
|
+
- Performance concerns: toggling is runtime-only; no rebuild needed.
|
|
25
|
+
|
|
26
|
+
## See also
|
|
27
|
+
|
|
28
|
+
- [Policy Evaluation Logic](../explanations/policy-evaluation-logic.md)
|
|
29
|
+
- [Three-Valued Logic](../explanations/three-valued-logic.md)
|
|
30
|
+
- [CLI Commands](../reference/cli-commands.md) (`--allow-unknown` parallels three-valued behavior)
|