Add CLI package, config file support, and workspace setup
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>
This commit is contained in:
48
cli/src/prompts/database.ts
Normal file
48
cli/src/prompts/database.ts
Normal file
@@ -0,0 +1,48 @@
|
||||
import * as p from "@clack/prompts";
|
||||
import type { DatabaseConfig } from "../config/schema.js";
|
||||
|
||||
export async function promptDatabase(): Promise<DatabaseConfig> {
|
||||
const mode = await p.select({
|
||||
message: "Database mode",
|
||||
options: [
|
||||
{ value: "pglite" as const, label: "PGlite (embedded, no setup needed)", hint: "recommended" },
|
||||
{ value: "postgres" as const, label: "PostgreSQL (external server)" },
|
||||
],
|
||||
});
|
||||
|
||||
if (p.isCancel(mode)) {
|
||||
p.cancel("Setup cancelled.");
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
if (mode === "postgres") {
|
||||
const connectionString = await p.text({
|
||||
message: "PostgreSQL connection string",
|
||||
placeholder: "postgres://user:pass@localhost:5432/paperclip",
|
||||
validate: (val) => {
|
||||
if (!val) return "Connection string is required for PostgreSQL mode";
|
||||
if (!val.startsWith("postgres")) return "Must be a postgres:// or postgresql:// URL";
|
||||
},
|
||||
});
|
||||
|
||||
if (p.isCancel(connectionString)) {
|
||||
p.cancel("Setup cancelled.");
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
return { mode: "postgres", connectionString, pgliteDataDir: "./data/pglite" };
|
||||
}
|
||||
|
||||
const pgliteDataDir = await p.text({
|
||||
message: "PGlite data directory",
|
||||
defaultValue: "./data/pglite",
|
||||
placeholder: "./data/pglite",
|
||||
});
|
||||
|
||||
if (p.isCancel(pgliteDataDir)) {
|
||||
p.cancel("Setup cancelled.");
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
return { mode: "pglite", pgliteDataDir: pgliteDataDir || "./data/pglite" };
|
||||
}
|
||||
Reference in New Issue
Block a user