Examples & Contracts
This section covers practical usage scripts and formal DSL contracts.
DSL Contracts (tests/contracts/dsl.contract.test.mjs)
Contract tests ensure DSL behavior remains stable:
- path write/read boot behavior
- fixed selectors (
[1]) - broadcast (
[i]) with derivations - logical filters
- range and multi-select
- transform projections
Run:
bash
npm run test:contractsDemo Scripts
FilePurposetests/Demos/Affinity_Model.tsAffinity scoring, selectors, explainability, and private policy lanetests/Demos/Social_Graph.tsPointer-based social graph walkthroughtests/Demos/ShopsExample.tsCollection + selectors + derivation exampletests/sand.tsSandbox/experimental script spaceRun all demos:
bash
npm run test:demosRun directly:
bash
node tests/Demos/Affinity_Model.ts
node tests/Demos/Social_Graph.ts
node tests/Demos/ShopsExample.ts
node tests/sand.tsWhen to Use Demos vs Contracts
- Use demos to communicate capability and onboarding.
- Use contracts to lock behavior and catch regressions.