fix: MCP agor-rebuild uses targeted kill (doesn't kill MCP's own Node process)
This commit is contained in:
parent
d334f57e9e
commit
f1472848f8
1 changed files with 22 additions and 1 deletions
|
|
@ -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.",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue