跳过内容

🔹 构建

🏗️ 通过 Capgo Cloud管理原生 iOS/Android 构建。

原生云构建请求目前处于有限 beta 阶段,访问受限。构建凭证永远不会在 Capgo 服务器上存储:它们只用于构建,然后删除。可选地,可以上传构建输出,并提供有限时间下载链接。

终端窗口
npx @capgo/cli build credentials save --appId YOUR_APP_ID --platform ios
npx @capgo/cli build credentials save --appId YOUR_APP_ID --platform android

在CI中捕获输出URL

CI输出URL捕获

Pass --output-record 为了持久保存下载URL和QR码code,然后使用 build last-output 读取它:

终端窗口
npx @capgo/cli build request APP_ID --platform android --output-upload --output-record /tmp/build.json
npx @capgo/cli build last-output --path /tmp/build.json --field outputUrl

🔹 Needed

🔹 Needed
终端窗口
npx @capgo/cli@latest build needed

🧭 如果原生构建需要,则打印“yes”并退出code 1;否则打印“no”并退出code 0。命令失败退出code 2.

示例:

终端窗口
npx @capgo/cli@latest build needed com.example.app --channel production --verbose

选项:

参数类型描述
-astringAPI用于链接到您的帐户
-cstring与CapacitorUpdater.defaultChannel或公共默认频道进行比较的频道。默认为CapacitorUpdater.defaultChannel或公共默认频道
—package-jsonstring多包仓库的package.json文件路径(逗号分隔)
—node-modulesstring多包仓库的node_modules目录路径(逗号分隔)
—verboseboolean详细日志输出
—supa-hoststring自主托管或Capgo开发时的自定义Supabase主机URL
—supa-anonstring自主托管时的自定义Supabase匿名密钥

🚀 Init

🚀 Init

Alias: onboarding

终端窗口
npx @capgo/cli@latest build init

交互式设置构建凭据 (iOS: 自动配置证书 + 配置文件; Android: 自动配置 keystore + Google OAuth 并配置 GCP 服务账号和 Play Console 邀请)

选项:

参数类型描述
-astringAPI 键用于链接到您的账号
-pstring要上线的平台 (ios 或 android)。如果省略,会自动检测当只有一个本地文件夹存在时;否则会提示。
--supa-hoststring自定义 Supabase 主机 URL(用于自主托管或 Capgo 开发)
—无分析boolean禁用此次运行的构建引导分析和终端回放
终端窗口
npx @capgo/cli@latest build request

请求 Capgo 云的原生构建。 此命令将压缩您的项目目录并上传到 Capgo 进行构建。 构建将被处理并直接发送到应用商店。 凭证在 Capgo 服务器上永不存储;它们在构建后删除。保存它们之前请求构建:

终端窗口
npx @capgo/cli build credentials save --appId APP_ID --platform ios

示例:

终端窗口
npx @capgo/cli@latest build request com.example.app --platform ios --path .

选项:

