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,113 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Check that release workflow gates are correct.
|
|
3
|
+
|
|
4
|
+
Verifies:
|
|
5
|
+
- Every upload-artifact job is referenced in create-release needs
|
|
6
|
+
- Dependabot automerge does not treat empty check results as success
|
|
7
|
+
"""
|
|
8
|
+
import sys
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
|
|
11
|
+
try:
|
|
12
|
+
import yaml
|
|
13
|
+
except ImportError:
|
|
14
|
+
print("PyYAML is required: pip install pyyaml")
|
|
15
|
+
sys.exit(1)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def check_artifact_gates(path):
|
|
19
|
+
errors = []
|
|
20
|
+
with open(path) as f:
|
|
21
|
+
wf = yaml.safe_load(f)
|
|
22
|
+
|
|
23
|
+
if wf is None:
|
|
24
|
+
return []
|
|
25
|
+
|
|
26
|
+
jobs = wf.get("jobs", {})
|
|
27
|
+
create_release = jobs.get("create-release", {})
|
|
28
|
+
needs = create_release.get("needs", [])
|
|
29
|
+
if isinstance(needs, str):
|
|
30
|
+
needs = [needs]
|
|
31
|
+
|
|
32
|
+
for job_name, job in jobs.items():
|
|
33
|
+
if job_name == "create-release":
|
|
34
|
+
continue
|
|
35
|
+
steps = job.get("steps", [])
|
|
36
|
+
has_upload = any(
|
|
37
|
+
"upload-artifact" in str(step.get("uses", ""))
|
|
38
|
+
for step in steps
|
|
39
|
+
)
|
|
40
|
+
if has_upload and job_name not in needs:
|
|
41
|
+
errors.append(
|
|
42
|
+
f"{path.name}: job '{job_name}' uploads artifacts "
|
|
43
|
+
f"but is not in create-release needs (found: {needs})"
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
return errors
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def check_dependabot_gates(path):
|
|
50
|
+
errors = []
|
|
51
|
+
if "dependabot" not in path.name:
|
|
52
|
+
return []
|
|
53
|
+
|
|
54
|
+
with open(path) as f:
|
|
55
|
+
wf = yaml.safe_load(f)
|
|
56
|
+
|
|
57
|
+
if wf is None:
|
|
58
|
+
return []
|
|
59
|
+
|
|
60
|
+
for job_name, job in wf.get("jobs", {}).items():
|
|
61
|
+
for step in job.get("steps", []):
|
|
62
|
+
run = step.get("run", "")
|
|
63
|
+
if not isinstance(run, str):
|
|
64
|
+
continue
|
|
65
|
+
if "checks" in run.lower() or "status" in run.lower():
|
|
66
|
+
if "[]" in run and "exit 0" not in run.split("[]")[0]:
|
|
67
|
+
lines_after = run.split("[]")
|
|
68
|
+
remaining = lines_after[1] if len(lines_after) > 1 else ""
|
|
69
|
+
if 'exit 0' in remaining and 'exit 1' not in remaining:
|
|
70
|
+
continue
|
|
71
|
+
|
|
72
|
+
has_empty_fail = "[]" in run and "exit 1" in run
|
|
73
|
+
if not has_empty_fail:
|
|
74
|
+
if "[]" in run:
|
|
75
|
+
next_chunk = run.split("[]", 1)[1] if "[]" in run else ""
|
|
76
|
+
if "exit 1" not in next_chunk:
|
|
77
|
+
has_rejection = "no check" in run.lower() and "exit 1" in run
|
|
78
|
+
if not has_rejection:
|
|
79
|
+
errors.append(
|
|
80
|
+
f"{path.name}:{job_name}: "
|
|
81
|
+
f"dependabot check may treat empty [] as success "
|
|
82
|
+
f"without explicit failure"
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
return errors
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
def main():
|
|
89
|
+
workflows_dir = Path(".github/workflows")
|
|
90
|
+
if not workflows_dir.exists():
|
|
91
|
+
print("No .github/workflows directory found")
|
|
92
|
+
sys.exit(0)
|
|
93
|
+
|
|
94
|
+
all_errors = []
|
|
95
|
+
for wf in sorted(workflows_dir.glob("*.yml")):
|
|
96
|
+
all_errors.extend(check_artifact_gates(wf))
|
|
97
|
+
all_errors.extend(check_dependabot_gates(wf))
|
|
98
|
+
for wf in sorted(workflows_dir.glob("*.yaml")):
|
|
99
|
+
all_errors.extend(check_artifact_gates(wf))
|
|
100
|
+
all_errors.extend(check_dependabot_gates(wf))
|
|
101
|
+
|
|
102
|
+
if all_errors:
|
|
103
|
+
print("Workflow gate lint FAILURES:")
|
|
104
|
+
for e in all_errors:
|
|
105
|
+
print(f" - {e}")
|
|
106
|
+
sys.exit(1)
|
|
107
|
+
else:
|
|
108
|
+
print("All workflow gate lints passed")
|
|
109
|
+
sys.exit(0)
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
if __name__ == "__main__":
|
|
113
|
+
main()
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
set -e
|
|
3
|
+
|
|
4
|
+
# optimized-wasm-build.sh
|
|
5
|
+
# Performs a production build of the domainforge-core WASM bundle with SAFE optimizations.
|
|
6
|
+
|
|
7
|
+
echo "🚀 Starting Optimized WASM Build..."
|
|
8
|
+
|
|
9
|
+
# 1. Clean previous builds
|
|
10
|
+
echo "🧹 Cleaning previous artifacts..."
|
|
11
|
+
cargo clean -p domainforge-core --target wasm32-unknown-unknown
|
|
12
|
+
|
|
13
|
+
# 2. Build with wasm-pack
|
|
14
|
+
# Note: Profile configuration in domainforge-core/Cargo.toml now enables wasm-opt
|
|
15
|
+
echo "🏗️ Building with wasm-pack (Release mode)..."
|
|
16
|
+
# Using --target web as a standard default, can be changed to --target nodejs if needed
|
|
17
|
+
wasm-pack build domainforge-core --target web --release --features wasm
|
|
18
|
+
|
|
19
|
+
# 3. Explicit Optimization (Verification Step)
|
|
20
|
+
# Even though we enabled it in Cargo.toml, running it explicitly ensures it happens
|
|
21
|
+
# and allows us to see the output stats.
|
|
22
|
+
WASM_FILE="domainforge-core/pkg/domainforge_core_bg.wasm"
|
|
23
|
+
OPTIMIZED_FILE="domainforge-core/pkg/domainforge_core_bg.optimized.wasm"
|
|
24
|
+
|
|
25
|
+
if command -v wasm-opt >/dev/null 2>&1; then
|
|
26
|
+
echo "🔧 Running explicit wasm-opt -Oz..."
|
|
27
|
+
wasm-opt -Oz -o "$OPTIMIZED_FILE" "$WASM_FILE"
|
|
28
|
+
|
|
29
|
+
# Compare sizes
|
|
30
|
+
ORIG_SIZE=$(stat -c%s "$WASM_FILE")
|
|
31
|
+
OPT_SIZE=$(stat -c%s "$OPTIMIZED_FILE")
|
|
32
|
+
|
|
33
|
+
echo "📊 Size Report:"
|
|
34
|
+
echo " Original: $(numfmt --to=iec-i --suffix=B $ORIG_SIZE)"
|
|
35
|
+
echo " Optimized: $(numfmt --to=iec-i --suffix=B $OPT_SIZE)"
|
|
36
|
+
|
|
37
|
+
# Replace if smaller
|
|
38
|
+
if [ $OPT_SIZE -lt $ORIG_SIZE ]; then
|
|
39
|
+
echo "✅ Optimization successful! Replacing original file."
|
|
40
|
+
mv "$OPTIMIZED_FILE" "$WASM_FILE"
|
|
41
|
+
else
|
|
42
|
+
echo "⚠️ Optimization did not reduce size. Keeping original."
|
|
43
|
+
rm "$OPTIMIZED_FILE"
|
|
44
|
+
fi
|
|
45
|
+
else
|
|
46
|
+
echo "⚠️ 'wasm-opt' not found in PATH. Skipping explicit optimization step."
|
|
47
|
+
echo " (Note: wasm-pack usually runs this internally if configured)"
|
|
48
|
+
fi
|
|
49
|
+
|
|
50
|
+
# 4. Final Size Check
|
|
51
|
+
FINAL_SIZE=$(stat -c%s "$WASM_FILE")
|
|
52
|
+
MAX_SIZE=$((2048 * 1024)) # 2 MB
|
|
53
|
+
|
|
54
|
+
echo "----------------------------------------"
|
|
55
|
+
echo "🏁 Final Bundle Size: $(numfmt --to=iec-i --suffix=B $FINAL_SIZE)"
|
|
56
|
+
if [ $FINAL_SIZE -gt $MAX_SIZE ]; then
|
|
57
|
+
echo "❌ WARNING: Bundle exceeds 0.5 MB limit!"
|
|
58
|
+
else
|
|
59
|
+
echo "✅ SUCCESS: Bundle is under 0.5 MB limit."
|
|
60
|
+
fi
|
|
61
|
+
echo "----------------------------------------"
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Post-build patcher for napi-rs generated index.d.ts.
|
|
3
|
+
|
|
4
|
+
napi-rs auto-generates index.d.ts with two known issues that must be fixed
|
|
5
|
+
after each `napi build`:
|
|
6
|
+
|
|
7
|
+
1. `Self | null` — napi-rs generates `Self` for `Option<Self>` return types
|
|
8
|
+
on class methods. TypeScript consumers need the concrete class name.
|
|
9
|
+
2. `function:` — Rust parameter names that are JS reserved words get emitted
|
|
10
|
+
verbatim. We patch them to safe names.
|
|
11
|
+
|
|
12
|
+
This script is idempotent and safe to run multiple times.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
import re
|
|
16
|
+
import sys
|
|
17
|
+
from pathlib import Path
|
|
18
|
+
|
|
19
|
+
DECL_FILE = Path("index.d.ts")
|
|
20
|
+
|
|
21
|
+
# Patches: (pattern, replacement)
|
|
22
|
+
PATCHES = [
|
|
23
|
+
# Fix `Self | null` → `NamespaceRegistry | null` in discover() return type
|
|
24
|
+
(
|
|
25
|
+
r"static discover\(path: string\): Self \| null",
|
|
26
|
+
r"static discover(path: string): NamespaceRegistry | null",
|
|
27
|
+
),
|
|
28
|
+
# Fix reserved-word `function:` param → `aggregateFunction:`
|
|
29
|
+
(
|
|
30
|
+
r"aggregationComprehension\(function:",
|
|
31
|
+
r"aggregationComprehension(aggregateFunction:",
|
|
32
|
+
),
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def patch_file(path: Path) -> int:
|
|
37
|
+
if not path.exists():
|
|
38
|
+
print(f"ERROR: {path} not found", file=sys.stderr)
|
|
39
|
+
return 1
|
|
40
|
+
|
|
41
|
+
original = path.read_text(encoding="utf-8")
|
|
42
|
+
patched = original
|
|
43
|
+
changes = 0
|
|
44
|
+
|
|
45
|
+
for pattern, replacement in PATCHES:
|
|
46
|
+
new_text = re.sub(pattern, replacement, patched)
|
|
47
|
+
if new_text != patched:
|
|
48
|
+
changes += 1
|
|
49
|
+
patched = new_text
|
|
50
|
+
|
|
51
|
+
if changes > 0:
|
|
52
|
+
path.write_text(patched, encoding="utf-8")
|
|
53
|
+
print(f"Patched {changes} issue(s) in {path}")
|
|
54
|
+
else:
|
|
55
|
+
print(f"No patches needed for {path}")
|
|
56
|
+
|
|
57
|
+
return 0
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
if __name__ == "__main__":
|
|
61
|
+
target = Path(sys.argv[1]) if len(sys.argv) > 1 else DECL_FILE
|
|
62
|
+
sys.exit(patch_file(target))
|
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# pre-release-check.sh - Pre-flight validation for releases
|
|
3
|
+
# Usage: ./scripts/pre-release-check.sh [--dry-run]
|
|
4
|
+
#
|
|
5
|
+
# Validates the repository is ready for a release:
|
|
6
|
+
# - No uncommitted changes
|
|
7
|
+
# - On correct branch (main, release/*)
|
|
8
|
+
# - All tests pass
|
|
9
|
+
# - Version files are in sync
|
|
10
|
+
# - CHANGELOG.md is up to date
|
|
11
|
+
|
|
12
|
+
set -euo pipefail
|
|
13
|
+
|
|
14
|
+
# ============================================================================
|
|
15
|
+
# Configuration
|
|
16
|
+
# ============================================================================
|
|
17
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
18
|
+
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
19
|
+
|
|
20
|
+
# Colors for output
|
|
21
|
+
RED='\033[0;31m'
|
|
22
|
+
GREEN='\033[0;32m'
|
|
23
|
+
YELLOW='\033[1;33m'
|
|
24
|
+
BLUE='\033[0;34m'
|
|
25
|
+
NC='\033[0m' # No Color
|
|
26
|
+
|
|
27
|
+
# Flags
|
|
28
|
+
DRY_RUN=false
|
|
29
|
+
VERBOSE=false
|
|
30
|
+
|
|
31
|
+
# ============================================================================
|
|
32
|
+
# Helper Functions
|
|
33
|
+
# ============================================================================
|
|
34
|
+
log_info() {
|
|
35
|
+
echo -e "${BLUE}[INFO]${NC} $1"
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
log_success() {
|
|
39
|
+
echo -e "${GREEN}[✓]${NC} $1"
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
log_warn() {
|
|
43
|
+
echo -e "${YELLOW}[WARN]${NC} $1"
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
log_error() {
|
|
47
|
+
echo -e "${RED}[✗]${NC} $1"
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
log_step() {
|
|
51
|
+
echo -e "${BLUE}[STEP]${NC} $1"
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
usage() {
|
|
55
|
+
cat <<EOF
|
|
56
|
+
Usage: $(basename "$0") [OPTIONS]
|
|
57
|
+
|
|
58
|
+
Pre-release validation checks for DomainForge.
|
|
59
|
+
|
|
60
|
+
OPTIONS:
|
|
61
|
+
--dry-run Show what would be checked without running tests
|
|
62
|
+
--verbose Show verbose output
|
|
63
|
+
--skip-tests Skip running test suites (faster, less thorough)
|
|
64
|
+
-h, --help Show this help message
|
|
65
|
+
|
|
66
|
+
CHECKS PERFORMED:
|
|
67
|
+
1. Git status - no uncommitted changes
|
|
68
|
+
2. Branch validation - must be main or release/*
|
|
69
|
+
3. Latest changes pulled from remote
|
|
70
|
+
4. All test suites pass (Rust, Python, TypeScript)
|
|
71
|
+
5. Version consistency across Cargo.toml, pyproject.toml, package.json
|
|
72
|
+
6. CHANGELOG.md has entry for current version
|
|
73
|
+
|
|
74
|
+
EXIT CODES:
|
|
75
|
+
0 All checks passed
|
|
76
|
+
1 One or more checks failed
|
|
77
|
+
|
|
78
|
+
EXAMPLES:
|
|
79
|
+
$(basename "$0") # Run full pre-release checks
|
|
80
|
+
$(basename "$0") --dry-run # Preview what would be checked
|
|
81
|
+
$(basename "$0") --skip-tests # Skip running tests (faster)
|
|
82
|
+
EOF
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
# ============================================================================
|
|
86
|
+
# Parse Arguments
|
|
87
|
+
# ============================================================================
|
|
88
|
+
SKIP_TESTS=false
|
|
89
|
+
|
|
90
|
+
while [[ $# -gt 0 ]]; do
|
|
91
|
+
case $1 in
|
|
92
|
+
--dry-run)
|
|
93
|
+
DRY_RUN=true
|
|
94
|
+
shift
|
|
95
|
+
;;
|
|
96
|
+
--verbose)
|
|
97
|
+
VERBOSE=true
|
|
98
|
+
shift
|
|
99
|
+
;;
|
|
100
|
+
--skip-tests)
|
|
101
|
+
SKIP_TESTS=true
|
|
102
|
+
shift
|
|
103
|
+
;;
|
|
104
|
+
-h|--help)
|
|
105
|
+
usage
|
|
106
|
+
exit 0
|
|
107
|
+
;;
|
|
108
|
+
*)
|
|
109
|
+
log_error "Unknown option: $1"
|
|
110
|
+
usage
|
|
111
|
+
exit 1
|
|
112
|
+
;;
|
|
113
|
+
esac
|
|
114
|
+
done
|
|
115
|
+
|
|
116
|
+
# ============================================================================
|
|
117
|
+
# Checks
|
|
118
|
+
# ============================================================================
|
|
119
|
+
cd "$PROJECT_ROOT"
|
|
120
|
+
|
|
121
|
+
FAILED=0
|
|
122
|
+
|
|
123
|
+
echo ""
|
|
124
|
+
echo "=============================================="
|
|
125
|
+
echo " DomainForge Pre-Release Checks"
|
|
126
|
+
echo "=============================================="
|
|
127
|
+
echo ""
|
|
128
|
+
|
|
129
|
+
if $DRY_RUN; then
|
|
130
|
+
log_warn "DRY RUN MODE - Showing what would be checked"
|
|
131
|
+
echo ""
|
|
132
|
+
fi
|
|
133
|
+
|
|
134
|
+
# Check 1: Git status
|
|
135
|
+
log_step "Checking git status for uncommitted changes..."
|
|
136
|
+
if $DRY_RUN; then
|
|
137
|
+
log_info "Would run: git status --porcelain"
|
|
138
|
+
else
|
|
139
|
+
if [[ -n $(git status --porcelain) ]]; then
|
|
140
|
+
log_error "Uncommitted changes detected:"
|
|
141
|
+
git status --short
|
|
142
|
+
FAILED=1
|
|
143
|
+
else
|
|
144
|
+
log_success "No uncommitted changes"
|
|
145
|
+
fi
|
|
146
|
+
fi
|
|
147
|
+
|
|
148
|
+
# Check 2: Branch validation
|
|
149
|
+
log_step "Validating current branch..."
|
|
150
|
+
if $DRY_RUN; then
|
|
151
|
+
log_info "Would check if branch matches: main or release/*"
|
|
152
|
+
else
|
|
153
|
+
BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
|
154
|
+
if [[ "$BRANCH" =~ ^(main|release/.*)$ ]]; then
|
|
155
|
+
log_success "On valid branch: $BRANCH"
|
|
156
|
+
if [[ "$BRANCH" != "main" ]]; then
|
|
157
|
+
log_warn "Release preparation is allowed on $BRANCH, but scripts/release.sh must be run from main after promotion."
|
|
158
|
+
fi
|
|
159
|
+
else
|
|
160
|
+
log_warn "On branch '$BRANCH' - releases typically done from main or release/*"
|
|
161
|
+
# Not a hard failure, just a warning
|
|
162
|
+
fi
|
|
163
|
+
fi
|
|
164
|
+
|
|
165
|
+
# Check 3: Pull latest changes
|
|
166
|
+
log_step "Checking for latest changes from remote..."
|
|
167
|
+
if $DRY_RUN; then
|
|
168
|
+
log_info "Would run: git fetch origin && git status -uno"
|
|
169
|
+
else
|
|
170
|
+
git fetch origin --quiet 2>/dev/null || log_warn "Could not fetch from origin"
|
|
171
|
+
LOCAL=$(git rev-parse HEAD)
|
|
172
|
+
REMOTE=$(git rev-parse "@{u}" 2>/dev/null || echo "")
|
|
173
|
+
if [[ -z "$REMOTE" ]]; then
|
|
174
|
+
log_warn "No upstream branch set"
|
|
175
|
+
elif [[ "$LOCAL" != "$REMOTE" ]]; then
|
|
176
|
+
BEHIND=$(git rev-list --count HEAD..@{u} 2>/dev/null || echo "0")
|
|
177
|
+
if [[ "$BEHIND" -gt 0 ]]; then
|
|
178
|
+
log_warn "Branch is $BEHIND commits behind remote. Consider pulling."
|
|
179
|
+
fi
|
|
180
|
+
else
|
|
181
|
+
log_success "Up to date with remote"
|
|
182
|
+
fi
|
|
183
|
+
fi
|
|
184
|
+
|
|
185
|
+
# Check 4: Version consistency
|
|
186
|
+
log_step "Checking version consistency across files..."
|
|
187
|
+
if $DRY_RUN; then
|
|
188
|
+
log_info "Would compare versions in:"
|
|
189
|
+
log_info " - domainforge-core/Cargo.toml"
|
|
190
|
+
log_info " - pyproject.toml"
|
|
191
|
+
log_info " - package.json"
|
|
192
|
+
else
|
|
193
|
+
CARGO_VERSION=$(grep -m1 '^version = ' domainforge-core/Cargo.toml | sed 's/version = "\(.*\)"/\1/')
|
|
194
|
+
PYPROJECT_VERSION=$(grep -m1 '^version = ' pyproject.toml | sed 's/version = "\(.*\)"/\1/' | tr -d '\r')
|
|
195
|
+
PKG_VERSION=$(grep -m1 '"version"' package.json | sed 's/.*"\([0-9][^"]*\)".*/\1/')
|
|
196
|
+
|
|
197
|
+
log_info "Cargo.toml: $CARGO_VERSION"
|
|
198
|
+
log_info "pyproject.toml: $PYPROJECT_VERSION"
|
|
199
|
+
log_info "package.json: $PKG_VERSION"
|
|
200
|
+
|
|
201
|
+
if [[ "$CARGO_VERSION" == "$PYPROJECT_VERSION" && "$CARGO_VERSION" == "$PKG_VERSION" ]]; then
|
|
202
|
+
log_success "All versions match: $CARGO_VERSION"
|
|
203
|
+
else
|
|
204
|
+
log_error "Version mismatch across files!"
|
|
205
|
+
FAILED=1
|
|
206
|
+
fi
|
|
207
|
+
fi
|
|
208
|
+
|
|
209
|
+
# Check 5: CHANGELOG.md has entry for current version
|
|
210
|
+
log_step "Checking CHANGELOG.md..."
|
|
211
|
+
if $DRY_RUN; then
|
|
212
|
+
log_info "Would verify CHANGELOG.md contains entry for current version"
|
|
213
|
+
else
|
|
214
|
+
if [[ -f "CHANGELOG.md" ]]; then
|
|
215
|
+
# Get the first version entry
|
|
216
|
+
FIRST_CHANGELOG_VERSION=$(grep -m1 '^\#\# \[' CHANGELOG.md | sed 's/.*\[\([0-9][^]]*\)\].*/\1/' || echo "")
|
|
217
|
+
if [[ -n "$FIRST_CHANGELOG_VERSION" ]]; then
|
|
218
|
+
if [[ "$FIRST_CHANGELOG_VERSION" == "$CARGO_VERSION" ]]; then
|
|
219
|
+
log_success "CHANGELOG.md has entry for current version ($CARGO_VERSION)"
|
|
220
|
+
else
|
|
221
|
+
log_warn "CHANGELOG.md top entry ($FIRST_CHANGELOG_VERSION) doesn't match current version ($CARGO_VERSION)"
|
|
222
|
+
fi
|
|
223
|
+
else
|
|
224
|
+
log_warn "Could not find version entry in CHANGELOG.md"
|
|
225
|
+
fi
|
|
226
|
+
else
|
|
227
|
+
log_error "CHANGELOG.md not found"
|
|
228
|
+
FAILED=1
|
|
229
|
+
fi
|
|
230
|
+
fi
|
|
231
|
+
|
|
232
|
+
# Check 6: Run tests
|
|
233
|
+
if $SKIP_TESTS; then
|
|
234
|
+
log_step "Skipping tests (--skip-tests flag)"
|
|
235
|
+
else
|
|
236
|
+
log_step "Running test suites..."
|
|
237
|
+
if $DRY_RUN; then
|
|
238
|
+
log_info "Would run: just all-tests (Rust + Python + TypeScript)"
|
|
239
|
+
else
|
|
240
|
+
if command -v just &> /dev/null; then
|
|
241
|
+
log_info "Running: just all-tests"
|
|
242
|
+
if just all-tests; then
|
|
243
|
+
log_success "All tests passed"
|
|
244
|
+
else
|
|
245
|
+
log_error "Tests failed"
|
|
246
|
+
FAILED=1
|
|
247
|
+
fi
|
|
248
|
+
else
|
|
249
|
+
log_warn "'just' not found, attempting individual test commands..."
|
|
250
|
+
|
|
251
|
+
# Try Rust tests
|
|
252
|
+
log_info "Running Rust tests..."
|
|
253
|
+
if cargo test -p domainforge-core --features cli; then
|
|
254
|
+
log_success "Rust tests passed"
|
|
255
|
+
else
|
|
256
|
+
log_error "Rust tests failed"
|
|
257
|
+
FAILED=1
|
|
258
|
+
fi
|
|
259
|
+
fi
|
|
260
|
+
fi
|
|
261
|
+
fi
|
|
262
|
+
|
|
263
|
+
# Check 7: Verify build works
|
|
264
|
+
log_step "Verifying release build..."
|
|
265
|
+
if $DRY_RUN; then
|
|
266
|
+
log_info "Would run: cargo build -p domainforge-core --release --features cli"
|
|
267
|
+
else
|
|
268
|
+
if cargo build -p domainforge-core --release --features cli 2>/dev/null; then
|
|
269
|
+
log_success "Release build successful"
|
|
270
|
+
else
|
|
271
|
+
log_error "Release build failed"
|
|
272
|
+
FAILED=1
|
|
273
|
+
fi
|
|
274
|
+
fi
|
|
275
|
+
|
|
276
|
+
# ============================================================================
|
|
277
|
+
# Summary
|
|
278
|
+
# ============================================================================
|
|
279
|
+
echo ""
|
|
280
|
+
echo "=============================================="
|
|
281
|
+
if [[ $FAILED -eq 0 ]]; then
|
|
282
|
+
log_success "All pre-release checks passed!"
|
|
283
|
+
echo "=============================================="
|
|
284
|
+
exit 0
|
|
285
|
+
else
|
|
286
|
+
log_error "Some pre-release checks failed"
|
|
287
|
+
echo "=============================================="
|
|
288
|
+
exit 1
|
|
289
|
+
fi
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Prepare rust test binary and update launch.json program path
|
|
3
|
+
set -euo pipefail
|
|
4
|
+
|
|
5
|
+
if [ -z "${1-}" ]; then
|
|
6
|
+
echo "Usage: $0 <test_name_prefix>"
|
|
7
|
+
echo "Example: $0 entity_tests"
|
|
8
|
+
exit 2
|
|
9
|
+
fi
|
|
10
|
+
|
|
11
|
+
PYTHON_BIN="${PYTHON_BIN:-python3}"
|
|
12
|
+
if ! command -v "${PYTHON_BIN}" >/dev/null 2>&1; then
|
|
13
|
+
if command -v python >/dev/null 2>&1; then
|
|
14
|
+
PYTHON_BIN="python"
|
|
15
|
+
else
|
|
16
|
+
echo "python3 (or python) is required to update launch.json" >&2
|
|
17
|
+
exit 1
|
|
18
|
+
fi
|
|
19
|
+
fi
|
|
20
|
+
|
|
21
|
+
TESTNAME=$1
|
|
22
|
+
ROOT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
|
|
23
|
+
SCRIPTS_DIR="$ROOT_DIR/scripts"
|
|
24
|
+
|
|
25
|
+
echo "Preparing debug binary for: $TESTNAME"
|
|
26
|
+
pushd "$ROOT_DIR" > /dev/null
|
|
27
|
+
log_file="$(mktemp)"
|
|
28
|
+
trap 'rm -f "$log_file"' EXIT
|
|
29
|
+
if ! "$SCRIPTS_DIR/find_and_link_test_binary.sh" "$TESTNAME" | tee "$log_file"; then
|
|
30
|
+
echo "Error: failed to locate or link debug binary" >&2
|
|
31
|
+
exit 1
|
|
32
|
+
fi
|
|
33
|
+
link_path="$(grep -v '^[[:space:]]*$' "$log_file" | tail -n 1)"
|
|
34
|
+
if [ -z "${link_path}" ]; then
|
|
35
|
+
echo "Error: linking script did not report the binary path" >&2
|
|
36
|
+
exit 1
|
|
37
|
+
fi
|
|
38
|
+
if [ ! -e "${link_path}" ]; then
|
|
39
|
+
echo "Error: linked binary not found at reported path: ${link_path}" >&2
|
|
40
|
+
exit 1
|
|
41
|
+
fi
|
|
42
|
+
if [ ! -f "${link_path}" ] && [ ! -L "${link_path}" ]; then
|
|
43
|
+
echo "Error: reported path is not a file or symlink: ${link_path}" >&2
|
|
44
|
+
exit 1
|
|
45
|
+
fi
|
|
46
|
+
trap - EXIT
|
|
47
|
+
rm -f "$log_file"
|
|
48
|
+
|
|
49
|
+
# Update launch.json program entry to point to the stable symlink
|
|
50
|
+
"${PYTHON_BIN}" "$SCRIPTS_DIR/update_launch_program.py" --program "${link_path}"
|
|
51
|
+
echo "Prepared debug program and updated launch.json"
|
|
52
|
+
popd > /dev/null
|