diff --git a/apps/x/apps/main/src/main.ts b/apps/x/apps/main/src/main.ts index a2ed0aa1..8755565d 100644 --- a/apps/x/apps/main/src/main.ts +++ b/apps/x/apps/main/src/main.ts @@ -24,11 +24,9 @@ import { init as initAgentRunner } from "@x/core/dist/agent-schedule/runner.js"; import { init as initAgentNotes } from "@x/core/dist/knowledge/agent_notes.js"; import { initConfigs } from "@x/core/dist/config/initConfigs.js"; import started from "electron-squirrel-startup"; -import { execSync, exec } from "node:child_process"; -import { promisify } from "node:util"; +import { execSync } from "node:child_process"; import { init as initChromeSync } from "@x/core/dist/knowledge/chrome-extension/server/server.js"; - -const execAsync = promisify(exec); +import { executeCommand } from "@x/core/dist/application/lib/command-executor.js"; const __filename = fileURLToPath(import.meta.url); const __dirname = dirname(__filename); @@ -189,15 +187,18 @@ app.whenReady().then(async () => { } // Ensure agent-slack CLI is available - try { - execSync('agent-slack --version', { stdio: 'ignore', timeout: 5000 }); - } catch { - try { + { + const versionCheck = await executeCommand('agent-slack --version', { timeout: 5000 }); + if (versionCheck.exitCode !== 0) { console.log('agent-slack not found, installing...'); - await execAsync('npm install -g agent-slack', { timeout: 60000 }); - console.log('agent-slack installed successfully'); - } catch (e) { - console.error('Failed to install agent-slack:', e); + const install = await executeCommand('npm install -g agent-slack', { timeout: 60000 }); + if (install.exitCode === 0) { + console.log('agent-slack installed successfully', install.stdout); + } else { + console.error('Failed to install agent-slack:', install.stderr); + } + } else { + console.log('agent-slack already installed:', versionCheck.stdout); } }