@hcmai/cli 0.3.16 → 0.4.0
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 +279 -21
- package/dist/index.js.map +1 -1
- package/dist/skills/hcm-delivery-seed/SKILL.md +230 -0
- package/dist/skills/llms.txt +1 -0
- package/dist/skills/manifest.json +48 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1955,7 +1955,7 @@ var init_readline = __esm({
|
|
|
1955
1955
|
|
|
1956
1956
|
// src/index.ts
|
|
1957
1957
|
import { Command } from "commander";
|
|
1958
|
-
import { migrateLegacyProfiles } from "@hcmai/sdk";
|
|
1958
|
+
import { LEDGER_ONLY_FLAG, migrateLegacyProfiles } from "@hcmai/sdk";
|
|
1959
1959
|
|
|
1960
1960
|
// src/package-version.ts
|
|
1961
1961
|
import { readFileSync } from "fs";
|
|
@@ -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();
|
|
@@ -7897,10 +7922,46 @@ async function deliveryGate0Command(args) {
|
|
|
7897
7922
|
// src/commands/delivery-seed.ts
|
|
7898
7923
|
init_auth_guard();
|
|
7899
7924
|
import {
|
|
7925
|
+
APPLY_CAVEAT,
|
|
7926
|
+
ApplyInvariantError,
|
|
7927
|
+
ApplyPremiseError,
|
|
7928
|
+
DRY_RUN_NOTE,
|
|
7929
|
+
DRY_RUN_TAIL,
|
|
7930
|
+
DriftDetected,
|
|
7931
|
+
FORCE_STALE_FLAG,
|
|
7900
7932
|
HcmClient as HcmClient20,
|
|
7901
7933
|
INIT_EXIT_CODES,
|
|
7902
|
-
|
|
7934
|
+
JOURNAL_STOP_KINDS,
|
|
7935
|
+
JOURNAL_STOP_UNKNOWN,
|
|
7936
|
+
Journal,
|
|
7937
|
+
JournalError,
|
|
7938
|
+
LeaseViolation,
|
|
7903
7939
|
MappingError,
|
|
7940
|
+
PlanReadError,
|
|
7941
|
+
WAIVER_REPLAY,
|
|
7942
|
+
acquireLease,
|
|
7943
|
+
applyPlan,
|
|
7944
|
+
applyReportText,
|
|
7945
|
+
applyRc,
|
|
7946
|
+
baselineRoundPremise as baselineRoundPremise2,
|
|
7947
|
+
computeFingerprint,
|
|
7948
|
+
describeWaiver,
|
|
7949
|
+
enforceDriftGate,
|
|
7950
|
+
existingJournalStop,
|
|
7951
|
+
journalNote,
|
|
7952
|
+
judgeDrift,
|
|
7953
|
+
loadMapping,
|
|
7954
|
+
loadRecordedFingerprint,
|
|
7955
|
+
planVsBaselinePremise,
|
|
7956
|
+
buildDeliveryRun,
|
|
7957
|
+
buildReconciliation,
|
|
7958
|
+
isZeroNetwork,
|
|
7959
|
+
ledgerOnlySignpost,
|
|
7960
|
+
notAsked,
|
|
7961
|
+
readImportPlan,
|
|
7962
|
+
verifyRc,
|
|
7963
|
+
verifyText,
|
|
7964
|
+
resolveBaselineDir,
|
|
7904
7965
|
discardedColumnLines,
|
|
7905
7966
|
inspectRound as inspectRound3,
|
|
7906
7967
|
loadExemptions,
|
|
@@ -7995,30 +8056,213 @@ function tenantOf(client3) {
|
|
|
7995
8056
|
const t = client3?.tenantId;
|
|
7996
8057
|
return t === void 0 || t === null ? "" : String(t);
|
|
7997
8058
|
}
|
|
8059
|
+
async function authOrSignpost(args, cmd) {
|
|
8060
|
+
try {
|
|
8061
|
+
return await getActiveAuthContextFromCli(args);
|
|
8062
|
+
} catch (e) {
|
|
8063
|
+
const signpost = ledgerOnlySignpost(cmd);
|
|
8064
|
+
if (!signpost || !(e instanceof Error)) throw e;
|
|
8065
|
+
e.message += signpost;
|
|
8066
|
+
throw e;
|
|
8067
|
+
}
|
|
8068
|
+
}
|
|
7998
8069
|
async function deliverySeedPlanCommand(args) {
|
|
7999
|
-
const ctx = await
|
|
8070
|
+
const ctx = await authOrSignpost(args, "plan");
|
|
8000
8071
|
const client3 = HcmClient20.fromAuthContext(ctx);
|
|
8001
8072
|
process.exitCode = await runSeedPlan(args, seedClient(client3, ctx));
|
|
8002
8073
|
}
|
|
8003
8074
|
function seedClient(client3, ctx) {
|
|
8004
8075
|
const raw = client3.raw();
|
|
8076
|
+
const wrap = async (send) => {
|
|
8077
|
+
try {
|
|
8078
|
+
const res = await send();
|
|
8079
|
+
return {
|
|
8080
|
+
status: res.status,
|
|
8081
|
+
body: res.data,
|
|
8082
|
+
error: "ok",
|
|
8083
|
+
headers: lowerCaseHeaders(res.headers)
|
|
8084
|
+
};
|
|
8085
|
+
} catch (e) {
|
|
8086
|
+
const res = e?.response;
|
|
8087
|
+
const status = res?.status ?? -1;
|
|
8088
|
+
return {
|
|
8089
|
+
status,
|
|
8090
|
+
body: res?.data ?? null,
|
|
8091
|
+
// 🔴 `-1` **不是** HTTP 状态:网络层没走通与「服务端答了个 4xx」在处置上相反,
|
|
8092
|
+
// 执行器正是靠这一格把「确定没建」与「不知道建没建」分开。
|
|
8093
|
+
error: status === -1 ? "network" : `http-${status}`,
|
|
8094
|
+
headers: lowerCaseHeaders(res?.headers)
|
|
8095
|
+
};
|
|
8096
|
+
}
|
|
8097
|
+
};
|
|
8005
8098
|
return {
|
|
8006
8099
|
tenantId: ctx.tenantId,
|
|
8007
|
-
|
|
8008
|
-
|
|
8009
|
-
|
|
8010
|
-
|
|
8011
|
-
|
|
8012
|
-
|
|
8013
|
-
|
|
8014
|
-
|
|
8015
|
-
|
|
8016
|
-
|
|
8017
|
-
|
|
8018
|
-
|
|
8100
|
+
capabilities: DEFAULT_CAPABILITIES3,
|
|
8101
|
+
get: (p, params) => wrap(() => raw.get(p, { params })),
|
|
8102
|
+
post: (p, body) => wrap(() => raw.post(p, body))
|
|
8103
|
+
};
|
|
8104
|
+
}
|
|
8105
|
+
function lowerCaseHeaders(headers) {
|
|
8106
|
+
if (headers === null || typeof headers !== "object") return {};
|
|
8107
|
+
const out = {};
|
|
8108
|
+
for (const [k, v] of Object.entries(headers)) {
|
|
8109
|
+
if (typeof v === "string") out[k.toLowerCase()] = v;
|
|
8110
|
+
}
|
|
8111
|
+
return out;
|
|
8112
|
+
}
|
|
8113
|
+
var DEFAULT_CAPABILITIES3 = "default";
|
|
8114
|
+
async function runSeedApply(args, client3) {
|
|
8115
|
+
const out = args.out ?? ".";
|
|
8116
|
+
const tenant2 = tenantOf(client3);
|
|
8117
|
+
const work = seedWorkDir({ out, tenant: tenant2, work: args.work ?? null, mapping: args.mapping ?? null });
|
|
8118
|
+
const mappingPath = seedMappingPath({ out, tenant: tenant2, mapping: args.mapping ?? null }, work);
|
|
8119
|
+
let plan;
|
|
8120
|
+
try {
|
|
8121
|
+
plan = readImportPlan(work);
|
|
8122
|
+
} catch (e) {
|
|
8123
|
+
if (e instanceof PlanReadError) return premise(`\u8BA1\u5212\u8BFB\u4E0D\u56DE\u6765\uFF1A[${e.reason}] ${e.message}`, e.hint);
|
|
8124
|
+
throw e;
|
|
8125
|
+
}
|
|
8126
|
+
let mapping;
|
|
8127
|
+
try {
|
|
8128
|
+
mapping = loadMapping(mappingPath);
|
|
8129
|
+
} catch (e) {
|
|
8130
|
+
if (e instanceof MappingError) return premise(`\u5DE5\u4EF6\u88C5\u4E0D\u8FDB\u6765\uFF1A[${e.reason}] ${e.message}`, e.hint);
|
|
8131
|
+
return premise(
|
|
8132
|
+
`\u8BFB\u4E0D\u5230\u5DE5\u4EF6\uFF1A${mappingPath}\uFF08${e instanceof Error ? e.message : String(e)}\uFF09`,
|
|
8133
|
+
"`apply` \u8981\u62FF\u5DE5\u4EF6\u4E0E\u8BA1\u5212\u5BF9\u8D26\uFF08\u6A21\u578B\u6E05\u5355\u4E0E\u4E1A\u52A1\u952E\uFF09\u3002\u5DE5\u4EF6\u5199\u5728\u522B\u5904\u5C31\u7528 `--mapping <\u8DEF\u5F84>` \u6307\u8FC7\u53BB\u3002"
|
|
8134
|
+
);
|
|
8135
|
+
}
|
|
8136
|
+
let journal;
|
|
8137
|
+
try {
|
|
8138
|
+
journal = Journal.load(work);
|
|
8139
|
+
} catch (e) {
|
|
8140
|
+
if (e instanceof JournalError) return premise(`\u53F0\u8D26\u8BFB\u4E0D\u56DE\u6765\uFF1A[${e.reason}] ${e.message}`, e.hint);
|
|
8141
|
+
throw e;
|
|
8142
|
+
}
|
|
8143
|
+
if (journal.exists && !args.resume) {
|
|
8144
|
+
return premise(...existingJournalStop(journal.path, journal.entries.length));
|
|
8145
|
+
}
|
|
8146
|
+
for (const waiver of journal.waivers) {
|
|
8147
|
+
process.stderr.write(
|
|
8148
|
+
WAIVER_REPLAY.replace("{flag}", FORCE_STALE_FLAG).replace("{detail}", describeWaiver(waiver)) + "\n"
|
|
8149
|
+
);
|
|
8150
|
+
}
|
|
8151
|
+
if (plan.baseline !== null) {
|
|
8152
|
+
const [baselineDir] = resolveBaselineDir(out, plan.baseline.path);
|
|
8153
|
+
if (baselineDir !== null) {
|
|
8154
|
+
const round = inspectRound3(baselineDir);
|
|
8155
|
+
const stale = planVsBaselinePremise(
|
|
8156
|
+
plan.baseline.path,
|
|
8157
|
+
plan.baseline.roundId,
|
|
8158
|
+
round.roundId ?? null
|
|
8159
|
+
);
|
|
8160
|
+
if (stale !== null) return premise(stale[0], stale[1]);
|
|
8161
|
+
for (const p of baselineRoundPremise2(round)) {
|
|
8162
|
+
if (!args.execute) {
|
|
8163
|
+
process.stderr.write(DRY_RUN_NOTE.replace("{message}", p.message) + "\n");
|
|
8164
|
+
continue;
|
|
8165
|
+
}
|
|
8166
|
+
return premise(
|
|
8167
|
+
p.message,
|
|
8168
|
+
`\`${FORCE_STALE_FLAG}\` **\u4E0D\u8C41\u514D\u8FD9\u4E00\u6761** \u2014\u2014 \u5B83\u7BA1\u7684\u662F\u300C\u57FA\u7EBF\u5BF9\u4E0D\u5BF9\u5F97\u4E0A\u8FD9\u4E2A\u73AF\u5883\u300D\uFF0C\u800C\u8FD9\u4E00\u6761\u95EE\u7684\u662F\u300C\u8FD9\u4EFD\u57FA\u7EBF**\u81EA\u5DF1**\u662F\u4E0D\u662F\u4E00\u8F6E\u5B8C\u6574\u8DD1\u51FA\u6765\u7684\u300D\uFF0C\u4E24\u4EF6\u4E8B\u3002\u{1F534} \u8FD9\u4E00\u8F6E**\u4E00\u53D1\u5199\u8BF7\u6C42\u90FD\u6CA1\u6709\u53D1\u51FA\u53BB**\uFF08\u95F8\u6392\u5728\u7B2C\u4E00\u4E2A\u5199\u8BF7\u6C42\u4E4B\u524D\uFF0C\u4E5F\u6392\u5728\u62FF\u5355\u5199\u8005\u79DF\u7EA6\u4E4B\u524D\uFF09\uFF0C\u6240\u4EE5\u5E93\u91CC\u6CA1\u6709\u591A\u51FA\u4EFB\u4F55\u884C\uFF0C\u76D8\u4E0A\u4E5F\u6CA1\u6709\u7559\u4E0B\u79DF\u7EA6\u3002`
|
|
8169
|
+
);
|
|
8019
8170
|
}
|
|
8020
8171
|
}
|
|
8021
|
-
}
|
|
8172
|
+
}
|
|
8173
|
+
const [recorded, loadCause] = loadRecordedFingerprint(out, plan.baseline?.path ?? null);
|
|
8174
|
+
const current = await computeFingerprint(client3);
|
|
8175
|
+
const verdict = judgeDrift(recorded, current, { baseline: plan.baseline?.path ?? null, loadCause });
|
|
8176
|
+
let note;
|
|
8177
|
+
try {
|
|
8178
|
+
note = enforceDriftGate(verdict, {
|
|
8179
|
+
journal,
|
|
8180
|
+
roundId: plan.roundId,
|
|
8181
|
+
forced: args.forceStale ?? false,
|
|
8182
|
+
dryRun: !args.execute
|
|
8183
|
+
});
|
|
8184
|
+
} catch (e) {
|
|
8185
|
+
if (e instanceof DriftDetected) return premise(e.verdict.message);
|
|
8186
|
+
if (e instanceof JournalError) {
|
|
8187
|
+
return premise(
|
|
8188
|
+
`\u653E\u884C\u8BB0\u5F55\u843D\u4E0D\u8FDB\u53F0\u8D26\uFF1A[${e.reason}] ${e.message}`,
|
|
8189
|
+
(e.hint ?? "") + " \u{1F534} \u8FD9\u4E00\u8F6E**\u4E00\u53D1\u5199\u8BF7\u6C42\u90FD\u6CA1\u6709\u53D1\u51FA\u53BB**\uFF08\u95F8\u6392\u5728\u7B2C\u4E00\u4E2A\u5199\u8BF7\u6C42\u4E4B\u524D\uFF09\uFF0C\u6240\u4EE5\u5E93\u91CC\u6CA1\u6709\u591A\u51FA\u4EFB\u4F55\u884C\u3002" + journalNote(journal.path)
|
|
8190
|
+
);
|
|
8191
|
+
}
|
|
8192
|
+
throw e;
|
|
8193
|
+
}
|
|
8194
|
+
if (note) process.stderr.write(note + "\n");
|
|
8195
|
+
let lease;
|
|
8196
|
+
try {
|
|
8197
|
+
lease = acquireLease(work, plan.roundId);
|
|
8198
|
+
} catch (e) {
|
|
8199
|
+
if (e instanceof LeaseViolation) return premise(`\u62FF\u4E0D\u5230\u5355\u5199\u8005\u79DF\u7EA6\uFF1A[${e.reason}] ${e.message}`, e.hint);
|
|
8200
|
+
throw e;
|
|
8201
|
+
}
|
|
8202
|
+
if (lease.reclaimed) process.stderr.write(`\u26A0\uFE0F \u56DE\u6536\u4E86\u4E00\u4EFD\u9648\u65E7\u79DF\u7EA6\uFF1A${JSON.stringify(lease.reclaimed)}
|
|
8203
|
+
`);
|
|
8204
|
+
let report;
|
|
8205
|
+
try {
|
|
8206
|
+
report = await applyPlan(client3, plan, mapping, journal, {
|
|
8207
|
+
dryRun: !args.execute,
|
|
8208
|
+
sample: args.sample ?? null,
|
|
8209
|
+
onRequestSpent: lease.heartbeatIfDue.bind(lease)
|
|
8210
|
+
});
|
|
8211
|
+
} catch (e) {
|
|
8212
|
+
if (e instanceof ApplyPremiseError) return premise(`\u6267\u884C\u524D\u63D0\u4E0D\u6210\u7ACB\uFF1A[${e.reason}] ${e.message}`, e.hint);
|
|
8213
|
+
if (e instanceof JournalError) {
|
|
8214
|
+
const [headline, nextStep, whenPresent] = JOURNAL_STOP_KINDS[e.reason] ?? JOURNAL_STOP_UNKNOWN;
|
|
8215
|
+
return premise(
|
|
8216
|
+
`${headline}\uFF08[${e.reason}] ${e.message}\uFF09`,
|
|
8217
|
+
(e.hint ?? "") + " " + nextStep + journalNote(journal.path, whenPresent)
|
|
8218
|
+
);
|
|
8219
|
+
}
|
|
8220
|
+
if (e instanceof ApplyInvariantError) {
|
|
8221
|
+
return premise(
|
|
8222
|
+
`\u8FD9\u4E00\u8F6E**\u505C\u5728\u8FD9\u91CC**\uFF1Akit \u7684\u5185\u90E8\u4E0D\u53D8\u91CF\u88AB\u7834\u574F\uFF08${e.name}: ${e.message}\uFF09`,
|
|
8223
|
+
"\u8FD9\u662F kit \u7684\u7F3A\u9677\uFF0C\u4E0D\u662F\u4F60\u7684\u6570\u636E\u95EE\u9898\u3002**\u522B\u6539\u5DE5\u4EF6\u91CD\u8BD5**\uFF0C\u628A\u8FD9\u6BB5\u4FE1\u606F\u539F\u6837\u62A5\u56DE\u6765\uFF1B\u8981\u4E0D\u8981\u7EED\u8DD1\uFF0C\u7B49\u8FD9\u4E2A\u7F3A\u9677\u4FEE\u597D\u4E4B\u540E\u518D\u8BF4\u3002" + journalNote(
|
|
8224
|
+
journal.path,
|
|
8225
|
+
"\u{1F534} **\u62A5\u56DE\u6765\u65F6\u628A\u5B83\u4E00\u8D77\u5E26\u4E0A** \u2014\u2014 \u8FD9\u4E00\u8F6E\u8D70\u5230\u54EA\u4E00\u884C\u3001\u5199\u51FA\u53BB\u4E86\u4EC0\u4E48\uFF0C\u53EA\u6709\u5B83\u8BF4\u5F97\u51FA\u3002"
|
|
8226
|
+
)
|
|
8227
|
+
);
|
|
8228
|
+
}
|
|
8229
|
+
throw e;
|
|
8230
|
+
} finally {
|
|
8231
|
+
lease.release();
|
|
8232
|
+
}
|
|
8233
|
+
process.stdout.write(applyReportText(report) + "\n");
|
|
8234
|
+
if (report.dryRun) process.stdout.write(DRY_RUN_TAIL + "\n");
|
|
8235
|
+
process.stdout.write(APPLY_CAVEAT + "\n");
|
|
8236
|
+
return applyRc(report);
|
|
8237
|
+
}
|
|
8238
|
+
async function deliverySeedApplyCommand(args) {
|
|
8239
|
+
const ctx = await authOrSignpost(args, "apply");
|
|
8240
|
+
const client3 = HcmClient20.fromAuthContext(ctx);
|
|
8241
|
+
process.exitCode = await runSeedApply(args, seedClient(client3, ctx));
|
|
8242
|
+
}
|
|
8243
|
+
async function runSeedVerify(args, client3) {
|
|
8244
|
+
const out = args.out ?? ".";
|
|
8245
|
+
const tenant2 = tenantOf(client3);
|
|
8246
|
+
const work = seedWorkDir({ out, tenant: tenant2, work: args.work ?? null, mapping: args.mapping ?? null });
|
|
8247
|
+
let delivery2;
|
|
8248
|
+
try {
|
|
8249
|
+
delivery2 = buildDeliveryRun(work);
|
|
8250
|
+
} catch (e) {
|
|
8251
|
+
if (e instanceof JournalError) return premise(`\u53F0\u8D26\u8BFB\u4E0D\u56DE\u6765\uFF1A[${e.reason}] ${e.message}`, e.hint ?? "");
|
|
8252
|
+
throw e;
|
|
8253
|
+
}
|
|
8254
|
+
const recon2 = isZeroNetwork(args) ? notAsked(delivery2) : await buildReconciliation(delivery2, client3);
|
|
8255
|
+
process.stdout.write(verifyText(delivery2, recon2));
|
|
8256
|
+
return verifyRc(delivery2, recon2);
|
|
8257
|
+
}
|
|
8258
|
+
async function deliverySeedVerifyCommand(args) {
|
|
8259
|
+
if (isZeroNetwork(args)) {
|
|
8260
|
+
process.exitCode = await runSeedVerify(args, null);
|
|
8261
|
+
return;
|
|
8262
|
+
}
|
|
8263
|
+
const ctx = await authOrSignpost(args, "verify");
|
|
8264
|
+
const client3 = HcmClient20.fromAuthContext(ctx);
|
|
8265
|
+
process.exitCode = await runSeedVerify(args, seedClient(client3, ctx));
|
|
8022
8266
|
}
|
|
8023
8267
|
|
|
8024
8268
|
// src/commands/delivery-triage.ts
|
|
@@ -8033,7 +8277,7 @@ import {
|
|
|
8033
8277
|
} from "@hcmai/sdk";
|
|
8034
8278
|
import { mkdirSync, readFileSync as readFileSync4, writeFileSync as writeFileSync2 } from "fs";
|
|
8035
8279
|
import * as path8 from "path";
|
|
8036
|
-
var
|
|
8280
|
+
var DEFAULT_CAPABILITIES4 = "default";
|
|
8037
8281
|
function premise2(message, hint) {
|
|
8038
8282
|
process.stderr.write(`\u{1F534} \u524D\u63D0\u4E0D\u6210\u7ACB\uFF1A${message}
|
|
8039
8283
|
`);
|
|
@@ -8083,7 +8327,7 @@ async function runTriage(args) {
|
|
|
8083
8327
|
}
|
|
8084
8328
|
const ctx = await getActiveAuthContextFromCli(args);
|
|
8085
8329
|
const client3 = HcmClient21.fromAuthContext(ctx);
|
|
8086
|
-
const probe = httpProbe3(client3.raw(), args.capabilities ??
|
|
8330
|
+
const probe = httpProbe3(client3.raw(), args.capabilities ?? DEFAULT_CAPABILITIES4);
|
|
8087
8331
|
const artifactsDir = args.recon ?? new ReconLayout2(args.out ?? ".", ctx.tenantId, await computeReconSourceKey2(probe)).dir;
|
|
8088
8332
|
const result = await runTriageRound(probe, artifactsDir, entriesIn);
|
|
8089
8333
|
if (result.body === null) {
|
|
@@ -8831,6 +9075,20 @@ var seed = delivery.command("seed").description(
|
|
|
8831
9075
|
"\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
9076
|
);
|
|
8833
9077
|
seed.command("plan").description("\u96F6\u5199\uFF1A\u8BFB\u5DE5\u4EF6 + \u6E90\u8868 + \u5200 2 \u7684\u57FA\u7EBF\uFF0C\u7B97\u51FA\u884C\u7EA7\u8BA1\u5212\u4E0E\u98CE\u9669\u6E05\u5355\u843D\u76D8\uFF08\u4E00\u53D1\u5199\u8BF7\u6C42\u90FD\u4E0D\u53D1\uFF09").option("--env <name>", "\u76EE\u6807\u73AF\u5883\u522B\u540D").option("--profile <name>", "\u8EAB\u4EFD\u6863\u6848").option("--as <identity>", "\u4E34\u65F6\u6362\u8EAB\u4EFD").option("--out <dir>", "recon \u4EA7\u7269\u6839\uFF08\u57FA\u7EBF\u5728 <out>/recon/<\u79DF\u6237\u6BB5>/<\u6765\u6E90\u6BB5>\uFF09", ".").option("--work <dir>", "work \u76EE\u5F55\uFF1B\u4E0D\u7ED9 \u21D2 <out>/work/<\u79DF\u6237\u6BB5>/").option("--mapping <file>", "\u5BFC\u5165\u6620\u5C04\u5DE5\u4EF6\uFF1B\u4E0D\u7ED9 \u21D2 <work>/mapping.json").option("--source-dir <dir>", "\u6E90\u8868\u6240\u5728\u76EE\u5F55\uFF08\u5DE5\u4EF6\u91CC\u5199\u7684\u662F\u76F8\u5BF9\u8DEF\u5F84\u65F6\u7528\u5B83\uFF09").option("--exemptions <file>", "\u7B7E\u5B57\u8C41\u514D\u53F0\u8D26\uFF08JSON \u6570\u7EC4\uFF09\uFF1B\u4E0D\u4F20\u4E0E\u4F20\u4E00\u4EFD\u7A7A\u53F0\u8D26\u662F\u4E24\u4E2A\u503C").action((opts) => deliverySeedPlanCommand(opts));
|
|
9078
|
+
seed.command("apply").description(
|
|
9079
|
+
"\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`"
|
|
9080
|
+
).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(
|
|
9081
|
+
"--force-stale",
|
|
9082
|
+
"\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",
|
|
9083
|
+
false
|
|
9084
|
+
).action((opts) => deliverySeedApplyCommand(opts));
|
|
9085
|
+
seed.command("verify").description(
|
|
9086
|
+
"\u628A\u4E24\u5C42\u8BC1\u636E\uFF08\u53F0\u8D26+\u8BA1\u5212 / \u5E93\u91CC\u73B0\u5728\u600E\u4E48\u6837\uFF09\u6E32\u67D3\u6210\u4E00\u9875\u53EF\u7B7E\u5B57\u7684\u7EB8\uFF0C\u518D\u7ED9\u4E00\u4E2A\u9000\u51FA\u7801\u3002\u6C14\u9699\u673A\u5668\u4E0A\u7528 `--ledger-only`\uFF1A\u53EA\u51FA\u53F0\u8D26\u90A3\u4E00\u5C42\uFF0C\u4E00\u53D1\u8BF7\u6C42\u90FD\u4E0D\u53D1"
|
|
9087
|
+
).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", ".").option("--work <dir>", "work \u76EE\u5F55\uFF1B\u4E0D\u7ED9 \u21D2 <out>/work/<\u79DF\u6237\u6BB5>/").option(
|
|
9088
|
+
LEDGER_ONLY_FLAG,
|
|
9089
|
+
"\u53EA\u51FA\u53F0\u8D26\u90A3\u4E00\u5C42\uFF08\u96F6\u7F51\u7EDC\uFF0C\u4E00\u53D1\u8BF7\u6C42\u90FD\u4E0D\u53D1\uFF09\u3002\u26A0\uFE0F **\u5E93\u91CC\u73B0\u5728\u600E\u4E48\u6837\uFF0C\u90A3\u4E00\u8D9F\u4E00\u4E2A\u5B57\u90FD\u6CA1\u95EE** \u2014\u2014 \u522B\u62FF\u5B83\u5F53\u9A8C\u6536\u901A\u8FC7",
|
|
9090
|
+
false
|
|
9091
|
+
).action((opts) => deliverySeedVerifyCommand(opts));
|
|
8834
9092
|
delivery.command("gate0").description(
|
|
8835
9093
|
"\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"
|
|
8836
9094
|
).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(
|
|
@@ -8852,7 +9110,7 @@ program.command("query <Model>").description("\u67E5\u8BE2 Model \u5217\u8868\u6
|
|
|
8852
9110
|
"--filter <JSON>",
|
|
8853
9111
|
`\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`
|
|
8854
9112
|
).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));
|
|
8855
|
-
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
|
|
9113
|
+
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));
|
|
8856
9114
|
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));
|
|
8857
9115
|
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));
|
|
8858
9116
|
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));
|