Fix CLI tools status endpoint crash and add droid detection support

1. Fixed crash in /api/cli-tools/status when statuses[toolId] is undefined
   - Added null check before accessing statuses[toolId] properties
   - Prevents "Cannot set property of undefined" error

2. Added support for droid.exe detection in ~/bin directory
   - Added ~/bin and ~/.local/bin to EXPECTED_PARENT_PATHS
   - Added droid.exe variant to toolBins for Windows
   - Added specific path check for droid in ~/bin/droid.exe

These fixes resolve issues where CLI tools (Claude Code, Codex, Droid)
were showing as "not installed" even when properly installed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
LASTHXH
2026-03-29 17:44:37 +05:00
parent b84e79362e
commit 394b986ccb
2 changed files with 19 additions and 2 deletions

View File

@@ -98,7 +98,10 @@ export async function GET() {
await Promise.all(
settingsTools.map(async (toolId) => {
if (!statuses[toolId]?.installed || !statuses[toolId]?.runnable) {
if (!statuses[toolId]) {
return;
}
if (!statuses[toolId].installed || !statuses[toolId].runnable) {
statuses[toolId].configStatus = "not_installed";
return;
}

View File

@@ -327,8 +327,15 @@ const getExpectedParentPaths = (): string[] => {
const npmPrefix = getNpmGlobalPrefix();
// Add common user bin directories
const userBinPaths = [
path.join(home, "bin"),
path.join(home, ".local", "bin"),
];
return [
home,
...userBinPaths,
userProfile,
validatedAppData,
validatedLocalAppData,
@@ -374,7 +381,10 @@ const getKnownToolPaths = (toolId: string): string[] => {
["claude.exe", "claude"],
],
codex: [["codex.cmd", "codex"]],
droid: [["droid.cmd", "droid"]],
droid: [
["droid.cmd", "droid"],
["droid.exe", "droid"],
],
openclaw: [["openclaw.cmd", "openclaw"]],
cursor: [
["agent.cmd", "agent"],
@@ -404,6 +414,10 @@ const getKnownToolPaths = (toolId: string): string[] => {
}
}
if (toolId === "droid") {
paths.push(path.join(home, "bin", "droid.exe"));
}
for (const [winName] of bins) {
if (npmPrefix) paths.push(path.join(npmPrefix, winName));
if (appData) {