@crediolabs/policy-builder-cli 0.1.4 → 0.1.6
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.
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
// [--json] [--quiet] [--out <path>]
|
|
9
9
|
// policy-builder synthesize --recorded-tx <path.json> --network <mainnet|testnet>
|
|
10
10
|
// [--responses <path.json>]
|
|
11
|
+
// [--smart-account <C...>] [--install-nonce <n>]
|
|
11
12
|
// [--json] [--quiet] [--out <path>]
|
|
12
13
|
//
|
|
13
14
|
// The router is hand-rolled (no commander / yargs dep). It splits argv into
|
|
@@ -61,12 +62,18 @@ Usage:
|
|
|
61
62
|
[--json] [--quiet] [--out <path>]
|
|
62
63
|
policy-builder synthesize --recorded-tx <path.json> --network <mainnet|testnet>
|
|
63
64
|
[--responses <path.json>]
|
|
65
|
+
[--smart-account <C...>] [--install-nonce <n>]
|
|
64
66
|
[--json] [--quiet] [--out <path>]
|
|
65
67
|
|
|
66
68
|
Flags:
|
|
67
|
-
--json
|
|
68
|
-
--quiet
|
|
69
|
-
--out
|
|
69
|
+
--json emit machine-readable JSON on stdout
|
|
70
|
+
--quiet suppress progress / non-error output
|
|
71
|
+
--out write artefact to file (JSON)
|
|
72
|
+
--smart-account C... account to opt into the interpreter adapter, so
|
|
73
|
+
non-OZ constraints (per-method scoping, invocation-count
|
|
74
|
+
windows, oracle bounds, exact hop paths) lower to a real
|
|
75
|
+
predicate document instead of warnings
|
|
76
|
+
--install-nonce per-rule install nonce for the interpreter policy (default 1)
|
|
70
77
|
`);
|
|
71
78
|
}
|
|
72
79
|
await main();
|
|
@@ -31,9 +31,7 @@ export async function runSynthesizeCommand(argv, flags) {
|
|
|
31
31
|
// Accept either a bare RecordedTransaction or the `{ ok, data }` artifact that
|
|
32
32
|
// `record --out` writes (same shape as `--json`), so `record --out X` followed
|
|
33
33
|
// by `synthesize --recorded-tx X` works end to end.
|
|
34
|
-
const recordedTx = recordedFile?.ok === true &&
|
|
35
|
-
typeof recordedFile.data === 'object' &&
|
|
36
|
-
recordedFile.data !== null
|
|
34
|
+
const recordedTx = recordedFile?.ok === true && typeof recordedFile.data === 'object' && recordedFile.data !== null
|
|
37
35
|
? recordedFile.data
|
|
38
36
|
: recordedFile;
|
|
39
37
|
const network = pairs.network;
|
|
@@ -49,6 +47,17 @@ export async function runSynthesizeCommand(argv, flags) {
|
|
|
49
47
|
if (pairs.responses) {
|
|
50
48
|
args.userResponses = readJsonFile(pairs.responses);
|
|
51
49
|
}
|
|
50
|
+
// --smart-account <C...> opts into the interpreter adapter, so constraints OZ
|
|
51
|
+
// cannot express (per-method scoping, invocation-count windows, oracle bounds,
|
|
52
|
+
// exact hop paths) lower to a real predicate document instead of just warnings.
|
|
53
|
+
// The core validates the address and installNonce; a bad value surfaces there.
|
|
54
|
+
if (pairs['smart-account']) {
|
|
55
|
+
const interpreter = { smartAccountAddress: pairs['smart-account'] };
|
|
56
|
+
if (pairs['install-nonce']) {
|
|
57
|
+
interpreter.installNonce = Number(pairs['install-nonce']);
|
|
58
|
+
}
|
|
59
|
+
args.interpreter = interpreter;
|
|
60
|
+
}
|
|
52
61
|
const res = await runSynthesizePolicy(args);
|
|
53
62
|
return formatToolResponse(res, flags, 'synthesize(recording)');
|
|
54
63
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crediolabs/policy-builder-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
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",
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"build": "tsc -p tsconfig.build.json"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@crediolabs/policy-builder-mcp": "^0.1.
|
|
35
|
-
"@crediolabs/policy-synth": "^0.1.
|
|
34
|
+
"@crediolabs/policy-builder-mcp": "^0.1.6",
|
|
35
|
+
"@crediolabs/policy-synth": "^0.1.4",
|
|
36
36
|
"zod": "3.25.76"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
@@ -40,9 +40,7 @@ export async function runSynthesizeCommand(
|
|
|
40
40
|
// `record --out` writes (same shape as `--json`), so `record --out X` followed
|
|
41
41
|
// by `synthesize --recorded-tx X` works end to end.
|
|
42
42
|
const recordedTx =
|
|
43
|
-
recordedFile?.ok === true &&
|
|
44
|
-
typeof recordedFile.data === 'object' &&
|
|
45
|
-
recordedFile.data !== null
|
|
43
|
+
recordedFile?.ok === true && typeof recordedFile.data === 'object' && recordedFile.data !== null
|
|
46
44
|
? (recordedFile.data as Record<string, unknown>)
|
|
47
45
|
: recordedFile
|
|
48
46
|
const network = pairs.network
|
|
@@ -58,6 +56,17 @@ export async function runSynthesizeCommand(
|
|
|
58
56
|
if (pairs.responses) {
|
|
59
57
|
args.userResponses = readJsonFile(pairs.responses)
|
|
60
58
|
}
|
|
59
|
+
// --smart-account <C...> opts into the interpreter adapter, so constraints OZ
|
|
60
|
+
// cannot express (per-method scoping, invocation-count windows, oracle bounds,
|
|
61
|
+
// exact hop paths) lower to a real predicate document instead of just warnings.
|
|
62
|
+
// The core validates the address and installNonce; a bad value surfaces there.
|
|
63
|
+
if (pairs['smart-account']) {
|
|
64
|
+
const interpreter: Record<string, unknown> = { smartAccountAddress: pairs['smart-account'] }
|
|
65
|
+
if (pairs['install-nonce']) {
|
|
66
|
+
interpreter.installNonce = Number(pairs['install-nonce'])
|
|
67
|
+
}
|
|
68
|
+
args.interpreter = interpreter
|
|
69
|
+
}
|
|
61
70
|
const res = await runSynthesizePolicy(args)
|
|
62
71
|
return formatToolResponse(res, flags, 'synthesize(recording)')
|
|
63
72
|
}
|