refactor: polish CLI theme + progress helpers
This commit is contained in:
@@ -4,7 +4,7 @@ import {
|
||||
type ModelScanResult,
|
||||
scanOpenRouterModels,
|
||||
} from "../../agents/model-scan.js";
|
||||
import { withProgress } from "../../cli/progress.js";
|
||||
import { withProgressTotals } from "../../cli/progress.js";
|
||||
import { CONFIG_PATH_CLAWDBOT, loadConfig } from "../../config/config.js";
|
||||
import type { RuntimeEnv } from "../../runtime.js";
|
||||
import { formatMs, formatTokenK, updateConfig } from "./shared.js";
|
||||
@@ -189,13 +189,13 @@ export async function modelsScanCommand(
|
||||
storedKey = undefined;
|
||||
}
|
||||
}
|
||||
const results = await withProgress(
|
||||
const results = await withProgressTotals(
|
||||
{
|
||||
label: "Scanning OpenRouter models...",
|
||||
indeterminate: false,
|
||||
enabled: opts.json !== true,
|
||||
},
|
||||
async (progress) =>
|
||||
async (update) =>
|
||||
await scanOpenRouterModels({
|
||||
apiKey: storedKey ?? undefined,
|
||||
minParamB: minParams,
|
||||
@@ -206,10 +206,12 @@ export async function modelsScanCommand(
|
||||
probe,
|
||||
onProgress: ({ phase, completed, total }) => {
|
||||
if (phase !== "probe") return;
|
||||
if (total <= 0) return;
|
||||
const labelBase = probe ? "Probing models" : "Scanning models";
|
||||
progress.setLabel(`${labelBase} (${completed}/${total})`);
|
||||
progress.setPercent((completed / total) * 100);
|
||||
update({
|
||||
completed,
|
||||
total,
|
||||
label: `${labelBase} (${completed}/${total})`,
|
||||
});
|
||||
},
|
||||
}),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user