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,115 @@
|
|
|
1
|
+
# Run Cross-Language Tests
|
|
2
|
+
|
|
3
|
+
Goal: Execute and maintain Rust, Python, and TypeScript tests to ensure the DSL, bindings, and projections stay in sync.
|
|
4
|
+
|
|
5
|
+
## Prerequisites
|
|
6
|
+
|
|
7
|
+
- Rust toolchain (with `cargo`), Node.js 20+, and Python 3.10+ available on your machine.
|
|
8
|
+
- Install project dependencies:
|
|
9
|
+
- `npm ci` to install JS deps.
|
|
10
|
+
- `just python-setup` to build Python bindings in a virtualenv.
|
|
11
|
+
- Optional: install `just` (`cargo install just --locked`) to use the provided recipes.
|
|
12
|
+
|
|
13
|
+
## Steps (be concise)
|
|
14
|
+
|
|
15
|
+
1. **Run all suites sequentially**
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
just all-tests
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
- Executes Rust (`cargo test -p domainforge-core --features cli`), Python (`pytest`), and TypeScript (Vitest) in order.
|
|
22
|
+
- Fails fast on the first failing command; rerun individual suites for debugging.
|
|
23
|
+
|
|
24
|
+
2. **Run Rust tests only**
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
just rust-test
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
- Includes CLI tests and parser/projection coverage under `domainforge-core/tests/`.
|
|
31
|
+
- Use `cargo test -p domainforge-core --features "cli shacl"` if you need SHACL validation paths.
|
|
32
|
+
|
|
33
|
+
3. **Run Python tests only**
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
just python-test
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
- Rebuilds bindings via `maturin develop` in the virtualenv if needed.
|
|
40
|
+
- To focus on a single file: `.venv/bin/pytest tests/test_golden_payment_flow.py -k payment`.
|
|
41
|
+
|
|
42
|
+
4. **Run TypeScript tests only**
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
just ts-test
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
- Invokes Vitest using the compiled napi module from `npm run build`.
|
|
49
|
+
- Filter tests: `npm test -- --runInBand golden-payment-flow.test.ts`.
|
|
50
|
+
|
|
51
|
+
5. **Add a cross-language golden scenario**
|
|
52
|
+
|
|
53
|
+
- Define the scenario in Rust tests under `domainforge-core/tests/` (e.g., roles/relations payment flow).
|
|
54
|
+
- Mirror the scenario in `tests/` (Python) and `typescript-tests/` with equivalent assertions.
|
|
55
|
+
- Keep DSL snippets identical to catch serialization and parsing differences.
|
|
56
|
+
|
|
57
|
+
6. **Debug mismatches**
|
|
58
|
+
|
|
59
|
+
- If Python or TypeScript counts differ, log the graph contents:
|
|
60
|
+
|
|
61
|
+
```python
|
|
62
|
+
for role in graph.all_roles():
|
|
63
|
+
print(role.name, role.id)
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
```ts
|
|
67
|
+
console.log(graph.allRelations().map(r => ({ name: r.name, predicate: r.predicate })));
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
- Re-run the Rust test with `-- --nocapture` to see detailed parser output when comparing against bindings.
|
|
71
|
+
|
|
72
|
+
7. **Automate in CI**
|
|
73
|
+
|
|
74
|
+
- Use `just ci-check` locally to mimic CI (formatting, clippy, and all tests).
|
|
75
|
+
- In GitHub Actions, configure runners with Rust/Python/Node toolchains and call the same commands; set up caching for `target/`, `.venv/`, and `node_modules/` to shorten feedback loops.
|
|
76
|
+
|
|
77
|
+
## Adding Cross-Language Test Cases
|
|
78
|
+
|
|
79
|
+
- Place shared DSL fixtures under `examples/` or `tests/fixtures/` to avoid duplication.
|
|
80
|
+
- Prefer end-to-end assertions (parse → export → import) instead of unit-testing binding wrappers in isolation.
|
|
81
|
+
- Capture CALM/Turtle exports as golden files when the shape is stable; regenerate them intentionally after schema changes.
|
|
82
|
+
|
|
83
|
+
## Troubleshooting
|
|
84
|
+
|
|
85
|
+
- **Binding build failures**: Ensure `rustup default stable` and `npm run build` succeed before running tests; stale artifacts can cause symbol resolution errors.
|
|
86
|
+
- **Platform differences**: On Windows, run the Node tests in a shell that has `node-gyp` prerequisites; on macOS ARM, ensure a compatible Python version for `maturin` wheels.
|
|
87
|
+
- **Timeouts in Vitest**: Use `npm test -- --runInBand --testTimeout=60000` when running under constrained CI machines.
|
|
88
|
+
|
|
89
|
+
## Links
|
|
90
|
+
|
|
91
|
+
- Tutorials: [Python Binding Quickstart](../tutorials/python-binding-quickstart.md), [TypeScript Binding Quickstart](../tutorials/typescript-binding-quickstart.md)
|
|
92
|
+
- Reference: [CLI Commands](../reference/cli-commands.md), [Python API](../reference/python-api.md), [TypeScript API](../reference/typescript-api.md)
|
|
93
|
+
|
|
94
|
+
## Example: Payment Role Flow golden test
|
|
95
|
+
|
|
96
|
+
- DSL snippet lives in `tests/test_golden_payment_flow.py` and `typescript-tests/golden-payment-flow.test.ts`.
|
|
97
|
+
- Expectations:
|
|
98
|
+
- `role_count()` returns 2 (`Payer`, `Payee`).
|
|
99
|
+
- `relation_count()` returns 1 with predicate `pays`.
|
|
100
|
+
- Flow quantity equals 10 and uses the resource `Money`.
|
|
101
|
+
- Use this as a template for new scenarios; keep IDs stable to avoid brittle UUID comparisons.
|
|
102
|
+
|
|
103
|
+
## Reporting and Maintaining Results
|
|
104
|
+
|
|
105
|
+
- Capture failing commands with full stdout/stderr in CI artifacts to compare Rust vs binding behavior.
|
|
106
|
+
- When bumping versions (e.g., to `0.1.0`), rerun the suites and update any snapshots to reflect metadata changes.
|
|
107
|
+
- Tag tests that rely on optional features (`shacl`, `wasm`) so they can be skipped on constrained environments.
|
|
108
|
+
|
|
109
|
+
## Readiness Checklist
|
|
110
|
+
|
|
111
|
+
- [ ] Rust, Python, and TypeScript suites green locally (`just all-tests`).
|
|
112
|
+
- [ ] Golden scenarios exercised in all languages with identical DSL inputs.
|
|
113
|
+
- [ ] New APIs added to bindings accompanied by parity tests.
|
|
114
|
+
- [ ] CI workflow caches warmed for `target/`, `.venv/`, and `node_modules/`.
|
|
115
|
+
- [ ] Release workflows (`release-pypi.yml`, `release-npm.yml`, `release-crates.yml`) reference the test commands.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Troubleshoot NAPI/TypeScript Builds
|
|
2
|
+
|
|
3
|
+
Goal: fix Node.js native module (`.node`) build issues, especially PyO3 symbol leaks.
|
|
4
|
+
|
|
5
|
+
## Symptoms
|
|
6
|
+
|
|
7
|
+
- Loading `domainforge-core.*.node` fails with `undefined symbol: PyBaseObject_Type`.
|
|
8
|
+
- TypeScript tests crash when `python` feature symbols leak into the NAPI build.
|
|
9
|
+
|
|
10
|
+
## Root cause
|
|
11
|
+
|
|
12
|
+
The native binary was built with `python` features enabled or reused artifacts from a Python build, pulling PyO3 symbols into the Node module.
|
|
13
|
+
|
|
14
|
+
## Fix: Clean, isolated build
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
# Remove stale artifacts
|
|
18
|
+
cargo clean
|
|
19
|
+
cd domainforge-core && cargo clean && cd ..
|
|
20
|
+
rm -rf target domainforge-core/target
|
|
21
|
+
|
|
22
|
+
# Build TypeScript binding only
|
|
23
|
+
cd domainforge-core
|
|
24
|
+
cargo build --lib --features typescript,three_valued_logic
|
|
25
|
+
|
|
26
|
+
# Copy the correct artifact to the root package if needed (choose your platform)
|
|
27
|
+
cp target/debug/libdomainforge_core.so ../domainforge-core.linux-x64-gnu.node # Linux
|
|
28
|
+
cp target/debug/libdomainforge_core.dylib ../domainforge-core.darwin-x64.node # macOS
|
|
29
|
+
cp target\\debug\\domainforge_core.dll ..\\domainforge-core.win32-x64.node # Windows
|
|
30
|
+
|
|
31
|
+
# Verify no Py* symbols remain
|
|
32
|
+
nm -D ../domainforge-core.linux-x64-gnu.node | grep Py || echo "clean"
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Then run `npm test` to confirm the binding loads.
|
|
36
|
+
|
|
37
|
+
## Prevent future leaks
|
|
38
|
+
|
|
39
|
+
- Keep Cargo features isolated:
|
|
40
|
+
|
|
41
|
+
```toml
|
|
42
|
+
[features]
|
|
43
|
+
default = []
|
|
44
|
+
python = ["pyo3", "pythonize"]
|
|
45
|
+
typescript = ["napi", "napi-derive"]
|
|
46
|
+
three_valued_logic = []
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
- Ensure build scripts (`package.json`, `just`) do **not** enable `python` when building NAPI.
|
|
50
|
+
- If you regularly switch between Python and TypeScript builds, run `cargo clean` between them.
|
|
51
|
+
|
|
52
|
+
## See also
|
|
53
|
+
|
|
54
|
+
- [Cross-Language Binding Strategy](../explanations/cross-language-binding-strategy.md)
|
|
55
|
+
- [TypeScript API Reference](../reference/typescript-api.md)
|
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
# Use SEA Modules and Imports
|
|
2
|
+
|
|
3
|
+
This guide explains how to organize large SEA models across multiple files using imports and the namespace registry.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
SEA supports modular organization through:
|
|
8
|
+
|
|
9
|
+
- **Imports**: Reference types from other SEA files
|
|
10
|
+
- **Namespace Registry**: Map namespace prefixes to file paths
|
|
11
|
+
- **Standard Library**: Built-in types via `std:` prefix
|
|
12
|
+
|
|
13
|
+
## Prerequisites
|
|
14
|
+
|
|
15
|
+
- `sea` CLI installed
|
|
16
|
+
- A project with multiple `.sea` files
|
|
17
|
+
|
|
18
|
+
## Quick Start
|
|
19
|
+
|
|
20
|
+
### 1. Create Multiple Files
|
|
21
|
+
|
|
22
|
+
**`common/types.sea`**
|
|
23
|
+
|
|
24
|
+
```sea
|
|
25
|
+
Namespace "common"
|
|
26
|
+
|
|
27
|
+
Entity "BaseEntity" {
|
|
28
|
+
id: UUID
|
|
29
|
+
created_at: DateTime
|
|
30
|
+
updated_at: DateTime
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
**`domain/customer.sea`**
|
|
35
|
+
|
|
36
|
+
```sea
|
|
37
|
+
Namespace "domain.customer"
|
|
38
|
+
|
|
39
|
+
import "common/types.sea"
|
|
40
|
+
|
|
41
|
+
Entity "Customer" {
|
|
42
|
+
@extends "BaseEntity"
|
|
43
|
+
name: String
|
|
44
|
+
email: String
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### 2. Configure the Registry
|
|
49
|
+
|
|
50
|
+
Create `.sea-registry.toml` at your project root:
|
|
51
|
+
|
|
52
|
+
```toml
|
|
53
|
+
[namespaces]
|
|
54
|
+
common = "common/types.sea"
|
|
55
|
+
domain = "domain/index.sea"
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### 3. Use Imports
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
domainforge validate domain/customer.sea --registry .sea-registry.toml
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Import Syntax
|
|
65
|
+
|
|
66
|
+
### Relative File Import
|
|
67
|
+
|
|
68
|
+
Import all types from a file:
|
|
69
|
+
|
|
70
|
+
```sea
|
|
71
|
+
import "common/types.sea"
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Namespace Binding
|
|
75
|
+
|
|
76
|
+
Import with namespace alias:
|
|
77
|
+
|
|
78
|
+
```sea
|
|
79
|
+
import namespace core from "std/core.sea"
|
|
80
|
+
|
|
81
|
+
Entity "User" {
|
|
82
|
+
email: core.Email
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Selective Import
|
|
87
|
+
|
|
88
|
+
Import specific types:
|
|
89
|
+
|
|
90
|
+
```sea
|
|
91
|
+
import { Customer, Order } from "domain/entities.sea"
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Wildcard Import (with alias)
|
|
95
|
+
|
|
96
|
+
```sea
|
|
97
|
+
import * as billing from "billing/types.sea"
|
|
98
|
+
|
|
99
|
+
Flow from Customer to billing.Invoice
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Namespace Registry
|
|
103
|
+
|
|
104
|
+
The `.sea-registry.toml` file maps namespace prefixes to file paths:
|
|
105
|
+
|
|
106
|
+
```toml
|
|
107
|
+
[registry]
|
|
108
|
+
paths = ["./src", "./vendor"]
|
|
109
|
+
|
|
110
|
+
[namespaces]
|
|
111
|
+
core = "domainforge-core/std/core.sea"
|
|
112
|
+
http = "domainforge-core/std/http.sea"
|
|
113
|
+
aws = "domainforge-core/std/aws.sea"
|
|
114
|
+
domain = "src/domain/index.sea"
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Resolution Priority
|
|
118
|
+
|
|
119
|
+
1. **Registry lookup**: Check `[namespaces]` table
|
|
120
|
+
2. **Path search**: Search directories in `[registry].paths`
|
|
121
|
+
3. **Relative resolution**: Resolve relative to the importing file
|
|
122
|
+
4. **Standard library**: Check built-in `std:` modules
|
|
123
|
+
|
|
124
|
+
## Standard Library
|
|
125
|
+
|
|
126
|
+
Built-in types available via `std:` prefix (no registry needed):
|
|
127
|
+
|
|
128
|
+
| Module | Contents |
|
|
129
|
+
| ---------- | ------------------------------------- |
|
|
130
|
+
| `std:core` | UUID, Email, URL, DateTime |
|
|
131
|
+
| `std:http` | Request, Response, Headers |
|
|
132
|
+
| `std:aws` | S3Bucket, LambdaFunction, DynamoTable |
|
|
133
|
+
|
|
134
|
+
### Usage
|
|
135
|
+
|
|
136
|
+
```sea
|
|
137
|
+
import namespace core from "std:core"
|
|
138
|
+
|
|
139
|
+
Entity "User" {
|
|
140
|
+
id: core.UUID
|
|
141
|
+
email: core.Email
|
|
142
|
+
website: core.URL
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## Index Files
|
|
147
|
+
|
|
148
|
+
Create `index.sea` files to re-export from a namespace:
|
|
149
|
+
|
|
150
|
+
**`domain/index.sea`**
|
|
151
|
+
|
|
152
|
+
```sea
|
|
153
|
+
Namespace "domain"
|
|
154
|
+
|
|
155
|
+
// Re-export from sub-modules
|
|
156
|
+
export * from "domain/customer.sea"
|
|
157
|
+
export * from "domain/order.sea"
|
|
158
|
+
export * from "domain/payment.sea"
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
Then import the namespace:
|
|
162
|
+
|
|
163
|
+
```sea
|
|
164
|
+
import namespace domain from "domain/index.sea"
|
|
165
|
+
|
|
166
|
+
Flow from domain.Customer to domain.Order
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
## Circular Dependency Detection
|
|
170
|
+
|
|
171
|
+
The parser detects circular imports:
|
|
172
|
+
|
|
173
|
+
```
|
|
174
|
+
Error[E010]: Circular module dependency detected
|
|
175
|
+
--> domain/order.sea:3
|
|
176
|
+
|
|
|
177
|
+
3 | import "domain/customer.sea"
|
|
178
|
+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
179
|
+
|
|
|
180
|
+
= note: dependency chain: customer.sea -> order.sea -> customer.sea
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### Resolution
|
|
184
|
+
|
|
185
|
+
Break cycles by:
|
|
186
|
+
|
|
187
|
+
1. Moving shared types to a `common` module
|
|
188
|
+
2. Using interface types instead of concrete imports
|
|
189
|
+
3. Restructuring module boundaries
|
|
190
|
+
|
|
191
|
+
## Project Structure Best Practices
|
|
192
|
+
|
|
193
|
+
```
|
|
194
|
+
my-project/
|
|
195
|
+
├── .sea-registry.toml
|
|
196
|
+
├── common/
|
|
197
|
+
│ ├── types.sea # Base types
|
|
198
|
+
│ └── units.sea # Custom units
|
|
199
|
+
├── domain/
|
|
200
|
+
│ ├── index.sea # Re-exports
|
|
201
|
+
│ ├── customer.sea
|
|
202
|
+
│ ├── order.sea
|
|
203
|
+
│ └── payment.sea
|
|
204
|
+
├── policies/
|
|
205
|
+
│ ├── compliance.sea
|
|
206
|
+
│ └── business-rules.sea
|
|
207
|
+
└── main.sea # Entry point
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
## CLI Options
|
|
211
|
+
|
|
212
|
+
### Validate with Registry
|
|
213
|
+
|
|
214
|
+
```bash
|
|
215
|
+
domainforge validate main.sea --registry .sea-registry.toml
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
### Specify Additional Paths
|
|
219
|
+
|
|
220
|
+
```bash
|
|
221
|
+
domainforge validate main.sea --include ./vendor --include ./lib
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
### Verbose Module Loading
|
|
225
|
+
|
|
226
|
+
```bash
|
|
227
|
+
SEA_LOG=debug domainforge validate main.sea
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
## Programmatic Usage
|
|
231
|
+
|
|
232
|
+
### Rust
|
|
233
|
+
|
|
234
|
+
```rust
|
|
235
|
+
use domainforge_core::registry::NamespaceRegistry;
|
|
236
|
+
use domainforge_core::parser::parse_with_registry;
|
|
237
|
+
|
|
238
|
+
let registry = NamespaceRegistry::from_file(".sea-registry.toml")?;
|
|
239
|
+
let graph = parse_with_registry("main.sea", ®istry)?;
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
### Python
|
|
243
|
+
|
|
244
|
+
```python
|
|
245
|
+
from domainforge import Graph, NamespaceRegistry
|
|
246
|
+
|
|
247
|
+
registry = NamespaceRegistry.from_file(".sea-registry.toml")
|
|
248
|
+
graph = Graph.parse_with_registry(open("main.sea").read(), registry)
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
## Troubleshooting
|
|
252
|
+
|
|
253
|
+
### Module Not Found
|
|
254
|
+
|
|
255
|
+
```
|
|
256
|
+
Error[E009]: Module not found: 'common/types.sea'
|
|
257
|
+
--> domain/customer.sea:3
|
|
258
|
+
|
|
|
259
|
+
= hint: Check .sea-registry.toml or use --include flag
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
**Fix**: Ensure the file path is correct or add to registry.
|
|
263
|
+
|
|
264
|
+
### Namespace Conflict
|
|
265
|
+
|
|
266
|
+
```
|
|
267
|
+
Error[E011]: Namespace conflict: 'Customer' defined in multiple modules
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
**Fix**: Use namespace aliases or rename conflicting types.
|
|
271
|
+
|
|
272
|
+
### Registry Not Found
|
|
273
|
+
|
|
274
|
+
```
|
|
275
|
+
Warning: No .sea-registry.toml found, using default resolution
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
**Fix**: Create `.sea-registry.toml` in project root.
|
|
279
|
+
|
|
280
|
+
## See Also
|
|
281
|
+
|
|
282
|
+
- [ADR-009: Module Resolution Strategy](../specs/ADR-009-module-resolution-strategy.md)
|
|
283
|
+
- [Configuration Reference](../reference/configuration.md)
|
|
284
|
+
- [Registry Reference](../reference/registry.md)
|
|
285
|
+
- [CLI Commands](../reference/cli-commands.md)
|
package/docs/index.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# DomainForge — New Documentation Index
|
|
2
|
+
Welcome to the DomainForge documentation! This index provides an overview of the various types of documentation available to help you get started, learn advanced features, and reference the API.
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
## Categories
|
|
6
|
+
|
|
7
|
+
- Tutorials: Hands-on, step-by-step learning (e.g., Getting started, Quickstarts)
|
|
8
|
+
- How-Tos: Task-focused, concise procedures (install, export to CALM)
|
|
9
|
+
- Reference: Stable API/grammar/CLI/configuration
|
|
10
|
+
- Explanations: Architecture and conceptual documents
|
|
11
|
+
- Playbooks: Runbooks and operational procedures
|
|
12
|
+
|
|
13
|
+
See the `templates/` folder to create new docs consistently.
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
# ADR: Canonical Expression Normalizer
|
|
2
|
+
|
|
3
|
+
**Status:** Proposed
|
|
4
|
+
**Date:** 2025-12-16
|
|
5
|
+
**Authors:** DomainForge Architecture Team
|
|
6
|
+
|
|
7
|
+
## Context
|
|
8
|
+
|
|
9
|
+
SEA-DSL policy expressions can be written in many syntactically equivalent forms:
|
|
10
|
+
|
|
11
|
+
- `a AND b` vs `b AND a`
|
|
12
|
+
- `true AND x` vs `x`
|
|
13
|
+
- Nested parentheses: `((a))` vs `a`
|
|
14
|
+
|
|
15
|
+
This creates challenges for:
|
|
16
|
+
|
|
17
|
+
1. **Hover signatures** - displaying a consistent, readable form
|
|
18
|
+
2. **Change detection** - determining if two policies are semantically equivalent
|
|
19
|
+
3. **Caching** - using normalized expressions as cache keys
|
|
20
|
+
4. **Testing** - golden snapshot tests need deterministic output
|
|
21
|
+
|
|
22
|
+
## Decision
|
|
23
|
+
|
|
24
|
+
Implement a canonical normalizer in `domainforge_core::policy` that transforms any `Expression` into a deterministic, minimal, canonical form.
|
|
25
|
+
|
|
26
|
+
## Design
|
|
27
|
+
|
|
28
|
+
### 1. Normalization Rules
|
|
29
|
+
|
|
30
|
+
| Category | Rule | Example |
|
|
31
|
+
| -------------------------- | --------------------------------------------- | ----------------------------------- |
|
|
32
|
+
| **Commutativity** | Sort operands of `AND`/`OR` lexicographically | `b AND a` → `a AND b` |
|
|
33
|
+
| **Identity** | Remove identity elements | `true AND x` → `x` |
|
|
34
|
+
| **Absorption** | Remove absorbed terms | `a OR (a AND b)` → `a` |
|
|
35
|
+
| **Parentheses** | Flatten redundant nesting | `((a))` → `a` |
|
|
36
|
+
| **Variable naming** | Alpha-rename quantifier vars | `forall x: ...` → `forall _v0: ...` |
|
|
37
|
+
| **Operator normalization** | Use canonical operators | `NOT (a = b)` → `a != b` |
|
|
38
|
+
|
|
39
|
+
### 2. API
|
|
40
|
+
|
|
41
|
+
```rust
|
|
42
|
+
// In domainforge_core::policy::expression
|
|
43
|
+
impl Expression {
|
|
44
|
+
/// Returns a canonical form of this expression
|
|
45
|
+
pub fn normalize(&self) -> NormalizedExpression;
|
|
46
|
+
|
|
47
|
+
/// Returns true if two expressions are semantically equivalent
|
|
48
|
+
pub fn is_equivalent(&self, other: &Expression) -> bool {
|
|
49
|
+
self.normalize() == other.normalize()
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
#[derive(Clone, PartialEq, Eq, Hash)]
|
|
54
|
+
pub struct NormalizedExpression {
|
|
55
|
+
inner: Expression,
|
|
56
|
+
/// Stable hash for caching
|
|
57
|
+
hash: u64,
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
impl Display for NormalizedExpression {
|
|
61
|
+
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
|
|
62
|
+
// Pretty-print in canonical form
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### 3. Implementation Strategy
|
|
68
|
+
|
|
69
|
+
**Phase 1: Core normalization**
|
|
70
|
+
|
|
71
|
+
- [ ] Implement `normalize()` for leaf nodes (Literal, Variable)
|
|
72
|
+
- [ ] Implement `normalize()` for binary operators with sorting
|
|
73
|
+
- [ ] Implement `normalize()` for unary operators
|
|
74
|
+
- [ ] Add stable hashing using `rustc_hash::FxHasher`
|
|
75
|
+
|
|
76
|
+
**Phase 2: Advanced normalization**
|
|
77
|
+
|
|
78
|
+
- [ ] Implement constant folding (`true AND x` → `x`)
|
|
79
|
+
- [ ] Implement absorption rules
|
|
80
|
+
- [ ] Implement alpha-renaming for quantifier variables
|
|
81
|
+
|
|
82
|
+
**Phase 3: Integration**
|
|
83
|
+
|
|
84
|
+
- [ ] Use in LSP hover signature generation
|
|
85
|
+
- [ ] Add `Policy::normalized_expression()` helper
|
|
86
|
+
- [ ] Add CLI option: `domainforge normalize <expr>`
|
|
87
|
+
|
|
88
|
+
### 4. Files to Modify
|
|
89
|
+
|
|
90
|
+
| File | Changes |
|
|
91
|
+
| ---------------------------------------------- | -------------------------------- |
|
|
92
|
+
| `domainforge-core/src/policy/mod.rs` | Add `mod normalize;` |
|
|
93
|
+
| `domainforge-core/src/policy/normalize.rs` | **NEW** - Normalization logic |
|
|
94
|
+
| `domainforge-core/src/policy/expression.rs` | Add `normalize()` method |
|
|
95
|
+
| `domainforge-lsp/src/hover/symbol_resolver.rs` | Use normalized form in signature |
|
|
96
|
+
|
|
97
|
+
## Consequences
|
|
98
|
+
|
|
99
|
+
### Positive
|
|
100
|
+
|
|
101
|
+
- Deterministic hover output
|
|
102
|
+
- Semantic equivalence checking
|
|
103
|
+
- Better caching with normalized keys
|
|
104
|
+
- Cleaner test assertions
|
|
105
|
+
|
|
106
|
+
### Negative
|
|
107
|
+
|
|
108
|
+
- Computational overhead for normalization
|
|
109
|
+
- Increased complexity in expression module
|
|
110
|
+
- Alpha-renaming may reduce readability
|
|
111
|
+
|
|
112
|
+
## Alternatives Considered
|
|
113
|
+
|
|
114
|
+
1. **No normalization** - Accept non-deterministic output (rejected: breaks testing)
|
|
115
|
+
2. **Simple sorting only** - Only sort commutative operators (insufficient for identity elimination)
|
|
116
|
+
3. **External SMT solver** - Use Z3 for semantic equivalence (rejected: too heavy)
|
|
117
|
+
|
|
118
|
+
## References
|
|
119
|
+
|
|
120
|
+
- [SDS-004: Policy Engine Design](./SDS-004-policy-engine-design.md)
|
|
121
|
+
- [hover_plan.yml](../archive/hover_plan.yml) - Mentions normalized form display
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# DomainForge CD Improvement Plan
|
|
2
|
+
|
|
3
|
+
> **Purpose**: Address identified gaps and technical debt in the Continuous Delivery pipeline.
|
|
4
|
+
>
|
|
5
|
+
> **Last Updated**: 2025-12-15
|
|
6
|
+
> **Status**: ✅ Implemented
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Executive Summary
|
|
11
|
+
|
|
12
|
+
Analysis of the 9 workflow files in `.github/workflows/` revealed several CD issues that create technical debt, inconsistency, and potential release failures. This plan provided a prioritized remediation roadmap, which has now been implemented.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Findings & Remediation Status
|
|
17
|
+
|
|
18
|
+
### 🔴 Critical Issues — ✅ Resolved
|
|
19
|
+
|
|
20
|
+
| ID | Issue | Resolution |
|
|
21
|
+
| --- | ---------------------------------- | --------------------------------------------------------------------- |
|
|
22
|
+
| C1 | Duplicate Python publish workflows | Deleted `publish-python.yml`, retained `release-pypi.yml` |
|
|
23
|
+
| C2 | Release → Publish disconnection | Added `continue-on-error` to handle edge cases |
|
|
24
|
+
| C3 | Publish rebuilds from scratch | Kept rebuild pattern (required for napi bindings) with error recovery |
|
|
25
|
+
|
|
26
|
+
### 🟠 High Priority Issues — ✅ Resolved
|
|
27
|
+
|
|
28
|
+
| ID | Issue | Resolution |
|
|
29
|
+
| --- | ----------------------- | ----------------------------------------------------------------------------- |
|
|
30
|
+
| H1 | Missing ARM targets | Added `aarch64-apple-darwin` and `aarch64-unknown-linux-gnu` to all workflows |
|
|
31
|
+
| H2 | No WASM npm package | Added `publish-wasm` job to `release-npm.yml` |
|
|
32
|
+
| H3 | Inconsistent thresholds | Harmonized WASM limit to 2MB in both `ci.yml` and `release.yml` |
|
|
33
|
+
|
|
34
|
+
### 🟡 Medium Priority Issues — ✅ Resolved
|
|
35
|
+
|
|
36
|
+
| ID | Issue | Resolution |
|
|
37
|
+
| --- | ------------------------------ | ---------------------------------------------- |
|
|
38
|
+
| M1 | Python version inconsistency | ARM targets added (3.12 support via manylinux) |
|
|
39
|
+
| M3 | No release automation | Created `prepare-release.yml` workflow |
|
|
40
|
+
| M4 | No `--skip-existing` in crates | Added with `continue-on-error` |
|
|
41
|
+
|
|
42
|
+
### 🔵 Low Priority — Not in Scope
|
|
43
|
+
|
|
44
|
+
| ID | Issue | Status |
|
|
45
|
+
| --- | -------------------------- | --------------------------------- |
|
|
46
|
+
| L1 | Release candidate workflow | Supported via `prerelease` input |
|
|
47
|
+
| L2 | Artifact signatures | Future enhancement |
|
|
48
|
+
| L3 | Automated changelog | Template added in prepare-release |
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## Implementation Checklist
|
|
53
|
+
|
|
54
|
+
### Phase 1: Eliminate Duplication ✅
|
|
55
|
+
|
|
56
|
+
- [x] Delete `publish-python.yml`
|
|
57
|
+
- [x] Update `release-pypi.yml` (kept rebuild, added ARM)
|
|
58
|
+
- [x] Update `release-npm.yml` (added WASM job)
|
|
59
|
+
- [x] Add `--skip-existing` to `release-crates.yml`
|
|
60
|
+
|
|
61
|
+
### Phase 2: Add ARM Targets ✅
|
|
62
|
+
|
|
63
|
+
- [x] Add `aarch64-apple-darwin` to `release.yml`
|
|
64
|
+
- [x] Add `aarch64-unknown-linux-gnu` to `release.yml`
|
|
65
|
+
- [x] Add ARM targets to Python wheels build
|
|
66
|
+
- [x] Use `cross` for CLI, `zig` for Python wheels
|
|
67
|
+
|
|
68
|
+
### Phase 3: Harmonize Thresholds ✅
|
|
69
|
+
|
|
70
|
+
- [x] Sync `WASM_MAX_BYTES` to 2MB in both workflows
|
|
71
|
+
- [x] Add ARM targets to `release-pypi.yml`
|
|
72
|
+
|
|
73
|
+
### Phase 4: WASM npm Publishing ✅
|
|
74
|
+
|
|
75
|
+
- [x] Add `publish-wasm` job to `release-npm.yml`
|
|
76
|
+
|
|
77
|
+
### Phase 5: Release Automation ✅
|
|
78
|
+
|
|
79
|
+
- [x] Create `prepare-release.yml` workflow
|
|
80
|
+
- [x] Supports major/minor/patch bumps
|
|
81
|
+
- [x] Supports pre-release suffixes
|
|
82
|
+
|
|
83
|
+
### Phase 6: Documentation ✅
|
|
84
|
+
|
|
85
|
+
- [x] Update `workflows/README.md`
|
|
86
|
+
- [x] Mark plan items as complete
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## Files Changed
|
|
91
|
+
|
|
92
|
+
| File | Action | Key Changes |
|
|
93
|
+
| --------------------- | -------- | --------------------------------------------------------------- |
|
|
94
|
+
| `publish-python.yml` | Deleted | Redundant with `release-pypi.yml` |
|
|
95
|
+
| `release.yml` | Modified | Added ARM targets, harmonized WASM threshold, cross-compilation |
|
|
96
|
+
| `release-pypi.yml` | Modified | Added ARM targets with Zig cross-compilation |
|
|
97
|
+
| `release-npm.yml` | Modified | Added WASM publishing job |
|
|
98
|
+
| `release-crates.yml` | Modified | Added error recovery |
|
|
99
|
+
| `ci.yml` | Modified | Added threshold comment |
|
|
100
|
+
| `prepare-release.yml` | Created | Automated release preparation |
|
|
101
|
+
| `README.md` | Modified | Comprehensive documentation update |
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## Verification
|
|
106
|
+
|
|
107
|
+
To verify the implementation:
|
|
108
|
+
|
|
109
|
+
1. Push changes to a branch and open a PR — GitHub validates YAML syntax
|
|
110
|
+
2. Manually trigger `prepare-release.yml` to test version bumping
|
|
111
|
+
3. Create a test tag `v0.0.0-test` to verify `release.yml` builds
|
|
112
|
+
4. Create a draft GitHub Release to verify publish workflows trigger
|