planetscale-pscale-cli-automation
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChinesePlanetScale CLI automation
PlanetScale CLI自动化
Purpose
用途
Teach agents how to invoke non-interactively. This skill covers CLI
conventions only. Operational workflows (inventory, safety review, schema
recommendations) use the other skills in this repo — start with
for a full assessment.
pscale../00-safe-orchestrator/SKILL.md指导代理如何以非交互方式调用。本技能仅涵盖CLI约定。操作工作流(清单、安全审查、架构建议)需使用本仓库中的其他技能——如需完整评估,请从开始。
pscale../00-safe-orchestrator/SKILL.mdTwo AGENTS.md files (do not confuse them)
两个AGENTS.md文件(请勿混淆)
| Document | Where | Purpose |
|---|---|---|
| CLI agent guide | Shipped with | How to call |
| Project agent guide | Your application repository's | Which org, database, branch, engine, prod branch, MCP scope, approval rules |
Do not edit project without operator approval (see
).
AGENTS.md../09-mcp-agent-operating-model/SKILL.md| 文档 | 位置 | 用途 |
|---|---|---|
| CLI代理指南 | 随 | 如何调用 |
| 项目代理指南 | 应用程序仓库中的 | 指定组织、数据库、分支、引擎、生产分支、MCP范围、审批规则 |
未经操作员批准,请勿编辑项目的(详见)。
AGENTS.md../09-mcp-agent-operating-model/SKILL.mdBootstrap (always start here)
初始化(始终从此处开始)
bash
pscale agent-guide --format json
pscale auth check --format jsonIf returns , follow and
in the JSON. For login, the human may need to approve in the
browser; use .
auth check"status": "action_required"issuesnext_stepspscale auth login --format jsonbash
pscale agent-guide --format json
pscale auth check --format json如果返回,请遵循JSON中的和字段。如需登录,用户可能需要在浏览器中进行批准;使用命令。
auth check"status": "action_required"issuesnext_stepspscale auth login --format jsonConventions
约定
- Always pass for automation.
--format json - Put on resource subcommands (
--org <org>,database,branch,sql, …) — not on rootapi.pscale - Put positional arguments before flags ().
pscale sql mydb main --org bb … - Use , not
pscale sql(shell requires a TTY).pscale shell - Default SQL role is reader; pass (or writer/readwriter) for writes. Match
--role adminsemantics forpscale shelland--role.--replica - is per subcommand only (e.g.
--force,database delete … --force). There is no globalpscale sql … --forceor--force.PSCALE_FORCE - alone never skips confirmations — add
--format jsonon the destructive subcommand after explicit user approval.--force
- 自动化时始终传递****参数。
--format json - 将****参数放在资源子命令(
--org <org>、database、branch、sql等)中——而非根命令api。pscale - 将位置参数放在标志之前(例如)。
pscale sql mydb main --org bb … - 使用****,而非
pscale sql(shell需要TTY)。pscale shell - 默认SQL角色为reader;如需写入操作,请传递(或writer/readwriter)。
--role admin和--role的语义与--replica保持一致。pscale shell - ****仅适用于子命令(例如
--force、database delete … --force)。不存在全局pscale sql … --force或--force环境变量。PSCALE_FORCE - 仅不会跳过确认步骤——在获得用户明确批准后,需在破坏性子命令中添加
--format json参数。--force
Typical workflow
典型工作流
bash
pscale auth check --format json
pscale org list --format json
pscale database list --org <org> --format json
pscale branch list <database> --org <org> --format json
pscale sql <database> <branch> --org <org> --format json --query "SELECT 1"MySQL uses by default (same as ); pass only
for multi-keyspace databases.
@primarypscale shell--keyspacebash
pscale auth check --format json
pscale org list --format json
pscale database list --org <org> --format json
pscale branch list <database> --org <org> --format json
pscale sql <database> <branch> --org <org> --format json --query "SELECT 1"MySQL默认使用(与相同);仅在多键空间数据库中需传递参数。
@primarypscale shell--keyspaceMCP vs CLI
MCP与CLI对比
- MCP clients — use the hosted PlanetScale MCP server (see for the current URL).
pscale agent-guide --format json - Shell scripts and coding agents — use with
pscaleas above.--format json
- MCP客户端——使用托管的PlanetScale MCP服务器(当前URL可通过获取)。
pscale agent-guide --format json - Shell脚本与编码代理——按上述方式使用带参数的
--format json。pscale
When this skill is not enough
当本技能不足以满足需求时
Install the full PlanetScale skills pack (if not already):
sh
git clone https://github.com/planetscale/skills.git && cd skills && script/setup安装完整的PlanetScale技能包(如果尚未安装):
sh
git clone https://github.com/planetscale/skills.git && cd skills && script/setupor: npx skills add planetscale/skills -g -y
or: npx skills add planetscale/skills -g -y
Then run sub-skills or `../00-safe-orchestrator/SKILL.md` for database operations
beyond basic CLI invocation.
然后运行子技能或`../00-safe-orchestrator/SKILL.md`以完成基础CLI调用之外的数据库操作。Current conventions source of truth
当前约定的权威来源
Prefer live output over memorized flag syntax:
bash
pscale agent-guide --format jsonThe embedded field contains the full CLI agent guide shipped with your
binary.
guidepscale优先使用实时输出而非记忆的标志语法:
bash
pscale agent-guide --format json其中嵌入的字段包含随二进制文件发布的完整CLI代理指南。
guidepscale