跳过内容

🔹 构建

🏗️ 通过 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

通过 --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
终端窗口
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 key to link to your account
-cstring与CapacitorUpdater.defaultChannel或公共默认频道进行比较的频道
—package-jsonstring多包仓库的package.json文件路径(逗号分隔)
—node-modulesstring多包仓库的node_modules目录路径(逗号分隔)
—verboseboolean启用详细日志的verbose输出
—supa-hoststring自主托管或开发环境下的自定义Supabase主机URL(Capgo)
—supa-anonstring自主托管下的自定义Supabase匿名密钥

🚀 Init

🚀 Init

别名: onboarding

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

交互式设置构建凭证(iOS:自动化证书和配置文件;Android:自动化keystore和Google OAuth并为GCP服务帐户和Play Console发送邀请)

选项:

参数类型描述
-astringAPI key to link to your account
-pstring平台 (ios 或 android) 用于 onboard。如果省略,会自动检测当只有一个本机文件夹存在时;否则会提示。
—supa-hoststring自定义 Supabase 主机 URL(用于自主托管或 Capgo 开发)
—no-analyticsboolean禁用此次运行的构建 onboard 分析和终端重放
终端窗口
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构建模式:debug 或 release(默认:release)
—build-certificate-base64stringiOS:Base64编码的.p12证书
—p12-passwordstringiOS: 证书密码 (如果证书没有密码则可选)
__CAPGO_KEEP_0__stringiOS: 应用专用密码上传(App Store Connect API key 的替代方案)
__CAPGO_KEEP_0__stringiOS: TestFlight 上传的应用专用密码(xxxx-xxxx-xxxx-xxxx)
__CAPGO_KEEP_0__stringiOS: App Store Connect 应用 ID(数字,需要与 —apple-id 和 —apple-app-specific-password 一起使用)
__CAPGO_KEEP_0__stringiOS: App Store Connect API Key ID
__CAPGO_KEEP_0__stringiOS: App Store Connect 发行者 ID
__CAPGO_KEEP_0__stringiOS: Base64-encoded App Store Connect API key (.p8)
—苹果商店连接团队IDstringiOS: 苹果商店连接团队ID
—iOS构建方案stringiOS: Xcode 构建方案(默认:App)
—iOS读取构建设置的Xcode目标(默认:同构建方案)string—iOS发布模式
iOS: 发行模式string—iOS签名配置文件
iOS: 签名配置文件路径或bundleId=path映射(可重复)string—安卓keystore文件
—安卓keystore文件string安卓:使用Base64编码的keystore文件
—keystore-key-aliasstring安卓: 密钥库密钥别名
—密钥库密钥密码string安卓: 密钥库密钥密码
密钥库存储密码string安卓: 密钥库存储密码
—play-config-jsonstring安卓: 基于Base64的Google Play服务账户JSON
—安卓版本stringAndroid: 产品风味用于构建(例如生产环境)。如果您的项目有多个风味,则必填。
应用内更新优先级stringAndroid: 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上传后,将该应用程序的商店发布提交审查,而不是将其留作草稿/未激活的构建。Android标记Play发布完成;iOS将处理后的TestFlight构建提交到App Store审查。
—store-release-namestring商店发布名称/版本标签。Android将其发送为Google Play的version_name;iOS在创建或重用可编辑版本时使用它作为App Store的版本。
—store-release-notesstring默认商店发布说明。Android使用此作为Play的更改日志;iOS使用它作为App Store的fallback What’s New文本。
—store-release-notes-localestring本地化商店发行说明(可重复),例如 —store-release-notes-locale en-US=“Bug fixes” —store-release-notes-locale fr-FR=“Corrections”。
—ios-testflight-groupsstringiOS:可选的,逗号分隔的TestFlight外部组名称或ID,用于外部beta分发。
—ios-automatic-releasebooleaniOS:在Apple批准后自动发布App Store版本。默认为手动发布。
—no-ios-automatic-releasebooleaniOS:在Apple批准后保持App Store版本等待手动发布。
—output-uploadboolean仅此次构建覆盖输出上传行为(启用)。优先级:CLI > env > 保存的凭据
—no-output-uploadboolean仅此次构建覆盖输出上传行为(禁用)。优先级:CLI > env > 保存的凭据
—output-retentionstringOverride 本次构建的输出链接 TTL(1小时到7天)。示例:1小时,6小时,2天。优先级:CLI > env > 保存的凭据
—output-recordstring在构建成功后,写入一个 JSON 记录(jobId,状态,输出 URL,QR 码 ASCII,QR 码 PNG 路径,完成时间)到一个路径。一个 PNG QR code 也会写入到该路径旁边,带有后缀。读取字段回 code .qr.png —no-skip-build-number-bump build last-output.
覆盖保存的凭据,以便重新启用本次构建的自动构建号递增功能。boolean—skip-marketing-version-bump
在应用程序已经发布时,跳过自动的市场版本(CFBundleShortVersionString / versionName)递增。boolean—sync-ios-version
iOS:在上传项目之前,同步 Xcode MARKETING_VERSION 从 package.json。boolean—ai-analytics
在构建失败时,发送日志到 __CAPGO_KEEP_0__ AI 进行诊断。在交互式终端中,这会跳过前置确认;在 CI 中,这会自动上传并将分析打印到 stderr。booleanOn build failure, send logs to Capgo AI for diagnosis. In interactive terminals this skips the upfront confirmation; in CI this auto-uploads and prints the analysis to stderr.
—no-prescanboolean跳过自动预构建扫描
—prescan-ignore-fatalboolean在预构建扫描时不阻塞构建(仅报告)
—fail-on-warningsboolean将预构建扫描警告视为致命错误
—send-logs-to-supportboolean在CI/CD构建失败时,自动将构建日志上传到Capgo支持(无需电子邮件)。Capgo支持将收到通知并通过电子邮件跟进。—ai-analytics可添加。
—send-logsboolean—send-logs-to-support的过时别名
-astringAPI账户链接密钥
—supa-hoststring自定义 Supabase 主机 URL(用于自主托管或 Capgo 开发)
—supa-anonstring自定义 Supabase 匿名密钥(用于自主托管)
—verboseboolean启用详细日志的verbose输出

