From f1472848f8d79a070e35378fd6ff5fb5ab237493 Mon Sep 17 00:00:00 2001 From: Hibryda Date: Thu, 26 Mar 2026 02:28:22 +0100 Subject: [PATCH] fix: MCP agor-rebuild uses targeted kill (doesn't kill MCP's own Node process) --- .claude/mcp-servers/agor-launcher/index.mjs | 23 ++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/.claude/mcp-servers/agor-launcher/index.mjs b/.claude/mcp-servers/agor-launcher/index.mjs index 584bb92..f132138 100644 --- a/.claude/mcp-servers/agor-launcher/index.mjs +++ b/.claude/mcp-servers/agor-launcher/index.mjs @@ -108,7 +108,28 @@ const TOOLS = { "agor-rebuild": { description: "Full rebuild: clean + npm install + vite build + native C library + PTY daemon.", schema: { type: "object", properties: {} }, - handler: () => run("rebuild", 120000), + handler: () => { + // Stop app (targeted kill — don't kill this Node/MCP process) + spawnSync("bash", ["-c", + 'pkill -f "AgentOrch" 2>/dev/null; pkill -f "electrobun dev" 2>/dev/null; pkill -f "WebKitWebProcess" 2>/dev/null; fuser -k 9760/tcp 2>/dev/null; true' + ], { timeout: 5000, stdio: "ignore" }); + // Clean + spawnSync("rm", ["-rf", `${EBUN}/build/`, `${EBUN}/node_modules/.electrobun-cache/`], { timeout: 5000 }); + // npm install + const npm = spawnSync("npm", ["install", "--legacy-peer-deps"], { cwd: EBUN, timeout: 60000, encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] }); + // vite build + const vite = spawnSync("npx", ["vite", "build"], { cwd: EBUN, timeout: 60000, encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] }); + // native build + const native = spawnSync("bash", ["-c", `cd ${ROOT}/agor-pty/native && gcc -shared -fPIC -o libagor-resize.so agor_resize.c $(pkg-config --cflags --libs gtk+-3.0) 2>&1`], { timeout: 30000, encoding: "utf-8" }); + const cargo = spawnSync("cargo", ["build", "--release"], { cwd: `${ROOT}/agor-pty`, timeout: 120000, encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] }); + return [ + "Rebuild complete:", + `npm: ${npm.status === 0 ? 'ok' : 'FAIL'}`, + `vite: ${vite.status === 0 ? 'ok' : 'FAIL'}`, + `native: ${native.status === 0 ? 'ok' : 'FAIL'}`, + `cargo: ${cargo.status === 0 ? 'ok' : 'FAIL'}`, + ].join("\n"); + }, }, "agor-status": { description: "Show running processes, ports, and window status.",