@hcmai/cli 0.4.28 → 0.4.30
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 +1472 -274
- package/dist/index.js.map +1 -1
- package/dist/skills/manifest.json +126 -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(path19) {
|
|
536
|
+
const segs = path19.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(path19) {
|
|
1719
|
+
const segs = (path19 ?? "").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 path19 = 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, path19);
|
|
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 ${path19}\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(path19) {
|
|
3474
|
+
if (statSync(path19).isFile()) return [path19];
|
|
3475
3475
|
const out = [];
|
|
3476
3476
|
const walk = (dir) => {
|
|
3477
3477
|
for (const name of readdirSync(dir).sort()) {
|
|
@@ -3480,7 +3480,7 @@ function collectYmlFiles(path18) {
|
|
|
3480
3480
|
else if (full.endsWith(".yml") || full.endsWith(".yaml")) out.push(full);
|
|
3481
3481
|
}
|
|
3482
3482
|
};
|
|
3483
|
-
walk(
|
|
3483
|
+
walk(path19);
|
|
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(path19, args) {
|
|
3492
3492
|
try {
|
|
3493
|
-
const files = collectYmlFiles(
|
|
3493
|
+
const files = collectYmlFiles(path19);
|
|
3494
3494
|
const fixtures = files.map(
|
|
3495
3495
|
(f) => parseFixture(readFileSync2(f, "utf8"), relative(process.cwd(), f))
|
|
3496
3496
|
);
|
|
@@ -4898,7 +4898,7 @@ async function datapackageInstallCommand(artifactPath, args) {
|
|
|
4898
4898
|
}
|
|
4899
4899
|
const timeoutMs = Math.max(1, Number(args.timeout ?? DEFAULT_INSTALL_WAIT_SECONDS)) * 1e3;
|
|
4900
4900
|
const showProgress = human && process.stderr.isTTY === true;
|
|
4901
|
-
const { run, timedOut } = await waitForInstallRun(client3, accepted.runId, {
|
|
4901
|
+
const { run: run2, timedOut } = await waitForInstallRun(client3, accepted.runId, {
|
|
4902
4902
|
timeoutMs,
|
|
4903
4903
|
onProgress: showProgress ? (r) => process.stderr.write(`\r${renderProgress(r)}`.padEnd(96)) : void 0
|
|
4904
4904
|
});
|
|
@@ -4912,27 +4912,27 @@ async function datapackageInstallCommand(artifactPath, args) {
|
|
|
4912
4912
|
}
|
|
4913
4913
|
emit3({
|
|
4914
4914
|
runId: accepted.runId,
|
|
4915
|
-
status:
|
|
4916
|
-
phase:
|
|
4917
|
-
filesDone:
|
|
4918
|
-
filesTotal:
|
|
4919
|
-
rowsDone:
|
|
4915
|
+
status: run2?.status ?? "RUNNING",
|
|
4916
|
+
phase: run2?.phase,
|
|
4917
|
+
filesDone: run2?.filesDone,
|
|
4918
|
+
filesTotal: run2?.filesTotal,
|
|
4919
|
+
rowsDone: run2?.rowsDone,
|
|
4920
4920
|
timedOut: true,
|
|
4921
4921
|
next_step: `hcm datapackage status ${accepted.runId}`
|
|
4922
4922
|
}, fmt);
|
|
4923
4923
|
process.exitCode = 0;
|
|
4924
4924
|
return;
|
|
4925
4925
|
}
|
|
4926
|
-
const failed2 =
|
|
4926
|
+
const failed2 = run2?.status !== "SUCCESS";
|
|
4927
4927
|
if (human) {
|
|
4928
4928
|
process.stdout.write(
|
|
4929
|
-
`${failed2 ? "\u274C" : "\u2705"} ${
|
|
4929
|
+
`${failed2 ? "\u274C" : "\u2705"} ${run2?.packageCode ?? accepted.packageName ?? "?"} v${run2?.version ?? accepted.version ?? "?"} \u2192 ${run2?.status ?? "?"}\uFF08rowCount=${run2?.rowCount ?? 0}\uFF0C${Math.round((run2?.durationMs ?? 0) / 1e3)}s\uFF09
|
|
4930
4930
|
`
|
|
4931
4931
|
);
|
|
4932
|
-
if (
|
|
4932
|
+
if (run2?.errorMessage) process.stdout.write(` \u539F\u56E0\uFF1A${run2.errorMessage}
|
|
4933
4933
|
`);
|
|
4934
4934
|
}
|
|
4935
|
-
emit3({ ...
|
|
4935
|
+
emit3({ ...run2 ?? {}, runId: accepted.runId, documentId: accepted.documentId }, fmt);
|
|
4936
4936
|
process.exitCode = failed2 ? 1 : 0;
|
|
4937
4937
|
return;
|
|
4938
4938
|
} catch (e) {
|
|
@@ -4950,9 +4950,9 @@ async function datapackageStatusCommand(runId, args) {
|
|
|
4950
4950
|
try {
|
|
4951
4951
|
const ctx = await getActiveAuthContextFromCli(args);
|
|
4952
4952
|
const client3 = HcmClient17.fromAuthContext(ctx);
|
|
4953
|
-
const
|
|
4953
|
+
const run2 = await fetchInstallRun(client3, runId);
|
|
4954
4954
|
const fmt = args.output ?? "json";
|
|
4955
|
-
if (!
|
|
4955
|
+
if (!run2) {
|
|
4956
4956
|
if (fmt !== "json") {
|
|
4957
4957
|
process.stdout.write(`\u23F3 \u6D41\u6C34 ${runId} \u8FD8\u6CA1\u51FA\u73B0\u2014\u2014\u521A\u53D7\u7406\u7684\u88C5\u8F7D\u4F1A\u6709\u51E0\u767E\u6BEB\u79D2\u7684\u7A7A\u7A97\u3002
|
|
4958
4958
|
`);
|
|
@@ -4962,12 +4962,12 @@ async function datapackageStatusCommand(runId, args) {
|
|
|
4962
4962
|
return;
|
|
4963
4963
|
}
|
|
4964
4964
|
if (fmt !== "json") {
|
|
4965
|
-
process.stdout.write(`${renderProgress(
|
|
4965
|
+
process.stdout.write(`${renderProgress(run2)}
|
|
4966
4966
|
`);
|
|
4967
|
-
if (
|
|
4967
|
+
if (run2.errorMessage) process.stdout.write(` \u539F\u56E0\uFF1A${run2.errorMessage}
|
|
4968
4968
|
`);
|
|
4969
4969
|
}
|
|
4970
|
-
emit3({ ...
|
|
4970
|
+
emit3({ ...run2, ...isTerminalRunStatus(run2.status) ? {} : { next_step: `hcm datapackage status ${runId}` } }, fmt);
|
|
4971
4971
|
process.exitCode = 0;
|
|
4972
4972
|
return;
|
|
4973
4973
|
} catch (e) {
|
|
@@ -4976,13 +4976,13 @@ async function datapackageStatusCommand(runId, args) {
|
|
|
4976
4976
|
else exitWithError(e);
|
|
4977
4977
|
}
|
|
4978
4978
|
}
|
|
4979
|
-
function renderProgress(
|
|
4980
|
-
if (!
|
|
4981
|
-
const phase =
|
|
4982
|
-
const files =
|
|
4983
|
-
const rows =
|
|
4984
|
-
const pct =
|
|
4985
|
-
const file =
|
|
4979
|
+
function renderProgress(run2) {
|
|
4980
|
+
if (!run2) return "\u23F3 \u7B49\u5F85\u88C5\u8F7D\u6D41\u6C34\u51FA\u73B0\u2026";
|
|
4981
|
+
const phase = run2.phase ?? run2.status ?? "?";
|
|
4982
|
+
const files = run2.filesTotal ? `${run2.filesDone ?? 0}/${run2.filesTotal} \u6587\u4EF6` : `${run2.filesDone ?? 0} \u6587\u4EF6`;
|
|
4983
|
+
const rows = run2.rowsTotal ? `${run2.rowsDone ?? 0}/${run2.rowsTotal} \u884C` : `${run2.rowsDone ?? 0} \u884C`;
|
|
4984
|
+
const pct = run2.rowsTotal ? ` ${Math.min(100, Math.round((run2.rowsDone ?? 0) / run2.rowsTotal * 100))}%` : "";
|
|
4985
|
+
const file = run2.currentFile ? ` ${truncateTail(run2.currentFile, 42)}` : "";
|
|
4986
4986
|
return `\u23F3 ${phase}${pct} ${files} ${rows}${file}`;
|
|
4987
4987
|
}
|
|
4988
4988
|
function truncateTail(text, max) {
|
|
@@ -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(path19, 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(), path19);
|
|
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(path18, 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(path19) {
|
|
6622
|
+
const base = path19.split(/[\\/]/).pop() ?? path19;
|
|
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, path19) {
|
|
6640
|
+
const { model, kind, state } = parseMetaPath(path19);
|
|
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 ${path19} \u8BA4\u4E0D\u51FA\u6A21\u578B\u540D/\u5C42\u540D` };
|
|
6643
6643
|
}
|
|
6644
6644
|
try {
|
|
6645
6645
|
await clearMetaCache2(c.raw(), model, {});
|
|
@@ -6670,21 +6670,21 @@ async function verifyAfterWrite(c, path18) {
|
|
|
6670
6670
|
run: () => c.raw().get(`/api/models/${model}`, { params: { state: state ?? "default", size: 1 } })
|
|
6671
6671
|
});
|
|
6672
6672
|
}
|
|
6673
|
-
for (const
|
|
6673
|
+
for (const probe2 of probes) {
|
|
6674
6674
|
try {
|
|
6675
|
-
await
|
|
6675
|
+
await probe2.run();
|
|
6676
6676
|
} catch (e) {
|
|
6677
6677
|
const why = unverifiableReason(e);
|
|
6678
|
-
if (why) return { status: "unverified", where:
|
|
6678
|
+
if (why) return { status: "unverified", where: probe2.where, why };
|
|
6679
6679
|
const err = e;
|
|
6680
6680
|
const body = err.response?.data;
|
|
6681
6681
|
const raw = typeof body === "string" ? body : JSON.stringify(body ?? err.message ?? String(e));
|
|
6682
|
-
return { status: "broken", where:
|
|
6682
|
+
return { status: "broken", where: probe2.where, raw };
|
|
6683
6683
|
}
|
|
6684
6684
|
}
|
|
6685
6685
|
return { status: "ok" };
|
|
6686
6686
|
}
|
|
6687
|
-
async function metaSetCommand(
|
|
6687
|
+
async function metaSetCommand(path19, args) {
|
|
6688
6688
|
try {
|
|
6689
6689
|
if (!args.file) {
|
|
6690
6690
|
throw new CliError19({
|
|
@@ -6700,9 +6700,9 @@ async function metaSetCommand(path18, 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(path19, 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 ${path19}\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(path18, args) {
|
|
|
6721
6721
|
if (dryFmt === "json" || dryFmt === "yaml") {
|
|
6722
6722
|
process.stdout.write(
|
|
6723
6723
|
formatObject18(
|
|
6724
|
-
{ dryRun: true, path:
|
|
6724
|
+
{ dryRun: true, path: path19, 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 ${path19}\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(), path19);
|
|
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()}-${path19.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(), path19, 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 ${path19}
|
|
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 ${path19} --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 ${path19}${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 ${path19}${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, path19);
|
|
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(path19, 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 ${path19}\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(), path19);
|
|
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 ${path19}
|
|
6826
6826
|
`);
|
|
6827
6827
|
process.stdout.write(formatObject18(result, { format: fmt }) + "\n");
|
|
6828
6828
|
process.exitCode = 0;
|
|
@@ -6831,7 +6831,7 @@ async function metaDeleteCommand(path18, args) {
|
|
|
6831
6831
|
fail5(e, args);
|
|
6832
6832
|
}
|
|
6833
6833
|
}
|
|
6834
|
-
async function metaValidateCommand(
|
|
6834
|
+
async function metaValidateCommand(path19, args) {
|
|
6835
6835
|
try {
|
|
6836
6836
|
if (!args.file) {
|
|
6837
6837
|
throw new CliError19({
|
|
@@ -6846,13 +6846,13 @@ async function metaValidateCommand(path18, 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(path19, 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: path19,
|
|
6856
6856
|
kind: result.kind,
|
|
6857
6857
|
schemaKnown: result.schemaKnown,
|
|
6858
6858
|
schemaSourceCommit: META_SCHEMA_SOURCE_COMMIT,
|
|
@@ -6864,7 +6864,7 @@ async function metaValidateCommand(path18, args) {
|
|
|
6864
6864
|
);
|
|
6865
6865
|
} else {
|
|
6866
6866
|
process.stdout.write(
|
|
6867
|
-
`\u{1F50E} ${
|
|
6867
|
+
`\u{1F50E} ${path19}\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);
|
|
@@ -6992,6 +6995,7 @@ async function workspaceActiveCommand(args) {
|
|
|
6992
6995
|
activeWorkspaceKey,
|
|
6993
6996
|
localWorkspaceKey: localContext?.workspaceKey ?? null,
|
|
6994
6997
|
matchesLocal: activeWorkspaceKey && localContext?.workspaceKey ? activeWorkspaceKey === localContext.workspaceKey : null,
|
|
6998
|
+
nextCommand: workspaceActiveNextCommand(activeWorkspaceKey),
|
|
6995
6999
|
profile: client3.profile,
|
|
6996
7000
|
tenantId: client3.tenantId,
|
|
6997
7001
|
endpoint: client3.endpoint,
|
|
@@ -7192,6 +7196,92 @@ async function workspaceAddMiniCommand(appCode, args) {
|
|
|
7192
7196
|
exitWorkspaceError(e, args.env ?? args.profile);
|
|
7193
7197
|
}
|
|
7194
7198
|
}
|
|
7199
|
+
async function workspaceRmCommand(relativePath, args) {
|
|
7200
|
+
try {
|
|
7201
|
+
const rootDir = resolveRootDir(args.dir);
|
|
7202
|
+
const context = await requireWorkspaceContext(rootDir);
|
|
7203
|
+
const normalized = normalizeWorkspaceRmPath(relativePath);
|
|
7204
|
+
const absolutePath = path5.join(rootDir, ...normalized.split("/"));
|
|
7205
|
+
let stat;
|
|
7206
|
+
try {
|
|
7207
|
+
stat = await fs5.lstat(absolutePath);
|
|
7208
|
+
} catch (e) {
|
|
7209
|
+
if (e.code !== "ENOENT") throw e;
|
|
7210
|
+
stat = null;
|
|
7211
|
+
}
|
|
7212
|
+
if (stat?.isDirectory()) {
|
|
7213
|
+
throw new Error(`workspace rm only accepts a file path: ${normalized}`);
|
|
7214
|
+
}
|
|
7215
|
+
if (stat && !stat.isFile()) {
|
|
7216
|
+
throw new Error(`workspace rm refuses non-regular files: ${normalized}`);
|
|
7217
|
+
}
|
|
7218
|
+
const manifest2 = await readWorkspaceRawManifest(rootDir, context);
|
|
7219
|
+
let manifestEntry = manifest2.files.find((file) => file.localPath === normalized);
|
|
7220
|
+
if (!manifestEntry && stat) {
|
|
7221
|
+
const client3 = await loadProfileClient({
|
|
7222
|
+
...args,
|
|
7223
|
+
env: args.env ?? args.profile ?? context.profile
|
|
7224
|
+
});
|
|
7225
|
+
if (client3) {
|
|
7226
|
+
const remote = (await listWorkspaceFiles(client3.raw(), context.workspaceKey)).data.find(
|
|
7227
|
+
(file) => file.relativePath === normalized
|
|
7228
|
+
);
|
|
7229
|
+
if (remote) {
|
|
7230
|
+
const content = await loadWorkspaceFileContent(client3.raw(), remote.id);
|
|
7231
|
+
manifestEntry = {
|
|
7232
|
+
localPath: normalized,
|
|
7233
|
+
remotePath: remote.relativePath,
|
|
7234
|
+
fileId: remote.id,
|
|
7235
|
+
sha256: sha2563(content.content),
|
|
7236
|
+
size: Buffer.byteLength(content.content, "utf8"),
|
|
7237
|
+
lastModified: remote.lastModified
|
|
7238
|
+
};
|
|
7239
|
+
manifest2.files.push(manifestEntry);
|
|
7240
|
+
await writeWorkspaceRawManifest(rootDir, manifest2);
|
|
7241
|
+
}
|
|
7242
|
+
}
|
|
7243
|
+
}
|
|
7244
|
+
if (!stat) {
|
|
7245
|
+
if (manifestEntry) {
|
|
7246
|
+
process.stdout.write(
|
|
7247
|
+
formatObject19(
|
|
7248
|
+
{
|
|
7249
|
+
workspaceKey: context.workspaceKey,
|
|
7250
|
+
file: normalized,
|
|
7251
|
+
status: "deleted",
|
|
7252
|
+
staged: true,
|
|
7253
|
+
next: `hcm workspace push --dir ${args.dir ?? "."}`
|
|
7254
|
+
},
|
|
7255
|
+
{ format: args.output ?? "table" }
|
|
7256
|
+
) + "\n"
|
|
7257
|
+
);
|
|
7258
|
+
process.exitCode = 0;
|
|
7259
|
+
return;
|
|
7260
|
+
}
|
|
7261
|
+
throw new Error(`workspace file not found locally or in the workspace: ${normalized}`);
|
|
7262
|
+
}
|
|
7263
|
+
await fs5.unlink(absolutePath);
|
|
7264
|
+
const result = {
|
|
7265
|
+
workspaceKey: context.workspaceKey,
|
|
7266
|
+
file: normalized,
|
|
7267
|
+
status: "deleted",
|
|
7268
|
+
staged: true,
|
|
7269
|
+
next: `hcm workspace push --dir ${args.dir ?? "."}`
|
|
7270
|
+
};
|
|
7271
|
+
if (args.output === "json" || args.output === "yaml") {
|
|
7272
|
+
process.stdout.write(formatObject19(result, { format: args.output }) + "\n");
|
|
7273
|
+
} else {
|
|
7274
|
+
process.stdout.write(`workspace file staged for deletion: ${normalized}
|
|
7275
|
+
`);
|
|
7276
|
+
process.stdout.write(`\u4E0B\u4E00\u6B65\uFF1A${result.next}
|
|
7277
|
+
`);
|
|
7278
|
+
}
|
|
7279
|
+
process.exitCode = 0;
|
|
7280
|
+
return;
|
|
7281
|
+
} catch (e) {
|
|
7282
|
+
exitWorkspaceError(e, args.env ?? args.profile);
|
|
7283
|
+
}
|
|
7284
|
+
}
|
|
7195
7285
|
async function workspaceStatusCommand(args) {
|
|
7196
7286
|
try {
|
|
7197
7287
|
const rootDir = resolveRootDir(args.dir);
|
|
@@ -7507,10 +7597,15 @@ async function writeTextFile(file, content, force) {
|
|
|
7507
7597
|
async function readWorkspaceRawManifest(rootDir, context) {
|
|
7508
7598
|
try {
|
|
7509
7599
|
const parsed = JSON.parse(
|
|
7510
|
-
await fs5.readFile(
|
|
7600
|
+
await fs5.readFile(
|
|
7601
|
+
path5.join(rootDir, WORKSPACE_STATE_DIR, WORKSPACE_PULL_MANIFEST_FILE),
|
|
7602
|
+
"utf-8"
|
|
7603
|
+
)
|
|
7511
7604
|
);
|
|
7512
7605
|
if (parsed.version !== WORKSPACE_CONTEXT_VERSION || parsed.workspaceKey !== context.workspaceKey) {
|
|
7513
|
-
throw new Error(
|
|
7606
|
+
throw new Error(
|
|
7607
|
+
`${WORKSPACE_PULL_MANIFEST_FILE} does not match workspace ${context.workspaceKey}`
|
|
7608
|
+
);
|
|
7514
7609
|
}
|
|
7515
7610
|
return parsed;
|
|
7516
7611
|
} catch (e) {
|
|
@@ -7527,14 +7622,16 @@ async function readWorkspaceRawManifest(rootDir, context) {
|
|
|
7527
7622
|
async function writeWorkspaceRawState(rootDir, context, files, remoteByLocalPath) {
|
|
7528
7623
|
const stateDir = path5.join(rootDir, WORKSPACE_STATE_DIR);
|
|
7529
7624
|
await fs5.mkdir(stateDir, { recursive: true });
|
|
7530
|
-
const snapshots = files.map(
|
|
7531
|
-
|
|
7532
|
-
|
|
7533
|
-
|
|
7534
|
-
|
|
7535
|
-
|
|
7536
|
-
|
|
7537
|
-
|
|
7625
|
+
const snapshots = files.map(
|
|
7626
|
+
(file) => ({
|
|
7627
|
+
localPath: file.localPath,
|
|
7628
|
+
remotePath: file.localPath,
|
|
7629
|
+
fileId: remoteByLocalPath.get(file.localPath)?.id,
|
|
7630
|
+
sha256: file.sha256,
|
|
7631
|
+
size: file.size,
|
|
7632
|
+
lastModified: remoteByLocalPath.get(file.localPath)?.lastModified
|
|
7633
|
+
})
|
|
7634
|
+
);
|
|
7538
7635
|
await fs5.writeFile(
|
|
7539
7636
|
path5.join(stateDir, WORKSPACE_PULL_MANIFEST_FILE),
|
|
7540
7637
|
JSON.stringify(
|
|
@@ -7551,6 +7648,15 @@ async function writeWorkspaceRawState(rootDir, context, files, remoteByLocalPath
|
|
|
7551
7648
|
"utf-8"
|
|
7552
7649
|
);
|
|
7553
7650
|
}
|
|
7651
|
+
async function writeWorkspaceRawManifest(rootDir, manifest2) {
|
|
7652
|
+
const stateDir = path5.join(rootDir, WORKSPACE_STATE_DIR);
|
|
7653
|
+
await fs5.mkdir(stateDir, { recursive: true });
|
|
7654
|
+
await fs5.writeFile(
|
|
7655
|
+
path5.join(stateDir, WORKSPACE_PULL_MANIFEST_FILE),
|
|
7656
|
+
JSON.stringify(manifest2, null, 2) + "\n",
|
|
7657
|
+
"utf8"
|
|
7658
|
+
);
|
|
7659
|
+
}
|
|
7554
7660
|
async function readWorkspaceRawLocalFiles(rootDir) {
|
|
7555
7661
|
const files = [];
|
|
7556
7662
|
await walkWorkspaceRawFiles(rootDir, "", files);
|
|
@@ -7625,7 +7731,9 @@ async function pushWorkspaceRawFiles(args) {
|
|
|
7625
7731
|
}
|
|
7626
7732
|
}
|
|
7627
7733
|
const latestRemoteFiles = await loadWorkspaceRawRemoteFiles(args.http, args.context.workspaceKey);
|
|
7628
|
-
const latestRemoteByLocalPath = new Map(
|
|
7734
|
+
const latestRemoteByLocalPath = new Map(
|
|
7735
|
+
latestRemoteFiles.map((file) => [file.item.relativePath, file.item])
|
|
7736
|
+
);
|
|
7629
7737
|
await writeWorkspaceRawState(args.rootDir, args.context, localFiles, latestRemoteByLocalPath);
|
|
7630
7738
|
return result;
|
|
7631
7739
|
}
|
|
@@ -7651,9 +7759,15 @@ function buildWorkspaceRawPushPlan(manifest2, localFiles, remoteFiles) {
|
|
|
7651
7759
|
const remoteSha = remote ? sha2563(remote.content) : void 0;
|
|
7652
7760
|
if (entry.status === "added") {
|
|
7653
7761
|
if (remote) {
|
|
7654
|
-
conflicts.push(
|
|
7762
|
+
conflicts.push(
|
|
7763
|
+
workspaceRawConflict(entry, "remote file already exists but was not in local snapshot")
|
|
7764
|
+
);
|
|
7655
7765
|
} else {
|
|
7656
|
-
operations.push({
|
|
7766
|
+
operations.push({
|
|
7767
|
+
operation: "create",
|
|
7768
|
+
localPath: entry.localPath,
|
|
7769
|
+
remotePath: entry.remotePath
|
|
7770
|
+
});
|
|
7657
7771
|
}
|
|
7658
7772
|
continue;
|
|
7659
7773
|
}
|
|
@@ -7865,7 +7979,9 @@ function validateWritableOptions(templateKind, args) {
|
|
|
7865
7979
|
if (templateKind === "writable-workbench") return;
|
|
7866
7980
|
if (templateKind === "multi-page") {
|
|
7867
7981
|
if (args.fields || args.defaults) {
|
|
7868
|
-
throw new Error(
|
|
7982
|
+
throw new Error(
|
|
7983
|
+
"--fields and --defaults are only supported with --template writable-workbench"
|
|
7984
|
+
);
|
|
7869
7985
|
}
|
|
7870
7986
|
return;
|
|
7871
7987
|
}
|
|
@@ -7898,6 +8014,16 @@ function normalizeWorkspaceKey(value) {
|
|
|
7898
8014
|
if (!key2) throw new Error("workspaceKey is required");
|
|
7899
8015
|
return key2;
|
|
7900
8016
|
}
|
|
8017
|
+
function normalizeWorkspaceRmPath(value) {
|
|
8018
|
+
if (path5.isAbsolute(value) || /^[A-Za-z]:[\\/]/.test(value)) {
|
|
8019
|
+
throw new Error("workspace rm path must be relative to the bound workspace");
|
|
8020
|
+
}
|
|
8021
|
+
const normalized = normalizeRelativePath(value);
|
|
8022
|
+
if (normalized === WORKSPACE_CONTEXT_FILE || normalized === WORKSPACE_STATE_DIR || normalized.startsWith(`${WORKSPACE_STATE_DIR}/`) || normalized === MINI_APPS_DIR || normalized.startsWith(`${MINI_APPS_DIR}/`)) {
|
|
8023
|
+
throw new Error(`workspace rm only accepts raw workspace files: ${normalized}`);
|
|
8024
|
+
}
|
|
8025
|
+
return normalized;
|
|
8026
|
+
}
|
|
7901
8027
|
function normalizeRelativePath(value) {
|
|
7902
8028
|
const normalized = toPosix(value).replace(/^\/+/, "").replace(/\/+/g, "/");
|
|
7903
8029
|
if (!normalized || normalized === "." || normalized.includes("\0")) {
|
|
@@ -7965,6 +8091,10 @@ function writeWorkspaceActiveResult(view, format) {
|
|
|
7965
8091
|
}
|
|
7966
8092
|
];
|
|
7967
8093
|
process.stdout.write(formatRows5(rows, { format: "table" }) + "\n");
|
|
8094
|
+
if (view.nextCommand) {
|
|
8095
|
+
process.stdout.write(`\u4E0B\u4E00\u6B65\uFF1A${view.nextCommand}
|
|
8096
|
+
`);
|
|
8097
|
+
}
|
|
7968
8098
|
}
|
|
7969
8099
|
function writeWorkspaceBindResult(context, rootDir, format) {
|
|
7970
8100
|
if (format !== "table") {
|
|
@@ -8063,7 +8193,10 @@ function writeWorkspacePushResult(rawResult, results, format) {
|
|
|
8063
8193
|
formatObject19(
|
|
8064
8194
|
{
|
|
8065
8195
|
workspaceFiles: { artifact: "workspace", ...rawResult },
|
|
8066
|
-
miniApps: results.map((item) => ({
|
|
8196
|
+
miniApps: results.map((item) => ({
|
|
8197
|
+
artifact: `mini:${item.app.appCode}`,
|
|
8198
|
+
...item.result
|
|
8199
|
+
}))
|
|
8067
8200
|
},
|
|
8068
8201
|
{ format }
|
|
8069
8202
|
) + "\n"
|
|
@@ -8228,6 +8361,28 @@ async function setDevModeBinding(client3, workspaceKey) {
|
|
|
8228
8361
|
workspaceKey
|
|
8229
8362
|
});
|
|
8230
8363
|
}
|
|
8364
|
+
function workspaceActiveNextCommand(activeWorkspaceKey) {
|
|
8365
|
+
return activeWorkspaceKey ? "hcm workspace deactivate" : null;
|
|
8366
|
+
}
|
|
8367
|
+
function unwrapWorkspaceActionPayload(response) {
|
|
8368
|
+
if (!response || typeof response !== "object") return response;
|
|
8369
|
+
const envelope = response;
|
|
8370
|
+
if (envelope.data && typeof envelope.data === "object") return envelope.data;
|
|
8371
|
+
if (envelope.result && typeof envelope.result === "object") return envelope.result;
|
|
8372
|
+
return response;
|
|
8373
|
+
}
|
|
8374
|
+
async function requestWorkspaceDeactivation(client3) {
|
|
8375
|
+
const response = await client3.action(
|
|
8376
|
+
"TenantExtensionWorkspace",
|
|
8377
|
+
"unbind-current-user",
|
|
8378
|
+
{ method: "POST", scope: "class" }
|
|
8379
|
+
);
|
|
8380
|
+
const binding = unwrapWorkspaceActionPayload(response);
|
|
8381
|
+
if (!binding || typeof binding !== "object" || binding.enabled !== false) {
|
|
8382
|
+
throw new Error("workspace deactivate \u672A\u6536\u5230 enabled=false \u7684\u670D\u52A1\u7AEF\u56DE\u6267\uFF0C\u4E0D\u80FD\u786E\u8BA4\u5DF2\u9000\u51FA\u5F00\u53D1\u6A21\u5F0F");
|
|
8383
|
+
}
|
|
8384
|
+
return binding;
|
|
8385
|
+
}
|
|
8231
8386
|
async function workspaceActivateCommand(workspaceKey, args) {
|
|
8232
8387
|
try {
|
|
8233
8388
|
const client3 = HcmClient19.fromAuthContext(await getActiveAuthContextFromCli(args));
|
|
@@ -8249,6 +8404,24 @@ async function workspaceActivateCommand(workspaceKey, args) {
|
|
|
8249
8404
|
exitWorkspaceError(e, args.env ?? args.profile);
|
|
8250
8405
|
}
|
|
8251
8406
|
}
|
|
8407
|
+
async function workspaceDeactivateCommand(args) {
|
|
8408
|
+
try {
|
|
8409
|
+
const client3 = HcmClient19.fromAuthContext(await getActiveAuthContextFromCli(args));
|
|
8410
|
+
const binding = await requestWorkspaceDeactivation(client3);
|
|
8411
|
+
const result = { ...binding, deactivated: true };
|
|
8412
|
+
const fmt = args.output ?? "table";
|
|
8413
|
+
if (fmt === "table") {
|
|
8414
|
+
process.stdout.write("workspace deactivated\n");
|
|
8415
|
+
process.stdout.write("\u5F53\u524D\u8EAB\u4EFD\u5DF2\u9000\u51FA\u5F00\u53D1\u8005\u6A21\u5F0F\uFF1B\u5F00\u53D1\u7A7A\u95F4\u3001\u672C\u5730\u6587\u4EF6\u4E0E\u5DF2\u53D1\u5E03\u8D44\u4EA7\u5747\u672A\u5220\u9664\u3002\n");
|
|
8416
|
+
} else {
|
|
8417
|
+
process.stdout.write(formatObject19(result, { format: fmt }) + "\n");
|
|
8418
|
+
}
|
|
8419
|
+
process.exitCode = 0;
|
|
8420
|
+
return;
|
|
8421
|
+
} catch (e) {
|
|
8422
|
+
exitWorkspaceError(e, args.env ?? args.profile);
|
|
8423
|
+
}
|
|
8424
|
+
}
|
|
8252
8425
|
|
|
8253
8426
|
// src/commands/identity.ts
|
|
8254
8427
|
init_exit();
|
|
@@ -8410,6 +8583,9 @@ var GUARDED_EXECUTOR_REASON_CODES = /* @__PURE__ */ new Set([
|
|
|
8410
8583
|
"action-effect-unrecognized",
|
|
8411
8584
|
"workspace-create",
|
|
8412
8585
|
"workspace-activate",
|
|
8586
|
+
"workspace-deactivate",
|
|
8587
|
+
// bind / add mini / rm 都是受控本地工作区变更;rm 暂存删除,push 再执行远端 DELETE。
|
|
8588
|
+
"workspace-local-change",
|
|
8413
8589
|
// 这两个的载荷是**任意文件 / 整棵目录**,此前刻意不收——绑不住就意味着
|
|
8414
8590
|
// 「批准时看到的内容」与「执行时实际读到的内容」可以不同。
|
|
8415
8591
|
//
|
|
@@ -8550,8 +8726,12 @@ function classify(argv, actionResolution) {
|
|
|
8550
8726
|
}
|
|
8551
8727
|
if (name === "models") return direct("R0", "product-discovery", "model-discovery");
|
|
8552
8728
|
if (name === "config") {
|
|
8553
|
-
if (["list", "show", "get"].includes(subcommand))
|
|
8554
|
-
|
|
8729
|
+
if (["list", "show", "get"].includes(subcommand))
|
|
8730
|
+
return direct("R0", "local-discovery", "config-read");
|
|
8731
|
+
return forbidden(
|
|
8732
|
+
"identity-governance",
|
|
8733
|
+
"\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"
|
|
8734
|
+
);
|
|
8555
8735
|
}
|
|
8556
8736
|
if (name === "upgrade" || name === "self-update") {
|
|
8557
8737
|
return direct("R1", "managed-local-write", "cli-self-upgrade");
|
|
@@ -8571,6 +8751,15 @@ function classify(argv, actionResolution) {
|
|
|
8571
8751
|
if (subcommand === "test") return direct("R1", "remote-read", "chiron-regression-test");
|
|
8572
8752
|
return forbidden("unknown-command", "\u672A\u77E5 chiron \u5B50\u547D\u4EE4\u6309\u6700\u9AD8\u98CE\u9669\u5173\u95ED\u3002");
|
|
8573
8753
|
}
|
|
8754
|
+
if (name === "jira") {
|
|
8755
|
+
if (["probe", "open", "show", "audit", "search", "status"].includes(subcommand)) {
|
|
8756
|
+
return direct("R1", "remote-read", "jira-read");
|
|
8757
|
+
}
|
|
8758
|
+
if (["comment", "assign", "move", "to-issue", "sync", "verify-pass", "verify-fail", "submit"].includes(subcommand)) {
|
|
8759
|
+
return direct("R1", "external-tracker-write", "jira-tracker-write");
|
|
8760
|
+
}
|
|
8761
|
+
return forbidden("unknown-command", "\u672A\u77E5 jira \u5B50\u547D\u4EE4\u6309\u6700\u9AD8\u98CE\u9669\u5173\u95ED\u3002");
|
|
8762
|
+
}
|
|
8574
8763
|
if (name === "skills") {
|
|
8575
8764
|
if (subcommand === "list" || subcommand === "show") {
|
|
8576
8765
|
return direct("R0", "product-discovery", "skill-discovery");
|
|
@@ -8631,8 +8820,10 @@ function classify(argv, actionResolution) {
|
|
|
8631
8820
|
if (subcommand === "bind" || subcommand === "add" && argv[2] === "mini") {
|
|
8632
8821
|
return guarded("managed-local-write", "workspace-local-change");
|
|
8633
8822
|
}
|
|
8823
|
+
if (subcommand === "rm") return guarded("managed-local-write", "workspace-local-change");
|
|
8634
8824
|
if (subcommand === "create") return guarded("tenant-write", "workspace-create");
|
|
8635
8825
|
if (subcommand === "activate") return guarded("tenant-write", "workspace-activate");
|
|
8826
|
+
if (subcommand === "deactivate") return guarded("tenant-write", "workspace-deactivate");
|
|
8636
8827
|
if (subcommand === "push") return guarded("tenant-write", "workspace-push");
|
|
8637
8828
|
if (["deploy", "release", "promote", "publish"].includes(subcommand)) {
|
|
8638
8829
|
return forbidden("publish", "\u90E8\u7F72\u5230 active \u5C5E\u4E8E R3\uFF0C\u987B\u8D70\u53D1\u5E03\u4E0E\u5BA1\u6279\u94FE\u8DEF\u3002");
|
|
@@ -9925,9 +10116,9 @@ async function deliveryDoctorCommand(args) {
|
|
|
9925
10116
|
try {
|
|
9926
10117
|
const ctx = await getActiveAuthContextFromCli(args);
|
|
9927
10118
|
const client3 = HcmClient21.fromAuthContext(ctx);
|
|
9928
|
-
const
|
|
9929
|
-
const identity2 = await fetchReconIdentity(
|
|
9930
|
-
const report = await runDoctor(
|
|
10119
|
+
const probe2 = httpProbe(client3.raw(), args.capabilities ?? DEFAULT_CAPABILITIES);
|
|
10120
|
+
const identity2 = await fetchReconIdentity(probe2, ctx.tenantId);
|
|
10121
|
+
const report = await runDoctor(probe2, identity2);
|
|
9931
10122
|
const fmt = args.output ?? "json";
|
|
9932
10123
|
if (fmt !== "json") process.stdout.write(render2(report) + "\n");
|
|
9933
10124
|
process.stdout.write(formatObject23(report, { format: fmt }) + "\n");
|
|
@@ -9944,8 +10135,8 @@ async function deliveryDoctorCommand(args) {
|
|
|
9944
10135
|
// src/commands/chiron-init.ts
|
|
9945
10136
|
init_auth_guard();
|
|
9946
10137
|
init_exit();
|
|
9947
|
-
import { promises as
|
|
9948
|
-
import
|
|
10138
|
+
import { promises as fs11 } from "fs";
|
|
10139
|
+
import path11 from "path";
|
|
9949
10140
|
import {
|
|
9950
10141
|
CliError as CliError21,
|
|
9951
10142
|
CliErrorCode as CliErrorCode20,
|
|
@@ -9960,11 +10151,205 @@ import {
|
|
|
9960
10151
|
} from "@hcmai/sdk";
|
|
9961
10152
|
|
|
9962
10153
|
// src/commands/chiron-project.ts
|
|
10154
|
+
import { promises as fs10 } from "fs";
|
|
10155
|
+
import os5 from "os";
|
|
10156
|
+
import path10 from "path";
|
|
10157
|
+
import { spawnSync } from "child_process";
|
|
10158
|
+
import { hcmConfigDir, listEnvs as listEnvs3, listIdentities as listIdentities4, loadEnv as loadEnv10, loadGlobalConfig as loadGlobalConfig10 } from "@hcmai/sdk";
|
|
10159
|
+
|
|
10160
|
+
// src/jira/client.ts
|
|
10161
|
+
import { execFileSync } from "child_process";
|
|
9963
10162
|
import { promises as fs9 } from "fs";
|
|
9964
10163
|
import os4 from "os";
|
|
9965
10164
|
import path9 from "path";
|
|
9966
|
-
|
|
9967
|
-
|
|
10165
|
+
var JIRA_BASE = (process.env.JIRA_BASE || "https://jira.hcmcloud.cn").replace(/\/+$/, "");
|
|
10166
|
+
var JIRA_PROJECT = process.env.JIRA_PROJECT || "HCMNX";
|
|
10167
|
+
var JIRA_KEYCHAIN = process.env.JIRA_KEYCHAIN_SERVICE || "jira-hcmcloud";
|
|
10168
|
+
var JIRA_TOKEN_FILE = () => process.env.JIRA_TOKEN_FILE || path9.join(os4.homedir(), ".config", "hcm", "jira-token");
|
|
10169
|
+
async function jiraTokenSource() {
|
|
10170
|
+
if (process.env.JIRA_TOKEN?.trim()) return { token: process.env.JIRA_TOKEN.trim(), from: "\u73AF\u5883\u53D8\u91CF JIRA_TOKEN" };
|
|
10171
|
+
const file = JIRA_TOKEN_FILE();
|
|
10172
|
+
try {
|
|
10173
|
+
const stat = await fs9.stat(file);
|
|
10174
|
+
const value = (await fs9.readFile(file, "utf8")).trim();
|
|
10175
|
+
if (value) {
|
|
10176
|
+
if (stat.mode & 63) process.stderr.write(`[jira] \u8B66\u544A\uFF1A${file} \u5BF9\u5176\u4ED6\u7528\u6237\u53EF\u8BFB\uFF08chmod 600 \u6536\u7D27\uFF09
|
|
10177
|
+
`);
|
|
10178
|
+
return { token: value, from: file };
|
|
10179
|
+
}
|
|
10180
|
+
} catch {
|
|
10181
|
+
}
|
|
10182
|
+
try {
|
|
10183
|
+
const out = execFileSync("security", ["find-generic-password", "-s", JIRA_KEYCHAIN, "-w"], {
|
|
10184
|
+
encoding: "utf8",
|
|
10185
|
+
stdio: ["ignore", "pipe", "ignore"]
|
|
10186
|
+
}).trim();
|
|
10187
|
+
if (out) return { token: out, from: `\u94A5\u5319\u4E32 ${JIRA_KEYCHAIN}` };
|
|
10188
|
+
} catch {
|
|
10189
|
+
}
|
|
10190
|
+
return null;
|
|
10191
|
+
}
|
|
10192
|
+
function jiraTokenHelp() {
|
|
10193
|
+
return `\u62FF\u4E0D\u5230 Jira \u4EE4\u724C\u3002next_step=\u5148\u5728 ${JIRA_BASE} \u53F3\u4E0A\u89D2\u5934\u50CF \u2192 \u4E2A\u4EBA\u8BBE\u7F6E \u2192 Personal Access Tokens \u5EFA\u4E00\u4E2A\uFF0C\u518D\u9009\u4E00\u79CD\u5B58\u6CD5\uFF08\u90FD\u4E0D\u4F1A\u8FDB\u4ED3\u5E93\uFF09\uFF1A
|
|
10194
|
+
\u2460 \u6587\u4EF6\uFF08\u63A8\u8350\uFF0C\u4E0D\u5F39\u7A97\uFF09\uFF1Amkdir -p ~/.config/hcm && (umask 177; cat > ${JIRA_TOKEN_FILE()}) \u7136\u540E\u7C98\u4EE4\u724C\u3001Ctrl-D
|
|
10195
|
+
\u2461 \u94A5\u5319\u4E32\uFF08\u514D\u5F39\u7A97\u8981\u5E26 -A\uFF09\uFF1Asecurity add-generic-password -a "$USER" -s ${JIRA_KEYCHAIN} -A -w
|
|
10196
|
+
\u2462 \u53EA\u7528\u4E00\u6B21\uFF1AJIRA_TOKEN=<\u4EE4\u724C> \u8DD1\u672C\u6B21\u547D\u4EE4`;
|
|
10197
|
+
}
|
|
10198
|
+
var JiraClient = class {
|
|
10199
|
+
base;
|
|
10200
|
+
project;
|
|
10201
|
+
token;
|
|
10202
|
+
fetchImpl;
|
|
10203
|
+
timeoutMs;
|
|
10204
|
+
constructor(o) {
|
|
10205
|
+
this.base = (o.base ?? JIRA_BASE).replace(/\/+$/, "");
|
|
10206
|
+
this.project = o.project ?? JIRA_PROJECT;
|
|
10207
|
+
this.token = o.token;
|
|
10208
|
+
this.fetchImpl = o.fetchImpl ?? fetch;
|
|
10209
|
+
this.timeoutMs = o.timeoutMs ?? 3e4;
|
|
10210
|
+
}
|
|
10211
|
+
browseUrl(key2) {
|
|
10212
|
+
return `${this.base}/browse/${key2}`;
|
|
10213
|
+
}
|
|
10214
|
+
/** 一次 REST 调用。失败时把 Jira 的 errorMessages 原样带出来,不吞。 */
|
|
10215
|
+
async api(p, init = {}) {
|
|
10216
|
+
const method = init.method ?? "GET";
|
|
10217
|
+
const url = p.startsWith("http") ? p : `${this.base}${p}`;
|
|
10218
|
+
const res = await this.fetchImpl(url, {
|
|
10219
|
+
method,
|
|
10220
|
+
headers: {
|
|
10221
|
+
Authorization: `Bearer ${this.token}`,
|
|
10222
|
+
Accept: "application/json",
|
|
10223
|
+
...init.body !== void 0 ? { "Content-Type": "application/json" } : {}
|
|
10224
|
+
},
|
|
10225
|
+
body: init.body !== void 0 ? JSON.stringify(init.body) : void 0,
|
|
10226
|
+
signal: AbortSignal.timeout(this.timeoutMs)
|
|
10227
|
+
});
|
|
10228
|
+
const text = await res.text();
|
|
10229
|
+
if (!res.ok) {
|
|
10230
|
+
let detail = text.slice(0, 600);
|
|
10231
|
+
try {
|
|
10232
|
+
const j = JSON.parse(text);
|
|
10233
|
+
const msgs = [...j.errorMessages ?? [], ...Object.entries(j.errors ?? {}).map(([k, v]) => `${k}: ${v}`)];
|
|
10234
|
+
if (msgs.length) detail = msgs.join("\uFF1B");
|
|
10235
|
+
} catch {
|
|
10236
|
+
}
|
|
10237
|
+
const hint = res.status === 401 ? " next_step=\u4EE4\u724C\u65E0\u6548\u6216\u8FC7\u671F\uFF0C\u91CD\u5EFA PAT \u540E\u91CD\u65B0\u5B58\u4E00\u6B21" : res.status === 403 ? " next_step=\u4EE4\u724C\u6709\u6548\u4F46\u6CA1\u6709\u8FD9\u4E2A\u9879\u76EE\u7684\u6743\u9650\uFF0C\u627E Jira \u7BA1\u7406\u5458\u5F00\u6743\u9650" : "";
|
|
10238
|
+
throw new Error(`Jira ${method} ${p} \u2192 ${res.status}\uFF1A${detail}${hint}`);
|
|
10239
|
+
}
|
|
10240
|
+
return text ? JSON.parse(text) : null;
|
|
10241
|
+
}
|
|
10242
|
+
serverInfo() {
|
|
10243
|
+
return this.api("/rest/api/2/serverInfo");
|
|
10244
|
+
}
|
|
10245
|
+
myself() {
|
|
10246
|
+
return this.api("/rest/api/2/myself");
|
|
10247
|
+
}
|
|
10248
|
+
async search(jql, {
|
|
10249
|
+
fields = ["summary", "status", "priority", "created", "updated", "labels", "issuetype", "reporter", "resolution"],
|
|
10250
|
+
max = 30
|
|
10251
|
+
} = {}) {
|
|
10252
|
+
const q = new URLSearchParams({ jql, maxResults: String(max), fields: fields.join(",") });
|
|
10253
|
+
const r = await this.api(`/rest/api/2/search?${q}`);
|
|
10254
|
+
return r.issues ?? [];
|
|
10255
|
+
}
|
|
10256
|
+
issue(key2, fields) {
|
|
10257
|
+
return this.api(`/rest/api/2/issue/${encodeURIComponent(key2)}${fields ? `?fields=${fields.join(",")}` : ""}`);
|
|
10258
|
+
}
|
|
10259
|
+
async comments(key2) {
|
|
10260
|
+
const r = await this.api(
|
|
10261
|
+
`/rest/api/2/issue/${encodeURIComponent(key2)}/comment?maxResults=50`
|
|
10262
|
+
);
|
|
10263
|
+
return r.comments ?? [];
|
|
10264
|
+
}
|
|
10265
|
+
addComment(key2, body) {
|
|
10266
|
+
return this.api(`/rest/api/2/issue/${encodeURIComponent(key2)}/comment`, { method: "POST", body: { body } });
|
|
10267
|
+
}
|
|
10268
|
+
createIssue(fields) {
|
|
10269
|
+
return this.api("/rest/api/2/issue", { method: "POST", body: { fields } });
|
|
10270
|
+
}
|
|
10271
|
+
async transitions(key2) {
|
|
10272
|
+
const r = await this.api(
|
|
10273
|
+
`/rest/api/2/issue/${encodeURIComponent(key2)}/transitions?expand=transitions.fields`
|
|
10274
|
+
);
|
|
10275
|
+
return r.transitions ?? [];
|
|
10276
|
+
}
|
|
10277
|
+
/** 按流转 id / 流转名 / 目标状态名三种写法找;找不到把可用流转列出来,不猜。 */
|
|
10278
|
+
async transition(key2, nameOrId, comment) {
|
|
10279
|
+
const list = await this.transitions(key2);
|
|
10280
|
+
const hit = list.find((t) => t.id === String(nameOrId)) || list.find((t) => t.name === nameOrId) || list.find((t) => t.to?.name === nameOrId);
|
|
10281
|
+
if (!hit) {
|
|
10282
|
+
throw new Error(
|
|
10283
|
+
`${key2} \u4E0A\u6CA1\u6709\u5230\u300C${nameOrId}\u300D\u7684\u6D41\u8F6C\u3002\u53EF\u7528\uFF1A${list.map((t) => `${t.name}\u2192${t.to?.name}`).join(" / ") || "\uFF08\u65E0\uFF09"}`
|
|
10284
|
+
);
|
|
10285
|
+
}
|
|
10286
|
+
await this.api(`/rest/api/2/issue/${encodeURIComponent(key2)}/transitions`, {
|
|
10287
|
+
method: "POST",
|
|
10288
|
+
body: {
|
|
10289
|
+
transition: { id: hit.id },
|
|
10290
|
+
...comment ? { update: { comment: [{ add: { body: comment } }] } } : {}
|
|
10291
|
+
}
|
|
10292
|
+
});
|
|
10293
|
+
return hit;
|
|
10294
|
+
}
|
|
10295
|
+
/**
|
|
10296
|
+
* 建单前先问 Jira:这个项目有哪些 issuetype、每种哪些字段必填、可选值是什么。
|
|
10297
|
+
*
|
|
10298
|
+
* 🔴 不写死 customfield 编号:同名字段在别的项目里编号不同,写死就是换个项目静默填错格。
|
|
10299
|
+
* Jira 9 起旧的 `createmeta?projectKeys=&expand=` 已移除(11.3.2 实测 404),用按 issuetype 分页的新接口。
|
|
10300
|
+
*/
|
|
10301
|
+
async createMeta(project = this.project) {
|
|
10302
|
+
const list = await this.api(
|
|
10303
|
+
`/rest/api/2/issue/createmeta/${project}/issuetypes`
|
|
10304
|
+
);
|
|
10305
|
+
const types = list.values ?? list.issueTypes ?? [];
|
|
10306
|
+
const out = [];
|
|
10307
|
+
for (const t of types) {
|
|
10308
|
+
if (t.subtask) continue;
|
|
10309
|
+
const f = await this.api(`/rest/api/2/issue/createmeta/${project}/issuetypes/${t.id}`);
|
|
10310
|
+
out.push({ id: t.id, name: t.name, fields: f.values ?? [] });
|
|
10311
|
+
}
|
|
10312
|
+
return out;
|
|
10313
|
+
}
|
|
10314
|
+
projectInfo(project = this.project) {
|
|
10315
|
+
return this.api(`/rest/api/2/project/${project}`);
|
|
10316
|
+
}
|
|
10317
|
+
projectStatuses(project = this.project) {
|
|
10318
|
+
return this.api(`/rest/api/2/project/${project}/statuses`);
|
|
10319
|
+
}
|
|
10320
|
+
/**
|
|
10321
|
+
* 远程链接:把代码库的 issue 挂到 Jira 单的「链接」栏里,而不是埋在评论中。
|
|
10322
|
+
* 公司现有惯例就是这样(HF 的开发任务用链接挂到 HCR 的需求上),照它来。
|
|
10323
|
+
* globalId 用 URL 本身,重复调用是覆盖不是新增。
|
|
10324
|
+
*/
|
|
10325
|
+
addRemoteLink(key2, url, title, relationship = "\u4EE3\u7801\u5E93\u6761\u76EE") {
|
|
10326
|
+
return this.api(`/rest/api/2/issue/${encodeURIComponent(key2)}/remotelink`, {
|
|
10327
|
+
method: "POST",
|
|
10328
|
+
body: {
|
|
10329
|
+
globalId: url,
|
|
10330
|
+
relationship,
|
|
10331
|
+
object: { url, title, icon: { url16x16: "https://cnb.cool/favicon.ico", title: "cnb" } }
|
|
10332
|
+
}
|
|
10333
|
+
});
|
|
10334
|
+
}
|
|
10335
|
+
async remoteLinks(key2) {
|
|
10336
|
+
try {
|
|
10337
|
+
return await this.api(`/rest/api/2/issue/${encodeURIComponent(key2)}/remotelink`) ?? [];
|
|
10338
|
+
} catch {
|
|
10339
|
+
return [];
|
|
10340
|
+
}
|
|
10341
|
+
}
|
|
10342
|
+
assign(key2, name) {
|
|
10343
|
+
return this.api(`/rest/api/2/issue/${encodeURIComponent(key2)}/assignee`, { method: "PUT", body: { name } });
|
|
10344
|
+
}
|
|
10345
|
+
};
|
|
10346
|
+
async function createJiraClient(opts = {}) {
|
|
10347
|
+
const src = opts.token ? { token: opts.token, from: "\u53C2\u6570" } : await jiraTokenSource();
|
|
10348
|
+
if (!src) throw new Error(jiraTokenHelp());
|
|
10349
|
+
return new JiraClient({ ...opts, token: src.token });
|
|
10350
|
+
}
|
|
10351
|
+
|
|
10352
|
+
// src/commands/chiron-project.ts
|
|
9968
10353
|
var ENV_FILE = "env.yaml";
|
|
9969
10354
|
var SKILLS_DIR = "hcm-skills";
|
|
9970
10355
|
var CASES_REPO_URL = "https://cnb.cool/hcm/chiron-cases.git";
|
|
@@ -10063,13 +10448,13 @@ function mergeChironAgentInstructions(existing) {
|
|
|
10063
10448
|
return upsertBlock(existing, AGENT_BEGIN, AGENT_END, renderChironAgentInstructions().trimEnd());
|
|
10064
10449
|
}
|
|
10065
10450
|
function caseLibraryDir() {
|
|
10066
|
-
return
|
|
10451
|
+
return path10.join(hcmConfigDir(), CASES_MCP_NAME);
|
|
10067
10452
|
}
|
|
10068
10453
|
function codexConfigFile() {
|
|
10069
|
-
return
|
|
10454
|
+
return path10.join(process.env.HOME ?? os5.homedir(), ".codex", "config.toml");
|
|
10070
10455
|
}
|
|
10071
10456
|
function renderCodexMcpSection(repo, envName, binPath = process.env.PATH ?? "") {
|
|
10072
|
-
const server =
|
|
10457
|
+
const server = path10.join(repo, "mcp", "server.mjs");
|
|
10073
10458
|
const env2 = [
|
|
10074
10459
|
`CASES_REPO = ${JSON.stringify(repo)}`,
|
|
10075
10460
|
`HCM_ENV = ${JSON.stringify(envName)}`,
|
|
@@ -10132,13 +10517,13 @@ async function ensureCaseLibrary(envName, deps = defaultCaseLibraryDeps, paths =
|
|
|
10132
10517
|
const repo = paths.repo ?? caseLibraryDir();
|
|
10133
10518
|
const codexConfig = paths.codexConfig ?? codexConfigFile();
|
|
10134
10519
|
const status = { ok: false, repo, step: "present", serverInstalled: false, codexWired: false };
|
|
10135
|
-
const hasGit = await exists2(
|
|
10520
|
+
const hasGit = await exists2(path10.join(repo, ".git"));
|
|
10136
10521
|
if (hasGit) {
|
|
10137
10522
|
const pull = deps.git(["pull", "--ff-only", "--quiet"], repo);
|
|
10138
10523
|
status.step = pull.status === 0 ? "updated" : "present";
|
|
10139
10524
|
if (pull.status !== 0) status.reason = `\u66F4\u65B0\u5931\u8D25\uFF0C\u6CBF\u7528\u672C\u5730\u7248\u672C\uFF1A${firstLine(pull.stderr, pull.error)}`;
|
|
10140
10525
|
} else {
|
|
10141
|
-
await
|
|
10526
|
+
await fs10.mkdir(path10.dirname(repo), { recursive: true });
|
|
10142
10527
|
const clone = deps.git(["clone", "--depth", "1", "--quiet", CASES_REPO_URL, repo]);
|
|
10143
10528
|
if (clone.status !== 0) {
|
|
10144
10529
|
status.step = "clone-failed";
|
|
@@ -10147,13 +10532,13 @@ async function ensureCaseLibrary(envName, deps = defaultCaseLibraryDeps, paths =
|
|
|
10147
10532
|
}
|
|
10148
10533
|
status.step = "cloned";
|
|
10149
10534
|
}
|
|
10150
|
-
const mcpDir =
|
|
10151
|
-
if (!await exists2(
|
|
10535
|
+
const mcpDir = path10.join(repo, "mcp");
|
|
10536
|
+
if (!await exists2(path10.join(mcpDir, "server.mjs"))) {
|
|
10152
10537
|
status.step = "install-failed";
|
|
10153
10538
|
status.reason = `\u6848\u4F8B\u5E93\u91CC\u6CA1\u6709 mcp/server.mjs\uFF1A${mcpDir}`;
|
|
10154
10539
|
return status;
|
|
10155
10540
|
}
|
|
10156
|
-
if (!await exists2(
|
|
10541
|
+
if (!await exists2(path10.join(mcpDir, "node_modules", "@modelcontextprotocol"))) {
|
|
10157
10542
|
const install = deps.npmInstall(mcpDir);
|
|
10158
10543
|
if (install.status !== 0) {
|
|
10159
10544
|
status.step = "install-failed";
|
|
@@ -10162,10 +10547,10 @@ async function ensureCaseLibrary(envName, deps = defaultCaseLibraryDeps, paths =
|
|
|
10162
10547
|
}
|
|
10163
10548
|
}
|
|
10164
10549
|
status.serverInstalled = true;
|
|
10165
|
-
await
|
|
10166
|
-
const existing = await
|
|
10550
|
+
await fs10.mkdir(path10.dirname(codexConfig), { recursive: true });
|
|
10551
|
+
const existing = await fs10.readFile(codexConfig, "utf8").catch(() => "");
|
|
10167
10552
|
const next = mergeCodexMcpConfig(existing, renderCodexMcpSection(repo, envName));
|
|
10168
|
-
if (next !== existing) await
|
|
10553
|
+
if (next !== existing) await fs10.writeFile(codexConfig, next, "utf8");
|
|
10169
10554
|
status.codexWired = true;
|
|
10170
10555
|
status.ok = true;
|
|
10171
10556
|
return status;
|
|
@@ -10173,9 +10558,9 @@ async function ensureCaseLibrary(envName, deps = defaultCaseLibraryDeps, paths =
|
|
|
10173
10558
|
async function inspectCaseLibrary(paths = {}) {
|
|
10174
10559
|
const repo = paths.repo ?? caseLibraryDir();
|
|
10175
10560
|
const codexConfig = paths.codexConfig ?? codexConfigFile();
|
|
10176
|
-
const cloned = await exists2(
|
|
10177
|
-
const serverInstalled = cloned && await exists2(
|
|
10178
|
-
const codexWired = codexConfigHasCases(await
|
|
10561
|
+
const cloned = await exists2(path10.join(repo, ".git"));
|
|
10562
|
+
const serverInstalled = cloned && await exists2(path10.join(repo, "mcp", "server.mjs")) && await exists2(path10.join(repo, "mcp", "node_modules", "@modelcontextprotocol"));
|
|
10563
|
+
const codexWired = codexConfigHasCases(await fs10.readFile(codexConfig, "utf8").catch(() => ""));
|
|
10179
10564
|
return { repo, cloned, serverInstalled, codexWired };
|
|
10180
10565
|
}
|
|
10181
10566
|
function firstLine(stderr, error) {
|
|
@@ -10183,28 +10568,6 @@ function firstLine(stderr, error) {
|
|
|
10183
10568
|
const line = stderr.split(/\r?\n/).map((l) => l.trim()).find(Boolean);
|
|
10184
10569
|
return line ?? "\uFF08\u65E0\u8F93\u51FA\uFF09";
|
|
10185
10570
|
}
|
|
10186
|
-
var JIRA_BASE = (process.env.JIRA_BASE || "https://jira.hcmcloud.cn").replace(/\/+$/, "");
|
|
10187
|
-
var JIRA_PROJECT = process.env.JIRA_PROJECT || "HCMNX";
|
|
10188
|
-
var JIRA_TOKEN_FILE = () => path9.join(os4.homedir(), ".config", "hcm", "jira-token");
|
|
10189
|
-
var JIRA_KEYCHAIN = "jira-hcmcloud";
|
|
10190
|
-
async function jiraTokenSource() {
|
|
10191
|
-
if (process.env.JIRA_TOKEN?.trim()) return { token: process.env.JIRA_TOKEN.trim(), from: "\u73AF\u5883\u53D8\u91CF JIRA_TOKEN" };
|
|
10192
|
-
const file = process.env.JIRA_TOKEN_FILE || JIRA_TOKEN_FILE();
|
|
10193
|
-
try {
|
|
10194
|
-
const value = (await fs9.readFile(file, "utf8")).trim();
|
|
10195
|
-
if (value) return { token: value, from: file };
|
|
10196
|
-
} catch {
|
|
10197
|
-
}
|
|
10198
|
-
try {
|
|
10199
|
-
const out = execFileSync("security", ["find-generic-password", "-s", JIRA_KEYCHAIN, "-w"], {
|
|
10200
|
-
encoding: "utf8",
|
|
10201
|
-
stdio: ["ignore", "pipe", "ignore"]
|
|
10202
|
-
}).trim();
|
|
10203
|
-
if (out) return { token: out, from: `\u94A5\u5319\u4E32 ${JIRA_KEYCHAIN}` };
|
|
10204
|
-
} catch {
|
|
10205
|
-
}
|
|
10206
|
-
return null;
|
|
10207
|
-
}
|
|
10208
10571
|
async function inspectJira() {
|
|
10209
10572
|
const src = await jiraTokenSource();
|
|
10210
10573
|
if (!src) {
|
|
@@ -10239,7 +10602,7 @@ async function inspectJira() {
|
|
|
10239
10602
|
}
|
|
10240
10603
|
async function exists2(file) {
|
|
10241
10604
|
try {
|
|
10242
|
-
await
|
|
10605
|
+
await fs10.access(file);
|
|
10243
10606
|
return true;
|
|
10244
10607
|
} catch {
|
|
10245
10608
|
return false;
|
|
@@ -10263,7 +10626,7 @@ var defaultChironInitDeps = {
|
|
|
10263
10626
|
all: true,
|
|
10264
10627
|
target: "codex",
|
|
10265
10628
|
env: envName,
|
|
10266
|
-
dir:
|
|
10629
|
+
dir: path11.join(root, SKILLS_DIR),
|
|
10267
10630
|
output: "table"
|
|
10268
10631
|
});
|
|
10269
10632
|
} finally {
|
|
@@ -10304,8 +10667,8 @@ async function resolveLoggedInEnv() {
|
|
|
10304
10667
|
}
|
|
10305
10668
|
async function scaffoldChironProject(root, env2, envName) {
|
|
10306
10669
|
const result = { created: [], updated: [], preserved: [] };
|
|
10307
|
-
const envFile =
|
|
10308
|
-
const existing = await
|
|
10670
|
+
const envFile = path11.join(root, ENV_FILE);
|
|
10671
|
+
const existing = await fs11.readFile(envFile, "utf8").catch(() => null);
|
|
10309
10672
|
if (existing !== null) {
|
|
10310
10673
|
const recorded = parseEnvYaml(existing);
|
|
10311
10674
|
if (recorded.endpoint !== env2.endpoint) {
|
|
@@ -10325,32 +10688,32 @@ async function scaffoldChironProject(root, env2, envName) {
|
|
|
10325
10688
|
}
|
|
10326
10689
|
result.preserved.push(ENV_FILE);
|
|
10327
10690
|
} else {
|
|
10328
|
-
await
|
|
10691
|
+
await fs11.writeFile(envFile, renderEnvYaml(env2), { encoding: "utf8", mode: 420, flag: "wx" });
|
|
10329
10692
|
result.created.push(ENV_FILE);
|
|
10330
10693
|
}
|
|
10331
10694
|
for (const directory of CHIRON_PROJECT_DIRECTORIES) {
|
|
10332
|
-
const absolute =
|
|
10695
|
+
const absolute = path11.join(root, directory);
|
|
10333
10696
|
await ensureDirectory(absolute);
|
|
10334
|
-
await writeIfAbsent(
|
|
10697
|
+
await writeIfAbsent(path11.join(absolute, ".gitkeep"), "", result, `${directory}/.gitkeep`);
|
|
10335
10698
|
}
|
|
10336
|
-
const deliveryDir =
|
|
10699
|
+
const deliveryDir = path11.join(root, ".hcm-delivery");
|
|
10337
10700
|
await ensureDirectory(deliveryDir);
|
|
10338
10701
|
await writeIfAbsent(
|
|
10339
|
-
|
|
10702
|
+
path11.join(deliveryDir, "project.yml"),
|
|
10340
10703
|
renderProjectYml(envName, "plan-only"),
|
|
10341
10704
|
result,
|
|
10342
10705
|
".hcm-delivery/project.yml"
|
|
10343
10706
|
);
|
|
10344
|
-
const pageAcceptanceFile =
|
|
10707
|
+
const pageAcceptanceFile = path11.join(root, "page-acceptance.sh");
|
|
10345
10708
|
const created = await writeIfAbsent(pageAcceptanceFile, renderPageAcceptanceSh("evidence"), result, "page-acceptance.sh", 493);
|
|
10346
|
-
if (created) await
|
|
10347
|
-
await mergeManagedFile(
|
|
10348
|
-
await mergeManagedFile(
|
|
10349
|
-
await mergeManagedFile(
|
|
10709
|
+
if (created) await fs11.chmod(pageAcceptanceFile, 493);
|
|
10710
|
+
await mergeManagedFile(path11.join(root, "AGENTS.md"), mergeChironAgentInstructions, result, "AGENTS.md");
|
|
10711
|
+
await mergeManagedFile(path11.join(root, "CLAUDE.md"), mergeChironAgentInstructions, result, "CLAUDE.md");
|
|
10712
|
+
await mergeManagedFile(path11.join(root, ".gitignore"), mergeDeliveryGitignore, result, ".gitignore");
|
|
10350
10713
|
return result;
|
|
10351
10714
|
}
|
|
10352
10715
|
async function runChironInit(args, deps = defaultChironInitDeps) {
|
|
10353
|
-
const root =
|
|
10716
|
+
const root = path11.resolve(args.project ?? ".");
|
|
10354
10717
|
const { name, env: env2, identity: identity2 } = await resolveLoggedInEnv();
|
|
10355
10718
|
if (isTempEnv3(name)) {
|
|
10356
10719
|
throw new CliError21({
|
|
@@ -10421,8 +10784,8 @@ async function chironInitCommand(args, deps) {
|
|
|
10421
10784
|
// src/commands/chiron-doctor.ts
|
|
10422
10785
|
init_auth_guard();
|
|
10423
10786
|
init_exit();
|
|
10424
|
-
import { promises as
|
|
10425
|
-
import
|
|
10787
|
+
import { promises as fs12 } from "fs";
|
|
10788
|
+
import path12 from "path";
|
|
10426
10789
|
import {
|
|
10427
10790
|
HcmClient as HcmClient23,
|
|
10428
10791
|
CliError as CliError22,
|
|
@@ -10435,9 +10798,9 @@ var defaultDeps = {
|
|
|
10435
10798
|
anchors: async (envName, tenant2) => {
|
|
10436
10799
|
const ctx = await getActiveAuthContextFromCli({ env: envName });
|
|
10437
10800
|
const client3 = HcmClient23.fromAuthContext(ctx);
|
|
10438
|
-
const
|
|
10439
|
-
const identity2 = await fetchReconIdentity3(
|
|
10440
|
-
return { report: await runDoctor2(
|
|
10801
|
+
const probe2 = httpProbe3(client3.raw(), "default");
|
|
10802
|
+
const identity2 = await fetchReconIdentity3(probe2, tenant2);
|
|
10803
|
+
return { report: await runDoctor2(probe2, identity2), tokenTenant: identity2?.tenantId ? String(identity2.tenantId) : void 0 };
|
|
10441
10804
|
},
|
|
10442
10805
|
fixSkills: (root, envName) => defaultChironInitDeps.installSkills(root, envName),
|
|
10443
10806
|
fixCases: async (envName) => {
|
|
@@ -10447,9 +10810,9 @@ var defaultDeps = {
|
|
|
10447
10810
|
inspectJira: () => inspectJira()
|
|
10448
10811
|
};
|
|
10449
10812
|
async function runChironDoctor(args, deps = defaultDeps) {
|
|
10450
|
-
const root =
|
|
10813
|
+
const root = path12.resolve(args.project ?? ".");
|
|
10451
10814
|
const report = { ok: false, project: root, env: null, envName: null, lines: [] };
|
|
10452
|
-
const envText = await
|
|
10815
|
+
const envText = await fs12.readFile(path12.join(root, ENV_FILE), "utf8").catch(() => null);
|
|
10453
10816
|
if (envText === null) {
|
|
10454
10817
|
report.lines.push({
|
|
10455
10818
|
item: "\u767B\u5F55",
|
|
@@ -10498,7 +10861,7 @@ async function runChironDoctor(args, deps = defaultDeps) {
|
|
|
10498
10861
|
}
|
|
10499
10862
|
}
|
|
10500
10863
|
const skillsLine = async () => {
|
|
10501
|
-
const state = await readSkillsState(
|
|
10864
|
+
const state = await readSkillsState(path12.join(root, SKILLS_DIR));
|
|
10502
10865
|
if (!state) return { item: "\u6280\u80FD", verdict: "fail", detail: `${SKILLS_DIR}/ \u91CC\u6CA1\u6709\u5B89\u88C5\u6E05\u5355`, nextStep: "hcm chiron doctor --fix\uFF08\u6216 hcm chiron init\uFF09" };
|
|
10503
10866
|
const count = Object.keys(state.skills).length;
|
|
10504
10867
|
if (state.endpoint && normalizeOrigin(state.endpoint) !== env2.endpoint) {
|
|
@@ -10528,9 +10891,9 @@ async function runChironDoctor(args, deps = defaultDeps) {
|
|
|
10528
10891
|
cases = await casesLine();
|
|
10529
10892
|
}
|
|
10530
10893
|
report.lines.push(cases);
|
|
10531
|
-
const
|
|
10894
|
+
const jira2 = await deps.inspectJira();
|
|
10532
10895
|
report.lines.push(
|
|
10533
|
-
|
|
10896
|
+
jira2.ok ? { item: "Jira", verdict: "ok", detail: `${jira2.who || "\u5DF2\u8FDE\u63A5"} \xB7 \u770B\u5F97\u5230 ${JIRA_PROJECT}\uFF08\u4EE4\u724C\u6765\u81EA ${jira2.from}\uFF09` } : { item: "Jira", verdict: "warn", detail: jira2.reason ?? "\u4E0D\u53EF\u7528", nextStep: "\u73B0\u5728\u4E0D\u914D\u4E5F\u80FD\u4EA4\u4ED8\uFF1B\u649E\u5230\u300C\u4EA7\u54C1\u505A\u4E0D\u5230\u300D\u8981\u63D0\u5355\u65F6\u5FC5\u987B\u5148\u914D\u597D" }
|
|
10534
10897
|
);
|
|
10535
10898
|
return finish(report);
|
|
10536
10899
|
}
|
|
@@ -10564,8 +10927,8 @@ async function chironDoctorCommand(args, deps) {
|
|
|
10564
10927
|
// src/commands/chiron-test.ts
|
|
10565
10928
|
init_exit();
|
|
10566
10929
|
import { spawnSync as spawnSync2 } from "child_process";
|
|
10567
|
-
import { promises as
|
|
10568
|
-
import
|
|
10930
|
+
import { promises as fs13 } from "fs";
|
|
10931
|
+
import path13 from "path";
|
|
10569
10932
|
import yaml2 from "js-yaml";
|
|
10570
10933
|
import { formatObject as formatObject26 } from "@hcmai/sdk";
|
|
10571
10934
|
|
|
@@ -10766,7 +11129,7 @@ var defaultDeps2 = {
|
|
|
10766
11129
|
return { status: r.status, stdout: r.stdout ?? "", stderr: r.stderr ?? "" };
|
|
10767
11130
|
},
|
|
10768
11131
|
readXlsx: (file) => xlsxRows(file),
|
|
10769
|
-
readText: (file) =>
|
|
11132
|
+
readText: (file) => fs13.readFile(file, "utf8")
|
|
10770
11133
|
};
|
|
10771
11134
|
async function runCase(spec, root, opts = {}, deps = defaultDeps2) {
|
|
10772
11135
|
const results = [];
|
|
@@ -10819,7 +11182,7 @@ async function runCase(spec, root, opts = {}, deps = defaultDeps2) {
|
|
|
10819
11182
|
continue;
|
|
10820
11183
|
}
|
|
10821
11184
|
if (c.file) {
|
|
10822
|
-
const file =
|
|
11185
|
+
const file = path13.resolve(root, fill(c.file));
|
|
10823
11186
|
const want = c.expect ?? {};
|
|
10824
11187
|
const bad = [];
|
|
10825
11188
|
if (want.xlsx_header || want.xlsx_min_rows !== void 0) {
|
|
@@ -10835,7 +11198,7 @@ async function runCase(spec, root, opts = {}, deps = defaultDeps2) {
|
|
|
10835
11198
|
results.push(bad.length ? { name: c.name, verdict: "fail", detail: bad.join("\uFF1B") } : { name: c.name, verdict: "pass", detail: "" });
|
|
10836
11199
|
continue;
|
|
10837
11200
|
}
|
|
10838
|
-
const out =
|
|
11201
|
+
const out = path13.join("evidence", "test", `${spec.name}-${c.name}`.replace(/[^\w一-龥-]+/g, "_") + ".png");
|
|
10839
11202
|
const argv = ["--path", fill(c.page), "--out", out];
|
|
10840
11203
|
if (opts.env) argv.push("--env", opts.env);
|
|
10841
11204
|
const as = c.as ?? opts.as;
|
|
@@ -10851,12 +11214,12 @@ async function runCase(spec, root, opts = {}, deps = defaultDeps2) {
|
|
|
10851
11214
|
return results;
|
|
10852
11215
|
}
|
|
10853
11216
|
async function loadCases(target) {
|
|
10854
|
-
const stat = await
|
|
10855
|
-
const files = stat.isDirectory() ? (await
|
|
11217
|
+
const stat = await fs13.stat(target);
|
|
11218
|
+
const files = stat.isDirectory() ? (await fs13.readdir(target)).filter((f) => /\.ya?ml$/.test(f)).sort().map((f) => path13.join(target, f)) : [target];
|
|
10856
11219
|
const out = [];
|
|
10857
11220
|
for (const f of files) {
|
|
10858
|
-
const spec = yaml2.load(await
|
|
10859
|
-
assertUsableSpec(spec,
|
|
11221
|
+
const spec = yaml2.load(await fs13.readFile(f, "utf8"));
|
|
11222
|
+
assertUsableSpec(spec, path13.basename(f));
|
|
10860
11223
|
out.push({ file: f, spec });
|
|
10861
11224
|
}
|
|
10862
11225
|
if (out.length === 0) throw new Error(`${target} \u4E0B\u6CA1\u6709\u7528\u4F8B\uFF08*.yml\uFF09`);
|
|
@@ -10864,15 +11227,15 @@ async function loadCases(target) {
|
|
|
10864
11227
|
}
|
|
10865
11228
|
async function chironTestCommand(target, args, deps) {
|
|
10866
11229
|
try {
|
|
10867
|
-
const root =
|
|
10868
|
-
const where =
|
|
11230
|
+
const root = path13.resolve(args.project ?? ".");
|
|
11231
|
+
const where = path13.resolve(root, target ?? "tests");
|
|
10869
11232
|
const cases = await loadCases(where);
|
|
10870
11233
|
const report = [];
|
|
10871
11234
|
let failed2 = 0;
|
|
10872
11235
|
for (const { file, spec } of cases) {
|
|
10873
11236
|
const results = await runCase(spec, root, { env: args.env, as: args.as }, deps);
|
|
10874
11237
|
failed2 += results.filter((r) => r.verdict === "fail").length;
|
|
10875
|
-
report.push({ case: spec.name, file:
|
|
11238
|
+
report.push({ case: spec.name, file: path13.relative(root, file), results });
|
|
10876
11239
|
}
|
|
10877
11240
|
const fmt = args.output ?? "table";
|
|
10878
11241
|
if (fmt === "json" || fmt === "yaml") {
|
|
@@ -10901,6 +11264,763 @@ ${failed2} \u6761\u6CA1\u8FC7\u2014\u2014\u4E0A\u9762\u6BCF\u6761\u90FD\u5199\u4
|
|
|
10901
11264
|
}
|
|
10902
11265
|
}
|
|
10903
11266
|
|
|
11267
|
+
// src/commands/jira.ts
|
|
11268
|
+
import { readFileSync as readFileSync7 } from "fs";
|
|
11269
|
+
import {
|
|
11270
|
+
createHttpClient as createHttpClient4,
|
|
11271
|
+
formatObject as formatObject27,
|
|
11272
|
+
loadEnv as loadEnv12,
|
|
11273
|
+
loadGlobalConfig as loadGlobalConfig12,
|
|
11274
|
+
resolveActiveEnv as resolveActiveEnv6
|
|
11275
|
+
} from "@hcmai/sdk";
|
|
11276
|
+
init_exit();
|
|
11277
|
+
|
|
11278
|
+
// src/jira/refs.ts
|
|
11279
|
+
import { execFileSync as execFileSync2 } from "child_process";
|
|
11280
|
+
var defaultCnb = (args) => execFileSync2("cnb", args, { encoding: "utf8", maxBuffer: 1 << 26, stdio: ["ignore", "pipe", "pipe"] });
|
|
11281
|
+
var PRODUCT_REPOS = ["hcm/hcm_nx_core", "hcm/hcm_nx_cli", "hcm/hcm_nx_cloud"];
|
|
11282
|
+
var REF_RE = /hcm\/(hcm_nx_(?:core|cli|cloud))(?:#|\/-\/issues\/)(\d+)/g;
|
|
11283
|
+
function linkedRepoRefs(text) {
|
|
11284
|
+
const out = /* @__PURE__ */ new Map();
|
|
11285
|
+
for (const m of String(text ?? "").matchAll(REF_RE)) {
|
|
11286
|
+
out.set(`hcm/${m[1]}#${m[2]}`, { repo: `hcm/${m[1]}`, number: m[2] });
|
|
11287
|
+
}
|
|
11288
|
+
return [...out.values()];
|
|
11289
|
+
}
|
|
11290
|
+
var repoIssueUrl = (repo, number) => `https://cnb.cool/${repo}/-/issues/${number}`;
|
|
11291
|
+
function parseCnbIssueOutput(raw) {
|
|
11292
|
+
const fields = {};
|
|
11293
|
+
let status;
|
|
11294
|
+
for (const line of raw.split("\n")) {
|
|
11295
|
+
const head = line.match(/^status:\s*(\d+)\s*$/);
|
|
11296
|
+
if (head && status === void 0) {
|
|
11297
|
+
status = Number(head[1]);
|
|
11298
|
+
continue;
|
|
11299
|
+
}
|
|
11300
|
+
const m = line.match(/^\s+(number|title|state|state_reason|priority|url|htmlUrl|created_at|updated_at|closed_at):\s*(.*)$/);
|
|
11301
|
+
if (!m) continue;
|
|
11302
|
+
const key2 = m[1];
|
|
11303
|
+
if (fields[key2] !== void 0) continue;
|
|
11304
|
+
fields[key2] = m[2].trim().replace(/^"|"$/g, "");
|
|
11305
|
+
}
|
|
11306
|
+
return { status, fields };
|
|
11307
|
+
}
|
|
11308
|
+
function cnbIssueState(cnb, repo, number) {
|
|
11309
|
+
let raw;
|
|
11310
|
+
try {
|
|
11311
|
+
raw = cnb(["issues", "get-issue", "--repo", repo, "--number", String(number)]);
|
|
11312
|
+
} catch (e) {
|
|
11313
|
+
return { kind: "unreadable", repo, number, reason: firstLine2(e.message) };
|
|
11314
|
+
}
|
|
11315
|
+
const { status, fields } = parseCnbIssueOutput(raw);
|
|
11316
|
+
if (status === 404) return { kind: "not-issue", repo, number };
|
|
11317
|
+
if (status !== void 0 && status !== 200) {
|
|
11318
|
+
return { kind: "unreadable", repo, number, reason: `cnb \u8FD4\u56DE ${status}` };
|
|
11319
|
+
}
|
|
11320
|
+
if (!fields.state) return { kind: "unreadable", repo, number, reason: "cnb \u8F93\u51FA\u91CC\u6CA1\u6709 state \u5B57\u6BB5" };
|
|
11321
|
+
return {
|
|
11322
|
+
kind: "issue",
|
|
11323
|
+
repo,
|
|
11324
|
+
number,
|
|
11325
|
+
state: fields.state,
|
|
11326
|
+
reason: fields.state_reason || void 0,
|
|
11327
|
+
title: fields.title ?? "",
|
|
11328
|
+
priority: fields.priority || void 0,
|
|
11329
|
+
url: repoIssueUrl(repo, number)
|
|
11330
|
+
};
|
|
11331
|
+
}
|
|
11332
|
+
var describeIssueState = (s) => {
|
|
11333
|
+
if (s.kind === "issue") return `${s.repo}#${s.number} [${s.state}${s.reason ? "\xB7" + s.reason : ""}] ${s.title}`;
|
|
11334
|
+
if (s.kind === "not-issue") return `${s.repo}#${s.number} \uFF08\u4E0D\u662F issue\uFF0C\u53EF\u80FD\u662F PR \u53F7\uFF1B\u4E0D\u8BA1\u5165\uFF09`;
|
|
11335
|
+
return `${s.repo}#${s.number} \uFF08\u8BFB\u4E0D\u5230\uFF1A${s.reason}\uFF09`;
|
|
11336
|
+
};
|
|
11337
|
+
function parseCnbIssueList(raw, repo) {
|
|
11338
|
+
const out = [];
|
|
11339
|
+
let cur = null;
|
|
11340
|
+
for (const line of raw.split("\n")) {
|
|
11341
|
+
const m = line.match(/^\s*-?\s*(number|title|state|state_reason|priority):\s*(.*)$/);
|
|
11342
|
+
if (!m) continue;
|
|
11343
|
+
const key2 = m[1];
|
|
11344
|
+
const value = m[2].trim().replace(/^"|"$/g, "");
|
|
11345
|
+
if (key2 === "number") {
|
|
11346
|
+
if (cur?.number) out.push(finishRow(cur, repo));
|
|
11347
|
+
cur = { number: value };
|
|
11348
|
+
continue;
|
|
11349
|
+
}
|
|
11350
|
+
if (cur && cur[key2] === void 0) cur[key2] = value;
|
|
11351
|
+
}
|
|
11352
|
+
if (cur?.number) out.push(finishRow(cur, repo));
|
|
11353
|
+
return out;
|
|
11354
|
+
}
|
|
11355
|
+
function finishRow(p, repo) {
|
|
11356
|
+
return {
|
|
11357
|
+
repo,
|
|
11358
|
+
number: p.number,
|
|
11359
|
+
title: p.title ?? "",
|
|
11360
|
+
state: p.state ?? "",
|
|
11361
|
+
state_reason: p.state_reason,
|
|
11362
|
+
priority: p.priority,
|
|
11363
|
+
url: repoIssueUrl(repo, p.number)
|
|
11364
|
+
};
|
|
11365
|
+
}
|
|
11366
|
+
function searchRepoIssues(cnb, repo, keyword, state) {
|
|
11367
|
+
try {
|
|
11368
|
+
return parseCnbIssueList(
|
|
11369
|
+
cnb(["issues", "list-issues", "--repo", repo, "--keyword", keyword, "--state", state, "--page-size", "20"]),
|
|
11370
|
+
repo
|
|
11371
|
+
);
|
|
11372
|
+
} catch {
|
|
11373
|
+
return [];
|
|
11374
|
+
}
|
|
11375
|
+
}
|
|
11376
|
+
function parseRef(raw, project, casesSlug = "hcm/chiron-cases") {
|
|
11377
|
+
const r = String(raw ?? "").trim();
|
|
11378
|
+
let m = r.match(/^(?:hcm\/)?(?:hcm_nx_)?(core|cli|cloud)#(\d+)$/i);
|
|
11379
|
+
if (m) return { kind: "repo", repo: `hcm/hcm_nx_${m[1].toLowerCase()}`, number: m[2] };
|
|
11380
|
+
m = r.match(/^(?:chiron-)?cases#(\d+)$/i);
|
|
11381
|
+
if (m) return { kind: "repo", repo: casesSlug, number: m[1] };
|
|
11382
|
+
m = r.match(/^([A-Z][A-Z0-9_]+)-(\d+)$/i);
|
|
11383
|
+
if (m) return { kind: "jira", key: `${m[1].toUpperCase()}-${m[2]}` };
|
|
11384
|
+
m = r.match(/^(\d+)$/);
|
|
11385
|
+
if (m) return { kind: "jira", key: `${project}-${m[1]}` };
|
|
11386
|
+
return null;
|
|
11387
|
+
}
|
|
11388
|
+
var firstLine2 = (s) => String(s ?? "").split("\n").find((l) => l.trim())?.trim() ?? "";
|
|
11389
|
+
|
|
11390
|
+
// src/jira/gaps.ts
|
|
11391
|
+
var MIN_LEN = [
|
|
11392
|
+
["title", 8],
|
|
11393
|
+
["phenomenon", 20],
|
|
11394
|
+
["repro", 10],
|
|
11395
|
+
["expected", 10],
|
|
11396
|
+
["alternative", 5],
|
|
11397
|
+
["q_mechanism", 10],
|
|
11398
|
+
["q_history", 10],
|
|
11399
|
+
["q_skill", 10]
|
|
11400
|
+
];
|
|
11401
|
+
function validateGapInput(x) {
|
|
11402
|
+
if (!x || typeof x !== "object") throw new Error("\u7F3A\u53E3\u8F7D\u8377\u5FC5\u987B\u662F\u4E00\u4E2A JSON \u5BF9\u8C61");
|
|
11403
|
+
const g = x;
|
|
11404
|
+
const problems = [];
|
|
11405
|
+
for (const [k, min] of MIN_LEN) {
|
|
11406
|
+
const v = g[k];
|
|
11407
|
+
if (typeof v !== "string" || v.trim().length < min) problems.push(`${k} \u81F3\u5C11 ${min} \u4E2A\u5B57`);
|
|
11408
|
+
}
|
|
11409
|
+
if (typeof g.title === "string" && g.title.length > 80) problems.push("title \u4E0D\u8D85\u8FC7 80 \u4E2A\u5B57");
|
|
11410
|
+
if (!["\u963B\u65AD", "\u6709\u66FF\u4EE3\u6CD5", "\u63AA\u8F9E\u7EA7"].includes(String(g.severity))) problems.push("severity \u53EA\u80FD\u662F \u963B\u65AD / \u6709\u66FF\u4EE3\u6CD5 / \u63AA\u8F9E\u7EA7");
|
|
11411
|
+
if (!["\u7F3A\u9677", "\u7F3A\u80FD\u529B"].includes(String(g.kind))) problems.push("kind \u53EA\u80FD\u662F \u7F3A\u9677\uFF08\u6545\u969C\uFF09/ \u7F3A\u80FD\u529B\uFF08\u9700\u6C42\uFF09");
|
|
11412
|
+
if (g.module !== void 0 && !["HCM-Core", "HCM-Cloud", "\u4EA7\u54C1\u652F\u6301"].includes(String(g.module))) problems.push("module \u53EA\u80FD\u662F HCM-Core / HCM-Cloud / \u4EA7\u54C1\u652F\u6301");
|
|
11413
|
+
if (problems.length) throw new Error(`\u7F3A\u53E3\u8F7D\u8377\u4E0D\u5408\u683C\uFF0C\u6CA1\u6709\u63D0\uFF1A
|
|
11414
|
+
${problems.join("\n ")}`);
|
|
11415
|
+
return g;
|
|
11416
|
+
}
|
|
11417
|
+
var gapKeyTag = (g) => `\u3014${[g.model, g.action, g.error_code].filter(Boolean).join("\xB7") || "-"}\u3015`;
|
|
11418
|
+
var gapSummary = (g) => `\u7F3A\u53E3\uFF1A${g.title} ${gapKeyTag(g)}`;
|
|
11419
|
+
function renderGapDescription(g, fingerprintText2) {
|
|
11420
|
+
return [
|
|
11421
|
+
"h2. \u73B0\u8C61",
|
|
11422
|
+
g.phenomenon,
|
|
11423
|
+
"",
|
|
11424
|
+
"h2. \u590D\u73B0",
|
|
11425
|
+
"{code}",
|
|
11426
|
+
g.repro,
|
|
11427
|
+
"{code}",
|
|
11428
|
+
"",
|
|
11429
|
+
"h2. \u671F\u671B",
|
|
11430
|
+
g.expected,
|
|
11431
|
+
"",
|
|
11432
|
+
"h2. \u73AF\u5883\u6307\u7EB9",
|
|
11433
|
+
fingerprintText2,
|
|
11434
|
+
"",
|
|
11435
|
+
"h2. \u66FF\u4EE3\u6CD5",
|
|
11436
|
+
g.alternative,
|
|
11437
|
+
"",
|
|
11438
|
+
"h2. \u4E25\u91CD\u5EA6",
|
|
11439
|
+
`${g.severity}\uFF08\u987E\u95EE\u4FA7\u5224\u5B9A\uFF1A\u963B\u65AD=\u4EA4\u4ED8\u505C\u4E0B / \u6709\u66FF\u4EE3\u6CD5=\u80FD\u7ED5 / \u63AA\u8F9E\u7EA7=\u8F93\u51FA\u5DF2\u7ED9\u8DEF\u6807\uFF09`,
|
|
11440
|
+
"",
|
|
11441
|
+
"h2. \u4E09\u95EE\u81EA\u7B54",
|
|
11442
|
+
`# \u673A\u5236\u8FB9\u754C\uFF1A${g.q_mechanism}`,
|
|
11443
|
+
`# \u5386\u53F2\uFF1A${g.q_history}`,
|
|
11444
|
+
`# \u6280\u80FD\u6709\u6CA1\u6709\u6559\u9519\uFF1A${g.q_skill}`,
|
|
11445
|
+
"",
|
|
11446
|
+
"h2. \u5173\u952E\u8BCD",
|
|
11447
|
+
[g.error_code, g.model, g.action].filter(Boolean).join(" \xB7 ") || "\uFF08\u65E0\uFF09",
|
|
11448
|
+
"",
|
|
11449
|
+
"_\u7531\u987E\u95EE agent \u7ECF `hcm jira submit` \u63D0\u4EA4\u3002\u5206\u8BCA\u4E09\u53BB\u5411\uFF1A\u8F6C\u4EA7\u54C1\u4ED3 issue \u5E76\u56DE\u94FE / \u6539\u6280\u80FD\u5E76\u56DE\u590D / \u5408\u5E76\u8BA1\u6570\u3002\u5904\u7406\u529E\u6CD5\u89C1\u4EA7\u54C1\u4ED3\u6280\u80FD jira-triage\u3002_"
|
|
11450
|
+
].join("\n");
|
|
11451
|
+
}
|
|
11452
|
+
function findDuplicateGap(open, summary, keyTag) {
|
|
11453
|
+
const bigrams = (t) => {
|
|
11454
|
+
const x = (t || "").replace(/〔.*?〕/g, "").replace(/[\s,。::、()()「」]/g, "");
|
|
11455
|
+
const out = /* @__PURE__ */ new Set();
|
|
11456
|
+
for (let i = 0; i + 1 < x.length; i++) out.add(x.slice(i, i + 2));
|
|
11457
|
+
return out;
|
|
11458
|
+
};
|
|
11459
|
+
const sim = (a, b) => {
|
|
11460
|
+
const A = bigrams(a);
|
|
11461
|
+
const B = bigrams(b);
|
|
11462
|
+
if (!A.size || !B.size) return 0;
|
|
11463
|
+
let n = 0;
|
|
11464
|
+
for (const s of A) if (B.has(s)) n++;
|
|
11465
|
+
return n / Math.min(A.size, B.size);
|
|
11466
|
+
};
|
|
11467
|
+
for (const i of open) {
|
|
11468
|
+
const t = i.fields.summary ?? "";
|
|
11469
|
+
if (keyTag !== "\u3014-\u3015" && t.includes(keyTag)) return i;
|
|
11470
|
+
if (sim(t, summary) >= 0.6) return i;
|
|
11471
|
+
}
|
|
11472
|
+
return null;
|
|
11473
|
+
}
|
|
11474
|
+
var KIND_TO_TYPE = { \u7F3A\u9677: ["\u6545\u969C", "Bug", "\u7F3A\u9677"], \u7F3A\u80FD\u529B: ["\u9700\u6C42", "Story", "New Feature"] };
|
|
11475
|
+
var KIND_TO_CATEGORY = { \u7F3A\u9677: "\u7A0B\u5E8FBug", \u7F3A\u80FD\u529B: "\u9700\u6C42" };
|
|
11476
|
+
var SEVERITY_TO_PRIORITY = {
|
|
11477
|
+
\u963B\u65AD: ["\u7D27\u6025", "Highest", "High", "\u9AD8"],
|
|
11478
|
+
\u6709\u66FF\u4EE3\u6CD5: ["Medium", "\u4E2D", "\u4E00\u822C", "High"],
|
|
11479
|
+
\u63AA\u8F9E\u7EA7: ["Low", "\u4F4E", "Lowest"]
|
|
11480
|
+
};
|
|
11481
|
+
var MODULE_DEFAULT_CHILD = { "HCM-Core": "\u57FA\u7840\u8BBE\u7F6E", "HCM-Cloud": "\u5F00\u53D1\u5E73\u53F0", \u4EA7\u54C1\u652F\u6301: "\u4EA7\u54C1\u652F\u6301" };
|
|
11482
|
+
function buildGapFields(g, ctx) {
|
|
11483
|
+
const wanted = KIND_TO_TYPE[g.kind] ?? [];
|
|
11484
|
+
const type = ctx.issuetypeOverride && ctx.types.find((t) => t.name === ctx.issuetypeOverride) || wanted.map((n) => ctx.types.find((t) => t.name === n)).find(Boolean);
|
|
11485
|
+
if (!type) {
|
|
11486
|
+
throw new Error(`\u9879\u76EE ${ctx.project} \u91CC\u6CA1\u6709\u300C${wanted.join(" / ")}\u300D\u8FD9\u7C7B issuetype\uFF0C\u5B9E\u9645\u6709\uFF1A${ctx.types.map((t) => t.name).join(" / ")}`);
|
|
11487
|
+
}
|
|
11488
|
+
const module = g.module ?? "HCM-Core";
|
|
11489
|
+
const keyTag = gapKeyTag(g);
|
|
11490
|
+
const byName = {
|
|
11491
|
+
\u6982\u8981: gapSummary(g),
|
|
11492
|
+
\u63CF\u8FF0: renderGapDescription(g, ctx.fingerprintText),
|
|
11493
|
+
\u95EE\u9898\u7C7B\u522B: KIND_TO_CATEGORY[g.kind],
|
|
11494
|
+
\u95EE\u9898\u6A21\u5757: module,
|
|
11495
|
+
\u4F18\u5148\u7EA7: SEVERITY_TO_PRIORITY[g.severity],
|
|
11496
|
+
\u62A5\u544A\u4EBA: ctx.me,
|
|
11497
|
+
\u7ECF\u529E\u4EBA: ctx.assignee,
|
|
11498
|
+
Bug\u53D1\u73B0\u4EBA: "\u987E\u95EE",
|
|
11499
|
+
Bug\u91CD\u73B0\u64CD\u4F5C\u6B65\u9AA4: g.repro,
|
|
11500
|
+
Bug\u9519\u8BEF\u53F7: g.error_code || "\u65E0\u9519\u8BEF\u7801\uFF08\u73B0\u8C61\u89C1\u63CF\u8FF0\uFF09"
|
|
11501
|
+
};
|
|
11502
|
+
const fields = { project: { key: ctx.project }, issuetype: { id: type.id } };
|
|
11503
|
+
const unfilled = [];
|
|
11504
|
+
const values = (f) => (f.allowedValues ?? []).map((v) => v.value ?? v.name).join("|");
|
|
11505
|
+
for (const f of type.fields ?? []) {
|
|
11506
|
+
if (["project", "issuetype"].includes(f.fieldId)) continue;
|
|
11507
|
+
const want = byName[f.name];
|
|
11508
|
+
if (want === void 0) {
|
|
11509
|
+
if (f.required) unfilled.push(`${f.name}(${f.fieldId})${f.allowedValues ? `=[${values(f)}]` : ""}`);
|
|
11510
|
+
continue;
|
|
11511
|
+
}
|
|
11512
|
+
if (f.schema?.type === "option-with-child") {
|
|
11513
|
+
const parent = (f.allowedValues ?? []).find((v) => (v.value ?? v.name) === want);
|
|
11514
|
+
if (!parent) {
|
|
11515
|
+
if (f.required) unfilled.push(`${f.name}(${f.fieldId}) \u60F3\u586B\u300C${String(want)}\u300D\u4F46\u53EF\u9009\u503C\u53EA\u6709 [${values(f)}]`);
|
|
11516
|
+
continue;
|
|
11517
|
+
}
|
|
11518
|
+
const childName = g.module_detail || MODULE_DEFAULT_CHILD[module];
|
|
11519
|
+
const child = (parent.children ?? []).find((c) => (c.value ?? c.name) === childName);
|
|
11520
|
+
if (!child && (parent.children ?? []).length) {
|
|
11521
|
+
unfilled.push(`${f.name}(${f.fieldId}) \u7684\u4E8C\u7EA7\u9879\u300C${childName}\u300D\u4E0D\u5728 [${(parent.children ?? []).map((c) => c.value ?? c.name).join("|")}] \u91CC`);
|
|
11522
|
+
continue;
|
|
11523
|
+
}
|
|
11524
|
+
fields[f.fieldId] = { id: parent.id, ...child ? { child: { id: child.id } } : {} };
|
|
11525
|
+
continue;
|
|
11526
|
+
}
|
|
11527
|
+
if (f.allowedValues) {
|
|
11528
|
+
const candidates = Array.isArray(want) ? want : [want];
|
|
11529
|
+
const hit = candidates.map((c) => f.allowedValues.find((v) => (v.name ?? v.value) === c)).find(Boolean);
|
|
11530
|
+
if (!hit) {
|
|
11531
|
+
if (f.required) unfilled.push(`${f.name}(${f.fieldId}) \u60F3\u586B\u300C${candidates.join("/")}\u300D\u4F46\u53EF\u9009\u503C\u53EA\u6709 [${values(f)}]`);
|
|
11532
|
+
continue;
|
|
11533
|
+
}
|
|
11534
|
+
fields[f.fieldId] = hit.id ? { id: hit.id } : { name: hit.name ?? hit.value };
|
|
11535
|
+
} else if (f.schema?.type === "user") {
|
|
11536
|
+
if (!want) {
|
|
11537
|
+
if (f.required) unfilled.push(`${f.name}(${f.fieldId}) \u53D6\u4E0D\u5230\u7528\u6237\u540D`);
|
|
11538
|
+
continue;
|
|
11539
|
+
}
|
|
11540
|
+
fields[f.fieldId] = { name: Array.isArray(want) ? want[0] : want };
|
|
11541
|
+
} else {
|
|
11542
|
+
fields[f.fieldId] = Array.isArray(want) ? want[0] : want;
|
|
11543
|
+
}
|
|
11544
|
+
}
|
|
11545
|
+
if ((type.fields ?? []).some((f) => f.fieldId === "labels")) {
|
|
11546
|
+
const sev = { \u963B\u65AD: "blocking", \u6709\u66FF\u4EE3\u6CD5: "workaround", \u63AA\u8F9E\u7EA7: "wording" }[g.severity];
|
|
11547
|
+
fields.labels = ["chiron-gap", `severity-${sev}`];
|
|
11548
|
+
}
|
|
11549
|
+
if (unfilled.length) {
|
|
11550
|
+
throw new Error(
|
|
11551
|
+
`\u8FD9\u53F0 Jira \u7684\u300C${type.name}\u300D\u6709\u6211\u586B\u4E0D\u4E0A\u7684\u5FC5\u586B\u5B57\u6BB5\uFF0C\u6CA1\u6709\u5EFA\u5355\uFF08\u4E0D\u66FF\u4F60\u731C\uFF09\uFF1A
|
|
11552
|
+
${unfilled.join("\n ")}
|
|
11553
|
+
next_step=\u8BA9 Jira \u7BA1\u7406\u5458\u628A\u8FD9\u4E9B\u5B57\u6BB5\u6539\u6210\u975E\u5FC5\u586B\uFF0C\u6216\u544A\u8BC9\u6211\u8BE5\u586B\u4EC0\u4E48\u3001\u6211\u52A0\u8FDB\u6620\u5C04\u3002\u53F0\u8D26\u5DF2\u7ECF\u5728\u9879\u76EE\u4ED3\u91CC\uFF0C\u4E0D\u4F1A\u4E22\u3002`
|
|
11554
|
+
);
|
|
11555
|
+
}
|
|
11556
|
+
return { fields, type, keyTag, summary: gapSummary(g), module: `${module}/${g.module_detail || MODULE_DEFAULT_CHILD[module]}` };
|
|
11557
|
+
}
|
|
11558
|
+
async function gapSubmit({ client: client3 }, g, { fingerprintText: fingerprintText2, issuetypeOverride, assigneeOverride }) {
|
|
11559
|
+
const summary = gapSummary(g);
|
|
11560
|
+
const keyTag = gapKeyTag(g);
|
|
11561
|
+
const open = await client3.search(`project = ${client3.project} AND resolution = Unresolved ORDER BY created DESC`, { max: 100 });
|
|
11562
|
+
const dup = findDuplicateGap(open, summary, keyTag);
|
|
11563
|
+
if (dup) {
|
|
11564
|
+
const body = `\u53C8\u4E00\u4E2A\u73B0\u573A\uFF08${fingerprintText2}\uFF09
|
|
11565
|
+
|
|
11566
|
+
**\u73B0\u8C61**\uFF1A${g.phenomenon}
|
|
11567
|
+
|
|
11568
|
+
**\u590D\u73B0**\uFF1A
|
|
11569
|
+
{code}
|
|
11570
|
+
${g.repro}
|
|
11571
|
+
{code}
|
|
11572
|
+
|
|
11573
|
+
**\u66FF\u4EE3\u6CD5**\uFF1A${g.alternative}
|
|
11574
|
+
\u4E25\u91CD\u5EA6\uFF1A${g.severity}`;
|
|
11575
|
+
await client3.addComment(dup.key, body);
|
|
11576
|
+
return { outcome: "appended", key: dup.key, url: client3.browseUrl(dup.key), summary: dup.fields.summary ?? "", alternative: g.alternative };
|
|
11577
|
+
}
|
|
11578
|
+
const [types, me, project] = await Promise.all([client3.createMeta(), client3.myself(), client3.projectInfo()]);
|
|
11579
|
+
const built = buildGapFields(g, {
|
|
11580
|
+
types,
|
|
11581
|
+
me: me.name ?? me.key ?? "",
|
|
11582
|
+
assignee: assigneeOverride || project.lead?.name || project.lead?.key,
|
|
11583
|
+
project: client3.project,
|
|
11584
|
+
fingerprintText: fingerprintText2,
|
|
11585
|
+
issuetypeOverride
|
|
11586
|
+
});
|
|
11587
|
+
const created = await client3.createIssue(built.fields);
|
|
11588
|
+
return { outcome: "created", key: created.key, url: client3.browseUrl(created.key), summary: built.summary, type: built.type.name, module: built.module, alternative: g.alternative };
|
|
11589
|
+
}
|
|
11590
|
+
async function gapSearch({ client: client3, cnb }, keywords, { includeClosed = true } = {}) {
|
|
11591
|
+
const rows = [];
|
|
11592
|
+
let jiraError;
|
|
11593
|
+
try {
|
|
11594
|
+
for (const kw of keywords) {
|
|
11595
|
+
const safe = kw.replace(/["\\]/g, " ").trim();
|
|
11596
|
+
const jql = `project = ${client3.project} AND text ~ "${safe}"${includeClosed ? "" : " AND resolution = Unresolved"} ORDER BY updated DESC`;
|
|
11597
|
+
for (const i of await client3.search(jql, { max: 15 })) {
|
|
11598
|
+
rows.push({ where: "Jira", id: i.key, title: i.fields.summary ?? "", state: i.fields.status?.name, resolution: i.fields.resolution?.name, url: client3.browseUrl(i.key) });
|
|
11599
|
+
}
|
|
11600
|
+
}
|
|
11601
|
+
if (!rows.length) {
|
|
11602
|
+
const open = await client3.search(`project = ${client3.project} AND resolution = Unresolved ORDER BY created DESC`, { max: 100 });
|
|
11603
|
+
for (const i of open) {
|
|
11604
|
+
if (keywords.some((k) => (i.fields.summary ?? "").includes(k))) {
|
|
11605
|
+
rows.push({ where: "Jira", id: i.key, title: i.fields.summary ?? "", state: i.fields.status?.name, url: client3.browseUrl(i.key) });
|
|
11606
|
+
}
|
|
11607
|
+
}
|
|
11608
|
+
}
|
|
11609
|
+
} catch (e) {
|
|
11610
|
+
jiraError = e.message;
|
|
11611
|
+
}
|
|
11612
|
+
for (const kw of keywords) {
|
|
11613
|
+
for (const st of includeClosed ? ["open", "closed"] : ["open"]) {
|
|
11614
|
+
for (const repo of PRODUCT_REPOS) {
|
|
11615
|
+
for (const i of searchRepoIssues(cnb, repo, kw, st)) rows.push({ where: "\u4EA7\u54C1\u4ED3", id: `${i.repo}#${i.number}`, title: i.title, state: i.state, url: i.url });
|
|
11616
|
+
}
|
|
11617
|
+
}
|
|
11618
|
+
}
|
|
11619
|
+
const seen = /* @__PURE__ */ new Set();
|
|
11620
|
+
return { rows: rows.filter((r) => seen.has(r.id) ? false : (seen.add(r.id), true)), jiraError };
|
|
11621
|
+
}
|
|
11622
|
+
async function gapStatus({ client: client3, cnb }, ref, casesSlug = "hcm/chiron-cases") {
|
|
11623
|
+
const parsed = parseRef(ref, client3.project, casesSlug);
|
|
11624
|
+
if (!parsed) throw new Error(`\u770B\u4E0D\u61C2 ${ref}\uFF1A\u7ED9 Jira \u5355\u53F7\uFF08HCMNX-12\uFF09\u3001\u4EA7\u54C1\u4ED3\u5F15\u7528\uFF08core#2198\uFF09\u6216\u5386\u53F2\u961F\u5217\u6761\u76EE\uFF08cases#26\uFF09`);
|
|
11625
|
+
if (parsed.kind === "repo") {
|
|
11626
|
+
const s = cnbIssueState(cnb, parsed.repo, parsed.number);
|
|
11627
|
+
if (s.kind !== "issue") throw new Error(`${parsed.repo}#${parsed.number} \u8BFB\u4E0D\u5230\uFF08\u7F16\u53F7\u4E0D\u5BF9\u3001\u662F PR \u53F7\uFF0C\u6216\u4F60\u6CA1\u6709\u8FD9\u4E2A\u4ED3\u7684\u6743\u9650\uFF09`);
|
|
11628
|
+
const where = parsed.repo === casesSlug ? "\u5386\u53F2\u961F\u5217" : "\u4EA7\u54C1\u4ED3";
|
|
11629
|
+
const nextStep2 = s.state === "closed" ? "\u8FD9\u6761\u5DF2\u5173\u3002\u76EE\u6807\u73AF\u5883\u90E8\u7F72\u5230\u542B\u4FEE\u590D\u7684\u7248\u672C\u540E `hcm skills update`\uFF0C\u518D\u6309\u6280\u80FD\u590D\u9A8C\u4E00\u6B21\u3002" : "\u8FD8\u5F00\u7740\u3002\u5148\u6309\u66FF\u4EE3\u6CD5\u7EE7\u7EED\u4EA4\u4ED8\uFF1B\u8981\u6392\u671F\u5C31\u5728\u90A3\u6761\u4E0B\u9762\u7559\u8A00\u3002";
|
|
11630
|
+
return { ref, lines: [`${where} ${s.repo}#${s.number} [${s.state}${s.reason ? "\xB7" + s.reason : ""}${s.priority ? " " + s.priority : ""}] ${s.title}`, ` ${s.url}`], nextStep: nextStep2, repo: s, links: [] };
|
|
11631
|
+
}
|
|
11632
|
+
const issue = await client3.issue(parsed.key);
|
|
11633
|
+
const cs = await client3.comments(parsed.key);
|
|
11634
|
+
const status = issue.fields.status?.name;
|
|
11635
|
+
const resolution = issue.fields.resolution?.name;
|
|
11636
|
+
const lines = [`Jira ${issue.key} [${status}${resolution ? "\xB7" + resolution : ""}${issue.fields.priority ? " " + issue.fields.priority.name : ""}] ${issue.fields.summary ?? ""}`, ` ${client3.browseUrl(issue.key)}`];
|
|
11637
|
+
const keyComments = cs.filter((c) => /分诊|已转|已修|合入|不做|重复|改技能|产品侧|代码库已关闭/.test(c.body ?? ""));
|
|
11638
|
+
const last = (keyComments.length ? keyComments : cs).at(-1);
|
|
11639
|
+
if (last) lines.push(` \u6700\u65B0\u5904\u7406\uFF08${String(last.created ?? "").slice(0, 10)} ${last.author?.displayName ?? "?"}\uFF09\uFF1A${(last.body ?? "").split("\n").find((l) => l.trim()) ?? ""}`.slice(0, 400));
|
|
11640
|
+
else lines.push(" \u8FD8\u6CA1\u6709\u4EBA\u5904\u7406\uFF08\u4EA7\u54C1\u4FA7\u6BCF\u5468\u6E05\u4E00\u6B21\uFF1B\u963B\u65AD\u7EA7\u8BF7\u5728\u9879\u76EE\u7FA4\u91CC\u70B9\u540D\u8D1F\u8D23\u4EBA\uFF09");
|
|
11641
|
+
const remote = (await client3.remoteLinks(parsed.key)).map((l) => l.object?.url ?? "").join("\n");
|
|
11642
|
+
const links = linkedRepoRefs(`${remote}
|
|
11643
|
+
${issue.fields.description ?? ""}
|
|
11644
|
+
${cs.map((c) => c.body ?? "").join("\n")}`).map((l) => cnbIssueState(cnb, l.repo, l.number));
|
|
11645
|
+
const issues = links.filter((l) => l.kind === "issue");
|
|
11646
|
+
for (const p of issues) lines.push(`\u4EA7\u54C1\u4ED3 ${p.repo}#${p.number} [${p.state}${p.reason ? "\xB7" + p.reason : ""}${p.priority ? " " + p.priority : ""}] ${p.title}`, ` ${p.url}`);
|
|
11647
|
+
let nextStep;
|
|
11648
|
+
if (resolution) nextStep = "Jira \u8FD9\u5355\u5DF2\u89E3\u51B3\u3002\u76EE\u6807\u73AF\u5883\u90E8\u7F72\u5230\u542B\u4FEE\u590D\u7684\u7248\u672C\u540E\uFF08`hcm version` \u7684 commit \u4F1A\u53D8\uFF09\uFF0C\u8DD1 `hcm skills update`\uFF0C\u518D\u6309\u6280\u80FD\u590D\u9A8C\u4E00\u6B21\u3002";
|
|
11649
|
+
else if (issues.length && issues.every((s) => s.state === "closed")) nextStep = "\u4EA7\u54C1\u4ED3\u90A3\u6761\u5DF2\u5173\u3001Jira \u8FD8\u6CA1\u5173\uFF0C\u591A\u534A\u5728\u7B49\u53D1\u5E03\u3002\u7EE7\u7EED\u7528\u66FF\u4EE3\u6CD5\uFF0C\u53D1\u5E03\u540E\u590D\u9A8C\u3002";
|
|
11650
|
+
else if (issues.length) nextStep = "\u4EA7\u54C1\u4ED3\u5DF2\u7ACB\u9879\u3001\u8FD8\u6CA1\u5173\u3002\u7EE7\u7EED\u7528\u66FF\u4EE3\u6CD5\uFF1B\u60F3\u8981\u6392\u671F\u5C31\u5728 Jira \u8FD9\u5355\u4E0B\u7559\u8A00\u3002";
|
|
11651
|
+
else nextStep = `\u7B49\u5206\u8BCA\u3002\u5148\u6309\u66FF\u4EE3\u6CD5\u7EE7\u7EED\u4EA4\u4ED8\uFF0C\u62A5\u544A\u5199 BLOCKED \xB7 \u5DF2\u63D0 ${issue.key}\u3002`;
|
|
11652
|
+
return { ref, lines, nextStep, jira: { key: issue.key, status, resolution, url: client3.browseUrl(issue.key) }, links };
|
|
11653
|
+
}
|
|
11654
|
+
|
|
11655
|
+
// src/jira/triage.ts
|
|
11656
|
+
var GAP_PREFIX = "\u7F3A\u53E3\uFF1A";
|
|
11657
|
+
var PENDING_STATUS = "\u65B0\u589E";
|
|
11658
|
+
var SYNC_MARKER = "\u4EE3\u7801\u5E93\u5DF2\u5173\u95ED\uFF1A";
|
|
11659
|
+
var bodyText = (issue, comments, remote = []) => [issue.fields.description ?? "", ...comments.map((c) => c.body ?? ""), ...remote.map((l) => l.object?.url ?? "")].join("\n");
|
|
11660
|
+
async function listOpen(client3, { all = false } = {}) {
|
|
11661
|
+
const every = await client3.search(`project = ${client3.project} AND resolution = Unresolved ORDER BY created DESC`, { max: 100 });
|
|
11662
|
+
const picked = all ? every : every.filter((i) => i.fields.status?.name === PENDING_STATUS);
|
|
11663
|
+
return {
|
|
11664
|
+
unresolved: every.length,
|
|
11665
|
+
rows: picked.map((i) => ({
|
|
11666
|
+
key: i.key,
|
|
11667
|
+
status: i.fields.status?.name ?? "?",
|
|
11668
|
+
priority: i.fields.priority?.name,
|
|
11669
|
+
summary: i.fields.summary ?? "",
|
|
11670
|
+
url: client3.browseUrl(i.key),
|
|
11671
|
+
reporter: i.fields.reporter?.displayName,
|
|
11672
|
+
created: String(i.fields.created ?? "").slice(0, 10),
|
|
11673
|
+
fromAgent: (i.fields.summary ?? "").startsWith(GAP_PREFIX)
|
|
11674
|
+
}))
|
|
11675
|
+
};
|
|
11676
|
+
}
|
|
11677
|
+
async function showIssue({ client: client3, cnb }, key2) {
|
|
11678
|
+
const issue = await client3.issue(key2);
|
|
11679
|
+
const comments = await client3.comments(key2);
|
|
11680
|
+
const remoteLinks = await client3.remoteLinks(key2);
|
|
11681
|
+
const links = linkedRepoRefs(bodyText(issue, comments, remoteLinks)).map((l) => cnbIssueState(cnb, l.repo, l.number));
|
|
11682
|
+
const transitions = await client3.transitions(key2);
|
|
11683
|
+
return { issue, comments, remoteLinks, links, transitions };
|
|
11684
|
+
}
|
|
11685
|
+
async function commentIssue(client3, key2, body) {
|
|
11686
|
+
await client3.addComment(key2, body);
|
|
11687
|
+
return { key: key2, url: client3.browseUrl(key2) };
|
|
11688
|
+
}
|
|
11689
|
+
async function assignIssue(client3, key2, who) {
|
|
11690
|
+
const name = who === "me" || !who ? (await client3.myself()).name ?? "" : who;
|
|
11691
|
+
if (!name) throw new Error("\u53D6\u4E0D\u5230\u5F53\u524D\u7528\u6237\u540D\uFF0C\u65E0\u6CD5\u63A5\u624B");
|
|
11692
|
+
await client3.assign(key2, name);
|
|
11693
|
+
return { key: key2, who: name, transitions: await client3.transitions(key2) };
|
|
11694
|
+
}
|
|
11695
|
+
async function moveIssue(client3, key2, target, comment) {
|
|
11696
|
+
const transition = await client3.transition(key2, target, comment);
|
|
11697
|
+
return { key: key2, transition };
|
|
11698
|
+
}
|
|
11699
|
+
async function toIssue({ client: client3, cnb }, key2, { repo = "hcm/hcm_nx_core", force = false, priority = "P2" } = {}) {
|
|
11700
|
+
const issue = await client3.issue(key2);
|
|
11701
|
+
const comments = await client3.comments(key2);
|
|
11702
|
+
const existing = linkedRepoRefs(bodyText(issue, comments, await client3.remoteLinks(key2)));
|
|
11703
|
+
if (existing.length && !force) return { key: key2, existing: existing.map((e) => `${e.repo}#${e.number}`) };
|
|
11704
|
+
const title = `${issue.fields.summary ?? ""}\uFF08Jira ${key2}\uFF09`;
|
|
11705
|
+
const body = [
|
|
11706
|
+
`> \u6765\u81EA Jira ${key2}\uFF1A${client3.browseUrl(key2)}`,
|
|
11707
|
+
`> \u62A5\u544A\u4EBA\uFF1A${issue.fields.reporter?.displayName ?? "?"} \u4F18\u5148\u7EA7\uFF1A${issue.fields.priority?.name ?? "-"}`,
|
|
11708
|
+
"",
|
|
11709
|
+
issue.fields.description || "\uFF08Jira \u6B63\u6587\u4E3A\u7A7A\uFF09"
|
|
11710
|
+
].join("\n");
|
|
11711
|
+
const raw = cnb(["issues", "create-issue", "--repo", repo, "--title", title, "--body", body, "--priority", priority]);
|
|
11712
|
+
const number = raw.match(/number:\s*"?(\d+)/)?.[1];
|
|
11713
|
+
if (!number) throw new Error(`\u4EA7\u54C1\u4ED3 issue \u5EFA\u5931\u8D25\uFF0Ccnb \u539F\u6837\u8F93\u51FA\uFF1A
|
|
11714
|
+
${raw.slice(0, 500)}`);
|
|
11715
|
+
const url = repoIssueUrl(repo, number);
|
|
11716
|
+
await client3.addRemoteLink(key2, url, `${repo}#${number} ${issue.fields.summary ?? ""}`.slice(0, 250));
|
|
11717
|
+
await client3.addComment(key2, `\u5DF2\u5728\u4EE3\u7801\u5E93\u767B\u8BB0\uFF1A${repo}#${number}
|
|
11718
|
+
${url}
|
|
11719
|
+
\u4FEE\u590D\u5408\u5165\u540E\u56DE\u5199\u672C\u5355\u4E3A\u300C\u5DF2\u4FEE\u590D\u300D\uFF0C\u76EE\u6807\u73AF\u5883\u53D1\u5E03\u4E14\u987E\u95EE\u590D\u9A8C\u901A\u8FC7\u540E\u624D\u5173\u95ED\u3002`);
|
|
11720
|
+
const me = (await client3.myself()).name;
|
|
11721
|
+
if (me && issue.fields.assignee?.name !== me) await client3.assign(key2, me);
|
|
11722
|
+
const out = { key: key2, repo, number, url };
|
|
11723
|
+
try {
|
|
11724
|
+
const hit = await client3.transition(key2, "\u6253\u5F00\u95EE\u9898");
|
|
11725
|
+
out.moved = hit.to?.name;
|
|
11726
|
+
} catch (e) {
|
|
11727
|
+
out.moveError = e.message;
|
|
11728
|
+
}
|
|
11729
|
+
return out;
|
|
11730
|
+
}
|
|
11731
|
+
async function syncIssue({ client: client3, cnb }, key2, { dryRun = false } = {}) {
|
|
11732
|
+
const issue = await client3.issue(key2);
|
|
11733
|
+
const comments = await client3.comments(key2);
|
|
11734
|
+
const refs = linkedRepoRefs(bodyText(issue, comments, await client3.remoteLinks(key2)));
|
|
11735
|
+
const links = refs.map((l) => cnbIssueState(cnb, l.repo, l.number));
|
|
11736
|
+
const issues = links.filter((l) => l.kind === "issue");
|
|
11737
|
+
if (!refs.length || !issues.length) return { key: key2, outcome: "no-links", links };
|
|
11738
|
+
if (links.some((l) => l.kind === "unreadable")) return { key: key2, outcome: "blocked-unreadable", links };
|
|
11739
|
+
const allClosed = issues.every((l) => l.state === "closed");
|
|
11740
|
+
if (!allClosed) return { key: key2, outcome: "not-closed", links };
|
|
11741
|
+
const already = comments.some((c) => (c.body ?? "").includes(SYNC_MARKER) || (c.body ?? "").includes("\u4EA7\u54C1\u4FA7\u5DF2\u5173\u95ED"));
|
|
11742
|
+
if (already) return { key: key2, outcome: "already-written", links };
|
|
11743
|
+
if (dryRun) return { key: key2, outcome: "dry-run-would-write", links };
|
|
11744
|
+
const summary = issues.map(describeIssueState).join("\u3001");
|
|
11745
|
+
await client3.addComment(
|
|
11746
|
+
key2,
|
|
11747
|
+
`${SYNC_MARKER}${summary}\u3002\u4FEE\u590D\u53EA\u662F\u8FDB\u4E86 main\u2014\u2014\u76EE\u6807\u73AF\u5883\u90E8\u7F72\u5230\u542B\u4FEE\u590D\u7684\u7248\u672C\u540E\uFF0C\u7531\u987E\u95EE\u590D\u9A8C\u901A\u8FC7\u624D\u5173\u672C\u5355\uFF08verify-pass\uFF09\uFF1B\u590D\u9A8C\u4E0D\u8FC7\u8D70 verify-fail \u9000\u56DE\u3002`
|
|
11748
|
+
);
|
|
11749
|
+
const out = { key: key2, outcome: "written", links };
|
|
11750
|
+
try {
|
|
11751
|
+
const hit = await client3.transition(key2, "\u5904\u7406\u5B8C\u6210");
|
|
11752
|
+
out.moved = hit.to?.name;
|
|
11753
|
+
} catch (e) {
|
|
11754
|
+
out.moveError = e.message;
|
|
11755
|
+
}
|
|
11756
|
+
return out;
|
|
11757
|
+
}
|
|
11758
|
+
async function verifyPass(client3, key2, note = "\u987E\u95EE\u5728\u76EE\u6807\u73AF\u5883\u590D\u9A8C\u901A\u8FC7\u3002") {
|
|
11759
|
+
await client3.addComment(key2, `\u987E\u95EE\u590D\u9A8C\u901A\u8FC7\uFF1A${note}`);
|
|
11760
|
+
const hit = await client3.transition(key2, "\u786E\u8BA4\u5173\u95ED");
|
|
11761
|
+
return { key: key2, to: hit.to?.name, url: client3.browseUrl(key2) };
|
|
11762
|
+
}
|
|
11763
|
+
async function verifyFail({ client: client3, cnb }, key2, note) {
|
|
11764
|
+
await client3.addComment(key2, `\u987E\u95EE\u590D\u9A8C\u672A\u901A\u8FC7\uFF0C\u9000\u56DE\uFF1A
|
|
11765
|
+
${note}`);
|
|
11766
|
+
const out = { key: key2, reopened: [], failed: [] };
|
|
11767
|
+
try {
|
|
11768
|
+
out.moved = (await client3.transition(key2, "\u672A\u89E3\u51B3")).to?.name;
|
|
11769
|
+
} catch (e) {
|
|
11770
|
+
out.moveError = e.message;
|
|
11771
|
+
}
|
|
11772
|
+
const issue = await client3.issue(key2);
|
|
11773
|
+
const comments = await client3.comments(key2);
|
|
11774
|
+
for (const l of linkedRepoRefs(bodyText(issue, comments, await client3.remoteLinks(key2)))) {
|
|
11775
|
+
const state = cnbIssueState(cnb, l.repo, l.number);
|
|
11776
|
+
if (state.kind !== "issue") continue;
|
|
11777
|
+
try {
|
|
11778
|
+
cnb(["issues", "update-issue", "--repo", l.repo, "--number", l.number, "--state", "open", "--state-reason", "reopened"]);
|
|
11779
|
+
cnb(["issues", "post-issue-comment", "--repo", l.repo, "--number", l.number, "--body", `\u987E\u95EE\u590D\u9A8C\u672A\u901A\u8FC7\uFF0C\u91CD\u5F00\uFF08Jira ${key2}\uFF09\uFF1A
|
|
11780
|
+
${note}`]);
|
|
11781
|
+
out.reopened.push(`${l.repo}#${l.number}`);
|
|
11782
|
+
} catch {
|
|
11783
|
+
out.failed.push(`${l.repo}#${l.number}`);
|
|
11784
|
+
}
|
|
11785
|
+
}
|
|
11786
|
+
return out;
|
|
11787
|
+
}
|
|
11788
|
+
async function auditIssues(client3) {
|
|
11789
|
+
const rows = (await client3.search(`project = ${client3.project} AND resolution = Unresolved ORDER BY created DESC`, { max: 100 })).filter(
|
|
11790
|
+
(i) => (i.fields.summary ?? "").startsWith(GAP_PREFIX)
|
|
11791
|
+
);
|
|
11792
|
+
const bad = [];
|
|
11793
|
+
for (const i of rows) {
|
|
11794
|
+
const status = i.fields.status?.name ?? "?";
|
|
11795
|
+
if (status === PENDING_STATUS) continue;
|
|
11796
|
+
const remote = await client3.remoteLinks(i.key);
|
|
11797
|
+
const text = bodyText(await client3.issue(i.key), await client3.comments(i.key), remote);
|
|
11798
|
+
if (!remote.length && !linkedRepoRefs(text).length) bad.push({ key: i.key, status, url: client3.browseUrl(i.key) });
|
|
11799
|
+
}
|
|
11800
|
+
return { checked: rows.length, bad };
|
|
11801
|
+
}
|
|
11802
|
+
async function probe(client3) {
|
|
11803
|
+
const [info, me, project] = await Promise.all([client3.serverInfo(), client3.myself(), client3.projectInfo()]);
|
|
11804
|
+
const types = (await client3.createMeta()).map((t) => ({
|
|
11805
|
+
id: t.id,
|
|
11806
|
+
name: t.name,
|
|
11807
|
+
required: (t.fields ?? []).filter((f) => f.required && !["project", "issuetype"].includes(f.fieldId)).map((f) => `${f.name}(${f.fieldId})${f.allowedValues ? `=[${f.allowedValues.slice(0, 8).map((v) => v.name ?? v.value).join("|")}]` : ""}`)
|
|
11808
|
+
}));
|
|
11809
|
+
const flows = (await client3.projectStatuses()).map((t) => ({ name: t.name, statuses: (t.statuses ?? []).map((s) => s.name ?? "") }));
|
|
11810
|
+
return {
|
|
11811
|
+
server: `Jira ${info.version ?? "?"} (${info.deploymentType ?? "?"}) @ ${client3.base}`,
|
|
11812
|
+
me: `${me.displayName ?? "?"} <${me.emailAddress ?? me.name ?? ""}> key=${me.key ?? me.name ?? ""}`,
|
|
11813
|
+
project: `${project.key ?? client3.project} ${project.name ?? ""} lead=${project.lead?.displayName ?? "?"}`,
|
|
11814
|
+
types,
|
|
11815
|
+
flows
|
|
11816
|
+
};
|
|
11817
|
+
}
|
|
11818
|
+
|
|
11819
|
+
// src/commands/jira.ts
|
|
11820
|
+
var defaultDeps3 = { client: () => createJiraClient(), cnb: defaultCnb };
|
|
11821
|
+
async function triageDeps(deps) {
|
|
11822
|
+
return { client: await deps.client(), cnb: deps.cnb };
|
|
11823
|
+
}
|
|
11824
|
+
function emit4(fmt, data, text) {
|
|
11825
|
+
if (fmt === "json" || fmt === "yaml") process.stdout.write(formatObject27(data, { format: fmt }) + "\n");
|
|
11826
|
+
else process.stdout.write(text() + "\n");
|
|
11827
|
+
}
|
|
11828
|
+
function readBody(opts, positional) {
|
|
11829
|
+
if (opts.file) return readFileSync7(opts.file, "utf8");
|
|
11830
|
+
if (opts.body) return opts.body;
|
|
11831
|
+
if (positional && positional.trim()) return positional;
|
|
11832
|
+
if (process.stdin.isTTY) throw new Error("\u7F3A\u6B63\u6587\uFF1A-f <\u6587\u4EF6> / --body <\u6587\u672C> / \u4F4D\u7F6E\u53C2\u6570\uFF0C\u6216\u4ECE\u6807\u51C6\u8F93\u5165\u5582");
|
|
11833
|
+
return readFileSync7(0, "utf8");
|
|
11834
|
+
}
|
|
11835
|
+
async function run(fn) {
|
|
11836
|
+
try {
|
|
11837
|
+
await fn();
|
|
11838
|
+
} catch (e) {
|
|
11839
|
+
exitWithError(e);
|
|
11840
|
+
}
|
|
11841
|
+
}
|
|
11842
|
+
async function jiraProbeCommand(args, deps = defaultDeps3) {
|
|
11843
|
+
await run(async () => {
|
|
11844
|
+
const r = await probe(await deps.client());
|
|
11845
|
+
emit4(
|
|
11846
|
+
args.output,
|
|
11847
|
+
r,
|
|
11848
|
+
() => [
|
|
11849
|
+
r.server,
|
|
11850
|
+
`\u6211\u662F\uFF1A${r.me}`,
|
|
11851
|
+
`\u9879\u76EE\uFF1A${r.project}`,
|
|
11852
|
+
...r.types.map((t) => `issuetype ${t.name}(${t.id}) \u5FC5\u586B\uFF1A${t.required.join(" \xB7 ") || "\uFF08\u65E0\uFF09"}`),
|
|
11853
|
+
...r.flows.map((f) => `\u72B6\u6001\u6D41 ${f.name}\uFF1A${f.statuses.join(" \u2192 ")}`)
|
|
11854
|
+
].join("\n")
|
|
11855
|
+
);
|
|
11856
|
+
});
|
|
11857
|
+
}
|
|
11858
|
+
async function jiraOpenCommand(args, deps = defaultDeps3) {
|
|
11859
|
+
await run(async () => {
|
|
11860
|
+
const r = await listOpen(await deps.client(), { all: !!args.all });
|
|
11861
|
+
emit4(args.output, r, () => {
|
|
11862
|
+
if (!r.rows.length) return args.all ? "\u9879\u76EE\u91CC\u6CA1\u6709\u672A\u89E3\u51B3\u7684\u5355\u3002" : `\u6CA1\u6709\u5F85\u5206\u8BCA\uFF08\u72B6\u6001\u300C\u65B0\u589E\u300D\uFF09\u7684\u5355\uFF1B\u9879\u76EE\u91CC\u672A\u89E3\u51B3\u7684\u5171 ${r.unresolved} \u6761\uFF0C\u770B\u5168\u90E8\u52A0 --all\u3002`;
|
|
11863
|
+
return r.rows.map((i) => `${i.key} [${i.status}${i.priority ? " " + i.priority : ""}]${i.fromAgent ? "" : " \uFF08\u975E agent \u63D0\u5355\uFF09"} ${i.summary}
|
|
11864
|
+
${i.url} \u62A5\u544A\u4EBA ${i.reporter ?? "?"} ${i.created}`).join("\n");
|
|
11865
|
+
});
|
|
11866
|
+
});
|
|
11867
|
+
}
|
|
11868
|
+
async function jiraShowCommand(key2, args, deps = defaultDeps3) {
|
|
11869
|
+
await run(async () => {
|
|
11870
|
+
const d = await triageDeps(deps);
|
|
11871
|
+
const r = await showIssue(d, key2);
|
|
11872
|
+
const i = r.issue;
|
|
11873
|
+
emit4(args.output, r, () => {
|
|
11874
|
+
const out = [
|
|
11875
|
+
`${i.key} [${i.fields.status?.name}${i.fields.resolution ? "\xB7" + i.fields.resolution.name : ""}${i.fields.priority ? " " + i.fields.priority.name : ""}] ${i.fields.summary ?? ""}`,
|
|
11876
|
+
`${d.client.browseUrl(i.key)} \u62A5\u544A\u4EBA ${i.fields.reporter?.displayName ?? "?"} \u7ECF\u529E\u4EBA ${i.fields.assignee?.displayName ?? "-"} \u6807\u7B7E ${(i.fields.labels ?? []).join(",") || "-"}`,
|
|
11877
|
+
"",
|
|
11878
|
+
"--- \u6B63\u6587 ---",
|
|
11879
|
+
i.fields.description || "\uFF08\u7A7A\uFF09"
|
|
11880
|
+
];
|
|
11881
|
+
for (const c of r.comments) out.push("", `--- \u8BC4\u8BBA ${c.author?.displayName ?? "?"} ${String(c.created ?? "").slice(0, 10)} ---`, c.body ?? "");
|
|
11882
|
+
for (const l of r.links) out.push("", `\u5173\u8054\u4EE3\u7801\u5E93 ${describeIssueState(l)}`);
|
|
11883
|
+
out.push("", `\u53EF\u7528\u6D41\u8F6C\uFF1A${r.transitions.map((t) => `${t.name}\u2192${t.to?.name}`).join(" / ") || "\uFF08\u65E0\uFF09"}`);
|
|
11884
|
+
return out.join("\n");
|
|
11885
|
+
});
|
|
11886
|
+
});
|
|
11887
|
+
}
|
|
11888
|
+
async function jiraCommentCommand(key2, text, args, deps = defaultDeps3) {
|
|
11889
|
+
await run(async () => {
|
|
11890
|
+
const body = readBody(args, text);
|
|
11891
|
+
const r = await commentIssue(await deps.client(), key2, body);
|
|
11892
|
+
emit4(args.output, r, () => `\u5DF2\u56DE\u590D ${r.key}\uFF1A${r.url}`);
|
|
11893
|
+
});
|
|
11894
|
+
}
|
|
11895
|
+
async function jiraAssignCommand(key2, who, args, deps = defaultDeps3) {
|
|
11896
|
+
await run(async () => {
|
|
11897
|
+
const r = await assignIssue(await deps.client(), key2, who);
|
|
11898
|
+
emit4(args.output, r, () => `${r.key} \u5DF2\u6539\u6D3E\u7ED9 ${r.who}\u3002\u73B0\u5728\u53EF\u505A\u7684\u6D41\u8F6C\uFF1A${r.transitions.map((x) => `${x.name}\u2192${x.to?.name}`).join(" / ") || "\uFF08\u65E0\uFF09"}`);
|
|
11899
|
+
});
|
|
11900
|
+
}
|
|
11901
|
+
async function jiraMoveCommand(key2, target, args, deps = defaultDeps3) {
|
|
11902
|
+
await run(async () => {
|
|
11903
|
+
const comment = args.file || args.body ? readBody(args) : void 0;
|
|
11904
|
+
const r = await moveIssue(await deps.client(), key2, target, comment);
|
|
11905
|
+
emit4(args.output, r, () => `${r.key} \u5DF2\u6D41\u8F6C\uFF1A${r.transition.name} \u2192 ${r.transition.to?.name}`);
|
|
11906
|
+
});
|
|
11907
|
+
}
|
|
11908
|
+
async function jiraToIssueCommand(key2, args, deps = defaultDeps3) {
|
|
11909
|
+
await run(async () => {
|
|
11910
|
+
const r = await toIssue(await triageDeps(deps), key2, { repo: args.repo, force: !!args.force });
|
|
11911
|
+
emit4(args.output, r, () => {
|
|
11912
|
+
if ("existing" in r) return `${r.key} \u5DF2\u5173\u8054 ${r.existing.join("\u3001")}\uFF0C\u4E0D\u91CD\u590D\u5EFA\u3002\u8981\u518D\u5EFA\u52A0 --force`;
|
|
11913
|
+
const moved = r.moved ? `\uFF0C\u5DF2\u63A8\u8FDB\u5230 ${r.moved}` : r.moveError ? `\uFF0C\u4F46\u6CA1\u80FD\u63A8\u8FDB\u72B6\u6001\uFF1A${r.moveError}` : "";
|
|
11914
|
+
return `${r.key} \u2192 ${r.repo}#${r.number} ${r.url}${moved}`;
|
|
11915
|
+
});
|
|
11916
|
+
});
|
|
11917
|
+
}
|
|
11918
|
+
async function jiraSyncCommand(key2, args, deps = defaultDeps3) {
|
|
11919
|
+
await run(async () => {
|
|
11920
|
+
const r = await syncIssue(await triageDeps(deps), key2, { dryRun: !!args.dryRun });
|
|
11921
|
+
emit4(args.output, r, () => {
|
|
11922
|
+
const links = r.links.map(describeIssueState).join("\u3001") || "\uFF08\u65E0\uFF09";
|
|
11923
|
+
switch (r.outcome) {
|
|
11924
|
+
case "written":
|
|
11925
|
+
return `${r.key} \u5DF2\u56DE\u5199\uFF1A${links}${r.moved ? ` \u5E76\u63A8\u8FDB\u5230 ${r.moved}` : r.moveError ? `\uFF08\u72B6\u6001\u6CA1\u63A8\u52A8\uFF1A${r.moveError}\uFF09` : ""}`;
|
|
11926
|
+
case "dry-run-would-write":
|
|
11927
|
+
return `${r.key} \u4EE3\u7801\u5E93\u6761\u76EE\u5DF2\u5168\u5173\uFF0C\u5B9E\u8DD1\u4F1A\u56DE\u5199\u5E76\u63A8\u300C\u5904\u7406\u5B8C\u6210\u300D\uFF1A${links}`;
|
|
11928
|
+
case "already-written":
|
|
11929
|
+
return `${r.key} \u5DF2\u56DE\u5199\u8FC7\uFF0C\u8DF3\u8FC7\uFF1A${links}`;
|
|
11930
|
+
case "not-closed":
|
|
11931
|
+
return `${r.key} \u4EA7\u54C1\u4ED3\u8FD8\u6CA1\u5173\uFF1A${links}`;
|
|
11932
|
+
case "blocked-unreadable":
|
|
11933
|
+
return `${r.key} \u6709\u8BFB\u4E0D\u5230\u7684\u4EE3\u7801\u5E93\u6761\u76EE\uFF0C\u4E0D\u6562\u5224\u5DF2\u5173\uFF08fail-closed\uFF09\uFF1A${links}`;
|
|
11934
|
+
default:
|
|
11935
|
+
return `${r.key} \u6CA1\u6709\u5173\u8054\u7684\u4EA7\u54C1\u4ED3 issue\uFF08PR \u53F7\u4E0D\u7B97\uFF09\uFF0C\u5148 to-issue\uFF1A${links}`;
|
|
11936
|
+
}
|
|
11937
|
+
});
|
|
11938
|
+
if (r.outcome === "blocked-unreadable") process.exitCode = 1;
|
|
11939
|
+
});
|
|
11940
|
+
}
|
|
11941
|
+
async function jiraVerifyPassCommand(key2, note, args, deps = defaultDeps3) {
|
|
11942
|
+
await run(async () => {
|
|
11943
|
+
const text = args.file || args.body || note && note.trim() ? readBody(args, note) : "\u987E\u95EE\u5728\u76EE\u6807\u73AF\u5883\u590D\u9A8C\u901A\u8FC7\u3002";
|
|
11944
|
+
const r = await verifyPass(await deps.client(), key2, text);
|
|
11945
|
+
emit4(args.output, r, () => `${r.key} \u5DF2\u5173\u95ED\uFF08${r.to ?? "?"}\uFF09\uFF1A${r.url}`);
|
|
11946
|
+
});
|
|
11947
|
+
}
|
|
11948
|
+
async function jiraVerifyFailCommand(key2, note, args, deps = defaultDeps3) {
|
|
11949
|
+
await run(async () => {
|
|
11950
|
+
const r = await verifyFail(await triageDeps(deps), key2, readBody(args, note));
|
|
11951
|
+
emit4(args.output, r, () => {
|
|
11952
|
+
const moved = r.moved ? `\u5DF2\u9000\u56DE\u5230 ${r.moved}` : `\u72B6\u6001\u6CA1\u9000\u56DE\uFF08${r.moveError ?? "?"}\uFF09`;
|
|
11953
|
+
const failed2 = r.failed.length ? `\uFF1B\u91CD\u5F00\u5931\u8D25\uFF1A${r.failed.join("\u3001")}` : "";
|
|
11954
|
+
return `${r.key} ${moved}\uFF1B\u5DF2\u91CD\u5F00 ${r.reopened.join("\u3001") || "\uFF08\u6CA1\u6709\u53EF\u91CD\u5F00\u7684\u4EE3\u7801\u5E93\u6761\u76EE\uFF09"}${failed2}`;
|
|
11955
|
+
});
|
|
11956
|
+
});
|
|
11957
|
+
}
|
|
11958
|
+
async function jiraAuditCommand(args, deps = defaultDeps3) {
|
|
11959
|
+
await run(async () => {
|
|
11960
|
+
const r = await auditIssues(await deps.client());
|
|
11961
|
+
emit4(args.output, r, () => {
|
|
11962
|
+
if (!r.checked) return "\u9879\u76EE\u91CC\u6CA1\u6709\u672A\u89E3\u51B3\u7684\u7F3A\u53E3\u5355\u3002";
|
|
11963
|
+
const lines = r.bad.map((b) => `\u26A0\uFE0F ${b.key} [${b.status}] \u6CA1\u6709\u4EE3\u7801\u5E93\u6761\u76EE\uFF1A${b.url}`);
|
|
11964
|
+
lines.push(r.bad.length ? `${r.bad.length} \u6761\u72B6\u6001\u5DF2\u63A8\u8FDB\u5374\u6CA1\u767B\u8BB0\uFF0C\u5148\u8865 to-issue\u3002` : "\u4E00\u81F4\uFF1A\u5DF2\u53D7\u7406\u7684\u5355\u90FD\u6302\u7740\u4EE3\u7801\u5E93\u6761\u76EE\u3002");
|
|
11965
|
+
return lines.join("\n");
|
|
11966
|
+
});
|
|
11967
|
+
if (r.bad.length) process.exitCode = 1;
|
|
11968
|
+
});
|
|
11969
|
+
}
|
|
11970
|
+
async function jiraSearchCommand(keywords, args, deps = defaultDeps3) {
|
|
11971
|
+
await run(async () => {
|
|
11972
|
+
if (!keywords.length) throw new Error("\u7ED9\u81F3\u5C11\u4E00\u4E2A\u5173\u952E\u8BCD\uFF1A\u9519\u8BEF\u7801 / Model / Action / \u4E00\u53E5\u73B0\u8C61");
|
|
11973
|
+
const r = await gapSearch(await triageDeps(deps), keywords, { includeClosed: args.includeClosed !== false });
|
|
11974
|
+
emit4(args.output, r, () => {
|
|
11975
|
+
const head = r.jiraError ? `\u26A0\uFE0F Jira \u6CA1\u67E5\u6210\uFF08${r.jiraError}\uFF09\uFF0C\u4E0B\u9762\u53EA\u6709\u4EA7\u54C1\u4ED3\u7684\u7ED3\u679C\uFF0C\u4E0D\u4EE3\u8868 Jira \u91CC\u6CA1\u6709\u3002
|
|
11976
|
+
` : "";
|
|
11977
|
+
if (!r.rows.length) return `${head}Jira \u4E0E\u4EA7\u54C1\u4ED3\u90FD\u6CA1\u6709\u76F8\u5173\u8BB0\u5F55\u3002\u53EF\u4EE5 submit\uFF0C\u4F46\u5148\u628A\u4E09\u95EE\u7B54\u5B8C\u3002`;
|
|
11978
|
+
return `${head}\u547D\u4E2D ${r.rows.length} \u6761\uFF08\u540C\u4E00\u7F3A\u53E3\u5DF2\u6709\u7F16\u53F7\u5C31\u5728\u90A3\u6761\u4E0B\u8FFD\u52A0\u73B0\u573A\uFF0C\u4E0D\u65B0\u5F00\uFF09\uFF1A
|
|
11979
|
+
${r.rows.map((i) => `${i.where} ${i.id} [${i.state}${i.resolution ? "\xB7" + i.resolution : ""}] ${i.title}
|
|
11980
|
+
${i.url}`).join("\n")}`;
|
|
11981
|
+
});
|
|
11982
|
+
});
|
|
11983
|
+
}
|
|
11984
|
+
async function jiraStatusCommand(ref, args, deps = defaultDeps3) {
|
|
11985
|
+
await run(async () => {
|
|
11986
|
+
const r = await gapStatus(await triageDeps(deps), ref);
|
|
11987
|
+
emit4(args.output, r, () => [...r.lines, `\u4E0B\u4E00\u6B65\uFF1A${r.nextStep}`].join("\n"));
|
|
11988
|
+
});
|
|
11989
|
+
}
|
|
11990
|
+
async function fingerprintText(env2) {
|
|
11991
|
+
try {
|
|
11992
|
+
const g = await loadGlobalConfig12();
|
|
11993
|
+
const name = resolveActiveEnv6({ envFlag: env2 }, process.env, g);
|
|
11994
|
+
const cfg = await loadEnv12(name);
|
|
11995
|
+
if (!cfg?.endpoint) return `\u672A\u53D6\u5230\u6307\u7EB9\uFF08env=${name}\uFF1A\u6CA1\u6709 endpoint\uFF09`;
|
|
11996
|
+
const http = createHttpClient4({ endpoint: cfg.endpoint.replace(/\/+$/, ""), getAccessToken: async () => null, onRefresh: async () => {
|
|
11997
|
+
} });
|
|
11998
|
+
const resp = await http.get("/api/version/backend");
|
|
11999
|
+
const info = resp.data?.data ?? resp.data ?? {};
|
|
12000
|
+
const commit = info.commit ?? info.gitCommit ?? info.version ?? "?";
|
|
12001
|
+
return `backend ${String(commit).slice(0, 12)} \xB7 CLI ${CLI_VERSION} \xB7 env ${name}`;
|
|
12002
|
+
} catch (e) {
|
|
12003
|
+
return `\u672A\u53D6\u5230\u6307\u7EB9\uFF08env=${env2 ?? "\u672A\u8BBE"}\uFF1B${String(e.message ?? e).split("\n")[0]?.slice(0, 120)}\uFF09`;
|
|
12004
|
+
}
|
|
12005
|
+
}
|
|
12006
|
+
async function jiraSubmitCommand(args, deps = defaultDeps3) {
|
|
12007
|
+
await run(async () => {
|
|
12008
|
+
const raw = args.file ? readFileSync7(args.file, "utf8") : process.stdin.isTTY ? "" : readFileSync7(0, "utf8");
|
|
12009
|
+
if (!raw.trim()) throw new Error("\u7F3A\u53E3\u8F7D\u8377\uFF1A--file <gap.json> \u6216\u4ECE\u6807\u51C6\u8F93\u5165\u5582 JSON");
|
|
12010
|
+
const gap = validateGapInput(JSON.parse(raw));
|
|
12011
|
+
const fp = args.fingerprint ?? await fingerprintText(args.env);
|
|
12012
|
+
const r = await gapSubmit(await triageDeps(deps), gap, { fingerprintText: fp, issuetypeOverride: args.issuetype, assigneeOverride: args.assignee });
|
|
12013
|
+
emit4(
|
|
12014
|
+
args.output,
|
|
12015
|
+
r,
|
|
12016
|
+
() => r.outcome === "appended" ? `Jira \u91CC\u5DF2\u6709\u540C\u4E00\u7F3A\u53E3 ${r.key}\u300C${r.summary}\u300D\uFF0C\u5DF2\u8FFD\u52A0\u300C\u53C8\u4E00\u4E2A\u73B0\u573A\u300D\u8BC4\u8BBA\uFF0C\u6CA1\u6709\u65B0\u5F00\u3002
|
|
12017
|
+
${r.url}
|
|
12018
|
+
\u7ED9\u987E\u95EE\u7684\u8BDD\uFF1A\u8FD9\u4E2A\u95EE\u9898\u5DF2\u7ECF\u5728\u4EA7\u54C1\u90A3\u8FB9\u6392\u7740\uFF0C\u7F16\u53F7 ${r.key}\uFF1B\u5148\u7528\u66FF\u4EE3\u6CD5\u300C${r.alternative}\u300D\u7EE7\u7EED\uFF0C\u5206\u8BCA\u7ED3\u8BBA\u4F1A\u56DE\u5230\u90A3\u5355\u91CC\u3002` : `\u5DF2\u63D0 ${r.key}\uFF08${r.type} \xB7 ${r.module}\uFF09\uFF1A${r.url}
|
|
12019
|
+
\u7ED9\u987E\u95EE\u7684\u8BDD\uFF1A\u7F3A\u53E3\u5DF2\u63D0\uFF0C\u7F16\u53F7 ${r.key}\uFF1B\u5148\u7528\u66FF\u4EE3\u6CD5\u300C${r.alternative}\u300D\u7EE7\u7EED\uFF0C\u4EA7\u54C1\u5206\u8BCA\u540E\u4F1A\u5728\u90A3\u5355\u91CC\u56DE\u590D\u3002\u62A5\u544A\u91CC\u5199\u300CBLOCKED \xB7 \u5DF2\u63D0 ${r.key} \xB7 \u66FF\u4EE3\u6CD5\uFF1A${r.alternative}\u300D\u3002`
|
|
12020
|
+
);
|
|
12021
|
+
});
|
|
12022
|
+
}
|
|
12023
|
+
|
|
10904
12024
|
// src/commands/delivery-recon.ts
|
|
10905
12025
|
init_auth_guard();
|
|
10906
12026
|
init_exit();
|
|
@@ -10909,7 +12029,7 @@ import {
|
|
|
10909
12029
|
ReconLayout,
|
|
10910
12030
|
ROUND_EXIT_CODES,
|
|
10911
12031
|
computeReconSourceKey,
|
|
10912
|
-
formatObject as
|
|
12032
|
+
formatObject as formatObject28,
|
|
10913
12033
|
fromAxiosError as fromAxiosError22,
|
|
10914
12034
|
httpProbe as httpProbe4,
|
|
10915
12035
|
inspectRound,
|
|
@@ -10921,15 +12041,15 @@ async function deliveryReconCommand(args) {
|
|
|
10921
12041
|
try {
|
|
10922
12042
|
const ctx = await getActiveAuthContextFromCli(args);
|
|
10923
12043
|
const client3 = HcmClient24.fromAuthContext(ctx);
|
|
10924
|
-
const
|
|
10925
|
-
const sourceKey = await computeReconSourceKey(
|
|
12044
|
+
const probe2 = httpProbe4(client3.raw(), args.capabilities ?? DEFAULT_CAPABILITIES2);
|
|
12045
|
+
const sourceKey = await computeReconSourceKey(probe2);
|
|
10926
12046
|
const layout = new ReconLayout(args.out ?? ".", ctx.tenantId, sourceKey);
|
|
10927
|
-
const summary = await runRecon(
|
|
12047
|
+
const summary = await runRecon(probe2, layout, {
|
|
10928
12048
|
state: args.state ?? "",
|
|
10929
12049
|
onlyModel: args.model ?? null,
|
|
10930
12050
|
identity: ctx.tenantId ? { requestedTenantId: ctx.tenantId } : null
|
|
10931
12051
|
});
|
|
10932
|
-
process.stdout.write(
|
|
12052
|
+
process.stdout.write(formatObject28(summary, { format: args.output ?? "json" }) + "\n");
|
|
10933
12053
|
} catch (e) {
|
|
10934
12054
|
const err = e;
|
|
10935
12055
|
if (err?.isAxiosError) exitWithError(fromAxiosError22(err, args.env));
|
|
@@ -10943,7 +12063,7 @@ async function deliveryReconRoundCommand(args) {
|
|
|
10943
12063
|
const result = inspectRound(args.dir ?? ".");
|
|
10944
12064
|
const fmt = args.output ?? "json";
|
|
10945
12065
|
if (fmt !== "json") process.stdout.write(renderRound(result));
|
|
10946
|
-
process.stdout.write(
|
|
12066
|
+
process.stdout.write(formatObject28(result, { format: fmt }) + "\n");
|
|
10947
12067
|
code = ROUND_EXIT_CODES[result.state];
|
|
10948
12068
|
} catch (e) {
|
|
10949
12069
|
exitWithError(e);
|
|
@@ -10962,14 +12082,14 @@ import {
|
|
|
10962
12082
|
GAP_REASONS,
|
|
10963
12083
|
deriveAclass,
|
|
10964
12084
|
exitCode as gate0ExitCode,
|
|
10965
|
-
formatObject as
|
|
12085
|
+
formatObject as formatObject29,
|
|
10966
12086
|
inspectRound as inspectRound2,
|
|
10967
12087
|
loadProtocolFacts,
|
|
10968
12088
|
scan
|
|
10969
12089
|
} from "@hcmai/sdk";
|
|
10970
|
-
import * as
|
|
12090
|
+
import * as path14 from "path";
|
|
10971
12091
|
function renderGate0(result, skillRoot) {
|
|
10972
|
-
const where = skillRoot ? `\uFF08${
|
|
12092
|
+
const where = skillRoot ? `\uFF08${path14.resolve(skillRoot)}\uFF09` : "";
|
|
10973
12093
|
const lines = [
|
|
10974
12094
|
`\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`
|
|
10975
12095
|
];
|
|
@@ -11007,7 +12127,7 @@ async function deliveryGate0Command(args) {
|
|
|
11007
12127
|
const merged = { ...result, premise: premise5 };
|
|
11008
12128
|
const fmt = args.output ?? "json";
|
|
11009
12129
|
if (fmt !== "json") process.stdout.write(renderGate0(merged, skillRoot));
|
|
11010
|
-
process.stdout.write(`${
|
|
12130
|
+
process.stdout.write(`${formatObject29(merged, { format: fmt })}
|
|
11011
12131
|
`);
|
|
11012
12132
|
for (const problem of premise5) {
|
|
11013
12133
|
process.stderr.write(`\u{1F534} \u524D\u63D0\u4E0D\u6210\u7ACB\uFF08${problem.reason}\uFF09\uFF1A${problem.message}
|
|
@@ -11082,7 +12202,7 @@ import {
|
|
|
11082
12202
|
writeRisk
|
|
11083
12203
|
} from "@hcmai/sdk";
|
|
11084
12204
|
import { existsSync as existsSync3 } from "fs";
|
|
11085
|
-
import * as
|
|
12205
|
+
import * as path15 from "path";
|
|
11086
12206
|
function premise(message, hint = "") {
|
|
11087
12207
|
process.stderr.write(message + (hint ? `
|
|
11088
12208
|
\u2192 ${hint}` : "") + "\n");
|
|
@@ -11109,13 +12229,13 @@ async function runSeedPlan(args, client3) {
|
|
|
11109
12229
|
const reconDir = candidates[0].reconDir;
|
|
11110
12230
|
if (candidates.length > 1) {
|
|
11111
12231
|
process.stderr.write(
|
|
11112
|
-
`\u26A0\uFE0F \u540C\u79DF\u6237\u4E0B\u6709 ${candidates.length} \u4EFD\u57FA\u7EBF\uFF0C\u672C\u8F6E\u8BFB\u7684\u662F \`${
|
|
12232
|
+
`\u26A0\uFE0F \u540C\u79DF\u6237\u4E0B\u6709 ${candidates.length} \u4EFD\u57FA\u7EBF\uFF0C\u672C\u8F6E\u8BFB\u7684\u662F \`${path15.basename(reconDir)}\`\uFF1A` + candidates.slice(1).map((c) => `\`${path15.basename(c.reconDir)}\``).join("\u3001") + " \u672A\u88AB\u8BFB\u53D6 \u2014\u2014 \u4E0D\u540C sourceKey \u7684\u4EA7\u7269**\u4E0D\u53EF\u4E92\u6362**\u3002\n"
|
|
11113
12233
|
);
|
|
11114
12234
|
}
|
|
11115
12235
|
const round = inspectRound3(reconDir);
|
|
11116
12236
|
process.stderr.write(roundWarning(round));
|
|
11117
12237
|
const baseline = {
|
|
11118
|
-
path: `${
|
|
12238
|
+
path: `${path15.basename(path15.dirname(reconDir))}/${path15.basename(reconDir)}`,
|
|
11119
12239
|
roundId: round.roundId ?? null
|
|
11120
12240
|
};
|
|
11121
12241
|
let exemptions = null;
|
|
@@ -11376,8 +12496,8 @@ async function deliverySeedVerifyCommand(args) {
|
|
|
11376
12496
|
|
|
11377
12497
|
// src/commands/delivery-seed-find.ts
|
|
11378
12498
|
import { existsSync as existsSync4 } from "fs";
|
|
11379
|
-
import { readFileSync as
|
|
11380
|
-
import * as
|
|
12499
|
+
import { readFileSync as readFileSync8 } from "fs";
|
|
12500
|
+
import * as path16 from "path";
|
|
11381
12501
|
import {
|
|
11382
12502
|
INIT_EXIT_CODES as INIT_EXIT_CODES2,
|
|
11383
12503
|
ValueHints,
|
|
@@ -11391,10 +12511,10 @@ import {
|
|
|
11391
12511
|
valuesRoundCaveat
|
|
11392
12512
|
} from "@hcmai/sdk";
|
|
11393
12513
|
function provenance(chosenReconDir, others) {
|
|
11394
|
-
let line = `> \u57FA\u7EBF\uFF1A\`${
|
|
12514
|
+
let line = `> \u57FA\u7EBF\uFF1A\`${path16.basename(chosenReconDir)}\`
|
|
11395
12515
|
`;
|
|
11396
12516
|
if (others.length > 0) {
|
|
11397
|
-
line += `> \u26A0\uFE0F \u540C\u79DF\u6237\u4E0B\u53E6\u6709 ${others.length} \u4EFD\u57FA\u7EBF\u672A\u88AB\u8BFB\u53D6\uFF1A` + others.map((o) => `\`${
|
|
12517
|
+
line += `> \u26A0\uFE0F \u540C\u79DF\u6237\u4E0B\u53E6\u6709 ${others.length} \u4EFD\u57FA\u7EBF\u672A\u88AB\u8BFB\u53D6\uFF1A` + others.map((o) => `\`${path16.basename(o)}\``).join("\u3001") + " \u2014\u2014 \u4E0D\u540C sourceKey \u7684\u4EA7\u7269**\u4E0D\u53EF\u4E92\u6362**\u3002\n";
|
|
11398
12518
|
}
|
|
11399
12519
|
return `${line}
|
|
11400
12520
|
`;
|
|
@@ -11439,7 +12559,7 @@ function runSeedFind(args) {
|
|
|
11439
12559
|
if (!existsSync4(chosen.indexFile)) {
|
|
11440
12560
|
return premise2(`\u7D22\u5F15\u6587\u4EF6\u5728\u9009\u4E2D\u4E4B\u540E\u6D88\u5931\u4E86\uFF1A${chosen.indexFile}`);
|
|
11441
12561
|
}
|
|
11442
|
-
const { rows, problems } = loadRows(
|
|
12562
|
+
const { rows, problems } = loadRows(readFileSync8(chosen.indexFile, "utf-8"));
|
|
11443
12563
|
process.stdout.write(
|
|
11444
12564
|
renderFind(find(rows, args.term), args.term, rows.length, {
|
|
11445
12565
|
prefixBytes: Buffer.byteLength(prefix, "utf-8"),
|
|
@@ -11479,7 +12599,7 @@ function deliverySeedValuesCommand(model, args) {
|
|
|
11479
12599
|
|
|
11480
12600
|
// src/commands/delivery-meta.ts
|
|
11481
12601
|
init_auth_guard();
|
|
11482
|
-
import { readFileSync as
|
|
12602
|
+
import { readFileSync as readFileSync9 } from "fs";
|
|
11483
12603
|
import {
|
|
11484
12604
|
BINDING_WORDS,
|
|
11485
12605
|
CHANGE_STATES,
|
|
@@ -11627,7 +12747,7 @@ function premise3(what, hint) {
|
|
|
11627
12747
|
async function runDeliveryMeta(args, client3) {
|
|
11628
12748
|
let content;
|
|
11629
12749
|
try {
|
|
11630
|
-
content =
|
|
12750
|
+
content = readFileSync9(args.contentFile, "utf-8");
|
|
11631
12751
|
} catch (e) {
|
|
11632
12752
|
return premise3(
|
|
11633
12753
|
`\u8981\u5199\u8FDB\u53BB\u7684\u6B63\u6587\u8BFB\u4E0D\u51FA\u6765\uFF1A${e.message}`,
|
|
@@ -11730,8 +12850,8 @@ import {
|
|
|
11730
12850
|
ReconLayout as ReconLayout2,
|
|
11731
12851
|
runTriageRound
|
|
11732
12852
|
} from "@hcmai/sdk";
|
|
11733
|
-
import { mkdirSync, readFileSync as
|
|
11734
|
-
import * as
|
|
12853
|
+
import { mkdirSync, readFileSync as readFileSync10, writeFileSync as writeFileSync2 } from "fs";
|
|
12854
|
+
import * as path17 from "path";
|
|
11735
12855
|
var DEFAULT_CAPABILITIES4 = "default";
|
|
11736
12856
|
function premise4(message, hint) {
|
|
11737
12857
|
process.stderr.write(`\u{1F534} \u524D\u63D0\u4E0D\u6210\u7ACB\uFF1A${message}
|
|
@@ -11744,7 +12864,7 @@ var REQUESTS_SHAPE = "`--requests` \u6536\u7684\u662F\u4E00\u4E2A JSON \u6570\u7
|
|
|
11744
12864
|
function readRequests(file) {
|
|
11745
12865
|
let raw;
|
|
11746
12866
|
try {
|
|
11747
|
-
raw = JSON.parse(
|
|
12867
|
+
raw = JSON.parse(readFileSync10(file, "utf8"));
|
|
11748
12868
|
} catch (e) {
|
|
11749
12869
|
throw new Error(`\u9700\u6C42\u6E05\u5355\u8BFB\u4E0D\u51FA\u6765\uFF08${file}\uFF09\uFF1A${e instanceof Error ? e.message : String(e)}`);
|
|
11750
12870
|
}
|
|
@@ -11767,8 +12887,8 @@ function renderProblems(rows) {
|
|
|
11767
12887
|
`;
|
|
11768
12888
|
}
|
|
11769
12889
|
function writeTriageArtifact(outDir, body) {
|
|
11770
|
-
const out =
|
|
11771
|
-
mkdirSync(
|
|
12890
|
+
const out = path17.join(outDir, "work", "triage.md");
|
|
12891
|
+
mkdirSync(path17.dirname(out), { recursive: true });
|
|
11772
12892
|
writeFileSync2(out, body, "utf8");
|
|
11773
12893
|
return out;
|
|
11774
12894
|
}
|
|
@@ -11782,9 +12902,9 @@ async function runTriage(args) {
|
|
|
11782
12902
|
}
|
|
11783
12903
|
const ctx = await getActiveAuthContextFromCli(args);
|
|
11784
12904
|
const client3 = HcmClient27.fromAuthContext(ctx);
|
|
11785
|
-
const
|
|
11786
|
-
const artifactsDir = args.recon ?? new ReconLayout2(args.out ?? ".", ctx.tenantId, await computeReconSourceKey2(
|
|
11787
|
-
const result = await runTriageRound(
|
|
12905
|
+
const probe2 = httpProbe5(client3.raw(), args.capabilities ?? DEFAULT_CAPABILITIES4);
|
|
12906
|
+
const artifactsDir = args.recon ?? new ReconLayout2(args.out ?? ".", ctx.tenantId, await computeReconSourceKey2(probe2)).dir;
|
|
12907
|
+
const result = await runTriageRound(probe2, artifactsDir, entriesIn);
|
|
11788
12908
|
if (result.body === null) {
|
|
11789
12909
|
process.stdout.write(renderProblems(result.problems));
|
|
11790
12910
|
return 1;
|
|
@@ -11809,9 +12929,9 @@ async function deliveryTriageCommand(args) {
|
|
|
11809
12929
|
// src/commands/delivery-execution.ts
|
|
11810
12930
|
import { createHash as createHash5, randomBytes as secureRandomBytes } from "crypto";
|
|
11811
12931
|
import { spawn as spawn2 } from "child_process";
|
|
11812
|
-
import { createReadStream, promises as
|
|
11813
|
-
import
|
|
11814
|
-
import { CliError as CliError23, CliErrorCode as CliErrorCode21, formatObject as
|
|
12932
|
+
import { createReadStream, promises as fs14 } from "fs";
|
|
12933
|
+
import path18 from "path";
|
|
12934
|
+
import { CliError as CliError23, CliErrorCode as CliErrorCode21, formatObject as formatObject30 } from "@hcmai/sdk";
|
|
11815
12935
|
init_exit();
|
|
11816
12936
|
var EXECUTION_CONTRACT_VERSION = "2026-09-03.controlled-v4";
|
|
11817
12937
|
var DEFAULT_TTL_SECONDS = 15 * 60;
|
|
@@ -11853,11 +12973,11 @@ async function prepareDeliveryExecution(input) {
|
|
|
11853
12973
|
};
|
|
11854
12974
|
const planId = sha2565(canonicalJson(core)).slice(0, 24);
|
|
11855
12975
|
const plan = { ...core, planId };
|
|
11856
|
-
const plansDir =
|
|
12976
|
+
const plansDir = path18.join(project, ".hcm-delivery", "execution-plans");
|
|
11857
12977
|
await safeManagedDirectory(project, ".hcm-delivery/execution-plans", plansDir);
|
|
11858
|
-
const planFile =
|
|
12978
|
+
const planFile = path18.join(plansDir, `${planId}.json`);
|
|
11859
12979
|
try {
|
|
11860
|
-
await
|
|
12980
|
+
await fs14.writeFile(planFile, `${JSON.stringify(plan, null, 2)}
|
|
11861
12981
|
`, {
|
|
11862
12982
|
encoding: "utf8",
|
|
11863
12983
|
mode: 384,
|
|
@@ -11871,7 +12991,7 @@ async function prepareDeliveryExecution(input) {
|
|
|
11871
12991
|
async function executeDeliveryPlan(input) {
|
|
11872
12992
|
if (!PLAN_ID_PATTERN.test(input.planId)) throw invalid2("planId \u5FC5\u987B\u662F 24 \u4F4D\u5C0F\u5199\u5341\u516D\u8FDB\u5236");
|
|
11873
12993
|
const project = await realProject(input.project);
|
|
11874
|
-
const planFile =
|
|
12994
|
+
const planFile = path18.join(project, ".hcm-delivery", "execution-plans", `${input.planId}.json`);
|
|
11875
12995
|
const plan = await readPlan(project, planFile);
|
|
11876
12996
|
if (plan.planId !== input.planId || computePlanId(plan) !== input.planId) {
|
|
11877
12997
|
throw invalid2("\u6267\u884C\u8BA1\u5212\u5185\u5BB9\u4E0E planId \u6458\u8981\u4E0D\u4E00\u81F4");
|
|
@@ -11908,13 +13028,13 @@ async function executeDeliveryPlan(input) {
|
|
|
11908
13028
|
await assertDocumentUnchanged(project, plan.documents.rollback, "\u56DE\u6EDA\u8BF4\u660E");
|
|
11909
13029
|
await assertPayloadsUnchanged(project, plan.payloads);
|
|
11910
13030
|
const evidenceDir = await bindEvidenceDirectory(project, plan.evidenceDir);
|
|
11911
|
-
const receiptFile =
|
|
13031
|
+
const receiptFile = path18.join(evidenceDir.absolute, `${plan.planId}.receipt.json`);
|
|
11912
13032
|
if (await pathExists(receiptFile)) throw invalid2(`\u6267\u884C\u6536\u636E\u5DF2\u5B58\u5728\uFF0C\u62D2\u7EDD\u518D\u6B21\u6267\u884C\uFF1A${plan.planId}`);
|
|
11913
|
-
const claimsDir =
|
|
13033
|
+
const claimsDir = path18.join(project, ".hcm-delivery", "execution-claims");
|
|
11914
13034
|
await safeManagedDirectory(project, ".hcm-delivery/execution-claims", claimsDir);
|
|
11915
|
-
const claimFile =
|
|
13035
|
+
const claimFile = path18.join(claimsDir, `${plan.planId}.json`);
|
|
11916
13036
|
try {
|
|
11917
|
-
await
|
|
13037
|
+
await fs14.writeFile(
|
|
11918
13038
|
claimFile,
|
|
11919
13039
|
`${JSON.stringify({ schemaVersion: 1, planId: plan.planId, claimedAt: now.toISOString() }, null, 2)}
|
|
11920
13040
|
`,
|
|
@@ -11925,10 +13045,10 @@ async function executeDeliveryPlan(input) {
|
|
|
11925
13045
|
}
|
|
11926
13046
|
const stdoutHash = createHash5("sha256");
|
|
11927
13047
|
const stderrHash = createHash5("sha256");
|
|
11928
|
-
const
|
|
13048
|
+
const run2 = input.runCommand ?? runCurrentCliCommand;
|
|
11929
13049
|
let exitCode;
|
|
11930
13050
|
try {
|
|
11931
|
-
({ exitCode } = await
|
|
13051
|
+
({ exitCode } = await run2(argv, project, {
|
|
11932
13052
|
stdout: (chunk) => stdoutHash.update(chunk),
|
|
11933
13053
|
stderr: (chunk) => stderrHash.update(chunk)
|
|
11934
13054
|
}));
|
|
@@ -11971,11 +13091,13 @@ async function deliveryPrepareCommand(argv, args) {
|
|
|
11971
13091
|
evidenceDir: args.evidenceDir,
|
|
11972
13092
|
...ttlSeconds === void 0 ? {} : { ttlSeconds }
|
|
11973
13093
|
});
|
|
11974
|
-
process.stdout.write(
|
|
11975
|
-
process.stderr.write(
|
|
13094
|
+
process.stdout.write(formatObject30(plan, { format: args.output ?? "json" }) + "\n");
|
|
13095
|
+
process.stderr.write(
|
|
13096
|
+
`
|
|
11976
13097
|
\u4E0B\u4E00\u6B65\uFF08argv \u5FC5\u987B\u4E0E\u672C\u6B21\u5B8C\u5168\u4E00\u81F4\uFF09\uFF1A
|
|
11977
13098
|
${nextCommandHint(plan.planId, args.project, argv)}
|
|
11978
|
-
`
|
|
13099
|
+
`
|
|
13100
|
+
);
|
|
11979
13101
|
} catch (cause) {
|
|
11980
13102
|
exitWithError(cause);
|
|
11981
13103
|
}
|
|
@@ -11998,17 +13120,20 @@ async function deliveryExecuteCommand(planId, argv, args) {
|
|
|
11998
13120
|
}
|
|
11999
13121
|
}
|
|
12000
13122
|
function writeDeliveryExecutionReceipt(receipt, format = "json") {
|
|
12001
|
-
process.stderr.write(
|
|
13123
|
+
process.stderr.write(formatObject30(receipt, { format }) + "\n");
|
|
12002
13124
|
process.exitCode = receipt.exitCode;
|
|
12003
13125
|
}
|
|
12004
13126
|
async function readProjectMode(project, environment) {
|
|
12005
|
-
const file =
|
|
13127
|
+
const file = path18.join(project, ".hcm-delivery", "project.yml");
|
|
12006
13128
|
const content = await readSafeFile(project, file, "\u9879\u76EE\u914D\u7F6E");
|
|
12007
13129
|
let mode;
|
|
12008
13130
|
try {
|
|
12009
13131
|
mode = deliveryModeForEnvironment(content.toString("utf8"), environment);
|
|
12010
13132
|
} catch (cause) {
|
|
12011
|
-
throw invalid2(
|
|
13133
|
+
throw invalid2(
|
|
13134
|
+
`project.yml \u7684 deliveryMode \u914D\u7F6E\u65E0\u6548\uFF1A${String(cause.message)}`,
|
|
13135
|
+
cause
|
|
13136
|
+
);
|
|
12012
13137
|
}
|
|
12013
13138
|
if (!mode) {
|
|
12014
13139
|
throw invalid2(
|
|
@@ -12018,13 +13143,13 @@ async function readProjectMode(project, environment) {
|
|
|
12018
13143
|
return mode;
|
|
12019
13144
|
}
|
|
12020
13145
|
var SKILLS_LOCK_CANDIDATES = [
|
|
12021
|
-
|
|
12022
|
-
|
|
13146
|
+
path18.join("hcm-skills", ".hcm-skills.json"),
|
|
13147
|
+
path18.join(".claude", "skills", ".hcm-skills.json")
|
|
12023
13148
|
];
|
|
12024
13149
|
async function readSkillsLock(project) {
|
|
12025
13150
|
const found = [];
|
|
12026
13151
|
for (const candidate of SKILLS_LOCK_CANDIDATES) {
|
|
12027
|
-
if (await pathExists(
|
|
13152
|
+
if (await pathExists(path18.join(project, candidate))) found.push(candidate);
|
|
12028
13153
|
}
|
|
12029
13154
|
if (found.length === 0) {
|
|
12030
13155
|
throw invalid2(
|
|
@@ -12036,7 +13161,7 @@ async function readSkillsLock(project) {
|
|
|
12036
13161
|
`\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`
|
|
12037
13162
|
);
|
|
12038
13163
|
}
|
|
12039
|
-
const bytes = await readSafeFile(project,
|
|
13164
|
+
const bytes = await readSafeFile(project, path18.join(project, found[0]), "\u6280\u80FD\u9501");
|
|
12040
13165
|
try {
|
|
12041
13166
|
JSON.parse(bytes.toString("utf8"));
|
|
12042
13167
|
} catch (cause) {
|
|
@@ -12049,7 +13174,7 @@ async function bindDocument(project, reference, label) {
|
|
|
12049
13174
|
if (!(relative2.startsWith("work/") || relative2.startsWith("decisions/"))) {
|
|
12050
13175
|
throw invalid2(`${label}\u5FC5\u987B\u4F4D\u4E8E\u9879\u76EE work/ \u6216 decisions/ \u4E0B`);
|
|
12051
13176
|
}
|
|
12052
|
-
const file =
|
|
13177
|
+
const file = path18.join(project, relative2);
|
|
12053
13178
|
const bytes = await readSafeFile(project, file, label);
|
|
12054
13179
|
return { path: relative2, sha256: sha2565(bytes) };
|
|
12055
13180
|
}
|
|
@@ -12062,11 +13187,11 @@ async function bindEvidenceDirectory(project, reference) {
|
|
|
12062
13187
|
if (!(relative2 === "evidence" || relative2.startsWith("evidence/"))) {
|
|
12063
13188
|
throw invalid2("evidence \u76EE\u5F55\u5FC5\u987B\u4F4D\u4E8E\u9879\u76EE evidence/ \u4E0B");
|
|
12064
13189
|
}
|
|
12065
|
-
const absolute =
|
|
13190
|
+
const absolute = path18.join(project, relative2);
|
|
12066
13191
|
await assertNoSymlinkComponents(project, relative2);
|
|
12067
|
-
const stat = await
|
|
13192
|
+
const stat = await fs14.stat(absolute).catch(() => null);
|
|
12068
13193
|
if (stat === null) {
|
|
12069
|
-
await
|
|
13194
|
+
await fs14.mkdir(absolute, { recursive: true, mode: 448 }).catch((cause) => {
|
|
12070
13195
|
throw invalid2(
|
|
12071
13196
|
`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`,
|
|
12072
13197
|
cause
|
|
@@ -12208,7 +13333,10 @@ function requireExactlyOnePayload(argv, command) {
|
|
|
12208
13333
|
}
|
|
12209
13334
|
var PAYLOAD_FILE_FLAGS = ["--data-file", "--params-file", "--file"];
|
|
12210
13335
|
var PAYLOAD_DIR_FLAGS = ["--dir"];
|
|
12211
|
-
var IMPLICIT_DIR_COMMANDS = {
|
|
13336
|
+
var IMPLICIT_DIR_COMMANDS = {
|
|
13337
|
+
"workspace push": ".",
|
|
13338
|
+
"workspace rm": "."
|
|
13339
|
+
};
|
|
12212
13340
|
var TOOLING_DIRS = [".git", "node_modules", ".hcm-delivery", "evidence"];
|
|
12213
13341
|
var POSITIONAL_PAYLOAD_COMMANDS = {
|
|
12214
13342
|
import: { index: 1, kind: "file-or-directory", label: "import \u6570\u636E\u96C6\u8F7D\u8377" },
|
|
@@ -12246,7 +13374,7 @@ async function bindPayloadPath(project, reference, label) {
|
|
|
12246
13374
|
const relative2 = safeRelative(reference, label);
|
|
12247
13375
|
let stat;
|
|
12248
13376
|
try {
|
|
12249
|
-
stat = await
|
|
13377
|
+
stat = await fs14.stat(path18.join(project, relative2));
|
|
12250
13378
|
} catch (cause) {
|
|
12251
13379
|
throw invalid2(
|
|
12252
13380
|
`${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`,
|
|
@@ -12257,10 +13385,10 @@ async function bindPayloadPath(project, reference, label) {
|
|
|
12257
13385
|
}
|
|
12258
13386
|
async function bindPayloadDirectory(project, reference, label) {
|
|
12259
13387
|
const relative2 = reference === "." ? "." : safeRelative(reference, label);
|
|
12260
|
-
const root =
|
|
13388
|
+
const root = path18.join(project, relative2);
|
|
12261
13389
|
let stat;
|
|
12262
13390
|
try {
|
|
12263
|
-
stat = await
|
|
13391
|
+
stat = await fs14.stat(root);
|
|
12264
13392
|
} catch {
|
|
12265
13393
|
throw invalid2(`${label}\u4E0D\u5B58\u5728\uFF1A${relative2}`);
|
|
12266
13394
|
}
|
|
@@ -12270,10 +13398,12 @@ async function bindPayloadDirectory(project, reference, label) {
|
|
|
12270
13398
|
const skipToolingAtRoot = relative2 === ".";
|
|
12271
13399
|
const entries = [];
|
|
12272
13400
|
const walk = async (dir, prefix) => {
|
|
12273
|
-
const items = await
|
|
12274
|
-
for (const item of [...items].sort(
|
|
13401
|
+
const items = await fs14.readdir(dir, { withFileTypes: true });
|
|
13402
|
+
for (const item of [...items].sort(
|
|
13403
|
+
(a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0
|
|
13404
|
+
)) {
|
|
12275
13405
|
if (skipToolingAtRoot && prefix === "" && TOOLING_DIRS.includes(item.name)) continue;
|
|
12276
|
-
const child =
|
|
13406
|
+
const child = path18.join(dir, item.name);
|
|
12277
13407
|
const rel = prefix ? `${prefix}/${item.name}` : item.name;
|
|
12278
13408
|
if (item.isSymbolicLink()) {
|
|
12279
13409
|
throw invalid2(
|
|
@@ -12298,7 +13428,7 @@ ${sha2565(bytes)}`);
|
|
|
12298
13428
|
}
|
|
12299
13429
|
async function bindPayloadFile(project, reference, label) {
|
|
12300
13430
|
const relative2 = safeRelative(reference, label);
|
|
12301
|
-
const file =
|
|
13431
|
+
const file = path18.join(project, relative2);
|
|
12302
13432
|
const bytes = await readSafeFile(project, file, label);
|
|
12303
13433
|
return { path: relative2, kind: "file", sha256: sha2565(bytes) };
|
|
12304
13434
|
}
|
|
@@ -12361,29 +13491,29 @@ async function runCurrentCliCommand(argv, cwd, streams) {
|
|
|
12361
13491
|
async function writeReceiptExclusive(target, receipt) {
|
|
12362
13492
|
const temp = `${target}.${process.pid}.${Date.now()}.tmp`;
|
|
12363
13493
|
try {
|
|
12364
|
-
await
|
|
13494
|
+
await fs14.writeFile(temp, `${JSON.stringify(receipt, null, 2)}
|
|
12365
13495
|
`, {
|
|
12366
13496
|
encoding: "utf8",
|
|
12367
13497
|
mode: 384,
|
|
12368
13498
|
flag: "wx"
|
|
12369
13499
|
});
|
|
12370
|
-
await
|
|
13500
|
+
await fs14.link(temp, target);
|
|
12371
13501
|
} catch (cause) {
|
|
12372
|
-
throw invalid2(`\u6267\u884C\u6536\u636E\u5199\u5165\u5931\u8D25\u6216\u5DF2\u5B58\u5728\uFF1A${
|
|
13502
|
+
throw invalid2(`\u6267\u884C\u6536\u636E\u5199\u5165\u5931\u8D25\u6216\u5DF2\u5B58\u5728\uFF1A${path18.basename(target)}`, cause);
|
|
12373
13503
|
} finally {
|
|
12374
|
-
await
|
|
13504
|
+
await fs14.unlink(temp).catch(() => void 0);
|
|
12375
13505
|
}
|
|
12376
13506
|
}
|
|
12377
13507
|
async function safeManagedDirectory(project, relative2, absolute) {
|
|
12378
|
-
await assertNoSymlinkComponents(project,
|
|
12379
|
-
const existing = await
|
|
13508
|
+
await assertNoSymlinkComponents(project, path18.dirname(relative2));
|
|
13509
|
+
const existing = await fs14.lstat(absolute).catch(() => void 0);
|
|
12380
13510
|
if (existing?.isSymbolicLink()) throw invalid2(`\u53D7\u7BA1\u76EE\u5F55\u4E0D\u80FD\u662F\u7B26\u53F7\u94FE\u63A5\uFF1A${relative2}`);
|
|
12381
13511
|
if (existing && !existing.isDirectory()) throw invalid2(`\u53D7\u7BA1\u8DEF\u5F84\u4E0D\u662F\u76EE\u5F55\uFF1A${relative2}`);
|
|
12382
|
-
if (!existing) await
|
|
12383
|
-
await
|
|
13512
|
+
if (!existing) await fs14.mkdir(absolute, { mode: 448 });
|
|
13513
|
+
await fs14.chmod(absolute, 448);
|
|
12384
13514
|
}
|
|
12385
13515
|
async function pathExists(file) {
|
|
12386
|
-
return
|
|
13516
|
+
return fs14.lstat(file).then(
|
|
12387
13517
|
() => true,
|
|
12388
13518
|
(cause) => {
|
|
12389
13519
|
if (cause.code === "ENOENT") return false;
|
|
@@ -12392,47 +13522,47 @@ async function pathExists(file) {
|
|
|
12392
13522
|
);
|
|
12393
13523
|
}
|
|
12394
13524
|
async function readSafeFile(project, file, label) {
|
|
12395
|
-
const relative2 =
|
|
12396
|
-
if (relative2.startsWith("../") ||
|
|
13525
|
+
const relative2 = path18.relative(project, file).split(path18.sep).join("/");
|
|
13526
|
+
if (relative2.startsWith("../") || path18.isAbsolute(relative2))
|
|
12397
13527
|
throw invalid2(`${label}\u8DEF\u5F84\u9003\u9038\u9879\u76EE`);
|
|
12398
13528
|
await assertNoSymlinkComponents(project, relative2);
|
|
12399
13529
|
let stat;
|
|
12400
13530
|
try {
|
|
12401
|
-
stat = await
|
|
13531
|
+
stat = await fs14.lstat(file);
|
|
12402
13532
|
} catch (cause) {
|
|
12403
13533
|
throw invalid2(`${label}\u4E0D\u53EF\u7528\uFF1A${relative2}`, cause);
|
|
12404
13534
|
}
|
|
12405
13535
|
if (stat.isSymbolicLink()) throw invalid2(`${label}\u4E0D\u80FD\u662F\u7B26\u53F7\u94FE\u63A5\uFF1A${relative2}`);
|
|
12406
13536
|
if (!stat.isFile()) throw invalid2(`${label}\u4E0D\u662F\u666E\u901A\u6587\u4EF6\uFF1A${relative2}`);
|
|
12407
|
-
return
|
|
13537
|
+
return fs14.readFile(file);
|
|
12408
13538
|
}
|
|
12409
13539
|
async function assertNoSymlinkComponents(project, relative2) {
|
|
12410
13540
|
const parts = relative2.split("/").filter(Boolean);
|
|
12411
13541
|
let current = project;
|
|
12412
13542
|
for (const part of parts) {
|
|
12413
|
-
current =
|
|
12414
|
-
const stat = await
|
|
13543
|
+
current = path18.join(current, part);
|
|
13544
|
+
const stat = await fs14.lstat(current).catch(() => void 0);
|
|
12415
13545
|
if (stat?.isSymbolicLink()) throw invalid2(`\u8DEF\u5F84\u5305\u542B\u7B26\u53F7\u94FE\u63A5\uFF1A${relative2}`);
|
|
12416
13546
|
if (!stat) break;
|
|
12417
13547
|
}
|
|
12418
13548
|
}
|
|
12419
13549
|
async function realProject(requested) {
|
|
12420
|
-
const absolute =
|
|
13550
|
+
const absolute = path18.resolve(requested);
|
|
12421
13551
|
let project;
|
|
12422
13552
|
try {
|
|
12423
|
-
project = await
|
|
13553
|
+
project = await fs14.realpath(absolute);
|
|
12424
13554
|
} catch (cause) {
|
|
12425
13555
|
throw invalid2(`\u9879\u76EE\u76EE\u5F55\u4E0D\u53EF\u7528\uFF1A${absolute}`, cause);
|
|
12426
13556
|
}
|
|
12427
|
-
const stat = await
|
|
13557
|
+
const stat = await fs14.stat(project);
|
|
12428
13558
|
if (!stat.isDirectory()) throw invalid2(`\u9879\u76EE\u8DEF\u5F84\u4E0D\u662F\u76EE\u5F55\uFF1A${absolute}`);
|
|
12429
13559
|
return project;
|
|
12430
13560
|
}
|
|
12431
13561
|
function safeRelative(reference, label) {
|
|
12432
|
-
if (!reference ||
|
|
13562
|
+
if (!reference || path18.isAbsolute(reference) || /[\r\n\0]/.test(reference)) {
|
|
12433
13563
|
throw invalid2(`${label}\u5FC5\u987B\u662F\u9879\u76EE\u5185\u76F8\u5BF9\u8DEF\u5F84`);
|
|
12434
13564
|
}
|
|
12435
|
-
const normalized =
|
|
13565
|
+
const normalized = path18.normalize(reference).split(path18.sep).join("/");
|
|
12436
13566
|
if (normalized === ".." || normalized.startsWith("../") || normalized === ".") {
|
|
12437
13567
|
throw invalid2(`${label}\u8DEF\u5F84\u9003\u9038\u9879\u76EE`);
|
|
12438
13568
|
}
|
|
@@ -12499,7 +13629,7 @@ init_exit();
|
|
|
12499
13629
|
import {
|
|
12500
13630
|
HcmClient as HcmClient28,
|
|
12501
13631
|
adminResetPassword,
|
|
12502
|
-
formatObject as
|
|
13632
|
+
formatObject as formatObject31,
|
|
12503
13633
|
fromAxiosError as fromAxiosError23,
|
|
12504
13634
|
CliError as CliError24,
|
|
12505
13635
|
CliErrorCode as CliErrorCode22
|
|
@@ -12533,7 +13663,7 @@ async function userResetPasswordCommand(args) {
|
|
|
12533
13663
|
const request = buildAdminResetPasswordRequest(args, password);
|
|
12534
13664
|
const client3 = HcmClient28.fromAuthContext(await getActiveAuthContextFromCli(args));
|
|
12535
13665
|
const result = await adminResetPassword(client3.raw(), request);
|
|
12536
|
-
process.stdout.write(
|
|
13666
|
+
process.stdout.write(formatObject31(result, { format: args.output ?? "json" }) + "\n");
|
|
12537
13667
|
} catch (cause) {
|
|
12538
13668
|
const err = cause;
|
|
12539
13669
|
if (err?.isAxiosError) exitWithError(fromAxiosError23(err, args.env));
|
|
@@ -12557,7 +13687,7 @@ init_exit();
|
|
|
12557
13687
|
init_auth_guard();
|
|
12558
13688
|
import {
|
|
12559
13689
|
HcmClient as HcmClient29,
|
|
12560
|
-
formatObject as
|
|
13690
|
+
formatObject as formatObject32,
|
|
12561
13691
|
fromAxiosError as fromAxiosError24
|
|
12562
13692
|
} from "@hcmai/sdk";
|
|
12563
13693
|
async function modelsCommand(keyword, args) {
|
|
@@ -12568,7 +13698,7 @@ async function modelsCommand(keyword, args) {
|
|
|
12568
13698
|
const rows = (needle ? all.filter((m) => JSON.stringify(m).toLowerCase().includes(needle)) : all).sort((a, b) => key(a).localeCompare(key(b)));
|
|
12569
13699
|
const fmt = args.output ?? "table";
|
|
12570
13700
|
if (fmt !== "table") {
|
|
12571
|
-
process.stdout.write(
|
|
13701
|
+
process.stdout.write(formatObject32({ total: rows.length, models: rows }, { format: fmt }) + "\n");
|
|
12572
13702
|
process.exitCode = 0;
|
|
12573
13703
|
return;
|
|
12574
13704
|
}
|
|
@@ -12618,11 +13748,17 @@ var exitOnBrokenPipe = (err) => {
|
|
|
12618
13748
|
};
|
|
12619
13749
|
process.stdout.on("error", exitOnBrokenPipe);
|
|
12620
13750
|
process.stderr.on("error", exitOnBrokenPipe);
|
|
12621
|
-
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(
|
|
13751
|
+
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(
|
|
13752
|
+
"--lang <code>",
|
|
13753
|
+
"\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"
|
|
13754
|
+
).hook("preAction", (thisCommand) => {
|
|
12622
13755
|
const lang = thisCommand.opts().lang;
|
|
12623
13756
|
if (lang) process.env.HCM_LANG = lang;
|
|
12624
13757
|
});
|
|
12625
|
-
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(
|
|
13758
|
+
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(
|
|
13759
|
+
"--new-password <pwd>",
|
|
13760
|
+
"\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"
|
|
13761
|
+
).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 }));
|
|
12626
13762
|
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));
|
|
12627
13763
|
var config = program.command("config").description("\u7BA1\u7406\u5168\u5C40 defaults\uFF08env/identity \u7528 `hcm env` / `hcm identity`\uFF09");
|
|
12628
13764
|
config.command("list").description("[deprecated] \u7528 `hcm env list`").action(() => configListDeprecated());
|
|
@@ -12648,9 +13784,29 @@ identity.command("remove <name>").description("\u5220\u9664 identity\uFF08\u6E05
|
|
|
12648
13784
|
var user = program.command("user").description("\u7BA1\u7406\u79DF\u6237\u7528\u6237\u7684\u4E13\u7528\u51ED\u636E\u6D41\u7A0B");
|
|
12649
13785
|
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));
|
|
12650
13786
|
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");
|
|
12651
|
-
chiron.command("init").description(
|
|
13787
|
+
chiron.command("init").description(
|
|
13788
|
+
"\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"
|
|
13789
|
+
).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));
|
|
12652
13790
|
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));
|
|
12653
|
-
chiron.command("doctor").description(
|
|
13791
|
+
chiron.command("doctor").description(
|
|
13792
|
+
"\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"
|
|
13793
|
+
).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));
|
|
13794
|
+
var OUTPUT_OPT = ["--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "table"];
|
|
13795
|
+
var jira = program.command("jira").description("\u777F\u620E\u7F3A\u53E3\u5728 Jira\uFF08HCMNX\uFF09\u4E0A\u7684\u51FA\u53E3\uFF1A\u987E\u95EE\u4FA7 search / status / submit\uFF1B\u4EA7\u54C1\u4FA7 open / show / to-issue / sync / verify-*");
|
|
13796
|
+
jira.command("probe").description("\u6211\u662F\u8C01 / Jira \u7248\u672C / \u9879\u76EE / issuetype \u4E0E\u5FC5\u586B\u5B57\u6BB5 / \u72B6\u6001\u6D41\uFF1B\u7B2C\u4E00\u6B21\u5148\u8DD1\u5B83").option(...OUTPUT_OPT).action((opts) => jiraProbeCommand(opts));
|
|
13797
|
+
jira.command("open").description("\u5F85\u5206\u8BCA\u7684\u5355\uFF08\u72B6\u6001\u300C\u65B0\u589E\u300D\uFF09\uFF1B--all \u770B\u9879\u76EE\u91CC\u5168\u90E8\u672A\u89E3\u51B3\u7684").option("--all", "\u5168\u90E8\u672A\u89E3\u51B3\u7684\u5355\uFF0C\u4E0D\u53EA\u5F85\u5206\u8BCA").option(...OUTPUT_OPT).action((opts) => jiraOpenCommand(opts));
|
|
13798
|
+
jira.command("show").description("\u6B63\u6587 + \u8BC4\u8BBA + \u5173\u8054\u4EE3\u7801\u5E93\u6761\u76EE\u7684\u72B6\u6001 + \u53EF\u7528\u6D41\u8F6C").argument("<key>", "Jira \u5355\u53F7\uFF0C\u5982 HCMNX-12").option(...OUTPUT_OPT).action((key2, opts) => jiraShowCommand(key2, opts));
|
|
13799
|
+
jira.command("comment").description("\u56DE\u590D\uFF08\u5206\u8BCA\u7ED3\u8BBA\u8D70\u8FD9\u6761\uFF09\uFF1A-f \u6587\u4EF6 / --body \u6587\u672C / \u4F4D\u7F6E\u53C2\u6570 / \u6807\u51C6\u8F93\u5165").argument("<key>", "Jira \u5355\u53F7").argument("[text]", "\u6B63\u6587").option("-f, --file <path>", "\u6B63\u6587\u6587\u4EF6").option("--body <text>", "\u6B63\u6587").option(...OUTPUT_OPT).action((key2, text, opts) => jiraCommentCommand(key2, text, opts));
|
|
13800
|
+
jira.command("assign").description("\u63A5\u624B\uFF1A\u6539\u7ECF\u529E\u4EBA\uFF08\u9ED8\u8BA4 me\uFF09").argument("<key>", "Jira \u5355\u53F7").argument("[who]", "\u7528\u6237\u540D\u6216 me", "me").option(...OUTPUT_OPT).action((key2, who, opts) => jiraAssignCommand(key2, who, opts));
|
|
13801
|
+
jira.command("move").description("\u6D41\u8F6C\uFF1A\u76EE\u6807\u72B6\u6001\u540D\u6216\u6D41\u8F6C\u540D\uFF08\u5982 \u63D0\u4EA4\u534F\u8C03 / \u4E0D\u7528\u5904\u7406\u4E86\uFF09\uFF1B\u53EF\u9644\u8BC4\u8BBA").argument("<key>", "Jira \u5355\u53F7").argument("<target>", "\u72B6\u6001\u6216\u6D41\u8F6C\u540D").option("-f, --file <path>", "\u9644\u5E26\u8BC4\u8BBA\u7684\u6587\u4EF6").option("--body <text>", "\u9644\u5E26\u8BC4\u8BBA").option(...OUTPUT_OPT).action((key2, target, opts) => jiraMoveCommand(key2, target, opts));
|
|
13802
|
+
jira.command("to-issue").description("\u5206\u8BCA\u4E3A\u771F\u7F3A\u53E3\uFF1A\u8F6C\u4EA7\u54C1\u4ED3 issue \u5E76\u53CC\u5411\u56DE\u94FE\uFF08\u5EFA\u6761\u76EE \u2192 \u6302\u94FE\u63A5 \u2192 \u63A5\u624B \u2192 \u63A8 OPEN\uFF09").argument("<key>", "Jira \u5355\u53F7").option("--repo <slug>", "\u4EA7\u54C1\u4ED3", "hcm/hcm_nx_core").option("--force", "\u5DF2\u5173\u8054\u8FC7\u4E5F\u518D\u5EFA\u4E00\u6761").option(...OUTPUT_OPT).action((key2, opts) => jiraToIssueCommand(key2, opts));
|
|
13803
|
+
jira.command("sync").description("\u4EE3\u7801\u5E93\u6761\u76EE\u5168\u5173 \u2192 \u56DE\u5199 Jira \u5E76\u63A8\u300C\u5DF2\u4FEE\u590D\u300D\uFF08PR \u53F7\u4E0D\u7B97\u6761\u76EE\uFF1B\u8BFB\u4E0D\u5230\u7684\u6309\u672A\u5173\u5904\u7406\uFF09").argument("<key>", "Jira \u5355\u53F7").option("--dry-run", "\u53EA\u5224\u65AD\u4E0D\u5199").option(...OUTPUT_OPT).action((key2, opts) => jiraSyncCommand(key2, opts));
|
|
13804
|
+
jira.command("verify-pass").description("\u987E\u95EE\u5728\u76EE\u6807\u73AF\u5883\u590D\u9A8C\u901A\u8FC7 \u2192 CLOSE").argument("<key>", "Jira \u5355\u53F7").argument("[note]", "\u8BF4\u660E").option("-f, --file <path>", "\u8BF4\u660E\u6587\u4EF6").option("--body <text>", "\u8BF4\u660E").option(...OUTPUT_OPT).action((key2, note, opts) => jiraVerifyPassCommand(key2, note, opts));
|
|
13805
|
+
jira.command("verify-fail").description("\u590D\u9A8C\u4E0D\u901A\u8FC7 \u2192 \u9000\u56DE OPEN\uFF0C\u5E76\u91CD\u5F00\u4EE3\u7801\u5E93 issue").argument("<key>", "Jira \u5355\u53F7").argument("[note]", "\u4E0D\u901A\u8FC7\u7684\u8BF4\u660E").option("-f, --file <path>", "\u8BF4\u660E\u6587\u4EF6").option("--body <text>", "\u8BF4\u660E").option(...OUTPUT_OPT).action((key2, note, opts) => jiraVerifyFailCommand(key2, note, opts));
|
|
13806
|
+
jira.command("audit").description("\u4E00\u81F4\u6027\uFF1A\u72B6\u6001\u5DF2\u79BB\u5F00\u300C\u65B0\u589E\u300D\u7684\u7F3A\u53E3\u5355\u5FC5\u987B\u6302\u7740\u4EE3\u7801\u5E93\u6761\u76EE").option(...OUTPUT_OPT).action((opts) => jiraAuditCommand(opts));
|
|
13807
|
+
jira.command("search").description("\u987E\u95EE\u4FA7\u67E5\u91CD\uFF1A\u6309\u9519\u8BEF\u7801 / Model / Action / \u4E00\u53E5\u73B0\u8C61\u67E5 Jira \u4E0E\u4EA7\u54C1\u4ED3\uFF0C\u5E26\u56DE\u7F16\u53F7\u4E0E\u72B6\u6001").argument("<keywords...>", "\u5173\u952E\u8BCD\uFF0C\u6BCF\u4E2A\u5355\u72EC\u67E5\u4E00\u6B21").option("--no-include-closed", "\u53EA\u67E5\u672A\u89E3\u51B3\u7684").option(...OUTPUT_OPT).action((keywords, opts) => jiraSearchCommand(keywords, opts));
|
|
13808
|
+
jira.command("status").description("\u987E\u95EE\u4FA7\u67E5\u8FDB\u5EA6\uFF1A\u8BA4 HCMNX-12 / 12 / core#2198 / cases#26").argument("<ref>", "Jira \u5355\u53F7\u6216\u4EE3\u7801\u5E93\u5F15\u7528").option(...OUTPUT_OPT).action((ref, opts) => jiraStatusCommand(ref, opts));
|
|
13809
|
+
jira.command("submit").description("\u987E\u95EE\u4FA7\u63D0\u7F3A\u53E3\uFF1A\u5148\u67E5\u91CD\uFF08\u540C\u4E00\u7F3A\u53E3\u8FFD\u52A0\u300C\u53C8\u4E00\u4E2A\u73B0\u573A\u300D\uFF09\uFF0C\u5426\u5219\u6309 HCMNX \u5FC5\u586B\u683C\u65B0\u5F00\uFF1B\u8F7D\u8377 JSON \u8D70 --file \u6216\u6807\u51C6\u8F93\u5165").option("--file <path>", "\u7F3A\u53E3\u8F7D\u8377 JSON\uFF08title/phenomenon/repro/expected/alternative/q_*/severity/kind/module\u2026\uFF09").option("--env <name>", "\u53D6\u73AF\u5883\u6307\u7EB9\u7528\u7684\u73AF\u5883\u522B\u540D\uFF08\u7F3A\u7701 activeEnv\uFF09").option("--fingerprint <text>", "\u76F4\u63A5\u7ED9\u6307\u7EB9\u6587\u672C\uFF08\u8BAD\u7EC3\u573A\u4ECE \u573A.yml \u53D6\u65F6\u7528\uFF09\uFF0C\u4E0D\u518D\u73B0\u67E5").option("--issuetype <name>", "\u8986\u76D6 issuetype\uFF08\u7F3A\u7701\u6309 kind \u9009 \u6545\u969C / \u9700\u6C42\uFF09").option("--assignee <user>", "\u8986\u76D6\u7ECF\u529E\u4EBA\uFF08\u7F3A\u7701\u9879\u76EE\u8D1F\u8D23\u4EBA\uFF09").option(...OUTPUT_OPT).action((opts) => jiraSubmitCommand(opts));
|
|
12654
13810
|
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");
|
|
12655
13811
|
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));
|
|
12656
13812
|
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));
|
|
@@ -12675,9 +13831,7 @@ seed.command("values").argument("<model>", "\u7801\u8868\u6A21\u578B\u540D\uFF08
|
|
|
12675
13831
|
(v) => Number(v)
|
|
12676
13832
|
).action((model, opts) => deliverySeedValuesCommand(model, opts));
|
|
12677
13833
|
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));
|
|
12678
|
-
seed.command("apply").description(
|
|
12679
|
-
"\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`"
|
|
12680
|
-
).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(
|
|
13834
|
+
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(
|
|
12681
13835
|
"--force-stale",
|
|
12682
13836
|
"\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",
|
|
12683
13837
|
false
|
|
@@ -12691,7 +13845,13 @@ seed.command("verify").description(
|
|
|
12691
13845
|
).action((opts) => deliverySeedVerifyCommand(opts));
|
|
12692
13846
|
delivery.command("meta").description(
|
|
12693
13847
|
`\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`
|
|
12694
|
-
).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(
|
|
13848
|
+
).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(
|
|
13849
|
+
"--layer <layer>",
|
|
13850
|
+
"\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"
|
|
13851
|
+
).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(
|
|
13852
|
+
"--content-file <file>",
|
|
13853
|
+
"\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"
|
|
13854
|
+
).requiredOption(
|
|
12695
13855
|
"--expect-field <key>",
|
|
12696
13856
|
"\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",
|
|
12697
13857
|
(v, acc) => [...acc, v],
|
|
@@ -12701,9 +13861,7 @@ delivery.command("meta").description(
|
|
|
12701
13861
|
"\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",
|
|
12702
13862
|
false
|
|
12703
13863
|
).action((opts) => deliveryMetaCommand(opts));
|
|
12704
|
-
delivery.command("gate0").description(
|
|
12705
|
-
"\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"
|
|
12706
|
-
).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(
|
|
13864
|
+
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(
|
|
12707
13865
|
"--mapping <file>",
|
|
12708
13866
|
"\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"
|
|
12709
13867
|
).option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "json").action((opts) => deliveryGate0Command(opts));
|
|
@@ -12727,13 +13885,29 @@ program.command("query <Model>").description("\u67E5\u8BE2 Model \u5217\u8868\u6
|
|
|
12727
13885
|
"--additions <JSON>",
|
|
12728
13886
|
`\u8DE8\u5173\u7CFB JOIN \u7684\u5BF9\u8C61\u6570\u7EC4 JSON\uFF0C\u4F8B\u5982 '[{"key":"employee","model":"Employee"}]'`
|
|
12729
13887
|
).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));
|
|
12730
|
-
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(
|
|
12731
|
-
|
|
13888
|
+
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(
|
|
13889
|
+
"--scope <scope>",
|
|
13890
|
+
"\u5F3A\u5236 Action scope\uFF1Aclass | object\uFF08\u9ED8\u8BA4\uFF1A\u6709 --id \u4E3A object\uFF0C\u5426\u5219 class\uFF09"
|
|
13891
|
+
).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));
|
|
13892
|
+
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(
|
|
13893
|
+
"--i18n",
|
|
13894
|
+
"\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"
|
|
13895
|
+
).action((m, opts) => createCommand(m, opts));
|
|
12732
13896
|
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));
|
|
12733
13897
|
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));
|
|
12734
13898
|
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));
|
|
12735
13899
|
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));
|
|
12736
|
-
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(
|
|
13900
|
+
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(
|
|
13901
|
+
"--events [conversationId]",
|
|
13902
|
+
"\u53EA\u8BFB\u67E5\u770B\u6307\u5B9A conversation \u7684 timeline/event \u6D41\uFF1B\u4E5F\u53EF\u914D --resume <id>"
|
|
13903
|
+
).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(
|
|
13904
|
+
"--show-tool-calls",
|
|
13905
|
+
"\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",
|
|
13906
|
+
true
|
|
13907
|
+
).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(
|
|
13908
|
+
"--on-confirm <decision>",
|
|
13909
|
+
"\u975E\u4EA4\u4E92 confirm \u51B3\u7B56\uFF1Aapprove | reject | reject:<reason>\uFF08\u4F18\u5148\u4E8E --auto-approve\uFF09"
|
|
13910
|
+
).option("--on-ask <answer>", "\u975E\u4EA4\u4E92 ASK \u5E94\u7B54\u6587\u672C\uFF08\u547D\u4E2D choices \u65F6\u81EA\u52A8\u56DE\u586B choiceIndex\uFF09").option(
|
|
12737
13911
|
"--inject-on <spec>",
|
|
12738
13912
|
"\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"
|
|
12739
13913
|
).option(
|
|
@@ -12750,6 +13924,7 @@ var workspace = program.command("workspace").description("\u5F00\u53D1\u79DF\u62
|
|
|
12750
13924
|
workspace.command("list").description("\u5217\u51FA\u5F53\u524D\u7528\u6237\u53EF\u8BBF\u95EE\u7684\u79DF\u6237\u5F00\u53D1\u7A7A\u95F4").option("--keyword <text>", "\u6309\u7A7A\u95F4 Key / \u8BF4\u660E / Owner \u641C\u7D22").option("--limit <n>", "\u8FD4\u56DE\u6761\u6570", "50").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((opts) => workspaceListCommand(opts));
|
|
12751
13925
|
workspace.command("active").description("\u67E5\u770B\u5F53\u524D HCM \u5F00\u53D1\u6A21\u5F0F\u6FC0\u6D3B\u7A7A\u95F4\uFF0C\u5E76\u5BF9\u6BD4\u672C\u5730\u76EE\u5F55\u7ED1\u5B9A").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((opts) => workspaceActiveCommand(opts));
|
|
12752
13926
|
workspace.command("activate <workspaceKey>").description("\u628A\u5F53\u524D\u7528\u6237\u7684\u5F00\u53D1\u8005\u6A21\u5F0F\u7ED1\u5B9A\u5230\u8BE5\u5F00\u53D1\u7A7A\u95F4\u2014\u2014\u7A7A\u95F4\u5185\u7684 artifact \u968F\u5373\u5728\u672C\u79DF\u6237\u751F\u6548").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((key2, opts) => workspaceActivateCommand(key2, opts));
|
|
13927
|
+
workspace.command("deactivate").description("\u8BA9\u5F53\u524D\u8EAB\u4EFD\u9000\u51FA\u5F00\u53D1\u8005\u6A21\u5F0F\uFF1B\u4E0D\u5220\u9664\u5F00\u53D1\u7A7A\u95F4\u6216\u5DF2\u53D1\u5E03\u8D44\u4EA7").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((opts) => workspaceDeactivateCommand(opts));
|
|
12753
13928
|
workspace.command("bind <workspaceKey>").description("\u628A\u5F53\u524D\u76EE\u5F55\u7ED1\u5B9A\u5230\u4E00\u4E2A\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("--tenant <tenantId>", "\u79DF\u6237 ID\uFF08\u9ED8\u8BA4\u4F7F\u7528 env \u914D\u7F6E\uFF09").option("--endpoint <url>", "HCM \u540E\u7AEF\u5730\u5740\uFF08\u9ED8\u8BA4\u4F7F\u7528 env \u914D\u7F6E\uFF09").option("--force", "\u5F3A\u5236\u8986\u76D6\u5DF2\u6709\u7ED1\u5B9A").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "table").action((workspaceKey, opts) => workspaceBindCommand(workspaceKey, opts));
|
|
12754
13929
|
workspace.command("create <workspaceKey>").description("\u65B0\u5EFA\u79DF\u6237\u5F00\u53D1\u7A7A\u95F4\uFF0C\u5E76\u5728\u672C\u5730\u76EE\u5F55\u5199\u5165 workspace \u7ED1\u5B9A").option("--dir <path>", "\u5DE5\u4F5C\u7A7A\u95F4\u672C\u5730\u76EE\u5F55", ".").option("--description <text>", "\u5F00\u53D1\u7A7A\u95F4\u8BF4\u660E").option("--activate", "\u521B\u5EFA\u540E\u7ED1\u5B9A\u4E3A\u5F53\u524D\u5F00\u53D1\u7A7A\u95F4").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", "\u672C\u5730\u76EE\u5F55\u5DF2\u6709\u4E0D\u540C workspace \u7ED1\u5B9A\u65F6\u5F3A\u5236\u8986\u76D6").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "table").action((workspaceKey, opts) => workspaceCreateCommand(workspaceKey, opts));
|
|
12755
13930
|
workspace.command("pull").description("\u4ECE\u5F00\u53D1\u7A7A\u95F4\u62C9\u53D6\u6587\u4EF6\u5305\u5230\u672C\u5730\uFF1Bmini_apps \u4F1A\u751F\u6210\u53EF\u9A8C\u8BC1\u7684 artifact \u4E0A\u4E0B\u6587").option("--workspace <key>", "\u79DF\u6237\u5F00\u53D1\u7A7A\u95F4 key\uFF1B\u672A\u63D0\u4F9B\u65F6\u8BFB\u53D6\u672C\u5730\u7ED1\u5B9A").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("--force", "\u5F3A\u5236\u8986\u76D6\u5DF2\u6709\u7684\u672C\u5730\u6587\u4EF6").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "table").action((opts) => workspacePullCommand(opts));
|
|
@@ -12760,6 +13935,7 @@ workspaceAdd.command("mini <appCode>").description("\u65B0\u589E\u8F7B\u5E94\u75
|
|
|
12760
13935
|
"embedded"
|
|
12761
13936
|
).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));
|
|
12762
13937
|
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));
|
|
13938
|
+
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));
|
|
12763
13939
|
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));
|
|
12764
13940
|
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));
|
|
12765
13941
|
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));
|
|
@@ -12768,7 +13944,9 @@ workspace.command("verify").description(
|
|
|
12768
13944
|
).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));
|
|
12769
13945
|
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));
|
|
12770
13946
|
program.command("mini").description("\u5DF2\u79FB\u9664\uFF1A\u8BF7\u6539\u7528 hcm workspace").allowUnknownOption(true).allowExcessArguments(true).argument("[args...]").action(() => removedMiniCommand());
|
|
12771
|
-
var script = program.command("script").description(
|
|
13947
|
+
var script = program.command("script").description(
|
|
13948
|
+
"\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"
|
|
13949
|
+
);
|
|
12772
13950
|
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));
|
|
12773
13951
|
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));
|
|
12774
13952
|
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));
|
|
@@ -12787,26 +13965,46 @@ datapackage.command("pack <packageDir>").description("\u628A\u5305\u76EE\u5F55\u
|
|
|
12787
13965
|
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));
|
|
12788
13966
|
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));
|
|
12789
13967
|
var tenant = program.command("tenant").description("\u79DF\u6237\u5F00\u901A\u4E0E\u751F\u547D\u5468\u671F");
|
|
12790
|
-
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(
|
|
13968
|
+
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(
|
|
13969
|
+
"--admin-password <pwd>",
|
|
13970
|
+
"\u7BA1\u7406\u5458\u5BC6\u7801\uFF08\u4F1A\u6CC4\u6F0F\u5230 history/ps\uFF0C\u5EFA\u8BAE --admin-password-stdin\uFF09"
|
|
13971
|
+
).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));
|
|
12791
13972
|
var meta = program.command("meta").description("\u79DF\u6237\u5143\u6570\u636E\u8BFB\u5199\uFF08\u9875\u9762/\u5B57\u6BB5/\u5217\u8868\u914D\u7F6E\uFF09");
|
|
12792
13973
|
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));
|
|
12793
13974
|
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));
|
|
12794
|
-
meta.command("set <path>").description(
|
|
12795
|
-
|
|
13975
|
+
meta.command("set <path>").description(
|
|
13976
|
+
"\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"
|
|
13977
|
+
).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));
|
|
13978
|
+
meta.command("validate <path>").description(
|
|
13979
|
+
"\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"
|
|
13980
|
+
).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));
|
|
12796
13981
|
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));
|
|
12797
13982
|
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");
|
|
12798
|
-
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(
|
|
13983
|
+
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(
|
|
13984
|
+
"--stage <key>",
|
|
13985
|
+
"\u53EA\u770B\u67D0\u4E2A\u4EA4\u4ED8\u9636\u6BB5\uFF1Ahandover | baseline | configure | migrate | integrate | golive | operate"
|
|
13986
|
+
).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));
|
|
12799
13987
|
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));
|
|
12800
13988
|
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));
|
|
12801
|
-
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(
|
|
13989
|
+
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(
|
|
13990
|
+
"--target <agent>",
|
|
13991
|
+
"\u88C5\u7ED9\u54EA\u4E2A agent\uFF1Aclaude\uFF08.claude/skills/\uFF09| codex\uFF08hcm-skills/ + Agent \u7D22\u5F15\uFF09| auto",
|
|
13992
|
+
"auto"
|
|
13993
|
+
).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));
|
|
12802
13994
|
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));
|
|
12803
|
-
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(
|
|
13995
|
+
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(
|
|
13996
|
+
"--i18n",
|
|
13997
|
+
"\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"
|
|
13998
|
+
).action((model, opts) => updateCommand(model, opts));
|
|
12804
13999
|
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));
|
|
12805
14000
|
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));
|
|
12806
|
-
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((
|
|
14001
|
+
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((path19, opts) => openCommand(path19, opts));
|
|
12807
14002
|
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");
|
|
12808
14003
|
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));
|
|
12809
|
-
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(
|
|
14004
|
+
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(
|
|
14005
|
+
"--set <assignment...>",
|
|
14006
|
+
"namespace.key=value\uFF0C\u4F8B\u5982 security.password.passwordPolicy=complex"
|
|
14007
|
+
).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));
|
|
12810
14008
|
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));
|
|
12811
14009
|
async function main() {
|
|
12812
14010
|
if (needsLegacyProfileMigration(process.argv)) {
|