🔹 Sync-ios-version

🔹 同步 iOS 版本
终端窗口
npx @capgo/cli@latest build sync-ios-version

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

示例:

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

选项:

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

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

选项:

参数类型描述
—平台string目标平台:ios或android(必填)
—路径string项目目录的路径(默认:当前目录)
-astringAPI key to link to your account
—android-flavorstring中国:分类类事为导航帮内定一个用
—ios-diststring欢迎中国:充给帮内定一个用
—jsonboolean编程为机器给笔计一个给笔计给
—fail-on-warningsboolean发起一为不常用的回答。发起一为不常用的回答
—ignore-fatalboolean给笔事为给笔事。给笔事一为给笔事一为给笔事
—verboseboolean详细日志输出
—supa-hoststring自建或开发环境时的 Supabase 主机 URL(Capgo)
—supa-anonstring自建 Supabase anon key(__CAPGO_KEEP_0__)

🔹 最后输出

🔹 最后输出
终端窗口
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)
—qrboolean打印渲染的 ASCII QR code(—field qrCodeAscii 的快捷方式)

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

🔹 https://__CAPGO_KEEP_0__.app/docs/__CAPGO_KEEP_1__/cloud-build/android/

Apple-key

标题: 🔹 Apple-key asc-key

别名:
npx @capgo/cli@latest build credentials apple-key

创建一个 App Store Connect 团队 API 密钥,使用一个带指引的 macOS 助手(仅限 macOS)。 打开一个本地窗口,带你走过 Apple 的 App Store Connect UI 在嵌入式浏览器中,自动捕获 Issuer ID + Key ID,拦截一次性的 .p8,验证它与 Apple,保存到 ~/.appstoreconnect/private_keys 中。 进度统计信息将发送到 Capgo 分析 (使用 CAPGO_DISABLE_TELEMETRY 禁用)。 npx @capgo/cli 构建凭证 apple-key —appId com.example.app

示例:

终端窗口
Example:

选项:

参数类型描述
-astringAPI 密钥,用于连接您的帐户
—appIdstring将捕获的密钥保存到此应用iOS构建凭据中
—localboolean将凭据保存到项目根目录下的 .capgo-credentials.json 文件中而不是全局文件
—jsonboolean以JSON格式打印捕获的Key ID / Issuer ID / .p8路径
终端窗口
npx @capgo/cli@latest build credentials save

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

  • ~/.capgo-credentials/credentials.json (默认,全球)
  • .capgo-credentials.json 在项目根目录 (使用 —local 标志) ⚠️ 必须在请求构建之前保存凭据。 🔒 这些凭据永远不会在 Capgo 服务器上永久存储。 它们在构建完成后立即删除。 📚 配置指南: iOS: https://capgo.app/docs/cli/cloud-build/ios/ 安卓: https://capgo.app/docs/cli/cloud-build/android/ npx @capgo/cli build credentials save —platform ios
    —certificate ./cert.p12 —p12-password “password”
    —ios-provisioning-profile ./profile.mobileprovision
    —apple-key ./AuthKey.p8 —apple-key-id “KEY123”
    —apple-issuer-id “issuer-uuid” —apple-team-id “team-id” Multi-target Example (app + widget extension): npx @capgo/cli build credentials save —platform ios
    多目标示例(app + 小部件扩展):
    npx @__CAPGO_KEEP_0__/__CAPGO_KEEP_1__ build credentials save —platform ios
    … npx @capgo/cli build credentials save —platform android
    —ios-provisioning-profile com.example.widget=./Widget.mobileprovision、…
    —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: 证书密码 (如果证书没有密码则可选)
