@crediolabs/policy-builder-cli

中文文档
5.2.0发布于 2026/10/26MITTypeScriptESM + CJS近 30 天下载 2030

Command line for the OZ Policy Builder: policy-builder <tool> runs any of the eight policy-synth tools and prints its JSON envelope.

原始使用文档

@crediolabs/policy-builder-cli

Command line for the OZ Policy Builder. Every tool of @crediolabs/policy-synth is a command, registered from its table.

npm install -g @crediolabs/[email protected]
policy-builder <tool> [json | --file path | - | --field value ...] [--out path]
policy-builder record --network testnet --hash <tx>
policy-builder synthesize --network testnet --hash <tx> --limit 5000000
policy-builder synthesize '{"intent": {"calls": [{"contract": "C...", "fn": "pay", "where": [{"constraint": "cap", "at": [0], "max": "100"}]}]}}'
policy-builder verify --file verify.json
policy-builder info --verifyLive true
policy-builder review --network testnet --xdr <unsigned XDR>
policy-builder bind --network testnet --smartAccount C... --sourceAccount G... --ruleId 7 --executor C...
policy-builder install --network testnet --smartAccount C... --sourceAccount G... --signers '["G..."]' --follow '{"smartAccount": "C...", "ruleId": 2}'

Call a tool by its full name or by a unique start or end of it (record, synthesize, simulate, verify, install, revoke, bind, info, review). Input is a JSON argument, --file, - (stdin) or --field value pairs (a value that is JSON is read as JSON). One JSON envelope goes to stdout, the same one the MCP server returns: { ok: true, data } or { ok: false, error: { code, message, retryable } }. The exit code is 0, 1 for a refusal and 2 for bad usage; --out also writes the envelope to a file.

The CLI holds no key material and signs nothing: install and revoke return unsigned XDR. The operator's settings are environment variables: POLICY_BUILDER_RPC_URL_<NETWORK>, POLICY_BUILDER_SAFE_READS_<NETWORK>, POLICY_BUILDER_ALLOW_SPOT_READS, POLICY_BUILDER_ALLOW_OVERRIDES (outside testnet an allow* override is honoured only with it set to 1), and the bounds on what a wallet signs, POLICY_BUILDER_AUTH_LEDGERS (default 300) and POLICY_BUILDER_MAX_RESOURCE_FEE (default 10 XLM). The tools, their limits and the install guardrails (threshold or anyOne, the spending-limit guard, the read-safety lint, the overlap scan) are described in the policy-synth README.

policy-builder review is for the account owner: it reads an unsigned install or removal from its bytes alone, with no RPC. It lists the problems it finds in the bytes (problems, signable), then a review rebuilt from those bytes: the transaction, the Authority node and the predicate. signable does not mean safe: an agent can rewrite the bytes consistently, so the owner reads the Authority node against what they meant (see "The owner's review" in the policy-synth README). A rule with a contract signer reads as a problem offline; --readContracts true reads each one off the ledger through the operator's RPC. Then only an adapter bound to no gate, an adapter signing a rule scoped to itself that does not pin call_fn = run, or an undeployed contract is flagged, and every other contract reads signable unvetted: the owner checks who controls it. An install that follows another rule (install --follow) carries no predicate, so it reads as a problem offline too; --readContracts true also reads the followed rule's predicate and nonce now off the pinned interpreter and shows them under Follows.

License

MIT

版本与发布记录

@crediolabs/policy-builder-cli 共发布 43 个版本,首次发布于 2026/07/23;过去 12 个月发布了 43 个版本。

版本发布日期距今
5.2.0latest2026/10/2619 天前
5.1.02026/10/2619 天前
5.0.02026/10/2619 天前
4.1.02026/10/2322 天前
4.0.12026/10/2123 天前
4.0.02026/10/2124 天前

关于 @crediolabs/policy-builder-cli 的常见问题

@crediolabs/policy-builder-cli 是什么?

Command line for the OZ Policy Builder: policy-builder <tool> runs any of the eight policy-synth tools and prints its JSON envelope.

如何安装 @crediolabs/policy-builder-cli?

在项目目录运行 npm install @crediolabs/policy-builder-cli,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 policy-builder,可以用 npx policy-builder 直接运行。

@crediolabs/policy-builder-cli 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@crediolabs/policy-builder-cli 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@crediolabs/policy-builder-cli 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=22.12。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@crediolabs/policy-builder-cli 可以商用吗?

@crediolabs/policy-builder-cli 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@crediolabs/policy-builder-cli 的下载量有多少?

根据 npm 官方下载统计,@crediolabs/policy-builder-cli 在 2026/10/11 – 2026/11/09 这 30 天内被下载 2,030 次,日均约 68 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@crediolabs/policy-builder-cli 还在维护吗?

最新版本 5.2.0 发布于 2026/10/26(19 天前);至今共发布 43 个版本,其中过去 12 个月发布了 43 个;首次发布于 2026/07/23。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。