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,913 @@
|
|
|
1
|
+
# SEA-DSL (Semantic Enterprise Architecture DSL) - AI Coding Agent Cheatsheet
|
|
2
|
+
# Purpose: Comprehensive reference for AI agents to understand and generate SEA-DSL code
|
|
3
|
+
# Version: 1.2.0
|
|
4
|
+
# Last Updated: 2025-12-16
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
meta:
|
|
8
|
+
dsl_name: SEA-DSL (Semantic Enterprise Architecture Domain-Specific Language)
|
|
9
|
+
purpose: Model enterprise systems as typed semantic graphs with entities, resources, flows, and policies
|
|
10
|
+
paradigm: Declarative, domain-driven, multi-target projection (CALM, RDF/KG, SBVR, Protobuf)
|
|
11
|
+
implementation:
|
|
12
|
+
core: Rust (canonical, in domainforge-core/)
|
|
13
|
+
bindings: [Python/PyO3, TypeScript/napi-rs, WASM/wasm-bindgen]
|
|
14
|
+
parser: PEG grammar via Pest (domainforge-core/grammar/sea.pest)
|
|
15
|
+
key_principle: Rust core is authoritative; bindings wrap types without duplicating logic
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
grammar:
|
|
19
|
+
file_structure:
|
|
20
|
+
pattern: "SOI ~ file_header? ~ declaration* ~ EOI"
|
|
21
|
+
components:
|
|
22
|
+
file_header:
|
|
23
|
+
annotations:
|
|
24
|
+
- "@namespace \"domain.subdomain\""
|
|
25
|
+
- "@version \"1.0.0\""
|
|
26
|
+
- "@owner \"team-name\""
|
|
27
|
+
- "@profile \"cloud\""
|
|
28
|
+
imports:
|
|
29
|
+
named: 'import {Foo, Bar as Baz} from "path/to/file.sea"'
|
|
30
|
+
wildcard: 'import * as alias from "module"'
|
|
31
|
+
stdlib: 'import { Service } from "std:core"'
|
|
32
|
+
|
|
33
|
+
keywords:
|
|
34
|
+
declaration: [Entity, Resource, Flow, Pattern, Role, Relation, Instance, Policy, Metric, Dimension, Unit, Mapping, Projection, ConceptChange, import, export]
|
|
35
|
+
expressions: [forall, exists, exists_unique, and, or, not, in, as, where, over, last, group_by]
|
|
36
|
+
operators: [">=", "<=", "!=", "=", ">", "<", contains, startswith, endswith, matches, before, after, during, has_role]
|
|
37
|
+
aggregates: [count, sum, min, max, avg]
|
|
38
|
+
collections: [flows, entities, resources, instances, relations]
|
|
39
|
+
modality: [Constraint, Derivation, Obligation, Prohibition, Permission]
|
|
40
|
+
case_sensitivity: case-insensitive (^"keyword" in grammar)
|
|
41
|
+
|
|
42
|
+
literals:
|
|
43
|
+
string: '"double-quoted with escapes"'
|
|
44
|
+
multiline: '"""triple-quoted\nmultiline"""'
|
|
45
|
+
number: "123, -456, 78.90 (no scientific notation)"
|
|
46
|
+
boolean: "true | false"
|
|
47
|
+
quantity: '100 "USD", 1_500 "kg"'
|
|
48
|
+
time: '"2025-12-31T23:59:59Z" (ISO 8601, timezone REQUIRED)'
|
|
49
|
+
interval: 'interval("09:00", "17:00")'
|
|
50
|
+
|
|
51
|
+
identifiers:
|
|
52
|
+
pattern: "[A-Za-z_][A-Za-z0-9_]*"
|
|
53
|
+
names: "double-quoted strings or triple-quoted multiline"
|
|
54
|
+
instance_reference: "@instance_name"
|
|
55
|
+
|
|
56
|
+
comments:
|
|
57
|
+
single_line: "// comment to end of line"
|
|
58
|
+
whitespace: "ignored outside strings"
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
primitives:
|
|
62
|
+
Entity:
|
|
63
|
+
purpose: "WHO - actors, systems, organizational units participating in flows"
|
|
64
|
+
syntax:
|
|
65
|
+
basic: 'Entity "Name"'
|
|
66
|
+
with_namespace: 'Entity "Name" in domain'
|
|
67
|
+
with_version: 'Entity "Name" v1.2.3 in domain'
|
|
68
|
+
with_evolution:
|
|
69
|
+
pattern: |
|
|
70
|
+
Entity "VendorV2" v2.0.0
|
|
71
|
+
@replaces "Vendor" v1.0.0
|
|
72
|
+
@changes ["added credit_limit", "added payment_terms"]
|
|
73
|
+
in procurement
|
|
74
|
+
fields:
|
|
75
|
+
id: "ConceptId (derived from namespace+name)"
|
|
76
|
+
name: "String"
|
|
77
|
+
namespace: "Option<String> (defaults to 'default')"
|
|
78
|
+
version: "Option<SemanticVersion>"
|
|
79
|
+
replaces: "Option<String> (entity name being replaced)"
|
|
80
|
+
changes: "Vec<String> (changelog entries)"
|
|
81
|
+
attributes: "IndexMap<String, AttributeValue>"
|
|
82
|
+
rust_constructor: "Entity::new_with_namespace(name, namespace)"
|
|
83
|
+
python_constructor: "Entity(name, namespace=None, attributes=None)"
|
|
84
|
+
typescript_constructor: "new Entity(name, namespace?, attributes?)"
|
|
85
|
+
|
|
86
|
+
Resource:
|
|
87
|
+
purpose: "WHAT - items transferred, measured, or tracked in flows"
|
|
88
|
+
syntax:
|
|
89
|
+
basic: 'Resource "Name"'
|
|
90
|
+
with_units: 'Resource "Name" units'
|
|
91
|
+
with_specific_unit: 'Resource "Money" USD'
|
|
92
|
+
with_namespace: 'Resource "Money" USD in finance'
|
|
93
|
+
fields:
|
|
94
|
+
id: "ConceptId"
|
|
95
|
+
name: "String"
|
|
96
|
+
namespace: "Option<String>"
|
|
97
|
+
unit: "Option<String> (concrete unit if bound)"
|
|
98
|
+
has_units: "bool (true if declared with 'units' keyword)"
|
|
99
|
+
attributes: "AttributeMap"
|
|
100
|
+
rust_constructor: "Resource::new(name, namespace, unit, has_units, attributes)"
|
|
101
|
+
validation:
|
|
102
|
+
- "unit must resolve to declared unit or fail validation"
|
|
103
|
+
- "if has_units=false, quantities with units cause validation error"
|
|
104
|
+
|
|
105
|
+
Flow:
|
|
106
|
+
purpose: "HOW - movement of resources between entities"
|
|
107
|
+
syntax:
|
|
108
|
+
basic: 'Flow "ResourceName" from "SourceEntity" to "DestEntity"'
|
|
109
|
+
with_quantity: 'Flow "Money" from "Customer" to "PaymentProcessor" quantity 1000'
|
|
110
|
+
fields:
|
|
111
|
+
id: "ConceptId"
|
|
112
|
+
resource_id: "ConceptId (MUST use ID, not reference)"
|
|
113
|
+
from_entity_id: "ConceptId"
|
|
114
|
+
to_entity_id: "ConceptId"
|
|
115
|
+
quantity: "Option<Quantity> {value: Decimal, unit: Option<String>}"
|
|
116
|
+
namespace: "Option<String>"
|
|
117
|
+
attributes: "AttributeMap"
|
|
118
|
+
rust_constructor: "Flow::new(resource_id, from_id, to_id, quantity, namespace, attributes)"
|
|
119
|
+
critical_anti_pattern:
|
|
120
|
+
wrong: "Flow::new(resource, from_entity, to_entity) # Passing objects"
|
|
121
|
+
correct: "Flow::new(resource.concept_id(), from.concept_id(), to.concept_id()) # Pass IDs"
|
|
122
|
+
validation:
|
|
123
|
+
- "resource_id, from, to must exist in same namespace"
|
|
124
|
+
- "quantity units must match resource dimension or be convertible"
|
|
125
|
+
|
|
126
|
+
Role:
|
|
127
|
+
purpose: "Participant category labels for relations"
|
|
128
|
+
syntax:
|
|
129
|
+
basic: 'Role "Approver"'
|
|
130
|
+
with_namespace: 'Role "Approver" in governance'
|
|
131
|
+
fields:
|
|
132
|
+
id: "ConceptId"
|
|
133
|
+
name: "String"
|
|
134
|
+
namespace: "Option<String>"
|
|
135
|
+
attributes: "AttributeMap"
|
|
136
|
+
rust_constructor: "Role::new(name, namespace, attributes)"
|
|
137
|
+
|
|
138
|
+
Relation:
|
|
139
|
+
purpose: "Semantic predicates connecting roles, optionally tied to flows"
|
|
140
|
+
syntax:
|
|
141
|
+
pattern: |
|
|
142
|
+
Relation "Payment"
|
|
143
|
+
subject: "Payer"
|
|
144
|
+
predicate: "pays"
|
|
145
|
+
object: "Payee"
|
|
146
|
+
via: flow "Money"
|
|
147
|
+
fields:
|
|
148
|
+
id: "ConceptId"
|
|
149
|
+
name: "String"
|
|
150
|
+
subject_role_id: "ConceptId"
|
|
151
|
+
predicate: "String"
|
|
152
|
+
object_role_id: "ConceptId"
|
|
153
|
+
via_flow_id: "Option<ConceptId>"
|
|
154
|
+
namespace: "Option<String>"
|
|
155
|
+
attributes: "AttributeMap"
|
|
156
|
+
rust_constructor: "Relation::new(name, namespace, subject_role, predicate, object_role, via_flow)"
|
|
157
|
+
validation:
|
|
158
|
+
- "subject/object role IDs must exist"
|
|
159
|
+
- "via_flow_id must point to declared flow if present"
|
|
160
|
+
|
|
161
|
+
Instance:
|
|
162
|
+
purpose: "Concrete instantiation of an entity with field values"
|
|
163
|
+
syntax:
|
|
164
|
+
pattern: |
|
|
165
|
+
Instance order_123 of "Order" {
|
|
166
|
+
amount: 150,
|
|
167
|
+
currency: "USD"
|
|
168
|
+
}
|
|
169
|
+
fields:
|
|
170
|
+
id: "ConceptId"
|
|
171
|
+
name: "String (identifier, not quoted)"
|
|
172
|
+
entity_type: "String"
|
|
173
|
+
fields: "Map<String, Expression>"
|
|
174
|
+
note: "Instance names are identifiers (unquoted), not string literals"
|
|
175
|
+
|
|
176
|
+
Policy:
|
|
177
|
+
purpose: "Expressions evaluated against the graph for constraints and derivations"
|
|
178
|
+
syntax:
|
|
179
|
+
basic: 'Policy policy_name as: expression'
|
|
180
|
+
with_modality: 'Policy name per Constraint Obligation priority 5 as: expression'
|
|
181
|
+
with_annotations:
|
|
182
|
+
pattern: |
|
|
183
|
+
Policy payment_threshold per Constraint Obligation priority 5
|
|
184
|
+
@rationale "Limit single payments"
|
|
185
|
+
@tags ["finance", "compliance"]
|
|
186
|
+
v1.0.0
|
|
187
|
+
as: forall f in flows: (f.resource = "Money" and f.quantity <= 10000)
|
|
188
|
+
fields:
|
|
189
|
+
name: "identifier (unquoted)"
|
|
190
|
+
kind: "[Constraint, Derivation, Obligation]"
|
|
191
|
+
modality: "[Obligation, Prohibition, Permission]"
|
|
192
|
+
priority: "number"
|
|
193
|
+
annotations: "rationale, tags"
|
|
194
|
+
version: "Option<SemanticVersion>"
|
|
195
|
+
expression: "Expression tree"
|
|
196
|
+
evaluation:
|
|
197
|
+
modes: ["two-valued (True/False)", "three-valued (True/False/Unknown)"]
|
|
198
|
+
unknown_handling: "undefined data yields Unknown in three-valued mode"
|
|
199
|
+
rust_api: "Graph::evaluate_policy(policy) -> EvaluationResult"
|
|
200
|
+
python_api: "graph.evaluate_policy(policy_json) -> PolicyResult"
|
|
201
|
+
typescript_api: "graph.evaluatePolicy(policyJson): PolicyResult"
|
|
202
|
+
|
|
203
|
+
Metric:
|
|
204
|
+
purpose: "Observable measurements with refresh intervals and thresholds"
|
|
205
|
+
syntax:
|
|
206
|
+
pattern: |
|
|
207
|
+
Metric "total_payment_volume" as:
|
|
208
|
+
sum(f in flows where f.resource = "Money": f.quantity as "USD")
|
|
209
|
+
@refresh_interval 60 "seconds"
|
|
210
|
+
@unit "USD"
|
|
211
|
+
@threshold 100
|
|
212
|
+
@severity "warning"
|
|
213
|
+
@target 5000
|
|
214
|
+
@window 300 "seconds"
|
|
215
|
+
annotations:
|
|
216
|
+
refresh_interval: "number unit_string"
|
|
217
|
+
unit: "string"
|
|
218
|
+
threshold: "number"
|
|
219
|
+
severity: "string (e.g., warning, critical)"
|
|
220
|
+
target: "number"
|
|
221
|
+
window: "number unit_string"
|
|
222
|
+
|
|
223
|
+
Pattern:
|
|
224
|
+
purpose: "Named regex patterns for validation"
|
|
225
|
+
syntax: 'Pattern "Email" matches "^[a-z0-9._%+-]+@[a-z0-9.-]+\\.[a-z]{2,}$"'
|
|
226
|
+
|
|
227
|
+
ConceptChange:
|
|
228
|
+
purpose: "Track semantic version migrations"
|
|
229
|
+
syntax:
|
|
230
|
+
pattern: |
|
|
231
|
+
ConceptChange "Vendor_v2_migration"
|
|
232
|
+
@from_version v2.0.0
|
|
233
|
+
@to_version v2.1.0
|
|
234
|
+
@migration_policy mandatory
|
|
235
|
+
@breaking_change true
|
|
236
|
+
annotations:
|
|
237
|
+
from_version: "vX.Y.Z"
|
|
238
|
+
to_version: "vX.Y.Z"
|
|
239
|
+
migration_policy: "mandatory | optional"
|
|
240
|
+
breaking_change: "true | false"
|
|
241
|
+
|
|
242
|
+
Dimension:
|
|
243
|
+
purpose: "Define measurement dimensions for unit conversion"
|
|
244
|
+
syntax: 'Dimension "Currency"'
|
|
245
|
+
|
|
246
|
+
Unit:
|
|
247
|
+
purpose: "Define units within dimensions with conversion factors"
|
|
248
|
+
syntax: 'Unit "USD" of "Currency" factor 1 base "USD"'
|
|
249
|
+
example_set:
|
|
250
|
+
- 'Dimension "Currency"'
|
|
251
|
+
- 'Unit "USD" of "Currency" factor 1 base "USD"'
|
|
252
|
+
- 'Unit "EUR" of "Currency" factor 1.07 base "USD"'
|
|
253
|
+
builtin_time_units:
|
|
254
|
+
s: "seconds (base)"
|
|
255
|
+
ms: "milliseconds (factor 0.001)"
|
|
256
|
+
us: "microseconds (factor 0.000001)"
|
|
257
|
+
ns: "nanoseconds (factor 0.000000001)"
|
|
258
|
+
|
|
259
|
+
Mapping:
|
|
260
|
+
purpose: "Define how primitives map to external formats"
|
|
261
|
+
syntax:
|
|
262
|
+
pattern: |
|
|
263
|
+
Mapping "name" for calm {
|
|
264
|
+
Entity "Customer" -> Target { "id": "customer_id" }
|
|
265
|
+
Flow "Money" -> Target { "from": true }
|
|
266
|
+
}
|
|
267
|
+
target_formats: [calm, kg, sbvr, protobuf]
|
|
268
|
+
|
|
269
|
+
Projection:
|
|
270
|
+
purpose: "Override default field projections for exports"
|
|
271
|
+
syntax:
|
|
272
|
+
pattern: |
|
|
273
|
+
Projection "name" for calm {
|
|
274
|
+
Entity "Customer" { "name": "customer_name" }
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
Expression:
|
|
278
|
+
purpose: "Programmatic construction and normalization of policy expressions"
|
|
279
|
+
variants:
|
|
280
|
+
Basic: "Expression (AST wrapper)"
|
|
281
|
+
Normalized: "NormalizedExpression (canonical form with stable hash)"
|
|
282
|
+
factory_methods:
|
|
283
|
+
rust: "Expression::literal(), Expression::variable(), Expression::binary()..."
|
|
284
|
+
python: "Expression.literal(), Expression.variable(), Expression.binary()..."
|
|
285
|
+
typescript: "Expression.literal(), Expression.variable(), Expression.binary()..."
|
|
286
|
+
wasm: "Expression.literal(), Expression.variable(), Expression.binary()..."
|
|
287
|
+
normalization:
|
|
288
|
+
method: "expr.normalize() -> NormalizedExpression"
|
|
289
|
+
features: "Identity elimination, commutative sorting, idempotence, double negation"
|
|
290
|
+
hashing:
|
|
291
|
+
Rust: "u64 (raw integer)"
|
|
292
|
+
Python: "hex string (0x...)"
|
|
293
|
+
TypeScript: "hex string (0x...)"
|
|
294
|
+
WASM: "hex string (0x...)"
|
|
295
|
+
note: "Hash values are consistent across bindings but representation differs (Rust: u64, others: hex string)"
|
|
296
|
+
|
|
297
|
+
---
|
|
298
|
+
expressions:
|
|
299
|
+
precedence:
|
|
300
|
+
highest_to_lowest:
|
|
301
|
+
- "primary_expr (literals, identifiers, parenthesized)"
|
|
302
|
+
- "cast_expr (as)"
|
|
303
|
+
- "unary_expr (-, not)"
|
|
304
|
+
- "multiplicative_expr (*, /)"
|
|
305
|
+
- "additive_expr (+, -)"
|
|
306
|
+
- "comparison_expr (=, !=, <, >, <=, >=, contains, matches, etc.)"
|
|
307
|
+
- "not_expr"
|
|
308
|
+
- "and_expr"
|
|
309
|
+
- "or_expr"
|
|
310
|
+
|
|
311
|
+
primary_expressions:
|
|
312
|
+
literal: "42, true, \"string\", 100 \"USD\""
|
|
313
|
+
variable: "identifier referencing in-scope binding"
|
|
314
|
+
member_access: "entity.name, flow.quantity"
|
|
315
|
+
instance_reference: "@instance_name"
|
|
316
|
+
parenthesized: "(expression)"
|
|
317
|
+
|
|
318
|
+
comparison_operators:
|
|
319
|
+
equality: ["=", "!="]
|
|
320
|
+
relational: [">", "<", ">=", "<="]
|
|
321
|
+
string_ops: [contains, startswith, endswith, matches]
|
|
322
|
+
temporal_ops: [before, after, during]
|
|
323
|
+
role_check: "has_role"
|
|
324
|
+
|
|
325
|
+
logical_operators:
|
|
326
|
+
and: "expr1 and expr2"
|
|
327
|
+
or: "expr1 or expr2"
|
|
328
|
+
not: "not expr"
|
|
329
|
+
|
|
330
|
+
quantifiers:
|
|
331
|
+
forall:
|
|
332
|
+
syntax: 'forall x in collection: (condition)'
|
|
333
|
+
example: 'forall f in flows: (f.quantity > 0)'
|
|
334
|
+
exists:
|
|
335
|
+
syntax: 'exists x in collection: (condition)'
|
|
336
|
+
example: 'exists e in entities: (e.name = "Admin")'
|
|
337
|
+
exists_unique:
|
|
338
|
+
syntax: 'exists_unique x in collection: (condition)'
|
|
339
|
+
purpose: "exactly one element satisfies condition"
|
|
340
|
+
|
|
341
|
+
aggregations:
|
|
342
|
+
simple:
|
|
343
|
+
count: 'count(flows)'
|
|
344
|
+
sum: 'sum(flows.quantity)'
|
|
345
|
+
with_filter:
|
|
346
|
+
pattern: 'count(flows where resource = "Camera")'
|
|
347
|
+
comprehension:
|
|
348
|
+
pattern: 'sum(f in flows where f.resource = "Money": f.quantity as "USD")'
|
|
349
|
+
components:
|
|
350
|
+
variable: "f"
|
|
351
|
+
collection: "flows"
|
|
352
|
+
filter: 'f.resource = "Money"'
|
|
353
|
+
projection: "f.quantity as \"USD\""
|
|
354
|
+
with_window:
|
|
355
|
+
pattern: 'sum(f in flows over last 60 "seconds" where f.resource = "Money": f.quantity)'
|
|
356
|
+
|
|
357
|
+
group_by:
|
|
358
|
+
syntax: 'group_by(var in collection: group_key) { aggregate_expression }'
|
|
359
|
+
example: 'group_by(f in flows: f.to.name) { sum(f.quantity) > 10 }'
|
|
360
|
+
|
|
361
|
+
casting:
|
|
362
|
+
purpose: "Convert between compatible units"
|
|
363
|
+
syntax: 'expression as "target_unit"'
|
|
364
|
+
examples:
|
|
365
|
+
- '1000 "ms" as "s" // -> 1 "s"'
|
|
366
|
+
- 'f.quantity as "USD"'
|
|
367
|
+
note: "Distinct from 'as:' keyword in Policy/Metric declarations"
|
|
368
|
+
|
|
369
|
+
collections:
|
|
370
|
+
available: [flows, entities, resources, instances, relations]
|
|
371
|
+
iteration: "Only accessible via quantifiers and aggregations"
|
|
372
|
+
|
|
373
|
+
---
|
|
374
|
+
graph_api:
|
|
375
|
+
construction:
|
|
376
|
+
rust: "Graph::new()"
|
|
377
|
+
python: "Graph()"
|
|
378
|
+
typescript: "new Graph()"
|
|
379
|
+
|
|
380
|
+
add_methods:
|
|
381
|
+
rust:
|
|
382
|
+
- "add_entity(&mut self, entity: Entity) -> Result<(), String>"
|
|
383
|
+
- "add_resource(&mut self, resource: Resource) -> Result<(), String>"
|
|
384
|
+
- "add_flow(&mut self, flow: Flow) -> Result<(), String>"
|
|
385
|
+
- "add_role(&mut self, role: Role) -> Result<(), String>"
|
|
386
|
+
- "add_relation_type(&mut self, relation: RelationType) -> Result<(), String>"
|
|
387
|
+
- "add_instance(&mut self, instance: Instance) -> Result<(), String>"
|
|
388
|
+
- "add_policy(&mut self, policy: Policy) -> Result<(), String>"
|
|
389
|
+
- "add_pattern(&mut self, pattern: Pattern) -> Result<(), String>"
|
|
390
|
+
python: "add_entity(), add_resource(), add_flow(), add_role(), add_relation(), add_instance()"
|
|
391
|
+
typescript: "addEntity(), addResource(), addFlow(), addRole(), addRelation(), addInstance()"
|
|
392
|
+
|
|
393
|
+
query_methods:
|
|
394
|
+
counts: "entity_count(), resource_count(), flow_count(), role_count(), relation_count(), instance_count(), policy_count(), pattern_count()"
|
|
395
|
+
get_by_id: "get_entity(id), get_resource(id), get_flow(id), get_role(id)"
|
|
396
|
+
find_by_name: "find_entity_by_name(name), find_resource_by_name(name), find_role_by_name(name)"
|
|
397
|
+
all_accessors: "all_entities(), all_resources(), all_flows(), all_instances(), all_roles(), all_relations(), all_patterns()"
|
|
398
|
+
|
|
399
|
+
policy_evaluation:
|
|
400
|
+
set_mode: "set_evaluation_mode(use_three_valued_logic: bool)"
|
|
401
|
+
check_mode: "use_three_valued_logic() -> bool"
|
|
402
|
+
evaluate: "evaluate_policy(policy) -> EvaluationResult"
|
|
403
|
+
|
|
404
|
+
parsing:
|
|
405
|
+
from_source:
|
|
406
|
+
rust: "Graph::parse(source: &str) -> Result<Graph, ParseError>"
|
|
407
|
+
python: "Graph.parse(source: str) -> Graph"
|
|
408
|
+
typescript: "Graph.parse(source: string): Graph"
|
|
409
|
+
|
|
410
|
+
critical_convention:
|
|
411
|
+
determinism: "Use IndexMap (not HashMap) for policy-relevant collections"
|
|
412
|
+
reason: "HashMap causes non-deterministic iteration order, breaking policy evaluation consistency"
|
|
413
|
+
|
|
414
|
+
---
|
|
415
|
+
types:
|
|
416
|
+
ConceptId:
|
|
417
|
+
purpose: "Unique identifier derived from namespace + name"
|
|
418
|
+
construction: "ConceptId::from_concept(namespace, name)"
|
|
419
|
+
legacy: "ConceptId::from_legacy_uuid(uuid)"
|
|
420
|
+
|
|
421
|
+
SemanticVersion:
|
|
422
|
+
format: "major.minor.patch (e.g., 1.2.3)"
|
|
423
|
+
usage: "Entity versions, policy versions, ConceptChange annotations"
|
|
424
|
+
|
|
425
|
+
Quantity:
|
|
426
|
+
fields:
|
|
427
|
+
value: "rust_decimal::Decimal (arbitrary precision)"
|
|
428
|
+
unit: "Option<String>"
|
|
429
|
+
json_serialization: "Decimal as string to preserve precision"
|
|
430
|
+
typescript_note: "Returns number for convenience; use string for round-tripping"
|
|
431
|
+
|
|
432
|
+
AttributeValue:
|
|
433
|
+
variants:
|
|
434
|
+
- "null"
|
|
435
|
+
- "boolean"
|
|
436
|
+
- "string"
|
|
437
|
+
- "Decimal (as string in JSON)"
|
|
438
|
+
- "bytes (base64 in JSON)"
|
|
439
|
+
- "array of AttributeValue"
|
|
440
|
+
- "object map (string -> AttributeValue)"
|
|
441
|
+
|
|
442
|
+
AttributeMap:
|
|
443
|
+
definition: "IndexMap<String, AttributeValue>"
|
|
444
|
+
note: "Uses IndexMap for deterministic iteration"
|
|
445
|
+
|
|
446
|
+
---
|
|
447
|
+
error_codes:
|
|
448
|
+
categories:
|
|
449
|
+
E001_E099: "Syntax and Parsing Errors"
|
|
450
|
+
E100_E199: "Type System Errors"
|
|
451
|
+
E200_E299: "Unit and Dimension Errors"
|
|
452
|
+
E300_E399: "Scope and Reference Errors"
|
|
453
|
+
E400_E499: "Policy Validation Errors"
|
|
454
|
+
E500_E599: "Namespace and Module Errors"
|
|
455
|
+
|
|
456
|
+
common_errors:
|
|
457
|
+
E001:
|
|
458
|
+
name: "Undefined Entity"
|
|
459
|
+
cause: "Reference to undeclared entity"
|
|
460
|
+
fix: "Define entity before referencing, check spelling, verify namespace"
|
|
461
|
+
E002:
|
|
462
|
+
name: "Undefined Resource"
|
|
463
|
+
cause: "Reference to undeclared resource"
|
|
464
|
+
fix: "Define resource before use, check spelling"
|
|
465
|
+
E005:
|
|
466
|
+
name: "Syntax Error"
|
|
467
|
+
cause: "Malformed DSL syntax"
|
|
468
|
+
fix: "Check for missing tokens, unclosed quotes/brackets"
|
|
469
|
+
E007:
|
|
470
|
+
name: "Duplicate Declaration"
|
|
471
|
+
cause: "Same name declared twice"
|
|
472
|
+
fix: "Use unique names or namespaces"
|
|
473
|
+
E100:
|
|
474
|
+
name: "Incompatible Types"
|
|
475
|
+
cause: "Type mismatch in expressions"
|
|
476
|
+
fix: "Ensure type compatibility, use conversions"
|
|
477
|
+
E200:
|
|
478
|
+
name: "Dimension Mismatch"
|
|
479
|
+
cause: "Operations on incompatible dimensions"
|
|
480
|
+
fix: "Use same dimension or add unit conversion"
|
|
481
|
+
E201:
|
|
482
|
+
name: "Invalid Unit"
|
|
483
|
+
cause: "Unrecognized unit name"
|
|
484
|
+
fix: "Declare unit or use standard names"
|
|
485
|
+
E300:
|
|
486
|
+
name: "Variable Not In Scope"
|
|
487
|
+
cause: "Variable used outside its binding scope"
|
|
488
|
+
fix: "Move reference inside scope or expand binding"
|
|
489
|
+
E400:
|
|
490
|
+
name: "Policy Evaluation Failed"
|
|
491
|
+
cause: "Policy expression could not evaluate"
|
|
492
|
+
fix: "Check expression syntax and input validity"
|
|
493
|
+
E500:
|
|
494
|
+
name: "Namespace Not Found"
|
|
495
|
+
cause: "Reference to non-existent namespace"
|
|
496
|
+
fix: "Check spelling, add import, use fuzzy suggestion"
|
|
497
|
+
E503:
|
|
498
|
+
name: "Module Not Found"
|
|
499
|
+
cause: "Imported module file missing"
|
|
500
|
+
fix: "Verify file path, check module existence"
|
|
501
|
+
E504:
|
|
502
|
+
name: "Symbol Not Exported"
|
|
503
|
+
cause: "Imported symbol not in module exports"
|
|
504
|
+
fix: "Check symbol name, verify export in source module"
|
|
505
|
+
|
|
506
|
+
handling:
|
|
507
|
+
cli: "sea validate --format json file.sea"
|
|
508
|
+
python: |
|
|
509
|
+
try:
|
|
510
|
+
graph = Graph.parse(source)
|
|
511
|
+
except Exception as e:
|
|
512
|
+
print(f"Error {e.code}: {e}")
|
|
513
|
+
typescript: |
|
|
514
|
+
try {
|
|
515
|
+
const graph = Graph.parse(source);
|
|
516
|
+
} catch (e: any) {
|
|
517
|
+
const metadata = JSON.parse(e.message.split("__metadata__: ")[1]);
|
|
518
|
+
console.error(`Error ${metadata.code}: ${metadata.errorType}`);
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
---
|
|
522
|
+
standard_library:
|
|
523
|
+
core:
|
|
524
|
+
path: "std:core"
|
|
525
|
+
entities: [System, User, Service]
|
|
526
|
+
import: 'import { Service } from "std:core"'
|
|
527
|
+
|
|
528
|
+
aws:
|
|
529
|
+
path: "std:aws"
|
|
530
|
+
entities:
|
|
531
|
+
- "AWS Lambda Function"
|
|
532
|
+
- "AWS S3 Bucket"
|
|
533
|
+
- "AWS DynamoDB Table"
|
|
534
|
+
|
|
535
|
+
http:
|
|
536
|
+
path: "std:http"
|
|
537
|
+
note: "HTTP-related entities and resources"
|
|
538
|
+
|
|
539
|
+
---
|
|
540
|
+
projections:
|
|
541
|
+
calm:
|
|
542
|
+
purpose: "FINOS CALM (Common Architecture Language Model)"
|
|
543
|
+
mapping:
|
|
544
|
+
Entity: "models[n].entities"
|
|
545
|
+
Resource: "models[n].resources (with units preserved)"
|
|
546
|
+
Role: "typed facts with subjectRole/objectRole"
|
|
547
|
+
Flow: "facts with sea:id linking to DSL IDs"
|
|
548
|
+
export_command: "sea export --format calm file.sea"
|
|
549
|
+
|
|
550
|
+
kg:
|
|
551
|
+
purpose: "RDF/Turtle Knowledge Graph"
|
|
552
|
+
export: "sea export --format turtle file.sea"
|
|
553
|
+
|
|
554
|
+
sbvr:
|
|
555
|
+
purpose: "SBVR semantic business vocabulary"
|
|
556
|
+
import_command: "sea import --format sbvr vocabulary.xmi"
|
|
557
|
+
|
|
558
|
+
protobuf:
|
|
559
|
+
purpose: "Protocol Buffers for gRPC/binary serialization"
|
|
560
|
+
version: "proto3"
|
|
561
|
+
mapping:
|
|
562
|
+
Entity: "message (PascalCase)"
|
|
563
|
+
Resource: "message (PascalCase)"
|
|
564
|
+
Flow: "gRPC service method (with --include-services)"
|
|
565
|
+
attributes: "message fields (snake_case, numbered alphabetically)"
|
|
566
|
+
type_mapping:
|
|
567
|
+
String: "string"
|
|
568
|
+
Int: "int64"
|
|
569
|
+
Float: "double"
|
|
570
|
+
Bool: "bool"
|
|
571
|
+
Date: "google.protobuf.Timestamp"
|
|
572
|
+
DateTime: "google.protobuf.Timestamp"
|
|
573
|
+
Duration: "google.protobuf.Duration"
|
|
574
|
+
UUID: "string"
|
|
575
|
+
Money: "custom Money message"
|
|
576
|
+
"List<T>": "repeated T"
|
|
577
|
+
"Optional<T>": "optional T"
|
|
578
|
+
Any: "google.protobuf.Any"
|
|
579
|
+
streaming_modes:
|
|
580
|
+
Unary: "default - single request/response"
|
|
581
|
+
ServerStreaming: "@streaming attribute on Flow"
|
|
582
|
+
ClientStreaming: "@client_streaming attribute"
|
|
583
|
+
Bidirectional: "@bidirectional attribute"
|
|
584
|
+
compatibility_modes:
|
|
585
|
+
Additive: "only additions allowed"
|
|
586
|
+
Backward: "additions + safe removals with reserved"
|
|
587
|
+
Breaking: "any changes allowed"
|
|
588
|
+
export_commands:
|
|
589
|
+
basic: "sea project --format protobuf model.sea output.proto"
|
|
590
|
+
with_services: "sea project --format protobuf --include-services model.sea api.proto"
|
|
591
|
+
multi_file: "sea project --format protobuf --multi-file --output-dir ./proto model.sea"
|
|
592
|
+
with_options: "sea project --format protobuf --option java_package=com.example model.sea output.proto"
|
|
593
|
+
buf_integration:
|
|
594
|
+
lint: "sea project --format protobuf --buf-lint model.sea output.proto"
|
|
595
|
+
breaking: "sea project --format protobuf --buf-breaking --against ./previous model.sea output.proto"
|
|
596
|
+
rust_api:
|
|
597
|
+
project: "ProtobufEngine::project(&graph, namespace, package) -> ProtoFile"
|
|
598
|
+
multi_file: "ProtobufEngine::project_multi_file(&graph, base_package) -> BTreeMap<String, ProtoFile>"
|
|
599
|
+
serialize: "proto_file.to_proto_string() -> String"
|
|
600
|
+
example_output: |
|
|
601
|
+
// Generated by SEA Projection Framework
|
|
602
|
+
syntax = "proto3";
|
|
603
|
+
package com.example.payments;
|
|
604
|
+
|
|
605
|
+
import "google/protobuf/timestamp.proto";
|
|
606
|
+
|
|
607
|
+
message Customer {
|
|
608
|
+
string email = 1;
|
|
609
|
+
string name = 2;
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
message Payment {
|
|
613
|
+
string amount = 1;
|
|
614
|
+
google.protobuf.Timestamp timestamp = 2;
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
service PaymentProcessorService {
|
|
618
|
+
rpc ProcessPayment(Payment) returns (PaymentResponse);
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
---
|
|
622
|
+
development_workflow:
|
|
623
|
+
grammar_changes:
|
|
624
|
+
steps:
|
|
625
|
+
1: "Update domainforge-core/grammar/sea.pest"
|
|
626
|
+
2: "Update AST in domainforge-core/src/parser/ast.rs"
|
|
627
|
+
3: "Add parser tests in domainforge-core/tests/parser_*.rs"
|
|
628
|
+
4: "Update projections (CALM/KG) if affected"
|
|
629
|
+
5: "Refresh documentation"
|
|
630
|
+
|
|
631
|
+
primitive_changes:
|
|
632
|
+
mandatory_updates:
|
|
633
|
+
- "domainforge-core/src/primitives/*.rs (Rust core)"
|
|
634
|
+
- "domainforge-core/src/python/primitives.rs (PyO3 bindings)"
|
|
635
|
+
- "domainforge-core/src/typescript/primitives.rs (napi-rs bindings)"
|
|
636
|
+
- "domainforge-core/src/wasm/primitives.rs (if public API)"
|
|
637
|
+
test_suites:
|
|
638
|
+
- "tests/ (Python integration)"
|
|
639
|
+
- "typescript-tests/ (TypeScript/Vitest)"
|
|
640
|
+
- "domainforge-core/tests/ (Rust unit/integration)"
|
|
641
|
+
|
|
642
|
+
verification:
|
|
643
|
+
all_tests: "just all-tests"
|
|
644
|
+
rust_only: "just rust-test"
|
|
645
|
+
python_only: "just python-test"
|
|
646
|
+
typescript_only: "just ts-test"
|
|
647
|
+
lint: "cargo clippy -- -D warnings && cargo fmt"
|
|
648
|
+
|
|
649
|
+
---
|
|
650
|
+
anti_patterns:
|
|
651
|
+
hashmap_usage:
|
|
652
|
+
wrong: |
|
|
653
|
+
use std::collections::HashMap;
|
|
654
|
+
let entities: HashMap<String, Entity> = ...;
|
|
655
|
+
correct: |
|
|
656
|
+
use indexmap::IndexMap;
|
|
657
|
+
let entities: IndexMap<String, Entity> = ...;
|
|
658
|
+
reason: "HashMap causes non-deterministic policy evaluation"
|
|
659
|
+
|
|
660
|
+
flow_construction:
|
|
661
|
+
wrong: "Flow::new(resource, from_entity, to_entity) // objects"
|
|
662
|
+
correct: "Flow::new(resource.concept_id(), from.concept_id(), to.concept_id()) // IDs"
|
|
663
|
+
reason: "Flows reference IDs, not objects"
|
|
664
|
+
|
|
665
|
+
parser_modification:
|
|
666
|
+
wrong: "Edit src/parser/ast.rs first"
|
|
667
|
+
correct: |
|
|
668
|
+
1. domainforge-core/grammar/sea.pest
|
|
669
|
+
2. src/parser/ast.rs
|
|
670
|
+
3. tests/parser_*.rs
|
|
671
|
+
reason: "Grammar is the source of truth for syntax"
|
|
672
|
+
|
|
673
|
+
binding_sync:
|
|
674
|
+
rule: "If touching domainforge-core/src/primitives/*.rs, MUST update all bindings"
|
|
675
|
+
files:
|
|
676
|
+
- "domainforge-core/src/python/primitives.rs"
|
|
677
|
+
- "domainforge-core/src/typescript/primitives.rs"
|
|
678
|
+
- "domainforge-core/src/wasm/primitives.rs"
|
|
679
|
+
verify: "just all-tests"
|
|
680
|
+
|
|
681
|
+
---
|
|
682
|
+
examples:
|
|
683
|
+
basic_model:
|
|
684
|
+
code: |
|
|
685
|
+
Entity "User" in auth
|
|
686
|
+
Resource "Token" units in auth
|
|
687
|
+
Flow "Token" from "User" to "User" quantity 1
|
|
688
|
+
|
|
689
|
+
logistics:
|
|
690
|
+
code: |
|
|
691
|
+
Entity "Warehouse"
|
|
692
|
+
Entity "Factory"
|
|
693
|
+
Resource "Camera" units
|
|
694
|
+
Flow "Camera" from "Warehouse" to "Factory" quantity 100
|
|
695
|
+
|
|
696
|
+
Policy logistics_flow as:
|
|
697
|
+
Entity.name != ""
|
|
698
|
+
|
|
699
|
+
finance_with_namespaces:
|
|
700
|
+
code: |
|
|
701
|
+
@namespace "com.example.finance"
|
|
702
|
+
|
|
703
|
+
Entity "Accounts Payable" in finance
|
|
704
|
+
Entity "Accounts Receivable" in finance
|
|
705
|
+
Entity "Customer" in finance
|
|
706
|
+
Resource "Invoice" units in finance
|
|
707
|
+
Flow "Invoice" from "Customer" to "Accounts Receivable" quantity 5
|
|
708
|
+
|
|
709
|
+
metrics_and_observability:
|
|
710
|
+
code: |
|
|
711
|
+
@namespace "com.example.payments"
|
|
712
|
+
|
|
713
|
+
Entity "PaymentProcessor" in com.example.payments
|
|
714
|
+
Entity "Customer" in com.example.payments
|
|
715
|
+
Resource "Money" USD in com.example.finance
|
|
716
|
+
|
|
717
|
+
Flow "Money" from "Customer" to "PaymentProcessor" quantity 1000
|
|
718
|
+
|
|
719
|
+
Metric "total_payment_volume" as:
|
|
720
|
+
sum(f in flows where f.resource = "Money": f.quantity as "USD")
|
|
721
|
+
@refresh_interval 60 "seconds"
|
|
722
|
+
@unit "USD"
|
|
723
|
+
|
|
724
|
+
Metric "payment_count" as:
|
|
725
|
+
count(f in flows where f.resource = "Money": f.quantity)
|
|
726
|
+
@threshold 100
|
|
727
|
+
@severity "warning"
|
|
728
|
+
|
|
729
|
+
evolution_and_versioning:
|
|
730
|
+
code: |
|
|
731
|
+
Entity "Vendor" v1.0.0 in procurement
|
|
732
|
+
|
|
733
|
+
Entity "VendorV2" v2.0.0
|
|
734
|
+
@replaces "Vendor" v1.0.0
|
|
735
|
+
@changes ["added credit_limit", "added payment_terms"]
|
|
736
|
+
in procurement
|
|
737
|
+
|
|
738
|
+
ConceptChange "Vendor_v2_migration"
|
|
739
|
+
@from_version v1.0.0
|
|
740
|
+
@to_version v2.0.0
|
|
741
|
+
@migration_policy mandatory
|
|
742
|
+
@breaking_change true
|
|
743
|
+
|
|
744
|
+
complex_policy:
|
|
745
|
+
code: |
|
|
746
|
+
Policy payment_limits per Constraint Obligation priority 10
|
|
747
|
+
@rationale "Prevent excessive single payments"
|
|
748
|
+
@tags ["compliance", "finance"]
|
|
749
|
+
v1.0.0
|
|
750
|
+
as: forall f in flows:
|
|
751
|
+
(f.resource = "Money" and f.quantity <= 100000 "USD")
|
|
752
|
+
or f.resource != "Money"
|
|
753
|
+
|
|
754
|
+
relation_example:
|
|
755
|
+
code: |
|
|
756
|
+
Entity "Buyer"
|
|
757
|
+
Entity "Seller"
|
|
758
|
+
Resource "Goods" units
|
|
759
|
+
Role "Purchaser"
|
|
760
|
+
Role "Vendor"
|
|
761
|
+
Flow "Goods" from "Seller" to "Buyer" quantity 10
|
|
762
|
+
|
|
763
|
+
Relation "Purchase"
|
|
764
|
+
subject: "Purchaser"
|
|
765
|
+
predicate: "buys from"
|
|
766
|
+
object: "Vendor"
|
|
767
|
+
via: flow "Goods"
|
|
768
|
+
|
|
769
|
+
unit_conversion:
|
|
770
|
+
code: |
|
|
771
|
+
Dimension "Currency"
|
|
772
|
+
Unit "USD" of "Currency" factor 1 base "USD"
|
|
773
|
+
Unit "EUR" of "Currency" factor 1.07 base "USD"
|
|
774
|
+
|
|
775
|
+
Resource "Payment" USD in finance
|
|
776
|
+
|
|
777
|
+
Policy currency_normalization as:
|
|
778
|
+
sum(f in flows where f.resource = "Payment": f.quantity as "USD") < 1000000
|
|
779
|
+
|
|
780
|
+
---
|
|
781
|
+
cli_commands:
|
|
782
|
+
validate:
|
|
783
|
+
usage: "sea validate [--format json|human|lsp] <file.sea>"
|
|
784
|
+
purpose: "Validate SEA file and report errors"
|
|
785
|
+
json_output: "sea validate --format json model.sea"
|
|
786
|
+
note: "JSON format outputs structured error/warning objects"
|
|
787
|
+
|
|
788
|
+
parse:
|
|
789
|
+
usage: "sea parse [--format human|json] <file.sea>"
|
|
790
|
+
purpose: "Parse and output graph summary or structure"
|
|
791
|
+
json_output: "sea parse --format json model.sea"
|
|
792
|
+
note: "JSON format outputs full parsed graph structure"
|
|
793
|
+
|
|
794
|
+
project:
|
|
795
|
+
purpose: "Project/export graph to external formats"
|
|
796
|
+
formats:
|
|
797
|
+
calm:
|
|
798
|
+
command: "sea project --format calm model.sea output.json"
|
|
799
|
+
output: "FINOS CALM JSON"
|
|
800
|
+
note: "Architecture-as-code format, outputs JSON"
|
|
801
|
+
rdf:
|
|
802
|
+
command: "sea project --format rdf model.sea output.ttl"
|
|
803
|
+
output: "RDF/Turtle (or RDF/XML with .rdf extension)"
|
|
804
|
+
protobuf:
|
|
805
|
+
command: "sea project --format protobuf model.sea output.proto"
|
|
806
|
+
output: "Protocol Buffer .proto file"
|
|
807
|
+
|
|
808
|
+
project_protobuf:
|
|
809
|
+
basic: "sea project --format protobuf model.sea output.proto"
|
|
810
|
+
with_services: "sea project --format protobuf --include-services model.sea api.proto"
|
|
811
|
+
multi_file: "sea project --format protobuf --multi-file --output-dir ./proto model.sea"
|
|
812
|
+
with_package: "sea project --format protobuf --package com.example model.sea output.proto"
|
|
813
|
+
with_options: "sea project --format protobuf --option java_package=com.example output.proto"
|
|
814
|
+
compatibility: "sea project --format protobuf --compatibility additive --against ./previous output.proto"
|
|
815
|
+
buf_lint: "sea project --format protobuf --buf-lint model.sea output.proto"
|
|
816
|
+
buf_breaking: "sea project --format protobuf --buf-breaking --against ./previous model.sea"
|
|
817
|
+
|
|
818
|
+
import:
|
|
819
|
+
purpose: "Import from external formats"
|
|
820
|
+
formats:
|
|
821
|
+
calm: "sea import --format calm input.json > model.sea"
|
|
822
|
+
sbvr: "sea import --format sbvr vocabulary.xmi > model.sea"
|
|
823
|
+
|
|
824
|
+
normalize:
|
|
825
|
+
usage: "sea normalize [--check-equiv OTHER_EXPR] [--json] <expression>"
|
|
826
|
+
purpose: "Normalize expressions and check equivalence"
|
|
827
|
+
examples:
|
|
828
|
+
basic: "sea normalize 'b AND a'"
|
|
829
|
+
check: "sea normalize 'a AND b' --check-equiv 'b AND a'"
|
|
830
|
+
json: "sea normalize 'true AND x' --json"
|
|
831
|
+
json_output_summary:
|
|
832
|
+
note: "Multiple commands support JSON output for tooling integration"
|
|
833
|
+
commands:
|
|
834
|
+
validate: "--format json outputs validation results as JSON"
|
|
835
|
+
parse: "--format json outputs parsed graph structure as JSON"
|
|
836
|
+
project_calm: "CALM export is inherently JSON format"
|
|
837
|
+
programmatic:
|
|
838
|
+
rust: "serde_json::to_string(&graph)"
|
|
839
|
+
python: "graph.export_calm() returns JSON string"
|
|
840
|
+
typescript: "graph.exportCalm() returns JSON string"
|
|
841
|
+
wasm: "graph.toJson() returns JSON object"
|
|
842
|
+
|
|
843
|
+
explain:
|
|
844
|
+
usage: "sea explain <error-code>"
|
|
845
|
+
purpose: "Get detailed info about error codes"
|
|
846
|
+
|
|
847
|
+
validate_kg:
|
|
848
|
+
usage: "sea validate-kg <file.ttl|file.rdf>"
|
|
849
|
+
purpose: "Validate RDF/Turtle or RDF/XML against SHACL shapes"
|
|
850
|
+
requires: "Build with --features cli,shacl"
|
|
851
|
+
note: "Validates KG structure conforms to SEA SHACL shapes"
|
|
852
|
+
|
|
853
|
+
fmt:
|
|
854
|
+
usage: "sea fmt <file.sea> [--out <output.sea>] [--check]"
|
|
855
|
+
purpose: "Format SEA source code with consistent whitespace, indentation, and styling"
|
|
856
|
+
status: "Fully implemented"
|
|
857
|
+
features:
|
|
858
|
+
- "Supports 14 declaration types (Entity, Resource, Flow, etc.)"
|
|
859
|
+
- "Indentation and spacing standardization"
|
|
860
|
+
- "Comment preservation (file headers)"
|
|
861
|
+
- "Sorted imports"
|
|
862
|
+
- "--check flag for CI validation (returns non-zero if changes needed)"
|
|
863
|
+
rust_api:
|
|
864
|
+
format: "domainforge_core::formatter::format(source, config) -> Result<String, FormatError>"
|
|
865
|
+
config: "FormatConfig { indent_style: IndentStyle, indent_size: usize }"
|
|
866
|
+
python_api:
|
|
867
|
+
format: "domainforge.format_source(source: str) -> str"
|
|
868
|
+
check: "domainforge.check_format(source: str) -> bool"
|
|
869
|
+
typescript_api:
|
|
870
|
+
format: "formatSource(source: string): string"
|
|
871
|
+
check: "checkFormat(source: string): boolean"
|
|
872
|
+
wasm_api:
|
|
873
|
+
format: "formatSource(source: string): string"
|
|
874
|
+
check: "checkFormat(source: string): boolean"
|
|
875
|
+
|
|
876
|
+
---
|
|
877
|
+
feature_flags:
|
|
878
|
+
build:
|
|
879
|
+
python: "cargo build --features python"
|
|
880
|
+
typescript: "cargo build --features typescript"
|
|
881
|
+
wasm: "cargo build --features wasm"
|
|
882
|
+
cli: "cargo build --features cli"
|
|
883
|
+
shacl: "cargo build --features cli,shacl"
|
|
884
|
+
notes:
|
|
885
|
+
shacl: "Required for validate-kg command and RDF/XML import"
|
|
886
|
+
lol_alloc: "Used automatically for WASM builds to reduce binary size"
|
|
887
|
+
|
|
888
|
+
---
|
|
889
|
+
key_files:
|
|
890
|
+
grammar: "domainforge-core/grammar/sea.pest"
|
|
891
|
+
primitives: "domainforge-core/src/primitives/"
|
|
892
|
+
graph: "domainforge-core/src/graph/mod.rs"
|
|
893
|
+
policy: "domainforge-core/src/policy/expression.rs"
|
|
894
|
+
calm: "domainforge-core/src/calm/"
|
|
895
|
+
kg: "domainforge-core/src/kg.rs"
|
|
896
|
+
protobuf: "domainforge-core/src/projection/protobuf.rs"
|
|
897
|
+
buf_integration: "domainforge-core/src/projection/buf.rs"
|
|
898
|
+
python_bindings: "domainforge-core/src/python/"
|
|
899
|
+
typescript_bindings: "domainforge-core/src/typescript/"
|
|
900
|
+
wasm_bindings: "domainforge-core/src/wasm/"
|
|
901
|
+
tests:
|
|
902
|
+
rust: "domainforge-core/tests/"
|
|
903
|
+
python: "tests/"
|
|
904
|
+
typescript: "typescript-tests/"
|
|
905
|
+
protobuf: "domainforge-core/tests/protobuf_projection_tests.rs"
|
|
906
|
+
examples: "examples/, domainforge-core/examples/"
|
|
907
|
+
stdlib: "domainforge-core/std/"
|
|
908
|
+
documentation:
|
|
909
|
+
how_tos: "docs/how-tos/"
|
|
910
|
+
reference: "docs/reference/"
|
|
911
|
+
specs: "docs/specs/"
|
|
912
|
+
protobuf_api: "docs/reference/protobuf-api.md"
|
|
913
|
+
protobuf_howto: "docs/how-tos/export-to-protobuf.md"
|