@hcmai/cli 0.3.6 → 0.3.7

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/dist/index.js CHANGED
@@ -2286,9 +2286,9 @@ async function loginCommand(args) {
2286
2286
  } catch (e) {
2287
2287
  const err = e;
2288
2288
  if (err.isAxiosError) {
2289
- const { fromAxiosError: fromAxiosError19 } = await import("@hcmai/sdk");
2289
+ const { fromAxiosError: fromAxiosError20 } = await import("@hcmai/sdk");
2290
2290
  exitWithError(
2291
- fromAxiosError19(
2291
+ fromAxiosError20(
2292
2292
  e,
2293
2293
  envName
2294
2294
  )
@@ -8644,12 +8644,63 @@ async function deliveryDoctorCommand(args) {
8644
8644
  }
8645
8645
  }
8646
8646
 
8647
+ // src/commands/delivery-recon.ts
8648
+ init_auth_guard();
8649
+ init_exit();
8650
+ import {
8651
+ HcmClient as HcmClient19,
8652
+ ReconLayout,
8653
+ ROUND_EXIT_CODES,
8654
+ computeReconSourceKey,
8655
+ formatObject as formatObject20,
8656
+ fromAxiosError as fromAxiosError18,
8657
+ httpProbe as httpProbe2,
8658
+ inspectRound,
8659
+ renderRound,
8660
+ runRecon
8661
+ } from "@hcmai/sdk";
8662
+ var DEFAULT_CAPABILITIES2 = "default";
8663
+ async function deliveryReconCommand(args) {
8664
+ try {
8665
+ const ctx = await getActiveAuthContextFromCli(args);
8666
+ const client3 = HcmClient19.fromAuthContext(ctx);
8667
+ const probe = httpProbe2(client3.raw(), args.capabilities ?? DEFAULT_CAPABILITIES2);
8668
+ const sourceKey = await computeReconSourceKey(probe);
8669
+ const layout = new ReconLayout(args.out ?? ".", ctx.tenantId, sourceKey);
8670
+ const summary = await runRecon(probe, layout, {
8671
+ state: args.state ?? "",
8672
+ onlyModel: args.model ?? null,
8673
+ identity: ctx.tenantId ? { requestedTenantId: ctx.tenantId } : null
8674
+ });
8675
+ process.stdout.write(formatObject20(summary, { format: args.output ?? "json" }) + "\n");
8676
+ } catch (e) {
8677
+ const err = e;
8678
+ if (err?.isAxiosError) exitWithError(fromAxiosError18(err, args.env));
8679
+ exitWithError(e);
8680
+ process.exit(1);
8681
+ }
8682
+ }
8683
+ async function deliveryReconRoundCommand(args) {
8684
+ let code;
8685
+ try {
8686
+ const result2 = inspectRound(args.dir ?? ".");
8687
+ const fmt = args.output ?? "json";
8688
+ if (fmt !== "json") process.stdout.write(renderRound(result2));
8689
+ process.stdout.write(formatObject20(result2, { format: fmt }) + "\n");
8690
+ code = ROUND_EXIT_CODES[result2.state];
8691
+ } catch (e) {
8692
+ exitWithError(e);
8693
+ code = 1;
8694
+ }
8695
+ process.exit(code);
8696
+ }
8697
+
8647
8698
  // src/commands/delivery-execution.ts
8648
8699
  import { createHash as createHash7, randomBytes as secureRandomBytes } from "crypto";
8649
8700
  import { spawn } from "child_process";
8650
8701
  import { createReadStream as createReadStream2, promises as fs8 } from "fs";
8651
8702
  import path8 from "path";
8652
- import { CliError as CliError22, CliErrorCode as CliErrorCode21, formatObject as formatObject20 } from "@hcmai/sdk";
8703
+ import { CliError as CliError22, CliErrorCode as CliErrorCode21, formatObject as formatObject21 } from "@hcmai/sdk";
8653
8704
  init_exit();
8654
8705
  var EXECUTION_CONTRACT_VERSION = "2026-08-29.controlled-v2";
8655
8706
  var DEFAULT_TTL_SECONDS = 15 * 60;
@@ -8805,7 +8856,7 @@ async function deliveryPrepareCommand(argv, args) {
8805
8856
  evidenceDir: args.evidenceDir,
8806
8857
  ...ttlSeconds === void 0 ? {} : { ttlSeconds }
8807
8858
  });
8808
- process.stdout.write(formatObject20(plan, { format: args.output ?? "json" }) + "\n");
8859
+ process.stdout.write(formatObject21(plan, { format: args.output ?? "json" }) + "\n");
8809
8860
  } catch (cause) {
8810
8861
  exitWithError(cause);
8811
8862
  }
@@ -8817,7 +8868,7 @@ async function deliveryExecuteCommand(planId, argv, args) {
8817
8868
  planId,
8818
8869
  argv
8819
8870
  });
