@heybox/hb-sdk 0.4.4 → 0.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -280,17 +280,37 @@ try {
280
280
  | ------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
281
281
  | `hb-sdk create <project-name>` | 创建外部小程序模板。 |
282
282
  | `hb-sdk dev [--runtime-url <url>]` | 启动当前项目的 Vite dev server 和浏览器 mock 宿主环境,并默认打开调试页;`--runtime-url` 会传给真实客户端 dev shell。 |
283
- | `hb-sdk deploy --release-note <text> [--skip-build] [--auto-publish]` | 构建、上传并提交当前小程序版本审核。`--skip-build` 跳过 build 直接上传 `dist/`;默认审核通过后需在开放平台手动发布,`--auto-publish` 改为审核通过后自动发布。 |
284
- | `hb-sdk login [--login-base-url <url>]` | 登录 Heybox,并把 CLI 自己需要的登录态和登录入口环境保存在本地缓存中。 |
283
+ | `hb-sdk login [--login-base-url <url>] [--no-select-entity]` | 登录 Heybox,并把 CLI 自己需要的登录态和登录入口环境保存在本地缓存中;默认会引导多主体用户选择服务端 current entity。 |
285
284
  | `hb-sdk login status` | 查看脱敏后的 CLI 登录态。 |
286
285
  | `hb-sdk login clear` | 清理 CLI 登录态。 |
287
286
  | `hb-sdk doctor` | 检查本机 `hb-sdk` Agent Skill 是否匹配当前 SDK,并输出手动安装/刷新命令。 |
287
+ | `hb-sdk remote access` | 查看当前 CLI 用户是否具备开发者用户小程序创建和管理资格。 |
288
+ | `hb-sdk remote entity list` | 列出当前 CLI 用户可切换的开发者主体,并标记服务端 current entity。 |
289
+ | `hb-sdk remote entity current` | 查看服务端 current entity,以及该主体的用户小程序权限状态。 |
290
+ | `hb-sdk remote entity switch <entity-id>` | 切换开发者平台服务端 current entity;不会修改项目绑定的小程序 ID。 |
291
+ | `hb-sdk remote list [--status <status>] [--keyword <text>]` | 列出当前 CLI 用户可管理的远端用户小程序,用于发现并绑定当前项目。 |
292
+ | `hb-sdk remote create --name <name> [--preview-image-url <url>] [--yes] [--force-bind]` | 在服务端 current entity 下创建远端用户小程序并写入当前项目的 `package.json.heybox.miniProgramId`。 |
293
+ | `hb-sdk remote bind <mini-program-id> [--force]` | 校验当前 CLI 用户可管理目标小程序后,再把它绑定到当前项目。 |
294
+ | `hb-sdk remote info` | 查看当前项目绑定的小程序详情。 |
295
+ | `hb-sdk remote update [--name <name>] [--preview-image-url <url>]` | 更新绑定小程序的名称或远程预览图 URL。 |
296
+ | `hb-sdk remote allowlist list/add/remove/set ...` | 管理绑定小程序的预览白名单。 |
297
+ | `hb-sdk remote deploy --release-note <text> [--skip-build] [--auto-publish]` | 构建、上传并提交当前小程序版本审核;`--skip-build` 跳过 build 直接上传 `dist/`。 |
298
+ | `hb-sdk remote versions` | 列出绑定小程序的远端版本。 |
299
+ | `hb-sdk remote preview <version>` | 查看指定版本的远端预览入口。 |
300
+ | `hb-sdk remote release <version> [--yes]` | 发布审核通过的版本;非 TTY 环境必须传 `--yes`。 |
301
+ | `hb-sdk remote withdraw <version> [--yes] [--reason <text>]` | 撤回审核中或已通过但未发布的版本;非 TTY 环境必须传 `--yes`。 |
302
+ | `hb-sdk remote take-down [--yes]` | 下架当前线上小程序;非 TTY 环境必须传 `--yes`。 |
303
+ | `hb-sdk remote reopen [--yes]` | 重新上架已下架的小程序;非 TTY 环境必须传 `--yes`。 |
304
+
305
+ 远端平台操作统一放在 `hb-sdk remote` 命令组下;顶层 `hb-sdk deploy` 已硬切删除,不再作为兼容别名保留。`hb-sdk login` 仍是顶层命令,因为它管理 CLI 登录态,不绑定到某个具体小程序。开发者主体的事实源是服务端 current entity;CLI 登录缓存中的 `selectedEntity` 只是上次选择时的提示快照,用于 `login status` 展示和漂移排障,不能作为权限或归属判断依据。
306
+
307
+ `hb-sdk remote ...` 支持通用参数 `--json`、`--api-base-url <url>`、`--login-base-url <url>`、`--allow-unsafe-api-base-url` 和 `--verbose`。其中 `--json` 会让 stdout 只输出一个 JSON 对象,进度、警告和诊断信息不应污染 stdout。
288
308
 
289
309
  所有命令都支持 `--verbose` / `-v`。默认输出只展示关键阶段状态、可访问 URL、下一步命令和可直接处理的错误提示;需要排查后端 envelope、HTTP 状态、trace id、原始响应体、cache 路径、API origin、逐文件上传进度或提交审核原始失败原因时,再追加 `--verbose` 查看详细调试信息。交互式终端会用颜色、符号和 loading 动画区分成功、警告、错误与耗时步骤;CI、非 TTY 和管道输出会退化为 `[hb-sdk] LEVEL ...` 这种稳定文本行。
290
310
 
291
- ## hb-sdk deploy
311
+ ## hb-sdk remote deploy
292
312
 
293
- `hb-sdk deploy` 把版本预检、build、CDN 上传、提交审核 API 串成单条命令。命令前置要求:
313
+ `hb-sdk remote deploy` 把版本预检、build、CDN 上传、提交审核 API 串成单条命令。顶层 `hb-sdk deploy` 已删除;旧脚本必须改成 `hb-sdk remote deploy`。命令前置要求:
294
314
 
295
315
  1. `package.json` 必须含 `heybox.miniProgramId` 字段,CLI 只从这里读 mini program id:
296
316
  ```json
@@ -300,25 +320,27 @@ try {
300
320
  }
301
321
  }
302
322
  ```
303
- 2. 已运行过 `hb-sdk login` 登录 Heybox
304
- 3. 如果需要以公司的名义发布小程序,需先找 @秦浩东 申请小程序开发权限。
305
- 4. 每次部署都要准备发布日志:`hb-sdk deploy --release-note "..."`。发布日志 trim 后不能为空,最多 500 个字符,允许换行;CI / 非 TTY 环境缺失时会直接失败,TTY 环境会提示输入。
306
- 5. 项目根有 `scripts.build`,会被 CLI 通过 lockfile 自动选用的 `pnpm`、`yarn` `npm` 触发;无 lockfile 时回退 `npm`。
307
- 6. 构建产物落在 `dist/`,包含 `index.html` `manifest.json`。
323
+ 2. 已运行过 `hb-sdk login` 登录 Heybox;多主体用户应确认 `hb-sdk remote entity current` 指向要发布的主体。
324
+ 3. 当前项目绑定的小程序必须属于服务端 current entity;如不一致,先运行 `hb-sdk remote entity switch <entity-id>` 切换主体。
325
+ 4. 如果需要以公司的名义发布小程序,需先找 @秦浩东 申请小程序开发权限。
326
+ 5. 每次部署都要准备发布日志:`hb-sdk remote deploy --release-note "..."`。发布日志 trim 后不能为空,最多 500 个字符,允许换行;CI / TTY 环境缺失时会直接失败,TTY 环境会提示输入。
327
+ 6. 项目根有 `scripts.build`,会被 CLI 通过 lockfile 自动选用的 `pnpm`、`yarn` `npm` 触发;无 lockfile 时回退 `npm`。
328
+ 7. 构建产物落在 `dist/`,包含 `index.html` 和 `manifest.json`。
308
329
 
309
330
  执行流程:
310
331
 
311
332
  1. 校验 `heybox.miniProgramId`、发布日志和登录态。
312
- 2. 普通 deploy 读取 `package.json.version`,登录后、build 前调用 `/mall/developer/user_miniprogram/version/precheck`,入参为 `mini_program_id`、`version`、`release_note`、`auto_publish`。
313
- 3. 触发 `<pm> run build`,除非使用 `--skip-build`。
314
- 4. 解析 `dist/manifest.json`,校验 `version` `x.y.z`,自动剥离 BOM;普通 deploy 要求该版本与 precheck 使用的 `package.json.version` 一致。
315
- 5. `--skip-build` 会先读取已有 `dist/manifest.json.version`,再调用 precheck。
316
- 6. 遍历 `dist/` 文件,跳过 `manifest.json`、`.DS_Store`、`.map`;遇到 symlink 或 `node_modules` 直接报错。
317
- 7. 校验所有上传路径长度不超过 64。
318
- 8. 4 并发上传到 COS。默认只展示上传阶段和文件总数;`--verbose` 会展示并发数、bucket / region 和逐文件结果,但不会输出 keys、签名、cookie 或 token。任一文件失败立刻 abort,不提交审核。
319
- 9. 全部上传成功后调用 `/mall/developer/user_miniprogram/version/submit_audit`,输出提交审核成功、发布策略和可用的 preview URL;后端原始失败细节只在 `--verbose` 下展示。
320
-
321
- 默认 `auto_publish=false`,审核通过后需在开放平台手动发布;使用 `--auto-publish` 时提交 `auto_publish=true`,审核通过后自动发布。未发布候选版本可通过开放平台"内测白名单"让指定用户在广场看到;正式入口使用 `mini_program_id`,`mini_url` 仅用于本地调试。
333
+ 2. 读取服务端 current entity 和绑定小程序详情,确认 `detail.entity_id` current entity 一致;主体不一致时直接失败,不触发 precheck、build、upload 或 submit audit。
334
+ 3. 普通 remote deploy 读取 `package.json.version`,主体校验通过后、build 前调用 `/mall/developer/user_miniprogram/version/precheck`,入参为 `mini_program_id`、`version`、`release_note`、`auto_publish`。
335
+ 4. 触发 `<pm> run build`,除非使用 `--skip-build`。
336
+ 5. 解析 `dist/manifest.json`,校验 `version` 为 `x.y.z`,自动剥离 BOM;普通 remote deploy 要求该版本与 precheck 使用的 `package.json.version` 一致。
337
+ 6. `--skip-build` 会先读取已有 `dist/manifest.json.version`,再调用 precheck。
338
+ 7. 遍历 `dist/` 文件,跳过 `manifest.json`、`.DS_Store`、`.map`;遇到 symlink 或 `node_modules` 直接报错。
339
+ 8. 校验所有上传路径长度不超过 64。
340
+ 9. 4 并发上传到 COS。默认只展示上传阶段和文件总数;`--verbose` 会展示并发数、bucket / region 和逐文件结果,但不会输出 keys、签名、cookie 或 token。任一文件失败立刻 abort,不提交审核。
341
+ 10. 全部上传成功后调用 `/mall/developer/user_miniprogram/version/submit_audit`,输出提交审核成功、发布策略和可用的 preview URL;后端原始失败细节只在 `--verbose` 下展示。
342
+
343
+ 默认 `auto_publish=false`,审核通过后使用 `hb-sdk remote versions` 查看版本状态,再用 `hb-sdk remote release <version>` 发布;使用 `--auto-publish` 时提交 `auto_publish=true`,审核通过后自动发布。未发布候选版本可通过 `hb-sdk remote allowlist add <heybox_id>` 加入预览白名单,让指定用户在广场看到;正式入口使用 `mini_program_id`,`mini_url` 仅用于本地调试。
322
344
 
323
345
  `--skip-build` 用于 CI 双阶段:上一步已经 build 完缓存好了 `dist/`,本步只做预检、上传和提交审核。`dist/manifest.json` 或 `dist/index.html` 缺失会立即报错。
324
346
 
@@ -329,20 +351,47 @@ try {
329
351
  ```bash
330
352
  HB_SDK_API_BASE_URL=https://api.test.xiaoheihe.cn \
331
353
  HB_SDK_LOGIN_BASE_URL=https://login.test.xiaoheihe.cn \
332
- hb-sdk deploy --release-note "测试环境验证"
354
+ hb-sdk remote deploy --release-note "测试环境验证"
333
355
 
334
356
  hb-sdk login --login-base-url https://login.test.xiaoheihe.cn
335
- hb-sdk deploy --api-base-url https://api.test.xiaoheihe.cn --login-base-url https://login.test.xiaoheihe.cn --release-note "测试环境验证"
336
- hb-sdk deploy --verbose --api-base-url https://api.test.xiaoheihe.cn --login-base-url https://login.test.xiaoheihe.cn --release-note "排查预检失败"
357
+ hb-sdk remote deploy --api-base-url https://api.test.xiaoheihe.cn --login-base-url https://login.test.xiaoheihe.cn --release-note "测试环境验证"
358
+ hb-sdk remote deploy --verbose --api-base-url https://api.test.xiaoheihe.cn --login-base-url https://login.test.xiaoheihe.cn --release-note "排查预检失败"
337
359
 
338
- HB_SDK_ALLOW_UNSAFE_API_BASE_URL=1 hb-sdk deploy --api-base-url http://127.0.0.1:8080 --release-note "本地后台联调"
360
+ HB_SDK_ALLOW_UNSAFE_API_BASE_URL=1 hb-sdk remote deploy --api-base-url http://127.0.0.1:8080 --release-note "本地后台联调"
339
361
  ```
340
362
 
341
- `--api-base-url` 优先于 `HB_SDK_API_BASE_URL`,只影响 deploy 里的预检、CDN 上传凭证/回调、提交审核等后台 API;`--login-base-url` 优先于 `HB_SDK_LOGIN_BASE_URL`,用于 `hb-sdk login` 的登录入口,以及 deploy 前校验当前 CLI 登录态是否属于同一个登录环境。仓库内开发可在 `packages/hb-sdk/src/cli/config.ts` 里按 `@heybox/hb-types` 的 `RylaiServiceTagConfig` 配置 `default_tag` 或 path-prefix 级 `special_tag`,给 Heybox 后台请求附加 `x-rylai-service-tag` header,并复用命中的 tag 追加 `special_tag` 请求参数,用于开发环境路由或灰度验证。自定义地址只接受 origin,不允许包含 path、query 或 hash;API origin 默认还必须是 Heybox 受信 HTTPS 域名,只有本地联调等场景可显式使用 `--allow-unsafe-api-base-url` 或 `HB_SDK_ALLOW_UNSAFE_API_BASE_URL=1` 放开。日志只输出 origin,不输出带身份和签名参数的完整请求 URL。`hb-sdk doctor`、npm latest 检查、mock host 的 `network.request()` 不受这些配置影响。
342
-
343
- CLI 登录态只供 CLI 命令访问黑盒接口时复用,不会注入 iframe SDK,也不会改变 `auth.login()`、`user.getInfo()`、`network.request()` 或 mock 宿主中的用户状态。`hb-sdk login status` 默认展示脱敏状态、`heyboxId`、`loginBaseUrl` 和登录时间;`--verbose` 额外展示 cache 路径。不输出 `pkey`、cookie 或完整请求头。
344
-
345
- `create`、`dev`、`deploy`、`login`、`login status`、`login clear`、`doctor` 这些 CLI 命令会在成功执行后检查 npm registry 上的 `@heybox/hb-sdk@latest`。如果发现新版本,会在 stderr 打印升级提醒;检查失败会静默跳过,不影响当前命令。`doctor` 已经诊断出 `SDK_MISMATCH` 时不会再追加统一提醒,避免同一次输出里重复提示升级 SDK。`hb-sdk --version` / `hb-sdk -V` 也会执行同一套检查,但 stdout 只输出版本号,升级提醒继续按 warn 级别写到 stderr。可通过 `HB_SDK_NO_UPDATE_CHECK=1` 禁用版本提醒;`CI=true` 时也会自动跳过检查。
363
+ `--api-base-url` 优先于 `HB_SDK_API_BASE_URL`,影响 `hb-sdk remote` 里的远端平台后台 API,包括预检、CDN 上传凭证/回调、提交审核、版本、发布、撤回、下架、重新上架、详情、基础信息和白名单等调用;`--login-base-url` 优先于 `HB_SDK_LOGIN_BASE_URL`,用于 `hb-sdk login` 的登录入口,以及 remote 命令前校验当前 CLI 登录态是否属于同一个登录环境。仓库内开发可在 `packages/hb-sdk/src/cli/config.ts` 里按 `@heybox/hb-types` 的 `RylaiServiceTagConfig` 配置 `default_tag` 或 path-prefix 级 `special_tag`,给 Heybox 后台请求附加 `x-rylai-service-tag` header,并复用命中的 tag 追加 `special_tag` 请求参数,用于开发环境路由或灰度验证。自定义地址只接受 origin,不允许包含 path、query 或 hash;API origin 默认还必须是 Heybox 受信 HTTPS 域名,只有本地联调等场景可显式使用 `--allow-unsafe-api-base-url` 或 `HB_SDK_ALLOW_UNSAFE_API_BASE_URL=1` 放开。日志只输出 origin,不输出带身份和签名参数的完整请求 URL。`hb-sdk doctor`、npm latest 检查、mock host 的 `network.request()` 不受这些配置影响。
364
+
365
+ ## hb-sdk remote 命令参考
366
+
367
+ `hb-sdk remote` 默认作用于当前项目绑定的小程序,即 `package.json.heybox.miniProgramId`。`remote list` 只展示服务端 current entity 下可管理的小程序,用于发现和绑定;会改变远端状态的命令仍然只操作当前绑定的小程序,不接受临时 `mini_program_id` 参数。需要查看或切换开发者主体时,使用 `hb-sdk remote entity ...`;CLI 不会根据本地绑定自动切换主体。
368
+
369
+ | 命令 | 说明 |
370
+ | ---- | ---- |
371
+ | `hb-sdk remote access` | 查询当前 CLI 用户是否具备开发者用户小程序管理资格。 |
372
+ | `hb-sdk remote entity list` | 列出可切换开发者主体,并标记服务端 current entity。 |
373
+ | `hb-sdk remote entity current` | 查看服务端 current entity 和该主体的用户小程序权限状态。 |
374
+ | `hb-sdk remote entity switch <entity-id>` | 切换服务端 current entity;只允许切到 `entity list` 返回的主体。 |
375
+ | `hb-sdk remote list [--status <status>] [--keyword <text>]` | 列出 current entity 下当前 CLI 用户可管理的小程序,并标出当前绑定项。 |
376
+ | `hb-sdk remote create --name <name> [--preview-image-url <url>] [--yes] [--force-bind]` | 在 current entity 下创建远端小程序并绑定当前项目;多主体非 TTY 环境必须传 `--yes` 确认使用当前主体;已有绑定时必须显式传 `--force-bind` 才能覆盖。 |
377
+ | `hb-sdk remote bind <mini-program-id> [--force]` | 先校验 current entity 可管理目标小程序,再写入当前项目绑定;`--force` 只允许覆盖本地绑定,不跳过远端校验或主体一致性校验。 |
378
+ | `hb-sdk remote info` | 查看当前绑定小程序的远端详情。 |
379
+ | `hb-sdk remote update [--name <name>] [--preview-image-url <url>]` | 更新名称或远程预览图 URL,至少传一个变更字段。 |
380
+ | `hb-sdk remote allowlist list` | 查看预览白名单。 |
381
+ | `hb-sdk remote allowlist add <heybox-id...>` | 添加十进制 Heybox ID 到预览白名单。 |
382
+ | `hb-sdk remote allowlist remove <heybox-id...>` | 从预览白名单移除非 owner 条目。 |
383
+ | `hb-sdk remote allowlist set <heybox-id...>` | 替换非 owner 白名单条目,并保留平台返回的 owner 语义。 |
384
+ | `hb-sdk remote deploy --release-note <text> [--skip-build] [--auto-publish]` | 构建、上传并提交当前版本审核。 |
385
+ | `hb-sdk remote versions` | 列出当前绑定小程序的远端版本。 |
386
+ | `hb-sdk remote preview <version>` | 查看指定版本的远端预览入口。 |
387
+ | `hb-sdk remote release <version> [--yes]` | 发布审核通过的版本;交互式终端会确认,非 TTY 必须传 `--yes`。 |
388
+ | `hb-sdk remote withdraw <version> [--yes] [--reason <text>]` | 撤回审核中或已通过但未发布的版本;交互式终端会确认,非 TTY 必须传 `--yes`。 |
389
+ | `hb-sdk remote take-down [--yes]` | 下架当前线上小程序;交互式终端会确认,非 TTY 必须传 `--yes`。 |
390
+ | `hb-sdk remote reopen [--yes]` | 重新上架已下架的小程序;交互式终端会确认,非 TTY 必须传 `--yes`。 |
391
+
392
+ CLI 登录态只供 CLI 命令访问黑盒接口时复用,不会注入 iframe SDK,也不会改变 `auth.login()`、`user.getInfo()`、`network.request()` 或 mock 宿主中的用户状态。`hb-sdk login` 成功后会尝试读取开发者主体列表:单主体自动确认或切换为 current entity,多主体交互式环境要求选择主体,多主体非 TTY 环境只提示后续运行 `hb-sdk remote entity switch <entity-id>`;显式传 `--no-select-entity` 时只写登录态,不修改服务端 current entity。`hb-sdk login status` 默认展示脱敏状态、`heyboxId`、`loginBaseUrl`、登录时间和本地 `selectedEntity` 提示快照;`--verbose` 额外展示 cache 路径。不输出 `pkey`、cookie 或完整请求头。`selectedEntity` 不是权限事实源,每次 remote 命令仍以服务端 current entity 为准。
393
+
394
+ `create`、`dev`、`remote ...`、`login`、`login status`、`login clear`、`doctor` 这些 CLI 命令会在成功执行后检查 npm registry 上的 `@heybox/hb-sdk@latest`。普通命令的检查结果会缓存 24 小时;如果发现新版本,会在 stderr 打印升级提醒;检查失败会静默跳过,不影响当前命令。`doctor` 已经诊断出 `SDK_MISMATCH` 时不会再追加统一提醒,避免同一次输出里重复提示升级 SDK。`hb-sdk --version` / `hb-sdk -V` 会直接请求 npm registry 获取 latest,不读取本地缓存;stdout 只输出版本号,升级提醒继续按 warn 级别写到 stderr。可通过 `HB_SDK_NO_UPDATE_CHECK=1` 禁用版本提醒;`CI=true` 时也会自动跳过检查。
346
395
 
347
396
  ## SDK 与 Runtime
348
397
 
@@ -388,7 +437,7 @@ export default defineConfig({
388
437
 
389
438
  - 读取 `package.json` 失败或 JSON 解析失败:`vite build` 直接失败,并输出具体原因。
390
439
  - `package.json.version` 不是非空字符串:`vite build` 直接失败。
391
- - `package.json.version` 仍是模板默认值 `0.0.0`:`vite build` 输出 warning 并写入 manifest;`hb-sdk deploy` 会拒绝发布,必须改成实际 `x.y.z` 版本。
440
+ - `package.json.version` 仍是模板默认值 `0.0.0`:`vite build` 输出 warning 并写入 manifest;`hb-sdk remote deploy` 会拒绝发布,必须改成实际 `x.y.z` 版本。
392
441
  - 版本号不满足极简 semver 形态 `x.y.z`:只输出 Rollup/Vite warning,仍会写入 manifest。
393
442
 
394
443
  `manifest.json` 不部署到 CDN,只交给发布流水线读取后上送后台;Host 通过后台 API 间接读取版本信息。第一阶段只支持 Vite 项目,非 Vite 打包器未来通过其他子入口扩展。
@@ -5,7 +5,7 @@ var fs = require('node:fs/promises');
5
5
  var path = require('node:path');
6
6
  var require$$0 = require('fs');
7
7
  var require$$1 = require('path');
8
- var index = require('./index-Bboot1us.cjs');
8
+ var index = require('./index-DuwxUSkq.cjs');
9
9
  require('node:module');
10
10
  require('os');
11
11
  require('readline');
@@ -9,7 +9,7 @@ var node_url = require('node:url');
9
9
  var net = require('node:net');
10
10
  var node_http = require('node:http');
11
11
  var browser = require('./browser-RAy8e8cV.cjs');
12
- var index = require('./index-Bboot1us.cjs');
12
+ var index = require('./index-DuwxUSkq.cjs');
13
13
  require('node:process');
14
14
  require('node:buffer');
15
15
  require('node:util');
@@ -4,7 +4,7 @@ var fs$1 = require('node:fs');
4
4
  var fs = require('node:fs/promises');
5
5
  var os = require('node:os');
6
6
  var path = require('node:path');
7
- var index = require('./index-Bboot1us.cjs');
7
+ var index = require('./index-DuwxUSkq.cjs');
8
8
  require('node:module');
9
9
  require('path');
10
10
  require('os');
@@ -1,13 +1,13 @@
1
1
  'use strict';
2
2
 
3
- var index$2 = require('./index-Bboot1us.cjs');
3
+ var index$2 = require('./index-DuwxUSkq.cjs');
4
4
  var require$$0$2 = require('fs');
5
5
  var require$$2$1 = require('crypto');
6
6
  var require$$1$2 = require('path');
7
7
  var require$$0$3 = require('assert');
8
8
  var require$$4$2 = require('events');
9
9
  var require$$1$1 = require('util');
10
- var deploy = require('./deploy-BaLyuR1X.cjs');
10
+ var remote = require('./remote-zX17hOT4.cjs');
11
11
  var require$$0$5 = require('net');
12
12
  var require$$0$4 = require('url');
13
13
  var require$$2$2 = require('http');
@@ -13707,7 +13707,7 @@ function requireSource () {
13707
13707
  const ajv_1 = requireAjv$1();
13708
13708
  const ajv_formats_1 = requireDist();
13709
13709
  const debounceFn = requireDebounceFn();
13710
- const semver = deploy.requireSemver();
13710
+ const semver = remote.requireSemver();
13711
13711
  const onetime = index$2.requireOnetime();
13712
13712
  const encryptionAlgorithm = 'aes-256-cbc';
13713
13713
  const createPlainObject = () => {
@@ -234,19 +234,19 @@ function requireArgument () {
234
234
 
235
235
  var command = {};
236
236
 
237
- const require$5 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-Bboot1us.cjs', document.baseURI).href)));
237
+ const require$5 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-DuwxUSkq.cjs', document.baseURI).href)));
238
238
  function __require$4() { return require$5("node:events"); }
239
239
 
240
- const require$4 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-Bboot1us.cjs', document.baseURI).href)));
240
+ const require$4 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-DuwxUSkq.cjs', document.baseURI).href)));
241
241
  function __require$3() { return require$4("node:child_process"); }
242
242
 
243
- const require$3 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-Bboot1us.cjs', document.baseURI).href)));
243
+ const require$3 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-DuwxUSkq.cjs', document.baseURI).href)));
244
244
  function __require$2() { return require$3("node:path"); }
245
245
 
246
- const require$2 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-Bboot1us.cjs', document.baseURI).href)));
246
+ const require$2 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-DuwxUSkq.cjs', document.baseURI).href)));
247
247
  function __require$1() { return require$2("node:fs"); }
248
248
 
249
- const require$1 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-Bboot1us.cjs', document.baseURI).href)));
249
+ const require$1 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-DuwxUSkq.cjs', document.baseURI).href)));
250
250
  function __require() { return require$1("node:process"); }
251
251
 
252
252
  var help = {};
@@ -12866,7 +12866,7 @@ async function getUpdateReminder(options = {}) {
12866
12866
  }
12867
12867
  const now = options.now?.() ?? new Date();
12868
12868
  const currentVersion = options.currentVersion ?? (await readCurrentSdkVersion$1(options.packageJsonFiles));
12869
- const cached = await readFreshUpdateCheckCache(getUpdateCheckCacheFilePath(options), now);
12869
+ const cached = options.forceRefresh ? null : await readFreshUpdateCheckCache(getUpdateCheckCacheFilePath(options), now);
12870
12870
  if (cached) {
12871
12871
  return createUpdateReminder(currentVersion, cached.latestVersion);
12872
12872
  }
@@ -12875,10 +12875,12 @@ async function getUpdateReminder(options = {}) {
12875
12875
  latestVersion = await fetchLatestVersion(options);
12876
12876
  }
12877
12877
  catch {
12878
- await writeUpdateCheckCache({
12879
- version: UPDATE_CHECK_CACHE_VERSION,
12880
- checkedAt: now.toISOString(),
12881
- }, options).catch(() => undefined);
12878
+ if (!options.forceRefresh) {
12879
+ await writeUpdateCheckCache({
12880
+ version: UPDATE_CHECK_CACHE_VERSION,
12881
+ checkedAt: now.toISOString(),
12882
+ }, options).catch(() => undefined);
12883
+ }
12882
12884
  return null;
12883
12885
  }
12884
12886
  await writeUpdateCheckCache({
@@ -13092,7 +13094,7 @@ function readErrorMessage(error, options = {}) {
13092
13094
  }
13093
13095
 
13094
13096
  const CLI_VERSION_PLACEHOLDER = ['__HB', 'SDK', 'CLI', 'VERSION__'].join('_');
13095
- const BUILT_CLI_VERSION = '0.4.4';
13097
+ const BUILT_CLI_VERSION = '0.4.6';
13096
13098
  const PACKAGE_JSON_CANDIDATES = [
13097
13099
  path.resolve(__dirname, '..', '..', 'package.json'),
13098
13100
  path.resolve(__dirname, '..', 'package.json'),
@@ -13151,9 +13153,9 @@ function createCliProgram(overrides = {}) {
13151
13153
  printLoginStatus: defaultPrintLoginStatus,
13152
13154
  printUpdateReminder: printUpdateReminder,
13153
13155
  runCreateCommand: defaultRunCreateCommand,
13154
- runDeployCommand: defaultRunDeployCommand,
13155
13156
  runDevCommand: defaultRunDevCommand,
13156
13157
  runDoctorCommand: defaultRunDoctorCommand,
13158
+ runRemoteCommand: defaultRunRemoteCommand,
13157
13159
  ...overrides,
13158
13160
  };
13159
13161
  const program = new Command();
@@ -13180,25 +13182,7 @@ function createCliProgram(overrides = {}) {
13180
13182
  const logger = resolveLogger(command);
13181
13183
  await handlers.runDevCommand(options, { logger });
13182
13184
  }, handlers.printUpdateReminder, resolveLogger));
13183
- addVerboseOption(program
13184
- .command('deploy')
13185
- .description('构建并提交当前小程序版本审核')
13186
- .option('--skip-build', '跳过 build,直接读 dist 目录上传并提交审核')
13187
- .option('--release-note <text>', '发布日志,提交审核必填')
13188
- .option('--auto-publish', '审核通过后自动发布;默认需在开放平台手动发布')
13189
- .option('--api-base-url <url>', 'Heybox 后台 API origin,默认读取 HB_SDK_API_BASE_URL 或生产地址')
13190
- .option('--allow-unsafe-api-base-url', '允许向非 Heybox HTTPS API origin 发送登录态,仅限本地调试')
13191
- .option('--login-base-url <url>', '校验 CLI 登录态使用的登录 origin,默认读取 HB_SDK_LOGIN_BASE_URL 或生产地址')).action(withUpdateReminder(async (options, command) => {
13192
- const logger = resolveLogger(command);
13193
- await handlers.runDeployCommand({
13194
- allowUnsafeApiBaseUrl: Boolean(options.allowUnsafeApiBaseUrl),
13195
- apiBaseUrl: options.apiBaseUrl,
13196
- autoPublish: Boolean(options.autoPublish),
13197
- loginBaseUrl: options.loginBaseUrl,
13198
- releaseNote: options.releaseNote,
13199
- skipBuild: Boolean(options.skipBuild),
13200
- }, { logger });
13201
- }, handlers.printUpdateReminder, resolveLogger));
13185
+ installRemoteCommands(program, handlers, resolveLogger);
13202
13186
  addVerboseOption(program.command('doctor').description('诊断 hb-sdk 本地环境和 Agent Skill 版本')).action(async (...args) => {
13203
13187
  const logger = resolveLogger(readCommandFromActionArgs(args));
13204
13188
  const result = await handlers.runDoctorCommand({ logger });
@@ -13209,11 +13193,13 @@ function createCliProgram(overrides = {}) {
13209
13193
  const login = addVerboseOption(program
13210
13194
  .command('login')
13211
13195
  .description('登录 Heybox 并缓存 CLI 登录态')
13212
- .option('--login-base-url <url>', 'Heybox 登录入口 origin,默认读取 HB_SDK_LOGIN_BASE_URL 或生产地址')).action(withUpdateReminder(async (options, command) => {
13196
+ .option('--login-base-url <url>', 'Heybox 登录入口 origin,默认读取 HB_SDK_LOGIN_BASE_URL 或生产地址')
13197
+ .option('--no-select-entity', '登录后不选择或切换开发者主体')).action(withUpdateReminder(async (options, command) => {
13213
13198
  const logger = resolveLogger(command);
13214
13199
  await handlers.loginToHeybox({
13215
13200
  logger,
13216
13201
  loginBaseUrl: options.loginBaseUrl,
13202
+ noSelectEntity: options.selectEntity === false,
13217
13203
  });
13218
13204
  }, handlers.printUpdateReminder, resolveLogger));
13219
13205
  addVerboseOption(login.command('status').description('查看脱敏后的 Heybox 登录态')).action(withUpdateReminder(async (...args) => {
@@ -13229,6 +13215,148 @@ function createCliProgram(overrides = {}) {
13229
13215
  function addVerboseOption(command) {
13230
13216
  return command.option('-v, --verbose', '输出详细调试信息');
13231
13217
  }
13218
+ function addRemotePublicOptions(command) {
13219
+ return addVerboseOption(command
13220
+ .option('--json', '以 JSON 格式输出 remote 命令结果')
13221
+ .option('--api-base-url <url>', 'Heybox 后台 API origin,默认读取 HB_SDK_API_BASE_URL 或生产地址')
13222
+ .option('--login-base-url <url>', '校验 CLI 登录态使用的登录 origin,默认读取 HB_SDK_LOGIN_BASE_URL 或生产地址')
13223
+ .option('--allow-unsafe-api-base-url', '允许向非 Heybox HTTPS API origin 发送登录态,仅限本地调试'));
13224
+ }
13225
+ function installRemoteCommands(program, handlers, resolveLogger) {
13226
+ const remote = addRemotePublicOptions(program.command('remote').description('管理当前项目绑定的远程 Heybox 用户小程序'));
13227
+ addRemotePublicOptions(remote.command('access').description('查看当前账号的用户小程序访问权限')).action(createRemoteAction(handlers, resolveLogger, 'access'));
13228
+ const entity = addRemotePublicOptions(remote.command('entity').description('查看和切换当前开发者主体'));
13229
+ addRemotePublicOptions(entity.command('list').description('列出当前账号可切换的开发者主体')).action(createRemoteAction(handlers, resolveLogger, 'entity:list'));
13230
+ addRemotePublicOptions(entity.command('current').description('查看当前开发者主体和用户小程序权限状态')).action(createRemoteAction(handlers, resolveLogger, 'entity:current'));
13231
+ addRemotePublicOptions(entity.command('switch').description('切换当前开发者主体').argument('<entity-id>', '开发者主体 ID')).action(createRemoteAction(handlers, resolveLogger, 'entity:switch', (_command, entityId) => ({
13232
+ entityId: readStringArgument(entityId, 'entity-id'),
13233
+ })));
13234
+ addRemotePublicOptions(remote
13235
+ .command('list')
13236
+ .description('列出当前账号可管理的用户小程序')
13237
+ .option('--status <status>', '按状态筛选')
13238
+ .option('--keyword <text>', '按关键词筛选')).action(createRemoteAction(handlers, resolveLogger, 'list', (command) => pickOptions(command, ['status', 'keyword'])));
13239
+ addRemotePublicOptions(remote
13240
+ .command('create')
13241
+ .description('创建远程用户小程序并绑定当前项目')
13242
+ .requiredOption('--name <name>', '小程序名称')
13243
+ .option('--preview-image-url <url>', '远程预览图 HTTPS URL')
13244
+ .option('--force-bind', '允许覆盖当前 package.json 中已有绑定')).option('--yes', '多开发者主体时确认使用服务端 current 主体创建').action(createRemoteAction(handlers, resolveLogger, 'create', (command) => ({
13245
+ ...pickOptions(command, ['name', 'previewImageUrl']),
13246
+ forceBind: Boolean(readCommandOptionsWithAncestors(command).forceBind),
13247
+ ...readYesOption(command),
13248
+ })));
13249
+ addRemotePublicOptions(remote.command('bind').description('绑定当前项目到已存在的远程用户小程序').argument('<mini-program-id>', '远程小程序 ID').option('--force', '允许覆盖当前 package.json 中已有绑定')).action(createRemoteAction(handlers, resolveLogger, 'bind', (command, miniProgramId) => ({
13250
+ force: Boolean(readCommandOptionsWithAncestors(command).force),
13251
+ miniProgramId: readStringArgument(miniProgramId, 'mini-program-id'),
13252
+ })));
13253
+ addRemotePublicOptions(remote.command('info').description('查看当前绑定的远程用户小程序详情')).action(createRemoteAction(handlers, resolveLogger, 'info'));
13254
+ addRemotePublicOptions(remote
13255
+ .command('update')
13256
+ .description('更新当前绑定的远程用户小程序基础信息')
13257
+ .option('--name <name>', '小程序名称')
13258
+ .option('--preview-image-url <url>', '远程预览图 HTTPS URL')).action(createRemoteAction(handlers, resolveLogger, 'update', (command) => pickOptions(command, ['name', 'previewImageUrl'])));
13259
+ const allowlist = addRemotePublicOptions(remote.command('allowlist').description('管理当前绑定小程序的预览白名单'));
13260
+ addRemotePublicOptions(allowlist.command('list').description('查看预览白名单')).action(createRemoteAction(handlers, resolveLogger, 'allowlist:list'));
13261
+ addRemotePublicOptions(allowlist.command('add').description('添加预览白名单 Heybox ID').argument('<heybox-id...>', 'Heybox ID')).action(createRemoteAction(handlers, resolveLogger, 'allowlist:add', (_command, heyboxIds) => ({
13262
+ heyboxIds: readStringArrayArgument(heyboxIds, 'heybox-id'),
13263
+ })));
13264
+ addRemotePublicOptions(allowlist.command('remove').description('移除预览白名单 Heybox ID').argument('<heybox-id...>', 'Heybox ID')).action(createRemoteAction(handlers, resolveLogger, 'allowlist:remove', (_command, heyboxIds) => ({
13265
+ heyboxIds: readStringArrayArgument(heyboxIds, 'heybox-id'),
13266
+ })));
13267
+ addRemotePublicOptions(allowlist.command('set').description('替换预览白名单 Heybox ID').argument('<heybox-id...>', 'Heybox ID')).action(createRemoteAction(handlers, resolveLogger, 'allowlist:set', (_command, heyboxIds) => ({
13268
+ heyboxIds: readStringArrayArgument(heyboxIds, 'heybox-id'),
13269
+ })));
13270
+ addRemotePublicOptions(remote
13271
+ .command('deploy')
13272
+ .description('构建并提交当前小程序版本审核')
13273
+ .option('--skip-build', '跳过 build,直接读 dist 目录上传并提交审核')
13274
+ .option('--release-note <text>', '发布日志,提交审核必填')
13275
+ .option('--auto-publish', '审核通过后自动发布;默认需在 CLI 中手动发布')).action(createRemoteAction(handlers, resolveLogger, 'deploy', (command) => {
13276
+ const options = readCommandOptionsWithAncestors(command);
13277
+ return {
13278
+ autoPublish: Boolean(options.autoPublish),
13279
+ releaseNote: readStringOption(options.releaseNote),
13280
+ skipBuild: Boolean(options.skipBuild),
13281
+ };
13282
+ }));
13283
+ addRemotePublicOptions(remote.command('versions').description('列出当前绑定小程序的远程版本')).action(createRemoteAction(handlers, resolveLogger, 'versions'));
13284
+ addRemotePublicOptions(remote.command('preview').description('查看指定版本的预览信息').argument('<version>', '版本号')).action(createRemoteAction(handlers, resolveLogger, 'preview', (_command, version) => ({
13285
+ version: readStringArgument(version, 'version'),
13286
+ })));
13287
+ addRemotePublicOptions(remote.command('release').description('发布指定已审核通过的版本').argument('<version>', '版本号').option('--yes', '跳过危险操作确认')).action(createRemoteAction(handlers, resolveLogger, 'release', (command, version) => ({
13288
+ version: readStringArgument(version, 'version'),
13289
+ ...readYesOption(command),
13290
+ })));
13291
+ addRemotePublicOptions(remote
13292
+ .command('withdraw')
13293
+ .description('撤回指定审核中或已通过的版本')
13294
+ .argument('<version>', '版本号')
13295
+ .option('--yes', '跳过危险操作确认')
13296
+ .option('--reason <text>', '撤回原因')).action(createRemoteAction(handlers, resolveLogger, 'withdraw', (command, version) => ({
13297
+ reason: readStringOption(readCommandOptionsWithAncestors(command).reason),
13298
+ version: readStringArgument(version, 'version'),
13299
+ ...readYesOption(command),
13300
+ })));
13301
+ addRemotePublicOptions(remote.command('take-down').description('下架当前在线小程序').option('--yes', '跳过危险操作确认')).action(createRemoteAction(handlers, resolveLogger, 'take-down', (command) => readYesOption(command)));
13302
+ addRemotePublicOptions(remote.command('reopen').description('重新上架已下架小程序').option('--yes', '跳过危险操作确认')).action(createRemoteAction(handlers, resolveLogger, 'reopen', (command) => readYesOption(command)));
13303
+ }
13304
+ function createRemoteAction(handlers, resolveLogger, commandName, getCommandOptions = () => ({})) {
13305
+ return withUpdateReminder(async (...args) => {
13306
+ const command = readCommandFromActionArgs(args);
13307
+ if (!command) {
13308
+ throw new Error('无法解析 remote 命令上下文');
13309
+ }
13310
+ const logger = resolveLogger(command);
13311
+ const commandArgs = args.slice(0, -2);
13312
+ await handlers.runRemoteCommand({
13313
+ command: commandName,
13314
+ ...readRemoteCommonOptions(command),
13315
+ ...getCommandOptions(command, ...commandArgs),
13316
+ }, { logger });
13317
+ }, handlers.printUpdateReminder, resolveLogger);
13318
+ }
13319
+ function readRemoteCommonOptions(command) {
13320
+ const options = readCommandOptionsWithAncestors(command);
13321
+ return {
13322
+ allowUnsafeApiBaseUrl: Boolean(options.allowUnsafeApiBaseUrl),
13323
+ apiBaseUrl: readStringOption(options.apiBaseUrl),
13324
+ json: Boolean(options.json),
13325
+ loginBaseUrl: readStringOption(options.loginBaseUrl),
13326
+ verbose: Boolean(options.verbose),
13327
+ };
13328
+ }
13329
+ function readYesOption(command) {
13330
+ return {
13331
+ yes: Boolean(readCommandOptionsWithAncestors(command).yes),
13332
+ };
13333
+ }
13334
+ function pickOptions(command, keys) {
13335
+ const options = readCommandOptionsWithAncestors(command);
13336
+ const picked = {};
13337
+ for (const key of keys) {
13338
+ const value = readStringOption(options[key]);
13339
+ if (value !== undefined) {
13340
+ picked[key] = value;
13341
+ }
13342
+ }
13343
+ return picked;
13344
+ }
13345
+ function readStringOption(value) {
13346
+ return typeof value === 'string' ? value : undefined;
13347
+ }
13348
+ function readStringArgument(value, name) {
13349
+ if (typeof value !== 'string') {
13350
+ throw new Error(`无法解析 ${name} 参数`);
13351
+ }
13352
+ return value;
13353
+ }
13354
+ function readStringArrayArgument(value, name) {
13355
+ if (!Array.isArray(value) || !value.every((item) => typeof item === 'string')) {
13356
+ throw new Error(`无法解析 ${name} 参数`);
13357
+ }
13358
+ return value;
13359
+ }
13232
13360
  function hasVerboseArg(argv) {
13233
13361
  return argv.includes('--verbose') || argv.includes('-v');
13234
13362
  }
@@ -13249,33 +13377,33 @@ function createCommandLoggerResolver(options) {
13249
13377
  };
13250
13378
  }
13251
13379
  const defaultClearLoginStatus = async (...args) => {
13252
- const { clearLoginStatus } = await Promise.resolve().then(function () { return require('./login-BQo2pIkq.cjs'); });
13380
+ const { clearLoginStatus } = await Promise.resolve().then(function () { return require('./login-OqaEx-Wd.cjs'); });
13253
13381
  return clearLoginStatus(...args);
13254
13382
  };
13255
13383
  const defaultLoginToHeybox = async (...args) => {
13256
- const { loginToHeybox } = await Promise.resolve().then(function () { return require('./login-BQo2pIkq.cjs'); });
13384
+ const { loginToHeybox } = await Promise.resolve().then(function () { return require('./login-OqaEx-Wd.cjs'); });
13257
13385
  return loginToHeybox(...args);
13258
13386
  };
13259
13387
  const defaultPrintLoginStatus = async (...args) => {
13260
- const { printLoginStatus } = await Promise.resolve().then(function () { return require('./login-BQo2pIkq.cjs'); });
13388
+ const { printLoginStatus } = await Promise.resolve().then(function () { return require('./login-OqaEx-Wd.cjs'); });
13261
13389
  return printLoginStatus(...args);
13262
13390
  };
13263
13391
  const defaultRunCreateCommand = async (...args) => {
13264
- const { runCreateCommand } = await Promise.resolve().then(function () { return require('./create-DAW1oAnH.cjs'); });
13392
+ const { runCreateCommand } = await Promise.resolve().then(function () { return require('./create-BahMMgJH.cjs'); });
13265
13393
  return runCreateCommand(...args);
13266
13394
  };
13267
- const defaultRunDeployCommand = async (...args) => {
13268
- const { runDeployCommand } = await Promise.resolve().then(function () { return require('./deploy-BaLyuR1X.cjs'); }).then(function (n) { return n.deploy; });
13269
- return runDeployCommand(...args);
13270
- };
13271
13395
  const defaultRunDevCommand = async (...args) => {
13272
- const { runDevCommand } = await Promise.resolve().then(function () { return require('./dev-BA_4fnzO.cjs'); });
13396
+ const { runDevCommand } = await Promise.resolve().then(function () { return require('./dev-CTuXVPpU.cjs'); });
13273
13397
  return runDevCommand(...args);
13274
13398
  };
13275
13399
  const defaultRunDoctorCommand = async (...args) => {
13276
- const { runDoctorCommand } = await Promise.resolve().then(function () { return require('./doctor-Bbv8Lzu_.cjs'); });
13400
+ const { runDoctorCommand } = await Promise.resolve().then(function () { return require('./doctor-9gg3ZIvt.cjs'); });
13277
13401
  return runDoctorCommand(...args);
13278
13402
  };
13403
+ const defaultRunRemoteCommand = async (...args) => {
13404
+ const { runRemoteCommand } = await Promise.resolve().then(function () { return require('./remote-zX17hOT4.cjs'); }).then(function (n) { return n.remote; });
13405
+ return runRemoteCommand(...args);
13406
+ };
13279
13407
  function resolveStandaloneLogger(options, verbose) {
13280
13408
  return options.logger ?? options.createLogger?.({ verbose }) ?? createCliLogger({ verbose });
13281
13409
  }
@@ -13283,7 +13411,16 @@ function readCommandVerbose(command) {
13283
13411
  if (!command) {
13284
13412
  return false;
13285
13413
  }
13286
- return Boolean(command.optsWithGlobals?.().verbose || command.opts().verbose);
13414
+ return Boolean(readCommandOptionsWithAncestors(command).verbose);
13415
+ }
13416
+ function readCommandOptionsWithAncestors(command) {
13417
+ const chain = [];
13418
+ let current = command;
13419
+ while (current) {
13420
+ chain.push(current);
13421
+ current = current.parent;
13422
+ }
13423
+ return Object.assign({}, ...chain.reverse().map((item) => item.opts()));
13287
13424
  }
13288
13425
  function installVersionUpdateReminder(program, printUpdateReminder, resolveLogger) {
13289
13426
  const parseAsync = program.parseAsync.bind(program);
@@ -13292,7 +13429,7 @@ function installVersionUpdateReminder(program, printUpdateReminder, resolveLogge
13292
13429
  if (isVersionRequest(argv, parseOptions)) {
13293
13430
  const logger = resolveLogger(hasVerboseArg(getUserArgs(argv, parseOptions)));
13294
13431
  logger.raw(getCliVersion(), { stream: 'stdout' });
13295
- await printUpdateReminder({ logger });
13432
+ await printUpdateReminder({ forceRefresh: true, logger });
13296
13433
  throw new CommanderError(0, 'commander.version', 'version displayed');
13297
13434
  }
13298
13435
  return parseAsync(...args);