@openbuilder/cli 0.50.24 → 0.50.26
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.
|
@@ -153,40 +153,6 @@ function performAppUpgrade() {
|
|
|
153
153
|
return false;
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
|
-
/**
|
|
157
|
-
* Re-launch the CLI with original arguments after update
|
|
158
|
-
*/
|
|
159
|
-
function relaunchCLI() {
|
|
160
|
-
const args = process.argv.slice(2);
|
|
161
|
-
try {
|
|
162
|
-
// Get the actual path to openbuilder to avoid shell hash caching issues
|
|
163
|
-
// This ensures we run the newly installed version, not a cached path
|
|
164
|
-
let openbuilderPath = 'openbuilder';
|
|
165
|
-
try {
|
|
166
|
-
// Use 'command -v' to get the actual path, bypassing shell hash
|
|
167
|
-
openbuilderPath = execSync('command -v openbuilder', { encoding: 'utf-8' }).trim();
|
|
168
|
-
}
|
|
169
|
-
catch {
|
|
170
|
-
// Fallback to just 'openbuilder' if command -v fails
|
|
171
|
-
}
|
|
172
|
-
// Use spawnSync with the explicit path to ensure we get the new version
|
|
173
|
-
const result = spawnSync(openbuilderPath, args, {
|
|
174
|
-
stdio: 'inherit',
|
|
175
|
-
env: {
|
|
176
|
-
...process.env,
|
|
177
|
-
OPENBUILDER_SKIP_UPDATE_CHECK: '1', // Prevent update loop
|
|
178
|
-
OPENBUILDER_SKIP_BANNER: '1', // Suppress banner after restart (already shown before update)
|
|
179
|
-
},
|
|
180
|
-
// Don't use shell: true to avoid shell hash caching
|
|
181
|
-
});
|
|
182
|
-
// Exit with the same code as the relaunched process
|
|
183
|
-
process.exit(result.status ?? 0);
|
|
184
|
-
}
|
|
185
|
-
catch {
|
|
186
|
-
// If relaunch fails, just exit - user can run command again
|
|
187
|
-
process.exit(0);
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
156
|
/**
|
|
191
157
|
* Main auto-update check function
|
|
192
158
|
* Call this early in CLI startup
|
|
@@ -259,8 +225,8 @@ async function checkAndAutoUpdate(currentVersion) {
|
|
|
259
225
|
console.log();
|
|
260
226
|
console.log(` ${pc.cyan('⬆')} ${pc.bold('Update available:')} ${pc.dim(currentVersion)} → ${pc.green(latestVersion)}`);
|
|
261
227
|
console.log();
|
|
262
|
-
//
|
|
263
|
-
console.log(` ${pc.dim('
|
|
228
|
+
// Perform the CLI update
|
|
229
|
+
console.log(` ${pc.dim('Updating CLI...')}`);
|
|
264
230
|
const cliSuccess = performCLIUpdate();
|
|
265
231
|
if (!cliSuccess) {
|
|
266
232
|
// CLI update failed, continue with current version
|
|
@@ -271,28 +237,28 @@ async function checkAndAutoUpdate(currentVersion) {
|
|
|
271
237
|
return false;
|
|
272
238
|
}
|
|
273
239
|
console.log(` ${pc.green('✓')} CLI updated to ${pc.green(latestVersion)}`);
|
|
274
|
-
//
|
|
240
|
+
// Check if we need to upgrade the app
|
|
275
241
|
const monorepoPath = config.monorepoPath;
|
|
276
242
|
const hasMonorepo = monorepoPath && existsSync(monorepoPath);
|
|
277
243
|
if (hasMonorepo) {
|
|
278
244
|
// Mark that we need to upgrade the app after CLI restart
|
|
279
|
-
// The new CLI version will handle the app upgrade
|
|
280
245
|
saveUpdateCache({
|
|
281
246
|
lastCheck: now,
|
|
282
247
|
latestVersion,
|
|
283
248
|
pendingAppUpgrade: true,
|
|
284
249
|
});
|
|
285
|
-
console.log();
|
|
286
|
-
console.log(` ${pc.dim('Step 2/2:')} App upgrade will continue after restart...`);
|
|
287
250
|
}
|
|
288
251
|
console.log();
|
|
289
|
-
console.log(` ${pc.green('✓')} ${pc.bold('
|
|
252
|
+
console.log(` ${pc.green('✓')} ${pc.bold('Update complete!')}`);
|
|
253
|
+
console.log();
|
|
254
|
+
console.log(` ${pc.yellow('⚠')} ${pc.bold('Please restart your terminal')} or run:`);
|
|
255
|
+
console.log(` ${pc.cyan('hash -r')} ${pc.dim('(bash/zsh)')}`);
|
|
256
|
+
console.log();
|
|
257
|
+
console.log(` ${pc.dim('Then run')} ${pc.cyan('openbuilder')} ${pc.dim('again.')}`);
|
|
290
258
|
console.log();
|
|
291
|
-
//
|
|
292
|
-
|
|
293
|
-
relaunchCLI();
|
|
294
|
-
return true; // CLI will exit via relaunchCLI
|
|
259
|
+
// Exit - user needs to restart terminal to pick up new version
|
|
260
|
+
process.exit(0);
|
|
295
261
|
}
|
|
296
262
|
|
|
297
263
|
export { checkAndAutoUpdate };
|
|
298
|
-
//# sourceMappingURL=auto-update-
|
|
264
|
+
//# sourceMappingURL=auto-update-Dq2PFvjt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auto-update-Dq2PFvjt.js","sources":["../../src/cli/utils/auto-update.ts"],"sourcesContent":["/**\n * Auto-update utility for OpenBuilder CLI\n * \n * Checks GitHub Releases for newer versions and automatically\n * updates both:\n * 1. The CLI itself (globally installed npm package)\n * 2. The app/monorepo (local installation that runs the web app)\n */\n\nimport { execSync, spawnSync } from 'node:child_process';\nimport { existsSync, readFileSync, writeFileSync, mkdirSync, unlinkSync } from 'node:fs';\nimport { join } from 'node:path';\nimport { homedir } from 'node:os';\nimport pc from 'picocolors';\nimport { configManager } from './config-manager.js';\n\n// GitHub API endpoint for releases\nconst GITHUB_RELEASES_URL = 'https://api.github.com/repos/codyde/openbuilder/releases/latest';\n\n// Install command for CLI\nconst INSTALL_COMMAND = 'curl -fsSL https://openbuilder.sh/install | bash';\n\n// Cache settings\nconst CACHE_DIR = join(homedir(), '.config', 'openbuilder');\nconst CACHE_FILE = join(CACHE_DIR, 'update-cache.json');\nconst CACHE_TTL_MS = 60 * 60 * 1000; // 1 hour\n\ninterface UpdateCache {\n lastCheck: number;\n latestVersion: string;\n // Track if we need to upgrade the app after CLI update\n pendingAppUpgrade?: boolean;\n}\n\n/**\n * Read the update cache file\n */\nfunction readUpdateCache(): UpdateCache | null {\n try {\n if (existsSync(CACHE_FILE)) {\n const content = readFileSync(CACHE_FILE, 'utf-8');\n return JSON.parse(content);\n }\n } catch {\n // Cache read failed, that's fine\n }\n return null;\n}\n\n/**\n * Write to the update cache file\n */\nfunction saveUpdateCache(cache: UpdateCache): void {\n try {\n if (!existsSync(CACHE_DIR)) {\n mkdirSync(CACHE_DIR, { recursive: true });\n }\n writeFileSync(CACHE_FILE, JSON.stringify(cache, null, 2));\n } catch {\n // Cache write failed, that's fine\n }\n}\n\n/**\n * Fetch the latest release version from GitHub\n * Returns version string (e.g., \"0.28.0\") or null on failure\n */\nasync function fetchLatestVersion(): Promise<string | null> {\n try {\n const controller = new AbortController();\n const timeout = setTimeout(() => controller.abort(), 5000); // 5s timeout\n\n const response = await fetch(GITHUB_RELEASES_URL, {\n headers: {\n 'Accept': 'application/vnd.github.v3+json',\n 'User-Agent': 'OpenBuilder-CLI-AutoUpdate',\n },\n signal: controller.signal,\n });\n\n clearTimeout(timeout);\n\n if (!response.ok) {\n return null;\n }\n\n const data = await response.json() as { tag_name: string };\n // Remove 'v' prefix if present (e.g., \"v0.28.0\" -> \"0.28.0\")\n return data.tag_name.replace(/^v/, '');\n } catch {\n // Network error, timeout, or parse error\n return null;\n }\n}\n\n/**\n * Compare two semver versions\n * Returns true if version1 < version2 (i.e., version2 is newer)\n */\nfunction isNewerVersion(current: string, latest: string): boolean {\n const parseVersion = (v: string) => {\n const parts = v.replace(/^v/, '').split('.').map(n => parseInt(n, 10) || 0);\n return { major: parts[0] || 0, minor: parts[1] || 0, patch: parts[2] || 0 };\n };\n\n const c = parseVersion(current);\n const l = parseVersion(latest);\n\n if (l.major > c.major) return true;\n if (l.major < c.major) return false;\n if (l.minor > c.minor) return true;\n if (l.minor < c.minor) return false;\n return l.patch > c.patch;\n}\n\n/**\n * Perform the CLI update by running the install script\n */\nfunction performCLIUpdate(): boolean {\n try {\n // Run the install command with quiet mode to avoid banner spam\n execSync(INSTALL_COMMAND, {\n stdio: 'inherit',\n shell: '/bin/bash',\n env: {\n ...process.env,\n OPENBUILDER_QUIET_INSTALL: '1', // Suppress banner in installer\n },\n });\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Check if the app/monorepo needs upgrading and perform the upgrade\n * This updates the local OpenBuilder installation that runs the web app\n */\nfunction performAppUpgrade(): boolean {\n const config = configManager.get();\n const monorepoPath = config.monorepoPath;\n\n // No monorepo configured, skip app upgrade\n if (!monorepoPath || !existsSync(monorepoPath)) {\n return true; // Not an error, just nothing to upgrade\n }\n\n console.log();\n console.log(` ${pc.cyan('⬆')} ${pc.bold('Upgrading app installation...')}`);\n console.log(` ${pc.dim(monorepoPath)}`);\n console.log();\n\n try {\n // Run openbuilder upgrade --force to upgrade the monorepo\n // Use --force to skip prompts since we're in auto-update mode\n const result = spawnSync('openbuilder', ['upgrade', '--force'], {\n stdio: 'inherit',\n env: {\n ...process.env,\n OPENBUILDER_SKIP_UPDATE_CHECK: '1', // Don't re-check for CLI updates\n },\n shell: true,\n });\n\n return result.status === 0;\n } catch {\n return false;\n }\n}\n\n/**\n * Re-launch the CLI with original arguments after update\n */\nfunction relaunchCLI(): void {\n const args = process.argv.slice(2);\n \n try {\n // Get the actual path to openbuilder to avoid shell hash caching issues\n // This ensures we run the newly installed version, not a cached path\n let openbuilderPath = 'openbuilder';\n try {\n // Use 'command -v' to get the actual path, bypassing shell hash\n openbuilderPath = execSync('command -v openbuilder', { encoding: 'utf-8' }).trim();\n } catch {\n // Fallback to just 'openbuilder' if command -v fails\n }\n \n // Use spawnSync with the explicit path to ensure we get the new version\n const result = spawnSync(openbuilderPath, args, {\n stdio: 'inherit',\n env: { \n ...process.env, \n OPENBUILDER_SKIP_UPDATE_CHECK: '1', // Prevent update loop\n OPENBUILDER_SKIP_BANNER: '1', // Suppress banner after restart (already shown before update)\n },\n // Don't use shell: true to avoid shell hash caching\n });\n \n // Exit with the same code as the relaunched process\n process.exit(result.status ?? 0);\n } catch {\n // If relaunch fails, just exit - user can run command again\n process.exit(0);\n }\n}\n\n/**\n * Main auto-update check function\n * Call this early in CLI startup\n * \n * Updates both:\n * 1. The CLI itself (globally installed)\n * 2. The app/monorepo (if configured)\n * \n * @param currentVersion - Current CLI version from package.json\n * @returns true if update was performed and CLI should exit\n */\nexport async function checkAndAutoUpdate(currentVersion: string): Promise<boolean> {\n // Skip if update check is disabled via env var\n if (process.env.OPENBUILDER_NO_UPDATE === '1' || process.env.OPENBUILDER_SKIP_UPDATE_CHECK === '1') {\n // But check if we have a pending app upgrade from a previous CLI update\n const cache = readUpdateCache();\n if (cache?.pendingAppUpgrade) {\n console.log();\n console.log(` ${pc.cyan('⬆')} ${pc.bold('Completing app upgrade...')}`);\n \n const appSuccess = performAppUpgrade();\n \n if (appSuccess) {\n // Clear the pending flag\n saveUpdateCache({ ...cache, pendingAppUpgrade: false });\n console.log(` ${pc.green('✓')} ${pc.bold('App upgrade complete!')}`);\n } else {\n console.log(` ${pc.yellow('⚠')} ${pc.dim('App upgrade failed. Run manually:')} ${pc.cyan('openbuilder upgrade')}`);\n }\n console.log();\n }\n return false;\n }\n\n // Skip if disabled in config\n const config = configManager.get();\n if (config.autoUpdate === false) {\n return false;\n }\n\n let latestVersion: string | null = null;\n\n // Check cache first to avoid hitting GitHub API too often\n const cache = readUpdateCache();\n const now = Date.now();\n\n if (cache && (now - cache.lastCheck) < CACHE_TTL_MS) {\n // Use cached version\n latestVersion = cache.latestVersion;\n } else {\n // Fetch from GitHub (with timeout)\n latestVersion = await fetchLatestVersion();\n \n if (latestVersion) {\n // Update cache\n saveUpdateCache({\n lastCheck: now,\n latestVersion,\n });\n } else if (cache) {\n // Fetch failed, use stale cache\n latestVersion = cache.latestVersion;\n }\n }\n\n // If we couldn't determine latest version, skip update\n if (!latestVersion) {\n return false;\n }\n\n // Check if update is needed\n if (!isNewerVersion(currentVersion, latestVersion)) {\n return false;\n }\n\n // Update available! Show message and perform update\n console.log();\n console.log(` ${pc.cyan('⬆')} ${pc.bold('Update available:')} ${pc.dim(currentVersion)} → ${pc.green(latestVersion)}`);\n console.log();\n\n // Perform the CLI update\n console.log(` ${pc.dim('Updating CLI...')}`);\n const cliSuccess = performCLIUpdate();\n\n if (!cliSuccess) {\n // CLI update failed, continue with current version\n console.log();\n console.log(` ${pc.yellow('⚠')} ${pc.dim('CLI update failed. Continuing with current version.')}`);\n console.log(` ${pc.dim('You can manually update with:')} ${pc.cyan('curl -fsSL https://openbuilder.sh/install | bash')}`);\n console.log();\n return false;\n }\n\n console.log(` ${pc.green('✓')} CLI updated to ${pc.green(latestVersion)}`);\n \n // Check if we need to upgrade the app\n const monorepoPath = config.monorepoPath;\n const hasMonorepo = monorepoPath && existsSync(monorepoPath);\n\n if (hasMonorepo) {\n // Mark that we need to upgrade the app after CLI restart\n saveUpdateCache({\n lastCheck: now,\n latestVersion,\n pendingAppUpgrade: true,\n });\n }\n\n console.log();\n console.log(` ${pc.green('✓')} ${pc.bold('Update complete!')}`);\n console.log();\n console.log(` ${pc.yellow('⚠')} ${pc.bold('Please restart your terminal')} or run:`);\n console.log(` ${pc.cyan('hash -r')} ${pc.dim('(bash/zsh)')}`);\n console.log();\n console.log(` ${pc.dim('Then run')} ${pc.cyan('openbuilder')} ${pc.dim('again.')}`);\n console.log();\n \n // Exit - user needs to restart terminal to pick up new version\n process.exit(0);\n}\n\n/**\n * Check for updates without auto-updating (for TUI modes)\n * Returns version info that can be displayed in the TUI\n * \n * @param currentVersion - Current CLI version from package.json\n * @returns Update info or null if no update available\n */\nexport async function checkForUpdate(currentVersion: string): Promise<{\n currentVersion: string;\n latestVersion: string;\n updateAvailable: boolean;\n} | null> {\n // Skip if update check is disabled via env var\n if (process.env.OPENBUILDER_NO_UPDATE === '1' || process.env.OPENBUILDER_SKIP_UPDATE_CHECK === '1') {\n return null;\n }\n\n // Skip if disabled in config\n const config = configManager.get();\n if (config.autoUpdate === false) {\n return null;\n }\n\n let latestVersion: string | null = null;\n\n // Check cache first to avoid hitting GitHub API too often\n const cache = readUpdateCache();\n const now = Date.now();\n\n if (cache && (now - cache.lastCheck) < CACHE_TTL_MS) {\n // Use cached version\n latestVersion = cache.latestVersion;\n } else {\n // Fetch from GitHub (with timeout)\n latestVersion = await fetchLatestVersion();\n \n if (latestVersion) {\n // Update cache\n saveUpdateCache({\n lastCheck: now,\n latestVersion,\n pendingAppUpgrade: cache?.pendingAppUpgrade,\n });\n } else if (cache) {\n // Fetch failed, use stale cache\n latestVersion = cache.latestVersion;\n }\n }\n\n // If we couldn't determine latest version, return null\n if (!latestVersion) {\n return null;\n }\n\n const updateAvailable = isNewerVersion(currentVersion, latestVersion);\n \n return {\n currentVersion,\n latestVersion,\n updateAvailable,\n };\n}\n\n/**\n * Clear the update cache (useful for testing or forcing a fresh check)\n */\nexport function clearUpdateCache(): void {\n try {\n if (existsSync(CACHE_FILE)) {\n unlinkSync(CACHE_FILE);\n }\n } catch {\n // Ignore errors\n }\n}\n\n/**\n * Get the current update status (for debugging/status commands)\n */\nexport function getUpdateStatus(): { \n cacheFile: string;\n cache: UpdateCache | null;\n monorepoPath: string | undefined;\n hasMonorepo: boolean;\n} {\n const config = configManager.get();\n const monorepoPath = config.monorepoPath;\n \n return {\n cacheFile: CACHE_FILE,\n cache: readUpdateCache(),\n monorepoPath,\n hasMonorepo: !!(monorepoPath && existsSync(monorepoPath)),\n };\n}\n"],"names":[],"mappings":";;;;;;;;;AAAA;;;;;;;AAOG;AASH;AACA,MAAM,mBAAmB,GAAG,iEAAiE;AAE7F;AACA,MAAM,eAAe,GAAG,kDAAkD;AAE1E;AACA,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,aAAa,CAAC;AAC3D,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,EAAE,mBAAmB,CAAC;AACvD,MAAM,YAAY,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AASpC;;AAEG;AACH,SAAS,eAAe,GAAA;AACtB,IAAA,IAAI;AACF,QAAA,IAAI,UAAU,CAAC,UAAU,CAAC,EAAE;YAC1B,MAAM,OAAO,GAAG,YAAY,CAAC,UAAU,EAAE,OAAO,CAAC;AACjD,YAAA,OAAO,I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AAC,CAAA,CAAE,CAAC;IACpF,OAAO,CAAC,GAAG,EAAE;;AAGb,IAAA,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;AACjB;;;;"}
|
package/dist/cli/index.js
CHANGED
|
@@ -474,7 +474,7 @@ if (isSilentMode) {
|
|
|
474
474
|
// For version mode: skip entirely - just show version
|
|
475
475
|
let willAutoUpdate = false;
|
|
476
476
|
if (!process.env.OPENBUILDER_SKIP_UPDATE_CHECK && !isVersionCommand) {
|
|
477
|
-
const { checkAndAutoUpdate } = await import('../chunks/auto-update-
|
|
477
|
+
const { checkAndAutoUpdate } = await import('../chunks/auto-update-Dq2PFvjt.js');
|
|
478
478
|
try {
|
|
479
479
|
// Show banner first for non-TUI modes
|
|
480
480
|
if (!isSilentMode) {
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auto-update-Cr7SnKwX.js","sources":["../../src/cli/utils/auto-update.ts"],"sourcesContent":["/**\n * Auto-update utility for OpenBuilder CLI\n * \n * Checks GitHub Releases for newer versions and automatically\n * updates both:\n * 1. The CLI itself (globally installed npm package)\n * 2. The app/monorepo (local installation that runs the web app)\n */\n\nimport { execSync, spawnSync } from 'node:child_process';\nimport { existsSync, readFileSync, writeFileSync, mkdirSync, unlinkSync } from 'node:fs';\nimport { join } from 'node:path';\nimport { homedir } from 'node:os';\nimport pc from 'picocolors';\nimport { configManager } from './config-manager.js';\n\n// GitHub API endpoint for releases\nconst GITHUB_RELEASES_URL = 'https://api.github.com/repos/codyde/openbuilder/releases/latest';\n\n// Install command for CLI\nconst INSTALL_COMMAND = 'curl -fsSL https://openbuilder.sh/install | bash';\n\n// Cache settings\nconst CACHE_DIR = join(homedir(), '.config', 'openbuilder');\nconst CACHE_FILE = join(CACHE_DIR, 'update-cache.json');\nconst CACHE_TTL_MS = 60 * 60 * 1000; // 1 hour\n\ninterface UpdateCache {\n lastCheck: number;\n latestVersion: string;\n // Track if we need to upgrade the app after CLI update\n pendingAppUpgrade?: boolean;\n}\n\n/**\n * Read the update cache file\n */\nfunction readUpdateCache(): UpdateCache | null {\n try {\n if (existsSync(CACHE_FILE)) {\n const content = readFileSync(CACHE_FILE, 'utf-8');\n return JSON.parse(content);\n }\n } catch {\n // Cache read failed, that's fine\n }\n return null;\n}\n\n/**\n * Write to the update cache file\n */\nfunction saveUpdateCache(cache: UpdateCache): void {\n try {\n if (!existsSync(CACHE_DIR)) {\n mkdirSync(CACHE_DIR, { recursive: true });\n }\n writeFileSync(CACHE_FILE, JSON.stringify(cache, null, 2));\n } catch {\n // Cache write failed, that's fine\n }\n}\n\n/**\n * Fetch the latest release version from GitHub\n * Returns version string (e.g., \"0.28.0\") or null on failure\n */\nasync function fetchLatestVersion(): Promise<string | null> {\n try {\n const controller = new AbortController();\n const timeout = setTimeout(() => controller.abort(), 5000); // 5s timeout\n\n const response = await fetch(GITHUB_RELEASES_URL, {\n headers: {\n 'Accept': 'application/vnd.github.v3+json',\n 'User-Agent': 'OpenBuilder-CLI-AutoUpdate',\n },\n signal: controller.signal,\n });\n\n clearTimeout(timeout);\n\n if (!response.ok) {\n return null;\n }\n\n const data = await response.json() as { tag_name: string };\n // Remove 'v' prefix if present (e.g., \"v0.28.0\" -> \"0.28.0\")\n return data.tag_name.replace(/^v/, '');\n } catch {\n // Network error, timeout, or parse error\n return null;\n }\n}\n\n/**\n * Compare two semver versions\n * Returns true if version1 < version2 (i.e., version2 is newer)\n */\nfunction isNewerVersion(current: string, latest: string): boolean {\n const parseVersion = (v: string) => {\n const parts = v.replace(/^v/, '').split('.').map(n => parseInt(n, 10) || 0);\n return { major: parts[0] || 0, minor: parts[1] || 0, patch: parts[2] || 0 };\n };\n\n const c = parseVersion(current);\n const l = parseVersion(latest);\n\n if (l.major > c.major) return true;\n if (l.major < c.major) return false;\n if (l.minor > c.minor) return true;\n if (l.minor < c.minor) return false;\n return l.patch > c.patch;\n}\n\n/**\n * Perform the CLI update by running the install script\n */\nfunction performCLIUpdate(): boolean {\n try {\n // Run the install command with quiet mode to avoid banner spam\n execSync(INSTALL_COMMAND, {\n stdio: 'inherit',\n shell: '/bin/bash',\n env: {\n ...process.env,\n OPENBUILDER_QUIET_INSTALL: '1', // Suppress banner in installer\n },\n });\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Check if the app/monorepo needs upgrading and perform the upgrade\n * This updates the local OpenBuilder installation that runs the web app\n */\nfunction performAppUpgrade(): boolean {\n const config = configManager.get();\n const monorepoPath = config.monorepoPath;\n\n // No monorepo configured, skip app upgrade\n if (!monorepoPath || !existsSync(monorepoPath)) {\n return true; // Not an error, just nothing to upgrade\n }\n\n console.log();\n console.log(` ${pc.cyan('⬆')} ${pc.bold('Upgrading app installation...')}`);\n console.log(` ${pc.dim(monorepoPath)}`);\n console.log();\n\n try {\n // Run openbuilder upgrade --force to upgrade the monorepo\n // Use --force to skip prompts since we're in auto-update mode\n const result = spawnSync('openbuilder', ['upgrade', '--force'], {\n stdio: 'inherit',\n env: {\n ...process.env,\n OPENBUILDER_SKIP_UPDATE_CHECK: '1', // Don't re-check for CLI updates\n },\n shell: true,\n });\n\n return result.status === 0;\n } catch {\n return false;\n }\n}\n\n/**\n * Re-launch the CLI with original arguments after update\n */\nfunction relaunchCLI(): void {\n const args = process.argv.slice(2);\n \n try {\n // Get the actual path to openbuilder to avoid shell hash caching issues\n // This ensures we run the newly installed version, not a cached path\n let openbuilderPath = 'openbuilder';\n try {\n // Use 'command -v' to get the actual path, bypassing shell hash\n openbuilderPath = execSync('command -v openbuilder', { encoding: 'utf-8' }).trim();\n } catch {\n // Fallback to just 'openbuilder' if command -v fails\n }\n \n // Use spawnSync with the explicit path to ensure we get the new version\n const result = spawnSync(openbuilderPath, args, {\n stdio: 'inherit',\n env: { \n ...process.env, \n OPENBUILDER_SKIP_UPDATE_CHECK: '1', // Prevent update loop\n OPENBUILDER_SKIP_BANNER: '1', // Suppress banner after restart (already shown before update)\n },\n // Don't use shell: true to avoid shell hash caching\n });\n \n // Exit with the same code as the relaunched process\n process.exit(result.status ?? 0);\n } catch {\n // If relaunch fails, just exit - user can run command again\n process.exit(0);\n }\n}\n\n/**\n * Main auto-update check function\n * Call this early in CLI startup\n * \n * Updates both:\n * 1. The CLI itself (globally installed)\n * 2. The app/monorepo (if configured)\n * \n * @param currentVersion - Current CLI version from package.json\n * @returns true if update was performed and CLI should exit\n */\nexport async function checkAndAutoUpdate(currentVersion: string): Promise<boolean> {\n // Skip if update check is disabled via env var\n if (process.env.OPENBUILDER_NO_UPDATE === '1' || process.env.OPENBUILDER_SKIP_UPDATE_CHECK === '1') {\n // But check if we have a pending app upgrade from a previous CLI update\n const cache = readUpdateCache();\n if (cache?.pendingAppUpgrade) {\n console.log();\n console.log(` ${pc.cyan('⬆')} ${pc.bold('Completing app upgrade...')}`);\n \n const appSuccess = performAppUpgrade();\n \n if (appSuccess) {\n // Clear the pending flag\n saveUpdateCache({ ...cache, pendingAppUpgrade: false });\n console.log(` ${pc.green('✓')} ${pc.bold('App upgrade complete!')}`);\n } else {\n console.log(` ${pc.yellow('⚠')} ${pc.dim('App upgrade failed. Run manually:')} ${pc.cyan('openbuilder upgrade')}`);\n }\n console.log();\n }\n return false;\n }\n\n // Skip if disabled in config\n const config = configManager.get();\n if (config.autoUpdate === false) {\n return false;\n }\n\n let latestVersion: string | null = null;\n\n // Check cache first to avoid hitting GitHub API too often\n const cache = readUpdateCache();\n const now = Date.now();\n\n if (cache && (now - cache.lastCheck) < CACHE_TTL_MS) {\n // Use cached version\n latestVersion = cache.latestVersion;\n } else {\n // Fetch from GitHub (with timeout)\n latestVersion = await fetchLatestVersion();\n \n if (latestVersion) {\n // Update cache\n saveUpdateCache({\n lastCheck: now,\n latestVersion,\n });\n } else if (cache) {\n // Fetch failed, use stale cache\n latestVersion = cache.latestVersion;\n }\n }\n\n // If we couldn't determine latest version, skip update\n if (!latestVersion) {\n return false;\n }\n\n // Check if update is needed\n if (!isNewerVersion(currentVersion, latestVersion)) {\n return false;\n }\n\n // Update available! Show message and perform update\n console.log();\n console.log(` ${pc.cyan('⬆')} ${pc.bold('Update available:')} ${pc.dim(currentVersion)} → ${pc.green(latestVersion)}`);\n console.log();\n\n // Step 1: Update the CLI\n console.log(` ${pc.dim('Step 1/2:')} Updating CLI...`);\n const cliSuccess = performCLIUpdate();\n\n if (!cliSuccess) {\n // CLI update failed, continue with current version\n console.log();\n console.log(` ${pc.yellow('⚠')} ${pc.dim('CLI update failed. Continuing with current version.')}`);\n console.log(` ${pc.dim('You can manually update with:')} ${pc.cyan('curl -fsSL https://openbuilder.sh/install | bash')}`);\n console.log();\n return false;\n }\n\n console.log(` ${pc.green('✓')} CLI updated to ${pc.green(latestVersion)}`);\n \n // Step 2: Check if we need to upgrade the app\n const monorepoPath = config.monorepoPath;\n const hasMonorepo = monorepoPath && existsSync(monorepoPath);\n\n if (hasMonorepo) {\n // Mark that we need to upgrade the app after CLI restart\n // The new CLI version will handle the app upgrade\n saveUpdateCache({\n lastCheck: now,\n latestVersion,\n pendingAppUpgrade: true,\n });\n \n console.log();\n console.log(` ${pc.dim('Step 2/2:')} App upgrade will continue after restart...`);\n }\n\n console.log();\n console.log(` ${pc.green('✓')} ${pc.bold('CLI update complete!')} Restarting...`);\n console.log();\n \n // Relaunch CLI with original args\n // The new CLI will pick up the pendingAppUpgrade flag and complete step 2\n relaunchCLI();\n \n return true; // CLI will exit via relaunchCLI\n}\n\n/**\n * Check for updates without auto-updating (for TUI modes)\n * Returns version info that can be displayed in the TUI\n * \n * @param currentVersion - Current CLI version from package.json\n * @returns Update info or null if no update available\n */\nexport async function checkForUpdate(currentVersion: string): Promise<{\n currentVersion: string;\n latestVersion: string;\n updateAvailable: boolean;\n} | null> {\n // Skip if update check is disabled via env var\n if (process.env.OPENBUILDER_NO_UPDATE === '1' || process.env.OPENBUILDER_SKIP_UPDATE_CHECK === '1') {\n return null;\n }\n\n // Skip if disabled in config\n const config = configManager.get();\n if (config.autoUpdate === false) {\n return null;\n }\n\n let latestVersion: string | null = null;\n\n // Check cache first to avoid hitting GitHub API too often\n const cache = readUpdateCache();\n const now = Date.now();\n\n if (cache && (now - cache.lastCheck) < CACHE_TTL_MS) {\n // Use cached version\n latestVersion = cache.latestVersion;\n } else {\n // Fetch from GitHub (with timeout)\n latestVersion = await fetchLatestVersion();\n \n if (latestVersion) {\n // Update cache\n saveUpdateCache({\n lastCheck: now,\n latestVersion,\n pendingAppUpgrade: cache?.pendingAppUpgrade,\n });\n } else if (cache) {\n // Fetch failed, use stale cache\n latestVersion = cache.latestVersion;\n }\n }\n\n // If we couldn't determine latest version, return null\n if (!latestVersion) {\n return null;\n }\n\n const updateAvailable = isNewerVersion(currentVersion, latestVersion);\n \n return {\n currentVersion,\n latestVersion,\n updateAvailable,\n };\n}\n\n/**\n * Clear the update cache (useful for testing or forcing a fresh check)\n */\nexport function clearUpdateCache(): void {\n try {\n if (existsSync(CACHE_FILE)) {\n unlinkSync(CACHE_FILE);\n }\n } catch {\n // Ignore errors\n }\n}\n\n/**\n * Get the current update status (for debugging/status commands)\n */\nexport function getUpdateStatus(): { \n cacheFile: string;\n cache: UpdateCache | null;\n monorepoPath: string | undefined;\n hasMonorepo: boolean;\n} {\n const config = configManager.get();\n const monorepoPath = config.monorepoPath;\n \n return {\n cacheFile: CACHE_FILE,\n cache: readUpdateCache(),\n monorepoPath,\n hasMonorepo: !!(monorepoPath && existsSync(monorepoPath)),\n };\n}\n"],"names":[],"mappings":";;;;;;;;;AAAA;;;;;;;AAOG;AASH;AACA,MAAM,mBAAmB,GAAG,iEAAiE;AAE7F;AACA,MAAM,eAAe,GAAG,kDAAkD;AAE1E;AACA,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,aAAa,CAAC;AAC3D,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,EAAE,mBAAmB,CAAC;AACvD,MAAM,YAAY,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AASpC;;AAEG;AACH,SAAS,eAAe,GAAA;AAC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