@hcmai/cli 0.4.9 → 0.4.11

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: fromAxiosError22 } = await import("@hcmai/sdk");
2289
+ const { fromAxiosError: fromAxiosError23 } = await import("@hcmai/sdk");
2290
2290
  exitWithError(
2291
- fromAxiosError22(
2291
+ fromAxiosError23(
2292
2292
  e,
2293
2293
  envName
2294
2294
  )
@@ -4412,6 +4412,65 @@ async function uploadCommand(filePath, args) {
4412
4412
  }
4413
4413
  }
4414
4414
 
4415
+ // src/commands/datapackage.ts
4416
+ init_exit();
4417
+ init_auth_guard();
4418
+ import {
4419
+ HcmClient as HcmClient16,
4420
+ formatObject as formatObject14,
4421
+ fromAxiosError as fromAxiosError14,
4422
+ packDataPackage,
4423
+ installDataPackageArtifact,
4424
+ DEFAULT_ARTIFACT_CATEGORY
4425
+ } from "@hcmai/sdk";
4426
+ async function datapackagePackCommand(packageDir, args) {
4427
+ try {
4428
+ const result = await packDataPackage(packageDir, args.out);
4429
+ const fmt = args.output ?? "json";
4430
+ if (fmt !== "json") {
4431
+ process.stdout.write(
4432
+ `\u{1F4E6} ${result.name} v${result.version}\uFF08${result.entryCount} \u4E2A\u6587\u4EF6\uFF09\u2192 ${result.artifactPath}
4433
+ `
4434
+ );
4435
+ }
4436
+ process.stdout.write(formatObject14(result, { format: fmt }) + "\n");
4437
+ process.exit(0);
4438
+ } catch (e) {
4439
+ exitWithError(e);
4440
+ }
4441
+ }
4442
+ async function datapackageInstallCommand(artifactPath, args) {
4443
+ try {
4444
+ const ctx = await getActiveAuthContextFromCli(args);
4445
+ const client3 = HcmClient16.fromAuthContext(ctx);
4446
+ const { documentId, view } = await installDataPackageArtifact(client3, artifactPath, {
4447
+ category: args.category ?? DEFAULT_ARTIFACT_CATEGORY
4448
+ });
4449
+ const fmt = args.output ?? "json";
4450
+ if (fmt !== "json") {
4451
+ process.stdout.write(
4452
+ `\u{1F4E5} ${view.code ?? "?"} v${view.version ?? "?"} \u2192 ${view.installStatus ?? "?"}\uFF08rowCount=${view.rowCount ?? 0}\uFF0CdocumentId=${documentId}\uFF09
4453
+ `
4454
+ );
4455
+ if (view.replayNotice) {
4456
+ process.stdout.write(`\u26A0\uFE0F ${view.replayNotice}
4457
+ `);
4458
+ }
4459
+ }
4460
+ process.stdout.write(formatObject14(view, { format: fmt }) + "\n");
4461
+ process.exit(0);
4462
+ } catch (e) {
4463
+ const err = e;
4464
+ if (err?.code === "ENOENT") {
4465
+ exitWithError(new Error(`\u5236\u54C1\u6587\u4EF6\u4E0D\u5B58\u5728\uFF1A${artifactPath}`));
4466
+ } else if (err?.isAxiosError) {
4467
+ exitWithError(fromAxiosError14(err, args.env));
4468
+ } else {
4469
+ exitWithError(e);
4470
+ }
4471
+ }
4472
+ }
4473
+
4415
4474
  // src/commands/skills.ts
4416
4475
  init_exit();
4417
4476
  import { promises as fsp2 } from "fs";
@@ -4433,8 +4492,8 @@ import {
4433
4492
  resolveAllSkillsInstallOrder,
4434
4493
  matchSkills,
4435
4494
  filterByStage,
4436
- formatObject as formatObject15,
4437
- fromAxiosError as fromAxiosError14,
4495
+ formatObject as formatObject16,
4496
+ fromAxiosError as fromAxiosError15,
4438
4497
  loadEnv as loadEnv5,
4439
4498
  loadGlobalConfig as loadGlobalConfig6,
4440
4499
  resolveActiveEnv as resolveActiveEnv3,
@@ -4565,7 +4624,7 @@ import { readFileSync as readFileSync4, readdirSync as readdirSync2, statSync as
4565
4624
  import { createHash } from "crypto";
4566
4625
  import * as path2 from "path";
4567
4626
  import { fileURLToPath } from "url";
4568
- import { formatObject as formatObject14, parseSkillFrontmatter } from "@hcmai/sdk";
4627
+ import { formatObject as formatObject15, parseSkillFrontmatter } from "@hcmai/sdk";
4569
4628
  function collectCommandSurface(root) {
4570
4629
  const out = [];
4571
4630
  const walk = (cmd, prefix) => {
@@ -4636,7 +4695,7 @@ function buildManifest(root, skillsDir = bundledSkillsDir()) {
4636
4695
  }
4637
4696
  function skillsManifestCommand(root, args) {
4638
4697
  const manifest2 = buildManifest(root);
4639
- process.stdout.write(formatObject14(manifest2, { format: args.output ?? "json" }) + "\n");
4698
+ process.stdout.write(formatObject15(manifest2, { format: args.output ?? "json" }) + "\n");
4640
4699
  }
4641
4700
  function str(v) {
4642
4701
  return typeof v === "string" && v ? v : void 0;
@@ -4832,7 +4891,7 @@ function fail4(e, args) {
4832
4891
  if (err?.response?.status === 404) {
4833
4892
  exitWithError(new Error("\u8BE5\u73AF\u5883\u6CA1\u6709\u8FD9\u4E2A\u6280\u80FD \u2014\u2014 \u8DD1 `hcm skills list` \u770B\u76EE\u5F55\uFF08\u6280\u80FD\u968F\u4EA7\u54C1\u7248\u672C\u8D70\uFF09"));
4834
4893
  }
4835
- if (err?.isAxiosError) exitWithError(fromAxiosError14(err, args.env));
4894
+ if (err?.isAxiosError) exitWithError(fromAxiosError15(err, args.env));
4836
4895
  exitWithError(e);
4837
4896
  process.exit(1);
4838
4897
  }
@@ -4883,7 +4942,7 @@ async function skillsListCommand(keyword, args) {
4883
4942
  }
4884
4943
  if (fmt === "json" || fmt === "yaml") {
4885
4944
  process.stdout.write(
4886
- formatObject15(
4945
+ formatObject16(
4887
4946
  {
4888
4947
  ...manifest2 ?? {},
4889
4948
  categories: cats,
@@ -4965,7 +5024,7 @@ async function listInstalledSkills(keyword, args) {
4965
5024
  const fmt = args.output ?? "table";
4966
5025
  if (!state || Object.keys(state.skills).length === 0) {
4967
5026
  if (fmt === "json" || fmt === "yaml") {
4968
- process.stdout.write(formatObject15({ baseDir: layout.baseDir, target: layout.target, all: false, skills: [] }, { format: fmt }) + "\n");
5027
+ process.stdout.write(formatObject16({ baseDir: layout.baseDir, target: layout.target, all: false, skills: [] }, { format: fmt }) + "\n");
4969
5028
  process.exit(0);
4970
5029
  }
4971
5030
  process.stdout.write(`${path4.join(layout.baseDir, SKILLS_STATE_FILE)} \u4E0D\u5B58\u5728\u6216\u4E3A\u7A7A \u2014\u2014 \u8FD9\u4E2A\u76EE\u5F55\u4E0B\u8FD8\u6CA1\u7528\u672C CLI \u88C5\u8FC7\u6280\u80FD\u3002
@@ -4998,7 +5057,7 @@ async function listInstalledSkills(keyword, args) {
4998
5057
  const shown = sourceFilter === "all" ? byKeyword : byKeyword.filter((row) => row.sourceKind === sourceFilter);
4999
5058
  const groupOf = (kind) => kind === "cli" ? "CLI \u81EA\u5E26" : kind === "local" ? "\u672C\u5730\u76EE\u5F55\u88C5\u7684" : "\u777F\u620E\u6280\u80FD\u5E93";
5000
5059
  if (fmt === "json" || fmt === "yaml") {
5001
- process.stdout.write(formatObject15({
5060
+ process.stdout.write(formatObject16({
5002
5061
  baseDir: layout.baseDir,
5003
5062
  target: layout.target,
5004
5063
  endpoint: state.endpoint,
@@ -5197,7 +5256,7 @@ async function skillsInstallCommand(id, args) {
5197
5256
  const agents = layout.agentsFile ? await syncAgentsIndex(layout, manifest2) : void 0;
5198
5257
  const fmt = args.output ?? "table";
5199
5258
  if (fmt === "json" || fmt === "yaml") {
5200
- process.stdout.write(formatObject15({ ...result, all, target_agent: layout.target, agentsFile: layout.agentsFile, agents, conflictCheck: conflictNote ? { checked: false, note: conflictNote } : { checked: true } }, { format: fmt }) + "\n");
5259
+ process.stdout.write(formatObject16({ ...result, all, target_agent: layout.target, agentsFile: layout.agentsFile, agents, conflictCheck: conflictNote ? { checked: false, note: conflictNote } : { checked: true } }, { format: fmt }) + "\n");
5201
5260
  } else {
5202
5261
  const headline = all ? `\u2705 \u5168\u90E8 ${requestedIds.length} \u4E2A\u6280\u80FD \u2192 ${result.baseDir}` : `\u2705 ${id} \u2192 ${path4.join(result.baseDir, id, "SKILL.md")}`;
5203
5262
  process.stdout.write(`${headline}
@@ -5762,7 +5821,7 @@ async function skillsUpdateCommand(args) {
5762
5821
  const changed = plan.entries.filter((e) => e.status === "updated" || e.status === "added");
5763
5822
  const fmt = args.output ?? "table";
5764
5823
  if (fmt === "json" || fmt === "yaml") {
5765
- process.stdout.write(formatObject15({
5824
+ process.stdout.write(formatObject16({
5766
5825
  endpoint,
5767
5826
  baseDir: layout.baseDir,
5768
5827
  target: layout.target,
@@ -5841,8 +5900,8 @@ async function skillsUpdateCommand(args) {
5841
5900
  import {
5842
5901
  bootstrapTenant,
5843
5902
  createHttpClient as createHttpClient3,
5844
- formatObject as formatObject16,
5845
- fromAxiosError as fromAxiosError15,
5903
+ formatObject as formatObject17,
5904
+ fromAxiosError as fromAxiosError16,
5846
5905
  loadEnv as loadEnv6,
5847
5906
  loadGlobalConfig as loadGlobalConfig7,
5848
5907
  resolveActiveEnv as resolveActiveEnv4,
@@ -5933,14 +5992,14 @@ async function tenantBootstrapCommand(args) {
5933
5992
  `
5934
5993
  );
5935
5994
  }
5936
- process.stdout.write(formatObject16(result, { format: fmt }) + "\n");
5995
+ process.stdout.write(formatObject17(result, { format: fmt }) + "\n");
5937
5996
  process.exit(0);
5938
5997
  } catch (e) {
5939
5998
  const err = e;
5940
5999
  if (err?.response?.status === 403) {
5941
6000
  exitWithError(new Error("bootstrap key \u65E0\u6548\uFF08403\uFF09\u2014\u2014 \u6838\u5BF9\u90E8\u7F72\u65B9\u63D0\u4F9B\u7684 key\uFF0C\u52FF\u590D\u7528\u5176\u4ED6\u73AF\u5883\u7684"));
5942
6001
  } else if (err?.isAxiosError) {
5943
- exitWithError(fromAxiosError15(err, args.env));
6002
+ exitWithError(fromAxiosError16(err, args.env));
5944
6003
  } else {
5945
6004
  exitWithError(e);
5946
6005
  }
@@ -5950,9 +6009,9 @@ async function tenantBootstrapCommand(args) {
5950
6009
  // src/commands/meta.ts
5951
6010
  import { promises as fsp3 } from "fs";
5952
6011
  import {
5953
- HcmClient as HcmClient16,
5954
- formatObject as formatObject17,
5955
- fromAxiosError as fromAxiosError16,
6012
+ HcmClient as HcmClient17,
6013
+ formatObject as formatObject18,
6014
+ fromAxiosError as fromAxiosError17,
5956
6015
  listTenantMeta,
5957
6016
  getTenantMeta,
5958
6017
  saveTenantMeta,
@@ -5963,7 +6022,7 @@ import {
5963
6022
  init_exit();
5964
6023
  init_auth_guard();
5965
6024
  async function client2(args) {
5966
- return HcmClient16.fromAuthContext(await getActiveAuthContextFromCli(args));
6025
+ return HcmClient17.fromAuthContext(await getActiveAuthContextFromCli(args));
5967
6026
  }
5968
6027
  function fail5(e, args) {
5969
6028
  const err = e;
@@ -5972,7 +6031,7 @@ function fail5(e, args) {
5972
6031
  new Error("\u5143\u6570\u636E\u5199\u5165\u88AB\u62D2\uFF08403\uFF09\u2014\u2014 \u9700 config-admin \u8EAB\u4EFD\u4E14\u5F53\u524D source \u53EF\u5199\uFF1B\u82E5\u5728\u79DF\u6237\u5F00\u53D1\u7A7A\u95F4\u5916\uFF0C\u5148 `hcm workspace bind <key>`")
5973
6032
  );
5974
6033
  }
5975
- if (err?.isAxiosError) exitWithError(fromAxiosError16(err, args.env));
6034
+ if (err?.isAxiosError) exitWithError(fromAxiosError17(err, args.env));
5976
6035
  exitWithError(e);
5977
6036
  process.exit(1);
5978
6037
  }
@@ -5988,7 +6047,7 @@ async function metaListCommand(args) {
5988
6047
  const fmt = args.output ?? "json";
5989
6048
  if (fmt !== "json") process.stdout.write(`\u{1F4C4} ${items.length} \u4EFD${total ? ` / \u5171 ${total}` : ""}
5990
6049
  `);
5991
- process.stdout.write(formatObject17(items, { format: fmt }) + "\n");
6050
+ process.stdout.write(formatObject18(items, { format: fmt }) + "\n");
5992
6051
  process.exit(0);
5993
6052
  } catch (e) {
5994
6053
  fail5(e, args);
@@ -6036,7 +6095,7 @@ ${content}
6036
6095
  \u8BB0\u5F97\u6E05\u7F13\u5B58\uFF1Ahcm cache clear-meta <Model>
6037
6096
  `);
6038
6097
  }
6039
- process.stdout.write(formatObject17(result, { format: fmt }) + "\n");
6098
+ process.stdout.write(formatObject18(result, { format: fmt }) + "\n");
6040
6099
  process.exit(0);
6041
6100
  } catch (e) {
6042
6101
  if (e?.code === "ENOENT") exitWithError(new Error(`\u6587\u4EF6\u4E0D\u5B58\u5728\uFF1A${args.file}`));
@@ -6057,7 +6116,7 @@ async function metaDeleteCommand(path12, args) {
6057
6116
  const fmt = args.output ?? "json";
6058
6117
  if (fmt !== "json") process.stdout.write(`\u{1F5D1}\uFE0F \u5DF2\u5220\u9664 ${path12}
6059
6118
  `);
6060
- process.stdout.write(formatObject17(result, { format: fmt }) + "\n");
6119
+ process.stdout.write(formatObject18(result, { format: fmt }) + "\n");
6061
6120
  process.exit(0);
6062
6121
  } catch (e) {
6063
6122
  fail5(e, args);
@@ -6076,10 +6135,10 @@ import {
6076
6135
  createWorkspaceFile,
6077
6136
  deleteWorkspaceFile,
6078
6137
  formatMiniVerifyReport,
6079
- formatObject as formatObject18,
6138
+ formatObject as formatObject19,
6080
6139
  formatRows as formatRows5,
6081
6140
  getMiniStatus,
6082
- HcmClient as HcmClient17,
6141
+ HcmClient as HcmClient18,
6083
6142
  initMiniAppProject,
6084
6143
  inferMiniWritableTemplateOptionsFromModel,
6085
6144
  listWorkspaceFiles,
@@ -6089,7 +6148,7 @@ import {
6089
6148
  runMiniSmokeChecks,
6090
6149
  saveWorkspaceFileContent,
6091
6150
  validateMiniProject,
6092
- fromAxiosError as fromAxiosError17
6151
+ fromAxiosError as fromAxiosError18
6093
6152
  } from "@hcmai/sdk";
6094
6153
 
6095
6154
  // src/commands/workspace-format.ts
@@ -6136,7 +6195,7 @@ var RAW_WORKSPACE_EXCLUDED_DIRS = /* @__PURE__ */ new Set([
6136
6195
  var RAW_WORKSPACE_EXCLUDED_FILES = /* @__PURE__ */ new Set([WORKSPACE_CONTEXT_FILE, ".DS_Store"]);
6137
6196
  async function workspaceListCommand(args) {
6138
6197
  try {
6139
- const client3 = HcmClient17.fromAuthContext(await getActiveAuthContextFromCli(args));
6198
+ const client3 = HcmClient18.fromAuthContext(await getActiveAuthContextFromCli(args));
6140
6199
  const limit = parsePositiveInt3(args.limit, 50, "--limit");
6141
6200
  const result = await client3.query("TenantExtensionWorkspace", {
6142
6201
  keyword: args.keyword,
@@ -6165,7 +6224,7 @@ async function workspaceActiveCommand(args) {
6165
6224
  const ctx = await getActiveAuthContextFromCli(args, {
6166
6225
  fallbackEnv: localContext?.profile
6167
6226
  });
6168
- const client3 = HcmClient17.fromAuthContext(ctx);
6227
+ const client3 = HcmClient18.fromAuthContext(ctx);
6169
6228
  const result = await client3.query("TenantExtensionWorkspace", {
6170
6229
  filter: { devModeEnabled: true },
6171
6230
  fields: ["workspaceKey", "devModeEnabled"],
@@ -6220,7 +6279,7 @@ async function workspaceCreateCommand(workspaceKey, args) {
6220
6279
  `${WORKSPACE_CONTEXT_FILE} already binds workspace '${existing.workspaceKey}'; use --force to rebind`
6221
6280
  );
6222
6281
  }
6223
- const client3 = HcmClient17.fromAuthContext(await getActiveAuthContextFromCli(args));
6282
+ const client3 = HcmClient18.fromAuthContext(await getActiveAuthContextFromCli(args));
6224
6283
  const normalizedWorkspaceKey = normalizeWorkspaceKey(workspaceKey);
6225
6284
  const resp = await client3.raw().post("/api/models/TenantExtensionWorkspace", {
6226
6285
  workspaceKey: normalizedWorkspaceKey,
@@ -6267,7 +6326,7 @@ async function workspacePullCommand(args) {
6267
6326
  `workspace key is required; pass --workspace <key> or run hcm workspace bind <key> first`
6268
6327
  );
6269
6328
  }
6270
- const client3 = HcmClient17.fromAuthContext(
6329
+ const client3 = HcmClient18.fromAuthContext(
6271
6330
  await getActiveAuthContextFromCli(args, { fallbackEnv: existing?.profile })
6272
6331
  );
6273
6332
  const context = buildWorkspaceContext({
@@ -6405,7 +6464,7 @@ async function workspaceStatusCommand(args) {
6405
6464
  }
6406
6465
  if (args.output === "json" || args.output === "yaml") {
6407
6466
  process.stdout.write(
6408
- formatObject18({ rootDir, miniApps: rows }, { format: args.output }) + "\n"
6467
+ formatObject19({ rootDir, miniApps: rows }, { format: args.output }) + "\n"
6409
6468
  );
6410
6469
  } else {
6411
6470
  process.stdout.write(formatRows5(rows, { format: "table" }) + "\n");
@@ -6437,7 +6496,7 @@ async function workspacePushCommand(args) {
6437
6496
  const rootDir = resolveRootDir(args.dir);
6438
6497
  const context = await requireWorkspaceContext(rootDir);
6439
6498
  const miniApps = await discoverMiniApps(rootDir);
6440
- const client3 = HcmClient17.fromAuthContext(
6499
+ const client3 = HcmClient18.fromAuthContext(
6441
6500
  await getActiveAuthContextFromCli(args, { fallbackEnv: context.profile })
6442
6501
  );
6443
6502
  const activeWorkspaceKey = args.dryRun ? null : await probeActiveWorkspaceKey(client3);
@@ -6509,7 +6568,7 @@ async function workspacePreviewCommand(args) {
6509
6568
  );
6510
6569
  }
6511
6570
  if (args.output === "json" || args.output === "yaml") {
6512
- process.stdout.write(formatObject18(rows, { format: args.output }) + "\n");
6571
+ process.stdout.write(formatObject19(rows, { format: args.output }) + "\n");
6513
6572
  } else {
6514
6573
  process.stdout.write(formatRows5(rows, { format: "table" }) + "\n");
6515
6574
  }
@@ -6960,7 +7019,7 @@ async function readMiniStatusSafely(app) {
6960
7019
  async function loadProfileClient(args) {
6961
7020
  try {
6962
7021
  const ctx = await getActiveAuthContextFromCli(args);
6963
- return HcmClient17.fromAuthContext(ctx);
7022
+ return HcmClient18.fromAuthContext(ctx);
6964
7023
  } catch (e) {
6965
7024
  if (args.env || args.profile) throw e;
6966
7025
  return null;
@@ -7115,7 +7174,7 @@ function optionalText(value) {
7115
7174
  }
7116
7175
  function writeWorkspaceListResult(rows, format, total) {
7117
7176
  if (format !== "table") {
7118
- process.stdout.write(formatObject18({ rows, total }, { format }) + "\n");
7177
+ process.stdout.write(formatObject19({ rows, total }, { format }) + "\n");
7119
7178
  return;
7120
7179
  }
7121
7180
  process.stdout.write(formatRows5(toWorkspaceListRows(rows), { format: "table" }) + "\n");
@@ -7126,7 +7185,7 @@ function writeWorkspaceListResult(rows, format, total) {
7126
7185
  }
7127
7186
  function writeWorkspaceActiveResult(view, format) {
7128
7187
  if (format !== "table") {
7129
- process.stdout.write(formatObject18(view, { format }) + "\n");
7188
+ process.stdout.write(formatObject19(view, { format }) + "\n");
7130
7189
  return;
7131
7190
  }
7132
7191
  const rows = [
@@ -7144,7 +7203,7 @@ function writeWorkspaceActiveResult(view, format) {
7144
7203
  }
7145
7204
  function writeWorkspaceBindResult(context, rootDir, format) {
7146
7205
  if (format !== "table") {
7147
- process.stdout.write(formatObject18({ ...context, rootDir }, { format }) + "\n");
7206
+ process.stdout.write(formatObject19({ ...context, rootDir }, { format }) + "\n");
7148
7207
  return;
7149
7208
  }
7150
7209
  process.stdout.write(
@@ -7158,7 +7217,7 @@ function writeWorkspaceBindResult(context, rootDir, format) {
7158
7217
  }
7159
7218
  function writeWorkspaceCreateResult(result, format) {
7160
7219
  if (format !== "table") {
7161
- process.stdout.write(formatObject18(result, { format }) + "\n");
7220
+ process.stdout.write(formatObject19(result, { format }) + "\n");
7162
7221
  return;
7163
7222
  }
7164
7223
  process.stdout.write(
@@ -7174,7 +7233,7 @@ function writeWorkspaceCreateResult(result, format) {
7174
7233
  }
7175
7234
  function writeWorkspacePullResult(result, format) {
7176
7235
  if (format !== "table") {
7177
- process.stdout.write(formatObject18(result, { format }) + "\n");
7236
+ process.stdout.write(formatObject19(result, { format }) + "\n");
7178
7237
  return;
7179
7238
  }
7180
7239
  const lines = [
@@ -7192,7 +7251,7 @@ function writeWorkspacePullResult(result, format) {
7192
7251
  }
7193
7252
  function writeWorkspaceAddMiniResult(result, rootDir, format) {
7194
7253
  if (format !== "table") {
7195
- process.stdout.write(formatObject18({ ...result, workspaceRoot: rootDir }, { format }) + "\n");
7254
+ process.stdout.write(formatObject19({ ...result, workspaceRoot: rootDir }, { format }) + "\n");
7196
7255
  return;
7197
7256
  }
7198
7257
  process.stdout.write(
@@ -7208,7 +7267,7 @@ function writeWorkspaceAddMiniResult(result, rootDir, format) {
7208
7267
  function writeWorkspaceValidateResult(results, format) {
7209
7268
  if (format !== "table") {
7210
7269
  process.stdout.write(
7211
- formatObject18(
7270
+ formatObject19(
7212
7271
  results.map((item) => ({ artifact: `mini:${item.app.appCode}`, ...item.result })),
7213
7272
  { format }
7214
7273
  ) + "\n"
@@ -7236,7 +7295,7 @@ mini:${item.app.appCode}
7236
7295
  function writeWorkspacePushResult(rawResult, results, format) {
7237
7296
  if (format !== "table") {
7238
7297
  process.stdout.write(
7239
- formatObject18(
7298
+ formatObject19(
7240
7299
  {
7241
7300
  workspaceFiles: { artifact: "workspace", ...rawResult },
7242
7301
  miniApps: results.map((item) => ({ artifact: `mini:${item.app.appCode}`, ...item.result }))
@@ -7292,7 +7351,7 @@ function writeWorkspaceVerifyResult(context, rootDir, raw, reports, format) {
7292
7351
  const ok = rawOk && reports.every((item) => item.report.ok);
7293
7352
  if (format === "json") {
7294
7353
  process.stdout.write(
7295
- formatObject18(
7354
+ formatObject19(
7296
7355
  {
7297
7356
  ok,
7298
7357
  workspaceKey: context.workspaceKey,
@@ -7319,7 +7378,7 @@ function writeWorkspaceVerifyResult(context, rootDir, raw, reports, format) {
7319
7378
  }
7320
7379
  if (format !== "table") {
7321
7380
  process.stdout.write(
7322
- formatObject18(
7381
+ formatObject19(
7323
7382
  {
7324
7383
  ok,
7325
7384
  workspaceKey: context.workspaceKey,
@@ -7371,7 +7430,7 @@ function formatStatusSummary(summary) {
7371
7430
  function exitWorkspaceError(err, profile) {
7372
7431
  const maybeAxios = err;
7373
7432
  if (maybeAxios?.isAxiosError) {
7374
- exitWithError(fromAxiosError17(err, profile));
7433
+ exitWithError(fromAxiosError18(err, profile));
7375
7434
  }
7376
7435
  exitWithError(err);
7377
7436
  }
@@ -7406,7 +7465,7 @@ async function setDevModeBinding(client3, workspaceKey) {
7406
7465
  }
7407
7466
  async function workspaceActivateCommand(workspaceKey, args) {
7408
7467
  try {
7409
- const client3 = HcmClient17.fromAuthContext(await getActiveAuthContextFromCli(args));
7468
+ const client3 = HcmClient18.fromAuthContext(await getActiveAuthContextFromCli(args));
7410
7469
  const key2 = normalizeWorkspaceKey(workspaceKey);
7411
7470
  await setDevModeBinding(client3, key2);
7412
7471
  const fmt = args.output ?? "table";
@@ -7416,7 +7475,7 @@ async function workspaceActivateCommand(workspaceKey, args) {
7416
7475
  process.stdout.write("\u8BE5\u7A7A\u95F4\u7684 metas / scripts / menus / mini_apps \u73B0\u5DF2\u5728\u5F53\u524D\u79DF\u6237\u751F\u6548\u3002\n");
7417
7476
  } else {
7418
7477
  process.stdout.write(
7419
- formatObject18({ workspaceKey: key2, activated: true }, { format: fmt }) + "\n"
7478
+ formatObject19({ workspaceKey: key2, activated: true }, { format: fmt }) + "\n"
7420
7479
  );
7421
7480
  }
7422
7481
  process.exit(0);
@@ -7501,11 +7560,11 @@ async function identityRemove(name) {
7501
7560
 
7502
7561
  // src/commands/delivery-action-policy.ts
7503
7562
  init_auth_guard();
7504
- import { existsSync as existsSync2 } from "fs";
7563
+ import { existsSync as existsSync2, readFileSync as readFileSync5 } from "fs";
7505
7564
  import { join as pathJoin } from "path";
7506
7565
  import {
7507
- HcmClient as HcmClient18,
7508
- formatObject as formatObject19
7566
+ HcmClient as HcmClient19,
7567
+ formatObject as formatObject20
7509
7568
  } from "@hcmai/sdk";
7510
7569
 
7511
7570
  // src/commands/delivery.ts
@@ -7541,7 +7600,19 @@ var GUARDED_EXECUTOR_REASON_CODES = /* @__PURE__ */ new Set([
7541
7600
  // 受控执行第一次跑通了 workspace create,却在 meta set / workspace push 上
7542
7601
  // 被「该 R2 命令不在首批受控执行器支持面」拦死,远端只多了一个空 workspace。
7543
7602
  "metadata-write",
7544
- "workspace-push"
7603
+ "workspace-push",
7604
+ // 载荷是**位置参数**(`hcm import <路径>`),既不走 --file 也不走 --dir,
7605
+ // 所以上一刀把文件与目录开关收进来时它仍留在外面(0.4.9 CHANGELOG 逐字记了这一条)。
7606
+ //
7607
+ // 现在收得住了:POSITIONAL_PAYLOAD_COMMANDS 把 argv[1] 这个固定位置钉成载荷,
7608
+ // 目录走整树摘要、单文件走文件摘要,execute 前重算比对(与 --dir 同一套 bind/assert)。
7609
+ // 位置定死而不是「扫第一个非 flag 参数」,是因为 shape 校验与载荷绑定必须对
7610
+ // 「哪个 token 是载荷」看法一致——两处各自解析就能绑 A 执行 B。
7611
+ //
7612
+ // 🔴 客户存量组织导入的整条链就卡在这一个上:2026-09-01 演示环境租户 15,
7613
+ // 531 条组织机构 dry-run 全绿(静态校验 0 失败),正式导入被
7614
+ // 「该 R2 命令不在首批受控执行器支持面」拦死,一个写请求都没发出去。
7615
+ "import-write"
7545
7616
  ]);
7546
7617
  function assessDeliveryCommand(inputArgv, options = {}) {
7547
7618
  const argv = inputArgv[0] === "--" ? inputArgv.slice(1) : [...inputArgv];
@@ -7882,11 +7953,29 @@ async function assessEffectiveDeliveryCommand(inputArgv, dependencies = {}) {
7882
7953
  const resolution = await (dependencies.resolveAction ?? resolveCoreAction)(request);
7883
7954
  return assessDeliveryCommand(inputArgv, { actionResolution: resolution });
7884
7955
  }
7956
+ function readDeliveryMode(projectRoot = ".") {
7957
+ const file = pathJoin(projectRoot, ".hcm-delivery", "project.yml");
7958
+ if (!existsSync2(file)) return null;
7959
+ const match = readFileSync5(file, "utf8").match(
7960
+ /^deliveryMode:\s*(?:"(plan-only|controlled)"|'(plan-only|controlled)'|(plan-only|controlled))\s*$/m
7961
+ );
7962
+ return match?.[1] ?? match?.[2] ?? match?.[3] ?? null;
7963
+ }
7885
7964
  function withProjectReadiness(assessment, projectRoot = ".") {
7886
7965
  const projectFile = pathJoin(projectRoot, ".hcm-delivery", "project.yml");
7887
7966
  const projectInitialized = existsSync2(projectFile);
7967
+ const deliveryMode = readDeliveryMode(projectRoot);
7968
+ if (projectInitialized && deliveryMode === "plan-only" && assessment.guardedExecutionAvailable) {
7969
+ return {
7970
+ ...assessment,
7971
+ projectInitialized,
7972
+ deliveryMode,
7973
+ modePolicy: assessment.modePolicy ? { ...assessment.modePolicy, controlled: "deny" } : assessment.modePolicy,
7974
+ projectNextStep: "\u672C\u9879\u76EE\u7684\u4EA4\u4ED8\u6A21\u5F0F\u662F plan-only\uFF0C\u53EA\u51FA\u8BA1\u5212\u4E0D\u6267\u884C\u3002\u8981\u771F\u6B63\u6267\u884C R2\uFF0C\u9700\u9879\u76EE\u8D1F\u8D23\u4EBA\u6388\u6743\u540E\u6539\u4E3A controlled\uFF08hcm delivery init --mode controlled --force \u4F1A\u8986\u76D6\u6574\u4EFD\u9879\u76EE\u914D\u7F6E\uFF0C\u8BF7\u786E\u8BA4\u540E\u518D\u6267\u884C\uFF09"
7975
+ };
7976
+ }
7888
7977
  if (projectInitialized || !assessment.guardedExecutionAvailable) {
7889
- return { ...assessment, projectInitialized };
7978
+ return { ...assessment, projectInitialized, deliveryMode };
7890
7979
  }
7891
7980
  const requirements = [...assessment.requirements ?? []];
7892
7981
  if (!requirements.includes("delivery-project")) requirements.push("delivery-project");
@@ -7901,7 +7990,7 @@ function withProjectReadiness(assessment, projectRoot = ".") {
7901
7990
  async function deliveryAssessCommand(argv, args) {
7902
7991
  const assessment = await assessEffectiveDeliveryCommand(argv);
7903
7992
  const enriched = withProjectReadiness(assessment);
7904
- process.stdout.write(formatObject19(enriched, { format: args.output ?? "json" }) + "\n");
7993
+ process.stdout.write(formatObject20(enriched, { format: args.output ?? "json" }) + "\n");
7905
7994
  }
7906
7995
  async function resolveCoreAction(request) {
7907
7996
  try {
@@ -7910,7 +7999,7 @@ async function resolveCoreAction(request) {
7910
7999
  as: request.identity,
7911
8000
  profile: request.profile
7912
8001
  });
7913
- const description = await HcmClient18.fromAuthContext(auth).describe(request.model);
8002
+ const description = await HcmClient19.fromAuthContext(auth).describe(request.model);
7914
8003
  const named = description.actions.filter((action2) => action2.name === request.action);
7915
8004
  if (named.length === 0) {
7916
8005
  return failed(
@@ -8000,7 +8089,7 @@ function flagValue2(argv, flag) {
8000
8089
  init_exit();
8001
8090
  import { promises as fs6 } from "fs";
8002
8091
  import path6 from "path";
8003
- import { formatObject as formatObject20 } from "@hcmai/sdk";
8092
+ import { formatObject as formatObject21 } from "@hcmai/sdk";
8004
8093
  var MODES = ["plan-only", "controlled"];
8005
8094
  var SCAFFOLD_DIRS = ["work", "decisions", "evidence"];
8006
8095
  function renderProjectYml(mode) {
@@ -8059,7 +8148,72 @@ async function deliveryInitCommand(args) {
8059
8148
  scaffold: created,
8060
8149
  nextStep: mode === "controlled" ? "hcm delivery assess <\u547D\u4EE4>\uFF1BR2 \u518D hcm delivery prepare --change-ref \u2026 --rollback-ref \u2026 --evidence-dir \u2026" : "hcm delivery assess <\u547D\u4EE4>\uFF1B\u672C\u9879\u76EE\u4E3A plan-only\uFF0Cexecute \u4F1A\u88AB\u62D2\u7EDD"
8061
8150
  };
8062
- process.stdout.write(formatObject20(result, { format: args.output ?? "json" }) + "\n");
8151
+ process.stdout.write(formatObject21(result, { format: args.output ?? "json" }) + "\n");
8152
+ process.exit(0);
8153
+ } catch (e) {
8154
+ exitWithError(e);
8155
+ process.exit(1);
8156
+ }
8157
+ }
8158
+ async function deliveryModeCommand(args) {
8159
+ try {
8160
+ const root = path6.resolve(args.project ?? ".");
8161
+ const file = path6.join(root, ".hcm-delivery", "project.yml");
8162
+ let content;
8163
+ try {
8164
+ content = await fs6.readFile(file, "utf8");
8165
+ } catch {
8166
+ throw new Error(
8167
+ `\u9879\u76EE\u672A\u521D\u59CB\u5316\uFF1A\u627E\u4E0D\u5230 ${file}
8168
+ \u4E0B\u4E00\u6B65\uFF1Ahcm delivery init`
8169
+ );
8170
+ }
8171
+ const read = () => content.match(
8172
+ /^deliveryMode:\s*(?:"(plan-only|controlled)"|'(plan-only|controlled)'|(plan-only|controlled))\s*$/m
8173
+ );
8174
+ if (!args.set) {
8175
+ const m2 = read();
8176
+ const current = m2?.[1] ?? m2?.[2] ?? m2?.[3] ?? null;
8177
+ process.stdout.write(
8178
+ formatObject21(
8179
+ {
8180
+ project: root,
8181
+ projectFile: file,
8182
+ deliveryMode: current,
8183
+ canExecuteR2: current === "controlled",
8184
+ ...current === "plan-only" ? { note: "plan-only \u53EA\u51FA\u8BA1\u5212\u4E0D\u6267\u884C\uFF1Bexecute \u4F1A\u62D2\u7EDD R2 \u8BA1\u5212" } : {}
8185
+ },
8186
+ { format: args.output ?? "json" }
8187
+ ) + "\n"
8188
+ );
8189
+ process.exit(0);
8190
+ }
8191
+ const next = args.set;
8192
+ if (!MODES.includes(next)) {
8193
+ throw new Error(`--set \u53EA\u63A5\u53D7 ${MODES.join(" | ")}\uFF0C\u6536\u5230 "${args.set}"`);
8194
+ }
8195
+ const m = read();
8196
+ if (!m) {
8197
+ throw new Error(
8198
+ `${file} \u91CC\u6CA1\u6709\u5408\u6CD5\u7684 deliveryMode \u884C\uFF0C\u4E0D\u5C31\u5730\u6539\u5199\u4EE5\u514D\u7834\u574F\u914D\u7F6E
8199
+ \u4E0B\u4E00\u6B65\uFF1A\u786E\u8BA4\u6587\u4EF6\u5185\u5BB9\uFF0C\u6216 hcm delivery init --force \u91CD\u65B0\u751F\u6210`
8200
+ );
8201
+ }
8202
+ const before = m[1] ?? m[2] ?? m[3];
8203
+ content = content.replace(m[0], `deliveryMode: ${next}`);
8204
+ await fs6.writeFile(file, content, "utf8");
8205
+ process.stdout.write(
8206
+ formatObject21(
8207
+ {
8208
+ project: root,
8209
+ projectFile: file,
8210
+ deliveryMode: next,
8211
+ previous: before,
8212
+ canExecuteR2: next === "controlled"
8213
+ },
8214
+ { format: args.output ?? "json" }
8215
+ ) + "\n"
8216
+ );
8063
8217
  process.exit(0);
8064
8218
  } catch (e) {
8065
8219
  exitWithError(e);
@@ -8071,10 +8225,10 @@ async function deliveryInitCommand(args) {
8071
8225
  init_auth_guard();
8072
8226
  init_exit();
8073
8227
  import {
8074
- HcmClient as HcmClient19,
8228
+ HcmClient as HcmClient20,
8075
8229
  fetchReconIdentity,
8076
- formatObject as formatObject21,
8077
- fromAxiosError as fromAxiosError18,
8230
+ formatObject as formatObject22,
8231
+ fromAxiosError as fromAxiosError19,
8078
8232
  httpProbe,
8079
8233
  runDoctor
8080
8234
  } from "@hcmai/sdk";
@@ -8093,17 +8247,17 @@ function render2(report) {
8093
8247
  async function deliveryDoctorCommand(args) {
8094
8248
  try {
8095
8249
  const ctx = await getActiveAuthContextFromCli(args);
8096
- const client3 = HcmClient19.fromAuthContext(ctx);
8250
+ const client3 = HcmClient20.fromAuthContext(ctx);
8097
8251
  const probe = httpProbe(client3.raw(), args.capabilities ?? DEFAULT_CAPABILITIES);
8098
8252
  const identity2 = await fetchReconIdentity(probe, ctx.tenantId);
8099
8253
  const report = await runDoctor(probe, identity2);
8100
8254
  const fmt = args.output ?? "json";
8101
8255
  if (fmt !== "json") process.stdout.write(render2(report) + "\n");
8102
- process.stdout.write(formatObject21(report, { format: fmt }) + "\n");
8256
+ process.stdout.write(formatObject22(report, { format: fmt }) + "\n");
8103
8257
  process.exit(report.ok ? 0 : 1);
8104
8258
  } catch (e) {
8105
8259
  const err = e;
8106
- if (err?.isAxiosError) exitWithError(fromAxiosError18(err, args.env));
8260
+ if (err?.isAxiosError) exitWithError(fromAxiosError19(err, args.env));
8107
8261
  exitWithError(e);
8108
8262
  process.exit(1);
8109
8263
  }
@@ -8113,12 +8267,12 @@ async function deliveryDoctorCommand(args) {
8113
8267
  init_auth_guard();
8114
8268
  init_exit();
8115
8269
  import {
8116
- HcmClient as HcmClient20,
8270
+ HcmClient as HcmClient21,
8117
8271
  ReconLayout,
8118
8272
  ROUND_EXIT_CODES,
8119
8273
  computeReconSourceKey,
8120
- formatObject as formatObject22,
8121
- fromAxiosError as fromAxiosError19,
8274
+ formatObject as formatObject23,
8275
+ fromAxiosError as fromAxiosError20,
8122
8276
  httpProbe as httpProbe2,
8123
8277
  inspectRound,
8124
8278
  renderRound,
@@ -8128,7 +8282,7 @@ var DEFAULT_CAPABILITIES2 = "default";
8128
8282
  async function deliveryReconCommand(args) {
8129
8283
  try {
8130
8284
  const ctx = await getActiveAuthContextFromCli(args);
8131
- const client3 = HcmClient20.fromAuthContext(ctx);
8285
+ const client3 = HcmClient21.fromAuthContext(ctx);
8132
8286
  const probe = httpProbe2(client3.raw(), args.capabilities ?? DEFAULT_CAPABILITIES2);
8133
8287
  const sourceKey = await computeReconSourceKey(probe);
8134
8288
  const layout = new ReconLayout(args.out ?? ".", ctx.tenantId, sourceKey);
@@ -8137,10 +8291,10 @@ async function deliveryReconCommand(args) {
8137
8291
  onlyModel: args.model ?? null,
8138
8292
  identity: ctx.tenantId ? { requestedTenantId: ctx.tenantId } : null
8139
8293
  });
8140
- process.stdout.write(formatObject22(summary, { format: args.output ?? "json" }) + "\n");
8294
+ process.stdout.write(formatObject23(summary, { format: args.output ?? "json" }) + "\n");
8141
8295
  } catch (e) {
8142
8296
  const err = e;
8143
- if (err?.isAxiosError) exitWithError(fromAxiosError19(err, args.env));
8297
+ if (err?.isAxiosError) exitWithError(fromAxiosError20(err, args.env));
8144
8298
  exitWithError(e);
8145
8299
  process.exit(1);
8146
8300
  }
@@ -8151,7 +8305,7 @@ async function deliveryReconRoundCommand(args) {
8151
8305
  const result = inspectRound(args.dir ?? ".");
8152
8306
  const fmt = args.output ?? "json";
8153
8307
  if (fmt !== "json") process.stdout.write(renderRound(result));
8154
- process.stdout.write(formatObject22(result, { format: fmt }) + "\n");
8308
+ process.stdout.write(formatObject23(result, { format: fmt }) + "\n");
8155
8309
  code = ROUND_EXIT_CODES[result.state];
8156
8310
  } catch (e) {
8157
8311
  exitWithError(e);
@@ -8169,7 +8323,7 @@ import {
8169
8323
  GAP_REASONS,
8170
8324
  deriveAclass,
8171
8325
  exitCode as gate0ExitCode,
8172
- formatObject as formatObject23,
8326
+ formatObject as formatObject24,
8173
8327
  inspectRound as inspectRound2,
8174
8328
  loadProtocolFacts,
8175
8329
  scan
@@ -8214,7 +8368,7 @@ async function deliveryGate0Command(args) {
8214
8368
  const merged = { ...result, premise: premise5 };
8215
8369
  const fmt = args.output ?? "json";
8216
8370
  if (fmt !== "json") process.stdout.write(renderGate0(merged, skillRoot));
8217
- process.stdout.write(`${formatObject23(merged, { format: fmt })}
8371
+ process.stdout.write(`${formatObject24(merged, { format: fmt })}
8218
8372
  `);
8219
8373
  for (const problem of premise5) {
8220
8374
  process.stderr.write(`\u{1F534} \u524D\u63D0\u4E0D\u6210\u7ACB\uFF08${problem.reason}\uFF09\uFF1A${problem.message}
@@ -8238,7 +8392,7 @@ import {
8238
8392
  DRY_RUN_TAIL,
8239
8393
  DriftDetected,
8240
8394
  FORCE_STALE_FLAG,
8241
- HcmClient as HcmClient21,
8395
+ HcmClient as HcmClient22,
8242
8396
  fetchReconIdentity as fetchReconIdentity2,
8243
8397
  INIT_EXIT_CODES,
8244
8398
  JOURNAL_STOP_KINDS,
@@ -8378,7 +8532,7 @@ async function authOrSignpost(args, cmd) {
8378
8532
  }
8379
8533
  async function deliverySeedPlanCommand(args) {
8380
8534
  const ctx = await authOrSignpost(args, "plan");
8381
- const client3 = HcmClient21.fromAuthContext(ctx);
8535
+ const client3 = HcmClient22.fromAuthContext(ctx);
8382
8536
  process.exitCode = await runSeedPlan(args, seedClient(client3, ctx));
8383
8537
  }
8384
8538
  function seedClient(client3, ctx) {
@@ -8552,7 +8706,7 @@ async function runSeedApply(args, client3) {
8552
8706
  }
8553
8707
  async function deliverySeedApplyCommand(args) {
8554
8708
  const ctx = await authOrSignpost(args, "apply");
8555
- const client3 = HcmClient21.fromAuthContext(ctx);
8709
+ const client3 = HcmClient22.fromAuthContext(ctx);
8556
8710
  process.exitCode = await runSeedApply(args, seedClient(client3, ctx));
8557
8711
  }
8558
8712
  async function runSeedVerify(args, client3) {
@@ -8576,13 +8730,13 @@ async function deliverySeedVerifyCommand(args) {
8576
8730
  return;
8577
8731
  }
8578
8732
  const ctx = await authOrSignpost(args, "verify");
8579
- const client3 = HcmClient21.fromAuthContext(ctx);
8733
+ const client3 = HcmClient22.fromAuthContext(ctx);
8580
8734
  process.exitCode = await runSeedVerify(args, await seedVerifyClient(client3, ctx));
8581
8735
  }
8582
8736
 
8583
8737
  // src/commands/delivery-seed-find.ts
8584
8738
  import { existsSync as existsSync4 } from "fs";
8585
- import { readFileSync as readFileSync5 } from "fs";
8739
+ import { readFileSync as readFileSync6 } from "fs";
8586
8740
  import * as path9 from "path";
8587
8741
  import {
8588
8742
  INIT_EXIT_CODES as INIT_EXIT_CODES2,
@@ -8645,7 +8799,7 @@ function runSeedFind(args) {
8645
8799
  if (!existsSync4(chosen.indexFile)) {
8646
8800
  return premise2(`\u7D22\u5F15\u6587\u4EF6\u5728\u9009\u4E2D\u4E4B\u540E\u6D88\u5931\u4E86\uFF1A${chosen.indexFile}`);
8647
8801
  }
8648
- const { rows, problems } = loadRows(readFileSync5(chosen.indexFile, "utf-8"));
8802
+ const { rows, problems } = loadRows(readFileSync6(chosen.indexFile, "utf-8"));
8649
8803
  process.stdout.write(
8650
8804
  renderFind(find(rows, args.term), args.term, rows.length, {
8651
8805
  prefixBytes: Buffer.byteLength(prefix, "utf-8"),
@@ -8685,13 +8839,13 @@ function deliverySeedValuesCommand(model, args) {
8685
8839
 
8686
8840
  // src/commands/delivery-meta.ts
8687
8841
  init_auth_guard();
8688
- import { readFileSync as readFileSync6 } from "fs";
8842
+ import { readFileSync as readFileSync7 } from "fs";
8689
8843
  import {
8690
8844
  BINDING_WORDS,
8691
8845
  CHANGE_STATES,
8692
8846
  CHANGE_UNKNOWN,
8693
8847
  CODE_WORDS,
8694
- HcmClient as HcmClient22,
8848
+ HcmClient as HcmClient23,
8695
8849
  INIT_EXIT_CODES as INIT_EXIT_CODES3,
8696
8850
  META_WRITE_STEPS,
8697
8851
  META_VERIFY_STEPS,
@@ -8833,7 +8987,7 @@ function premise3(what, hint) {
8833
8987
  async function runDeliveryMeta(args, client3) {
8834
8988
  let content;
8835
8989
  try {
8836
- content = readFileSync6(args.contentFile, "utf-8");
8990
+ content = readFileSync7(args.contentFile, "utf-8");
8837
8991
  } catch (e) {
8838
8992
  return premise3(
8839
8993
  `\u8981\u5199\u8FDB\u53BB\u7684\u6B63\u6587\u8BFB\u4E0D\u51FA\u6765\uFF1A${e.message}`,
@@ -8919,7 +9073,7 @@ function lowerCaseHeaders2(headers) {
8919
9073
  }
8920
9074
  async function deliveryMetaCommand(args) {
8921
9075
  const ctx = await getActiveAuthContextFromCli(args);
8922
- const client3 = HcmClient22.fromAuthContext(ctx);
9076
+ const client3 = HcmClient23.fromAuthContext(ctx);
8923
9077
  process.exitCode = await runDeliveryMeta(
8924
9078
  { ...args, tenant: args.tenant ?? String(ctx.tenantId ?? "") },
8925
9079
  metaClient(client3, ctx)
@@ -8931,12 +9085,12 @@ init_auth_guard();
8931
9085
  init_exit();
8932
9086
  import {
8933
9087
  computeReconSourceKey as computeReconSourceKey2,
8934
- HcmClient as HcmClient23,
9088
+ HcmClient as HcmClient24,
8935
9089
  httpProbe as httpProbe3,
8936
9090
  ReconLayout as ReconLayout2,
8937
9091
  runTriageRound
8938
9092
  } from "@hcmai/sdk";
8939
- import { mkdirSync, readFileSync as readFileSync7, writeFileSync as writeFileSync2 } from "fs";
9093
+ import { mkdirSync, readFileSync as readFileSync8, writeFileSync as writeFileSync2 } from "fs";
8940
9094
  import * as path10 from "path";
8941
9095
  var DEFAULT_CAPABILITIES4 = "default";
8942
9096
  function premise4(message, hint) {
@@ -8950,7 +9104,7 @@ var REQUESTS_SHAPE = "`--requests` \u6536\u7684\u662F\u4E00\u4E2A JSON \u6570\u7
8950
9104
  function readRequests(file) {
8951
9105
  let raw;
8952
9106
  try {
8953
- raw = JSON.parse(readFileSync7(file, "utf8"));
9107
+ raw = JSON.parse(readFileSync8(file, "utf8"));
8954
9108
  } catch (e) {
8955
9109
  throw new Error(`\u9700\u6C42\u6E05\u5355\u8BFB\u4E0D\u51FA\u6765\uFF08${file}\uFF09\uFF1A${e instanceof Error ? e.message : String(e)}`);
8956
9110
  }
@@ -8987,7 +9141,7 @@ async function runTriage(args) {
8987
9141
  return premise4(e instanceof Error ? e.message : String(e), REQUESTS_SHAPE);
8988
9142
  }
8989
9143
  const ctx = await getActiveAuthContextFromCli(args);
8990
- const client3 = HcmClient23.fromAuthContext(ctx);
9144
+ const client3 = HcmClient24.fromAuthContext(ctx);
8991
9145
  const probe = httpProbe3(client3.raw(), args.capabilities ?? DEFAULT_CAPABILITIES4);
8992
9146
  const artifactsDir = args.recon ?? new ReconLayout2(args.out ?? ".", ctx.tenantId, await computeReconSourceKey2(probe)).dir;
8993
9147
  const result = await runTriageRound(probe, artifactsDir, entriesIn);
@@ -9016,7 +9170,7 @@ import { createHash as createHash5, randomBytes as secureRandomBytes } from "cry
9016
9170
  import { spawn } from "child_process";
9017
9171
  import { createReadStream, promises as fs7 } from "fs";
9018
9172
  import path11 from "path";
9019
- import { CliError as CliError20, CliErrorCode as CliErrorCode19, formatObject as formatObject24 } from "@hcmai/sdk";
9173
+ import { CliError as CliError20, CliErrorCode as CliErrorCode19, formatObject as formatObject25 } from "@hcmai/sdk";
9020
9174
  init_exit();
9021
9175
  var EXECUTION_CONTRACT_VERSION = "2026-08-29.controlled-v3";
9022
9176
  var DEFAULT_TTL_SECONDS = 15 * 60;
@@ -9026,15 +9180,16 @@ var PLAN_ID_PATTERN = /^[a-f0-9]{24}$/;
9026
9180
  async function prepareDeliveryExecution(input) {
9027
9181
  const project = await realProject(input.project);
9028
9182
  await readProjectMode(project);
9029
- const assessment = await (input.assessCommand ?? assessEffectiveDeliveryCommand)(input.argv);
9030
- assertGuardedAssessment(assessment, input.argv);
9183
+ const argv = normalizeCommandArgv(input.argv);
9184
+ const assessment = await (input.assessCommand ?? assessEffectiveDeliveryCommand)(argv);
9185
+ assertGuardedAssessment(assessment, argv);
9031
9186
  const ttlSeconds = input.ttlSeconds ?? DEFAULT_TTL_SECONDS;
9032
9187
  if (!Number.isInteger(ttlSeconds) || ttlSeconds < MIN_TTL_SECONDS || ttlSeconds > MAX_TTL_SECONDS) {
9033
9188
  throw invalid2(`--ttl-seconds \u5FC5\u987B\u662F ${MIN_TTL_SECONDS} \u5230 ${MAX_TTL_SECONDS} \u7684\u6574\u6570`);
9034
9189
  }
9035
9190
  const change = await bindDocument(project, input.changeRef, "\u53D8\u66F4\u8BF4\u660E");
9036
9191
  const rollback = await bindDocument(project, input.rollbackRef, "\u56DE\u6EDA\u8BF4\u660E");
9037
- const payloads = await bindPayloadFiles(project, input.argv);
9192
+ const payloads = await bindPayloadFiles(project, argv);
9038
9193
  const evidence = await bindEvidenceDirectory(project, input.evidenceDir);
9039
9194
  const lockBytes = await readSkillsLock(project);
9040
9195
  const runtime = await (input.runtimeIdentity ?? currentRuntimeIdentity)();
@@ -9090,8 +9245,9 @@ async function executeDeliveryPlan(input) {
9090
9245
  }
9091
9246
  if (now.getTime() < createdAt - 5e3) throw invalid2("\u5F53\u524D\u65F6\u95F4\u65E9\u4E8E\u8BA1\u5212\u521B\u5EFA\u65F6\u95F4");
9092
9247
  if (now.getTime() > expiresAt) throw invalid2("\u6267\u884C\u8BA1\u5212\u5DF2\u8FC7\u671F\uFF0C\u8BF7\u91CD\u65B0 prepare");
9093
- const assessment = await (input.assessCommand ?? assessEffectiveDeliveryCommand)(input.argv);
9094
- assertGuardedAssessment(assessment, input.argv);
9248
+ const argv = normalizeCommandArgv(input.argv);
9249
+ const assessment = await (input.assessCommand ?? assessEffectiveDeliveryCommand)(argv);
9250
+ assertGuardedAssessment(assessment, argv);
9095
9251
  if (canonicalJson(assessment) !== canonicalJson(plan.assessment)) {
9096
9252
  throw invalid2("\u5B9E\u9645 argv \u4E0E\u6267\u884C\u8BA1\u5212\u7684\u547D\u4EE4\u6458\u8981\u6216\u98CE\u9669\u4E8B\u5B9E\u4E0D\u4E00\u81F4");
9097
9253
  }
@@ -9127,7 +9283,7 @@ async function executeDeliveryPlan(input) {
9127
9283
  const run = input.runCommand ?? runCurrentCliCommand;
9128
9284
  let exitCode;
9129
9285
  try {
9130
- ({ exitCode } = await run(input.argv, project, {
9286
+ ({ exitCode } = await run(argv, project, {
9131
9287
  stdout: (chunk) => stdoutHash.update(chunk),
9132
9288
  stderr: (chunk) => stderrHash.update(chunk)
9133
9289
  }));
@@ -9170,7 +9326,7 @@ async function deliveryPrepareCommand(argv, args) {
9170
9326
  evidenceDir: args.evidenceDir,
9171
9327
  ...ttlSeconds === void 0 ? {} : { ttlSeconds }
9172
9328
  });
9173
- process.stdout.write(formatObject24(plan, { format: args.output ?? "json" }) + "\n");
9329
+ process.stdout.write(formatObject25(plan, { format: args.output ?? "json" }) + "\n");
9174
9330
  process.stderr.write(`
9175
9331
  \u4E0B\u4E00\u6B65\uFF08argv \u5FC5\u987B\u4E0E\u672C\u6B21\u5B8C\u5168\u4E00\u81F4\uFF09\uFF1A
9176
9332
  ${nextCommandHint(plan.planId, args.project, argv)}
@@ -9191,7 +9347,7 @@ async function deliveryExecuteCommand(planId, argv, args) {
9191
9347
  planId,
9192
9348
  argv
9193
9349
  });
9194
- process.stdout.write(formatObject24(receipt, { format: args.output ?? "json" }) + "\n");
9350
+ process.stdout.write(formatObject25(receipt, { format: args.output ?? "json" }) + "\n");
9195
9351
  process.exitCode = receipt.exitCode;
9196
9352
  } catch (cause) {
9197
9353
  exitWithError(cause);
@@ -9327,6 +9483,18 @@ function validateSupportedCommandShape(reasonCode, argv) {
9327
9483
  }
9328
9484
  return;
9329
9485
  }
9486
+ if (reasonCode === "import-write") {
9487
+ if (argv[0] !== "import") {
9488
+ throw invalid2(`import \u7684\u547D\u4EE4\u540D\u5FC5\u987B\u662F argv \u7684\u7B2C\u4E00\u4E2A token\uFF0C\u5B9E\u9645\u662F\uFF1A${argv[0] ?? "(\u7A7A)"}`);
9489
+ }
9490
+ const dataset = argv[1];
9491
+ if (!dataset || dataset.startsWith("-")) {
9492
+ throw invalid2(
9493
+ "import \u7684\u6570\u636E\u96C6\u8DEF\u5F84\u5FC5\u987B\u7D27\u8DDF\u5728 import \u4E4B\u540E\uFF08hcm import <\u8DEF\u5F84> ...\uFF09\u3002next_step=\u628A\u8DEF\u5F84\u79FB\u5230\u547D\u4EE4\u540D\u540E\u9762\u7684\u7B2C\u4E00\u4E2A\u4F4D\u7F6E\u2014\u2014\u53D7\u63A7\u6267\u884C\u6309\u8FD9\u4E2A\u4F4D\u7F6E\u9489\u4F4F\u8F7D\u8377"
9494
+ );
9495
+ }
9496
+ return;
9497
+ }
9330
9498
  if (reasonCode === "record-create") {
9331
9499
  requireExactlyOnePayload(argv, "create");
9332
9500
  return;
@@ -9377,6 +9545,13 @@ function requireExactlyOnePayload(argv, command) {
9377
9545
  var PAYLOAD_FILE_FLAGS = ["--data-file", "--params-file", "--file"];
9378
9546
  var PAYLOAD_DIR_FLAGS = ["--dir"];
9379
9547
  var IMPLICIT_DIR_COMMANDS = { "workspace push": "." };
9548
+ var TOOLING_DIRS = [".git", "node_modules", ".hcm-delivery", "evidence"];
9549
+ var POSITIONAL_PAYLOAD_COMMANDS = { import: 1 };
9550
+ function normalizeCommandArgv(argv) {
9551
+ let start = 0;
9552
+ while (argv[start] === "--") start += 1;
9553
+ return argv.slice(start);
9554
+ }
9380
9555
  async function bindPayloadFiles(project, argv) {
9381
9556
  const bound = [];
9382
9557
  for (const flag of PAYLOAD_FILE_FLAGS) {
@@ -9393,8 +9568,25 @@ async function bindPayloadFiles(project, argv) {
9393
9568
  if (implicit !== void 0 && optionalFlagValue(argv, "--dir") === void 0) {
9394
9569
  bound.push(await bindPayloadDirectory(project, implicit, "\u5DE5\u4F5C\u7A7A\u95F4\u76EE\u5F55\u8F7D\u8377"));
9395
9570
  }
9571
+ const positional = POSITIONAL_PAYLOAD_COMMANDS[argv[0] ?? ""];
9572
+ if (positional !== void 0) {
9573
+ bound.push(await bindPayloadPath(project, argv[positional] ?? "", `${argv[0]} \u6570\u636E\u96C6\u8F7D\u8377`));
9574
+ }
9396
9575
  return bound;
9397
9576
  }
9577
+ async function bindPayloadPath(project, reference, label) {
9578
+ const relative2 = safeRelative(reference, label);
9579
+ let stat;
9580
+ try {
9581
+ stat = await fs7.stat(path11.join(project, relative2));
9582
+ } catch (cause) {
9583
+ throw invalid2(
9584
+ `${label}\u4E0D\u5B58\u5728\uFF1A${relative2}\u3002next_step=\u628A\u6570\u636E\u96C6\u653E\u8FDB\u9879\u76EE\u76EE\u5F55\u5185\uFF0C\u5E76\u7528\u9879\u76EE\u5185\u76F8\u5BF9\u8DEF\u5F84\u5F15\u7528\uFF08\u53D7\u63A7\u6267\u884C\u53EA\u9489\u5F97\u4F4F\u9879\u76EE\u5185\u7684\u8F7D\u8377\uFF09`,
9585
+ cause
9586
+ );
9587
+ }
9588
+ return stat.isDirectory() ? bindPayloadDirectory(project, relative2, label) : bindPayloadFile(project, relative2, label);
9589
+ }
9398
9590
  async function bindPayloadDirectory(project, reference, label) {
9399
9591
  const relative2 = reference === "." ? "." : safeRelative(reference, label);
9400
9592
  const root = path11.join(project, relative2);
@@ -9407,13 +9599,19 @@ async function bindPayloadDirectory(project, reference, label) {
9407
9599
  if (!stat.isDirectory()) {
9408
9600
  throw invalid2(`${label}\u4E0D\u662F\u76EE\u5F55\uFF1A${relative2}`);
9409
9601
  }
9602
+ const skipToolingAtRoot = relative2 === ".";
9410
9603
  const entries = [];
9411
9604
  const walk = async (dir, prefix) => {
9412
9605
  const items = await fs7.readdir(dir, { withFileTypes: true });
9413
9606
  for (const item of [...items].sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0)) {
9414
- if ([".git", "node_modules", ".hcm-delivery", "evidence"].includes(item.name)) continue;
9607
+ if (skipToolingAtRoot && prefix === "" && TOOLING_DIRS.includes(item.name)) continue;
9415
9608
  const child = path11.join(dir, item.name);
9416
9609
  const rel = prefix ? `${prefix}/${item.name}` : item.name;
9610
+ if (item.isSymbolicLink()) {
9611
+ throw invalid2(
9612
+ `${label}\u542B\u7B26\u53F7\u94FE\u63A5\uFF1A${rel}\u3002next_step=\u628A\u8F6F\u94FE\u6362\u6210\u771F\u5B9E\u6587\u4EF6\u6216\u76EE\u5F55\u2014\u2014\u53D7\u63A7\u6267\u884C\u9489\u4E0D\u4F4F\u8F6F\u94FE\u6307\u5411\u7684\u5185\u5BB9`
9613
+ );
9614
+ }
9417
9615
  if (item.isDirectory()) {
9418
9616
  await walk(child, rel);
9419
9617
  } else if (item.isFile()) {
@@ -9630,10 +9828,10 @@ function nextCommandHint(planId, project, argv) {
9630
9828
  init_auth_guard();
9631
9829
  init_exit();
9632
9830
  import {
9633
- HcmClient as HcmClient24,
9831
+ HcmClient as HcmClient25,
9634
9832
  adminResetPassword,
9635
- formatObject as formatObject25,
9636
- fromAxiosError as fromAxiosError20,
9833
+ formatObject as formatObject26,
9834
+ fromAxiosError as fromAxiosError21,
9637
9835
  CliError as CliError21,
9638
9836
  CliErrorCode as CliErrorCode20
9639
9837
  } from "@hcmai/sdk";
@@ -9664,12 +9862,12 @@ async function userResetPasswordCommand(args) {
9664
9862
  try {
9665
9863
  const password = args.passwordStdin ? await readSecretFromStdin() : await promptPasswordTwice();
9666
9864
  const request = buildAdminResetPasswordRequest(args, password);
9667
- const client3 = HcmClient24.fromAuthContext(await getActiveAuthContextFromCli(args));
9865
+ const client3 = HcmClient25.fromAuthContext(await getActiveAuthContextFromCli(args));
9668
9866
  const result = await adminResetPassword(client3.raw(), request);
9669
- process.stdout.write(formatObject25(result, { format: args.output ?? "json" }) + "\n");
9867
+ process.stdout.write(formatObject26(result, { format: args.output ?? "json" }) + "\n");
9670
9868
  } catch (cause) {
9671
9869
  const err = cause;
9672
- if (err?.isAxiosError) exitWithError(fromAxiosError20(err, args.env));
9870
+ if (err?.isAxiosError) exitWithError(fromAxiosError21(err, args.env));
9673
9871
  exitWithError(cause);
9674
9872
  }
9675
9873
  }
@@ -9689,19 +9887,19 @@ async function promptPasswordTwice() {
9689
9887
  init_exit();
9690
9888
  init_auth_guard();
9691
9889
  import {
9692
- HcmClient as HcmClient25,
9693
- formatObject as formatObject26,
9694
- fromAxiosError as fromAxiosError21
9890
+ HcmClient as HcmClient26,
9891
+ formatObject as formatObject27,
9892
+ fromAxiosError as fromAxiosError22
9695
9893
  } from "@hcmai/sdk";
9696
9894
  async function modelsCommand(keyword, args) {
9697
9895
  try {
9698
- const client3 = HcmClient25.fromAuthContext(await getActiveAuthContextFromCli(args));
9896
+ const client3 = HcmClient26.fromAuthContext(await getActiveAuthContextFromCli(args));
9699
9897
  const all = await client3.listModels();
9700
9898
  const needle = keyword?.trim().toLowerCase();
9701
9899
  const rows = (needle ? all.filter((m) => JSON.stringify(m).toLowerCase().includes(needle)) : all).sort((a, b) => key(a).localeCompare(key(b)));
9702
9900
  const fmt = args.output ?? "table";
9703
9901
  if (fmt !== "table") {
9704
- process.stdout.write(formatObject26({ total: rows.length, models: rows }, { format: fmt }) + "\n");
9902
+ process.stdout.write(formatObject27({ total: rows.length, models: rows }, { format: fmt }) + "\n");
9705
9903
  process.exit(0);
9706
9904
  }
9707
9905
  if (rows.length === 0) {
@@ -9725,7 +9923,7 @@ async function modelsCommand(keyword, args) {
9725
9923
  process.exit(0);
9726
9924
  } catch (e) {
9727
9925
  const err = e;
9728
- if (err?.isAxiosError) exitWithError(fromAxiosError21(err, args.profile));
9926
+ if (err?.isAxiosError) exitWithError(fromAxiosError22(err, args.profile));
9729
9927
  exitWithError(e);
9730
9928
  }
9731
9929
  }
@@ -9838,6 +10036,7 @@ delivery.command("triage").description(
9838
10036
  "\u57FA\u7EBF\u4EA7\u7269\u76EE\u5F55\uFF08<out>/recon/<\u79DF\u6237\u6BB5>/<\u6765\u6E90\u6BB5>\uFF09\uFF1B\u4E0D\u7ED9\u5219\u6309\u722C\u53D6\u8EAB\u4EFD\u73B0\u7B97\u4E00\u4EFD"
9839
10037
  ).option("--out <dir>", "\u4EA7\u7269\u6839\uFF08\u5199 work/triage.md\uFF09", ".").option("--capabilities <caps>", "\u672C\u6B21\u63A2\u6D4B\u58F0\u660E\u7684 capability \u4E32", "default").action((opts) => deliveryTriageCommand(opts));
9840
10038
  delivery.command("init").description("\u751F\u6210\u53D7\u63A7\u6267\u884C\u6240\u9700\u7684\u9879\u76EE\u9AA8\u67B6\uFF08.hcm-delivery/project.yml + work/ decisions/ evidence/\uFF09").option("--project <dir>", "HCM \u987E\u95EE\u9879\u76EE\u6839\u76EE\u5F55", ".").option("--mode <mode>", "\u4EA4\u4ED8\u6A21\u5F0F\uFF1Acontrolled | plan-only", "controlled").option("--force", "\u8986\u76D6\u5DF2\u5B58\u5728\u7684\u9879\u76EE\u914D\u7F6E").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "json").action((opts) => deliveryInitCommand(opts));
10039
+ delivery.command("mode").description("\u770B/\u6539\u672C\u9879\u76EE\u7684\u4EA4\u4ED8\u6A21\u5F0F\uFF1B\u4E0D\u5E26 --set \u53EA\u8BFB\uFF0C\u5E26 --set \u5C31\u5730\u6539\u90A3\u4E00\u884C\uFF08\u4E0D\u8986\u76D6\u6574\u4EFD\u914D\u7F6E\uFF09").option("--project <dir>", "HCM \u987E\u95EE\u9879\u76EE\u6839\u76EE\u5F55", ".").option("--set <mode>", "\u6539\u4E3A\uFF1Acontrolled | plan-only").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "json").action((opts) => deliveryModeCommand(opts));
9841
10040
  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));
9842
10041
  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));
9843
10042
  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(
@@ -9899,6 +10098,9 @@ program.command("upload <file>").description("\u4E0A\u4F20\u672C\u5730\u6587\u4E
9899
10098
  "\u5B58\u50A8\u5206\u7C7B\uFF08\u987B\u662F\u76EE\u6807\u73AF\u5883\u91CC\u771F\u5B9E\u5B58\u5728\u7684\u5206\u7C7B\uFF0C\u5982 flex-report / template / attachment\uFF09",
9900
10099
  "attachment"
9901
10100
  ).action((file, opts) => uploadCommand(file, opts));
10101
+ var datapackage = program.command("datapackage").description("DataPackage \u5355\u6587\u4EF6\u5236\u54C1\uFF1Apack \u6253\u5305\uFF08\u7EAF\u672C\u5730\uFF09/ install \u4E0A\u4F20\u5B89\u88C5\uFF08\u670D\u52A1\u7AEF\u5B89\u88C5\u5668\uFF09");
10102
+ datapackage.command("pack <packageDir>").description("\u628A\u5305\u76EE\u5F55\uFF08\u542B package.yml\uFF09\u6253\u6210 .hcmpkg \u5355\u6587\u4EF6\u5236\u54C1\uFF0C\u4E0D\u8054\u7F51").option("-o, --out <path>", "\u4EA7\u7269\u8DEF\u5F84\uFF08\u7F3A\u7701 <name \u672B\u6BB5>-<version>.hcmpkg\uFF09").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "json").action((dir, opts) => datapackagePackCommand(dir, opts));
10103
+ datapackage.command("install <artifact>").description("\u4E0A\u4F20 .hcmpkg \u5236\u54C1\u5E76\u7ECF\u670D\u52A1\u7AEF DataPackage.installFromDocument \u5B89\u88C5\uFF08admin.system\uFF09").option("--env <name>", "\u4E34\u65F6\u5207\u73AF\u5883\uFF08\u8986\u76D6 activeEnv\uFF0C\u672C\u6B21\u547D\u4EE4\uFF09").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("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "json").action((artifact, opts) => datapackageInstallCommand(artifact, opts));
9902
10104
  var tenant = program.command("tenant").description("\u79DF\u6237\u5F00\u901A\u4E0E\u751F\u547D\u5468\u671F");
9903
10105
  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("--admin-password <pwd>", "\u7BA1\u7406\u5458\u5BC6\u7801\uFF08\u4F1A\u6CC4\u6F0F\u5230 history/ps\uFF0C\u5EFA\u8BAE --admin-password-stdin\uFF09").option("--admin-password-stdin", "\u4ECE\u6807\u51C6\u8F93\u5165\u8BFB\u7BA1\u7406\u5458\u5BC6\u7801\uFF08\u63A8\u8350\uFF09").option("--tenant-name <name>", "\u79DF\u6237\u540D\u79F0\uFF08\u9ED8\u8BA4\u53D6 tenantId\uFF09").option("--bootstrap-key <key>", "bootstrap \u5BC6\u94A5\uFF08\u5EFA\u8BAE\u7528 HCM_BOOTSTRAP_KEY \u73AF\u5883\u53D8\u91CF\uFF09").option("--bootstrap-key-stdin", "\u4ECE\u6807\u51C6\u8F93\u5165\u8BFB bootstrap \u5BC6\u94A5").option("--endpoint <url>", "\u540E\u7AEF\u5730\u5740\uFF08\u9ED8\u8BA4\u53D6 activeEnv \u7684 endpoint\uFF09").option("--env <name>", "\u4ECE\u8BE5 env \u89E3\u6790 endpoint").option("-y, --yes", "\u8DF3\u8FC7\u786E\u8BA4\uFF08CI \u7528\uFF09").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "json").action((opts) => tenantBootstrapCommand(opts));
9904
10106
  var meta = program.command("meta").description("\u79DF\u6237\u5143\u6570\u636E\u8BFB\u5199\uFF08\u9875\u9762/\u5B57\u6BB5/\u5217\u8868\u914D\u7F6E\uFF09");