Square CLI
$ square 官方出品 高风险Square CLI(square)为开发者与编程 Agent 提供目录、订单、支付、库存和客户 API 的终端访问能力。专为 LLM 自发现而设计,支持通过 square --llms --format json 导出完整命令清单,并在任意子命令上通过 --schema 输出 JSON Schema。
npm install -g @square/cli square 可在本地直接提供 --llms 与 --schema 自省并执行可脚本化的商业 API 调用;若是托管的远程 OAuth 助手会话则更适合使用 Square MCP。
Agent 友好度体检单
当前为静态评估(本机尚未安装或尚未运行探针)。可在本地运行 npm run data:probe 并提交 data/probes/ 升级为实测证据。
FCRS-1.0 六维评分拆解
原生支持 --llms、单命令 --schema 与 --format json,对 Agent 极度友好。
square --llms --format jsonexports machine-readable command manifests- Every subcommand supports
--schemaintrospection
Sandbox 与 Production 配置隔离清晰,但生产环境命令会直接修改商户数据或触发资金交易。
- Supports Sandbox isolation and explicit
--schemavalidation
可通过 npm install -g @square/cli、npx -y @square/cli 及 GitHub 预编译二进制跨平台安装。
- Cross-platform binaries and npm/npx distribution
无需编写 SDK 样板代码即可覆盖 Square 全套商业 API。
- Maps catalog, orders, payments, inventory, and locations directly to CLI verbs
Square 官方维护(square/cli),但采用专有 Square Developer Terms 而非开源许可证。
- Published and maintained directly by Square (
square about)
除了 Square 开发者文档外,还可通过 --schema 与 --llms 实时自验证。
- Built-in
--schemaand--llmsoutputs match live CLI behavior
安全边界、鉴权与放权指南
将 Sandbox 与 Production 配置文件令牌保存在本地 ~/.square/ 目录中,也支持通过环境变量或命令行参数传入访问令牌。
CLI 按 Square Developer Terms 免费提供;真实生产收款会产生 Square 标准交易手续费。
# Square CLI (square) Agent Rules - Run `square --llms --format json` and `<cmd> --schema` instead of guessing API flags. - Target Sandbox credentials before testing payments, refunds, or order mutations. - Never execute live production charges or refunds without explicit human confirmation.
Agent 高频安全命令配方
只读查询(安全推荐)
square --llms --format json
以结构化 JSON 输出完整 Square CLI 命令树与说明,供 Agent 规划调用。
square catalog list --schema
在调用 Square API 前先输出该命令精确的参数、标志与载荷 JSON Schema。
受控写入与预演
square locations list --format json
以机器可读的 JSON 格式获取当前配置文件下的商户门店信息。
核心优势
- + 内置
--llms与--schema让 Agent 无需猜测即可获取精确参数契约。 - + 支持
--format json清洁输出及npx -y @square/cli零配置运行。
注意事项与踩坑点
- ! 属于受 Square Developer Terms 约束的专有软件,非 OSI 开源协议。
- ! 若未严格限定 Sandbox 凭据,生产令牌可直接发起真实扣款、退款或商品变更。