@hcmai/cli 0.3.14 → 0.3.16
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 +220 -65
- package/dist/index.js.map +1 -1
- package/dist/skills/manifest.json +18 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -523,8 +523,8 @@ var init_TerminalRenderer = __esm({
|
|
|
523
523
|
}
|
|
524
524
|
}
|
|
525
525
|
/** 来源行(仅子代理触发,agentPath ≥2 段时显示 `↑ 来自 a › b`,对齐 Web)。 */
|
|
526
|
-
originLine(
|
|
527
|
-
const segs =
|
|
526
|
+
originLine(path10) {
|
|
527
|
+
const segs = path10.split(".").filter(Boolean);
|
|
528
528
|
if (segs.length < 2) return "";
|
|
529
529
|
const names = segs.map((k) => agentDisplayName(k));
|
|
530
530
|
return chalk.gray(` \u2191 \u6765\u81EA ${names.join(" \u203A ")}`) + "\n";
|
|
@@ -1706,8 +1706,8 @@ function agentLabel(agentId) {
|
|
|
1706
1706
|
if (/^[0-9a-f]{8}-[0-9a-f-]{27}$/i.test(agentId)) return `agent \u2026${agentId.slice(-4)}`;
|
|
1707
1707
|
return agentDisplayName(agentId);
|
|
1708
1708
|
}
|
|
1709
|
-
function originLine(
|
|
1710
|
-
const segs = (
|
|
1709
|
+
function originLine(path10) {
|
|
1710
|
+
const segs = (path10 ?? "").split(".").filter(Boolean);
|
|
1711
1711
|
if (segs.length < 2) return null;
|
|
1712
1712
|
return `\u6765\u81EA ${segs.map((k) => agentDisplayName(k)).join(" \u203A ")}`;
|
|
1713
1713
|
}
|
|
@@ -3059,8 +3059,8 @@ import {
|
|
|
3059
3059
|
formatObject as formatObject7,
|
|
3060
3060
|
fromAxiosError as fromAxiosError8
|
|
3061
3061
|
} from "@hcmai/sdk";
|
|
3062
|
-
function collectYmlFiles(
|
|
3063
|
-
if (statSync(
|
|
3062
|
+
function collectYmlFiles(path10) {
|
|
3063
|
+
if (statSync(path10).isFile()) return [path10];
|
|
3064
3064
|
const out = [];
|
|
3065
3065
|
const walk = (dir) => {
|
|
3066
3066
|
for (const name of readdirSync(dir).sort()) {
|
|
@@ -3069,7 +3069,7 @@ function collectYmlFiles(path9) {
|
|
|
3069
3069
|
else if (full.endsWith(".yml") || full.endsWith(".yaml")) out.push(full);
|
|
3070
3070
|
}
|
|
3071
3071
|
};
|
|
3072
|
-
walk(
|
|
3072
|
+
walk(path10);
|
|
3073
3073
|
return out.sort();
|
|
3074
3074
|
}
|
|
3075
3075
|
var DRY_RUN_CLIENT = {
|
|
@@ -3077,9 +3077,9 @@ var DRY_RUN_CLIENT = {
|
|
|
3077
3077
|
create: async () => ({ id: "" }),
|
|
3078
3078
|
update: async () => ({})
|
|
3079
3079
|
};
|
|
3080
|
-
async function importCommand(
|
|
3080
|
+
async function importCommand(path10, args) {
|
|
3081
3081
|
try {
|
|
3082
|
-
const files = collectYmlFiles(
|
|
3082
|
+
const files = collectYmlFiles(path10);
|
|
3083
3083
|
const fixtures = files.map(
|
|
3084
3084
|
(f) => parseFixture(readFileSync2(f, "utf8"), relative(process.cwd(), f))
|
|
3085
3085
|
);
|
|
@@ -5858,17 +5858,17 @@ async function metaListCommand(args) {
|
|
|
5858
5858
|
fail4(e, args);
|
|
5859
5859
|
}
|
|
5860
5860
|
}
|
|
5861
|
-
async function metaGetCommand(
|
|
5861
|
+
async function metaGetCommand(path10, args) {
|
|
5862
5862
|
try {
|
|
5863
5863
|
const c = await client2(args);
|
|
5864
|
-
const content = await getTenantMeta(c.raw(),
|
|
5864
|
+
const content = await getTenantMeta(c.raw(), path10);
|
|
5865
5865
|
process.stdout.write(content.endsWith("\n") ? content : content + "\n");
|
|
5866
5866
|
process.exit(0);
|
|
5867
5867
|
} catch (e) {
|
|
5868
5868
|
fail4(e, args);
|
|
5869
5869
|
}
|
|
5870
5870
|
}
|
|
5871
|
-
async function metaSetCommand(
|
|
5871
|
+
async function metaSetCommand(path10, args) {
|
|
5872
5872
|
try {
|
|
5873
5873
|
if (!args.file) {
|
|
5874
5874
|
throw new CliError18({
|
|
@@ -5885,7 +5885,7 @@ async function metaSetCommand(path9, args) {
|
|
|
5885
5885
|
}) : await fsp3.readFile(args.file, "utf8");
|
|
5886
5886
|
if (args.dryRun) {
|
|
5887
5887
|
process.stdout.write(
|
|
5888
|
-
`[dry-run] \u5C06\u5199\u5165 ${
|
|
5888
|
+
`[dry-run] \u5C06\u5199\u5165 ${path10}\uFF08${Buffer.byteLength(content)} B\uFF09\u2014\u2014\u672A\u5B9E\u9645\u5199\u5165
|
|
5889
5889
|
---
|
|
5890
5890
|
${content}
|
|
5891
5891
|
`
|
|
@@ -5893,10 +5893,10 @@ ${content}
|
|
|
5893
5893
|
process.exit(0);
|
|
5894
5894
|
}
|
|
5895
5895
|
const c = await client2(args);
|
|
5896
|
-
const result = await saveTenantMeta(c.raw(),
|
|
5896
|
+
const result = await saveTenantMeta(c.raw(), path10, content);
|
|
5897
5897
|
const fmt = args.output ?? "json";
|
|
5898
5898
|
if (fmt !== "json") {
|
|
5899
|
-
process.stdout.write(`\u2705 \u5DF2\u5199\u5165 ${
|
|
5899
|
+
process.stdout.write(`\u2705 \u5DF2\u5199\u5165 ${path10}
|
|
5900
5900
|
\u8BB0\u5F97\u6E05\u7F13\u5B58\uFF1Ahcm cache clear-meta <Model>
|
|
5901
5901
|
`);
|
|
5902
5902
|
}
|
|
@@ -5907,19 +5907,19 @@ ${content}
|
|
|
5907
5907
|
fail4(e, args);
|
|
5908
5908
|
}
|
|
5909
5909
|
}
|
|
5910
|
-
async function metaDeleteCommand(
|
|
5910
|
+
async function metaDeleteCommand(path10, args) {
|
|
5911
5911
|
try {
|
|
5912
5912
|
if (!args.yes) {
|
|
5913
|
-
const ok = await promptConfirm(`\u5C06\u5220\u9664\u5143\u6570\u636E ${
|
|
5913
|
+
const ok = await promptConfirm(`\u5C06\u5220\u9664\u5143\u6570\u636E ${path10}\uFF0C\u6B64\u64CD\u4F5C\u4E0D\u53EF\u9006\u3002\u7EE7\u7EED\uFF1F`);
|
|
5914
5914
|
if (!ok) {
|
|
5915
5915
|
process.stderr.write("\u5DF2\u53D6\u6D88\n");
|
|
5916
5916
|
process.exit(1);
|
|
5917
5917
|
}
|
|
5918
5918
|
}
|
|
5919
5919
|
const c = await client2(args);
|
|
5920
|
-
const result = await deleteTenantMeta(c.raw(),
|
|
5920
|
+
const result = await deleteTenantMeta(c.raw(), path10);
|
|
5921
5921
|
const fmt = args.output ?? "json";
|
|
5922
|
-
if (fmt !== "json") process.stdout.write(`\u{1F5D1}\uFE0F \u5DF2\u5220\u9664 ${
|
|
5922
|
+
if (fmt !== "json") process.stdout.write(`\u{1F5D1}\uFE0F \u5DF2\u5220\u9664 ${path10}
|
|
5923
5923
|
`);
|
|
5924
5924
|
process.stdout.write(formatObject16(result, { format: fmt }) + "\n");
|
|
5925
5925
|
process.exit(0);
|
|
@@ -7656,17 +7656,25 @@ async function resolveCoreAction(request) {
|
|
|
7656
7656
|
profile: request.profile
|
|
7657
7657
|
});
|
|
7658
7658
|
const description = await HcmClient17.fromAuthContext(auth).describe(request.model);
|
|
7659
|
-
const
|
|
7660
|
-
if (
|
|
7659
|
+
const named = description.actions.filter((action2) => action2.name === request.action);
|
|
7660
|
+
if (named.length === 0) {
|
|
7661
7661
|
return failed(
|
|
7662
7662
|
"action-metadata-not-found",
|
|
7663
|
-
|
|
7663
|
+
`Core \u5143\u6570\u636E\u91CC\u6CA1\u6709 ${request.model}.${request.action} \u8FD9\u4E2A Action\u3002next_step=\u7528 \`hcm describe ${request.model}\` \u6838\u5BF9 Action \u540D`
|
|
7664
|
+
);
|
|
7665
|
+
}
|
|
7666
|
+
const matches = request.explicitShape ? named.filter((action2) => matchesRequest(action2, request)) : named;
|
|
7667
|
+
if (matches.length === 0) {
|
|
7668
|
+
const shapes = named.map((a) => `scope=${a.scope ?? "?"} method=${(a.httpMethod ?? "?").toUpperCase()}`).join("\uFF1B");
|
|
7669
|
+
return failed(
|
|
7670
|
+
"action-shape-mismatch",
|
|
7671
|
+
`${request.model}.${request.action} \u5B58\u5728\uFF0C\u4F46\u5F62\u6001\u5BF9\u4E0D\u4E0A\uFF1A\u4F60\u7ED9\u7684\u662F scope=${request.scope} method=${request.httpMethod}\uFF0C\u5143\u6570\u636E\u91CC\u662F ${shapes}\u3002next_step=\u53BB\u6389 --scope/--method \u8BA9 CLI \u6309\u5143\u6570\u636E\u81EA\u52A8\u5224\u5B9A\uFF0C\u6216\u6539\u6210\u4E0A\u9762\u7684\u5F62\u6001`
|
|
7664
7672
|
);
|
|
7665
7673
|
}
|
|
7666
7674
|
if (matches.length > 1) {
|
|
7667
7675
|
return failed(
|
|
7668
7676
|
"action-metadata-ambiguous",
|
|
7669
|
-
|
|
7677
|
+
`${request.model}.${request.action} \u5728\u5143\u6570\u636E\u91CC\u6709\u591A\u79CD\u5F62\u6001\uFF0C\u65E0\u6CD5\u552F\u4E00\u5224\u5B9A\u3002next_step=\u7528 --scope \u4E0E --method \u6307\u660E\u8981\u8C03\u54EA\u4E00\u4E2A`
|
|
7670
7678
|
);
|
|
7671
7679
|
}
|
|
7672
7680
|
const action = matches[0];
|
|
@@ -7679,8 +7687,8 @@ async function resolveCoreAction(request) {
|
|
|
7679
7687
|
return {
|
|
7680
7688
|
status: "resolved",
|
|
7681
7689
|
policy: {
|
|
7682
|
-
scope: action.scope,
|
|
7683
|
-
httpMethod: action.httpMethod.toUpperCase(),
|
|
7690
|
+
scope: action.scope ?? request.scope,
|
|
7691
|
+
httpMethod: (action.httpMethod ?? request.httpMethod).toUpperCase(),
|
|
7684
7692
|
readOnly: action.readOnly,
|
|
7685
7693
|
...action.source ? { source: action.source } : {}
|
|
7686
7694
|
}
|
|
@@ -7702,7 +7710,8 @@ function parseActionRequest(inputArgv) {
|
|
|
7702
7710
|
if (separator <= 0 || separator === spec.length - 1) {
|
|
7703
7711
|
return failed("invalid-action-spec", "Action \u5FC5\u987B\u4F7F\u7528 <Model>.<Action> \u683C\u5F0F\u3002");
|
|
7704
7712
|
}
|
|
7705
|
-
const
|
|
7713
|
+
const explicitMethod = flagValue2(argv, "--method");
|
|
7714
|
+
const httpMethod = (explicitMethod ?? "POST").toUpperCase();
|
|
7706
7715
|
if (!["GET", "POST", "PUT", "DELETE"].includes(httpMethod)) {
|
|
7707
7716
|
return failed("invalid-action-method", "Action method \u5FC5\u987B\u662F GET\u3001POST\u3001PUT \u6216 DELETE\u3002");
|
|
7708
7717
|
}
|
|
@@ -7716,6 +7725,7 @@ function parseActionRequest(inputArgv) {
|
|
|
7716
7725
|
action: spec.slice(separator + 1),
|
|
7717
7726
|
httpMethod,
|
|
7718
7727
|
scope,
|
|
7728
|
+
...explicitMethod !== void 0 || explicitScope !== void 0 ? { explicitShape: true } : {},
|
|
7719
7729
|
env: flagValue2(argv, "--env"),
|
|
7720
7730
|
identity: flagValue2(argv, "--as"),
|
|
7721
7731
|
profile: flagValue2(argv, "--profile")
|
|
@@ -7863,16 +7873,16 @@ async function deliveryGate0Command(args) {
|
|
|
7863
7873
|
const { aclass, problems: aclassProblems } = deriveAclass(reconDir, args.mapping ?? null);
|
|
7864
7874
|
const { facts, problems: factsProblems } = loadProtocolFacts();
|
|
7865
7875
|
const result = scan(skillRoot, aclass, facts, { aclassProblems, factsProblems });
|
|
7866
|
-
const
|
|
7876
|
+
const premise3 = checkPremise([
|
|
7867
7877
|
...result.premise,
|
|
7868
7878
|
...baselineRoundPremise(inspectRound2(reconDir))
|
|
7869
7879
|
]);
|
|
7870
|
-
const merged = { ...result, premise:
|
|
7880
|
+
const merged = { ...result, premise: premise3 };
|
|
7871
7881
|
const fmt = args.output ?? "json";
|
|
7872
7882
|
if (fmt !== "json") process.stdout.write(renderGate0(merged, skillRoot));
|
|
7873
7883
|
process.stdout.write(`${formatObject21(merged, { format: fmt })}
|
|
7874
7884
|
`);
|
|
7875
|
-
for (const problem of
|
|
7885
|
+
for (const problem of premise3) {
|
|
7876
7886
|
process.stderr.write(`\u{1F534} \u524D\u63D0\u4E0D\u6210\u7ACB\uFF08${problem.reason}\uFF09\uFF1A${problem.message}
|
|
7877
7887
|
`);
|
|
7878
7888
|
}
|
|
@@ -7884,20 +7894,147 @@ async function deliveryGate0Command(args) {
|
|
|
7884
7894
|
process.exit(code);
|
|
7885
7895
|
}
|
|
7886
7896
|
|
|
7897
|
+
// src/commands/delivery-seed.ts
|
|
7898
|
+
init_auth_guard();
|
|
7899
|
+
import {
|
|
7900
|
+
HcmClient as HcmClient20,
|
|
7901
|
+
INIT_EXIT_CODES,
|
|
7902
|
+
baselineRoundPremise as baselineRoundPremise2,
|
|
7903
|
+
MappingError,
|
|
7904
|
+
discardedColumnLines,
|
|
7905
|
+
inspectRound as inspectRound3,
|
|
7906
|
+
loadExemptions,
|
|
7907
|
+
planFromArtifacts,
|
|
7908
|
+
planProblemLines,
|
|
7909
|
+
planRc,
|
|
7910
|
+
planSummaryLine,
|
|
7911
|
+
riskFromArtifacts,
|
|
7912
|
+
roundWarning,
|
|
7913
|
+
seedBaselines,
|
|
7914
|
+
seedMappingPath,
|
|
7915
|
+
seedWorkDir,
|
|
7916
|
+
writeImportPlan,
|
|
7917
|
+
writeRisk
|
|
7918
|
+
} from "@hcmai/sdk";
|
|
7919
|
+
import { existsSync as existsSync2 } from "fs";
|
|
7920
|
+
import * as path7 from "path";
|
|
7921
|
+
function premise(message, hint = "") {
|
|
7922
|
+
process.stderr.write(message + (hint ? `
|
|
7923
|
+
\u2192 ${hint}` : "") + "\n");
|
|
7924
|
+
return INIT_EXIT_CODES.premise;
|
|
7925
|
+
}
|
|
7926
|
+
async function runSeedPlan(args, client3) {
|
|
7927
|
+
const out = args.out ?? ".";
|
|
7928
|
+
const tenant2 = tenantOf(client3);
|
|
7929
|
+
const work = seedWorkDir({ out, tenant: tenant2, work: args.work ?? null, mapping: args.mapping ?? null });
|
|
7930
|
+
const mappingPath = seedMappingPath({ out, tenant: tenant2, mapping: args.mapping ?? null }, work);
|
|
7931
|
+
if (!existsSync2(mappingPath)) {
|
|
7932
|
+
return premise(
|
|
7933
|
+
`\u8BFB\u4E0D\u5230\u5BFC\u5165\u6620\u5C04\u5DE5\u4EF6\uFF1A${mappingPath}`,
|
|
7934
|
+
"\u5DE5\u4EF6\u662F\u987E\u95EE\u81EA\u5DF1\u5199\u7684\uFF08\u5951\u7EA6\u89C1 README \u7684 `work/mapping.json` \u4E00\u8282\uFF09\u3002\u5199\u5728\u522B\u5904\u5C31\u7528 `--mapping <\u8DEF\u5F84>` \u6307\u8FC7\u53BB\uFF0C\u6216\u7528 `--work <\u76EE\u5F55>` \u6362 work \u76EE\u5F55\u3002"
|
|
7935
|
+
);
|
|
7936
|
+
}
|
|
7937
|
+
const [base, candidates] = seedBaselines(out, tenant2);
|
|
7938
|
+
if (candidates.length === 0) {
|
|
7939
|
+
return premise(
|
|
7940
|
+
`\u672A\u627E\u5230\u5200 2 \u7684\u57FA\u7EBF\uFF1A${base}/*/index/fields.jsonl`,
|
|
7941
|
+
"`plan` \u7684\u98CE\u9669\u6E05\u5355\u8981\u8BFB recon \u4EA7\u7269\u91CC\u7684 `mapping/` \u4E0E `valuedomain/`\u3002\u5148\u8DD1\u4E00\u6B21 `hcm delivery recon`\u3002"
|
|
7942
|
+
);
|
|
7943
|
+
}
|
|
7944
|
+
const reconDir = candidates[0].reconDir;
|
|
7945
|
+
if (candidates.length > 1) {
|
|
7946
|
+
process.stderr.write(
|
|
7947
|
+
`\u26A0\uFE0F \u540C\u79DF\u6237\u4E0B\u6709 ${candidates.length} \u4EFD\u57FA\u7EBF\uFF0C\u672C\u8F6E\u8BFB\u7684\u662F \`${path7.basename(reconDir)}\`\uFF1A` + candidates.slice(1).map((c) => `\`${path7.basename(c.reconDir)}\``).join("\u3001") + " \u672A\u88AB\u8BFB\u53D6 \u2014\u2014 \u4E0D\u540C sourceKey \u7684\u4EA7\u7269**\u4E0D\u53EF\u4E92\u6362**\u3002\n"
|
|
7948
|
+
);
|
|
7949
|
+
}
|
|
7950
|
+
const round = inspectRound3(reconDir);
|
|
7951
|
+
process.stderr.write(roundWarning(round));
|
|
7952
|
+
const baseline = {
|
|
7953
|
+
path: `${path7.basename(path7.dirname(reconDir))}/${path7.basename(reconDir)}`,
|
|
7954
|
+
roundId: round.roundId ?? null
|
|
7955
|
+
};
|
|
7956
|
+
let exemptions = null;
|
|
7957
|
+
if (args.exemptions) {
|
|
7958
|
+
const [loaded, err] = loadExemptions(args.exemptions);
|
|
7959
|
+
if (err !== null) {
|
|
7960
|
+
process.stderr.write(err + "\n");
|
|
7961
|
+
return INIT_EXIT_CODES.premise;
|
|
7962
|
+
}
|
|
7963
|
+
exemptions = loaded;
|
|
7964
|
+
}
|
|
7965
|
+
let plan;
|
|
7966
|
+
let risk;
|
|
7967
|
+
try {
|
|
7968
|
+
plan = await planFromArtifacts(client3, mappingPath, args.sourceDir, { baseline });
|
|
7969
|
+
risk = await riskFromArtifacts(mappingPath, reconDir, {
|
|
7970
|
+
sourceDir: args.sourceDir,
|
|
7971
|
+
exemptions,
|
|
7972
|
+
plan,
|
|
7973
|
+
// 🔴 **判据整个在生产模块里**(`baselineRoundPremise`),本层不重判、不改写判词;
|
|
7974
|
+
// risk 那一层只做形态转换(加 hint)。
|
|
7975
|
+
roundPremise: baselineRoundPremise2(round)
|
|
7976
|
+
});
|
|
7977
|
+
} catch (e) {
|
|
7978
|
+
if (e instanceof MappingError) {
|
|
7979
|
+
return premise(`\u5DE5\u4EF6\u88C5\u4E0D\u8FDB\u6765\uFF1A[${e.reason}] ${e.message}`, e.hint);
|
|
7980
|
+
}
|
|
7981
|
+
throw e;
|
|
7982
|
+
}
|
|
7983
|
+
const planFile = writeImportPlan(plan, work);
|
|
7984
|
+
const riskFile = writeRisk(risk, work);
|
|
7985
|
+
process.stdout.write(`\u8BA1\u5212\uFF1A${planFile}
|
|
7986
|
+
`);
|
|
7987
|
+
process.stdout.write(`\u98CE\u9669\uFF1A${riskFile}
|
|
7988
|
+
`);
|
|
7989
|
+
for (const line of discardedColumnLines(plan.notes)) process.stdout.write(line + "\n");
|
|
7990
|
+
process.stdout.write(planSummaryLine(plan, risk) + "\n");
|
|
7991
|
+
for (const line of planProblemLines(plan, risk)) process.stderr.write(line + "\n");
|
|
7992
|
+
return planRc(plan, risk);
|
|
7993
|
+
}
|
|
7994
|
+
function tenantOf(client3) {
|
|
7995
|
+
const t = client3?.tenantId;
|
|
7996
|
+
return t === void 0 || t === null ? "" : String(t);
|
|
7997
|
+
}
|
|
7998
|
+
async function deliverySeedPlanCommand(args) {
|
|
7999
|
+
const ctx = await getActiveAuthContextFromCli(args);
|
|
8000
|
+
const client3 = HcmClient20.fromAuthContext(ctx);
|
|
8001
|
+
process.exitCode = await runSeedPlan(args, seedClient(client3, ctx));
|
|
8002
|
+
}
|
|
8003
|
+
function seedClient(client3, ctx) {
|
|
8004
|
+
const raw = client3.raw();
|
|
8005
|
+
return {
|
|
8006
|
+
tenantId: ctx.tenantId,
|
|
8007
|
+
async post(p, body) {
|
|
8008
|
+
try {
|
|
8009
|
+
const res = await raw.post(p, body);
|
|
8010
|
+
return { status: res.status, body: res.data, error: "ok", headers: {} };
|
|
8011
|
+
} catch (e) {
|
|
8012
|
+
const status = e?.response?.status ?? -1;
|
|
8013
|
+
return {
|
|
8014
|
+
status,
|
|
8015
|
+
body: e?.response?.data ?? null,
|
|
8016
|
+
error: status === -1 ? "network" : `http-${status}`,
|
|
8017
|
+
headers: {}
|
|
8018
|
+
};
|
|
8019
|
+
}
|
|
8020
|
+
}
|
|
8021
|
+
};
|
|
8022
|
+
}
|
|
8023
|
+
|
|
7887
8024
|
// src/commands/delivery-triage.ts
|
|
7888
8025
|
init_auth_guard();
|
|
7889
8026
|
init_exit();
|
|
7890
8027
|
import {
|
|
7891
8028
|
computeReconSourceKey as computeReconSourceKey2,
|
|
7892
|
-
HcmClient as
|
|
8029
|
+
HcmClient as HcmClient21,
|
|
7893
8030
|
httpProbe as httpProbe3,
|
|
7894
8031
|
ReconLayout as ReconLayout2,
|
|
7895
8032
|
runTriageRound
|
|
7896
8033
|
} from "@hcmai/sdk";
|
|
7897
8034
|
import { mkdirSync, readFileSync as readFileSync4, writeFileSync as writeFileSync2 } from "fs";
|
|
7898
|
-
import * as
|
|
8035
|
+
import * as path8 from "path";
|
|
7899
8036
|
var DEFAULT_CAPABILITIES3 = "default";
|
|
7900
|
-
function
|
|
8037
|
+
function premise2(message, hint) {
|
|
7901
8038
|
process.stderr.write(`\u{1F534} \u524D\u63D0\u4E0D\u6210\u7ACB\uFF1A${message}
|
|
7902
8039
|
`);
|
|
7903
8040
|
process.stderr.write(` ${hint}
|
|
@@ -7931,21 +8068,21 @@ function renderProblems(rows) {
|
|
|
7931
8068
|
`;
|
|
7932
8069
|
}
|
|
7933
8070
|
function writeTriageArtifact(outDir, body) {
|
|
7934
|
-
const out =
|
|
7935
|
-
mkdirSync(
|
|
8071
|
+
const out = path8.join(outDir, "work", "triage.md");
|
|
8072
|
+
mkdirSync(path8.dirname(out), { recursive: true });
|
|
7936
8073
|
writeFileSync2(out, body, "utf8");
|
|
7937
8074
|
return out;
|
|
7938
8075
|
}
|
|
7939
8076
|
async function runTriage(args) {
|
|
7940
|
-
if (!args.requests) return
|
|
8077
|
+
if (!args.requests) return premise2("\u6CA1\u7ED9 `--requests`", REQUESTS_SHAPE);
|
|
7941
8078
|
let entriesIn;
|
|
7942
8079
|
try {
|
|
7943
8080
|
entriesIn = readRequests(args.requests);
|
|
7944
8081
|
} catch (e) {
|
|
7945
|
-
return
|
|
8082
|
+
return premise2(e instanceof Error ? e.message : String(e), REQUESTS_SHAPE);
|
|
7946
8083
|
}
|
|
7947
8084
|
const ctx = await getActiveAuthContextFromCli(args);
|
|
7948
|
-
const client3 =
|
|
8085
|
+
const client3 = HcmClient21.fromAuthContext(ctx);
|
|
7949
8086
|
const probe = httpProbe3(client3.raw(), args.capabilities ?? DEFAULT_CAPABILITIES3);
|
|
7950
8087
|
const artifactsDir = args.recon ?? new ReconLayout2(args.out ?? ".", ctx.tenantId, await computeReconSourceKey2(probe)).dir;
|
|
7951
8088
|
const result = await runTriageRound(probe, artifactsDir, entriesIn);
|
|
@@ -7973,7 +8110,7 @@ async function deliveryTriageCommand(args) {
|
|
|
7973
8110
|
import { createHash as createHash5, randomBytes as secureRandomBytes } from "crypto";
|
|
7974
8111
|
import { spawn } from "child_process";
|
|
7975
8112
|
import { createReadStream, promises as fs6 } from "fs";
|
|
7976
|
-
import
|
|
8113
|
+
import path9 from "path";
|
|
7977
8114
|
import { CliError as CliError20, CliErrorCode as CliErrorCode19, formatObject as formatObject22 } from "@hcmai/sdk";
|
|
7978
8115
|
init_exit();
|
|
7979
8116
|
var EXECUTION_CONTRACT_VERSION = "2026-08-29.controlled-v3";
|
|
@@ -8013,9 +8150,9 @@ async function prepareDeliveryExecution(input) {
|
|
|
8013
8150
|
};
|
|
8014
8151
|
const planId = sha2565(canonicalJson(core)).slice(0, 24);
|
|
8015
8152
|
const plan = { ...core, planId };
|
|
8016
|
-
const plansDir =
|
|
8153
|
+
const plansDir = path9.join(project, ".hcm-delivery", "execution-plans");
|
|
8017
8154
|
await safeManagedDirectory(project, ".hcm-delivery/execution-plans", plansDir);
|
|
8018
|
-
const planFile =
|
|
8155
|
+
const planFile = path9.join(plansDir, `${planId}.json`);
|
|
8019
8156
|
try {
|
|
8020
8157
|
await fs6.writeFile(planFile, `${JSON.stringify(plan, null, 2)}
|
|
8021
8158
|
`, {
|
|
@@ -8034,7 +8171,7 @@ async function executeDeliveryPlan(input) {
|
|
|
8034
8171
|
if (await readProjectMode(project) !== "controlled") {
|
|
8035
8172
|
throw invalid2("\u9879\u76EE\u4E0D\u662F controlled\uFF0C\u4E0D\u80FD\u6267\u884C R2 \u8BA1\u5212");
|
|
8036
8173
|
}
|
|
8037
|
-
const planFile =
|
|
8174
|
+
const planFile = path9.join(project, ".hcm-delivery", "execution-plans", `${input.planId}.json`);
|
|
8038
8175
|
const plan = await readPlan(project, planFile);
|
|
8039
8176
|
if (plan.planId !== input.planId || computePlanId(plan) !== input.planId) {
|
|
8040
8177
|
throw invalid2("\u6267\u884C\u8BA1\u5212\u5185\u5BB9\u4E0E planId \u6458\u8981\u4E0D\u4E00\u81F4");
|
|
@@ -8065,11 +8202,11 @@ async function executeDeliveryPlan(input) {
|
|
|
8065
8202
|
await assertDocumentUnchanged(project, plan.documents.rollback, "\u56DE\u6EDA\u8BF4\u660E");
|
|
8066
8203
|
await assertPayloadsUnchanged(project, plan.payloads);
|
|
8067
8204
|
const evidenceDir = await bindEvidenceDirectory(project, plan.evidenceDir);
|
|
8068
|
-
const receiptFile =
|
|
8205
|
+
const receiptFile = path9.join(evidenceDir.absolute, `${plan.planId}.receipt.json`);
|
|
8069
8206
|
if (await pathExists(receiptFile)) throw invalid2(`\u6267\u884C\u6536\u636E\u5DF2\u5B58\u5728\uFF0C\u62D2\u7EDD\u518D\u6B21\u6267\u884C\uFF1A${plan.planId}`);
|
|
8070
|
-
const claimsDir =
|
|
8207
|
+
const claimsDir = path9.join(project, ".hcm-delivery", "execution-claims");
|
|
8071
8208
|
await safeManagedDirectory(project, ".hcm-delivery/execution-claims", claimsDir);
|
|
8072
|
-
const claimFile =
|
|
8209
|
+
const claimFile = path9.join(claimsDir, `${plan.planId}.json`);
|
|
8073
8210
|
try {
|
|
8074
8211
|
await fs6.writeFile(
|
|
8075
8212
|
claimFile,
|
|
@@ -8129,12 +8266,21 @@ async function deliveryPrepareCommand(argv, args) {
|
|
|
8129
8266
|
...ttlSeconds === void 0 ? {} : { ttlSeconds }
|
|
8130
8267
|
});
|
|
8131
8268
|
process.stdout.write(formatObject22(plan, { format: args.output ?? "json" }) + "\n");
|
|
8269
|
+
process.stderr.write(`
|
|
8270
|
+
\u4E0B\u4E00\u6B65\uFF08argv \u5FC5\u987B\u4E0E\u672C\u6B21\u5B8C\u5168\u4E00\u81F4\uFF09\uFF1A
|
|
8271
|
+
${nextCommandHint(plan.planId, args.project, argv)}
|
|
8272
|
+
`);
|
|
8132
8273
|
} catch (cause) {
|
|
8133
8274
|
exitWithError(cause);
|
|
8134
8275
|
}
|
|
8135
8276
|
}
|
|
8136
8277
|
async function deliveryExecuteCommand(planId, argv, args) {
|
|
8137
8278
|
try {
|
|
8279
|
+
if (!argv || argv.length === 0) {
|
|
8280
|
+
throw invalid2(
|
|
8281
|
+
`execute \u5FC5\u987B\u5728 \`--\` \u4E4B\u540E\u590D\u8FF0\u4E0E prepare \u5B8C\u5168\u76F8\u540C\u7684\u90A3\u4E32 argv\u3002\u6267\u884C\u8BA1\u5212\u53EA\u5B58\u8BE5\u547D\u4EE4\u7684\u6458\u8981\u3001\u4E0D\u5B58\u539F\u6587\uFF08\u8FD9\u6837\u8BA1\u5212\u6587\u4EF6\u843D\u76D8\u65F6\u4E0D\u4F1A\u643A\u5E26\u51ED\u636E\u7C7B\u53C2\u6570\uFF09\uFF0C\u6240\u4EE5\u8FD9\u4E00\u4E32\u5FC5\u987B\u7531\u4F60\u7ED9\u56DE\u6765\u3002next_step=hcm delivery execute ${planId} --project <\u9879\u76EE\u76EE\u5F55> -- <\u4E0E prepare \u5B8C\u5168\u76F8\u540C\u7684\u5B50\u547D\u4EE4\u4E0E\u53C2\u6570>`
|
|
8282
|
+
);
|
|
8283
|
+
}
|
|
8138
8284
|
const receipt = await executeDeliveryPlan({
|
|
8139
8285
|
project: args.project ?? process.cwd(),
|
|
8140
8286
|
planId,
|
|
@@ -8147,7 +8293,7 @@ async function deliveryExecuteCommand(planId, argv, args) {
|
|
|
8147
8293
|
}
|
|
8148
8294
|
}
|
|
8149
8295
|
async function readProjectMode(project) {
|
|
8150
|
-
const file =
|
|
8296
|
+
const file = path9.join(project, ".hcm-delivery", "project.yml");
|
|
8151
8297
|
const content = await readSafeFile(project, file, "\u9879\u76EE\u914D\u7F6E");
|
|
8152
8298
|
const match = content.toString("utf8").match(
|
|
8153
8299
|
/^deliveryMode:\s*(?:"(plan-only|controlled)"|'(plan-only|controlled)'|(plan-only|controlled))\s*$/m
|
|
@@ -8159,13 +8305,13 @@ async function readProjectMode(project) {
|
|
|
8159
8305
|
return mode;
|
|
8160
8306
|
}
|
|
8161
8307
|
var SKILLS_LOCK_CANDIDATES = [
|
|
8162
|
-
|
|
8163
|
-
|
|
8308
|
+
path9.join("hcm-skills", ".hcm-skills.json"),
|
|
8309
|
+
path9.join(".claude", "skills", ".hcm-skills.json")
|
|
8164
8310
|
];
|
|
8165
8311
|
async function readSkillsLock(project) {
|
|
8166
8312
|
const found = [];
|
|
8167
8313
|
for (const candidate of SKILLS_LOCK_CANDIDATES) {
|
|
8168
|
-
if (await pathExists(
|
|
8314
|
+
if (await pathExists(path9.join(project, candidate))) found.push(candidate);
|
|
8169
8315
|
}
|
|
8170
8316
|
if (found.length === 0) {
|
|
8171
8317
|
throw invalid2(
|
|
@@ -8177,7 +8323,7 @@ async function readSkillsLock(project) {
|
|
|
8177
8323
|
`\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`
|
|
8178
8324
|
);
|
|
8179
8325
|
}
|
|
8180
|
-
const bytes = await readSafeFile(project,
|
|
8326
|
+
const bytes = await readSafeFile(project, path9.join(project, found[0]), "\u6280\u80FD\u9501");
|
|
8181
8327
|
try {
|
|
8182
8328
|
JSON.parse(bytes.toString("utf8"));
|
|
8183
8329
|
} catch (cause) {
|
|
@@ -8190,7 +8336,7 @@ async function bindDocument(project, reference, label) {
|
|
|
8190
8336
|
if (!(relative2.startsWith("work/") || relative2.startsWith("decisions/"))) {
|
|
8191
8337
|
throw invalid2(`${label}\u5FC5\u987B\u4F4D\u4E8E\u9879\u76EE work/ \u6216 decisions/ \u4E0B`);
|
|
8192
8338
|
}
|
|
8193
|
-
const file =
|
|
8339
|
+
const file = path9.join(project, relative2);
|
|
8194
8340
|
const bytes = await readSafeFile(project, file, label);
|
|
8195
8341
|
return { path: relative2, sha256: sha2565(bytes) };
|
|
8196
8342
|
}
|
|
@@ -8203,7 +8349,7 @@ async function bindEvidenceDirectory(project, reference) {
|
|
|
8203
8349
|
if (!(relative2 === "evidence" || relative2.startsWith("evidence/"))) {
|
|
8204
8350
|
throw invalid2("evidence \u76EE\u5F55\u5FC5\u987B\u4F4D\u4E8E\u9879\u76EE evidence/ \u4E0B");
|
|
8205
8351
|
}
|
|
8206
|
-
const absolute =
|
|
8352
|
+
const absolute = path9.join(project, relative2);
|
|
8207
8353
|
await assertNoSymlinkComponents(project, relative2);
|
|
8208
8354
|
const stat = await fs6.stat(absolute).catch(() => null);
|
|
8209
8355
|
if (stat === null) {
|
|
@@ -8335,7 +8481,7 @@ async function bindPayloadFiles(project, argv) {
|
|
|
8335
8481
|
}
|
|
8336
8482
|
async function bindPayloadFile(project, reference, label) {
|
|
8337
8483
|
const relative2 = safeRelative(reference, label);
|
|
8338
|
-
const file =
|
|
8484
|
+
const file = path9.join(project, relative2);
|
|
8339
8485
|
const bytes = await readSafeFile(project, file, label);
|
|
8340
8486
|
return { path: relative2, sha256: sha2565(bytes) };
|
|
8341
8487
|
}
|
|
@@ -8404,13 +8550,13 @@ async function writeReceiptExclusive(target, receipt) {
|
|
|
8404
8550
|
});
|
|
8405
8551
|
await fs6.link(temp, target);
|
|
8406
8552
|
} catch (cause) {
|
|
8407
|
-
throw invalid2(`\u6267\u884C\u6536\u636E\u5199\u5165\u5931\u8D25\u6216\u5DF2\u5B58\u5728\uFF1A${
|
|
8553
|
+
throw invalid2(`\u6267\u884C\u6536\u636E\u5199\u5165\u5931\u8D25\u6216\u5DF2\u5B58\u5728\uFF1A${path9.basename(target)}`, cause);
|
|
8408
8554
|
} finally {
|
|
8409
8555
|
await fs6.unlink(temp).catch(() => void 0);
|
|
8410
8556
|
}
|
|
8411
8557
|
}
|
|
8412
8558
|
async function safeManagedDirectory(project, relative2, absolute) {
|
|
8413
|
-
await assertNoSymlinkComponents(project,
|
|
8559
|
+
await assertNoSymlinkComponents(project, path9.dirname(relative2));
|
|
8414
8560
|
const existing = await fs6.lstat(absolute).catch(() => void 0);
|
|
8415
8561
|
if (existing?.isSymbolicLink()) throw invalid2(`\u53D7\u7BA1\u76EE\u5F55\u4E0D\u80FD\u662F\u7B26\u53F7\u94FE\u63A5\uFF1A${relative2}`);
|
|
8416
8562
|
if (existing && !existing.isDirectory()) throw invalid2(`\u53D7\u7BA1\u8DEF\u5F84\u4E0D\u662F\u76EE\u5F55\uFF1A${relative2}`);
|
|
@@ -8427,8 +8573,8 @@ async function pathExists(file) {
|
|
|
8427
8573
|
);
|
|
8428
8574
|
}
|
|
8429
8575
|
async function readSafeFile(project, file, label) {
|
|
8430
|
-
const relative2 =
|
|
8431
|
-
if (relative2.startsWith("../") ||
|
|
8576
|
+
const relative2 = path9.relative(project, file).split(path9.sep).join("/");
|
|
8577
|
+
if (relative2.startsWith("../") || path9.isAbsolute(relative2))
|
|
8432
8578
|
throw invalid2(`${label}\u8DEF\u5F84\u9003\u9038\u9879\u76EE`);
|
|
8433
8579
|
await assertNoSymlinkComponents(project, relative2);
|
|
8434
8580
|
let stat;
|
|
@@ -8445,14 +8591,14 @@ async function assertNoSymlinkComponents(project, relative2) {
|
|
|
8445
8591
|
const parts = relative2.split("/").filter(Boolean);
|
|
8446
8592
|
let current = project;
|
|
8447
8593
|
for (const part of parts) {
|
|
8448
|
-
current =
|
|
8594
|
+
current = path9.join(current, part);
|
|
8449
8595
|
const stat = await fs6.lstat(current).catch(() => void 0);
|
|
8450
8596
|
if (stat?.isSymbolicLink()) throw invalid2(`\u8DEF\u5F84\u5305\u542B\u7B26\u53F7\u94FE\u63A5\uFF1A${relative2}`);
|
|
8451
8597
|
if (!stat) break;
|
|
8452
8598
|
}
|
|
8453
8599
|
}
|
|
8454
8600
|
async function realProject(requested) {
|
|
8455
|
-
const absolute =
|
|
8601
|
+
const absolute = path9.resolve(requested);
|
|
8456
8602
|
let project;
|
|
8457
8603
|
try {
|
|
8458
8604
|
project = await fs6.realpath(absolute);
|
|
@@ -8464,10 +8610,10 @@ async function realProject(requested) {
|
|
|
8464
8610
|
return project;
|
|
8465
8611
|
}
|
|
8466
8612
|
function safeRelative(reference, label) {
|
|
8467
|
-
if (!reference ||
|
|
8613
|
+
if (!reference || path9.isAbsolute(reference) || /[\r\n\0]/.test(reference)) {
|
|
8468
8614
|
throw invalid2(`${label}\u5FC5\u987B\u662F\u9879\u76EE\u5185\u76F8\u5BF9\u8DEF\u5F84`);
|
|
8469
8615
|
}
|
|
8470
|
-
const normalized =
|
|
8616
|
+
const normalized = path9.normalize(reference).split(path9.sep).join("/");
|
|
8471
8617
|
if (normalized === ".." || normalized.startsWith("../") || normalized === ".") {
|
|
8472
8618
|
throw invalid2(`${label}\u8DEF\u5F84\u9003\u9038\u9879\u76EE`);
|
|
8473
8619
|
}
|
|
@@ -8519,12 +8665,17 @@ async function sha256File(file) {
|
|
|
8519
8665
|
function invalid2(message, cause) {
|
|
8520
8666
|
return new CliError20({ code: CliErrorCode19.INVALID_ARGUMENT, message, cause });
|
|
8521
8667
|
}
|
|
8668
|
+
function nextCommandHint(planId, project, argv) {
|
|
8669
|
+
const quoted = argv.map((a) => /[\s"'$`\\]/.test(a) ? `'${a.replace(/'/g, `'\\''`)}'` : a);
|
|
8670
|
+
const proj = project && project !== "." ? ` --project ${project}` : "";
|
|
8671
|
+
return `hcm delivery execute ${planId}${proj} -- ${quoted.join(" ")}`;
|
|
8672
|
+
}
|
|
8522
8673
|
|
|
8523
8674
|
// src/commands/user.ts
|
|
8524
8675
|
init_auth_guard();
|
|
8525
8676
|
init_exit();
|
|
8526
8677
|
import {
|
|
8527
|
-
HcmClient as
|
|
8678
|
+
HcmClient as HcmClient22,
|
|
8528
8679
|
adminResetPassword,
|
|
8529
8680
|
formatObject as formatObject23,
|
|
8530
8681
|
fromAxiosError as fromAxiosError19,
|
|
@@ -8558,7 +8709,7 @@ async function userResetPasswordCommand(args) {
|
|
|
8558
8709
|
try {
|
|
8559
8710
|
const password = args.passwordStdin ? await readSecretFromStdin() : await promptPasswordTwice();
|
|
8560
8711
|
const request = buildAdminResetPasswordRequest(args, password);
|
|
8561
|
-
const client3 =
|
|
8712
|
+
const client3 = HcmClient22.fromAuthContext(await getActiveAuthContextFromCli(args));
|
|
8562
8713
|
const result = await adminResetPassword(client3.raw(), request);
|
|
8563
8714
|
process.stdout.write(formatObject23(result, { format: args.output ?? "json" }) + "\n");
|
|
8564
8715
|
} catch (cause) {
|
|
@@ -8583,13 +8734,13 @@ async function promptPasswordTwice() {
|
|
|
8583
8734
|
init_exit();
|
|
8584
8735
|
init_auth_guard();
|
|
8585
8736
|
import {
|
|
8586
|
-
HcmClient as
|
|
8737
|
+
HcmClient as HcmClient23,
|
|
8587
8738
|
formatObject as formatObject24,
|
|
8588
8739
|
fromAxiosError as fromAxiosError20
|
|
8589
8740
|
} from "@hcmai/sdk";
|
|
8590
8741
|
async function modelsCommand(keyword, args) {
|
|
8591
8742
|
try {
|
|
8592
|
-
const client3 =
|
|
8743
|
+
const client3 = HcmClient23.fromAuthContext(await getActiveAuthContextFromCli(args));
|
|
8593
8744
|
const all = await client3.listModels();
|
|
8594
8745
|
const needle = keyword?.trim().toLowerCase();
|
|
8595
8746
|
const rows = (needle ? all.filter((m) => JSON.stringify(m).toLowerCase().includes(needle)) : all).sort((a, b) => key(a).localeCompare(key(b)));
|
|
@@ -8676,6 +8827,10 @@ recon.command("round").description("\u96F6\u7F51\u7EDC\uFF1A\u8BFB\u4E00\u4EFD\u
|
|
|
8676
8827
|
output: cmd.parent?.opts()?.output
|
|
8677
8828
|
})
|
|
8678
8829
|
);
|
|
8830
|
+
var seed = delivery.command("seed").description(
|
|
8831
|
+
"\u628A\u987E\u95EE\u624B\u4E0A\u7684**\u5BA2\u6237\u8868**\u53D8\u6210\u4EA7\u54C1\u91CC\u7684\u884C\u3002\u26A0\uFE0F \u4E0E\u9876\u5C42 `hcm import <path>` \u4E0D\u662F\u4E00\u56DE\u4E8B\uFF1A\u90A3\u4E00\u6761\u5403 DataPackage YAML\uFF08fixture \u6CE8\u5165\u5668\uFF09\uFF0C\u8FD9\u4E00\u65CF\u5403\u5BA2\u6237\u7684 Excel"
|
|
8832
|
+
);
|
|
8833
|
+
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));
|
|
8679
8834
|
delivery.command("gate0").description(
|
|
8680
8835
|
"\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"
|
|
8681
8836
|
).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(
|
|
@@ -8692,7 +8847,7 @@ delivery.command("triage").description(
|
|
|
8692
8847
|
"\u57FA\u7EBF\u4EA7\u7269\u76EE\u5F55\uFF08<out>/recon/<\u79DF\u6237\u6BB5>/<\u6765\u6E90\u6BB5>\uFF09\uFF1B\u4E0D\u7ED9\u5219\u6309\u722C\u53D6\u8EAB\u4EFD\u73B0\u7B97\u4E00\u4EFD"
|
|
8693
8848
|
).option("--out <dir>", "\u4EA7\u7269\u6839\uFF08\u5199 work/triage.md\uFF09", ".").option("--capabilities <caps>", "\u672C\u6B21\u63A2\u6D4B\u58F0\u660E\u7684 capability \u4E32", "default").action((opts) => deliveryTriageCommand(opts));
|
|
8694
8849
|
delivery.command("prepare").description("\u628A\u53D7\u652F\u6301\u7684 R2 argv \u4E0E\u9501\u3001\u8FD0\u884C\u65F6\u548C\u53D8\u66F4/\u56DE\u6EDA\u8BF4\u660E\u7ED1\u5B9A\u4E3A\u77ED\u65F6\u6267\u884C\u8BA1\u5212").requiredOption("--change-ref <file>", "\u9879\u76EE work/ \u6216 decisions/ \u4E0B\u7684\u53D8\u66F4\u8BF4\u660E").requiredOption("--rollback-ref <file>", "\u9879\u76EE work/ \u6216 decisions/ \u4E0B\u7684\u56DE\u6EDA\u8BF4\u660E").requiredOption("--evidence-dir <dir>", "\u9879\u76EE evidence/ \u4E0B\u7684\u6536\u636E\u76EE\u5F55").option("--project <dir>", "HCM \u987E\u95EE\u9879\u76EE\u6839\u76EE\u5F55", ".").option("--ttl-seconds <n>", "\u6709\u6548\u671F\u79D2\u6570\uFF0860-3600\uFF09", "900").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "json").allowUnknownOption(true).argument("<command...>", "\u88AB\u7ED1\u5B9A\u7684 R2 HCM \u5B50\u547D\u4EE4\u4E0E\u53C2\u6570\uFF0C\u4E0D\u5305\u542B hcm \u672C\u8EAB").action((command, opts) => deliveryPrepareCommand(command, opts));
|
|
8695
|
-
delivery.command("execute <planId>").description("\u9010\u6B21\u6279\u51C6\u540E\u6D88\u8D39\u77ED\u65F6\u8BA1\u5212\uFF0C\u5E76\u6267\u884C\u4E00\u6B21\u4E0E\u8BA1\u5212\u5B8C\u5168\u76F8\u540C\u7684 R2 argv").option("--project <dir>", "HCM \u987E\u95EE\u9879\u76EE\u6839\u76EE\u5F55", ".").option("--output <fmt>", "\u6536\u636E\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "json").allowUnknownOption(true).argument("
|
|
8850
|
+
delivery.command("execute <planId>").description("\u9010\u6B21\u6279\u51C6\u540E\u6D88\u8D39\u77ED\u65F6\u8BA1\u5212\uFF0C\u5E76\u6267\u884C\u4E00\u6B21\u4E0E\u8BA1\u5212\u5B8C\u5168\u76F8\u540C\u7684 R2 argv").option("--project <dir>", "HCM \u987E\u95EE\u9879\u76EE\u6839\u76EE\u5F55", ".").option("--output <fmt>", "\u6536\u636E\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "json").allowUnknownOption(true).argument("[command...]", "\u4E0E prepare \u5B8C\u5168\u76F8\u540C\u7684 R2 HCM \u5B50\u547D\u4EE4\u4E0E\u53C2\u6570").action((planId, command, opts) => deliveryExecuteCommand(planId, command, opts));
|
|
8696
8851
|
program.command("query <Model>").description("\u67E5\u8BE2 Model \u5217\u8868\u6570\u636E\uFF08\u901A\u8FC7 ModelQueryDsl JSON \u8868\u8FBE\u8FC7\u6EE4/\u6392\u5E8F/\u5206\u9875\uFF09").option(
|
|
8697
8852
|
"--filter <JSON>",
|
|
8698
8853
|
`\u8FC7\u6EE4 AST\uFF08ModelQueryDsl\uFF09\uFF1A\u53F6\u5B50 '{"field":"status","op":"eq","value":"ACTIVE"}'\uFF0C\u591A\u6761\u4EF6\u7528 '{"and":[\u53F6\u5B50,\u2026]}'\u3002\u26A0\uFE0F \u4E0D\u63A5\u53D7 {"\u5B57\u6BB5":"\u503C"} \u7B80\u5199\uFF0Cschema \u5C42\u4F1A\u62D2`
|