@hcmai/cli 0.15.8 → 0.15.9

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
@@ -3842,15 +3842,7 @@ import {
3842
3842
  } from "@hcmai/sdk";
3843
3843
  async function queryCommand(model, args) {
3844
3844
  try {
3845
- const dsl = {};
3846
- if (args.filter) dsl.filter = parseJsonOrThrow(args.filter, "--filter");
3847
- if (args.sort) dsl.sort = parseJsonOrThrow(args.sort, "--sort");
3848
- if (args.additions) dsl.additions = parseAdditionsOrThrow(args.additions);
3849
- if (args.fields) dsl.fields = args.fields.split(",").map((s) => s.trim());
3850
- if (args.keyword) dsl.keyword = args.keyword;
3851
- if (args.limit) dsl.limit = Number(args.limit);
3852
- if (args.offset) dsl.offset = Number(args.offset);
3853
- if (!dsl.limit) dsl.limit = 20;
3845
+ const dsl = buildQueryDsl(args);
3854
3846
  const client3 = HcmClient2.fromAuthContext(await getActiveAuthContextFromCli(args));
3855
3847
  const result = await client3.query(model, dsl);
3856
3848
  const fmt = args.output ?? "table";
@@ -3863,6 +3855,19 @@ async function queryCommand(model, args) {
3863
3855
  exitWithError(e);
3864
3856
  }
3865
3857
  }
3858
+ function buildQueryDsl(args) {
3859
+ const dsl = {};
3860
+ if (args.plugin) dsl.plugin = args.plugin;
3861
+ if (args.filter) dsl.filter = parseJsonOrThrow(args.filter, "--filter");
3862
+ if (args.sort) dsl.sort = parseJsonOrThrow(args.sort, "--sort");
3863
+ if (args.additions) dsl.additions = parseAdditionsOrThrow(args.additions);
3864
+ if (args.fields) dsl.fields = args.fields.split(",").map((s) => s.trim());
3865
+ if (args.keyword) dsl.keyword = args.keyword;
3866
+ if (args.limit) dsl.limit = Number(args.limit);
3867
+ if (args.offset) dsl.offset = Number(args.offset);
3868
+ if (!dsl.limit) dsl.limit = 20;
3869
+ return dsl;
3870
+ }
3866
3871
  function printQueryResult(result, fmt) {
3867
3872
  const out = formatRows(result.rows, { format: fmt });
3868
3873
  process.stdout.write(out + "\n");
@@ -8621,6 +8626,9 @@ async function skillsSyncCommand(args, deps = defaultSkillsSyncDeps) {
8621
8626
  // src/commands/tenant.ts
8622
8627
  import {
8623
8628
  bootstrapTenant,
8629
+ resetTenant,
8630
+ HcmClient as HcmClient19,
8631
+ readSessionPrincipal as readSessionPrincipal2,
8624
8632
  discoverProjectEnv as discoverProjectEnv4,
8625
8633
  assertDangerWrite as assertDangerWrite3,
8626
8634
  normalizeOrigin as normalizeOrigin4,
@@ -8634,6 +8642,71 @@ import {
8634
8642
  CliErrorCode as CliErrorCode20
8635
8643
  } from "@hcmai/sdk";
8636
8644
  init_exit();
8645
+ init_auth_guard();
8646
+ async function tenantResetCommand(args) {
8647
+ let attempted = false;
8648
+ try {
8649
+ const fmt = args.output ?? "json";
8650
+ if (!["table", "json", "yaml"].includes(fmt)) throw new CliError21({
8651
+ code: CliErrorCode20.INVALID_ARGUMENT,
8652
+ message: "--output \u53D6\u503C table | json | yaml"
8653
+ });
8654
+ const ctx = await getActiveAuthContextFromCli(args);
8655
+ if (ctx.impersonation) throw new CliError21({
8656
+ code: CliErrorCode20.SCOPE_FORBIDDEN,
8657
+ message: "\u79DF\u6237\u91CD\u7F6E\u4E0D\u63A5\u53D7\u4EE3\u7406\u4F1A\u8BDD\uFF0C\u8BF7\u7528\u5185\u7F6E admin \u7684\u76F4\u63A5\u767B\u5F55\u8EAB\u4EFD\u3002"
8658
+ });
8659
+ const { endpoint, tenantId, env: env2 } = ctx;
8660
+ const safety = ctx.environmentSafety ? { ...ctx.environmentSafety } : void 0;
8661
+ assertDangerWrite3(safety, "\u91CD\u7F6E\u79DF\u6237 PostgreSQL \u6570\u636E");
8662
+ const accessToken = await HcmClient19.fromAuthContext(ctx).getAccessToken();
8663
+ if (!accessToken) throw new CliError21({ code: CliErrorCode20.AUTH_FAILED, message: "\u5F53\u524D\u8EAB\u4EFD\u6CA1\u6709\u53EF\u8BFB\u53D6\u7684\u51ED\u636E\uFF0C\u672A\u53D1\u9001\u91CD\u7F6E\u3002" });
8664
+ const client3 = new HcmClient19({ endpoint, tenantId, accessToken, profile: env2, environmentSafety: safety });
8665
+ client3.raw().defaults.maxRedirects = 0;
8666
+ client3.raw().defaults.__skipRetry = true;
8667
+ const principal = await readSessionPrincipal2(client3.raw());
8668
+ if (principal.tenantId !== tenantId || principal.username !== "admin" || !principal.roles?.includes("admin.system") || principal.impersonated || principal.actSub != null) {
8669
+ throw new CliError21({
8670
+ code: CliErrorCode20.SCOPE_FORBIDDEN,
8671
+ message: `\u5B9E\u9645\u8EAB\u4EFD ${principal.username} / \u79DF\u6237 ${principal.tenantId} \u4E0D\u662F\u76EE\u6807 ${tenantId} \u7684\u76F4\u63A5\u5185\u7F6E\u7BA1\u7406\u5458\uFF0C\u672A\u53D1\u9001\u91CD\u7F6E\u3002`,
8672
+ context: { nextStep: `hcm login --env ${env2} \u767B\u5F55\u76EE\u6807\u79DF\u6237\u7684\u5185\u7F6E admin \u540E\u91CD\u8BD5\u3002` }
8673
+ });
8674
+ }
8675
+ process.stderr.write(`\u2192 \u91CD\u7F6E\u76EE\u6807 ${endpoint} \xB7 \u73AF\u5883 ${env2} \xB7 \u79DF\u6237 ${tenantId} \xB7 \u7528\u6237 ${principal.username}
8676
+ \u5C06\u4E0D\u53EF\u9006\u5730\u5220\u9664 PostgreSQL \u4E1A\u52A1\u6570\u636E\u5E76\u6062\u590D\u51FA\u5382\u57FA\u7EBF\uFF1BMongo\u3001\u6587\u6863\u5BF9\u8C61\u4E0E\u5916\u90E8\u5411\u91CF\u4E0D\u5904\u7406\u3001\u4E0D\u6838\u9A8C\u3002
8677
+ `);
8678
+ if (!args.yes) {
8679
+ if (!process.stdin.isTTY) throw new CliError21({
8680
+ code: CliErrorCode20.INVALID_ARGUMENT,
8681
+ message: "\u975E\u4EA4\u4E92\u8F93\u5165\u672A\u786E\u8BA4\u79DF\u6237\u91CD\u7F6E\uFF0C\u672A\u53D1\u9001\u91CD\u7F6E\u3002",
8682
+ context: { nextStep: "\u6838\u5BF9\u4E0A\u8FF0\u76EE\u6807\u4E0E\u5F71\u54CD\u540E\u663E\u5F0F\u52A0 --yes\uFF1B\u5371\u9669\u73AF\u5883\u8FD8\u9700\u8981 --allow-danger\u3002" }
8683
+ });
8684
+ const answer = await promptText("\u786E\u8BA4\u91CD\u7F6E\u8FD9\u4E2A\u79DF\u6237\uFF1F\u8F93\u5165 yes \u7EE7\u7EED\uFF1A", process.stderr);
8685
+ if (!/^y(es)?$/i.test(answer)) throw new CliError21({ code: CliErrorCode20.INVALID_ARGUMENT, message: "\u5DF2\u53D6\u6D88\uFF0C\u672A\u53D1\u9001\u91CD\u7F6E\u3002" });
8686
+ }
8687
+ attempted = true;
8688
+ const receipt = await resetTenant(client3.raw(), tenantId);
8689
+ if (fmt === "table") process.stdout.write(
8690
+ `\u79DF\u6237 ${receipt.tenantId} \xB7 \u6D41\u6C34 ${receipt.runId}
8691
+ \u5220\u9664 ${receipt.deletedRows} \u884C / \u6D89\u53CA ${receipt.touchedTables} \u8868 / \u91CD\u5EFA ${receipt.restoredRows} \u884C
8692
+ PostgreSQL \u6838\u9A8C=${receipt.pgVerified}\uFF1B\u6574\u4F53\u6838\u9A8C=${receipt.overallVerified}\uFF1B\u8BB0\u8D26=${receipt.journalReconciledMarked}
8693
+ \u975E PG ${receipt.nonPgSurface.status}\uFF1A${receipt.nonPgSurface.reason}
8694
+ \u4E0B\u4E00\u6B65\uFF1A${receipt.nonPgSurface.nextStep}
8695
+ `
8696
+ );
8697
+ process.stdout.write(formatObject19(receipt, { format: fmt }) + "\n");
8698
+ const quote = (value) => "'" + value.replace(/'/g, "'\\''") + "'";
8699
+ process.stderr.write(`\u91CD\u7F6E\u5DF2\u6E05\u7406\u5F53\u524D\u4F1A\u8BDD\uFF1B\u8BF7 hcm login --env ${quote(env2)} --endpoint ${quote(endpoint)} --tenant ${quote(tenantId)} \u91CD\u65B0\u767B\u5F55\uFF0C\u518D\u67E5\u8BE2\u6216\u88C5\u5305\u3002
8700
+ `);
8701
+ if (!receipt.journalReconciledMarked) process.stderr.write("\u91CD\u7F6E\u56DE\u6267\u8BB0\u8D26\u672A\u786E\u8BA4\uFF1B\u8BF7\u6309 runId \u6838\u67E5\u670D\u52A1\u7AEF\u6D41\u6C34\uFF0C\u52FF\u56E0\u8BB0\u8D26\u72B6\u6001\u91CD\u8DD1\u91CD\u7F6E\u3002\n");
8702
+ if (!receipt.pgVerified) process.stderr.write("PostgreSQL \u57FA\u7EBF\u672A\u6838\u9A8C\uFF0C\u4E0D\u80FD\u5BA3\u79F0\u91CD\u7F6E\u5B8C\u6210\uFF1B\u8BF7\u6309 runId \u6838\u67E5\u3002\n");
8703
+ process.exitCode = receipt.pgVerified ? 0 : 4;
8704
+ } catch (error) {
8705
+ if (attempted) process.stderr.write("TENANT_RESET_RESULT_UNKNOWN\uFF1A\u672C\u6B21\u5DF2\u5C1D\u8BD5\u4E00\u6B21\u91CD\u7F6E\uFF0C\u7ED3\u679C\u672A\u786E\u8BA4\uFF1B\u672A\u81EA\u52A8\u91CD\u8BD5\u3002\u4E0D\u8981\u76F2\u76EE\u91CD\u8DD1\uFF0C\u8BF7\u6838\u67E5\u670D\u52A1\u7AEF\u6D41\u6C34\u4E0E\u5F53\u524D\u79DF\u6237\u72B6\u6001\u3002\n");
8706
+ const e = error;
8707
+ exitWithError(e?.isAxiosError ? fromAxiosError18(error, args.env) : error);
8708
+ }
8709
+ }
8637
8710
  async function resolveBootstrapKey(args, stdinTaken) {
8638
8711
  const fromEnv = process.env.HCM_BOOTSTRAP_KEY;
8639
8712
  if (fromEnv) return fromEnv;
@@ -8743,7 +8816,7 @@ import { promises as fsp3 } from "fs";
8743
8816
  import os4 from "os";
8744
8817
  import nodePath from "path";
8745
8818
  import {
8746
- HcmClient as HcmClient19,
8819
+ HcmClient as HcmClient20,
8747
8820
  formatObject as formatObject20,
8748
8821
  fromAxiosError as fromAxiosError19,
8749
8822
  listTenantMeta,
@@ -8762,7 +8835,7 @@ init_exit();
8762
8835
  init_impersonation_lifecycle();
8763
8836
  init_auth_guard();
8764
8837
  async function client2(args) {
8765
- return HcmClient19.fromAuthContext(await getActiveAuthContextFromCli(args));
8838
+ return HcmClient20.fromAuthContext(await getActiveAuthContextFromCli(args));
8766
8839
  }
8767
8840
  function formatMetaForbiddenMessage(mode = "write") {
8768
8841
  if (mode === "read") {
@@ -9089,7 +9162,7 @@ import {
9089
9162
  formatObject as formatObject21,
9090
9163
  formatRows as formatRows5,
9091
9164
  getMiniStatus,
9092
- HcmClient as HcmClient20,
9165
+ HcmClient as HcmClient21,
9093
9166
  initMiniAppProject,
9094
9167
  inferMiniWritableTemplateOptionsFromModel,
9095
9168
  listWorkspaceFiles,
@@ -9146,7 +9219,7 @@ var RAW_WORKSPACE_EXCLUDED_DIRS = /* @__PURE__ */ new Set([
9146
9219
  var RAW_WORKSPACE_EXCLUDED_FILES = /* @__PURE__ */ new Set([WORKSPACE_CONTEXT_FILE, ".DS_Store"]);
9147
9220
  async function workspaceListCommand(args) {
9148
9221
  try {
9149
- const client3 = HcmClient20.fromAuthContext(await getActiveAuthContextFromCli(args));
9222
+ const client3 = HcmClient21.fromAuthContext(await getActiveAuthContextFromCli(args));
9150
9223
  const limit = parsePositiveInt3(args.limit, 50, "--limit");
9151
9224
  const result = await client3.query("TenantExtensionWorkspace", {
9152
9225
  keyword: args.keyword,
@@ -9179,7 +9252,7 @@ async function workspaceActiveCommand(args) {
9179
9252
  const ctx = await getActiveAuthContextFromCli(args, {
9180
9253
  fallbackEnv: localContext?.profile
9181
9254
  });
9182
- const client3 = HcmClient20.fromAuthContext(ctx);
9255
+ const client3 = HcmClient21.fromAuthContext(ctx);
9183
9256
  const result = await client3.query("TenantExtensionWorkspace", {
9184
9257
  filter: { devModeEnabled: true },
9185
9258
  fields: ["workspaceKey", "devModeEnabled"],
@@ -9237,7 +9310,7 @@ async function workspaceCreateCommand(workspaceKey, args) {
9237
9310
  `${WORKSPACE_CONTEXT_FILE} already binds workspace '${existing.workspaceKey}'; use --force to rebind`
9238
9311
  );
9239
9312
  }
9240
- const client3 = HcmClient20.fromAuthContext(await getActiveAuthContextFromCli(args));
9313
+ const client3 = HcmClient21.fromAuthContext(await getActiveAuthContextFromCli(args));
9241
9314
  const normalizedWorkspaceKey = normalizeWorkspaceKey(workspaceKey);
9242
9315
  const resp = await client3.raw().post("/api/models/TenantExtensionWorkspace", {
9243
9316
  workspaceKey: normalizedWorkspaceKey,
@@ -9285,7 +9358,7 @@ async function workspacePullCommand(args) {
9285
9358
  `workspace key is required; pass --workspace <key> or run hcm workspace bind <key> first`
9286
9359
  );
9287
9360
  }
9288
- const client3 = HcmClient20.fromAuthContext(
9361
+ const client3 = HcmClient21.fromAuthContext(
9289
9362
  await getActiveAuthContextFromCli(args, { fallbackEnv: existing?.profile })
9290
9363
  );
9291
9364
  const context = buildWorkspaceContext({
@@ -9545,7 +9618,7 @@ async function workspacePushCommand(args) {
9545
9618
  const rootDir = resolveRootDir(args.dir);
9546
9619
  const context = await requireWorkspaceContext(rootDir);
9547
9620
  const miniApps = await discoverMiniApps(rootDir);
9548
- const client3 = HcmClient20.fromAuthContext(
9621
+ const client3 = HcmClient21.fromAuthContext(
9549
9622
  await getActiveAuthContextFromCli(args, { fallbackEnv: context.profile })
9550
9623
  );
9551
9624
  const activeWorkspaceKey = args.dryRun ? null : await probeActiveWorkspaceKey(client3);
@@ -10093,7 +10166,7 @@ async function readMiniStatusSafely(app) {
10093
10166
  async function loadProfileClient(args) {
10094
10167
  try {
10095
10168
  const ctx = await getActiveAuthContextFromCli(args);
10096
- return HcmClient20.fromAuthContext(ctx);
10169
+ return HcmClient21.fromAuthContext(ctx);
10097
10170
  } catch (e) {
10098
10171
  if (args.env || args.profile) throw e;
10099
10172
  return null;
@@ -10580,7 +10653,7 @@ async function requestWorkspaceDeactivation(client3) {
10580
10653
  }
10581
10654
  async function workspaceActivateCommand(workspaceKey, args) {
10582
10655
  try {
10583
- const client3 = HcmClient20.fromAuthContext(await getActiveAuthContextFromCli(args));
10656
+ const client3 = HcmClient21.fromAuthContext(await getActiveAuthContextFromCli(args));
10584
10657
  const key2 = normalizeWorkspaceKey(workspaceKey);
10585
10658
  await setDevModeBinding(client3, key2);
10586
10659
  const fmt = args.output ?? "table";
@@ -10601,7 +10674,7 @@ async function workspaceActivateCommand(workspaceKey, args) {
10601
10674
  }
10602
10675
  async function workspaceDeactivateCommand(args) {
10603
10676
  try {
10604
- const client3 = HcmClient20.fromAuthContext(await getActiveAuthContextFromCli(args));
10677
+ const client3 = HcmClient21.fromAuthContext(await getActiveAuthContextFromCli(args));
10605
10678
  const binding = await requestWorkspaceDeactivation(client3);
10606
10679
  const result = { ...binding, deactivated: true };
10607
10680
  const fmt = args.output ?? "table";
@@ -10758,7 +10831,7 @@ import path10 from "path";
10758
10831
  import {
10759
10832
  CliError as CliError24,
10760
10833
  CliErrorCode as CliErrorCode23,
10761
- HcmClient as HcmClient21,
10834
+ HcmClient as HcmClient22,
10762
10835
  fetchReconIdentity,
10763
10836
  formatObject as formatObject23,
10764
10837
  httpProbe,
@@ -10772,7 +10845,7 @@ import {
10772
10845
  } from "@hcmai/sdk";
10773
10846
  async function probeTokenTenant(envName, requested) {
10774
10847
  const ctx = await getActiveAuthContextFromCli({ env: envName });
10775
- const client3 = HcmClient21.fromAuthContext(ctx);
10848
+ const client3 = HcmClient22.fromAuthContext(ctx);
10776
10849
  const identity2 = await fetchReconIdentity(httpProbe(client3.raw(), "default"), requested);
10777
10850
  return identity2?.tenantId ? String(identity2.tenantId) : void 0;
10778
10851
  }
@@ -11918,7 +11991,7 @@ init_exit();
11918
11991
  import { promises as fs10 } from "fs";
11919
11992
  import path11 from "path";
11920
11993
  import {
11921
- HcmClient as HcmClient22,
11994
+ HcmClient as HcmClient23,
11922
11995
  CliError as CliError26,
11923
11996
  CliErrorCode as CliErrorCode26,
11924
11997
  loadGlobalConfig as loadGlobalConfig11,
@@ -11933,7 +12006,7 @@ import {
11933
12006
  var defaultDeps2 = {
11934
12007
  anchors: async (envName, tenant2, as, project) => {
11935
12008
  const ctx = await getActiveAuthContextFromCli({ env: envName, as }, { cwd: project });
11936
- const client3 = HcmClient22.fromAuthContext(ctx);
12009
+ const client3 = HcmClient23.fromAuthContext(ctx);
11937
12010
  const probe = httpProbe2(client3.raw(), "default");
11938
12011
  const identity2 = await fetchReconIdentity2(probe, tenant2);
11939
12012
  const report = await runDoctor(probe, identity2, () => probeConversationHandshake({
@@ -12359,7 +12432,7 @@ import { accessSync, constants, readdirSync as readdirSync3 } from "fs";
12359
12432
  import fs12 from "fs/promises";
12360
12433
  import os5 from "os";
12361
12434
  import path14 from "path";
12362
- import { CliError as CliError30, CliErrorCode as CliErrorCode30, formatObject as formatObject27, HcmClient as HcmClient23, loadEnv as loadEnv6 } from "@hcmai/sdk";
12435
+ import { CliError as CliError30, CliErrorCode as CliErrorCode30, formatObject as formatObject27, HcmClient as HcmClient24, loadEnv as loadEnv6 } from "@hcmai/sdk";
12363
12436
  import { createRequire } from "module";
12364
12437
 
12365
12438
  // src/commands/chiron-page-cdp.ts
@@ -12962,7 +13035,7 @@ var defaultChironPageDeps = {
12962
13035
  context: { nextStep: `hcm env edit frontend <\u524D\u7AEF\u5730\u5740> --env ${ctx.env}` }
12963
13036
  });
12964
13037
  }
12965
- const client3 = HcmClient23.fromAuthContext(ctx);
13038
+ const client3 = HcmClient24.fromAuthContext(ctx);
12966
13039
  const { ticket } = await mintBrowserTicket(client3, ctx.env)();
12967
13040
  return { url: buildBrowserLoginUrl(frontend, ticket, sitePath), environment: ctx.env, identity: ctx.identity ?? null };
12968
13041
  },
@@ -13043,7 +13116,7 @@ import { formatObject as formatObject28 } from "@hcmai/sdk";
13043
13116
 
13044
13117
  // src/commands/delivery-action-policy.ts
13045
13118
  init_auth_guard();
13046
- import { HcmClient as HcmClient24, classifyEffect } from "@hcmai/sdk";
13119
+ import { HcmClient as HcmClient25, classifyEffect } from "@hcmai/sdk";
13047
13120
 
13048
13121
  // src/commands/delivery.ts
13049
13122
  import { createHash as createHash6 } from "crypto";
@@ -13558,7 +13631,7 @@ async function resolveCoreAction(request) {
13558
13631
  as: request.identity,
13559
13632
  profile: request.profile
13560
13633
  });
13561
- const description = await HcmClient24.fromAuthContext(auth).describe(request.model);
13634
+ const description = await HcmClient25.fromAuthContext(auth).describe(request.model);
13562
13635
  const named = description.actions.filter((action) => action.name === request.action);
13563
13636
  if (named.length === 0) {
13564
13637
  const degraded = description.effectiveActionsAvailable ? "" : `\u26A0\uFE0F \u672C\u6B21\u6BD4\u5BF9\u4E0D\u542B\u811A\u672C Action\u2014\u2014${description.effectiveActionsNote ?? "\u539F\u56E0\u672A\u77E5"}\u3002`;
@@ -14029,7 +14102,7 @@ ${failed2} \u6761\u6CA1\u8FC7\u2014\u2014\u4E0A\u9762\u6BCF\u6761\u90FD\u5199\u4
14029
14102
  init_auth_guard();
14030
14103
  init_exit();
14031
14104
  import {
14032
- HcmClient as HcmClient25,
14105
+ HcmClient as HcmClient26,
14033
14106
  ReconLayout,
14034
14107
  ROUND_EXIT_CODES,
14035
14108
  computeReconSourceKey,
@@ -14044,7 +14117,7 @@ var DEFAULT_CAPABILITIES = "default";
14044
14117
  async function deliveryReconCommand(args) {
14045
14118
  try {
14046
14119
  const ctx = await getActiveAuthContextFromCli(args);
14047
- const client3 = HcmClient25.fromAuthContext(ctx);
14120
+ const client3 = HcmClient26.fromAuthContext(ctx);
14048
14121
  const probe = httpProbe3(client3.raw(), args.capabilities ?? DEFAULT_CAPABILITIES);
14049
14122
  const sourceKey = await computeReconSourceKey(probe);
14050
14123
  const layout = new ReconLayout(args.out ?? ".", ctx.tenantId, sourceKey);
@@ -14087,7 +14160,7 @@ import {
14087
14160
  DRY_RUN_TAIL,
14088
14161
  DriftDetected,
14089
14162
  FORCE_STALE_FLAG,
14090
- HcmClient as HcmClient26,
14163
+ HcmClient as HcmClient27,
14091
14164
  fetchReconIdentity as fetchReconIdentity3,
14092
14165
  INIT_EXIT_CODES,
14093
14166
  JOURNAL_STOP_KINDS,
@@ -14227,7 +14300,7 @@ async function authOrSignpost(args, cmd) {
14227
14300
  }
14228
14301
  async function deliverySeedPlanCommand(args) {
14229
14302
  const ctx = await authOrSignpost(args, "plan");
14230
- const client3 = HcmClient26.fromAuthContext(ctx);
14303
+ const client3 = HcmClient27.fromAuthContext(ctx);
14231
14304
  process.exitCode = await runSeedPlan(args, seedClient(client3, ctx));
14232
14305
  }
14233
14306
  function seedClient(client3, ctx) {
@@ -14401,7 +14474,7 @@ async function runSeedApply(args, client3) {
14401
14474
  }
14402
14475
  async function deliverySeedApplyCommand(args) {
14403
14476
  const ctx = await authOrSignpost(args, "apply");
14404
- const client3 = HcmClient26.fromAuthContext(ctx);
14477
+ const client3 = HcmClient27.fromAuthContext(ctx);
14405
14478
  process.exitCode = await runSeedApply(args, seedClient(client3, ctx));
14406
14479
  }
14407
14480
  async function runSeedVerify(args, client3) {
@@ -14425,7 +14498,7 @@ async function deliverySeedVerifyCommand(args) {
14425
14498
  return;
14426
14499
  }
14427
14500
  const ctx = await authOrSignpost(args, "verify");
14428
- const client3 = HcmClient26.fromAuthContext(ctx);
14501
+ const client3 = HcmClient27.fromAuthContext(ctx);
14429
14502
  process.exitCode = await runSeedVerify(args, await seedVerifyClient(client3, ctx));
14430
14503
  }
14431
14504
 
@@ -14540,7 +14613,7 @@ import {
14540
14613
  CHANGE_STATES,
14541
14614
  CHANGE_UNKNOWN,
14542
14615
  CODE_WORDS,
14543
- HcmClient as HcmClient27,
14616
+ HcmClient as HcmClient28,
14544
14617
  INIT_EXIT_CODES as INIT_EXIT_CODES3,
14545
14618
  META_WRITE_STEPS,
14546
14619
  META_VERIFY_STEPS,
@@ -14768,7 +14841,7 @@ function lowerCaseHeaders2(headers) {
14768
14841
  }
14769
14842
  async function deliveryMetaCommand(args) {
14770
14843
  const ctx = await getActiveAuthContextFromCli(args);
14771
- const client3 = HcmClient27.fromAuthContext(ctx);
14844
+ const client3 = HcmClient28.fromAuthContext(ctx);
14772
14845
  process.exitCode = await runDeliveryMeta(
14773
14846
  { ...args, tenant: args.tenant ?? String(ctx.tenantId ?? "") },
14774
14847
  metaClient(client3, ctx)
@@ -14780,7 +14853,7 @@ init_auth_guard();
14780
14853
  init_exit();
14781
14854
  import {
14782
14855
  computeReconSourceKey as computeReconSourceKey2,
14783
- HcmClient as HcmClient28,
14856
+ HcmClient as HcmClient29,
14784
14857
  httpProbe as httpProbe4,
14785
14858
  ReconLayout as ReconLayout2,
14786
14859
  runTriageRound
@@ -14836,7 +14909,7 @@ async function runTriage(args) {
14836
14909
  return premise4(e instanceof Error ? e.message : String(e), REQUESTS_SHAPE);
14837
14910
  }
14838
14911
  const ctx = await getActiveAuthContextFromCli(args);
14839
- const client3 = HcmClient28.fromAuthContext(ctx);
14912
+ const client3 = HcmClient29.fromAuthContext(ctx);
14840
14913
  const probe = httpProbe4(client3.raw(), args.capabilities ?? DEFAULT_CAPABILITIES3);
14841
14914
  const artifactsDir = args.recon ?? new ReconLayout2(args.out ?? ".", ctx.tenantId, await computeReconSourceKey2(probe)).dir;
14842
14915
  const result = await runTriageRound(probe, artifactsDir, entriesIn);
@@ -14865,7 +14938,7 @@ async function deliveryTriageCommand(args) {
14865
14938
  init_auth_guard();
14866
14939
  init_exit();
14867
14940
  import {
14868
- HcmClient as HcmClient29,
14941
+ HcmClient as HcmClient30,
14869
14942
  adminResetPassword,
14870
14943
  formatObject as formatObject30,
14871
14944
  fromAxiosError as fromAxiosError23,
@@ -14899,7 +14972,7 @@ async function userResetPasswordCommand(args) {
14899
14972
  try {
14900
14973
  const password = args.passwordStdin ? await readSecretFromStdin() : await promptPasswordTwice();
14901
14974
  const request = buildAdminResetPasswordRequest(args, password);
14902
- const client3 = HcmClient29.fromAuthContext(await getActiveAuthContextFromCli(args));
14975
+ const client3 = HcmClient30.fromAuthContext(await getActiveAuthContextFromCli(args));
14903
14976
  const result = await adminResetPassword(client3.raw(), request);
14904
14977
  process.stdout.write(formatObject30(result, { format: args.output ?? "json" }) + "\n");
14905
14978
  } catch (cause) {
@@ -14924,13 +14997,13 @@ async function promptPasswordTwice() {
14924
14997
  init_exit();
14925
14998
  init_auth_guard();
14926
14999
  import {
14927
- HcmClient as HcmClient30,
15000
+ HcmClient as HcmClient31,
14928
15001
  formatObject as formatObject31,
14929
15002
  fromAxiosError as fromAxiosError24
14930
15003
  } from "@hcmai/sdk";
14931
15004
  async function modelsCommand(keyword, args) {
14932
15005
  try {
14933
- const client3 = HcmClient30.fromAuthContext(await getActiveAuthContextFromCli(args));
15006
+ const client3 = HcmClient31.fromAuthContext(await getActiveAuthContextFromCli(args));
14934
15007
  const all = await client3.listModels();
14935
15008
  const needle = keyword?.trim().toLowerCase();
14936
15009
  const rows2 = (needle ? all.filter((m) => JSON.stringify(m).toLowerCase().includes(needle)) : all).sort((a, b) => key(a).localeCompare(key(b)));
@@ -15134,7 +15207,7 @@ program.command("query <Model>").description("\u67E5\u8BE2 Model \u5217\u8868\u6
15134
15207
  ).option("--sort <JSON>", `\u6392\u5E8F\u6761\u4EF6 JSON\uFF0C\u4F8B\u5982 '[{"field":"hireDate","direction":"desc"}]'`).option(
15135
15208
  "--additions <JSON>",
15136
15209
  `\u8DE8\u5173\u7CFB JOIN \u7684\u5BF9\u8C61\u6570\u7EC4 JSON\uFF0C\u4F8B\u5982 '[{"key":"employee","model":"Employee"}]'`
15137
- ).option("--fields <list>", "\u8FD4\u56DE\u5B57\u6BB5\u5217\u8868\uFF08\u9017\u53F7\u5206\u9694\uFF09\uFF0C\u4F8B\u5982 name,code,email").option("--keyword <text>", "\u5168\u6587\u68C0\u7D22\u5173\u952E\u5B57").option("--limit <n>", "\u6BCF\u9875\u5927\u5C0F", "20").option("--offset <n>", "\u504F\u79FB\u91CF\uFF08\u6309 limit \u81EA\u52A8\u6362\u7B97 page\uFF09").option("--env <name>", "\u672C\u6B21\u4F7F\u7528\u7684\u9879\u76EE\u73AF\u5883\u540D\u6216\u672C\u673A\u69FD\u540D").option("--as <identity>", "\u4E34\u65F6\u6362\u8EAB\u4EFD\uFF08\u8986\u76D6 env defaultIdentity\uFF0C\u672C\u6B21\u547D\u4EE4\uFF09").option("--profile <name>", "[deprecated] \u7528 --env \u66FF\u4EE3").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "table").action((m, opts) => queryCommand(m, opts));
15210
+ ).option("--fields <list>", "\u8FD4\u56DE\u5B57\u6BB5\u5217\u8868\uFF08\u9017\u53F7\u5206\u9694\uFF09\uFF0C\u4F8B\u5982 name,code,email").option("--plugin <activation>", "\u5143\u6570\u636E\u63D2\u4EF6\u6FC0\u6D3B\u4E32\uFF0C\u4F8B\u5982 salaryByAssist:assistId=<uuid>").option("--keyword <text>", "\u5168\u6587\u68C0\u7D22\u5173\u952E\u5B57").option("--limit <n>", "\u6BCF\u9875\u5927\u5C0F", "20").option("--offset <n>", "\u504F\u79FB\u91CF\uFF08\u6309 limit \u81EA\u52A8\u6362\u7B97 page\uFF09").option("--env <name>", "\u672C\u6B21\u4F7F\u7528\u7684\u9879\u76EE\u73AF\u5883\u540D\u6216\u672C\u673A\u69FD\u540D").option("--as <identity>", "\u4E34\u65F6\u6362\u8EAB\u4EFD\uFF08\u8986\u76D6 env defaultIdentity\uFF0C\u672C\u6B21\u547D\u4EE4\uFF09").option("--profile <name>", "[deprecated] \u7528 --env \u66FF\u4EE3").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "table").action((m, opts) => queryCommand(m, opts));
15138
15211
  program.command("action <Model.Action>").description("\u8C03\u7528 Model \u4E0A\u7684 Action\uFF08\u4E1A\u52A1\u65B9\u6CD5\uFF09\uFF0C\u4F8B\u5982 Employee.regularize").option("--id <id>", "\u76EE\u6807\u5B9E\u4F53 ID\uFF08object Action \u5FC5\u586B\uFF09").option("--ids <csv>", "\u6279\u91CF ID\uFF08\u9017\u53F7\u5206\u9694\uFF0Cbulk Action \u7528\uFF09").option("--method <method>", "HTTP \u65B9\u6CD5\uFF1AGET | POST | PUT | DELETE\uFF08\u9ED8\u8BA4\u6309 Core \u5143\u6570\u636E\u81EA\u52A8\u5224\u5B9A\uFF09").option(
15139
15212
  "--scope <scope>",
15140
15213
  "\u5F3A\u5236 Action scope\uFF1Aclass | object\uFF08\u9ED8\u8BA4\uFF1A\u6709 --id \u4E3A object\uFF0C\u5426\u5219 class\uFF09"
@@ -15220,6 +15293,7 @@ datapackage.command("pack <packageDir>").description("\u628A\u5305\u76EE\u5F55\u
15220
15293
  datapackage.command("install <artifact>").description("\u4E0A\u4F20 .hcmpkg \u5236\u54C1\u5E76\u7ECF\u670D\u52A1\u7AEF\u5F02\u6B65\u5B89\u88C5\u5668\u5B89\u88C5\uFF0C\u5B9E\u65F6\u663E\u793A\u8FDB\u5EA6\uFF08admin.system\uFF09").option("--env <name>", "\u672C\u6B21\u4F7F\u7528\u7684\u9879\u76EE\u73AF\u5883\u540D\u6216\u672C\u673A\u69FD\u540D").option("--as <identity>", "\u4E34\u65F6\u6362\u8EAB\u4EFD").option("--category <name>", "\u5236\u54C1\u4E0A\u4F20\u7684\u5B58\u50A8\u5206\u7C7B\uFF08\u670D\u52A1\u7AEF\u6570\u636E\u975E\u679A\u4E3E\uFF09", "attachment").option("--no-wait", "\u53EA\u53D7\u7406\u4E0D\u7B49\u5F85\uFF0C\u7ACB\u523B\u8FD4\u56DE runId").option("--timeout <sec>", "\u7B49\u5F85\u4E0A\u9650\uFF08\u79D2\uFF09\uFF1B\u7B49\u4E0D\u5230\u4E0D\u662F\u5931\u8D25\uFF0C\u88C5\u8F7D\u5728\u670D\u52A1\u7AEF\u7EE7\u7EED", "900").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "json").action((artifact, opts) => datapackageInstallCommand(artifact, opts));
15221
15294
  datapackage.command("status <runId>").description("\u67E5\u770B\u88C5\u8F7D\u6D41\u6C34\u8FDB\u5EA6/\u7EC8\u6001\uFF08\u914D\u5408 install --no-wait \u6216\u7B49\u5F85\u8D85\u65F6\u540E\u4F7F\u7528\uFF09").option("--env <name>", "\u672C\u6B21\u4F7F\u7528\u7684\u9879\u76EE\u73AF\u5883\u540D\u6216\u672C\u673A\u69FD\u540D").option("--as <identity>", "\u4E34\u65F6\u6362\u8EAB\u4EFD").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "json").action((runId, opts) => datapackageStatusCommand(runId, opts));
15222
15295
  var tenant = program.command("tenant").description("\u79DF\u6237\u5F00\u901A\u4E0E\u751F\u547D\u5468\u671F");
15296
+ tenant.command("reset").description("\u4EE5\u5F53\u524D\u79DF\u6237\u5185\u7F6E admin \u91CD\u7F6E PostgreSQL \u5230\u51FA\u5382\u57FA\u7EBF\uFF1B\u4E0D\u53EF\u9006\uFF0C\u975E PG \u672A\u5904\u7406\u672A\u6838\u9A8C").option("--env <name>", "\u672C\u6B21\u4F7F\u7528\u7684\u9879\u76EE\u73AF\u5883\u540D\u6216\u672C\u673A\u69FD\u540D").option("--as <identity>", "\u4F7F\u7528\u8BE5\u73AF\u5883\u7684\u76F4\u63A5\u767B\u5F55\u8EAB\u4EFD\uFF0C\u4E0D\u63A5\u53D7\u4EE3\u7406").option("-y, --yes", "\u786E\u8BA4\u91CD\u7F6E\u5DF2\u6838\u9A8C\u7684\u5F53\u524D\u79DF\u6237\uFF0C\u8DF3\u8FC7\u4EA4\u4E92").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "json").action((opts) => tenantResetCommand(opts));
15223
15297
  tenant.command("bootstrap").description("\u5F00\u901A\u65B0\u79DF\u6237\uFF08\u5EFA\u79DF\u6237 + admin \u7528\u6237 + \u7ED3\u6784 reconcile\uFF09\u2014\u2014\u4E0D\u53EF\u9006\uFF0C\u9ED8\u8BA4\u8FC7\u786E\u8BA4\u95F8").requiredOption("--tenant-id <id>", "\u79DF\u6237 ID").requiredOption("--admin-username <user>", "\u7BA1\u7406\u5458\u7528\u6237\u540D").option(
15224
15298
  "--admin-password <pwd>",
15225
15299
  "\u7BA1\u7406\u5458\u5BC6\u7801\uFF08\u4F1A\u6CC4\u6F0F\u5230 history/ps\uFF0C\u5EFA\u8BAE --admin-password-stdin\uFF09"