prae-cli 0.5.0 → 0.5.1
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,4 +1,4 @@
|
|
|
1
|
-
import { t as evaluate } from "./evaluate-
|
|
1
|
+
import { t as evaluate } from "./evaluate-DMyL3qM_.js";
|
|
2
2
|
import { m as seal, t as Ledger } from "./src-CXU0_W1P.js";
|
|
3
3
|
import { a as renderPacks, c as renderShell, i as renderOverview, l as VERDICT_LABEL$1, n as renderApprovals, o as esc, r as renderCompliance, s as renderNav, t as navFor } from "./views-DalPkBZZ.js";
|
|
4
4
|
import { existsSync, readFileSync } from "node:fs";
|
|
@@ -970,7 +970,7 @@ async function scanFile(path, packPath, json) {
|
|
|
970
970
|
* not come up inspecting nothing.
|
|
971
971
|
*/
|
|
972
972
|
async function mcp(root, packPath, ledgerPath) {
|
|
973
|
-
const { serveMcp } = await import("./mcp-
|
|
973
|
+
const { serveMcp } = await import("./mcp-CEN48TpN.js");
|
|
974
974
|
const { resolve: resolve$1 } = await import("node:path");
|
|
975
975
|
const bundled = [join(import.meta.dirname, "secret-catcher.prae.json"), join(import.meta.dirname, "..", "..", "..", "examples", "secret-catcher.prae.json")].find((candidate) => existsSync(candidate));
|
|
976
976
|
const chosen = packPath ?? bundled;
|
|
@@ -266,6 +266,42 @@ function hostIn(host, list$1) {
|
|
|
266
266
|
return host === want;
|
|
267
267
|
});
|
|
268
268
|
}
|
|
269
|
+
/**
|
|
270
|
+
* Argument names that conventionally carry a filesystem path, in the order
|
|
271
|
+
* they are tried when a path rule names none.
|
|
272
|
+
*
|
|
273
|
+
* A path rule used to default to the single argument spelled `path`. DeepSeek
|
|
274
|
+
* Harness's own `read`, `write` and `edit` tools pass `file_path`, so every
|
|
275
|
+
* shipped path rule without an explicit `arg` — including the baseline's
|
|
276
|
+
* "deny read ./.env" — matched nothing on the very harness it was written
|
|
277
|
+
* for, while the ledger dutifully recorded every allowed read. A rule that
|
|
278
|
+
* silently never fires is the worst way for policy to be wrong; defaulting
|
|
279
|
+
* to the conventional set is the same call the dsh adapter already made for
|
|
280
|
+
* path resolution, now made once, here, for matching too.
|
|
281
|
+
*/
|
|
282
|
+
const PATH_ARGS = [
|
|
283
|
+
"path",
|
|
284
|
+
"file_path",
|
|
285
|
+
"filePath",
|
|
286
|
+
"target",
|
|
287
|
+
"directory",
|
|
288
|
+
"cwd",
|
|
289
|
+
"file",
|
|
290
|
+
"dest",
|
|
291
|
+
"destination",
|
|
292
|
+
"source"
|
|
293
|
+
];
|
|
294
|
+
/** The first conventional path argument present, as a string, or undefined. */
|
|
295
|
+
function pathArgOf(args, explicit) {
|
|
296
|
+
if (explicit !== void 0) {
|
|
297
|
+
const v = args[explicit];
|
|
298
|
+
return typeof v === "string" ? v : void 0;
|
|
299
|
+
}
|
|
300
|
+
for (const key of PATH_ARGS) {
|
|
301
|
+
const v = args[key];
|
|
302
|
+
if (typeof v === "string") return v;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
269
305
|
|
|
270
306
|
//#endregion
|
|
271
307
|
//#region ../kernel/src/rule.ts
|
|
@@ -319,7 +355,7 @@ function matches(when, facts) {
|
|
|
319
355
|
if (!commandMatches(when.command, raw)) return false;
|
|
320
356
|
}
|
|
321
357
|
if (when.path !== void 0) {
|
|
322
|
-
const raw = facts.args
|
|
358
|
+
const raw = pathArgOf(facts.args, when.path.arg);
|
|
323
359
|
if (typeof raw !== "string") return false;
|
|
324
360
|
if (when.path.inside !== void 0 && !withinAny(raw, when.path.inside)) return false;
|
|
325
361
|
if (when.path.outside !== void 0 && withinAny(raw, when.path.outside)) return false;
|
package/lib/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./evaluate-
|
|
2
|
-
import { a as planWrite, i as dshHome, n as applyWrite, o as praeRow, r as defaultProfile, s as profileAt, t as main } from "./cli-
|
|
1
|
+
import "./evaluate-DMyL3qM_.js";
|
|
2
|
+
import { a as planWrite, i as dshHome, n as applyWrite, o as praeRow, r as defaultProfile, s as profileAt, t as main } from "./cli-DfXHsQO7.js";
|
|
3
3
|
import "./src-CXU0_W1P.js";
|
|
4
4
|
import "./views-DalPkBZZ.js";
|
|
5
5
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as evaluate } from "./evaluate-
|
|
1
|
+
import { t as evaluate } from "./evaluate-DMyL3qM_.js";
|
|
2
2
|
import { a as scan, n as MAX_SCAN_BYTES } from "./src-Br1tGPtS.js";
|
|
3
3
|
import { readFile, readdir, stat } from "node:fs/promises";
|
|
4
4
|
import { resolve, sep } from "node:path";
|
package/lib/playground.js
CHANGED
|
@@ -269,6 +269,42 @@
|
|
|
269
269
|
return host === want;
|
|
270
270
|
});
|
|
271
271
|
}
|
|
272
|
+
/**
|
|
273
|
+
* Argument names that conventionally carry a filesystem path, in the order
|
|
274
|
+
* they are tried when a path rule names none.
|
|
275
|
+
*
|
|
276
|
+
* A path rule used to default to the single argument spelled `path`. DeepSeek
|
|
277
|
+
* Harness's own `read`, `write` and `edit` tools pass `file_path`, so every
|
|
278
|
+
* shipped path rule without an explicit `arg` — including the baseline's
|
|
279
|
+
* "deny read ./.env" — matched nothing on the very harness it was written
|
|
280
|
+
* for, while the ledger dutifully recorded every allowed read. A rule that
|
|
281
|
+
* silently never fires is the worst way for policy to be wrong; defaulting
|
|
282
|
+
* to the conventional set is the same call the dsh adapter already made for
|
|
283
|
+
* path resolution, now made once, here, for matching too.
|
|
284
|
+
*/
|
|
285
|
+
const PATH_ARGS = [
|
|
286
|
+
"path",
|
|
287
|
+
"file_path",
|
|
288
|
+
"filePath",
|
|
289
|
+
"target",
|
|
290
|
+
"directory",
|
|
291
|
+
"cwd",
|
|
292
|
+
"file",
|
|
293
|
+
"dest",
|
|
294
|
+
"destination",
|
|
295
|
+
"source"
|
|
296
|
+
];
|
|
297
|
+
/** The first conventional path argument present, as a string, or undefined. */
|
|
298
|
+
function pathArgOf(args, explicit) {
|
|
299
|
+
if (explicit !== void 0) {
|
|
300
|
+
const v = args[explicit];
|
|
301
|
+
return typeof v === "string" ? v : void 0;
|
|
302
|
+
}
|
|
303
|
+
for (const key of PATH_ARGS) {
|
|
304
|
+
const v = args[key];
|
|
305
|
+
if (typeof v === "string") return v;
|
|
306
|
+
}
|
|
307
|
+
}
|
|
272
308
|
|
|
273
309
|
//#endregion
|
|
274
310
|
//#region ../kernel/src/rule.ts
|
|
@@ -322,7 +358,7 @@
|
|
|
322
358
|
if (!commandMatches(when.command, raw)) return false;
|
|
323
359
|
}
|
|
324
360
|
if (when.path !== void 0) {
|
|
325
|
-
const raw = facts.args
|
|
361
|
+
const raw = pathArgOf(facts.args, when.path.arg);
|
|
326
362
|
if (typeof raw !== "string") return false;
|
|
327
363
|
if (when.path.inside !== void 0 && !withinAny(raw, when.path.inside)) return false;
|
|
328
364
|
if (when.path.outside !== void 0 && withinAny(raw, when.path.outside)) return false;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "prae-cli",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "Operator policy for agent harnesses: validate packs, explain a decision, verify a decision log, and provision a governed DSH profile.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dsh-plugin",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"tsdown": "^0.15.6",
|
|
41
41
|
"typescript": "^5.9.2",
|
|
42
42
|
"vitest": "^3.2.4",
|
|
43
|
-
"@prae/controls": "0.1.0",
|
|
44
43
|
"@prae/extract": "0.1.0",
|
|
44
|
+
"@prae/controls": "0.1.0",
|
|
45
45
|
"@prae/inspect": "0.1.0",
|
|
46
46
|
"@prae/instructions": "0.1.0",
|
|
47
47
|
"@prae/kernel": "0.1.0",
|