参数类型描述
—pathstring项目构建目录的路径(默认:当前目录)
—node-modulesstring多包项目的node_modules目录路径(逗号分隔)
—platformstring目标平台:ios或android(必填)
—build-modestring构建模式:调试或发布(默认:发布)
__build-certificate-base64stringiOS:Base64编码的.p12证书
__p12-passwordstringiOS:证书密码(如果证书没有密码,则可选)
__apple-idstringiOS:用于上传应用特定密码的Apple ID电子邮件(App Store ConnectAPI密钥的替代方案)
__apple-app-specific-passwordstringiOS:用于TestFlight上传的应用特定密码(xxxx-xxxx-xxxx-xxxx)
__apple-app-idstringiOS:App Store Connect应用ID(与__apple-id和__apple-app-specific-password一起使用)
__apple-key-idstringiOS: App Store Connect API 应用密钥ID
—苹果发行者 IDstringiOS: App Store Connect 发行者 ID
—苹果密钥内容stringiOS: Base64编码的App Store ConnectAPI密钥(.p8)
—App Store Connect Team IDstringiOS: App Store Connect 团队 ID
—iOS方案stringiOS: 使用 Xcode 构建方案(默认:App)
—ios-targetstringiOS: 在 Xcode 中,目标设置为读取构建设置(默认值:与方案相同)
—iOS分发stringiOS: 分发模式
—ios-provisioning-profilestringiOS: Provisioning profile路径或bundleId=path映射(可重复)
—android-keystore-filestringAndroid: Base64编码的keystore文件
—keystore-key-aliasstringAndroid: Keystore密钥别名
—keystore-key-passwordstringAndroid: Keystore密钥密码
—keystore-store-passwordstringAndroid: Keystore存储密码
—play-config-jsonstringAndroid: Base64-encoded Google Play service account JSON
—android-flavorstringAndroid: 项目中需要构建的产品风格(例如生产环境)。如果项目有多个风格,则必填。
—in-app-update-prioritystringAndroid: Google Play 内购更新优先级(整数 0–5;越高越紧急)。请参阅 https://developer.android.com/guide/playcore/in-app-updates. 优先级:CLI > env > 保存的凭据
—no-playstore-uploadboolean跳过此构建的Play Store上传(清空保存的Play配置)。需要 —output-upload。
—submit-to-store-reviewboolean上传后将此版本提交到App Store审查,而不是将其留作草稿/未激活的构建。Android标记Play发布完成;iOS将处理后的TestFlight构建提交到App Store审查。
—store-release-namestring__CAPGO_KEEP_0__
__CAPGO_KEEP_0__string__CAPGO_KEEP_1__
__CAPGO_KEEP_2__string__CAPGO_KEEP_3__
__CAPGO_KEEP_4__string__CAPGO_KEEP_5__
__CAPGO_KEEP_6__boolean__CAPGO_KEEP_7__
__CAPGO_KEEP_8__boolean__CAPGO_KEEP_9__
__CAPGO_KEEP_10__booleanOverride 本次构建的输出上传行为 (启用). 优先级: CLI > env > saved credentials
—no-output-uploadbooleanOverride 本次构建的输出上传行为 (禁用). 优先级: CLI > env > saved credentials
—output-retentionstringOverride 本次构建的输出链接有效期 (1h 到 7d). 示例: 1h, 6h, 2d. 优先级: CLI > env > saved credentials
—output-recordstring成功构建后,写入一个 JSON 记录 (jobId, status, outputUrl, qrCodeAscii, qrCodePngPath, finishedAt) 到一个路径。一个 PNG QR code 也会写入到该路径的旁边,带有 .qr.png suffix. 读取字段回 build last-output.
—no-skip-build-number-bumpbooleanOverride 保存的凭据以重新启用自动构建号递增功能本次构建
—skip-marketing-version-bumpboolean跳过自动市场版本 (CFBundleShortVersionString / versionName) 增加,当应用已经发布时
—iOS同步版本booleaniOS:在上传项目之前从package.json同步Xcode MARKETING_VERSION。
—AI分析boolean在构建失败时,发送日志到Capgo AI进行诊断。在交互式终端中跳过确认;在CI中自动上传并将分析打印到stderr。
—跳过预扫描boolean跳过自动预构建扫描
—预扫描忽略致命错误boolean在预构建扫描时不阻塞构建(只报告)
—警告为致命错误boolean将预扫描警告视为致命错误
—自动发送日志至支持boolean在CI/CD构建失败时,自动上传构建日志至Capgo支持(无需发送电子邮件)。Capgo支持将收到电子邮件并会通过电子邮件跟进。与—AI分析相加。
—发送日志boolean已弃用 —send-logs-to-support 的别名
-astringAPI 用于链接到您的帐户的密钥
—自定义 Supabase 主机 URL(用于自主托管或 __CAPGO_KEEP_0__ 开发)stringCustom Supabase host URL (for self-hosting or Capgo development)
—详细输出和日志stringiOS 版本同步
iOS 版本同步boolean自定义 Supabase 主机 URL(用于自主托管或 __CAPGO_KEEP_0__ 开发)

🔹 自定义 Supabase 匿名密钥(用于自主托管)

详细输出和日志
终端窗口
npx @capgo/cli@latest build sync-ios-version

从 package.json 中同步本地 iOS Xcode MARKETING_VERSION。

示例:

终端窗口
npx @capgo/cli@latest build sync-ios-version --path .

选项:

参数类型描述
—pathstring项目目录的路径(默认:当前目录)
—检查boolean仅检查; MARKETING_VERSION 不一致时退出非零
终端窗口
npx @capgo/cli@latest build prescan

扫描您的项目和保存的凭据以查找可能会导致云构建失败的问题 — 在上传任何内容之前。 检查凭据(过期、密码、配置文件配对)、项目状态(cap 同步、node_modules 布局)和平台配置。自动在 build request;此命令独立运行它(例如,在 CI 中)。

