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.
Files changed (481) hide show
  1. package/.cargo/config.toml +6 -0
  2. package/.claude/settings.local.json +18 -0
  3. package/.coderabbit.yml +43 -0
  4. package/.codex/skills/release-management/SKILL.md +151 -0
  5. package/.codex/skills/release-management/agents/openai.yaml +4 -0
  6. package/.github/actions/decrypt-secrets/action.yml +121 -0
  7. package/.github/agents/Coder.agent.md +97 -0
  8. package/.github/agents/DeepResearch.agent.md +61 -0
  9. package/.github/chatmodes/tdd.vibepro.chatmode.md +1183 -0
  10. package/.github/copilot-instructions.md +13 -0
  11. package/.github/dependabot.yml +68 -0
  12. package/.github/workflows/README.md +165 -0
  13. package/.github/workflows/ci.yml +335 -0
  14. package/.github/workflows/dependabot-automerge.yml +114 -0
  15. package/.github/workflows/dependency-review.yml +27 -0
  16. package/.github/workflows/deploy.yml +87 -0
  17. package/.github/workflows/prepare-release.yml +168 -0
  18. package/.github/workflows/release-crates.yml +42 -0
  19. package/.github/workflows/release-npm.yml +137 -0
  20. package/.github/workflows/release-please.yml +29 -0
  21. package/.github/workflows/release-pypi.yml +96 -0
  22. package/.gitkeep +1 -0
  23. package/.release-please-manifest.json +5 -0
  24. package/.sea-registry.toml +10 -0
  25. package/.serena/project.yml +133 -0
  26. package/.sops.yaml +10 -0
  27. package/AGENTS.md +216 -0
  28. package/CHANGELOG.md +400 -0
  29. package/CLAUDE.md +62 -0
  30. package/CONTRIBUTING.md +323 -0
  31. package/Cargo.lock +3612 -0
  32. package/Cargo.toml +12 -0
  33. package/LICENSE +201 -0
  34. package/README.md +660 -0
  35. package/README_PYTHON.md +256 -0
  36. package/README_TYPESCRIPT.md +305 -0
  37. package/README_WASM.md +329 -0
  38. package/RELEASE_NOTES.md +41 -0
  39. package/bun.lock +378 -0
  40. package/bunfig.toml +11 -0
  41. package/check_output.txt +83 -0
  42. package/clippy_output.txt +80 -0
  43. package/commitlint.config.cjs +8 -0
  44. package/deny.toml +42 -0
  45. package/devbox.json +14 -0
  46. package/devbox.lock +76 -0
  47. package/docs/RELEASE_PROCESS.md +360 -0
  48. package/docs/diagnostics.md +161 -0
  49. package/docs/doc_guidelines.md +53 -0
  50. package/docs/explanations/README.md +21 -0
  51. package/docs/explanations/architecture-overview.md +109 -0
  52. package/docs/explanations/cross-language-binding-strategy.md +68 -0
  53. package/docs/explanations/graph-store-design.md +47 -0
  54. package/docs/explanations/performance-benchmarks.md +63 -0
  55. package/docs/explanations/policy-evaluation-logic.md +106 -0
  56. package/docs/explanations/semantic-modeling-concepts.md +109 -0
  57. package/docs/explanations/three-valued-logic.md +66 -0
  58. package/docs/explanations/versioning-strategy.md +45 -0
  59. package/docs/governance.md +168 -0
  60. package/docs/how-tos/README.md +46 -0
  61. package/docs/how-tos/ci-cd-validation.md +93 -0
  62. package/docs/how-tos/create-custom-units.md +125 -0
  63. package/docs/how-tos/define-policies.md +119 -0
  64. package/docs/how-tos/export-to-calm.md +110 -0
  65. package/docs/how-tos/export-to-protobuf.md +312 -0
  66. package/docs/how-tos/extend-grammar.md +133 -0
  67. package/docs/how-tos/generate-rdf-turtle.md +106 -0
  68. package/docs/how-tos/import-from-calm.md +114 -0
  69. package/docs/how-tos/import-from-sbvr.md +249 -0
  70. package/docs/how-tos/install-cli.md +126 -0
  71. package/docs/how-tos/parse-sea-files.md +132 -0
  72. package/docs/how-tos/policy-evaluation-modes.md +30 -0
  73. package/docs/how-tos/run-cross-language-tests.md +115 -0
  74. package/docs/how-tos/troubleshoot-napi-builds.md +55 -0
  75. package/docs/how-tos/use-modules-imports.md +285 -0
  76. package/docs/index.md +13 -0
  77. package/docs/plans/canonical-normalizer.md +121 -0
  78. package/docs/plans/cd_improvement.md +112 -0
  79. package/docs/plans/cli-ast.md +29 -0
  80. package/docs/plans/expression-bindings-and-normalizer-integration.md +174 -0
  81. package/docs/plans/protobuf_advanced_features_plan.md +597 -0
  82. package/docs/plans/protobuf_plan.yml +525 -0
  83. package/docs/plans/refactor_dsl_architecture.md +131 -0
  84. package/docs/plans/release-plan.md +163 -0
  85. package/docs/plans/sea_fmt_implementation_plan.md +516 -0
  86. package/docs/playbooks/README.md +18 -0
  87. package/docs/playbooks/adding-new-primitive.md +68 -0
  88. package/docs/playbooks/debugging-parser-failures.md +42 -0
  89. package/docs/playbooks/local-release-preparation.md +139 -0
  90. package/docs/playbooks/migrating-schema-versions.md +43 -0
  91. package/docs/playbooks/onboarding-contributors.md +64 -0
  92. package/docs/playbooks/releasing-beta.md +86 -0
  93. package/docs/playbooks/secret-management.md +64 -0
  94. package/docs/reference/README.md +199 -0
  95. package/docs/reference/ast-json-api.md +427 -0
  96. package/docs/reference/calm-mapping.md +519 -0
  97. package/docs/reference/cli-commands.md +588 -0
  98. package/docs/reference/configuration.md +202 -0
  99. package/docs/reference/error-codes.md +664 -0
  100. package/docs/reference/generated-artifacts-policy.md +53 -0
  101. package/docs/reference/grammar-spec.md +255 -0
  102. package/docs/reference/primitives-api.md +317 -0
  103. package/docs/reference/protobuf-api.md +426 -0
  104. package/docs/reference/python-api.md +485 -0
  105. package/docs/reference/registry.md +50 -0
  106. package/docs/reference/sea-dsl-ai-cheatsheet.yaml +913 -0
  107. package/docs/reference/security-model.md +74 -0
  108. package/docs/reference/typescript-api.md +508 -0
  109. package/docs/reference/wasm-api.md +420 -0
  110. package/docs/semantic-pack-review.md +144 -0
  111. package/docs/semantic-pack-signing.md +234 -0
  112. package/docs/semantic-packs.md +284 -0
  113. package/docs/specs/ADR-001-sea-dsl-semantic-source-of-truth.md +33 -0
  114. package/docs/specs/ADR-002-projection-first-class-construct.md +50 -0
  115. package/docs/specs/ADR-003-protobuf-projection-target.md +51 -0
  116. package/docs/specs/ADR-004-projection-compatibility-semantics.md +57 -0
  117. package/docs/specs/ADR-005-multi-language-support-strategy.md +112 -0
  118. package/docs/specs/ADR-006-error-handling-strategy.md +115 -0
  119. package/docs/specs/ADR-007-policy-evaluation-engine.md +95 -0
  120. package/docs/specs/ADR-008-knowledge-graph-integration.md +90 -0
  121. package/docs/specs/ADR-009-module-resolution-strategy.md +115 -0
  122. package/docs/specs/ADR-010-unit-system.md +106 -0
  123. package/docs/specs/PRD-001-sea-projection-framework.md +155 -0
  124. package/docs/specs/PRD-002-sea-cli-tooling.md +169 -0
  125. package/docs/specs/PRD-003-dsl-core-capabilities.md +275 -0
  126. package/docs/specs/README.md +62 -0
  127. package/docs/specs/SDS-001-protobuf-projection-engine.md +451 -0
  128. package/docs/specs/SDS-002-sea-core-architecture.md +268 -0
  129. package/docs/specs/SDS-003-parser-semantic-graph.md +377 -0
  130. package/docs/specs/SDS-004-policy-engine-design.md +362 -0
  131. package/docs/specs/SDS-005-knowledge-graph-module.md +364 -0
  132. package/docs/specs/SDS-006-calm-integration.md +367 -0
  133. package/docs/specs/SDS-007-sbvr-import.md +347 -0
  134. package/docs/templates/template_explanation.md +14 -0
  135. package/docs/templates/template_howto.md +21 -0
  136. package/docs/templates/template_playbook.md +21 -0
  137. package/docs/templates/template_reference.md +17 -0
  138. package/docs/templates/template_tutorial.md +24 -0
  139. package/docs/tutorials/README.md +12 -0
  140. package/docs/tutorials/first-sea-model.md +85 -0
  141. package/docs/tutorials/getting-started.md +98 -0
  142. package/docs/tutorials/python-binding-quickstart.md +107 -0
  143. package/docs/tutorials/typescript-binding-quickstart.md +91 -0
  144. package/docs/tutorials/wasm-in-browser.md +75 -0
  145. package/domainforge-core/CHANGELOG.md +138 -0
  146. package/domainforge-core/Cargo.toml +101 -0
  147. package/domainforge-core/MIGRATING.md +32 -0
  148. package/domainforge-core/README.md +197 -0
  149. package/domainforge-core/benchmark_results.txt +51 -0
  150. package/domainforge-core/build.rs +6 -0
  151. package/domainforge-core/deny.toml +31 -0
  152. package/domainforge-core/docs/specs/projections/sbvr_kg_mapping.md +43 -0
  153. package/domainforge-core/examples/basic.sea +7 -0
  154. package/domainforge-core/examples/cli/import_export_workflow.sh +38 -0
  155. package/domainforge-core/examples/cli/validate_example.sh +30 -0
  156. package/domainforge-core/examples/evolution_semantics.sea +31 -0
  157. package/domainforge-core/examples/parser_demo.rs +203 -0
  158. package/domainforge-core/grammar/sea.pest +408 -0
  159. package/domainforge-core/schemas/calm-v1.schema.json +170 -0
  160. package/domainforge-core/schemas/shacl/sea_shapes.ttl +19 -0
  161. package/domainforge-core/src/authority/compiler.rs +309 -0
  162. package/domainforge-core/src/authority/environment.rs +203 -0
  163. package/domainforge-core/src/authority/error.rs +164 -0
  164. package/domainforge-core/src/authority/fact_resolver.rs +224 -0
  165. package/domainforge-core/src/authority/mod.rs +25 -0
  166. package/domainforge-core/src/authority/pack.rs +133 -0
  167. package/domainforge-core/src/authority/policy.rs +224 -0
  168. package/domainforge-core/src/authority/resolver.rs +446 -0
  169. package/domainforge-core/src/authority/trace.rs +217 -0
  170. package/domainforge-core/src/authority/transform.rs +168 -0
  171. package/domainforge-core/src/authority/types.rs +617 -0
  172. package/domainforge-core/src/bin/domainforge.rs +25 -0
  173. package/domainforge-core/src/calm/export.rs +538 -0
  174. package/domainforge-core/src/calm/import.rs +1220 -0
  175. package/domainforge-core/src/calm/mod.rs +9 -0
  176. package/domainforge-core/src/calm/models.rs +108 -0
  177. package/domainforge-core/src/calm/sbvr_import.rs +9 -0
  178. package/domainforge-core/src/cli/authority.rs +149 -0
  179. package/domainforge-core/src/cli/format.rs +85 -0
  180. package/domainforge-core/src/cli/import.rs +133 -0
  181. package/domainforge-core/src/cli/mod.rs +64 -0
  182. package/domainforge-core/src/cli/normalize.rs +180 -0
  183. package/domainforge-core/src/cli/pack.rs +904 -0
  184. package/domainforge-core/src/cli/parse.rs +112 -0
  185. package/domainforge-core/src/cli/project.rs +294 -0
  186. package/domainforge-core/src/cli/registry.rs +41 -0
  187. package/domainforge-core/src/cli/test.rs +12 -0
  188. package/domainforge-core/src/cli/validate.rs +195 -0
  189. package/domainforge-core/src/cli/validate_kg.rs +80 -0
  190. package/domainforge-core/src/concept_id.rs +89 -0
  191. package/domainforge-core/src/error/diagnostics.rs +426 -0
  192. package/domainforge-core/src/error/fuzzy.rs +253 -0
  193. package/domainforge-core/src/error/mod.rs +13 -0
  194. package/domainforge-core/src/formatter/comments.rs +223 -0
  195. package/domainforge-core/src/formatter/config.rs +114 -0
  196. package/domainforge-core/src/formatter/mod.rs +22 -0
  197. package/domainforge-core/src/formatter/printer.rs +906 -0
  198. package/domainforge-core/src/graph/mod.rs +858 -0
  199. package/domainforge-core/src/graph/to_ast.rs +66 -0
  200. package/domainforge-core/src/kg.rs +1476 -0
  201. package/domainforge-core/src/kg_import.rs +251 -0
  202. package/domainforge-core/src/lib.rs +203 -0
  203. package/domainforge-core/src/module/mod.rs +1 -0
  204. package/domainforge-core/src/module/resolver.rs +260 -0
  205. package/domainforge-core/src/parser/ast.rs +2919 -0
  206. package/domainforge-core/src/parser/ast_convert.rs +494 -0
  207. package/domainforge-core/src/parser/ast_schema.rs +491 -0
  208. package/domainforge-core/src/parser/error.rs +291 -0
  209. package/domainforge-core/src/parser/lint.rs +39 -0
  210. package/domainforge-core/src/parser/mod.rs +193 -0
  211. package/domainforge-core/src/parser/printer.rs +702 -0
  212. package/domainforge-core/src/parser/profiles.rs +71 -0
  213. package/domainforge-core/src/parser/string_utils.rs +138 -0
  214. package/domainforge-core/src/patterns.rs +68 -0
  215. package/domainforge-core/src/policy/core.rs +1148 -0
  216. package/domainforge-core/src/policy/expression.rs +399 -0
  217. package/domainforge-core/src/policy/mod.rs +18 -0
  218. package/domainforge-core/src/policy/normalize.rs +1028 -0
  219. package/domainforge-core/src/policy/quantifier.rs +940 -0
  220. package/domainforge-core/src/policy/three_valued.rs +140 -0
  221. package/domainforge-core/src/policy/three_valued_microbench.rs +104 -0
  222. package/domainforge-core/src/policy/type_inference.rs +67 -0
  223. package/domainforge-core/src/policy/violation.rs +36 -0
  224. package/domainforge-core/src/primitives/concept_change.rs +61 -0
  225. package/domainforge-core/src/primitives/entity.rs +224 -0
  226. package/domainforge-core/src/primitives/flow.rs +111 -0
  227. package/domainforge-core/src/primitives/instance.rs +93 -0
  228. package/domainforge-core/src/primitives/mapping_contract.rs +50 -0
  229. package/domainforge-core/src/primitives/metric.rs +79 -0
  230. package/domainforge-core/src/primitives/mod.rs +25 -0
  231. package/domainforge-core/src/primitives/projection_contract.rs +50 -0
  232. package/domainforge-core/src/primitives/quantity.rs +56 -0
  233. package/domainforge-core/src/primitives/relation.rs +68 -0
  234. package/domainforge-core/src/primitives/resource.rs +237 -0
  235. package/domainforge-core/src/primitives/resource_instance.rs +88 -0
  236. package/domainforge-core/src/primitives/role.rs +49 -0
  237. package/domainforge-core/src/projection/buf.rs +404 -0
  238. package/domainforge-core/src/projection/contracts.rs +22 -0
  239. package/domainforge-core/src/projection/engine.rs +19 -0
  240. package/domainforge-core/src/projection/mod.rs +16 -0
  241. package/domainforge-core/src/projection/protobuf.rs +3331 -0
  242. package/domainforge-core/src/projection/registry.rs +43 -0
  243. package/domainforge-core/src/python/authority.rs +253 -0
  244. package/domainforge-core/src/python/error.rs +227 -0
  245. package/domainforge-core/src/python/formatter.rs +86 -0
  246. package/domainforge-core/src/python/graph.rs +366 -0
  247. package/domainforge-core/src/python/mod.rs +9 -0
  248. package/domainforge-core/src/python/policy.rs +651 -0
  249. package/domainforge-core/src/python/primitives.rs +796 -0
  250. package/domainforge-core/src/python/registry.rs +98 -0
  251. package/domainforge-core/src/python/semantic_pack.rs +619 -0
  252. package/domainforge-core/src/python/units.rs +96 -0
  253. package/domainforge-core/src/registry/mod.rs +432 -0
  254. package/domainforge-core/src/registry/tests.rs +210 -0
  255. package/domainforge-core/src/sbvr.rs +744 -0
  256. package/domainforge-core/src/semantic_pack/builder.rs +470 -0
  257. package/domainforge-core/src/semantic_pack/canonical_json.rs +184 -0
  258. package/domainforge-core/src/semantic_pack/diagnostics.rs +214 -0
  259. package/domainforge-core/src/semantic_pack/diff.rs +216 -0
  260. package/domainforge-core/src/semantic_pack/mod.rs +31 -0
  261. package/domainforge-core/src/semantic_pack/pack_set.rs +240 -0
  262. package/domainforge-core/src/semantic_pack/resolver.rs +437 -0
  263. package/domainforge-core/src/semantic_pack/review.rs +125 -0
  264. package/domainforge-core/src/semantic_pack/schema.rs +342 -0
  265. package/domainforge-core/src/semantic_pack/signing.rs +105 -0
  266. package/domainforge-core/src/semantic_pack/validator.rs +368 -0
  267. package/domainforge-core/src/semantic_version.rs +140 -0
  268. package/domainforge-core/src/test_utils.rs +12 -0
  269. package/domainforge-core/src/typescript/authority.rs +184 -0
  270. package/domainforge-core/src/typescript/error.rs +146 -0
  271. package/domainforge-core/src/typescript/formatter.rs +76 -0
  272. package/domainforge-core/src/typescript/graph.rs +391 -0
  273. package/domainforge-core/src/typescript/mod.rs +9 -0
  274. package/domainforge-core/src/typescript/policy.rs +564 -0
  275. package/domainforge-core/src/typescript/primitives.rs +784 -0
  276. package/domainforge-core/src/typescript/registry.rs +88 -0
  277. package/domainforge-core/src/typescript/semantic_pack.rs +470 -0
  278. package/domainforge-core/src/typescript/units.rs +76 -0
  279. package/domainforge-core/src/units/mod.rs +462 -0
  280. package/domainforge-core/src/uuid_module.rs +42 -0
  281. package/domainforge-core/src/validation_error.rs +818 -0
  282. package/domainforge-core/src/validation_result.rs +30 -0
  283. package/domainforge-core/src/wasm/authority.rs +192 -0
  284. package/domainforge-core/src/wasm/error.rs +145 -0
  285. package/domainforge-core/src/wasm/formatter.rs +69 -0
  286. package/domainforge-core/src/wasm/graph.rs +471 -0
  287. package/domainforge-core/src/wasm/mod.rs +16 -0
  288. package/domainforge-core/src/wasm/policy.rs +607 -0
  289. package/domainforge-core/src/wasm/primitives.rs +295 -0
  290. package/domainforge-core/src/wasm/semantic_pack.rs +471 -0
  291. package/domainforge-core/src/wasm/units.rs +62 -0
  292. package/domainforge-core/std/aws.sea +6 -0
  293. package/domainforge-core/std/core.sea +6 -0
  294. package/domainforge-core/std/http.sea +27 -0
  295. package/domainforge-core/tests/aggregation_enhanced_tests.rs +162 -0
  296. package/domainforge-core/tests/aggregation_eval_tests.rs +248 -0
  297. package/domainforge-core/tests/aggregation_integration_tests.rs +379 -0
  298. package/domainforge-core/tests/aggregation_parser_tests.rs +92 -0
  299. package/domainforge-core/tests/aggregation_tests.rs +102 -0
  300. package/domainforge-core/tests/authority_conformance_tests.rs +1173 -0
  301. package/domainforge-core/tests/calm_round_trip_tests.rs +283 -0
  302. package/domainforge-core/tests/calm_schema_validation_tests.rs +137 -0
  303. package/domainforge-core/tests/cast_operator_tests.rs +85 -0
  304. package/domainforge-core/tests/cli_binary_check.rs +37 -0
  305. package/domainforge-core/tests/cli_import_tests.rs +291 -0
  306. package/domainforge-core/tests/cli_path_traversal_tests.rs +124 -0
  307. package/domainforge-core/tests/cli_tests.rs +63 -0
  308. package/domainforge-core/tests/diagnostics_tests.rs +203 -0
  309. package/domainforge-core/tests/dimension_unit_tests.rs +80 -0
  310. package/domainforge-core/tests/entity_tests.rs +69 -0
  311. package/domainforge-core/tests/evolution_semantics_tests.rs +157 -0
  312. package/domainforge-core/tests/flow_tests.rs +78 -0
  313. package/domainforge-core/tests/flow_unit_validation_tests.rs +31 -0
  314. package/domainforge-core/tests/graph_integration_tests.rs +218 -0
  315. package/domainforge-core/tests/graph_tests.rs +626 -0
  316. package/domainforge-core/tests/import_parsing_tests.rs +23 -0
  317. package/domainforge-core/tests/instance_integration_tests.rs +98 -0
  318. package/domainforge-core/tests/instance_parsing_tests.rs +58 -0
  319. package/domainforge-core/tests/instance_tests.rs +61 -0
  320. package/domainforge-core/tests/kg_uri_encoding_tests.rs +53 -0
  321. package/domainforge-core/tests/lint_tests.rs +19 -0
  322. package/domainforge-core/tests/metric_tests.rs +143 -0
  323. package/domainforge-core/tests/module_resolution_tests.rs +100 -0
  324. package/domainforge-core/tests/namespace_registry_tests.rs +247 -0
  325. package/domainforge-core/tests/null_handling_tests.rs +26 -0
  326. package/domainforge-core/tests/parser_ast_v3.rs +53 -0
  327. package/domainforge-core/tests/parser_dimension_registry_tests.rs +20 -0
  328. package/domainforge-core/tests/parser_integration_tests.rs +294 -0
  329. package/domainforge-core/tests/parser_metadata_tests.rs +97 -0
  330. package/domainforge-core/tests/parser_resource_domain_only_graph_test.rs +21 -0
  331. package/domainforge-core/tests/parser_resource_limits_tests.rs +122 -0
  332. package/domainforge-core/tests/parser_tests.rs +512 -0
  333. package/domainforge-core/tests/pattern_semantics_tests.rs +87 -0
  334. package/domainforge-core/tests/phase_14_determinism_tests.rs +166 -0
  335. package/domainforge-core/tests/phase_15_validation_error_tests.rs +136 -0
  336. package/domainforge-core/tests/phase_16_unicode_tests.rs +248 -0
  337. package/domainforge-core/tests/phase_17_export_tests.rs +285 -0
  338. package/domainforge-core/tests/phase_17_round_trip_tests.rs +264 -0
  339. package/domainforge-core/tests/policy_tests.rs +635 -0
  340. package/domainforge-core/tests/primitives_integration_tests.rs +151 -0
  341. package/domainforge-core/tests/print_rdf_xml.rs +14 -0
  342. package/domainforge-core/tests/printer_tests.rs +204 -0
  343. package/domainforge-core/tests/profile_tests.rs +35 -0
  344. package/domainforge-core/tests/projection_contracts_tests.rs +154 -0
  345. package/domainforge-core/tests/protobuf_projection_tests.rs +199 -0
  346. package/domainforge-core/tests/quantity_tests.rs +41 -0
  347. package/domainforge-core/tests/rdf_xml_typed_literal_tests.rs +105 -0
  348. package/domainforge-core/tests/registry_schema_tests.rs +33 -0
  349. package/domainforge-core/tests/resource_tests.rs +50 -0
  350. package/domainforge-core/tests/resource_unit_tests.rs +24 -0
  351. package/domainforge-core/tests/roles_relations_tests.rs +61 -0
  352. package/domainforge-core/tests/round_trip_tests.rs +34 -0
  353. package/domainforge-core/tests/runtime_toggle_tests.rs +70 -0
  354. package/domainforge-core/tests/sbvr_fact_schema_tests.rs +60 -0
  355. package/domainforge-core/tests/sbvr_flow_facts_tests.rs +55 -0
  356. package/domainforge-core/tests/sbvr_parsing_tests.rs +53 -0
  357. package/domainforge-core/tests/semantic_pack_alias_resolution.rs +197 -0
  358. package/domainforge-core/tests/semantic_pack_build.rs +302 -0
  359. package/domainforge-core/tests/semantic_pack_consumer_smoke.rs +150 -0
  360. package/domainforge-core/tests/semantic_pack_pack_set.rs +160 -0
  361. package/domainforge-core/tests/semantic_pack_signing.rs +157 -0
  362. package/domainforge-core/tests/semantic_pack_three_valued.rs +250 -0
  363. package/domainforge-core/tests/semantic_pack_validate.rs +196 -0
  364. package/domainforge-core/tests/std_lib_tests.rs +37 -0
  365. package/domainforge-core/tests/temporal_evaluation_tests.rs +159 -0
  366. package/domainforge-core/tests/temporal_semantics_tests.rs +214 -0
  367. package/domainforge-core/tests/three_valued_quantifiers_tests.rs +164 -0
  368. package/domainforge-core/tests/turtle_entity_export_tests.rs +38 -0
  369. package/domainforge-core/tests/turtle_escaping_tests.rs +53 -0
  370. package/domainforge-core/tests/turtle_resource_export_tests.rs +34 -0
  371. package/domainforge-core/tests/type_inference_tests.rs +40 -0
  372. package/domainforge-core/tests/unicode_validation_tests.rs +169 -0
  373. package/domainforge-core/tests/unit_tests.rs +81 -0
  374. package/domainforge-core/tests/validate_tests.rs +38 -0
  375. package/domainforge-core/tests/validation_unit_mismatch_tests.rs +83 -0
  376. package/domainforge-core/tests/wasm_tests.rs +229 -0
  377. package/domainforge-python/CHANGELOG-python.md +12 -0
  378. package/domainforge-python/MIGRATING.md +24 -0
  379. package/domainforge-python/README.md +256 -0
  380. package/domainforge-python/domainforge/__init__.py +95 -0
  381. package/domainforge-python/domainforge/domainforge.pyi +519 -0
  382. package/domainforge-python/pyproject.toml +36 -0
  383. package/domainforge-typescript/CHANGELOG-typescript.md +12 -0
  384. package/domainforge-typescript/LICENSE +201 -0
  385. package/domainforge-typescript/MIGRATING.md +24 -0
  386. package/domainforge-typescript/README.md +305 -0
  387. package/domainforge-typescript/index.d.ts +452 -0
  388. package/domainforge-typescript/index.js +361 -0
  389. package/domainforge-typescript/package.json +60 -0
  390. package/example.js +61 -0
  391. package/examples/browser.html +366 -0
  392. package/examples/namespaces/finance/cashflow.sea +5 -0
  393. package/examples/namespaces/logistics/core.sea +7 -0
  394. package/examples/observability_metrics.sea +38 -0
  395. package/fixtures/semantic_packs/acme_procurement/domain/entities.sea +39 -0
  396. package/fixtures/semantic_packs/acme_procurement/domain/metrics.sea +11 -0
  397. package/fixtures/semantic_packs/acme_procurement/domain/relations.sea +7 -0
  398. package/fixtures/semantic_packs/acme_procurement/domain/resources.sea +9 -0
  399. package/fixtures/semantic_packs/acme_procurement/review/acme.procurement.semantic-review.jsonl +7 -0
  400. package/fixtures/semantic_packs/acme_procurement/tests/ambiguous_vendor_alias.sea +8 -0
  401. package/fixtures/semantic_packs/acme_procurement/tests/deprecated_vendor_alias.sea +8 -0
  402. package/fixtures/semantic_packs/acme_procurement/tests/invalid_relation.sea +3 -0
  403. package/fixtures/semantic_packs/acme_procurement/tests/proposed_concept.sea +8 -0
  404. package/fixtures/semantic_packs/acme_procurement/tests/rejected_concept.sea +8 -0
  405. package/fixtures/semantic_packs/acme_procurement/tests/unit_mismatch.sea +7 -0
  406. package/fixtures/semantic_packs/acme_procurement/tests/unknown_vendor_policy.sea +8 -0
  407. package/fixtures/semantic_packs/acme_procurement/tests/valid_purchase_policy.sea +8 -0
  408. package/index.d.ts +2 -0
  409. package/index.js +8 -0
  410. package/justfile +200 -0
  411. package/lefthook.yml +13 -0
  412. package/lib/validate_native_exports.d.ts +4 -0
  413. package/lib/validate_native_exports.js +12 -0
  414. package/package.json +22 -0
  415. package/pytest.ini +5 -0
  416. package/python/tests/test_registry.py +75 -0
  417. package/python/tests/test_units.py +18 -0
  418. package/release-please-config.json +49 -0
  419. package/requirements-dev.txt +3 -0
  420. package/requirements.txt +3 -0
  421. package/rust-toolchain.toml +3 -0
  422. package/schemas/ast-v1.schema.json +72 -0
  423. package/schemas/ast-v2.schema.json +1200 -0
  424. package/schemas/ast-v3.schema.json +1200 -0
  425. package/schemas/sea-registry.schema.json +45 -0
  426. package/scripts/build-python.sh +37 -0
  427. package/scripts/build-release.sh +279 -0
  428. package/scripts/build-typescript.sh +13 -0
  429. package/scripts/build-wasm.sh +113 -0
  430. package/scripts/bump-version.sh +245 -0
  431. package/scripts/check_unused_test_imports.py +85 -0
  432. package/scripts/ci_tasks.py +379 -0
  433. package/scripts/clear_debug_test.sh +10 -0
  434. package/scripts/create-github-release.sh +262 -0
  435. package/scripts/create-tag.sh +203 -0
  436. package/scripts/find_and_link_test_binary.sh +70 -0
  437. package/scripts/generate-changelog.sh +271 -0
  438. package/scripts/generate-release-notes.sh +205 -0
  439. package/scripts/lint_release_security.py +96 -0
  440. package/scripts/lint_release_workflows.py +82 -0
  441. package/scripts/lint_workflow_gates.py +113 -0
  442. package/scripts/optimized-wasm-build.sh +61 -0
  443. package/scripts/patch_napi_types.py +62 -0
  444. package/scripts/pre-release-check.sh +289 -0
  445. package/scripts/prepare_rust_debug.sh +52 -0
  446. package/scripts/release.sh +373 -0
  447. package/scripts/resolve_rust_binary.py +230 -0
  448. package/scripts/run_commitlint.sh +29 -0
  449. package/scripts/test-all.sh +77 -0
  450. package/scripts/update_launch_program.py +93 -0
  451. package/secrets/README.md +27 -0
  452. package/secrets/secrets.yaml +21 -0
  453. package/test_integration.py +67 -0
  454. package/tests/test_authority.py +328 -0
  455. package/tests/test_ci_tasks.py +143 -0
  456. package/tests/test_expression.py +256 -0
  457. package/tests/test_golden_payment_flow.py +42 -0
  458. package/tests/test_graph.py +127 -0
  459. package/tests/test_instance.py +136 -0
  460. package/tests/test_parser.py +82 -0
  461. package/tests/test_primitives.py +68 -0
  462. package/tests/test_role_relation_parity.py +56 -0
  463. package/tests/test_runtime_toggle.py +156 -0
  464. package/tests/test_semantic_pack.py +639 -0
  465. package/tests/test_three_valued_eval.py +159 -0
  466. package/tsconfig.json +30 -0
  467. package/typescript-tests/advanced.test.ts +165 -0
  468. package/typescript-tests/authority.test.ts +216 -0
  469. package/typescript-tests/expression.test.ts +228 -0
  470. package/typescript-tests/golden-payment-flow.test.ts +51 -0
  471. package/typescript-tests/graph.test.ts +142 -0
  472. package/typescript-tests/native-binding.test.ts +20 -0
  473. package/typescript-tests/primitives.test.ts +88 -0
  474. package/typescript-tests/registry.test.ts +122 -0
  475. package/typescript-tests/role_relation.test.ts +63 -0
  476. package/typescript-tests/runtime_toggle.test.ts +141 -0
  477. package/typescript-tests/semantic-pack.test.ts +556 -0
  478. package/typescript-tests/three_valued_eval.test.ts +135 -0
  479. package/typescript-tests/units.test.ts +36 -0
  480. package/vitest.config.ts +13 -0
  481. package/wasm_demo.html +225 -0
@@ -0,0 +1,234 @@
1
+ # Semantic Pack Signing and Verification
2
+
3
+ Semantic packs use Ed25519 detached signatures to provide tamper evidence and authenticity verification. This document describes the signing algorithm, payload format, CLI commands, and how the LSP and CI handle signature states.
4
+
5
+ ## Signing Algorithm
6
+
7
+ DomainForge uses **Ed25519** (Edwards-curve Digital Signature Algorithm) for pack signing. Ed25519 provides:
8
+
9
+ - 128-bit security level.
10
+ - Deterministic signatures (no randomness in signature generation).
11
+ - Compact signatures (64 bytes).
12
+ - Fast verification.
13
+
14
+ The implementation uses the `ed25519-dalek` crate with PKCS#8 PEM key encoding.
15
+
16
+ ## Signature Payload Format
17
+
18
+ The signing payload is a UTF-8 byte string with the following format:
19
+
20
+ ```
21
+ DOMAINFORGE_SEMANTIC_PACK_V0_3\n<content_hash>\n<pack_id>\n<schema_version>\n
22
+ ```
23
+
24
+ Where:
25
+
26
+ - `DOMAINFORGE_SEMANTIC_PACK_V0_3` is a fixed domain separation string.
27
+ - `<content_hash>` is the pack content hash (SHA-256) with signature fields excluded.
28
+ - `<pack_id>` is the pack's unique identifier (e.g., `acme/logistics/1.1.0`).
29
+ - `<schema_version>` is the pack schema version (e.g., `0.3`).
30
+
31
+ The trailing newline ensures the payload is unambiguous when concatenated.
32
+
33
+ ## Pack Content Hash
34
+
35
+ The pack content hash is computed over the canonical JSON representation of the pack with all signature fields cleared:
36
+
37
+ ```rust
38
+ // Fields cleared before hashing:
39
+ pack.trust.signature = None;
40
+ pack.trust.signature_state = Unsigned;
41
+ ```
42
+
43
+ This means:
44
+
45
+ - Signing a pack does not change its content hash.
46
+ - The content hash is deterministic regardless of signature state.
47
+ - Two packs with identical semantic content but different signatures have the same content hash.
48
+
49
+ The canonicalization process sorts all keys, arrays, and sub-objects deterministically to ensure reproducible hashes across builds.
50
+
51
+ ## CLI Commands
52
+
53
+ ### Signing a Pack
54
+
55
+ ```bash
56
+ domainforge pack sign <pack-path> --key <private-key.pem>
57
+ ```
58
+
59
+ Options:
60
+
61
+ | Option | Description |
62
+ |---------------|-----------------------------------------------|
63
+ | `<pack-path>` | Path to the unsigned pack JSON file. |
64
+ | `--key` | Path to the Ed25519 private key (PEM format). |
65
+ | `--out` | (Optional) Output path for the signed pack. |
66
+
67
+ When `--out` is omitted, the signed pack is written to stdout. To overwrite the input file in-place, use `--out <pack-path>` (back up the original first).
68
+
69
+ The command reads the pack, computes the content hash, signs the payload, and writes the signed pack with the `trust` fields updated:
70
+
71
+ ```json
72
+ {
73
+ "trust": {
74
+ "approval_state": "approved",
75
+ "signature_state": "signed",
76
+ "signed_by": "pack-filename",
77
+ "signature_alg": "ed25519",
78
+ "signature": "<base64-encoded-signature>"
79
+ }
80
+ }
81
+ ```
82
+
83
+ Example:
84
+
85
+ ```bash
86
+ domainforge pack sign packs/acme-logistics-1.1.0.json \
87
+ --key keys/acme-private.pem \
88
+ --out packs/acme-logistics-1.1.0-signed.json
89
+ ```
90
+
91
+ ### Verifying a Pack Signature
92
+
93
+ ```bash
94
+ domainforge pack verify <pack-path> --key <public-key.pem>
95
+ ```
96
+
97
+ Options:
98
+
99
+ | Option | Description |
100
+ |---------------|-----------------------------------------------|
101
+ | `<pack-path>` | Path to the signed pack JSON file. |
102
+ | `--key` | Path to the Ed25519 public key (PEM format). |
103
+
104
+ The command:
105
+
106
+ 1. Reads the pack.
107
+ 2. Computes the content hash (excluding signature fields).
108
+ 3. Reconstructs the signing payload.
109
+ 4. Decodes the base64 signature from the pack.
110
+ 5. Verifies the Ed25519 signature against the public key.
111
+
112
+ Example:
113
+
114
+ ```bash
115
+ domainforge pack verify packs/acme-logistics-1.1.0-signed.json \
116
+ --key keys/acme-public.pem
117
+ ```
118
+
119
+ ## Exit Codes
120
+
121
+ | Code | Meaning |
122
+ |------|-----------------------------------------|
123
+ | 0 | Signature is valid. |
124
+ | 3 | Pack is unsigned (no signature present).|
125
+ | 4 | Signature is invalid or has been tampered with. |
126
+
127
+ The `domainforge pack validate` command uses these same codes when `--require-signature` is set:
128
+
129
+ ```bash
130
+ # Exit 3 if unsigned
131
+ domainforge pack validate --pack packs/unsigned.json --require-signature models/*.sea
132
+
133
+ # Exit 4 if signature is invalid
134
+ domainforge pack validate --pack packs/tampered.json --require-signature models/*.sea
135
+ ```
136
+
137
+ ## LSP Behavior
138
+
139
+ The DomainForge LSP adjusts its behavior based on the pack's signature state:
140
+
141
+ | Signature State | LSP Behavior |
142
+ |--------------------|-------------------------------------------------------------------------|
143
+ | `unsigned` | Loads the pack in **warn mode**. All features are available but a diagnostic warns that the pack is unsigned. |
144
+ | `signed` | Full functionality with no warnings. |
145
+ | `invalid_signature`| Pack features are **disabled**. The LSP reports a critical error and does not use the pack for resolution. |
146
+
147
+ In practice, unsigned packs are common during development. Teams should sign packs before merging to main branches.
148
+
149
+ ## CI Strict Behavior
150
+
151
+ When `--mode strict --require-signature` is set:
152
+
153
+ - Unsigned packs cause the validation to fail with exit code 3.
154
+ - Invalid signatures cause the validation to fail with exit code 4.
155
+ - The `--expected-hash` flag provides additional tamper protection by pinning the expected content hash.
156
+
157
+ ```bash
158
+ domainforge pack validate \
159
+ --pack packs/acme-logistics-1.1.0-signed.json \
160
+ --mode strict \
161
+ --require-signature \
162
+ --expected-hash sha256:abc123def456... \
163
+ models/**/*.sea
164
+ ```
165
+
166
+ If the pack's content hash does not match `--expected-hash`, the command exits with code 4 regardless of signature validity.
167
+
168
+ ## Generating Ed25519 Keys
169
+
170
+ Use `openssl` to generate Ed25519 key pairs:
171
+
172
+ ### Generate a Private Key
173
+
174
+ ```bash
175
+ openssl genpkey -algorithm Ed25519 -out acme-private.pem
176
+ ```
177
+
178
+ ### Extract the Public Key
179
+
180
+ ```bash
181
+ openssl pkey -in acme-private.pem -pubout -out acme-public.pem
182
+ ```
183
+
184
+ ### Verify Key Format
185
+
186
+ Private keys should be in PKCS#8 PEM format. Do not commit real private keys; generate them locally at runtime or in CI.
187
+
188
+ ```
189
+ <PKCS#8 PEM-encoded Ed25519 private key generated locally>
190
+ ```
191
+
192
+ Public keys should be in SPKI PEM format:
193
+
194
+ ```
195
+ <SPKI PEM-encoded Ed25519 public key corresponding to that generated key>
196
+ ```
197
+
198
+ ## Expected-Hash Pinning
199
+
200
+ For environments where defense-in-depth is required, the `--expected-hash` flag pins the expected content hash of the pack. This provides tamper protection even if the signing key is compromised:
201
+
202
+ ```bash
203
+ EXPECTED_HASH=$(domainforge pack inspect --pack packs/acme-logistics-1.1.0.json --format json | jq -r '.content_hash')
204
+
205
+ # Store the hash in CI configuration
206
+ echo "PACK_HASH=$EXPECTED_HASH" >> ci.env
207
+
208
+ # Later, in CI:
209
+ domainforge pack validate \
210
+ --pack packs/acme-logistics-1.1.0-signed.json \
211
+ --require-signature \
212
+ --expected-hash "$PACK_HASH" \
213
+ models/**/*.sea
214
+ ```
215
+
216
+ The content hash is computed with signature fields excluded, so it remains stable across signing and verification operations.
217
+
218
+ ## Signature Verification Errors
219
+
220
+ The verifier reports specific error types:
221
+
222
+ | Error | Cause |
223
+ |------------------------------|----------------------------------------------------------|
224
+ | `MissingSignature` | The pack has no `signature` field in `trust`. |
225
+ | `InvalidSignatureFormat` | The base64 signature cannot be decoded to 64 bytes. |
226
+ | `InvalidSignature` | The Ed25519 signature does not verify against the public key and payload. |
227
+ | `KeyParseError` | The public key PEM is malformed or not Ed25519. |
228
+ | `Base64Error` | The signature base64 encoding is invalid. |
229
+
230
+ ## See Also
231
+
232
+ - [Semantic Packs](semantic-packs.md) for the overall pack system.
233
+ - [Semantic Pack Review Process](semantic-pack-review.md) for the review gate that precedes signing.
234
+ - [Semantic Diagnostic Codes](diagnostics.md) for `pack_unsigned` and `pack_signature_invalid` codes.
@@ -0,0 +1,284 @@
1
+ # Semantic Packs
2
+
3
+ A **semantic pack** is a deterministic, review-gated, signed JSON artifact that defines an organization's approved vocabulary of business concepts, relations, metrics, dimensions, units, aliases, and mapping rules.
4
+
5
+ Semantic packs act as a contract between the people who define business terminology and the tools that consume it. Every concept in a pack carries a human-reviewed definition, an owner, and a cryptographic hash of its semantic content. Downstream consumers---the DomainForge LSP, CI validators, and the SEA-Forge pipeline---resolve .sea source terms against the pack and emit structured diagnostics when terms are unknown, ambiguous, deprecated, or rejected.
6
+
7
+ ## What a Semantic Pack Is
8
+
9
+ A semantic pack captures:
10
+
11
+ - **Concepts**: the core nouns of your domain---entities, resources, roles, flows, policies, metrics, dimensions, and units.
12
+ - **Relations**: typed predicates between concepts (e.g., `processes`, `owned_by`).
13
+ - **Metrics and dimensions**: observability definitions with unit and dimension bindings.
14
+ - **Aliases**: alternative names mapped to canonical concepts, each with a status (`approved`, `deprecated`, `ambiguous`, `blocked`).
15
+ - **Mapping rules**: cross-domain or cross-system term mappings with confidence scores.
16
+
17
+ Each pack is a self-contained JSON document with a stable content hash, a meaning fingerprint, and a review manifest hash. Two builds from identical inputs produce bit-for-bit identical output.
18
+
19
+ ## What a Semantic Pack Is Not
20
+
21
+ - Not an embedding model or vector similarity index.
22
+ - Not a customer-specific LSP binary---the LSP loads packs dynamically.
23
+ - Not an ontology governance workflow UI---packs are the artifact that governance tooling produces.
24
+
25
+ ## Pack Authority States
26
+
27
+ Every pack carries a `trust` object with two orthogonal dimensions: **approval state** and **signature state**.
28
+
29
+ | Approval State | Signature State | What It Powers |
30
+ |---------------------|-----------------|-----------------------------------------------------|
31
+ | `candidate` | `unsigned` | Local development, IDE exploration |
32
+ | `approved` | `unsigned` | CI warn mode, LSP with warnings, pre-release checks |
33
+ | `approved` | `signed` | CI strict mode, SEA-Forge production pipeline |
34
+ | `rejected` | any | Nothing---rejected packs block downstream use |
35
+
36
+ An approved-but-unsigned pack allows teams to iterate on definitions while still enforcing review coverage. Moving to `signed` is the final gate before production use.
37
+
38
+ ## Three-Valued Semantic Truth
39
+
40
+ DomainForge uses three-valued logic for concept resolution:
41
+
42
+ | Truth Value | Meaning |
43
+ |-------------|----------------------------------------------------------------|
44
+ | `valid` | The term resolved to an active, reviewed concept. |
45
+ | `invalid` | The term resolved to a rejected concept or a blocked alias. |
46
+ | `unknown` | The term could not be resolved, or resolved to a proposed concept, or is ambiguous. |
47
+
48
+ `unknown` stays distinct from `invalid` even when mapped to an error severity in strict mode. An `unknown` result means "we lack enough information to confirm or deny"---the tooling should encourage the user to add a definition or resolve the ambiguity rather than treat it as a hard rejection.
49
+
50
+ This separation lets the LSP offer "add to pack" quick-fix suggestions for `unknown` terms while still surfacing `invalid` terms as genuine errors.
51
+
52
+ ## Pack Lifecycle
53
+
54
+ ```
55
+ candidate --> approved_unsigned --> approved_signed --> retired/revoked
56
+ | ^
57
+ +---- rejected ------------------------+
58
+ ```
59
+
60
+ 1. **Candidate**: Built from .sea source files. No review required. Suitable for local exploration.
61
+ 2. **Approved (unsigned)**: All active concepts have matching review records with `approve` or `minor_amendment_no_semantic_change` decisions. Definition hashes are verified. Meaning version has been bumped if the fingerprint changed.
62
+ 3. **Approved (signed)**: An Ed25519 detached signature covers the pack content hash. The signing payload includes the content hash, pack ID, and schema version.
63
+ 4. **Retired/Revoked**: Listed in `replaces_pack_ids` of a successor pack. Downstream tools should treat retired packs as deprecated and redirect to the replacement.
64
+
65
+ A pack never transitions backward. Once approved, it cannot return to candidate. Once signed, the signature can only be invalidated (tampered) or superseded by a new signed version.
66
+
67
+ ## Compatibility and Versioning
68
+
69
+ Each pack carries several versioning fields:
70
+
71
+ | Field | Purpose |
72
+ |------------------------|-------------------------------------------------------------------------|
73
+ | `schema_version` | The pack JSON schema version. Currently `0.3`. |
74
+ | `pack_version` | Semver for the pack artifact itself (e.g., `1.2.0`). |
75
+ | `meaning_version` | Semver for the semantic content. Must be bumped when `meaning_fingerprint` changes. |
76
+ | `meaning_fingerprint` | SHA-256 hash of all concept definition records. Changes when any concept definition, status, or decision_ref changes. |
77
+ | `replaces_pack_ids` | List of pack IDs that this pack supersedes. |
78
+
79
+ The build system enforces that `meaning_version` increases whenever `meaning_fingerprint` changes. A pack that changes meaning without bumping the version fails the build with `meaning_version_not_bumped`.
80
+
81
+ ## CLI Examples
82
+
83
+ ### Building a Pack
84
+
85
+ Build a candidate pack from .sea source files:
86
+
87
+ ```bash
88
+ domainforge pack build \
89
+ --source "models/**/*.sea" \
90
+ --org acme \
91
+ --domain logistics \
92
+ --version 1.0.0 \
93
+ --meaning-version 1.0.0 \
94
+ --approval candidate \
95
+ --out packs/acme-logistics-1.0.0.json
96
+ ```
97
+
98
+ Build an approved pack with review records:
99
+
100
+ ```bash
101
+ domainforge pack build \
102
+ --source "models/**/*.sea" \
103
+ --org acme \
104
+ --domain logistics \
105
+ --version 1.1.0 \
106
+ --meaning-version 1.1.0 \
107
+ --approval approved \
108
+ --review reviews/logistics-review.jsonl \
109
+ --previous-pack packs/acme-logistics-1.0.0.json \
110
+ --out packs/acme-logistics-1.1.0.json
111
+ ```
112
+
113
+ For the first approved pack in a domain, use `--allow-first-approved-version`:
114
+
115
+ ```bash
116
+ domainforge pack build \
117
+ --source "models/**/*.sea" \
118
+ --org acme \
119
+ --domain logistics \
120
+ --version 1.0.0 \
121
+ --meaning-version 1.0.0 \
122
+ --approval approved \
123
+ --review reviews/logistics-review.jsonl \
124
+ --allow-first-approved-version \
125
+ --out packs/acme-logistics-1.0.0.json
126
+ ```
127
+
128
+ ### Validating Against a Pack
129
+
130
+ Validate .sea files against a pack in warn mode:
131
+
132
+ ```bash
133
+ domainforge pack validate \
134
+ --pack packs/acme-logistics-1.1.0.json \
135
+ --mode warn \
136
+ models/payment.sea models/shipping.sea
137
+ ```
138
+
139
+ Validate in strict mode with signature required:
140
+
141
+ ```bash
142
+ domainforge pack validate \
143
+ --pack packs/acme-logistics-1.1.0.json \
144
+ --mode strict \
145
+ --require-signature \
146
+ --expected-hash sha256:abc123... \
147
+ models/**/*.sea
148
+ ```
149
+
150
+ ### Inspecting a Pack
151
+
152
+ ```bash
153
+ domainforge pack inspect --pack packs/acme-logistics-1.1.0.json
154
+
155
+ # JSON output for tooling
156
+ domainforge pack inspect --pack packs/acme-logistics-1.1.0.json --format json
157
+ ```
158
+
159
+ ### Diffing Two Packs
160
+
161
+ ```bash
162
+ domainforge pack diff \
163
+ --old packs/acme-logistics-1.0.0.json \
164
+ --new packs/acme-logistics-1.1.0.json
165
+
166
+ # JSON output
167
+ domainforge pack diff \
168
+ --old packs/acme-logistics-1.0.0.json \
169
+ --new packs/acme-logistics-1.1.0.json \
170
+ --format json
171
+ ```
172
+
173
+ Diff classifications:
174
+
175
+ | Classification | Meaning |
176
+ |------------------------|--------------------------------------------------------|
177
+ | `additive` | New concept added. |
178
+ | `definitional_change` | Definition hash changed (non-breaking). |
179
+ | `deprecating` | Concept status changed to deprecated. |
180
+ | `breaking` | Active concept removed, or meaning changed without version bump. |
181
+ | `governance_critical` | Status transition that is not deprecated or rejected. |
182
+ | `signature_only` | Only the signature changed, semantic content is identical. |
183
+
184
+ ### Signing and Verifying
185
+
186
+ ```bash
187
+ # Sign a pack
188
+ domainforge pack sign packs/acme-logistics-1.1.0.json --key keys/acme-private.pem --out packs/acme-logistics-1.1.0-signed.json
189
+
190
+ # Verify a pack signature
191
+ domainforge pack verify packs/acme-logistics-1.1.0-signed.json --key keys/acme-public.pem
192
+ ```
193
+
194
+ ## Workspace Configuration
195
+
196
+ Add a `.domainforge/config.json` to your project root to configure pack resolution:
197
+
198
+ ```json
199
+ {
200
+ "semantic_packs": [
201
+ {
202
+ "path": "packs/acme-logistics-1.1.0.json",
203
+ "priority": 0
204
+ },
205
+ {
206
+ "path": "packs/acme-shared-2.0.0.json",
207
+ "priority": 1
208
+ }
209
+ ],
210
+ "validation_mode": "warn",
211
+ "deprecated_policy": "warn",
212
+ "require_signed_packs": false
213
+ }
214
+ ```
215
+
216
+ The LSP reads this configuration on startup and resolves terms against the configured packs in priority order.
217
+
218
+ ## CI Strict Mode
219
+
220
+ For CI pipelines that enforce semantic correctness:
221
+
222
+ ```bash
223
+ #!/bin/bash
224
+ set -euo pipefail
225
+
226
+ # Build and sign the pack
227
+ domainforge pack build \
228
+ --source "models/**/*.sea" \
229
+ --org "$ORG" \
230
+ --domain "$DOMAIN" \
231
+ --version "$VERSION" \
232
+ --meaning-version "$MEANING_VERSION" \
233
+ --approval approved \
234
+ --review "reviews/review.jsonl" \
235
+ --previous-pack "packs/previous.json" \
236
+ --out "packs/current-unsigned.json"
237
+
238
+ domainforge pack sign "packs/current-unsigned.json" \
239
+ --key "$SIGNING_KEY_PATH" \
240
+ --out "packs/current.json"
241
+
242
+ # Validate all source files in strict mode
243
+ domainforge pack validate \
244
+ --pack "packs/current.json" \
245
+ --mode strict \
246
+ --require-signature \
247
+ --expected-hash "$EXPECTED_HASH" \
248
+ models/**/*.sea
249
+ ```
250
+
251
+ Exit codes for pack validation:
252
+
253
+ | Code | Meaning |
254
+ |------|----------------------------------|
255
+ | 0 | Validation passed. |
256
+ | 1 | Semantic validation failed. |
257
+ | 2 | Parse error in input file. |
258
+ | 3 | Pack unsigned when required. |
259
+ | 4 | Signature verification failed. |
260
+
261
+ ## Consumer Contract
262
+
263
+ Downstream tools that consume semantic packs must follow these rules:
264
+
265
+ 1. **Never modify a pack in place.** Treat packs as immutable artifacts. To change vocabulary, build a new pack version.
266
+ 2. **Always verify the signature before trusting content.** Unsigned packs are acceptable in development; signed packs are required in production.
267
+ 3. **Respect the three-valued truth.** Map `unknown` to actionable suggestions, not hard errors, unless in strict mode.
268
+ 4. **Check `meaning_version` before `pack_version`.** A meaning change without a version bump is a bug, not a feature.
269
+ 5. **Use `normalize_lookup_key` for term matching.** The normalization algorithm (NFC, case-fold, whitespace collapse) is the canonical equality function for lookup keys.
270
+ 6. **Honor `replaces_pack_ids`.** When loading multiple packs, redirect references to superseded packs to the replacement.
271
+
272
+ ### Consumers
273
+
274
+ - **Context Kernel**: Uses packs to build context windows for LLM-assisted architecture modeling.
275
+ - **SWE_SEED**: Uses packs to validate that generated code references approved business concepts.
276
+ - **SEA-Forge Pipeline**: Uses signed packs as the authoritative vocabulary for production code generation.
277
+ - **DomainForge LSP**: Loads packs at workspace initialization and provides real-time diagnostics.
278
+
279
+ ## See Also
280
+
281
+ - [Semantic Pack Review Process](semantic-pack-review.md)
282
+ - [Semantic Pack Signing and Verification](semantic-pack-signing.md)
283
+ - [Semantic Diagnostic Codes](diagnostics.md)
284
+ - [Semantic Modeling Concepts](explanations/semantic-modeling-concepts.md)
@@ -0,0 +1,33 @@
1
+ # ADR-001: Treat SEA-DSL as the Semantic Source of Truth
2
+
3
+ **Status:** Accepted
4
+ **Date:** 2025-12-14
5
+ **Deciders:** DomainForge Architecture Team
6
+
7
+ ## Context
8
+
9
+ SEA-DSL models enterprise meaning using constructs such as `Entity`, `Resource`, `Flow`, `Policy`, `Metric`, and `ConceptChange`. There is a need to generate schemas, code, and runtime contracts (DDD/Hex, Protobuf, JSON, XML) without collapsing the DSL into a schema-first or implementation-first language.
10
+
11
+ ## Decision
12
+
13
+ SEA-DSL SHALL remain a **semantic language only**.
14
+
15
+ All schemas, code artifacts, and runtime contracts SHALL be produced via **projection engines** from the semantic graph.
16
+
17
+ ## Consequences
18
+
19
+ ### Positive
20
+
21
+ - SEA-DSL remains stable, expressive, and technology-agnostic.
22
+ - Multiple projections (Protobuf, DDD manifests, GraphQL, etc.) can coexist.
23
+ - Schema evolution is governed by semantic evolution, not implementation drift.
24
+
25
+ ### Negative
26
+
27
+ - Requires additional tooling (projection engines) to produce usable artifacts.
28
+ - Learning curve for users who expect schema-first approaches.
29
+
30
+ ## Related
31
+
32
+ - [ADR-002: Introduce Projection as a First-Class DSL Construct](./ADR-002-projection-first-class-construct.md)
33
+ - [ADR-003: Add Protobuf as a Projection Target](./ADR-003-protobuf-projection-target.md)
@@ -0,0 +1,50 @@
1
+ # ADR-002: Introduce Projection as a First-Class DSL Construct
2
+
3
+ **Status:** Accepted
4
+ **Date:** 2025-12-14
5
+ **Deciders:** DomainForge Architecture Team
6
+
7
+ ## Context
8
+
9
+ Enterprises need explicit, governable control over _which_ parts of the semantic model are projected _where_, _for whom_, and _under what compatibility guarantees_.
10
+
11
+ ## Decision
12
+
13
+ Introduce a top-level `Projection` construct in SEA-DSL that:
14
+
15
+ - Declares **scope** (namespace, tags, profiles)
16
+ - Declares **target format** (protobuf, ddd-manifest, etc.)
17
+ - Declares **governance metadata** (stability, compatibility, audience)
18
+
19
+ Projection constructs SHALL NOT contain format-specific details.
20
+
21
+ ### Example Syntax
22
+
23
+ ```sea
24
+ Projection PaymentsProto {
25
+ source: "com.example.finance.payments"
26
+ format: protobuf
27
+ compatibility: backward
28
+ stability: stable
29
+ audience: ["agents", "services"]
30
+ }
31
+ ```
32
+
33
+ ## Consequences
34
+
35
+ ### Positive
36
+
37
+ - Projections are auditable and declarative.
38
+ - Compatibility rules can be enforced centrally.
39
+ - Multiple consumers (agents, services, pipelines) can rely on explicit contracts.
40
+
41
+ ### Negative
42
+
43
+ - Adds complexity to the DSL grammar.
44
+ - Requires governance tooling to validate projection declarations.
45
+
46
+ ## Related
47
+
48
+ - [ADR-001: Treat SEA-DSL as the Semantic Source of Truth](./ADR-001-sea-dsl-semantic-source-of-truth.md)
49
+ - [ADR-003: Add Protobuf as a Projection Target](./ADR-003-protobuf-projection-target.md)
50
+ - [ADR-004: Enforce Projection Compatibility Semantics](./ADR-004-projection-compatibility-semantics.md)
@@ -0,0 +1,51 @@
1
+ # ADR-003: Add Protobuf as a Projection Target (Not a Semantic Format)
2
+
3
+ **Status:** Accepted
4
+ **Date:** 2025-12-14
5
+ **Deciders:** DomainForge Architecture Team
6
+
7
+ ## Context
8
+
9
+ SEA requires high-performance, versioned, cross-language contracts for agents, services, governance events, and telemetry.
10
+
11
+ ## Decision
12
+
13
+ Add **Protobuf** as a supported projection target.
14
+
15
+ Protobuf SHALL be generated **only** from the semantic graph via a projection engine.
16
+
17
+ Protobuf SHALL NOT:
18
+
19
+ - Replace SEA-DSL
20
+ - Encode policy logic
21
+ - Encode semantic evolution rules
22
+
23
+ ## Rationale
24
+
25
+ Protobuf provides:
26
+
27
+ - Efficient binary serialization
28
+ - Strong cross-language support
29
+ - Built-in versioning primitives
30
+ - Industry-standard tooling
31
+
32
+ By treating Protobuf as a projection target rather than a source format, we maintain SEA-DSL's semantic integrity while gaining Protobuf's runtime benefits.
33
+
34
+ ## Consequences
35
+
36
+ ### Positive
37
+
38
+ - Agents receive stable, deterministic contracts.
39
+ - Runtime governance and telemetry become efficient and auditable.
40
+ - SEA avoids becoming data-centric or schema-centric.
41
+
42
+ ### Negative
43
+
44
+ - Requires building and maintaining a Protobuf projection engine.
45
+ - Some Protobuf features (services, streaming) may require additional mapping work.
46
+
47
+ ## Related
48
+
49
+ - [ADR-001: Treat SEA-DSL as the Semantic Source of Truth](./ADR-001-sea-dsl-semantic-source-of-truth.md)
50
+ - [ADR-002: Introduce Projection as a First-Class DSL Construct](./ADR-002-projection-first-class-construct.md)
51
+ - [ADR-004: Enforce Projection Compatibility Semantics](./ADR-004-projection-compatibility-semantics.md)