✅ 应用已注册
你的应用已在 Capgo 中注册,并拥有生产 channel
复制包含安装步骤和该插件完整 Markdown 指南的配置 prompt。
Capgo CLI 提供交互式 onboarding,为您的 Capacitor 应用设置 Live Updates。您将:
预计耗时: 10-20 分钟(取决于您的网速和构建时间)
使用你的 API 密钥运行 onboarding 命令:
npx @capgo/cli@latest init [APIKEY]你会看到欢迎信息:
Capgo onboarding 🛫CLI 将引导你完成 13 个交互式步骤:
配置阶段 (步骤 1-6):
@capgo/capacitor-updater 插件测试阶段 (步骤 7-12):
完成(第 13 步):
CLI 会检查你的开发环境,确保已安装必要的工具。
检查项:
可能的结果:
✅ 已找到两个环境:
✅ Xcode detected - iOS development ready✅ Android SDK detected - Android development ready⚠️ 未找到环境:
⚠️ Xcode not found⚠️ Android SDK not found❌ No development environment detected
📱 To develop mobile apps with Capacitor, you need: • For iOS: Xcode (macOS only) - https://developer.apple.com/xcode/ • For Android: Android Studio - https://developer.android.com/studio可能会问到的问题:
CLI 会帮你登录 Capgo,并把你的应用添加到账户中。
(spinner) Running: npm @capgo/cli@latest login ***Login Done ✅
❓ Add {appId} in Capgo?如果你的应用 ID 已被占用:
CLI 会给出替代建议:
❌ App ID "com.example.app" is already taken💡 Here are some suggestions: 1. com.example.app2 2. com.example.app3 3. com.example.app.new 4. com.example.app.app
❓ What would you like to do?你可以选择一个建议的 ID,或输入自定义的应用 ID。
通过 Channels,你可以为应用管理不同的更新流。
❓ Create default channel production for {appId} in Capgo?如果你选择 Yes:
(spinner) Running: npm @capgo/cli@latest channel add production {appId} --defaultChannel add Done ✅ (or "Channel already added ✅")系统将创建一个 production Channel 并将其设为默认。这是大多数用户的推荐选项。
如果你选择“否”:
If you change your mind, run it for yourself with: "npm @capgo/cli@latest channel add production {appId} --default"您稍后需要手动创建并配置通道。或者,您可以:
capacitor.config.ts 文件setChannel() 方法动态设置通道CLI 将安装 @capgo/capacitor-updater 与您的 Capacitor 版本兼容的插件。
❓ Automatic Install "@capgo/capacitor-updater" dependency in {appId}?版本兼容性:
@capgo/capacitor-updater v5@capgo/capacitor-updater v6@capgo/capacitor-updater v7即时更新选项:
安装完成后,系统会询问您:
❓ Do you want to set instant updates in {appId}? Read more: https://capgo.app/docs/live-updates/update-behavior/#applying-updates-immediately如果你选择 Yes:
autoUpdate: 'always' 以及 autoSplashscreen: true 会被添加到你的配置中@capacitor/splash-screen 缺失时会安装,并使用 launchAutoHide: falsecapacitor.config.ts 将自动更新always, atInstall, onLaunch) 应继续使用 npx @capgo/cli@latest bundle upload --delta 这样只下载变更的文件,用户无需等待整个 zip 包如果你选择“否”:
capacitor.config.tsCLI 会自动将所需的 code 注入到你的主应用文件中。
❓ Automatic Add "CapacitorUpdater.notifyAppReady()" code and import in {appId}?新增内容:
import { CapacitorUpdater } from '@capgo/capacitor-updater'
CapacitorUpdater.notifyAppReady()项目类型检测:
plugins/capacitorUpdater.client.ts端到端加密为您的更新增加了一层额外的安全保障。
🔐 End-to-end encryption ✅ Use this for: Banking, healthcare, or apps with legal encryption requirements ⚠️ Note: Makes debugging harder - skip if you don't need it
❓ Enable end-to-end encryption for {appId} updates?如果您启用加密,CLI 将:
在 onboarding 过程中选择要测试的平台。
📱 Platform selection for onboarding This is just for testing during onboarding - your app will work on all platforms
❓ Which platform do you want to test with during this onboarding? Options: - iOS - AndroidCLI 将构建您的应用,并与 Capacitor 同步。
❓ Automatic build {appId} with "npm run build"?执行过程:
npx cap sync {platform}如果缺少 build 脚本:
系统会询问你是想跳过 build,还是向你的项目添加 build 脚本 package.json.
在设备或模拟器上测试你的 App 初始版本。
❓ Run {appId} on {PLATFORM} device now to test the initial version?如果你选择 是:
(spinner) Running: npx cap run {platform}(device picker appears)App started ✅📱 Your app should now be running on your {platform} device with Capgo integrated🔄 This is your baseline version - we'll create an update next现在该做一处可见的更改,来测试 Capgo 的更新系统了。
🎯 Now let's test Capgo by making a visible change and deploying an update!
❓ How would you like to test the update? Options: - Auto: Let Capgo CLI make a visible change for you - Manual: I'll make changes myself自动模式: CLI 会自动修改你的文件,添加可见的测试横幅或改动。
手动模式: 由你自己修改(例如更改文本、颜色或添加元素)。
版本处理:
❓ How do you want to handle the version for this update? Options: - Auto: Bump patch version ({currentVersion} → {nextVersion}) - Manual: I'll provide the version number包含变更的 Build:
❓ Build {appId} with changes before uploading?将更新后的 app bundle 上传到 Capgo。
❓ Upload the updated {appId} bundle (v{version}) to Capgo?CLI 会运行:
npx @capgo/cli@latest bundle uploadDelta 更新提示(如果启用了即时生效模式):
💡 Instant updates are enabled in your config Delta updates send only changed files instead of the full bundle
❓ Enable delta updates for this upload? (Recommended with instant updates)成功:
✅ Update v{version} uploaded successfully!🎉 Your updated bundle is now available on Capgo是时候看看更新实际运行的效果了!
🧪 Time to test the Capgo update system!📱 Go to your device where the app is running即时更新:
🔄 IMPORTANT: Background your app (swipe up/press home button) and then reopen it⏱️ The update should be downloaded and applied automatically标准更新:
📱 With standard updates, you will need to: 1. Background the app (swipe up/press home button) to start download 2. Wait a few seconds for download to complete 3. Background and foreground again to see the update监控日志:
❓ Monitor Capgo logs to verify the update worked?如果你选择 是,你会看到设备上的实时日志,显示更新过程。
Welcome onboard ✈️!恭喜!你已成功为应用配置好 Capgo 实时更新。
完成 onboarding 后,你已处于以下状态:
✅ 应用已注册
你的应用已在 Capgo 中注册,并拥有生产 channel
✅ 插件已安装
Capacitor Updater 插件已安装并配置完成
✅ Code 已集成
你的应用已添加 code 集成
✅ 更新测试通过
你已成功部署并收到 live update
后续更新请使用:
npm run buildnpx @capgo/cli@latest bundle upload --channel=production更多部署选项,请参阅 部署 Live Update.
如果你退出 onboarding 流程,可以随时继续:
npx @capgo/cli@latest init [APIKEY]您将看到:
You have already got to the step {stepNumber}/13 in the previous session❓ Would you like to continue from where you left off?问题: 未检测到 Xcode 或 Android SDK。
解决方案:
问题: 你的 App ID 已被注册。
解决方案: 请选择建议的备选方案之一,或以反向域名格式输入自定义 App ID。
问题: 在以下路径中未找到 build script: package.json.
解决方案: 请为你的项目添加 build script package.json:
{ "scripts": { "build": "your-build-command" }}问题: CLI 无法自动注入 code 集成。
解决方案: 请手动将 code 添加到您的主文件中:
import { CapacitorUpdater } from '@capgo/capacitor-updater'
CapacitorUpdater.notifyAppReady()问题: 您的 Capacitor 版本低于 v5。
解决方案: 将 Capacitor 升级到 v5 或更高版本:
完成 onboarding 后,探索以下主题:
一次性设置清单
一次性配置好 channels、CI 和 delta upload,保证长期稳定
部署更新
了解如何从 Capgo dashboard 部署更新
更新类型
所有 OTA 更新类型参考:生效时机、延迟条件、版本拦截和分发
CI/CD 集成
使用 CI/CD 自动化更新部署
通道
通过 channels 管理多个更新流
加密
使用端到端加密保障更新安全
更新行为
自定义更新的应用时机与方式(direct、delta 等)
如果在 onboarding 过程中遇到问题:
如果你正在使用 CLI 入门指南 要规划 dashboard 和 API 操作,请将其连接到 API 概览 关于 API Overview 中的实现细节, 简介 关于 Introduction 中的实现细节, API 密钥 有关 API Keys 的实现细节, 设备 有关 Devices 的实现细节,以及 Bundle 有关 Bundles 中的实现细节。