@hcmai/cli 0.4.0 → 0.4.1

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
@@ -523,8 +523,8 @@ var init_TerminalRenderer = __esm({
523
523
  }
524
524
  }
525
525
  /** 来源行(仅子代理触发,agentPath ≥2 段时显示 `↑ 来自 a › b`,对齐 Web)。 */
526
- originLine(path10) {
527
- const segs = path10.split(".").filter(Boolean);
526
+ originLine(path11) {
527
+ const segs = path11.split(".").filter(Boolean);
528
528
  if (segs.length < 2) return "";
529
529
  const names = segs.map((k) => agentDisplayName(k));
530
530
  return chalk.gray(` \u2191 \u6765\u81EA ${names.join(" \u203A ")}`) + "\n";
@@ -1706,8 +1706,8 @@ function agentLabel(agentId) {
1706
1706
  if (/^[0-9a-f]{8}-[0-9a-f-]{27}$/i.test(agentId)) return `agent \u2026${agentId.slice(-4)}`;
1707
1707
  return agentDisplayName(agentId);
1708
1708
  }
1709
- function originLine(path10) {
1710
- const segs = (path10 ?? "").split(".").filter(Boolean);
1709
+ function originLine(path11) {
1710
+ const segs = (path11 ?? "").split(".").filter(Boolean);
1711
1711
  if (segs.length < 2) return null;
1712
1712
  return `\u6765\u81EA ${segs.map((k) => agentDisplayName(k)).join(" \u203A ")}`;
1713
1713
  }
@@ -3084,8 +3084,8 @@ import {
3084
3084
  formatObject as formatObject7,
3085
3085
  fromAxiosError as fromAxiosError8
3086
3086
  } from "@hcmai/sdk";
3087
- function collectYmlFiles(path10) {
3088
- if (statSync(path10).isFile()) return [path10];
3087
+ function collectYmlFiles(path11) {
3088
+ if (statSync(path11).isFile()) return [path11];
3089
3089
  const out = [];
3090
3090
  const walk = (dir) => {
3091
3091
  for (const name of readdirSync(dir).sort()) {
@@ -3094,7 +3094,7 @@ function collectYmlFiles(path10) {
3094
3094
  else if (full.endsWith(".yml") || full.endsWith(".yaml")) out.push(full);
3095
3095
  }
3096
3096
  };
3097
- walk(path10);
3097
+ walk(path11);
3098
3098
  return out.sort();
3099
3099
  }
3100
3100
  var DRY_RUN_CLIENT = {
@@ -3102,9 +3102,9 @@ var DRY_RUN_CLIENT = {
3102
3102
  create: async () => ({ id: "" }),
3103
3103
  update: async () => ({})
3104
3104
  };
3105
- async function importCommand(path10, args) {
3105
+ async function importCommand(path11, args) {
3106
3106
  try {
3107
- const files = collectYmlFiles(path10);
3107
+ const files = collectYmlFiles(path11);
3108
3108
  const fixtures = files.map(
3109
3109
  (f) => parseFixture(readFileSync2(f, "utf8"), relative(process.cwd(), f))
3110
3110
  );
@@ -5883,17 +5883,17 @@ async function metaListCommand(args) {
5883
5883
  fail4(e, args);
5884
5884
  }
5885
5885
  }
5886
- async function metaGetCommand(path10, args) {
5886
+ async function metaGetCommand(path11, args) {
5887
5887
  try {
5888
5888
  const c = await client2(args);
5889
- const content = await getTenantMeta(c.raw(), path10);
5889
+ const content = await getTenantMeta(c.raw(), path11);
5890
5890
  process.stdout.write(content.endsWith("\n") ? content : content + "\n");
5891
5891
  process.exit(0);
5892
5892
  } catch (e) {
5893
5893
  fail4(e, args);
5894
5894
  }
5895
5895
  }
5896
- async function metaSetCommand(path10, args) {
5896
+ async function metaSetCommand(path11, args) {
5897
5897
  try {
5898
5898
  if (!args.file) {
5899
5899
  throw new CliError18({
@@ -5910,7 +5910,7 @@ async function metaSetCommand(path10, args) {
5910
5910
  }) : await fsp3.readFile(args.file, "utf8");
5911
5911
  if (args.dryRun) {
5912
5912
  process.stdout.write(
5913
- `[dry-run] \u5C06\u5199\u5165 ${path10}\uFF08${Buffer.byteLength(content)} B\uFF09\u2014\u2014\u672A\u5B9E\u9645\u5199\u5165
5913
+ `[dry-run] \u5C06\u5199\u5165 ${path11}\uFF08${Buffer.byteLength(content)} B\uFF09\u2014\u2014\u672A\u5B9E\u9645\u5199\u5165
5914
5914
  ---
5915
5915
  ${content}
5916
5916
  `
@@ -5918,10 +5918,10 @@ ${content}
5918
5918
  process.exit(0);
5919
5919
  }
5920
5920
  const c = await client2(args);
5921
- const result = await saveTenantMeta(c.raw(), path10, content);
5921
+ const result = await saveTenantMeta(c.raw(), path11, content);
5922
5922
  const fmt = args.output ?? "json";
5923
5923
  if (fmt !== "json") {
5924
- process.stdout.write(`\u2705 \u5DF2\u5199\u5165 ${path10}
5924
+ process.stdout.write(`\u2705 \u5DF2\u5199\u5165 ${path11}
5925
5925
  \u8BB0\u5F97\u6E05\u7F13\u5B58\uFF1Ahcm cache clear-meta <Model>
5926
5926
  `);
5927
5927
  }
@@ -5932,19 +5932,19 @@ ${content}
5932
5932
  fail4(e, args);
5933
5933
  }
5934
5934
  }
5935
- async function metaDeleteCommand(path10, args) {
5935
+ async function metaDeleteCommand(path11, args) {
5936
5936
  try {
5937
5937
  if (!args.yes) {
5938
- const ok = await promptConfirm(`\u5C06\u5220\u9664\u5143\u6570\u636E ${path10}\uFF0C\u6B64\u64CD\u4F5C\u4E0D\u53EF\u9006\u3002\u7EE7\u7EED\uFF1F`);
5938
+ const ok = await promptConfirm(`\u5C06\u5220\u9664\u5143\u6570\u636E ${path11}\uFF0C\u6B64\u64CD\u4F5C\u4E0D\u53EF\u9006\u3002\u7EE7\u7EED\uFF1F`);
5939
5939
  if (!ok) {
5940
5940
  process.stderr.write("\u5DF2\u53D6\u6D88\n");
5941
5941
  process.exit(1);
5942
5942
  }
5943
5943
  }
5944
5944
  const c = await client2(args);
5945
- const result = await deleteTenantMeta(c.raw(), path10);
5945
+ const result = await deleteTenantMeta(c.raw(), path11);
5946
5946
  const fmt = args.output ?? "json";
5947
- if (fmt !== "json") process.stdout.write(`\u{1F5D1}\uFE0F \u5DF2\u5220\u9664 ${path10}
5947
+ if (fmt !== "json") process.stdout.write(`\u{1F5D1}\uFE0F \u5DF2\u5220\u9664 ${path11}
5948
5948
  `);
5949
5949
  process.stdout.write(formatObject16(result, { format: fmt }) + "\n");
5950
5950
  process.exit(0);
@@ -6035,7 +6035,6 @@ async function workspaceListCommand(args) {
6035
6035
  "ownerUserName",
6036
6036
  "sharedUsers",
6037
6037
  "filesCount",
6038
- "myLockCount",
6039
6038
  "devModeEnabled",
6040
6039
  "updateTime"
6041
6040
  ],
@@ -7898,16 +7897,16 @@ async function deliveryGate0Command(args) {
7898
7897
  const { aclass, problems: aclassProblems } = deriveAclass(reconDir, args.mapping ?? null);
7899
7898
  const { facts, problems: factsProblems } = loadProtocolFacts();
7900
7899
  const result = scan(skillRoot, aclass, facts, { aclassProblems, factsProblems });
7901
- const premise3 = checkPremise([
7900
+ const premise4 = checkPremise([
7902
7901
  ...result.premise,
7903
7902
  ...baselineRoundPremise(inspectRound2(reconDir))
7904
7903
  ]);
7905
- const merged = { ...result, premise: premise3 };
7904
+ const merged = { ...result, premise: premise4 };
7906
7905
  const fmt = args.output ?? "json";
7907
7906
  if (fmt !== "json") process.stdout.write(renderGate0(merged, skillRoot));
7908
7907
  process.stdout.write(`${formatObject21(merged, { format: fmt })}
7909
7908
  `);
7910
- for (const problem of premise3) {
7909
+ for (const problem of premise4) {
7911
7910
  process.stderr.write(`\u{1F534} \u524D\u63D0\u4E0D\u6210\u7ACB\uFF08${problem.reason}\uFF09\uFF1A${problem.message}
7912
7911
  `);
7913
7912
  }
@@ -8265,6 +8264,109 @@ async function deliverySeedVerifyCommand(args) {
8265
8264
  process.exitCode = await runSeedVerify(args, seedClient(client3, ctx));
8266
8265
  }
8267
8266
 
8267
+ // src/commands/delivery-seed-find.ts
8268
+ import { existsSync as existsSync3 } from "fs";
8269
+ import { readFileSync as readFileSync4 } from "fs";
8270
+ import * as path8 from "path";
8271
+ import {
8272
+ INIT_EXIT_CODES as INIT_EXIT_CODES2,
8273
+ ValueHints,
8274
+ find,
8275
+ inspectRound as inspectRound4,
8276
+ loadRows,
8277
+ renderFind,
8278
+ renderValues,
8279
+ roundWarning as roundWarning2,
8280
+ seedBaselines as seedBaselines2,
8281
+ valuesRoundCaveat
8282
+ } from "@hcmai/sdk";
8283
+ function provenance(chosenReconDir, others) {
8284
+ let line = `> \u57FA\u7EBF\uFF1A\`${path8.basename(chosenReconDir)}\`
8285
+ `;
8286
+ if (others.length > 0) {
8287
+ line += `> \u26A0\uFE0F \u540C\u79DF\u6237\u4E0B\u53E6\u6709 ${others.length} \u4EFD\u57FA\u7EBF\u672A\u88AB\u8BFB\u53D6\uFF1A` + others.map((o) => `\`${path8.basename(o)}\``).join("\u3001") + " \u2014\u2014 \u4E0D\u540C sourceKey \u7684\u4EA7\u7269**\u4E0D\u53EF\u4E92\u6362**\u3002\n";
8288
+ }
8289
+ return `${line}
8290
+ `;
8291
+ }
8292
+ function premise2(message, hint = "") {
8293
+ process.stderr.write(message + (hint ? `
8294
+ \u2192 ${hint}` : "") + "\n");
8295
+ return INIT_EXIT_CODES2.premise;
8296
+ }
8297
+ function pickBaseline(args) {
8298
+ const out = args.out ?? ".";
8299
+ const tenant2 = args.tenant ?? "";
8300
+ if (!tenant2) {
8301
+ return {
8302
+ rc: premise2(
8303
+ "\u6CA1\u7ED9 `--tenant`\u3002",
8304
+ "\u672C\u547D\u4EE4\u96F6\u7F51\u7EDC\uFF08\u4E0D\u767B\u5F55\u3001\u4E00\u53D1\u8BF7\u6C42\u90FD\u4E0D\u53D1\uFF09\uFF0C\u6240\u4EE5\u5B83\u65E0\u6CD5\u4ECE\u767B\u5F55\u6001\u77E5\u9053\u4F60\u5728\u54EA\u4E2A\u79DF\u6237\u3002\u7ED9\u7684\u503C\u8981\u4E0E\u5F53\u521D\u8DD1 `hcm delivery recon` \u65F6\u90A3\u4E2A\u79DF\u6237\u4E00\u81F4\u3002"
8305
+ )
8306
+ };
8307
+ }
8308
+ const [base, candidates] = seedBaselines2(out, tenant2);
8309
+ if (candidates.length === 0) {
8310
+ return {
8311
+ rc: premise2(
8312
+ `\u672A\u627E\u5230\u7D22\u5F15\uFF1A${base}/*/index/fields.jsonl`,
8313
+ "\u672C\u547D\u4EE4\u53EA\u8BFB `hcm delivery recon` \u843D\u76D8\u7684\u5B57\u6BB5\u76EE\u5F55\u3002\u5148\u8DD1\u4E00\u6B21 `hcm delivery recon`\uFF0C\u6216\u7528 `--out <\u76EE\u5F55>` \u6307\u5230\u4EA7\u7269\u6839\u3002"
8314
+ )
8315
+ };
8316
+ }
8317
+ const chosen = candidates[0];
8318
+ const others = candidates.slice(1).map((c) => c.reconDir);
8319
+ let prefix = provenance(chosen.reconDir, others);
8320
+ prefix += roundWarning2(inspectRound4(chosen.reconDir));
8321
+ return { reconDir: chosen.reconDir, indexFile: chosen.indexFile, prefix };
8322
+ }
8323
+ function runSeedFind(args) {
8324
+ const picked = pickBaseline(args);
8325
+ if ("rc" in picked) return picked.rc;
8326
+ const chosen = { reconDir: picked.reconDir, indexFile: picked.indexFile };
8327
+ const prefix = picked.prefix;
8328
+ process.stdout.write(prefix);
8329
+ if (!existsSync3(chosen.indexFile)) {
8330
+ return premise2(`\u7D22\u5F15\u6587\u4EF6\u5728\u9009\u4E2D\u4E4B\u540E\u6D88\u5931\u4E86\uFF1A${chosen.indexFile}`);
8331
+ }
8332
+ const { rows, problems } = loadRows(readFileSync4(chosen.indexFile, "utf-8"));
8333
+ process.stdout.write(
8334
+ renderFind(find(rows, args.term), args.term, rows.length, {
8335
+ prefixBytes: Buffer.byteLength(prefix, "utf-8"),
8336
+ // 🔴 指路器与检索**读同一份基线**(`pickBaseline` 选的那一份)——
8337
+ // 各选各的会让 find 指出来的对照表与 `values` 打开的不是同一份产物。
8338
+ hints: new ValueHints(chosen.reconDir)
8339
+ })
8340
+ );
8341
+ for (const bad of problems) {
8342
+ process.stderr.write(`\u26A0\uFE0F \u7D22\u5F15\u6709\u574F\u884C\uFF08\u5176\u4F59 ${rows.length} \u884C\u4ECD\u53EF\u7528\uFF09\uFF1A${bad}
8343
+ `);
8344
+ }
8345
+ return INIT_EXIT_CODES2.clean;
8346
+ }
8347
+ function deliverySeedFindCommand(term, args) {
8348
+ process.exitCode = runSeedFind({ ...args, term });
8349
+ }
8350
+ function runSeedValues(args) {
8351
+ const picked = pickBaseline({ term: "", out: args.out, tenant: args.tenant });
8352
+ if ("rc" in picked) return picked.rc;
8353
+ process.stdout.write(picked.prefix);
8354
+ const got = renderValues(picked.reconDir, args.model, {
8355
+ limit: args.limit,
8356
+ roundCaveat: valuesRoundCaveat(inspectRound4(picked.reconDir))
8357
+ });
8358
+ if (!got.ok) {
8359
+ process.stderr.write(`${got.message}
8360
+ `);
8361
+ return INIT_EXIT_CODES2.premise;
8362
+ }
8363
+ process.stdout.write(got.text);
8364
+ return INIT_EXIT_CODES2.clean;
8365
+ }
8366
+ function deliverySeedValuesCommand(model, args) {
8367
+ process.exitCode = runSeedValues({ ...args, model });
8368
+ }
8369
+
8268
8370
  // src/commands/delivery-triage.ts
8269
8371
  init_auth_guard();
8270
8372
  init_exit();
@@ -8275,10 +8377,10 @@ import {
8275
8377
  ReconLayout as ReconLayout2,
8276
8378
  runTriageRound
8277
8379
  } from "@hcmai/sdk";
8278
- import { mkdirSync, readFileSync as readFileSync4, writeFileSync as writeFileSync2 } from "fs";
8279
- import * as path8 from "path";
8380
+ import { mkdirSync, readFileSync as readFileSync5, writeFileSync as writeFileSync2 } from "fs";
8381
+ import * as path9 from "path";
8280
8382
  var DEFAULT_CAPABILITIES4 = "default";
8281
- function premise2(message, hint) {
8383
+ function premise3(message, hint) {
8282
8384
  process.stderr.write(`\u{1F534} \u524D\u63D0\u4E0D\u6210\u7ACB\uFF1A${message}
8283
8385
  `);
8284
8386
  process.stderr.write(` ${hint}
@@ -8289,7 +8391,7 @@ var REQUESTS_SHAPE = "`--requests` \u6536\u7684\u662F\u4E00\u4E2A JSON \u6570\u7
8289
8391
  function readRequests(file) {
8290
8392
  let raw;
8291
8393
  try {
8292
- raw = JSON.parse(readFileSync4(file, "utf8"));
8394
+ raw = JSON.parse(readFileSync5(file, "utf8"));
8293
8395
  } catch (e) {
8294
8396
  throw new Error(`\u9700\u6C42\u6E05\u5355\u8BFB\u4E0D\u51FA\u6765\uFF08${file}\uFF09\uFF1A${e instanceof Error ? e.message : String(e)}`);
8295
8397
  }
@@ -8312,18 +8414,18 @@ function renderProblems(rows) {
8312
8414
  `;
8313
8415
  }
8314
8416
  function writeTriageArtifact(outDir, body) {
8315
- const out = path8.join(outDir, "work", "triage.md");
8316
- mkdirSync(path8.dirname(out), { recursive: true });
8417
+ const out = path9.join(outDir, "work", "triage.md");
8418
+ mkdirSync(path9.dirname(out), { recursive: true });
8317
8419
  writeFileSync2(out, body, "utf8");
8318
8420
  return out;
8319
8421
  }
8320
8422
  async function runTriage(args) {
8321
- if (!args.requests) return premise2("\u6CA1\u7ED9 `--requests`", REQUESTS_SHAPE);
8423
+ if (!args.requests) return premise3("\u6CA1\u7ED9 `--requests`", REQUESTS_SHAPE);
8322
8424
  let entriesIn;
8323
8425
  try {
8324
8426
  entriesIn = readRequests(args.requests);
8325
8427
  } catch (e) {
8326
- return premise2(e instanceof Error ? e.message : String(e), REQUESTS_SHAPE);
8428
+ return premise3(e instanceof Error ? e.message : String(e), REQUESTS_SHAPE);
8327
8429
  }
8328
8430
  const ctx = await getActiveAuthContextFromCli(args);
8329
8431
  const client3 = HcmClient21.fromAuthContext(ctx);
@@ -8354,7 +8456,7 @@ async function deliveryTriageCommand(args) {
8354
8456
  import { createHash as createHash5, randomBytes as secureRandomBytes } from "crypto";
8355
8457
  import { spawn } from "child_process";
8356
8458
  import { createReadStream, promises as fs6 } from "fs";
8357
- import path9 from "path";
8459
+ import path10 from "path";
8358
8460
  import { CliError as CliError20, CliErrorCode as CliErrorCode19, formatObject as formatObject22 } from "@hcmai/sdk";
8359
8461
  init_exit();
8360
8462
  var EXECUTION_CONTRACT_VERSION = "2026-08-29.controlled-v3";
@@ -8394,9 +8496,9 @@ async function prepareDeliveryExecution(input) {
8394
8496
  };
8395
8497
  const planId = sha2565(canonicalJson(core)).slice(0, 24);
8396
8498
  const plan = { ...core, planId };
8397
- const plansDir = path9.join(project, ".hcm-delivery", "execution-plans");
8499
+ const plansDir = path10.join(project, ".hcm-delivery", "execution-plans");
8398
8500
  await safeManagedDirectory(project, ".hcm-delivery/execution-plans", plansDir);
8399
- const planFile = path9.join(plansDir, `${planId}.json`);
8501
+ const planFile = path10.join(plansDir, `${planId}.json`);
8400
8502
  try {
8401
8503
  await fs6.writeFile(planFile, `${JSON.stringify(plan, null, 2)}
8402
8504
  `, {
@@ -8415,7 +8517,7 @@ async function executeDeliveryPlan(input) {
8415
8517
  if (await readProjectMode(project) !== "controlled") {
8416
8518
  throw invalid2("\u9879\u76EE\u4E0D\u662F controlled\uFF0C\u4E0D\u80FD\u6267\u884C R2 \u8BA1\u5212");
8417
8519
  }
8418
- const planFile = path9.join(project, ".hcm-delivery", "execution-plans", `${input.planId}.json`);
8520
+ const planFile = path10.join(project, ".hcm-delivery", "execution-plans", `${input.planId}.json`);
8419
8521
  const plan = await readPlan(project, planFile);
8420
8522
  if (plan.planId !== input.planId || computePlanId(plan) !== input.planId) {
8421
8523
  throw invalid2("\u6267\u884C\u8BA1\u5212\u5185\u5BB9\u4E0E planId \u6458\u8981\u4E0D\u4E00\u81F4");
@@ -8446,11 +8548,11 @@ async function executeDeliveryPlan(input) {
8446
8548
  await assertDocumentUnchanged(project, plan.documents.rollback, "\u56DE\u6EDA\u8BF4\u660E");
8447
8549
  await assertPayloadsUnchanged(project, plan.payloads);
8448
8550
  const evidenceDir = await bindEvidenceDirectory(project, plan.evidenceDir);
8449
- const receiptFile = path9.join(evidenceDir.absolute, `${plan.planId}.receipt.json`);
8551
+ const receiptFile = path10.join(evidenceDir.absolute, `${plan.planId}.receipt.json`);
8450
8552
  if (await pathExists(receiptFile)) throw invalid2(`\u6267\u884C\u6536\u636E\u5DF2\u5B58\u5728\uFF0C\u62D2\u7EDD\u518D\u6B21\u6267\u884C\uFF1A${plan.planId}`);
8451
- const claimsDir = path9.join(project, ".hcm-delivery", "execution-claims");
8553
+ const claimsDir = path10.join(project, ".hcm-delivery", "execution-claims");
8452
8554
  await safeManagedDirectory(project, ".hcm-delivery/execution-claims", claimsDir);
8453
- const claimFile = path9.join(claimsDir, `${plan.planId}.json`);
8555
+ const claimFile = path10.join(claimsDir, `${plan.planId}.json`);
8454
8556
  try {
8455
8557
  await fs6.writeFile(
8456
8558
  claimFile,
@@ -8537,7 +8639,7 @@ async function deliveryExecuteCommand(planId, argv, args) {
8537
8639
  }
8538
8640
  }
8539
8641
  async function readProjectMode(project) {
8540
- const file = path9.join(project, ".hcm-delivery", "project.yml");
8642
+ const file = path10.join(project, ".hcm-delivery", "project.yml");
8541
8643
  const content = await readSafeFile(project, file, "\u9879\u76EE\u914D\u7F6E");
8542
8644
  const match = content.toString("utf8").match(
8543
8645
  /^deliveryMode:\s*(?:"(plan-only|controlled)"|'(plan-only|controlled)'|(plan-only|controlled))\s*$/m
@@ -8549,13 +8651,13 @@ async function readProjectMode(project) {
8549
8651
  return mode;
8550
8652
  }
8551
8653
  var SKILLS_LOCK_CANDIDATES = [
8552
- path9.join("hcm-skills", ".hcm-skills.json"),
8553
- path9.join(".claude", "skills", ".hcm-skills.json")
8654
+ path10.join("hcm-skills", ".hcm-skills.json"),
8655
+ path10.join(".claude", "skills", ".hcm-skills.json")
8554
8656
  ];
8555
8657
  async function readSkillsLock(project) {
8556
8658
  const found = [];
8557
8659
  for (const candidate of SKILLS_LOCK_CANDIDATES) {
8558
- if (await pathExists(path9.join(project, candidate))) found.push(candidate);
8660
+ if (await pathExists(path10.join(project, candidate))) found.push(candidate);
8559
8661
  }
8560
8662
  if (found.length === 0) {
8561
8663
  throw invalid2(
@@ -8567,7 +8669,7 @@ async function readSkillsLock(project) {
8567
8669
  `\u9879\u76EE\u91CC\u6709\u591A\u4EFD\u6280\u80FD\u9501\uFF08${found.join("\u3001")}\uFF09\uFF0C\u65E0\u6CD5\u552F\u4E00\u5224\u5B9A\u53D7\u63A7\u6267\u884C\u7ED1\u5B9A\u54EA\u4E00\u4EFD\u3002next_step=\u53EA\u4FDD\u7559\u5B9E\u9645\u5728\u7528\u7684\u90A3\u4E2A\u6280\u80FD\u76EE\u5F55`
8568
8670
  );
8569
8671
  }
8570
- const bytes = await readSafeFile(project, path9.join(project, found[0]), "\u6280\u80FD\u9501");
8672
+ const bytes = await readSafeFile(project, path10.join(project, found[0]), "\u6280\u80FD\u9501");
8571
8673
  try {
8572
8674
  JSON.parse(bytes.toString("utf8"));
8573
8675
  } catch (cause) {
@@ -8580,7 +8682,7 @@ async function bindDocument(project, reference, label) {
8580
8682
  if (!(relative2.startsWith("work/") || relative2.startsWith("decisions/"))) {
8581
8683
  throw invalid2(`${label}\u5FC5\u987B\u4F4D\u4E8E\u9879\u76EE work/ \u6216 decisions/ \u4E0B`);
8582
8684
  }
8583
- const file = path9.join(project, relative2);
8685
+ const file = path10.join(project, relative2);
8584
8686
  const bytes = await readSafeFile(project, file, label);
8585
8687
  return { path: relative2, sha256: sha2565(bytes) };
8586
8688
  }
@@ -8593,7 +8695,7 @@ async function bindEvidenceDirectory(project, reference) {
8593
8695
  if (!(relative2 === "evidence" || relative2.startsWith("evidence/"))) {
8594
8696
  throw invalid2("evidence \u76EE\u5F55\u5FC5\u987B\u4F4D\u4E8E\u9879\u76EE evidence/ \u4E0B");
8595
8697
  }
8596
- const absolute = path9.join(project, relative2);
8698
+ const absolute = path10.join(project, relative2);
8597
8699
  await assertNoSymlinkComponents(project, relative2);
8598
8700
  const stat = await fs6.stat(absolute).catch(() => null);
8599
8701
  if (stat === null) {
@@ -8725,7 +8827,7 @@ async function bindPayloadFiles(project, argv) {
8725
8827
  }
8726
8828
  async function bindPayloadFile(project, reference, label) {
8727
8829
  const relative2 = safeRelative(reference, label);
8728
- const file = path9.join(project, relative2);
8830
+ const file = path10.join(project, relative2);
8729
8831
  const bytes = await readSafeFile(project, file, label);
8730
8832
  return { path: relative2, sha256: sha2565(bytes) };
8731
8833
  }
@@ -8794,13 +8896,13 @@ async function writeReceiptExclusive(target, receipt) {
8794
8896
  });
8795
8897
  await fs6.link(temp, target);
8796
8898
  } catch (cause) {
8797
- throw invalid2(`\u6267\u884C\u6536\u636E\u5199\u5165\u5931\u8D25\u6216\u5DF2\u5B58\u5728\uFF1A${path9.basename(target)}`, cause);
8899
+ throw invalid2(`\u6267\u884C\u6536\u636E\u5199\u5165\u5931\u8D25\u6216\u5DF2\u5B58\u5728\uFF1A${path10.basename(target)}`, cause);
8798
8900
  } finally {
8799
8901
  await fs6.unlink(temp).catch(() => void 0);
8800
8902
  }
8801
8903
  }
8802
8904
  async function safeManagedDirectory(project, relative2, absolute) {
8803
- await assertNoSymlinkComponents(project, path9.dirname(relative2));
8905
+ await assertNoSymlinkComponents(project, path10.dirname(relative2));
8804
8906
  const existing = await fs6.lstat(absolute).catch(() => void 0);
8805
8907
  if (existing?.isSymbolicLink()) throw invalid2(`\u53D7\u7BA1\u76EE\u5F55\u4E0D\u80FD\u662F\u7B26\u53F7\u94FE\u63A5\uFF1A${relative2}`);
8806
8908
  if (existing && !existing.isDirectory()) throw invalid2(`\u53D7\u7BA1\u8DEF\u5F84\u4E0D\u662F\u76EE\u5F55\uFF1A${relative2}`);
@@ -8817,8 +8919,8 @@ async function pathExists(file) {
8817
8919
  );
8818
8920
  }
8819
8921
  async function readSafeFile(project, file, label) {
8820
- const relative2 = path9.relative(project, file).split(path9.sep).join("/");
8821
- if (relative2.startsWith("../") || path9.isAbsolute(relative2))
8922
+ const relative2 = path10.relative(project, file).split(path10.sep).join("/");
8923
+ if (relative2.startsWith("../") || path10.isAbsolute(relative2))
8822
8924
  throw invalid2(`${label}\u8DEF\u5F84\u9003\u9038\u9879\u76EE`);
8823
8925
  await assertNoSymlinkComponents(project, relative2);
8824
8926
  let stat;
@@ -8835,14 +8937,14 @@ async function assertNoSymlinkComponents(project, relative2) {
8835
8937
  const parts = relative2.split("/").filter(Boolean);
8836
8938
  let current = project;
8837
8939
  for (const part of parts) {
8838
- current = path9.join(current, part);
8940
+ current = path10.join(current, part);
8839
8941
  const stat = await fs6.lstat(current).catch(() => void 0);
8840
8942
  if (stat?.isSymbolicLink()) throw invalid2(`\u8DEF\u5F84\u5305\u542B\u7B26\u53F7\u94FE\u63A5\uFF1A${relative2}`);
8841
8943
  if (!stat) break;
8842
8944
  }
8843
8945
  }
8844
8946
  async function realProject(requested) {
8845
- const absolute = path9.resolve(requested);
8947
+ const absolute = path10.resolve(requested);
8846
8948
  let project;
8847
8949
  try {
8848
8950
  project = await fs6.realpath(absolute);
@@ -8854,10 +8956,10 @@ async function realProject(requested) {
8854
8956
  return project;
8855
8957
  }
8856
8958
  function safeRelative(reference, label) {
8857
- if (!reference || path9.isAbsolute(reference) || /[\r\n\0]/.test(reference)) {
8959
+ if (!reference || path10.isAbsolute(reference) || /[\r\n\0]/.test(reference)) {
8858
8960
  throw invalid2(`${label}\u5FC5\u987B\u662F\u9879\u76EE\u5185\u76F8\u5BF9\u8DEF\u5F84`);
8859
8961
  }
8860
- const normalized = path9.normalize(reference).split(path9.sep).join("/");
8962
+ const normalized = path10.normalize(reference).split(path10.sep).join("/");
8861
8963
  if (normalized === ".." || normalized.startsWith("../") || normalized === ".") {
8862
8964
  throw invalid2(`${label}\u8DEF\u5F84\u9003\u9038\u9879\u76EE`);
8863
8965
  }
@@ -9074,6 +9176,16 @@ recon.command("round").description("\u96F6\u7F51\u7EDC\uFF1A\u8BFB\u4E00\u4EFD\u
9074
9176
  var seed = delivery.command("seed").description(
9075
9177
  "\u628A\u987E\u95EE\u624B\u4E0A\u7684**\u5BA2\u6237\u8868**\u53D8\u6210\u4EA7\u54C1\u91CC\u7684\u884C\u3002\u26A0\uFE0F \u4E0E\u9876\u5C42 `hcm import <path>` \u4E0D\u662F\u4E00\u56DE\u4E8B\uFF1A\u90A3\u4E00\u6761\u5403 DataPackage YAML\uFF08fixture \u6CE8\u5165\u5668\uFF09\uFF0C\u8FD9\u4E00\u65CF\u5403\u5BA2\u6237\u7684 Excel"
9076
9178
  );
9179
+ seed.command("find").argument("<term>", "\u8981\u627E\u7684\u8BCD\uFF1A\u5B57\u6BB5\u540D / \u4E2D\u6587\u540D\u79F0 / \u4E1A\u52A1\u8BDD\u672F\uFF08\u540C\u4E49\u8BCD\u3001\u63CF\u8FF0\u3001\u679A\u4E3E\u6807\u7B7E\u90FD\u641C\uFF09").description(
9180
+ "\u{1F534} **\u96F6\u7F51\u7EDC**\uFF1A\u5728 recon \u843D\u76D8\u7684\u5B57\u6BB5\u76EE\u5F55\u91CC\u8DE8\u6A21\u578B\u627E\u5B57\u6BB5\uFF0C\u4E00\u53D1\u8BF7\u6C42\u90FD\u4E0D\u53D1\uFF08\u6C14\u9699\u673A\u5668\u53EF\u7528\uFF09\u3002\u5199 mapping.json \u4E4B\u524D\u7528\u5B83\u628A\u4E00\u4E2A\u4E2D\u6587\u8BF4\u6CD5\u843D\u5230 `\u6A21\u578B.\u5B57\u6BB5`"
9181
+ ).option("--out <dir>", "recon \u4EA7\u7269\u6839\uFF08\u57FA\u7EBF\u5728 <out>/recon/<\u79DF\u6237\u6BB5>/<\u6765\u6E90\u6BB5>\uFF09", ".").option("--tenant <id>", "\u79DF\u6237\uFF08\u96F6\u7F51\u7EDC \u21D2 \u65E0\u6CD5\u4ECE\u767B\u5F55\u6001\u5F97\u77E5\uFF0C\u5FC5\u987B\u7ED9\uFF1B\u8981\u4E0E\u8DD1 recon \u65F6\u90A3\u4E2A\u4E00\u81F4\uFF09").action((term, opts) => deliverySeedFindCommand(term, opts));
9182
+ seed.command("values").argument("<model>", "\u7801\u8868\u6A21\u578B\u540D\uFF08\u5982 CO_0001\uFF09\uFF1B`find` \u7684\u6307\u8DEF\u884C\u4F1A\u544A\u8BC9\u4F60\u662F\u54EA\u4E00\u5F20").description(
9183
+ "\u{1F534} **\u96F6\u7F51\u7EDC**\uFF1A\u6253\u5370\u4E00\u5F20\u7801\u8868\u7684 `id / code / name` \u5BF9\u7167\uFF0C\u62AC\u5934\u5148\u8BF4 completeness\u3002\u987E\u95EE\u6284 id \u5C31\u6284\u8FD9\u4E00\u4EFD\uFF08\u5F15\u7528\u5B57\u6BB5\u5B58\u7684\u662F id \u4E0D\u662F code\uFF09"
9184
+ ).option("--out <dir>", "recon \u4EA7\u7269\u6839\uFF08\u57FA\u7EBF\u5728 <out>/recon/<\u79DF\u6237\u6BB5>/<\u6765\u6E90\u6BB5>\uFF09", ".").option("--tenant <id>", "\u79DF\u6237\uFF08\u96F6\u7F51\u7EDC \u21D2 \u65E0\u6CD5\u4ECE\u767B\u5F55\u6001\u5F97\u77E5\uFF0C\u5FC5\u987B\u7ED9\uFF1B\u8981\u4E0E\u8DD1 recon \u65F6\u90A3\u4E2A\u4E00\u81F4\uFF09").option(
9185
+ "--limit <n>",
9186
+ "\u6253\u51E0\u884C\u3002\u4E0D\u7ED9 \u21D2 \u8D70\u5B57\u8282\u9884\u7B97\uFF1B`0` \u21D2 \u5168\u90E8\u6253\u5370\uFF08\u9003\u751F\u95E8\uFF1A\u4F60\u8981\u7684\u90A3\u884C\u6070\u597D\u5728\u88AB\u622A\u6389\u7684\u90A3\u534A\u91CC\u65F6\u7528\u5B83\uFF09",
9187
+ (v) => Number(v)
9188
+ ).action((model, opts) => deliverySeedValuesCommand(model, opts));
9077
9189
  seed.command("plan").description("\u96F6\u5199\uFF1A\u8BFB\u5DE5\u4EF6 + \u6E90\u8868 + \u5200 2 \u7684\u57FA\u7EBF\uFF0C\u7B97\u51FA\u884C\u7EA7\u8BA1\u5212\u4E0E\u98CE\u9669\u6E05\u5355\u843D\u76D8\uFF08\u4E00\u53D1\u5199\u8BF7\u6C42\u90FD\u4E0D\u53D1\uFF09").option("--env <name>", "\u76EE\u6807\u73AF\u5883\u522B\u540D").option("--profile <name>", "\u8EAB\u4EFD\u6863\u6848").option("--as <identity>", "\u4E34\u65F6\u6362\u8EAB\u4EFD").option("--out <dir>", "recon \u4EA7\u7269\u6839\uFF08\u57FA\u7EBF\u5728 <out>/recon/<\u79DF\u6237\u6BB5>/<\u6765\u6E90\u6BB5>\uFF09", ".").option("--work <dir>", "work \u76EE\u5F55\uFF1B\u4E0D\u7ED9 \u21D2 <out>/work/<\u79DF\u6237\u6BB5>/").option("--mapping <file>", "\u5BFC\u5165\u6620\u5C04\u5DE5\u4EF6\uFF1B\u4E0D\u7ED9 \u21D2 <work>/mapping.json").option("--source-dir <dir>", "\u6E90\u8868\u6240\u5728\u76EE\u5F55\uFF08\u5DE5\u4EF6\u91CC\u5199\u7684\u662F\u76F8\u5BF9\u8DEF\u5F84\u65F6\u7528\u5B83\uFF09").option("--exemptions <file>", "\u7B7E\u5B57\u8C41\u514D\u53F0\u8D26\uFF08JSON \u6570\u7EC4\uFF09\uFF1B\u4E0D\u4F20\u4E0E\u4F20\u4E00\u4EFD\u7A7A\u53F0\u8D26\u662F\u4E24\u4E2A\u503C").action((opts) => deliverySeedPlanCommand(opts));
9078
9190
  seed.command("apply").description(
9079
9191
  "\u7167\u8BA1\u5212\u628A\u884C\u5EFA\u8FDB\u53BB\u3002**\u9ED8\u8BA4\u5E72\u8DD1**\uFF08\u4E00\u53D1\u5199\u8BF7\u6C42\u90FD\u4E0D\u53D1\uFF09\uFF0C\u8981\u771F\u5199\u5FC5\u987B\u663E\u5F0F `--execute`"