hot-updater

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Hot Updater CLI

Hot Updater CLI

Use this skill when a task involves Hot Updater's CLI,
hot-updater.config.ts
, React Native OTA deployment, patch artifacts, bundle operations, rollback, release-channel management, code signing keys, database migration, fingerprints, or diagnostics.
当任务涉及Hot Updater的CLI、
hot-updater.config.ts
、React Native OTA部署、补丁制品、包操作、回滚、发布渠道管理、代码签名密钥、数据库迁移、指纹或诊断时,可使用此技能。

Operating Rules

操作规则

  • Start from the project root unless the user specifies another app directory.
  • Read local
    hot-updater.config.ts
    before assuming provider behavior.
  • Use
    npx hot-updater ...
    for CLI examples and user-facing instructions.
  • Do not run
    npx hot-updater init
    on behalf of the user. It is interactive and asks for provider, build, and project-specific choices. Guide the user to run it directly and follow the setup documentation.
  • Before running
    npx hot-updater doctor
    for a server/infrastructure check, make sure the server base URL is available. If the user did not provide it and it is not obvious from local config, ask for the update server URL first.
  • For doctor repair loops, run
    npx hot-updater doctor --json
    first. Fix issues marked
    fixability: "auto"
    by editing local project files, run the listed
    commands
    for issues marked
    fixability: "command"
    , and rerun doctor after each focused change. Stop when doctor passes or the remaining issues are marked
    fixability: "blocked"
    .
  • Treat
    fixability: "blocked"
    as outside the autonomous local loop. Server infrastructure remediation commonly needs provider credentials, environment variables, and redeploy access; summarize the blocker instead of running migrations or mutating provider setup.
  • Treat
    deploy
    ,
    patch
    ,
    bundle enable
    ,
    bundle disable
    ,
    bundle update
    ,
    bundle delete
    ,
    bundle promote
    ,
    rollback
    ,
    channel set
    ,
    keys export-public
    ,
    keys remove
    , and
    db migrate
    as state-changing operations.
  • Treat
    keys generate
    and
    db generate
    as local file/artifact writing operations.
  • Use
    --json
    only with commands documented here as supporting it. For mutating commands,
    --json
    only changes the output format after the requested mutation has already been authorized. If a target project uses an older CLI without that option, fall back to the human-readable output.
  • For non-interactive shells, use
    -y
    only when the user already requested the exact mutation and the target is unambiguous.
  • After mutating bundle state, verify with
    bundle list
    or the relevant provider state.
  • If
    deploy
    fails, stop the deploy workflow. Do not keep retrying fixes, edit setup, change credentials, install dependencies, or run migrations unless the user explicitly asks for that follow-up. Analyze only the failed command, relevant output, likely cause, and suggested next checks.
  • Do not edit provider credentials unless the user explicitly asks. Credentials are commonly stored in
    .env.hotupdater
    , but projects may use a different environment-loading setup.
  • 除非用户指定其他应用目录,否则从项目根目录开始操作。
  • 在假设供应商行为之前,先读取本地的
    hot-updater.config.ts
    配置文件。
  • CLI示例和面向用户的说明使用
    npx hot-updater ...
    格式。
  • 不要代用户运行
    npx hot-updater init
    命令。该命令为交互式,会询问供应商、构建和项目相关的选项。引导用户直接运行该命令并遵循设置文档操作。
  • 在运行
    npx hot-updater doctor
    进行服务器/基础设施检查之前,确保服务器基础URL可用。如果用户未提供该URL,且无法从本地配置中明确获取,先询问更新服务器URL。
  • 对于doctor修复循环,先运行
    npx hot-updater doctor --json
    。通过编辑本地项目文件修复标记为
    fixability: "auto"
    的问题,运行标记为
    fixability: "command"
    的问题对应的
    commands
    命令,每次针对性修改后重新运行doctor命令。当doctor检查通过或剩余问题标记为
    fixability: "blocked"
    时停止操作。
  • fixability: "blocked"
    视为本地自主操作范围外的问题。服务器基础设施修复通常需要供应商凭证、环境变量和重新部署权限;此时应总结阻塞问题,而非运行迁移或修改供应商设置。
  • deploy
    patch
    bundle enable
    bundle disable
    bundle update
    bundle delete
    bundle promote
    rollback
    channel set
    keys export-public
    keys remove
    db migrate
    视为状态变更操作。
  • keys generate
    db generate
    视为本地文件/制品写入操作。
  • 仅在本文档说明支持
    --json
    参数的命令中使用该参数。对于变更类命令,
    --json
    仅会在已授权请求的变更操作完成后修改输出格式。如果目标项目使用的旧版CLI不支持该选项,则回退为人类可读格式输出。
  • 对于非交互式shell,仅当用户已明确请求确切的变更操作且目标明确时,才使用
    -y
    参数。
  • 修改包状态后,使用
    bundle list
    或相关供应商状态进行验证。
  • 如果
    deploy
    命令失败,停止部署工作流。除非用户明确要求后续操作,否则不要继续尝试修复、修改设置、更改凭证、安装依赖或运行迁移。仅分析失败的命令、相关输出、可能的原因以及建议的下一步检查。
  • 除非用户明确要求,否则不要编辑供应商凭证。凭证通常存储在
    .env.hotupdater
    中,但项目可能使用不同的环境加载设置。

Natural Language Requests

自然语言请求

Users may invoke this skill with prompts such as:
txt
$hot-updater deploy using the current app version
$hot-updater deploy the current iOS app version to production
$hot-updater roll back the most recently deployed bundle
$hot-updater list iOS bundles on the production channel
$hot-updater update rollout cohort count for bundle <bundle-id> to 500
$hot-updater promote bundle <bundle-id> to staging
$hot-updater create a patch from bundle <old-id> to <new-id>
$hot-updater export the code signing public key
$hot-updater run doctor with server URL https://updates.example.com/api/check-update
$hot-updater fix local doctor issues that do not require server credentials
Translate the request into the safest CLI flow. If a state-changing request is missing a required channel, platform, bundle target, patch base, destination channel, or server URL that cannot be inferred from local context, ask one concise question before mutating anything. For deploy and patch channel, use the CLI default
production
unless the user names another channel or local context clearly indicates one.
用户可能通过以下提示调用此技能:
txt
$hot-updater deploy using the current app version
$hot-updater deploy the current iOS app version to production
$hot-updater roll back the most recently deployed bundle
$hot-updater list iOS bundles on the production channel
$hot-updater update rollout cohort count for bundle <bundle-id> to 500
$hot-updater promote bundle <bundle-id> to staging
$hot-updater create a patch from bundle <old-id> to <new-id>
$hot-updater export the code signing public key
$hot-updater run doctor with server URL https://updates.example.com/api/check-update
$hot-updater fix local doctor issues that do not require server credentials
将请求转换为最安全的CLI流程。如果状态变更请求缺少必要的渠道、平台、包目标、补丁基础包、目标渠道或无法从本地上下文推断的服务器URL,在进行任何变更前先提出一个简洁的问题。对于部署和补丁渠道,除非用户指定其他渠道或本地上下文明确指示,否则使用CLI默认的
production
渠道。

Current App Version Deploy

当前应用版本部署

When the user asks to deploy for the current app version:
  1. Run
    npx hot-updater app-version --json
    when supported; otherwise run
    npx hot-updater app-version
    .
  2. Extract
    ios
    and/or
    android
    from JSON when available, or from the human-readable output as a fallback.
  3. If the platform is missing, ask whether to deploy iOS, Android, or both.
  4. Deploy with
    -t <version>
    :
