@openbuilder/cli 0.50.3 → 0.50.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../src/cli/utils/banner.ts","../../src/cli/utils/error-handler.ts","../../src/cli/utils/shutdown-handler.ts","../../src/cli/index.ts"],"sourcesContent":["/**\n * ASCII art banner for OpenBuilder CLI\n */\n\n// ANSI color codes\nconst colors = {\n reset: '\\x1b[0m',\n purple: '\\x1b[35m',\n brightPurple: '\\x1b[95m',\n cyan: '\\x1b[36m',\n white: '\\x1b[37m',\n gray: '\\x1b[90m',\n};\n\n/**\n * Displays the OpenBuilder banner\n */\nexport function displayBanner(): void {\n const banner = `\n${colors.cyan} ██████╗ ██████╗ ███████╗███╗ ██╗${colors.brightPurple}██████╗ ██╗ ██╗██╗██╗ ██████╗ ███████╗██████╗${colors.reset}\n${colors.cyan}██╔═══██╗██╔══██╗██╔════╝████╗ ██║${colors.brightPurple}██╔══██╗██║ ██║██║██║ ██╔══██╗██╔════╝██╔══██╗${colors.reset}\n${colors.cyan}██║ ██║██████╔╝█████╗ ██╔██╗ ██║${colors.brightPurple}██████╔╝██║ ██║██║██║ ██║ ██║█████╗ ██████╔╝${colors.reset}\n${colors.cyan}██║ ██║██╔═══╝ ██╔══╝ ██║╚██╗██║${colors.brightPurple}██╔══██╗██║ ██║██║██║ ██║ ██║██╔══╝ ██╔══██╗${colors.reset}\n${colors.cyan}╚██████╔╝██║ ███████╗██║ ╚████║${colors.brightPurple}██████╔╝╚██████╔╝██║███████╗██████╔╝███████╗██║ ██║${colors.reset}\n${colors.cyan} ╚═════╝ ╚═╝ ╚══════╝╚═╝ ╚═══╝${colors.brightPurple}╚═════╝ ╚═════╝ ╚═╝╚══════╝╚═════╝ ╚══════╝╚═╝ ╚═╝${colors.reset}\n`;\n\n console.log(banner);\n}\n\n/**\n * Displays a \"Setup Complete\" celebration banner\n */\nexport function displaySetupComplete(): void {\n const banner = `\n${colors.cyan} ██████╗ ██████╗ ███████╗███╗ ██╗${colors.brightPurple}██████╗ ██╗ ██╗██╗██╗ ██████╗ ███████╗██████╗${colors.reset}\n${colors.cyan}██╔═══██╗██╔══██╗██╔════╝████╗ ██║${colors.brightPurple}██╔══██╗██║ ██║██║██║ ██╔══██╗██╔════╝██╔══██╗${colors.reset}\n${colors.cyan}██║ ██║██████╔╝█████╗ ██╔██╗ ██║${colors.brightPurple}██████╔╝██║ ██║██║██║ ██║ ██║█████╗ ██████╔╝${colors.reset}\n${colors.cyan}██║ ██║██╔═══╝ ██╔══╝ ██║╚██╗██║${colors.brightPurple}██╔══██╗██║ ██║██║██║ ██║ ██║██╔══╝ ██╔══██╗${colors.reset}\n${colors.cyan}╚██████╔╝██║ ███████╗██║ ╚████║${colors.brightPurple}██████╔╝╚██████╔╝██║███████╗██████╔╝███████╗██║ ██║${colors.reset}\n${colors.cyan} ╚═════╝ ╚═╝ ╚══════╝╚═╝ ╚═══╝${colors.brightPurple}╚═════╝ ╚═════╝ ╚═╝╚══════╝╚═════╝ ╚══════╝╚═╝ ╚═╝${colors.reset}\n${colors.white} Setup is complete! 🎉${colors.reset}\n`;\n\n console.log(banner);\n}\n","/**\n * Centralized error handling and formatting for CLI\n * Displays errors with context, suggestions, and proper formatting\n */\n\nimport chalk from 'chalk';\nimport { CLIError, ErrorCode } from './cli-error.js';\n\nexport interface ErrorHandlerOptions {\n debug?: boolean;\n exitOnError?: boolean;\n}\n\nexport class CLIErrorHandler {\n private debug: boolean;\n private exitOnError: boolean;\n\n constructor(options: ErrorHandlerOptions = {}) {\n this.debug = options.debug ?? process.env.DEBUG === '1';\n this.exitOnError = options.exitOnError ?? true;\n }\n\n /**\n * Main error handling method\n * Formats and displays error, then exits if fatal\n */\n handle(error: Error | CLIError): void {\n // Convert to CLIError if needed\n const cliError = error instanceof CLIError\n ? error\n : this.convertToCLIError(error);\n\n // Display the error\n this.display(cliError);\n\n // Exit if fatal and exitOnError is enabled\n if (cliError.fatal && this.exitOnError) {\n process.exit(cliError.getExitCode());\n }\n }\n\n /**\n * Display formatted error to console\n */\n private display(error: CLIError): void {\n console.error(); // Empty line for spacing\n\n // Error header\n console.error(chalk.red('✗'), chalk.bold(error.message));\n\n // Error code (in debug mode)\n if (this.debug) {\n console.error(chalk.dim(` Code: ${error.code}`));\n }\n\n // Context information\n if (error.context && Object.keys(error.context).length > 0) {\n console.error();\n console.error(chalk.dim(' Details:'));\n Object.entries(error.context).forEach(([key, value]) => {\n console.error(chalk.dim(` ${key}: ${this.formatValue(value)}`));\n });\n }\n\n // Suggestions\n if (error.suggestions.length > 0) {\n console.error();\n console.error(chalk.yellow(' Try this:'));\n error.suggestions.forEach((suggestion, index) => {\n console.error(chalk.yellow(` ${index + 1}. ${suggestion}`));\n });\n }\n\n // Documentation link\n if (error.docs) {\n console.error();\n console.error(chalk.dim(' Documentation:'), chalk.cyan(error.docs));\n }\n\n // Stack trace (debug mode only)\n if (this.debug && error.stack) {\n console.error();\n console.error(chalk.dim(' Stack trace:'));\n console.error(chalk.dim(error.stack));\n }\n\n // Original error cause (if available)\n if (this.debug && error.cause) {\n console.error();\n console.error(chalk.dim(' Caused by:'));\n console.error(chalk.dim(error.cause.message));\n if (error.cause.stack) {\n console.error(chalk.dim(error.cause.stack));\n }\n }\n\n console.error(); // Empty line for spacing\n }\n\n /**\n * Format context values for display\n */\n private formatValue(value: unknown): string {\n if (typeof value === 'string') return value;\n if (typeof value === 'number') return String(value);\n if (typeof value === 'boolean') return String(value);\n if (value === null || value === undefined) return 'null';\n if (Array.isArray(value)) return value.join(', ');\n return JSON.stringify(value);\n }\n\n /**\n * Convert generic errors to CLIError\n */\n private convertToCLIError(error: Error): CLIError {\n // Try to infer error code from message\n const code = this.inferErrorCode(error);\n\n return new CLIError({\n code,\n message: error.message || 'An unexpected error occurred',\n cause: error,\n suggestions: ['Run with --debug flag for more details'],\n });\n }\n\n /**\n * Infer error code from generic error\n */\n private inferErrorCode(error: Error): ErrorCode {\n const message = error.message.toLowerCase();\n\n if (message.includes('econnrefused') || message.includes('connection refused')) {\n return 'DB_CONNECTION_FAILED';\n }\n if (message.includes('eaddrinuse') || message.includes('address already in use')) {\n return 'PORT_IN_USE';\n }\n if (message.includes('eacces') || message.includes('permission denied')) {\n return 'PERMISSION_DENIED';\n }\n if (message.includes('enoent') || message.includes('no such file')) {\n return 'CONFIG_NOT_FOUND';\n }\n\n return 'UNKNOWN_ERROR';\n }\n\n /**\n * Wrap an async function with error handling\n * Usage: await errorHandler.wrap(() => someAsyncFunction(), 'Description')\n */\n async wrap<T>(\n fn: () => Promise<T>,\n context?: string\n ): Promise<T> {\n try {\n return await fn();\n } catch (error) {\n if (context && error instanceof CLIError) {\n // Create new CLIError with added context (can't modify readonly property)\n const enhancedError = new CLIError({\n code: error.code,\n message: error.message,\n context: { ...error.context, operation: context },\n suggestions: error.suggestions,\n fatal: error.fatal,\n cause: error.cause,\n docs: error.docs,\n });\n this.handle(enhancedError);\n throw enhancedError;\n }\n this.handle(error as Error);\n throw error; // Re-throw for callers that want to handle it\n }\n }\n\n /**\n * Enable or disable debug mode\n */\n setDebug(debug: boolean): void {\n this.debug = debug;\n }\n\n /**\n * Enable or disable exit on error\n */\n setExitOnError(exitOnError: boolean): void {\n this.exitOnError = exitOnError;\n }\n}\n\n/**\n * Global error handler instance\n * Can be configured once and used throughout the CLI\n */\nexport const globalErrorHandler = new CLIErrorHandler();\n\n/**\n * Setup global error handlers for uncaught errors\n */\nexport function setupGlobalErrorHandlers(): void {\n process.on('uncaughtException', (error: Error) => {\n console.error(chalk.red('\\n✗ Uncaught exception:'));\n globalErrorHandler.handle(error);\n });\n\n process.on('unhandledRejection', (reason: unknown) => {\n console.error(chalk.red('\\n✗ Unhandled promise rejection:'));\n const error = reason instanceof Error ? reason : new Error(String(reason));\n globalErrorHandler.handle(error);\n });\n}\n","/**\n * Graceful shutdown handler for CLI\n * Ensures proper cleanup when user presses Ctrl+C or process is terminated\n */\n\nimport chalk from 'chalk';\nimport { ChildProcess } from 'node:child_process';\n\ntype CleanupFunction = () => Promise<void> | void;\n\nexport interface ShutdownHandlerOptions {\n /** Timeout in ms before forcing exit (default: 5000) */\n timeout?: number;\n /** Show shutdown messages (default: true) */\n verbose?: boolean;\n}\n\nexport class ShutdownHandler {\n private cleanupFunctions: CleanupFunction[] = [];\n private childProcesses: ChildProcess[] = [];\n private isShuttingDown = false;\n private timeout: number;\n private verbose: boolean;\n\n constructor(options: ShutdownHandlerOptions = {}) {\n this.timeout = options.timeout ?? 5000;\n this.verbose = options.verbose !== false;\n }\n\n /**\n * Register a cleanup function to run on shutdown\n */\n onShutdown(fn: CleanupFunction): void {\n this.cleanupFunctions.push(fn);\n }\n\n /**\n * Register a child process to kill on shutdown\n */\n registerProcess(process: ChildProcess): void {\n this.childProcesses.push(process);\n }\n\n /**\n * Setup signal handlers for graceful shutdown\n */\n setup(): void {\n // Handle Ctrl+C (SIGINT)\n process.on('SIGINT', () => {\n if (this.verbose) {\n console.log(); // New line after ^C\n console.log(chalk.yellow('⚠'), 'Received interrupt signal (Ctrl+C)');\n }\n this.shutdown('SIGINT');\n });\n\n // Handle termination (SIGTERM)\n process.on('SIGTERM', () => {\n if (this.verbose) {\n console.log(chalk.yellow('⚠'), 'Received termination signal (SIGTERM)');\n }\n this.shutdown('SIGTERM');\n });\n\n // Handle process exit\n process.on('exit', (code) => {\n if (this.verbose && code !== 0) {\n console.log(chalk.red('✗'), `Process exiting with code ${code}`);\n }\n });\n }\n\n /**\n * Execute graceful shutdown\n */\n private async shutdown(signal: string): Promise<void> {\n // Prevent multiple shutdown attempts\n if (this.isShuttingDown) {\n if (this.verbose) {\n console.log(chalk.dim(' Already shutting down...'));\n }\n return;\n }\n\n this.isShuttingDown = true;\n\n if (this.verbose) {\n console.log(chalk.cyan('ℹ'), 'Shutting down gracefully...');\n }\n\n // Set a timeout to force exit if cleanup takes too long\n const forceExitTimeout = setTimeout(() => {\n console.error(chalk.red('✗'), 'Shutdown timeout exceeded, forcing exit');\n process.exit(1);\n }, this.timeout);\n\n try {\n // 1. Kill child processes first\n if (this.childProcesses.length > 0) {\n if (this.verbose) {\n console.log(chalk.dim(' Stopping child processes...'));\n }\n await this.killChildProcesses();\n }\n\n // 2. Run cleanup functions\n if (this.cleanupFunctions.length > 0) {\n if (this.verbose) {\n console.log(chalk.dim(' Running cleanup tasks...'));\n }\n await this.runCleanup();\n }\n\n // 3. Success\n if (this.verbose) {\n console.log(chalk.green('✓'), 'Shutdown complete');\n }\n\n clearTimeout(forceExitTimeout);\n process.exit(0);\n } catch (error) {\n console.error(chalk.red('✗'), 'Error during shutdown:', error);\n clearTimeout(forceExitTimeout);\n process.exit(1);\n }\n }\n\n /**\n * Kill all registered child processes\n */\n private async killChildProcesses(): Promise<void> {\n const killPromises = this.childProcesses.map(async (child) => {\n if (!child.killed && child.pid) {\n try {\n // Try graceful SIGTERM first\n child.kill('SIGTERM');\n\n // Wait up to 2 seconds for graceful shutdown\n await new Promise<void>((resolve) => {\n const timeout = setTimeout(() => {\n // Force kill if still alive\n if (!child.killed) {\n child.kill('SIGKILL');\n }\n resolve();\n }, 2000);\n\n child.on('exit', () => {\n clearTimeout(timeout);\n resolve();\n });\n });\n } catch (error) {\n // Process might already be dead\n if (this.verbose) {\n console.log(chalk.dim(` Could not kill process ${child.pid}`));\n }\n }\n }\n });\n\n await Promise.all(killPromises);\n }\n\n /**\n * Run all cleanup functions\n */\n private async runCleanup(): Promise<void> {\n const cleanupPromises = this.cleanupFunctions.map(async (fn) => {\n try {\n await fn();\n } catch (error) {\n if (this.verbose) {\n console.error(chalk.yellow('⚠'), 'Cleanup function failed:', error);\n }\n }\n });\n\n await Promise.all(cleanupPromises);\n }\n\n /**\n * Manually trigger shutdown (for testing or programmatic use)\n */\n async triggerShutdown(): Promise<void> {\n await this.shutdown('MANUAL');\n }\n\n /**\n * Remove a child process from tracking (e.g., after it exits naturally)\n */\n unregisterProcess(process: ChildProcess): void {\n const index = this.childProcesses.indexOf(process);\n if (index > -1) {\n this.childProcesses.splice(index, 1);\n }\n }\n}\n\n/**\n * Global shutdown handler instance\n */\nexport const globalShutdownHandler = new ShutdownHandler();\n\n/**\n * Helper to setup shutdown handler with common options\n */\nexport function setupShutdownHandler(options?: ShutdownHandlerOptions): ShutdownHandler {\n const handler = new ShutdownHandler(options);\n handler.setup();\n return handler;\n}\n","#!/usr/bin/env node\n// EARLY TUI DETECTION: Set SILENT_MODE before any modules are imported\n// This suppresses console output in TUI mode\n// Must be done before imports because file-logger.ts captures console at load time\n{\n const args = process.argv.slice(2);\n const isRunnerTUI = args[0] === 'runner' && !args.includes('--no-tui');\n const isRunTUI = args[0] === 'run';\n const isInitTUI = args[0] === 'init' && (args.includes('-y') || args.includes('--yes') || args.includes('--non-interactive'));\n const isNoArgsTUI = args.length === 0 || (args.length === 1 && args[0] === '--debug');\n \n if (isRunnerTUI || isRunTUI || isInitTUI || isNoArgsTUI) {\n process.env.SILENT_MODE = '1';\n }\n}\n\n// IMPORTANT: Ensure vendor packages are extracted before any imports\n// pnpm postinstall doesn't always run reliably for global installs from URLs\n//\n// NOTE: @openbuilder/agent-core is bundled directly into dist/ by tsup,\n// so we don't need to check for it. But vendor packages (Sentry, etc.) still\n// need to be installed from the vendor/ tarballs.\nimport { existsSync, readFileSync } from 'node:fs';\nimport { join, dirname, resolve } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { execFileSync } from 'node:child_process';\n\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = dirname(__filename);\n\n// Find the package root by looking for package.json\n// This works regardless of where the bundled code ends up (dist/, dist/cli/, etc.)\nfunction findPackageRoot(startDir: string): string {\n let dir = startDir;\n for (let i = 0; i < 5; i++) { // Max 5 levels up\n if (existsSync(join(dir, 'package.json'))) {\n return dir;\n }\n const parent = dirname(dir);\n if (parent === dir) break; // Reached filesystem root\n dir = parent;\n }\n return startDir; // Fallback to start dir\n}\n\nconst packageRoot = findPackageRoot(__dirname);\n\n// Check if running in development mode (linked via pnpm/npm link)\n// Skip vendor install if we're in the monorepo - dependencies are handled by pnpm\nconst isLinkedDevelopment = packageRoot.includes('/openbuilder/apps/runner');\n\n// Only run vendor install for production global installs\nif (!isLinkedDevelopment) {\n // Check if Sentry packages are missing and extract from vendor if needed\n // (agent-core is bundled by tsup, but Sentry packages come from vendor tarballs)\n const nodeModulesDir = dirname(packageRoot); // Go up from package to node_modules/@openbuilder\n const sentryNodePath = join(nodeModulesDir, \"..\", \"@sentry\", \"node\");\n\n if (!existsSync(sentryNodePath)) {\n // Silently initialize vendor packages in background\n try {\n const installScript = join(packageRoot, \"scripts/install-vendor.js\");\n execFileSync(\"node\", [installScript], {\n cwd: packageRoot,\n stdio: \"pipe\" // Silent mode - output only shown if VERBOSE=1\n });\n } catch (error) {\n console.error(\"Failed to initialize vendor packages:\", error);\n process.exit(1);\n }\n }\n}\n\n// Sentry instrumentation is loaded via --import flag in bin/openbuilder.js wrapper\n// This ensures instrumentation happens before any ESM module resolution\n\nimport { Command } from 'commander';\nimport { displayBanner } from './utils/banner.js';\nimport { setupGlobalErrorHandlers, globalErrorHandler } from './utils/error-handler.js';\nimport { setupShutdownHandler } from './utils/shutdown-handler.js';\n\n// Get package.json for version info\nconst packageJson = JSON.parse(\n readFileSync(join(packageRoot, 'package.json'), 'utf-8')\n);\n\n// Setup global error handlers for uncaught errors\nsetupGlobalErrorHandlers();\n\n// Setup graceful shutdown handlers for Ctrl+C\nexport const shutdownHandler = setupShutdownHandler({\n timeout: 5000,\n verbose: true,\n});\n\n// Check if we're running in TUI mode or version mode - skip banner if so\nconst args = process.argv.slice(2);\nconst isInitWithYes = args[0] === 'init' && (args.includes('-y') || args.includes('--yes') || args.includes('--non-interactive'));\nconst isNoArgs = args.length === 0 || (args.length === 1 && args[0] === '--debug');\nconst isRunCommand = args[0] === 'run'; // `openbuilder run` uses TUI Dashboard\nconst isRunnerCommand = args[0] === 'runner' && !args.includes('--no-tui'); // `openbuilder runner` uses TUI Dashboard (unless --no-tui)\nconst isVersionCommand = args.includes('--version') || args.includes('-V'); // Skip banner for version output\nconst isSkipBanner = process.env.OPENBUILDER_SKIP_BANNER === '1'; // Skip banner after auto-update restart\nconst isTUIMode = isInitWithYes || isNoArgs || isRunCommand || isRunnerCommand;\nconst isSilentMode = isTUIMode || isVersionCommand || isSkipBanner;\n\n// Set SILENT_MODE for TUI/version to suppress all console output from other modules\n// This must be set early, before modules that use console.log are imported\nif (isSilentMode) {\n process.env.SILENT_MODE = '1';\n}\n\n// Auto-update check - do this BEFORE displaying banner to avoid double banners\n// For TUI modes: check only and store result for display (don't auto-update to avoid disruption)\n// For CLI modes: full auto-update with restart\n// For version mode: skip entirely - just show version\nlet willAutoUpdate = false;\nif (!process.env.OPENBUILDER_SKIP_UPDATE_CHECK && !isVersionCommand) {\n const { checkAndAutoUpdate, checkForUpdate } = await import('./utils/auto-update.js');\n \n try {\n if (isTUIMode) {\n // TUI mode: just check for updates, store result for TUI to display\n const updateInfo = await checkForUpdate(packageJson.version);\n if (updateInfo?.updateAvailable) {\n // Store update info for TUI components to access\n process.env.OPENBUILDER_UPDATE_AVAILABLE = updateInfo.latestVersion;\n }\n } else {\n // CLI mode: full auto-update\n // Show banner first since we're in CLI mode and might not auto-update\n displayBanner();\n const didUpdate = await checkAndAutoUpdate(packageJson.version);\n if (didUpdate) {\n // CLI will be relaunched by auto-update, exit this process\n willAutoUpdate = true;\n process.exit(0);\n }\n }\n } catch {\n // Auto-update failed silently, continue with current version\n // Show banner if we haven't yet (non-TUI mode)\n if (!isTUIMode) {\n // Banner already shown above before checkAndAutoUpdate\n }\n }\n} else if (!isSilentMode) {\n // Update check skipped, show banner for CLI mode (but not version mode)\n displayBanner();\n}\n\nconst program = new Command();\n\nprogram\n .name('openbuilder')\n .description('OpenBuilder CLI - AI App Builder')\n .version(packageJson.version)\n .option('--runner', 'Start runner only (connect to remote server)')\n .option('--debug', 'Enable debug mode with verbose error output')\n .hook('preAction', (thisCommand) => {\n // Enable debug mode if --debug flag is present\n const opts = thisCommand.opts();\n if (opts.debug) {\n globalErrorHandler.setDebug(true);\n process.env.DEBUG = '1';\n }\n })\n .action(async (options) => {\n try {\n // Default action when no subcommand is provided\n if (options.runner) {\n // Start runner only (legacy flag)\n const { runCommand } = await import('./commands/run.js');\n await runCommand({});\n } else {\n // Show TUI main menu\n const { mainTUICommand } = await import('./commands/main-tui.js');\n await mainTUICommand();\n }\n } catch (error) {\n globalErrorHandler.handle(error as Error);\n }\n });\n\n// Import commands\nprogram\n .command('init')\n .description('Initialize workspace and configuration for local development')\n .option('--workspace <path>', 'Set workspace directory')\n .option('--url <url>', 'Set server URL (default: http://localhost:3000)')\n .option('--secret <secret>', 'Set shared secret')\n .option('--branch <branch>', 'Git branch to clone (default: main)')\n .option('--database [value]', 'Database setup: connection string, or omit to auto-setup Neon in -y mode')\n .option('-y, --yes', 'Accept all defaults (non-interactive mode)')\n .option('--non-interactive', 'Use defaults without prompts (alias for -y)')\n .action(async (options) => {\n try {\n const { initCommand } = await import('./commands/init.js');\n await initCommand(options);\n } catch (error) {\n globalErrorHandler.handle(error as Error);\n }\n });\n\nprogram\n .command('run')\n .description('Start the full stack locally (web app + runner)')\n .option('-p, --port <port>', 'Web app port (default: 3000)')\n .option('--dev', 'Use development mode (hot reload, slower startup)')\n .option('--rebuild', 'Rebuild services before starting')\n .option('--no-local', 'Disable local mode (require authentication)')\n .option('--no-tui', 'Disable TUI dashboard, use plain text logs')\n .option('-v, --verbose', 'Enable verbose logging (show debug info)')\n .action(async (options) => {\n try {\n const { startCommand } = await import('./commands/start.js');\n await startCommand(options);\n } catch (error) {\n globalErrorHandler.handle(error as Error);\n }\n });\n\nprogram\n .command('build')\n .description('Build all services without starting (useful while app is running)')\n .option('--watch', 'Watch for changes and rebuild automatically')\n .action(async (options) => {\n try {\n const { buildCommand } = await import('./commands/build.js');\n await buildCommand(options);\n } catch (error) {\n globalErrorHandler.handle(error as Error);\n }\n });\n\nprogram\n .command('runner')\n .description('Start runner only (connect to OpenBuilder server)')\n .option('-u, --url <url>', 'OpenBuilder server URL (default: https://openbuilder.up.railway.app)')\n .option('-w, --workspace <path>', 'Workspace directory (default: ~/openbuilder-workspace)')\n .option('-i, --runner-id <id>', 'Runner identifier (default: system username)')\n .option('-s, --secret <secret>', 'Shared secret for authentication (required)')\n .option('-b, --broker <url>', 'WebSocket URL override (advanced, inferred from --url)')\n .option('-v, --verbose', 'Enable verbose logging')\n .option('-l, --local', 'Enable local mode (bypasses authentication)')\n .option('--no-tui', 'Disable TUI dashboard, use plain text logs')\n .action(async (options) => {\n try {\n const { runCommand } = await import('./commands/run.js');\n await runCommand(options);\n } catch (error) {\n globalErrorHandler.handle(error as Error);\n }\n });\n\n\nprogram\n .command('config <action> [key] [value]')\n .description('Manage configuration (actions: get, set, list, path, validate, reset)')\n .action(async (action, key, value) => {\n try {\n const { configCommand } = await import('./commands/config.js');\n await configCommand(action, key, value);\n } catch (error) {\n globalErrorHandler.handle(error as Error);\n }\n });\n\n// Alias for config validate\nprogram\n .command('verify')\n .description('Verify configuration is valid (alias for config validate)')\n .action(async () => {\n try {\n const { configCommand } = await import('./commands/config.js');\n await configCommand('validate');\n } catch (error) {\n globalErrorHandler.handle(error as Error);\n }\n });\n\nprogram\n .command('status')\n .description('Show runner status and configuration')\n .action(async () => {\n try {\n const { statusCommand } = await import('./commands/status.js');\n await statusCommand();\n } catch (error) {\n globalErrorHandler.handle(error as Error);\n }\n });\n\nprogram\n .command('cleanup')\n .description('Clean up projects and resources')\n .option('--project <slug>', 'Delete specific project')\n .option('--all', 'Clean all projects in workspace')\n .option('--tunnels', 'Close all active tunnels')\n .option('--processes', 'Kill all dev servers')\n .action(async (options) => {\n try {\n const { cleanupCommand } = await import('./commands/cleanup.js');\n await cleanupCommand(options);\n } catch (error) {\n globalErrorHandler.handle(error as Error);\n }\n });\n\nprogram\n .command('database')\n .alias('db')\n .description('Set up a new database and initialize schema')\n .action(async () => {\n try {\n const { databaseCommand } = await import('./commands/database.js');\n await databaseCommand();\n } catch (error) {\n globalErrorHandler.handle(error as Error);\n }\n });\n\nprogram\n .command('upgrade')\n .description('Upgrade to latest version (preserves configuration)')\n .option('--branch <branch>', 'Upgrade to specific branch (default: main)')\n .option('--force', 'Skip safety checks (uncommitted changes)')\n .action(async (options) => {\n try {\n const { upgradeCommand } = await import('./commands/upgrade.js');\n await upgradeCommand(options);\n } catch (error) {\n globalErrorHandler.handle(error as Error);\n }\n });\n\nprogram.parse();"],"names":["__filename","__dirname"],"mappings":";;;;;;;;;;AAAA;;AAEG;AAEH;AACA,MAAM,MAAM,GAAG;AACb,IAAA,KAAK,EAAE,SAAS;AAChB,IACA,YAAY,EAAE,UAAU;AACxB,IAAA,IAAI,EAAE,WAGP;AAED;;AAEG;SACa,aAAa,GAAA;AAC3B,IAAA,MAAM,MAAM,GAAG;EACf,MAAM,CAAC,IAAI,CAAA,mCAAA,EAAsC,MAAM,CAAC,YAAY,CAAA,mDAAA,EAAsD,MAAM,CAAC,KAAK;EACtI,MAAM,CAAC,IAAI,CAAA,mCAAA,EAAsC,MAAM,CAAC,YAAY,CAAA,oDAAA,EAAuD,MAAM,CAAC,KAAK;EACvI,MAAM,CAAC,IAAI,CAAA,mCAAA,EAAsC,MAAM,CAAC,YAAY,CAAA,oDAAA,EAAuD,MAAM,CAAC,KAAK;EACvI,MAAM,CAAC,IAAI,CAAA,mCAAA,EAAsC,MAAM,CAAC,YAAY,CAAA,oDAAA,EAAuD,MAAM,CAAC,KAAK;EACvI,MAAM,CAAC,IAAI,CAAA,mCAAA,EAAsC,MAAM,CAAC,YAAY,CAAA,oDAAA,EAAuD,MAAM,CAAC,KAAK;EACvI,MAAM,CAAC,IAAI,CAAA,mCAAA,EAAsC,MAAM,CAAC,YAAY,CAAA,oDAAA,EAAuD,MAAM,CAAC,KAAK;CACxI;AAEC,IAAA,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC;AACrB;;AC5BA;;;AAGG;MAUU,eAAe,CAAA;AAI1B,IAAA,W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AAC,MAAM,CAAC,KAAc,CAAC;IAC3C;AACF,CAAC,CAAC;AAEJ;KACG,OAAO,CAAC,UAAU;KAClB,KAAK,CAAC,IAAI;KACV,WAAW,CAAC,6CAA6C;KACzD,MAAM,CAAC,YAAW;AACjB,IAAA,IAAI;QACF,MAAM,EAAE,eAAe,EAAE,GAAG,MAAM,OAAO,gCAAwB,CAAC;QAClE,MAAM,eAAe,EAAE;IACzB;IAAE,OAAO,KAAK,EAAE;AACd,QAAA,kBAAkB,CAAC,MAAM,CAAC,KAAc,CAAC;IAC3C;AACF,CAAC,CAAC;AAEJ;KACG,OAAO,CAAC,SAAS;KACjB,WAAW,CAAC,qDAAqD;AACjE,KAAA,MAAM,CAAC,mBAAmB,EAAE,4CAA4C;AACxE,KAAA,MAAM,CAAC,SAAS,EAAE,0CAA0C;AAC5D,KAAA,MAAM,CAAC,OAAO,OAAO,KAAI;AACxB,IAAA,IAAI;QACF,MAAM,EAAE,cAAc,EAAE,GAAG,MAAM,OAAO,+BAAuB,CAAC;AAChE,QAAA,MAAM,cAAc,CAAC,OAAO,CAAC;IAC/B;IAAE,OAAO,KAAK,EAAE;AACd,QAAA,kBAAkB,CAAC,MAAM,CAAC,KAAc,CAAC;IAC3C;AACF,CAAC,CAAC;AAEJ,OAAO,CAAC,KAAK,EAAE;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../src/cli/utils/banner.ts","../../src/cli/utils/error-handler.ts","../../src/cli/utils/shutdown-handler.ts","../../src/cli/index.ts"],"sourcesContent":["/**\n * ASCII art banner for OpenBuilder CLI\n */\n\n// ANSI color codes\nconst colors = {\n reset: '\\x1b[0m',\n purple: '\\x1b[35m',\n brightPurple: '\\x1b[95m',\n cyan: '\\x1b[36m',\n white: '\\x1b[37m',\n gray: '\\x1b[90m',\n};\n\n/**\n * Displays the OpenBuilder banner\n */\nexport function displayBanner(): void {\n const banner = `\n${colors.cyan} ██████╗ ██████╗ ███████╗███╗ ██╗${colors.brightPurple}██████╗ ██╗ ██╗██╗██╗ ██████╗ ███████╗██████╗${colors.reset}\n${colors.cyan}██╔═══██╗██╔══██╗██╔════╝████╗ ██║${colors.brightPurple}██╔══██╗██║ ██║██║██║ ██╔══██╗██╔════╝██╔══██╗${colors.reset}\n${colors.cyan}██║ ██║██████╔╝█████╗ ██╔██╗ ██║${colors.brightPurple}██████╔╝██║ ██║██║██║ ██║ ██║█████╗ ██████╔╝${colors.reset}\n${colors.cyan}██║ ██║██╔═══╝ ██╔══╝ ██║╚██╗██║${colors.brightPurple}██╔══██╗██║ ██║██║██║ ██║ ██║██╔══╝ ██╔══██╗${colors.reset}\n${colors.cyan}╚██████╔╝██║ ███████╗██║ ╚████║${colors.brightPurple}██████╔╝╚██████╔╝██║███████╗██████╔╝███████╗██║ ██║${colors.reset}\n${colors.cyan} ╚═════╝ ╚═╝ ╚══════╝╚═╝ ╚═══╝${colors.brightPurple}╚═════╝ ╚═════╝ ╚═╝╚══════╝╚═════╝ ╚══════╝╚═╝ ╚═╝${colors.reset}\n`;\n\n console.log(banner);\n}\n\n/**\n * Displays a \"Setup Complete\" celebration banner\n */\nexport function displaySetupComplete(): void {\n const banner = `\n${colors.cyan} ██████╗ ██████╗ ███████╗███╗ ██╗${colors.brightPurple}██████╗ ██╗ ██╗██╗██╗ ██████╗ ███████╗██████╗${colors.reset}\n${colors.cyan}██╔═══██╗██╔══██╗██╔════╝████╗ ██║${colors.brightPurple}██╔══██╗██║ ██║██║██║ ██╔══██╗██╔════╝██╔══██╗${colors.reset}\n${colors.cyan}██║ ██║██████╔╝█████╗ ██╔██╗ ██║${colors.brightPurple}██████╔╝██║ ██║██║██║ ██║ ██║█████╗ ██████╔╝${colors.reset}\n${colors.cyan}██║ ██║██╔═══╝ ██╔══╝ ██║╚██╗██║${colors.brightPurple}██╔══██╗██║ ██║██║██║ ██║ ██║██╔══╝ ██╔══██╗${colors.reset}\n${colors.cyan}╚██████╔╝██║ ███████╗██║ ╚████║${colors.brightPurple}██████╔╝╚██████╔╝██║███████╗██████╔╝███████╗██║ ██║${colors.reset}\n${colors.cyan} ╚═════╝ ╚═╝ ╚══════╝╚═╝ ╚═══╝${colors.brightPurple}╚═════╝ ╚═════╝ ╚═╝╚══════╝╚═════╝ ╚══════╝╚═╝ ╚═╝${colors.reset}\n${colors.white} Setup is complete! 🎉${colors.reset}\n`;\n\n console.log(banner);\n}\n","/**\n * Centralized error handling and formatting for CLI\n * Displays errors with context, suggestions, and proper formatting\n */\n\nimport chalk from 'chalk';\nimport { CLIError, ErrorCode } from './cli-error.js';\n\nexport interface ErrorHandlerOptions {\n debug?: boolean;\n exitOnError?: boolean;\n}\n\nexport class CLIErrorHandler {\n private debug: boolean;\n private exitOnError: boolean;\n\n constructor(options: ErrorHandlerOptions = {}) {\n this.debug = options.debug ?? process.env.DEBUG === '1';\n this.exitOnError = options.exitOnError ?? true;\n }\n\n /**\n * Main error handling method\n * Formats and displays error, then exits if fatal\n */\n handle(error: Error | CLIError): void {\n // Convert to CLIError if needed\n const cliError = error instanceof CLIError\n ? error\n : this.convertToCLIError(error);\n\n // Display the error\n this.display(cliError);\n\n // Exit if fatal and exitOnError is enabled\n if (cliError.fatal && this.exitOnError) {\n process.exit(cliError.getExitCode());\n }\n }\n\n /**\n * Display formatted error to console\n */\n private display(error: CLIError): void {\n console.error(); // Empty line for spacing\n\n // Error header\n console.error(chalk.red('✗'), chalk.bold(error.message));\n\n // Error code (in debug mode)\n if (this.debug) {\n console.error(chalk.dim(` Code: ${error.code}`));\n }\n\n // Context information\n if (error.context && Object.keys(error.context).length > 0) {\n console.error();\n console.error(chalk.dim(' Details:'));\n Object.entries(error.context).forEach(([key, value]) => {\n console.error(chalk.dim(` ${key}: ${this.formatValue(value)}`));\n });\n }\n\n // Suggestions\n if (error.suggestions.length > 0) {\n console.error();\n console.error(chalk.yellow(' Try this:'));\n error.suggestions.forEach((suggestion, index) => {\n console.error(chalk.yellow(` ${index + 1}. ${suggestion}`));\n });\n }\n\n // Documentation link\n if (error.docs) {\n console.error();\n console.error(chalk.dim(' Documentation:'), chalk.cyan(error.docs));\n }\n\n // Stack trace (debug mode only)\n if (this.debug && error.stack) {\n console.error();\n console.error(chalk.dim(' Stack trace:'));\n console.error(chalk.dim(error.stack));\n }\n\n // Original error cause (if available)\n if (this.debug && error.cause) {\n console.error();\n console.error(chalk.dim(' Caused by:'));\n console.error(chalk.dim(error.cause.message));\n if (error.cause.stack) {\n console.error(chalk.dim(error.cause.stack));\n }\n }\n\n console.error(); // Empty line for spacing\n }\n\n /**\n * Format context values for display\n */\n private formatValue(value: unknown): string {\n if (typeof value === 'string') return value;\n if (typeof value === 'number') return String(value);\n if (typeof value === 'boolean') return String(value);\n if (value === null || value === undefined) return 'null';\n if (Array.isArray(value)) return value.join(', ');\n return JSON.stringify(value);\n }\n\n /**\n * Convert generic errors to CLIError\n */\n private convertToCLIError(error: Error): CLIError {\n // Try to infer error code from message\n const code = this.inferErrorCode(error);\n\n return new CLIError({\n code,\n message: error.message || 'An unexpected error occurred',\n cause: error,\n suggestions: ['Run with --debug flag for more details'],\n });\n }\n\n /**\n * Infer error code from generic error\n */\n private inferErrorCode(error: Error): ErrorCode {\n const message = error.message.toLowerCase();\n\n if (message.includes('econnrefused') || message.includes('connection refused')) {\n return 'DB_CONNECTION_FAILED';\n }\n if (message.includes('eaddrinuse') || message.includes('address already in use')) {\n return 'PORT_IN_USE';\n }\n if (message.includes('eacces') || message.includes('permission denied')) {\n return 'PERMISSION_DENIED';\n }\n if (message.includes('enoent') || message.includes('no such file')) {\n return 'CONFIG_NOT_FOUND';\n }\n\n return 'UNKNOWN_ERROR';\n }\n\n /**\n * Wrap an async function with error handling\n * Usage: await errorHandler.wrap(() => someAsyncFunction(), 'Description')\n */\n async wrap<T>(\n fn: () => Promise<T>,\n context?: string\n ): Promise<T> {\n try {\n return await fn();\n } catch (error) {\n if (context && error instanceof CLIError) {\n // Create new CLIError with added context (can't modify readonly property)\n const enhancedError = new CLIError({\n code: error.code,\n message: error.message,\n context: { ...error.context, operation: context },\n suggestions: error.suggestions,\n fatal: error.fatal,\n cause: error.cause,\n docs: error.docs,\n });\n this.handle(enhancedError);\n throw enhancedError;\n }\n this.handle(error as Error);\n throw error; // Re-throw for callers that want to handle it\n }\n }\n\n /**\n * Enable or disable debug mode\n */\n setDebug(debug: boolean): void {\n this.debug = debug;\n }\n\n /**\n * Enable or disable exit on error\n */\n setExitOnError(exitOnError: boolean): void {\n this.exitOnError = exitOnError;\n }\n}\n\n/**\n * Global error handler instance\n * Can be configured once and used throughout the CLI\n */\nexport const globalErrorHandler = new CLIErrorHandler();\n\n/**\n * Setup global error handlers for uncaught errors\n */\nexport function setupGlobalErrorHandlers(): void {\n process.on('uncaughtException', (error: Error) => {\n console.error(chalk.red('\\n✗ Uncaught exception:'));\n globalErrorHandler.handle(error);\n });\n\n process.on('unhandledRejection', (reason: unknown) => {\n console.error(chalk.red('\\n✗ Unhandled promise rejection:'));\n const error = reason instanceof Error ? reason : new Error(String(reason));\n globalErrorHandler.handle(error);\n });\n}\n","/**\n * Graceful shutdown handler for CLI\n * Ensures proper cleanup when user presses Ctrl+C or process is terminated\n */\n\nimport chalk from 'chalk';\nimport { ChildProcess } from 'node:child_process';\n\ntype CleanupFunction = () => Promise<void> | void;\n\nexport interface ShutdownHandlerOptions {\n /** Timeout in ms before forcing exit (default: 5000) */\n timeout?: number;\n /** Show shutdown messages (default: true) */\n verbose?: boolean;\n}\n\nexport class ShutdownHandler {\n private cleanupFunctions: CleanupFunction[] = [];\n private childProcesses: ChildProcess[] = [];\n private isShuttingDown = false;\n private timeout: number;\n private verbose: boolean;\n\n constructor(options: ShutdownHandlerOptions = {}) {\n this.timeout = options.timeout ?? 5000;\n this.verbose = options.verbose !== false;\n }\n\n /**\n * Register a cleanup function to run on shutdown\n */\n onShutdown(fn: CleanupFunction): void {\n this.cleanupFunctions.push(fn);\n }\n\n /**\n * Register a child process to kill on shutdown\n */\n registerProcess(process: ChildProcess): void {\n this.childProcesses.push(process);\n }\n\n /**\n * Setup signal handlers for graceful shutdown\n */\n setup(): void {\n // Handle Ctrl+C (SIGINT)\n process.on('SIGINT', () => {\n if (this.verbose) {\n console.log(); // New line after ^C\n console.log(chalk.yellow('⚠'), 'Received interrupt signal (Ctrl+C)');\n }\n this.shutdown('SIGINT');\n });\n\n // Handle termination (SIGTERM)\n process.on('SIGTERM', () => {\n if (this.verbose) {\n console.log(chalk.yellow('⚠'), 'Received termination signal (SIGTERM)');\n }\n this.shutdown('SIGTERM');\n });\n\n // Handle process exit\n process.on('exit', (code) => {\n if (this.verbose && code !== 0) {\n console.log(chalk.red('✗'), `Process exiting with code ${code}`);\n }\n });\n }\n\n /**\n * Execute graceful shutdown\n */\n private async shutdown(signal: string): Promise<void> {\n // Prevent multiple shutdown attempts\n if (this.isShuttingDown) {\n if (this.verbose) {\n console.log(chalk.dim(' Already shutting down...'));\n }\n return;\n }\n\n this.isShuttingDown = true;\n\n if (this.verbose) {\n console.log(chalk.cyan('ℹ'), 'Shutting down gracefully...');\n }\n\n // Set a timeout to force exit if cleanup takes too long\n const forceExitTimeout = setTimeout(() => {\n console.error(chalk.red('✗'), 'Shutdown timeout exceeded, forcing exit');\n process.exit(1);\n }, this.timeout);\n\n try {\n // 1. Kill child processes first\n if (this.childProcesses.length > 0) {\n if (this.verbose) {\n console.log(chalk.dim(' Stopping child processes...'));\n }\n await this.killChildProcesses();\n }\n\n // 2. Run cleanup functions\n if (this.cleanupFunctions.length > 0) {\n if (this.verbose) {\n console.log(chalk.dim(' Running cleanup tasks...'));\n }\n await this.runCleanup();\n }\n\n // 3. Success\n if (this.verbose) {\n console.log(chalk.green('✓'), 'Shutdown complete');\n }\n\n clearTimeout(forceExitTimeout);\n process.exit(0);\n } catch (error) {\n console.error(chalk.red('✗'), 'Error during shutdown:', error);\n clearTimeout(forceExitTimeout);\n process.exit(1);\n }\n }\n\n /**\n * Kill all registered child processes\n */\n private async killChildProcesses(): Promise<void> {\n const killPromises = this.childProcesses.map(async (child) => {\n if (!child.killed && child.pid) {\n try {\n // Try graceful SIGTERM first\n child.kill('SIGTERM');\n\n // Wait up to 2 seconds for graceful shutdown\n await new Promise<void>((resolve) => {\n const timeout = setTimeout(() => {\n // Force kill if still alive\n if (!child.killed) {\n child.kill('SIGKILL');\n }\n resolve();\n }, 2000);\n\n child.on('exit', () => {\n clearTimeout(timeout);\n resolve();\n });\n });\n } catch (error) {\n // Process might already be dead\n if (this.verbose) {\n console.log(chalk.dim(` Could not kill process ${child.pid}`));\n }\n }\n }\n });\n\n await Promise.all(killPromises);\n }\n\n /**\n * Run all cleanup functions\n */\n private async runCleanup(): Promise<void> {\n const cleanupPromises = this.cleanupFunctions.map(async (fn) => {\n try {\n await fn();\n } catch (error) {\n if (this.verbose) {\n console.error(chalk.yellow('⚠'), 'Cleanup function failed:', error);\n }\n }\n });\n\n await Promise.all(cleanupPromises);\n }\n\n /**\n * Manually trigger shutdown (for testing or programmatic use)\n */\n async triggerShutdown(): Promise<void> {\n await this.shutdown('MANUAL');\n }\n\n /**\n * Remove a child process from tracking (e.g., after it exits naturally)\n */\n unregisterProcess(process: ChildProcess): void {\n const index = this.childProcesses.indexOf(process);\n if (index > -1) {\n this.childProcesses.splice(index, 1);\n }\n }\n}\n\n/**\n * Global shutdown handler instance\n */\nexport const globalShutdownHandler = new ShutdownHandler();\n\n/**\n * Helper to setup shutdown handler with common options\n */\nexport function setupShutdownHandler(options?: ShutdownHandlerOptions): ShutdownHandler {\n const handler = new ShutdownHandler(options);\n handler.setup();\n return handler;\n}\n","#!/usr/bin/env node\n// EARLY TUI DETECTION: Set SILENT_MODE before any modules are imported\n// This suppresses console output in TUI mode\n// Must be done before imports because file-logger.ts captures console at load time\n{\n const args = process.argv.slice(2);\n const isRunnerTUI = args[0] === 'runner' && !args.includes('--no-tui');\n const isRunTUI = args[0] === 'run';\n const isInitTUI = args[0] === 'init' && (args.includes('-y') || args.includes('--yes') || args.includes('--non-interactive'));\n const isNoArgsTUI = args.length === 0 || (args.length === 1 && args[0] === '--debug');\n \n if (isRunnerTUI || isRunTUI || isInitTUI || isNoArgsTUI) {\n process.env.SILENT_MODE = '1';\n }\n}\n\n// IMPORTANT: Ensure vendor packages are extracted before any imports\n// pnpm postinstall doesn't always run reliably for global installs from URLs\n//\n// NOTE: @openbuilder/agent-core is bundled directly into dist/ by tsup,\n// so we don't need to check for it. But vendor packages (Sentry, etc.) still\n// need to be installed from the vendor/ tarballs.\nimport { existsSync, readFileSync } from 'node:fs';\nimport { join, dirname, resolve } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { execFileSync } from 'node:child_process';\n\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = dirname(__filename);\n\n// Find the package root by looking for package.json\n// This works regardless of where the bundled code ends up (dist/, dist/cli/, etc.)\nfunction findPackageRoot(startDir: string): string {\n let dir = startDir;\n for (let i = 0; i < 5; i++) { // Max 5 levels up\n if (existsSync(join(dir, 'package.json'))) {\n return dir;\n }\n const parent = dirname(dir);\n if (parent === dir) break; // Reached filesystem root\n dir = parent;\n }\n return startDir; // Fallback to start dir\n}\n\nconst packageRoot = findPackageRoot(__dirname);\n\n// Check if running in development mode (linked via pnpm/npm link)\n// Skip vendor install if we're in the monorepo - dependencies are handled by pnpm\nconst isLinkedDevelopment = packageRoot.includes('/openbuilder/apps/runner');\n\n// Only run vendor install for production global installs\nif (!isLinkedDevelopment) {\n // Check if Sentry packages are missing and extract from vendor if needed\n // (agent-core is bundled by tsup, but Sentry packages come from vendor tarballs)\n const nodeModulesDir = dirname(packageRoot); // Go up from package to node_modules/@openbuilder\n const sentryNodePath = join(nodeModulesDir, \"..\", \"@sentry\", \"node\");\n\n if (!existsSync(sentryNodePath)) {\n // Silently initialize vendor packages in background\n try {\n const installScript = join(packageRoot, \"scripts/install-vendor.js\");\n execFileSync(\"node\", [installScript], {\n cwd: packageRoot,\n stdio: \"pipe\" // Silent mode - output only shown if VERBOSE=1\n });\n } catch (error) {\n console.error(\"Failed to initialize vendor packages:\", error);\n process.exit(1);\n }\n }\n}\n\n// Sentry instrumentation is loaded via --import flag in bin/openbuilder.js wrapper\n// This ensures instrumentation happens before any ESM module resolution\n\nimport { Command } from 'commander';\nimport { displayBanner } from './utils/banner.js';\nimport { setupGlobalErrorHandlers, globalErrorHandler } from './utils/error-handler.js';\nimport { setupShutdownHandler } from './utils/shutdown-handler.js';\n\n// Get package.json for version info\nconst packageJson = JSON.parse(\n readFileSync(join(packageRoot, 'package.json'), 'utf-8')\n);\n\n// Setup global error handlers for uncaught errors\nsetupGlobalErrorHandlers();\n\n// Setup graceful shutdown handlers for Ctrl+C\nexport const shutdownHandler = setupShutdownHandler({\n timeout: 5000,\n verbose: true,\n});\n\n// Check if we're running in TUI mode or version mode - skip banner if so\nconst args = process.argv.slice(2);\nconst isInitWithYes = args[0] === 'init' && (args.includes('-y') || args.includes('--yes') || args.includes('--non-interactive'));\nconst isNoArgs = args.length === 0 || (args.length === 1 && args[0] === '--debug');\nconst isRunCommand = args[0] === 'run'; // `openbuilder run` uses TUI Dashboard\nconst isRunnerCommand = args[0] === 'runner' && !args.includes('--no-tui'); // `openbuilder runner` uses TUI Dashboard (unless --no-tui)\nconst isVersionCommand = args.includes('--version') || args.includes('-V'); // Skip banner for version output\nconst isSkipBanner = process.env.OPENBUILDER_SKIP_BANNER === '1'; // Skip banner after auto-update restart\nconst isTUIMode = isInitWithYes || isNoArgs || isRunCommand || isRunnerCommand;\nconst isSilentMode = isTUIMode || isVersionCommand || isSkipBanner;\n\n// Set SILENT_MODE for TUI/version to suppress all console output from other modules\n// This must be set early, before modules that use console.log are imported\nif (isSilentMode) {\n process.env.SILENT_MODE = '1';\n}\n\n// Auto-update check - do this BEFORE displaying banner to avoid double banners\n// All modes (TUI and CLI): full auto-update with restart\n// For version mode: skip entirely - just show version\nlet willAutoUpdate = false;\nif (!process.env.OPENBUILDER_SKIP_UPDATE_CHECK && !isVersionCommand) {\n const { checkAndAutoUpdate } = await import('./utils/auto-update.js');\n \n try {\n // Show banner first for non-TUI modes\n if (!isSilentMode) {\n displayBanner();\n }\n \n // Full auto-update for all modes\n const didUpdate = await checkAndAutoUpdate(packageJson.version);\n if (didUpdate) {\n // CLI will be relaunched by auto-update, exit this process\n willAutoUpdate = true;\n process.exit(0);\n }\n } catch {\n // Auto-update failed silently, continue with current version\n }\n} else if (!isSilentMode) {\n // Update check skipped, show banner for CLI mode (but not version mode)\n displayBanner();\n}\n\nconst program = new Command();\n\nprogram\n .name('openbuilder')\n .description('OpenBuilder CLI - AI App Builder')\n .version(packageJson.version)\n .option('--runner', 'Start runner only (connect to remote server)')\n .option('--debug', 'Enable debug mode with verbose error output')\n .hook('preAction', (thisCommand) => {\n // Enable debug mode if --debug flag is present\n const opts = thisCommand.opts();\n if (opts.debug) {\n globalErrorHandler.setDebug(true);\n process.env.DEBUG = '1';\n }\n })\n .action(async (options) => {\n try {\n // Default action when no subcommand is provided\n if (options.runner) {\n // Start runner only (legacy flag)\n const { runCommand } = await import('./commands/run.js');\n await runCommand({});\n } else {\n // Show TUI main menu\n const { mainTUICommand } = await import('./commands/main-tui.js');\n await mainTUICommand();\n }\n } catch (error) {\n globalErrorHandler.handle(error as Error);\n }\n });\n\n// Import commands\nprogram\n .command('init')\n .description('Initialize workspace and configuration for local development')\n .option('--workspace <path>', 'Set workspace directory')\n .option('--url <url>', 'Set server URL (default: http://localhost:3000)')\n .option('--secret <secret>', 'Set shared secret')\n .option('--branch <branch>', 'Git branch to clone (default: main)')\n .option('--database [value]', 'Database setup: connection string, or omit to auto-setup Neon in -y mode')\n .option('-y, --yes', 'Accept all defaults (non-interactive mode)')\n .option('--non-interactive', 'Use defaults without prompts (alias for -y)')\n .action(async (options) => {\n try {\n const { initCommand } = await import('./commands/init.js');\n await initCommand(options);\n } catch (error) {\n globalErrorHandler.handle(error as Error);\n }\n });\n\nprogram\n .command('run')\n .description('Start the full stack locally (web app + runner)')\n .option('-p, --port <port>', 'Web app port (default: 3000)')\n .option('--dev', 'Use development mode (hot reload, slower startup)')\n .option('--rebuild', 'Rebuild services before starting')\n .option('--no-local', 'Disable local mode (require authentication)')\n .option('--no-tui', 'Disable TUI dashboard, use plain text logs')\n .option('-v, --verbose', 'Enable verbose logging (show debug info)')\n .action(async (options) => {\n try {\n const { startCommand } = await import('./commands/start.js');\n await startCommand(options);\n } catch (error) {\n globalErrorHandler.handle(error as Error);\n }\n });\n\nprogram\n .command('build')\n .description('Build all services without starting (useful while app is running)')\n .option('--watch', 'Watch for changes and rebuild automatically')\n .action(async (options) => {\n try {\n const { buildCommand } = await import('./commands/build.js');\n await buildCommand(options);\n } catch (error) {\n globalErrorHandler.handle(error as Error);\n }\n });\n\nprogram\n .command('runner')\n .description('Start runner only (connect to OpenBuilder server)')\n .option('-u, --url <url>', 'OpenBuilder server URL (default: https://openbuilder.up.railway.app)')\n .option('-w, --workspace <path>', 'Workspace directory (default: ~/openbuilder-workspace)')\n .option('-i, --runner-id <id>', 'Runner identifier (default: system username)')\n .option('-s, --secret <secret>', 'Shared secret for authentication (required)')\n .option('-b, --broker <url>', 'WebSocket URL override (advanced, inferred from --url)')\n .option('-v, --verbose', 'Enable verbose logging')\n .option('-l, --local', 'Enable local mode (bypasses authentication)')\n .option('--no-tui', 'Disable TUI dashboard, use plain text logs')\n .action(async (options) => {\n try {\n const { runCommand } = await import('./commands/run.js');\n await runCommand(options);\n } catch (error) {\n globalErrorHandler.handle(error as Error);\n }\n });\n\n\nprogram\n .command('config <action> [key] [value]')\n .description('Manage configuration (actions: get, set, list, path, validate, reset)')\n .action(async (action, key, value) => {\n try {\n const { configCommand } = await import('./commands/config.js');\n await configCommand(action, key, value);\n } catch (error) {\n globalErrorHandler.handle(error as Error);\n }\n });\n\n// Alias for config validate\nprogram\n .command('verify')\n .description('Verify configuration is valid (alias for config validate)')\n .action(async () => {\n try {\n const { configCommand } = await import('./commands/config.js');\n await configCommand('validate');\n } catch (error) {\n globalErrorHandler.handle(error as Error);\n }\n });\n\nprogram\n .command('status')\n .description('Show runner status and configuration')\n .action(async () => {\n try {\n const { statusCommand } = await import('./commands/status.js');\n await statusCommand();\n } catch (error) {\n globalErrorHandler.handle(error as Error);\n }\n });\n\nprogram\n .command('cleanup')\n .description('Clean up projects and resources')\n .option('--project <slug>', 'Delete specific project')\n .option('--all', 'Clean all projects in workspace')\n .option('--tunnels', 'Close all active tunnels')\n .option('--processes', 'Kill all dev servers')\n .action(async (options) => {\n try {\n const { cleanupCommand } = await import('./commands/cleanup.js');\n await cleanupCommand(options);\n } catch (error) {\n globalErrorHandler.handle(error as Error);\n }\n });\n\nprogram\n .command('database')\n .alias('db')\n .description('Set up a new database and initialize schema')\n .action(async () => {\n try {\n const { databaseCommand } = await import('./commands/database.js');\n await databaseCommand();\n } catch (error) {\n globalErrorHandler.handle(error as Error);\n }\n });\n\nprogram\n .command('upgrade')\n .description('Upgrade to latest version (preserves configuration)')\n .option('--branch <branch>', 'Upgrade to specific branch (default: main)')\n .option('--force', 'Skip safety checks (uncommitted changes)')\n .action(async (options) => {\n try {\n const { upgradeCommand } = await import('./commands/upgrade.js');\n await upgradeCommand(options);\n } catch (error) {\n globalErrorHandler.handle(error as Error);\n }\n });\n\nprogram\n .command('login')\n .description('Authenticate with OpenBuilder via OAuth (GitHub/Sentry)')\n .option('-u, --url <url>', 'OpenBuilder server URL (default: https://openbuilder.app)')\n .option('-f, --force', 'Force re-authentication even if already logged in')\n .action(async (options) => {\n try {\n const { loginCommand } = await import('./commands/login.js');\n await loginCommand(options);\n } catch (error) {\n globalErrorHandler.handle(error as Error);\n }\n });\n\nprogram\n .command('logout')\n .description('Clear stored authentication credentials')\n .action(async () => {\n try {\n const { logoutCommand } = await import('./commands/logout.js');\n await logoutCommand();\n } catch (error) {\n globalErrorHandler.handle(error as Error);\n }\n });\n\nprogram.parse();"],"names":["__filename","__dirname"],"mappings":";;;;;;;;;;AAAA;;AAEG;AAEH;AACA,MAAM,MAAM,GAAG;AACb,IAAA,KAAK,EAAE,SAAS;AAChB,IACA,YAAY,EAAE,UAAU;AACxB,IAAA,IAA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MAAM,cAAc,CAAC,OAAO,CAAC;IAC/B;IAAE,OAAO,KAAK,EAAE;AACd,QAAA,kBAAkB,CAAC,MAAM,CAAC,KAAc,CAAC;IAC3C;AACF,CAAC,CAAC;AAEJ;KACG,OAAO,CAAC,OAAO;KACf,WAAW,CAAC,yDAAyD;AACrE,KAAA,MAAM,CAAC,iBAAiB,EAAE,2DAA2D;AACrF,KAAA,MAAM,CAAC,aAAa,EAAE,mDAAmD;AACzE,KAAA,MAAM,CAAC,OAAO,OAAO,KAAI;AACxB,IAAA,IAAI;QACF,MAAM,EAAE,YAAY,EAAE,GAAG,MAAM,OAAO,6BAAqB,CAAC;AAC5D,QAAA,MAAM,YAAY,CAAC,OAAO,CAAC;IAC7B;IAAE,OAAO,KAAK,EAAE;AACd,QAAA,kBAAkB,CAAC,MAAM,CAAC,KAAc,CAAC;IAC3C;AACF,CAAC,CAAC;AAEJ;KACG,OAAO,CAAC,QAAQ;KAChB,WAAW,CAAC,yCAAyC;KACrD,MAAM,CAAC,YAAW;AACjB,IAAA,IAAI;QACF,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,OAAO,8BAAsB,CAAC;QAC9D,MAAM,aAAa,EAAE;IACvB;IAAE,OAAO,KAAK,EAAE;AACd,QAAA,kBAAkB,CAAC,MAAM,CAAC,KAAc,CAAC;IAC3C;AACF,CAAC,CAAC;AAEJ,OAAO,CAAC,KAAK,EAAE;;;;"}
package/dist/index.js CHANGED
@@ -17,7 +17,7 @@ import { join } from 'path';
17
17
  import WebSocket$1, { WebSocketServer, WebSocket } from 'ws';
