跳转到内容

Cloud 命令

Cloud 命令实现跨创作者的基因共享。通过 Rotifer Cloud Registry,发布的基因可以被全球创作者发现、安装和竞争。

通过 OAuth 认证 Rotifer Cloud。

终端窗口
rotifer login [选项]

选项:

标志说明
--provider <name>OAuth 提供商:github(默认)或 gitlab
--endpoint <url>Cloud 端点 URL(覆盖默认值)

认证流程:

  1. 打开浏览器前往 OAuth 授权页面(GitHub 或 GitLab)
  2. 用户授权 Rotifer Protocol
  3. PKCE 流程交换授权码获取令牌
  4. 凭证保存至 ~/.rotifer/credentials.json

示例:

终端窗口
$ rotifer login
正在打开浏览器进行 GitHub 认证...
等待授权...
✓ 已登录为 @yourname

清除 Cloud 认证凭证。

终端窗口
rotifer logout

示例:

终端窗口
$ rotifer logout
✓ Logged out successfully

将基因上传至 Rotifer Cloud Registry。

终端窗口
rotifer publish [gene-name] [选项]

参数:

参数必填说明
gene-name是(除非使用 --all)要发布的基因名称

选项:

标志说明
--description <文本>覆盖基因描述
--changelog <文本>本版本的变更记录(最长 500 字符)
--skip-arena跳过自动 Arena 提交和声誉计算
--skip-security跳过发布前安全检查(危险 API / IR / 密钥扫描)
--skip-vg跳过 V(g) 安全扫描,上传一个 skipped 徽章占位(徽章显示 skipped)
--all发布 genes/ 目录下所有有效基因
--trust-unsigned允许 T1 发布门在无沙箱的 Node.js 下运行未编译的外来基因(从 Cloud 安装或从 ClawHub 包装的)。不加时,带 testsuite.json 的这类基因会被发布门拦下

前提条件:

  • 必须已登录(rotifer login)
  • 基因必须有有效的 phenotype.json
  • 建议先编译 WASM(gene.ir.wasm),但非必须
  • 带 testsuite.json 的外来基因(从 Cloud 安装或从 ClawHub 包装的)要先编译(rotifer compile <gene>),T1 发布门才会在沙箱里跑它的测试集。0.38.0 起,不加 --trust-unsigned 时,发布门不会在 Node.js 下以源码运行它

上传内容:

  • Phenotype 元数据(域、模式、版本、保真度)
  • WASM 二进制文件(如果已编译)
  • 描述和作者信息

发布后:

  • 基因目录中保存 .cloud-manifest.json,关联本地基因与云端 ID
  • 基因对其他创作者可搜索和安装

示例:

终端窗口
$ rotifer publish my-search --description "快速网页搜索基因"
以 @yourname 身份发布...
上传到云端注册表...
✓ 基因 'my-search' 已发布到云端!
ID: a1b2c3d4-...
创作者: yourname
域: search.web
版本: 0.1.0
保真度: Wrapped
WASM 大小:142.3KB
其他人可安装:rotifer install a1b2c3d4-...
提交到 Cloud Arena:rotifer arena submit --cloud my-search

把你已发布的某个基因版本从公开注册表下架。不删除任何东西:这个版本的记录仍在,变的只是「是否公开」。

终端窗口
rotifer unpublish <gene> [选项]

参数:

参数必填说明
gene是基因名、name@version 或基因 UUID。只写名字时,下架仍在公开状态的最新版本。

选项:

标志说明
--yes确认执行。不加它,命令只说明将要做什么,不做任何改动。
--reason <text>下架原因(最多 500 字符),随下架一起记录。

工作流程:

  1. 需要先 rotifer login,只有该版本的作者能下架。
  2. 该版本从搜索和公开注册表中消失。
  3. 它的 Arena 记录、调用历史和已发布的产物都保留,排行榜和公开调用记录仍可重算。
  4. 这次变更写入公开的可见性日志(谁、何时、为什么),并重算你的声誉。

示例:

终端窗口
$ rotifer unpublish my-search@0.2.0
⚠ About to unpublish my-search@0.2.0.
ℹ It disappears from search and the public registry.
ℹ Its Arena entry, invocation history and published artifact are kept.
ℹ Put it back with: rotifer republish my-search@0.2.0
ℹ Re-run with --yes to confirm.
$ rotifer unpublish my-search@0.2.0 --yes --reason "已由 0.3.0 取代"
✓ Unpublished my-search@0.2.0
ℹ Undo with: rotifer republish my-search@0.2.0

把你已下架的某个基因版本重新放回公开注册表。

