@plures/praxis 1.1.3 → 1.2.10
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/FRAMEWORK.md +106 -15
- package/README.md +194 -119
- package/dist/browser/adapter-CIMBGDC7.js +14 -0
- package/dist/browser/chunk-K377RW4V.js +230 -0
- package/dist/browser/chunk-MBVHLOU2.js +152 -0
- package/dist/browser/{chunk-R45WXWKH.js → chunk-VOMLVI6V.js} +1 -149
- package/dist/browser/engine-YJZV4SLD.js +8 -0
- package/dist/browser/index.d.ts +161 -5
- package/dist/browser/index.js +156 -141
- package/dist/browser/integrations/svelte.d.ts +2 -2
- package/dist/browser/integrations/svelte.js +2 -1
- package/dist/browser/{reactive-engine.svelte-C9OpcTHf.d.ts → reactive-engine.svelte-9aS0kTa8.d.ts} +136 -1
- package/dist/node/adapter-75ISSMWD.js +15 -0
- package/dist/node/chunk-5RH7UAQC.js +486 -0
- package/dist/node/chunk-MBVHLOU2.js +152 -0
- package/dist/node/chunk-PRPQO6R5.js +85 -0
- package/dist/node/chunk-R2PSBPKQ.js +150 -0
- package/dist/node/chunk-S54337I5.js +446 -0
- package/dist/node/{chunk-R45WXWKH.js → chunk-VOMLVI6V.js} +1 -149
- package/dist/node/chunk-WZ6B3LZ6.js +638 -0
- package/dist/node/cli/index.cjs +2936 -897
- package/dist/node/cli/index.js +27 -0
- package/dist/node/components/index.d.cts +3 -2
- package/dist/node/components/index.d.ts +3 -2
- package/dist/node/docs-JFNYTOJA.js +102 -0
- package/dist/node/engine-2DQBKBJC.js +9 -0
- package/dist/node/index.cjs +1114 -354
- package/dist/node/index.d.cts +388 -5
- package/dist/node/index.d.ts +388 -5
- package/dist/node/index.js +201 -640
- package/dist/node/integrations/svelte.cjs +76 -0
- package/dist/node/integrations/svelte.d.cts +2 -2
- package/dist/node/integrations/svelte.d.ts +2 -2
- package/dist/node/integrations/svelte.js +3 -1
- package/dist/node/{reactive-engine.svelte-1M4m_C_v.d.cts → reactive-engine.svelte-BFIZfawz.d.cts} +199 -1
- package/dist/node/{reactive-engine.svelte-ChNFn4Hj.d.ts → reactive-engine.svelte-CRNqHlbv.d.ts} +199 -1
- package/dist/node/reverse-W7THPV45.js +193 -0
- package/dist/node/{terminal-adapter-CWka-yL8.d.ts → terminal-adapter-B-UK_Vdz.d.ts} +28 -3
- package/dist/node/{terminal-adapter-CDzxoLKR.d.cts → terminal-adapter-BQSIF5bf.d.cts} +28 -3
- package/dist/node/validate-CNHUULQE.js +180 -0
- package/docs/core/pluresdb-integration.md +15 -15
- package/docs/decision-ledger/BEHAVIOR_LEDGER.md +225 -0
- package/docs/decision-ledger/DecisionLedger.tla +180 -0
- package/docs/decision-ledger/IMPLEMENTATION_SUMMARY.md +217 -0
- package/docs/decision-ledger/LATEST.md +166 -0
- package/docs/guides/cicd-pipeline.md +142 -0
- package/package.json +2 -2
- package/src/__tests__/cli-validate.test.ts +197 -0
- package/src/__tests__/decision-ledger.test.ts +485 -0
- package/src/__tests__/reverse-generator.test.ts +189 -0
- package/src/__tests__/scanner.test.ts +215 -0
- package/src/cli/commands/docs.ts +147 -0
- package/src/cli/commands/reverse.ts +289 -0
- package/src/cli/commands/validate.ts +264 -0
- package/src/cli/index.ts +68 -0
- package/src/core/pluresdb/adapter.ts +46 -3
- package/src/core/reactive-engine.svelte.ts +6 -1
- package/src/core/reactive-engine.ts +1 -1
- package/src/core/rules.ts +133 -0
- package/src/decision-ledger/README.md +400 -0
- package/src/decision-ledger/REVERSE_ENGINEERING.md +484 -0
- package/src/decision-ledger/facts-events.ts +121 -0
- package/src/decision-ledger/index.ts +70 -0
- package/src/decision-ledger/ledger.ts +246 -0
- package/src/decision-ledger/logic-ledger.ts +158 -0
- package/src/decision-ledger/reverse-generator.ts +426 -0
- package/src/decision-ledger/scanner.ts +506 -0
- package/src/decision-ledger/types.ts +247 -0
- package/src/decision-ledger/validation.ts +336 -0
- package/src/dsl/index.ts +13 -2
- package/src/index.browser.ts +6 -0
- package/src/index.ts +40 -0
- package/src/integrations/pluresdb.ts +14 -2
- 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
|
-
|
|
149
|
+
**Status**: ✅ Fully implemented with comprehensive test coverage
|
|
148
150
|
|
|
149
|
-
|
|
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
|
-
-
|
|
154
|
-
-
|
|
155
|
-
-
|
|
156
|
-
-
|
|
157
|
-
-
|
|
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
|
|
163
|
-
-
|
|
164
|
-
-
|
|
165
|
-
-
|
|
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
|
-
|
|
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,5 +1,3 @@
|
|
|
1
|
-
dotnet build
|
|
2
|
-
dotnet test
|
|
3
1
|
# Praxis
|
|
4
2
|
|
|
5
3
|
**Typed, visual-first application logic for Svelte, Node, and the browser.**
|
|
@@ -10,25 +8,10 @@ dotnet test
|
|
|
10
8
|
[](https://nodejs.org/)
|
|
11
9
|
[](https://deno.land/)
|
|
12
10
|
|
|
13
|
-
Praxis is a
|
|
11
|
+
Praxis is a unified solution for declarative application development. The framework combines typed logic modeling (facts, events, rules, constraints), component generation (Svelte 5), and local-first data persistence (PluresDB). It includes visual tools (CodeCanvas, State-Docs), distributed system support (Unum), optional cloud relay, and a CLI for scaffolding and generation.
|
|
14
12
|
|
|
15
|
-
|
|
13
|
+
The library delivers unified ESM/CJS builds with curated subpath exports (`./`, `./svelte`, `./schema`, `./component`, `./cloud`, `./components`), Svelte 5 runes support, and publish-ready packages for npm and JSR.
|
|
16
14
|
|
|
17
|
-
## What’s new
|
|
18
|
-
- **Unified builds & exports**: `./`, `./svelte`, `./schema`, `./component`, `./cloud`, `./components`, and CLI all ship with ESM, CJS, and type definitions.
|
|
19
|
-
- **Svelte 5 runes native**: Runes-friendly stores and helpers; server+client builds for integrations.
|
|
20
|
-
- **Framework-agnostic reactivity**: Proxy-based reactive engine for use without Svelte, enabling reactive state management in Node.js, browsers, and any JavaScript environment.
|
|
21
|
-
- **Logic engine refinements**: Typed registry, step diagnostics, and trace-friendly rule execution.
|
|
22
|
-
- **Cloud relay & local-first**: Polished cloud connector alongside PluresDB-first workflows.
|
|
23
|
-
- **Publish-ready**: npm public access + JSR exports aligned to source.
|
|
24
|
-
|
|
25
|
-
## Capabilities at a glance
|
|
26
|
-
- **Logic Engine**: Facts, events, rules, constraints, registry, introspection, and reactive engine variants (Svelte 5 + framework-agnostic).
|
|
27
|
-
- **Schema & Codegen**: PSF-style schema types plus component generator for Svelte UIs.
|
|
28
|
-
- **Svelte Integration**: Typed helpers, runes-ready builds, and Svelte component typings.
|
|
29
|
-
- **Local-First Data**: PluresDB integrations for offline-first, reactive state.
|
|
30
|
-
- **Cloud Relay**: Optional sync layer (GitHub-auth friendly) for distributed teams.
|
|
31
|
-
- **CLI**: Scaffolding, generation, canvas helpers, and cloud commands.
|
|
32
15
|
|
|
33
16
|
## Install
|
|
34
17
|
Node 18+ recommended.
|
|
@@ -43,7 +26,7 @@ pnpm add @plures/praxis
|
|
|
43
26
|
|
|
44
27
|
JSR (Deno):
|
|
45
28
|
```bash
|
|
46
|
-
|
|
29
|
+
deno add @plures/praxis
|
|
47
30
|
# or via import map pointing to npm:
|
|
48
31
|
# {
|
|
49
32
|
# "imports": { "@plures/praxis": "npm:@plures/praxis@^1.1.2" }
|
|
@@ -81,6 +64,64 @@ const engine = createPraxisEngine({ initialContext: { currentUser: null }, regis
|
|
|
81
64
|
engine.step([Login.create({ username: 'alex' })]);
|
|
82
65
|
```
|
|
83
66
|
|
|
67
|
+
## Unified workflow example
|
|
68
|
+
|
|
69
|
+
See all Praxis integrations working together - from schema definition to persistence, documentation, and distributed communication:
|
|
70
|
+
|
|
71
|
+
```ts
|
|
72
|
+
import {
|
|
73
|
+
createPraxisEngine,
|
|
74
|
+
PraxisRegistry,
|
|
75
|
+
defineRule,
|
|
76
|
+
createInMemoryDB,
|
|
77
|
+
createPluresDBAdapter,
|
|
78
|
+
createUnumAdapter,
|
|
79
|
+
createStateDocsGenerator,
|
|
80
|
+
schemaToCanvas,
|
|
81
|
+
} from '@plures/praxis';
|
|
82
|
+
|
|
83
|
+
// 1. Define logic with Praxis engine
|
|
84
|
+
const registry = new PraxisRegistry();
|
|
85
|
+
registry.registerRule(/* your rules */);
|
|
86
|
+
const engine = createPraxisEngine({ initialContext: {}, registry });
|
|
87
|
+
|
|
88
|
+
// 2. Add PluresDB for local-first persistence
|
|
89
|
+
const db = createInMemoryDB();
|
|
90
|
+
const pluresAdapter = createPluresDBAdapter({ db, registry });
|
|
91
|
+
pluresAdapter.attachEngine(engine);
|
|
92
|
+
|
|
93
|
+
// 3. Add Unum for distributed communication
|
|
94
|
+
const unum = await createUnumAdapter({
|
|
95
|
+
db,
|
|
96
|
+
identity: { name: 'node-1' },
|
|
97
|
+
realtime: true,
|
|
98
|
+
});
|
|
99
|
+
const channel = await unum.createChannel('app-sync');
|
|
100
|
+
|
|
101
|
+
// Subscribe to distribute events across nodes
|
|
102
|
+
unum.subscribeToEvents(channel.id, (event) => {
|
|
103
|
+
engine.step([event]);
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
// 4. Generate documentation with State-Docs
|
|
107
|
+
const docsGenerator = createStateDocsGenerator({
|
|
108
|
+
projectTitle: 'My App',
|
|
109
|
+
target: './docs',
|
|
110
|
+
});
|
|
111
|
+
const docs = docsGenerator.generateFromModule(registry.module);
|
|
112
|
+
|
|
113
|
+
// 5. Export schema to CodeCanvas for visual editing
|
|
114
|
+
const canvas = schemaToCanvas(mySchema);
|
|
115
|
+
// Canvas can be edited visually and converted back to schema
|
|
116
|
+
|
|
117
|
+
// Now you have:
|
|
118
|
+
// ✅ Logic engine running
|
|
119
|
+
// ✅ Auto-persisting to PluresDB
|
|
120
|
+
// ✅ Distributing events across nodes via Unum
|
|
121
|
+
// ✅ Auto-generated documentation
|
|
122
|
+
// ✅ Visual schema representation
|
|
123
|
+
```
|
|
124
|
+
|
|
84
125
|
## Svelte integration (runes-ready)
|
|
85
126
|
```svelte
|
|
86
127
|
<script lang="ts">
|
|
@@ -468,7 +509,7 @@ Demonstrates the terminal node feature for command execution:
|
|
|
468
509
|
- Terminal adapter creation and configuration
|
|
469
510
|
- Command execution and history tracking
|
|
470
511
|
- YAML schema loading with terminal nodes
|
|
471
|
-
- PluresDB binding configuration
|
|
512
|
+
- PluresDB binding configuration
|
|
472
513
|
- Both text and widget input modes
|
|
473
514
|
|
|
474
515
|
```bash
|
|
@@ -603,7 +644,7 @@ Praxis integrates with the full Plures ecosystem:
|
|
|
603
644
|
|
|
604
645
|
### PluresDB Integration
|
|
605
646
|
|
|
606
|
-
Local-first reactive datastore for offline-capable applications.
|
|
647
|
+
Local-first reactive datastore for offline-capable applications. Fully implemented with 32 tests covering all features.
|
|
607
648
|
|
|
608
649
|
```typescript
|
|
609
650
|
import {
|
|
@@ -652,116 +693,174 @@ adapter.subscribeToEvents((events) => {
|
|
|
652
693
|
|
|
653
694
|
### Unum Integration
|
|
654
695
|
|
|
655
|
-
Identity and channels for distributed systems.
|
|
696
|
+
Identity and channels for distributed systems. Fully implemented with comprehensive channel and identity management.
|
|
656
697
|
|
|
657
698
|
```typescript
|
|
658
|
-
import {
|
|
699
|
+
import {
|
|
700
|
+
createUnumAdapter,
|
|
701
|
+
attachUnumToEngine,
|
|
702
|
+
} from '@plures/praxis';
|
|
659
703
|
|
|
660
|
-
// Create identity
|
|
661
|
-
const
|
|
662
|
-
|
|
663
|
-
|
|
704
|
+
// Create Unum adapter with identity
|
|
705
|
+
const unum = await createUnumAdapter({
|
|
706
|
+
db: pluresDB,
|
|
707
|
+
identity: {
|
|
708
|
+
name: 'my-app-node',
|
|
709
|
+
metadata: { role: 'coordinator' },
|
|
710
|
+
},
|
|
711
|
+
realtime: true,
|
|
664
712
|
});
|
|
665
713
|
|
|
666
|
-
// Create channel for messaging
|
|
667
|
-
const channel = await createChannel(
|
|
668
|
-
|
|
669
|
-
|
|
714
|
+
// Create a channel for messaging
|
|
715
|
+
const channel = await unum.createChannel('app-events', ['member-1', 'member-2']);
|
|
716
|
+
|
|
717
|
+
// Broadcast Praxis events to channel
|
|
718
|
+
await unum.broadcastEvent(channel.id, {
|
|
719
|
+
tag: 'USER_JOINED',
|
|
720
|
+
payload: { userId: 'alice' },
|
|
670
721
|
});
|
|
671
722
|
|
|
672
|
-
//
|
|
673
|
-
const
|
|
674
|
-
|
|
675
|
-
|
|
723
|
+
// Subscribe to events from channel
|
|
724
|
+
const unsubscribe = unum.subscribeToEvents(channel.id, (event) => {
|
|
725
|
+
console.log('Received event:', event);
|
|
726
|
+
// Feed into local Praxis engine
|
|
727
|
+
engine.step([event]);
|
|
676
728
|
});
|
|
729
|
+
|
|
730
|
+
// Attach to engine for automatic event broadcasting
|
|
731
|
+
attachUnumToEngine(engine, unum, channel.id);
|
|
677
732
|
```
|
|
678
733
|
|
|
679
|
-
**
|
|
680
|
-
|
|
734
|
+
**Features:**
|
|
735
|
+
|
|
736
|
+
- **Identity Management**: Create and manage user/node identities
|
|
737
|
+
- **Channel Communication**: Real-time messaging between distributed nodes
|
|
738
|
+
- **Event Broadcasting**: Share Praxis events across channels
|
|
739
|
+
- **Fact Synchronization**: Distribute facts to connected participants
|
|
740
|
+
- **PluresDB Integration**: Persists identities and messages
|
|
741
|
+
|
|
742
|
+
**Status**: ✅ Available (`src/integrations/unum.ts`)
|
|
743
|
+
**Tests**: Comprehensive integration tests
|
|
744
|
+
**Use Cases**: Distributed messaging, identity management, multi-user collaboration
|
|
681
745
|
|
|
682
|
-
### ADP Integration
|
|
683
746
|
|
|
684
|
-
|
|
747
|
+
### State-Docs Integration
|
|
748
|
+
|
|
749
|
+
Living documentation generated from Praxis schemas. Fully implemented with Markdown and Mermaid diagram generation.
|
|
685
750
|
|
|
686
751
|
```typescript
|
|
687
|
-
import {
|
|
752
|
+
import {
|
|
753
|
+
createStateDocsGenerator,
|
|
754
|
+
generateDocs,
|
|
755
|
+
} from '@plures/praxis';
|
|
688
756
|
|
|
689
|
-
//
|
|
690
|
-
const
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
757
|
+
// Create generator
|
|
758
|
+
const generator = createStateDocsGenerator({
|
|
759
|
+
projectTitle: 'My Praxis App',
|
|
760
|
+
target: './docs',
|
|
761
|
+
visualization: {
|
|
762
|
+
format: 'mermaid',
|
|
763
|
+
theme: 'default',
|
|
764
|
+
},
|
|
765
|
+
template: {
|
|
766
|
+
toc: true,
|
|
767
|
+
timestamp: true,
|
|
768
|
+
},
|
|
701
769
|
});
|
|
702
770
|
|
|
703
|
-
//
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
771
|
+
// Generate docs from schema
|
|
772
|
+
const docs = generator.generateFromSchema(appSchema);
|
|
773
|
+
|
|
774
|
+
// Or from registry
|
|
775
|
+
const registryDocs = generator.generateFromModule(myModule);
|
|
776
|
+
|
|
777
|
+
// Write generated docs
|
|
778
|
+
for (const doc of docs) {
|
|
779
|
+
await writeFile(doc.path, doc.content);
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
// Quick helper
|
|
783
|
+
const allDocs = generateDocs(appSchema, {
|
|
784
|
+
projectTitle: 'My App',
|
|
785
|
+
target: './docs',
|
|
707
786
|
});
|
|
708
787
|
```
|
|
709
788
|
|
|
710
|
-
**
|
|
711
|
-
|
|
789
|
+
**Features:**
|
|
790
|
+
|
|
791
|
+
- **Schema Documentation**: Auto-generate docs from Praxis schemas
|
|
792
|
+
- **Mermaid Diagrams**: Visual state machine and flow diagrams
|
|
793
|
+
- **Markdown Output**: GitHub-ready documentation
|
|
794
|
+
- **Model & Component Docs**: Detailed API documentation
|
|
795
|
+
- **Logic Flow Visualization**: Event → Rule → Fact diagrams
|
|
796
|
+
- **Table of Contents**: Automatic ToC generation
|
|
712
797
|
|
|
713
|
-
|
|
798
|
+
**Status**: ✅ Available (`src/integrations/state-docs.ts`)
|
|
799
|
+
**Documentation**: Auto-generates README, models.md, logic diagrams
|
|
714
800
|
|
|
715
|
-
|
|
801
|
+
### CodeCanvas Integration
|
|
802
|
+
|
|
803
|
+
Visual IDE for schema and logic editing. Fully implemented with schema visualization and canvas export.
|
|
716
804
|
|
|
717
805
|
```typescript
|
|
718
|
-
import {
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
components: componentDefinitions,
|
|
725
|
-
output: './docs',
|
|
726
|
-
format: 'markdown', // or 'html', 'pdf'
|
|
727
|
-
});
|
|
806
|
+
import {
|
|
807
|
+
schemaToCanvas,
|
|
808
|
+
canvasToSchema,
|
|
809
|
+
canvasToMermaid,
|
|
810
|
+
createCanvasEditor,
|
|
811
|
+
} from '@plures/praxis';
|
|
728
812
|
|
|
729
|
-
//
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
// - API reference
|
|
734
|
-
// - Usage examples
|
|
735
|
-
```
|
|
813
|
+
// Convert schema to canvas document
|
|
814
|
+
const canvas = schemaToCanvas(mySchema, {
|
|
815
|
+
layout: 'hierarchical',
|
|
816
|
+
});
|
|
736
817
|
|
|
737
|
-
|
|
738
|
-
|
|
818
|
+
// Export to YAML (Obsidian Canvas compatible)
|
|
819
|
+
const yaml = canvasToYaml(canvas);
|
|
820
|
+
await writeFile('./schema.canvas.yaml', yaml);
|
|
739
821
|
|
|
740
|
-
|
|
822
|
+
// Export to Mermaid diagram
|
|
823
|
+
const mermaid = canvasToMermaid(canvas);
|
|
741
824
|
|
|
742
|
-
|
|
825
|
+
// Create canvas editor instance
|
|
826
|
+
const editor = createCanvasEditor({
|
|
827
|
+
schema: mySchema,
|
|
828
|
+
enableFSM: true,
|
|
829
|
+
layout: 'hierarchical',
|
|
830
|
+
});
|
|
743
831
|
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
832
|
+
// Add nodes programmatically
|
|
833
|
+
editor.addNode({
|
|
834
|
+
type: 'model',
|
|
835
|
+
label: 'User',
|
|
836
|
+
x: 100,
|
|
837
|
+
y: 100,
|
|
838
|
+
width: 150,
|
|
839
|
+
height: 60,
|
|
840
|
+
data: userModel,
|
|
841
|
+
});
|
|
747
842
|
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
# - Logic flow editor
|
|
751
|
-
# - Component preview
|
|
752
|
-
# - Real-time collaboration
|
|
753
|
-
# - Export to code
|
|
843
|
+
// Convert back to schema
|
|
844
|
+
const updatedSchema = editor.toSchema();
|
|
754
845
|
```
|
|
755
846
|
|
|
756
|
-
**
|
|
847
|
+
**Features:**
|
|
848
|
+
|
|
849
|
+
- **Visual Schema Design**: Node-based schema editor
|
|
850
|
+
- **Canvas Export**: YAML and Mermaid diagram formats
|
|
851
|
+
- **Obsidian Compatible**: Works with Obsidian Canvas format
|
|
852
|
+
- **FSM Visualization**: State machine and flow diagrams
|
|
853
|
+
- **Bi-directional Sync**: Canvas ↔ Schema round-tripping
|
|
854
|
+
- **Guardian Validation**: Pre-commit lifecycle checks
|
|
855
|
+
|
|
856
|
+
**Status**: ✅ Available (`src/integrations/code-canvas.ts`)
|
|
757
857
|
**Documentation**: [docs/guides/canvas.md](./docs/guides/canvas.md)
|
|
758
858
|
|
|
759
|
-
### Svelte
|
|
859
|
+
### Svelte Integration
|
|
760
860
|
|
|
761
|
-
|
|
861
|
+
Svelte v5 integration with reactive stores.
|
|
762
862
|
|
|
763
863
|
```typescript
|
|
764
|
-
// Svelte v5 integration (available now)
|
|
765
864
|
import { createPraxisStore } from '@plures/praxis/svelte';
|
|
766
865
|
|
|
767
866
|
const stateStore = createPraxisStore(engine);
|
|
@@ -769,15 +868,8 @@ const userStore = createDerivedStore(engine, (ctx) => ctx.currentUser);
|
|
|
769
868
|
|
|
770
869
|
// In Svelte component:
|
|
771
870
|
// $: currentUser = $userStore;
|
|
772
|
-
|
|
773
|
-
// Desktop app with Tauri
|
|
774
|
-
npm run tauri:dev // Development
|
|
775
|
-
npm run tauri:build // Production
|
|
776
871
|
```
|
|
777
872
|
|
|
778
|
-
**Status**: Svelte integration available, Tauri templates planned
|
|
779
|
-
**Platform Support**: Web (now), Desktop (planned), Mobile (future)
|
|
780
|
-
|
|
781
873
|
## Cross-Language Usage
|
|
782
874
|
|
|
783
875
|
### PowerShell
|
|
@@ -851,23 +943,6 @@ Console.WriteLine($"Facts: {result.State.Facts.Count}"); // Facts: 1
|
|
|
851
943
|
|
|
852
944
|
See [csharp/Praxis/README.md](./csharp/Praxis/README.md) for complete documentation.
|
|
853
945
|
|
|
854
|
-
## Roadmap
|
|
855
|
-
|
|
856
|
-
### Current Focus
|
|
857
|
-
|
|
858
|
-
- Full CodeCanvas integration
|
|
859
|
-
- Enhanced Unum identity support
|
|
860
|
-
- Advanced State-Docs generation
|
|
861
|
-
- Multi-language schema support
|
|
862
|
-
- Real PluresDB sync with CRDT/offline-first capabilities
|
|
863
|
-
|
|
864
|
-
### Long Term
|
|
865
|
-
|
|
866
|
-
- Mobile templates (iOS, Android)
|
|
867
|
-
- Enterprise features
|
|
868
|
-
- Advanced orchestration
|
|
869
|
-
- Performance optimizations
|
|
870
|
-
- Plugin ecosystem
|
|
871
946
|
|
|
872
947
|
## Cross-Language Support
|
|
873
948
|
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import {
|
|
2
|
+
InMemoryPraxisDB,
|
|
3
|
+
PluresDBPraxisAdapter,
|
|
4
|
+
createInMemoryDB,
|
|
5
|
+
createPluresDB,
|
|
6
|
+
createPraxisLocalFirst
|
|
7
|
+
} from "./chunk-MBVHLOU2.js";
|
|
8
|
+
export {
|
|
9
|
+
InMemoryPraxisDB,
|
|
10
|
+
PluresDBPraxisAdapter,
|
|
11
|
+
createInMemoryDB,
|
|
12
|
+
createPluresDB,
|
|
13
|
+
createPraxisLocalFirst
|
|
14
|
+
};
|