CLI 目录 横向对比 FCRS-1.0 标准 /llms.txt
← 返回 CLI 目录

Supabase CLI

$ supabase 官方出品 高风险
Supabase · 数据库与数据处理 · MIT · macos / linux / windows

Supabase CLI 管理基于本地容器的 Supabase 环境、数据库迁移、Schema Diff、TypeScript 类型生成与 Edge Functions。在 db push 上支持 --dry-run 预演,项目管理命令支持 --output json。

FCRS-1.0 综合评分
86 /100
良好 (Good)
中置信度 (源码/文档)
零摩擦安装命令
brew install supabase/tap/supabase
CLI vs MCP 选型建议 CLI + MCP 搭配

本地迁移、gen types 与 db diff 优先用 supabase CLI;面向已关联云项目的自然语言 SQL 探索可用 Supabase MCP。

Agent 友好度体检单

✓ 原生 JSON 输出
— 字段裁剪
✓ 无头非交互
✓ 支持 Dry-Run
— 只读模式开关
✓ 支持 NO_COLOR
— 自省/Schema 发现
— 官方 SKILL.md

当前为静态评估(本机尚未安装或尚未运行探针)。可在本地运行 npm run data:probe 并提交 data/probes/ 升级为实测证据。

FCRS-1.0 六维评分拆解

Agent 友好度 21 / 25

列表查询支持 --output json,db push 支持 --dry-run,关键流程支持 --yes 非交互确认。

  • Supports --output json, --dry-run, and --yes across key workflows
安全与权限边界 20 / 25

本地优先开发流程加上 db push --dry-run 有效降低迁移事故风险,但 db reset 与 --linked 远端操作需严格管控。

  • --local vs --linked separation and db push --dry-run
  • Destructive reset commands exist for local/linked DBs
安装与运行摩擦 13 / 15

通过 Homebrew/npx 安装单 Go 二进制;启动完整本地栈需本机具备容器运行时。

  • Go binary distributed via supabase/cli; supabase start requires Docker
能力覆盖与边际价值 14 / 15

在一个工具内优雅串联数据库迁移、Diff、类型生成与边缘函数。

  • gen types typescript and db diff integrate directly into coding loops
维护与来源背书 10 / 10

Supabase 官方(supabase/cli)以 MIT 协议高频发版维护。

  • Official supabase/cli repository
文档与可验证性 8 / 10

Supabase 官方 CLI 参考文档完整清晰。

  • Published reference at supabase.com/docs/reference/cli

安全边界、鉴权与放权指南

鉴权方式
浏览器 OAuth 环境变量密钥 系统钥匙串
凭证存储位置

访问令牌保存在系统钥匙串/本地配置中,或通过 SUPABASE_ACCESS_TOKEN 环境变量传入。

潜在副作用
只读查询 本地写入 远端写入 破坏性删除 计费影响
费用与配额提示

CLI 以 MIT 开源免费;托管 Supabase 云项目遵循对应免费/付费套餐配额。

可复制到 CLAUDE.md / AGENTS.md 的安全护栏
# Supabase CLI Agent Rules
- Always run `supabase db push --dry-run` before `supabase db push`.
- Prefer `--local` for `gen types` and `db diff` during feature work.
- NEVER run `supabase db reset --linked` or `supabase projects delete` autonomously.

Agent 高频安全命令配方

只读查询(安全推荐)

从本地 Schema 生成 TypeScript 类型
supabase gen types typescript --local > src/types/supabase.ts

保持前后端类型与本地 Postgres 同步,完全不触碰线上生产库。

用 --dry-run 预演待执行的迁移
supabase db push --dry-run

展示即将执行的 SQL 迁移而不实际应用到目标库。

受控写入与预演

创建带时间戳的新本地迁移文件
supabase migration new add_users_index

在本地生成 SQL 迁移草稿文件供人工或测试审阅。

核心优势

  • + supabase db push --dry-run 提供可靠的迁移上线前预检。
  • + --local 类型生成与 Diff 无缝融入编码 Agent 迭代闭环。
  • + 支持 SUPABASE_ACCESS_TOKEN 与 --yes 适配无头 CI 执行。

注意事项与踩坑点

  • ! 虽然 CLI 二进制本身轻量,但 supabase start 完整本地栈依赖 Docker。
  • ! 对关联项目误传 db reset --linked 可能清空远端预发/生产库结构。

已验证兼容的 Agent 宿主

Claude Code Codex CLI Gemini CLI