capawesome-cli
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCapawesome CLI
Capawesome CLI
Install, configure, and use the Capawesome CLI () for authentication, project linking, command execution, and CI/CD integration.
@capawesome/cli安装、配置并使用Capawesome CLI()完成认证、项目关联、命令执行和CI/CD集成工作。
@capawesome/cliPrerequisites
前置要求
- Node.js (v18 or later) and npm installed.
- A Capawesome Cloud account and organization.
- 已安装Node.js(v18及以上版本)和npm。
- 拥有Capawesome Cloud账号和所属组织。
General Rules
通用规则
Before running any command for the first time, run it with the flag to review all available options.
@capawesome/cli--help首次运行任意命令前,请添加参数运行,查看所有可用选项。
@capawesome/cli--helpProcedures
操作步骤
Step 1: Install the CLI
步骤1:安装CLI
Install globally:
bash
npm install -g @capawesome/cli@latestAlternatively, use to run commands without global installation:
npxbash
npx @capawesome/cli <command>Verify the installation:
bash
npx @capawesome/cli doctorThe command prints environment and CLI diagnostic information.
doctor全局安装:
bash
npm install -g @capawesome/cli@latest或者无需全局安装,直接使用运行命令:
npxbash
npx @capawesome/cli <command>验证安装是否成功:
bash
npx @capawesome/cli doctordoctorStep 2: Authenticate
步骤2:身份认证
Interactive Login (Local Development)
交互式登录(本地开发场景)
bash
npx @capawesome/cli loginThis opens a browser-based authentication flow. After completing the flow, the CLI stores the session locally.
bash
npx @capawesome/cli login执行后会打开浏览器端认证流程,流程完成后CLI会在本地存储会话信息。
Token-Based Login (CI/CD)
Token登录(CI/CD场景)
- Generate a token in the Capawesome Cloud Console under Settings > Tokens.
- Authenticate using the token:
bash
npx @capawesome/cli login --token <TOKEN>- 在Capawesome Cloud控制台的设置 > Token页面生成Token。
- 使用Token完成认证:
bash
npx @capawesome/cli login --token <TOKEN>Verify Session
验证会话状态
bash
npx @capawesome/cli whoamibash
npx @capawesome/cli whoamiLog Out
退出登录
bash
npx @capawesome/cli logoutbash
npx @capawesome/cli logoutStep 3: Create or Select an App
步骤3:创建或选择应用
Skip if the user already has a Capawesome Cloud app ID.
Create a new app:
bash
npx @capawesome/cli apps:create --name "My App" --organization-id <ORGANIZATION_ID>The CLI outputs the app ID (UUID). Save it for subsequent commands.
如果用户已有Capawesome Cloud应用ID,可跳过本步骤。
创建新应用:
bash
npx @capawesome/cli apps:create --name "My App" --organization-id <ORGANIZATION_ID>CLI会输出应用ID(UUID格式),请妥善保存供后续命令使用。
Step 4: Link a Project (Optional)
步骤4:关联项目(可选)
Skip for standard project setups where the app is in the repo root and uses + .
npm installnpm run buildFor monorepos, subdirectory apps, or custom build commands, create in the project root:
capawesome.config.jsonjson
{
"cloud": {
"apps": [
{
"appId": "<APP_ID>",
"baseDir": "apps/my-app",
"dependencyInstallCommand": "npm install",
"webBuildCommand": "npm run build"
}
]
}
}Read for all configuration options including monorepo, pnpm, and Yarn setups.
references/project-configuration.md如果是标准项目配置(应用位于仓库根目录,使用 + 命令),可跳过本步骤。
npm installnpm run build如果是单仓多包(monorepo)、应用位于子目录,或者使用自定义构建命令,请在项目根目录创建文件:
capawesome.config.jsonjson
{
"cloud": {
"apps": [
{
"appId": "<APP_ID>",
"baseDir": "apps/my-app",
"dependencyInstallCommand": "npm install",
"webBuildCommand": "npm run build"
}
]
}
}查看文件了解所有配置选项,包括单仓多包、pnpm和Yarn环境的配置方法。
references/project-configuration.mdStep 5: Run CLI Commands
步骤5:运行CLI命令
Read for the full command reference organized by category:
references/commands.md- Authentication — ,
login,logoutwhoami - App Management — ,
apps:createapps:delete - Build Commands — ,
apps:builds:create,apps:builds:cancel,apps:builds:downloadapps:builds:logs - Certificate Commands — ,
apps:certificates:create,apps:certificates:list,apps:certificates:get,apps:certificates:updateapps:certificates:delete - Environment Commands — ,
apps:environments:create,apps:environments:list,apps:environments:set,apps:environments:unsetapps:environments:delete - Channel Commands — ,
apps:channels:create,apps:channels:delete,apps:channels:get,apps:channels:list,apps:channels:pause,apps:channels:resumeapps:channels:update - Live Update Commands — ,
apps:liveupdates:upload,apps:liveupdates:register,apps:liveupdates:bundle,apps:liveupdates:generatemanifest,apps:liveupdates:generatesigningkey,apps:liveupdates:rollback,apps:liveupdates:rolloutapps:liveupdates:setnativeversions - Deployment Commands — ,
apps:deployments:create,apps:deployments:cancelapps:deployments:logs - Destination Commands — ,
apps:destinations:create,apps:destinations:list,apps:destinations:get,apps:destinations:updateapps:destinations:delete - Device Commands — ,
apps:devices:delete,apps:devices:forcechannel,apps:devices:unforcechannelapps:devices:probe - Organization Commands —
organizations:create - Utility —
doctor
查看文件获取按类别整理的完整命令参考:
references/commands.md- 认证 — ,
login,logoutwhoami - 应用管理 — ,
apps:createapps:delete - 构建命令 — ,
apps:builds:create,apps:builds:cancel,apps:builds:downloadapps:builds:logs - 证书命令 — ,
apps:certificates:create,apps:certificates:list,apps:certificates:get,apps:certificates:updateapps:certificates:delete - 环境变量命令 — ,
apps:environments:create,apps:environments:list,apps:environments:set,apps:environments:unsetapps:environments:delete - 渠道命令 — ,
apps:channels:create,apps:channels:delete,apps:channels:get,apps:channels:list,apps:channels:pause,apps:channels:resumeapps:channels:update - 热更新命令 — ,
apps:liveupdates:upload,apps:liveupdates:register,apps:liveupdates:bundle,apps:liveupdates:generatemanifest,apps:liveupdates:generatesigningkey,apps:liveupdates:rollback,apps:liveupdates:rolloutapps:liveupdates:setnativeversions - 部署命令 — ,
apps:deployments:create,apps:deployments:cancelapps:deployments:logs - 目标端命令 — ,
apps:destinations:create,apps:destinations:list,apps:destinations:get,apps:destinations:updateapps:destinations:delete - 设备命令 — ,
apps:devices:delete,apps:devices:forcechannel,apps:devices:unforcechannelapps:devices:probe - 组织命令 —
organizations:create - 工具类 —
doctor
Step 6: Set Up CI/CD Integration (Optional)
步骤6:配置CI/CD集成(可选)
Skip unless the user wants to run CLI commands in a CI/CD pipeline.
Read for the full CI/CD setup procedure covering:
references/ci-cd-integration.md- Token-based authentication
- Non-blocking builds with
--detached - Machine-readable output with
--json - Skipping confirmation prompts with
--yes - Example workflows for GitHub Actions and other CI platforms
除非用户需要在CI/CD流水线中运行CLI命令,否则可跳过本步骤。
查看文件获取完整的CI/CD配置流程,覆盖以下内容:
references/ci-cd-integration.md- 基于Token的认证
- 使用参数实现非阻塞构建
--detached - 使用参数输出机器可读格式结果
--json - 使用参数跳过确认提示
--yes - GitHub Actions和其他CI平台的示例工作流
Error Handling
错误处理
- — The CLI is not installed globally. Either install with
command not found: @capawesome/clior prefix commands withnpm install -g @capawesome/cli@latest.npx - Authentication errors / — Re-run
Not authenticated. For CI/CD, verify the token is valid and not expired.npx @capawesome/cli login - returns unexpected user — Log out with
whoamiand log in again with the correct account.npx @capawesome/cli logout - Command fails with missing options — Run the command with to see all required and optional flags.
--help - reports issues — Follow the diagnostic output to resolve environment problems (Node.js version, npm version, CLI version).
doctor - not detected — Ensure the file is in the project root directory (same level as
capawesome.config.json). Verify the JSON is valid.package.json
- — CLI未全局安装。可以执行
command not found: @capawesome/cli全局安装,或者在命令前添加npm install -g @capawesome/cli@latest前缀运行。npx - 认证错误 / — 重新执行
Not authenticated。如果是CI/CD场景,请验证Token有效且未过期。npx @capawesome/cli login - 返回非预期用户 — 执行
whoami退出登录,再使用正确账号重新登录。npx @capawesome/cli logout - 命令因缺少参数执行失败 — 添加参数运行命令,查看所有必填和可选参数。
--help - 命令报告问题 — 按照诊断输出解决环境问题(Node.js版本、npm版本、CLI版本)。
doctor - 未检测到— 确认文件位于项目根目录(和
capawesome.config.json同级),并验证JSON格式合法。package.json
Related Skills
相关技能
- — For setting up and using Capawesome Cloud features (native builds, live updates, app store publishing). Uses the CLI as a tool but covers the full workflow.
capawesome-cloud - — For installing and configuring Capacitor plugins, including the
capacitor-pluginsplugin.@capawesome/capacitor-live-update
- — 用于配置和使用Capawesome Cloud功能(原生构建、热更新、应用商店发布)。该技能以CLI为工具,但覆盖完整工作流。
capawesome-cloud - — 用于安装和配置Capacitor插件,包括
capacitor-plugins插件。@capawesome/capacitor-live-update