8820
- process.stdout.write(formatObject20(receipt, { format: args.output ?? "json" }) + "\n");
8871
+ process.stdout.write(formatObject21(receipt, { format: args.output ?? "json" }) + "\n");
8821
8872
  process.exitCode = receipt.exitCode;
8822
8873
  } catch (cause) {
8823
8874
  exitWithError(cause);
@@ -9181,10 +9232,10 @@ function invalid4(message, cause) {
9181
9232
  init_auth_guard();
9182
9233
  init_exit();
9183
9234
  import {
9184
- HcmClient as HcmClient19,
9235
+ HcmClient as HcmClient20,
9185
9236
  adminResetPassword,
9186
- formatObject as formatObject21,
9187
- fromAxiosError as fromAxiosError18,
9237
+ formatObject as formatObject22,
9238
+ fromAxiosError as fromAxiosError19,
9188
9239
  CliError as CliError23,
9189
9240
  CliErrorCode as CliErrorCode22
9190
9241
  } from "@hcmai/sdk";
@@ -9215,12 +9266,12 @@ async function userResetPasswordCommand(args) {
9215
9266
  try {
9216
9267
  const password = args.passwordStdin ? await readSecretFromStdin() : await promptPasswordTwice();
9217
9268
  const request = buildAdminResetPasswordRequest(args, password);
9218
- const client3 = HcmClient19.fromAuthContext(await getActiveAuthContextFromCli(args));
9269
+ const client3 = HcmClient20.fromAuthContext(await getActiveAuthContextFromCli(args));
9219
9270
  const result2 = await adminResetPassword(client3.raw(), request);
9220
- process.stdout.write(formatObject21(result2, { format: args.output ?? "json" }) + "\n");
9271
+ process.stdout.write(formatObject22(result2, { format: args.output ?? "json" }) + "\n");
9221
9272
  } catch (cause) {
9222
9273
  const err = cause;
9223
- if (err?.isAxiosError) exitWithError(fromAxiosError18(err, args.env));
9274
+ if (err?.isAxiosError) exitWithError(fromAxiosError19(err, args.env));
9224
9275
  exitWithError(cause);
9225
9276
  }
9226
9277
  }
@@ -9278,6 +9329,13 @@ user.command("reset-password").description("\u7531 admin.system \u5B89\u5168\u91
9278
9329
  var delivery = program.command("delivery").description("\u987E\u95EE\u4EA4\u4ED8\uFF1A\u73B0\u573A\u63A2\u6D3B\u3001\u98CE\u9669\u8BC4\u4F30\u4E0E\u4E00\u6B21\u6027\u53D7\u63A7\u6267\u884C\u5408\u540C");
9279
9330
  delivery.command("assess").description("\u8BC4\u4F30\u4E00\u6B21 HCM CLI argv\uFF1BAction \u98CE\u63A7\u58F0\u660E\u8BFB\u53D6\u81EA\u76EE\u6807 Core\uFF0C\u7528 -- \u5206\u9694\u88AB\u8BC4\u4F30\u547D\u4EE4").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "json").allowUnknownOption(true).argument("<command...>", "\u88AB\u8BC4\u4F30\u7684 HCM \u5B50\u547D\u4EE4\u4E0E\u53C2\u6570\uFF0C\u4E0D\u5305\u542B hcm \u672C\u8EAB").action((command, opts) => deliveryAssessCommand(command, opts));
9280
9331
  delivery.command("doctor").description("\u56DB\u6761\u951A\u70B9\u63A2\u6D3B\uFF1A\u8FDE\u901A / \u6211\u662F\u8C01 / configAdmin / \u7AD9\u5728\u54EA\u4E00\u5C42").option("--env <name>", "\u76EE\u6807\u73AF\u5883\u522B\u540D").option("--as <identity>", "\u4E34\u65F6\u6362\u8EAB\u4EFD").option("--capabilities <s>", "\u722C\u53D6\u65F6\u58F0\u660E\u7684 capability \u4E32\uFF08\u4F1A\u968F\u56DB\u5143\u7EC4\u7559\u6863\uFF09").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "json").action((opts) => deliveryDoctorCommand(opts));
9332
+ var recon = delivery.command("recon").description("\u722C\u4E00\u4EFD\u53EF\u5E26\u8D70\u7684\u57FA\u7EBF\uFF1A\u6A21\u578B / \u5B57\u6BB5 / \u53EA\u8BFB\u95F8 / \u4F9D\u8D56\u56FE / \u7801\u8868 / \u53EF\u5199\u6027\u753B\u50CF").option("--env <name>", "\u76EE\u6807\u73AF\u5883\u522B\u540D").option("--as <identity>", "\u4E34\u65F6\u6362\u8EAB\u4EFD").option("--out <dir>", "\u4EA7\u7269\u6839\u76EE\u5F55\uFF08\u4EA7\u7269\u843D\u5728 <out>/recon/<\u79DF\u6237\u6BB5>/<\u6765\u6E90\u6BB5>\uFF09", ".").option("--state <s>", "\u53EA\u8BFB\u95F8\u7684 state\uFF08\u4EA7\u54C1\u91CC state \u4E0D\u53EF\u679A\u4E3E\uFF0C\u95F8\u7684\u8986\u76D6\u9762\u6C38\u8FDC\u662F state-scoped\uFF09").option("--model <key>", "\u5B9A\u5411\u91CD\u722C\uFF1A\u53EA\u91CD\u722C\u8FD9\u4E00\u4E2A\u6A21\u578B\uFF0C\u5176\u4F59\u6CBF\u7528\u4E0A\u4E00\u8F6E\u4EA7\u7269").option("--capabilities <s>", "\u722C\u53D6\u65F6\u58F0\u660E\u7684 capability \u4E32\uFF08\u4F1A\u968F\u56DB\u5143\u7EC4\u7559\u6863\uFF09").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "json").action((opts) => deliveryReconCommand(opts));
9333
+ recon.command("round").description("\u96F6\u7F51\u7EDC\uFF1A\u8BFB\u4E00\u4EFD\u5DF2\u843D\u76D8\u7684\u57FA\u7EBF\uFF0C\u5224\u65AD\u5B83\u662F\u4E0D\u662F\u4E00\u8F6E\u5B8C\u6574\u8DD1\u51FA\u6765\u7684\uFF08complete/mixed/unknown\uFF09").option("--dir <dir>", "\u4EA7\u7269\u76EE\u5F55\uFF08<out>/recon/<\u79DF\u6237\u6BB5>/<\u6765\u6E90\u6BB5>\uFF09", ".").action(
9334
+ (opts, cmd) => deliveryReconRoundCommand({
9335
+ ...opts,
9336
+ output: cmd.parent?.opts()?.output
9337
+ })
9338
+ );
9281
9339
  delivery.command("prepare").description("\u628A\u53D7\u652F\u6301\u7684 R2 argv \u4E0E\u9501\u3001\u8FD0\u884C\u65F6\u548C\u53D8\u66F4/\u56DE\u6EDA\u8BF4\u660E\u7ED1\u5B9A\u4E3A\u77ED\u65F6\u6267\u884C\u8BA1\u5212").requiredOption("--change-ref <file>", "\u9879\u76EE work/ \u6216 decisions/ \u4E0B\u7684\u53D8\u66F4\u8BF4\u660E").requiredOption("--rollback-ref <file>", "\u9879\u76EE work/ \u6216 decisions/ \u4E0B\u7684\u56DE\u6EDA\u8BF4\u660E").requiredOption("--evidence-dir <dir>", "\u9879\u76EE evidence/ \u4E0B\u7684\u6536\u636E\u76EE\u5F55").option("--project <dir>", "HCM \u987E\u95EE\u9879\u76EE\u6839\u76EE\u5F55", ".").option("--ttl-seconds <n>", "\u6709\u6548\u671F\u79D2\u6570\uFF0860-3600\uFF09", "900").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "json").allowUnknownOption(true).argument("<command...>", "\u88AB\u7ED1\u5B9A\u7684 R2 HCM \u5B50\u547D\u4EE4\u4E0E\u53C2\u6570\uFF0C\u4E0D\u5305\u542B hcm \u672C\u8EAB").action((command, opts) => deliveryPrepareCommand(command, opts));
9282
9340
  delivery.command("execute <planId>").description("\u9010\u6B21\u6279\u51C6\u540E\u6D88\u8D39\u77ED\u65F6\u8BA1\u5212\uFF0C\u5E76\u6267\u884C\u4E00\u6B21\u4E0E\u8BA1\u5212\u5B8C\u5168\u76F8\u540C\u7684 R2 argv").option("--project <dir>", "HCM \u987E\u95EE\u9879\u76EE\u6839\u76EE\u5F55", ".").option("--output <fmt>", "\u6536\u636E\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "json").allowUnknownOption(true).argument("<command...>", "\u4E0E prepare \u5B8C\u5168\u76F8\u540C\u7684 R2 HCM \u5B50\u547D\u4EE4\u4E0E\u53C2\u6570").action((planId, command, opts) => deliveryExecuteCommand(planId, command, opts));
9283
9341
  program.command("query <Model>").description("\u67E5\u8BE2 Model \u5217\u8868\u6570\u636E\uFF08\u901A\u8FC7 ModelQueryDsl JSON \u8868\u8FBE\u8FC7\u6EE4/\u6392\u5E8F/\u5206\u9875\uFF09").option(