sh
npx hot-updater deploy -p ios -t <ios-app-version>
npx hot-updater deploy -p android -t <android-app-version>
If deploying both platforms, run one platform at a time and verify each result with
npx hot-updater bundle list -p <platform> --limit 5 --json
when supported, or without
--json
as a fallback.
If a deploy command fails, do not continue to the next platform or attempt an automatic repair. Report the failure analysis and wait for a new user request.
当用户要求部署当前应用版本时:
  1. 如果支持,运行
    npx hot-updater app-version --json
    ;否则运行
    npx hot-updater app-version
  2. 如果有JSON输出,从中提取
    ios
    和/或
    android
    版本;否则从人类可读输出中提取作为备选。
  3. 如果平台信息缺失,询问用户是部署iOS、Android还是两者都部署。
  4. 使用
    -t <version>
    参数进行部署:
sh
npx hot-updater deploy -p ios -t <ios-app-version>
npx hot-updater deploy -p android -t <android-app-version>
如果同时部署两个平台,一次运行一个平台的部署命令,并在支持时使用
npx hot-updater bundle list -p <platform> --limit 5 --json
验证每个结果;否则不使用
--json
参数进行验证。
如果某个部署命令失败,不要继续部署下一个平台或尝试自动修复。报告失败分析并等待用户的新请求。

Recent Bundle Rollback

最近包回滚

When the user asks to roll back the most recent deployment without naming a bundle:
  1. Run
    npx hot-updater bundle list --json --limit 10
    .
  2. Choose the most recent enabled bundle from the JSON result.
  3. Use that bundle's
    channel
    ,
    platform
    , and
    id
    for a scoped rollback:
sh
npx hot-updater rollback <channel> -p <platform> --target <bundle-id> -y
If the most recent bundle is already disabled, tell the user and ask whether to roll back the next enabled bundle. After rollback, verify with:
sh
npx hot-updater bundle list -c <channel> -p <platform> --limit 5 --json
If
--json
is unavailable, rerun the same command without
--json
.
当用户要求回滚最近部署的包但未指定包ID时:
  1. 运行
    npx hot-updater bundle list --json --limit 10
  2. 从JSON结果中选择最近启用的包。
  3. 使用该包的
    channel
    platform
    id
    进行范围回滚:
sh
npx hot-updater rollback <channel> -p <platform> --target <bundle-id> -y
如果最近的包已被禁用,告知用户并询问是否回滚下一个启用的包。回滚后,使用以下命令验证:
sh
npx hot-updater bundle list -c <channel> -p <platform> --limit 5 --json
如果不支持
--json
参数,则不带该参数重新运行相同命令。

Core Commands

核心命令

Setup and Diagnostics

设置与诊断

sh
npx hot-updater init
npx hot-updater doctor --server-base-url <update-server-url>
npx hot-updater doctor --json
npx hot-updater doctor --server-base-url <update-server-url> --json
npx hot-updater fingerprint
npx hot-updater fingerprint create
npx hot-updater app-version
npx hot-updater app-version --json
npx hot-updater console
  • init
    creates or updates project configuration. Because it is interactive, tell the user to run it directly instead of choosing answers for them.
  • doctor
    checks local setup and server health. Provide
    --server-base-url
    ; the command appends
    /version
    for the server check. If the user has not provided one, ask for it before running the command.
  • doctor --json
    is the preferred agent surface. It returns stable issue codes, related paths,
    fixability
    , and command hints for local iterative repair. Do not parse the human-readable doctor output when JSON is available.
  • fingerprint
    and
    fingerprint create
    generate the app fingerprint.
  • app-version
    reads native iOS and Android app versions.
    --json
    returns
    { "android": string | null, "ios": string | null }
    on CLIs that support it.
  • console
    opens the local management console.
