feat: apply lobster palette to prompts
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
import { spawnSync } from "node:child_process";
|
||||
|
||||
import { confirm, select, text } from "@clack/prompts";
|
||||
import {
|
||||
confirm as clackConfirm,
|
||||
select as clackSelect,
|
||||
text as clackText,
|
||||
} from "@clack/prompts";
|
||||
|
||||
import {
|
||||
CLAUDE_CLI_PROFILE_ID,
|
||||
@@ -11,9 +15,34 @@ import { normalizeProviderId } from "../../agents/model-selection.js";
|
||||
import { parseDurationMs } from "../../cli/parse-duration.js";
|
||||
import { CONFIG_PATH_CLAWDBOT } from "../../config/config.js";
|
||||
import type { RuntimeEnv } from "../../runtime.js";
|
||||
import {
|
||||
stylePromptHint,
|
||||
stylePromptMessage,
|
||||
} from "../../terminal/prompt-style.js";
|
||||
import { applyAuthProfileConfig } from "../onboard-auth.js";
|
||||
import { updateConfig } from "./shared.js";
|
||||
|
||||
const confirm = (params: Parameters<typeof clackConfirm>[0]) =>
|
||||
clackConfirm({
|
||||
...params,
|
||||
message: stylePromptMessage(params.message),
|
||||
});
|
||||
const text = (params: Parameters<typeof clackText>[0]) =>
|
||||
clackText({
|
||||
...params,
|
||||
message: stylePromptMessage(params.message),
|
||||
});
|
||||
const select = <T>(params: Parameters<typeof clackSelect<T>>[0]) =>
|
||||
clackSelect({
|
||||
...params,
|
||||
message: stylePromptMessage(params.message),
|
||||
options: params.options.map((opt) =>
|
||||
opt.hint === undefined
|
||||
? opt
|
||||
: { ...opt, hint: stylePromptHint(opt.hint) },
|
||||
),
|
||||
});
|
||||
|
||||
type TokenProvider = "anthropic";
|
||||
|
||||
function resolveTokenProvider(raw?: string): TokenProvider | "custom" | null {
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
import { cancel, isCancel, multiselect } from "@clack/prompts";
|
||||
import {
|
||||
cancel,
|
||||
isCancel,
|
||||
multiselect as clackMultiselect,
|
||||
} from "@clack/prompts";
|
||||
import { resolveApiKeyForProvider } from "../../agents/model-auth.js";
|
||||
import {
|
||||
type ModelScanResult,
|
||||
@@ -7,11 +11,27 @@ import {
|
||||
import { withProgressTotals } from "../../cli/progress.js";
|
||||
import { CONFIG_PATH_CLAWDBOT, loadConfig } from "../../config/config.js";
|
||||
import type { RuntimeEnv } from "../../runtime.js";
|
||||
import {
|
||||
stylePromptHint,
|
||||
stylePromptMessage,
|
||||
stylePromptTitle,
|
||||
} from "../../terminal/prompt-style.js";
|
||||
import { formatMs, formatTokenK, updateConfig } from "./shared.js";
|
||||
|
||||
const MODEL_PAD = 42;
|
||||
const CTX_PAD = 8;
|
||||
|
||||
const multiselect = <T>(params: Parameters<typeof clackMultiselect<T>>[0]) =>
|
||||
clackMultiselect({
|
||||
...params,
|
||||
message: stylePromptMessage(params.message),
|
||||
options: params.options.map((opt) =>
|
||||
opt.hint === undefined
|
||||
? opt
|
||||
: { ...opt, hint: stylePromptHint(opt.hint) },
|
||||
),
|
||||
});
|
||||
|
||||
const pad = (value: string, size: number) => value.padEnd(size);
|
||||
|
||||
const truncate = (value: string, max: number) => {
|
||||
@@ -268,7 +288,7 @@ export async function modelsScanCommand(
|
||||
});
|
||||
|
||||
if (isCancel(selection)) {
|
||||
cancel("Model scan cancelled.");
|
||||
cancel(stylePromptTitle("Model scan cancelled.") ?? "Model scan cancelled.");
|
||||
runtime.exit(0);
|
||||
}
|
||||
|
||||
@@ -285,7 +305,9 @@ export async function modelsScanCommand(
|
||||
});
|
||||
|
||||
if (isCancel(imageSelection)) {
|
||||
cancel("Model scan cancelled.");
|
||||
cancel(
|
||||
stylePromptTitle("Model scan cancelled.") ?? "Model scan cancelled.",
|
||||
);
|
||||
runtime.exit(0);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user