—苹果密钥stringiOS: .p8 App Store Connect API 密钥路径
—苹果密钥 IDstringiOS: App Store Connect API 密钥 ID
—苹果发行者 IDstringiOS: App Store Connect 发行者 ID
__CAPGO_KEEP_0__stringiOS: App Store Connect 团队 ID
—ios-distributionstringiOS: 分发模式
—apple-idstringiOS: App Store Connect Apple ID 电子邮件(替代 API 密钥)
—apple-app-specific-passwordstringiOS: TestFlight 上传所需的 App 专用密码(xxxx-xxxx-xxxx-xxxx)
—apple-app-idstringiOS: App Store Connect 应用程序 ID(数字)
—keystorestringAndroid: 导入.keystore或.jks文件的路径
__CAPGO_KEEP_0__stringAndroid: 导入.keystore或.jks文件的别名
__CAPGO_KEEP_0__stringAndroid: 导入.keystore或.jks文件的密码
__CAPGO_KEEP_0__stringAndroid: 导入.keystore或.jks文件的存储密码
__CAPGO_KEEP_0__stringAndroid: 导入Google Play服务账户JSON文件的路径
__CAPGO_KEEP_0__stringAndroid: 构建的产品风味(例如生产环境)
__CAPGO_KEEP_0__stringAndroid: Google Play 在-app 更新优先级(整数 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天。
—skip-build-number-bumpboolean跳过自动构建号/版本 code 自动递增功能
—no-skip-build-number-bumpboolean重新启用自动构建号递增 (默认行为)
—skip-marketing-version-bumpboolean在应用已发布时,跳过未来构建的自动营销版本号更新
—no-skip-marketing-version-bumpboolean重新启用自动营销版本号更新 (默认行为)
终端窗口
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 中列出凭据

🔹 清除

终端窗口
复制到剪贴板
npx @capgo/cli@latest build credentials clear

Clear saved build credentials. Remove credentials from storage. Use —appId and —platform to target specific credentials. Examples: npx @capgo/cli build credentials clear # Clear all apps (global) npx @capgo/cli build credentials clear —local # Clear local credentials npx @capgo/cli build credentials clear —appId com.example.app —platform ios

Terminal window

参数类型描述
—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 自动检测)
—platformstring平台:ios 或 android(根据选项自动检测)
—localboolean更新本地 .capgo-credentials.json 代替全局
—证书stringP12证书文件路径
—ios-分发配置string分发配置文件路径或bundleId=path (可重复, 默认为追加)
—覆盖ios-分发映射boolean覆盖整个分发映射而不是合并 (默认: 合并)
—p12-密码stringP12证书密码
—苹果密钥stringApp Store Connect API 密钥 (.p8 文件)路径
—苹果密钥IDstringApp Store Connect API 密钥 ID
—apple-issuer-idstringApp Store Connect 发行者 ID
—apple-team-idstringApp Store Connect 团队 ID
—apple-idstringiOS: App Store Connect 应用程序专用密码上传的电子邮件 (替代 App Store Connect API 密钥)
—apple-app-specific-passwordstringiOS: TestFlight 上传的应用程序专用密码 (xxxx-xxxx-xxxx-xxxx)
—apple-app-idstringiOS: App Store Connect 应用程序 ID (与 —apple-id 和 —apple-app-specific-password 一起使用)
—ios-distributionstringiOS: 分发模式
—密钥库string密钥库文件路径 (.keystore 或 .jks)
—密钥库别名string密钥库密钥别名
—密钥库密钥密码string密钥库密钥密码
—密钥库存储密码string密钥库存储密码
—Google Play 配置stringGoogle Play 服务账户 JSON 文件路径
—Android 风味stringAndroid: 构建的产品风味 (例如生产). 如果您的项目有多个风味,则必填.
—in-app-update-prioritystringAndroid: Google Play 在-app 更新优先级 (整数 0–5; 更高 = 更紧急)
—output-uploadboolean上传构建输出 (IPA/APK/AAB) 到 Capgo 存储并打印下载链接
—no-output-uploadboolean不上传构建输出 (IPA/APK/AAB) 到 Capgo 存储
—output-retentionstring输出链接 TTL: 1h 到 7d。示例:1h,6h,2d
—skip-build-number-bumpboolean跳过自动构建号/版本 code 自动递增
—no-skip-build-number-bumpboolean重新启用自动构建号递增(默认行为)
—跳过市场版本更新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

参数:

Param类型描述
—appIdstring用于管理的 App ID(可选,若省略则会提示选择)
—platformstring要管理的平台:ios 或 android(可选,若省略则会提示选择)
—localboolean仅浏览本地 .capgo-credentials.json

🔹 迁移

终端窗口
复制到剪贴板
npx @capgo/cli@latest build credentials migrate

Migrate legacy provisioning profile to the new multi-target format. 将BUILD_PROVISION_PROFILE_BASE64转换为CAPGO_IOS_PROVISIONING_MAP。 自动从您的Xcode项目中发现主bundle ID。 npx @capgo/cli build credentials migrate —platform ios

示例:

终端窗口
Example:

选项:

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