@plures/praxis 1.2.13 → 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.
Files changed (85) hide show
  1. package/README.md +44 -0
  2. package/dist/browser/{chunk-VOMLVI6V.js → chunk-BBP2F7TT.js} +70 -1
  3. package/dist/browser/{chunk-K377RW4V.js → chunk-FCEH7WMH.js} +1 -1
  4. package/dist/browser/{engine-YJZV4SLD.js → engine-65QDGCAN.js} +1 -1
  5. package/dist/browser/index.d.ts +104 -2
  6. package/dist/browser/index.js +181 -5
  7. package/dist/browser/integrations/svelte.d.ts +2 -2
  8. package/dist/browser/integrations/svelte.js +2 -2
  9. package/dist/browser/{reactive-engine.svelte-9aS0kTa8.d.ts → reactive-engine.svelte-Cqd8Mod2.d.ts} +56 -1
  10. package/dist/node/{chunk-PRPQO6R5.js → chunk-32YFEEML.js} +1 -1
  11. package/dist/node/{chunk-VOMLVI6V.js → chunk-BBP2F7TT.js} +70 -1
  12. package/dist/node/{chunk-5RH7UAQC.js → chunk-PTH6MD6P.js} +1 -0
  13. package/dist/node/cli/index.cjs +1553 -839
  14. package/dist/node/cli/index.js +39 -2
  15. package/dist/node/cloud/index.d.cts +1 -1
  16. package/dist/node/cloud/index.d.ts +1 -1
  17. package/dist/node/components/index.d.cts +2 -2
  18. package/dist/node/components/index.d.ts +2 -2
  19. package/dist/node/conversations-KQBXTP3N.js +596 -0
  20. package/dist/node/{engine-2DQBKBJC.js → engine-7CXQV6RC.js} +1 -1
  21. package/dist/node/index.cjs +408 -3
  22. package/dist/node/index.d.cts +308 -7
  23. package/dist/node/index.d.ts +308 -7
  24. package/dist/node/index.js +336 -6
  25. package/dist/node/integrations/svelte.cjs +70 -1
  26. package/dist/node/integrations/svelte.d.cts +3 -3
  27. package/dist/node/integrations/svelte.d.ts +3 -3
  28. package/dist/node/integrations/svelte.js +2 -2
  29. package/dist/node/{protocol-Qek7ebBl.d.ts → protocol-BocKczNv.d.cts} +1 -1
  30. package/dist/node/{protocol-Qek7ebBl.d.cts → protocol-BocKczNv.d.ts} +1 -1
  31. package/dist/node/{reactive-engine.svelte-CRNqHlbv.d.ts → reactive-engine.svelte-CGe8SpVE.d.cts} +57 -2
  32. package/dist/node/{reactive-engine.svelte-BFIZfawz.d.cts → reactive-engine.svelte-D-xTDxT5.d.ts} +57 -2
  33. package/dist/node/{terminal-adapter-B-UK_Vdz.d.ts → terminal-adapter-CvIvgTo4.d.ts} +1 -1
  34. package/dist/node/{terminal-adapter-BQSIF5bf.d.cts → terminal-adapter-Db-snPJ3.d.cts} +1 -1
  35. package/dist/node/{validate-CNHUULQE.js → validate-EN3M4FUR.js} +1 -1
  36. package/dist/node/{verify-KLJRXVJS.js → verify-7VZRP2WS.js} +2 -2
  37. package/docs/BOT_UPDATE_POLICY.md +125 -0
  38. package/docs/DOGFOODING_CHECKLIST.md +254 -0
  39. package/docs/DOGFOODING_INDEX.md +169 -0
  40. package/docs/DOGFOODING_QUICK_START.md +140 -0
  41. package/docs/KNO_ENG_EXTRACTION_PLAN.md +577 -0
  42. package/docs/PLURES_TOOLS_INVENTORY.md +170 -0
  43. package/docs/README.md +12 -0
  44. package/docs/TESTING_BOT_WORKFLOWS.md +154 -0
  45. package/docs/conversations/INTEGRATION_POINTS.md +719 -0
  46. package/docs/conversations/README.md +168 -0
  47. package/docs/core/extending-praxis-core.md +604 -0
  48. package/docs/core/praxis-core-api.md +385 -0
  49. package/docs/decision-ledger/contract-index.json +2 -2
  50. package/docs/decision-ledger/decisions/2026-02-01-monorepo-organization.md +130 -0
  51. package/docs/examples/DOGFOODING_WORKFLOW_EXAMPLE.md +295 -0
  52. package/docs/examples/README.md +41 -0
  53. package/docs/workflows/pr-overlap-guard.md +50 -0
  54. package/package.json +7 -2
  55. package/src/__tests__/chronicle.test.ts +512 -0
  56. package/src/__tests__/conversations.test.ts +312 -0
  57. package/src/__tests__/edge-cases.test.ts +1 -1
  58. package/src/__tests__/engine-dx.test.ts +355 -0
  59. package/src/cli/commands/conversations.ts +252 -0
  60. package/src/cli/index.ts +73 -0
  61. package/src/conversations/README.md +230 -0
  62. package/src/conversations/candidate.schema.json +123 -0
  63. package/src/conversations/candidates.ts +114 -0
  64. package/src/conversations/capture.ts +56 -0
  65. package/src/conversations/classify.ts +110 -0
  66. package/src/conversations/conversation.schema.json +106 -0
  67. package/src/conversations/emitters/fs.ts +65 -0
  68. package/src/conversations/emitters/github.ts +115 -0
  69. package/src/conversations/gate.ts +102 -0
  70. package/src/conversations/index.ts +28 -0
  71. package/src/conversations/normalize.ts +51 -0
  72. package/src/conversations/redact.ts +57 -0
  73. package/src/conversations/types.ts +96 -0
  74. package/src/core/chronicle/chronicle.ts +227 -0
  75. package/src/core/chronicle/context.ts +80 -0
  76. package/src/core/chronicle/index.ts +53 -0
  77. package/src/core/chronicle/mcp.ts +135 -0
  78. package/src/core/chronicle/types.ts +61 -0
  79. package/src/core/engine.ts +99 -1
  80. package/src/core/pluresdb/index.ts +22 -0
  81. package/src/core/pluresdb/store.ts +162 -5
  82. package/src/core/rules.ts +12 -0
  83. package/src/dsl/index.ts +6 -0
  84. package/src/index.ts +18 -0
  85. package/src/integrations/pluresdb.ts +22 -0
