@hcmai/cli 0.3.15 → 0.3.17
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 +231 -61
- 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
|
}
|
|
@@ -2757,8 +2757,10 @@ async function actionCommand(spec, args) {
|
|
|
2757
2757
|
message: "--id and --ids are mutually exclusive"
|
|
2758
2758
|
});
|
|
2759
2759
|
}
|
|
2760
|
-
const
|
|
2761
|
-
const
|
|
2760
|
+
const explicitMethod = args.method !== void 0;
|
|
2761
|
+
const explicitScope = args.scope !== void 0;
|
|
2762
|
+
let method = normalizeMethod(args.method);
|
|
2763
|
+
let scope = normalizeScope(args.scope);
|
|
2762
2764
|
const input = { method };
|
|
2763
2765
|
if (scope) input.scope = scope;
|
|
2764
2766
|
if (args.id) input.id = args.id;
|
|
@@ -2772,6 +2774,15 @@ async function actionCommand(spec, args) {
|
|
|
2772
2774
|
});
|
|
2773
2775
|
if (params) input.params = params;
|
|
2774
2776
|
const client3 = HcmClient2.fromAuthContext(await getActiveAuthContextFromCli(args));
|
|
2777
|
+
if (!explicitMethod || !explicitScope) {
|
|
2778
|
+
const shape = await lookupActionShape(client3, model, action);
|
|
2779
|
+
if (shape) {
|
|
2780
|
+
if (!explicitMethod && shape.httpMethod) method = shape.httpMethod;
|
|
2781
|
+
if (!explicitScope && shape.scope) scope = shape.scope;
|
|
2782
|
+
input.method = method;
|
|
2783
|
+
if (scope) input.scope = scope;
|
|
2784
|
+
}
|
|
2785
|
+
}
|
|
2775
2786
|
const result = await client3.action(model, action, input);
|
|
2776
2787
|
const fmt = args.output ?? "json";
|
|
2777
2788
|
if (fmt !== "json" && result.taskId) {
|
|
@@ -2808,6 +2819,20 @@ function normalizeScope(value) {
|
|
|
2808
2819
|
message: `--scope \u53D6\u503C class | object\uFF0C\u6536\u5230 "${value}"`
|
|
2809
2820
|
});
|
|
2810
2821
|
}
|
|
2822
|
+
async function lookupActionShape(client3, model, action) {
|
|
2823
|
+
try {
|
|
2824
|
+
const described = await client3.describe(model);
|
|
2825
|
+
const named = described.actions.filter((a) => a.name === action);
|
|
2826
|
+
if (named.length !== 1) return void 0;
|
|
2827
|
+
const only = named[0];
|
|
2828
|
+
const m = only.httpMethod?.toUpperCase();
|
|
2829
|
+
const httpMethod = m === "GET" || m === "POST" || m === "PUT" || m === "DELETE" ? m : void 0;
|
|
2830
|
+
const sc = only.scope === "class" || only.scope === "object" ? only.scope : void 0;
|
|
2831
|
+
return { ...httpMethod ? { httpMethod } : {}, ...sc ? { scope: sc } : {} };
|
|
2832
|
+
} catch {
|
|
2833
|
+
return void 0;
|
|
2834
|
+
}
|
|
2835
|
+
}
|
|
2811
2836
|
|
|
2812
2837
|
// src/commands/create.ts
|
|
2813
2838
|
init_exit();
|
|
@@ -3059,8 +3084,8 @@ import {
|
|
|
3059
3084
|
formatObject as formatObject7,
|
|
3060
3085
|
fromAxiosError as fromAxiosError8
|
|
3061
3086
|
} from "@hcmai/sdk";
|
|
3062
|
-
function collectYmlFiles(
|
|
3063
|
-
if (statSync(
|
|
3087
|
+
function collectYmlFiles(path10) {
|
|
3088
|
+
if (statSync(path10).isFile()) return [path10];
|
|
3064
3089
|
const out = [];
|
|
3065
3090
|
const walk = (dir) => {
|
|
3066
3091
|
for (const name of readdirSync(dir).sort()) {
|
|
@@ -3069,7 +3094,7 @@ function collectYmlFiles(path9) {
|
|
|
3069
3094
|
else if (full.endsWith(".yml") || full.endsWith(".yaml")) out.push(full);
|
|
3070
3095
|
}
|
|
3071
3096
|
};
|
|
3072
|
-
walk(
|
|
3097
|
+
walk(path10);
|
|
3073
3098
|
return out.sort();
|
|
3074
3099
|
}
|
|
3075
3100
|
var DRY_RUN_CLIENT = {
|
|
@@ -3077,9 +3102,9 @@ var DRY_RUN_CLIENT = {
|
|
|
3077
3102
|
create: async () => ({ id: "" }),
|
|
3078
3103
|
update: async () => ({})
|
|
3079
3104
|
};
|
|
3080
|
-
async function importCommand(
|
|
3105
|
+
async function importCommand(path10, args) {
|
|
3081
3106
|
try {
|
|
3082
|
-
const files = collectYmlFiles(
|
|
3107
|
+
const files = collectYmlFiles(path10);
|
|
3083
3108
|
const fixtures = files.map(
|
|
3084
3109
|
(f) => parseFixture(readFileSync2(f, "utf8"), relative(process.cwd(), f))
|
|
3085
3110
|
);
|
|
@@ -5858,17 +5883,17 @@ async function metaListCommand(args) {
|
|
|
5858
5883
|
fail4(e, args);
|
|
5859
5884
|
}
|
|
5860
5885
|
}
|
|
5861
|
-
async function metaGetCommand(
|
|
5886
|
+
async function metaGetCommand(path10, args) {
|
|
5862
5887
|
try {
|
|
5863
5888
|
const c = await client2(args);
|
|
5864
|
-
const content = await getTenantMeta(c.raw(),
|
|
5889
|
+
const content = await getTenantMeta(c.raw(), path10);
|
|
5865
5890
|
process.stdout.write(content.endsWith("\n") ? content : content + "\n");
|
|
5866
5891
|
process.exit(0);
|
|
5867
5892
|
} catch (e) {
|
|
5868
5893
|
fail4(e, args);
|
|
5869
5894
|
}
|
|
5870
5895
|
}
|
|
5871
|
-
async function metaSetCommand(
|
|
5896
|
+
async function metaSetCommand(path10, args) {
|
|
5872
5897
|
try {
|
|
5873
5898
|
if (!args.file) {
|
|
5874
5899
|
throw new CliError18({
|
|
@@ -5885,7 +5910,7 @@ async function metaSetCommand(path9, args) {
|
|
|
5885
5910
|
}) : await fsp3.readFile(args.file, "utf8");
|
|
5886
5911
|
if (args.dryRun) {
|
|
5887
5912
|
process.stdout.write(
|
|
5888
|
-
`[dry-run] \u5C06\u5199\u5165 ${
|
|
5913
|
+
`[dry-run] \u5C06\u5199\u5165 ${path10}\uFF08${Buffer.byteLength(content)} B\uFF09\u2014\u2014\u672A\u5B9E\u9645\u5199\u5165
|
|
5889
5914
|
---
|
|
5890
5915
|
${content}
|
|
5891
5916
|
`
|
|
@@ -5893,10 +5918,10 @@ ${content}
|
|
|
5893
5918
|
process.exit(0);
|
|
5894
5919
|
}
|
|
5895
5920
|
const c = await client2(args);
|
|
5896
|
-
const result = await saveTenantMeta(c.raw(),
|
|
5921
|
+
const result = await saveTenantMeta(c.raw(), path10, content);
|
|
5897
5922
|
const fmt = args.output ?? "json";
|
|
5898
5923
|
if (fmt !== "json") {
|
|
5899
|
-
process.stdout.write(`\u2705 \u5DF2\u5199\u5165 ${
|
|
5924
|
+
process.stdout.write(`\u2705 \u5DF2\u5199\u5165 ${path10}
|
|
5900
5925
|
\u8BB0\u5F97\u6E05\u7F13\u5B58\uFF1Ahcm cache clear-meta <Model>
|
|
5901
5926
|
`);
|
|
5902
5927
|
}
|
|
@@ -5907,19 +5932,19 @@ ${content}
|
|
|
5907
5932
|
fail4(e, args);
|
|
5908
5933
|
}
|
|
5909
5934
|
}
|
|
5910
|
-
async function metaDeleteCommand(
|
|
5935
|
+
async function metaDeleteCommand(path10, args) {
|
|
5911
5936
|
try {
|
|
5912
5937
|
if (!args.yes) {
|
|
5913
|
-
const ok = await promptConfirm(`\u5C06\u5220\u9664\u5143\u6570\u636E ${
|
|
5938
|
+
const ok = await promptConfirm(`\u5C06\u5220\u9664\u5143\u6570\u636E ${path10}\uFF0C\u6B64\u64CD\u4F5C\u4E0D\u53EF\u9006\u3002\u7EE7\u7EED\uFF1F`);
|
|
5914
5939
|
if (!ok) {
|
|
5915
5940
|
process.stderr.write("\u5DF2\u53D6\u6D88\n");
|
|
5916
5941
|
process.exit(1);
|
|
5917
5942
|
}
|
|
5918
5943
|
}
|
|
5919
5944
|
const c = await client2(args);
|
|
5920
|
-
const result = await deleteTenantMeta(c.raw(),
|
|
5945
|
+
const result = await deleteTenantMeta(c.raw(), path10);
|
|
5921
5946
|
const fmt = args.output ?? "json";
|
|
5922
|
-
if (fmt !== "json") process.stdout.write(`\u{1F5D1}\uFE0F \u5DF2\u5220\u9664 ${
|
|
5947
|
+
if (fmt !== "json") process.stdout.write(`\u{1F5D1}\uFE0F \u5DF2\u5220\u9664 ${path10}
|
|
5923
5948
|
`);
|
|
5924
5949
|
process.stdout.write(formatObject16(result, { format: fmt }) + "\n");
|
|
5925
5950
|
process.exit(0);
|
|
@@ -7873,16 +7898,16 @@ async function deliveryGate0Command(args) {
|
|
|
7873
7898
|
const { aclass, problems: aclassProblems } = deriveAclass(reconDir, args.mapping ?? null);
|
|
7874
7899
|
const { facts, problems: factsProblems } = loadProtocolFacts();
|
|
7875
7900
|
const result = scan(skillRoot, aclass, facts, { aclassProblems, factsProblems });
|
|
7876
|
-
const
|
|
7901
|
+
const premise3 = checkPremise([
|
|
7877
7902
|
...result.premise,
|
|
7878
7903
|
...baselineRoundPremise(inspectRound2(reconDir))
|
|
7879
7904
|
]);
|
|
7880
|
-
const merged = { ...result, premise:
|
|
7905
|
+
const merged = { ...result, premise: premise3 };
|
|
7881
7906
|
const fmt = args.output ?? "json";
|
|
7882
7907
|
if (fmt !== "json") process.stdout.write(renderGate0(merged, skillRoot));
|
|
7883
7908
|
process.stdout.write(`${formatObject21(merged, { format: fmt })}
|
|
7884
7909
|
`);
|
|
7885
|
-
for (const problem of
|
|
7910
|
+
for (const problem of premise3) {
|
|
7886
7911
|
process.stderr.write(`\u{1F534} \u524D\u63D0\u4E0D\u6210\u7ACB\uFF08${problem.reason}\uFF09\uFF1A${problem.message}
|
|
7887
7912
|
`);
|
|
7888
7913
|
}
|
|
@@ -7894,20 +7919,147 @@ async function deliveryGate0Command(args) {
|
|
|
7894
7919
|
process.exit(code);
|
|
7895
7920
|
}
|
|
7896
7921
|
|
|
7922
|
+
// src/commands/delivery-seed.ts
|
|
7923
|
+
init_auth_guard();
|
|
7924
|
+
import {
|
|
7925
|
+
HcmClient as HcmClient20,
|
|
7926
|
+
INIT_EXIT_CODES,
|
|
7927
|
+
baselineRoundPremise as baselineRoundPremise2,
|
|
7928
|
+
MappingError,
|
|
7929
|
+
discardedColumnLines,
|
|
7930
|
+
inspectRound as inspectRound3,
|
|
7931
|
+
loadExemptions,
|
|
7932
|
+
planFromArtifacts,
|
|
7933
|
+
planProblemLines,
|
|
7934
|
+
planRc,
|
|
7935
|
+
planSummaryLine,
|
|
7936
|
+
riskFromArtifacts,
|
|
7937
|
+
roundWarning,
|
|
7938
|
+
seedBaselines,
|
|
7939
|
+
seedMappingPath,
|
|
7940
|
+
seedWorkDir,
|
|
7941
|
+
writeImportPlan,
|
|
7942
|
+
writeRisk
|
|
7943
|
+
} from "@hcmai/sdk";
|
|
7944
|
+
import { existsSync as existsSync2 } from "fs";
|
|
7945
|
+
import * as path7 from "path";
|
|
7946
|
+
function premise(message, hint = "") {
|
|
7947
|
+
process.stderr.write(message + (hint ? `
|
|
7948
|
+
\u2192 ${hint}` : "") + "\n");
|
|
7949
|
+
return INIT_EXIT_CODES.premise;
|
|
7950
|
+
}
|
|
7951
|
+
async function runSeedPlan(args, client3) {
|
|
7952
|
+
const out = args.out ?? ".";
|
|
7953
|
+
const tenant2 = tenantOf(client3);
|
|
7954
|
+
const work = seedWorkDir({ out, tenant: tenant2, work: args.work ?? null, mapping: args.mapping ?? null });
|
|
7955
|
+
const mappingPath = seedMappingPath({ out, tenant: tenant2, mapping: args.mapping ?? null }, work);
|
|
7956
|
+
if (!existsSync2(mappingPath)) {
|
|
7957
|
+
return premise(
|
|
7958
|
+
`\u8BFB\u4E0D\u5230\u5BFC\u5165\u6620\u5C04\u5DE5\u4EF6\uFF1A${mappingPath}`,
|
|
7959
|
+
"\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"
|
|
7960
|
+
);
|
|
7961
|
+
}
|
|
7962
|
+
const [base, candidates] = seedBaselines(out, tenant2);
|
|
7963
|
+
if (candidates.length === 0) {
|
|
7964
|
+
return premise(
|
|
7965
|
+
`\u672A\u627E\u5230\u5200 2 \u7684\u57FA\u7EBF\uFF1A${base}/*/index/fields.jsonl`,
|
|
7966
|
+
"`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"
|
|
7967
|
+
);
|
|
7968
|
+
}
|
|
7969
|
+
const reconDir = candidates[0].reconDir;
|
|
7970
|
+
if (candidates.length > 1) {
|
|
7971
|
+
process.stderr.write(
|
|
7972
|
+
`\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"
|
|
7973
|
+
);
|
|
7974
|
+
}
|
|
7975
|
+
const round = inspectRound3(reconDir);
|
|
7976
|
+
process.stderr.write(roundWarning(round));
|
|
7977
|
+
const baseline = {
|
|
7978
|
+
path: `${path7.basename(path7.dirname(reconDir))}/${path7.basename(reconDir)}`,
|
|
7979
|
+
roundId: round.roundId ?? null
|
|
7980
|
+
};
|
|
7981
|
+
let exemptions = null;
|
|
7982
|
+
if (args.exemptions) {
|
|
7983
|
+
const [loaded, err] = loadExemptions(args.exemptions);
|
|
7984
|
+
if (err !== null) {
|
|
7985
|
+
process.stderr.write(err + "\n");
|
|
7986
|
+
return INIT_EXIT_CODES.premise;
|
|
7987
|
+
}
|
|
7988
|
+
exemptions = loaded;
|
|
7989
|
+
}
|
|
7990
|
+
let plan;
|
|
7991
|
+
let risk;
|
|
7992
|
+
try {
|
|
7993
|
+
plan = await planFromArtifacts(client3, mappingPath, args.sourceDir, { baseline });
|
|
7994
|
+
risk = await riskFromArtifacts(mappingPath, reconDir, {
|
|
7995
|
+
sourceDir: args.sourceDir,
|
|
7996
|
+
exemptions,
|
|
7997
|
+
plan,
|
|
7998
|
+
// 🔴 **判据整个在生产模块里**(`baselineRoundPremise`),本层不重判、不改写判词;
|
|
7999
|
+
// risk 那一层只做形态转换(加 hint)。
|
|
8000
|
+
roundPremise: baselineRoundPremise2(round)
|
|
8001
|
+
});
|
|
8002
|
+
} catch (e) {
|
|
8003
|
+
if (e instanceof MappingError) {
|
|
8004
|
+
return premise(`\u5DE5\u4EF6\u88C5\u4E0D\u8FDB\u6765\uFF1A[${e.reason}] ${e.message}`, e.hint);
|
|
8005
|
+
}
|
|
8006
|
+
throw e;
|
|
8007
|
+
}
|
|
8008
|
+
const planFile = writeImportPlan(plan, work);
|
|
8009
|
+
const riskFile = writeRisk(risk, work);
|
|
8010
|
+
process.stdout.write(`\u8BA1\u5212\uFF1A${planFile}
|
|
8011
|
+
`);
|
|
8012
|
+
process.stdout.write(`\u98CE\u9669\uFF1A${riskFile}
|
|
8013
|
+
`);
|
|
8014
|
+
for (const line of discardedColumnLines(plan.notes)) process.stdout.write(line + "\n");
|
|
8015
|
+
process.stdout.write(planSummaryLine(plan, risk) + "\n");
|
|
8016
|
+
for (const line of planProblemLines(plan, risk)) process.stderr.write(line + "\n");
|
|
8017
|
+
return planRc(plan, risk);
|
|
8018
|
+
}
|
|
8019
|
+
function tenantOf(client3) {
|
|
8020
|
+
const t = client3?.tenantId;
|
|
8021
|
+
return t === void 0 || t === null ? "" : String(t);
|
|
8022
|
+
}
|
|
8023
|
+
async function deliverySeedPlanCommand(args) {
|
|
8024
|
+
const ctx = await getActiveAuthContextFromCli(args);
|
|
8025
|
+
const client3 = HcmClient20.fromAuthContext(ctx);
|
|
8026
|
+
process.exitCode = await runSeedPlan(args, seedClient(client3, ctx));
|
|
8027
|
+
}
|
|
8028
|
+
function seedClient(client3, ctx) {
|
|
8029
|
+
const raw = client3.raw();
|
|
8030
|
+
return {
|
|
8031
|
+
tenantId: ctx.tenantId,
|
|
8032
|
+
async post(p, body) {
|
|
8033
|
+
try {
|
|
8034
|
+
const res = await raw.post(p, body);
|
|
8035
|
+
return { status: res.status, body: res.data, error: "ok", headers: {} };
|
|
8036
|
+
} catch (e) {
|
|
8037
|
+
const status = e?.response?.status ?? -1;
|
|
8038
|
+
return {
|
|
8039
|
+
status,
|
|
8040
|
+
body: e?.response?.data ?? null,
|
|
8041
|
+
error: status === -1 ? "network" : `http-${status}`,
|
|
8042
|
+
headers: {}
|
|
8043
|
+
};
|
|
8044
|
+
}
|
|
8045
|
+
}
|
|
8046
|
+
};
|
|
8047
|
+
}
|
|
8048
|
+
|
|
7897
8049
|
// src/commands/delivery-triage.ts
|
|
7898
8050
|
init_auth_guard();
|
|
7899
8051
|
init_exit();
|
|
7900
8052
|
import {
|
|
7901
8053
|
computeReconSourceKey as computeReconSourceKey2,
|
|
7902
|
-
HcmClient as
|
|
8054
|
+
HcmClient as HcmClient21,
|
|
7903
8055
|
httpProbe as httpProbe3,
|
|
7904
8056
|
ReconLayout as ReconLayout2,
|
|
7905
8057
|
runTriageRound
|
|
7906
8058
|
} from "@hcmai/sdk";
|
|
7907
8059
|
import { mkdirSync, readFileSync as readFileSync4, writeFileSync as writeFileSync2 } from "fs";
|
|
7908
|
-
import * as
|
|
8060
|
+
import * as path8 from "path";
|
|
7909
8061
|
var DEFAULT_CAPABILITIES3 = "default";
|
|
7910
|
-
function
|
|
8062
|
+
function premise2(message, hint) {
|
|
7911
8063
|
process.stderr.write(`\u{1F534} \u524D\u63D0\u4E0D\u6210\u7ACB\uFF1A${message}
|
|
7912
8064
|
`);
|
|
7913
8065
|
process.stderr.write(` ${hint}
|
|
@@ -7941,21 +8093,21 @@ function renderProblems(rows) {
|
|
|
7941
8093
|
`;
|
|
7942
8094
|
}
|
|
7943
8095
|
function writeTriageArtifact(outDir, body) {
|
|
7944
|
-
const out =
|
|
7945
|
-
mkdirSync(
|
|
8096
|
+
const out = path8.join(outDir, "work", "triage.md");
|
|
8097
|
+
mkdirSync(path8.dirname(out), { recursive: true });
|
|
7946
8098
|
writeFileSync2(out, body, "utf8");
|
|
7947
8099
|
return out;
|
|
7948
8100
|
}
|
|
7949
8101
|
async function runTriage(args) {
|
|
7950
|
-
if (!args.requests) return
|
|
8102
|
+
if (!args.requests) return premise2("\u6CA1\u7ED9 `--requests`", REQUESTS_SHAPE);
|
|
7951
8103
|
let entriesIn;
|
|
7952
8104
|
try {
|
|
7953
8105
|
entriesIn = readRequests(args.requests);
|
|
7954
8106
|
} catch (e) {
|
|
7955
|
-
return
|
|
8107
|
+
return premise2(e instanceof Error ? e.message : String(e), REQUESTS_SHAPE);
|
|
7956
8108
|
}
|
|
7957
8109
|
const ctx = await getActiveAuthContextFromCli(args);
|
|
7958
|
-
const client3 =
|
|
8110
|
+
const client3 = HcmClient21.fromAuthContext(ctx);
|
|
7959
8111
|
const probe = httpProbe3(client3.raw(), args.capabilities ?? DEFAULT_CAPABILITIES3);
|
|
7960
8112
|
const artifactsDir = args.recon ?? new ReconLayout2(args.out ?? ".", ctx.tenantId, await computeReconSourceKey2(probe)).dir;
|
|
7961
8113
|
const result = await runTriageRound(probe, artifactsDir, entriesIn);
|
|
@@ -7983,7 +8135,7 @@ async function deliveryTriageCommand(args) {
|
|
|
7983
8135
|
import { createHash as createHash5, randomBytes as secureRandomBytes } from "crypto";
|
|
7984
8136
|
import { spawn } from "child_process";
|
|
7985
8137
|
import { createReadStream, promises as fs6 } from "fs";
|
|
7986
|
-
import
|
|
8138
|
+
import path9 from "path";
|
|
7987
8139
|
import { CliError as CliError20, CliErrorCode as CliErrorCode19, formatObject as formatObject22 } from "@hcmai/sdk";
|
|
7988
8140
|
init_exit();
|
|
7989
8141
|
var EXECUTION_CONTRACT_VERSION = "2026-08-29.controlled-v3";
|
|
@@ -8023,9 +8175,9 @@ async function prepareDeliveryExecution(input) {
|
|
|
8023
8175
|
};
|
|
8024
8176
|
const planId = sha2565(canonicalJson(core)).slice(0, 24);
|
|
8025
8177
|
const plan = { ...core, planId };
|
|
8026
|
-
const plansDir =
|
|
8178
|
+
const plansDir = path9.join(project, ".hcm-delivery", "execution-plans");
|
|
8027
8179
|
await safeManagedDirectory(project, ".hcm-delivery/execution-plans", plansDir);
|
|
8028
|
-
const planFile =
|
|
8180
|
+
const planFile = path9.join(plansDir, `${planId}.json`);
|
|
8029
8181
|
try {
|
|
8030
8182
|
await fs6.writeFile(planFile, `${JSON.stringify(plan, null, 2)}
|
|
8031
8183
|
`, {
|
|
@@ -8044,7 +8196,7 @@ async function executeDeliveryPlan(input) {
|
|
|
8044
8196
|
if (await readProjectMode(project) !== "controlled") {
|
|
8045
8197
|
throw invalid2("\u9879\u76EE\u4E0D\u662F controlled\uFF0C\u4E0D\u80FD\u6267\u884C R2 \u8BA1\u5212");
|
|
8046
8198
|
}
|
|
8047
|
-
const planFile =
|
|
8199
|
+
const planFile = path9.join(project, ".hcm-delivery", "execution-plans", `${input.planId}.json`);
|
|
8048
8200
|
const plan = await readPlan(project, planFile);
|
|
8049
8201
|
if (plan.planId !== input.planId || computePlanId(plan) !== input.planId) {
|
|
8050
8202
|
throw invalid2("\u6267\u884C\u8BA1\u5212\u5185\u5BB9\u4E0E planId \u6458\u8981\u4E0D\u4E00\u81F4");
|
|
@@ -8075,11 +8227,11 @@ async function executeDeliveryPlan(input) {
|
|
|
8075
8227
|
await assertDocumentUnchanged(project, plan.documents.rollback, "\u56DE\u6EDA\u8BF4\u660E");
|
|
8076
8228
|
await assertPayloadsUnchanged(project, plan.payloads);
|
|
8077
8229
|
const evidenceDir = await bindEvidenceDirectory(project, plan.evidenceDir);
|
|
8078
|
-
const receiptFile =
|
|
8230
|
+
const receiptFile = path9.join(evidenceDir.absolute, `${plan.planId}.receipt.json`);
|
|
8079
8231
|
if (await pathExists(receiptFile)) throw invalid2(`\u6267\u884C\u6536\u636E\u5DF2\u5B58\u5728\uFF0C\u62D2\u7EDD\u518D\u6B21\u6267\u884C\uFF1A${plan.planId}`);
|
|
8080
|
-
const claimsDir =
|
|
8232
|
+
const claimsDir = path9.join(project, ".hcm-delivery", "execution-claims");
|
|
8081
8233
|
await safeManagedDirectory(project, ".hcm-delivery/execution-claims", claimsDir);
|
|
8082
|
-
const claimFile =
|
|
8234
|
+
const claimFile = path9.join(claimsDir, `${plan.planId}.json`);
|
|
8083
8235
|
try {
|
|
8084
8236
|
await fs6.writeFile(
|
|
8085
8237
|
claimFile,
|
|
@@ -8139,12 +8291,21 @@ async function deliveryPrepareCommand(argv, args) {
|
|
|
8139
8291
|
...ttlSeconds === void 0 ? {} : { ttlSeconds }
|
|
8140
8292
|
});
|
|
8141
8293
|
process.stdout.write(formatObject22(plan, { format: args.output ?? "json" }) + "\n");
|
|
8294
|
+
process.stderr.write(`
|
|
8295
|
+
\u4E0B\u4E00\u6B65\uFF08argv \u5FC5\u987B\u4E0E\u672C\u6B21\u5B8C\u5168\u4E00\u81F4\uFF09\uFF1A
|
|
8296
|
+
${nextCommandHint(plan.planId, args.project, argv)}
|
|
8297
|
+
`);
|
|
8142
8298
|
} catch (cause) {
|
|
8143
8299
|
exitWithError(cause);
|
|
8144
8300
|
}
|
|
8145
8301
|
}
|
|
8146
8302
|
async function deliveryExecuteCommand(planId, argv, args) {
|
|
8147
8303
|
try {
|
|
8304
|
+
if (!argv || argv.length === 0) {
|
|
8305
|
+
throw invalid2(
|
|
8306
|
+
`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>`
|
|
8307
|
+
);
|
|
8308
|
+
}
|
|
8148
8309
|
const receipt = await executeDeliveryPlan({
|
|
8149
8310
|
project: args.project ?? process.cwd(),
|
|
8150
8311
|
planId,
|
|
@@ -8157,7 +8318,7 @@ async function deliveryExecuteCommand(planId, argv, args) {
|
|
|
8157
8318
|
}
|
|
8158
8319
|
}
|
|
8159
8320
|
async function readProjectMode(project) {
|
|
8160
|
-
const file =
|
|
8321
|
+
const file = path9.join(project, ".hcm-delivery", "project.yml");
|
|
8161
8322
|
const content = await readSafeFile(project, file, "\u9879\u76EE\u914D\u7F6E");
|
|
8162
8323
|
const match = content.toString("utf8").match(
|
|
8163
8324
|
/^deliveryMode:\s*(?:"(plan-only|controlled)"|'(plan-only|controlled)'|(plan-only|controlled))\s*$/m
|
|
@@ -8169,13 +8330,13 @@ async function readProjectMode(project) {
|
|
|
8169
8330
|
return mode;
|
|
8170
8331
|
}
|
|
8171
8332
|
var SKILLS_LOCK_CANDIDATES = [
|
|
8172
|
-
|
|
8173
|
-
|
|
8333
|
+
path9.join("hcm-skills", ".hcm-skills.json"),
|
|
8334
|
+
path9.join(".claude", "skills", ".hcm-skills.json")
|
|
8174
8335
|
];
|
|
8175
8336
|
async function readSkillsLock(project) {
|
|
8176
8337
|
const found = [];
|
|
8177
8338
|
for (const candidate of SKILLS_LOCK_CANDIDATES) {
|
|
8178
|
-
if (await pathExists(
|
|
8339
|
+
if (await pathExists(path9.join(project, candidate))) found.push(candidate);
|
|
8179
8340
|
}
|
|
8180
8341
|
if (found.length === 0) {
|
|
8181
8342
|
throw invalid2(
|
|
@@ -8187,7 +8348,7 @@ async function readSkillsLock(project) {
|
|
|
8187
8348
|
`\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`
|
|
8188
8349
|
);
|
|
8189
8350
|
}
|
|
8190
|
-
const bytes = await readSafeFile(project,
|
|
8351
|
+
const bytes = await readSafeFile(project, path9.join(project, found[0]), "\u6280\u80FD\u9501");
|
|
8191
8352
|
try {
|
|
8192
8353
|
JSON.parse(bytes.toString("utf8"));
|
|
8193
8354
|
} catch (cause) {
|
|
@@ -8200,7 +8361,7 @@ async function bindDocument(project, reference, label) {
|
|
|
8200
8361
|
if (!(relative2.startsWith("work/") || relative2.startsWith("decisions/"))) {
|
|
8201
8362
|
throw invalid2(`${label}\u5FC5\u987B\u4F4D\u4E8E\u9879\u76EE work/ \u6216 decisions/ \u4E0B`);
|
|
8202
8363
|
}
|
|
8203
|
-
const file =
|
|
8364
|
+
const file = path9.join(project, relative2);
|
|
8204
8365
|
const bytes = await readSafeFile(project, file, label);
|
|
8205
8366
|
return { path: relative2, sha256: sha2565(bytes) };
|
|
8206
8367
|
}
|
|
@@ -8213,7 +8374,7 @@ async function bindEvidenceDirectory(project, reference) {
|
|
|
8213
8374
|
if (!(relative2 === "evidence" || relative2.startsWith("evidence/"))) {
|
|
8214
8375
|
throw invalid2("evidence \u76EE\u5F55\u5FC5\u987B\u4F4D\u4E8E\u9879\u76EE evidence/ \u4E0B");
|
|
8215
8376
|
}
|
|
8216
|
-
const absolute =
|
|
8377
|
+
const absolute = path9.join(project, relative2);
|
|
8217
8378
|
await assertNoSymlinkComponents(project, relative2);
|
|
8218
8379
|
const stat = await fs6.stat(absolute).catch(() => null);
|
|
8219
8380
|
if (stat === null) {
|
|
@@ -8345,7 +8506,7 @@ async function bindPayloadFiles(project, argv) {
|
|
|
8345
8506
|
}
|
|
8346
8507
|
async function bindPayloadFile(project, reference, label) {
|
|
8347
8508
|
const relative2 = safeRelative(reference, label);
|
|
8348
|
-
const file =
|
|
8509
|
+
const file = path9.join(project, relative2);
|
|
8349
8510
|
const bytes = await readSafeFile(project, file, label);
|
|
8350
8511
|
return { path: relative2, sha256: sha2565(bytes) };
|
|
8351
8512
|
}
|
|
@@ -8414,13 +8575,13 @@ async function writeReceiptExclusive(target, receipt) {
|
|
|
8414
8575
|
});
|
|
8415
8576
|
await fs6.link(temp, target);
|
|
8416
8577
|
} catch (cause) {
|
|
8417
|
-
throw invalid2(`\u6267\u884C\u6536\u636E\u5199\u5165\u5931\u8D25\u6216\u5DF2\u5B58\u5728\uFF1A${
|
|
8578
|
+
throw invalid2(`\u6267\u884C\u6536\u636E\u5199\u5165\u5931\u8D25\u6216\u5DF2\u5B58\u5728\uFF1A${path9.basename(target)}`, cause);
|
|
8418
8579
|
} finally {
|
|
8419
8580
|
await fs6.unlink(temp).catch(() => void 0);
|
|
8420
8581
|
}
|
|
8421
8582
|
}
|
|
8422
8583
|
async function safeManagedDirectory(project, relative2, absolute) {
|
|
8423
|
-
await assertNoSymlinkComponents(project,
|
|
8584
|
+
await assertNoSymlinkComponents(project, path9.dirname(relative2));
|
|
8424
8585
|
const existing = await fs6.lstat(absolute).catch(() => void 0);
|
|
8425
8586
|
if (existing?.isSymbolicLink()) throw invalid2(`\u53D7\u7BA1\u76EE\u5F55\u4E0D\u80FD\u662F\u7B26\u53F7\u94FE\u63A5\uFF1A${relative2}`);
|
|
8426
8587
|
if (existing && !existing.isDirectory()) throw invalid2(`\u53D7\u7BA1\u8DEF\u5F84\u4E0D\u662F\u76EE\u5F55\uFF1A${relative2}`);
|
|
@@ -8437,8 +8598,8 @@ async function pathExists(file) {
|
|
|
8437
8598
|
);
|
|
8438
8599
|
}
|
|
8439
8600
|
async function readSafeFile(project, file, label) {
|
|
8440
|
-
const relative2 =
|
|
8441
|
-
if (relative2.startsWith("../") ||
|
|
8601
|
+
const relative2 = path9.relative(project, file).split(path9.sep).join("/");
|
|
8602
|
+
if (relative2.startsWith("../") || path9.isAbsolute(relative2))
|
|
8442
8603
|
throw invalid2(`${label}\u8DEF\u5F84\u9003\u9038\u9879\u76EE`);
|
|
8443
8604
|
await assertNoSymlinkComponents(project, relative2);
|
|
8444
8605
|
let stat;
|
|
@@ -8455,14 +8616,14 @@ async function assertNoSymlinkComponents(project, relative2) {
|
|
|
8455
8616
|
const parts = relative2.split("/").filter(Boolean);
|
|
8456
8617
|
let current = project;
|
|
8457
8618
|
for (const part of parts) {
|
|
8458
|
-
current =
|
|
8619
|
+
current = path9.join(current, part);
|
|
8459
8620
|
const stat = await fs6.lstat(current).catch(() => void 0);
|
|
8460
8621
|
if (stat?.isSymbolicLink()) throw invalid2(`\u8DEF\u5F84\u5305\u542B\u7B26\u53F7\u94FE\u63A5\uFF1A${relative2}`);
|
|
8461
8622
|
if (!stat) break;
|
|
8462
8623
|
}
|
|
8463
8624
|
}
|
|
8464
8625
|
async function realProject(requested) {
|
|
8465
|
-
const absolute =
|
|
8626
|
+
const absolute = path9.resolve(requested);
|
|
8466
8627
|
let project;
|
|
8467
8628
|
try {
|
|
8468
8629
|
project = await fs6.realpath(absolute);
|
|
@@ -8474,10 +8635,10 @@ async function realProject(requested) {
|
|
|
8474
8635
|
return project;
|
|
8475
8636
|
}
|
|
8476
8637
|
function safeRelative(reference, label) {
|
|
8477
|
-
if (!reference ||
|
|
8638
|
+
if (!reference || path9.isAbsolute(reference) || /[\r\n\0]/.test(reference)) {
|
|
8478
8639
|
throw invalid2(`${label}\u5FC5\u987B\u662F\u9879\u76EE\u5185\u76F8\u5BF9\u8DEF\u5F84`);
|
|
8479
8640
|
}
|
|
8480
|
-
const normalized =
|
|
8641
|
+
const normalized = path9.normalize(reference).split(path9.sep).join("/");
|
|
8481
8642
|
if (normalized === ".." || normalized.startsWith("../") || normalized === ".") {
|
|
8482
8643
|
throw invalid2(`${label}\u8DEF\u5F84\u9003\u9038\u9879\u76EE`);
|
|
8483
8644
|
}
|
|
@@ -8529,12 +8690,17 @@ async function sha256File(file) {
|
|
|
8529
8690
|
function invalid2(message, cause) {
|
|
8530
8691
|
return new CliError20({ code: CliErrorCode19.INVALID_ARGUMENT, message, cause });
|
|
8531
8692
|
}
|
|
8693
|
+
function nextCommandHint(planId, project, argv) {
|
|
8694
|
+
const quoted = argv.map((a) => /[\s"'$`\\]/.test(a) ? `'${a.replace(/'/g, `'\\''`)}'` : a);
|
|
8695
|
+
const proj = project && project !== "." ? ` --project ${project}` : "";
|
|
8696
|
+
return `hcm delivery execute ${planId}${proj} -- ${quoted.join(" ")}`;
|
|
8697
|
+
}
|
|
8532
8698
|
|
|
8533
8699
|
// src/commands/user.ts
|
|
8534
8700
|
init_auth_guard();
|
|
8535
8701
|
init_exit();
|
|
8536
8702
|
import {
|
|
8537
|
-
HcmClient as
|
|
8703
|
+
HcmClient as HcmClient22,
|
|
8538
8704
|
adminResetPassword,
|
|
8539
8705
|
formatObject as formatObject23,
|
|
8540
8706
|
fromAxiosError as fromAxiosError19,
|
|
@@ -8568,7 +8734,7 @@ async function userResetPasswordCommand(args) {
|
|
|
8568
8734
|
try {
|
|
8569
8735
|
const password = args.passwordStdin ? await readSecretFromStdin() : await promptPasswordTwice();
|
|
8570
8736
|
const request = buildAdminResetPasswordRequest(args, password);
|
|
8571
|
-
const client3 =
|
|
8737
|
+
const client3 = HcmClient22.fromAuthContext(await getActiveAuthContextFromCli(args));
|
|
8572
8738
|
const result = await adminResetPassword(client3.raw(), request);
|
|
8573
8739
|
process.stdout.write(formatObject23(result, { format: args.output ?? "json" }) + "\n");
|
|
8574
8740
|
} catch (cause) {
|
|
@@ -8593,13 +8759,13 @@ async function promptPasswordTwice() {
|
|
|
8593
8759
|
init_exit();
|
|
8594
8760
|
init_auth_guard();
|
|
8595
8761
|
import {
|
|
8596
|
-
HcmClient as
|
|
8762
|
+
HcmClient as HcmClient23,
|
|
8597
8763
|
formatObject as formatObject24,
|
|
8598
8764
|
fromAxiosError as fromAxiosError20
|
|
8599
8765
|
} from "@hcmai/sdk";
|
|
8600
8766
|
async function modelsCommand(keyword, args) {
|
|
8601
8767
|
try {
|
|
8602
|
-
const client3 =
|
|
8768
|
+
const client3 = HcmClient23.fromAuthContext(await getActiveAuthContextFromCli(args));
|
|
8603
8769
|
const all = await client3.listModels();
|
|
8604
8770
|
const needle = keyword?.trim().toLowerCase();
|
|
8605
8771
|
const rows = (needle ? all.filter((m) => JSON.stringify(m).toLowerCase().includes(needle)) : all).sort((a, b) => key(a).localeCompare(key(b)));
|
|
@@ -8686,6 +8852,10 @@ recon.command("round").description("\u96F6\u7F51\u7EDC\uFF1A\u8BFB\u4E00\u4EFD\u
|
|
|
8686
8852
|
output: cmd.parent?.opts()?.output
|
|
8687
8853
|
})
|
|
8688
8854
|
);
|
|
8855
|
+
var seed = delivery.command("seed").description(
|
|
8856
|
+
"\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"
|
|
8857
|
+
);
|
|
8858
|
+
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));
|
|
8689
8859
|
delivery.command("gate0").description(
|
|
8690
8860
|
"\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"
|
|
8691
8861
|
).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(
|
|
@@ -8702,12 +8872,12 @@ delivery.command("triage").description(
|
|
|
8702
8872
|
"\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"
|
|
8703
8873
|
).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));
|
|
8704
8874
|
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));
|
|
8705
|
-
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("
|
|
8875
|
+
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));
|
|
8706
8876
|
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(
|
|
8707
8877
|
"--filter <JSON>",
|
|
8708
8878
|
`\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`
|
|
8709
8879
|
).option("--sort <JSON>", `\u6392\u5E8F\u6761\u4EF6 JSON\uFF0C\u4F8B\u5982 '[{"field":"hireDate","direction":"desc"}]'`).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));
|
|
8710
|
-
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
|
|
8880
|
+
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("--scope <scope>", "\u5F3A\u5236 Action scope\uFF1Aclass | object\uFF08\u9ED8\u8BA4\uFF1A\u6709 --id \u4E3A object\uFF0C\u5426\u5219 class\uFF09").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));
|
|
8711
8881
|
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").action((m, opts) => createCommand(m, opts));
|
|
8712
8882
|
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));
|
|
8713
8883
|
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));
|