From 0a7807a9dcb25cffea93f39adaf346626a2a0315 Mon Sep 17 00:00:00 2001 From: Bohdan Triapitsyn Date: Sun, 5 Jul 2026 23:21:59 +0300 Subject: [PATCH] fix: run deployed web CLI from Bun global install Detects the OpenChamber CLI from Bun's global install directory Starts the global instance via the installed CLI path instead of relying on PATH Fails fast if the global CLI was not installed --- scripts/oc-dev.mjs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/scripts/oc-dev.mjs b/scripts/oc-dev.mjs index 06ca5441..c6b2226e 100755 --- a/scripts/oc-dev.mjs +++ b/scripts/oc-dev.mjs @@ -286,6 +286,11 @@ function installedWebCli(directory) { return existsSync(cliPath) ? cliPath : ''; } +function installedGlobalWebCli() { + const bunInstall = process.env.BUN_INSTALL || path.join(os.homedir(), '.bun'); + return installedWebCli(path.join(bunInstall, 'install', 'global')); +} + function stopInstalledInstance(directory, port) { const cliPath = installedWebCli(directory); if (!cliPath) return; @@ -370,7 +375,11 @@ async function deployWeb(options, config) { run('bun', ['remove', '-g', 'openchamber'], { allowFail: true, label: 'remove openchamber' }); }); step('Installing package globally', () => run('bun', ['add', '-g', packageFile])); - step(`Starting global instance on ${GLOBAL_PORT}`, () => run('openchamber', ['--port', GLOBAL_PORT], { env: { OPENCHAMBER_UI_PASSWORD: process.env.OPENCHAMBER_PASSWORD || '', OPENCHAMBER_HOST: '0.0.0.0' } })); + step(`Starting global instance on ${GLOBAL_PORT}`, () => { + const cliPath = installedGlobalWebCli(); + if (!cliPath) throw new Error('Global OpenChamber CLI was not installed by bun add -g'); + run('node', [cliPath, '--port', GLOBAL_PORT], { env: { OPENCHAMBER_UI_PASSWORD: process.env.OPENCHAMBER_PASSWORD || '', OPENCHAMBER_HOST: '0.0.0.0' } }); + }); } async function deployRemoteWeb(options, config) {