prae-cli 0.1.0
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/LICENSE +21 -0
- package/README.md +101 -0
- package/lib/bin.d.ts +1 -0
- package/lib/bin.js +11 -0
- package/lib/cli-DGVWMDT0.js +2405 -0
- package/lib/index.d.ts +61 -0
- package/lib/index.js +3 -0
- package/lib/playground.js +685 -0
- package/package.json +52 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Praesidium contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# prae-cli
|
|
2
|
+
|
|
3
|
+
Command line for [`dsh-prae`](https://www.npmjs.com/package/dsh-prae):
|
|
4
|
+
validate an operator policy pack, ask it why a call would be refused, verify a
|
|
5
|
+
decision log, and provision a governed profile.
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npx prae explain ./acme-baseline.prae.json write path=/etc/hosts
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
DENIED write (fs:write)
|
|
13
|
+
PRAE-001 · writes outside ./src, ./tests, and ./docs are not granted in this pack
|
|
14
|
+
|
|
15
|
+
PRAE-001 deny writes outside ./src, ./tests, and ./docs are not granted in this pack
|
|
16
|
+
|
|
17
|
+
acme-baseline 1.0.0 · 6 rules considered
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Commands
|
|
21
|
+
|
|
22
|
+
### `prae check <pack.json>`
|
|
23
|
+
|
|
24
|
+
Validate a pack and summarise what it enforces. Unknown fields are errors, so a
|
|
25
|
+
mistyped matcher fails here rather than loading clean and enforcing nothing.
|
|
26
|
+
|
|
27
|
+
### `prae explain <pack.json> <tool> [key=value ...]`
|
|
28
|
+
|
|
29
|
+
Judge one call and print the trace. Nothing is executed and no harness is
|
|
30
|
+
involved — "why was this denied" is the first question anyone asks of a policy
|
|
31
|
+
engine, and answering it should not require running an agent.
|
|
32
|
+
|
|
33
|
+
It also says when no capability claims the named tool, so a reader cannot infer
|
|
34
|
+
coverage that is not there.
|
|
35
|
+
|
|
36
|
+
### `prae verify <ledger.jsonl>`
|
|
37
|
+
|
|
38
|
+
Re-derive every hash in a decision log and report any break. Prints the limit
|
|
39
|
+
next to the result rather than in a footnote: a removed, edited, or reordered
|
|
40
|
+
row breaks the chain; a rewrite of the whole file by someone holding this code
|
|
41
|
+
does not.
|
|
42
|
+
|
|
43
|
+
### `prae console <ledger.jsonl> --out <dir> [--pack <file>]`
|
|
44
|
+
|
|
45
|
+
Write the control plane as linked pages: Overview, Policy packs, Playground,
|
|
46
|
+
Audit ledger, Compliance map. The Playground is written only when `--pack` is
|
|
47
|
+
given, since an empty one teaches nothing.
|
|
48
|
+
|
|
49
|
+
The Playground inlines the **real kernel** and runs it in the page, so a rule
|
|
50
|
+
that denies there denies in a live profile. A playground running an
|
|
51
|
+
approximation would be worse than none — it would teach a policy language that
|
|
52
|
+
does not exist, and the difference would surface at the worst moment.
|
|
53
|
+
|
|
54
|
+
Static files rather than a server. The views are a read of local evidence, and
|
|
55
|
+
a governance tool that opens a port to show you its own audit trail has added
|
|
56
|
+
an attack surface to solve a rendering problem.
|
|
57
|
+
|
|
58
|
+
The Fleet view the rail names is shown dim and marked `SOON`. It needs a
|
|
59
|
+
control plane that does not exist yet, and a working-looking Fleet page over
|
|
60
|
+
one machine would be a lie told in the most expensive place to tell one.
|
|
61
|
+
|
|
62
|
+
The Compliance map states what each control asks for against what the profile
|
|
63
|
+
actually produces — evidence toward a control, never compliance with it.
|
|
64
|
+
Whether that evidence satisfies the obligation is an auditor's judgement.
|
|
65
|
+
|
|
66
|
+
### `prae init [options]`
|
|
67
|
+
|
|
68
|
+
Compose the overlay row that mounts the plugin with a pack.
|
|
69
|
+
|
|
70
|
+
| Flag | Meaning |
|
|
71
|
+
| --- | --- |
|
|
72
|
+
| `--pack <file>` | The policy pack to embed. Required. |
|
|
73
|
+
| `--profile <dir>` | Profile directory. Defaults to `$DSH_HOME/profiles/web`. |
|
|
74
|
+
| `--ledger <file>` | Where decisions are appended. |
|
|
75
|
+
| `--approver <name>` | Account this profile runs as, recorded against approvals. |
|
|
76
|
+
| `--apply` | Actually write. Without it, the composed overlay is printed and nothing changes. |
|
|
77
|
+
|
|
78
|
+
**It defaults to not writing**, because the file it edits decides whether the
|
|
79
|
+
harness boots at all. A row naming a package the profile cannot resolve is not a
|
|
80
|
+
disabled feature — Cordis fails module resolution during boot, the harness does
|
|
81
|
+
not start, and every tool you would debug it with is gone. So `init` refuses
|
|
82
|
+
outright when `dsh-prae` is not installed in the profile, snapshots the
|
|
83
|
+
file before writing, and checks the overlay has not changed since you reviewed
|
|
84
|
+
the diff.
|
|
85
|
+
|
|
86
|
+
None of that safety is reimplemented here: it comes from
|
|
87
|
+
[`dsh-overlay-check`](https://www.npmjs.com/package/dsh-overlay-check), which was
|
|
88
|
+
hardened against a real gate review — including a symlink escape that lexical
|
|
89
|
+
containment let through.
|
|
90
|
+
|
|
91
|
+
The pack is embedded in the row rather than referenced by path. A row pointing
|
|
92
|
+
at a file that later moves is a policy nobody can reconstruct from the profile
|
|
93
|
+
alone, and reconstructing what was in force is the entire point.
|
|
94
|
+
|
|
95
|
+
## Status
|
|
96
|
+
|
|
97
|
+
Pre-release. Do not pin a production system to it.
|
|
98
|
+
|
|
99
|
+
## Licence
|
|
100
|
+
|
|
101
|
+
MIT.
|
package/lib/bin.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
package/lib/bin.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { t as main } from "./cli-DGVWMDT0.js";
|
|
3
|
+
|
|
4
|
+
//#region src/bin.ts
|
|
5
|
+
main(process.argv.slice(2)).catch((error) => {
|
|
6
|
+
console.error(`prae: ${error instanceof Error ? error.message : error}`);
|
|
7
|
+
process.exit(1);
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
//#endregion
|
|
11
|
+
export { };
|