@plures/praxis 1.2.12 → 1.2.41
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/README.md +63 -0
- package/dist/browser/{chunk-VOMLVI6V.js → chunk-BBP2F7TT.js} +70 -1
- package/dist/browser/{chunk-K377RW4V.js → chunk-FCEH7WMH.js} +1 -1
- package/dist/browser/{engine-YJZV4SLD.js → engine-65QDGCAN.js} +1 -1
- package/dist/browser/index.d.ts +104 -2
- package/dist/browser/index.js +181 -5
- package/dist/browser/integrations/svelte.d.ts +2 -2
- package/dist/browser/integrations/svelte.js +2 -2
- package/dist/browser/{reactive-engine.svelte-9aS0kTa8.d.ts → reactive-engine.svelte-Cqd8Mod2.d.ts} +56 -1
- package/dist/node/{chunk-PRPQO6R5.js → chunk-32YFEEML.js} +1 -1
- package/dist/node/{chunk-VOMLVI6V.js → chunk-BBP2F7TT.js} +70 -1
- package/dist/node/{chunk-5RH7UAQC.js → chunk-PTH6MD6P.js} +1 -0
- package/dist/node/cli/index.cjs +1553 -839
- package/dist/node/cli/index.js +39 -2
- package/dist/node/cloud/index.d.cts +1 -1
- package/dist/node/cloud/index.d.ts +1 -1
- package/dist/node/components/index.d.cts +2 -2
- package/dist/node/components/index.d.ts +2 -2
- package/dist/node/conversations-KQBXTP3N.js +596 -0
- package/dist/node/{engine-2DQBKBJC.js → engine-7CXQV6RC.js} +1 -1
- package/dist/node/index.cjs +408 -3
- package/dist/node/index.d.cts +308 -7
- package/dist/node/index.d.ts +308 -7
- package/dist/node/index.js +336 -6
- package/dist/node/integrations/svelte.cjs +70 -1
- package/dist/node/integrations/svelte.d.cts +3 -3
- package/dist/node/integrations/svelte.d.ts +3 -3
- package/dist/node/integrations/svelte.js +2 -2
- package/dist/node/{protocol-Qek7ebBl.d.ts → protocol-BocKczNv.d.cts} +1 -1
- package/dist/node/{protocol-Qek7ebBl.d.cts → protocol-BocKczNv.d.ts} +1 -1
- package/dist/node/{reactive-engine.svelte-CRNqHlbv.d.ts → reactive-engine.svelte-CGe8SpVE.d.cts} +57 -2
- package/dist/node/{reactive-engine.svelte-BFIZfawz.d.cts → reactive-engine.svelte-D-xTDxT5.d.ts} +57 -2
- package/dist/node/{terminal-adapter-B-UK_Vdz.d.ts → terminal-adapter-CvIvgTo4.d.ts} +1 -1
- package/dist/node/{terminal-adapter-BQSIF5bf.d.cts → terminal-adapter-Db-snPJ3.d.cts} +1 -1
- package/dist/node/{validate-CNHUULQE.js → validate-EN3M4FUR.js} +1 -1
- package/dist/node/{verify-KLJRXVJS.js → verify-7VZRP2WS.js} +2 -2
- package/docs/BOT_UPDATE_POLICY.md +125 -0
- package/docs/DOGFOODING_CHECKLIST.md +254 -0
- package/docs/DOGFOODING_INDEX.md +169 -0
- package/docs/DOGFOODING_QUICK_START.md +140 -0
- package/docs/KNO_ENG_EXTRACTION_PLAN.md +577 -0
- package/docs/PLURES_TOOLS_INVENTORY.md +170 -0
- package/docs/README.md +12 -0
- package/docs/TESTING_BOT_WORKFLOWS.md +154 -0
- package/docs/conversations/INTEGRATION_POINTS.md +719 -0
- package/docs/conversations/README.md +168 -0
- package/docs/core/extending-praxis-core.md +604 -0
- package/docs/core/praxis-core-api.md +385 -0
- package/docs/decision-ledger/contract-index.json +2 -2
- package/docs/decision-ledger/decisions/2026-02-01-monorepo-organization.md +130 -0
- package/docs/examples/DOGFOODING_WORKFLOW_EXAMPLE.md +295 -0
- package/docs/examples/README.md +41 -0
- package/docs/workflows/pr-overlap-guard.md +50 -0
- package/package.json +7 -2
- package/src/__tests__/chronicle.test.ts +512 -0
- package/src/__tests__/conversations.test.ts +312 -0
- package/src/__tests__/edge-cases.test.ts +1 -1
- package/src/__tests__/engine-dx.test.ts +355 -0
- package/src/cli/commands/conversations.ts +252 -0
- package/src/cli/index.ts +73 -0
- package/src/conversations/README.md +230 -0
- package/src/conversations/candidate.schema.json +123 -0
- package/src/conversations/candidates.ts +114 -0
- package/src/conversations/capture.ts +56 -0
- package/src/conversations/classify.ts +110 -0
- package/src/conversations/conversation.schema.json +106 -0
- package/src/conversations/emitters/fs.ts +65 -0
- package/src/conversations/emitters/github.ts +115 -0
- package/src/conversations/gate.ts +102 -0
- package/src/conversations/index.ts +28 -0
- package/src/conversations/normalize.ts +51 -0
- package/src/conversations/redact.ts +57 -0
- package/src/conversations/types.ts +96 -0
- package/src/core/chronicle/chronicle.ts +227 -0
- package/src/core/chronicle/context.ts +80 -0
- package/src/core/chronicle/index.ts +53 -0
- package/src/core/chronicle/mcp.ts +135 -0
- package/src/core/chronicle/types.ts +61 -0
- package/src/core/engine.ts +99 -1
- package/src/core/pluresdb/index.ts +22 -0
- package/src/core/pluresdb/store.ts +162 -5
- package/src/core/rules.ts +12 -0
- package/src/dsl/index.ts +6 -0
- package/src/index.ts +18 -0
- package/src/integrations/pluresdb.ts +22 -0
|
@@ -0,0 +1,385 @@
|
|
|
1
|
+
# Praxis-Core API Documentation
|
|
2
|
+
|
|
3
|
+
**Version:** 1.0.0
|
|
4
|
+
**Status:** Stable
|
|
5
|
+
**Last Updated:** 2026-02-01
|
|
6
|
+
|
|
7
|
+
## Overview
|
|
8
|
+
|
|
9
|
+
Praxis-Core is the canonical logic layer of the Praxis framework. It provides the foundational primitives for building functional, declarative applications with contracts, rules, constraints, and decision ledger capabilities.
|
|
10
|
+
|
|
11
|
+
This document defines the **stable API surface** and **stability guarantees** for praxis-core.
|
|
12
|
+
|
|
13
|
+
## What is Praxis-Core?
|
|
14
|
+
|
|
15
|
+
Praxis-Core consists of the following source modules under `src/`:
|
|
16
|
+
|
|
17
|
+
### Core Modules (Stable)
|
|
18
|
+
|
|
19
|
+
1. **`src/core/protocol.ts`** - Language-neutral protocol types
|
|
20
|
+
2. **`src/core/rules.ts`** - Registry system for rules and constraints
|
|
21
|
+
3. **`src/core/engine.ts`** - Logic engine execution
|
|
22
|
+
4. **`src/core/actors.ts`** - Actor system for side effects
|
|
23
|
+
5. **`src/core/introspection.ts`** - Registry introspection and analysis
|
|
24
|
+
6. **`src/core/reactive-engine.ts`** - Framework-agnostic reactive engine
|
|
25
|
+
7. **`src/core/reactive-engine.svelte.ts`** - Svelte 5 reactive engine
|
|
26
|
+
8. **`src/dsl/`** - DSL helpers for defining facts, events, rules
|
|
27
|
+
9. **`src/decision-ledger/`** - Contract-based validation and behavior tracking
|
|
28
|
+
|
|
29
|
+
### Supporting Core Modules
|
|
30
|
+
|
|
31
|
+
10. **`src/core/schema/`** - Schema types, validation, and loading
|
|
32
|
+
11. **`src/core/component/`** - Component generation from schemas
|
|
33
|
+
12. **`src/core/logic/`** - Logic generation utilities
|
|
34
|
+
13. **`src/core/pluresdb/`** - PluresDB integration primitives
|
|
35
|
+
|
|
36
|
+
All modules above are considered part of the **praxis-core** stable API surface.
|
|
37
|
+
|
|
38
|
+
### Non-Core Modules
|
|
39
|
+
|
|
40
|
+
The following are **not** part of praxis-core but build on top of it:
|
|
41
|
+
|
|
42
|
+
- `src/integrations/` - Third-party integrations (PluresDB, Unum, Tauri, etc.)
|
|
43
|
+
- `src/cli/` - Command-line interface
|
|
44
|
+
- `src/cloud/` - Cloud synchronization
|
|
45
|
+
- `src/components/` - UI components
|
|
46
|
+
- `src/runtime/` - Runtime adapters
|
|
47
|
+
- `src/adapters/` - External adapters
|
|
48
|
+
|
|
49
|
+
## Core Modules
|
|
50
|
+
|
|
51
|
+
Praxis-Core consists of the following stable modules:
|
|
52
|
+
|
|
53
|
+
### 1. Protocol (`src/core/protocol.ts`)
|
|
54
|
+
|
|
55
|
+
The language-neutral, JSON-friendly protocol that forms the foundation of Praxis.
|
|
56
|
+
|
|
57
|
+
**Stability: STABLE** - These types will not change in backward-incompatible ways within the same major version.
|
|
58
|
+
|
|
59
|
+
#### Exported Types
|
|
60
|
+
|
|
61
|
+
- `PraxisFact` - A typed proposition about the domain
|
|
62
|
+
- `PraxisEvent` - A temporally ordered fact meant to drive change
|
|
63
|
+
- `PraxisState` - The state of the Praxis engine at a point in time
|
|
64
|
+
- `PraxisDiagnostics` - Diagnostic information about violations or errors
|
|
65
|
+
- `PraxisStepConfig` - Configuration for step execution
|
|
66
|
+
- `PraxisStepResult` - Result of a step execution
|
|
67
|
+
- `PraxisStepFn` - The core step function signature
|
|
68
|
+
|
|
69
|
+
#### Exported Constants
|
|
70
|
+
|
|
71
|
+
- `PRAXIS_PROTOCOL_VERSION` - Current protocol version (follows semver)
|
|
72
|
+
|
|
73
|
+
#### Stability Guarantees
|
|
74
|
+
|
|
75
|
+
1. **Core Types Stability**: All protocol types maintain backward compatibility within major versions
|
|
76
|
+
2. **JSON Compatibility**: All types remain JSON-serializable
|
|
77
|
+
3. **Cross-Language Compatibility**: Changes coordinated across TypeScript, C#, and PowerShell implementations
|
|
78
|
+
4. **Migration Path**: Major version changes include migration guides and deprecation warnings
|
|
79
|
+
|
|
80
|
+
### 2. Rules & Constraints (`src/core/rules.ts`)
|
|
81
|
+
|
|
82
|
+
The registry system for rules and constraints with contract compliance support.
|
|
83
|
+
|
|
84
|
+
**Stability: STABLE**
|
|
85
|
+
|
|
86
|
+
#### Exported Types
|
|
87
|
+
|
|
88
|
+
- `RuleId` - Unique identifier for a rule
|
|
89
|
+
- `ConstraintId` - Unique identifier for a constraint
|
|
90
|
+
- `RuleFn<TContext>` - Rule function signature (pure, no side effects)
|
|
91
|
+
- `ConstraintFn<TContext>` - Constraint function signature (pure, no side effects)
|
|
92
|
+
- `RuleDescriptor<TContext>` - Complete rule definition with metadata
|
|
93
|
+
- `ConstraintDescriptor<TContext>` - Complete constraint definition with metadata
|
|
94
|
+
- `PraxisModule<TContext>` - Bundle of rules and constraints
|
|
95
|
+
- `RegistryComplianceOptions` - Contract compliance configuration
|
|
96
|
+
- `PraxisRegistryOptions` - Registry configuration options
|
|
97
|
+
|
|
98
|
+
#### Exported Classes
|
|
99
|
+
|
|
100
|
+
- `PraxisRegistry<TContext>` - Central registry for rules and constraints
|
|
101
|
+
|
|
102
|
+
##### Registry Methods (Public API)
|
|
103
|
+
|
|
104
|
+
```typescript
|
|
105
|
+
class PraxisRegistry<TContext> {
|
|
106
|
+
// Registration
|
|
107
|
+
registerRule(descriptor: RuleDescriptor<TContext>): void
|
|
108
|
+
registerConstraint(descriptor: ConstraintDescriptor<TContext>): void
|
|
109
|
+
registerModule(module: PraxisModule<TContext>): void
|
|
110
|
+
|
|
111
|
+
// Lookup
|
|
112
|
+
getRule(id: RuleId): RuleDescriptor<TContext> | undefined
|
|
113
|
+
getConstraint(id: ConstraintId): ConstraintDescriptor<TContext> | undefined
|
|
114
|
+
getRuleIds(): RuleId[]
|
|
115
|
+
getConstraintIds(): ConstraintId[]
|
|
116
|
+
getAllRules(): RuleDescriptor<TContext>[]
|
|
117
|
+
getAllConstraints(): ConstraintDescriptor<TContext>[]
|
|
118
|
+
|
|
119
|
+
// Contract Compliance
|
|
120
|
+
getContractGaps(): ContractGap[]
|
|
121
|
+
clearContractGaps(): void
|
|
122
|
+
}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
#### Stability Guarantees
|
|
126
|
+
|
|
127
|
+
1. **ID Stability**: Rule and constraint IDs are permanent identifiers
|
|
128
|
+
2. **Function Signatures**: `RuleFn` and `ConstraintFn` signatures will not change
|
|
129
|
+
3. **Registry API**: Public methods will maintain backward compatibility
|
|
130
|
+
4. **Compliance Optional**: Contract compliance checks can be disabled in production
|
|
131
|
+
|
|
132
|
+
### 3. Logic Engine (`src/core/engine.ts`)
|
|
133
|
+
|
|
134
|
+
The core execution engine that processes events through rules and checks constraints.
|
|
135
|
+
|
|
136
|
+
**Stability: STABLE**
|
|
137
|
+
|
|
138
|
+
#### Exported Types
|
|
139
|
+
|
|
140
|
+
- `PraxisEngineOptions<TContext>` - Configuration for engine creation
|
|
141
|
+
|
|
142
|
+
#### Exported Classes
|
|
143
|
+
|
|
144
|
+
- `LogicEngine<TContext>` - The main logic engine
|
|
145
|
+
|
|
146
|
+
##### Engine Methods (Public API)
|
|
147
|
+
|
|
148
|
+
```typescript
|
|
149
|
+
class LogicEngine<TContext> {
|
|
150
|
+
// State Access
|
|
151
|
+
getState(): Readonly<PraxisState & { context: TContext }>
|
|
152
|
+
getContext(): TContext
|
|
153
|
+
getFacts(): PraxisFact[]
|
|
154
|
+
|
|
155
|
+
// Execution
|
|
156
|
+
step(events: PraxisEvent[]): PraxisStepResult
|
|
157
|
+
stepWithConfig(events: PraxisEvent[], config: PraxisStepConfig): PraxisStepResult
|
|
158
|
+
|
|
159
|
+
// Direct Manipulation (exceptional cases)
|
|
160
|
+
updateContext(updater: (context: TContext) => TContext): void
|
|
161
|
+
addFacts(facts: PraxisFact[]): void
|
|
162
|
+
clearFacts(): void
|
|
163
|
+
reset(options: PraxisEngineOptions<TContext>): void
|
|
164
|
+
}
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
#### Exported Functions
|
|
168
|
+
|
|
169
|
+
- `createPraxisEngine<TContext>(options: PraxisEngineOptions<TContext>): LogicEngine<TContext>`
|
|
170
|
+
|
|
171
|
+
#### Stability Guarantees
|
|
172
|
+
|
|
173
|
+
1. **Immutability**: All state returns are immutable copies
|
|
174
|
+
2. **Purity**: Rule and constraint functions must be pure
|
|
175
|
+
3. **Determinism**: Same inputs always produce same outputs
|
|
176
|
+
4. **Error Handling**: Errors captured in diagnostics, never thrown during step
|
|
177
|
+
|
|
178
|
+
### 4. DSL Helpers (`src/dsl/index.ts`)
|
|
179
|
+
|
|
180
|
+
Ergonomic TypeScript helpers for defining typed facts, events, rules, and constraints.
|
|
181
|
+
|
|
182
|
+
**Stability: STABLE**
|
|
183
|
+
|
|
184
|
+
#### Exported Types
|
|
185
|
+
|
|
186
|
+
- `FactDefinition<TTag, TPayload>` - Typed fact definition
|
|
187
|
+
- `EventDefinition<TTag, TPayload>` - Typed event definition
|
|
188
|
+
- `DefineRuleOptions<TContext>` - Options for defining rules
|
|
189
|
+
- `DefineConstraintOptions<TContext>` - Options for defining constraints
|
|
190
|
+
- `DefineModuleOptions<TContext>` - Options for defining modules
|
|
191
|
+
|
|
192
|
+
#### Exported Functions
|
|
193
|
+
|
|
194
|
+
```typescript
|
|
195
|
+
// Factory Functions
|
|
196
|
+
defineFact<TTag, TPayload>(tag: TTag): FactDefinition<TTag, TPayload>
|
|
197
|
+
defineEvent<TTag, TPayload>(tag: TTag): EventDefinition<TTag, TPayload>
|
|
198
|
+
defineRule<TContext>(options: DefineRuleOptions<TContext>): RuleDescriptor<TContext>
|
|
199
|
+
defineConstraint<TContext>(options: DefineConstraintOptions<TContext>): ConstraintDescriptor<TContext>
|
|
200
|
+
defineModule<TContext>(options: DefineModuleOptions<TContext>): PraxisModule<TContext>
|
|
201
|
+
|
|
202
|
+
// Helper Functions
|
|
203
|
+
filterEvents<T extends PraxisEvent>(events: PraxisEvent[], predicate: (e: PraxisEvent) => e is T): T[]
|
|
204
|
+
filterFacts<T extends PraxisFact>(facts: PraxisFact[], predicate: (f: PraxisFact) => f is T): T[]
|
|
205
|
+
findEvent<T extends PraxisEvent>(events: PraxisEvent[], predicate: (e: PraxisEvent) => e is T): T | undefined
|
|
206
|
+
findFact<T extends PraxisFact>(facts: PraxisFact[], predicate: (f: PraxisFact) => f is T): T | undefined
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
#### Stability Guarantees
|
|
210
|
+
|
|
211
|
+
1. **Type Safety**: All definitions provide compile-time type safety
|
|
212
|
+
2. **Runtime Safety**: Type guards validate structure at runtime
|
|
213
|
+
3. **Serialization**: All definitions produce JSON-serializable output
|
|
214
|
+
4. **Composability**: Definitions can be freely composed and reused
|
|
215
|
+
|
|
216
|
+
### 5. Decision Ledger (`src/decision-ledger/`)
|
|
217
|
+
|
|
218
|
+
Contract-based validation and behavior tracking for rules and constraints.
|
|
219
|
+
|
|
220
|
+
**Stability: STABLE**
|
|
221
|
+
|
|
222
|
+
#### Exported Types
|
|
223
|
+
|
|
224
|
+
- `Contract` - Contract definition for rules/constraints
|
|
225
|
+
- `Example` - Given/When/Then test example
|
|
226
|
+
- `Assumption` - Explicit assumption with confidence level
|
|
227
|
+
- `Reference` - External reference (docs, tickets, etc.)
|
|
228
|
+
- `ContractGap` - Information about missing contract elements
|
|
229
|
+
- `MissingArtifact` - Type of missing contract artifact
|
|
230
|
+
- `Severity` - Severity level for validation issues
|
|
231
|
+
- `ValidationReport` - Report of contract validation
|
|
232
|
+
- `ValidateOptions` - Options for contract validation
|
|
233
|
+
- `LedgerEntry` - Immutable snapshot of rule behavior
|
|
234
|
+
- `LedgerEntryStatus` - Status of ledger entry
|
|
235
|
+
|
|
236
|
+
#### Exported Functions
|
|
237
|
+
|
|
238
|
+
```typescript
|
|
239
|
+
// Contract Definition
|
|
240
|
+
defineContract(options: DefineContractOptions): Contract
|
|
241
|
+
getContract(descriptor: RuleDescriptor | ConstraintDescriptor): Contract | undefined
|
|
242
|
+
isContract(obj: unknown): obj is Contract
|
|
243
|
+
|
|
244
|
+
// Validation
|
|
245
|
+
validateContracts(registry: PraxisRegistry, options?: ValidateOptions): ValidationReport
|
|
246
|
+
formatValidationReport(report: ValidationReport): string
|
|
247
|
+
formatValidationReportJSON(report: ValidationReport): string
|
|
248
|
+
formatValidationReportSARIF(report: ValidationReport): string
|
|
249
|
+
|
|
250
|
+
// Ledger
|
|
251
|
+
createBehaviorLedger(basePath: string): BehaviorLedger
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
#### Exported Events/Facts
|
|
255
|
+
|
|
256
|
+
- `ContractMissing` - Fact emitted when contract is missing
|
|
257
|
+
- `ContractValidated` - Fact emitted when contract is validated
|
|
258
|
+
- `ContractGapAcknowledged` - Fact emitted when gap is acknowledged
|
|
259
|
+
- `ContractAdded` - Event for adding a contract
|
|
260
|
+
- `ContractUpdated` - Event for updating a contract
|
|
261
|
+
- `AcknowledgeContractGap` - Event to acknowledge a gap
|
|
262
|
+
- `ValidateContracts` - Event to trigger validation
|
|
263
|
+
|
|
264
|
+
#### Exported Classes
|
|
265
|
+
|
|
266
|
+
- `BehaviorLedger` - Immutable ledger for tracking behavior changes
|
|
267
|
+
|
|
268
|
+
#### Stability Guarantees
|
|
269
|
+
|
|
270
|
+
1. **Contract Schema**: Contract structure remains backward compatible
|
|
271
|
+
2. **Validation API**: Validation functions maintain signatures
|
|
272
|
+
3. **Ledger Immutability**: Ledger entries are append-only, never modified
|
|
273
|
+
4. **Output Formats**: SARIF and JSON output formats remain stable
|
|
274
|
+
|
|
275
|
+
## API Stability Levels
|
|
276
|
+
|
|
277
|
+
### Stable
|
|
278
|
+
|
|
279
|
+
APIs marked as **STABLE** follow semantic versioning:
|
|
280
|
+
|
|
281
|
+
- **Patch** (1.0.x): Bug fixes, documentation, no API changes
|
|
282
|
+
- **Minor** (1.x.0): New features, backward-compatible additions
|
|
283
|
+
- **Major** (x.0.0): Breaking changes (with migration guide)
|
|
284
|
+
|
|
285
|
+
Stable APIs will:
|
|
286
|
+
- Not remove exported functions, classes, or types
|
|
287
|
+
- Not change function signatures in breaking ways
|
|
288
|
+
- Provide deprecation warnings before removal
|
|
289
|
+
- Include migration guides for breaking changes
|
|
290
|
+
|
|
291
|
+
### Experimental
|
|
292
|
+
|
|
293
|
+
APIs marked as **EXPERIMENTAL** may change without notice. Use with caution in production.
|
|
294
|
+
|
|
295
|
+
Currently, no core APIs are experimental. All extensions and integrations may have their own stability levels.
|
|
296
|
+
|
|
297
|
+
## Versioning
|
|
298
|
+
|
|
299
|
+
Praxis-Core follows [Semantic Versioning 2.0.0](https://semver.org/):
|
|
300
|
+
|
|
301
|
+
```
|
|
302
|
+
MAJOR.MINOR.PATCH
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
- **MAJOR**: Breaking changes to the core API
|
|
306
|
+
- **MINOR**: New features, backward-compatible additions
|
|
307
|
+
- **PATCH**: Bug fixes, documentation updates
|
|
308
|
+
|
|
309
|
+
### Version Compatibility
|
|
310
|
+
|
|
311
|
+
| Praxis Version | Protocol Version | Min Node.js | Min Deno |
|
|
312
|
+
|----------------|------------------|-------------|----------|
|
|
313
|
+
| 1.x.x | 1.0.0 | 18.0.0 | 1.37.0 |
|
|
314
|
+
|
|
315
|
+
### Deprecation Policy
|
|
316
|
+
|
|
317
|
+
1. **Announcement**: Deprecations announced at least one minor version in advance
|
|
318
|
+
2. **Warnings**: Deprecated APIs emit runtime warnings in development mode
|
|
319
|
+
3. **Documentation**: Deprecated APIs marked clearly in docs with alternatives
|
|
320
|
+
4. **Removal**: Deprecated APIs removed only in next major version
|
|
321
|
+
|
|
322
|
+
## Non-Breaking Changes
|
|
323
|
+
|
|
324
|
+
The following changes are considered non-breaking:
|
|
325
|
+
|
|
326
|
+
- Adding new optional parameters with defaults
|
|
327
|
+
- Adding new methods to classes
|
|
328
|
+
- Adding new exported functions or types
|
|
329
|
+
- Adding new fields to options objects (as optional)
|
|
330
|
+
- Performance improvements
|
|
331
|
+
- Bug fixes that restore documented behavior
|
|
332
|
+
- Internal refactoring without API changes
|
|
333
|
+
|
|
334
|
+
## Breaking Changes
|
|
335
|
+
|
|
336
|
+
The following changes are considered breaking:
|
|
337
|
+
|
|
338
|
+
- Removing exported functions, classes, or types
|
|
339
|
+
- Changing function signatures (parameters or return types)
|
|
340
|
+
- Changing behavior in incompatible ways
|
|
341
|
+
- Renaming exports without aliases
|
|
342
|
+
- Making optional parameters required
|
|
343
|
+
- Changing TypeScript compiler requirements
|
|
344
|
+
|
|
345
|
+
## Cross-Language Compatibility
|
|
346
|
+
|
|
347
|
+
Praxis-Core maintains implementations in:
|
|
348
|
+
|
|
349
|
+
- **TypeScript** (reference implementation)
|
|
350
|
+
- **C#** (.NET)
|
|
351
|
+
- **PowerShell**
|
|
352
|
+
|
|
353
|
+
All core types and protocol definitions are coordinated across implementations to ensure:
|
|
354
|
+
|
|
355
|
+
1. **Data Portability**: State, facts, and events can be serialized and shared
|
|
356
|
+
2. **Behavior Consistency**: Same rules produce same results
|
|
357
|
+
3. **Version Synchronization**: Major versions released in lockstep
|
|
358
|
+
|
|
359
|
+
## Testing Guarantees
|
|
360
|
+
|
|
361
|
+
Praxis-Core maintains:
|
|
362
|
+
|
|
363
|
+
1. **Unit Tests**: All public APIs have unit test coverage
|
|
364
|
+
2. **Integration Tests**: Cross-module integration tested
|
|
365
|
+
3. **Contract Tests**: All core rules/constraints have contracts
|
|
366
|
+
4. **Cross-Language Tests**: Protocol compatibility verified across implementations
|
|
367
|
+
5. **Performance Tests**: No performance regressions in stable APIs
|
|
368
|
+
|
|
369
|
+
## Support
|
|
370
|
+
|
|
371
|
+
- **Documentation**: Full API documentation at [docs/core/](.)
|
|
372
|
+
- **Examples**: Reference examples in [examples/](../../examples/)
|
|
373
|
+
- **Issues**: Bug reports at [GitHub Issues](https://github.com/plures/praxis/issues)
|
|
374
|
+
- **Discussions**: Questions at [GitHub Discussions](https://github.com/plures/praxis/discussions)
|
|
375
|
+
|
|
376
|
+
## References
|
|
377
|
+
|
|
378
|
+
- [Extending Praxis-Core](./extending-praxis-core.md)
|
|
379
|
+
- [Decision Ledger Dogfooding](../decision-ledger/DOGFOODING.md)
|
|
380
|
+
- [Contributing Guide](../../CONTRIBUTING.md)
|
|
381
|
+
- [Protocol Versioning](../../PROTOCOL_VERSIONING.md)
|
|
382
|
+
|
|
383
|
+
---
|
|
384
|
+
|
|
385
|
+
**Next:** [Extending Praxis-Core](./extending-praxis-core.md)
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
# Decision: Monorepo Organization with Package Boundaries
|
|
2
|
+
|
|
3
|
+
**Date**: 2026-02-01
|
|
4
|
+
|
|
5
|
+
**Status**: Proposed
|
|
6
|
+
|
|
7
|
+
**Context**: The Praxis repository has grown to include multiple concerns (core logic, Svelte integration, CLI tools, cloud features) all in a single package structure. This makes it difficult for users to use only what they need and creates unclear ownership boundaries.
|
|
8
|
+
|
|
9
|
+
## Decision
|
|
10
|
+
|
|
11
|
+
Organize the Praxis repository as a monorepo with clearly separated packages:
|
|
12
|
+
|
|
13
|
+
1. **@plures/praxis-core**: Core logic library (facts, events, rules, constraints, schemas, decision ledger)
|
|
14
|
+
2. **@plures/praxis-cli**: Command-line interface and code generators
|
|
15
|
+
3. **@plures/praxis-svelte**: Svelte 5 integration and reactive runtime
|
|
16
|
+
4. **@plures/praxis-cloud**: Cloud sync and relay server
|
|
17
|
+
5. **@plures/praxis**: Main package that re-exports everything
|
|
18
|
+
|
|
19
|
+
## Rationale
|
|
20
|
+
|
|
21
|
+
### Benefits
|
|
22
|
+
|
|
23
|
+
1. **Clearer Boundaries**: Each package has a well-defined purpose and ownership
|
|
24
|
+
2. **Smaller Bundles**: Users can import only what they need (tree-shaking at package level)
|
|
25
|
+
3. **Independent Versioning**: Packages can evolve at different rates (though we'll keep them synchronized initially)
|
|
26
|
+
4. **Better Testing**: Each package can be tested in isolation
|
|
27
|
+
5. **Easier Onboarding**: New contributors can focus on specific packages
|
|
28
|
+
6. **Zero-Dependency Core**: Core logic has no external dependencies, making it portable
|
|
29
|
+
|
|
30
|
+
### Trade-offs
|
|
31
|
+
|
|
32
|
+
1. **Complexity**: More packages to manage and publish
|
|
33
|
+
2. **Migration Effort**: Requires gradual migration of existing code
|
|
34
|
+
3. **Build Coordination**: Need to ensure packages build in correct order
|
|
35
|
+
4. **Import Changes**: Users may need to update imports (though backwards compatibility is maintained)
|
|
36
|
+
|
|
37
|
+
### Alternatives Considered
|
|
38
|
+
|
|
39
|
+
1. **Keep Current Structure**: Rejected because it doesn't scale well and creates unclear boundaries
|
|
40
|
+
2. **Separate Repositories**: Rejected because it makes coordination harder and increases overhead
|
|
41
|
+
3. **Lerna/Nx Monorepo**: Considered but decided to start with npm workspaces for simplicity
|
|
42
|
+
|
|
43
|
+
## Implementation Plan
|
|
44
|
+
|
|
45
|
+
### Phase 1: Documentation (Complete)
|
|
46
|
+
- Create MONOREPO.md with target structure
|
|
47
|
+
- Create package README files
|
|
48
|
+
- Update CONTRIBUTING.md and README.md
|
|
49
|
+
- Create MIGRATION_GUIDE.md
|
|
50
|
+
|
|
51
|
+
### Phase 2: Package Structure (In Progress)
|
|
52
|
+
- Create package directories
|
|
53
|
+
- Create package.json files
|
|
54
|
+
- Set up workspace configuration
|
|
55
|
+
- Configure build tools
|
|
56
|
+
|
|
57
|
+
### Phase 3: Core Extraction
|
|
58
|
+
- Move logic engine to praxis-core
|
|
59
|
+
- Move schema system to praxis-core
|
|
60
|
+
- Move decision ledger to praxis-core
|
|
61
|
+
- Update imports
|
|
62
|
+
- Verify tests
|
|
63
|
+
|
|
64
|
+
### Phase 4: Integration Extraction
|
|
65
|
+
- Move CLI to praxis-cli
|
|
66
|
+
- Move Svelte integration to praxis-svelte
|
|
67
|
+
- Move cloud features to praxis-cloud
|
|
68
|
+
- Update imports
|
|
69
|
+
- Verify tests
|
|
70
|
+
|
|
71
|
+
### Phase 5: Compatibility Layer
|
|
72
|
+
- Create main praxis package with re-exports
|
|
73
|
+
- Verify existing imports work
|
|
74
|
+
- Document new import patterns
|
|
75
|
+
|
|
76
|
+
### Phase 6: Examples Migration
|
|
77
|
+
- Move example apps to apps/
|
|
78
|
+
- Update dependencies
|
|
79
|
+
- Verify apps work
|
|
80
|
+
|
|
81
|
+
## Success Criteria
|
|
82
|
+
|
|
83
|
+
1. All packages build successfully
|
|
84
|
+
2. All tests pass
|
|
85
|
+
3. Existing imports continue to work
|
|
86
|
+
4. New granular imports are available
|
|
87
|
+
5. Documentation is updated
|
|
88
|
+
6. CI/CD pipeline works with new structure
|
|
89
|
+
|
|
90
|
+
## Risks and Mitigations
|
|
91
|
+
|
|
92
|
+
### Risk: Breaking Existing Users
|
|
93
|
+
**Mitigation**: Maintain backwards compatibility with main package re-exports
|
|
94
|
+
|
|
95
|
+
### Risk: Build Complexity
|
|
96
|
+
**Mitigation**: Use npm workspaces for simple, native build coordination
|
|
97
|
+
|
|
98
|
+
### Risk: Package Versioning Confusion
|
|
99
|
+
**Mitigation**: Keep all packages synchronized at the same version initially
|
|
100
|
+
|
|
101
|
+
### Risk: Migration Takes Too Long
|
|
102
|
+
**Mitigation**: Incremental approach allows partial progress; existing code still works
|
|
103
|
+
|
|
104
|
+
## Principles
|
|
105
|
+
|
|
106
|
+
1. **Incremental**: Changes happen step-by-step
|
|
107
|
+
2. **Non-Breaking**: Existing code continues to work
|
|
108
|
+
3. **Reversible**: Each step can be rolled back
|
|
109
|
+
4. **Tested**: Tests run after each change
|
|
110
|
+
5. **Documented**: Updates documented as we go
|
|
111
|
+
|
|
112
|
+
## References
|
|
113
|
+
|
|
114
|
+
- [MONOREPO.md](../../../MONOREPO.md) - Complete monorepo plan
|
|
115
|
+
- [MIGRATION_GUIDE.md](../../../MIGRATION_GUIDE.md) - User and contributor guide
|
|
116
|
+
- [npm Workspaces Documentation](https://docs.npmjs.com/cli/v7/using-npm/workspaces)
|
|
117
|
+
- [TypeScript Project References](https://www.typescriptlang.org/docs/handbook/project-references.html)
|
|
118
|
+
|
|
119
|
+
## Review and Approval
|
|
120
|
+
|
|
121
|
+
- **Proposed by**: Copilot
|
|
122
|
+
- **Reviewed by**: [Pending]
|
|
123
|
+
- **Approved by**: [Pending]
|
|
124
|
+
|
|
125
|
+
## Follow-up Actions
|
|
126
|
+
|
|
127
|
+
1. Review this decision with team
|
|
128
|
+
2. Get approval to proceed with implementation
|
|
129
|
+
3. Complete Phase 2 (package structure)
|
|
130
|
+
4. Begin Phase 3 (core extraction)
|