Add cli/ package with initial scaffolding. Add config-schema to shared package for typed configuration. Add server config-file loader for paperclip.config.ts support. Register cli in pnpm workspace. Add .paperclip/ and .pnpm-store/ to gitignore. Minor Companies page fix. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
44 lines
1.0 KiB
TypeScript
44 lines
1.0 KiB
TypeScript
import * as p from "@clack/prompts";
|
|
import type { LlmConfig } from "../config/schema.js";
|
|
|
|
export async function promptLlm(): Promise<LlmConfig | undefined> {
|
|
const configureLlm = await p.confirm({
|
|
message: "Configure an LLM provider now?",
|
|
initialValue: false,
|
|
});
|
|
|
|
if (p.isCancel(configureLlm)) {
|
|
p.cancel("Setup cancelled.");
|
|
process.exit(0);
|
|
}
|
|
|
|
if (!configureLlm) return undefined;
|
|
|
|
const provider = await p.select({
|
|
message: "LLM provider",
|
|
options: [
|
|
{ value: "claude" as const, label: "Claude (Anthropic)" },
|
|
{ value: "openai" as const, label: "OpenAI" },
|
|
],
|
|
});
|
|
|
|
if (p.isCancel(provider)) {
|
|
p.cancel("Setup cancelled.");
|
|
process.exit(0);
|
|
}
|
|
|
|
const apiKey = await p.password({
|
|
message: `${provider === "claude" ? "Anthropic" : "OpenAI"} API key`,
|
|
validate: (val) => {
|
|
if (!val) return "API key is required";
|
|
},
|
|
});
|
|
|
|
if (p.isCancel(apiKey)) {
|
|
p.cancel("Setup cancelled.");
|
|
process.exit(0);
|
|
}
|
|
|
|
return { provider, apiKey };
|
|
}
|