终端窗口
rotifer republish <gene> [选项]

参数:

参数必填说明
gene是基因名、name@version 或基因 UUID。只写名字时,恢复已下架的最新版本。

选项:

标志说明
--reason <text>重新上架的原因,随恢复一起记录。

只有作者能重新上架,而且只能针对当前处于下架状态的版本。恢复的是原来那份产物和内容哈希,不会重新构建。没有确认提示。

示例:

终端窗口
$ rotifer republish my-search@0.2.0 --reason "误下架"
✓ Republished my-search@0.2.0

在 Cloud Registry 中搜索基因。

终端窗口
rotifer search [查询] [选项]

参数:

参数必填说明
查询否搜索关键词(匹配名称和描述)

选项:

标志说明
-d, --domain <域>按功能域过滤
--fidelity <类型>按 Native 或 Wrapped 过滤
--sort <排序>排序:newest、popular、fitness
--page <n>页码(每页 20 条)

示例:

终端窗口
$ rotifer search "web search"
┌──────────────────────┬──────────┬────────────┬─────────┬──────────┬───────────┐
│ Name │ Creator │ Domain │ Version │ Fidelity │ Downloads │
├──────────────────────┼──────────┼────────────┼─────────┼──────────┼───────────┤
│ fast-web-search │ alice │ search.web │ 0.2.0 │ Native │ 142 │
│ my-web-search │ bob │ search.web │ 0.1.0 │ Wrapped │ 38 │
└──────────────────────┴──────────┴────────────┴─────────┴──────────┴───────────┘

从 Cloud Registry 下载并安装基因到本地项目。

终端窗口
rotifer install <gene-ref> [选项]

参数:

参数必填说明
gene-ref是基因的 UUID

选项:

标志说明
--force本地已存在同名基因时强制覆盖

工作流程:

  1. 从云端获取基因元数据
  2. 下载 WASM 二进制文件(如有)
  3. 在项目的 genes/ 目录中创建基因目录
  4. 保存 phenotype.json 和 gene.ir.wasm

示例:

终端窗口
$ rotifer install a1b2c3d4-e5f6-7890-abcd-ef1234567890
正在从云端下载 'fast-web-search'...
✓ 已安装到 genes/fast-web-search/
域: search.web
保真度: Native
版本: 0.2.0
测试:rotifer test fast-web-search
提交到 Arena:rotifer arena submit fast-web-search

从项目中移除一个基因,同时保留快照以便恢复。

终端窗口
rotifer uninstall <gene-name>

参数:

参数必填说明
gene-name是要移除的基因

工作流程: 把基因目录从项目的基因目录移到旁边的 .snapshots/ 里,并记下被替换的时间。只影响当前项目,不碰 Cloud Registry;要把你发布的基因从注册表下架,用 rotifer unpublish。

示例:

终端窗口
$ rotifer uninstall hello-world
✓ Removed hello-world
ℹ Restore it with: rotifer rollback hello-world

恢复上一次覆盖或卸载替换掉的那份基因。

终端窗口
rotifer rollback [gene-name]

参数:

参数必填说明
gene-name否要恢复的基因。不填则列出可以回滚的基因。

工作流程:

  • 基因被覆盖(rotifer install --force)或被移除(rotifer uninstall)时会留一份快照。
  • 每个基因只保留一份快照,再次覆盖或卸载会替换掉旧的快照。
  • 恢复时丢弃当前副本、放回快照,快照随之用掉。回滚只撤销一步,不是历史记录。
  • 只作用于当前项目,不改动 Cloud Registry 里的任何东西。
  • @rotifer/mcp-server 使用同样的快照布局,所以经 MCP server 替换掉的基因可以在这里恢复,反过来也一样。

示例:

终端窗口
$ rotifer rollback
ℹ Genes that can be rolled back:
hello-world — replaced 2026-10-26T03:01:30.855Z
ℹ Restore one with: rotifer rollback <gene-name>
$ rotifer rollback hello-world
✓ Restored hello-world to ./genes/hello-world
ℹ The snapshot has been used up. Rollback undoes one step, not a history.

该基因没有快照时,命令以错误 E0052 退出,并提示不带参数运行 rotifer rollback 查看能恢复什么。


默认情况下,Cloud 命令连接 https://cloud.rotifer.dev。可配置自定义端点:

环境变量:

终端窗口
export ROTIFER_CLOUD_ENDPOINT=https://your-instance.supabase.co

配置文件(~/.rotifer/cloud.json):

{
"endpoint": "https://your-instance.supabase.co",
"anonKey": "your-anon-key"
}