Cloud 绑定指南
Cloud 绑定(v0.4 引入)实现跨开发者的基因共享。将你的基因发布到共享注册表,发现其他开发者创建的基因,并在全球 Arena 中竞争。
开发者 A Cloud 开发者 B┌──────────┐ ┌──────────────┐ ┌──────────┐│ rotifer │ ── publish ──→ │ Supabase │ ←── search ─── │ rotifer ││ CLI │ ←── search ─── │ ┌────────┐ │ ──→ install ──→ │ CLI ││ │ ── arena ──→ │ │ 基因 │ │ ←── arena ─── │ │└──────────┘ │ │ Arena │ │ └──────────┘ │ │ Auth │ │ │ └────────┘ │ └──────────────┘rotifer login2. 发布基因
Section titled “2. 发布基因”rotifer init my-project && cd my-projectrotifer wrap my-search --domain search.webrotifer test my-searchrotifer compile my-searchrotifer publish my-search3. 发现基因
Section titled “3. 发现基因”rotifer search # 浏览所有基因rotifer search "web search" # 按关键词搜索rotifer search -d search.web # 按域过滤rotifer search --fidelity Native # 按保真度过滤4. 安装基因
Section titled “4. 安装基因”rotifer install <gene-id>5. Cloud Arena
Section titled “5. Cloud Arena”rotifer arena submit my-search --cloudrotifer arena list --cloudrotifer arena watch search.web --cloudCloud 配置
Section titled “Cloud 配置”所有 Cloud 命令默认连接 https://rotifer-cloud.supabase.co。
环境变量:
export ROTIFER_CLOUD_ENDPOINT=https://your-instance.supabase.coexport ROTIFER_CLOUD_ANON_KEY=your-anon-key配置文件(~/.rotifer/cloud.json):
{ "endpoint": "https://your-instance.supabase.co", "anonKey": "your-anon-key"}- 行级安全策略 (RLS) — 用户只能修改自己的基因
- PKCE OAuth — 安全的令牌交换(CLI 中无客户端密钥)
- WASM 存储 — 公开读取,认证写入
- 输入验证 — 通过 PostgREST 进行服务端模式验证
”未登录”错误
Section titled “”未登录”错误”rotifer login # 重新认证安装时”基因未找到”
Section titled “安装时”基因未找到””确保使用的是 rotifer search 返回的完整 UUID。
大型 WASM 文件(>1MB)可能需要较长时间。优化方法:
- 减少依赖
- 使用编译管线中的 tree-shaking
- 将大型基因拆分为更小的可组合单元