选项:

参数类型描述
—平台string目标平台:ios 或 android(必填)
—路径string项目目录路径(默认:当前目录)
-astringAPI用于链接到您的帐户
—android-风味stringAndroid:构建将使用的产品风味
—ios-分发stringiOS:用于验证的分发模式
—jsonboolean输出机器可读的JSON报告
—警告时退出boolean在 CI 中当发现警告时退出 (非零)
—忽略致命boolean诊断模式:报告所有内容但总是退出 0
—详细boolean启用详细输出和详细日志
—超级主机string自定义 Supabase 主机 URL(用于自主托管或 Capgo 开发)
—超级匿名string自定义 Supabase 匿名密钥(用于自主托管)

🔹 最后输出

标题: 🔹 最后输出
终端窗口
npx @capgo/cli@latest build last-output

读取由前一次构建输出记录写入的构建输出 build request --output-record. 默认打印完整的 JSON,使用 —field 打印单个字段,或者使用 —qr 打印 ASCII QR code。在 CI 中有用,用于获取下载 URL 或 QR 并将其发送回 PR 或问题。 示例: npx @capgo/cli build last-output —path /tmp/build.json npx @capgo/cli build last-output —path /tmp/build.json —field outputUrl npx @capgo/cli build last-output —path /tmp/build.json —qr

选项

参数类型描述
—pathstring写入 —output-record 后的 JSON 记录路径(必填)
—fieldstring打印单个字段(可选:jobId、appId、platform、buildMode、status、outputUrl、qrCodeAscii、qrCodePngPath、finishedAt、schemaVersion)
—二维码booleanPrint the rendered ASCII QR code (shortcut for —field qrCodeAscii)

管理本地机器存储的构建凭证。 🔒 安全性:

别名: asc-key

终端窗口
npx @capgo/cli@latest build credentials apple-key

Create an App Store Connect team API key with a guided macOS helper (macOS only). Opens a native window that walks you through Apple’s App Store Connect UI in an embedded browser, auto-captures the Issuer ID + Key ID, intercepts the one-time .p8, validates it against Apple, and saves it to ~/.appstoreconnect/private_keys. Progress statistics are forwarded to Capgo analytics (disable with CAPGO_DISABLE_TELEMETRY). npx @capgo/cli build credentials apple-key —appId com.example.app

打开一个本机窗口,带您通过 Apple 的 App Store Connect UI 在嵌入式浏览器中进行引导式操作,自动捕获 Issuer ID + Key ID,拦截一次性 .p8,验证它与 Apple 并将其保存到 ~/.appstoreconnect/private_keys 中。进度统计信息将传递到 __CAPGO_KEEP_1__ 分析 (通过 __CAPGO_KEEP_2___DISABLE_TELEMETRY 禁用)。npx @__CAPGO_KEEP_3__/__CAPGO_KEEP_4__ 构建凭据 apple-key —appId com.example.app

示例:
Example:

复制到剪贴板

选项:参数:描述
-astringAPI key to link to your account
—appIdstring将捕获的密钥保存到此应用的iOS构建凭据中
—localboolean将密钥保存到项目级别的 .capgo-credentials.json 文件而不是全局文件
—jsonboolean以 JSON 格式打印捕获的 Key ID / Issuer ID / .p8 路径

🔹 保存

标题: 保存
终端窗口
npx @capgo/cli@latest build credentials save

保存 iOS 或 Android 的构建凭据。 凭据存储在:

  • ~/.capgo-凭据/凭据.json (默认,全球)
  • .capgo-凭据.json 在项目根目录 (带有 —local 标志) ⚠️ 必须在构建之前保存凭据。 🔒 这些凭据永远不会在 Capgo 服务器上永久存储。 它们在构建完成后立即删除。 📚 配置指南: iOS: https://capgo.app/docs/cli/cloud-build/ios/ Android: https://capgo.app/docs/cli/cloud-build/android/ npx @capgo/cli build credentials save —platform ios
    —证书 ./cert.p12 —p12密码 “password”
    —iOS 配置文件 ./profile.mobileprovision
    —apple-key ./AuthKey.p8 —apple-key-id “KEY123”
    —apple-issuer-id “issuer-uuid” —apple-team-id “team-id” 多目标示例(app + 小部件扩展): npx @capgo/cli build credentials save —platform ios
    —ios-配置文件 ./App.mobileprovision
    —ios-配置文件 com.example.widget=./Widget.mobileprovision
    … npx @capgo/cli build credentials save —platform android
    —keystore ./release.keystore —keystore-alias “my-key”
    —keystore-key-password “key-pass”
    —play-config ./service-account.json 本地存储 (每个项目): npx @capgo/cli build credentials save —local —platform ios …

示例:

终端窗口
iOS Example:

选项:

参数类型描述
—appIdstring应用 ID (例如,com.example.app) (必填)
—平台string平台:ios 或 android (必填)
—证书stringiOS:.p12 证书文件路径
—ios-签名配置stringiOS:签名配置文件路径或 bundleId=path (可重复)
—p12-密码stringiOS:证书密码 (如果证书没有密码,则可选)
—apple-keystringiOS: App Store Connect API 证书路径
—apple-key-idstringiOS: App Store Connect API Key ID
—apple-issuer-idstringiOS: App Store Connect Issuer ID
—apple-team-idstringiOS: App Store Connect Team ID
—ios-distributionstringiOS: 分发模式
—apple-idstringiOS: App Store Connect API Key 的 Apple ID邮箱(App Store Connect 证书替代)
—apple-app-specific-passwordstringiOS: App-specific password (xxxx-xxxx-xxxx-xxxx) for TestFlight uploads
—apple-app-idstringiOS: 笔给 App Store Connect app id (上为 —apple-id 和 —apple-app-specific-password)
—keystorestring中国: 路dbf为为存适器的路dbf器主 (.keystore 或 .jks)
—keystore-aliasstring中国: 路d为存适器的路dbf器为名
—keystore-key-passwordstring中国: 路d为存适器的路dbf器密当输入密
—keystore-store-passwordstring中国: 路d为存适器的路dbf器床存密当输入密
—play-configstringAndroid: 到 Google Play 商店服务账户 JSON 文件的路径
—android-flavorstringAndroid: 产品风味来构建 (例如生产). 如果您的项目有多个风味,则必填
—in-app-update-prioritystringAndroid: Google Play 内购更新优先级 (整数 0–5; 更高 = 更紧急). 省略以保持 Play 的现有值不变
—localboolean将凭据保存到项目根目录的 .capgo-credentials.json 文件而不是全局 ~/.capgo-credentials/
—output-uploadboolean将构建输出 (IPA/APK/AAB) 上传到 Capgo 存储并打印下载链接
—no-output-uploadboolean不要将构建输出 (IPA/APK/AAB) 上传到 Capgo 存储
—output-retentionstring输出链接有效期:1小时至7天(默认:1小时)。示例:1小时,6小时,2天
—跳过构建号码升级boolean跳过自动构建号码/版本 code 增加于未来构建
—不跳过构建号码升级boolean恢复自动构建号码增量(默认行为)
—跳过市场版本号码升级boolean跳过自动市场版本号码升级于未来构建时,应用已发布
—不跳过市场版本号码升级boolean恢复自动市场版本号码升级(默认行为)

📋 列表

标题:列表
终端窗口
npx @capgo/cli@latest build credentials list

列表保存的构建凭据(密码被掩码). 显示当前保存的凭据(包括全局和本地凭据). 示例: npx @capgo/cli build credentials list # 列出所有应用 npx @capgo/cli build credentials list —appId com.example.app # 列出特定应用

选项:

参数类型描述
—appIdstring要列出的应用 ID(可选,若省略则列出所有)
—localboolean仅列出本地 .capgo-credentials.json 文件中的凭据
Terminal 窗口
npx @capgo/cli@latest build credentials clear

清除保存的构建凭据。 从存储中删除凭据。 使用 —appId 和 —platform 来目标特定的凭据。 示例: npx @capgo/cli build credentials clear # 清除所有应用(全局) npx @capgo/cli build credentials clear —local # 清除本地凭据 npx @capgo/cli build credentials clear —appId com.example.app —platform ios

选项:

参数类型描述
—appIdstring要清除的应用 ID(可选,清除所有应用时省略)
—platformstring要清除的平台:ios 或 android(可选,清除所有平台时省略)
—localboolean清除本地 .capgo-credentials.json 代替全局
终端窗口
npx @capgo/cli@latest build credentials update

仅更新特定凭据而不需要再次提供所有凭据。 更新现有凭据仅需提供您要修改的字段。 平台将自动检测您提供的选项。 示例: npx @capgo/cli build credentials update —ios-provisioning-profile ./new-profile.mobileprovision npx @capgo/cli build credentials update —local —keystore ./new-keystore.jks

选项:

参数类型描述
—appIdstring应用 ID(如果省略则从 capacitor.config 自动检测)
—平台string平台:ios 或 android(自动检测选项)
—本地boolean更新本地 .capgo-credentials.json 代替全局
—证书stringP12 证书文件路径
—ios 配置文件string配置文件路径或 bundleId=path(可重复,按需添加)
—覆盖 ios 配置文件映射boolean覆盖整个配置文件映射代替合并(默认:合并)
—p12 密码stringP12 证书密码
—apple-keystringApp Store Connect API key (.p8 文件)
—apple-key-idstringApp Store Connect API Key ID
—apple-issuer-idstringApp Store Connect Issuer ID
—apple-team-idstringApp Store Connect Team ID
—apple-idstringiOS: App Store Connect API key 的 Apple ID 邮箱(用于替代 App Store Connect API key)
—apple-app-specific-passwordstringiOS: TestFlight 上传的 App 专用密码(xxxx-xxxx-xxxx-xxxx)
—apple-app-idstringiOS: 必须与 —apple-id 和 —apple-app-specific-password 一起使用的 App Store Connect 应用程序 ID (数字)
—ios-distributionstringiOS: 分发模式
—keystorestring.keystore 或 .jks 文件的密钥库路径
—keystore-aliasstring密钥库密钥别名
—keystore-key-passwordstring密钥库密钥密码
—keystore-store-passwordstring密钥库存储密码
—play-configstringGoogle Play 服务账户 JSON 路径
—android-flavorstringAndroid: 产品风味(例如生产)。如果您的项目有多个风味,则必填。
—in-app-update-prioritystringAndroid: Google Play 内购更新优先级(整数 0–5;更高 = 更紧急)
—output-uploadboolean将构建输出(IPA/APK/AAB)上传到 Capgo 存储并打印下载链接
—no-output-uploadboolean不上传构建输出(IPA/APK/AAB)到 Capgo 存储
—output-retentionstring输出链接有效期:1小时至7天。示例:1小时,6小时,2天
—跳过构建号增加boolean跳过自动构建号/版本 code 增加
—不跳过构建号增加boolean重新启用自动构建号增加(默认行为)
—跳过市场版本增加boolean跳过自动市场版本增加(当应用已发布时,未来构建)
—不跳过市场版本增加boolean重新启用自动市场版本增加(默认行为)
终端窗口
npx @capgo/cli@latest build credentials manage

交互式管理保存的构建凭证。 浏览存储的凭证,查看已配置的内容,导出一个CI/CD准备好的.env文件, 或删除一个平台的凭证。重用相同的TUI。 示例: npx @__CAPGO_KEEP_0__/__CAPGO_KEEP_1__ build credentials manage npx @__CAPGO_KEEP_2__/__CAPGO_KEEP_3__ build credentials manage —appId com.example.app npx @__CAPGO_KEEP_4__/__CAPGO_KEEP_5__ build credentials manage —appId com.example.app —platform ios npx @__CAPGO_KEEP_6__/__CAPGO_KEEP_7__ build credentials manage —local capgo init. Examples: npx @capgo/cli build credentials manage npx @capgo/cli build credentials manage —appId com.example.app npx @capgo/cli build credentials manage —appId com.example.app —platform ios npx @capgo/cli build credentials manage —local

参数

类型描述—appId
要管理的应用 ID(可选,若省略则会提示选择)string—platform
要管理的平台:ios 或 android(可选,若省略则会提示选择)string—local
仅浏览本地 .__CAPGO_KEEP_0__-credentials.jsonbooleanOnly browse local .capgo-credentials.json

🔹 迁移

标题:迁移
终端窗口
npx @capgo/cli@latest build credentials migrate

将遗留的配置文件迁移到新的多目标格式。 将BUILD_PROVISION_PROFILE_BASE64转换为CAPGO_IOS_PROVISIONING_MAP。 自动从您的Xcode项目中发现主包ID。 npx @capgo/cli build credentials migrate —platform ios

示例:

终端窗口
Example:

选项:

参数类型描述
—appIdstring应用ID(如果省略,会自动从capacitor.config中检测)
—platformstring仅支持ios平台
—localboolean从本地.capgo-credentials.json迁移而不是全局