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:
@@ -24,6 +24,7 @@ type SetupMode = "quickstart" | "advanced";
|
||||
type OnboardOptions = {
|
||||
config?: string;
|
||||
run?: boolean;
|
||||
yes?: boolean;
|
||||
invokedByRun?: boolean;
|
||||
};
|
||||
|
||||
@@ -80,27 +81,32 @@ export async function onboard(opts: OnboardOptions): Promise<void> {
|
||||
}
|
||||
}
|
||||
|
||||
const setupModeChoice = await p.select({
|
||||
message: "Choose setup path",
|
||||
options: [
|
||||
{
|
||||
value: "quickstart" as const,
|
||||
label: "Quickstart",
|
||||
hint: "Recommended: local defaults + ready to run",
|
||||
},
|
||||
{
|
||||
value: "advanced" as const,
|
||||
label: "Advanced setup",
|
||||
hint: "Customize database, server, storage, and more",
|
||||
},
|
||||
],
|
||||
initialValue: "quickstart",
|
||||
});
|
||||
if (p.isCancel(setupModeChoice)) {
|
||||
p.cancel("Setup cancelled.");
|
||||
return;
|
||||
let setupMode: SetupMode = "quickstart";
|
||||
if (opts.yes) {
|
||||
p.log.message(pc.dim("`--yes` enabled: using Quickstart defaults."));
|
||||
} else {
|
||||
const setupModeChoice = await p.select({
|
||||
message: "Choose setup path",
|
||||
options: [
|
||||
{
|
||||
value: "quickstart" as const,
|
||||
label: "Quickstart",
|
||||
hint: "Recommended: local defaults + ready to run",
|
||||
},
|
||||
{
|
||||
value: "advanced" as const,
|
||||
label: "Advanced setup",
|
||||
hint: "Customize database, server, storage, and more",
|
||||
},
|
||||
],
|
||||
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 {
|
||||
@@ -260,7 +266,7 @@ export async function onboard(opts: OnboardOptions): Promise<void> {
|
||||
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) {
|
||||
const answer = await p.confirm({
|
||||
message: "Start Paperclip now?",
|
||||
|
||||
@@ -40,6 +40,7 @@ program
|
||||
.description("Interactive first-run setup wizard")
|
||||
.option("-c, --config <path>", "Path to config file")
|
||||
.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)
|
||||
.action(onboard);
|
||||
|
||||
|
||||
@@ -44,6 +44,12 @@ Start immediately after onboarding:
|
||||
pnpm paperclipai onboard --run
|
||||
```
|
||||
|
||||
Non-interactive defaults + immediate start (opens browser on server listen):
|
||||
|
||||
```sh
|
||||
pnpm paperclipai onboard --yes
|
||||
```
|
||||
|
||||
## `paperclipai doctor`
|
||||
|
||||
Health checks with optional auto-repair:
|
||||
|
||||
Reference in New Issue
Block a user