@hcmai/cli 0.4.17 → 0.4.18

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
@@ -6178,6 +6178,8 @@ async function tenantBootstrapCommand(args) {
6178
6178
 
6179
6179
  // src/commands/meta.ts
6180
6180
  import { promises as fsp3 } from "fs";
6181
+ import os3 from "os";
6182
+ import nodePath from "path";
6181
6183
  import {
6182
6184
  HcmClient as HcmClient18,
6183
6185
  formatObject as formatObject18,
@@ -6186,6 +6188,11 @@ import {
6186
6188
  getTenantMeta,
6187
6189
  saveTenantMeta,
6188
6190
  deleteTenantMeta,
6191
+ clearMetaCache as clearMetaCache2,
6192
+ validateMetaContent,
6193
+ formatMetaIssues,
6194
+ explainJacksonError,
6195
+ META_SCHEMA_SOURCE_COMMIT,
6189
6196
  CliError as CliError19,
6190
6197
  CliErrorCode as CliErrorCode18
6191
6198
  } from "@hcmai/sdk";
@@ -6233,6 +6240,73 @@ async function metaGetCommand(path12, args) {
6233
6240
  fail5(e, args);
6234
6241
  }
6235
6242
  }
6243
+ var PROBEABLE_META_TYPES = /* @__PURE__ */ new Set(["model", "list", "info", "view", "filter", "page", "wiz", "impexp"]);
6244
+ function parseMetaPath(path12) {
6245
+ const base = path12.split(/[\\/]/).pop() ?? path12;
6246
+ if (!/\.(yml|yaml)$/i.test(base)) return {};
6247
+ const parts = base.replace(/\.(yml|yaml)$/i, "").split(".");
6248
+ return { model: parts[0] || void 0, kind: parts[1] ?? "model", state: parts[2] };
6249
+ }
6250
+ function connFlags(args) {
6251
+ return (args.env ? ` --env ${args.env}` : "") + (args.as ? ` --as ${args.as}` : "");
6252
+ }
6253
+ function unverifiableReason(e) {
6254
+ const err = e;
6255
+ const st = err.response?.status;
6256
+ if (st === 401 || st === 403) return `\u6743\u9650\u4E0D\u8DB3\uFF08HTTP ${st}\uFF09`;
6257
+ if (st === 404) return "\u63A5\u53E3 404\uFF08\u6A21\u578B\u540D\u5BF9\u4E0D\u4E0A\uFF1F\uFF09";
6258
+ if (st === 429 || st != null && st >= 502) return `\u670D\u52A1\u7AEF\u6682\u65F6\u4E0D\u53EF\u7528\uFF08HTTP ${st}\uFF09`;
6259
+ if (st == null) return `\u8BF7\u6C42\u6CA1\u53D1\u51FA\u53BB\u6216\u6CA1\u56DE\u6765\uFF08${err.code ?? err.message ?? "\u672A\u77E5"}\uFF09`;
6260
+ return void 0;
6261
+ }
6262
+ async function verifyAfterWrite(c, path12) {
6263
+ const { model, kind, state } = parseMetaPath(path12);
6264
+ if (!model || !kind) {
6265
+ return { status: "unverified", where: "(\u672A\u63A2)", why: `\u4ECE\u8DEF\u5F84 ${path12} \u8BA4\u4E0D\u51FA\u6A21\u578B\u540D/\u5C42\u540D` };
6266
+ }
6267
+ try {
6268
+ await clearMetaCache2(c.raw(), model, {});
6269
+ } catch (e) {
6270
+ const err = e;
6271
+ return {
6272
+ status: "unverified",
6273
+ where: `DELETE /api/models/${model}/meta/cache`,
6274
+ why: `\u6E05\u5143\u6570\u636E\u7F13\u5B58\u5931\u8D25\uFF08${err.response?.status ?? err.message ?? "\u672A\u77E5"}\uFF09\uFF1B\u540E\u9762\u90A3\u4E00\u8BFB\u4F1A\u547D\u4E2D\u65E7\u7F13\u5B58\uFF0C\u9A8C\u4E0D\u51FA\u8FD9\u4EFD\u65B0\u7684\u771F\u5047`
6275
+ };
6276
+ }
6277
+ const probes = [];
6278
+ if (PROBEABLE_META_TYPES.has(kind)) {
6279
+ const params = { type: kind };
6280
+ if (state) params.state = state;
6281
+ probes.push({
6282
+ where: `GET /api/models/${model}/meta?type=${kind}${state ? `&state=${state}` : ""}`,
6283
+ run: () => c.raw().get(`/api/models/${model}/meta`, { params })
6284
+ });
6285
+ }
6286
+ probes.push({
6287
+ where: `GET /api/models/${model}/meta`,
6288
+ run: () => c.raw().get(`/api/models/${model}/meta`)
6289
+ });
6290
+ if (kind === "list") {
6291
+ probes.push({
6292
+ where: `GET /api/models/${model}?state=${state ?? "default"}`,
6293
+ run: () => c.raw().get(`/api/models/${model}`, { params: { state: state ?? "default", size: 1 } })
6294
+ });
6295
+ }
6296
+ for (const probe of probes) {
6297
+ try {
6298
+ await probe.run();
6299
+ } catch (e) {
6300
+ const why = unverifiableReason(e);
6301
+ if (why) return { status: "unverified", where: probe.where, why };
6302
+ const err = e;
6303
+ const body = err.response?.data;
6304
+ const raw = typeof body === "string" ? body : JSON.stringify(body ?? err.message ?? String(e));
6305
+ return { status: "broken", where: probe.where, raw };
6306
+ }
6307
+ }
6308
+ return { status: "ok" };
6309
+ }
6236
6310
  async function metaSetCommand(path12, args) {
6237
6311
  try {
6238
6312
  if (!args.file) {
@@ -6248,27 +6322,112 @@ async function metaSetCommand(path12, args) {
6248
6322
  process.stdin.on("end", () => resolve4(buf));
6249
6323
  process.stdin.on("error", reject);
6250
6324
  }) : await fsp3.readFile(args.file, "utf8");
6325
+ if (!args.skipValidate) {
6326
+ const result2 = validateMetaContent(path12, content);
6327
+ if (result2.issues.length > 0) {
6328
+ process.stderr.write(`\u{1F50E} \u5199\u524D\u6821\u9A8C ${path12}\uFF08schema \u7C7B\u578B\uFF1A${result2.kind ?? "\u672A\u8BC6\u522B"}\uFF09
6329
+ `);
6330
+ process.stderr.write(formatMetaIssues(result2, " ") + "\n");
6331
+ }
6332
+ if (result2.errors.length > 0) {
6333
+ process.stderr.write(
6334
+ `
6335
+ \u274C \u4E0A\u9762 ${result2.errors.length} \u5904\u7C7B\u578B\u4E0D\u7B26\uFF0C\u5199\u4E0B\u53BB\u670D\u52A1\u7AEF\u4F1A**\u6536\u4E0B\u5E76\u8FD4 200**\uFF0C\u7136\u540E\u5728\u771F\u5B9E\u7528\u6237\u6253\u5F00\u9875\u9762\u65F6\u624D\u70B8\u3002\u5DF2\u62E6\u5728\u5199\u4E4B\u524D\u3002
6336
+ \u786E\u4FE1 schema \u526F\u672C\u65E7\u4E86\uFF08core \u6539\u8FC7\u5951\u7EA6\uFF09\u21D2 \u52A0 --skip-validate \u5F3A\u5199\u3002
6337
+ `
6338
+ );
6339
+ process.exit(1);
6340
+ }
6341
+ }
6251
6342
  if (args.dryRun) {
6252
- process.stdout.write(
6253
- `[dry-run] \u5C06\u5199\u5165 ${path12}\uFF08${Buffer.byteLength(content)} B\uFF09\u2014\u2014\u672A\u5B9E\u9645\u5199\u5165
6343
+ const dryFmt = args.output;
6344
+ if (dryFmt === "json" || dryFmt === "yaml") {
6345
+ process.stdout.write(
6346
+ formatObject18(
6347
+ { dryRun: true, path: path12, bytes: Buffer.byteLength(content), content },
6348
+ { format: dryFmt }
6349
+ ) + "\n"
6350
+ );
6351
+ } else {
6352
+ process.stdout.write(
6353
+ `[dry-run] \u5C06\u5199\u5165 ${path12}\uFF08${Buffer.byteLength(content)} B\uFF09\u2014\u2014\u672A\u5B9E\u9645\u5199\u5165
6254
6354
  ---
6255
6355
  ${content}
6256
6356
  `
6257
- );
6357
+ );
6358
+ }
6258
6359
  process.exit(0);
6259
6360
  }
6260
6361
  const c = await client2(args);
6362
+ let backupFile;
6363
+ let backupState = "unknown";
6364
+ let backupWhy;
6365
+ try {
6366
+ const prev = await getTenantMeta(c.raw(), path12);
6367
+ if (!prev || prev.trim() === "") {
6368
+ backupState = "absent";
6369
+ } else {
6370
+ backupFile = nodePath.join(
6371
+ os3.tmpdir(),
6372
+ `hcm-meta-backup-${Date.now()}-${path12.replace(/[\\/]/g, "_")}`
6373
+ );
6374
+ await fsp3.writeFile(backupFile, prev, "utf8");
6375
+ backupState = "saved";
6376
+ }
6377
+ } catch (e) {
6378
+ const err = e;
6379
+ const st = err.response?.status;
6380
+ if (st === 404) {
6381
+ backupState = "absent";
6382
+ } else {
6383
+ backupState = "unknown";
6384
+ backupWhy = `HTTP ${st ?? "-"}${err.code ? ` ${err.code}` : ""}${err.message ? `\uFF1A${err.message}` : ""}`;
6385
+ }
6386
+ }
6261
6387
  const result = await saveTenantMeta(c.raw(), path12, content);
6262
6388
  const fmt = args.output ?? "json";
6263
- if (fmt !== "json") {
6264
- process.stdout.write(`\u2705 \u5DF2\u5199\u5165 ${path12}
6265
- \u8BB0\u5F97\u6E05\u7F13\u5B58\uFF1Ahcm cache clear-meta <Model>
6389
+ if (fmt !== "json") process.stdout.write(`\u2705 \u5DF2\u5199\u5165 ${path12}
6266
6390
  `);
6391
+ const restoreHint = backupState === "saved" && backupFile ? ` \u65E7\u5185\u5BB9\u5DF2\u5B58\uFF1A${backupFile}
6392
+ \u653E\u56DE\u53BB\uFF1Ahcm meta set ${path12} --file ${backupFile}${connFlags(args)}
6393
+ ` : backupState === "absent" ? ` \u8FD9\u4E00\u5C42\u6B64\u524D\u6CA1\u6709\u8986\u76D6\uFF08\u5DF2\u8BC1\u5B9E\uFF09\uFF0C\u6062\u590D\u5373\u5220\u9664\uFF1Ahcm meta delete ${path12}${connFlags(args)}
6394
+ ` : ` \u26A0\uFE0F \u65E7\u5185\u5BB9**\u6CA1\u5907\u4EFD\u6210**\uFF08${backupWhy ?? "\u539F\u56E0\u672A\u77E5"}\uFF09\u2014\u2014\u65E2\u4E0D\u77E5\u9053\u6B64\u524D\u6709\u6CA1\u6709\u8986\u76D6\uFF0C\u4E5F\u5C31\u7ED9\u4E0D\u51FA\u6062\u590D\u547D\u4EE4\u3002
6395
+ \u5148\u81EA\u5DF1\u8BFB\u4E00\u904D\u786E\u8BA4\uFF1Ahcm meta get ${path12}${connFlags(args)}
6396
+ `;
6397
+ if (args.verify === false) {
6398
+ process.stderr.write(
6399
+ "\u26A0\uFE0F --no-verify\uFF1A**\u6CA1\u6709**\u9A8C\u8FC7\u670D\u52A1\u7AEF\u8BFB\u4E0D\u8BFB\u5F97\u52A8\u8FD9\u4EFD meta\u3002\u300C\u5199\u5165\u6210\u529F\u300D\u53EA\u8BF4\u660E\u5B57\u8282\u6536\u4E0B\u4E86\u3002\n \u81EA\u5DF1\u8865\uFF1Ahcm cache clear-meta <Model> \u540E\u6253\u5F00\u9875\u9762\u770B\u4E00\u773C\u3002\n" + restoreHint
6400
+ );
6401
+ } else {
6402
+ const outcome = await verifyAfterWrite(c, path12);
6403
+ if (outcome.status === "broken") {
6404
+ const human = explainJacksonError(outcome.raw);
6405
+ process.stderr.write(
6406
+ `
6407
+ \u{1F534} \u5199\u8FDB\u53BB\u4E86\uFF0C\u4F46**\u670D\u52A1\u7AEF\u8BFB\u4E0D\u52A8** \u2014\u2014 \u9875\u9762\u73B0\u5728\u662F\u574F\u7684\u3002
6408
+ \u63A2\u9488\uFF1A${outcome.where}
6409
+ ` + (human ? `${human.split("\n").map((l) => " " + l).join("\n")}
6410
+ ` : "") + ` \u670D\u52A1\u7AEF\u539F\u8BDD\uFF1A${outcome.raw.slice(0, 600)}
6411
+ ` + restoreHint
6412
+ );
6413
+ process.exit(1);
6414
+ }
6415
+ if (outcome.status === "unverified") {
6416
+ process.stderr.write(
6417
+ `
6418
+ \u26A0\uFE0F \u5199\u8FDB\u53BB\u4E86\uFF0C\u4F46**\u6CA1\u9A8C\u6210**\uFF1A${outcome.why}
6419
+ \u63A2\u9488\uFF1A${outcome.where}
6420
+ \u4E5F\u5C31\u662F\u8BF4\uFF0C\u670D\u52A1\u7AEF\u8BFB\u4E0D\u8BFB\u5F97\u52A8\u8FD9\u4EFD meta\uFF0C\u672C\u6B21\u547D\u4EE4**\u4E0D\u77E5\u9053**\u3002
6421
+ ` + restoreHint
6422
+ );
6423
+ } else if (fmt !== "json") {
6424
+ process.stdout.write(" \u5DF2\u6E05\u5143\u6570\u636E\u7F13\u5B58\uFF0C\u5E76\u771F\u8BFB\u4E86\u4E00\u904D\uFF1A\u670D\u52A1\u7AEF\u8BFB\u5F97\u52A8 \u2714\n");
6425
+ }
6267
6426
  }
6268
6427
  process.stdout.write(formatObject18(result, { format: fmt }) + "\n");
6269
6428
  process.exit(0);
6270
6429
  } catch (e) {
6271
- if (e?.code === "ENOENT") exitWithError(new Error(`\u6587\u4EF6\u4E0D\u5B58\u5728\uFF1A${args.file}`));
6430
+ if (e.code === "ENOENT") exitWithError(new Error(`\u6587\u4EF6\u4E0D\u5B58\u5728\uFF1A${args.file}`));
6272
6431
  fail5(e, args);
6273
6432
  }
6274
6433
  }
@@ -6292,6 +6451,52 @@ async function metaDeleteCommand(path12, args) {
6292
6451
  fail5(e, args);
6293
6452
  }
6294
6453
  }
6454
+ async function metaValidateCommand(path12, args) {
6455
+ try {
6456
+ if (!args.file) {
6457
+ throw new CliError19({
6458
+ code: CliErrorCode18.MISSING_FLAG,
6459
+ message: "--file <path> \u5FC5\u586B\uFF08\u8981\u9A8C\u7684\u90A3\u4EFD\u539F\u6587\uFF1B\u7528 - \u8868\u793A stdin\uFF09"
6460
+ });
6461
+ }
6462
+ const content = args.file === "-" ? await new Promise((resolve4, reject) => {
6463
+ let buf = "";
6464
+ process.stdin.setEncoding("utf8");
6465
+ process.stdin.on("data", (d) => buf += d);
6466
+ process.stdin.on("end", () => resolve4(buf));
6467
+ process.stdin.on("error", reject);
6468
+ }) : await fsp3.readFile(args.file, "utf8");
6469
+ const result = validateMetaContent(path12, content);
6470
+ const fmt = args.output ?? "table";
6471
+ if (fmt === "json" || fmt === "yaml") {
6472
+ process.stdout.write(
6473
+ formatObject18(
6474
+ {
6475
+ path: path12,
6476
+ kind: result.kind,
6477
+ schemaKnown: result.schemaKnown,
6478
+ schemaSourceCommit: META_SCHEMA_SOURCE_COMMIT,
6479
+ errorCount: result.errors.length,
6480
+ issues: result.issues
6481
+ },
6482
+ { format: fmt }
6483
+ ) + "\n"
6484
+ );
6485
+ } else {
6486
+ process.stdout.write(
6487
+ `\u{1F50E} ${path12}\uFF08schema \u7C7B\u578B\uFF1A${result.kind ?? "\u672A\u8BC6\u522B"}\uFF0C\u6765\u6E90 ${META_SCHEMA_SOURCE_COMMIT.slice(0, 8)}\uFF09
6488
+ `
6489
+ );
6490
+ process.stdout.write(
6491
+ result.issues.length === 0 ? " \u6CA1\u6709\u53D1\u73B0\u95EE\u9898\u3002\n" : formatMetaIssues(result, " ") + "\n"
6492
+ );
6493
+ }
6494
+ process.exit(result.errors.length > 0 ? 1 : 0);
6495
+ } catch (e) {
6496
+ if (e.code === "ENOENT") exitWithError(new Error(`\u6587\u4EF6\u4E0D\u5B58\u5728\uFF1A${args.file}`));
6497
+ fail5(e, args);
6498
+ }
6499
+ }
6295
6500
 
6296
6501
  // src/commands/workspace.ts
6297
6502
  init_exit();
@@ -7784,8 +7989,31 @@ var GUARDED_EXECUTOR_REASON_CODES = /* @__PURE__ */ new Set([
7784
7989
  // 「该 R2 命令不在首批受控执行器支持面」拦死,一个写请求都没发出去。
7785
7990
  "import-write"
7786
7991
  ]);
7992
+ function normalizeAssessedArgv(inputArgv) {
7993
+ let rest = inputArgv;
7994
+ const dropSeparators = () => {
7995
+ let start = 0;
7996
+ while (rest[start] === "--") start += 1;
7997
+ rest = start > 0 ? rest.slice(start) : rest;
7998
+ };
7999
+ dropSeparators();
8000
+ if (PACKAGE_RUNNERS.has(rest[0] ?? "") && isCliLauncher(rest[1])) {
8001
+ rest = rest.slice(2);
8002
+ } else if (isCliLauncher(rest[0])) {
8003
+ rest = rest.slice(1);
8004
+ }
8005
+ dropSeparators();
8006
+ return rest === inputArgv ? [...inputArgv] : rest;
8007
+ }
8008
+ var PACKAGE_RUNNERS = /* @__PURE__ */ new Set(["npx", "bunx", "pnpx"]);
8009
+ function isCliLauncher(token) {
8010
+ if (!token || token.startsWith("-")) return false;
8011
+ if (token === "@hcmai/cli") return true;
8012
+ const base = token.split(/[\\/]/).pop() ?? token;
8013
+ return base === "hcm" || base === "hcm.js" || base === "hcmai";
8014
+ }
7787
8015
  function assessDeliveryCommand(inputArgv, options = {}) {
7788
- const argv = inputArgv[0] === "--" ? inputArgv.slice(1) : [...inputArgv];
8016
+ const argv = normalizeAssessedArgv(inputArgv);
7789
8017
  const commandSha256 = sha2564(JSON.stringify(argv));
7790
8018
  const name = argv[0] ?? "";
7791
8019
  const subcommand = argv[1] && !argv[1].startsWith("-") ? argv[1] : void 0;
@@ -9729,9 +9957,7 @@ var IMPLICIT_DIR_COMMANDS = { "workspace push": "." };
9729
9957
  var TOOLING_DIRS = [".git", "node_modules", ".hcm-delivery", "evidence"];
9730
9958
  var POSITIONAL_PAYLOAD_COMMANDS = { import: 1 };
9731
9959
  function normalizeCommandArgv(argv) {
9732
- let start = 0;
9733
- while (argv[start] === "--") start += 1;
9734
- return argv.slice(start);
9960
+ return normalizeAssessedArgv(argv);
9735
9961
  }
9736
9962
  async function bindPayloadFiles(project, argv) {
9737
9963
  const bound = [];
@@ -10287,7 +10513,8 @@ tenant.command("bootstrap").description("\u5F00\u901A\u65B0\u79DF\u6237\uFF08\u5
10287
10513
  var meta = program.command("meta").description("\u79DF\u6237\u5143\u6570\u636E\u8BFB\u5199\uFF08\u9875\u9762/\u5B57\u6BB5/\u5217\u8868\u914D\u7F6E\uFF09");
10288
10514
  meta.command("list").description("\u5217\u51FA\u79DF\u6237\u5143\u6570\u636E\u6587\u4EF6").option("--keyword <kw>", "\u641C\u7D22\u5173\u952E\u8BCD").option("--type <type>", "\u7C7B\u578B\uFF1Ayml | properties | all", "all").option("--page <n>", "\u9875\u7801\uFF08\u4ECE 0 \u5F00\u59CB\uFF09").option("--page-size <n>", "\u6BCF\u9875\u6761\u6570").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("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "json").action((opts) => metaListCommand(opts));
10289
10515
  meta.command("get <path>").description("\u6253\u5370 meta \u539F\u6587\uFF08\u5982 metas/Employee.list.yml\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").action((p, opts) => metaGetCommand(p, opts));
10290
- meta.command("set <path>").description("\u5199\u5165 meta \u539F\u6587\uFF1B\u5199\u5B8C\u987B hcm cache clear-meta <Model> \u624D\u751F\u6548").requiredOption("--file <file>", "\u4ECE\u6587\u4EF6\u8BFB\u53D6\u539F\u6587\uFF08- \u8868\u793A stdin\uFF09").option("--dry-run", "\u53EA\u663E\u793A\u5C06\u5199\u5165\u7684\u5185\u5BB9\uFF0C\u4E0D\u5B9E\u9645\u5199\u5165").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("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "json").action((p, opts) => metaSetCommand(p, opts));
10516
+ meta.command("set <path>").description("\u5199\u5165 meta \u539F\u6587\uFF1A\u5199\u524D\u6309 schema \u9A8C\u7C7B\u578B \u2192 \u5199\u5165 \u2192 \u6E05\u7F13\u5B58\u540E\u771F\u8BFB\u4E00\u904D\uFF08\u8BFB\u4E0D\u52A8\u5C31\u62A5\u5E76\u7ED9\u6062\u590D\u547D\u4EE4\uFF09").requiredOption("--file <file>", "\u4ECE\u6587\u4EF6\u8BFB\u53D6\u539F\u6587\uFF08- \u8868\u793A stdin\uFF09").option("--dry-run", "\u53EA\u663E\u793A\u5C06\u5199\u5165\u7684\u5185\u5BB9\uFF0C\u4E0D\u5B9E\u9645\u5199\u5165").option("--skip-validate", "\u8DF3\u8FC7\u5199\u524D schema \u7C7B\u578B\u6821\u9A8C\uFF08schema \u526F\u672C\u65E7\u4E86\u65F6\u7684\u9003\u751F\u95E8\uFF09").option("--no-verify", "\u4E0D\u505A\u5199\u540E\u81EA\u8BC1\u3002\u26A0\uFE0F \u300C\u5199\u5165\u6210\u529F\u300D\u53EA\u8BF4\u660E\u5B57\u8282\u6536\u4E0B\u4E86\uFF0C\u4E0D\u8BF4\u660E\u670D\u52A1\u7AEF\u8BFB\u5F97\u52A8").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("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "json").action((p, opts) => metaSetCommand(p, opts));
10517
+ meta.command("validate <path>").description("\u96F6\u7F51\u7EDC\uFF1A\u6309 core \u4ED3\u7684 JSON Schema \u9A8C\u4E00\u4EFD meta \u539F\u6587\uFF08path \u53EA\u7528\u6765\u6311 schema\uFF0C\u4E0D\u53D1\u8BF7\u6C42\uFF09").requiredOption("--file <file>", "\u8981\u9A8C\u7684\u539F\u6587\uFF08- \u8868\u793A stdin\uFF09").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "table").action((p, opts) => metaValidateCommand(p, opts));
10291
10518
  meta.command("delete <path>").description("\u5220\u9664 meta\uFF08\u4E0D\u53EF\u9006\uFF0C\u9ED8\u8BA4\u8FC7\u786E\u8BA4\u95F8\uFF09").option("-y, --yes", "\u8DF3\u8FC7\u786E\u8BA4").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("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "json").action((p, opts) => metaDeleteCommand(p, opts));
10292
10519
  var skills = program.command("skills").description("\u4EA4\u4ED8\u6280\u80FD\uFF1A\u777F\u620E Chiron \u6280\u80FD\u5E93 + CLI \u81EA\u5E26\u6280\u80FD\uFF08\u514D\u8BA4\u8BC1\uFF0C\u65E0\u9700\u5148 login\uFF09");
10293
10520
  skills.command("list [keyword]").description("\u5217\u51FA\u76EE\u6807\u73AF\u5883\u8FD9\u4E00\u7248\u7684\u4EA4\u4ED8\u6280\u80FD\uFF1B--installed \u6539\u770B\u672C\u5730\u88C5\u4E86\u54EA\u4E9B\uFF08\u4E0D\u8FDE\u7F51\uFF09").option("--installed", "\u53EA\u770B\u672C\u5730\u5DF2\u88C5\u7684\u6280\u80FD\uFF08\u8BFB .hcm-skills.json\uFF0C\u4E0D\u8FDE\u7F51\uFF09").option("--target <agent>", "\u914D\u5408 --installed\uFF1Aclaude | codex | auto", "auto").option("--global", "\u914D\u5408 --installed\uFF1A\u770B\u7528\u6237\u7EA7\u76EE\u5F55").option("--dir <path>", "\u914D\u5408 --installed\uFF1A\u770B\u6307\u5B9A\u76EE\u5F55").option("--category <key>", "\u53EA\u770B\u67D0\u4E2A\u5206\u7C7B").option("--stage <key>", "\u53EA\u770B\u67D0\u4E2A\u4EA4\u4ED8\u9636\u6BB5\uFF1Ahandover | baseline | configure | migrate | integrate | golive | operate").option("--by-stage", "\u6309\u4EA4\u4ED8\u751F\u547D\u5468\u671F\u5206\u7EC4\u5C55\u793A\uFF08\u9ED8\u8BA4\u6309\u529F\u80FD\u5206\u7C7B\uFF09").option("--source <kind>", "\u8FD9\u4E00\u8D9F\u770B\u54EA\u4E9B\u6765\u6E90\uFF1Acli\uFF08\u53EA\u770B\u81EA\u5E26\uFF0C\u4E0D\u8FDE\u7F51\uFF09| chiron | all", "all").option("--endpoint <url>", "\u6280\u80FD\u5E93\u5730\u5740\uFF08\u9ED8\u8BA4\u53D6 activeEnv \u7684 endpoint\uFF09").option("--env <name>", "\u4ECE\u8BE5 env \u89E3\u6790 endpoint").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "table").action((kw, opts) => skillsListCommand(kw, opts));