@hcmai/cli 0.4.27 → 0.4.29
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 +710 -172
- package/dist/index.js.map +1 -1
- package/dist/skills/manifest.json +20 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -532,8 +532,8 @@ var init_TerminalRenderer = __esm({
|
|
|
532
532
|
}
|
|
533
533
|
}
|
|
534
534
|
/** 来源行(仅子代理触发,agentPath ≥2 段时显示 `↑ 来自 a › b`,对齐 Web)。 */
|
|
535
|
-
originLine(
|
|
536
|
-
const segs =
|
|
535
|
+
originLine(path18) {
|
|
536
|
+
const segs = path18.split(".").filter(Boolean);
|
|
537
537
|
if (segs.length < 2) return "";
|
|
538
538
|
const names = segs.map((k) => agentDisplayName(k));
|
|
539
539
|
return chalk.gray(` \u2191 \u6765\u81EA ${names.join(" \u203A ")}`) + "\n";
|
|
@@ -1715,8 +1715,8 @@ function agentLabel(agentId) {
|
|
|
1715
1715
|
if (/^[0-9a-f]{8}-[0-9a-f-]{27}$/i.test(agentId)) return `agent \u2026${agentId.slice(-4)}`;
|
|
1716
1716
|
return agentDisplayName(agentId);
|
|
1717
1717
|
}
|
|
1718
|
-
function originLine(
|
|
1719
|
-
const segs = (
|
|
1718
|
+
function originLine(path18) {
|
|
1719
|
+
const segs = (path18 ?? "").split(".").filter(Boolean);
|
|
1720
1720
|
if (segs.length < 2) return null;
|
|
1721
1721
|
return `\u6765\u81EA ${segs.map((k) => agentDisplayName(k)).join(" \u203A ")}`;
|
|
1722
1722
|
}
|
|
@@ -3362,7 +3362,7 @@ function launchBrowser(url, platform = process.platform) {
|
|
|
3362
3362
|
child.unref();
|
|
3363
3363
|
}
|
|
3364
3364
|
async function runOpen(target, args, deps) {
|
|
3365
|
-
const
|
|
3365
|
+
const path18 = normalizeTarget(target);
|
|
3366
3366
|
if (!deps.frontend?.trim()) {
|
|
3367
3367
|
throw new CliError12({
|
|
3368
3368
|
code: CliErrorCode11.INVALID_ARGUMENT,
|
|
@@ -3370,13 +3370,13 @@ async function runOpen(target, args, deps) {
|
|
|
3370
3370
|
});
|
|
3371
3371
|
}
|
|
3372
3372
|
const { ticket, expiresIn } = await deps.mintTicket();
|
|
3373
|
-
const url = buildBrowserLoginUrl(deps.frontend, ticket,
|
|
3373
|
+
const url = buildBrowserLoginUrl(deps.frontend, ticket, path18);
|
|
3374
3374
|
if (args.printUrl) {
|
|
3375
3375
|
deps.write(`${url}
|
|
3376
3376
|
`);
|
|
3377
3377
|
} else {
|
|
3378
3378
|
deps.launch(url);
|
|
3379
|
-
deps.write(`\u5DF2\u7528\u5F53\u524D\u8EAB\u4EFD\u6253\u5F00 ${
|
|
3379
|
+
deps.write(`\u5DF2\u7528\u5F53\u524D\u8EAB\u4EFD\u6253\u5F00 ${path18}\uFF08\u7968\u636E ${expiresIn ?? 60}s \u5185\u6709\u6548\uFF0C\u53EA\u80FD\u7528\u4E00\u6B21\uFF09
|
|
3380
3380
|
`);
|
|
3381
3381
|
}
|
|
3382
3382
|
return { url, expiresIn };
|
|
@@ -3470,8 +3470,8 @@ import {
|
|
|
3470
3470
|
formatObject as formatObject7,
|
|
3471
3471
|
fromAxiosError as fromAxiosError9
|
|
3472
3472
|
} from "@hcmai/sdk";
|
|
3473
|
-
function collectYmlFiles(
|
|
3474
|
-
if (statSync(
|
|
3473
|
+
function collectYmlFiles(path18) {
|
|
3474
|
+
if (statSync(path18).isFile()) return [path18];
|
|
3475
3475
|
const out = [];
|
|
3476
3476
|
const walk = (dir) => {
|
|
3477
3477
|
for (const name of readdirSync(dir).sort()) {
|
|
@@ -3480,7 +3480,7 @@ function collectYmlFiles(path17) {
|
|
|
3480
3480
|
else if (full.endsWith(".yml") || full.endsWith(".yaml")) out.push(full);
|
|
3481
3481
|
}
|
|
3482
3482
|
};
|
|
3483
|
-
walk(
|
|
3483
|
+
walk(path18);
|
|
3484
3484
|
return out.sort();
|
|
3485
3485
|
}
|
|
3486
3486
|
var DRY_RUN_CLIENT = {
|
|
@@ -3488,9 +3488,9 @@ var DRY_RUN_CLIENT = {
|
|
|
3488
3488
|
create: async () => ({ id: "" }),
|
|
3489
3489
|
update: async () => ({})
|
|
3490
3490
|
};
|
|
3491
|
-
async function importCommand(
|
|
3491
|
+
async function importCommand(path18, args) {
|
|
3492
3492
|
try {
|
|
3493
|
-
const files = collectYmlFiles(
|
|
3493
|
+
const files = collectYmlFiles(path18);
|
|
3494
3494
|
const fixtures = files.map(
|
|
3495
3495
|
(f) => parseFixture(readFileSync2(f, "utf8"), relative(process.cwd(), f))
|
|
3496
3496
|
);
|
|
@@ -4751,8 +4751,8 @@ async function scriptManifestValidateCommand(args) {
|
|
|
4751
4751
|
if (!args.file) {
|
|
4752
4752
|
throw new Error("\u7F3A\u5C11 --file\n \u4E0B\u4E00\u6B65\uFF1Ahcm script manifest-validate --file ./manifest.yml");
|
|
4753
4753
|
}
|
|
4754
|
-
const
|
|
4755
|
-
const result = await withClient2(args, (c) => validateScriptManifest(c.raw(),
|
|
4754
|
+
const yaml3 = readFileSync3(args.file, "utf8");
|
|
4755
|
+
const result = await withClient2(args, (c) => validateScriptManifest(c.raw(), yaml3));
|
|
4756
4756
|
emit2(result, args, `\u{1F4CB} manifest \u6821\u9A8C\u5B8C\u6210\uFF1A${args.file}`);
|
|
4757
4757
|
} catch (e) {
|
|
4758
4758
|
fail3(e, args);
|
|
@@ -6606,10 +6606,10 @@ async function metaListCommand(args) {
|
|
|
6606
6606
|
fail5(e, args);
|
|
6607
6607
|
}
|
|
6608
6608
|
}
|
|
6609
|
-
async function metaGetCommand(
|
|
6609
|
+
async function metaGetCommand(path18, args) {
|
|
6610
6610
|
try {
|
|
6611
6611
|
const c = await client2(args);
|
|
6612
|
-
const content = await getTenantMeta(c.raw(),
|
|
6612
|
+
const content = await getTenantMeta(c.raw(), path18);
|
|
6613
6613
|
process.stdout.write(content.endsWith("\n") ? content : content + "\n");
|
|
6614
6614
|
process.exitCode = 0;
|
|
6615
6615
|
return;
|
|
@@ -6618,8 +6618,8 @@ async function metaGetCommand(path17, args) {
|
|
|
6618
6618
|
}
|
|
6619
6619
|
}
|
|
6620
6620
|
var PROBEABLE_META_TYPES = /* @__PURE__ */ new Set(["model", "list", "info", "view", "filter", "page", "wiz", "impexp"]);
|
|
6621
|
-
function parseMetaPath(
|
|
6622
|
-
const base =
|
|
6621
|
+
function parseMetaPath(path18) {
|
|
6622
|
+
const base = path18.split(/[\\/]/).pop() ?? path18;
|
|
6623
6623
|
if (!/\.(yml|yaml)$/i.test(base)) return {};
|
|
6624
6624
|
const parts = base.replace(/\.(yml|yaml)$/i, "").split(".");
|
|
6625
6625
|
return { model: parts[0] || void 0, kind: parts[1] ?? "model", state: parts[2] };
|
|
@@ -6636,10 +6636,10 @@ function unverifiableReason(e) {
|
|
|
6636
6636
|
if (st == null) return `\u8BF7\u6C42\u6CA1\u53D1\u51FA\u53BB\u6216\u6CA1\u56DE\u6765\uFF08${err.code ?? err.message ?? "\u672A\u77E5"}\uFF09`;
|
|
6637
6637
|
return void 0;
|
|
6638
6638
|
}
|
|
6639
|
-
async function verifyAfterWrite(c,
|
|
6640
|
-
const { model, kind, state } = parseMetaPath(
|
|
6639
|
+
async function verifyAfterWrite(c, path18) {
|
|
6640
|
+
const { model, kind, state } = parseMetaPath(path18);
|
|
6641
6641
|
if (!model || !kind) {
|
|
6642
|
-
return { status: "unverified", where: "(\u672A\u63A2)", why: `\u4ECE\u8DEF\u5F84 ${
|
|
6642
|
+
return { status: "unverified", where: "(\u672A\u63A2)", why: `\u4ECE\u8DEF\u5F84 ${path18} \u8BA4\u4E0D\u51FA\u6A21\u578B\u540D/\u5C42\u540D` };
|
|
6643
6643
|
}
|
|
6644
6644
|
try {
|
|
6645
6645
|
await clearMetaCache2(c.raw(), model, {});
|
|
@@ -6684,7 +6684,7 @@ async function verifyAfterWrite(c, path17) {
|
|
|
6684
6684
|
}
|
|
6685
6685
|
return { status: "ok" };
|
|
6686
6686
|
}
|
|
6687
|
-
async function metaSetCommand(
|
|
6687
|
+
async function metaSetCommand(path18, args) {
|
|
6688
6688
|
try {
|
|
6689
6689
|
if (!args.file) {
|
|
6690
6690
|
throw new CliError19({
|
|
@@ -6700,9 +6700,9 @@ async function metaSetCommand(path17, args) {
|
|
|
6700
6700
|
process.stdin.on("error", reject);
|
|
6701
6701
|
}) : await fsp3.readFile(args.file, "utf8");
|
|
6702
6702
|
if (!args.skipValidate) {
|
|
6703
|
-
const result2 = validateMetaContent(
|
|
6703
|
+
const result2 = validateMetaContent(path18, content);
|
|
6704
6704
|
if (result2.issues.length > 0) {
|
|
6705
|
-
process.stderr.write(`\u{1F50E} \u5199\u524D\u6821\u9A8C ${
|
|
6705
|
+
process.stderr.write(`\u{1F50E} \u5199\u524D\u6821\u9A8C ${path18}\uFF08schema \u7C7B\u578B\uFF1A${result2.kind ?? "\u672A\u8BC6\u522B"}\uFF09
|
|
6706
6706
|
`);
|
|
6707
6707
|
process.stderr.write(formatMetaIssues(result2, " ") + "\n");
|
|
6708
6708
|
}
|
|
@@ -6721,13 +6721,13 @@ async function metaSetCommand(path17, args) {
|
|
|
6721
6721
|
if (dryFmt === "json" || dryFmt === "yaml") {
|
|
6722
6722
|
process.stdout.write(
|
|
6723
6723
|
formatObject18(
|
|
6724
|
-
{ dryRun: true, path:
|
|
6724
|
+
{ dryRun: true, path: path18, bytes: Buffer.byteLength(content), content },
|
|
6725
6725
|
{ format: dryFmt }
|
|
6726
6726
|
) + "\n"
|
|
6727
6727
|
);
|
|
6728
6728
|
} else {
|
|
6729
6729
|
process.stdout.write(
|
|
6730
|
-
`[dry-run] \u5C06\u5199\u5165 ${
|
|
6730
|
+
`[dry-run] \u5C06\u5199\u5165 ${path18}\uFF08${Buffer.byteLength(content)} B\uFF09\u2014\u2014\u672A\u5B9E\u9645\u5199\u5165
|
|
6731
6731
|
---
|
|
6732
6732
|
${content}
|
|
6733
6733
|
`
|
|
@@ -6741,13 +6741,13 @@ ${content}
|
|
|
6741
6741
|
let backupState = "unknown";
|
|
6742
6742
|
let backupWhy;
|
|
6743
6743
|
try {
|
|
6744
|
-
const prev = await getTenantMeta(c.raw(),
|
|
6744
|
+
const prev = await getTenantMeta(c.raw(), path18);
|
|
6745
6745
|
if (!prev || prev.trim() === "") {
|
|
6746
6746
|
backupState = "absent";
|
|
6747
6747
|
} else {
|
|
6748
6748
|
backupFile = nodePath.join(
|
|
6749
6749
|
os3.tmpdir(),
|
|
6750
|
-
`hcm-meta-backup-${Date.now()}-${
|
|
6750
|
+
`hcm-meta-backup-${Date.now()}-${path18.replace(/[\\/]/g, "_")}`
|
|
6751
6751
|
);
|
|
6752
6752
|
await fsp3.writeFile(backupFile, prev, "utf8");
|
|
6753
6753
|
backupState = "saved";
|
|
@@ -6762,22 +6762,22 @@ ${content}
|
|
|
6762
6762
|
backupWhy = `HTTP ${st ?? "-"}${err.code ? ` ${err.code}` : ""}${err.message ? `\uFF1A${err.message}` : ""}`;
|
|
6763
6763
|
}
|
|
6764
6764
|
}
|
|
6765
|
-
const result = await saveTenantMeta(c.raw(),
|
|
6765
|
+
const result = await saveTenantMeta(c.raw(), path18, content);
|
|
6766
6766
|
const fmt = args.output ?? "json";
|
|
6767
|
-
if (fmt !== "json") process.stdout.write(`\u2705 \u5DF2\u5199\u5165 ${
|
|
6767
|
+
if (fmt !== "json") process.stdout.write(`\u2705 \u5DF2\u5199\u5165 ${path18}
|
|
6768
6768
|
`);
|
|
6769
6769
|
const restoreHint = backupState === "saved" && backupFile ? ` \u65E7\u5185\u5BB9\u5DF2\u5B58\uFF1A${backupFile}
|
|
6770
|
-
\u653E\u56DE\u53BB\uFF1Ahcm meta set ${
|
|
6771
|
-
` : 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 ${
|
|
6770
|
+
\u653E\u56DE\u53BB\uFF1Ahcm meta set ${path18} --file ${backupFile}${connFlags(args)}
|
|
6771
|
+
` : 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 ${path18}${connFlags(args)}
|
|
6772
6772
|
` : ` \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
|
|
6773
|
-
\u5148\u81EA\u5DF1\u8BFB\u4E00\u904D\u786E\u8BA4\uFF1Ahcm meta get ${
|
|
6773
|
+
\u5148\u81EA\u5DF1\u8BFB\u4E00\u904D\u786E\u8BA4\uFF1Ahcm meta get ${path18}${connFlags(args)}
|
|
6774
6774
|
`;
|
|
6775
6775
|
if (args.verify === false) {
|
|
6776
6776
|
process.stderr.write(
|
|
6777
6777
|
"\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
|
|
6778
6778
|
);
|
|
6779
6779
|
} else {
|
|
6780
|
-
const outcome = await verifyAfterWrite(c,
|
|
6780
|
+
const outcome = await verifyAfterWrite(c, path18);
|
|
6781
6781
|
if (outcome.status === "broken") {
|
|
6782
6782
|
const human = explainJacksonError(outcome.raw);
|
|
6783
6783
|
process.stderr.write(
|
|
@@ -6810,19 +6810,19 @@ ${content}
|
|
|
6810
6810
|
fail5(e, args);
|
|
6811
6811
|
}
|
|
6812
6812
|
}
|
|
6813
|
-
async function metaDeleteCommand(
|
|
6813
|
+
async function metaDeleteCommand(path18, args) {
|
|
6814
6814
|
try {
|
|
6815
6815
|
if (!args.yes) {
|
|
6816
|
-
const ok = await promptConfirm(`\u5C06\u5220\u9664\u5143\u6570\u636E ${
|
|
6816
|
+
const ok = await promptConfirm(`\u5C06\u5220\u9664\u5143\u6570\u636E ${path18}\uFF0C\u6B64\u64CD\u4F5C\u4E0D\u53EF\u9006\u3002\u7EE7\u7EED\uFF1F`);
|
|
6817
6817
|
if (!ok) {
|
|
6818
6818
|
process.stderr.write("\u5DF2\u53D6\u6D88\n");
|
|
6819
6819
|
process.exit(1);
|
|
6820
6820
|
}
|
|
6821
6821
|
}
|
|
6822
6822
|
const c = await client2(args);
|
|
6823
|
-
const result = await deleteTenantMeta(c.raw(),
|
|
6823
|
+
const result = await deleteTenantMeta(c.raw(), path18);
|
|
6824
6824
|
const fmt = args.output ?? "json";
|
|
6825
|
-
if (fmt !== "json") process.stdout.write(`\u{1F5D1}\uFE0F \u5DF2\u5220\u9664 ${
|
|
6825
|
+
if (fmt !== "json") process.stdout.write(`\u{1F5D1}\uFE0F \u5DF2\u5220\u9664 ${path18}
|
|
6826
6826
|
`);
|
|
6827
6827
|
process.stdout.write(formatObject18(result, { format: fmt }) + "\n");
|
|
6828
6828
|
process.exitCode = 0;
|
|
@@ -6831,7 +6831,7 @@ async function metaDeleteCommand(path17, args) {
|
|
|
6831
6831
|
fail5(e, args);
|
|
6832
6832
|
}
|
|
6833
6833
|
}
|
|
6834
|
-
async function metaValidateCommand(
|
|
6834
|
+
async function metaValidateCommand(path18, args) {
|
|
6835
6835
|
try {
|
|
6836
6836
|
if (!args.file) {
|
|
6837
6837
|
throw new CliError19({
|
|
@@ -6846,13 +6846,13 @@ async function metaValidateCommand(path17, args) {
|
|
|
6846
6846
|
process.stdin.on("end", () => resolve4(buf));
|
|
6847
6847
|
process.stdin.on("error", reject);
|
|
6848
6848
|
}) : await fsp3.readFile(args.file, "utf8");
|
|
6849
|
-
const result = validateMetaContent(
|
|
6849
|
+
const result = validateMetaContent(path18, content);
|
|
6850
6850
|
const fmt = args.output ?? "table";
|
|
6851
6851
|
if (fmt === "json" || fmt === "yaml") {
|
|
6852
6852
|
process.stdout.write(
|
|
6853
6853
|
formatObject18(
|
|
6854
6854
|
{
|
|
6855
|
-
path:
|
|
6855
|
+
path: path18,
|
|
6856
6856
|
kind: result.kind,
|
|
6857
6857
|
schemaKnown: result.schemaKnown,
|
|
6858
6858
|
schemaSourceCommit: META_SCHEMA_SOURCE_COMMIT,
|
|
@@ -6864,7 +6864,7 @@ async function metaValidateCommand(path17, args) {
|
|
|
6864
6864
|
);
|
|
6865
6865
|
} else {
|
|
6866
6866
|
process.stdout.write(
|
|
6867
|
-
`\u{1F50E} ${
|
|
6867
|
+
`\u{1F50E} ${path18}\uFF08schema \u7C7B\u578B\uFF1A${result.kind ?? "\u672A\u8BC6\u522B"}\uFF0C\u6765\u6E90 ${META_SCHEMA_SOURCE_COMMIT.slice(0, 8)}\uFF09
|
|
6868
6868
|
`
|
|
6869
6869
|
);
|
|
6870
6870
|
process.stdout.write(
|
|
@@ -6964,7 +6964,10 @@ async function workspaceListCommand(args) {
|
|
|
6964
6964
|
"devModeEnabled",
|
|
6965
6965
|
"updateTime"
|
|
6966
6966
|
],
|
|
6967
|
-
sort: [
|
|
6967
|
+
sort: [
|
|
6968
|
+
{ field: "devModeEnabled", desc: true },
|
|
6969
|
+
{ field: "updateTime", desc: true }
|
|
6970
|
+
],
|
|
6968
6971
|
limit
|
|
6969
6972
|
});
|
|
6970
6973
|
writeWorkspaceListResult(result.rows, args.output ?? "table", result.total);
|
|
@@ -7192,6 +7195,92 @@ async function workspaceAddMiniCommand(appCode, args) {
|
|
|
7192
7195
|
exitWorkspaceError(e, args.env ?? args.profile);
|
|
7193
7196
|
}
|
|
7194
7197
|
}
|
|
7198
|
+
async function workspaceRmCommand(relativePath, args) {
|
|
7199
|
+
try {
|
|
7200
|
+
const rootDir = resolveRootDir(args.dir);
|
|
7201
|
+
const context = await requireWorkspaceContext(rootDir);
|
|
7202
|
+
const normalized = normalizeWorkspaceRmPath(relativePath);
|
|
7203
|
+
const absolutePath = path5.join(rootDir, ...normalized.split("/"));
|
|
7204
|
+
let stat;
|
|
7205
|
+
try {
|
|
7206
|
+
stat = await fs5.lstat(absolutePath);
|
|
7207
|
+
} catch (e) {
|
|
7208
|
+
if (e.code !== "ENOENT") throw e;
|
|
7209
|
+
stat = null;
|
|
7210
|
+
}
|
|
7211
|
+
if (stat?.isDirectory()) {
|
|
7212
|
+
throw new Error(`workspace rm only accepts a file path: ${normalized}`);
|
|
7213
|
+
}
|
|
7214
|
+
if (stat && !stat.isFile()) {
|
|
7215
|
+
throw new Error(`workspace rm refuses non-regular files: ${normalized}`);
|
|
7216
|
+
}
|
|
7217
|
+
const manifest2 = await readWorkspaceRawManifest(rootDir, context);
|
|
7218
|
+
let manifestEntry = manifest2.files.find((file) => file.localPath === normalized);
|
|
7219
|
+
if (!manifestEntry && stat) {
|
|
7220
|
+
const client3 = await loadProfileClient({
|
|
7221
|
+
...args,
|
|
7222
|
+
env: args.env ?? args.profile ?? context.profile
|
|
7223
|
+
});
|
|
7224
|
+
if (client3) {
|
|
7225
|
+
const remote = (await listWorkspaceFiles(client3.raw(), context.workspaceKey)).data.find(
|
|
7226
|
+
(file) => file.relativePath === normalized
|
|
7227
|
+
);
|
|
7228
|
+
if (remote) {
|
|
7229
|
+
const content = await loadWorkspaceFileContent(client3.raw(), remote.id);
|
|
7230
|
+
manifestEntry = {
|
|
7231
|
+
localPath: normalized,
|
|
7232
|
+
remotePath: remote.relativePath,
|
|
7233
|
+
fileId: remote.id,
|
|
7234
|
+
sha256: sha2563(content.content),
|
|
7235
|
+
size: Buffer.byteLength(content.content, "utf8"),
|
|
7236
|
+
lastModified: remote.lastModified
|
|
7237
|
+
};
|
|
7238
|
+
manifest2.files.push(manifestEntry);
|
|
7239
|
+
await writeWorkspaceRawManifest(rootDir, manifest2);
|
|
7240
|
+
}
|
|
7241
|
+
}
|
|
7242
|
+
}
|
|
7243
|
+
if (!stat) {
|
|
7244
|
+
if (manifestEntry) {
|
|
7245
|
+
process.stdout.write(
|
|
7246
|
+
formatObject19(
|
|
7247
|
+
{
|
|
7248
|
+
workspaceKey: context.workspaceKey,
|
|
7249
|
+
file: normalized,
|
|
7250
|
+
status: "deleted",
|
|
7251
|
+
staged: true,
|
|
7252
|
+
next: `hcm workspace push --dir ${args.dir ?? "."}`
|
|
7253
|
+
},
|
|
7254
|
+
{ format: args.output ?? "table" }
|
|
7255
|
+
) + "\n"
|
|
7256
|
+
);
|
|
7257
|
+
process.exitCode = 0;
|
|
7258
|
+
return;
|
|
7259
|
+
}
|
|
7260
|
+
throw new Error(`workspace file not found locally or in the workspace: ${normalized}`);
|
|
7261
|
+
}
|
|
7262
|
+
await fs5.unlink(absolutePath);
|
|
7263
|
+
const result = {
|
|
7264
|
+
workspaceKey: context.workspaceKey,
|
|
7265
|
+
file: normalized,
|
|
7266
|
+
status: "deleted",
|
|
7267
|
+
staged: true,
|
|
7268
|
+
next: `hcm workspace push --dir ${args.dir ?? "."}`
|
|
7269
|
+
};
|
|
7270
|
+
if (args.output === "json" || args.output === "yaml") {
|
|
7271
|
+
process.stdout.write(formatObject19(result, { format: args.output }) + "\n");
|
|
7272
|
+
} else {
|
|
7273
|
+
process.stdout.write(`workspace file staged for deletion: ${normalized}
|
|
7274
|
+
`);
|
|
7275
|
+
process.stdout.write(`\u4E0B\u4E00\u6B65\uFF1A${result.next}
|
|
7276
|
+
`);
|
|
7277
|
+
}
|
|
7278
|
+
process.exitCode = 0;
|
|
7279
|
+
return;
|
|
7280
|
+
} catch (e) {
|
|
7281
|
+
exitWorkspaceError(e, args.env ?? args.profile);
|
|
7282
|
+
}
|
|
7283
|
+
}
|
|
7195
7284
|
async function workspaceStatusCommand(args) {
|
|
7196
7285
|
try {
|
|
7197
7286
|
const rootDir = resolveRootDir(args.dir);
|
|
@@ -7507,10 +7596,15 @@ async function writeTextFile(file, content, force) {
|
|
|
7507
7596
|
async function readWorkspaceRawManifest(rootDir, context) {
|
|
7508
7597
|
try {
|
|
7509
7598
|
const parsed = JSON.parse(
|
|
7510
|
-
await fs5.readFile(
|
|
7599
|
+
await fs5.readFile(
|
|
7600
|
+
path5.join(rootDir, WORKSPACE_STATE_DIR, WORKSPACE_PULL_MANIFEST_FILE),
|
|
7601
|
+
"utf-8"
|
|
7602
|
+
)
|
|
7511
7603
|
);
|
|
7512
7604
|
if (parsed.version !== WORKSPACE_CONTEXT_VERSION || parsed.workspaceKey !== context.workspaceKey) {
|
|
7513
|
-
throw new Error(
|
|
7605
|
+
throw new Error(
|
|
7606
|
+
`${WORKSPACE_PULL_MANIFEST_FILE} does not match workspace ${context.workspaceKey}`
|
|
7607
|
+
);
|
|
7514
7608
|
}
|
|
7515
7609
|
return parsed;
|
|
7516
7610
|
} catch (e) {
|
|
@@ -7527,14 +7621,16 @@ async function readWorkspaceRawManifest(rootDir, context) {
|
|
|
7527
7621
|
async function writeWorkspaceRawState(rootDir, context, files, remoteByLocalPath) {
|
|
7528
7622
|
const stateDir = path5.join(rootDir, WORKSPACE_STATE_DIR);
|
|
7529
7623
|
await fs5.mkdir(stateDir, { recursive: true });
|
|
7530
|
-
const snapshots = files.map(
|
|
7531
|
-
|
|
7532
|
-
|
|
7533
|
-
|
|
7534
|
-
|
|
7535
|
-
|
|
7536
|
-
|
|
7537
|
-
|
|
7624
|
+
const snapshots = files.map(
|
|
7625
|
+
(file) => ({
|
|
7626
|
+
localPath: file.localPath,
|
|
7627
|
+
remotePath: file.localPath,
|
|
7628
|
+
fileId: remoteByLocalPath.get(file.localPath)?.id,
|
|
7629
|
+
sha256: file.sha256,
|
|
7630
|
+
size: file.size,
|
|
7631
|
+
lastModified: remoteByLocalPath.get(file.localPath)?.lastModified
|
|
7632
|
+
})
|
|
7633
|
+
);
|
|
7538
7634
|
await fs5.writeFile(
|
|
7539
7635
|
path5.join(stateDir, WORKSPACE_PULL_MANIFEST_FILE),
|
|
7540
7636
|
JSON.stringify(
|
|
@@ -7551,6 +7647,15 @@ async function writeWorkspaceRawState(rootDir, context, files, remoteByLocalPath
|
|
|
7551
7647
|
"utf-8"
|
|
7552
7648
|
);
|
|
7553
7649
|
}
|
|
7650
|
+
async function writeWorkspaceRawManifest(rootDir, manifest2) {
|
|
7651
|
+
const stateDir = path5.join(rootDir, WORKSPACE_STATE_DIR);
|
|
7652
|
+
await fs5.mkdir(stateDir, { recursive: true });
|
|
7653
|
+
await fs5.writeFile(
|
|
7654
|
+
path5.join(stateDir, WORKSPACE_PULL_MANIFEST_FILE),
|
|
7655
|
+
JSON.stringify(manifest2, null, 2) + "\n",
|
|
7656
|
+
"utf8"
|
|
7657
|
+
);
|
|
7658
|
+
}
|
|
7554
7659
|
async function readWorkspaceRawLocalFiles(rootDir) {
|
|
7555
7660
|
const files = [];
|
|
7556
7661
|
await walkWorkspaceRawFiles(rootDir, "", files);
|
|
@@ -7625,7 +7730,9 @@ async function pushWorkspaceRawFiles(args) {
|
|
|
7625
7730
|
}
|
|
7626
7731
|
}
|
|
7627
7732
|
const latestRemoteFiles = await loadWorkspaceRawRemoteFiles(args.http, args.context.workspaceKey);
|
|
7628
|
-
const latestRemoteByLocalPath = new Map(
|
|
7733
|
+
const latestRemoteByLocalPath = new Map(
|
|
7734
|
+
latestRemoteFiles.map((file) => [file.item.relativePath, file.item])
|
|
7735
|
+
);
|
|
7629
7736
|
await writeWorkspaceRawState(args.rootDir, args.context, localFiles, latestRemoteByLocalPath);
|
|
7630
7737
|
return result;
|
|
7631
7738
|
}
|
|
@@ -7651,9 +7758,15 @@ function buildWorkspaceRawPushPlan(manifest2, localFiles, remoteFiles) {
|
|
|
7651
7758
|
const remoteSha = remote ? sha2563(remote.content) : void 0;
|
|
7652
7759
|
if (entry.status === "added") {
|
|
7653
7760
|
if (remote) {
|
|
7654
|
-
conflicts.push(
|
|
7761
|
+
conflicts.push(
|
|
7762
|
+
workspaceRawConflict(entry, "remote file already exists but was not in local snapshot")
|
|
7763
|
+
);
|
|
7655
7764
|
} else {
|
|
7656
|
-
operations.push({
|
|
7765
|
+
operations.push({
|
|
7766
|
+
operation: "create",
|
|
7767
|
+
localPath: entry.localPath,
|
|
7768
|
+
remotePath: entry.remotePath
|
|
7769
|
+
});
|
|
7657
7770
|
}
|
|
7658
7771
|
continue;
|
|
7659
7772
|
}
|
|
@@ -7865,7 +7978,9 @@ function validateWritableOptions(templateKind, args) {
|
|
|
7865
7978
|
if (templateKind === "writable-workbench") return;
|
|
7866
7979
|
if (templateKind === "multi-page") {
|
|
7867
7980
|
if (args.fields || args.defaults) {
|
|
7868
|
-
throw new Error(
|
|
7981
|
+
throw new Error(
|
|
7982
|
+
"--fields and --defaults are only supported with --template writable-workbench"
|
|
7983
|
+
);
|
|
7869
7984
|
}
|
|
7870
7985
|
return;
|
|
7871
7986
|
}
|
|
@@ -7898,6 +8013,16 @@ function normalizeWorkspaceKey(value) {
|
|
|
7898
8013
|
if (!key2) throw new Error("workspaceKey is required");
|
|
7899
8014
|
return key2;
|
|
7900
8015
|
}
|
|
8016
|
+
function normalizeWorkspaceRmPath(value) {
|
|
8017
|
+
if (path5.isAbsolute(value) || /^[A-Za-z]:[\\/]/.test(value)) {
|
|
8018
|
+
throw new Error("workspace rm path must be relative to the bound workspace");
|
|
8019
|
+
}
|
|
8020
|
+
const normalized = normalizeRelativePath(value);
|
|
8021
|
+
if (normalized === WORKSPACE_CONTEXT_FILE || normalized === WORKSPACE_STATE_DIR || normalized.startsWith(`${WORKSPACE_STATE_DIR}/`) || normalized === MINI_APPS_DIR || normalized.startsWith(`${MINI_APPS_DIR}/`)) {
|
|
8022
|
+
throw new Error(`workspace rm only accepts raw workspace files: ${normalized}`);
|
|
8023
|
+
}
|
|
8024
|
+
return normalized;
|
|
8025
|
+
}
|
|
7901
8026
|
function normalizeRelativePath(value) {
|
|
7902
8027
|
const normalized = toPosix(value).replace(/^\/+/, "").replace(/\/+/g, "/");
|
|
7903
8028
|
if (!normalized || normalized === "." || normalized.includes("\0")) {
|
|
@@ -8063,7 +8188,10 @@ function writeWorkspacePushResult(rawResult, results, format) {
|
|
|
8063
8188
|
formatObject19(
|
|
8064
8189
|
{
|
|
8065
8190
|
workspaceFiles: { artifact: "workspace", ...rawResult },
|
|
8066
|
-
miniApps: results.map((item) => ({
|
|
8191
|
+
miniApps: results.map((item) => ({
|
|
8192
|
+
artifact: `mini:${item.app.appCode}`,
|
|
8193
|
+
...item.result
|
|
8194
|
+
}))
|
|
8067
8195
|
},
|
|
8068
8196
|
{ format }
|
|
8069
8197
|
) + "\n"
|
|
@@ -8410,6 +8538,8 @@ var GUARDED_EXECUTOR_REASON_CODES = /* @__PURE__ */ new Set([
|
|
|
8410
8538
|
"action-effect-unrecognized",
|
|
8411
8539
|
"workspace-create",
|
|
8412
8540
|
"workspace-activate",
|
|
8541
|
+
// bind / add mini / rm 都是受控本地工作区变更;rm 暂存删除,push 再执行远端 DELETE。
|
|
8542
|
+
"workspace-local-change",
|
|
8413
8543
|
// 这两个的载荷是**任意文件 / 整棵目录**,此前刻意不收——绑不住就意味着
|
|
8414
8544
|
// 「批准时看到的内容」与「执行时实际读到的内容」可以不同。
|
|
8415
8545
|
//
|
|
@@ -8550,8 +8680,12 @@ function classify(argv, actionResolution) {
|
|
|
8550
8680
|
}
|
|
8551
8681
|
if (name === "models") return direct("R0", "product-discovery", "model-discovery");
|
|
8552
8682
|
if (name === "config") {
|
|
8553
|
-
if (["list", "show", "get"].includes(subcommand))
|
|
8554
|
-
|
|
8683
|
+
if (["list", "show", "get"].includes(subcommand))
|
|
8684
|
+
return direct("R0", "local-discovery", "config-read");
|
|
8685
|
+
return forbidden(
|
|
8686
|
+
"identity-governance",
|
|
8687
|
+
"\u4FEE\u6539\u672C\u673A\u5168\u5C40\u914D\u7F6E\u4F1A\u6539\u53D8\u540E\u7EED\u6240\u6709\u547D\u4EE4\u7684\u73AF\u5883\u4E0E\u8EAB\u4EFD\uFF0C\u5C5E\u6CBB\u7406\u64CD\u4F5C\u3002"
|
|
8688
|
+
);
|
|
8555
8689
|
}
|
|
8556
8690
|
if (name === "upgrade" || name === "self-update") {
|
|
8557
8691
|
return direct("R1", "managed-local-write", "cli-self-upgrade");
|
|
@@ -8568,6 +8702,7 @@ function classify(argv, actionResolution) {
|
|
|
8568
8702
|
if (name === "chiron") {
|
|
8569
8703
|
if (subcommand === "doctor") return direct("R0", "local-discovery", "chiron-doctor");
|
|
8570
8704
|
if (subcommand === "init") return direct("R1", "managed-local-write", "chiron-project-scaffold");
|
|
8705
|
+
if (subcommand === "test") return direct("R1", "remote-read", "chiron-regression-test");
|
|
8571
8706
|
return forbidden("unknown-command", "\u672A\u77E5 chiron \u5B50\u547D\u4EE4\u6309\u6700\u9AD8\u98CE\u9669\u5173\u95ED\u3002");
|
|
8572
8707
|
}
|
|
8573
8708
|
if (name === "skills") {
|
|
@@ -8630,6 +8765,7 @@ function classify(argv, actionResolution) {
|
|
|
8630
8765
|
if (subcommand === "bind" || subcommand === "add" && argv[2] === "mini") {
|
|
8631
8766
|
return guarded("managed-local-write", "workspace-local-change");
|
|
8632
8767
|
}
|
|
8768
|
+
if (subcommand === "rm") return guarded("managed-local-write", "workspace-local-change");
|
|
8633
8769
|
if (subcommand === "create") return guarded("tenant-write", "workspace-create");
|
|
8634
8770
|
if (subcommand === "activate") return guarded("tenant-write", "workspace-activate");
|
|
8635
8771
|
if (subcommand === "push") return guarded("tenant-write", "workspace-push");
|
|
@@ -9067,21 +9203,21 @@ async function resolveCoreAction(request) {
|
|
|
9067
9203
|
`Core \u5143\u6570\u636E\u91CC\u6CA1\u6709 ${request.model}.${request.action} \u8FD9\u4E2A Action\u3002${degraded}next_step=\u7528 \`hcm describe ${request.model}\` \u770B\u5B83\u5217\u51FA\u7684 Action \u540D\uFF08\u811A\u672C Action \u4F1A\u6807 [script]\uFF09`
|
|
9068
9204
|
);
|
|
9069
9205
|
}
|
|
9070
|
-
const
|
|
9071
|
-
if (
|
|
9206
|
+
const matches2 = request.explicitShape ? named.filter((action) => matchesRequest(action, request)) : named;
|
|
9207
|
+
if (matches2.length === 0) {
|
|
9072
9208
|
const shapes = named.map((a) => `scope=${a.scope ?? "?"} method=${(a.httpMethod ?? "?").toUpperCase()}`).join("\uFF1B");
|
|
9073
9209
|
return failed(
|
|
9074
9210
|
"action-shape-mismatch",
|
|
9075
9211
|
`${request.model}.${request.action} \u5B58\u5728\uFF0C\u4F46\u5F62\u6001\u5BF9\u4E0D\u4E0A\uFF1A\u4F60\u7ED9\u7684\u662F scope=${request.scope} method=${request.httpMethod}\uFF0C\u5143\u6570\u636E\u91CC\u662F ${shapes}\u3002next_step=\u53BB\u6389 --scope/--method \u8BA9 CLI \u6309\u5143\u6570\u636E\u81EA\u52A8\u5224\u5B9A\uFF0C\u6216\u6539\u6210\u4E0A\u9762\u7684\u5F62\u6001`
|
|
9076
9212
|
);
|
|
9077
9213
|
}
|
|
9078
|
-
if (
|
|
9214
|
+
if (matches2.length > 1) {
|
|
9079
9215
|
return failed(
|
|
9080
9216
|
"action-metadata-ambiguous",
|
|
9081
9217
|
`${request.model}.${request.action} \u5728\u5143\u6570\u636E\u91CC\u6709\u591A\u79CD\u5F62\u6001\uFF0C\u65E0\u6CD5\u552F\u4E00\u5224\u5B9A\u3002next_step=\u7528 --scope \u4E0E --method \u6307\u660E\u8981\u8C03\u54EA\u4E00\u4E2A`
|
|
9082
9218
|
);
|
|
9083
9219
|
}
|
|
9084
|
-
return policyFromActionMeta(
|
|
9220
|
+
return policyFromActionMeta(matches2[0], request);
|
|
9085
9221
|
} catch {
|
|
9086
9222
|
return failed(
|
|
9087
9223
|
"action-metadata-unavailable",
|
|
@@ -10027,17 +10163,17 @@ function projectEnvFromConfig(cfg) {
|
|
|
10027
10163
|
}
|
|
10028
10164
|
async function findEnvByEndpoint(endpoint, tenant2) {
|
|
10029
10165
|
const wanted = normalizeOrigin(endpoint);
|
|
10030
|
-
const
|
|
10166
|
+
const matches2 = [];
|
|
10031
10167
|
for (const name of await listEnvs3().catch(() => [])) {
|
|
10032
10168
|
const config2 = await loadEnv10(name).catch(() => null);
|
|
10033
10169
|
if (!config2 || normalizeOrigin(config2.endpoint) !== wanted) continue;
|
|
10034
|
-
|
|
10170
|
+
matches2.push({ name, config: config2, hasIdentity: (await listIdentities4(name).catch(() => [])).length > 0 });
|
|
10035
10171
|
}
|
|
10036
|
-
if (
|
|
10172
|
+
if (matches2.length === 0) return null;
|
|
10037
10173
|
const active = (await loadGlobalConfig10().catch(() => null))?.activeEnv;
|
|
10038
|
-
const usable =
|
|
10039
|
-
const
|
|
10040
|
-
return { name:
|
|
10174
|
+
const usable = matches2.filter((m) => m.hasIdentity);
|
|
10175
|
+
const pick2 = usable.find((m) => m.name === active) ?? (tenant2 ? usable.find((m) => (m.config.tenantId ?? "1") === tenant2) : void 0) ?? usable[0] ?? matches2.find((m) => m.name === active) ?? matches2[0];
|
|
10176
|
+
return { name: pick2.name, config: pick2.config };
|
|
10041
10177
|
}
|
|
10042
10178
|
function renderChironAgentInstructions() {
|
|
10043
10179
|
return [
|
|
@@ -10560,6 +10696,346 @@ async function chironDoctorCommand(args, deps) {
|
|
|
10560
10696
|
}
|
|
10561
10697
|
}
|
|
10562
10698
|
|
|
10699
|
+
// src/commands/chiron-test.ts
|
|
10700
|
+
init_exit();
|
|
10701
|
+
import { spawnSync as spawnSync2 } from "child_process";
|
|
10702
|
+
import { promises as fs12 } from "fs";
|
|
10703
|
+
import path12 from "path";
|
|
10704
|
+
import yaml2 from "js-yaml";
|
|
10705
|
+
import { formatObject as formatObject26 } from "@hcmai/sdk";
|
|
10706
|
+
|
|
10707
|
+
// src/commands/xlsx-peek.ts
|
|
10708
|
+
import { readFileSync as readFileSync6 } from "fs";
|
|
10709
|
+
import { inflateRawSync } from "zlib";
|
|
10710
|
+
function readZip(buf, want) {
|
|
10711
|
+
let eocd = -1;
|
|
10712
|
+
for (let i = buf.length - 22; i >= 0 && i > buf.length - 66e3; i--) {
|
|
10713
|
+
if (buf.readUInt32LE(i) === 101010256) {
|
|
10714
|
+
eocd = i;
|
|
10715
|
+
break;
|
|
10716
|
+
}
|
|
10717
|
+
}
|
|
10718
|
+
if (eocd < 0) throw new Error("\u4E0D\u662F\u6709\u6548\u7684 zip/xlsx\uFF08\u627E\u4E0D\u5230\u4E2D\u592E\u76EE\u5F55\uFF09");
|
|
10719
|
+
const count = buf.readUInt16LE(eocd + 10);
|
|
10720
|
+
let p = buf.readUInt32LE(eocd + 16);
|
|
10721
|
+
const out = [];
|
|
10722
|
+
for (let n = 0; n < count; n++) {
|
|
10723
|
+
if (buf.readUInt32LE(p) !== 33639248) break;
|
|
10724
|
+
const method = buf.readUInt16LE(p + 10);
|
|
10725
|
+
const compressedSize = buf.readUInt32LE(p + 20);
|
|
10726
|
+
const nameLen = buf.readUInt16LE(p + 28);
|
|
10727
|
+
const extraLen = buf.readUInt16LE(p + 30);
|
|
10728
|
+
const commentLen = buf.readUInt16LE(p + 32);
|
|
10729
|
+
const localOffset = buf.readUInt32LE(p + 42);
|
|
10730
|
+
const name = buf.subarray(p + 46, p + 46 + nameLen).toString("utf8");
|
|
10731
|
+
if (want(name)) {
|
|
10732
|
+
const lnameLen = buf.readUInt16LE(localOffset + 26);
|
|
10733
|
+
const lextraLen = buf.readUInt16LE(localOffset + 28);
|
|
10734
|
+
const start = localOffset + 30 + lnameLen + lextraLen;
|
|
10735
|
+
const raw = buf.subarray(start, start + compressedSize);
|
|
10736
|
+
if (method === 0) out.push({ name, data: Buffer.from(raw) });
|
|
10737
|
+
else if (method === 8) out.push({ name, data: inflateRawSync(raw) });
|
|
10738
|
+
else throw new Error(`xlsx \u91CC\u7684 ${name} \u7528\u4E86\u4E0D\u652F\u6301\u7684\u538B\u7F29\u65B9\u5F0F ${method}`);
|
|
10739
|
+
}
|
|
10740
|
+
p += 46 + nameLen + extraLen + commentLen;
|
|
10741
|
+
}
|
|
10742
|
+
return out;
|
|
10743
|
+
}
|
|
10744
|
+
var decode = (s) => s.replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/'/g, "'").replace(/&/g, "&");
|
|
10745
|
+
function xlsxRows(file, maxRows = 50) {
|
|
10746
|
+
const buf = readFileSync6(file);
|
|
10747
|
+
const [sheet] = readZip(buf, (n) => n === "xl/worksheets/sheet1.xml");
|
|
10748
|
+
if (!sheet) throw new Error(`${file} \u91CC\u6CA1\u6709 xl/worksheets/sheet1.xml\uFF0C\u53EF\u80FD\u4E0D\u662F xlsx`);
|
|
10749
|
+
const [shared] = readZip(buf, (n) => n === "xl/sharedStrings.xml");
|
|
10750
|
+
const sharedStrings = [];
|
|
10751
|
+
if (shared) {
|
|
10752
|
+
for (const si of shared.data.toString("utf8").split("<si>").slice(1)) {
|
|
10753
|
+
sharedStrings.push(decode([...si.matchAll(/<t[^>]*>([\s\S]*?)<\/t>/g)].map((m) => m[1] ?? "").join("")));
|
|
10754
|
+
}
|
|
10755
|
+
}
|
|
10756
|
+
const xml = sheet.data.toString("utf8");
|
|
10757
|
+
const rows = [];
|
|
10758
|
+
for (const rowXml of xml.split("<row").slice(1)) {
|
|
10759
|
+
if (rows.length >= maxRows) break;
|
|
10760
|
+
const cells = [];
|
|
10761
|
+
for (const m of rowXml.matchAll(/<c\b([^>]*)>([\s\S]*?)<\/c>/g)) {
|
|
10762
|
+
const attrs = m[1] ?? "";
|
|
10763
|
+
const body = m[2] ?? "";
|
|
10764
|
+
const v = /<v>([\s\S]*?)<\/v>/.exec(body)?.[1] ?? "";
|
|
10765
|
+
const inline = [...body.matchAll(/<t[^>]*>([\s\S]*?)<\/t>/g)].map((x) => x[1] ?? "").join("");
|
|
10766
|
+
if (/t="s"/.test(attrs)) cells.push(sharedStrings[Number(v)] ?? "");
|
|
10767
|
+
else if (inline) cells.push(decode(inline));
|
|
10768
|
+
else cells.push(decode(v));
|
|
10769
|
+
}
|
|
10770
|
+
rows.push(cells);
|
|
10771
|
+
}
|
|
10772
|
+
return rows;
|
|
10773
|
+
}
|
|
10774
|
+
|
|
10775
|
+
// src/commands/chiron-test.ts
|
|
10776
|
+
var CONTENT_KEYS = ["stdout_contains", "json", "xlsx_header", "xlsx_min_rows", "text_contains"];
|
|
10777
|
+
var hasContentAssertion = (c) => (c.page ? (c.expect_text?.length ?? 0) > 0 : false) || CONTENT_KEYS.some((k) => c.expect?.[k] !== void 0);
|
|
10778
|
+
function assertUsableSpec(spec, where) {
|
|
10779
|
+
if (!spec?.name || !Array.isArray(spec.checks) || spec.checks.length === 0) {
|
|
10780
|
+
throw new Error(`${where}: \u7528\u4F8B\u8981\u6709 name \u4E0E\u81F3\u5C11\u4E00\u6761 checks`);
|
|
10781
|
+
}
|
|
10782
|
+
spec.checks.forEach((c, i) => {
|
|
10783
|
+
const at = `${where} \u7B2C ${i + 1} \u6761\u300C${c.name ?? "\u672A\u547D\u540D"}\u300D`;
|
|
10784
|
+
if (!c.name) throw new Error(`${at}: \u7F3A name`);
|
|
10785
|
+
const kinds = [c.run, c.file, c.page].filter(Boolean).length;
|
|
10786
|
+
if (kinds !== 1) throw new Error(`${at}: run / file / page \u5FC5\u987B\u4E14\u53EA\u80FD\u6709\u4E00\u4E2A`);
|
|
10787
|
+
if (c.run) {
|
|
10788
|
+
if (!/^hcm\s/.test(c.run.trim())) {
|
|
10789
|
+
throw new Error(`${at}: run \u53EA\u80FD\u8DD1 hcm \u5B50\u547D\u4EE4\uFF08\u4E0D\u63A5\u53D7\u4EFB\u610F shell\uFF1B\u8981\u7ED5\u8FC7 CLI \u7684\u4E8B\u672C\u6765\u5C31\u4E0D\u8BE5\u505A\uFF09`);
|
|
10790
|
+
}
|
|
10791
|
+
tokenize(c.run);
|
|
10792
|
+
}
|
|
10793
|
+
if (c.page && !c.expect_text?.length) throw new Error(`${at}: \u9875\u9762\u5224\u636E\u81F3\u5C11\u8981\u4E00\u4E2A expect_text\u2014\u2014\u622A\u56FE\u5B58\u5728\u4E0D\u7B49\u4E8E\u9875\u9762\u5BF9`);
|
|
10794
|
+
if (c.file && !hasContentAssertion(c)) throw new Error(`${at}: \u8BFB\u6587\u4EF6\u5374\u6CA1\u6709\u5185\u5BB9\u5224\u636E\uFF08${CONTENT_KEYS.join(" / ")}\uFF09\u2014\u2014\u6587\u4EF6\u5B58\u5728\u4E0D\u7B49\u4E8E\u5185\u5BB9\u5BF9`);
|
|
10795
|
+
});
|
|
10796
|
+
if (!spec.checks.some(hasContentAssertion)) {
|
|
10797
|
+
throw new Error(
|
|
10798
|
+
`${where}: \u6574\u4EFD\u7528\u4F8B\u6CA1\u6709\u4EFB\u4F55\u5185\u5BB9\u5224\u636E\uFF08${CONTENT_KEYS.join(" / ")} / expect_text\uFF09\uFF0C\u53EA\u8DD1\u4E0D\u770B\u7B49\u4E8E\u6CA1\u6D4B\u3002`
|
|
10799
|
+
);
|
|
10800
|
+
}
|
|
10801
|
+
}
|
|
10802
|
+
function tokenize(line) {
|
|
10803
|
+
const out = [];
|
|
10804
|
+
let cur = "";
|
|
10805
|
+
let quote = null;
|
|
10806
|
+
let started = false;
|
|
10807
|
+
for (let i = 0; i < line.length; i++) {
|
|
10808
|
+
const ch = line[i];
|
|
10809
|
+
if (quote) {
|
|
10810
|
+
if (ch === quote) quote = null;
|
|
10811
|
+
else if (ch === "\\" && quote === '"' && i + 1 < line.length) {
|
|
10812
|
+
cur += line[++i];
|
|
10813
|
+
} else cur += ch;
|
|
10814
|
+
continue;
|
|
10815
|
+
}
|
|
10816
|
+
if (ch === '"' || ch === "'") {
|
|
10817
|
+
quote = ch;
|
|
10818
|
+
started = true;
|
|
10819
|
+
continue;
|
|
10820
|
+
}
|
|
10821
|
+
if (ch === "\\" && i + 1 < line.length) {
|
|
10822
|
+
cur += line[++i];
|
|
10823
|
+
started = true;
|
|
10824
|
+
continue;
|
|
10825
|
+
}
|
|
10826
|
+
if (/\s/.test(ch)) {
|
|
10827
|
+
if (started || cur) {
|
|
10828
|
+
out.push(cur);
|
|
10829
|
+
cur = "";
|
|
10830
|
+
started = false;
|
|
10831
|
+
}
|
|
10832
|
+
continue;
|
|
10833
|
+
}
|
|
10834
|
+
cur += ch;
|
|
10835
|
+
started = true;
|
|
10836
|
+
}
|
|
10837
|
+
if (quote) throw new Error(`\u547D\u4EE4\u91CC\u7684\u5F15\u53F7\u6CA1\u95ED\u5408\uFF1A${line}`);
|
|
10838
|
+
if (started || cur) out.push(cur);
|
|
10839
|
+
return out;
|
|
10840
|
+
}
|
|
10841
|
+
function parseJsonLoose(stdout) {
|
|
10842
|
+
const candidates = [];
|
|
10843
|
+
const oa = stdout.indexOf("{"), ob = stdout.lastIndexOf("}");
|
|
10844
|
+
const aa = stdout.indexOf("["), ab = stdout.lastIndexOf("]");
|
|
10845
|
+
if (aa >= 0 && ab > aa) candidates.push([aa, ab]);
|
|
10846
|
+
if (oa >= 0 && ob > oa) candidates.push([oa, ob]);
|
|
10847
|
+
candidates.sort((x, y) => x[0] - y[0]);
|
|
10848
|
+
for (const [a, b] of candidates) {
|
|
10849
|
+
try {
|
|
10850
|
+
return JSON.parse(stdout.slice(a, b + 1));
|
|
10851
|
+
} catch {
|
|
10852
|
+
}
|
|
10853
|
+
}
|
|
10854
|
+
return void 0;
|
|
10855
|
+
}
|
|
10856
|
+
function pick(value, expr) {
|
|
10857
|
+
const tokens = [...expr.replace(/^\$/, "").matchAll(/\[(\d+)\]|([^.[\]]+)/g)];
|
|
10858
|
+
let cur = value;
|
|
10859
|
+
for (const t of tokens) {
|
|
10860
|
+
if (cur === null || cur === void 0) return void 0;
|
|
10861
|
+
if (t[1] !== void 0) {
|
|
10862
|
+
if (!Array.isArray(cur)) return void 0;
|
|
10863
|
+
cur = cur[Number(t[1])];
|
|
10864
|
+
} else {
|
|
10865
|
+
if (typeof cur !== "object") return void 0;
|
|
10866
|
+
cur = cur[t[2]];
|
|
10867
|
+
}
|
|
10868
|
+
}
|
|
10869
|
+
return cur;
|
|
10870
|
+
}
|
|
10871
|
+
function matches(actual, rule) {
|
|
10872
|
+
const r = rule.trim();
|
|
10873
|
+
if (r === "\u975E\u7A7A" || r === "nonempty") return actual !== void 0 && actual !== null && String(actual) !== "" && !(Array.isArray(actual) && actual.length === 0);
|
|
10874
|
+
const m = /^(>=|<=|>|<|!=|=)\s*(.*)$/.exec(r);
|
|
10875
|
+
if (!m) return String(actual) === r;
|
|
10876
|
+
const [, op, want] = m;
|
|
10877
|
+
const n = Number(want), a = Array.isArray(actual) ? actual.length : Number(actual);
|
|
10878
|
+
switch (op) {
|
|
10879
|
+
case ">":
|
|
10880
|
+
return Number.isFinite(a) && a > n;
|
|
10881
|
+
case "<":
|
|
10882
|
+
return Number.isFinite(a) && a < n;
|
|
10883
|
+
case ">=":
|
|
10884
|
+
return Number.isFinite(a) && a >= n;
|
|
10885
|
+
case "<=":
|
|
10886
|
+
return Number.isFinite(a) && a <= n;
|
|
10887
|
+
case "!=":
|
|
10888
|
+
return String(actual) !== want;
|
|
10889
|
+
default:
|
|
10890
|
+
return String(actual) === want;
|
|
10891
|
+
}
|
|
10892
|
+
}
|
|
10893
|
+
var defaultDeps2 = {
|
|
10894
|
+
assess: (argv) => assessEffectiveDeliveryCommand(argv),
|
|
10895
|
+
hcm: (argv, cwd) => {
|
|
10896
|
+
const r = spawnSync2("hcm", argv, { cwd, encoding: "utf8", maxBuffer: 1 << 26, timeout: 6e5 });
|
|
10897
|
+
return { status: r.status, stdout: r.stdout ?? "", stderr: r.stderr ?? "" };
|
|
10898
|
+
},
|
|
10899
|
+
pageAcceptance: (root, argv) => {
|
|
10900
|
+
const r = spawnSync2("./page-acceptance.sh", argv, { cwd: root, encoding: "utf8", maxBuffer: 1 << 24, timeout: 3e5 });
|
|
10901
|
+
return { status: r.status, stdout: r.stdout ?? "", stderr: r.stderr ?? "" };
|
|
10902
|
+
},
|
|
10903
|
+
readXlsx: (file) => xlsxRows(file),
|
|
10904
|
+
readText: (file) => fs12.readFile(file, "utf8")
|
|
10905
|
+
};
|
|
10906
|
+
async function runCase(spec, root, opts = {}, deps = defaultDeps2) {
|
|
10907
|
+
const results = [];
|
|
10908
|
+
const vars = {};
|
|
10909
|
+
const fill = (text) => text.replace(/\$\{(\w+)\}/g, (_, k) => {
|
|
10910
|
+
if (vars[k] === void 0) throw new Error(`\u7528\u5230\u4E86 ${"$"}{${k}} \u4F46\u524D\u9762\u6CA1\u6709\u54EA\u4E00\u6B65\u6355\u83B7\u5B83`);
|
|
10911
|
+
return vars[k];
|
|
10912
|
+
});
|
|
10913
|
+
for (const c of spec.checks) {
|
|
10914
|
+
try {
|
|
10915
|
+
if (c.run) {
|
|
10916
|
+
const argv2 = tokenize(fill(c.run)).slice(1);
|
|
10917
|
+
const verdict = await deps.assess(argv2);
|
|
10918
|
+
if (verdict.execution !== "direct") {
|
|
10919
|
+
results.push({
|
|
10920
|
+
name: c.name,
|
|
10921
|
+
verdict: "fail",
|
|
10922
|
+
detail: `\u8FD9\u6761\u547D\u4EE4\u6309\u4EA4\u4ED8\u98CE\u63A7\u662F ${verdict.risk} / ${verdict.execution}\uFF08${verdict.reasonCode}\uFF09\uFF0C\u6CA1\u6709\u8DD1\u3002\u7528\u4F8B\u53EA\u8DD1\u53EA\u8BFB\uFF1B\u8981\u5199\u6570\u636E\u8D70 hcm delivery assess \u2192 prepare \u2192 execute\u3002`
|
|
10923
|
+
});
|
|
10924
|
+
continue;
|
|
10925
|
+
}
|
|
10926
|
+
if (opts.env && !argv2.includes("--env")) argv2.push("--env", opts.env);
|
|
10927
|
+
const as2 = c.as ?? opts.as;
|
|
10928
|
+
if (as2 && !argv2.includes("--as")) argv2.push("--as", as2);
|
|
10929
|
+
const r2 = deps.hcm(argv2, root);
|
|
10930
|
+
const want = c.expect ?? {};
|
|
10931
|
+
const bad = [];
|
|
10932
|
+
if (want.exit !== void 0 && r2.status !== want.exit) bad.push(`\u9000\u51FA\u7801 ${r2.status} \u2260 ${want.exit}`);
|
|
10933
|
+
for (const t of want.stdout_contains ?? []) if (!r2.stdout.includes(t)) bad.push(`\u8F93\u51FA\u91CC\u6CA1\u6709\u300C${t}\u300D`);
|
|
10934
|
+
for (const t of want.stdout_not_contains ?? []) if (r2.stdout.includes(t)) bad.push(`\u8F93\u51FA\u91CC\u51FA\u73B0\u4E86\u4E0D\u8BE5\u6709\u7684\u300C${t}\u300D`);
|
|
10935
|
+
if (want.json) {
|
|
10936
|
+
const parsed = parseJsonLoose(r2.stdout);
|
|
10937
|
+
if (parsed === void 0) bad.push("\u8F93\u51FA\u4E0D\u662F JSON\uFF0C\u65E0\u6CD5\u6309 json \u5224\u636E\u6BD4\u5BF9");
|
|
10938
|
+
if (parsed !== void 0) {
|
|
10939
|
+
for (const [expr, rule] of Object.entries(want.json)) {
|
|
10940
|
+
const actual = pick(parsed, expr);
|
|
10941
|
+
if (!matches(actual, rule)) bad.push(`${expr} \u5B9E\u9645 ${JSON.stringify(actual)}\uFF0C\u671F\u671B ${rule}`);
|
|
10942
|
+
}
|
|
10943
|
+
}
|
|
10944
|
+
}
|
|
10945
|
+
if (c.capture && bad.length === 0) {
|
|
10946
|
+
const parsed = parseJsonLoose(r2.stdout);
|
|
10947
|
+
for (const [name, expr] of Object.entries(c.capture)) {
|
|
10948
|
+
const v = pick(parsed, expr);
|
|
10949
|
+
if (v === void 0 || v === null || String(v) === "") bad.push(`\u8981\u6355\u83B7\u7684 ${name}\uFF08${expr}\uFF09\u5728\u8F93\u51FA\u91CC\u53D6\u4E0D\u5230`);
|
|
10950
|
+
else vars[name] = String(v);
|
|
10951
|
+
}
|
|
10952
|
+
}
|
|
10953
|
+
results.push(bad.length ? { name: c.name, verdict: "fail", detail: `${bad.join("\uFF1B")}${r2.stderr.trim() ? `\uFF5Cstderr: ${r2.stderr.trim().split("\n")[0]}` : ""}` } : { name: c.name, verdict: hasContentAssertion(c) ? "pass" : "step", detail: c.capture ? `\u6355\u83B7 ${Object.keys(c.capture).join("\u3001")}` : "" });
|
|
10954
|
+
continue;
|
|
10955
|
+
}
|
|
10956
|
+
if (c.file) {
|
|
10957
|
+
const file = path12.resolve(root, fill(c.file));
|
|
10958
|
+
const want = c.expect ?? {};
|
|
10959
|
+
const bad = [];
|
|
10960
|
+
if (want.xlsx_header || want.xlsx_min_rows !== void 0) {
|
|
10961
|
+
const rows = deps.readXlsx(file);
|
|
10962
|
+
const header = (rows[0] ?? []).map((x) => String(x).trim());
|
|
10963
|
+
for (const h of want.xlsx_header ?? []) if (!header.includes(h)) bad.push(`\u8868\u5934\u91CC\u6CA1\u6709\u300C${h}\u300D\uFF0C\u5B9E\u9645\u662F [${header.slice(0, 8).join(", ")}]`);
|
|
10964
|
+
if (want.xlsx_min_rows !== void 0 && rows.length - 1 < want.xlsx_min_rows) bad.push(`\u6570\u636E\u884C ${Math.max(rows.length - 1, 0)} \u5C11\u4E8E ${want.xlsx_min_rows}`);
|
|
10965
|
+
}
|
|
10966
|
+
if (want.text_contains) {
|
|
10967
|
+
const text = await deps.readText(file);
|
|
10968
|
+
for (const t of want.text_contains) if (!text.includes(t)) bad.push(`\u6587\u4EF6\u91CC\u6CA1\u6709\u300C${t}\u300D`);
|
|
10969
|
+
}
|
|
10970
|
+
results.push(bad.length ? { name: c.name, verdict: "fail", detail: bad.join("\uFF1B") } : { name: c.name, verdict: "pass", detail: "" });
|
|
10971
|
+
continue;
|
|
10972
|
+
}
|
|
10973
|
+
const out = path12.join("evidence", "test", `${spec.name}-${c.name}`.replace(/[^\w一-龥-]+/g, "_") + ".png");
|
|
10974
|
+
const argv = ["--path", fill(c.page), "--out", out];
|
|
10975
|
+
if (opts.env) argv.push("--env", opts.env);
|
|
10976
|
+
const as = c.as ?? opts.as;
|
|
10977
|
+
if (as) argv.push("--as", as);
|
|
10978
|
+
for (const t of c.expect_text ?? []) argv.push("--expect-text", t);
|
|
10979
|
+
for (const t of c.reject_text ?? []) argv.push("--reject-text", t);
|
|
10980
|
+
const r = deps.pageAcceptance(root, argv);
|
|
10981
|
+
results.push(r.status === 0 ? { name: c.name, verdict: "pass", detail: out } : { name: c.name, verdict: "fail", detail: (r.stderr || r.stdout).trim().split("\n").slice(-1)[0] ?? `\u9000\u51FA\u7801 ${r.status}` });
|
|
10982
|
+
} catch (e) {
|
|
10983
|
+
results.push({ name: c.name, verdict: "fail", detail: e.message });
|
|
10984
|
+
}
|
|
10985
|
+
}
|
|
10986
|
+
return results;
|
|
10987
|
+
}
|
|
10988
|
+
async function loadCases(target) {
|
|
10989
|
+
const stat = await fs12.stat(target);
|
|
10990
|
+
const files = stat.isDirectory() ? (await fs12.readdir(target)).filter((f) => /\.ya?ml$/.test(f)).sort().map((f) => path12.join(target, f)) : [target];
|
|
10991
|
+
const out = [];
|
|
10992
|
+
for (const f of files) {
|
|
10993
|
+
const spec = yaml2.load(await fs12.readFile(f, "utf8"));
|
|
10994
|
+
assertUsableSpec(spec, path12.basename(f));
|
|
10995
|
+
out.push({ file: f, spec });
|
|
10996
|
+
}
|
|
10997
|
+
if (out.length === 0) throw new Error(`${target} \u4E0B\u6CA1\u6709\u7528\u4F8B\uFF08*.yml\uFF09`);
|
|
10998
|
+
return out;
|
|
10999
|
+
}
|
|
11000
|
+
async function chironTestCommand(target, args, deps) {
|
|
11001
|
+
try {
|
|
11002
|
+
const root = path12.resolve(args.project ?? ".");
|
|
11003
|
+
const where = path12.resolve(root, target ?? "tests");
|
|
11004
|
+
const cases = await loadCases(where);
|
|
11005
|
+
const report = [];
|
|
11006
|
+
let failed2 = 0;
|
|
11007
|
+
for (const { file, spec } of cases) {
|
|
11008
|
+
const results = await runCase(spec, root, { env: args.env, as: args.as }, deps);
|
|
11009
|
+
failed2 += results.filter((r) => r.verdict === "fail").length;
|
|
11010
|
+
report.push({ case: spec.name, file: path12.relative(root, file), results });
|
|
11011
|
+
}
|
|
11012
|
+
const fmt = args.output ?? "table";
|
|
11013
|
+
if (fmt === "json" || fmt === "yaml") {
|
|
11014
|
+
process.stdout.write(formatObject26({ ok: failed2 === 0, failed: failed2, cases: report }, { format: fmt }) + "\n");
|
|
11015
|
+
} else {
|
|
11016
|
+
for (const c of report) {
|
|
11017
|
+
process.stdout.write(`
|
|
11018
|
+
${c.case}\uFF08${c.file}\uFF09
|
|
11019
|
+
`);
|
|
11020
|
+
for (const r of c.results) {
|
|
11021
|
+
const mark = r.verdict === "pass" ? "\u2705" : r.verdict === "step" ? "\xB7" : r.verdict === "warn" ? "\u26A0\uFE0F" : "\u274C";
|
|
11022
|
+
process.stdout.write(` ${mark} ${r.name}${r.detail ? ` ${r.detail}` : ""}
|
|
11023
|
+
`);
|
|
11024
|
+
}
|
|
11025
|
+
}
|
|
11026
|
+
const verified = report.reduce((n, c) => n + c.results.filter((r) => r.verdict === "pass").length, 0);
|
|
11027
|
+
process.stdout.write(failed2 === 0 ? `
|
|
11028
|
+
\u5168\u90E8\u901A\u8FC7\uFF08\u771F\u5224\u8FC7\u5185\u5BB9\u7684 ${verified} \u6761\uFF1B\u5E26 \xB7 \u7684\u662F\u6B65\u9AA4\uFF0C\u4E0D\u7B97\u9A8C\u8BC1\uFF09\u3002
|
|
11029
|
+
` : `
|
|
11030
|
+
${failed2} \u6761\u6CA1\u8FC7\u2014\u2014\u4E0A\u9762\u6BCF\u6761\u90FD\u5199\u4E86\u5B9E\u9645\u503C\u4E0E\u671F\u671B\uFF0C\u7167\u7740\u67E5\u3002
|
|
11031
|
+
`);
|
|
11032
|
+
}
|
|
11033
|
+
process.exitCode = failed2 === 0 ? 0 : 1;
|
|
11034
|
+
} catch (e) {
|
|
11035
|
+
exitWithError(e);
|
|
11036
|
+
}
|
|
11037
|
+
}
|
|
11038
|
+
|
|
10563
11039
|
// src/commands/delivery-recon.ts
|
|
10564
11040
|
init_auth_guard();
|
|
10565
11041
|
init_exit();
|
|
@@ -10568,7 +11044,7 @@ import {
|
|
|
10568
11044
|
ReconLayout,
|
|
10569
11045
|
ROUND_EXIT_CODES,
|
|
10570
11046
|
computeReconSourceKey,
|
|
10571
|
-
formatObject as
|
|
11047
|
+
formatObject as formatObject27,
|
|
10572
11048
|
fromAxiosError as fromAxiosError22,
|
|
10573
11049
|
httpProbe as httpProbe4,
|
|
10574
11050
|
inspectRound,
|
|
@@ -10588,7 +11064,7 @@ async function deliveryReconCommand(args) {
|
|
|
10588
11064
|
onlyModel: args.model ?? null,
|
|
10589
11065
|
identity: ctx.tenantId ? { requestedTenantId: ctx.tenantId } : null
|
|
10590
11066
|
});
|
|
10591
|
-
process.stdout.write(
|
|
11067
|
+
process.stdout.write(formatObject27(summary, { format: args.output ?? "json" }) + "\n");
|
|
10592
11068
|
} catch (e) {
|
|
10593
11069
|
const err = e;
|
|
10594
11070
|
if (err?.isAxiosError) exitWithError(fromAxiosError22(err, args.env));
|
|
@@ -10602,7 +11078,7 @@ async function deliveryReconRoundCommand(args) {
|
|
|
10602
11078
|
const result = inspectRound(args.dir ?? ".");
|
|
10603
11079
|
const fmt = args.output ?? "json";
|
|
10604
11080
|
if (fmt !== "json") process.stdout.write(renderRound(result));
|
|
10605
|
-
process.stdout.write(
|
|
11081
|
+
process.stdout.write(formatObject27(result, { format: fmt }) + "\n");
|
|
10606
11082
|
code = ROUND_EXIT_CODES[result.state];
|
|
10607
11083
|
} catch (e) {
|
|
10608
11084
|
exitWithError(e);
|
|
@@ -10621,14 +11097,14 @@ import {
|
|
|
10621
11097
|
GAP_REASONS,
|
|
10622
11098
|
deriveAclass,
|
|
10623
11099
|
exitCode as gate0ExitCode,
|
|
10624
|
-
formatObject as
|
|
11100
|
+
formatObject as formatObject28,
|
|
10625
11101
|
inspectRound as inspectRound2,
|
|
10626
11102
|
loadProtocolFacts,
|
|
10627
11103
|
scan
|
|
10628
11104
|
} from "@hcmai/sdk";
|
|
10629
|
-
import * as
|
|
11105
|
+
import * as path13 from "path";
|
|
10630
11106
|
function renderGate0(result, skillRoot) {
|
|
10631
|
-
const where = skillRoot ? `\uFF08${
|
|
11107
|
+
const where = skillRoot ? `\uFF08${path13.resolve(skillRoot)}\uFF09` : "";
|
|
10632
11108
|
const lines = [
|
|
10633
11109
|
`\u626B\u63CF\u9762${where}\uFF1A${result.scanned.length} \u4E2A\u6587\u4EF6\uFF1B\u5224\u7EA2 ${result.red.length} \u6761\uFF1B\u7F3A\u53E3\u653E\u884C ${result.gaps.length} \u6761\u3002`
|
|
10634
11110
|
];
|
|
@@ -10666,7 +11142,7 @@ async function deliveryGate0Command(args) {
|
|
|
10666
11142
|
const merged = { ...result, premise: premise5 };
|
|
10667
11143
|
const fmt = args.output ?? "json";
|
|
10668
11144
|
if (fmt !== "json") process.stdout.write(renderGate0(merged, skillRoot));
|
|
10669
|
-
process.stdout.write(`${
|
|
11145
|
+
process.stdout.write(`${formatObject28(merged, { format: fmt })}
|
|
10670
11146
|
`);
|
|
10671
11147
|
for (const problem of premise5) {
|
|
10672
11148
|
process.stderr.write(`\u{1F534} \u524D\u63D0\u4E0D\u6210\u7ACB\uFF08${problem.reason}\uFF09\uFF1A${problem.message}
|
|
@@ -10741,7 +11217,7 @@ import {
|
|
|
10741
11217
|
writeRisk
|
|
10742
11218
|
} from "@hcmai/sdk";
|
|
10743
11219
|
import { existsSync as existsSync3 } from "fs";
|
|
10744
|
-
import * as
|
|
11220
|
+
import * as path14 from "path";
|
|
10745
11221
|
function premise(message, hint = "") {
|
|
10746
11222
|
process.stderr.write(message + (hint ? `
|
|
10747
11223
|
\u2192 ${hint}` : "") + "\n");
|
|
@@ -10768,13 +11244,13 @@ async function runSeedPlan(args, client3) {
|
|
|
10768
11244
|
const reconDir = candidates[0].reconDir;
|
|
10769
11245
|
if (candidates.length > 1) {
|
|
10770
11246
|
process.stderr.write(
|
|
10771
|
-
`\u26A0\uFE0F \u540C\u79DF\u6237\u4E0B\u6709 ${candidates.length} \u4EFD\u57FA\u7EBF\uFF0C\u672C\u8F6E\u8BFB\u7684\u662F \`${
|
|
11247
|
+
`\u26A0\uFE0F \u540C\u79DF\u6237\u4E0B\u6709 ${candidates.length} \u4EFD\u57FA\u7EBF\uFF0C\u672C\u8F6E\u8BFB\u7684\u662F \`${path14.basename(reconDir)}\`\uFF1A` + candidates.slice(1).map((c) => `\`${path14.basename(c.reconDir)}\``).join("\u3001") + " \u672A\u88AB\u8BFB\u53D6 \u2014\u2014 \u4E0D\u540C sourceKey \u7684\u4EA7\u7269**\u4E0D\u53EF\u4E92\u6362**\u3002\n"
|
|
10772
11248
|
);
|
|
10773
11249
|
}
|
|
10774
11250
|
const round = inspectRound3(reconDir);
|
|
10775
11251
|
process.stderr.write(roundWarning(round));
|
|
10776
11252
|
const baseline = {
|
|
10777
|
-
path: `${
|
|
11253
|
+
path: `${path14.basename(path14.dirname(reconDir))}/${path14.basename(reconDir)}`,
|
|
10778
11254
|
roundId: round.roundId ?? null
|
|
10779
11255
|
};
|
|
10780
11256
|
let exemptions = null;
|
|
@@ -11035,8 +11511,8 @@ async function deliverySeedVerifyCommand(args) {
|
|
|
11035
11511
|
|
|
11036
11512
|
// src/commands/delivery-seed-find.ts
|
|
11037
11513
|
import { existsSync as existsSync4 } from "fs";
|
|
11038
|
-
import { readFileSync as
|
|
11039
|
-
import * as
|
|
11514
|
+
import { readFileSync as readFileSync7 } from "fs";
|
|
11515
|
+
import * as path15 from "path";
|
|
11040
11516
|
import {
|
|
11041
11517
|
INIT_EXIT_CODES as INIT_EXIT_CODES2,
|
|
11042
11518
|
ValueHints,
|
|
@@ -11050,10 +11526,10 @@ import {
|
|
|
11050
11526
|
valuesRoundCaveat
|
|
11051
11527
|
} from "@hcmai/sdk";
|
|
11052
11528
|
function provenance(chosenReconDir, others) {
|
|
11053
|
-
let line = `> \u57FA\u7EBF\uFF1A\`${
|
|
11529
|
+
let line = `> \u57FA\u7EBF\uFF1A\`${path15.basename(chosenReconDir)}\`
|
|
11054
11530
|
`;
|
|
11055
11531
|
if (others.length > 0) {
|
|
11056
|
-
line += `> \u26A0\uFE0F \u540C\u79DF\u6237\u4E0B\u53E6\u6709 ${others.length} \u4EFD\u57FA\u7EBF\u672A\u88AB\u8BFB\u53D6\uFF1A` + others.map((o) => `\`${
|
|
11532
|
+
line += `> \u26A0\uFE0F \u540C\u79DF\u6237\u4E0B\u53E6\u6709 ${others.length} \u4EFD\u57FA\u7EBF\u672A\u88AB\u8BFB\u53D6\uFF1A` + others.map((o) => `\`${path15.basename(o)}\``).join("\u3001") + " \u2014\u2014 \u4E0D\u540C sourceKey \u7684\u4EA7\u7269**\u4E0D\u53EF\u4E92\u6362**\u3002\n";
|
|
11057
11533
|
}
|
|
11058
11534
|
return `${line}
|
|
11059
11535
|
`;
|
|
@@ -11098,7 +11574,7 @@ function runSeedFind(args) {
|
|
|
11098
11574
|
if (!existsSync4(chosen.indexFile)) {
|
|
11099
11575
|
return premise2(`\u7D22\u5F15\u6587\u4EF6\u5728\u9009\u4E2D\u4E4B\u540E\u6D88\u5931\u4E86\uFF1A${chosen.indexFile}`);
|
|
11100
11576
|
}
|
|
11101
|
-
const { rows, problems } = loadRows(
|
|
11577
|
+
const { rows, problems } = loadRows(readFileSync7(chosen.indexFile, "utf-8"));
|
|
11102
11578
|
process.stdout.write(
|
|
11103
11579
|
renderFind(find(rows, args.term), args.term, rows.length, {
|
|
11104
11580
|
prefixBytes: Buffer.byteLength(prefix, "utf-8"),
|
|
@@ -11138,7 +11614,7 @@ function deliverySeedValuesCommand(model, args) {
|
|
|
11138
11614
|
|
|
11139
11615
|
// src/commands/delivery-meta.ts
|
|
11140
11616
|
init_auth_guard();
|
|
11141
|
-
import { readFileSync as
|
|
11617
|
+
import { readFileSync as readFileSync8 } from "fs";
|
|
11142
11618
|
import {
|
|
11143
11619
|
BINDING_WORDS,
|
|
11144
11620
|
CHANGE_STATES,
|
|
@@ -11286,7 +11762,7 @@ function premise3(what, hint) {
|
|
|
11286
11762
|
async function runDeliveryMeta(args, client3) {
|
|
11287
11763
|
let content;
|
|
11288
11764
|
try {
|
|
11289
|
-
content =
|
|
11765
|
+
content = readFileSync8(args.contentFile, "utf-8");
|
|
11290
11766
|
} catch (e) {
|
|
11291
11767
|
return premise3(
|
|
11292
11768
|
`\u8981\u5199\u8FDB\u53BB\u7684\u6B63\u6587\u8BFB\u4E0D\u51FA\u6765\uFF1A${e.message}`,
|
|
@@ -11389,8 +11865,8 @@ import {
|
|
|
11389
11865
|
ReconLayout as ReconLayout2,
|
|
11390
11866
|
runTriageRound
|
|
11391
11867
|
} from "@hcmai/sdk";
|
|
11392
|
-
import { mkdirSync, readFileSync as
|
|
11393
|
-
import * as
|
|
11868
|
+
import { mkdirSync, readFileSync as readFileSync9, writeFileSync as writeFileSync2 } from "fs";
|
|
11869
|
+
import * as path16 from "path";
|
|
11394
11870
|
var DEFAULT_CAPABILITIES4 = "default";
|
|
11395
11871
|
function premise4(message, hint) {
|
|
11396
11872
|
process.stderr.write(`\u{1F534} \u524D\u63D0\u4E0D\u6210\u7ACB\uFF1A${message}
|
|
@@ -11403,7 +11879,7 @@ var REQUESTS_SHAPE = "`--requests` \u6536\u7684\u662F\u4E00\u4E2A JSON \u6570\u7
|
|
|
11403
11879
|
function readRequests(file) {
|
|
11404
11880
|
let raw;
|
|
11405
11881
|
try {
|
|
11406
|
-
raw = JSON.parse(
|
|
11882
|
+
raw = JSON.parse(readFileSync9(file, "utf8"));
|
|
11407
11883
|
} catch (e) {
|
|
11408
11884
|
throw new Error(`\u9700\u6C42\u6E05\u5355\u8BFB\u4E0D\u51FA\u6765\uFF08${file}\uFF09\uFF1A${e instanceof Error ? e.message : String(e)}`);
|
|
11409
11885
|
}
|
|
@@ -11426,8 +11902,8 @@ function renderProblems(rows) {
|
|
|
11426
11902
|
`;
|
|
11427
11903
|
}
|
|
11428
11904
|
function writeTriageArtifact(outDir, body) {
|
|
11429
|
-
const out =
|
|
11430
|
-
mkdirSync(
|
|
11905
|
+
const out = path16.join(outDir, "work", "triage.md");
|
|
11906
|
+
mkdirSync(path16.dirname(out), { recursive: true });
|
|
11431
11907
|
writeFileSync2(out, body, "utf8");
|
|
11432
11908
|
return out;
|
|
11433
11909
|
}
|
|
@@ -11468,9 +11944,9 @@ async function deliveryTriageCommand(args) {
|
|
|
11468
11944
|
// src/commands/delivery-execution.ts
|
|
11469
11945
|
import { createHash as createHash5, randomBytes as secureRandomBytes } from "crypto";
|
|
11470
11946
|
import { spawn as spawn2 } from "child_process";
|
|
11471
|
-
import { createReadStream, promises as
|
|
11472
|
-
import
|
|
11473
|
-
import { CliError as CliError23, CliErrorCode as CliErrorCode21, formatObject as
|
|
11947
|
+
import { createReadStream, promises as fs13 } from "fs";
|
|
11948
|
+
import path17 from "path";
|
|
11949
|
+
import { CliError as CliError23, CliErrorCode as CliErrorCode21, formatObject as formatObject29 } from "@hcmai/sdk";
|
|
11474
11950
|
init_exit();
|
|
11475
11951
|
var EXECUTION_CONTRACT_VERSION = "2026-09-03.controlled-v4";
|
|
11476
11952
|
var DEFAULT_TTL_SECONDS = 15 * 60;
|
|
@@ -11512,11 +11988,11 @@ async function prepareDeliveryExecution(input) {
|
|
|
11512
11988
|
};
|
|
11513
11989
|
const planId = sha2565(canonicalJson(core)).slice(0, 24);
|
|
11514
11990
|
const plan = { ...core, planId };
|
|
11515
|
-
const plansDir =
|
|
11991
|
+
const plansDir = path17.join(project, ".hcm-delivery", "execution-plans");
|
|
11516
11992
|
await safeManagedDirectory(project, ".hcm-delivery/execution-plans", plansDir);
|
|
11517
|
-
const planFile =
|
|
11993
|
+
const planFile = path17.join(plansDir, `${planId}.json`);
|
|
11518
11994
|
try {
|
|
11519
|
-
await
|
|
11995
|
+
await fs13.writeFile(planFile, `${JSON.stringify(plan, null, 2)}
|
|
11520
11996
|
`, {
|
|
11521
11997
|
encoding: "utf8",
|
|
11522
11998
|
mode: 384,
|
|
@@ -11530,7 +12006,7 @@ async function prepareDeliveryExecution(input) {
|
|
|
11530
12006
|
async function executeDeliveryPlan(input) {
|
|
11531
12007
|
if (!PLAN_ID_PATTERN.test(input.planId)) throw invalid2("planId \u5FC5\u987B\u662F 24 \u4F4D\u5C0F\u5199\u5341\u516D\u8FDB\u5236");
|
|
11532
12008
|
const project = await realProject(input.project);
|
|
11533
|
-
const planFile =
|
|
12009
|
+
const planFile = path17.join(project, ".hcm-delivery", "execution-plans", `${input.planId}.json`);
|
|
11534
12010
|
const plan = await readPlan(project, planFile);
|
|
11535
12011
|
if (plan.planId !== input.planId || computePlanId(plan) !== input.planId) {
|
|
11536
12012
|
throw invalid2("\u6267\u884C\u8BA1\u5212\u5185\u5BB9\u4E0E planId \u6458\u8981\u4E0D\u4E00\u81F4");
|
|
@@ -11567,13 +12043,13 @@ async function executeDeliveryPlan(input) {
|
|
|
11567
12043
|
await assertDocumentUnchanged(project, plan.documents.rollback, "\u56DE\u6EDA\u8BF4\u660E");
|
|
11568
12044
|
await assertPayloadsUnchanged(project, plan.payloads);
|
|
11569
12045
|
const evidenceDir = await bindEvidenceDirectory(project, plan.evidenceDir);
|
|
11570
|
-
const receiptFile =
|
|
12046
|
+
const receiptFile = path17.join(evidenceDir.absolute, `${plan.planId}.receipt.json`);
|
|
11571
12047
|
if (await pathExists(receiptFile)) throw invalid2(`\u6267\u884C\u6536\u636E\u5DF2\u5B58\u5728\uFF0C\u62D2\u7EDD\u518D\u6B21\u6267\u884C\uFF1A${plan.planId}`);
|
|
11572
|
-
const claimsDir =
|
|
12048
|
+
const claimsDir = path17.join(project, ".hcm-delivery", "execution-claims");
|
|
11573
12049
|
await safeManagedDirectory(project, ".hcm-delivery/execution-claims", claimsDir);
|
|
11574
|
-
const claimFile =
|
|
12050
|
+
const claimFile = path17.join(claimsDir, `${plan.planId}.json`);
|
|
11575
12051
|
try {
|
|
11576
|
-
await
|
|
12052
|
+
await fs13.writeFile(
|
|
11577
12053
|
claimFile,
|
|
11578
12054
|
`${JSON.stringify({ schemaVersion: 1, planId: plan.planId, claimedAt: now.toISOString() }, null, 2)}
|
|
11579
12055
|
`,
|
|
@@ -11630,11 +12106,13 @@ async function deliveryPrepareCommand(argv, args) {
|
|
|
11630
12106
|
evidenceDir: args.evidenceDir,
|
|
11631
12107
|
...ttlSeconds === void 0 ? {} : { ttlSeconds }
|
|
11632
12108
|
});
|
|
11633
|
-
process.stdout.write(
|
|
11634
|
-
process.stderr.write(
|
|
12109
|
+
process.stdout.write(formatObject29(plan, { format: args.output ?? "json" }) + "\n");
|
|
12110
|
+
process.stderr.write(
|
|
12111
|
+
`
|
|
11635
12112
|
\u4E0B\u4E00\u6B65\uFF08argv \u5FC5\u987B\u4E0E\u672C\u6B21\u5B8C\u5168\u4E00\u81F4\uFF09\uFF1A
|
|
11636
12113
|
${nextCommandHint(plan.planId, args.project, argv)}
|
|
11637
|
-
`
|
|
12114
|
+
`
|
|
12115
|
+
);
|
|
11638
12116
|
} catch (cause) {
|
|
11639
12117
|
exitWithError(cause);
|
|
11640
12118
|
}
|
|
@@ -11657,17 +12135,20 @@ async function deliveryExecuteCommand(planId, argv, args) {
|
|
|
11657
12135
|
}
|
|
11658
12136
|
}
|
|
11659
12137
|
function writeDeliveryExecutionReceipt(receipt, format = "json") {
|
|
11660
|
-
process.stderr.write(
|
|
12138
|
+
process.stderr.write(formatObject29(receipt, { format }) + "\n");
|
|
11661
12139
|
process.exitCode = receipt.exitCode;
|
|
11662
12140
|
}
|
|
11663
12141
|
async function readProjectMode(project, environment) {
|
|
11664
|
-
const file =
|
|
12142
|
+
const file = path17.join(project, ".hcm-delivery", "project.yml");
|
|
11665
12143
|
const content = await readSafeFile(project, file, "\u9879\u76EE\u914D\u7F6E");
|
|
11666
12144
|
let mode;
|
|
11667
12145
|
try {
|
|
11668
12146
|
mode = deliveryModeForEnvironment(content.toString("utf8"), environment);
|
|
11669
12147
|
} catch (cause) {
|
|
11670
|
-
throw invalid2(
|
|
12148
|
+
throw invalid2(
|
|
12149
|
+
`project.yml \u7684 deliveryMode \u914D\u7F6E\u65E0\u6548\uFF1A${String(cause.message)}`,
|
|
12150
|
+
cause
|
|
12151
|
+
);
|
|
11671
12152
|
}
|
|
11672
12153
|
if (!mode) {
|
|
11673
12154
|
throw invalid2(
|
|
@@ -11677,13 +12158,13 @@ async function readProjectMode(project, environment) {
|
|
|
11677
12158
|
return mode;
|
|
11678
12159
|
}
|
|
11679
12160
|
var SKILLS_LOCK_CANDIDATES = [
|
|
11680
|
-
|
|
11681
|
-
|
|
12161
|
+
path17.join("hcm-skills", ".hcm-skills.json"),
|
|
12162
|
+
path17.join(".claude", "skills", ".hcm-skills.json")
|
|
11682
12163
|
];
|
|
11683
12164
|
async function readSkillsLock(project) {
|
|
11684
12165
|
const found = [];
|
|
11685
12166
|
for (const candidate of SKILLS_LOCK_CANDIDATES) {
|
|
11686
|
-
if (await pathExists(
|
|
12167
|
+
if (await pathExists(path17.join(project, candidate))) found.push(candidate);
|
|
11687
12168
|
}
|
|
11688
12169
|
if (found.length === 0) {
|
|
11689
12170
|
throw invalid2(
|
|
@@ -11695,7 +12176,7 @@ async function readSkillsLock(project) {
|
|
|
11695
12176
|
`\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`
|
|
11696
12177
|
);
|
|
11697
12178
|
}
|
|
11698
|
-
const bytes = await readSafeFile(project,
|
|
12179
|
+
const bytes = await readSafeFile(project, path17.join(project, found[0]), "\u6280\u80FD\u9501");
|
|
11699
12180
|
try {
|
|
11700
12181
|
JSON.parse(bytes.toString("utf8"));
|
|
11701
12182
|
} catch (cause) {
|
|
@@ -11708,7 +12189,7 @@ async function bindDocument(project, reference, label) {
|
|
|
11708
12189
|
if (!(relative2.startsWith("work/") || relative2.startsWith("decisions/"))) {
|
|
11709
12190
|
throw invalid2(`${label}\u5FC5\u987B\u4F4D\u4E8E\u9879\u76EE work/ \u6216 decisions/ \u4E0B`);
|
|
11710
12191
|
}
|
|
11711
|
-
const file =
|
|
12192
|
+
const file = path17.join(project, relative2);
|
|
11712
12193
|
const bytes = await readSafeFile(project, file, label);
|
|
11713
12194
|
return { path: relative2, sha256: sha2565(bytes) };
|
|
11714
12195
|
}
|
|
@@ -11721,11 +12202,11 @@ async function bindEvidenceDirectory(project, reference) {
|
|
|
11721
12202
|
if (!(relative2 === "evidence" || relative2.startsWith("evidence/"))) {
|
|
11722
12203
|
throw invalid2("evidence \u76EE\u5F55\u5FC5\u987B\u4F4D\u4E8E\u9879\u76EE evidence/ \u4E0B");
|
|
11723
12204
|
}
|
|
11724
|
-
const absolute =
|
|
12205
|
+
const absolute = path17.join(project, relative2);
|
|
11725
12206
|
await assertNoSymlinkComponents(project, relative2);
|
|
11726
|
-
const stat = await
|
|
12207
|
+
const stat = await fs13.stat(absolute).catch(() => null);
|
|
11727
12208
|
if (stat === null) {
|
|
11728
|
-
await
|
|
12209
|
+
await fs13.mkdir(absolute, { recursive: true, mode: 448 }).catch((cause) => {
|
|
11729
12210
|
throw invalid2(
|
|
11730
12211
|
`evidence \u76EE\u5F55\u5EFA\u4E0D\u51FA\u6765\uFF1A${relative2}\u3002next_step=\u68C0\u67E5\u4E0A\u7EA7\u76EE\u5F55\u6743\u9650\uFF0C\u6216\u6362\u4E00\u4E2A evidence/ \u4E0B\u7684\u8DEF\u5F84`,
|
|
11731
12212
|
cause
|
|
@@ -11867,7 +12348,10 @@ function requireExactlyOnePayload(argv, command) {
|
|
|
11867
12348
|
}
|
|
11868
12349
|
var PAYLOAD_FILE_FLAGS = ["--data-file", "--params-file", "--file"];
|
|
11869
12350
|
var PAYLOAD_DIR_FLAGS = ["--dir"];
|
|
11870
|
-
var IMPLICIT_DIR_COMMANDS = {
|
|
12351
|
+
var IMPLICIT_DIR_COMMANDS = {
|
|
12352
|
+
"workspace push": ".",
|
|
12353
|
+
"workspace rm": "."
|
|
12354
|
+
};
|
|
11871
12355
|
var TOOLING_DIRS = [".git", "node_modules", ".hcm-delivery", "evidence"];
|
|
11872
12356
|
var POSITIONAL_PAYLOAD_COMMANDS = {
|
|
11873
12357
|
import: { index: 1, kind: "file-or-directory", label: "import \u6570\u636E\u96C6\u8F7D\u8377" },
|
|
@@ -11905,7 +12389,7 @@ async function bindPayloadPath(project, reference, label) {
|
|
|
11905
12389
|
const relative2 = safeRelative(reference, label);
|
|
11906
12390
|
let stat;
|
|
11907
12391
|
try {
|
|
11908
|
-
stat = await
|
|
12392
|
+
stat = await fs13.stat(path17.join(project, relative2));
|
|
11909
12393
|
} catch (cause) {
|
|
11910
12394
|
throw invalid2(
|
|
11911
12395
|
`${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`,
|
|
@@ -11916,10 +12400,10 @@ async function bindPayloadPath(project, reference, label) {
|
|
|
11916
12400
|
}
|
|
11917
12401
|
async function bindPayloadDirectory(project, reference, label) {
|
|
11918
12402
|
const relative2 = reference === "." ? "." : safeRelative(reference, label);
|
|
11919
|
-
const root =
|
|
12403
|
+
const root = path17.join(project, relative2);
|
|
11920
12404
|
let stat;
|
|
11921
12405
|
try {
|
|
11922
|
-
stat = await
|
|
12406
|
+
stat = await fs13.stat(root);
|
|
11923
12407
|
} catch {
|
|
11924
12408
|
throw invalid2(`${label}\u4E0D\u5B58\u5728\uFF1A${relative2}`);
|
|
11925
12409
|
}
|
|
@@ -11929,10 +12413,12 @@ async function bindPayloadDirectory(project, reference, label) {
|
|
|
11929
12413
|
const skipToolingAtRoot = relative2 === ".";
|
|
11930
12414
|
const entries = [];
|
|
11931
12415
|
const walk = async (dir, prefix) => {
|
|
11932
|
-
const items = await
|
|
11933
|
-
for (const item of [...items].sort(
|
|
12416
|
+
const items = await fs13.readdir(dir, { withFileTypes: true });
|
|
12417
|
+
for (const item of [...items].sort(
|
|
12418
|
+
(a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0
|
|
12419
|
+
)) {
|
|
11934
12420
|
if (skipToolingAtRoot && prefix === "" && TOOLING_DIRS.includes(item.name)) continue;
|
|
11935
|
-
const child =
|
|
12421
|
+
const child = path17.join(dir, item.name);
|
|
11936
12422
|
const rel = prefix ? `${prefix}/${item.name}` : item.name;
|
|
11937
12423
|
if (item.isSymbolicLink()) {
|
|
11938
12424
|
throw invalid2(
|
|
@@ -11957,7 +12443,7 @@ ${sha2565(bytes)}`);
|
|
|
11957
12443
|
}
|
|
11958
12444
|
async function bindPayloadFile(project, reference, label) {
|
|
11959
12445
|
const relative2 = safeRelative(reference, label);
|
|
11960
|
-
const file =
|
|
12446
|
+
const file = path17.join(project, relative2);
|
|
11961
12447
|
const bytes = await readSafeFile(project, file, label);
|
|
11962
12448
|
return { path: relative2, kind: "file", sha256: sha2565(bytes) };
|
|
11963
12449
|
}
|
|
@@ -12020,29 +12506,29 @@ async function runCurrentCliCommand(argv, cwd, streams) {
|
|
|
12020
12506
|
async function writeReceiptExclusive(target, receipt) {
|
|
12021
12507
|
const temp = `${target}.${process.pid}.${Date.now()}.tmp`;
|
|
12022
12508
|
try {
|
|
12023
|
-
await
|
|
12509
|
+
await fs13.writeFile(temp, `${JSON.stringify(receipt, null, 2)}
|
|
12024
12510
|
`, {
|
|
12025
12511
|
encoding: "utf8",
|
|
12026
12512
|
mode: 384,
|
|
12027
12513
|
flag: "wx"
|
|
12028
12514
|
});
|
|
12029
|
-
await
|
|
12515
|
+
await fs13.link(temp, target);
|
|
12030
12516
|
} catch (cause) {
|
|
12031
|
-
throw invalid2(`\u6267\u884C\u6536\u636E\u5199\u5165\u5931\u8D25\u6216\u5DF2\u5B58\u5728\uFF1A${
|
|
12517
|
+
throw invalid2(`\u6267\u884C\u6536\u636E\u5199\u5165\u5931\u8D25\u6216\u5DF2\u5B58\u5728\uFF1A${path17.basename(target)}`, cause);
|
|
12032
12518
|
} finally {
|
|
12033
|
-
await
|
|
12519
|
+
await fs13.unlink(temp).catch(() => void 0);
|
|
12034
12520
|
}
|
|
12035
12521
|
}
|
|
12036
12522
|
async function safeManagedDirectory(project, relative2, absolute) {
|
|
12037
|
-
await assertNoSymlinkComponents(project,
|
|
12038
|
-
const existing = await
|
|
12523
|
+
await assertNoSymlinkComponents(project, path17.dirname(relative2));
|
|
12524
|
+
const existing = await fs13.lstat(absolute).catch(() => void 0);
|
|
12039
12525
|
if (existing?.isSymbolicLink()) throw invalid2(`\u53D7\u7BA1\u76EE\u5F55\u4E0D\u80FD\u662F\u7B26\u53F7\u94FE\u63A5\uFF1A${relative2}`);
|
|
12040
12526
|
if (existing && !existing.isDirectory()) throw invalid2(`\u53D7\u7BA1\u8DEF\u5F84\u4E0D\u662F\u76EE\u5F55\uFF1A${relative2}`);
|
|
12041
|
-
if (!existing) await
|
|
12042
|
-
await
|
|
12527
|
+
if (!existing) await fs13.mkdir(absolute, { mode: 448 });
|
|
12528
|
+
await fs13.chmod(absolute, 448);
|
|
12043
12529
|
}
|
|
12044
12530
|
async function pathExists(file) {
|
|
12045
|
-
return
|
|
12531
|
+
return fs13.lstat(file).then(
|
|
12046
12532
|
() => true,
|
|
12047
12533
|
(cause) => {
|
|
12048
12534
|
if (cause.code === "ENOENT") return false;
|
|
@@ -12051,47 +12537,47 @@ async function pathExists(file) {
|
|
|
12051
12537
|
);
|
|
12052
12538
|
}
|
|
12053
12539
|
async function readSafeFile(project, file, label) {
|
|
12054
|
-
const relative2 =
|
|
12055
|
-
if (relative2.startsWith("../") ||
|
|
12540
|
+
const relative2 = path17.relative(project, file).split(path17.sep).join("/");
|
|
12541
|
+
if (relative2.startsWith("../") || path17.isAbsolute(relative2))
|
|
12056
12542
|
throw invalid2(`${label}\u8DEF\u5F84\u9003\u9038\u9879\u76EE`);
|
|
12057
12543
|
await assertNoSymlinkComponents(project, relative2);
|
|
12058
12544
|
let stat;
|
|
12059
12545
|
try {
|
|
12060
|
-
stat = await
|
|
12546
|
+
stat = await fs13.lstat(file);
|
|
12061
12547
|
} catch (cause) {
|
|
12062
12548
|
throw invalid2(`${label}\u4E0D\u53EF\u7528\uFF1A${relative2}`, cause);
|
|
12063
12549
|
}
|
|
12064
12550
|
if (stat.isSymbolicLink()) throw invalid2(`${label}\u4E0D\u80FD\u662F\u7B26\u53F7\u94FE\u63A5\uFF1A${relative2}`);
|
|
12065
12551
|
if (!stat.isFile()) throw invalid2(`${label}\u4E0D\u662F\u666E\u901A\u6587\u4EF6\uFF1A${relative2}`);
|
|
12066
|
-
return
|
|
12552
|
+
return fs13.readFile(file);
|
|
12067
12553
|
}
|
|
12068
12554
|
async function assertNoSymlinkComponents(project, relative2) {
|
|
12069
12555
|
const parts = relative2.split("/").filter(Boolean);
|
|
12070
12556
|
let current = project;
|
|
12071
12557
|
for (const part of parts) {
|
|
12072
|
-
current =
|
|
12073
|
-
const stat = await
|
|
12558
|
+
current = path17.join(current, part);
|
|
12559
|
+
const stat = await fs13.lstat(current).catch(() => void 0);
|
|
12074
12560
|
if (stat?.isSymbolicLink()) throw invalid2(`\u8DEF\u5F84\u5305\u542B\u7B26\u53F7\u94FE\u63A5\uFF1A${relative2}`);
|
|
12075
12561
|
if (!stat) break;
|
|
12076
12562
|
}
|
|
12077
12563
|
}
|
|
12078
12564
|
async function realProject(requested) {
|
|
12079
|
-
const absolute =
|
|
12565
|
+
const absolute = path17.resolve(requested);
|
|
12080
12566
|
let project;
|
|
12081
12567
|
try {
|
|
12082
|
-
project = await
|
|
12568
|
+
project = await fs13.realpath(absolute);
|
|
12083
12569
|
} catch (cause) {
|
|
12084
12570
|
throw invalid2(`\u9879\u76EE\u76EE\u5F55\u4E0D\u53EF\u7528\uFF1A${absolute}`, cause);
|
|
12085
12571
|
}
|
|
12086
|
-
const stat = await
|
|
12572
|
+
const stat = await fs13.stat(project);
|
|
12087
12573
|
if (!stat.isDirectory()) throw invalid2(`\u9879\u76EE\u8DEF\u5F84\u4E0D\u662F\u76EE\u5F55\uFF1A${absolute}`);
|
|
12088
12574
|
return project;
|
|
12089
12575
|
}
|
|
12090
12576
|
function safeRelative(reference, label) {
|
|
12091
|
-
if (!reference ||
|
|
12577
|
+
if (!reference || path17.isAbsolute(reference) || /[\r\n\0]/.test(reference)) {
|
|
12092
12578
|
throw invalid2(`${label}\u5FC5\u987B\u662F\u9879\u76EE\u5185\u76F8\u5BF9\u8DEF\u5F84`);
|
|
12093
12579
|
}
|
|
12094
|
-
const normalized =
|
|
12580
|
+
const normalized = path17.normalize(reference).split(path17.sep).join("/");
|
|
12095
12581
|
if (normalized === ".." || normalized.startsWith("../") || normalized === ".") {
|
|
12096
12582
|
throw invalid2(`${label}\u8DEF\u5F84\u9003\u9038\u9879\u76EE`);
|
|
12097
12583
|
}
|
|
@@ -12158,7 +12644,7 @@ init_exit();
|
|
|
12158
12644
|
import {
|
|
12159
12645
|
HcmClient as HcmClient28,
|
|
12160
12646
|
adminResetPassword,
|
|
12161
|
-
formatObject as
|
|
12647
|
+
formatObject as formatObject30,
|
|
12162
12648
|
fromAxiosError as fromAxiosError23,
|
|
12163
12649
|
CliError as CliError24,
|
|
12164
12650
|
CliErrorCode as CliErrorCode22
|
|
@@ -12192,7 +12678,7 @@ async function userResetPasswordCommand(args) {
|
|
|
12192
12678
|
const request = buildAdminResetPasswordRequest(args, password);
|
|
12193
12679
|
const client3 = HcmClient28.fromAuthContext(await getActiveAuthContextFromCli(args));
|
|
12194
12680
|
const result = await adminResetPassword(client3.raw(), request);
|
|
12195
|
-
process.stdout.write(
|
|
12681
|
+
process.stdout.write(formatObject30(result, { format: args.output ?? "json" }) + "\n");
|
|
12196
12682
|
} catch (cause) {
|
|
12197
12683
|
const err = cause;
|
|
12198
12684
|
if (err?.isAxiosError) exitWithError(fromAxiosError23(err, args.env));
|
|
@@ -12216,7 +12702,7 @@ init_exit();
|
|
|
12216
12702
|
init_auth_guard();
|
|
12217
12703
|
import {
|
|
12218
12704
|
HcmClient as HcmClient29,
|
|
12219
|
-
formatObject as
|
|
12705
|
+
formatObject as formatObject31,
|
|
12220
12706
|
fromAxiosError as fromAxiosError24
|
|
12221
12707
|
} from "@hcmai/sdk";
|
|
12222
12708
|
async function modelsCommand(keyword, args) {
|
|
@@ -12227,7 +12713,7 @@ async function modelsCommand(keyword, args) {
|
|
|
12227
12713
|
const rows = (needle ? all.filter((m) => JSON.stringify(m).toLowerCase().includes(needle)) : all).sort((a, b) => key(a).localeCompare(key(b)));
|
|
12228
12714
|
const fmt = args.output ?? "table";
|
|
12229
12715
|
if (fmt !== "table") {
|
|
12230
|
-
process.stdout.write(
|
|
12716
|
+
process.stdout.write(formatObject31({ total: rows.length, models: rows }, { format: fmt }) + "\n");
|
|
12231
12717
|
process.exitCode = 0;
|
|
12232
12718
|
return;
|
|
12233
12719
|
}
|
|
@@ -12277,11 +12763,17 @@ var exitOnBrokenPipe = (err) => {
|
|
|
12277
12763
|
};
|
|
12278
12764
|
process.stdout.on("error", exitOnBrokenPipe);
|
|
12279
12765
|
process.stderr.on("error", exitOnBrokenPipe);
|
|
12280
|
-
program.name("hcm").description("HCM \u547D\u4EE4\u884C\u5DE5\u5177 \u2014 \u64CD\u4F5C HCM API\u3001\u4E0E Moirai \u6570\u5B57\u5458\u5DE5\u5BF9\u8BDD\u3001\u5F00\u53D1\u79DF\u6237\u5F00\u53D1\u7A7A\u95F4").version(CLI_VERSION).option(
|
|
12766
|
+
program.name("hcm").description("HCM \u547D\u4EE4\u884C\u5DE5\u5177 \u2014 \u64CD\u4F5C HCM API\u3001\u4E0E Moirai \u6570\u5B57\u5458\u5DE5\u5BF9\u8BDD\u3001\u5F00\u53D1\u79DF\u6237\u5F00\u53D1\u7A7A\u95F4").version(CLI_VERSION).option(
|
|
12767
|
+
"--lang <code>",
|
|
12768
|
+
"\u8BF7\u6C42\u8BED\u8A00\uFF1Azh_CN | zh_HK | en\uFF08\u7B49\u4EF7\u4E8E\u73AF\u5883\u53D8\u91CF HCM_LANG\uFF1B\u4E0D\u7ED9\u6309\u670D\u52A1\u7AEF\u7F3A\u7701\u8BED\u8A00\uFF09"
|
|
12769
|
+
).hook("preAction", (thisCommand) => {
|
|
12281
12770
|
const lang = thisCommand.opts().lang;
|
|
12282
12771
|
if (lang) process.env.HCM_LANG = lang;
|
|
12283
12772
|
});
|
|
12284
|
-
program.command("login").description("\u767B\u5F55 HCM\uFF08\u914D\u5BF9\u7801 / \u7528\u6237\u540D\u5BC6\u7801 / client_credentials / PAT \u56DB\u79CD\u65B9\u5F0F\uFF09").argument("[endpoint]", "\u4ECE\u7CFB\u7EDF\u9875\u9762\u300C\u547D\u4EE4\u884C\u5DE5\u5177\u300D\u590D\u5236\u6765\u7684\u5730\u5740\uFF08\u914D\u5BF9\u7801\u65B9\u5F0F\uFF09").option("--code <code>", "\u914D\u5BF9\u7801\uFF0C\u5728\u7CFB\u7EDF\u9875\u9762\u7528\u6237\u83DC\u5355 \u2192\u300C\u547D\u4EE4\u884C\u5DE5\u5177\u300D\u751F\u6210").option("--env <name>", "\u73AF\u5883\u540D\uFF08\u9ED8\u8BA4 activeEnv\uFF09").option("--profile <name>", "[deprecated] \u7528 --env \u66FF\u4EE3").option("--name <id-name>", "\u81EA\u5B9A\u4E49 identity \u540D\uFF08\u9ED8\u8BA4\u6309 scheme \u63A8\u65AD\uFF09").option("--no-activate", "login \u5B8C\u4E0D\u5207\u5230\u8BE5\u73AF\u5883\u4E5F\u4E0D\u8BBE\u4E3A default identity").option("--endpoint <url>", "HCM \u540E\u7AEF\u5730\u5740\uFF0C\u4F8B\u5982 http://localhost:8080").option("--username <user>", "\u7528\u6237\u540D\uFF08\u5BC6\u7801\u767B\u5F55\u6A21\u5F0F\uFF09").option("--password <pwd>", "\u5BC6\u7801\uFF08\u5BC6\u7801\u767B\u5F55\u6A21\u5F0F\uFF1B\u4F1A\u6CC4\u6F0F\u5230 history/ps\uFF0CAgent/\u53D7\u63A7\u4EA4\u4ED8\u8BF7\u7528 --password-stdin\uFF09").option("--password-stdin", "\u4ECE\u6807\u51C6\u8F93\u5165\u8BFB\u5BC6\u7801\uFF08\u5BC6\u7801\u767B\u5F55\u6A21\u5F0F\uFF0C\u975E\u4EA4\u4E92/\u4E0D\u56DE\u663E\uFF09").option("--client-id <id>", "OAuth client_id\uFF08client_credentials \u6A21\u5F0F\uFF09").option("--client-secret <secret>", "OAuth client_secret\uFF08client_credentials \u6A21\u5F0F\uFF09").option("--pat <token>", "PAT \u4E2A\u4EBA\u8BBF\u95EE\u4EE4\u724C\uFF08\u6CE8\u610F\uFF1A\u4F1A\u6CC4\u6F0F\u5230 ps/history\uFF0C\u5EFA\u8BAE\u6539\u7528 --pat-stdin\uFF09").option("--pat-stdin", "\u4ECE\u6807\u51C6\u8F93\u5165\u8BFB\u53D6 PAT\uFF08\u63A8\u8350\uFF09").option(
|
|
12773
|
+
program.command("login").description("\u767B\u5F55 HCM\uFF08\u914D\u5BF9\u7801 / \u7528\u6237\u540D\u5BC6\u7801 / client_credentials / PAT \u56DB\u79CD\u65B9\u5F0F\uFF09").argument("[endpoint]", "\u4ECE\u7CFB\u7EDF\u9875\u9762\u300C\u547D\u4EE4\u884C\u5DE5\u5177\u300D\u590D\u5236\u6765\u7684\u5730\u5740\uFF08\u914D\u5BF9\u7801\u65B9\u5F0F\uFF09").option("--code <code>", "\u914D\u5BF9\u7801\uFF0C\u5728\u7CFB\u7EDF\u9875\u9762\u7528\u6237\u83DC\u5355 \u2192\u300C\u547D\u4EE4\u884C\u5DE5\u5177\u300D\u751F\u6210").option("--env <name>", "\u73AF\u5883\u540D\uFF08\u9ED8\u8BA4 activeEnv\uFF09").option("--profile <name>", "[deprecated] \u7528 --env \u66FF\u4EE3").option("--name <id-name>", "\u81EA\u5B9A\u4E49 identity \u540D\uFF08\u9ED8\u8BA4\u6309 scheme \u63A8\u65AD\uFF09").option("--no-activate", "login \u5B8C\u4E0D\u5207\u5230\u8BE5\u73AF\u5883\u4E5F\u4E0D\u8BBE\u4E3A default identity").option("--endpoint <url>", "HCM \u540E\u7AEF\u5730\u5740\uFF0C\u4F8B\u5982 http://localhost:8080").option("--username <user>", "\u7528\u6237\u540D\uFF08\u5BC6\u7801\u767B\u5F55\u6A21\u5F0F\uFF09").option("--password <pwd>", "\u5BC6\u7801\uFF08\u5BC6\u7801\u767B\u5F55\u6A21\u5F0F\uFF1B\u4F1A\u6CC4\u6F0F\u5230 history/ps\uFF0CAgent/\u53D7\u63A7\u4EA4\u4ED8\u8BF7\u7528 --password-stdin\uFF09").option("--password-stdin", "\u4ECE\u6807\u51C6\u8F93\u5165\u8BFB\u5BC6\u7801\uFF08\u5BC6\u7801\u767B\u5F55\u6A21\u5F0F\uFF0C\u975E\u4EA4\u4E92/\u4E0D\u56DE\u663E\uFF09").option("--client-id <id>", "OAuth client_id\uFF08client_credentials \u6A21\u5F0F\uFF09").option("--client-secret <secret>", "OAuth client_secret\uFF08client_credentials \u6A21\u5F0F\uFF09").option("--pat <token>", "PAT \u4E2A\u4EBA\u8BBF\u95EE\u4EE4\u724C\uFF08\u6CE8\u610F\uFF1A\u4F1A\u6CC4\u6F0F\u5230 ps/history\uFF0C\u5EFA\u8BAE\u6539\u7528 --pat-stdin\uFF09").option("--pat-stdin", "\u4ECE\u6807\u51C6\u8F93\u5165\u8BFB\u53D6 PAT\uFF08\u63A8\u8350\uFF09").option(
|
|
12774
|
+
"--new-password <pwd>",
|
|
12775
|
+
"\u9996\u767B\u5F3A\u5236\u6539\u5BC6\u65F6\u7684\u65B0\u53E3\u4EE4\uFF08\u4F1A\u6CC4\u6F0F\u5230 history/ps\uFF0C\u5EFA\u8BAE --new-password-stdin\uFF09"
|
|
12776
|
+
).option("--new-password-stdin", "\u9996\u767B\u5F3A\u5236\u6539\u5BC6\u65F6\u4ECE\u6807\u51C6\u8F93\u5165\u8BFB\u65B0\u53E3\u4EE4\uFF08\u975E\u4EA4\u4E92\u573A\u666F\uFF09").option("--tenant <tenantId>", "\u79DF\u6237 ID\uFF08\u9ED8\u8BA4 1\uFF09").action((endpoint, opts) => loginCommand({ ...opts, endpointArg: endpoint }));
|
|
12285
12777
|
program.command("logout").description("\u767B\u51FA HCM\uFF08\u6E05\u9664 identity \u7684 keychain token\uFF09").option("--identity <name>", "\u6307\u5B9A identity\uFF1B\u9ED8\u8BA4\u6E05\u5F53\u524D env \u7684 default identity").option("--env <name>", "\u6307\u5B9A env\uFF08\u5F71\u54CD default identity \u89E3\u6790\uFF09").action((opts) => logoutCommand(opts));
|
|
12286
12778
|
var config = program.command("config").description("\u7BA1\u7406\u5168\u5C40 defaults\uFF08env/identity \u7528 `hcm env` / `hcm identity`\uFF09");
|
|
12287
12779
|
config.command("list").description("[deprecated] \u7528 `hcm env list`").action(() => configListDeprecated());
|
|
@@ -12307,8 +12799,13 @@ identity.command("remove <name>").description("\u5220\u9664 identity\uFF08\u6E05
|
|
|
12307
12799
|
var user = program.command("user").description("\u7BA1\u7406\u79DF\u6237\u7528\u6237\u7684\u4E13\u7528\u51ED\u636E\u6D41\u7A0B");
|
|
12308
12800
|
user.command("reset-password").description("\u7531 admin.system \u5B89\u5168\u91CD\u7F6E\u7528\u6237\u5BC6\u7801\uFF0C\u5E76\u4F7F\u65E2\u6709\u4F1A\u8BDD\u5931\u6548").option("--id <uuid>", "\u76EE\u6807\u7528\u6237 ID\uFF08\u4E0E --username \u4E8C\u9009\u4E00\uFF09").option("--username <user>", "\u76EE\u6807\u7528\u6237\u540D\uFF08\u4E0E --id \u4E8C\u9009\u4E00\uFF09").option("--password-stdin", "\u4ECE\u6807\u51C6\u8F93\u5165\u8BFB\u53D6\u65B0\u5BC6\u7801\uFF08Agent/\u53D7\u63A7\u4EA4\u4ED8\u5FC5\u987B\u4F7F\u7528\uFF09").option("--no-force-change", "\u4E0B\u6B21\u767B\u5F55\u4E0D\u5F3A\u5236\u6539\u5BC6\uFF08\u4EC5\u9650\u5DF2\u6279\u51C6\u7684\u9694\u79BB\u6D4B\u8BD5\u73AF\u5883\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\uFF08\u5FC5\u987B\u5177\u5907 admin.system\uFF09").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "json").action((opts) => userResetPasswordCommand(opts));
|
|
12309
12801
|
var chiron = program.command("chiron").description("\u777F\u620E\u987E\u95EE\u9879\u76EE\uFF1Ainit \u4E00\u6761\u547D\u4EE4\u521D\u59CB\u5316\u9879\u76EE\u4ED3\uFF0Cdoctor \u56DB\u884C\u6838\u5BF9\u80FD\u4E0D\u80FD\u5F00\u5DE5");
|
|
12310
|
-
chiron.command("init").description(
|
|
12311
|
-
|
|
12802
|
+
chiron.command("init").description(
|
|
12803
|
+
"\u521D\u59CB\u5316\u987E\u95EE\u9879\u76EE\u4ED3\uFF1A\u5199 env.yaml\uFF08\u7528\u521A hcm login \u7684\u73AF\u5883\uFF09\u3001\u5EFA\u76EE\u5F55\u3001\u88C5\u5168\u90E8\u6280\u80FD\u3001\u63A5\u6848\u4F8B\u5E93\uFF1B\u91CD\u8DD1\u5B89\u5168"
|
|
12804
|
+
).option("--project <dir>", "\u9879\u76EE\u6839\u76EE\u5F55", ".").option("--skip-skills", "\u4E0D\u88C5\u6280\u80FD\uFF08\u79BB\u7EBF/\u6D4B\u8BD5\uFF09").option("--skip-cases", "\u4E0D\u63A5\u6848\u4F8B\u5E93").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "table").action((opts) => chironInitCommand(opts));
|
|
12805
|
+
chiron.command("test").description("\u6309\u7528\u4F8B\u8DD1\u4E00\u904D\u5E76\u628A\u95EE\u9898\u627E\u51FA\u6765\uFF1A\u7528\u4F8B\u5728\u9879\u76EE\u4ED3 tests/\uFF0C\u5224\u636E\u5FC5\u987B\u770B\u5185\u5BB9\uFF08\u53EA\u5224\u9000\u51FA\u7801\u7684\u7528\u4F8B\u4F1A\u88AB\u62D2\u7EDD\u52A0\u8F7D\uFF09").argument("[target]", "\u7528\u4F8B\u6587\u4EF6\u6216\u76EE\u5F55\uFF08\u9ED8\u8BA4 tests/\uFF09").option("--project <dir>", "\u9879\u76EE\u6839\u76EE\u5F55", ".").option("--env <name>", "\u76EE\u6807\u73AF\u5883\uFF1B\u7528\u4F8B\u91CC\u6CA1\u5199 --env \u65F6\u8865\u4E0A").option("--as <identity>", "\u8EAB\u4EFD\uFF1B\u7528\u4F8B\u91CC\u6CA1\u5199 --as \u65F6\u8865\u4E0A").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "table").action((target, opts) => chironTestCommand(target, opts));
|
|
12806
|
+
chiron.command("doctor").description(
|
|
12807
|
+
"\u6838\u5BF9\uFF1A\u672C\u673A\u767B\u5F55\u662F\u5426\u5BF9\u7740 env.yaml \u7684\u73AF\u5883\uFF08\u542B\u56DB\u6761\u951A\u70B9\uFF09/ \u6280\u80FD\u88C5\u6CA1\u88C5 / \u6848\u4F8B\u5E93\u63A5\u6CA1\u63A5 / Jira \u80FD\u4E0D\u80FD\u63D0\u5355"
|
|
12808
|
+
).option("--project <dir>", "\u9879\u76EE\u6839\u76EE\u5F55", ".").option("--fix", "\u80FD\u81EA\u52A8\u8865\u7684\u8865\u4E0A\uFF08\u6280\u80FD / \u6848\u4F8B\u5E93\uFF09\u540E\u518D\u6838\u4E00\u904D").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "table").action((opts) => chironDoctorCommand(opts));
|
|
12312
12809
|
var delivery = program.command("delivery").description("\u987E\u95EE\u4EA4\u4ED8\uFF1A\u73B0\u573A\u63A2\u6D3B\u3001\u98CE\u9669\u8BC4\u4F30\u4E0E\u4E00\u6B21\u6027\u53D7\u63A7\u6267\u884C\u5408\u540C");
|
|
12313
12810
|
delivery.command("assess").description("\u8BC4\u4F30\u4E00\u6B21 HCM CLI argv\uFF1BAction \u98CE\u63A7\u58F0\u660E\u8BFB\u53D6\u81EA\u76EE\u6807 Core\uFF0C\u7528 -- \u5206\u9694\u88AB\u8BC4\u4F30\u547D\u4EE4").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "json").allowUnknownOption(true).argument("<command...>", "\u88AB\u8BC4\u4F30\u7684 HCM \u5B50\u547D\u4EE4\u4E0E\u53C2\u6570\uFF0C\u4E0D\u5305\u542B hcm \u672C\u8EAB").action((command, opts) => deliveryAssessCommand(command, opts));
|
|
12314
12811
|
delivery.command("doctor").description("\u56DB\u6761\u951A\u70B9\u63A2\u6D3B\uFF1A\u8FDE\u901A / \u6211\u662F\u8C01 / configAdmin / \u7AD9\u5728\u54EA\u4E00\u5C42").option("--env <name>", "\u76EE\u6807\u73AF\u5883\u522B\u540D").option("--as <identity>", "\u4E34\u65F6\u6362\u8EAB\u4EFD").option("--capabilities <s>", "\u722C\u53D6\u65F6\u58F0\u660E\u7684 capability \u4E32\uFF08\u4F1A\u968F\u56DB\u5143\u7EC4\u7559\u6863\uFF09").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "json").action((opts) => deliveryDoctorCommand(opts));
|
|
@@ -12333,9 +12830,7 @@ seed.command("values").argument("<model>", "\u7801\u8868\u6A21\u578B\u540D\uFF08
|
|
|
12333
12830
|
(v) => Number(v)
|
|
12334
12831
|
).action((model, opts) => deliverySeedValuesCommand(model, opts));
|
|
12335
12832
|
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));
|
|
12336
|
-
seed.command("apply").description(
|
|
12337
|
-
"\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`"
|
|
12338
|
-
).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("--execute", "\u771F\u5199\u3002\u4E0D\u52A0\u5219\u662F\u5E72\u8DD1", false).option("--resume", "\u8FD9\u4E2A work \u76EE\u5F55\u5DF2\u6709\u53F0\u8D26\u65F6\u63A5\u7740\u8DD1\uFF08kit \u7EDD\u4E0D\u66FF\u4F60\u5220\u53F0\u8D26\uFF09", false).option("--sample <n>", "\u672C\u8F6E\u6700\u591A\u82B1 n \u4E2A\u5199\u8BF7\u6C42\uFF0C\u5E76\u5BF9\u5B83\u4EEC\u9010\u884C\u56DE\u8BFB\u590D\u9A8C", (v) => Number(v)).option(
|
|
12833
|
+
seed.command("apply").description("\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`").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("--execute", "\u771F\u5199\u3002\u4E0D\u52A0\u5219\u662F\u5E72\u8DD1", false).option("--resume", "\u8FD9\u4E2A work \u76EE\u5F55\u5DF2\u6709\u53F0\u8D26\u65F6\u63A5\u7740\u8DD1\uFF08kit \u7EDD\u4E0D\u66FF\u4F60\u5220\u53F0\u8D26\uFF09", false).option("--sample <n>", "\u672C\u8F6E\u6700\u591A\u82B1 n \u4E2A\u5199\u8BF7\u6C42\uFF0C\u5E76\u5BF9\u5B83\u4EEC\u9010\u884C\u56DE\u8BFB\u590D\u9A8C", (v) => Number(v)).option(
|
|
12339
12834
|
"--force-stale",
|
|
12340
12835
|
"\u57FA\u7EBF\u4E0E\u8FD9\u4E2A\u73AF\u5883\u5BF9\u4E0D\u4E0A\u65F6\u4ECD\u7136\u653E\u884C\uFF0C\u5E76\u628A\u8FD9\u4E00\u7B14\u8BB0\u8FDB\u53F0\u8D26\u3002\u26A0\uFE0F \u4E0D\u8C41\u514D\u300C\u8BA1\u5212 vs \u57FA\u7EBF\u300D\u4E0E\u300C\u57FA\u7EBF\u662F\u4E0D\u662F\u4E00\u8F6E\u300D\u4E24\u6761\u524D\u63D0",
|
|
12341
12836
|
false
|
|
@@ -12349,7 +12844,13 @@ seed.command("verify").description(
|
|
|
12349
12844
|
).action((opts) => deliverySeedVerifyCommand(opts));
|
|
12350
12845
|
delivery.command("meta").description(
|
|
12351
12846
|
`\u6539\u4E00\u4EFD\u79DF\u6237 meta\uFF08\u5199 \u2192 \u6E05\u7F13\u5B58 \u2192 \u5B9A\u5411\u91CD\u722C \u2192 diff \u70B9\u540D\u5B57\u6BB5\uFF09\uFF0C\u5168\u7A0B\u5E26\u8865\u507F\u53F0\u8D26\u3002\u52A0 \`${VERIFY_ACTIVE_FLAG}\` \u518D\u7AD9\u5230 active \u5C42\u770B\u4E00\u773C**\u771F\u5B9E\u7528\u6237**\u770B\u5F97\u89C1\u4EC0\u4E48`
|
|
12352
|
-
).option("--env <name>", "\u76EE\u6807\u73AF\u5883\u522B\u540D").option("--profile <name>", "\u8EAB\u4EFD\u6863\u6848").option("--as <identity>", "\u4E34\u65F6\u6362\u8EAB\u4EFD").requiredOption(
|
|
12847
|
+
).option("--env <name>", "\u76EE\u6807\u73AF\u5883\u522B\u540D").option("--profile <name>", "\u8EAB\u4EFD\u6863\u6848").option("--as <identity>", "\u4E34\u65F6\u6362\u8EAB\u4EFD").requiredOption(
|
|
12848
|
+
"--layer <layer>",
|
|
12849
|
+
"\u58F0\u660E\u8981\u5199\u7684\u90A3\u4E00\u5C42\uFF08\u5982 `ws:poc-cnpc`\uFF09\uFF0C\u5FC5\u987B\u4E0E\u5F53\u524D\u5F00\u53D1\u8005\u6A21\u5F0F\u7ED1\u5B9A\u7B97\u51FA\u6765\u7684\u5C42\u76F8\u7B49"
|
|
12850
|
+
).requiredOption("--workspace <key>", "\u6B64\u523B\u7ED1\u7740\u7684\u5F00\u53D1\u7A7A\u95F4 key").requiredOption("--model <name>", "\u6A21\u578B\u540D").requiredOption("--meta-path <path>", "\u79DF\u6237 meta \u91CC\u90A3\u4EFD\u6587\u4EF6\u7684\u8DEF\u5F84").requiredOption(
|
|
12851
|
+
"--content-file <file>",
|
|
12852
|
+
"\u8981\u5199\u8FDB\u53BB\u7684 yml \u6B63\u6587\uFF08**\u8FD9\u53F0\u673A\u5668\u4E0A**\u90A3\u4EFD\uFF0C\u672C\u5DE5\u5177\u4E0D\u66FF\u4F60\u62FC\u5185\u5BB9\uFF09"
|
|
12853
|
+
).requiredOption(
|
|
12353
12854
|
"--expect-field <key>",
|
|
12354
12855
|
"\u70B9\u540D\u8981\u770B\u5230\u7684\u5B57\u6BB5 key\uFF0C\u53EF\u91CD\u590D\u3002**\u81F3\u5C11\u4E00\u4E2A**\uFF1A\u70B9\u540D\u4E3A\u7A7A\u65F6\u6BD4\u5BF9\u6052\u6210\u7ACB\uFF0C\u8BF4\u4E0D\u51FA\u6539\u52A8\u5230\u4F4D\u6CA1\u6709",
|
|
12355
12856
|
(v, acc) => [...acc, v],
|
|
@@ -12359,9 +12860,7 @@ delivery.command("meta").description(
|
|
|
12359
12860
|
"\u5199\u5B8C\u4E4B\u540E**\u771F\u7684**\u628A\u5F00\u53D1\u8005\u6A21\u5F0F\u7ED1\u5B9A\u632A\u5F00\u4E00\u6B21\uFF0C\u7AD9\u5230 active \u5C42\u770B\u4E00\u773C\u518D\u632A\u56DE\u6765\u3002\u26A0\uFE0F \u7ED1\u5B9A\u6309\u7528\u6237\u5B58\uFF0C\u7A97\u53E3\u671F\u91CC\u4F60\u8FD9\u4E2A\u8D26\u53F7\u7684\u522B\u7684\u8BF7\u6C42\u4F1A\u4E00\u8D77\u843D\u5230 active",
|
|
12360
12861
|
false
|
|
12361
12862
|
).action((opts) => deliveryMetaCommand(opts));
|
|
12362
|
-
delivery.command("gate0").description(
|
|
12363
|
-
"\u96F6\u7F51\u7EDC\uFF1A\u626B\u4E00\u4EFD skill \u7684\u6B63\u6587\uFF0C\u628A\u73AF\u5883\u4E8B\u5B9E / \u672A\u767B\u8BB0\u7684\u534F\u8BAE\u5F62\u6001 / \u4EA7\u7269\u8DEF\u5F84\u6321\u5728\u6210\u7A3F\u4E4B\u5916"
|
|
12364
|
-
).requiredOption("--skills <dir>", "\u8981\u626B\u7684 skill \u6839\u76EE\u5F55\uFF08\u6B63\u6587 + references/ \u5168\u76EE\u5F55\uFF0C\u540C\u4E00\u5224\u636E\uFF09").option("--recon <dir>", "\u57FA\u7EBF\u4EA7\u7269\u76EE\u5F55\uFF08<out>/recon/<\u79DF\u6237\u6BB5>/<\u6765\u6E90\u6BB5>\uFF09", ".").option(
|
|
12863
|
+
delivery.command("gate0").description("\u96F6\u7F51\u7EDC\uFF1A\u626B\u4E00\u4EFD skill \u7684\u6B63\u6587\uFF0C\u628A\u73AF\u5883\u4E8B\u5B9E / \u672A\u767B\u8BB0\u7684\u534F\u8BAE\u5F62\u6001 / \u4EA7\u7269\u8DEF\u5F84\u6321\u5728\u6210\u7A3F\u4E4B\u5916").requiredOption("--skills <dir>", "\u8981\u626B\u7684 skill \u6839\u76EE\u5F55\uFF08\u6B63\u6587 + references/ \u5168\u76EE\u5F55\uFF0C\u540C\u4E00\u5224\u636E\uFF09").option("--recon <dir>", "\u57FA\u7EBF\u4EA7\u7269\u76EE\u5F55\uFF08<out>/recon/<\u79DF\u6237\u6BB5>/<\u6765\u6E90\u6BB5>\uFF09", ".").option(
|
|
12365
12864
|
"--mapping <file>",
|
|
12366
12865
|
"\u987E\u95EE\u624B\u5199\u7684\u6620\u5C04\u5DE5\u4EF6\uFF08naturalKey \u8FD9\u4E00\u7C7B\u7684\u552F\u4E00\u6765\u6E90\uFF09\uFF1B\u4E0D\u7ED9 \u21D2 \u90A3\u4E00\u7C7B\u6052\u7EFF \u21D2 rc=2"
|
|
12367
12866
|
).option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "json").action((opts) => deliveryGate0Command(opts));
|
|
@@ -12385,13 +12884,29 @@ program.command("query <Model>").description("\u67E5\u8BE2 Model \u5217\u8868\u6
|
|
|
12385
12884
|
"--additions <JSON>",
|
|
12386
12885
|
`\u8DE8\u5173\u7CFB JOIN \u7684\u5BF9\u8C61\u6570\u7EC4 JSON\uFF0C\u4F8B\u5982 '[{"key":"employee","model":"Employee"}]'`
|
|
12387
12886
|
).option("--fields <list>", "\u8FD4\u56DE\u5B57\u6BB5\u5217\u8868\uFF08\u9017\u53F7\u5206\u9694\uFF09\uFF0C\u4F8B\u5982 name,code,email").option("--keyword <text>", "\u5168\u6587\u68C0\u7D22\u5173\u952E\u5B57").option("--limit <n>", "\u6BCF\u9875\u5927\u5C0F", "20").option("--offset <n>", "\u504F\u79FB\u91CF\uFF08\u6309 limit \u81EA\u52A8\u6362\u7B97 page\uFF09").option("--env <name>", "\u4E34\u65F6\u5207\u73AF\u5883\uFF08\u8986\u76D6 activeEnv\uFF0C\u672C\u6B21\u547D\u4EE4\uFF09").option("--as <identity>", "\u4E34\u65F6\u6362\u8EAB\u4EFD\uFF08\u8986\u76D6 env defaultIdentity\uFF0C\u672C\u6B21\u547D\u4EE4\uFF09").option("--profile <name>", "[deprecated] \u7528 --env \u66FF\u4EE3").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "table").action((m, opts) => queryCommand(m, opts));
|
|
12388
|
-
program.command("action <Model.Action>").description("\u8C03\u7528 Model \u4E0A\u7684 Action\uFF08\u4E1A\u52A1\u65B9\u6CD5\uFF09\uFF0C\u4F8B\u5982 Employee.regularize").option("--id <id>", "\u76EE\u6807\u5B9E\u4F53 ID\uFF08object Action \u5FC5\u586B\uFF09").option("--ids <csv>", "\u6279\u91CF ID\uFF08\u9017\u53F7\u5206\u9694\uFF0Cbulk Action \u7528\uFF09").option("--method <method>", "HTTP \u65B9\u6CD5\uFF1AGET | POST | PUT | DELETE\uFF08\u9ED8\u8BA4\u6309 Core \u5143\u6570\u636E\u81EA\u52A8\u5224\u5B9A\uFF09").option(
|
|
12389
|
-
|
|
12887
|
+
program.command("action <Model.Action>").description("\u8C03\u7528 Model \u4E0A\u7684 Action\uFF08\u4E1A\u52A1\u65B9\u6CD5\uFF09\uFF0C\u4F8B\u5982 Employee.regularize").option("--id <id>", "\u76EE\u6807\u5B9E\u4F53 ID\uFF08object Action \u5FC5\u586B\uFF09").option("--ids <csv>", "\u6279\u91CF ID\uFF08\u9017\u53F7\u5206\u9694\uFF0Cbulk Action \u7528\uFF09").option("--method <method>", "HTTP \u65B9\u6CD5\uFF1AGET | POST | PUT | DELETE\uFF08\u9ED8\u8BA4\u6309 Core \u5143\u6570\u636E\u81EA\u52A8\u5224\u5B9A\uFF09").option(
|
|
12888
|
+
"--scope <scope>",
|
|
12889
|
+
"\u5F3A\u5236 Action scope\uFF1Aclass | object\uFF08\u9ED8\u8BA4\uFF1A\u6709 --id \u4E3A object\uFF0C\u5426\u5219 class\uFF09"
|
|
12890
|
+
).option("--params <JSON>", `Action \u5165\u53C2 JSON\uFF0C\u4F8B\u5982 '{"effectDate":"2026-06-01"}'`).option("--params-file <path>", "\u4ECE UTF-8 JSON \u6587\u4EF6\u8BFB\u53D6 Action \u5165\u53C2\uFF08\u4E0E --params \u4E92\u65A5\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\uFF08\u8986\u76D6 env defaultIdentity\uFF0C\u672C\u6B21\u547D\u4EE4\uFF09").option("--profile <name>", "[deprecated] \u7528 --env \u66FF\u4EE3").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "json").action((spec, opts) => actionCommand(spec, opts));
|
|
12891
|
+
program.command("create <Model>").description("\u521B\u5EFA\u4E00\u6761 Model \u8BB0\u5F55\uFF08\u8D70\u540E\u7AEF\u5B8C\u6574\u6821\u9A8C\uFF09").option("--data <JSON>", `\u8BB0\u5F55\u5B57\u6BB5 JSON\uFF0C\u4F8B\u5982 '{"code":"ORG_SALES","name":"\u9500\u552E\u90E8"}'`).option("--data-file <path>", "\u4ECE UTF-8 JSON \u6587\u4EF6\u8BFB\u53D6\u8BB0\u5F55\u5B57\u6BB5\uFF08\u4E0E --data \u4E92\u65A5\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\uFF08\u8986\u76D6 env defaultIdentity\uFF0C\u672C\u6B21\u547D\u4EE4\uFF09").option("--profile <name>", "[deprecated] \u7528 --env \u66FF\u4EE3").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "json").option(
|
|
12892
|
+
"--i18n",
|
|
12893
|
+
"\u591A\u8BED\u8A00\u5B57\u6BB5\u6309 Map \u5B8C\u6574\u66FF\u6362\uFF08\u952E\u7528 zh-CN / en-US \u8FDE\u5B57\u7B26\u5F62\uFF09\uFF1B\u4E0D\u4F20\u5219\u6309\u5B57\u7B26\u4E32\u53EA\u6539\u5F53\u524D\u8BED\u8A00"
|
|
12894
|
+
).action((m, opts) => createCommand(m, opts));
|
|
12390
12895
|
program.command("delete <Model>").description("\u5220\u9664\u4E00\u6761 Model \u8BB0\u5F55\uFF08\u8D70\u540E\u7AEF\u5B8C\u6574\u6821\u9A8C\uFF1B\u90E8\u5206 Model \u4F1A\u6267\u884C\u4E1A\u52A1\u64A4\u9500\uFF09").option("--id <id>", "\u76EE\u6807\u5B9E\u4F53 ID\uFF08\u5FC5\u586B\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\uFF08\u8986\u76D6 env defaultIdentity\uFF0C\u672C\u6B21\u547D\u4EE4\uFF09").option("--profile <name>", "[deprecated] \u7528 --env \u66FF\u4EE3").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "json").action((m, opts) => deleteCommand(m, opts));
|
|
12391
12896
|
program.command("import <path>").description("\u6CE8\u5165 DataPackage YAML \u6570\u636E\u96C6\uFF08\u76EE\u5F55\u6216\u5355\u6587\u4EF6\uFF0C\u8D70\u540E\u7AEF\u5B8C\u6574\u6821\u9A8C\uFF09").option("--dry-run", "\u53EA\u8DD1\u5BA2\u6237\u7AEF\u9759\u6001\u6821\u9A8C\uFF0C\u4E0D\u843D\u5E93\uFF08\u89C1 spec \xA78 \u9650\u5236\uFF09").option("--update-only", "\u5DF2\u5B58\u5728\uFF08\u6309 key_field\uFF09\u5219 PUT \u66F4\u65B0\uFF0C\u5426\u5219 create").option("--on-error <mode>", "stop | continue\uFF08\u9ED8\u8BA4 continue\uFF09", "continue").option("--report <path>", "\u5199 JSON \u6CE8\u5165\u62A5\u544A\uFF08\u9010\u884C\u7ED3\u679C + key\u2192id \u6620\u5C04\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\uFF08\u8986\u76D6 env defaultIdentity\uFF0C\u672C\u6B21\u547D\u4EE4\uFF09").option("--profile <name>", "[deprecated] \u7528 --env \u66FF\u4EE3").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "json").action((p, opts) => importCommand(p, opts));
|
|
12392
12897
|
program.command("models [keyword]").description("\u5217\u51FA\u76EE\u6807\u73AF\u5883\u6709\u54EA\u4E9B Model\uFF08describe \u7684\u4E0A\u4E00\u6B65\uFF09\uFF1B\u53EF\u5E26\u5173\u952E\u5B57\u8FC7\u6EE4").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\uFF08\u8986\u76D6 env defaultIdentity\uFF0C\u672C\u6B21\u547D\u4EE4\uFF09").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "table").action((keyword, opts) => modelsCommand(keyword, opts));
|
|
12393
12898
|
program.command("describe <Model>").description("\u67E5\u770B Model \u5143\u6570\u636E\uFF08\u5B57\u6BB5\u3001\u5173\u7CFB\u3001Action \u5217\u8868\uFF09").option("-v, --verbose", "\u663E\u793A\u5B57\u6BB5\u63CF\u8FF0\u4E0E enum \u53D6\u503C").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\uFF08\u8986\u76D6 env defaultIdentity\uFF0C\u672C\u6B21\u547D\u4EE4\uFF09").option("--profile <name>", "[deprecated] \u7528 --env \u66FF\u4EE3").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "table").action((m, opts) => describeCommand(m, opts));
|
|
12394
|
-
program.command("chat [prompt]").description("\u4E0E\u6570\u5B57\u5458\u5DE5 Moirai \u5BF9\u8BDD\uFF1B\u6709 prompt \u5355\u53D1\u540E\u9000\u51FA\uFF0C\u4E0D\u5E26 prompt \u8FDB\u5165 REPL").option("--agent <key>", "\u6307\u5B9A agent UUID\uFF08\u9ED8\u8BA4\u4F7F\u7528 analyst \u5185\u7F6E agent\uFF09").option("--resume <id>", "\u7EED\u63A5\u6307\u5B9A conversation\uFF1B\u4E0D\u4F20\u5219\u9ED8\u8BA4\u5F00\u65B0\u4F1A\u8BDD").option("--conversation <id>", "[deprecated] \u7528 --resume \u66FF\u4EE3\uFF1B\u4F20 NEW \u7B49\u4EF7\u9ED8\u8BA4\u65B0\u4F1A\u8BDD").option("--list", "\u5217\u51FA\u6700\u8FD1\u4F1A\u8BDD\uFF0C\u4E0D\u8FDB\u5165\u804A\u5929").option(
|
|
12899
|
+
program.command("chat [prompt]").description("\u4E0E\u6570\u5B57\u5458\u5DE5 Moirai \u5BF9\u8BDD\uFF1B\u6709 prompt \u5355\u53D1\u540E\u9000\u51FA\uFF0C\u4E0D\u5E26 prompt \u8FDB\u5165 REPL").option("--agent <key>", "\u6307\u5B9A agent UUID\uFF08\u9ED8\u8BA4\u4F7F\u7528 analyst \u5185\u7F6E agent\uFF09").option("--resume <id>", "\u7EED\u63A5\u6307\u5B9A conversation\uFF1B\u4E0D\u4F20\u5219\u9ED8\u8BA4\u5F00\u65B0\u4F1A\u8BDD").option("--conversation <id>", "[deprecated] \u7528 --resume \u66FF\u4EE3\uFF1B\u4F20 NEW \u7B49\u4EF7\u9ED8\u8BA4\u65B0\u4F1A\u8BDD").option("--list", "\u5217\u51FA\u6700\u8FD1\u4F1A\u8BDD\uFF0C\u4E0D\u8FDB\u5165\u804A\u5929").option(
|
|
12900
|
+
"--events [conversationId]",
|
|
12901
|
+
"\u53EA\u8BFB\u67E5\u770B\u6307\u5B9A conversation \u7684 timeline/event \u6D41\uFF1B\u4E5F\u53EF\u914D --resume <id>"
|
|
12902
|
+
).option("--limit <N>", "\u914D\u5408 --list\uFF1A\u663E\u793A\u6700\u8FD1 N \u6761\u4F1A\u8BDD", "10").option("--stream", "\u6D41\u5F0F\u8F93\u51FA\uFF08\u9ED8\u8BA4\u5F00\u542F\uFF0C\u9010 token \u6253\u5370 + thinking/tools \u5B9E\u65F6\u663E\u793A\uFF09", true).option("--no-stream", "\u5173\u95ED\u6D41\u5F0F\uFF0C\u7B49 LLM \u5168\u6587\u8FD4\u56DE\u540E\u4E00\u6B21\u6027\u663E\u793A\uFF08CI / \u811A\u672C\u7BA1\u9053\u573A\u666F\uFF09").option(
|
|
12903
|
+
"--show-tool-calls",
|
|
12904
|
+
"\u5C55\u793A\u5DE5\u5177\u8C03\u7528\u8BE6\u7EC6\u53C2\u6570\uFF08\u9ED8\u8BA4\u663E\u793A\u5DE5\u5177\u540D + \u72B6\u6001\uFF0Cverbose \u65F6\u663E\u793A\u5B8C\u6574\u53C2\u6570\uFF09",
|
|
12905
|
+
true
|
|
12906
|
+
).option("--no-show-tool-calls", "\u5B8C\u5168\u9690\u85CF\u5DE5\u5177\u8C03\u7528").option("--prompt-file <path>", "\u4ECE\u6587\u4EF6\u8BFB\u53D6 prompt \u5185\u5BB9").option("--timeout <sec>", "\u8BF7\u6C42\u8D85\u65F6\u79D2\u6570", "60").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\uFF08\u8986\u76D6 env defaultIdentity\uFF0C\u672C\u6B21\u547D\u4EE4\uFF09").option("--profile <name>", "[deprecated] \u7528 --env \u66FF\u4EE3").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atext | json", "text").option("--no-markdown", "\u5173\u95ED\u6D41\u5F0F\u672B\u6001 markdown \u6E32\u67D3\uFF08CI / pipe \u53CB\u597D\uFF09").option("--no-thinking", "\u5173\u95ED thinking \u6BB5\u663E\u793A").option("--verbose-thinking", "\u5C55\u5F00 thinking \u5B8C\u6574\u5185\u5BB9\uFF08\u9ED8\u8BA4\u4EC5\u5355\u884C\u603B\u7ED3\uFF09").option("--verbose-tools", "\u5C55\u793A\u5DE5\u5177\u8C03\u7528\u5B8C\u6574\u53C2\u6570\uFF08\u9ED8\u8BA4\u4EC5\u5DE5\u5177\u540D + \u72B6\u6001\uFF09").option("--no-spinner", "\u5173\u95ED spinner\uFF08CI \u53CB\u597D\uFF09").option("--no-color", "\u5173\u95ED\u989C\u8272\uFF08CI / accessibility\uFF09").option("--raw", "\u9010\u884C\u6253\u5370\u539F\u59CB v4/control envelope\uFF08\u534F\u8BAE\u793A\u6CE2\u5668\uFF0C\u4E0D\u6E32\u67D3\uFF09").option("--auto-approve", "\u81EA\u52A8\u6279\u51C6\u9AD8\u98CE\u9669 confirm\uFF08\u4ECD\u6253\u5370\u5BA1\u8BA1\u884C\uFF1B\u6279\u91CF / \u975E\u4EA4\u4E92\u573A\u666F\uFF09").option(
|
|
12907
|
+
"--on-confirm <decision>",
|
|
12908
|
+
"\u975E\u4EA4\u4E92 confirm \u51B3\u7B56\uFF1Aapprove | reject | reject:<reason>\uFF08\u4F18\u5148\u4E8E --auto-approve\uFF09"
|
|
12909
|
+
).option("--on-ask <answer>", "\u975E\u4EA4\u4E92 ASK \u5E94\u7B54\u6587\u672C\uFF08\u547D\u4E2D choices \u65F6\u81EA\u52A8\u56DE\u586B choiceIndex\uFF09").option(
|
|
12395
12910
|
"--inject-on <spec>",
|
|
12396
12911
|
"\u6D41\u4E2D\u9014\u6CE8\u5165\u547D\u4EE4\uFF08\u4EC5 --raw\uFF09\uFF1A<eventType>:<action>[:<content>]\uFF0Caction \u2208 {interrupt, steer}\uFF08P0 S-interrupt / S-steer\uFF09"
|
|
12397
12912
|
).option(
|
|
@@ -12418,6 +12933,7 @@ workspaceAdd.command("mini <appCode>").description("\u65B0\u589E\u8F7B\u5E94\u75
|
|
|
12418
12933
|
"embedded"
|
|
12419
12934
|
).option("--scopes <csv>", "manifest.requiredScopes \u5217\u8868\uFF08\u9017\u53F7\u5206\u9694\uFF1B\u9ED8\u8BA4\u968F\u6A21\u677F\u9009\u62E9\uFF09").option("--tenant <tenantId>", "manifest.bundleObjectRef \u4E2D\u7ED1\u5B9A\u7684\u79DF\u6237 ID").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\uFF08\u8986\u76D6 env defaultIdentity\uFF0C\u672C\u6B21\u547D\u4EE4\uFF09").option("--profile <name>", "[deprecated] \u7528 --env \u66FF\u4EE3").option("--force", "\u5F3A\u5236\u8986\u76D6\u5DF2\u6709\u7684\u672C\u5730\u6587\u4EF6").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "table").action((appCode, opts) => workspaceAddMiniCommand(appCode, opts));
|
|
12420
12935
|
workspace.command("status").description("\u67E5\u770B\u5F00\u53D1\u7A7A\u95F4\u672C\u5730 artifact \u4E0E\u4E0A\u6B21 pull/push \u7684\u5DEE\u5F02").option("--dir <path>", "\u5DE5\u4F5C\u7A7A\u95F4\u672C\u5730\u76EE\u5F55", ".").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "table").action((opts) => workspaceStatusCommand(opts));
|
|
12936
|
+
workspace.command("rm <relativePath>").description("\u6682\u5B58\u5220\u9664\u4E00\u4E2A raw workspace \u6587\u4EF6\uFF1B\u968F\u540E\u7528 push \u6267\u884C\u8FDC\u7AEF\u5220\u9664").option("--dir <path>", "\u5DE5\u4F5C\u7A7A\u95F4\u672C\u5730\u76EE\u5F55", ".").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\uFF08\u8986\u76D6 env defaultIdentity\uFF0C\u672C\u6B21\u547D\u4EE4\uFF09").option("--profile <name>", "[deprecated] \u7528 --env \u66FF\u4EE3").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "table").action((relativePath, opts) => workspaceRmCommand(relativePath, opts));
|
|
12421
12937
|
workspace.command("validate").description("\u6821\u9A8C\u5F00\u53D1\u7A7A\u95F4\u672C\u5730 artifact\uFF08push \u524D\u5FC5\u8DD1\uFF09").option("--dir <path>", "\u5DE5\u4F5C\u7A7A\u95F4\u672C\u5730\u76EE\u5F55", ".").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "table").action((opts) => workspaceValidateCommand(opts));
|
|
12422
12938
|
workspace.command("push").description("\u628A\u672C\u5730\u5F00\u53D1\u7A7A\u95F4 artifact \u63A8\u9001\u56DE\u79DF\u6237\u5F00\u53D1\u7A7A\u95F4").option("--dir <path>", "\u5DE5\u4F5C\u7A7A\u95F4\u672C\u5730\u76EE\u5F55", ".").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\uFF08\u8986\u76D6 env defaultIdentity\uFF0C\u672C\u6B21\u547D\u4EE4\uFF09").option("--profile <name>", "[deprecated] \u7528 --env \u66FF\u4EE3").option("--dry-run", "\u53EA\u8BA1\u7B97\u5F85\u6267\u884C\u7684\u64CD\u4F5C\uFF0C\u4E0D\u771F\u6B63\u5199\u8FDC\u7AEF\u6587\u4EF6").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "table").action((opts) => workspacePushCommand(opts));
|
|
12423
12939
|
workspace.command("preview").description("\u6253\u5370\u5F00\u53D1\u7A7A\u95F4\u4E2D\u8F7B\u5E94\u7528 artifact \u7684\u9884\u89C8 URL").option("--dir <path>", "\u5DE5\u4F5C\u7A7A\u95F4\u672C\u5730\u76EE\u5F55", ".").option("--frontend <url>", "\u524D\u7AEF\u5730\u5740", "http://127.0.0.1:5179").option("--surface <surface>", "\u5C55\u793A\u54EA\u79CD\u5F62\u6001\uFF1Aall | bare | standalone | embedded", "all").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "table").action((opts) => workspacePreviewCommand(opts));
|
|
@@ -12426,7 +12942,9 @@ workspace.command("verify").description(
|
|
|
12426
12942
|
).option("--dir <path>", "\u5DE5\u4F5C\u7A7A\u95F4\u672C\u5730\u76EE\u5F55", ".").option("--env <name>", "\u4E34\u65F6\u5207\u73AF\u5883\uFF08\u8986\u76D6 activeEnv\uFF0Cdry-run \u9636\u6BB5\u9700\u8981\uFF09").option("--as <identity>", "\u4E34\u65F6\u6362\u8EAB\u4EFD\uFF08\u8986\u76D6 env defaultIdentity\uFF0C\u672C\u6B21\u547D\u4EE4\uFF09").option("--profile <name>", "[deprecated] \u7528 --env \u66FF\u4EE3").option("--frontend <url>", "\u524D\u7AEF\u5730\u5740", "http://127.0.0.1:5179").option("--surface <surface>", "\u9884\u89C8\u5F62\u6001\uFF1Aall | bare | standalone | embedded", "all").option("--smoke", "\u5BF9\u9884\u89C8\u5165\u53E3\u4E0E\u57FA\u7840\u8D44\u6E90\u6267\u884C\u53EA\u8BFB HTTP GET \u53EF\u8FBE\u68C0\u67E5").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "table").action((opts) => workspaceVerifyCommand(opts));
|
|
12427
12943
|
program.command("trace [traceId]").description("\u67E5\u770B trace\uFF1A\u4E0D\u4F20 traceId \u5217\u6700\u8FD1\u8BB0\u5F55\uFF0C\u4F20 traceId \u663E\u793A\u4EBA\u7C7B\u53EF\u8BFB\u8BE6\u60C5").option("--conv <convId>", "\u67E5\u4F1A\u8BDD\u7684 LLM \u9010\u8C03\u7528 trace\uFF08PG llm_call_trace\uFF0CADR-134 D2\uFF09").option("--llm-calls", "\u628A\u4F4D\u7F6E\u53C2\u5F53 convId \u67E5 LLM \u9010\u8C03\u7528\uFF08\u7B49\u4EF7 --conv <convId>\uFF09").option("--span <N>", "\u67E5\u770B\u7B2C N \u4E2A span \u7684\u8BE6\u60C5").option("-n, --limit <N>", "\u5217\u8868\u6A21\u5F0F\u663E\u793A\u6761\u6570", "10").option("--events", "\u6309\u4E8B\u4EF6\u65F6\u95F4\u7EBF\u5C55\u793A spans/logs/LLM \u5185\u5BB9\u6458\u8981").option("--raw", "\u8F93\u51FA\u539F\u59CB trace \u805A\u5408 JSON\uFF08\u534F\u8BAE/P0 \u8C03\u8BD5\u7528\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\uFF08\u8986\u76D6 env defaultIdentity\uFF0C\u672C\u6B21\u547D\u4EE4\uFF09").option("--profile <name>", "[deprecated] \u7528 --env \u66FF\u4EE3").option("--output <fmt>", "\u517C\u5BB9\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml\uFF1B\u8C03\u8BD5\u539F\u6587\u4F18\u5148\u7528 --raw", "table").action((traceId, opts) => traceCommand(traceId ?? null, opts));
|
|
12428
12944
|
program.command("mini").description("\u5DF2\u79FB\u9664\uFF1A\u8BF7\u6539\u7528 hcm workspace").allowUnknownOption(true).allowExcessArguments(true).argument("[args...]").action(() => removedMiniCommand());
|
|
12429
|
-
var script = program.command("script").description(
|
|
12945
|
+
var script = program.command("script").description(
|
|
12946
|
+
"\u4E91\u51FD\u6570\uFF1A\u53EA\u8BFB\u8BD5\u8FD0\u884C\u3001manifest \u6821\u9A8C\u3001\u6267\u884C\u65E5\u5FD7\u4E0E\u5F02\u6B65\u4EFB\u52A1\uFF08\u8D70 CLI \u8BA4\u8BC1\uFF0C\u4E0D\u9700\u8981\u81EA\u5DF1\u62FF token\uFF09"
|
|
12947
|
+
);
|
|
12430
12948
|
script.command("dry-run").description("\u53EA\u8BFB\u8BD5\u8FD0\u884C\u4E91\u51FD\u6570\uFF1B\u5199\u64CD\u4F5C\u88AB\u62E6\u622A\u3001\u4EC5\u8BB0\u5F55\u4E3A writeIntents\uFF0C\u4E0D\u6539\u6570\u636E").requiredOption("--script-key <key>", "\u811A\u672C key\uFF0C\u5982 employee.sync-tags").option("--model <Model>", "\u7ED1\u5B9A\u7684 Model").option("--action <action>", "\u7ED1\u5B9A\u7684 Action key").option("--scope <scope>", "Action scope\uFF1Aclass | object").option("--method <method>", "HTTP \u65B9\u6CD5").option("--target-id <id>", "object scope \u7684\u76EE\u6807\u5B9E\u4F53 id").option("--params <JSON>", "\u5165\u53C2 JSON \u5BF9\u8C61").option("--params-file <path>", "\u4ECE UTF-8 JSON \u6587\u4EF6\u8BFB\u5165\u53C2\uFF08\u4E0E --params \u4E92\u65A5\uFF09").option("--context <JSON>", "context JSON \u5BF9\u8C61").option("--event <JSON>", "event JSON \u5BF9\u8C61").option("--timeout <ms>", "\u8D85\u65F6\u6BEB\u79D2").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) => scriptDryRunCommand(opts));
|
|
12431
12949
|
script.command("manifest-validate").description("\u6821\u9A8C\u6269\u5C55\u5305 manifest.yml").requiredOption("--file <path>", "manifest.yml \u8DEF\u5F84").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) => scriptManifestValidateCommand(opts));
|
|
12432
12950
|
script.command("logs").description("\u67E5\u540C\u6B65\u6267\u884C\u65E5\u5FD7\uFF08\u5206\u9875\uFF09").option("--script-key <key>", "\u53EA\u770B\u67D0\u4E2A\u811A\u672C").option("--status <status>", "\u6309\u72B6\u6001\u8FC7\u6EE4").option("--mode <mode>", "\u6309 sync/async \u8FC7\u6EE4").option("--dry-run", "\u53EA\u770B dry-run \u8BB0\u5F55").option("--from <iso>", "\u8D77\u59CB\u65F6\u95F4\uFF08ISO 8601\uFF09").option("--to <iso>", "\u7ED3\u675F\u65F6\u95F4\uFF08ISO 8601\uFF09").option("--page <n>", "\u9875\u7801\uFF0C\u4ECE 0 \u5F00\u59CB").option("--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) => scriptLogsCommand(opts));
|
|
@@ -12445,26 +12963,46 @@ datapackage.command("pack <packageDir>").description("\u628A\u5305\u76EE\u5F55\u
|
|
|
12445
12963
|
datapackage.command("install <artifact>").description("\u4E0A\u4F20 .hcmpkg \u5236\u54C1\u5E76\u7ECF\u670D\u52A1\u7AEF\u5F02\u6B65\u5B89\u88C5\u5668\u5B89\u88C5\uFF0C\u5B9E\u65F6\u663E\u793A\u8FDB\u5EA6\uFF08admin.system\uFF09").option("--env <name>", "\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("--no-wait", "\u53EA\u53D7\u7406\u4E0D\u7B49\u5F85\uFF0C\u7ACB\u523B\u8FD4\u56DE runId").option("--timeout <sec>", "\u7B49\u5F85\u4E0A\u9650\uFF08\u79D2\uFF09\uFF1B\u7B49\u4E0D\u5230\u4E0D\u662F\u5931\u8D25\uFF0C\u88C5\u8F7D\u5728\u670D\u52A1\u7AEF\u7EE7\u7EED", "900").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "json").action((artifact, opts) => datapackageInstallCommand(artifact, opts));
|
|
12446
12964
|
datapackage.command("status <runId>").description("\u67E5\u770B\u88C5\u8F7D\u6D41\u6C34\u8FDB\u5EA6/\u7EC8\u6001\uFF08\u914D\u5408 install --no-wait \u6216\u7B49\u5F85\u8D85\u65F6\u540E\u4F7F\u7528\uFF09").option("--env <name>", "\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((runId, opts) => datapackageStatusCommand(runId, opts));
|
|
12447
12965
|
var tenant = program.command("tenant").description("\u79DF\u6237\u5F00\u901A\u4E0E\u751F\u547D\u5468\u671F");
|
|
12448
|
-
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(
|
|
12966
|
+
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(
|
|
12967
|
+
"--admin-password <pwd>",
|
|
12968
|
+
"\u7BA1\u7406\u5458\u5BC6\u7801\uFF08\u4F1A\u6CC4\u6F0F\u5230 history/ps\uFF0C\u5EFA\u8BAE --admin-password-stdin\uFF09"
|
|
12969
|
+
).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));
|
|
12449
12970
|
var meta = program.command("meta").description("\u79DF\u6237\u5143\u6570\u636E\u8BFB\u5199\uFF08\u9875\u9762/\u5B57\u6BB5/\u5217\u8868\u914D\u7F6E\uFF09");
|
|
12450
12971
|
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));
|
|
12451
12972
|
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));
|
|
12452
|
-
meta.command("set <path>").description(
|
|
12453
|
-
|
|
12973
|
+
meta.command("set <path>").description(
|
|
12974
|
+
"\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"
|
|
12975
|
+
).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));
|
|
12976
|
+
meta.command("validate <path>").description(
|
|
12977
|
+
"\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"
|
|
12978
|
+
).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));
|
|
12454
12979
|
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));
|
|
12455
12980
|
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");
|
|
12456
|
-
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(
|
|
12981
|
+
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(
|
|
12982
|
+
"--stage <key>",
|
|
12983
|
+
"\u53EA\u770B\u67D0\u4E2A\u4EA4\u4ED8\u9636\u6BB5\uFF1Ahandover | baseline | configure | migrate | integrate | golive | operate"
|
|
12984
|
+
).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));
|
|
12457
12985
|
skills.command("manifest").description("\u6253\u5370\u672C CLI \u7684\u547D\u4EE4\u9762\u4E0E\u81EA\u5E26\u6280\u80FD\u6E05\u5355\uFF08\u4E0D\u8FDE\u7F51\uFF0C\u4F9B\u5B88\u536B\u4E0E\u5916\u90E8\u5DE5\u5177\u6BD4\u5BF9\uFF09").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "json").action((opts) => skillsManifestCommand(program, opts));
|
|
12458
12986
|
skills.command("show <id>").description("\u6253\u5370\u6280\u80FD\u539F\u6587\uFF08\u7BA1\u9053\u53CB\u597D\uFF09\uFF1B\u81EA\u5E26\u6280\u80FD\u76F4\u63A5\u8BFB\u672C\u5730\uFF0C\u4E0D\u8FDE\u7F51").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").action((id, opts) => skillsShowCommand(id, opts));
|
|
12459
|
-
skills.command("install [id]").description("\u8FDE\u540C requires \u524D\u7F6E\u6280\u80FD\u4E0E\u53C2\u8003\u6587\u4EF6\u88C5\u5230 agent \u6280\u80FD\u76EE\u5F55\uFF1B--all \u88C5\u6574\u4E2A\u6280\u80FD\u5E93").option("--all", "\u88C5\u6574\u4E2A\u6280\u80FD\u5E93\uFF0C\u5E76\u8BB0\u4E3A\u300C\u8DDF\u968F\u5168\u96C6\u300D\uFF08\u5F80\u540E update \u4F1A\u81EA\u52A8\u8865\u4E0A\u4EA7\u54C1\u65B0\u589E\u7684\u6280\u80FD\uFF09").option(
|
|
12987
|
+
skills.command("install [id]").description("\u8FDE\u540C requires \u524D\u7F6E\u6280\u80FD\u4E0E\u53C2\u8003\u6587\u4EF6\u88C5\u5230 agent \u6280\u80FD\u76EE\u5F55\uFF1B--all \u88C5\u6574\u4E2A\u6280\u80FD\u5E93").option("--all", "\u88C5\u6574\u4E2A\u6280\u80FD\u5E93\uFF0C\u5E76\u8BB0\u4E3A\u300C\u8DDF\u968F\u5168\u96C6\u300D\uFF08\u5F80\u540E update \u4F1A\u81EA\u52A8\u8865\u4E0A\u4EA7\u54C1\u65B0\u589E\u7684\u6280\u80FD\uFF09").option(
|
|
12988
|
+
"--target <agent>",
|
|
12989
|
+
"\u88C5\u7ED9\u54EA\u4E2A agent\uFF1Aclaude\uFF08.claude/skills/\uFF09| codex\uFF08hcm-skills/ + Agent \u7D22\u5F15\uFF09| auto",
|
|
12990
|
+
"auto"
|
|
12991
|
+
).option("--global", "\u88C5\u5230\u7528\u6237\u7EA7\u76EE\u5F55\u800C\u975E\u5F53\u524D\u9879\u76EE").option("--dir <path>", "\u88C5\u5230\u6307\u5B9A\u76EE\u5F55").option("--from <dir>", "\u4ECE\u672C\u5730\u76EE\u5F55\u88C5\uFF08\u73B0\u573A\u6539\u8FC7\u7684\u7248\u672C\uFF09\uFF0C\u4E0D\u8D70\u7F51\u7EDC").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("--force", "\u8986\u76D6\u5DF2\u5B58\u5728\u7684\u540C\u540D\u6280\u80FD").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((id, opts) => skillsInstallCommand(id, opts));
|
|
12460
12992
|
skills.command("update").description("\u628A\u88C5\u8FC7\u7684\u6280\u80FD\u5347\u5230\u76EE\u6807\u73AF\u5883\u8FD9\u4E00\u7248\uFF08\u4EA7\u54C1\u5347\u7EA7\u540E\u8DD1\u5B83\uFF09").option("--all", "\u8FDE\u4EA7\u54C1\u65B0\u589E\u7684\u6280\u80FD\u4E00\u8D77\u88C5\u4E0A\uFF0C\u5E76\u8BB0\u4E3A\u300C\u8DDF\u968F\u5168\u96C6\u300D").option("--check", "\u53EA\u770B\u4F1A\u53D8\u4EC0\u4E48\uFF0C\u4E0D\u5199\u76D8").option("--target <agent>", "claude | codex | auto\uFF08\u9ED8\u8BA4\u6309\u5DF2\u5B89\u88C5\u76EE\u5F55\u63A2\uFF09", "auto").option("--global", "\u5347\u7EA7\u7528\u6237\u7EA7\u76EE\u5F55\u91CC\u7684\u6280\u80FD").option("--dir <path>", "\u5347\u7EA7\u6307\u5B9A\u76EE\u5F55\u91CC\u7684\u6280\u80FD").option("--force", "\u8FDE\u672C\u5730\u6539\u8FC7\u7684\u6280\u80FD\u4E00\u8D77\u8986\u76D6\u6210\u4EA7\u54C1\u8FD9\u4E00\u7248").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\u5B89\u88C5\u65F6\u8BB0\u5F55\u7684\u5730\u5740\uFF09").option("--env <name>", "\u4ECE\u8BE5 env \u89E3\u6790 endpoint").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "table").action((opts) => skillsUpdateCommand(opts));
|
|
12461
|
-
program.command("update <Model>").description("\u66F4\u65B0\u4E00\u6761 Model \u8BB0\u5F55\uFF08\u8D70\u540E\u7AEF\u5B8C\u6574\u6821\u9A8C\uFF09\u3002\u5347\u7EA7 CLI \u8BF7\u7528 `hcm upgrade`").requiredOption("--id <id>", "\u8BB0\u5F55 ID").option("--data <JSON>", `\u8981\u66F4\u65B0\u7684\u5B57\u6BB5 JSON\uFF0C\u4F8B\u5982 '{"name":"\u65B0\u540D\u79F0"}'`).option("--data-file <path>", "\u4ECE UTF-8 JSON \u6587\u4EF6\u8BFB\u53D6\u66F4\u65B0\u5B57\u6BB5\uFF08\u4E0E --data \u4E92\u65A5\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\uFF08\u8986\u76D6 env defaultIdentity\uFF0C\u672C\u6B21\u547D\u4EE4\uFF09").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "json").option(
|
|
12993
|
+
program.command("update <Model>").description("\u66F4\u65B0\u4E00\u6761 Model \u8BB0\u5F55\uFF08\u8D70\u540E\u7AEF\u5B8C\u6574\u6821\u9A8C\uFF09\u3002\u5347\u7EA7 CLI \u8BF7\u7528 `hcm upgrade`").requiredOption("--id <id>", "\u8BB0\u5F55 ID").option("--data <JSON>", `\u8981\u66F4\u65B0\u7684\u5B57\u6BB5 JSON\uFF0C\u4F8B\u5982 '{"name":"\u65B0\u540D\u79F0"}'`).option("--data-file <path>", "\u4ECE UTF-8 JSON \u6587\u4EF6\u8BFB\u53D6\u66F4\u65B0\u5B57\u6BB5\uFF08\u4E0E --data \u4E92\u65A5\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\uFF08\u8986\u76D6 env defaultIdentity\uFF0C\u672C\u6B21\u547D\u4EE4\uFF09").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "json").option(
|
|
12994
|
+
"--i18n",
|
|
12995
|
+
"\u591A\u8BED\u8A00\u5B57\u6BB5\u6309 Map \u5B8C\u6574\u66FF\u6362\uFF08\u952E\u7528 zh-CN / en-US \u8FDE\u5B57\u7B26\u5F62\uFF09\uFF1B\u4E0D\u4F20\u5219\u6309\u5B57\u7B26\u4E32\u53EA\u6539\u5F53\u524D\u8BED\u8A00"
|
|
12996
|
+
).action((model, opts) => updateCommand(model, opts));
|
|
12462
12997
|
program.command("version").description("\u67E5 CLI \u4E0E\u540E\u7AEF\u4E24\u4E2A\u7248\u672C\uFF08commit / tag / \u6784\u5EFA\u65F6\u95F4\uFF09\u2014\u2014\u514D\u8BA4\u8BC1\uFF0C\u65E0\u9700\u5148 login").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("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "json").action((opts) => versionCommand(opts));
|
|
12463
12998
|
program.command("upgrade").alias("self-update").description("\u5347\u7EA7 CLI \u81EA\u5DF1\uFF08\u6CE8\u610F\uFF1A`hcm update` \u662F\u66F4\u65B0\u4E1A\u52A1\u8BB0\u5F55\uFF0C\u4E0D\u662F\u5347\u7EA7\uFF09").option("--check", "\u53EA\u68C0\u67E5\uFF1B\u6709\u65B0\u7248\u672C\u65F6\u4EE5\u9000\u51FA\u7801 1 \u7ED3\u675F\uFF0C\u4FBF\u4E8E\u811A\u672C\u5224\u65AD").action((opts) => upgradeCommand(opts));
|
|
12464
|
-
program.command("open [path]").description("\u7528\u5F53\u524D CLI \u8EAB\u4EFD\u6253\u5F00\u524D\u7AEF\u9875\u9762\uFF1A\u94F8\u4E00\u5F20 60s \u4E00\u6B21\u6027\u7968\u636E\u4EA4\u7ED9\u6D4F\u89C8\u5668\uFF0C\u4F1A\u8BDD token \u4E0D\u8FDB URL").option("--print-url", "\u53EA\u6253\u5370\u767B\u5F55 URL\uFF0C\u4E0D\u5F00\u6D4F\u89C8\u5668\uFF08\u7ED9 agent \u6D4F\u89C8\u5668 navigate \u7528\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\uFF08\u8986\u76D6 env defaultIdentity\uFF0C\u672C\u6B21\u547D\u4EE4\uFF09").option("--profile <name>", "[deprecated] \u7528 --env \u66FF\u4EE3").action((
|
|
12999
|
+
program.command("open [path]").description("\u7528\u5F53\u524D CLI \u8EAB\u4EFD\u6253\u5F00\u524D\u7AEF\u9875\u9762\uFF1A\u94F8\u4E00\u5F20 60s \u4E00\u6B21\u6027\u7968\u636E\u4EA4\u7ED9\u6D4F\u89C8\u5668\uFF0C\u4F1A\u8BDD token \u4E0D\u8FDB URL").option("--print-url", "\u53EA\u6253\u5370\u767B\u5F55 URL\uFF0C\u4E0D\u5F00\u6D4F\u89C8\u5668\uFF08\u7ED9 agent \u6D4F\u89C8\u5668 navigate \u7528\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\uFF08\u8986\u76D6 env defaultIdentity\uFF0C\u672C\u6B21\u547D\u4EE4\uFF09").option("--profile <name>", "[deprecated] \u7528 --env \u66FF\u4EE3").action((path18, opts) => openCommand(path18, opts));
|
|
12465
13000
|
var setting = program.command("setting").description("\u79DF\u6237\u7CFB\u7EDF\u53C2\u6570\uFF08\u767B\u5F55\u7B56\u7565 / \u5BC6\u7801\u7B56\u7565 / \u529F\u80FD\u5F00\u5173 / \u96C6\u6210\u53C2\u6570\uFF09");
|
|
12466
13001
|
setting.command("get <domain>").description("\u8BFB\u67D0\u57DF\u53C2\u6570\uFF08\u5B9A\u4E49 + \u79DF\u6237\u8986\u76D6\u503C\u5408\u5E76\uFF0C\u7F3A\u5931\u56DE\u843D\u9ED8\u8BA4\u503C\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("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "table").action((d, opts) => settingGetCommand(d, opts));
|
|
12467
|
-
setting.command("set <domain>").description("\u6539\u53C2\u6570\uFF0C\u53EF\u91CD\u590D --set\uFF1B\u8D70\u53D7\u63A7\u6821\u9A8C\u8DEF\u5F84\u800C\u975E\u6807\u51C6 CRUD").option(
|
|
13002
|
+
setting.command("set <domain>").description("\u6539\u53C2\u6570\uFF0C\u53EF\u91CD\u590D --set\uFF1B\u8D70\u53D7\u63A7\u6821\u9A8C\u8DEF\u5F84\u800C\u975E\u6807\u51C6 CRUD").option(
|
|
13003
|
+
"--set <assignment...>",
|
|
13004
|
+
"namespace.key=value\uFF0C\u4F8B\u5982 security.password.passwordPolicy=complex"
|
|
13005
|
+
).option("--dry-run", "\u53EA\u663E\u793A\u5C06\u5199\u5165\u4EC0\u4E48\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((d, opts) => settingSetCommand(d, opts));
|
|
12468
13006
|
setting.command("reset <domain> <namespace> <key>").description("\u6E05\u9664\u79DF\u6237\u8986\u76D6\uFF0C\u56DE\u843D\u5230\u9ED8\u8BA4\u503C").option("--revision <n>", "\u4E50\u89C2\u9501\u7248\u672C\u53F7").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((d, ns, k, opts) => settingResetCommand(d, ns, k, opts));
|
|
12469
13007
|
async function main() {
|
|
12470
13008
|
if (needsLegacyProfileMigration(process.argv)) {
|