18
18
  import { drizzle } from 'drizzle-orm/node-postgres';
19
19
  import pg from 'pg';
20
- import { pgTable, timestamp, boolean, text, uuid, index, uniqueIndex, jsonb, integer } from 'drizzle-orm/pg-core';
20
+ import { pgTable, timestamp, boolean, text, uuid, index, uniqueIndex, integer, jsonb } from 'drizzle-orm/pg-core';
21
21
  import { sql, and, eq, desc, isNull } from 'drizzle-orm';
22
22
  import { randomUUID, createHash } from 'crypto';
23
23
  import { migrate } from 'drizzle-orm/node-postgres/migrator';
@@ -4473,6 +4473,7 @@ function publishRunnerEvent(event) {
4473
4473
  var schema_exports = {};
4474
4474
  __export$1(schema_exports, {
4475
4475
  accounts: () => accounts,
4476
+ cliAuthSessions: () => cliAuthSessions,
4476
4477
  generationNotes: () => generationNotes,
4477
4478
  generationSessions: () => generationSessions,
4478
4479
  generationTodos: () => generationTodos,
@@ -4552,6 +4553,8 @@ var runnerKeys = pgTable("runner_keys", {
4552
4553
  // SHA-256 hash of the full key
4553
4554
  keyPrefix: text("key_prefix").notNull(),
4554
4555
  // First 8 chars for display: "sv_abc123..."
4556
+ source: text("source").default("web"),
4557
+ // 'web' | 'cli' - how the key was created
4555
4558
  lastUsedAt: timestamp("last_used_at"),
4556
4559
  createdAt: timestamp("created_at").notNull().defaultNow(),
4557
4560
  revokedAt: timestamp("revoked_at")
@@ -4560,6 +4563,31 @@ var runnerKeys = pgTable("runner_keys", {
4560
4563
  userIdIdx: index("runner_keys_user_id_idx").on(table.userId),
4561
4564
  keyHashIdx: uniqueIndex("runner_keys_key_hash_idx").on(table.keyHash)
4562
4565
  }));
4566
+ var cliAuthSessions = pgTable("cli_auth_sessions", {
4567
+ id: uuid("id").primaryKey().defaultRandom(),
4568
+ token: text("token").notNull().unique(),
4569
+ // Random token for session identification
4570
+ callbackPort: integer("callback_port").notNull(),
4571
+ // Port the CLI is listening on
4572
+ callbackHost: text("callback_host").default("localhost"),
4573
+ // Host for callback
4574
+ state: text("state").notNull().default("pending"),
4575
+ // 'pending' | 'authenticated' | 'completed' | 'expired'
4576
+ userId: uuid("user_id").references(() => users.id, { onDelete: "cascade" }),
4577
+ // Set after auth
4578
+ runnerKeyId: uuid("runner_key_id").references(() => runnerKeys.id, { onDelete: "cascade" }),
4579
+ // Created key
4580
+ deviceName: text("device_name"),
4581
+ // Auto-detected device name
4582
+ expiresAt: timestamp("expires_at").notNull(),
4583
+ // Session expiration (short-lived)
4584
+ createdAt: timestamp("created_at").notNull().defaultNow(),
4585
+ authenticatedAt: timestamp("authenticated_at")
4586
+ // When user completed OAuth
4587
+ }, (table) => ({
4588
+ tokenIdx: uniqueIndex("cli_auth_sessions_token_idx").on(table.token),
4589
+ expiresAtIdx: index("cli_auth_sessions_expires_at_idx").on(table.expiresAt)
4590
+ }));
4563
4591
  var projects = pgTable("projects", {
4564
4592
  id: uuid("id").primaryKey().defaultRandom(),
4565
4593
  userId: uuid("user_id").references(() => users.id, { onDelete: "set null" }),
@@ -13701,7 +13729,7 @@ async function startRunner(options = {}) {
13701
13729
  // Detect framework from generated files
13702
13730
  let detectedFramework = null;
13703
13731
  try {
13704
- const { detectFrameworkFromFilesystem } = await import('./chunks/port-allocator-BRFzgH9b.js');
13732
+ const { detectFrameworkFromFilesystem } = await import('./chunks/port-allocator-Ct3ioni4.js');
13705
13733
  const framework = await detectFrameworkFromFilesystem(projectDirectory);
13706
13734
  detectedFramework = framework;
13707
13735
  if (framework) {