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
package/justfile
ADDED
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
default := "ai-validate"
|
|
2
|
+
cargo := `if command -v cargo >/dev/null 2>&1; then printf 'cargo'; elif command -v devbox >/dev/null 2>&1; then printf 'devbox run -- cargo'; else printf 'cargo'; fi`
|
|
3
|
+
|
|
4
|
+
# Run all validation checks required for CI and AI agents
|
|
5
|
+
ai-validate:
|
|
6
|
+
{{cargo}} test -p domainforge-core --features cli
|
|
7
|
+
|
|
8
|
+
# Test tasks - run per-language test suites
|
|
9
|
+
rust-test:
|
|
10
|
+
@echo "Running Rust tests..."
|
|
11
|
+
{{cargo}} test -p domainforge-core --features cli
|
|
12
|
+
|
|
13
|
+
# Test all CLI commands
|
|
14
|
+
cli-test:
|
|
15
|
+
{{cargo}} test -p domainforge-core --test cli_tests --features cli
|
|
16
|
+
|
|
17
|
+
# Run CLI validation examples
|
|
18
|
+
cli-validate:
|
|
19
|
+
cd domainforge-core/examples/cli && ./validate_example.sh
|
|
20
|
+
|
|
21
|
+
# Run CLI import/export workflow
|
|
22
|
+
cli-workflow:
|
|
23
|
+
cd domainforge-core/examples/cli && ./import_export_workflow.sh
|
|
24
|
+
|
|
25
|
+
build-rust-tests:
|
|
26
|
+
@echo "Build Rust tests without running them (to prepare debug binaries)"
|
|
27
|
+
{{cargo}} test -p domainforge-core --features cli --no-run
|
|
28
|
+
|
|
29
|
+
python-test:
|
|
30
|
+
@echo "Running Python tests..."
|
|
31
|
+
# Prefer the virtualenv python if it exists to avoid system site-packages and PEP 668 restrictions
|
|
32
|
+
if [ -x ".venv/bin/python" ]; then \
|
|
33
|
+
.venv/bin/python -m pytest -q; \
|
|
34
|
+
else \
|
|
35
|
+
python3 -m pytest -q || python -m pytest -q; \
|
|
36
|
+
fi
|
|
37
|
+
|
|
38
|
+
ts-test:
|
|
39
|
+
@echo "Running TypeScript tests (Vitest)..."
|
|
40
|
+
if command -v bun >/dev/null 2>&1; then \
|
|
41
|
+
bun test; \
|
|
42
|
+
else \
|
|
43
|
+
npm run test:node --silent; \
|
|
44
|
+
fi
|
|
45
|
+
|
|
46
|
+
all-tests:
|
|
47
|
+
@echo "Running all tests (Rust, Python, TypeScript)..."
|
|
48
|
+
just rust-test
|
|
49
|
+
just python-test
|
|
50
|
+
just ts-test
|
|
51
|
+
prepare-rust-debug:
|
|
52
|
+
@echo "Prepare a Rust test binary for codelldb debugging (build & symlink)"
|
|
53
|
+
if [ -z "${RUST_TEST_NAME-}" ]; then RUST_TEST_NAME="entity_tests"; fi
|
|
54
|
+
echo "Using RUST_TEST_NAME=${RUST_TEST_NAME}"
|
|
55
|
+
./scripts/prepare_rust_debug.sh "${RUST_TEST_NAME}"
|
|
56
|
+
clear-rust-debug:
|
|
57
|
+
@echo "Clear symlink created for rust debug binary"
|
|
58
|
+
./scripts/clear_debug_test.sh || true
|
|
59
|
+
python-setup:
|
|
60
|
+
@echo "Setting up Python virtualenv and installing dev dependencies..."
|
|
61
|
+
rm -rf .venv
|
|
62
|
+
python -m venv .venv || python3 -m venv .venv || (echo "Python 3 is required; please install python."; exit 1)
|
|
63
|
+
.venv/bin/python -m pip install --upgrade pip
|
|
64
|
+
# Install runtime requirements if present
|
|
65
|
+
if [ -f requirements.txt ]; then .venv/bin/python -m pip install -r requirements.txt || true; fi
|
|
66
|
+
# Install development requirements if present
|
|
67
|
+
if [ -f requirements-dev.txt ]; then .venv/bin/python -m pip install -r requirements-dev.txt || true; fi
|
|
68
|
+
# Install dev/test tooling
|
|
69
|
+
.venv/bin/python -m pip install -U pytest maturin
|
|
70
|
+
# Build & install the Python bindings into the venv.
|
|
71
|
+
# pyproject.toml lives in domainforge-python/ and declares manifest-path, features,
|
|
72
|
+
# and module-name under [tool.maturin]. Do NOT pass --manifest-path on the CLI:
|
|
73
|
+
# maturin resolves the pyproject from the manifest dir when it's given, which makes
|
|
74
|
+
# it ignore [tool.maturin] (features/module-name) and fall back to cffi. Invoke from
|
|
75
|
+
# domainforge-python/ so maturin reads the pyproject next to it.
|
|
76
|
+
cd domainforge-python && ../.venv/bin/maturin develop --release || (cd domainforge-python && ../.venv/bin/maturin develop)
|
|
77
|
+
|
|
78
|
+
install-just:
|
|
79
|
+
@echo "Checking if 'just' is already installed..."
|
|
80
|
+
if command -v just >/dev/null 2>&1; then \
|
|
81
|
+
echo "just is already installed: $(just --version)"; exit 0; \
|
|
82
|
+
fi
|
|
83
|
+
@echo "Attempting to install 'just' via OS package manager..."
|
|
84
|
+
if command -v winget >/dev/null 2>&1; then \
|
|
85
|
+
echo "Installing via winget..."; winget install --id Just -e || true; \
|
|
86
|
+
fi;
|
|
87
|
+
if command -v scoop >/dev/null 2>&1; then \
|
|
88
|
+
echo "Installing via scoop..."; scoop install just || true; \
|
|
89
|
+
fi;
|
|
90
|
+
if command -v brew >/dev/null 2>&1; then \
|
|
91
|
+
brew install just || true; \
|
|
92
|
+
fi;
|
|
93
|
+
if command -v apt-get >/dev/null 2>&1; then \
|
|
94
|
+
sudo apt-get update && sudo apt-get install -y just || true; \
|
|
95
|
+
fi;
|
|
96
|
+
if command -v dnf >/dev/null 2>&1; then \
|
|
97
|
+
sudo dnf install -y just || true; \
|
|
98
|
+
fi;
|
|
99
|
+
if command -v pacman >/dev/null 2>&1; then \
|
|
100
|
+
sudo pacman -S --noconfirm just || true; \
|
|
101
|
+
fi;
|
|
102
|
+
@echo "Fallback: attempt to install via cargo..."
|
|
103
|
+
cargo install just --locked || (echo "cargo install just failed; please install manually using your OS package manager (brew, apt, dnf, pacman) or visit https://github.com/casey/just#installation"; exit 1)
|
|
104
|
+
|
|
105
|
+
setup:
|
|
106
|
+
@echo "Installing TypeScript dependencies and Python dev dependencies..."
|
|
107
|
+
npm ci || npm install
|
|
108
|
+
# Install Git hooks if lefthook is available from local dependencies or PATH
|
|
109
|
+
npx --yes lefthook install || true
|
|
110
|
+
# Prepare a Python virtualenv and install dev dependencies if possible
|
|
111
|
+
just python-setup || true
|
|
112
|
+
|
|
113
|
+
python-clean:
|
|
114
|
+
@echo "Removing Python virtual environment (.venv)"
|
|
115
|
+
if [ -d .venv ]; then rm -rf .venv || true; fi
|
|
116
|
+
|
|
117
|
+
audit:
|
|
118
|
+
cargo audit
|
|
119
|
+
cargo deny check
|
|
120
|
+
|
|
121
|
+
smoke-test-npm:
|
|
122
|
+
@echo "Running npm pack smoke test..."
|
|
123
|
+
@output=$(cd domainforge-typescript && npm pack --dry-run 2>&1); \
|
|
124
|
+
echo "$output"; \
|
|
125
|
+
echo "$output" | grep -q "index\.js" || { echo "ERROR: index.js missing from pack"; exit 1; }; \
|
|
126
|
+
echo "$output" | grep -q "index\.d\.ts" || { echo "ERROR: index.d.ts missing from pack"; exit 1; }; \
|
|
127
|
+
echo "$output" | grep -q "domainforge-core.*\.node" || { echo "ERROR: native .node binary missing from pack"; exit 1; }; \
|
|
128
|
+
echo "$output" | grep -q "README\.md" || { echo "ERROR: README.md missing from pack"; exit 1; }; \
|
|
129
|
+
echo "$output" | grep -q "LICENSE" || { echo "ERROR: LICENSE missing from pack"; exit 1; }; \
|
|
130
|
+
echo "npm pack smoke test passed"
|
|
131
|
+
|
|
132
|
+
smoke-test-wasm:
|
|
133
|
+
@echo "Running WASM pkg smoke test..."
|
|
134
|
+
test -d target/wasm-pkg || { echo "ERROR: WASM pkg not built. Run scripts/build-wasm.sh first"; exit 1; }
|
|
135
|
+
for f in domainforge_core.js domainforge_core.d.ts domainforge_core_bg.wasm domainforge_core_bg.wasm.d.ts package.json; do \
|
|
136
|
+
test -f target/wasm-pkg/$f || { echo "ERROR: missing $f"; exit 1; }; \
|
|
137
|
+
done
|
|
138
|
+
@echo "WASM smoke test passed"
|
|
139
|
+
|
|
140
|
+
enterprise-verify:
|
|
141
|
+
#!/usr/bin/env bash
|
|
142
|
+
set -euo pipefail
|
|
143
|
+
echo "=== Enterprise Release Verification ==="
|
|
144
|
+
echo "1/6: Format check..."
|
|
145
|
+
cargo fmt --all --check
|
|
146
|
+
echo "2/6: Clippy..."
|
|
147
|
+
cargo clippy --workspace --all-targets --all-features -- -D warnings
|
|
148
|
+
echo "3/6: Rust tests..."
|
|
149
|
+
cargo test --workspace --all-targets --all-features
|
|
150
|
+
echo "4/6: Doctests..."
|
|
151
|
+
cargo test -p domainforge-core --features cli --doc
|
|
152
|
+
echo "5/6: All language tests..."
|
|
153
|
+
just all-tests
|
|
154
|
+
echo "6/6: Audit..."
|
|
155
|
+
just audit
|
|
156
|
+
echo "=== Enterprise Verification PASSED ==="
|
|
157
|
+
|
|
158
|
+
# ============================================================================
|
|
159
|
+
# CI-specific recipes (used by GitHub Actions)
|
|
160
|
+
# ============================================================================
|
|
161
|
+
|
|
162
|
+
# Run Rust tests (CI variant)
|
|
163
|
+
ci-test-rust:
|
|
164
|
+
@echo "Running Rust tests (CI)..."
|
|
165
|
+
{{cargo}} test --verbose --workspace --features cli
|
|
166
|
+
|
|
167
|
+
# Run Python tests (CI variant)
|
|
168
|
+
ci-test-python:
|
|
169
|
+
@echo "Running Python tests (CI)..."
|
|
170
|
+
.venv/bin/python -m pytest tests/
|
|
171
|
+
|
|
172
|
+
# Run TypeScript tests (CI variant)
|
|
173
|
+
ci-test-ts:
|
|
174
|
+
@echo "Running TypeScript tests (CI)..."
|
|
175
|
+
npm test
|
|
176
|
+
|
|
177
|
+
# Verify CLI binary can execute
|
|
178
|
+
ci-verify-binary BINARY_PATH:
|
|
179
|
+
@echo "Verifying CLI binary: {{BINARY_PATH}}"
|
|
180
|
+
python3 scripts/ci_tasks.py verify-cli --binary "{{BINARY_PATH}}"
|
|
181
|
+
|
|
182
|
+
# Check CLI binary size
|
|
183
|
+
ci-check-binary-size BINARY_PATH MAX_BYTES="52428800":
|
|
184
|
+
@echo "Checking binary size: {{BINARY_PATH}}"
|
|
185
|
+
python3 scripts/ci_tasks.py check-size --file "{{BINARY_PATH}}" --max-bytes {{MAX_BYTES}} --label "CLI binary"
|
|
186
|
+
|
|
187
|
+
# Package CLI binary for release
|
|
188
|
+
ci-package-binary BINARY_PATH OUTPUT_PATH:
|
|
189
|
+
@echo "Packaging binary: {{BINARY_PATH}} -> {{OUTPUT_PATH}}"
|
|
190
|
+
python3 scripts/ci_tasks.py package --input "{{BINARY_PATH}}" --output "{{OUTPUT_PATH}}"
|
|
191
|
+
|
|
192
|
+
# Verify packaged archive
|
|
193
|
+
ci-verify-package ARCHIVE_PATH BINARY_NAME="domainforge":
|
|
194
|
+
@echo "Verifying packaged archive: {{ARCHIVE_PATH}}"
|
|
195
|
+
python3 scripts/ci_tasks.py unpack-verify --archive "{{ARCHIVE_PATH}}" --binary-name "{{BINARY_NAME}}"
|
|
196
|
+
|
|
197
|
+
# Check packaged artifact size
|
|
198
|
+
ci-check-package-size ARCHIVE_PATH MAX_BYTES="73400320":
|
|
199
|
+
@echo "Checking package size: {{ARCHIVE_PATH}}"
|
|
200
|
+
python3 scripts/ci_tasks.py check-size --file "{{ARCHIVE_PATH}}" --max-bytes {{MAX_BYTES}} --label "Packaged artifact"
|
package/lefthook.yml
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
pre-commit:
|
|
2
|
+
commands:
|
|
3
|
+
cargo-fmt:
|
|
4
|
+
glob: "**/*.rs"
|
|
5
|
+
run: cargo fmt --all -- --check
|
|
6
|
+
cargo-clippy:
|
|
7
|
+
glob: "**/*.rs"
|
|
8
|
+
run: cargo clippy --all-targets --all-features -- -D warnings
|
|
9
|
+
|
|
10
|
+
commit-msg:
|
|
11
|
+
commands:
|
|
12
|
+
commitlint:
|
|
13
|
+
run: ./scripts/run_commitlint.sh {1}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// validate_native_exports.js
|
|
2
|
+
// Helper to verify native binding exports and throw a descriptive error when missing.
|
|
3
|
+
"use strict";
|
|
4
|
+
|
|
5
|
+
function validateNativeExports(nativeBinding, requiredExports) {
|
|
6
|
+
const missing = requiredExports.filter((name) => !nativeBinding || !Object.prototype.hasOwnProperty.call(nativeBinding, name));
|
|
7
|
+
if (missing.length > 0) {
|
|
8
|
+
throw new Error(`Native binding missing required export(s): ${missing.join(', ')}. Ensure the native addon was built and exposes these symbol(s).`);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
module.exports = { validateNativeExports };
|
package/package.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "domainforge",
|
|
3
|
+
"version": "0.13.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"workspaces": [
|
|
6
|
+
"domainforge-typescript"
|
|
7
|
+
],
|
|
8
|
+
"scripts": {
|
|
9
|
+
"test": "bun vitest run",
|
|
10
|
+
"test:node": "npx vitest run",
|
|
11
|
+
"test:types": "tsc --noEmit --strict --skipLibCheck false -p tsconfig.json"
|
|
12
|
+
},
|
|
13
|
+
"devDependencies": {
|
|
14
|
+
"@commitlint/cli": "^21.0.2",
|
|
15
|
+
"@commitlint/config-conventional": "^21.0.2",
|
|
16
|
+
"lefthook": "^2.1.9"
|
|
17
|
+
},
|
|
18
|
+
"engines": {
|
|
19
|
+
"node": ">= 18",
|
|
20
|
+
"bun": ">= 1.1.0"
|
|
21
|
+
}
|
|
22
|
+
}
|
package/pytest.ini
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
import textwrap
|
|
3
|
+
|
|
4
|
+
import domainforge
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def test_registry_discover_and_resolve(tmp_path):
|
|
8
|
+
# Skip this test if runtime package isn't built with python FFI enabled
|
|
9
|
+
if not hasattr(domainforge, "NamespaceRegistry"):
|
|
10
|
+
return
|
|
11
|
+
base = tmp_path
|
|
12
|
+
domains = base / "domains" / "logistics"
|
|
13
|
+
domains.mkdir(parents=True)
|
|
14
|
+
file_path = domains / "warehouse.sea"
|
|
15
|
+
file_path.write_text('Entity "Warehouse"')
|
|
16
|
+
|
|
17
|
+
registry_path = base / ".sea-registry.toml"
|
|
18
|
+
registry_content = textwrap.dedent("""\
|
|
19
|
+
version = 1
|
|
20
|
+
[[namespaces]]
|
|
21
|
+
namespace = "logistics"
|
|
22
|
+
patterns = ["domains/logistics/**/*.sea"]
|
|
23
|
+
""")
|
|
24
|
+
registry_path.write_text(registry_content)
|
|
25
|
+
|
|
26
|
+
reg = domainforge.NamespaceRegistry.from_file(str(registry_path))
|
|
27
|
+
assert reg is not None
|
|
28
|
+
files = reg.resolve_files()
|
|
29
|
+
assert len(files) == 1
|
|
30
|
+
assert files[0].path.endswith("warehouse.sea")
|
|
31
|
+
assert files[0].namespace == "logistics"
|
|
32
|
+
# fail_on_ambiguity for trivial case should still succeed (no ambiguity)
|
|
33
|
+
files = reg.resolve_files(False)
|
|
34
|
+
assert len(files) == 1
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def test_registry_precedence_long_and_tie(tmp_path):
|
|
38
|
+
# Skip if not installed with FFI bindings
|
|
39
|
+
if not hasattr(domainforge, "NamespaceRegistry"):
|
|
40
|
+
return
|
|
41
|
+
base = tmp_path
|
|
42
|
+
domains = base / "domains" / "logistics"
|
|
43
|
+
domains.mkdir(parents=True)
|
|
44
|
+
file_path = domains / "warehouse.sea"
|
|
45
|
+
file_path.write_text('Entity "Warehouse"')
|
|
46
|
+
|
|
47
|
+
# long prefix precedence
|
|
48
|
+
registry_path = base / ".sea-registry.toml"
|
|
49
|
+
registry_content = (
|
|
50
|
+
"version = 1\n"
|
|
51
|
+
'default_namespace = "default"\n\n'
|
|
52
|
+
'[[namespaces]]\nnamespace = "short"\npatterns = ["domains/**/*.sea"]\n\n'
|
|
53
|
+
'[[namespaces]]\nnamespace = "long"\npatterns = ["domains/logistics/**/*.sea"]\n'
|
|
54
|
+
)
|
|
55
|
+
registry_path.write_text(registry_content)
|
|
56
|
+
reg = domainforge.NamespaceRegistry.from_file(str(registry_path))
|
|
57
|
+
assert reg.namespace_for(str(file_path)) == "long"
|
|
58
|
+
|
|
59
|
+
# alphabetical tie-breaker
|
|
60
|
+
registry_content = (
|
|
61
|
+
"version = 1\n"
|
|
62
|
+
'default_namespace = "default"\n\n'
|
|
63
|
+
'[[namespaces]]\nnamespace = "logistics"\npatterns = ["domains/*/warehouse.sea"]\n\n'
|
|
64
|
+
'[[namespaces]]\nnamespace = "finance"\npatterns = ["domains/*/warehouse.sea"]\n'
|
|
65
|
+
)
|
|
66
|
+
registry_path.write_text(registry_content)
|
|
67
|
+
reg = domainforge.NamespaceRegistry.from_file(str(registry_path))
|
|
68
|
+
assert reg.namespace_for(str(file_path)) == "finance"
|
|
69
|
+
|
|
70
|
+
# When asking to fail on ambiguity, an exception should be raised
|
|
71
|
+
with pytest.raises(Exception):
|
|
72
|
+
reg.namespace_for(str(file_path), True)
|
|
73
|
+
# resolve_files should raise when fail_on_ambiguity True
|
|
74
|
+
with pytest.raises(Exception):
|
|
75
|
+
reg.resolve_files(True)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import domainforge
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def test_dimension_parse_case_insensitive():
|
|
5
|
+
if not hasattr(domainforge, "Dimension"):
|
|
6
|
+
return
|
|
7
|
+
d1 = domainforge.Dimension.parse("currency")
|
|
8
|
+
d2 = domainforge.Dimension.parse("Currency")
|
|
9
|
+
assert str(d1) == str(d2)
|
|
10
|
+
assert str(d1) == "Currency"
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def test_unit_constructor_and_getters():
|
|
14
|
+
if not hasattr(domainforge, "Unit"):
|
|
15
|
+
return
|
|
16
|
+
u = domainforge.Unit("USD", "US Dollar", "Currency", 1.0, "USD")
|
|
17
|
+
assert u.symbol == "USD"
|
|
18
|
+
assert u.base_unit == "USD"
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
|
|
3
|
+
"include-component-in-tag": true,
|
|
4
|
+
"tag-separator": "-",
|
|
5
|
+
"component-no-space": true,
|
|
6
|
+
"pull-request-title-pattern": "chore: release ${component} ${version}",
|
|
7
|
+
"plugins": [
|
|
8
|
+
{
|
|
9
|
+
"type": "linked-versions",
|
|
10
|
+
"groupName": "domainforge",
|
|
11
|
+
"components": ["domainforge-core", "domainforge", "domainforge-typescript"]
|
|
12
|
+
}
|
|
13
|
+
],
|
|
14
|
+
"changelog-sections": [
|
|
15
|
+
{ "type": "feat", "section": "Features" },
|
|
16
|
+
{ "type": "fix", "section": "Bug Fixes" },
|
|
17
|
+
{ "type": "perf", "section": "Performance" },
|
|
18
|
+
{ "type": "deps", "section": "Dependencies" },
|
|
19
|
+
{ "type": "revert", "section": "Reverts" },
|
|
20
|
+
{ "type": "docs", "section": "Documentation", "hidden": true },
|
|
21
|
+
{ "type": "refactor", "section": "Refactoring", "hidden": true },
|
|
22
|
+
{ "type": "test", "section": "Tests", "hidden": true },
|
|
23
|
+
{ "type": "chore", "section": "Miscellaneous", "hidden": true },
|
|
24
|
+
{ "type": "build", "section": "Build System", "hidden": true },
|
|
25
|
+
{ "type": "ci", "section": "Continuous Integration", "hidden": true }
|
|
26
|
+
],
|
|
27
|
+
"packages": {
|
|
28
|
+
"domainforge-core": {
|
|
29
|
+
"release-type": "rust",
|
|
30
|
+
"package-name": "domainforge-core",
|
|
31
|
+
"component": "domainforge-core",
|
|
32
|
+
"changelog-path": "CHANGELOG.md"
|
|
33
|
+
},
|
|
34
|
+
"domainforge-python": {
|
|
35
|
+
"release-type": "python",
|
|
36
|
+
"package-name": "domainforge",
|
|
37
|
+
"component": "domainforge",
|
|
38
|
+
"changelog-path": "CHANGELOG-python.md",
|
|
39
|
+
"extra-files": ["pyproject.toml"]
|
|
40
|
+
},
|
|
41
|
+
"domainforge-typescript": {
|
|
42
|
+
"release-type": "node",
|
|
43
|
+
"package-name": "@godspeedai/domainforge",
|
|
44
|
+
"component": "domainforge-typescript",
|
|
45
|
+
"changelog-path": "CHANGELOG-typescript.md",
|
|
46
|
+
"extra-files": ["package.json"]
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
package/requirements.txt
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"title": "SEA DSL Abstract Syntax Tree",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"version": { "type": "string", "pattern": "^\\d+\\.\\d+\\.\\d+$" },
|
|
8
|
+
"namespace": { "type": "string" },
|
|
9
|
+
"imports": {
|
|
10
|
+
"type": "array",
|
|
11
|
+
"items": { "$ref": "#/definitions/Import" }
|
|
12
|
+
},
|
|
13
|
+
"entities": {
|
|
14
|
+
"type": "array",
|
|
15
|
+
"items": { "$ref": "#/definitions/Entity" }
|
|
16
|
+
},
|
|
17
|
+
"resources": {
|
|
18
|
+
"type": "array",
|
|
19
|
+
"items": { "$ref": "#/definitions/Resource" }
|
|
20
|
+
},
|
|
21
|
+
"flows": {
|
|
22
|
+
"type": "array",
|
|
23
|
+
"items": { "$ref": "#/definitions/Flow" }
|
|
24
|
+
},
|
|
25
|
+
"policies": {
|
|
26
|
+
"type": "array",
|
|
27
|
+
"items": { "$ref": "#/definitions/Policy" }
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"definitions": {
|
|
31
|
+
"Import": {
|
|
32
|
+
"type": "object",
|
|
33
|
+
"properties": {
|
|
34
|
+
"path": { "type": "string" }
|
|
35
|
+
},
|
|
36
|
+
"required": ["path"]
|
|
37
|
+
},
|
|
38
|
+
"Entity": {
|
|
39
|
+
"type": "object",
|
|
40
|
+
"properties": {
|
|
41
|
+
"name": { "type": "string" }
|
|
42
|
+
},
|
|
43
|
+
"required": ["name"]
|
|
44
|
+
},
|
|
45
|
+
"Resource": {
|
|
46
|
+
"type": "object",
|
|
47
|
+
"properties": {
|
|
48
|
+
"name": { "type": "string" },
|
|
49
|
+
"unit": { "type": "string" }
|
|
50
|
+
},
|
|
51
|
+
"required": ["name", "unit"]
|
|
52
|
+
},
|
|
53
|
+
"Flow": {
|
|
54
|
+
"type": "object",
|
|
55
|
+
"properties": {
|
|
56
|
+
"resource": { "type": "string" },
|
|
57
|
+
"from": { "type": "string" },
|
|
58
|
+
"to": { "type": "string" },
|
|
59
|
+
"quantity": { "type": "number" }
|
|
60
|
+
},
|
|
61
|
+
"required": ["resource", "from", "to", "quantity"]
|
|
62
|
+
},
|
|
63
|
+
"Policy": {
|
|
64
|
+
"type": "object",
|
|
65
|
+
"properties": {
|
|
66
|
+
"description": { "type": "string" },
|
|
67
|
+
"expression": { "type": "string" }
|
|
68
|
+
},
|
|
69
|
+
"required": ["description", "expression"]
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|