fix: clean up onboarding + channel selection types

This commit is contained in:
Peter Steinberger
2026-01-15 05:12:29 +00:00
parent 9c02ea9098
commit 57c66fe813
7 changed files with 56 additions and 37 deletions

View File

@@ -6,7 +6,9 @@ import type { WizardPrompter } from "../../../wizard/prompts.js";
export const makeRuntime = (overrides: Partial<RuntimeEnv> = {}): RuntimeEnv => ({
log: vi.fn(),
error: vi.fn(),
exit: vi.fn(),
exit: vi.fn((code: number) => {
throw new Error(`exit:${code}`);
}) as RuntimeEnv["exit"],
...overrides,
});

View File

@@ -82,24 +82,26 @@ async function promptInstallChoice(params: {
prompter: WizardPrompter;
}): Promise<InstallChoice> {
const { entry, localPath, prompter } = params;
const localOptions: Array<{ value: InstallChoice; label: string; hint?: string }> = localPath
? [
{
value: "local",
label: "Use local plugin path",
hint: localPath,
},
]
: [];
const options: Array<{ value: InstallChoice; label: string; hint?: string }> = [
{ value: "npm", label: `Download from npm (${entry.install.npmSpec})` },
...(localPath
? [
{
value: "local",
label: "Use local plugin path",
hint: localPath,
},
]
: []),
...localOptions,
{ value: "skip", label: "Skip for now" },
];
return (await prompter.select({
const initialValue: InstallChoice = localPath ? "local" : "npm";
return await prompter.select<InstallChoice>({
message: `Install ${entry.meta.label} plugin?`,
options,
initialValue: localPath ? "local" : "npm",
})) as InstallChoice;
initialValue,
});
}
export async function ensureOnboardingPluginInstalled(params: {