feat(cli): add --yes flag to onboard for non-interactive quickstart

Skip the setup path prompt and auto-start the server when --yes is
passed, enabling fully non-interactive onboarding with local defaults.
Opens the browser automatically on server listen.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Dotta
2026-03-03 12:18:25 -06:00
parent 313a4aa36a
commit b5e2433822
3 changed files with 34 additions and 21 deletions

View File

@@ -24,6 +24,7 @@ type SetupMode = "quickstart" | "advanced";
type OnboardOptions = { type OnboardOptions = {
config?: string; config?: string;
run?: boolean; run?: boolean;
yes?: boolean;
invokedByRun?: boolean; invokedByRun?: boolean;
}; };
@@ -80,27 +81,32 @@ export async function onboard(opts: OnboardOptions): Promise<void> {
} }
} }
const setupModeChoice = await p.select({ let setupMode: SetupMode = "quickstart";
message: "Choose setup path", if (opts.yes) {
options: [ p.log.message(pc.dim("`--yes` enabled: using Quickstart defaults."));
{ } else {
value: "quickstart" as const, const setupModeChoice = await p.select({
label: "Quickstart", message: "Choose setup path",
hint: "Recommended: local defaults + ready to run", options: [
}, {
{ value: "quickstart" as const,
value: "advanced" as const, label: "Quickstart",
label: "Advanced setup", hint: "Recommended: local defaults + ready to run",
hint: "Customize database, server, storage, and more", },
}, {
], value: "advanced" as const,
initialValue: "quickstart", label: "Advanced setup",
}); hint: "Customize database, server, storage, and more",
if (p.isCancel(setupModeChoice)) { },
p.cancel("Setup cancelled."); ],
return; initialValue: "quickstart",
});
if (p.isCancel(setupModeChoice)) {
p.cancel("Setup cancelled.");
return;
}
setupMode = setupModeChoice as SetupMode;
} }
const setupMode = setupModeChoice as SetupMode;
let llm: PaperclipConfig["llm"] | undefined; let llm: PaperclipConfig["llm"] | undefined;
let { let {
@@ -260,7 +266,7 @@ export async function onboard(opts: OnboardOptions): Promise<void> {
await bootstrapCeoInvite({ config: configPath }); await bootstrapCeoInvite({ config: configPath });
} }
let shouldRunNow = opts.run === true; let shouldRunNow = opts.run === true || opts.yes === true;
if (!shouldRunNow && !opts.invokedByRun && process.stdin.isTTY && process.stdout.isTTY) { if (!shouldRunNow && !opts.invokedByRun && process.stdin.isTTY && process.stdout.isTTY) {
const answer = await p.confirm({ const answer = await p.confirm({
message: "Start Paperclip now?", message: "Start Paperclip now?",

View File

@@ -40,6 +40,7 @@ program
.description("Interactive first-run setup wizard") .description("Interactive first-run setup wizard")
.option("-c, --config <path>", "Path to config file") .option("-c, --config <path>", "Path to config file")
.option("-d, --data-dir <path>", DATA_DIR_OPTION_HELP) .option("-d, --data-dir <path>", DATA_DIR_OPTION_HELP)
.option("-y, --yes", "Accept defaults (quickstart + start immediately)", false)
.option("--run", "Start Paperclip immediately after saving config", false) .option("--run", "Start Paperclip immediately after saving config", false)
.action(onboard); .action(onboard);

View File

@@ -44,6 +44,12 @@ Start immediately after onboarding:
pnpm paperclipai onboard --run pnpm paperclipai onboard --run
``` ```
Non-interactive defaults + immediate start (opens browser on server listen):
```sh
pnpm paperclipai onboard --yes
```
## `paperclipai doctor` ## `paperclipai doctor`
Health checks with optional auto-repair: Health checks with optional auto-repair: