feat: apply lobster palette to prompts
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
import path from "node:path";
|
||||
|
||||
import {
|
||||
confirm,
|
||||
intro,
|
||||
multiselect,
|
||||
note,
|
||||
outro,
|
||||
select,
|
||||
confirm as clackConfirm,
|
||||
intro as clackIntro,
|
||||
multiselect as clackMultiselect,
|
||||
note as clackNote,
|
||||
outro as clackOutro,
|
||||
select as clackSelect,
|
||||
spinner,
|
||||
text,
|
||||
text as clackText,
|
||||
} from "@clack/prompts";
|
||||
import {
|
||||
loginOpenAICodex,
|
||||
@@ -39,6 +39,11 @@ import { ensureControlUiAssetsBuilt } from "../infra/control-ui-assets.js";
|
||||
import type { RuntimeEnv } from "../runtime.js";
|
||||
import { defaultRuntime } from "../runtime.js";
|
||||
import { theme } from "../terminal/theme.js";
|
||||
import {
|
||||
stylePromptHint,
|
||||
stylePromptMessage,
|
||||
stylePromptTitle,
|
||||
} from "../terminal/prompt-style.js";
|
||||
import { resolveUserPath, sleep } from "../utils.js";
|
||||
import { createClackPrompter } from "../wizard/clack-prompter.js";
|
||||
import {
|
||||
@@ -104,6 +109,43 @@ type ConfigureWizardParams = {
|
||||
sections?: WizardSection[];
|
||||
};
|
||||
|
||||
const intro = (message: string) =>
|
||||
clackIntro(stylePromptTitle(message) ?? message);
|
||||
const outro = (message: string) =>
|
||||
clackOutro(stylePromptTitle(message) ?? message);
|
||||
const note = (message: string, title?: string) =>
|
||||
clackNote(message, stylePromptTitle(title));
|
||||
const text = (params: Parameters<typeof clackText>[0]) =>
|
||||
clackText({
|
||||
...params,
|
||||
message: stylePromptMessage(params.message),
|
||||
});
|
||||
const confirm = (params: Parameters<typeof clackConfirm>[0]) =>
|
||||
clackConfirm({
|
||||
...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) },
|
||||
),
|
||||
});
|
||||
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 startOscSpinner = (label: string) => {
|
||||
const spin = spinner();
|
||||
spin.start(theme.accent(label));
|
||||
|
||||
Reference in New Issue
Block a user