@plures/praxis 1.4.4 → 2.0.3
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 +164 -1067
- package/dist/browser/chunk-IUEKGHQN.js +373 -0
- package/dist/browser/factory/index.d.ts +2 -1
- package/dist/browser/index.d.ts +7 -4
- package/dist/browser/index.js +18 -6
- package/dist/browser/integrations/svelte.d.ts +4 -3
- package/dist/browser/project/index.d.ts +2 -1
- package/dist/browser/{reactive-engine.svelte-DgVTqHLc.d.ts → reactive-engine.svelte-BwWadvAW.d.ts} +2 -1
- package/dist/browser/rule-result-DcXWe9tn.d.ts +206 -0
- package/dist/browser/{rules-i1LHpnGd.d.ts → rules-BaWMqxuG.d.ts} +2 -205
- package/dist/browser/unified/index.d.ts +239 -0
- package/dist/browser/unified/index.js +20 -0
- package/dist/node/chunk-IUEKGHQN.js +373 -0
- package/dist/node/cli/index.js +1 -1
- package/dist/node/index.cjs +377 -0
- package/dist/node/index.d.cts +4 -2
- package/dist/node/index.d.ts +4 -2
- package/dist/node/index.js +19 -7
- package/dist/node/integrations/svelte.d.cts +3 -2
- package/dist/node/integrations/svelte.d.ts +3 -2
- package/dist/node/integrations/svelte.js +2 -2
- package/dist/node/{reactive-engine.svelte-DekxqFu0.d.ts → reactive-engine.svelte-BBZLMzus.d.ts} +3 -79
- package/dist/node/{reactive-engine.svelte-Cg0Yc2Hs.d.cts → reactive-engine.svelte-Cbq_V20o.d.cts} +3 -79
- package/dist/node/rule-result-B9GMivAn.d.cts +80 -0
- package/dist/node/rule-result-Bo3sFMmN.d.ts +80 -0
- package/dist/node/unified/index.cjs +494 -0
- package/dist/node/unified/index.d.cts +240 -0
- package/dist/node/unified/index.d.ts +240 -0
- package/dist/node/unified/index.js +21 -0
- package/docs/README.md +58 -102
- package/docs/archive/1.x/CONVERSATIONS_IMPLEMENTATION.md +207 -0
- package/docs/archive/1.x/DECISION_LEDGER_IMPLEMENTATION.md +109 -0
- package/docs/archive/1.x/DECISION_LEDGER_SUMMARY.md +424 -0
- package/docs/archive/1.x/ELEVATION_SUMMARY.md +249 -0
- package/docs/archive/1.x/FEATURE_SUMMARY.md +238 -0
- package/docs/archive/1.x/GOLDEN_PATH_IMPLEMENTATION.md +280 -0
- package/docs/archive/1.x/IMPLEMENTATION.md +166 -0
- package/docs/archive/1.x/IMPLEMENTATION_COMPLETE.md +389 -0
- package/docs/archive/1.x/IMPLEMENTATION_SUMMARY.md +59 -0
- package/docs/archive/1.x/INTEGRATION_ENHANCEMENT_SUMMARY.md +238 -0
- package/docs/archive/1.x/KNO_ENG_REFACTORING_SUMMARY.md +198 -0
- package/docs/archive/1.x/MONOREPO_SUMMARY.md +158 -0
- package/docs/archive/1.x/README.md +28 -0
- package/docs/archive/1.x/SVELTE_INTEGRATION_SUMMARY.md +415 -0
- package/docs/archive/1.x/TASK_1_COMPLETE.md +235 -0
- package/docs/archive/1.x/TASK_1_SUMMARY.md +281 -0
- package/docs/archive/1.x/VERSION_0.2.0_RELEASE_NOTES.md +288 -0
- package/docs/archive/1.x/ValidationChecklist.md +7 -0
- package/package.json +13 -1
- package/src/index.browser.ts +20 -0
- package/src/index.ts +21 -0
- package/src/unified/__tests__/unified-qa.test.ts +761 -0
- package/src/unified/__tests__/unified.test.ts +396 -0
- package/src/unified/core.ts +534 -0
- package/src/unified/index.ts +32 -0
- package/src/unified/rules.ts +66 -0
- package/src/unified/types.ts +148 -0
- package/dist/node/{chunk-ZO2LU4G4.js → chunk-WFRHXZBP.js} +3 -3
- package/dist/node/{validate-5PSWJTIC.js → validate-BY7JNY7H.js} +1 -1
package/docs/README.md
CHANGED
|
@@ -1,81 +1,77 @@
|
|
|
1
|
-
# Praxis Documentation
|
|
1
|
+
# Praxis 2.0 Documentation
|
|
2
2
|
|
|
3
|
-
Welcome to the official Praxis documentation
|
|
3
|
+
Welcome to the official Praxis documentation. Praxis is the full-stack declarative application framework for the Plures ecosystem — typed logic, reactive state, local-first data, and visual tooling for Svelte, Node, and the browser.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
**Start here for dogfooding:** [Dogfooding Index](./DOGFOODING_INDEX.md)
|
|
8
|
-
|
|
9
|
-
We actively dogfood all Plures tools during development. Key resources:
|
|
10
|
-
- [Quick Start Guide](./DOGFOODING_QUICK_START.md) - Get started in 5 minutes
|
|
11
|
-
- [Dogfooding Checklist](./DOGFOODING_CHECKLIST.md) - Daily/weekly/monthly workflows
|
|
12
|
-
- [Plures Tools Inventory](./PLURES_TOOLS_INVENTORY.md) - All available tools
|
|
13
|
-
- [Workflow Examples](./examples/DOGFOODING_WORKFLOW_EXAMPLE.md) - See it in action
|
|
5
|
+
> **New to Praxis?** Start with the [Getting Started guide](../GETTING_STARTED.md).
|
|
6
|
+
> **Upgrading from 1.x?** See the [Migration Guide](../MIGRATION_GUIDE.md).
|
|
14
7
|
|
|
15
8
|
## Quick Start
|
|
16
9
|
|
|
17
10
|
```bash
|
|
18
|
-
# Install Praxis
|
|
19
11
|
npm install @plures/praxis
|
|
20
|
-
|
|
21
|
-
# Create a new app
|
|
22
12
|
npx praxis create app my-app
|
|
23
|
-
cd my-app
|
|
24
|
-
npm install
|
|
25
|
-
|
|
26
|
-
# Start development
|
|
27
|
-
npm run dev
|
|
28
13
|
```
|
|
29
14
|
|
|
30
15
|
## Documentation Index
|
|
31
16
|
|
|
32
17
|
### Core Concepts
|
|
33
18
|
|
|
34
|
-
| Document
|
|
35
|
-
|
|
36
|
-
| [What is Praxis](./core/what-is-praxis.md)
|
|
37
|
-
| [Praxis-Core API](./core/praxis-core-api.md)
|
|
38
|
-
| [Extending Praxis-Core](./core/extending-praxis-core.md) | Extension guidelines
|
|
39
|
-
| [Schema Model](./core/schema-model.md)
|
|
40
|
-
| [Logic Engine](./core/logic-engine.md)
|
|
41
|
-
| [UI Generation](./core/ui-generation.md)
|
|
42
|
-
| [PluresDB Integration](./core/pluresdb-integration.md) | Local-first data with reactive storage
|
|
43
|
-
| [Code ↔ Canvas Sync](./core/code-canvas-sync.md)
|
|
44
|
-
| [CLI Usage](./core/cli-usage.md)
|
|
45
|
-
| [Building Extensions](./core/building-extensions.md)
|
|
19
|
+
| Document | Description |
|
|
20
|
+
|----------|-------------|
|
|
21
|
+
| [What is Praxis](./core/what-is-praxis.md) | Overview and philosophy |
|
|
22
|
+
| [Praxis-Core API](./core/praxis-core-api.md) | Stable API surface and guarantees |
|
|
23
|
+
| [Extending Praxis-Core](./core/extending-praxis-core.md) | Extension guidelines |
|
|
24
|
+
| [Schema Model](./core/schema-model.md) | Praxis Schema Format (PSF) |
|
|
25
|
+
| [Logic Engine](./core/logic-engine.md) | Facts, events, rules, and constraints |
|
|
26
|
+
| [UI Generation](./core/ui-generation.md) | Component generation from schemas |
|
|
27
|
+
| [PluresDB Integration](./core/pluresdb-integration.md) | Local-first data with reactive storage |
|
|
28
|
+
| [Code ↔ Canvas Sync](./core/code-canvas-sync.md) | Bidirectional synchronization |
|
|
29
|
+
| [CLI Usage](./core/cli-usage.md) | Command-line interface reference |
|
|
30
|
+
| [Building Extensions](./core/building-extensions.md) | Extending Praxis |
|
|
46
31
|
|
|
47
32
|
### Guides
|
|
48
33
|
|
|
49
|
-
| Guide
|
|
50
|
-
|
|
51
|
-
| [Getting Started](./guides/getting-started.md)
|
|
52
|
-
| [Svelte Integration](./guides/svelte-integration.md)
|
|
53
|
-
| [Canvas](./guides/canvas.md)
|
|
34
|
+
| Guide | Description |
|
|
35
|
+
|-------|-------------|
|
|
36
|
+
| [Getting Started](./guides/getting-started.md) | First steps with Praxis |
|
|
37
|
+
| [Svelte Integration](./guides/svelte-integration.md) | Using Praxis with Svelte 5 |
|
|
38
|
+
| [Canvas](./guides/canvas.md) | Visual development with CodeCanvas |
|
|
54
39
|
| [History & State Patterns](./guides/history-state-pattern.md) | Undo/redo and time-travel debugging |
|
|
55
|
-
| [Parallel State Patterns](./guides/parallel-state-pattern.md) | Managing parallel state machines
|
|
56
|
-
| [Orchestration](./guides/orchestration.md)
|
|
40
|
+
| [Parallel State Patterns](./guides/parallel-state-pattern.md) | Managing parallel state machines |
|
|
41
|
+
| [Orchestration](./guides/orchestration.md) | Distributed system coordination |
|
|
42
|
+
| [CI/CD Pipeline](./guides/cicd-pipeline.md) | Continuous integration setup |
|
|
57
43
|
|
|
58
44
|
### Tutorials
|
|
59
45
|
|
|
60
|
-
| Tutorial
|
|
61
|
-
|
|
62
|
-
| [Build Your First App](./tutorials/first-app.md)
|
|
63
|
-
| [Todo with PluresDB](./tutorials/todo-pluresdb.md) | Local-first todo application
|
|
64
|
-
| [Form Builder](./tutorials/form-builder.md)
|
|
65
|
-
| [E-commerce Cart](./tutorials/ecommerce-cart.md)
|
|
46
|
+
| Tutorial | Description |
|
|
47
|
+
|----------|-------------|
|
|
48
|
+
| [Build Your First App](./tutorials/first-app.md) | Step-by-step beginner tutorial |
|
|
49
|
+
| [Todo with PluresDB](./tutorials/todo-pluresdb.md) | Local-first todo application |
|
|
50
|
+
| [Form Builder](./tutorials/form-builder.md) | Dynamic form creation |
|
|
51
|
+
| [E-commerce Cart](./tutorials/ecommerce-cart.md) | Shopping cart with checkout flow |
|
|
52
|
+
|
|
53
|
+
### Decision Ledger
|
|
54
|
+
|
|
55
|
+
| Resource | Description |
|
|
56
|
+
|----------|-------------|
|
|
57
|
+
| [Dogfooding Guide](./decision-ledger/DOGFOODING.md) | Decision Ledger workflow |
|
|
58
|
+
| [Behavior Ledger](./decision-ledger/BEHAVIOR_LEDGER.md) | Rule/constraint change log |
|
|
59
|
+
| [Contract Index](./decision-ledger/contract-index.json) | Machine-readable contract inventory |
|
|
66
60
|
|
|
67
61
|
### Examples
|
|
68
62
|
|
|
69
|
-
| Example
|
|
70
|
-
|
|
71
|
-
| [
|
|
72
|
-
| [
|
|
73
|
-
| [
|
|
74
|
-
| [
|
|
75
|
-
| [
|
|
76
|
-
| [
|
|
63
|
+
| Example | Description |
|
|
64
|
+
|---------|-------------|
|
|
65
|
+
| [Unified App](../examples/unified-app/) | `createApp()` with rules and Mermaid docs |
|
|
66
|
+
| [Hero Shop](../examples/hero-shop/) | Full e-commerce application |
|
|
67
|
+
| [Todo](../examples/todo/) | Minimal todo application |
|
|
68
|
+
| [Form Builder](../examples/form-builder/) | Dynamic form builder |
|
|
69
|
+
| [Offline Chat](../examples/offline-chat/) | Local-first chat application |
|
|
70
|
+
| [Terminal Node](../examples/terminal-node/) | Command execution with YAML schemas |
|
|
71
|
+
| [Cloud Sync](../examples/cloud-sync/) | Multi-client synchronization |
|
|
72
|
+
| [Decision Ledger](../examples/decision-ledger/) | Contracts, validation, SARIF output |
|
|
77
73
|
|
|
78
|
-
## Architecture
|
|
74
|
+
## Architecture
|
|
79
75
|
|
|
80
76
|
```mermaid
|
|
81
77
|
flowchart TB
|
|
@@ -108,59 +104,19 @@ flowchart TB
|
|
|
108
104
|
Engine --> StateDocs
|
|
109
105
|
```
|
|
110
106
|
|
|
111
|
-
##
|
|
112
|
-
|
|
113
|
-
### 🎯 Schema-Driven Development
|
|
114
|
-
|
|
115
|
-
Define your entire application in PSF (Praxis Schema Format), then generate everything else.
|
|
116
|
-
|
|
117
|
-
### ⚡ Logic Engine
|
|
118
|
-
|
|
119
|
-
Pure, functional business logic with facts, events, rules, and constraints.
|
|
120
|
-
|
|
121
|
-
### 🧩 Component Generation
|
|
122
|
-
|
|
123
|
-
Automatically generate Svelte components from your schemas.
|
|
124
|
-
|
|
125
|
-
### 📱 Local-First
|
|
126
|
-
|
|
127
|
-
Built-in PluresDB integration for offline-capable, reactive data storage.
|
|
128
|
-
|
|
129
|
-
### 🎨 Visual Development
|
|
130
|
-
|
|
131
|
-
CodeCanvas provides visual schema and logic editing.
|
|
107
|
+
## Dogfooding
|
|
132
108
|
|
|
133
|
-
|
|
109
|
+
We actively dogfood all Plures tools during development:
|
|
134
110
|
|
|
135
|
-
|
|
111
|
+
- [Dogfooding Index](./DOGFOODING_INDEX.md) — overview
|
|
112
|
+
- [Quick Start](./DOGFOODING_QUICK_START.md) — get started in 5 minutes
|
|
113
|
+
- [Checklist](./DOGFOODING_CHECKLIST.md) — daily/weekly/monthly workflows
|
|
114
|
+
- [Tools Inventory](./PLURES_TOOLS_INVENTORY.md) — all available tools
|
|
115
|
+
- [Workflow Example](./examples/DOGFOODING_WORKFLOW_EXAMPLE.md) — see it in action
|
|
136
116
|
|
|
137
|
-
|
|
117
|
+
## 1.x Documentation Archive
|
|
138
118
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
### 🔄 Real-Time Sync
|
|
142
|
-
|
|
143
|
-
Praxis Cloud provides sync across devices and users.
|
|
144
|
-
|
|
145
|
-
## Installation Options
|
|
146
|
-
|
|
147
|
-
### npm
|
|
148
|
-
|
|
149
|
-
```bash
|
|
150
|
-
npm install @plures/praxis
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
### Deno
|
|
154
|
-
|
|
155
|
-
```typescript
|
|
156
|
-
import { createPraxisEngine } from 'jsr:@plures/praxis';
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
### C# (.NET)
|
|
160
|
-
|
|
161
|
-
```bash
|
|
162
|
-
dotnet add package Plures.Praxis
|
|
163
|
-
```
|
|
119
|
+
Historical documentation from Praxis 1.x development is preserved in [archive/1.x/](./archive/1.x/).
|
|
164
120
|
|
|
165
121
|
## Community
|
|
166
122
|
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
# Praxis Conversations Subsystem Implementation
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
This document summarizes the implementation of the **praxis-conversations** subsystem, a deterministic-first conversation ingestion pipeline integrated into the Praxis framework.
|
|
6
|
+
|
|
7
|
+
## Implementation Date
|
|
8
|
+
|
|
9
|
+
February 1, 2024
|
|
10
|
+
|
|
11
|
+
## Deliverables
|
|
12
|
+
|
|
13
|
+
### 1. JSON Schemas
|
|
14
|
+
|
|
15
|
+
Located in `src/conversations/`:
|
|
16
|
+
|
|
17
|
+
- **conversation.schema.json**: Defines the structure for conversation data including turns, metadata, and classification
|
|
18
|
+
- **candidate.schema.json**: Defines the structure for emission candidates (GitHub issues, documentation, etc.)
|
|
19
|
+
|
|
20
|
+
### 2. Core Pipeline Modules
|
|
21
|
+
|
|
22
|
+
The pipeline follows this deterministic flow:
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
capture → redact → normalize → classify → candidates → gate → emit
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
**Modules** (all in `src/conversations/`):
|
|
29
|
+
|
|
30
|
+
- `capture.ts`: Capture conversations from various sources
|
|
31
|
+
- `redact.ts`: Deterministic PII redaction (email, phone, IP, SSN, credit cards)
|
|
32
|
+
- `normalize.ts`: Content normalization (whitespace, code blocks)
|
|
33
|
+
- `classify.ts`: Keyword-based classification (bug-report, feature-request, question, etc.)
|
|
34
|
+
- `candidates.ts`: Generate emission candidates from classified conversations
|
|
35
|
+
- `gate.ts`: Quality gates (minimum length, valid title, metadata, duplicates)
|
|
36
|
+
|
|
37
|
+
### 3. Emitters
|
|
38
|
+
|
|
39
|
+
Located in `src/conversations/emitters/`:
|
|
40
|
+
|
|
41
|
+
- **fs.ts**: Filesystem emitter with dry-run support
|
|
42
|
+
- **github.ts**: GitHub issue emitter with **HARD GATE** on `commit_intent=true`
|
|
43
|
+
|
|
44
|
+
### 4. CLI Commands
|
|
45
|
+
|
|
46
|
+
Command: `praxis conversations [subcommand]`
|
|
47
|
+
|
|
48
|
+
Subcommands:
|
|
49
|
+
- `capture`: Capture a conversation from input
|
|
50
|
+
- `push`: Process through redact + normalize pipeline
|
|
51
|
+
- `classify`: Classify conversation and generate candidate
|
|
52
|
+
- `emit`: Emit candidate to fs or github (with gates)
|
|
53
|
+
|
|
54
|
+
### 5. Tests & Fixtures
|
|
55
|
+
|
|
56
|
+
- **Tests**: `src/__tests__/conversations.test.ts` (18 comprehensive tests)
|
|
57
|
+
- **Fixtures**: `test/fixtures/conversations/` (3 test conversations)
|
|
58
|
+
- bug-report.json
|
|
59
|
+
- feature-request.json
|
|
60
|
+
- question.json
|
|
61
|
+
|
|
62
|
+
All tests passing (18/18 for conversations, 404/408 total)
|
|
63
|
+
|
|
64
|
+
### 6. Documentation
|
|
65
|
+
|
|
66
|
+
- **README**: `src/conversations/README.md` (comprehensive guide)
|
|
67
|
+
- Includes schema documentation, CLI usage, and programmatic API examples
|
|
68
|
+
|
|
69
|
+
## Key Features
|
|
70
|
+
|
|
71
|
+
1. **Deterministic-first**: No LLM required, all logic is rule-based
|
|
72
|
+
2. **Hard-gated GitHub emitter**: Requires explicit `--commit-intent` flag
|
|
73
|
+
3. **PII redaction**: Automatic removal of sensitive data
|
|
74
|
+
4. **Quality gates**: 4 gates ensure quality before emission
|
|
75
|
+
5. **Dry-run mode**: Test without side effects
|
|
76
|
+
6. **Extensible**: Easy to add new emitters, classifiers, or gates
|
|
77
|
+
|
|
78
|
+
## Usage Examples
|
|
79
|
+
|
|
80
|
+
### CLI Usage
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
# Full pipeline
|
|
84
|
+
praxis conversations push -i input.json -o processed.json
|
|
85
|
+
praxis conversations classify -i processed.json -o candidate.json
|
|
86
|
+
praxis conversations emit -i candidate.json -e fs --output-dir ./output
|
|
87
|
+
|
|
88
|
+
# GitHub emission (requires --commit-intent)
|
|
89
|
+
praxis conversations emit -i candidate.json -e github \
|
|
90
|
+
--owner myorg --repo myrepo --commit-intent
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Programmatic Usage
|
|
94
|
+
|
|
95
|
+
```typescript
|
|
96
|
+
import {
|
|
97
|
+
captureConversation,
|
|
98
|
+
redactConversation,
|
|
99
|
+
normalizeConversation,
|
|
100
|
+
classifyConversation,
|
|
101
|
+
generateCandidate,
|
|
102
|
+
applyGates,
|
|
103
|
+
emitToFS,
|
|
104
|
+
} from '@plures/praxis/conversations';
|
|
105
|
+
|
|
106
|
+
// Process conversation
|
|
107
|
+
let conv = captureConversation({ turns: [...], metadata: {} });
|
|
108
|
+
conv = redactConversation(conv);
|
|
109
|
+
conv = normalizeConversation(conv);
|
|
110
|
+
conv = classifyConversation(conv);
|
|
111
|
+
|
|
112
|
+
// Generate and emit candidate
|
|
113
|
+
const candidate = generateCandidate(conv);
|
|
114
|
+
const gated = applyGates(candidate);
|
|
115
|
+
if (gated.gateStatus?.passed) {
|
|
116
|
+
await emitToFS(gated, { outputDir: './output' });
|
|
117
|
+
}
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Security
|
|
121
|
+
|
|
122
|
+
- **CodeQL Scan**: 0 vulnerabilities found
|
|
123
|
+
- **PII Redaction**: Implemented for emails, phones, IPs, SSNs, credit cards
|
|
124
|
+
- **GitHub Gate**: Hard-gated to prevent accidental issue creation
|
|
125
|
+
- **Input Validation**: All inputs validated before processing
|
|
126
|
+
|
|
127
|
+
## Testing
|
|
128
|
+
|
|
129
|
+
All tests passing:
|
|
130
|
+
- Conversations subsystem: 18/18 tests
|
|
131
|
+
- Full test suite: 404/408 tests (4 skipped)
|
|
132
|
+
|
|
133
|
+
Run tests:
|
|
134
|
+
```bash
|
|
135
|
+
npm test src/__tests__/conversations.test.ts
|
|
136
|
+
npm test # Full suite
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## Code Review
|
|
140
|
+
|
|
141
|
+
Code review completed with all feedback addressed:
|
|
142
|
+
- Documented intentionally broad PII patterns (prioritize safety)
|
|
143
|
+
- Optimized label deduplication using Set (O(n) vs O(n²))
|
|
144
|
+
- Added clarifying comments for pattern limitations
|
|
145
|
+
|
|
146
|
+
## Files Modified/Created
|
|
147
|
+
|
|
148
|
+
### New Files (19 total)
|
|
149
|
+
|
|
150
|
+
**Core modules**:
|
|
151
|
+
- src/conversations/candidate.schema.json
|
|
152
|
+
- src/conversations/candidates.ts
|
|
153
|
+
- src/conversations/capture.ts
|
|
154
|
+
- src/conversations/classify.ts
|
|
155
|
+
- src/conversations/conversation.schema.json
|
|
156
|
+
- src/conversations/gate.ts
|
|
157
|
+
- src/conversations/index.ts
|
|
158
|
+
- src/conversations/normalize.ts
|
|
159
|
+
- src/conversations/redact.ts
|
|
160
|
+
- src/conversations/types.ts
|
|
161
|
+
- src/conversations/README.md
|
|
162
|
+
|
|
163
|
+
**Emitters**:
|
|
164
|
+
- src/conversations/emitters/fs.ts
|
|
165
|
+
- src/conversations/emitters/github.ts
|
|
166
|
+
|
|
167
|
+
**CLI**:
|
|
168
|
+
- src/cli/commands/conversations.ts
|
|
169
|
+
|
|
170
|
+
**Tests & Fixtures**:
|
|
171
|
+
- src/__tests__/conversations.test.ts
|
|
172
|
+
- test/fixtures/conversations/bug-report.json
|
|
173
|
+
- test/fixtures/conversations/feature-request.json
|
|
174
|
+
- test/fixtures/conversations/question.json
|
|
175
|
+
|
|
176
|
+
### Modified Files
|
|
177
|
+
|
|
178
|
+
- src/cli/index.ts (added conversations commands)
|
|
179
|
+
- .gitignore (added .demo/)
|
|
180
|
+
|
|
181
|
+
## Compliance with Praxis Decision Ledger
|
|
182
|
+
|
|
183
|
+
This implementation follows the Praxis Decision Ledger dogfooding guidelines:
|
|
184
|
+
- Deterministic implementation (no LLM dependencies)
|
|
185
|
+
- Comprehensive test coverage
|
|
186
|
+
- Clear contracts and schemas
|
|
187
|
+
- Documentation for all public APIs
|
|
188
|
+
|
|
189
|
+
## Future Enhancements
|
|
190
|
+
|
|
191
|
+
Potential improvements for future iterations:
|
|
192
|
+
- Additional emitters (Slack, Discord, email)
|
|
193
|
+
- More sophisticated classification rules
|
|
194
|
+
- Duplicate detection against real GitHub issues
|
|
195
|
+
- Custom PII patterns via configuration
|
|
196
|
+
- Batch processing support
|
|
197
|
+
|
|
198
|
+
## Conclusion
|
|
199
|
+
|
|
200
|
+
The praxis-conversations subsystem has been successfully implemented with:
|
|
201
|
+
- Complete deterministic pipeline
|
|
202
|
+
- Hard-gated GitHub emitter
|
|
203
|
+
- Comprehensive tests and documentation
|
|
204
|
+
- Zero security vulnerabilities
|
|
205
|
+
- All code review feedback addressed
|
|
206
|
+
|
|
207
|
+
The subsystem is ready for use and follows all Praxis framework conventions.
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# Decision Ledger Reverse Engineering - Implementation Summary
|
|
2
|
+
|
|
3
|
+
This document provides a comprehensive summary of the decision ledger reverse engineering implementation for the Praxis framework.
|
|
4
|
+
|
|
5
|
+
## What Was Implemented
|
|
6
|
+
|
|
7
|
+
### Core Components
|
|
8
|
+
|
|
9
|
+
1. **Repository Scanner** (`src/decision-ledger/scanner.ts`)
|
|
10
|
+
- Scans codebases to discover existing rules and constraints
|
|
11
|
+
- Maps test files to rules by ID references
|
|
12
|
+
- Maps spec files (TLA+, markdown) to rules
|
|
13
|
+
- Infers contract information from code and comments
|
|
14
|
+
- Includes error handling with warnings collection
|
|
15
|
+
- Path validation and normalization
|
|
16
|
+
|
|
17
|
+
2. **Reverse Contract Generator** (`src/decision-ledger/reverse-generator.ts`)
|
|
18
|
+
- Generates contracts from existing code
|
|
19
|
+
- Supports AI-powered generation (OpenAI, GitHub Copilot)
|
|
20
|
+
- Fallback to heuristic-based generation
|
|
21
|
+
- Confidence scoring system (normalized, capped at 0.9)
|
|
22
|
+
- Extracts examples from test files
|
|
23
|
+
- Generates default assumptions
|
|
24
|
+
|
|
25
|
+
3. **CLI Command** (`src/cli/commands/reverse.ts`)
|
|
26
|
+
- `praxis reverse` command for reverse engineering
|
|
27
|
+
- Interactive mode with user prompts
|
|
28
|
+
- Batch processing with limit control
|
|
29
|
+
- Dry-run mode for previewing
|
|
30
|
+
- Multiple output formats (JSON, YAML)
|
|
31
|
+
- Logic ledger integration
|
|
32
|
+
- Unique filename generation with hashes
|
|
33
|
+
- Comprehensive progress reporting
|
|
34
|
+
|
|
35
|
+
### Features
|
|
36
|
+
|
|
37
|
+
#### Repository Scanning
|
|
38
|
+
- **File pattern matching**: Discovers `defineRule()` and `defineConstraint()` patterns
|
|
39
|
+
- **Test mapping**: Links test files to rules by searching for rule IDs
|
|
40
|
+
- **Spec mapping**: Links specification files to rules
|
|
41
|
+
- **Artifact tracking**: Builds index of tests and specs for validation
|
|
42
|
+
- **Error handling**: Collects warnings for permission errors and scan issues
|
|
43
|
+
- **Exclusion patterns**: Respects node_modules, dist, build directories
|
|
44
|
+
|
|
45
|
+
#### Contract Generation
|
|
46
|
+
- **Heuristic analysis**: Infers behavior from JSDoc, descriptions, code structure
|
|
47
|
+
- **AI integration**: Placeholder hooks for OpenAI and GitHub Copilot
|
|
48
|
+
- **Confidence scoring**: Normalized scoring based on available artifacts
|
|
49
|
+
- **Example extraction**: Parses test descriptions into Given/When/Then format
|
|
50
|
+
- **Assumption generation**: Creates default assumptions with confidence levels
|
|
51
|
+
- **Reference tracking**: Links to test files and spec files
|
|
52
|
+
|
|
53
|
+
#### Migration Support
|
|
54
|
+
- **Backward compatible**: Existing Praxis code works without modification
|
|
55
|
+
- **Incremental adoption**: Process rules one at a time or in batches
|
|
56
|
+
- **Interactive review**: Prompt for each contract generation
|
|
57
|
+
- **Dry-run mode**: Preview without writing files
|
|
58
|
+
- **Multiple formats**: Output as JSON or YAML
|
|
59
|
+
|
|
60
|
+
## Documentation
|
|
61
|
+
|
|
62
|
+
1. **Reverse Engineering Guide** (`src/decision-ledger/REVERSE_ENGINEERING.md`)
|
|
63
|
+
- Comprehensive guide for migrating existing codebases
|
|
64
|
+
- Step-by-step migration workflow
|
|
65
|
+
- Examples of generated contracts
|
|
66
|
+
- Best practices and troubleshooting
|
|
67
|
+
|
|
68
|
+
2. **Updated README** (`src/decision-ledger/README.md`)
|
|
69
|
+
- Added reverse engineering section
|
|
70
|
+
- CLI command documentation
|
|
71
|
+
- API reference updates
|
|
72
|
+
|
|
73
|
+
## Testing
|
|
74
|
+
|
|
75
|
+
All tests pass (378 passed, 4 skipped out of 382 total tests).
|
|
76
|
+
|
|
77
|
+
- Scanner tests verify contract inference
|
|
78
|
+
- Generator tests verify contract generation with various inputs
|
|
79
|
+
- Confidence scoring tests ensure proper normalization
|
|
80
|
+
- Build verification successful
|
|
81
|
+
|
|
82
|
+
## Key Features
|
|
83
|
+
|
|
84
|
+
✅ Repository scanning with pattern matching
|
|
85
|
+
✅ AI integration hooks (placeholder)
|
|
86
|
+
✅ Heuristic-based contract generation
|
|
87
|
+
✅ Interactive and batch modes
|
|
88
|
+
✅ Error handling with warnings
|
|
89
|
+
✅ Comprehensive documentation
|
|
90
|
+
✅ Full test coverage
|
|
91
|
+
✅ Code review feedback addressed
|
|
92
|
+
|
|
93
|
+
## Usage Example
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
# Scan and generate contracts
|
|
97
|
+
praxis reverse --output ./contracts
|
|
98
|
+
|
|
99
|
+
# Interactive mode
|
|
100
|
+
praxis reverse --interactive
|
|
101
|
+
|
|
102
|
+
# With AI (when implemented)
|
|
103
|
+
praxis reverse --ai openai
|
|
104
|
+
|
|
105
|
+
# Commit to ledger
|
|
106
|
+
praxis reverse --ledger --author "team"
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
See [REVERSE_ENGINEERING.md](src/decision-ledger/REVERSE_ENGINEERING.md) for complete documentation.
|