@crediolabs/policy-builder-cli 0.1.0 → 0.1.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.
Files changed (2) hide show
  1. package/README.md +74 -0
  2. package/package.json +4 -3
package/README.md ADDED
@@ -0,0 +1,74 @@
1
+ # @crediolabs/policy-builder-cli
2
+
3
+ CLI for the OpenZeppelin Accounts Policy Builder. It records a Soroban
4
+ transaction and synthesises the minimal policy that permits exactly that flow —
5
+ the same core as the MCP server, for solo-dev and CI workflows. MIT-licensed.
6
+
7
+ ## Install
8
+
9
+ ```sh
10
+ npm install -g @crediolabs/policy-builder-cli
11
+ # or run without installing:
12
+ npx @crediolabs/policy-builder-cli --help
13
+ ```
14
+
15
+ ## Commands
16
+
17
+ ```
18
+ policy-builder record --network <mainnet|testnet> --hash <tx> | --xdr <b64>
19
+ [--json] [--quiet] [--out <path>]
20
+
21
+ policy-builder synthesize --mandate <path.json>
22
+ [--json] [--quiet] [--out <path>]
23
+
24
+ policy-builder synthesize --recorded-tx <path.json> --network <mainnet|testnet>
25
+ [--responses <path.json>]
26
+ [--json] [--quiet] [--out <path>]
27
+ ```
28
+
29
+ Global flags:
30
+
31
+ - `--json` — emit a machine-readable JSON envelope (`{ ok, data }` / `{ ok, error }`) on stdout.
32
+ - `--quiet` — suppress progress / non-error output.
33
+ - `--out <path>` — write the artefact to a file (JSON).
34
+
35
+ A `ToolError` exits non-zero (`1`), so CI scripts can gate on `$?`.
36
+
37
+ ## Examples
38
+
39
+ Record an on-chain transaction and synthesise from the recording:
40
+
41
+ ```sh
42
+ policy-builder record --network mainnet --hash <tx-hash> --out recorded-tx.json
43
+ policy-builder synthesize --recorded-tx recorded-tx.json --network mainnet --json
44
+ ```
45
+
46
+ Synthesise deterministically from a mandate (`mandate.json`):
47
+
48
+ ```json
49
+ {
50
+ "chain": "stellar",
51
+ "contract": "CTOKEN",
52
+ "method": "transfer",
53
+ "spendingLimit": { "token": "CTOKEN", "limit": "5000000", "windowSeconds": 2592000 }
54
+ }
55
+ ```
56
+
57
+ ```sh
58
+ policy-builder synthesize --mandate mandate.json --json
59
+ ```
60
+
61
+ > Recording an XDR envelope (`--xdr`) instead of an on-chain `--hash` has no raw
62
+ > events to cross-check, so the recorder fails closed at the default confidence
63
+ > threshold. See [`@crediolabs/policy-synth`](https://www.npmjs.com/package/@crediolabs/policy-synth)
64
+ > for the confidence-override details.
65
+
66
+ ## Status
67
+
68
+ The `record` and `synthesize` commands (both the mandate and recording
69
+ front-ends) are implemented and test-covered. Install, on-chain verify, and
70
+ simulate are later phases.
71
+
72
+ ## License
73
+
74
+ MIT.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crediolabs/policy-builder-cli",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "license": "MIT",
5
5
  "description": "CLI wrapper around the OZ policy-synth core (record + synthesize) for solo-dev and CI workflows.",
6
6
  "type": "module",
@@ -12,10 +12,11 @@
12
12
  "bun": "./src/index.ts",
13
13
  "import": "./dist/src/index.js",
14
14
  "default": "./dist/src/index.js"
15
- }
15
+ },
16
+ "./package.json": "./package.json"
16
17
  },
17
18
  "bin": {
18
- "policy-builder": "./dist/bin/policy-builder.js"
19
+ "policy-builder": "dist/bin/policy-builder.js"
19
20
  },
20
21
  "files": [
21
22
  "dist",