@plures/praxis 1.1.2 → 1.2.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 (49) hide show
  1. package/FRAMEWORK.md +106 -15
  2. package/README.md +275 -53
  3. package/dist/browser/adapter-TM4IS5KT.js +12 -0
  4. package/dist/browser/chunk-JQ64KMLN.js +141 -0
  5. package/dist/browser/chunk-LE2ZJYFC.js +154 -0
  6. package/dist/browser/chunk-VOMLVI6V.js +197 -0
  7. package/dist/browser/engine-YJZV4SLD.js +8 -0
  8. package/dist/browser/index.d.ts +300 -11
  9. package/dist/browser/index.js +334 -325
  10. package/dist/browser/integrations/svelte.d.ts +3 -1
  11. package/dist/browser/integrations/svelte.js +8 -0
  12. package/dist/browser/{engine-BjdqxeXG.d.ts → reactive-engine.svelte-C9OpcTHf.d.ts} +87 -1
  13. package/dist/node/adapter-K6DOX6XS.js +13 -0
  14. package/dist/node/chunk-JQ64KMLN.js +141 -0
  15. package/dist/node/chunk-LE2ZJYFC.js +154 -0
  16. package/dist/node/chunk-S54337I5.js +446 -0
  17. package/dist/node/chunk-VOMLVI6V.js +197 -0
  18. package/dist/node/cli/index.cjs +1444 -889
  19. package/dist/node/cli/index.js +9 -0
  20. package/dist/node/components/index.d.cts +2 -2
  21. package/dist/node/components/index.d.ts +2 -2
  22. package/dist/node/docs-JFNYTOJA.js +102 -0
  23. package/dist/node/engine-2DQBKBJC.js +9 -0
  24. package/dist/node/index.cjs +747 -234
  25. package/dist/node/index.d.cts +237 -15
  26. package/dist/node/index.d.ts +237 -15
  27. package/dist/node/index.js +339 -767
  28. package/dist/node/integrations/svelte.cjs +357 -2
  29. package/dist/node/integrations/svelte.d.cts +3 -1
  30. package/dist/node/integrations/svelte.d.ts +3 -1
  31. package/dist/node/integrations/svelte.js +7 -0
  32. package/dist/node/{engine-CVJobhHm.d.cts → reactive-engine.svelte-1M4m_C_v.d.cts} +87 -1
  33. package/dist/node/{engine-1iqLe6_P.d.ts → reactive-engine.svelte-ChNFn4Hj.d.ts} +87 -1
  34. package/dist/node/{terminal-adapter-XLtCjjb_.d.cts → terminal-adapter-CDzxoLKR.d.cts} +68 -1
  35. package/dist/node/{terminal-adapter-07HGftGQ.d.ts → terminal-adapter-CWka-yL8.d.ts} +68 -1
  36. package/package.json +3 -2
  37. package/src/__tests__/reactive-engine.test.ts +516 -0
  38. package/src/cli/commands/docs.ts +147 -0
  39. package/src/cli/index.ts +21 -0
  40. package/src/core/pluresdb/README.md +156 -0
  41. package/src/core/pluresdb/adapter.ts +165 -0
  42. package/src/core/pluresdb/index.ts +3 -3
  43. package/src/core/reactive-engine.svelte.ts +93 -19
  44. package/src/core/reactive-engine.ts +284 -22
  45. package/src/index.browser.ts +16 -0
  46. package/src/index.ts +16 -0
  47. package/src/integrations/pluresdb.ts +2 -2
  48. package/src/integrations/svelte.ts +8 -0
  49. package/src/integrations/unified.ts +350 -0
package/FRAMEWORK.md CHANGED
@@ -143,28 +143,104 @@ PluresDB provides the data storage and synchronization layer.
143
143
  - Logic engine fact/event storage
144
144
  - Component data binding
145
145
  - Distributed state management
146
+ - CRDT-based synchronization
147
+ - Event sourcing and replay
146
148
 
147
- ### 5. Visual IDE (CodeCanvas Integration)
149
+ **Status**: Fully implemented with comprehensive test coverage
148
150
 
149
- CodeCanvas provides visual development capabilities.
151
+ ### 5. Identity & Channels (Unum Integration)
152
+
153
+ Unum provides identity management and channel-based communication for distributed systems.
150
154
 
151
155
  **Features:**
152
156
 
153
- - Visual schema editor
154
- - Logic flow designer
155
- - Component preview
156
- - Orchestrator visualization
157
- - Documentation navigation
157
+ - Identity creation and management
158
+ - Channel-based messaging
159
+ - Event and fact broadcasting
160
+ - Member management
161
+ - Real-time synchronization with PluresDB
162
+
163
+ **Use Cases:**
164
+
165
+ - Multi-user collaboration
166
+ - Distributed event streaming
167
+ - Node-to-node communication
168
+ - Identity-based access control
169
+ - Real-time state synchronization
170
+
171
+ **Integration Points:**
172
+
173
+ - Praxis event broadcasting to channels
174
+ - Fact synchronization across nodes
175
+ - PluresDB backend for persistence
176
+ - Engine attachment for automatic distribution
177
+
178
+ **Status**: ✅ Fully implemented with comprehensive API
179
+
180
+ ### 6. Documentation (State-Docs Integration)
181
+
182
+ State-Docs generates living documentation from Praxis schemas and logic definitions.
183
+
184
+ **Features:**
185
+
186
+ - Auto-generated Markdown documentation
187
+ - Mermaid and DOT diagram generation
188
+ - Model and component catalogs
189
+ - Logic flow visualization
190
+ - Event → Rule → Fact diagrams
191
+ - Customizable templates
192
+
193
+ **Use Cases:**
194
+
195
+ - API documentation
196
+ - Architecture diagrams
197
+ - Onboarding documentation
198
+ - Design reviews
199
+ - GitHub Pages integration
200
+
201
+ **Integration Points:**
202
+
203
+ - Schema documentation generation
204
+ - Registry introspection
205
+ - Automatic ToC and index generation
206
+ - Diagram export (Mermaid, DOT)
207
+
208
+ **Status**: ✅ Fully implemented with CLI support (`praxis docs`)
209
+
210
+ ### 7. Visual IDE (CodeCanvas Integration)
211
+
212
+ CodeCanvas provides visual development capabilities for schemas and logic flows.
213
+
214
+ **Features:**
215
+
216
+ - Visual schema editor with node-based UI
217
+ - Schema ↔ Canvas bi-directional sync
218
+ - Mermaid and YAML export
219
+ - Obsidian Canvas compatibility
220
+ - FSM visualization
221
+ - Guardian pre-commit validation
222
+ - Activity lifecycle tracking
158
223
 
159
224
  **Use Cases:**
160
225
 
161
226
  - Design schemas visually
162
- - Build logic flows with drag-and-drop
163
- - Preview generated components
164
- - Visualize distributed orchestration
165
- - Navigate living documentation
227
+ - Build logic flows with visual tools
228
+ - Export schemas to diagrams
229
+ - Integrate with Obsidian workflows
230
+ - Visualize state machines
231
+ - Enforce development lifecycle
166
232
 
167
- ### 6. Orchestration (DSC/MCP Support)
233
+ **Integration Points:**
234
+
235
+ - Schema conversion (`schemaToCanvas`)
236
+ - Canvas export (YAML, Mermaid, JSON)
237
+ - Visual editor API
238
+ - FSM lifecycle management
239
+ - Guardian validation hooks
240
+
241
+ **Status**: ✅ Fully implemented with CLI support (`praxis canvas`)
242
+
243
+ ### 8. Orchestration (DSC/MCP Support)
168
244
 
169
245
  Support for distributed system coordination.
170
246
 
@@ -213,17 +289,32 @@ Generate code from schemas.
213
289
 
214
290
  Options:
215
291
 
