@plures/praxis 1.1.3 → 1.2.10
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/FRAMEWORK.md +106 -15
- package/README.md +194 -119
- package/dist/browser/adapter-CIMBGDC7.js +14 -0
- package/dist/browser/chunk-K377RW4V.js +230 -0
- package/dist/browser/chunk-MBVHLOU2.js +152 -0
- package/dist/browser/{chunk-R45WXWKH.js → chunk-VOMLVI6V.js} +1 -149
- package/dist/browser/engine-YJZV4SLD.js +8 -0
- package/dist/browser/index.d.ts +161 -5
- package/dist/browser/index.js +156 -141
- package/dist/browser/integrations/svelte.d.ts +2 -2
- package/dist/browser/integrations/svelte.js +2 -1
- package/dist/browser/{reactive-engine.svelte-C9OpcTHf.d.ts → reactive-engine.svelte-9aS0kTa8.d.ts} +136 -1
- package/dist/node/adapter-75ISSMWD.js +15 -0
- package/dist/node/chunk-5RH7UAQC.js +486 -0
- package/dist/node/chunk-MBVHLOU2.js +152 -0
- package/dist/node/chunk-PRPQO6R5.js +85 -0
- package/dist/node/chunk-R2PSBPKQ.js +150 -0
- package/dist/node/chunk-S54337I5.js +446 -0
- package/dist/node/{chunk-R45WXWKH.js → chunk-VOMLVI6V.js} +1 -149
- package/dist/node/chunk-WZ6B3LZ6.js +638 -0
- package/dist/node/cli/index.cjs +2936 -897
- package/dist/node/cli/index.js +27 -0
- package/dist/node/components/index.d.cts +3 -2
- package/dist/node/components/index.d.ts +3 -2
- package/dist/node/docs-JFNYTOJA.js +102 -0
- package/dist/node/engine-2DQBKBJC.js +9 -0
- package/dist/node/index.cjs +1114 -354
- package/dist/node/index.d.cts +388 -5
- package/dist/node/index.d.ts +388 -5
- package/dist/node/index.js +201 -640
- package/dist/node/integrations/svelte.cjs +76 -0
- package/dist/node/integrations/svelte.d.cts +2 -2
- package/dist/node/integrations/svelte.d.ts +2 -2
- package/dist/node/integrations/svelte.js +3 -1
- package/dist/node/{reactive-engine.svelte-1M4m_C_v.d.cts → reactive-engine.svelte-BFIZfawz.d.cts} +199 -1
- package/dist/node/{reactive-engine.svelte-ChNFn4Hj.d.ts → reactive-engine.svelte-CRNqHlbv.d.ts} +199 -1
- package/dist/node/reverse-W7THPV45.js +193 -0
- package/dist/node/{terminal-adapter-CWka-yL8.d.ts → terminal-adapter-B-UK_Vdz.d.ts} +28 -3
- package/dist/node/{terminal-adapter-CDzxoLKR.d.cts → terminal-adapter-BQSIF5bf.d.cts} +28 -3
- package/dist/node/validate-CNHUULQE.js +180 -0
- package/docs/core/pluresdb-integration.md +15 -15
- package/docs/decision-ledger/BEHAVIOR_LEDGER.md +225 -0
- package/docs/decision-ledger/DecisionLedger.tla +180 -0
- package/docs/decision-ledger/IMPLEMENTATION_SUMMARY.md +217 -0
- package/docs/decision-ledger/LATEST.md +166 -0
- package/docs/guides/cicd-pipeline.md +142 -0
- package/package.json +2 -2
- package/src/__tests__/cli-validate.test.ts +197 -0
- package/src/__tests__/decision-ledger.test.ts +485 -0
- package/src/__tests__/reverse-generator.test.ts +189 -0
- package/src/__tests__/scanner.test.ts +215 -0
- package/src/cli/commands/docs.ts +147 -0
- package/src/cli/commands/reverse.ts +289 -0
- package/src/cli/commands/validate.ts +264 -0
- package/src/cli/index.ts +68 -0
- package/src/core/pluresdb/adapter.ts +46 -3
- package/src/core/reactive-engine.svelte.ts +6 -1
- package/src/core/reactive-engine.ts +1 -1
- package/src/core/rules.ts +133 -0
- package/src/decision-ledger/README.md +400 -0
- package/src/decision-ledger/REVERSE_ENGINEERING.md +484 -0
- package/src/decision-ledger/facts-events.ts +121 -0
- package/src/decision-ledger/index.ts +70 -0
- package/src/decision-ledger/ledger.ts +246 -0
- package/src/decision-ledger/logic-ledger.ts +158 -0
- package/src/decision-ledger/reverse-generator.ts +426 -0
- package/src/decision-ledger/scanner.ts +506 -0
- package/src/decision-ledger/types.ts +247 -0
- package/src/decision-ledger/validation.ts +336 -0
- package/src/dsl/index.ts +13 -2
- package/src/index.browser.ts +6 -0
- package/src/index.ts +40 -0
- package/src/integrations/pluresdb.ts +14 -2
- package/src/integrations/unified.ts +350 -0
package/dist/node/cli/index.js
CHANGED
|
@@ -605,6 +605,15 @@ program.command("generate").description("Generate code from schemas").option("-s
|
|
|
605
605
|
).action(async (options) => {
|
|
606
606
|
await generate(options);
|
|
607
607
|
});
|
|
608
|
+
program.command("docs [schema]").description("Generate documentation from schemas or registries").option("-o, --output <dir>", "Output directory", "./docs").option("--title <title>", "Documentation title").option("--format <format>", "Diagram format (mermaid, dot)", "mermaid").option("--no-toc", "Disable table of contents").option("--no-timestamp", "Disable timestamp").option("--from-registry", "Generate from registry instead of schema").option("--header <content>", "Custom header content").option("--footer <content>", "Custom footer content").action(async (schema, options) => {
|
|
609
|
+
try {
|
|
610
|
+
const { docs } = await import("../docs-JFNYTOJA.js");
|
|
611
|
+
await docs(schema, options);
|
|
612
|
+
} catch (error) {
|
|
613
|
+
console.error("Error generating documentation:", error);
|
|
614
|
+
process.exit(1);
|
|
615
|
+
}
|
|
616
|
+
});
|
|
608
617
|
program.command("canvas [schema]").description("Open CodeCanvas for visual editing").option("-p, --port <port>", "Port for Canvas server", "3000").option("-m, --mode <mode>", "Mode (edit, view, present)", "edit").option("-e, --export <format>", "Export format (yaml, mermaid, json)").option("-o, --output <file>", "Output file for export").action(async (schema, options) => {
|
|
609
618
|
try {
|
|
610
619
|
const { canvas } = await import("../canvas-UERZHJYW.js");
|
|
@@ -687,4 +696,22 @@ program.command("verify <type>").description("Verify project implementation (e.g
|
|
|
687
696
|
process.exit(1);
|
|
688
697
|
}
|
|
689
698
|
});
|
|
699
|
+
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) => {
|
|
700
|
+
try {
|
|
701
|
+
const { validateCommand } = await import("../validate-CNHUULQE.js");
|
|
702
|
+
await validateCommand(options);
|
|
703
|
+
} catch (error) {
|
|
704
|
+
console.error("Error validating contracts:", error);
|
|
705
|
+
process.exit(1);
|
|
706
|
+
}
|
|
707
|
+
});
|
|
708
|
+
program.command("reverse").description("Reverse engineer contracts from existing codebase").option("-d, --dir <path>", "Root directory to scan", process.cwd()).option("--ai <provider>", "AI provider (none, github-copilot, openai, auto)", "none").option("-o, --output <dir>", "Output directory for contracts", "./contracts").option("--ledger", "Write to logic ledger", false).option("--dry-run", "Dry run mode (no files written)", false).option("-i, --interactive", "Interactive mode (prompt for each)", false).option("--confidence <threshold>", "Confidence threshold (0.0-1.0)", "0.7").option("--limit <n>", "Max number of rules to process").option("--author <name>", "Author name for ledger entries", "reverse-engineer").option("--format <format>", "Output format (json, yaml)", "json").action(async (options) => {
|
|
709
|
+
try {
|
|
710
|
+
const { reverseCommand } = await import("../reverse-W7THPV45.js");
|
|
711
|
+
await reverseCommand(options);
|
|
712
|
+
} catch (error) {
|
|
713
|
+
console.error("Error reverse engineering contracts:", error);
|
|
714
|
+
process.exit(1);
|
|
715
|
+
}
|
|
716
|
+
});
|
|
690
717
|
program.parse();
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { T as TerminalAdapter } from '../terminal-adapter-
|
|
2
|
-
export { c as createTerminalAdapter } from '../terminal-adapter-
|
|
1
|
+
import { T as TerminalAdapter } from '../terminal-adapter-BQSIF5bf.cjs';
|
|
2
|
+
export { c as createTerminalAdapter } from '../terminal-adapter-BQSIF5bf.cjs';
|
|
3
3
|
import '../schema.cjs';
|
|
4
|
+
import '@plures/pluresdb/local-first';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Praxis Svelte Components
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { T as TerminalAdapter } from '../terminal-adapter-
|
|
2
|
-
export { c as createTerminalAdapter } from '../terminal-adapter-
|
|
1
|
+
import { T as TerminalAdapter } from '../terminal-adapter-B-UK_Vdz.js';
|
|
2
|
+
export { c as createTerminalAdapter } from '../terminal-adapter-B-UK_Vdz.js';
|
|
3
3
|
import '../schema.js';
|
|
4
|
+
import '@plures/pluresdb/local-first';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Praxis Svelte Components
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createStateDocsGenerator
|
|
3
|
+
} from "./chunk-S54337I5.js";
|
|
4
|
+
import {
|
|
5
|
+
loadSchemaFromFile
|
|
6
|
+
} from "./chunk-UY7YEBE2.js";
|
|
7
|
+
import "./chunk-UATVJBNV.js";
|
|
8
|
+
import "./chunk-QGM4M3NI.js";
|
|
9
|
+
|
|
10
|
+
// src/cli/commands/docs.ts
|
|
11
|
+
import * as fs from "fs";
|
|
12
|
+
import * as path from "path";
|
|
13
|
+
async function docs(schemaOrRegistryPath, options) {
|
|
14
|
+
console.log("\n\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557");
|
|
15
|
+
console.log("\u2551 Praxis Documentation Generator \u2551");
|
|
16
|
+
console.log("\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D\n");
|
|
17
|
+
if (!schemaOrRegistryPath || !fs.existsSync(schemaOrRegistryPath)) {
|
|
18
|
+
console.error("Error: Schema or registry file required");
|
|
19
|
+
console.log("Usage: praxis docs <schema-file> [options]");
|
|
20
|
+
console.log("\nOptions:");
|
|
21
|
+
console.log(" --output <dir> Output directory (default: ./docs)");
|
|
22
|
+
console.log(" --title <title> Documentation title");
|
|
23
|
+
console.log(" --format <format> Diagram format: mermaid (default) or dot");
|
|
24
|
+
console.log(" --no-toc Disable table of contents");
|
|
25
|
+
console.log(" --no-timestamp Disable timestamp");
|
|
26
|
+
console.log(" --from-registry Generate from registry instead of schema");
|
|
27
|
+
process.exit(1);
|
|
28
|
+
}
|
|
29
|
+
const outputDir = options.output || "./docs";
|
|
30
|
+
const title = options.title || "Praxis Application";
|
|
31
|
+
const generator = createStateDocsGenerator({
|
|
32
|
+
projectTitle: title,
|
|
33
|
+
target: outputDir,
|
|
34
|
+
visualization: {
|
|
35
|
+
format: options.format || "mermaid",
|
|
36
|
+
exportPng: false
|
|
37
|
+
},
|
|
38
|
+
template: {
|
|
39
|
+
toc: options.toc !== false,
|
|
40
|
+
timestamp: options.timestamp !== false,
|
|
41
|
+
header: options.header,
|
|
42
|
+
footer: options.footer
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
console.log(`Source: ${schemaOrRegistryPath}`);
|
|
46
|
+
console.log(`Output: ${outputDir}
|
|
47
|
+
`);
|
|
48
|
+
try {
|
|
49
|
+
let generatedDocs;
|
|
50
|
+
if (options.fromRegistry) {
|
|
51
|
+
console.log("Loading registry module...");
|
|
52
|
+
const module = await import(path.resolve(schemaOrRegistryPath));
|
|
53
|
+
const registry = module.registry || module.default || module;
|
|
54
|
+
if (!registry || typeof registry.getAllRules !== "function") {
|
|
55
|
+
console.error("Error: Invalid registry module");
|
|
56
|
+
console.log("Expected: export const registry = new PraxisRegistry()");
|
|
57
|
+
process.exit(1);
|
|
58
|
+
}
|
|
59
|
+
console.log("Generating documentation from registry...");
|
|
60
|
+
const praxisModule = {
|
|
61
|
+
rules: registry.getAllRules(),
|
|
62
|
+
constraints: registry.getAllConstraints()
|
|
63
|
+
};
|
|
64
|
+
generatedDocs = generator.generateFromModule(praxisModule);
|
|
65
|
+
} else {
|
|
66
|
+
console.log("Loading schema...");
|
|
67
|
+
const result = await loadSchemaFromFile(schemaOrRegistryPath);
|
|
68
|
+
if (result.errors.length > 0 || !result.schema) {
|
|
69
|
+
console.error(`Error loading schema: ${result.errors.join(", ")}`);
|
|
70
|
+
process.exit(1);
|
|
71
|
+
}
|
|
72
|
+
console.log("Generating documentation from schema...");
|
|
73
|
+
generatedDocs = generator.generateFromSchema(result.schema);
|
|
74
|
+
}
|
|
75
|
+
if (!fs.existsSync(outputDir)) {
|
|
76
|
+
fs.mkdirSync(outputDir, { recursive: true });
|
|
77
|
+
}
|
|
78
|
+
console.log("\nWriting documentation files:\n");
|
|
79
|
+
for (const doc of generatedDocs) {
|
|
80
|
+
const fullPath = path.resolve(doc.path);
|
|
81
|
+
const dir = path.dirname(fullPath);
|
|
82
|
+
if (!fs.existsSync(dir)) {
|
|
83
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
84
|
+
}
|
|
85
|
+
fs.writeFileSync(fullPath, doc.content);
|
|
86
|
+
console.log(` \u2713 ${doc.path} (${doc.type})`);
|
|
87
|
+
}
|
|
88
|
+
console.log(`
|
|
89
|
+
\u2713 Generated ${generatedDocs.length} documentation file(s)`);
|
|
90
|
+
console.log(`
|
|
91
|
+
View your documentation: ${path.resolve(outputDir, "README.md")}`);
|
|
92
|
+
} catch (error) {
|
|
93
|
+
console.error(`Error generating documentation: ${error}`);
|
|
94
|
+
if (error instanceof Error) {
|
|
95
|
+
console.error(error.stack);
|
|
96
|
+
}
|
|
97
|
+
process.exit(1);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
export {
|
|
101
|
+
docs
|
|
102
|
+
};
|