From 13cac8d750c8ea2612312533440ef3784582e3e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=B7=E6=98=8E=E7=8F=A0?= Date: Fri, 12 Jun 2026 11:00:54 +0800 Subject: [PATCH] fix: detect TaskMaster CLI installation on Windows checkTaskMasterInstallation spawned 'which' via shell, but cmd.exe has no 'which' builtin, so the check always failed on Windows and reported TaskMaster as not installed even when it was on PATH. Use 'where' on win32 and take the first line of its output, since 'where' can return multiple matches (task-master and task-master.cmd). Co-Authored-By: Claude Fable 5 --- server/routes/taskmaster.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/server/routes/taskmaster.js b/server/routes/taskmaster.js index 01a8d80100..5d899d5825 100644 --- a/server/routes/taskmaster.js +++ b/server/routes/taskmaster.js @@ -40,8 +40,9 @@ const router = express.Router(); */ async function checkTaskMasterInstallation() { return new Promise((resolve) => { - // Check if task-master command is available - const child = spawn('which', ['task-master'], { + // Check if task-master command is available ('which' is not available in cmd.exe) + const whichCommand = process.platform === 'win32' ? 'where' : 'which'; + const child = spawn(whichCommand, ['task-master'], { stdio: ['ignore', 'pipe', 'pipe'], shell: true }); @@ -59,6 +60,8 @@ async function checkTaskMasterInstallation() { child.on('close', (code) => { if (code === 0 && output.trim()) { + // 'where' may return multiple matches (e.g. task-master and task-master.cmd) + const installPath = output.trim().split(/\r?\n/)[0]; // TaskMaster is installed, get version const versionChild = spawn('task-master', ['--version'], { stdio: ['ignore', 'pipe', 'pipe'], @@ -74,16 +77,16 @@ async function checkTaskMasterInstallation() { versionChild.on('close', (versionCode) => { resolve({ isInstalled: true, - installPath: output.trim(), + installPath, version: versionCode === 0 ? versionOutput.trim() : 'unknown', reason: null }); }); - + versionChild.on('error', () => { resolve({ isInstalled: true, - installPath: output.trim(), + installPath, version: 'unknown', reason: null });