From f50d7d69fbe0ba9201c500b9230a75c7a874df4d Mon Sep 17 00:00:00 2001 From: William Valentin Date: Tue, 10 Feb 2026 09:36:58 -0800 Subject: [PATCH] feat(setup): wire setup command into CLI and start command - Register setup command in CLI index - Offer setup wizard when running `flynn start` with no config - Guard telegram log output since telegram is now optional Co-Authored-By: Claude Opus 4.6 --- src/cli/index.ts | 2 ++ src/cli/start.ts | 19 ++++++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/cli/index.ts b/src/cli/index.ts index 70b6314..d7234b1 100644 --- a/src/cli/index.ts +++ b/src/cli/index.ts @@ -7,6 +7,7 @@ import { registerDoctorCommand } from './doctor.js'; import { registerConfigCommand } from './config-cmd.js'; import { registerTuiCommand } from './tui.js'; import { registerCompletionCommand } from './completion.js'; +import { registerSetupCommand } from './setup.js'; export function createProgram(): Command { const program = new Command(); @@ -23,6 +24,7 @@ export function createProgram(): Command { registerDoctorCommand(program); registerConfigCommand(program); registerCompletionCommand(program); + registerSetupCommand(program); return program; } diff --git a/src/cli/start.ts b/src/cli/start.ts index fa6c42c..edd4393 100644 --- a/src/cli/start.ts +++ b/src/cli/start.ts @@ -11,8 +11,25 @@ export function registerStartCommand(program: Command): void { const configPath = opts.config ?? getConfigPath(); if (!existsSync(configPath)) { + // Offer setup wizard + const { createInterface } = await import('readline/promises'); + const { createPrompter } = await import('./setup/prompts.js'); + const rl = createInterface({ input: process.stdin, output: process.stdout }); + const p = createPrompter(rl); + const runWizard = await p.confirm( + 'No configuration found. Would you like to run the setup wizard?', + true, + ); + rl.close(); + + if (runWizard) { + const { runSetup } = await import('./setup.js'); + await runSetup(configPath); + return; + } + console.error(`Config file not found: ${configPath}`); - console.error('Run "flynn doctor" to diagnose, or create a config at ~/.config/flynn/config.yaml'); + console.error('Run "flynn setup" to create one, or "flynn doctor" to diagnose.'); process.exit(1); }