@cleocode/cleo 2026.6.0 → 2026.6.2
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/cli/index.js +46 -23
- package/dist/cli/index.js.map +3 -3
- package/package.json +14 -14
package/dist/cli/index.js
CHANGED
|
@@ -56675,16 +56675,18 @@ var init_llm3 = __esm({
|
|
|
56675
56675
|
const a = args;
|
|
56676
56676
|
const provider = String(a["provider"] ?? "");
|
|
56677
56677
|
const label = typeof a["label"] === "string" && a["label"] ? a["label"] : void 0;
|
|
56678
|
-
const jsonOutput = a["json"] === true;
|
|
56679
56678
|
const result = await runLlmLogin(provider, { label });
|
|
56680
|
-
if (
|
|
56681
|
-
|
|
56682
|
-
|
|
56683
|
-
|
|
56684
|
-
|
|
56685
|
-
|
|
56686
|
-
|
|
56687
|
-
|
|
56679
|
+
if (result.success && result.data) {
|
|
56680
|
+
if (isHumanOutput()) {
|
|
56681
|
+
humanLine(
|
|
56682
|
+
`Logged in to ${result.data.provider} as '${result.data.label}'` + (result.data.expiresIn != null ? ` (expires in ${Math.round(result.data.expiresIn / 60)} min)` : "")
|
|
56683
|
+
);
|
|
56684
|
+
} else {
|
|
56685
|
+
cliOutput(result.data, { command: "llm-login", operation: "llm.login" });
|
|
56686
|
+
}
|
|
56687
|
+
return;
|
|
56688
|
+
}
|
|
56689
|
+
if (result.error) {
|
|
56688
56690
|
cliError(
|
|
56689
56691
|
result.error.message,
|
|
56690
56692
|
result.error.code || 1,
|
|
@@ -56706,19 +56708,20 @@ var init_llm3 = __esm({
|
|
|
56706
56708
|
description: "Output result as JSON"
|
|
56707
56709
|
}
|
|
56708
56710
|
},
|
|
56709
|
-
async run(
|
|
56710
|
-
const jsonOutput = args["json"] === true;
|
|
56711
|
+
async run() {
|
|
56711
56712
|
const result = await runLlmRefreshCatalog();
|
|
56712
|
-
if (
|
|
56713
|
-
process.stdout.write(`${JSON.stringify(result, null, 2)}
|
|
56714
|
-
`);
|
|
56715
|
-
} else if (result.success && result.data) {
|
|
56713
|
+
if (result.success && result.data) {
|
|
56716
56714
|
const d = result.data;
|
|
56717
|
-
|
|
56718
|
-
|
|
56719
|
-
`
|
|
56720
|
-
|
|
56721
|
-
|
|
56715
|
+
if (isHumanOutput()) {
|
|
56716
|
+
humanLine(
|
|
56717
|
+
`Catalog refreshed: ${d.providers} providers, ${d.models} models written to ${d.filePath}`
|
|
56718
|
+
);
|
|
56719
|
+
} else {
|
|
56720
|
+
cliOutput(result.data, { command: "llm-refresh-catalog", operation: "llm.refreshCatalog" });
|
|
56721
|
+
}
|
|
56722
|
+
return;
|
|
56723
|
+
}
|
|
56724
|
+
if (!result.success) {
|
|
56722
56725
|
cliError(
|
|
56723
56726
|
result.error?.message ?? "refresh failed",
|
|
56724
56727
|
result.error?.code ?? 1,
|
|
@@ -75791,15 +75794,34 @@ async function maybePromptFirstRun() {
|
|
|
75791
75794
|
}
|
|
75792
75795
|
}
|
|
75793
75796
|
|
|
75797
|
+
// packages/cleo/src/cli/lib/interactive-commands.ts
|
|
75798
|
+
var INTERACTIVE_COMMAND_PATHS = [
|
|
75799
|
+
["llm", "login"],
|
|
75800
|
+
["llm", "add"],
|
|
75801
|
+
["llm", "refresh-catalog"],
|
|
75802
|
+
["login"],
|
|
75803
|
+
["auth", "login"],
|
|
75804
|
+
["setup"],
|
|
75805
|
+
["init"]
|
|
75806
|
+
];
|
|
75807
|
+
function isInteractiveInvocation(argv) {
|
|
75808
|
+
const positionals = argv.filter((token) => !token.startsWith("-"));
|
|
75809
|
+
if (positionals.length === 0) return false;
|
|
75810
|
+
return INTERACTIVE_COMMAND_PATHS.some(
|
|
75811
|
+
(path6) => path6.length <= positionals.length && path6.every((seg, i) => seg === positionals[i])
|
|
75812
|
+
);
|
|
75813
|
+
}
|
|
75814
|
+
|
|
75794
75815
|
// packages/cleo/src/cli/middleware/output-format.ts
|
|
75795
75816
|
import { resolveOutputFormat } from "@cleocode/lafs";
|
|
75796
|
-
function resolveFormat(opts, defaults) {
|
|
75817
|
+
function resolveFormat(opts, defaults, tty) {
|
|
75797
75818
|
const input2 = {
|
|
75798
75819
|
jsonFlag: opts["json"] === true,
|
|
75799
75820
|
humanFlag: opts["human"] === true,
|
|
75800
75821
|
quiet: opts["quiet"] === true,
|
|
75801
75822
|
projectDefault: defaults?.projectDefault,
|
|
75802
|
-
userDefault: defaults?.userDefault
|
|
75823
|
+
userDefault: defaults?.userDefault,
|
|
75824
|
+
tty
|
|
75803
75825
|
};
|
|
75804
75826
|
return resolveOutputFormat(input2);
|
|
75805
75827
|
}
|
|
@@ -75890,7 +75912,8 @@ async function startCli() {
|
|
|
75890
75912
|
else if (arg === "--output" && i + 1 < argv.length) outputModeRaw = argv[++i];
|
|
75891
75913
|
else if (arg === "--summary") summaryFlag = true;
|
|
75892
75914
|
}
|
|
75893
|
-
const
|
|
75915
|
+
const interactiveTty = isInteractiveInvocation(argv) && process.stdout.isTTY === true;
|
|
75916
|
+
const formatResolution = resolveFormat(rawOpts, void 0, interactiveTty);
|
|
75894
75917
|
setFormatContext(formatResolution);
|
|
75895
75918
|
const fieldResolution = resolveFieldContext(rawOpts);
|
|
75896
75919
|
if (fieldResolution.mviSource === "default") {
|