sh
npx hot-updater init
npx hot-updater doctor --server-base-url <update-server-url>
npx hot-updater doctor --json
npx hot-updater doctor --server-base-url <update-server-url> --json
npx hot-updater fingerprint
npx hot-updater fingerprint create
npx hot-updater app-version
npx hot-updater app-version --json
npx hot-updater console
  • init
    用于创建或更新项目配置。由于该命令是交互式的,告知用户直接运行该命令,而非代其选择答案。
  • doctor
    检查本地设置和服务器健康状况。需提供
    --server-base-url
    参数;该命令会在该URL后追加
    /version
    以进行服务器检查。如果用户未提供该URL,在运行命令前先询问。
  • doctor --json
    是首选的代理交互方式。它返回稳定的问题代码、相关路径、
    fixability
    属性以及本地迭代修复的命令提示。当JSON可用时,不要解析人类可读的doctor输出。
  • fingerprint
    fingerprint create
    用于生成应用指纹。
  • app-version
    读取原生iOS和Android应用版本。支持该参数的CLI中,
    --json
    会返回
    { "android": string | null, "ios": string | null }
    格式的结果。
  • console
    打开本地管理控制台。

Deploy

部署

sh
npx hot-updater deploy -p <ios|android>
npx hot-updater deploy -p ios -c production -r 25
npx hot-updater deploy -p android -f
npx hot-updater deploy -p ios -d
npx hot-updater deploy -p ios -o ./hot-updater-output
Important options:
OptionMeaning
-p, --platform <platform>
Target
ios
or
android
.
-c, --channel <channel>
Release channel, default
production
.
-t, --target-app-version <range>
App version range such as
1.2.3
or
1.x.x
.
-r, --rollout <percentage>
Initial rollout percentage from
0
to
100
.
-f, --force-update
Apply immediately on client update.
-d, --disabled
Upload disabled for later enablement.
-o, --bundle-output-path <path>
Directory where bundle archives are generated.
-m, --message <message>
Custom deployment message.
-i, --interactive
Guided deployment flow.
sh
npx hot-updater deploy -p <ios|android>
npx hot-updater deploy -p ios -c production -r 25
npx hot-updater deploy -p android -f
npx hot-updater deploy -p ios -d
npx hot-updater deploy -p ios -o ./hot-updater-output
重要选项说明:
选项含义
-p, --platform <platform>
目标平台:
ios
android
-c, --channel <channel>
发布渠道,默认值为
production
-t, --target-app-version <range>
应用版本范围,例如
1.2.3
1.x.x
-r, --rollout <percentage>
初始发布百分比,范围为
0
100
-f, --force-update
在客户端更新时立即应用。
-d, --disabled
上传后处于禁用状态,可后续启用。
-o, --bundle-output-path <path>
生成包归档文件的目录。
-m, --message <message>
自定义部署消息。
-i, --interactive
引导式部署流程。

Patch Artifacts

补丁制品

sh
npx hot-updater patch -b <bundle-id> --base-bundle-id <base-bundle-id> -p ios
npx hot-updater patch -b <bundle-id> --base-bundle-id <base-bundle-id> -p android -c production
npx hot-updater patch -i
Important options:
OptionMeaning
-b, --bundle-id <bundleId>
Target bundle id that should receive the patch artifact.
--base-bundle-id <baseBundleId>
Older bundle id to use as the patch base.
-p, --platform <platform>
Target
ios
or
android
.
-c, --channel <channel>
Channel used to load config, default
production
.
-i, --interactive
Guided patch flow.
sh
npx hot-updater patch -b <bundle-id> --base-bundle-id <base-bundle-id> -p ios
npx hot-updater patch -b <bundle-id> --base-bundle-id <base-bundle-id> -p android -c production
npx hot-updater patch -i
重要选项说明:
选项含义
-b, --bundle-id <bundleId>
应接收补丁制品的目标包ID。
--base-bundle-id <baseBundleId>
用作补丁基础的旧包ID。
-p, --platform <platform>
目标平台:
ios
android
-c, --channel <channel>
用于加载配置的渠道,默认值为
production
-i, --interactive
引导式补丁流程。

Bundle Inventory and State

