@plures/praxis 1.4.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-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-7M3HV4XR.js → chunk-ZO2LU4G4.js} +1 -1
- package/dist/node/cli/index.cjs +48 -0
- package/dist/node/cli/index.js +2 -2
- package/dist/node/{engine-FEN5IYZ5.js → engine-VFHCIEM4.js} +2 -1
- package/dist/node/index.cjs +1747 -0
- package/dist/node/index.d.cts +960 -278
- package/dist/node/index.d.ts +960 -278
- package/dist/node/index.js +559 -6
- package/dist/node/integrations/svelte.js +3 -2
- package/dist/node/{server-SYZPDULV.js → server-FKLVY57V.js} +4 -2
- package/dist/node/{validate-TQGVIG7G.js → validate-5PSWJTIC.js} +2 -1
- package/package.json +32 -11
- package/src/__tests__/chronos-project.test.ts +799 -0
- package/src/__tests__/decision-ledger.test.ts +857 -402
- 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/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/index.browser.ts +83 -0
- package/src/index.ts +77 -0
- package/dist/node/chunk-FWOXU4MM.js +0 -487
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
// src/core/rule-result.ts
|
|
2
|
+
var RuleResult = class _RuleResult {
|
|
3
|
+
/** The kind of result */
|
|
4
|
+
kind;
|
|
5
|
+
/** Facts produced (only for 'emit') */
|
|
6
|
+
facts;
|
|
7
|
+
/** Fact tags to retract (only for 'retract') */
|
|
8
|
+
retractTags;
|
|
9
|
+
/** Optional reason (for noop/skip/retract — useful for debugging) */
|
|
10
|
+
reason;
|
|
11
|
+
/** The rule ID that produced this result (set by engine) */
|
|
12
|
+
ruleId;
|
|
13
|
+
constructor(kind, facts, retractTags, reason) {
|
|
14
|
+
this.kind = kind;
|
|
15
|
+
this.facts = facts;
|
|
16
|
+
this.retractTags = retractTags;
|
|
17
|
+
this.reason = reason;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Rule produced facts.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* return RuleResult.emit([
|
|
24
|
+
* { tag: 'sprint.behind', payload: { deficit: 5 } }
|
|
25
|
+
* ]);
|
|
26
|
+
*/
|
|
27
|
+
static emit(facts) {
|
|
28
|
+
if (facts.length === 0) {
|
|
29
|
+
throw new Error(
|
|
30
|
+
"RuleResult.emit() requires at least one fact. Use RuleResult.noop() or RuleResult.skip() when a rule has nothing to say."
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
return new _RuleResult("emit", facts, []);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Rule evaluated but had nothing to report.
|
|
37
|
+
* Unlike returning [], this is explicit and traceable.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* if (ctx.completedHours >= expectedHours) {
|
|
41
|
+
* return RuleResult.noop('Sprint is on pace');
|
|
42
|
+
* }
|
|
43
|
+
*/
|
|
44
|
+
static noop(reason) {
|
|
45
|
+
return new _RuleResult("noop", [], [], reason);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Rule decided to skip because preconditions were not met.
|
|
49
|
+
* Distinct from noop: skip means "I can't evaluate", noop means "I evaluated and found nothing".
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* if (!ctx.sprintName) {
|
|
53
|
+
* return RuleResult.skip('No active sprint');
|
|
54
|
+
* }
|
|
55
|
+
*/
|
|
56
|
+
static skip(reason) {
|
|
57
|
+
return new _RuleResult("skip", [], [], reason);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Rule retracts previously emitted facts by tag.
|
|
61
|
+
* Used when a condition that previously produced facts is no longer true.
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* // Sprint was behind, but caught up
|
|
65
|
+
* if (ctx.completedHours >= expectedHours) {
|
|
66
|
+
* return RuleResult.retract(['sprint.behind'], 'Sprint caught up');
|
|
67
|
+
* }
|
|
68
|
+
*/
|
|
69
|
+
static retract(tags, reason) {
|
|
70
|
+
if (tags.length === 0) {
|
|
71
|
+
throw new Error("RuleResult.retract() requires at least one tag.");
|
|
72
|
+
}
|
|
73
|
+
return new _RuleResult("retract", [], tags, reason);
|
|
74
|
+
}
|
|
75
|
+
/** Whether this result produced facts */
|
|
76
|
+
get hasFacts() {
|
|
77
|
+
return this.facts.length > 0;
|
|
78
|
+
}
|
|
79
|
+
/** Whether this result retracts facts */
|
|
80
|
+
get hasRetractions() {
|
|
81
|
+
return this.retractTags.length > 0;
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
function fact(tag, payload) {
|
|
85
|
+
return { tag, payload };
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export {
|
|
89
|
+
RuleResult,
|
|
90
|
+
fact
|
|
91
|
+
};
|
|
@@ -1,93 +1,10 @@
|
|
|
1
|
+
import {
|
|
2
|
+
RuleResult
|
|
3
|
+
} from "./chunk-IG5BJ2MT.js";
|
|
4
|
+
|
|
1
5
|
// src/core/protocol.ts
|
|
2
6
|
var PRAXIS_PROTOCOL_VERSION = "1.0.0";
|
|
3
7
|
|
|
4
|
-
// src/core/rule-result.ts
|
|
5
|
-
var RuleResult = class _RuleResult {
|
|
6
|
-
/** The kind of result */
|
|
7
|
-
kind;
|
|
8
|
-
/** Facts produced (only for 'emit') */
|
|
9
|
-
facts;
|
|
10
|
-
/** Fact tags to retract (only for 'retract') */
|
|
11
|
-
retractTags;
|
|
12
|
-
/** Optional reason (for noop/skip/retract — useful for debugging) */
|
|
13
|
-
reason;
|
|
14
|
-
/** The rule ID that produced this result (set by engine) */
|
|
15
|
-
ruleId;
|
|
16
|
-
constructor(kind, facts, retractTags, reason) {
|
|
17
|
-
this.kind = kind;
|
|
18
|
-
this.facts = facts;
|
|
19
|
-
this.retractTags = retractTags;
|
|
20
|
-
this.reason = reason;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Rule produced facts.
|
|
24
|
-
*
|
|
25
|
-
* @example
|
|
26
|
-
* return RuleResult.emit([
|
|
27
|
-
* { tag: 'sprint.behind', payload: { deficit: 5 } }
|
|
28
|
-
* ]);
|
|
29
|
-
*/
|
|
30
|
-
static emit(facts) {
|
|
31
|
-
if (facts.length === 0) {
|
|
32
|
-
throw new Error(
|
|
33
|
-
"RuleResult.emit() requires at least one fact. Use RuleResult.noop() or RuleResult.skip() when a rule has nothing to say."
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
return new _RuleResult("emit", facts, []);
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Rule evaluated but had nothing to report.
|
|
40
|
-
* Unlike returning [], this is explicit and traceable.
|
|
41
|
-
*
|
|
42
|
-
* @example
|
|
43
|
-
* if (ctx.completedHours >= expectedHours) {
|
|
44
|
-
* return RuleResult.noop('Sprint is on pace');
|
|
45
|
-
* }
|
|
46
|
-
*/
|
|
47
|
-
static noop(reason) {
|
|
48
|
-
return new _RuleResult("noop", [], [], reason);
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Rule decided to skip because preconditions were not met.
|
|
52
|
-
* Distinct from noop: skip means "I can't evaluate", noop means "I evaluated and found nothing".
|
|
53
|
-
*
|
|
54
|
-
* @example
|
|
55
|
-
* if (!ctx.sprintName) {
|
|
56
|
-
* return RuleResult.skip('No active sprint');
|
|
57
|
-
* }
|
|
58
|
-
*/
|
|
59
|
-
static skip(reason) {
|
|
60
|
-
return new _RuleResult("skip", [], [], reason);
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Rule retracts previously emitted facts by tag.
|
|
64
|
-
* Used when a condition that previously produced facts is no longer true.
|
|
65
|
-
*
|
|
66
|
-
* @example
|
|
67
|
-
* // Sprint was behind, but caught up
|
|
68
|
-
* if (ctx.completedHours >= expectedHours) {
|
|
69
|
-
* return RuleResult.retract(['sprint.behind'], 'Sprint caught up');
|
|
70
|
-
* }
|
|
71
|
-
*/
|
|
72
|
-
static retract(tags, reason) {
|
|
73
|
-
if (tags.length === 0) {
|
|
74
|
-
throw new Error("RuleResult.retract() requires at least one tag.");
|
|
75
|
-
}
|
|
76
|
-
return new _RuleResult("retract", [], tags, reason);
|
|
77
|
-
}
|
|
78
|
-
/** Whether this result produced facts */
|
|
79
|
-
get hasFacts() {
|
|
80
|
-
return this.facts.length > 0;
|
|
81
|
-
}
|
|
82
|
-
/** Whether this result retracts facts */
|
|
83
|
-
get hasRetractions() {
|
|
84
|
-
return this.retractTags.length > 0;
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
function fact(tag, payload) {
|
|
88
|
-
return { tag, payload };
|
|
89
|
-
}
|
|
90
|
-
|
|
91
8
|
// src/core/engine.ts
|
|
92
9
|
function safeClone(value) {
|
|
93
10
|
if (value === null || typeof value !== "object") {
|
|
@@ -382,8 +299,6 @@ function createPraxisEngine(options) {
|
|
|
382
299
|
|
|
383
300
|
export {
|
|
384
301
|
PRAXIS_PROTOCOL_VERSION,
|
|
385
|
-
RuleResult,
|
|
386
|
-
fact,
|
|
387
302
|
LogicEngine,
|
|
388
303
|
createPraxisEngine
|
|
389
304
|
};
|
package/dist/node/cli/index.cjs
CHANGED
|
@@ -216406,6 +216406,49 @@ var init_reverse_generator = __esm({
|
|
|
216406
216406
|
}
|
|
216407
216407
|
});
|
|
216408
216408
|
|
|
216409
|
+
// src/decision-ledger/analyzer.ts
|
|
216410
|
+
var init_analyzer = __esm({
|
|
216411
|
+
"src/decision-ledger/analyzer.ts"() {
|
|
216412
|
+
"use strict";
|
|
216413
|
+
init_rule_result();
|
|
216414
|
+
}
|
|
216415
|
+
});
|
|
216416
|
+
|
|
216417
|
+
// src/decision-ledger/derivation.ts
|
|
216418
|
+
var init_derivation = __esm({
|
|
216419
|
+
"src/decision-ledger/derivation.ts"() {
|
|
216420
|
+
"use strict";
|
|
216421
|
+
init_analyzer();
|
|
216422
|
+
}
|
|
216423
|
+
});
|
|
216424
|
+
|
|
216425
|
+
// src/decision-ledger/contract-verification.ts
|
|
216426
|
+
var init_contract_verification = __esm({
|
|
216427
|
+
"src/decision-ledger/contract-verification.ts"() {
|
|
216428
|
+
"use strict";
|
|
216429
|
+
init_rule_result();
|
|
216430
|
+
init_analyzer();
|
|
216431
|
+
}
|
|
216432
|
+
});
|
|
216433
|
+
|
|
216434
|
+
// src/decision-ledger/suggestions.ts
|
|
216435
|
+
var init_suggestions = __esm({
|
|
216436
|
+
"src/decision-ledger/suggestions.ts"() {
|
|
216437
|
+
"use strict";
|
|
216438
|
+
}
|
|
216439
|
+
});
|
|
216440
|
+
|
|
216441
|
+
// src/decision-ledger/report.ts
|
|
216442
|
+
var init_report = __esm({
|
|
216443
|
+
"src/decision-ledger/report.ts"() {
|
|
216444
|
+
"use strict";
|
|
216445
|
+
init_analyzer();
|
|
216446
|
+
init_derivation();
|
|
216447
|
+
init_suggestions();
|
|
216448
|
+
init_contract_verification();
|
|
216449
|
+
}
|
|
216450
|
+
});
|
|
216451
|
+
|
|
216409
216452
|
// src/decision-ledger/index.ts
|
|
216410
216453
|
var init_decision_ledger = __esm({
|
|
216411
216454
|
"src/decision-ledger/index.ts"() {
|
|
@@ -216417,6 +216460,11 @@ var init_decision_ledger = __esm({
|
|
|
216417
216460
|
init_logic_ledger();
|
|
216418
216461
|
init_scanner();
|
|
216419
216462
|
init_reverse_generator();
|
|
216463
|
+
init_analyzer();
|
|
216464
|
+
init_derivation();
|
|
216465
|
+
init_contract_verification();
|
|
216466
|
+
init_suggestions();
|
|
216467
|
+
init_report();
|
|
216420
216468
|
}
|
|
216421
216469
|
});
|
|
216422
216470
|
|
package/dist/node/cli/index.js
CHANGED
|
@@ -689,7 +689,7 @@ cloudCmd.command("usage").description("View cloud usage metrics").action(async (
|
|
|
689
689
|
});
|
|
690
690
|
program.command("mcp").description("Start the Praxis MCP server (Model Context Protocol) for AI assistant integration").option("--name <name>", "Server name", "@plures/praxis").option("--version <version>", "Server version", "1.0.0").action(async (options) => {
|
|
691
691
|
try {
|
|
692
|
-
const { createPraxisMcpServer } = await import("../server-
|
|
692
|
+
const { createPraxisMcpServer } = await import("../server-FKLVY57V.js");
|
|
693
693
|
const { PraxisRegistry } = await import("../rules-4DAJ4Z4N.js");
|
|
694
694
|
const registry = new PraxisRegistry({
|
|
695
695
|
compliance: { enabled: false }
|
|
@@ -717,7 +717,7 @@ program.command("verify <type>").description("Verify project implementation (e.g
|
|
|
717
717
|
});
|
|
718
718
|
program.command("validate").description("Validate contract coverage for rules and constraints").option("--output <format>", "Output format (console, json, sarif)", "console").option("--strict", "Exit with error if contracts are missing", false).option("--registry <path>", "Path to registry module").option("--tests", "Check for tests for each rule/constraint", true).option("--spec", "Check for specs for each rule/constraint", true).option("--emit-facts", "Emit ContractMissing facts JSON payload", false).option("--gap-output <file>", "Write contract-gap payload to file").option("--ledger <dir>", "Write logic ledger snapshots to directory").option("--author <name>", "Author name for ledger entries", "system").action(async (options) => {
|
|
719
719
|
try {
|
|
720
|
-
const { validateCommand } = await import("../validate-
|
|
720
|
+
const { validateCommand } = await import("../validate-5PSWJTIC.js");
|
|
721
721
|
await validateCommand(options);
|
|
722
722
|
} catch (error) {
|
|
723
723
|
console.error("Error validating contracts:", error);
|