@openbuilder/cli 0.31.11
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.
- package/README.md +1053 -0
- package/bin/openbuilder.js +31 -0
- package/dist/chunks/Banner-D4tqKfzA.js +113 -0
- package/dist/chunks/Banner-D4tqKfzA.js.map +1 -0
- package/dist/chunks/auto-update-Dj3lWPWO.js +350 -0
- package/dist/chunks/auto-update-Dj3lWPWO.js.map +1 -0
- package/dist/chunks/build-D0qYqIq0.js +116 -0
- package/dist/chunks/build-D0qYqIq0.js.map +1 -0
- package/dist/chunks/cleanup-qVTsA3tk.js +141 -0
- package/dist/chunks/cleanup-qVTsA3tk.js.map +1 -0
- package/dist/chunks/cli-error-BjQwvWtK.js +140 -0
- package/dist/chunks/cli-error-BjQwvWtK.js.map +1 -0
- package/dist/chunks/config-BGP1jZJ4.js +167 -0
- package/dist/chunks/config-BGP1jZJ4.js.map +1 -0
- package/dist/chunks/config-manager-BkbjtN-H.js +133 -0
- package/dist/chunks/config-manager-BkbjtN-H.js.map +1 -0
- package/dist/chunks/database-BvAbD4sP.js +68 -0
- package/dist/chunks/database-BvAbD4sP.js.map +1 -0
- package/dist/chunks/database-setup-BYjIRAmT.js +253 -0
- package/dist/chunks/database-setup-BYjIRAmT.js.map +1 -0
- package/dist/chunks/exports-ij9sv4UM.js +7793 -0
- package/dist/chunks/exports-ij9sv4UM.js.map +1 -0
- package/dist/chunks/init-CZoN6soU.js +468 -0
- package/dist/chunks/init-CZoN6soU.js.map +1 -0
- package/dist/chunks/init-tui-BNzk_7Yx.js +1127 -0
- package/dist/chunks/init-tui-BNzk_7Yx.js.map +1 -0
- package/dist/chunks/logger-ZpJi7chw.js +38 -0
- package/dist/chunks/logger-ZpJi7chw.js.map +1 -0
- package/dist/chunks/main-tui-Cq1hLCx-.js +644 -0
- package/dist/chunks/main-tui-Cq1hLCx-.js.map +1 -0
- package/dist/chunks/manager-CvGX9qqe.js +1161 -0
- package/dist/chunks/manager-CvGX9qqe.js.map +1 -0
- package/dist/chunks/port-allocator-BRFzgH9b.js +749 -0
- package/dist/chunks/port-allocator-BRFzgH9b.js.map +1 -0
- package/dist/chunks/process-killer-CaUL7Kpl.js +87 -0
- package/dist/chunks/process-killer-CaUL7Kpl.js.map +1 -0
- package/dist/chunks/prompts-1QbE_bRr.js +128 -0
- package/dist/chunks/prompts-1QbE_bRr.js.map +1 -0
- package/dist/chunks/repo-cloner-CpOQjFSo.js +219 -0
- package/dist/chunks/repo-cloner-CpOQjFSo.js.map +1 -0
- package/dist/chunks/repo-detector-B_oj696o.js +66 -0
- package/dist/chunks/repo-detector-B_oj696o.js.map +1 -0
- package/dist/chunks/run-D23hg4xy.js +630 -0
- package/dist/chunks/run-D23hg4xy.js.map +1 -0
- package/dist/chunks/runner-logger-instance-nDWv2h2T.js +899 -0
- package/dist/chunks/runner-logger-instance-nDWv2h2T.js.map +1 -0
- package/dist/chunks/spinner-BJL9zWAJ.js +53 -0
- package/dist/chunks/spinner-BJL9zWAJ.js.map +1 -0
- package/dist/chunks/start-BygPCbvw.js +1708 -0
- package/dist/chunks/start-BygPCbvw.js.map +1 -0
- package/dist/chunks/start-traditional-uoLZXdxm.js +255 -0
- package/dist/chunks/start-traditional-uoLZXdxm.js.map +1 -0
- package/dist/chunks/status-cS8YwtUx.js +97 -0
- package/dist/chunks/status-cS8YwtUx.js.map +1 -0
- package/dist/chunks/theme-DhorI2Hb.js +44 -0
- package/dist/chunks/theme-DhorI2Hb.js.map +1 -0
- package/dist/chunks/upgrade-CT6w0lKp.js +323 -0
- package/dist/chunks/upgrade-CT6w0lKp.js.map +1 -0
- package/dist/chunks/useBuildState-CdBSu9y_.js +331 -0
- package/dist/chunks/useBuildState-CdBSu9y_.js.map +1 -0
- package/dist/cli/index.js +694 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/index.js +14358 -0
- package/dist/index.js.map +1 -0
- package/dist/instrument.js +64226 -0
- package/dist/instrument.js.map +1 -0
- package/dist/templates.json +295 -0
- package/package.json +98 -0
- package/scripts/install-vendor-deps.js +34 -0
- package/scripts/install-vendor.js +167 -0
- package/scripts/prepare-release.js +71 -0
- package/templates/config.template.json +18 -0
- package/templates.json +295 -0
- package/vendor/ai-sdk-provider-claude-code-LOCAL.tgz +0 -0
- package/vendor/sentry-core-LOCAL.tgz +0 -0
- package/vendor/sentry-nextjs-LOCAL.tgz +0 -0
- package/vendor/sentry-node-LOCAL.tgz +0 -0
- package/vendor/sentry-node-core-LOCAL.tgz +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"start-traditional-uoLZXdxm.js","sources":["../../src/cli/commands/start-traditional.ts"],"sourcesContent":["/**\n * Enhanced start command with graceful shutdown and better error handling\n * Starts the full stack: Web App + Runner (no broker - runner connects directly)\n */\n\nimport { spawn, ChildProcess } from 'node:child_process';\nimport { existsSync, writeFileSync } from 'node:fs';\nimport { join } from 'node:path';\nimport * as p from '@clack/prompts';\nimport pc from 'picocolors';\nimport { configManager } from '../utils/config-manager.js';\nimport { findMonorepoRoot, isInsideMonorepo } from '../utils/repo-detector.js';\nimport { killProcessOnPort } from '../utils/process-killer.js';\nimport { CLIError, errors } from '../utils/cli-error.js';\nimport { shutdownHandler } from '../index.js';\n\ninterface StartOptions {\n port?: string;\n dev?: boolean; // Use development mode (hot reload)\n rebuild?: boolean; // Rebuild services before starting\n local?: boolean; // Enable local mode (default: true, use --no-local to disable)\n verbose?: boolean; // Enable verbose logging\n}\n\ninterface ManagedProcess {\n name: string;\n process: ChildProcess;\n port?: number;\n}\n\nexport async function startCommand(options: StartOptions) {\n const s = p.spinner();\n\n // Step 1: Find monorepo\n s.start('Locating OpenBuilder repository');\n\n let monorepoRoot: string | undefined;\n const config = configManager.get();\n\n // Try config first\n if (config.monorepoPath && existsSync(config.monorepoPath)) {\n monorepoRoot = config.monorepoPath;\n }\n\n // Try detection\n if (!monorepoRoot) {\n const repoCheck = await isInsideMonorepo();\n if (repoCheck.inside && repoCheck.root) {\n monorepoRoot = repoCheck.root;\n configManager.set('monorepoPath', monorepoRoot);\n }\n }\n\n if (!monorepoRoot) {\n s.stop(pc.red('✗') + ' Repository not found');\n throw errors.monorepoNotFound([\n config.monorepoPath || 'none',\n process.cwd(),\n ]);\n }\n\n s.stop(pc.green('✓') + ' Repository found');\n\n // Step 2: Check dependencies\n const nodeModulesPath = join(monorepoRoot, 'node_modules');\n\n if (!existsSync(nodeModulesPath)) {\n s.start('Installing dependencies');\n try {\n const { installDependencies } = await import('../utils/repo-cloner.js');\n await installDependencies(monorepoRoot);\n s.stop(pc.green('✓') + ' Dependencies installed');\n } catch (error) {\n s.stop(pc.red('✗') + ' Failed to install dependencies');\n throw new CLIError({\n code: 'DEPENDENCIES_INSTALL_FAILED',\n message: 'Failed to install dependencies',\n cause: error instanceof Error ? error : new Error(String(error)),\n suggestions: [\n `Run manually: cd ${monorepoRoot} && pnpm install`,\n 'Check your internet connection',\n ],\n });\n }\n }\n\n // Step 2.5: Check for production build (unless --dev mode)\n const nextBuildIdPath = join(monorepoRoot, 'apps', 'openbuilder', '.next', 'BUILD_ID');\n const needsProductionBuild = !options.dev && !existsSync(nextBuildIdPath);\n\n // Rebuild services if requested OR if production build is missing\n if (options.rebuild || needsProductionBuild) {\n const buildReason = options.rebuild \n ? 'Rebuilding services' \n : 'Building for production (first run)';\n s.start(buildReason);\n\n try {\n // Use turbo to build all services with caching\n await new Promise<void>((resolve, reject) => {\n const buildProcess = spawn('pnpm', ['build:all'], {\n cwd: monorepoRoot,\n stdio: 'inherit', // Show build output in traditional mode\n shell: true,\n });\n\n buildProcess.on('close', (code) => {\n if (code === 0) {\n resolve();\n } else {\n reject(new Error(`Build failed with code ${code}`));\n }\n });\n\n buildProcess.on('error', reject);\n });\n\n s.stop(pc.green('✓') + ' Build complete (using Turborepo cache)');\n } catch (error) {\n s.stop(pc.red('✗') + ' Build failed');\n throw new CLIError({\n code: 'BUILD_FAILED',\n message: 'Failed to build services',\n suggestions: [\n 'Check that all dependencies are installed',\n 'Try running: pnpm build:all',\n 'Run with --dev flag to skip build and use dev mode',\n ],\n });\n }\n }\n\n // Step 3: Check database\n if (!config.databaseUrl) {\n throw new CLIError({\n code: 'MISSING_REQUIRED_CONFIG',\n message: 'Database URL not configured',\n suggestions: [\n 'Run initialization: openbuilder init',\n 'Or set manually: openbuilder config set databaseUrl <url>',\n 'Or setup database: openbuilder db',\n ],\n docs: 'https://github.com/codyde/openbuilder#database-setup',\n });\n }\n\n // Step 4: Clean up zombie processes\n const webPort = Number(options.port || '3000');\n\n s.start('Checking for port conflicts');\n await killProcessOnPort(webPort);\n s.stop(pc.green('✓') + ' Ports available');\n\n console.log();\n console.log(pc.bold('Starting services...'));\n console.log();\n\n const processes: ManagedProcess[] = [];\n const sharedSecret = configManager.getSecret() || 'dev-secret';\n\n // Register cleanup with shutdown handler\n shutdownHandler.onShutdown(async () => {\n console.log();\n console.log(pc.yellow('⚠'), 'Stopping all services...');\n\n // Kill all child processes\n for (const { name, process: proc } of processes) {\n if (!proc.killed && proc.pid) {\n console.log(pc.dim(` Stopping ${name}...`));\n proc.kill('SIGTERM');\n }\n }\n\n // Give them time to exit gracefully\n await new Promise(resolve => setTimeout(resolve, 2000));\n\n // Force kill stragglers\n for (const { name, port } of processes) {\n if (port) {\n try {\n await killProcessOnPort(port);\n } catch {\n // Best effort\n }\n }\n }\n\n console.log(pc.green('✓'), 'All services stopped');\n });\n\n try {\n // Local mode is enabled by default, can be disabled with --no-local\n const isLocalMode = options.local !== false;\n \n // Write .env.local file to ensure env vars are available to Next.js\n const envLocalPath = join(monorepoRoot, 'apps', 'openbuilder', '.env.local');\n const envContent = [\n '# Auto-generated by openbuilder CLI - DO NOT EDIT',\n `# Generated at: ${new Date().toISOString()}`,\n '',\n `OPENBUILDER_LOCAL_MODE=${isLocalMode ? 'true' : 'false'}`,\n `RUNNER_SHARED_SECRET=${sharedSecret}`,\n `WORKSPACE_ROOT=${config.workspace}`,\n `RUNNER_ID=${config.runner?.id || 'local'}`,\n `RUNNER_DEFAULT_ID=${config.runner?.id || 'local'}`,\n `DATABASE_URL=${config.databaseUrl || ''}`,\n '',\n ].join('\\n');\n \n writeFileSync(envLocalPath, envContent);\n \n // Start Web App (now handles runner WebSocket connections directly)\n console.log(pc.cyan('1/2'), 'Starting web app...');\n // Default to production mode unless --dev flag is present\n const webCommand = options.dev ? 'dev' : 'start';\n const webApp = spawn('pnpm', ['--filter', 'openbuilder', webCommand], {\n cwd: monorepoRoot,\n stdio: ['ignore', 'pipe', 'pipe'],\n shell: true,\n env: {\n ...process.env,\n PORT: String(webPort),\n DATABASE_URL: config.databaseUrl,\n RUNNER_SHARED_SECRET: sharedSecret,\n WORKSPACE_ROOT: config.workspace,\n RUNNER_ID: config.runner?.id || 'local',\n RUNNER_DEFAULT_ID: config.runner?.id || 'local',\n // Enable local mode - bypasses authentication requirements (default: true)\n OPENBUILDER_LOCAL_MODE: isLocalMode ? 'true' : 'false',\n },\n });\n\n processes.push({ name: 'Web App', process: webApp, port: webPort });\n shutdownHandler.registerProcess(webApp);\n\n // Handle web app output\n webApp.stdout?.on('data', (data) => {\n const text = data.toString().trim();\n if (text && !text.includes('warn') && !text.includes('deprecated')) {\n console.log(pc.blue('[web]'), text);\n }\n });\n\n webApp.stderr?.on('data', (data) => {\n const text = data.toString().trim();\n if (text && !text.includes('warn') && !text.includes('deprecated')) {\n console.log(pc.yellow('[web]'), text);\n }\n });\n\n webApp.on('exit', (code) => {\n // Exit codes 0, 130 (SIGINT), and 143 (SIGTERM) are normal shutdown\n if (code !== 0 && code !== null && code !== 130 && code !== 143) {\n console.error(pc.red('✗'), `Web app crashed with code ${code}`);\n process.exit(1);\n }\n });\n\n // Wait for web app and WebSocket server to initialize\n await new Promise(resolve => setTimeout(resolve, 3000));\n\n // Start Runner\n console.log(pc.cyan('2/2'), 'Starting runner...');\n console.log();\n\n // Success message\n console.log(pc.green('✓'), pc.bold('All services started!'));\n console.log();\n console.log(pc.bold('Services running:'));\n console.log(` ${pc.blue('Web App:')} http://localhost:${webPort}`);\n console.log(` ${pc.magenta('Runner:')} Connected to web app`);\n console.log();\n console.log(pc.dim(`Press ${pc.cyan('Ctrl+C')} to stop all services`));\n console.log();\n\n // Start runner (blocks until shutdown) - connects directly to Next.js WebSocket\n const { startRunner } = await import('../../index.js');\n await startRunner({\n wsUrl: `ws://localhost:${webPort}/ws/runner`,\n sharedSecret: sharedSecret,\n runnerId: config.runner?.id || 'local',\n workspace: config.workspace,\n verbose: options.verbose,\n tuiMode: false, // Traditional mode = no TUI\n });\n\n } catch (error) {\n // Global error handler will format this nicely\n throw error;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;;AAGG;AA2BI,eAAe,YAAY,CAAC,OAAqB,EAAA;AACtD,IAAA,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE;;AAGrB,IAAA,CAAC,CAAC,KAAK,CAAC,iCAAiC,CAAC;AAE1C,IAAA,IAAI,YAAgC;AACpC,IAAA,MAAM,MAAM,GAAG,aAAa,CAAC,GAAG,EAAE;;IAGlC,IAAI,MAAM,CAAC,YAAY,IAAI,UAAU,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE;AAC1D,QAAA,YAAY,GAAG,MAAM,CAAC,YAAY;IACpC;;IAGA,IAAI,CAAC,YAAY,EAAE;AACjB,QAAA,MAAM,SAAS,GAAG,MAAM,gBAAgB,EAAE;QAC1C,IAAI,SAAS,CAAC,MAAM,IAAI,SAAS,CAAC,IAAI,EAAE;AACtC,YAAA,YAAY,GAAG,SAAS,CAAC,IAAI;AAC7B,YAAA,aAAa,CAAC,GAAG,CAAC,cAAc,EAAE,YAAY,CAAC;QACjD;IACF;IAEA,IAAI,CAAC,YAAY,EAAE;AACjB,QAAA,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,uBAAuB,CAAC;QAC7C,MAAM,MAAM,CAAC,gBAAgB,CAAC;YAC5B,MAAM,CA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,IAAI,CAAC,uBAAuB,CAAC,CAAC;QAC5D,OAAO,CAAC,GAAG,EAAE;QACb,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;AACzC,QAAA,OAAO,CAAC,GAAG,CAAC,CAAA,EAAA,EAAK,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA,kBAAA,EAAqB,OAAO,CAAA,CAAE,CAAC;AACnE,QAAA,OAAO,CAAC,GAAG,CAAC,CAAA,EAAA,EAAK,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA,qBAAA,CAAuB,CAAC;QAC9D,OAAO,CAAC,GAAG,EAAE;AACb,QAAA,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAA,MAAA,EAAS,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA,qBAAA,CAAuB,CAAC,CAAC;QACtE,OAAO,CAAC,GAAG,EAAE;;QAGb,MAAM,EAAE,WAAW,EAAE,GAAG,MAAM,OAAO,aAAgB,CAAC;AACtD,QAAA,MAAM,WAAW,CAAC;YAChB,KAAK,EAAE,CAAA,eAAA,EAAkB,OAAO,CAAA,UAAA,CAAY;AAC5C,YAAA,YAAY,EAAE,YAAY;AAC1B,YAAA,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,EAAE,IAAI,OAAO;YACtC,SAAS,EAAE,MAAM,CAAC,SAAS;YAC3B,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,OAAO,EAAE,KAAK;AACf,SAAA,CAAC;IAEJ;IAAE,OAAO,KAAK,EAAE;;AAEd,QAAA,MAAM,KAAK;IACb;AACF;;;;"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
// OpenBuilder CLI - Built with Rollup
|
|
2
|
+
import { existsSync } from 'node:fs';
|
|
3
|
+
import { readdir, stat } from 'node:fs/promises';
|
|
4
|
+
import chalk from 'chalk';
|
|
5
|
+
import { l as logger } from './logger-ZpJi7chw.js';
|
|
6
|
+
import { c as configManager } from './config-manager-BkbjtN-H.js';
|
|
7
|
+
import 'conf';
|
|
8
|
+
import 'node:os';
|
|
9
|
+
import 'node:path';
|
|
10
|
+
|
|
11
|
+
async function statusCommand() {
|
|
12
|
+
logger.section('OpenBuilder Runner Status');
|
|
13
|
+
// Check if initialized
|
|
14
|
+
const isInitialized = configManager.isInitialized();
|
|
15
|
+
logger.log('');
|
|
16
|
+
logger.info(`${chalk.bold('Status:')} ${isInitialized ? chalk.green('Initialized') : chalk.yellow('Not initialized')}`);
|
|
17
|
+
if (!isInitialized) {
|
|
18
|
+
logger.log('');
|
|
19
|
+
logger.warn('Run "openbuilder init" to initialize');
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
// Get configuration
|
|
23
|
+
const config = configManager.get();
|
|
24
|
+
logger.log('');
|
|
25
|
+
// Config file
|
|
26
|
+
logger.info(`${chalk.bold('Config File:')}`);
|
|
27
|
+
logger.log(` ${configManager.path}`);
|
|
28
|
+
logger.log('');
|
|
29
|
+
// Workspace
|
|
30
|
+
logger.info(`${chalk.bold('Workspace:')}`);
|
|
31
|
+
logger.log(` Path: ${config.workspace}`);
|
|
32
|
+
const workspaceExists = existsSync(config.workspace);
|
|
33
|
+
logger.log(` Exists: ${workspaceExists ? chalk.green('Yes') : chalk.red('No')}`);
|
|
34
|
+
if (workspaceExists) {
|
|
35
|
+
try {
|
|
36
|
+
const entries = await readdir(config.workspace);
|
|
37
|
+
const projects = [];
|
|
38
|
+
for (const entry of entries) {
|
|
39
|
+
const entryPath = `${config.workspace}/${entry}`;
|
|
40
|
+
const stats = await stat(entryPath);
|
|
41
|
+
if (stats.isDirectory()) {
|
|
42
|
+
projects.push(entry);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
logger.log(` Projects: ${projects.length}`);
|
|
46
|
+
if (projects.length > 0 && projects.length <= 10) {
|
|
47
|
+
projects.forEach(p => logger.log(` - ${p}`));
|
|
48
|
+
}
|
|
49
|
+
else if (projects.length > 10) {
|
|
50
|
+
projects.slice(0, 10).forEach(p => logger.log(` - ${p}`));
|
|
51
|
+
logger.log(` ... and ${projects.length - 10} more`);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
logger.log(` Projects: ${chalk.yellow('Unable to read')}`);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
logger.log('');
|
|
59
|
+
// Server
|
|
60
|
+
logger.info(`${chalk.bold('Server:')}`);
|
|
61
|
+
logger.log(` WebSocket URL: ${config.server?.wsUrl || 'not set'}`);
|
|
62
|
+
logger.log(` API URL: ${config.apiUrl || 'not set'}`);
|
|
63
|
+
logger.log(` Secret: ${config.server?.secret ? chalk.green('Set') : chalk.red('Not set')}`);
|
|
64
|
+
logger.log('');
|
|
65
|
+
// Runner
|
|
66
|
+
logger.info(`${chalk.bold('Runner:')}`);
|
|
67
|
+
logger.log(` ID: ${config.runner?.id || 'not set'}`);
|
|
68
|
+
logger.log(` Reconnect Attempts: ${config.runner?.reconnectAttempts || 5}`);
|
|
69
|
+
logger.log(` Heartbeat Interval: ${config.runner?.heartbeatInterval || 15000}ms`);
|
|
70
|
+
logger.log('');
|
|
71
|
+
// Validate configuration
|
|
72
|
+
const validation = configManager.validate();
|
|
73
|
+
logger.info(`${chalk.bold('Validation:')}`);
|
|
74
|
+
if (validation.valid) {
|
|
75
|
+
logger.log(` ${chalk.green('✓')} Configuration is valid`);
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
logger.log(` ${chalk.red('✗')} Configuration has errors:`);
|
|
79
|
+
validation.errors.forEach((err) => logger.log(` - ${chalk.red(err)}`));
|
|
80
|
+
}
|
|
81
|
+
logger.log('');
|
|
82
|
+
// Next steps
|
|
83
|
+
if (validation.valid) {
|
|
84
|
+
logger.info('Ready to run! Use:');
|
|
85
|
+
logger.log(` ${chalk.cyan('openbuilder run')} - Start local full stack`);
|
|
86
|
+
logger.log(` ${chalk.cyan('openbuilder runner')} - Connect to remote server`);
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
logger.info('Fix configuration errors with:');
|
|
90
|
+
logger.log(` ${chalk.cyan('openbuilder config set <key> <value>')}`);
|
|
91
|
+
logger.log(` or ${chalk.cyan('openbuilder init')} to reconfigure`);
|
|
92
|
+
}
|
|
93
|
+
logger.log('');
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export { statusCommand };
|
|
97
|
+
//# sourceMappingURL=status-cS8YwtUx.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status-cS8YwtUx.js","sources":["../../src/cli/commands/status.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\nimport { readdir, stat } from 'node:fs/promises';\nimport chalk from 'chalk';\nimport { logger } from '../utils/logger.js';\nimport { configManager } from '../utils/config-manager.js';\n\nexport async function statusCommand() {\n logger.section('OpenBuilder Runner Status');\n\n // Check if initialized\n const isInitialized = configManager.isInitialized();\n logger.log('');\n logger.info(`${chalk.bold('Status:')} ${isInitialized ? chalk.green('Initialized') : chalk.yellow('Not initialized')}`);\n\n if (!isInitialized) {\n logger.log('');\n logger.warn('Run \"openbuilder init\" to initialize');\n return;\n }\n\n // Get configuration\n const config = configManager.get();\n logger.log('');\n\n // Config file\n logger.info(`${chalk.bold('Config File:')}`);\n logger.log(` ${configManager.path}`);\n logger.log('');\n\n // Workspace\n logger.info(`${chalk.bold('Workspace:')}`);\n logger.log(` Path: ${config.workspace}`);\n\n const workspaceExists = existsSync(config.workspace);\n logger.log(` Exists: ${workspaceExists ? chalk.green('Yes') : chalk.red('No')}`);\n\n if (workspaceExists) {\n try {\n const entries = await readdir(config.workspace);\n const projects = [];\n\n for (const entry of entries) {\n const entryPath = `${config.workspace}/${entry}`;\n const stats = await stat(entryPath);\n if (stats.isDirectory()) {\n projects.push(entry);\n }\n }\n\n logger.log(` Projects: ${projects.length}`);\n if (projects.length > 0 && projects.length <= 10) {\n projects.forEach(p => logger.log(` - ${p}`));\n } else if (projects.length > 10) {\n projects.slice(0, 10).forEach(p => logger.log(` - ${p}`));\n logger.log(` ... and ${projects.length - 10} more`);\n }\n } catch (error) {\n logger.log(` Projects: ${chalk.yellow('Unable to read')}`);\n }\n }\n logger.log('');\n\n // Server\n logger.info(`${chalk.bold('Server:')}`);\n logger.log(` WebSocket URL: ${config.server?.wsUrl || 'not set'}`);\n logger.log(` API URL: ${config.apiUrl || 'not set'}`);\n logger.log(` Secret: ${config.server?.secret ? chalk.green('Set') : chalk.red('Not set')}`);\n logger.log('');\n\n // Runner\n logger.info(`${chalk.bold('Runner:')}`);\n logger.log(` ID: ${config.runner?.id || 'not set'}`);\n logger.log(` Reconnect Attempts: ${config.runner?.reconnectAttempts || 5}`);\n logger.log(` Heartbeat Interval: ${config.runner?.heartbeatInterval || 15000}ms`);\n logger.log('');\n\n // Validate configuration\n const validation = configManager.validate();\n logger.info(`${chalk.bold('Validation:')}`);\n if (validation.valid) {\n logger.log(` ${chalk.green('✓')} Configuration is valid`);\n } else {\n logger.log(` ${chalk.red('✗')} Configuration has errors:`);\n validation.errors.forEach((err) => logger.log(` - ${chalk.red(err)}`));\n }\n logger.log('');\n\n // Next steps\n if (validation.valid) {\n logger.info('Ready to run! Use:');\n logger.log(` ${chalk.cyan('openbuilder run')} - Start local full stack`);\n logger.log(` ${chalk.cyan('openbuilder runner')} - Connect to remote server`);\n } else {\n logger.info('Fix configuration errors with:');\n logger.log(` ${chalk.cyan('openbuilder config set <key> <value>')}`);\n logger.log(` or ${chalk.cyan('openbuilder init')} to reconfigure`);\n }\n logger.log('');\n}\n"],"names":[],"mappings":";;;;;;;;;;AAMO,eAAe,aAAa,GAAA;AACjC,IAAA,MAAM,CAAC,OAAO,CAAC,2BAA2B,CAAC;;AAG3C,IAAA,MAAM,aAAa,GAAG,aAAa,CAAC,aAAa,EAAE;AACnD,IAAA,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC;AACd,IAAA,MAAM,CAAC,IAAI,CAAC,CAA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|
7
|
+
cyan: '#06b6d4',
|
|
8
|
+
purple: '#a855f7',
|
|
9
|
+
brightPurple: '#c084fc',
|
|
10
|
+
// Status colors
|
|
11
|
+
success: '#22c55e',
|
|
12
|
+
error: '#ef4444',
|
|
13
|
+
warning: '#f59e0b',
|
|
14
|
+
// Neutral colors
|
|
15
|
+
white: '#ffffff',
|
|
16
|
+
gray: '#6b7280',
|
|
17
|
+
dimGray: '#4b5563',
|
|
18
|
+
darkGray: '#374151',
|
|
19
|
+
};
|
|
20
|
+
const symbols = {
|
|
21
|
+
// Progress indicators
|
|
22
|
+
filledDot: '●',
|
|
23
|
+
hollowDot: '○',
|
|
24
|
+
errorDot: '✗',
|
|
25
|
+
// Task states
|
|
26
|
+
check: '✓',
|
|
27
|
+
cross: '✗',
|
|
28
|
+
// Connectors
|
|
29
|
+
horizontalLine: '─',
|
|
30
|
+
// Spinners (will cycle through these)
|
|
31
|
+
spinnerFrames: ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'],
|
|
32
|
+
};
|
|
33
|
+
const layout = {
|
|
34
|
+
// Animation timing (slower as requested)
|
|
35
|
+
spinnerInterval: 120, // ms between spinner frames
|
|
36
|
+
taskCompletionDelay: 400, // ms to pause after task completion
|
|
37
|
+
stepTransitionDelay: 300, // ms between step transitions
|
|
38
|
+
// Shared width for progress stepper and task list (keeps them aligned)
|
|
39
|
+
// ProgressStepper: 4 cells * 10 chars + 3 connectors * 7 chars = 61 chars
|
|
40
|
+
progressWidth: 61,
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export { colors as c, layout as l, symbols as s };
|
|
44
|
+
//# sourceMappingURL=theme-DhorI2Hb.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme-DhorI2Hb.js","sources":["../../src/cli/tui/theme.ts"],"sourcesContent":["/**\n * Theme and color definitions for the TUI\n */\n\nexport const colors = {\n // Primary brand colors\n cyan: '#06b6d4',\n purple: '#a855f7',\n brightPurple: '#c084fc',\n \n // Status colors\n success: '#22c55e',\n error: '#ef4444',\n warning: '#f59e0b',\n \n // Neutral colors\n white: '#ffffff',\n gray: '#6b7280',\n dimGray: '#4b5563',\n darkGray: '#374151',\n};\n\nexport const symbols = {\n // Progress indicators\n filledDot: '●',\n hollowDot: '○',\n errorDot: '✗',\n \n // Task states\n check: '✓',\n cross: '✗',\n \n // Connectors\n horizontalLine: '─',\n treeConnector: '└─',\n \n // Spinners (will cycle through these)\n spinnerFrames: ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'],\n};\n\nexport const layout = {\n // Animation timing (slower as requested)\n spinnerInterval: 120, // ms between spinner frames\n taskCompletionDelay: 400, // ms to pause after task completion\n stepTransitionDelay: 300, // ms between step transitions\n \n // Shared width for progress stepper and task list (keeps them aligned)\n // ProgressStepper: 4 cells * 10 chars + 3 connectors * 7 chars = 61 chars\n progressWidth: 61,\n};\n"],"names":[],"mappings":";AAAA;;AAEG;AAEI,MAAM,MAAM,GAAG;;AAEpB,IAAA,IAAI,EAAE,SAAS;AACf,IAAA,MAAM,EAAE,SAAS;AACjB,IAAA,YAAY,EAAE,SAAS;;AAGvB,IAAA,OAAO,EAAE,SAAS;AAClB,IAAA,KAAK,EAAE,SAAS;AAChB,IAAA,OAAO,EAAE,SAAS;;AAGlB,IAAA,KAAK,EAAE,SAAS;AAChB,IAAA,IAAI,EAAE,SAAS;AACf,IAAA,OAAO,EAAE,SAAS;AAClB,IAAA,QAAQ,EAAE,SAAS;;AAGd,MAAM,OAAO,GAAG;;AAErB,IAAA,SAAS,EAAE,GAAG;AACd,IAAA,SAAS,EAAE,GAAG;AACd,IAAA,QAAQ,EAAE,GAAG;;AAGb,IAAA,KAAK,EAAE,GAAG;AACV,IAAA,KAAK,EAAE,GAAG;;AAGV,IAAA,cAAc,EAAE,GAAG;AACnB,IAEA;IACA,aAAa,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;;AAG5D,MAAM,MAAM,GAAG;;IAEpB,eAAe,EAAE,GAAG;IACpB,mBAAmB,EAAE,GAAG;IACxB,mBAAmB,EAAE,GAAG;;;AAIxB,IAAA,aAAa,EAAE,EAAE;;;;;"}
|
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
// OpenBuilder CLI - Built with Rollup
|
|
2
|
+
import { existsSync, readFileSync, rmSync, writeFileSync, renameSync } from 'node:fs';
|
|
3
|
+
import { join, dirname } from 'node:path';
|
|
4
|
+
import { execSync } from 'node:child_process';
|
|
5
|
+
import * as p from '@clack/prompts';
|
|
6
|
+
import pc from 'picocolors';
|
|
7
|
+
import { C as CLIError } from './cli-error-BjQwvWtK.js';
|
|
8
|
+
import { i as isInsideMonorepo } from './repo-detector-B_oj696o.js';
|
|
9
|
+
import { c as configManager } from './config-manager-BkbjtN-H.js';
|
|
10
|
+
import 'node:fs/promises';
|
|
11
|
+
import 'conf';
|
|
12
|
+
import 'node:os';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Upgrade command - In-place upgrade to latest version
|
|
16
|
+
* Preserves configuration and user data while replacing application code
|
|
17
|
+
*/
|
|
18
|
+
async function upgradeCommand(options) {
|
|
19
|
+
const s = p.spinner();
|
|
20
|
+
// Step 1: Find current monorepo
|
|
21
|
+
s.start('Locating OpenBuilder installation');
|
|
22
|
+
let monorepoRoot;
|
|
23
|
+
const config = configManager.get();
|
|
24
|
+
// Try config first
|
|
25
|
+
if (config.monorepoPath && existsSync(config.monorepoPath)) {
|
|
26
|
+
monorepoRoot = config.monorepoPath;
|
|
27
|
+
}
|
|
28
|
+
// Try detection if not in config
|
|
29
|
+
if (!monorepoRoot) {
|
|
30
|
+
const repoCheck = await isInsideMonorepo();
|
|
31
|
+
if (repoCheck.inside && repoCheck.root) {
|
|
32
|
+
monorepoRoot = repoCheck.root;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
if (!monorepoRoot) {
|
|
36
|
+
s.stop(pc.red('✗') + ' OpenBuilder installation not found');
|
|
37
|
+
throw new CLIError({
|
|
38
|
+
code: 'UPGRADE_NOT_IN_REPO',
|
|
39
|
+
message: 'Could not locate OpenBuilder installation',
|
|
40
|
+
suggestions: [
|
|
41
|
+
'Run from within OpenBuilder directory',
|
|
42
|
+
'Or run init first: openbuilder init',
|
|
43
|
+
config.monorepoPath ? `Configured path not found: ${config.monorepoPath}` : 'No installation path configured',
|
|
44
|
+
],
|
|
45
|
+
docs: 'https://github.com/codyde/openbuilder#upgrade',
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
s.stop(pc.green('✓') + ` Found: ${monorepoRoot}`);
|
|
49
|
+
// Step 2: Check git status
|
|
50
|
+
if (!options.force) {
|
|
51
|
+
s.start('Checking for uncommitted changes');
|
|
52
|
+
try {
|
|
53
|
+
const gitStatus = execSync('git status --porcelain', {
|
|
54
|
+
cwd: monorepoRoot,
|
|
55
|
+
encoding: 'utf-8',
|
|
56
|
+
}).trim();
|
|
57
|
+
if (gitStatus.length > 0) {
|
|
58
|
+
s.stop(pc.yellow('⚠') + ' Uncommitted changes detected');
|
|
59
|
+
const changes = gitStatus.split('\n').slice(0, 5);
|
|
60
|
+
console.log(pc.dim(' Modified files:'));
|
|
61
|
+
changes.forEach(line => console.log(pc.dim(` ${line}`)));
|
|
62
|
+
if (!options.force) {
|
|
63
|
+
const confirm = await p.confirm({
|
|
64
|
+
message: 'Continue upgrade? This will discard local changes.',
|
|
65
|
+
initialValue: false,
|
|
66
|
+
});
|
|
67
|
+
if (!confirm || p.isCancel(confirm)) {
|
|
68
|
+
console.log(pc.dim('\nUpgrade cancelled'));
|
|
69
|
+
process.exit(0);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
s.stop(pc.green('✓') + ' No uncommitted changes');
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
s.stop(pc.yellow('⚠') + ' Not a git repository');
|
|
79
|
+
// Continue anyway - user might have extracted from tarball
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
// Step 3: Backup configuration files
|
|
83
|
+
s.start('Backing up configuration files');
|
|
84
|
+
const envBackup = {
|
|
85
|
+
runner: {},
|
|
86
|
+
openbuilder: {},
|
|
87
|
+
};
|
|
88
|
+
// Define paths to check
|
|
89
|
+
const envPaths = [
|
|
90
|
+
{ app: 'runner', path: join(monorepoRoot, 'apps/runner/.env') },
|
|
91
|
+
{ app: 'runner', pathLocal: join(monorepoRoot, 'apps/runner/.env.local') },
|
|
92
|
+
{ app: 'openbuilder', path: join(monorepoRoot, 'apps/openbuilder/.env') },
|
|
93
|
+
{ app: 'openbuilder', pathLocal: join(monorepoRoot, 'apps/openbuilder/.env.local') },
|
|
94
|
+
];
|
|
95
|
+
let backedUpCount = 0;
|
|
96
|
+
for (const item of envPaths) {
|
|
97
|
+
const app = item.app;
|
|
98
|
+
const filePath = item.path || item.pathLocal;
|
|
99
|
+
const isLocal = !!item.pathLocal;
|
|
100
|
+
if (existsSync(filePath)) {
|
|
101
|
+
const content = readFileSync(filePath, 'utf-8');
|
|
102
|
+
if (isLocal) {
|
|
103
|
+
envBackup[app].envLocal = content;
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
envBackup[app].env = content;
|
|
107
|
+
}
|
|
108
|
+
backedUpCount++;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
s.stop(pc.green('✓') + ` Backed up ${backedUpCount} configuration file(s)`);
|
|
112
|
+
// Step 4: Determine branch
|
|
113
|
+
const branch = options.branch || 'main';
|
|
114
|
+
s.start(`Cloning fresh copy from ${pc.cyan(branch)}`);
|
|
115
|
+
const parentDir = dirname(monorepoRoot);
|
|
116
|
+
const repoName = monorepoRoot.split('/').pop();
|
|
117
|
+
const tempDir = join(parentDir, `${repoName}-upgrade-temp`);
|
|
118
|
+
// Remove temp directory if it exists from failed previous upgrade
|
|
119
|
+
if (existsSync(tempDir)) {
|
|
120
|
+
rmSync(tempDir, { recursive: true, force: true });
|
|
121
|
+
}
|
|
122
|
+
try {
|
|
123
|
+
execSync(`git clone --branch ${branch} --depth 1 https://github.com/codyde/openbuilder.git "${tempDir}"`, {
|
|
124
|
+
cwd: parentDir,
|
|
125
|
+
stdio: 'pipe', // Silent
|
|
126
|
+
});
|
|
127
|
+
s.stop(pc.green('✓') + ' Cloned successfully');
|
|
128
|
+
}
|
|
129
|
+
catch (error) {
|
|
130
|
+
s.stop(pc.red('✗') + ' Clone failed');
|
|
131
|
+
// Cleanup temp dir
|
|
132
|
+
if (existsSync(tempDir)) {
|
|
133
|
+
rmSync(tempDir, { recursive: true, force: true });
|
|
134
|
+
}
|
|
135
|
+
throw new CLIError({
|
|
136
|
+
code: 'UPGRADE_CLONE_FAILED',
|
|
137
|
+
message: `Failed to clone branch "${branch}"`,
|
|
138
|
+
suggestions: [
|
|
139
|
+
'Check your internet connection',
|
|
140
|
+
'Verify the branch exists: https://github.com/codyde/openbuilder/tree/' + branch,
|
|
141
|
+
'Try upgrading to main: openbuilder upgrade',
|
|
142
|
+
],
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
// Step 5: Restore configuration files
|
|
146
|
+
s.start('Restoring configuration files');
|
|
147
|
+
let restoredCount = 0;
|
|
148
|
+
const restorePaths = [
|
|
149
|
+
{ app: 'runner', file: '.env', dir: join(tempDir, 'apps/runner') },
|
|
150
|
+
{ app: 'runner', file: '.env.local', dir: join(tempDir, 'apps/runner') },
|
|
151
|
+
{ app: 'openbuilder', file: '.env', dir: join(tempDir, 'apps/openbuilder') },
|
|
152
|
+
{ app: 'openbuilder', file: '.env.local', dir: join(tempDir, 'apps/openbuilder') },
|
|
153
|
+
];
|
|
154
|
+
for (const item of restorePaths) {
|
|
155
|
+
const isLocal = item.file === '.env.local';
|
|
156
|
+
const backupContent = isLocal ? envBackup[item.app].envLocal : envBackup[item.app].env;
|
|
157
|
+
if (backupContent) {
|
|
158
|
+
const targetPath = join(item.dir, item.file);
|
|
159
|
+
writeFileSync(targetPath, backupContent, 'utf-8');
|
|
160
|
+
restoredCount++;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
s.stop(pc.green('✓') + ` Restored ${restoredCount} configuration file(s)`);
|
|
164
|
+
// Step 6: Install dependencies
|
|
165
|
+
s.start('Installing dependencies');
|
|
166
|
+
try {
|
|
167
|
+
execSync('pnpm install', {
|
|
168
|
+
cwd: tempDir,
|
|
169
|
+
stdio: 'pipe',
|
|
170
|
+
env: { ...process.env, TURBO_TELEMETRY_DISABLED: '1' },
|
|
171
|
+
});
|
|
172
|
+
s.stop(pc.green('✓') + ' Dependencies installed');
|
|
173
|
+
}
|
|
174
|
+
catch (error) {
|
|
175
|
+
s.stop(pc.red('✗') + ' Dependency installation failed');
|
|
176
|
+
// Cleanup
|
|
177
|
+
rmSync(tempDir, { recursive: true, force: true });
|
|
178
|
+
throw new CLIError({
|
|
179
|
+
code: 'UPGRADE_INSTALL_FAILED',
|
|
180
|
+
message: 'Failed to install dependencies in new version',
|
|
181
|
+
suggestions: [
|
|
182
|
+
'Check if the branch is stable',
|
|
183
|
+
'Try upgrading to main instead',
|
|
184
|
+
'Check disk space',
|
|
185
|
+
],
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
// Step 7: Build services
|
|
189
|
+
s.start('Building services (this may take a moment)');
|
|
190
|
+
try {
|
|
191
|
+
execSync('pnpm turbo build', {
|
|
192
|
+
cwd: tempDir,
|
|
193
|
+
stdio: 'pipe',
|
|
194
|
+
env: { ...process.env, TURBO_TELEMETRY_DISABLED: '1' },
|
|
195
|
+
});
|
|
196
|
+
s.stop(pc.green('✓') + ' Build successful');
|
|
197
|
+
}
|
|
198
|
+
catch (error) {
|
|
199
|
+
s.stop(pc.red('✗') + ' Build failed');
|
|
200
|
+
// Try to extract error message from execSync error
|
|
201
|
+
let errorOutput = '';
|
|
202
|
+
if (error && typeof error === 'object' && 'stderr' in error) {
|
|
203
|
+
errorOutput = String(error.stderr || '');
|
|
204
|
+
}
|
|
205
|
+
if (!errorOutput && error && typeof error === 'object' && 'stdout' in error) {
|
|
206
|
+
errorOutput = String(error.stdout || '');
|
|
207
|
+
}
|
|
208
|
+
// Show error details if available
|
|
209
|
+
if (errorOutput) {
|
|
210
|
+
console.log(pc.red('\nBuild errors:'));
|
|
211
|
+
console.log(pc.gray('─'.repeat(60)));
|
|
212
|
+
const lines = errorOutput.split('\n').slice(-20);
|
|
213
|
+
lines.forEach(line => console.log(pc.red(` ${line}`)));
|
|
214
|
+
console.log(pc.gray('─'.repeat(60)));
|
|
215
|
+
console.log('');
|
|
216
|
+
}
|
|
217
|
+
// Cleanup
|
|
218
|
+
rmSync(tempDir, { recursive: true, force: true });
|
|
219
|
+
throw new CLIError({
|
|
220
|
+
code: 'UPGRADE_BUILD_FAILED',
|
|
221
|
+
message: 'Failed to build new version',
|
|
222
|
+
suggestions: [
|
|
223
|
+
'The branch may have build errors',
|
|
224
|
+
'Try upgrading to a stable release tag',
|
|
225
|
+
'Check build logs for errors',
|
|
226
|
+
],
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
// Step 7.5: Apply database migrations (if DATABASE_URL exists)
|
|
230
|
+
const databaseUrl = envBackup.openbuilder.env?.match(/DATABASE_URL=["']?([^"'\n]+)["']?/)?.[1] ||
|
|
231
|
+
envBackup.openbuilder.envLocal?.match(/DATABASE_URL=["']?([^"'\n]+)["']?/)?.[1] ||
|
|
232
|
+
process.env.DATABASE_URL;
|
|
233
|
+
if (databaseUrl) {
|
|
234
|
+
s.start('Applying database migrations');
|
|
235
|
+
try {
|
|
236
|
+
execSync('npx drizzle-kit push --config=drizzle.config.ts', {
|
|
237
|
+
cwd: join(tempDir, 'apps/openbuilder'),
|
|
238
|
+
stdio: 'pipe',
|
|
239
|
+
env: {
|
|
240
|
+
...process.env,
|
|
241
|
+
DATABASE_URL: databaseUrl,
|
|
242
|
+
},
|
|
243
|
+
});
|
|
244
|
+
s.stop(pc.green('✓') + ' Database schema updated');
|
|
245
|
+
}
|
|
246
|
+
catch (error) {
|
|
247
|
+
s.stop(pc.yellow('⚠') + ' Migration failed');
|
|
248
|
+
console.log(pc.dim(' You may need to run: openbuilder database'));
|
|
249
|
+
console.log(pc.dim(' This won\'t prevent the upgrade from completing'));
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
else {
|
|
253
|
+
s.start('Skipping database migrations (no DATABASE_URL found)');
|
|
254
|
+
s.stop(pc.yellow('⚠') + ' No database configured');
|
|
255
|
+
}
|
|
256
|
+
// Step 8: Swap directories (atomic operation)
|
|
257
|
+
s.start('Finalizing upgrade');
|
|
258
|
+
const backupDir = join(parentDir, `${repoName}-backup-${Date.now()}`);
|
|
259
|
+
try {
|
|
260
|
+
// Rename current installation to backup
|
|
261
|
+
renameSync(monorepoRoot, backupDir);
|
|
262
|
+
// Rename new installation to production
|
|
263
|
+
renameSync(tempDir, monorepoRoot);
|
|
264
|
+
s.stop(pc.green('✓') + ' Upgrade finalized');
|
|
265
|
+
}
|
|
266
|
+
catch (error) {
|
|
267
|
+
s.stop(pc.red('✗') + ' Failed to swap directories');
|
|
268
|
+
// Attempt recovery
|
|
269
|
+
try {
|
|
270
|
+
if (existsSync(backupDir)) {
|
|
271
|
+
renameSync(backupDir, monorepoRoot);
|
|
272
|
+
console.log(pc.yellow('⚠') + ' Restored original installation');
|
|
273
|
+
}
|
|
274
|
+
if (existsSync(tempDir)) {
|
|
275
|
+
rmSync(tempDir, { recursive: true, force: true });
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
catch (recoveryError) {
|
|
279
|
+
console.error(pc.red('❌') + ' Failed to recover. Manual intervention required.');
|
|
280
|
+
console.error(pc.dim(` Backup location: ${backupDir}`));
|
|
281
|
+
}
|
|
282
|
+
throw error;
|
|
283
|
+
}
|
|
284
|
+
// Step 9: Cleanup backup
|
|
285
|
+
s.start('Cleaning up');
|
|
286
|
+
try {
|
|
287
|
+
rmSync(backupDir, { recursive: true, force: true });
|
|
288
|
+
s.stop(pc.green('✓') + ' Cleanup complete');
|
|
289
|
+
}
|
|
290
|
+
catch (error) {
|
|
291
|
+
s.stop(pc.yellow('⚠') + ' Could not remove backup');
|
|
292
|
+
console.log(pc.dim(` You can manually delete: ${backupDir}`));
|
|
293
|
+
}
|
|
294
|
+
// Success!
|
|
295
|
+
console.log();
|
|
296
|
+
console.log(pc.green('✓') + pc.bold(' Upgrade complete!'));
|
|
297
|
+
console.log();
|
|
298
|
+
// Check if user is currently inside the monorepo directory
|
|
299
|
+
const currentDir = process.cwd();
|
|
300
|
+
const isCurrentlyInMonorepo = currentDir.startsWith(monorepoRoot);
|
|
301
|
+
if (isCurrentlyInMonorepo) {
|
|
302
|
+
console.log(pc.yellow('⚠') + pc.bold(' IMPORTANT: Your shell directory is stale'));
|
|
303
|
+
console.log();
|
|
304
|
+
console.log(pc.dim(' The upgrade renamed directories while you were inside them.'));
|
|
305
|
+
console.log(pc.dim(' You need to refresh your shell location:'));
|
|
306
|
+
console.log();
|
|
307
|
+
console.log(pc.cyan(' cd .. && cd ' + monorepoRoot.split('/').pop()));
|
|
308
|
+
console.log();
|
|
309
|
+
console.log(pc.dim(' Or simply close and reopen your terminal.'));
|
|
310
|
+
console.log();
|
|
311
|
+
}
|
|
312
|
+
console.log(pc.dim(' Note: Restart your terminal to use the updated CLI'));
|
|
313
|
+
console.log(pc.dim(' Or run: hash -r'));
|
|
314
|
+
console.log();
|
|
315
|
+
if (branch !== 'main') {
|
|
316
|
+
console.log(pc.yellow('⚠') + ` You upgraded to branch: ${pc.cyan(branch)}`);
|
|
317
|
+
console.log(pc.dim(' To return to main: openbuilder upgrade'));
|
|
318
|
+
console.log();
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
export { upgradeCommand };
|
|
323
|
+
//# sourceMappingURL=upgrade-CT6w0lKp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upgrade-CT6w0lKp.js","sources":["../../src/cli/commands/upgrade.ts"],"sourcesContent":["/**\n * Upgrade command - In-place upgrade to latest version\n * Preserves configuration and user data while replacing application code\n */\n\nimport { existsSync, readFileSync, writeFileSync, mkdirSync, rmSync, renameSync, copyFileSync } from 'node:fs';\nimport { join, dirname } from 'node:path';\nimport { execSync } from 'node:child_process';\nimport * as p from '@clack/prompts';\nimport pc from 'picocolors';\nimport { CLIError, errors } from '../utils/cli-error.js';\nimport { isInsideMonorepo } from '../utils/repo-detector.js';\nimport { configManager } from '../utils/config-manager.js';\n\ninterface UpgradeOptions {\n branch?: string;\n force?: boolean;\n}\n\ninterface EnvBackup {\n runner: { env?: string; envLocal?: string };\n openbuilder: { env?: string; envLocal?: string };\n}\n\nexport async function upgradeCommand(options: UpgradeOptions) {\n const s = p.spinner();\n\n // Step 1: Find current monorepo\n s.start('Locating OpenBuilder installation');\n\n let monorepoRoot: string | undefined;\n const config = configManager.get();\n\n // Try config first\n if (config.monorepoPath && existsSync(config.monorepoPath)) {\n monorepoRoot = config.monorepoPath;\n }\n\n // Try detection if not in config\n if (!monorepoRoot) {\n const repoCheck = await isInsideMonorepo();\n if (repoCheck.inside && repoCheck.root) {\n monorepoRoot = repoCheck.root;\n }\n }\n\n if (!monorepoRoot) {\n s.stop(pc.red('✗') + ' OpenBuilder installation not found');\n throw new CLIError({\n code: 'UPGRADE_NOT_IN_REPO',\n message: 'Could not locate OpenBuilder installation',\n suggestions: [\n 'Run from within OpenBuilder directory',\n 'Or run init first: openbuilder init',\n config.monorepoPath ? `Configured path not found: ${config.monorepoPath}` : 'No installation path configured',\n ],\n docs: 'https://github.com/codyde/openbuilder#upgrade',\n });\n }\n\n s.stop(pc.green('✓') + ` Found: ${monorepoRoot}`);\n\n // Step 2: Check git status\n if (!options.force) {\n s.start('Checking for uncommitted changes');\n\n try {\n const gitStatus = execSync('git status --porcelain', {\n cwd: monorepoRoot,\n encoding: 'utf-8',\n }).trim();\n\n if (gitStatus.length > 0) {\n s.stop(pc.yellow('⚠') + ' Uncommitted changes detected');\n\n const changes = gitStatus.split('\\n').slice(0, 5);\n console.log(pc.dim(' Modified files:'));\n changes.forEach(line => console.log(pc.dim(` ${line}`)));\n\n if (!options.force) {\n const confirm = await p.confirm({\n message: 'Continue upgrade? This will discard local changes.',\n initialValue: false,\n });\n\n if (!confirm || p.isCancel(confirm)) {\n console.log(pc.dim('\\nUpgrade cancelled'));\n process.exit(0);\n }\n }\n } else {\n s.stop(pc.green('✓') + ' No uncommitted changes');\n }\n } catch (error) {\n s.stop(pc.yellow('⚠') + ' Not a git repository');\n // Continue anyway - user might have extracted from tarball\n }\n }\n\n // Step 3: Backup configuration files\n s.start('Backing up configuration files');\n\n const envBackup: EnvBackup = {\n runner: {},\n openbuilder: {},\n };\n\n // Define paths to check\n const envPaths = [\n { app: 'runner', path: join(monorepoRoot, 'apps/runner/.env') },\n { app: 'runner', pathLocal: join(monorepoRoot, 'apps/runner/.env.local') },\n { app: 'openbuilder', path: join(monorepoRoot, 'apps/openbuilder/.env') },\n { app: 'openbuilder', pathLocal: join(monorepoRoot, 'apps/openbuilder/.env.local') },\n ];\n\n let backedUpCount = 0;\n\n for (const item of envPaths) {\n const app = item.app as keyof EnvBackup;\n const filePath = item.path || item.pathLocal!;\n const isLocal = !!item.pathLocal;\n\n if (existsSync(filePath)) {\n const content = readFileSync(filePath, 'utf-8');\n if (isLocal) {\n envBackup[app].envLocal = content;\n } else {\n envBackup[app].env = content;\n }\n backedUpCount++;\n }\n }\n\n s.stop(pc.green('✓') + ` Backed up ${backedUpCount} configuration file(s)`);\n\n // Step 4: Determine branch\n const branch = options.branch || 'main';\n\n s.start(`Cloning fresh copy from ${pc.cyan(branch)}`);\n\n const parentDir = dirname(monorepoRoot);\n const repoName = monorepoRoot.split('/').pop();\n const tempDir = join(parentDir, `${repoName}-upgrade-temp`);\n\n // Remove temp directory if it exists from failed previous upgrade\n if (existsSync(tempDir)) {\n rmSync(tempDir, { recursive: true, force: true });\n }\n\n try {\n execSync(\n `git clone --branch ${branch} --depth 1 https://github.com/codyde/openbuilder.git \"${tempDir}\"`,\n {\n cwd: parentDir,\n stdio: 'pipe', // Silent\n }\n );\n\n s.stop(pc.green('✓') + ' Cloned successfully');\n } catch (error) {\n s.stop(pc.red('✗') + ' Clone failed');\n\n // Cleanup temp dir\n if (existsSync(tempDir)) {\n rmSync(tempDir, { recursive: true, force: true });\n }\n\n throw new CLIError({\n code: 'UPGRADE_CLONE_FAILED',\n message: `Failed to clone branch \"${branch}\"`,\n suggestions: [\n 'Check your internet connection',\n 'Verify the branch exists: https://github.com/codyde/openbuilder/tree/' + branch,\n 'Try upgrading to main: openbuilder upgrade',\n ],\n });\n }\n\n // Step 5: Restore configuration files\n s.start('Restoring configuration files');\n\n let restoredCount = 0;\n\n const restorePaths = [\n { app: 'runner' as const, file: '.env', dir: join(tempDir, 'apps/runner') },\n { app: 'runner' as const, file: '.env.local', dir: join(tempDir, 'apps/runner') },\n { app: 'openbuilder' as const, file: '.env', dir: join(tempDir, 'apps/openbuilder') },\n { app: 'openbuilder' as const, file: '.env.local', dir: join(tempDir, 'apps/openbuilder') },\n ];\n\n for (const item of restorePaths) {\n const isLocal = item.file === '.env.local';\n const backupContent = isLocal ? envBackup[item.app].envLocal : envBackup[item.app].env;\n\n if (backupContent) {\n const targetPath = join(item.dir, item.file);\n writeFileSync(targetPath, backupContent, 'utf-8');\n restoredCount++;\n }\n }\n\n s.stop(pc.green('✓') + ` Restored ${restoredCount} configuration file(s)`);\n\n // Step 6: Install dependencies\n s.start('Installing dependencies');\n\n try {\n execSync('pnpm install', {\n cwd: tempDir,\n stdio: 'pipe',\n env: { ...process.env, TURBO_TELEMETRY_DISABLED: '1' },\n });\n\n s.stop(pc.green('✓') + ' Dependencies installed');\n } catch (error) {\n s.stop(pc.red('✗') + ' Dependency installation failed');\n\n // Cleanup\n rmSync(tempDir, { recursive: true, force: true });\n\n throw new CLIError({\n code: 'UPGRADE_INSTALL_FAILED',\n message: 'Failed to install dependencies in new version',\n suggestions: [\n 'Check if the branch is stable',\n 'Try upgrading to main instead',\n 'Check disk space',\n ],\n });\n }\n\n // Step 7: Build services\n s.start('Building services (this may take a moment)');\n\n try {\n execSync('pnpm turbo build', {\n cwd: tempDir,\n stdio: 'pipe',\n env: { ...process.env, TURBO_TELEMETRY_DISABLED: '1' },\n });\n\n s.stop(pc.green('✓') + ' Build successful');\n } catch (error) {\n s.stop(pc.red('✗') + ' Build failed');\n\n // Try to extract error message from execSync error\n let errorOutput = '';\n if (error && typeof error === 'object' && 'stderr' in error) {\n errorOutput = String((error as { stderr?: unknown }).stderr || '');\n }\n if (!errorOutput && error && typeof error === 'object' && 'stdout' in error) {\n errorOutput = String((error as { stdout?: unknown }).stdout || '');\n }\n\n // Show error details if available\n if (errorOutput) {\n console.log(pc.red('\\nBuild errors:'));\n console.log(pc.gray('─'.repeat(60)));\n const lines = errorOutput.split('\\n').slice(-20);\n lines.forEach(line => console.log(pc.red(` ${line}`)));\n console.log(pc.gray('─'.repeat(60)));\n console.log('');\n }\n\n // Cleanup\n rmSync(tempDir, { recursive: true, force: true });\n\n throw new CLIError({\n code: 'UPGRADE_BUILD_FAILED',\n message: 'Failed to build new version',\n suggestions: [\n 'The branch may have build errors',\n 'Try upgrading to a stable release tag',\n 'Check build logs for errors',\n ],\n });\n }\n\n // Step 7.5: Apply database migrations (if DATABASE_URL exists)\n const databaseUrl =\n envBackup.openbuilder.env?.match(/DATABASE_URL=[\"']?([^\"'\\n]+)[\"']?/)?.[1] ||\n envBackup.openbuilder.envLocal?.match(/DATABASE_URL=[\"']?([^\"'\\n]+)[\"']?/)?.[1] ||\n process.env.DATABASE_URL;\n\n if (databaseUrl) {\n s.start('Applying database migrations');\n\n try {\n execSync('npx drizzle-kit push --config=drizzle.config.ts', {\n cwd: join(tempDir, 'apps/openbuilder'),\n stdio: 'pipe',\n env: {\n ...process.env,\n DATABASE_URL: databaseUrl,\n },\n });\n\n s.stop(pc.green('✓') + ' Database schema updated');\n } catch (error) {\n s.stop(pc.yellow('⚠') + ' Migration failed');\n console.log(pc.dim(' You may need to run: openbuilder database'));\n console.log(pc.dim(' This won\\'t prevent the upgrade from completing'));\n }\n } else {\n s.start('Skipping database migrations (no DATABASE_URL found)');\n s.stop(pc.yellow('⚠') + ' No database configured');\n }\n\n // Step 8: Swap directories (atomic operation)\n s.start('Finalizing upgrade');\n\n const backupDir = join(parentDir, `${repoName}-backup-${Date.now()}`);\n\n try {\n // Rename current installation to backup\n renameSync(monorepoRoot, backupDir);\n\n // Rename new installation to production\n renameSync(tempDir, monorepoRoot);\n\n s.stop(pc.green('✓') + ' Upgrade finalized');\n } catch (error) {\n s.stop(pc.red('✗') + ' Failed to swap directories');\n\n // Attempt recovery\n try {\n if (existsSync(backupDir)) {\n renameSync(backupDir, monorepoRoot);\n console.log(pc.yellow('⚠') + ' Restored original installation');\n }\n if (existsSync(tempDir)) {\n rmSync(tempDir, { recursive: true, force: true });\n }\n } catch (recoveryError) {\n console.error(pc.red('❌') + ' Failed to recover. Manual intervention required.');\n console.error(pc.dim(` Backup location: ${backupDir}`));\n }\n\n throw error;\n }\n\n // Step 9: Cleanup backup\n s.start('Cleaning up');\n\n try {\n rmSync(backupDir, { recursive: true, force: true });\n s.stop(pc.green('✓') + ' Cleanup complete');\n } catch (error) {\n s.stop(pc.yellow('⚠') + ' Could not remove backup');\n console.log(pc.dim(` You can manually delete: ${backupDir}`));\n }\n\n // Success!\n console.log();\n console.log(pc.green('✓') + pc.bold(' Upgrade complete!'));\n console.log();\n\n // Check if user is currently inside the monorepo directory\n const currentDir = process.cwd();\n const isCurrentlyInMonorepo = currentDir.startsWith(monorepoRoot);\n\n if (isCurrentlyInMonorepo) {\n console.log(pc.yellow('⚠') + pc.bold(' IMPORTANT: Your shell directory is stale'));\n console.log();\n console.log(pc.dim(' The upgrade renamed directories while you were inside them.'));\n console.log(pc.dim(' You need to refresh your shell location:'));\n console.log();\n console.log(pc.cyan(' cd .. && cd ' + monorepoRoot.split('/').pop()));\n console.log();\n console.log(pc.dim(' Or simply close and reopen your terminal.'));\n console.log();\n }\n\n console.log(pc.dim(' Note: Restart your terminal to use the updated CLI'));\n console.log(pc.dim(' Or run: hash -r'));\n console.log();\n\n if (branch !== 'main') {\n console.log(pc.yellow('⚠') + ` You upgraded to branch: ${pc.cyan(branch)}`);\n console.log(pc.dim(' To return to main: openbuilder upgrade'));\n console.log();\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;AAAA;;;AAGG;AAqBI,eAAe,cAAc,CAAC,OAAuB,EAAA;AAC1D,IAAA,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE;;AAGrB,IAAA,CAAC,CAAC,KAAK,CAAC,mCAAmC,CAAC;AAE5C,IAAA,IAAI,YAAgC;AACpC,IAAA,MAAM,MAAM,GAAG,aAAa,CAAC,GAAG,EAAE;;IAGlC,IAAI,MAAM,CAAC,YAAY,IAAI,UAAU,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE;AAC1D,QAAA,YAAY,GAAG,MAAM,CAAC,YAAY;IACpC;;IAGA,IAAI,CAAC,YAAY,EAAE;AACjB,QAAA,MAAM,SAAS,GAAG,MAAM,gBAAgB,EAAE;QAC1C,IAAI,SAAS,CAAC,MAAM,IAAI,SAAS,CAAC,IAAI,EAAE;AACtC,YAAA,YAAY,GAAG,SAAS,CAAC,IAAI;QAC/B;IACF;IAEA,IAAI,CAAC,YAAY,EAAE;AACjB,QAAA,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,qCAAqC,CAAC;QAC3D,MAAM,IAAI,QAAQ,CAAC;AACjB,YAAA,IAAI,EAAE,qBAAqB;AAC3B,YAAA,OAAO,EAAE,2CAA2C;AACpD,YAAA,WAAW,EAAE;gBACX,uCAAuC;gBACvC,qCAAqC;AACrC,gBAAA,MAAM,CAAC,YA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