包清单与状态

sh
npx hot-updater bundle list
npx hot-updater bundle list -c production -p ios --limit 10
npx hot-updater bundle list -c production -p ios --limit 10 --json
npx hot-updater bundle list --json
npx hot-updater bundle show <bundle-id>
npx hot-updater bundle show <bundle-id> --json
npx hot-updater bundle disable <bundle-id>
npx hot-updater bundle enable <bundle-id>
npx hot-updater bundle update <bundle-id> --rollout-cohort-count 500
npx hot-updater bundle update <bundle-id> --force-update true --json
npx hot-updater bundle update <bundle-id> --target-cohorts 1,2,3
npx hot-updater bundle update <bundle-id> --clear-target-cohorts
npx hot-updater bundle delete <bundle-id>
npx hot-updater bundle promote <bundle-id> -t staging
npx hot-updater bundle promote <bundle-id> -t staging -a move
  • bundle list
    shows the most recent bundles first.
  • bundle list --limit <n>
    defaults to
    20
    .
  • --json
    is available for
    bundle list
    ,
    bundle show
    , and
    bundle update
    on CLIs that support it.
  • bundle disable
    and
    bundle enable
    read the bundle, mutate enabled state, commit the change, then re-read to verify.
  • bundle update
    can set rollout cohort count from
    0
    to
    1000
    , force update metadata, and target cohorts.
  • bundle delete
    removes the bundle record by id.
  • bundle promote
    copies to a target channel by default. Use
    -a move
    only when the user explicitly wants to keep the same bundle id and move channels.
  • In CI or other non-interactive shells, pass
    -y
    to
    enable
    or
    disable
    . Also pass
    -y
    to
    update
    ,
    delete
    , or
    promote
    only when the requested mutation target is unambiguous.
sh
npx hot-updater bundle list
npx hot-updater bundle list -c production -p ios --limit 10
npx hot-updater bundle list -c production -p ios --limit 10 --json
npx hot-updater bundle list --json
npx hot-updater bundle show <bundle-id>
npx hot-updater bundle show <bundle-id> --json
npx hot-updater bundle disable <bundle-id>
npx hot-updater bundle enable <bundle-id>
npx hot-updater bundle update <bundle-id> --rollout-cohort-count 500
npx hot-updater bundle update <bundle-id> --force-update true --json
npx hot-updater bundle update <bundle-id> --target-cohorts 1,2,3
npx hot-updater bundle update <bundle-id> --clear-target-cohorts
npx hot-updater bundle delete <bundle-id>
npx hot-updater bundle promote <bundle-id> -t staging
npx hot-updater bundle promote <bundle-id> -t staging -a move
  • bundle list
    按时间倒序显示最近的包。
  • bundle list --limit <n>
    默认值为
    20
  • 支持该参数的CLI中,
    --json
    可用于
    bundle list
    bundle show
    bundle update
    命令。
  • bundle disable
    bundle enable
    命令会读取包信息、修改启用状态、提交变更,然后重新读取以验证。
  • bundle update
    可设置发布群组数量(范围
    0
    1000
    )、强制更新元数据以及指定目标群组。
  • bundle delete
    按ID删除包记录。
  • bundle promote
    默认将包复制到目标渠道。仅当用户明确希望保留相同包ID并切换渠道时,才使用
    -a move
    参数。
  • 在CI或其他非交互式shell中,对
    enable
    disable
    命令使用
    -y
    参数。仅当请求的变更目标明确时,才对
    update
    delete
    promote
    命令使用
    -y
    参数。

Rollback

回滚

sh
npx hot-updater rollback <channel>
npx hot-updater rollback production -p ios
npx hot-updater rollback production -p ios --target <bundle-id> -y
  • Rollback disables the latest enabled bundle on the channel.
  • Without
    -p
    , rollback applies to both iOS and Android.
  • The next most recent enabled bundle on the same channel and platform becomes the fallback.
  • If no previous enabled bundle exists, the app falls back to the JavaScript bundle shipped in the native binary.
  • Use
    --target <bundle-id>
    to retry a partial rollback for exactly one bundle.
