@hcmai/cli 0.15.2 → 0.15.3
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 +24 -8
- package/dist/index.js.map +1 -1
- package/dist/skills/manifest.json +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -2085,7 +2085,7 @@ __export(run_exports, {
|
|
|
2085
2085
|
});
|
|
2086
2086
|
import React3 from "react";
|
|
2087
2087
|
import { render } from "ink";
|
|
2088
|
-
import { HcmClient as HcmClient10, WsClient, DEFAULT_AGENT_ID as DEFAULT_AGENT_ID2, assertDangerWrite } from "@hcmai/sdk";
|
|
2088
|
+
import { HcmClient as HcmClient10, WsClient, DEFAULT_AGENT_ID as DEFAULT_AGENT_ID2, assertDangerWrite, conversationWebSocketEndpoint } from "@hcmai/sdk";
|
|
2089
2089
|
async function runInkRepl(args) {
|
|
2090
2090
|
if (process.stdout.isTTY) {
|
|
2091
2091
|
process.stdout.write("\x1B[>4;1m");
|
|
@@ -2096,7 +2096,7 @@ async function runInkRepl(args) {
|
|
|
2096
2096
|
assertDangerWrite(ctx.environmentSafety, "\u542F\u52A8\u4EA4\u4E92\u4F1A\u8BDD\uFF08\u53EF\u80FD\u6267\u884C\u4E1A\u52A1\u5199\u5165\uFF09");
|
|
2097
2097
|
const client3 = HcmClient10.fromAuthContext(ctx);
|
|
2098
2098
|
const ws = new WsClient({
|
|
2099
|
-
endpoint: ctx.endpoint
|
|
2099
|
+
endpoint: conversationWebSocketEndpoint(ctx.endpoint),
|
|
2100
2100
|
getAccessToken: () => client3.getAccessToken(),
|
|
2101
2101
|
onTokenExpiring: () => client3.handleRefresh()
|
|
2102
2102
|
});
|
|
@@ -4589,6 +4589,7 @@ init_auth_guard();
|
|
|
4589
4589
|
import {
|
|
4590
4590
|
HcmClient as HcmClient11,
|
|
4591
4591
|
WsClient as WsClient2,
|
|
4592
|
+
conversationWebSocketEndpoint as conversationWebSocketEndpoint2,
|
|
4592
4593
|
assertDangerWrite as assertDangerWrite2,
|
|
4593
4594
|
oneShot,
|
|
4594
4595
|
sendMessageAndStream as sendMessageAndStream2,
|
|
@@ -4940,7 +4941,7 @@ async function chatCommand(prompt, args) {
|
|
|
4940
4941
|
const injectOn = args.injectOn ? parseInjectOn(args.injectOn) : void 0;
|
|
4941
4942
|
const ctx = await getActiveAuthContextFromCli(args);
|
|
4942
4943
|
assertDangerWrite2(ctx.environmentSafety, "\u53D1\u9001\u6216\u7EE7\u7EED\u4F1A\u8BDD\uFF08\u53EF\u80FD\u6267\u884C\u4E1A\u52A1\u5199\u5165\uFF09");
|
|
4943
|
-
const wsUrl = ctx.endpoint
|
|
4944
|
+
const wsUrl = conversationWebSocketEndpoint2(ctx.endpoint);
|
|
4944
4945
|
const client3 = HcmClient11.fromAuthContext(ctx);
|
|
4945
4946
|
const stateKey = ctx.env;
|
|
4946
4947
|
const agentId = args.agent ?? DEFAULT_AGENT_ID3;
|
|
@@ -11427,6 +11428,8 @@ import {
|
|
|
11427
11428
|
fetchReconIdentity as fetchReconIdentity2,
|
|
11428
11429
|
formatObject as formatObject24,
|
|
11429
11430
|
httpProbe as httpProbe2,
|
|
11431
|
+
conversationWebSocketEndpoint as conversationWebSocketEndpoint3,
|
|
11432
|
+
probeConversationHandshake,
|
|
11430
11433
|
runDoctor
|
|
11431
11434
|
} from "@hcmai/sdk";
|
|
11432
11435
|
var defaultDeps2 = {
|
|
@@ -11435,7 +11438,11 @@ var defaultDeps2 = {
|
|
|
11435
11438
|
const client3 = HcmClient21.fromAuthContext(ctx);
|
|
11436
11439
|
const probe = httpProbe2(client3.raw(), "default");
|
|
11437
11440
|
const identity2 = await fetchReconIdentity2(probe, tenant2);
|
|
11438
|
-
|
|
11441
|
+
const report = await runDoctor(probe, identity2, () => probeConversationHandshake({
|
|
11442
|
+
endpoint: conversationWebSocketEndpoint3(ctx.endpoint),
|
|
11443
|
+
getAccessToken: () => client3.getAccessToken()
|
|
11444
|
+
}));
|
|
11445
|
+
return { report, tokenTenant: identity2?.tenantId ? String(identity2.tenantId) : void 0 };
|
|
11439
11446
|
},
|
|
11440
11447
|
inspectCases: () => inspectCaseLibrary(),
|
|
11441
11448
|
inspectJira: () => inspectJira()
|
|
@@ -11478,7 +11485,8 @@ async function runChironDoctor(args, deps = defaultDeps2) {
|
|
|
11478
11485
|
for (const name of targets) {
|
|
11479
11486
|
const env3 = file.environments[name];
|
|
11480
11487
|
const isDefault = name === file.default;
|
|
11481
|
-
const
|
|
11488
|
+
const selected = isDefault || args.env !== void 0;
|
|
11489
|
+
const severity = () => selected ? "fail" : "warn";
|
|
11482
11490
|
const label = `${name}${isDefault ? "\uFF08default\uFF09" : ""}${env3.danger ? " \xB7 danger" : ""}`;
|
|
11483
11491
|
const found = await findEnvByEndpoint3(env3.endpoint, env3.tenant);
|
|
11484
11492
|
const loginCmd = names.length > 1 ? `hcm login --env ${name}` : `hcm login ${env3.endpoint}`;
|
|
@@ -11486,11 +11494,12 @@ async function runChironDoctor(args, deps = defaultDeps2) {
|
|
|
11486
11494
|
report.lines.push({ item: "\u767B\u5F55", verdict: severity(), detail: `${label} \xB7 \u672C\u673A\u6CA1\u6709\u767B\u5F55\u8FC7 ${env3.endpoint}`, nextStep: loginCmd });
|
|
11487
11495
|
continue;
|
|
11488
11496
|
}
|
|
11489
|
-
if (
|
|
11497
|
+
if (selected) report.envName = found.name;
|
|
11490
11498
|
try {
|
|
11491
11499
|
const targetEnv = name;
|
|
11492
11500
|
const { report: anchors, tokenTenant: tokenTenant2 } = await deps.anchors(targetEnv, env3.tenant, args.as);
|
|
11493
|
-
if (
|
|
11501
|
+
if (selected) report.anchors = anchors;
|
|
11502
|
+
(report.environmentAnchors ??= {})[name] = anchors;
|
|
11494
11503
|
const tenantMismatch = tokenTenant2 && tokenTenant2 !== env3.tenant;
|
|
11495
11504
|
const bad = anchors.checks.filter((c) => !c.ok && !(tenantMismatch && c.anchor === "identity"));
|
|
11496
11505
|
if (bad.length === 0 && !tenantMismatch) {
|
|
@@ -11567,6 +11576,13 @@ function renderChironDoctor(report) {
|
|
|
11567
11576
|
out.push(`${mark[l.verdict]} ${l.item.padEnd(3, "\u3000")} ${l.detail}`);
|
|
11568
11577
|
if (l.nextStep && l.verdict !== "ok") out.push(` \u2192 ${l.nextStep}`);
|
|
11569
11578
|
}
|
|
11579
|
+
const environments = report.environmentAnchors ?? (report.anchors ? { default: report.anchors } : {});
|
|
11580
|
+
for (const [name, anchors] of Object.entries(environments)) {
|
|
11581
|
+
for (const check of anchors.checks) {
|
|
11582
|
+
out.push(`${check.ok ? mark.ok : mark.fail} ${name} \xB7 ${check.anchor} ${check.detail}`);
|
|
11583
|
+
if (check.nextStep) out.push(` \u2192 ${check.nextStep}`);
|
|
11584
|
+
}
|
|
11585
|
+
}
|
|
11570
11586
|
out.push("");
|
|
11571
11587
|
out.push(report.ok ? "\u53EF\u4EE5\u5F00\u5DE5\uFF1A\u5728\u8FD9\u4E2A\u76EE\u5F55\u91CC\u542F\u52A8 codex\u3002" : "\u5148\u6309 \u2192 \u5904\u7406\u7EA2\u9879\uFF0C\u518D\u8DD1\u4E00\u6B21 hcm chiron doctor\u3002");
|
|
11572
11588
|
return out.join("\n");
|
|
@@ -14035,7 +14051,7 @@ chiron.command("init").description("\u5EFA\u987E\u95EE\u9879\u76EE\u4ED3\uFF1A\u
|
|
|
14035
14051
|
chiron.command("test").description("\u6309\u7528\u4F8B\u8DD1\u4E00\u904D\u5E76\u628A\u95EE\u9898\u627E\u51FA\u6765\uFF1A\u7528\u4F8B\u5728\u9879\u76EE\u4ED3 tests/\uFF0C\u5224\u636E\u5FC5\u987B\u770B\u5185\u5BB9\uFF08\u53EA\u5224\u9000\u51FA\u7801\u7684\u7528\u4F8B\u4F1A\u88AB\u62D2\u7EDD\u52A0\u8F7D\uFF09").argument("[target]", "\u7528\u4F8B\u6587\u4EF6\u6216\u76EE\u5F55\uFF08\u9ED8\u8BA4 tests/\uFF09").option("--project <dir>", "\u9879\u76EE\u6839\u76EE\u5F55", ".").option("--env <name>", "\u76EE\u6807\u73AF\u5883\uFF1B\u7528\u4F8B\u91CC\u6CA1\u5199 --env \u65F6\u8865\u4E0A").option("--as <identity>", "\u8EAB\u4EFD\uFF1B\u7528\u4F8B\u91CC\u6CA1\u5199 --as \u65F6\u8865\u4E0A").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "table").action((target, opts) => chironTestCommand(target, opts));
|
|
14036
14052
|
chiron.command("page").description("\u6253\u5F00\u9875\u9762\u622A\u56FE\u5E76\u5BF9\u7740\u9875\u9762\u5185\u5BB9\u5224\u4E00\u6B21\uFF1A\u81F3\u5C11\u8981\u7ED9\u4E00\u6761 --expect-text\uFF0C\u53EA\u622A\u56FE\u4E0D\u7B97\u9A8C\u6536").argument("<\u8DEF\u5F84>", "\u7AD9\u5185\u8DEF\u5F84\uFF0C\u5982 /dashboard/xxx").requiredOption("--out <file>", "\u622A\u56FE\u843D\u70B9\uFF0C\u5FC5\u987B\u5728\u9879\u76EE\u7684 evidence/ \u4E0B\u4E14\u4EE5 .png \u7ED3\u5C3E").option("--expect-text <text...>", "\u9875\u9762\u4E0A\u5FC5\u987B\u51FA\u73B0\u7684\u6587\u672C\uFF08\u81F3\u5C11\u4E00\u6761\uFF09").option("--reject-text <text...>", "\u9875\u9762\u4E0A\u4E0D\u5F97\u51FA\u73B0\u7684\u6587\u672C").option("--project <dir>", "\u9879\u76EE\u6839\u76EE\u5F55", ".").option("--env <name>", "\u9879\u76EE\u73AF\u5883\u540D\u6216\u672C\u673A\u69FD\u540D").option("--as <identity>", "\u4E34\u65F6\u6362\u8EAB\u4EFD").option("--wait-ms <ms>", "\u9875\u9762\u6E32\u67D3\u9884\u7B97\u6BEB\u79D2\u6570", "10000").option("--size <WxH>", "\u89C6\u53E3\u5C3A\u5BF8", "1440x900").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "table").action((target, opts) => chironPageCommand(target, opts));
|
|
14037
14053
|
chiron.command("doctor").description(
|
|
14038
|
-
"\u6838\u5BF9\uFF1A\u672C\u673A\u767B\u5F55\u662F\u5426\u5BF9\u7740 env.yaml \u7684\u73AF\u5883\uFF08\u542B\
|
|
14054
|
+
"\u6838\u5BF9\uFF1A\u672C\u673A\u767B\u5F55\u662F\u5426\u5BF9\u7740 env.yaml \u7684\u73AF\u5883\uFF08\u542B\u4E94\u6761\u951A\u70B9\u4E0E\u5BF9\u8BDD\u63E1\u624B\uFF09/ \u6280\u80FD\u88C5\u6CA1\u88C5 / \u6848\u4F8B\u5E93\u8BFB\u4E0D\u8BFB\u5F97\u5230 / Jira \u80FD\u4E0D\u80FD\u63D0\u5355"
|
|
14039
14055
|
).option("--project <dir>", "\u9879\u76EE\u6839\u76EE\u5F55", ".").option("--env <name>", "\u8986\u76D6\u8981\u6838\u7684\u73AF\u5883\u522B\u540D\uFF08\u9ED8\u8BA4\u53D6 env.yaml\uFF1B\u591A\u73AF\u5883\u9879\u76EE\u7528\u5B83\u6328\u4E2A\u63A2\uFF09").option("--as <identity>", "\u4E34\u65F6\u6362\u8EAB\u4EFD\u63A2\u951A\u70B9").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "table").action((opts) => chironDoctorCommand(opts));
|
|
14040
14056
|
var chironSkills = chiron.command("skills").description("\u8FD9\u4E2A\u9879\u76EE\u4ED3\u7684\u6280\u80FD\uFF1A\u8DDF\u76EE\u6807\u73AF\u5883\u5BF9\u9F50");
|
|
14041
14057
|
chironSkills.command("sync").description("\u8BA9\u8FD9\u4E2A\u4ED3\u7684\u6280\u80FD\u8DDF\u76EE\u6807\u73AF\u5883\u5BF9\u9F50\uFF1A\u7B2C\u4E00\u6B21\u5C31\u88C5\u9F50\uFF0C\u4E4B\u540E\u6309\u4EA7\u54C1\u5F53\u524D\u5168\u96C6\u5BF9\u8D26\u3002\u5E42\u7B49\uFF0C\u4EA7\u54C1\u5347\u7EA7\u540E\u8DD1\u5B83").option("--only <id...>", "\u53EA\u8981\u8FD9\u51E0\u4E2A\u6280\u80FD\uFF08\u8FDE\u540C requires \u524D\u7F6E\uFF09\uFF0C\u4E0D\u8BA2\u9605\u5168\u96C6\uFF1B\u8BAD\u7EC3\u573A blind \u6863\u7528").option("--check", "\u53EA\u770B\u4F1A\u53D8\u4EC0\u4E48\uFF0C\u4E0D\u5199\u76D8").option("--target <agent>", "claude\uFF08.claude/skills/\uFF09| codex\uFF08hcm-skills/ + Agent \u7D22\u5F15\uFF09| auto", "auto").option("--global", "\u540C\u6B65\u7528\u6237\u7EA7\u76EE\u5F55\u800C\u975E\u5F53\u524D\u9879\u76EE").option("--dir <path>", "\u540C\u6B65\u6307\u5B9A\u76EE\u5F55").option("--from <dir>", "\u4ECE\u672C\u5730\u76EE\u5F55\u53D6\uFF08\u73B0\u573A\u6539\u8FC7\u7684\u7248\u672C\uFF09\uFF0C\u4E0D\u8D70\u7F51\u7EDC").option("--force", "\u8FDE\u672C\u5730\u6539\u8FC7\u7684\u6280\u80FD\u4E00\u8D77\u8986\u76D6\u6210\u4EA7\u54C1\u8FD9\u4E00\u7248").option("--prune-max <n>", `\u4E00\u8D9F\u6700\u591A\u6E05\u51E0\u4EFD\u4E0A\u6E38\u4E0D\u518D\u53D1\u7684\u6280\u80FD\uFF0C\u8D85\u4E86\u6574\u6279\u62D2\u7EDD\uFF1B0 = \u4E00\u4EFD\u90FD\u522B\u6E05\uFF08\u7F3A\u7701 ${PRUNE_DEFAULT_MAX}\uFF09`).option("--source <kind>", "\u8FD9\u4E00\u8D9F\u770B\u54EA\u4E9B\u6765\u6E90\uFF1Acli\uFF08\u53EA\u770B\u81EA\u5E26\uFF0C\u4E0D\u8FDE\u7F51\uFF09| chiron | all", "all").option("--endpoint <url>", "\u6280\u80FD\u5E93\u5730\u5740\uFF08\u9ED8\u8BA4\u53D6\u9879\u76EE\u73AF\u5883\u6216\u5B89\u88C5\u65F6\u8BB0\u5F55\u7684\u5730\u5740\uFF09").option("--env <name>", "\u4ECE\u8BE5 env \u89E3\u6790 endpoint").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "table").action((opts) => skillsSyncCommand(opts));
|