216
- - `--target`: Generation target (components, models, docs, all)
292
+ - `--target`: Generation target (components, models, pluresdb, docs, all)
217
293
  - `--watch`: Watch for schema changes
294
+ - `--auto-index`: Auto-indexing strategy for PluresDB
295
+
296
+ #### `praxis docs [schema]`
297
+
298
+ Generate documentation from schemas or registries.
299
+
300
+ Options:
301
+
302
+ - `--output`: Output directory (default: ./docs)
303
+ - `--title`: Documentation title
304
+ - `--format`: Diagram format (mermaid, dot)
305
+ - `--no-toc`: Disable table of contents
306
+ - `--from-registry`: Generate from registry instead of schema
218
307
 
219
308
  #### `praxis canvas [schema]`
220
309
 
221
- Open CodeCanvas for visual editing.
310
+ Open CodeCanvas for visual editing or export schemas to canvas formats.
222
311
 
223
312
  Options:
224
313
 
225
- - `--port`: Port for Canvas server
314
+ - `--port`: Port for Canvas server (default: 3000)
226
315
  - `--mode`: Mode (edit, view, present)
316
+ - `--export`: Export format (yaml, mermaid, json)
317
+ - `--output`: Output file for export
227
318
 
228
319
  #### `praxis orchestrate`
229
320
 
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  dotnet build
2
2
  dotnet test
3
- # Praxis 1.1.2
3
+ # Praxis
4
4
 
5
5
  **Typed, visual-first application logic for Svelte, Node, and the browser.**
6
6
 
@@ -10,24 +10,37 @@ dotnet test
10
10
  [![Node.js Version](https://img.shields.io/badge/node-%3E%3D18-brightgreen)](https://nodejs.org/)
11
11
  [![Deno Compatible](https://img.shields.io/badge/deno-compatible-brightgreen)](https://deno.land/)
12
12
 
13
- Praxis is a schema-driven, rule-based engine with first-class Svelte 5 integration, component generation, and optional cloud sync. Version **1.1.2** delivers a unified ESM/CJS build, curated subpath exports, Svelte runes support, and a slimmer, publish-ready package for npm and JSR.
13
+ Praxis is **the unified solution for declarative application development**, combining:
14
+
15
+ - **Logic Modeling**: Typed facts, events, rules, and constraints for domain logic
16
+ - **Component Auto-Generation**: Svelte 5 components generated from schemas
17
+ - **Data Persistence**: PluresDB for local-first, reactive data storage
18
+ - **Documentation**: Auto-generated docs with State-Docs and visual diagrams
19
+ - **Visual Editing**: CodeCanvas for schema design and FSM visualization
20
+ - **Distributed Systems**: Unum for identity and multi-node communication
21
+
22
+ The library delivers a unified ESM/CJS build, curated subpath exports, Svelte runes support, and a slimmer, publish-ready package for npm and JSR.
14
23
 
15
24
  ---
16
25
 
17
- ## What’s new in 1.1.2
26
+ ## What’s new
18
27
  - **Unified builds & exports**: `./`, `./svelte`, `./schema`, `./component`, `./cloud`, `./components`, and CLI all ship with ESM, CJS, and type definitions.
19
28
  - **Svelte 5 runes native**: Runes-friendly stores and helpers; server+client builds for integrations.
29
+ - **Framework-agnostic reactivity**: Proxy-based reactive engine for use without Svelte, enabling reactive state management in Node.js, browsers, and any JavaScript environment.
20
30
  - **Logic engine refinements**: Typed registry, step diagnostics, and trace-friendly rule execution.
21
31
  - **Cloud relay & local-first**: Polished cloud connector alongside PluresDB-first workflows.
22
32
  - **Publish-ready**: npm public access + JSR exports aligned to source.
23
33
 
24
34
  ## Capabilities at a glance
25
- - **Logic Engine**: Facts, events, rules, constraints, registry, introspection, and reactive engine variant.
35
+ - **Logic Engine**: Facts, events, rules, constraints, registry, introspection, and reactive engine variants (Svelte 5 + framework-agnostic).
26
36
  - **Schema & Codegen**: PSF-style schema types plus component generator for Svelte UIs.
27
37
  - **Svelte Integration**: Typed helpers, runes-ready builds, and Svelte component typings.
28
- - **Local-First Data**: PluresDB integrations for offline-first, reactive state.
38
+ - **Local-First Data**: PluresDB integration for offline-first, reactive state with full persistence.
39
+ - **Distributed Systems**: Unum integration for identity management and multi-node channels.
40
+ - **Documentation**: State-Docs integration for auto-generated Markdown docs and Mermaid diagrams.
41
+ - **Visual Editing**: CodeCanvas integration for visual schema design and FSM visualization.
29
42
  - **Cloud Relay**: Optional sync layer (GitHub-auth friendly) for distributed teams.
30
- - **CLI**: Scaffolding, generation, canvas helpers, and cloud commands.
43
+ - **CLI**: Scaffolding, generation, canvas helpers, docs generation, and cloud commands.
31
44
 
32
45
  ## Install
33
46
  Node 18+ recommended.
@@ -80,6 +93,64 @@ const engine = createPraxisEngine({ initialContext: { currentUser: null }, regis
80
93
  engine.step([Login.create({ username: 'alex' })]);
81
94
  ```
82
95
 
96
+ ## Unified workflow example
97
+
98
+ See all Praxis integrations working together - from schema definition to persistence, documentation, and distributed communication:
99
+
100
+ ```ts
101
+ import {
102
+ createPraxisEngine,
103
+ PraxisRegistry,
104
+ defineRule,
105
+ createInMemoryDB,
106
+ createPluresDBAdapter,
107
+ createUnumAdapter,
108
+ createStateDocsGenerator,
109
+ schemaToCanvas,
110
+ } from '@plures/praxis';
111
+
112
+ // 1. Define logic with Praxis engine
113
+ const registry = new PraxisRegistry();
114
+ registry.registerRule(/* your rules */);
115
+ const engine = createPraxisEngine({ initialContext: {}, registry });
116
+
117
+ // 2. Add PluresDB for local-first persistence
118
+ const db = createInMemoryDB();
119
+ const pluresAdapter = createPluresDBAdapter({ db, registry });
120
+ pluresAdapter.attachEngine(engine);
121
+
122
+ // 3. Add Unum for distributed communication
123
+ const unum = await createUnumAdapter({
124
+ db,
125
+ identity: { name: 'node-1' },
126
+ realtime: true,
127
+ });
128
+ const channel = await unum.createChannel('app-sync');
129
+
130
+ // Subscribe to distribute events across nodes
131
+ unum.subscribeToEvents(channel.id, (event) => {
132
+ engine.step([event]);
133
+ });
134
+
135
+ // 4. Generate documentation with State-Docs
136
+ const docsGenerator = createStateDocsGenerator({
137
+ projectTitle: 'My App',
138
+ target: './docs',
139
+ });
140
+ const docs = docsGenerator.generateFromModule(registry.module);
141
+
142
+ // 5. Export schema to CodeCanvas for visual editing
143
+ const canvas = schemaToCanvas(mySchema);
144
+ // Canvas can be edited visually and converted back to schema
145
+
146
+ // Now you have:
147
+ // ✅ Logic engine running
148
+ // ✅ Auto-persisting to PluresDB
149
+ // ✅ Distributing events across nodes via Unum
150
+ // ✅ Auto-generated documentation
151
+ // ✅ Visual schema representation
152
+ ```
153
+
83
154
  ## Svelte integration (runes-ready)
84
155
  ```svelte
85
156
  <script lang="ts">
@@ -100,16 +171,47 @@ engine.step([Login.create({ username: 'alex' })]);
100
171
  registry.registerRule(counterRule);
101
172
 
102
173
  const engine = createReactiveEngine({ initialContext: { count: 0 }, registry });
103
- const count = engine.$derived((s) => s.context.count);
174
+
175
+ // Use Svelte's $derived with the reactive engine state
176
+ const count = $derived(engine.context.count);
104
177
 
105
178
  function addOne() {
106
179
  engine.step([Increment.create({ amount: 1 })]);
107
180
  }
108
181
  </script>
109
182
 
110
- <button on:click={addOne}>Count is {$count}</button>
183
+ <button on:click={addOne}>Count is {count}</button>
184
+ ```
185
+
186
+ ## Framework-agnostic reactive engine
187
+ For non-Svelte environments, use the framework-agnostic reactive engine with Proxy-based reactivity:
188
+
189
+ ```typescript
190
+ import { createFrameworkAgnosticReactiveEngine } from '@plures/praxis';
191
+
192
+ const engine = createFrameworkAgnosticReactiveEngine({
193
+ initialContext: { count: 0 },
194
+ });
195
+
196
+ // Subscribe to state changes
197
+ engine.subscribe((state) => {
198
+ console.log('Count:', state.context.count);
199
+ });
200
+
201
+ // Create derived/computed values
202
+ const doubled = engine.$derived((state) => state.context.count * 2);
203
+ doubled.subscribe((value) => {
204
+ console.log('Doubled:', value);
205
+ });
206
+
207
+ // Apply mutations (batched for performance)
208
+ engine.apply((state) => {
209
+ state.context.count += 1;
210
+ });
111
211
  ```
112
212
 
213
+ See the [reactive counter example](./examples/reactive-counter/README.md) for a complete demonstration.
214
+
113
215
  ## Cloud relay (optional)
114
216
  ```ts
115
217
  import { connectRelay } from '@plures/praxis/cloud';
@@ -129,6 +231,35 @@ await relay.sync({
129
231
  });
130
232
  ```
131
233
 
234
+ ## PluresDB integration
235
+ ```ts
236
+ import { PluresNode } from 'pluresdb';
237
+ import { createPluresDB, createPraxisDBStore } from '@plures/praxis';
238
+ import { PraxisRegistry } from '@plures/praxis';
239
+
240
+ // Initialize the official PluresDB from npm
241
+ const pluresdb = new PluresNode({
242
+ config: {
243
+ port: 34567,
244
+ dataDir: './data',
245
+ },
246
+ autoStart: true,
247
+ });
248
+
249
+ // Wrap it with the Praxis adapter
250
+ const db = createPluresDB(pluresdb);
251
+
252
+ // Use with Praxis store for local-first reactive data
253
+ const registry = new PraxisRegistry();
254
+ const store = createPraxisDBStore(db, registry);
255
+
256
+ // Or use in-memory database for development/testing
257
+ import { createInMemoryDB } from '@plures/praxis';
258
+ const devDb = createInMemoryDB();
259
+ ```
260
+
261
+ > **Note:** Praxis now uses the official [PluresDB package from NPM](https://www.npmjs.com/package/pluresdb), which provides P2P sync, CRDT conflict resolution, SQLite compatibility, and more. The `createPluresDB()` function wraps PluresDB to provide the `PraxisDB` interface used by Praxis.
262
+
132
263
  ## CLI (npx-friendly)
133
264
  ```bash
134
265
  npx praxis --help
@@ -591,32 +722,55 @@ adapter.subscribeToEvents((events) => {
591
722
 
592
723
  ### Unum Integration
593
724
 
594
- Identity and channels for distributed systems.
725
+ Identity and channels for distributed systems. **Now fully implemented** with comprehensive channel and identity management.
595
726
 
596
727
  ```typescript
597
- import { createUnumIdentity, createChannel } from '@plures/unum';
728
+ import {
729
+ createUnumAdapter,
730
+ attachUnumToEngine,
731
+ } from '@plures/praxis';
598
732
 
599
- // Create identity
600
- const identity = await createUnumIdentity({
601
- name: 'my-app-node',
602
- keys: await generateKeys(),
733
+ // Create Unum adapter with identity
734
+ const unum = await createUnumAdapter({
735
+ db: pluresDB,
736
+ identity: {
737
+ name: 'my-app-node',
738
+ metadata: { role: 'coordinator' },
739
+ },
740
+ realtime: true,
603
741
  });
604
742
 
605
- // Create channel for messaging
606
- const channel = await createChannel({
607
- name: 'app-events',
608
- participants: [identity.id],
743
+ // Create a channel for messaging
744
+ const channel = await unum.createChannel('app-events', ['member-1', 'member-2']);
745
+
746
+ // Broadcast Praxis events to channel
747
+ await unum.broadcastEvent(channel.id, {
748
+ tag: 'USER_JOINED',
749
+ payload: { userId: 'alice' },
609
750
  });
610
751
 
611
- // Integrate with Praxis actors
612
- const unumActor = createActor('unum-bridge', identity, async (event) => {
613
- // Bridge Praxis events to Unum channels
614
- await channel.publish(event);
752
+ // Subscribe to events from channel
753
+ const unsubscribe = unum.subscribeToEvents(channel.id, (event) => {
754
+ console.log('Received event:', event);
755
+ // Feed into local Praxis engine
756
+ engine.step([event]);
615
757
  });
758
+
759
+ // Attach to engine for automatic event broadcasting
760
+ attachUnumToEngine(engine, unum, channel.id);
616
761
  ```
617
762
 
618
- **Status**: Planned
619
- **Use Cases**: Distributed messaging, identity management, authentication
763
+ **Features:**
764
+
765
+ - **Identity Management**: Create and manage user/node identities
766
+ - **Channel Communication**: Real-time messaging between distributed nodes
767
+ - **Event Broadcasting**: Share Praxis events across channels
768
+ - **Fact Synchronization**: Distribute facts to connected participants
769
+ - **PluresDB Integration**: Persists identities and messages
770
+
771
+ **Status**: ✅ Available (`src/integrations/unum.ts`)
772
+ **Tests**: Comprehensive integration tests
773
+ **Use Cases**: Distributed messaging, identity management, multi-user collaboration
620
774
 
621
775
  ### ADP Integration
622
776
 
@@ -651,48 +805,116 @@ adp.enforce({
651
805
 
652
806
  ### State-Docs Integration
653
807
 
654
- Living documentation generated from Praxis schemas.
808
+ Living documentation generated from Praxis schemas. **Now fully implemented** with Markdown and Mermaid diagram generation.
655
809
 
656
810
  ```typescript
657
- import { generateStateDocs } from '@plures/state-docs';
658
-
659
- // Generate documentation from schema
660
- const docs = await generateStateDocs({
661
- schema: appSchema,
662
- logic: logicDefinitions,
663
- components: componentDefinitions,
664
- output: './docs',
665
- format: 'markdown', // or 'html', 'pdf'
811
+ import {
812
+ createStateDocsGenerator,
813
+ generateDocs,
814
+ } from '@plures/praxis';
815
+
816
+ // Create generator
817
+ const generator = createStateDocsGenerator({
818
+ projectTitle: 'My Praxis App',
819
+ target: './docs',
820
+ visualization: {
821
+ format: 'mermaid',
822
+ theme: 'default',
823
+ },
824
+ template: {
825
+ toc: true,
826
+ timestamp: true,
827
+ },
666
828
  });
667
829
 
668
- // Documentation includes:
669
- // - Data model diagrams
670
- // - Logic flow diagrams
671
- // - Component catalog
672
- // - API reference
673
- // - Usage examples
830
+ // Generate docs from schema
831
+ const docs = generator.generateFromSchema(appSchema);
832
+
833
+ // Or from registry
834
+ const registryDocs = generator.generateFromModule(myModule);
835
+
836
+ // Write generated docs
837
+ for (const doc of docs) {
838
+ await writeFile(doc.path, doc.content);
839
+ }
840
+
841
+ // Quick helper
842
+ const allDocs = generateDocs(appSchema, {
843
+ projectTitle: 'My App',
844
+ target: './docs',
845
+ });
674
846
  ```
675
847
 
676
- **Status**: Planned
677
- **Documentation**: See examples for State-Docs integration patterns
848
+ **Features:**
849
+
850
+ - **Schema Documentation**: Auto-generate docs from Praxis schemas
851
+ - **Mermaid Diagrams**: Visual state machine and flow diagrams
852
+ - **Markdown Output**: GitHub-ready documentation
853
+ - **Model & Component Docs**: Detailed API documentation
854
+ - **Logic Flow Visualization**: Event → Rule → Fact diagrams
855
+ - **Table of Contents**: Automatic ToC generation
856
+
857
+ **Status**: ✅ Available (`src/integrations/state-docs.ts`)
858
+ **CLI**: Use `praxis generate` with `--docs` flag (coming soon)
859
+ **Documentation**: Auto-generates README, models.md, logic diagrams
678
860
 
679
861
  ### CodeCanvas Integration
680
862
 
681
- Visual IDE for schema and logic editing.
863
+ Visual IDE for schema and logic editing. **Now fully implemented** with schema visualization and canvas export.
682
864
 
683
- ```bash
684
- # Open Canvas for visual editing
685
- praxis canvas src/schemas/app.schema.ts
865
+ ```typescript
866
+ import {
867
+ schemaToCanvas,
868
+ canvasToSchema,
869
+ canvasToMermaid,
870
+ createCanvasEditor,
871
+ } from '@plures/praxis';
872
+
873
+ // Convert schema to canvas document
874
+ const canvas = schemaToCanvas(mySchema, {
875
+ layout: 'hierarchical',
876
+ });
686
877
 
687
- # Features:
688
- # - Visual schema design
689
- # - Logic flow editor
690
- # - Component preview
691
- # - Real-time collaboration
692
- # - Export to code
878
+ // Export to YAML (Obsidian Canvas compatible)
879
+ const yaml = canvasToYaml(canvas);
880
+ await writeFile('./schema.canvas.yaml', yaml);
881
+
882
+ // Export to Mermaid diagram
883
+ const mermaid = canvasToMermaid(canvas);
884
+
885
+ // Create canvas editor instance
886
+ const editor = createCanvasEditor({
887
+ schema: mySchema,
888
+ enableFSM: true,
889
+ layout: 'hierarchical',
890
+ });
891
+
892
+ // Add nodes programmatically
893
+ editor.addNode({
894
+ type: 'model',
895
+ label: 'User',
896
+ x: 100,
897
+ y: 100,
898
+ width: 150,
899
+ height: 60,
900
+ data: userModel,
901
+ });
902
+
903
+ // Convert back to schema
904
+ const updatedSchema = editor.toSchema();
693
905
  ```
694
906
 
695
- **Status**: Planned
907
+ **Features:**
908
+
909
+ - **Visual Schema Design**: Node-based schema editor
910
+ - **Canvas Export**: YAML and Mermaid diagram formats
911
+ - **Obsidian Compatible**: Works with Obsidian Canvas format
912
+ - **FSM Visualization**: State machine and flow diagrams
913
+ - **Bi-directional Sync**: Canvas ↔ Schema round-tripping
914
+ - **Guardian Validation**: Pre-commit lifecycle checks
915
+
916
+ **Status**: ✅ Available (`src/integrations/code-canvas.ts`)
917
+ **CLI**: Use `praxis canvas` commands (coming soon)
696
918
  **Documentation**: [docs/guides/canvas.md](./docs/guides/canvas.md)
697
919
 
698
920
  ### Svelte + Tauri Runtime
@@ -0,0 +1,12 @@
1
+ import {
2
+ InMemoryPraxisDB,
3
+ PluresDBPraxisAdapter,
4
+ createInMemoryDB,
5
+ createPluresDB
6
+ } from "./chunk-JQ64KMLN.js";
7
+ export {
8
+ InMemoryPraxisDB,
9
+ PluresDBPraxisAdapter,
10
+ createInMemoryDB,
11
+ createPluresDB
12
+ };