@@ -0,0 +1,295 @@
1
+ # Example: Dogfooding Workflow in Action
2
+
3
+ This example demonstrates a complete dogfooding workflow when adding a new feature to Praxis.
4
+
5
+ ## Scenario: Adding a New Rule with Full Dogfooding
6
+
7
+ Let's walk through adding a new rule that validates user permissions, while actively dogfooding all relevant Plures tools.
8
+
9
+ ### Step 1: Start with Decision Ledger (Contract-First)
10
+
11
+ Before writing code, define the contract:
12
+
13
+ ```typescript
14
+ // src/rules/permissions.ts
15
+ import { defineContract, defineRule, PraxisRegistry } from '@plures/praxis';
16
+
17
+ // Define the contract first (Dogfooding: Decision Ledger)
18
+ const permissionCheckContract = defineContract({
19
+ behavior: "Validates user permissions against required roles before granting access",
20
+
21
+ examples: [
22
+ {
23
+ given: "User has role 'admin'",
24
+ when: "User requests admin action",
25
+ then: "Access granted fact is emitted",
26
+ },
27
+ {
28
+ given: "User has role 'viewer'",
29
+ when: "User requests admin action",
30
+ then: "Access denied fact is emitted with reason",
31
+ },
32
+ {
33
+ given: "User has no roles",
34
+ when: "User requests any protected action",
35
+ then: "Access denied fact is emitted",
36
+ },
37
+ ],
38
+
39
+ invariants: [
40
+ "Access decisions are deterministic based on roles",
41
+ "Denied access always includes a reason",
42
+ "Role checks are case-insensitive",
43
+ ],
44
+
45
+ assumptions: [
46
+ {
47
+ statement: "User roles are validated before reaching this rule",
48
+ confidence: "high",
49
+ },
50
+ {
51
+ statement: "Role names follow kebab-case convention",
52
+ confidence: "medium",
53
+ },
54
+ ],
55
+
56
+ references: [
57
+ "docs/security/RBAC.md",
58
+ "Issue #123: Permission system design",
59
+ ],
60
+ });
61
+
62
+ // Implement the rule with contract attached
63
+ const permissionCheckRule = defineRule({
64
+ id: 'auth.permission-check',
65
+ description: 'Check user permissions against required roles',
66
+ meta: {
67
+ contract: permissionCheckContract,
68
+ },
69
+ impl: (state, events) => {
70
+ // Implementation here...
71
+ },
72
+ });
73
+ ```
74
+
75
+ **Friction Found?** If the contract API is confusing or lacks examples, file a dogfooding issue immediately.
76
+
77
+ ### Step 2: Visualize with CodeCanvas
78
+
79
+ Before implementing, visualize the schema:
80
+
81
+ ```typescript
82
+ // scripts/visualize-auth-schema.ts
83
+ import { schemaToCanvas } from '@plures/praxis';
84
+ import { writeFileSync } from 'fs';
85
+
86
+ const authSchema = {
87
+ entities: {
88
+ User: {
89
+ fields: {
90
+ id: { type: 'string' },
91
+ roles: { type: 'array', items: { type: 'string' } },
92
+ },
93
+ },
94
+ Permission: {
95
+ fields: {
96
+ action: { type: 'string' },
97
+ requiredRoles: { type: 'array', items: { type: 'string' } },
98
+ },
99
+ },
100
+ },
101
+ };
102
+
103
+ // Dogfooding: CodeCanvas
104
+ const canvas = schemaToCanvas(authSchema);
105
+ writeFileSync('./docs/auth-schema.json', JSON.stringify(canvas, null, 2));
106
+
107
+ console.log('✅ Canvas exported to docs/auth-schema.json');
108
+ // TODO: Convert to visual diagram format
109
+ ```
110
+
111
+ Run it:
112
+ ```bash
113
+ npx tsx scripts/visualize-auth-schema.ts
114
+ ```
115
+
116
+ **Friction Found?** If `schemaToCanvas` doesn't handle your schema correctly, file a dogfooding issue with the schema structure.
117
+
118
+ ### Step 3: Generate Tests from Contract
119
+
120
+ Write tests that mirror the contract examples:
121
+
122
+ ```typescript
123
+ // test/rules/permissions.test.ts
124
+ import { describe, it, expect } from 'vitest';
125
+ import { permissionCheckRule } from '../../src/rules/permissions';
126
+ import { createPraxisEngine, PraxisRegistry } from '@plures/praxis';
127
+
128
+ describe('auth.permission-check', () => {
129
+ // Test Example 1 from contract
130
+ it('should grant access when user has required role', () => {
131
+ const registry = new PraxisRegistry();
132
+ registry.registerRule(permissionCheckRule);
133
+
134
+ const engine = createPraxisEngine({
135
+ initialContext: { user: { roles: ['admin'] } },
136
+ registry,
137
+ });
138
+
139
+ const events = [
140
+ { type: 'REQUEST_ADMIN_ACTION', payload: { action: 'delete-user' } },
141
+ ];
142
+
143
+ const result = engine.step(events);
144
+ expect(result.facts.some(f => f.type === 'ACCESS_GRANTED')).toBe(true);
145
+ });
146
+
147
+ // Test Example 2 from contract
148
+ it('should deny access when user lacks required role', () => {
149
+ const registry = new PraxisRegistry();
150
+ registry.registerRule(permissionCheckRule);
151
+
152
+ const engine = createPraxisEngine({
153
+ initialContext: { user: { roles: ['viewer'] } },
154
+ registry,
155
+ });
156
+
157
+ const events = [
158
+ { type: 'REQUEST_ADMIN_ACTION', payload: { action: 'delete-user' } },
159
+ ];
160
+
161
+ const result = engine.step(events);
162
+ const deniedFact = result.facts.find(f => f.type === 'ACCESS_DENIED');
163
+ expect(deniedFact).toBeDefined();
164
+ expect(deniedFact?.payload.reason).toBeDefined();
165
+ });
166
+
167
+ // Test Invariant: Denied access always includes reason
168
+ it('invariant: denied access always includes reason', () => {
169
+ // Test implementation...
170
+ });
171
+ });
172
+ ```
173
+
174
+ **Friction Found?** If testing the contract examples is cumbersome, file a dogfooding issue suggesting auto-generation.
175
+
176
+ ### Step 4: Generate Documentation with State-Docs
177
+
178
+ Generate documentation from your module:
179
+
180
+ ```typescript
181
+ // scripts/generate-auth-docs.ts
182
+ import { createStateDocsGenerator } from '@plures/praxis';
183
+ import { permissionCheckRule } from '../src/rules/permissions';
184
+ import { PraxisRegistry } from '@plures/praxis';
185
+
186
+ const registry = new PraxisRegistry();
187
+ registry.registerRule(permissionCheckRule);
188
+
189
+ // Dogfooding: State-Docs
190
+ const docsGenerator = createStateDocsGenerator({
191
+ projectTitle: 'Praxis Auth Module',
192
+ target: './docs/generated/auth',
193
+ });
194
+
195
+ const docs = docsGenerator.generateFromModule({
196
+ name: 'auth',
197
+ rules: [permissionCheckRule],
198
+ });
199
+
200
+ console.log('✅ Documentation generated at docs/generated/auth');
201
+ ```
202
+
203
+ Run it:
204
+ ```bash
205
+ npx tsx scripts/generate-auth-docs.ts
206
+ ```
207
+
208
+ **Friction Found?** If State-Docs doesn't extract contract information properly, file a dogfooding issue.
209
+
210
+ ### Step 5: Run Validation (Before Commit)
211
+
212
+ ```bash
213
+ # Dogfooding: Praxis CLI
214
+ npm run scan:rules
215
+ npm run validate:contracts
216
+ npm test
217
+ npm run typecheck
218
+ ```
219
+
220
+ **Friction Found?** If validation output is unclear or doesn't show file paths, file a dogfooding issue.
221
+
222
+ ### Step 6: Use PluresDB for Test Fixtures
223
+
224
+ Instead of manual test data, use PluresDB:
225
+
226
+ ```typescript
227
+ // test/fixtures/auth-fixtures.ts
228
+ import { createInMemoryDB, createPluresDBAdapter } from '@plures/praxis';
229
+
230
+ // Dogfooding: PluresDB
231
+ export async function createAuthTestFixtures() {
232
+ const db = createInMemoryDB();
233
+ const adapter = createPluresDBAdapter({ db });
234
+
235
+ // Pre-populate test data
236
+ await db.insert('users', {
237
+ id: 'user-1',
238
+ roles: ['admin', 'moderator'],
239
+ });
240
+
241
+ await db.insert('users', {
242
+ id: 'user-2',
243
+ roles: ['viewer'],
244
+ });
245
+
246
+ return { db, adapter };
247
+ }
248
+ ```
249
+
250
+ **Friction Found?** If PluresDB setup is tedious for tests, file a dogfooding issue.
251
+
252
+ ### Step 7: File Friction Reports
253
+
254
+ Throughout this process, you might have encountered friction. File issues:
255
+
256
+ 1. **Issue #1**: "State-Docs doesn't extract contract examples automatically"
257
+ - Tool: State-Docs
258
+ - Type: Missing feature
259
+ - Impact: Medium
260
+
261
+ 2. **Issue #2**: "CodeCanvas export format isn't compatible with Mermaid"
262
+ - Tool: CodeCanvas
263
+ - Type: Missing feature
264
+ - Impact: Low
265
+
266
+ 3. **Issue #3**: "Praxis CLI validate doesn't show file paths for contract gaps"
267
+ - Tool: Praxis CLI
268
+ - Type: Confusing error message
269
+ - Impact: High
270
+
271
+ ## Summary: Tools Used
272
+
273
+ In this workflow, we dogfooded:
274
+
275
+ - ✅ **Decision Ledger**: Contract-first development
276
+ - ✅ **CodeCanvas**: Schema visualization
277
+ - ✅ **State-Docs**: Documentation generation
278
+ - ✅ **Praxis CLI**: Validation and scaffolding
279
+ - ✅ **PluresDB**: Test fixture management
280
+
281
+ **Friction reports filed**: 3
282
+ **Developer experience improved**: 🚀
283
+
284
+ ## Next Steps
285
+
286
+ After completing the feature:
287
+
288
+ 1. Review the friction reports filed
289
+ 2. Prioritize high-impact issues
290
+ 3. Update the [Plures Tools Inventory](../PLURES_TOOLS_INVENTORY.md) with learnings
291
+ 4. Share insights in the weekly dogfooding review
292
+
293
+ ---
294
+
295
+ This example demonstrates the complete dogfooding loop: **Use → Observe → Report → Improve**.
@@ -0,0 +1,41 @@
1
+ # Dogfooding Examples
2
+
3
+ This directory contains practical examples of dogfooding Plures tools in real-world development scenarios.
4
+
5
+ ## Available Examples
6
+
7
+ ### [Dogfooding Workflow Example](./DOGFOODING_WORKFLOW_EXAMPLE.md)
8
+
9
+ A comprehensive walkthrough demonstrating how to dogfood all Plures tools when adding a new feature to Praxis. This example shows:
10
+
11
+ - Using Decision Ledger for contract-first development
12
+ - Visualizing schemas with CodeCanvas
13
+ - Generating documentation with State-Docs
14
+ - Running Praxis CLI validation
15
+ - Using PluresDB for test fixtures
16
+ - Filing friction reports during development
17
+
18
+ **Use this when:** You want to see a complete end-to-end example of dogfooding in action.
19
+
20
+ ---
21
+
22
+ ## Contributing New Examples
23
+
24
+ Have a great dogfooding workflow or pattern? Add it here!
25
+
26
+ 1. Create a new `.md` file in this directory
27
+ 2. Follow the structure of existing examples
28
+ 3. Include:
29
+ - Clear scenario description
30
+ - Step-by-step instructions
31
+ - Code examples
32
+ - Friction points to watch for
33
+ - Summary of tools used
34
+ 4. Update this README with a link and description
35
+
36
+ ---
37
+
38
+ See also:
39
+ - [Dogfooding Quick Start](../DOGFOODING_QUICK_START.md)
40
+ - [Dogfooding Checklist](../DOGFOODING_CHECKLIST.md)
41
+ - [Plures Tools Inventory](../PLURES_TOOLS_INVENTORY.md)
@@ -0,0 +1,50 @@
1
+ # PR Overlap Guard
2
+
3
+ ## Overview
4
+
5
+ The Praxis PR Overlap Guard is an automated workflow that helps prevent duplicate work by detecting when a new pull request may overlap with existing open pull requests.
6
+
7
+ ## How It Works
8
+
9
+ The workflow runs automatically when a PR is opened, synchronized, or reopened. It:
10
+
11
+ 1. **Title Similarity Check**: Uses character trigram analysis to detect similar PR titles
12
+ - Normalizes titles (lowercase, removes special characters)
13
+ - Computes Jaccard coefficient of character trigrams
14
+ - Flags titles with >60% similarity
15
+
16
+ 2. **Code Overlap Check**: Analyzes diff signatures to detect similar changes
17
+ - Compares changed file paths
18
+ - Analyzes added/removed line counts
19
+ - Flags code with >50% overlap
20
+
21
+ 3. **Automated Alerts**: Posts a comment on the PR if potential overlaps are detected
22
+ - Lists similar PRs with links
23
+ - Shows similarity percentages
24
+ - Allows manual verification
25
+
26
+ ## Thresholds
27
+
28
+ - **Title Similarity**: 60% or higher triggers an alert
29
+ - **Patch Overlap**: 50% or higher triggers an alert
30
+ - PRs meeting either threshold will generate an alert
31
+
32
+ ## Response to Alerts
33
+
34
+ If you receive an overlap alert:
35
+
36
+ 1. Review the linked PRs to understand the overlap
37
+ 2. If your PR is intentionally similar (e.g., alternative approach), add a comment explaining the difference
38
+ 3. If it's a genuine duplicate, consider coordinating with the other PR author
39
+ 4. The alert is informational - you can proceed if you believe your PR is distinct
40
+
41
+ ## Technical Details
42
+
43
+ - **Algorithm**: Custom trigram-based string similarity + file/line change analysis
44
+ - **Performance**: Only computes expensive patch comparisons when titles are >30% similar
45
+ - **Dependencies**: Uses GitHub CLI (`gh`) for fetching PR data
46
+
47
+ ## Files
48
+
49
+ - Workflow: `.github/workflows/praxis-pr-overlap-guard.yml`
50
+ - Documentation: `docs/workflows/pr-overlap-guard.md` (this file)
package/package.json CHANGED
@@ -1,8 +1,13 @@
1
1
  {
2
2
  "name": "@plures/praxis",
3
- "version": "1.2.13",
3
+ "version": "1.2.41",
4
4
  "description": "The Full Plures Application Framework - declarative schemas, logic engine, component generation, and local-first data",
5
5
  "type": "module",
6
+ "packageManager": "pnpm@9.15.1",
7
+ "workspaces": [
8
+ "packages/*",
9
+ "apps/*"
10
+ ],
6
11
  "main": "./dist/node/index.js",
7
12
  "types": "./dist/node/index.d.ts",
8
13
  "bin": {
@@ -120,7 +125,7 @@
120
125
  "dependencies": {
121
126
  "commander": "^14.0.2",
122
127
  "js-yaml": "^4.1.1",
123
- "@plures/pluresdb": "^1.6.10"
128
+ "@plures/pluresdb": "^2.9.7"
124
129
  },
125
130
  "peerDependencies": {
126
131
  "svelte": "^5.46.0"