feat: install development build globally
This commit is contained in:
1 parent
7cfb68e434
commit
3e072b490e
9 files changed
+249
-9
No files matched your search
+22
-5
@@ -53,6 +53,7 @@ export async function runAiProCli(rawArgs: string[]): Promise<{ stdout: string;
|
||||
}
|
||||
|
||||
const command = (positional[0] || "help").toLowerCase();
|
||||
const jsonMode = booleanOption(parsed.options, ["json", "j"]);
|
||||
const targetSn = positional[1] || stringOption(parsed.options, ["code", "sn", "id", "target"]);
|
||||
const args = positional.slice(1);
|
||||
const corpId = corp?.corpId || corp?.id;
|
||||
@@ -73,6 +74,16 @@ export async function runAiProCli(rawArgs: string[]): Promise<{ stdout: string;
|
||||
};
|
||||
|
||||
try {
|
||||
if (command === "version" || command === "v" || booleanOption(parsed.options, ["version", "v"])) {
|
||||
return {
|
||||
stdout: jsonMode
|
||||
? printJson({ name: "hose-aipro", version: VERSION }) + "\n"
|
||||
: `hose-aipro v${VERSION}\n`,
|
||||
stderr: "",
|
||||
exitCode: 0,
|
||||
};
|
||||
}
|
||||
|
||||
switch (command) {
|
||||
// ── 0. 运行时上下文与身份诊断 (status / whoami / context / info) ────────
|
||||
case "status":
|
||||
@@ -1136,7 +1147,11 @@ ${corpBanner}
|
||||
7. 全流程监控日志流水查看:
|
||||
hose-aipro logs [单号] # 追溯所有 AI PRO 操作流水
|
||||
`;
|
||||
return { stdout: helpText.trim() + "\n", stderr: "", exitCode: 0 };
|
||||
return {
|
||||
stdout: jsonMode ? printJson({ help: helpText.trim() }) + "\n" : helpText.trim() + "\n",
|
||||
stderr: "",
|
||||
exitCode: 0,
|
||||
};
|
||||
}
|
||||
}
|
||||
} catch (err: any) {
|
||||
@@ -1151,8 +1166,8 @@ ${corpBanner}
|
||||
summary: err.message.replace(/\n+/g, " "),
|
||||
});
|
||||
return {
|
||||
stdout: "",
|
||||
stderr: `\n${err.message}\n`,
|
||||
stdout: jsonMode ? printJson({ error: true, message: err.message, exitCode: 1 }) + "\n" : "",
|
||||
stderr: jsonMode ? "" : `\n${err.message}\n`,
|
||||
exitCode: 1,
|
||||
};
|
||||
}
|
||||
@@ -1167,8 +1182,10 @@ ${corpBanner}
|
||||
});
|
||||
|
||||
return {
|
||||
stdout: "",
|
||||
stderr: `[AI PRO 错误] ${err?.message || err}\n`,
|
||||
stdout: jsonMode
|
||||
? printJson({ error: true, message: String(err?.message || err), exitCode: 1 }) + "\n"
|
||||
: "",
|
||||
stderr: jsonMode ? "" : `[AI PRO 错误] ${err?.message || err}\n`,
|
||||
exitCode: 1,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user