@plures/praxis 1.3.0 → 1.4.4
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/dist/browser/{chunk-N63K4KWS.js → chunk-4IRUGWR3.js} +1 -1
- package/dist/browser/chunk-6SJ44Q64.js +473 -0
- package/dist/browser/chunk-BQOYZBWA.js +282 -0
- package/dist/browser/chunk-IG5BJ2MT.js +91 -0
- package/dist/browser/{chunk-MJK3IYTJ.js → chunk-JZDJU2DO.js} +4 -84
- package/dist/browser/chunk-ZEW4LJAJ.js +353 -0
- package/dist/browser/{engine-YIEGSX7U.js → engine-3B5WJPGT.js} +2 -1
- package/dist/browser/expectations/index.d.ts +180 -0
- package/dist/browser/expectations/index.js +14 -0
- package/dist/browser/factory/index.d.ts +149 -0
- package/dist/browser/factory/index.js +15 -0
- package/dist/browser/index.d.ts +274 -3
- package/dist/browser/index.js +407 -54
- package/dist/browser/integrations/svelte.d.ts +3 -2
- package/dist/browser/integrations/svelte.js +3 -2
- package/dist/browser/project/index.d.ts +176 -0
- package/dist/browser/project/index.js +19 -0
- package/dist/browser/reactive-engine.svelte-DgVTqHLc.d.ts +223 -0
- package/dist/browser/{reactive-engine.svelte-DjynI82A.d.ts → rules-i1LHpnGd.d.ts} +13 -221
- package/dist/node/chunk-2IUFZBH3.js +87 -0
- package/dist/node/{chunk-WZ6B3LZ6.js → chunk-7CSWBDFL.js} +3 -56
- package/dist/node/chunk-AZLNISFI.js +1690 -0
- package/dist/node/chunk-IG5BJ2MT.js +91 -0
- package/dist/node/{chunk-KMJWAFZV.js → chunk-JZDJU2DO.js} +4 -89
- package/dist/node/chunk-PGVSB6NR.js +59 -0
- package/dist/node/{chunk-5JQJZADT.js → chunk-ZO2LU4G4.js} +4 -4
- package/dist/node/cli/index.cjs +1126 -211
- package/dist/node/cli/index.js +21 -2
- package/dist/node/{engine-FEN5IYZ5.js → engine-VFHCIEM4.js} +2 -1
- package/dist/node/index.cjs +5623 -2765
- package/dist/node/index.d.cts +1181 -1
- package/dist/node/index.d.ts +1181 -1
- package/dist/node/index.js +1646 -79
- package/dist/node/integrations/svelte.js +4 -3
- package/dist/node/{reverse-W7THPV45.js → reverse-YD3CWIGM.js} +3 -2
- package/dist/node/rules-4DAJ4Z4N.js +7 -0
- package/dist/node/server-FKLVY57V.js +363 -0
- package/dist/node/{validate-EN3M4FUR.js → validate-5PSWJTIC.js} +5 -3
- package/package.json +50 -3
- package/src/__tests__/chronos-project.test.ts +799 -0
- package/src/__tests__/decision-ledger.test.ts +857 -402
- package/src/__tests__/expectations.test.ts +364 -0
- package/src/__tests__/factory.test.ts +426 -0
- package/src/__tests__/mcp-server.test.ts +310 -0
- package/src/__tests__/project.test.ts +396 -0
- package/src/chronos/diff.ts +336 -0
- package/src/chronos/hooks.ts +227 -0
- package/src/chronos/index.ts +83 -0
- package/src/chronos/project-chronicle.ts +198 -0
- package/src/chronos/timeline.ts +152 -0
- package/src/cli/index.ts +28 -0
- package/src/decision-ledger/analyzer-types.ts +280 -0
- package/src/decision-ledger/analyzer.ts +518 -0
- package/src/decision-ledger/contract-verification.ts +456 -0
- package/src/decision-ledger/derivation.ts +158 -0
- package/src/decision-ledger/index.ts +59 -0
- package/src/decision-ledger/report.ts +378 -0
- package/src/decision-ledger/suggestions.ts +287 -0
- package/src/expectations/expectations.ts +471 -0
- package/src/expectations/index.ts +29 -0
- package/src/expectations/types.ts +95 -0
- package/src/factory/factory.ts +634 -0
- package/src/factory/index.ts +27 -0
- package/src/factory/types.ts +64 -0
- package/src/index.browser.ts +83 -0
- package/src/index.ts +134 -0
- package/src/mcp/index.ts +33 -0
- package/src/mcp/server.ts +485 -0
- package/src/mcp/types.ts +161 -0
- package/src/project/index.ts +31 -0
- package/src/project/project.ts +423 -0
- package/src/project/types.ts +87 -0
- package/dist/node/chunk-PTH6MD6P.js +0 -487
- /package/dist/node/{chunk-R2PSBPKQ.js → chunk-TEMFJOIH.js} +0 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Praxis Rules Factory — Types
|
|
3
|
+
*
|
|
4
|
+
* Configuration types for predefined rule module factories.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
// ─── Input Rules ────────────────────────────────────────────────────────────
|
|
8
|
+
|
|
9
|
+
export type SanitizationType = 'sql-injection' | 'xss' | 'path-traversal' | 'command-injection';
|
|
10
|
+
|
|
11
|
+
export interface InputRulesConfig {
|
|
12
|
+
/** Sanitization checks to apply */
|
|
13
|
+
sanitize?: SanitizationType[];
|
|
14
|
+
/** Maximum input length (0 = unlimited) */
|
|
15
|
+
maxLength?: number;
|
|
16
|
+
/** Whether the input is required (non-empty) */
|
|
17
|
+
required?: boolean;
|
|
18
|
+
/** Custom field name for facts/events (default: 'input') */
|
|
19
|
+
fieldName?: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// ─── Toast Rules ────────────────────────────────────────────────────────────
|
|
23
|
+
|
|
24
|
+
export interface ToastRulesConfig {
|
|
25
|
+
/** Only show toast if there's a meaningful diff */
|
|
26
|
+
requireDiff?: boolean;
|
|
27
|
+
/** Auto-dismiss after N milliseconds (0 = no auto-dismiss) */
|
|
28
|
+
autoDismissMs?: number;
|
|
29
|
+
/** Prevent duplicate toasts with same message */
|
|
30
|
+
deduplicate?: boolean;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// ─── Form Rules ─────────────────────────────────────────────────────────────
|
|
34
|
+
|
|
35
|
+
export interface FormRulesConfig {
|
|
36
|
+
/** Validate fields on blur */
|
|
37
|
+
validateOnBlur?: boolean;
|
|
38
|
+
/** Gate form submission on validation passing */
|
|
39
|
+
submitGate?: boolean;
|
|
40
|
+
/** Custom form name for namespacing facts */
|
|
41
|
+
formName?: string;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// ─── Navigation Rules ───────────────────────────────────────────────────────
|
|
45
|
+
|
|
46
|
+
export interface NavigationRulesConfig {
|
|
47
|
+
/** Warn/block navigation when form has unsaved changes */
|
|
48
|
+
dirtyGuard?: boolean;
|
|
49
|
+
/** Require authentication for navigation */
|
|
50
|
+
authRequired?: boolean;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// ─── Data Rules ─────────────────────────────────────────────────────────────
|
|
54
|
+
|
|
55
|
+
export interface DataRulesConfig {
|
|
56
|
+
/** Enable optimistic UI updates */
|
|
57
|
+
optimisticUpdate?: boolean;
|
|
58
|
+
/** Rollback optimistic updates on error */
|
|
59
|
+
rollbackOnError?: boolean;
|
|
60
|
+
/** Invalidate relevant caches on data change */
|
|
61
|
+
cacheInvalidation?: boolean;
|
|
62
|
+
/** Custom entity name for facts */
|
|
63
|
+
entityName?: string;
|
|
64
|
+
}
|
package/src/index.browser.ts
CHANGED
|
@@ -220,3 +220,86 @@ export {
|
|
|
220
220
|
// Unified Integration Helpers
|
|
221
221
|
export type { UnifiedAppConfig, UnifiedApp } from './integrations/unified.js';
|
|
222
222
|
export { createUnifiedApp, attachAllIntegrations } from './integrations/unified.js';
|
|
223
|
+
|
|
224
|
+
// ── Rule Result (typed rule returns — no empty arrays) ──────────────────────
|
|
225
|
+
export { RuleResult, fact } from './core/rule-result.js';
|
|
226
|
+
export type { TypedRuleFn } from './core/rule-result.js';
|
|
227
|
+
|
|
228
|
+
// ── UI Rules (predefined, lightweight, separate from business logic) ────────
|
|
229
|
+
export {
|
|
230
|
+
uiModule,
|
|
231
|
+
createUIModule,
|
|
232
|
+
loadingGateRule,
|
|
233
|
+
errorDisplayRule,
|
|
234
|
+
offlineIndicatorRule,
|
|
235
|
+
dirtyGuardRule,
|
|
236
|
+
initGateRule,
|
|
237
|
+
viewportRule,
|
|
238
|
+
noInteractionWhileLoadingConstraint,
|
|
239
|
+
mustBeInitializedConstraint,
|
|
240
|
+
uiStateChanged,
|
|
241
|
+
navigationRequest,
|
|
242
|
+
resizeEvent,
|
|
243
|
+
} from './core/ui-rules.js';
|
|
244
|
+
export type { UIContext } from './core/ui-rules.js';
|
|
245
|
+
|
|
246
|
+
// ── Completeness Analysis ───────────────────────────────────────────────────
|
|
247
|
+
export { auditCompleteness, formatReport } from './core/completeness.js';
|
|
248
|
+
export type { LogicBranch, StateField, StateTransition, CompletenessReport, CompletenessConfig } from './core/completeness.js';
|
|
249
|
+
|
|
250
|
+
// ── Expectations DSL (behavioral declarations) ─────────────────────────────
|
|
251
|
+
export {
|
|
252
|
+
Expectation,
|
|
253
|
+
ExpectationSet,
|
|
254
|
+
expectBehavior,
|
|
255
|
+
verify,
|
|
256
|
+
formatVerificationReport,
|
|
257
|
+
} from './expectations/index.js';
|
|
258
|
+
export type {
|
|
259
|
+
ExpectationCondition,
|
|
260
|
+
ConditionStatus,
|
|
261
|
+
ConditionResult,
|
|
262
|
+
ExpectationResult,
|
|
263
|
+
VerificationReport,
|
|
264
|
+
ExpectationSetOptions,
|
|
265
|
+
VerifiableRegistry,
|
|
266
|
+
VerifiableDescriptor,
|
|
267
|
+
} from './expectations/index.js';
|
|
268
|
+
|
|
269
|
+
// ── Rules Factory (predefined modules) ─────────────────────────────────────
|
|
270
|
+
export {
|
|
271
|
+
inputRules,
|
|
272
|
+
toastRules,
|
|
273
|
+
formRules,
|
|
274
|
+
navigationRules,
|
|
275
|
+
dataRules,
|
|
276
|
+
} from './factory/index.js';
|
|
277
|
+
export type {
|
|
278
|
+
InputRulesConfig,
|
|
279
|
+
ToastRulesConfig,
|
|
280
|
+
FormRulesConfig,
|
|
281
|
+
NavigationRulesConfig,
|
|
282
|
+
DataRulesConfig,
|
|
283
|
+
SanitizationType,
|
|
284
|
+
} from './factory/index.js';
|
|
285
|
+
|
|
286
|
+
// ── Project Logic (developer workflow) ──────────────────────────────────────
|
|
287
|
+
export {
|
|
288
|
+
defineGate,
|
|
289
|
+
semverContract,
|
|
290
|
+
commitFromState,
|
|
291
|
+
branchRules,
|
|
292
|
+
lintGate,
|
|
293
|
+
formatGate,
|
|
294
|
+
expectationGate,
|
|
295
|
+
} from './project/index.js';
|
|
296
|
+
export type {
|
|
297
|
+
GateConfig,
|
|
298
|
+
GateState,
|
|
299
|
+
GateStatus,
|
|
300
|
+
SemverContractConfig,
|
|
301
|
+
SemverReport,
|
|
302
|
+
PraxisDiff,
|
|
303
|
+
BranchRulesConfig,
|
|
304
|
+
PredefinedGateConfig,
|
|
305
|
+
} from './project/index.js';
|
package/src/index.ts
CHANGED
|
@@ -155,6 +155,51 @@ export type {
|
|
|
155
155
|
LedgerEntryStatus,
|
|
156
156
|
} from './decision-ledger/index.js';
|
|
157
157
|
|
|
158
|
+
// Decision Ledger — Analyzer Engine
|
|
159
|
+
export {
|
|
160
|
+
analyzeDependencyGraph,
|
|
161
|
+
findDeadRules,
|
|
162
|
+
findUnreachableStates,
|
|
163
|
+
findShadowedRules,
|
|
164
|
+
findContradictions,
|
|
165
|
+
findGaps,
|
|
166
|
+
traceDerivation,
|
|
167
|
+
traceImpact,
|
|
168
|
+
verifyContractExamples,
|
|
169
|
+
verifyInvariants,
|
|
170
|
+
findContractGaps,
|
|
171
|
+
crossReferenceContracts,
|
|
172
|
+
suggest,
|
|
173
|
+
suggestAll,
|
|
174
|
+
generateLedger,
|
|
175
|
+
formatLedger,
|
|
176
|
+
formatBuildOutput,
|
|
177
|
+
diffLedgers,
|
|
178
|
+
} from './decision-ledger/index.js';
|
|
179
|
+
export type {
|
|
180
|
+
FactNode,
|
|
181
|
+
DependencyEdge,
|
|
182
|
+
DependencyGraph,
|
|
183
|
+
DerivationStep,
|
|
184
|
+
DerivationChain,
|
|
185
|
+
DeadRule,
|
|
186
|
+
UnreachableState,
|
|
187
|
+
ShadowedRule,
|
|
188
|
+
Contradiction,
|
|
189
|
+
Gap,
|
|
190
|
+
ImpactReport,
|
|
191
|
+
ExampleVerification,
|
|
192
|
+
ContractVerificationResult,
|
|
193
|
+
InvariantCheck,
|
|
194
|
+
ContractCoverageGap,
|
|
195
|
+
CrossReference,
|
|
196
|
+
FindingType,
|
|
197
|
+
Suggestion,
|
|
198
|
+
AnalysisReport,
|
|
199
|
+
LedgerDiffEntry,
|
|
200
|
+
LedgerDiff,
|
|
201
|
+
} from './decision-ledger/index.js';
|
|
202
|
+
|
|
158
203
|
// Terminal Node Runtime
|
|
159
204
|
export type {
|
|
160
205
|
TerminalExecutionResult,
|
|
@@ -353,3 +398,92 @@ export type { UIContext } from './core/ui-rules.js';
|
|
|
353
398
|
export { auditCompleteness, formatReport } from './core/completeness.js';
|
|
354
399
|
export type { LogicBranch, StateField, StateTransition, CompletenessReport, CompletenessConfig } from './core/completeness.js';
|
|
355
400
|
|
|
401
|
+
// ── Expectations DSL (behavioral declarations) ─────────────────────────────
|
|
402
|
+
export {
|
|
403
|
+
Expectation,
|
|
404
|
+
ExpectationSet,
|
|
405
|
+
expectBehavior,
|
|
406
|
+
verify,
|
|
407
|
+
formatVerificationReport,
|
|
408
|
+
} from './expectations/index.js';
|
|
409
|
+
export type {
|
|
410
|
+
ExpectationCondition,
|
|
411
|
+
ConditionStatus,
|
|
412
|
+
ConditionResult,
|
|
413
|
+
ExpectationResult,
|
|
414
|
+
VerificationReport,
|
|
415
|
+
ExpectationSetOptions,
|
|
416
|
+
VerifiableRegistry,
|
|
417
|
+
VerifiableDescriptor,
|
|
418
|
+
} from './expectations/index.js';
|
|
419
|
+
|
|
420
|
+
// ── Rules Factory (predefined modules) ─────────────────────────────────────
|
|
421
|
+
export {
|
|
422
|
+
inputRules,
|
|
423
|
+
toastRules,
|
|
424
|
+
formRules,
|
|
425
|
+
navigationRules,
|
|
426
|
+
dataRules,
|
|
427
|
+
} from './factory/index.js';
|
|
428
|
+
export type {
|
|
429
|
+
InputRulesConfig,
|
|
430
|
+
ToastRulesConfig,
|
|
431
|
+
FormRulesConfig,
|
|
432
|
+
NavigationRulesConfig,
|
|
433
|
+
DataRulesConfig,
|
|
434
|
+
SanitizationType,
|
|
435
|
+
} from './factory/index.js';
|
|
436
|
+
|
|
437
|
+
// ── Project Logic (developer workflow) ──────────────────────────────────────
|
|
438
|
+
export {
|
|
439
|
+
defineGate,
|
|
440
|
+
semverContract,
|
|
441
|
+
commitFromState,
|
|
442
|
+
branchRules,
|
|
443
|
+
lintGate,
|
|
444
|
+
formatGate,
|
|
445
|
+
expectationGate,
|
|
446
|
+
} from './project/index.js';
|
|
447
|
+
export type {
|
|
448
|
+
GateConfig,
|
|
449
|
+
GateState,
|
|
450
|
+
GateStatus,
|
|
451
|
+
SemverContractConfig,
|
|
452
|
+
SemverReport,
|
|
453
|
+
PraxisDiff,
|
|
454
|
+
BranchRulesConfig,
|
|
455
|
+
PredefinedGateConfig,
|
|
456
|
+
} from './project/index.js';
|
|
457
|
+
|
|
458
|
+
// ── Chronos Project-Level Chronicle ─────────────────────────────────────────
|
|
459
|
+
export {
|
|
460
|
+
ProjectChronicle,
|
|
461
|
+
createProjectChronicle,
|
|
462
|
+
Timeline,
|
|
463
|
+
createTimeline,
|
|
464
|
+
enableProjectChronicle,
|
|
465
|
+
recordAudit,
|
|
466
|
+
diffRegistries,
|
|
467
|
+
diffContracts,
|
|
468
|
+
diffExpectations,
|
|
469
|
+
formatDelta,
|
|
470
|
+
formatCommitMessage as formatBehavioralCommit,
|
|
471
|
+
formatReleaseNotes,
|
|
472
|
+
} from './chronos/index.js';
|
|
473
|
+
export type {
|
|
474
|
+
ProjectEvent,
|
|
475
|
+
ProjectEventKind,
|
|
476
|
+
ProjectChronicleOptions,
|
|
477
|
+
TimelineFilter,
|
|
478
|
+
BehavioralDelta,
|
|
479
|
+
ChronicleHandle,
|
|
480
|
+
EnableChronicleOptions,
|
|
481
|
+
RegistrySnapshot,
|
|
482
|
+
RegistryDiff,
|
|
483
|
+
ContractCoverage,
|
|
484
|
+
ContractDiff,
|
|
485
|
+
ExpectationSnapshot,
|
|
486
|
+
ExpectationDiff,
|
|
487
|
+
FullBehavioralDiff,
|
|
488
|
+
} from './chronos/index.js';
|
|
489
|
+
|
package/src/mcp/index.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Praxis MCP Module
|
|
3
|
+
*
|
|
4
|
+
* Public API for the MCP (Model Context Protocol) server.
|
|
5
|
+
* Exposes Praxis engine operations as AI-consumable tools.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* import { createPraxisMcpServer } from '@plures/praxis/mcp';
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
export { createPraxisMcpServer } from './server.js';
|
|
14
|
+
export type {
|
|
15
|
+
PraxisMcpServerOptions,
|
|
16
|
+
InspectInput,
|
|
17
|
+
InspectOutput,
|
|
18
|
+
RuleInfo,
|
|
19
|
+
ConstraintInfo,
|
|
20
|
+
EvaluateInput,
|
|
21
|
+
EvaluateOutput,
|
|
22
|
+
AuditInput,
|
|
23
|
+
AuditOutput,
|
|
24
|
+
SuggestInput,
|
|
25
|
+
SuggestOutput,
|
|
26
|
+
StepInput,
|
|
27
|
+
StepOutput,
|
|
28
|
+
FactsOutput,
|
|
29
|
+
ContractsInput,
|
|
30
|
+
ContractsOutput,
|
|
31
|
+
ContractInfo,
|
|
32
|
+
GatesInput,
|
|
33
|
+
} from './types.js';
|