sh
npx hot-updater rollback <channel>
npx hot-updater rollback production -p ios
npx hot-updater rollback production -p ios --target <bundle-id> -y
  • 回滚操作会禁用渠道上最新启用的包。
  • 如果不指定
    -p
    参数,回滚会同时应用于iOS和Android平台。
  • 同一渠道和平台上最近的下一个启用包会成为回退版本。
  • 如果没有之前启用的包,应用会回退到原生二进制文件中附带的JavaScript包。
  • 使用
    --target <bundle-id>
    参数可针对特定包重试部分回滚操作。

Channels

渠道

sh
npx hot-updater channel set <channel>
This writes the default channel into native iOS and Android project files. Changing this embedded channel requires a native rebuild.
sh
npx hot-updater channel set <channel>
该命令会将默认渠道写入原生iOS和Android项目文件。修改此嵌入渠道需要重新构建原生应用。

Code Signing Keys

代码签名密钥

sh
npx hot-updater keys generate
npx hot-updater keys generate -o ./keys -k 4096
npx hot-updater keys export-public
npx hot-updater keys export-public -i ./keys/private.pem --print-only
npx hot-updater keys remove
  • keys generate
    writes an RSA key pair. The default output directory is
    ./keys
    , and supported key sizes are
    2048
    and
    4096
    with default
    4096
    .
  • keys export-public
    reads the private key from
    -i
    or from
    signing.privateKeyPath
    in
    hot-updater.config.ts
    , then writes native public key configuration unless
    --print-only
    is used.
  • keys remove
    removes public keys from native configuration files.
  • Use
    -y
    for native file writes only when the user explicitly requested the exact operation.
sh
npx hot-updater keys generate
npx hot-updater keys generate -o ./keys -k 4096
npx hot-updater keys export-public
npx hot-updater keys export-public -i ./keys/private.pem --print-only
npx hot-updater keys remove
  • keys generate
    生成RSA密钥对。默认输出目录为
    ./keys
    ,支持的密钥长度为
    2048
    4096
    ,默认值为
    4096
  • keys export-public
    -i
    参数指定的路径或
    hot-updater.config.ts
    中的
    signing.privateKeyPath
    读取私钥,然后写入原生公钥配置,除非使用
    --print-only
    参数。
  • keys remove
    从原生配置文件中移除公钥。
  • 仅当用户明确请求确切操作时,才对原生文件写入操作使用
    -y
    参数。

Database

数据库

sh
npx hot-updater db generate [configPath] [outputDir]
npx hot-updater db generate --sql
npx hot-updater db generate --sql postgresql
npx hot-updater db migrate [configPath]
  • db generate
    creates migration output without applying it. The default output directory is
    hot-updater_migrations
    .
  • db generate --sql [provider]
    creates a standalone SQL file without reading config. Supported providers are
    postgresql
    ,
    mysql
    , and
    sqlite
    ; omitting the provider starts interactive selection.
  • db migrate
    applies the latest migration through the configured database plugin.
  • Pass
    -y
    only when the user explicitly requested the write or migration.
sh
npx hot-updater db generate [configPath] [outputDir]
npx hot-updater db generate --sql
npx hot-updater db generate --sql postgresql
npx hot-updater db migrate [configPath]
  • db generate
    生成迁移输出但不应用。默认输出目录为
    hot-updater_migrations
  • db generate --sql [provider]
    生成独立的SQL文件,无需读取配置。支持的供应商为
    postgresql
    mysql
    sqlite
    ;如果省略供应商参数,会启动交互式选择。
  • db migrate
    通过配置的数据库插件应用最新的迁移。
  • 仅当用户明确请求写入或迁移操作时,才使用
    -y
    参数。