npx skills add https://github.com/apollographql/skills --skill roverRover 是 Apollo GraphOS 的官方 CLI 工具。它可以帮助您管理模式、在本地运行组合、发布到 GraphOS,并在本地机器上开发超级图。
# macOS/Linux
curl -sSL https://rover.apollo.dev/nix/latest | sh
# npm (跨平台)
npm install -g @apollo/rover
# Windows PowerShell
iwr 'https://rover.apollo.dev/win/latest' | iex
# 交互式身份验证(打开浏览器)
rover config auth
# 或者设置环境变量
export APOLLO_KEY=your-api-key
rover --version
rover config whoami
| 命令 | 描述 | 使用场景 |
|---|---|---|
rover subgraph publish | 将子图模式发布到 GraphOS |
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
| CI/CD,模式更新 |
rover subgraph check | 验证模式变更 | PR 检查,部署前检查 |
rover subgraph fetch | 下载子图模式 | 本地开发 |
rover supergraph compose | 在本地组合超级图 | 本地测试 |
rover dev | 本地超级图开发 | 开发工作流 |
rover graph publish | 发布单图模式 | 非联邦图 |
大多数命令需要一个格式为以下的图引用:
<GRAPH_ID>@<VARIANT>
示例:
my-graph@productionmy-graph@stagingmy-graph@current (默认变体)设置为环境变量:
export APOLLO_GRAPH_REF=my-graph@production
# 从模式文件
rover subgraph publish my-graph@production \
--name products \
--schema ./schema.graphql \
--routing-url https://products.example.com/graphql
# 从运行中的服务器(自省)
rover subgraph publish my-graph@production \
--name products \
--schema <(rover subgraph introspect http://localhost:4001/graphql) \
--routing-url https://products.example.com/graphql
# 对照生产流量进行检查
rover subgraph check my-graph@production \
--name products \
--schema ./schema.graphql
# 从 GraphOS 获取
rover subgraph fetch my-graph@production --name products
# 自省运行中的服务器
rover subgraph introspect http://localhost:4001/graphql
创建 supergraph.yaml:
federation_version: =2.9.0
subgraphs:
products:
routing_url: http://localhost:4001/graphql
schema:
file: ./products/schema.graphql
reviews:
routing_url: http://localhost:4002/graphql
schema:
subgraph_url: http://localhost:4002/graphql
组合:
rover supergraph compose --config supergraph.yaml > supergraph.graphql
rover supergraph fetch my-graph@production
rover dev 进行本地开发启动一个具有自动模式组合功能的本地路由器:
# 使用超级图配置启动
rover dev --supergraph-config supergraph.yaml
# 使用 GraphOS 变体作为基础启动
rover dev --graph-ref my-graph@staging --supergraph-config local.yaml
# 启用 MCP 服务器启动
rover dev --supergraph-config supergraph.yaml --mcp
特定主题的详细文档:
# 1. 检查模式变更
rover subgraph check $APOLLO_GRAPH_REF \
--name $SUBGRAPH_NAME \
--schema ./schema.graphql
# 2. 如果检查通过,则发布
rover subgraph publish $APOLLO_GRAPH_REF \
--name $SUBGRAPH_NAME \
--schema ./schema.graphql \
--routing-url $ROUTING_URL
# 对照 GraphOS 规则进行代码检查
rover subgraph lint --name products ./schema.graphql
# 单图代码检查
rover graph lint my-graph@production ./schema.graphql
# 用于脚本处理的 JSON 输出
rover subgraph fetch my-graph@production --name products --format json
# 纯文本输出(默认)
rover subgraph fetch my-graph@production --name products --format plain
rover config auth 或 APOLLO_KEY)graph@variantrover subgraph publish 之前使用 rover subgraph checkrover dev 而不是手动运行路由器APOLLO_KEY 提交到版本控制系统;使用环境变量--format jsonfederation_versionrover subgraph introspect 从运行中的服务提取模式每周安装量
402
代码仓库
GitHub 星标数
31
首次出现
2026年1月23日
安全审计
已安装于
claude-code360
opencode314
codex314
github-copilot310
gemini-cli308
cursor295
Rover is the official CLI for Apollo GraphOS. It helps you manage schemas, run composition locally, publish to GraphOS, and develop supergraphs on your local machine.
# macOS/Linux
curl -sSL https://rover.apollo.dev/nix/latest | sh
# npm (cross-platform)
npm install -g @apollo/rover
# Windows PowerShell
iwr 'https://rover.apollo.dev/win/latest' | iex
# Interactive authentication (opens browser)
rover config auth
# Or set environment variable
export APOLLO_KEY=your-api-key
rover --version
rover config whoami
| Command | Description | Use Case |
|---|---|---|
rover subgraph publish | Publish subgraph schema to GraphOS | CI/CD, schema updates |
rover subgraph check | Validate schema changes | PR checks, pre-deploy |
rover subgraph fetch | Download subgraph schema | Local development |
rover supergraph compose | Compose supergraph locally | Local testing |
rover dev | Local supergraph development | Development workflow |
rover graph publish | Publish monograph schema | Non-federated graphs |
Most commands require a graph reference in the format:
<GRAPH_ID>@<VARIANT>
Examples:
my-graph@productionmy-graph@stagingmy-graph@current (default variant)Set as environment variable:
export APOLLO_GRAPH_REF=my-graph@production
# From schema file
rover subgraph publish my-graph@production \
--name products \
--schema ./schema.graphql \
--routing-url https://products.example.com/graphql
# From running server (introspection)
rover subgraph publish my-graph@production \
--name products \
--schema <(rover subgraph introspect http://localhost:4001/graphql) \
--routing-url https://products.example.com/graphql
# Check against production traffic
rover subgraph check my-graph@production \
--name products \
--schema ./schema.graphql
# Fetch from GraphOS
rover subgraph fetch my-graph@production --name products
# Introspect running server
rover subgraph introspect http://localhost:4001/graphql
Create supergraph.yaml:
federation_version: =2.9.0
subgraphs:
products:
routing_url: http://localhost:4001/graphql
schema:
file: ./products/schema.graphql
reviews:
routing_url: http://localhost:4002/graphql
schema:
subgraph_url: http://localhost:4002/graphql
Compose:
rover supergraph compose --config supergraph.yaml > supergraph.graphql
rover supergraph fetch my-graph@production
rover devStart a local Router with automatic schema composition:
# Start with supergraph config
rover dev --supergraph-config supergraph.yaml
# Start with GraphOS variant as base
rover dev --graph-ref my-graph@staging --supergraph-config local.yaml
# Start with MCP server enabled
rover dev --supergraph-config supergraph.yaml --mcp
Detailed documentation for specific topics:
# 1. Check schema changes
rover subgraph check $APOLLO_GRAPH_REF \
--name $SUBGRAPH_NAME \
--schema ./schema.graphql
# 2. If check passes, publish
rover subgraph publish $APOLLO_GRAPH_REF \
--name $SUBGRAPH_NAME \
--schema ./schema.graphql \
--routing-url $ROUTING_URL
# Lint against GraphOS rules
rover subgraph lint --name products ./schema.graphql
# Lint monograph
rover graph lint my-graph@production ./schema.graphql
# JSON output for scripting
rover subgraph fetch my-graph@production --name products --format json
# Plain output (default)
rover subgraph fetch my-graph@production --name products --format plain
rover config auth or APOLLO_KEY)graph@variantrover subgraph check before rover subgraph publish in CI/CDrover dev for local supergraph development instead of running Router manuallyAPOLLO_KEY to version control; use environment variables--format json when parsing output programmaticallyfederation_version explicitly in supergraph.yaml for reproducibilityWeekly Installs
402
Repository
GitHub Stars
31
First Seen
Jan 23, 2026
Security Audits
Gen Agent Trust HubFailSocketPassSnykWarn
Installed on
claude-code360
opencode314
codex314
github-copilot310
gemini-cli308
cursor295
agent-browser 浏览器自动化工具 - Vercel Labs 命令行网页操作与测试
140,500 周安装
rover subgraph introspect to extract schemas from running services