prae-cli 0.10.1 → 0.10.2

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/lib/bin.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  //#region src/bin.ts
3
3
  const argv = process.argv.slice(2);
4
- (argv[0] === "hook" && argv[1] === "claude-code" ? import("./hook-DxLgNtc4.js").then(({ runHook }) => runHook(argv.slice(2))) : import("./cli-BlWTUnGJ.js").then(({ main }) => main(argv))).catch((error) => {
4
+ (argv[0] === "hook" && argv[1] === "claude-code" ? import("./hook-C7LGEIs2.js").then(({ runHook }) => runHook(argv.slice(2))) : import("./cli-DYKKNlDI.js").then(({ main }) => main(argv))).catch((error) => {
5
5
  console.error(`prae: ${error instanceof Error ? error.message : error}`);
6
6
  process.exit(1);
7
7
  });
@@ -1,6 +1,7 @@
1
1
  import { c as withinAny, i as evaluate, n as FRAMEWORKS, o as hostOf, r as cite, t as parsePack } from "./src-CZYvvEn5.js";
2
2
  import { a as verifyEntries, b as seal, g as GENESIS, h as verifySignature, l as verifyBytes, n as Ledger, r as readEntries, t as verifyGrowing, u as fingerprint, v as chain } from "./src-CuiWC80o.js";
3
- import { a as renderPacks, c as renderNav, i as renderOverview, l as renderShell, n as renderApprovals, o as CONTROLS, r as renderCompliance, s as esc, t as navFor, u as VERDICT_LABEL$1 } from "./views-C7DD-Oif.js";
3
+ import { t as capabilityOf } from "./facts-DkTRO2p0.js";
4
+ import { a as renderPacks, c as renderNav, i as renderOverview, l as renderShell, n as renderApprovals, o as CONTROLS, r as renderCompliance, s as esc, t as navFor, u as VERDICT_LABEL$1 } from "./views-endiZu1Z.js";
4
5
  import { createRequire } from "node:module";
5
6
  import { closeSync, existsSync, mkdirSync, openSync, readFileSync, readSync, readdirSync, statSync, watch, writeFileSync } from "node:fs";
6
7
  import { mkdir, readFile, writeFile } from "node:fs/promises";
@@ -2184,7 +2185,7 @@ async function check(path, argv = []) {
2184
2185
  * from the findings, so there is nothing here to be careful about printing.
2185
2186
  */
2186
2187
  async function scanFile(path, packPath, json) {
2187
- const { scan } = await import("./src-CwBEFhww.js");
2188
+ const { scan } = await import("./src-DIuEg7gi.js");
2188
2189
  let content;
2189
2190
  try {
2190
2191
  content = await readFile(path, "utf8");
@@ -2224,7 +2225,7 @@ async function scanFile(path, packPath, json) {
2224
2225
  * not come up inspecting nothing.
2225
2226
  */
2226
2227
  async function mcp(root, packPath, ledgerPath) {
2227
- const { serveMcp } = await import("./mcp-DdEDvTvR.js");
2228
+ const { serveMcp } = await import("./mcp-C2gadkb2.js");
2228
2229
  const { resolve: resolve$1 } = await import("node:path");
2229
2230
  const bundled = [join(import.meta.dirname, "secret-catcher.prae.json"), join(import.meta.dirname, "..", "..", "..", "examples", "secret-catcher.prae.json")].find((candidate) => existsSync(candidate));
2230
2231
  const chosen = packPath ?? bundled;
@@ -2256,8 +2257,7 @@ function parseArgs(pairs) {
2256
2257
  }
2257
2258
  async function explain(path, tool, pairs) {
2258
2259
  const pack = await loadPack(path);
2259
- const { capabilityForTool } = await import("capmark");
2260
- const capability = capabilityForTool(tool)?.id;
2260
+ const capability = capabilityOf(tool);
2261
2261
  const decision = evaluate(pack, {
2262
2262
  tool,
2263
2263
  ...capability === void 0 ? {} : { capability },
@@ -2393,7 +2393,7 @@ async function receipt(path, seq, keyPath, out) {
2393
2393
  * file and sets the exit code, so scripts can branch on it.
2394
2394
  */
2395
2395
  async function verifyReceiptCmd(path) {
2396
- const { checkReceipt } = await import("./receipt-check-2F4zLEW5.js");
2396
+ const { checkReceipt } = await import("./receipt-check-BtAJqyrX.js");
2397
2397
  let parsed$1;
2398
2398
  try {
2399
2399
  parsed$1 = JSON.parse(await readFile(path, "utf8"));
@@ -2424,7 +2424,7 @@ async function test(suitePath, packOverride, asJson) {
2424
2424
  } catch (error) {
2425
2425
  return fail(`${suitePath} is not valid JSON: ${error instanceof Error ? error.message : error}`);
2426
2426
  }
2427
- const { parseSuite, renderSuite, runSuite } = await import("./test-run-BGsK-inZ.js");
2427
+ const { parseSuite, renderSuite, runSuite } = await import("./test-run-DCprBW44.js");
2428
2428
  const suite = parseSuite(parsed$1);
2429
2429
  if (!suite.ok) {
2430
2430
  console.error(`prae: ${suitePath} is not a valid test suite`);
@@ -2434,8 +2434,7 @@ async function test(suitePath, packOverride, asJson) {
2434
2434
  const chosen = packOverride ?? (suite.suite.pack === void 0 ? void 0 : resolve(dirname(suitePath), suite.suite.pack));
2435
2435
  if (chosen === void 0) return fail("test needs a pack: set `pack` in the suite or pass --pack");
2436
2436
  const pack = await loadPack(chosen);
2437
- const { capabilityForTool } = await import("capmark");
2438
- const { scan } = await import("./src-CwBEFhww.js");
2437
+ const { scan } = await import("./src-DIuEg7gi.js");
2439
2438
  const inspect = pack.rules.some((rule) => rule.when.secrets !== void 0) ? (path) => {
2440
2439
  try {
2441
2440
  return scan(readFileSync(path, "utf8"));
@@ -2444,7 +2443,7 @@ async function test(suitePath, packOverride, asJson) {
2444
2443
  }
2445
2444
  } : void 0;
2446
2445
  const result = runSuite(pack, suite.suite, {
2447
- capabilityFor: (tool) => capabilityForTool(tool)?.id,
2446
+ capabilityFor: capabilityOf,
2448
2447
  ...inspect === void 0 ? {} : { inspect }
2449
2448
  });
2450
2449
  if (asJson) console.log(JSON.stringify(result, null, 2));
@@ -2464,7 +2463,7 @@ async function verify$1(path, keyPath, checkpointPath) {
2464
2463
  const last = entries.at(-1);
2465
2464
  console.log(`${result.entries} entries · chain intact${last === void 0 ? "" : ` · seal ${seal(last)}`}`);
2466
2465
  if (checkpointPath !== void 0) {
2467
- const { checkCheckpoint } = await import("./checkpoint-BLOGdWFu.js");
2466
+ const { checkCheckpoint } = await import("./checkpoint-D7d6ZGXR.js");
2468
2467
  const publicKey = keyPath === void 0 ? void 0 : readFileSync(keyPath, "utf8");
2469
2468
  const verdict = checkCheckpoint(entries, JSON.parse(readFileSync(checkpointPath, "utf8")), publicKey);
2470
2469
  for (const line of verdict.lines) (verdict.ok ? console.log : console.error)(`checkpoint: ${line}`);
@@ -2549,7 +2548,7 @@ async function report(path, out, packPath) {
2549
2548
  * that step is a proposal a human approves, and it starts from this list.
2550
2549
  */
2551
2550
  async function instructions(from, asJson) {
2552
- const { ingest } = await import("./src-XukJfuml.js");
2551
+ const { ingest } = await import("./src-DxJIOaP5.js");
2553
2552
  const result = ingest(from);
2554
2553
  if (asJson) {
2555
2554
  console.log(JSON.stringify(result, null, 2));
@@ -2585,7 +2584,7 @@ async function instructions(from, asJson) {
2585
2584
  * on purpose rather than something that happened to their policy.
2586
2585
  */
2587
2586
  async function propose(from, options) {
2588
- const [{ ingest }, { extract }] = await Promise.all([import("./src-XukJfuml.js"), import("./src-BoBCmiwj.js")]);
2587
+ const [{ ingest }, { extract }] = await Promise.all([import("./src-DxJIOaP5.js"), import("./src-DV83J9G2.js")]);
2589
2588
  const read = ingest(from);
2590
2589
  if (read.files.length === 0) {
2591
2590
  console.log(`No instruction files found at or above ${from}.`);
@@ -2645,9 +2644,9 @@ async function consoleOut(path, argv) {
2645
2644
  const instructionsDir = flag(argv, "instructions");
2646
2645
  if (instructionsDir !== void 0) {
2647
2646
  const [{ ingest }, { extract }, { renderInstructions }] = await Promise.all([
2648
- import("./src-XukJfuml.js"),
2649
- import("./src-BoBCmiwj.js"),
2650
- import("./instructions-fCJ4j7ce.js")
2647
+ import("./src-DxJIOaP5.js"),
2648
+ import("./src-DV83J9G2.js"),
2649
+ import("./instructions-Bcs2n2O6.js")
2651
2650
  ]);
2652
2651
  const read = ingest(instructionsDir);
2653
2652
  instructionsView = renderInstructions(data, read, extract(read.statements));
@@ -2811,7 +2810,7 @@ async function chainMatrix(path, argv) {
2811
2810
  if (!chainOk || sigFailed) process.exitCode = 1;
2812
2811
  }
2813
2812
  async function checkpoint(path, keyPath, out) {
2814
- const { makeCheckpoint } = await import("./checkpoint-BLOGdWFu.js");
2813
+ const { makeCheckpoint } = await import("./checkpoint-D7d6ZGXR.js");
2815
2814
  let ledger;
2816
2815
  try {
2817
2816
  ledger = Ledger.open(path);
@@ -2832,7 +2831,7 @@ async function checkpoint(path, keyPath, out) {
2832
2831
  }
2833
2832
  }
2834
2833
  async function exportLedger(path, options) {
2835
- const { toOcsf, ndjson, sendToHec } = await import("./ocsf-BwWyM7hc.js");
2834
+ const { toOcsf, ndjson, sendToHec } = await import("./ocsf-DwExfPqP.js");
2836
2835
  const { createRequire: createRequire$1 } = await import("node:module");
2837
2836
  const { version } = createRequire$1(import.meta.url)("../package.json");
2838
2837
  let ledger;
@@ -2963,7 +2962,7 @@ async function main(argv) {
2963
2962
  }
2964
2963
  case "init":
2965
2964
  if (rest[0] === "claude-code") {
2966
- const { initClaudeCode, stableNode } = await import("./init-BPlBJvA-.js");
2965
+ const { initClaudeCode, stableNode } = await import("./init-DvzCuemh.js");
2967
2966
  try {
2968
2967
  return initClaudeCode(rest.slice(1), {
2969
2968
  cwd: process.cwd(),
@@ -2978,7 +2977,7 @@ async function main(argv) {
2978
2977
  return init(rest);
2979
2978
  case "hook": {
2980
2979
  if (rest[0] !== "claude-code") fail("hook takes claude-code");
2981
- const { runHook } = await import("./hook-DxLgNtc4.js");
2980
+ const { runHook } = await import("./hook-C7LGEIs2.js");
2982
2981
  return runHook(rest.slice(1));
2983
2982
  }
2984
2983
  case "--help":
@@ -0,0 +1,7 @@
1
+ import "./src-CZYvvEn5.js";
2
+ import "./src-CuiWC80o.js";
3
+ import { t as main } from "./cli-BTVEk0Fh.js";
4
+ import "./facts-DkTRO2p0.js";
5
+ import "./views-endiZu1Z.js";
6
+
7
+ export { main };
@@ -0,0 +1,89 @@
1
+ import { a as PATH_ARGS, s as relativeTo } from "./src-CZYvvEn5.js";
2
+ import { capabilityForTool } from "capmark";
3
+
4
+ //#region ../dsh/src/facts.ts
5
+ function resolveArgs(args, resolvePath, cwd) {
6
+ if (resolvePath === void 0 && cwd === void 0) return args;
7
+ const out = { ...args };
8
+ for (const key of PATH_ARGS) {
9
+ const value = out[key];
10
+ if (typeof value !== "string") continue;
11
+ let path = value;
12
+ if (resolvePath !== void 0) try {
13
+ path = resolvePath(path);
14
+ } catch {}
15
+ out[key] = cwd === void 0 ? path : relativeTo(path, cwd);
16
+ }
17
+ return out;
18
+ }
19
+ /**
20
+ * Claude Code names its built-in tools in PascalCase (`Read`, `Bash`, …),
21
+ * which capmark's catalogue does not list. Each takes the capability of its
22
+ * lowercase counterpart; without this a Claude Code call carries no
23
+ * capability, and the rules scoped by one (paths, egress, the shell) never
24
+ * see it. An MCP tool, `mcp__<server>__<tool>`, takes its tool's.
25
+ */
26
+ const CLAUDE_CODE = {
27
+ Read: "read",
28
+ Write: "write",
29
+ Edit: "edit",
30
+ MultiEdit: "edit",
31
+ NotebookEdit: "edit",
32
+ Bash: "bash",
33
+ PowerShell: "bash",
34
+ Grep: "grep",
35
+ Glob: "glob",
36
+ LS: "glob",
37
+ WebFetch: "web_fetch",
38
+ WebSearch: "web_search"
39
+ };
40
+ /**
41
+ * MCP tools whose names capmark's catalogue does not list, from the
42
+ * reference servers an agent most often mounts (modelcontextprotocol
43
+ * `filesystem` and `fetch`) and `prae mcp`'s own. Applied only after an
44
+ * `mcp__<server>__` prefix: without it, a Claude Code session reading
45
+ * `.env` through `mcp__filesystem__read_file` carries no capability, and
46
+ * no `fs:read` rule sees it.
47
+ */
48
+ const MCP_TOOLS = {
49
+ read_file: "read",
50
+ read_text_file: "read",
51
+ read_media_file: "read",
52
+ list_directory: "glob",
53
+ list_dir: "glob",
54
+ directory_tree: "glob",
55
+ search_files: "glob",
56
+ get_file_info: "glob",
57
+ write_file: "write",
58
+ edit_file: "edit",
59
+ create_directory: "write",
60
+ fetch: "web_fetch"
61
+ };
62
+ function capabilityOf(tool) {
63
+ const direct = capabilityForTool(tool)?.id;
64
+ if (direct !== void 0) return direct;
65
+ const alias = CLAUDE_CODE[tool];
66
+ if (alias !== void 0) return capabilityForTool(alias)?.id;
67
+ const mcp = tool.startsWith("mcp__") ? tool.lastIndexOf("__") : -1;
68
+ if (mcp <= 5) return void 0;
69
+ const name = tool.slice(mcp + 2);
70
+ return capabilityOf(MCP_TOOLS[name] ?? name);
71
+ }
72
+ function factsFor(exec, options = {}) {
73
+ const args = exec.arguments ?? {};
74
+ const capability = capabilityOf(exec.name);
75
+ const plugin = options.owners?.get(exec.name);
76
+ const id = exec.agent?.id;
77
+ const agent = typeof id === "string" ? id : void 0;
78
+ return {
79
+ tool: exec.name,
80
+ ...capability === void 0 ? {} : { capability },
81
+ ...plugin === void 0 ? {} : { plugin },
82
+ ...agent === void 0 ? {} : { agent },
83
+ args: resolveArgs(args, options.resolvePath, options.cwd),
84
+ ...options.counts === void 0 ? {} : { counts: options.counts }
85
+ };
86
+ }
87
+
88
+ //#endregion
89
+ export { factsFor as n, capabilityOf as t };
@@ -1,96 +1,11 @@
1
1
  import { a as PATH_ARGS, i as evaluate, l as segments, s as relativeTo, t as parsePack } from "./src-CZYvvEn5.js";
2
2
  import { n as Ledger } from "./src-CuiWC80o.js";
3
- import { a as scan, n as MAX_SCAN_BYTES } from "./src-B25SHWcz.js";
3
+ import { n as factsFor, t as capabilityOf } from "./facts-DkTRO2p0.js";
4
+ import { a as scan, n as MAX_SCAN_BYTES } from "./src-9phPLfAL.js";
4
5
  import { lstatSync, readFileSync, readlinkSync, realpathSync, statSync } from "node:fs";
5
6
  import { basename, dirname, isAbsolute, join, relative, resolve } from "node:path";
6
7
  import { createHash } from "node:crypto";
7
- import { capabilityForTool } from "capmark";
8
8
 
9
- //#region ../dsh/src/facts.ts
10
- function resolveArgs(args, resolvePath, cwd) {
11
- if (resolvePath === void 0 && cwd === void 0) return args;
12
- const out = { ...args };
13
- for (const key of PATH_ARGS) {
14
- const value = out[key];
15
- if (typeof value !== "string") continue;
16
- let path = value;
17
- if (resolvePath !== void 0) try {
18
- path = resolvePath(path);
19
- } catch {}
20
- out[key] = cwd === void 0 ? path : relativeTo(path, cwd);
21
- }
22
- return out;
23
- }
24
- /**
25
- * Claude Code names its built-in tools in PascalCase (`Read`, `Bash`, …),
26
- * which capmark's catalogue does not list. Each takes the capability of its
27
- * lowercase counterpart; without this a Claude Code call carries no
28
- * capability, and the rules scoped by one (paths, egress, the shell) never
29
- * see it. An MCP tool, `mcp__<server>__<tool>`, takes its tool's.
30
- */
31
- const CLAUDE_CODE = {
32
- Read: "read",
33
- Write: "write",
34
- Edit: "edit",
35
- MultiEdit: "edit",
36
- NotebookEdit: "edit",
37
- Bash: "bash",
38
- PowerShell: "bash",
39
- Grep: "grep",
40
- Glob: "glob",
41
- LS: "glob",
42
- WebFetch: "web_fetch",
43
- WebSearch: "web_search"
44
- };
45
- /**
46
- * MCP tools whose names capmark's catalogue does not list, from the
47
- * reference servers an agent most often mounts (modelcontextprotocol
48
- * `filesystem` and `fetch`) and `prae mcp`'s own. Applied only after an
49
- * `mcp__<server>__` prefix: without it, a Claude Code session reading
50
- * `.env` through `mcp__filesystem__read_file` carries no capability, and
51
- * no `fs:read` rule sees it.
52
- */
53
- const MCP_TOOLS = {
54
- read_file: "read",
55
- read_text_file: "read",
56
- read_media_file: "read",
57
- list_directory: "glob",
58
- list_dir: "glob",
59
- directory_tree: "glob",
60
- search_files: "glob",
61
- get_file_info: "glob",
62
- write_file: "write",
63
- edit_file: "edit",
64
- create_directory: "write",
65
- fetch: "web_fetch"
66
- };
67
- function capabilityOf(tool) {
68
- const direct = capabilityForTool(tool)?.id;
69
- if (direct !== void 0) return direct;
70
- const alias = CLAUDE_CODE[tool];
71
- if (alias !== void 0) return capabilityForTool(alias)?.id;
72
- const mcp = tool.startsWith("mcp__") ? tool.lastIndexOf("__") : -1;
73
- if (mcp <= 5) return void 0;
74
- const name = tool.slice(mcp + 2);
75
- return capabilityOf(MCP_TOOLS[name] ?? name);
76
- }
77
- function factsFor(exec, options = {}) {
78
- const args = exec.arguments ?? {};
79
- const capability = capabilityOf(exec.name);
80
- const plugin = options.owners?.get(exec.name);
81
- const id = exec.agent?.id;
82
- const agent = typeof id === "string" ? id : void 0;
83
- return {
84
- tool: exec.name,
85
- ...capability === void 0 ? {} : { capability },
86
- ...plugin === void 0 ? {} : { plugin },
87
- ...agent === void 0 ? {} : { agent },
88
- args: resolveArgs(args, options.resolvePath, options.cwd),
89
- ...options.counts === void 0 ? {} : { counts: options.counts }
90
- };
91
- }
92
-
93
- //#endregion
94
9
  //#region ../dsh/src/judge.ts
95
10
  /**
96
11
  * Judge one call against a pack, without a harness anywhere near it.
package/lib/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import "./src-CZYvvEn5.js";
2
2
  import "./src-CuiWC80o.js";
3
- import { a as planWrite, i as dshHome, n as applyWrite, o as praeRow, r as defaultProfile, s as profileAt, t as main } from "./cli-C_6dosaw.js";
4
- import "./views-C7DD-Oif.js";
3
+ import { a as planWrite, i as dshHome, n as applyWrite, o as praeRow, r as defaultProfile, s as profileAt, t as main } from "./cli-BTVEk0Fh.js";
4
+ import "./facts-DkTRO2p0.js";
5
+ import "./views-endiZu1Z.js";
5
6
 
6
7
  export { applyWrite, defaultProfile, dshHome, main, planWrite, praeRow, profileAt };
@@ -1,5 +1,5 @@
1
1
  import "./src-CZYvvEn5.js";
2
- import { c as renderNav, l as renderShell, s as esc, t as navFor } from "./views-C7DD-Oif.js";
2
+ import { c as renderNav, l as renderShell, s as esc, t as navFor } from "./views-endiZu1Z.js";
3
3
 
4
4
  //#region src/console/instructions.ts
5
5
  const STYLE = `
@@ -1,5 +1,5 @@
1
1
  import { i as evaluate } from "./src-CZYvvEn5.js";
2
- import { a as scan, n as MAX_SCAN_BYTES } from "./src-B25SHWcz.js";
2
+ import { a as scan, n as MAX_SCAN_BYTES } from "./src-9phPLfAL.js";
3
3
  import { readFile, readdir, stat } from "node:fs/promises";
4
4
  import { resolve, sep } from "node:path";
5
5
  import { Server } from "@modelcontextprotocol/sdk/server/index.js";
@@ -1,3 +1,3 @@
1
- import { a as scan, i as looksBinary, n as MAX_SCAN_BYTES, r as entropy, t as DETECTORS } from "./src-B25SHWcz.js";
1
+ import { a as scan, i as looksBinary, n as MAX_SCAN_BYTES, r as entropy, t as DETECTORS } from "./src-9phPLfAL.js";
2
2
 
3
3
  export { DETECTORS, MAX_SCAN_BYTES, entropy, looksBinary, scan };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prae-cli",
3
- "version": "0.10.1",
3
+ "version": "0.10.2",
4
4
  "description": "Operator policy for agent harnesses: validate packs, explain a decision, test a pack against security invariants, verify a decision log, and provision a governed DSH profile.",
5
5
  "keywords": [
6
6
  "dsh-plugin",
@@ -42,12 +42,12 @@
42
42
  "typescript": "^5.9.2",
43
43
  "vitest": "^3.2.4",
44
44
  "@prae/controls": "0.1.0",
45
- "@prae/extract": "0.1.0",
45
+ "@prae/instructions": "0.1.0",
46
+ "@prae/inspect": "0.1.0",
46
47
  "@prae/kernel": "0.1.0",
47
- "@prae/ledger": "0.1.0",
48
48
  "@prae/tokens": "0.1.0",
49
- "@prae/instructions": "0.1.0",
50
- "@prae/inspect": "0.1.0"
49
+ "@prae/extract": "0.1.0",
50
+ "@prae/ledger": "0.1.0"
51
51
  },
52
52
  "scripts": {
53
53
  "test": "vitest run",
@@ -1,6 +0,0 @@
1
- import "./src-CZYvvEn5.js";
2
- import "./src-CuiWC80o.js";
3
- import { t as main } from "./cli-C_6dosaw.js";
4
- import "./views-C7DD-Oif.js";
5
-
6
- export { main };
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes