From 581b2f9a0fd84de8d627508ab2c3ad500898e6f9 Mon Sep 17 00:00:00 2001 From: Alex MacDonell Date: Sat, 25 Apr 2026 13:22:51 -0700 Subject: [PATCH] fix(glean-core): resolve HOME via os.homedir() for Windows compatibility MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The session-start hook used $HOME inside a node -e snippet to require ~/.claude.json. On Windows under Git Bash, $HOME expands to a Unix-style path (e.g. /c/Users/foo) which Node on Windows cannot require(), so the check throws, exits 1, and the 'Glean is installed but no MCP server is configured' message fires on every session — even when a Glean server is in fact configured. Resolve the home directory inside Node via os.homedir() instead, which returns a platform-correct path everywhere. --- plugins/glean-core/scripts/session-start.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/glean-core/scripts/session-start.sh b/plugins/glean-core/scripts/session-start.sh index 026e085..967b0c7 100755 --- a/plugins/glean-core/scripts/session-start.sh +++ b/plugins/glean-core/scripts/session-start.sh @@ -26,8 +26,11 @@ output_json() { printf '{\n "systemMessage": "%s"\n}\n' "$escaped" } -# Check if any Glean MCP servers are configured -if node -e "const c=require('$HOME/.claude.json'); process.exit(Object.keys(c.mcpServers||{}).some(k=>k.toLowerCase().includes('glean'))?0:1)" 2>/dev/null; then +# Check if any Glean MCP servers are configured. +# Resolve the home directory inside Node via os.homedir() so this works on +# Windows, where $HOME under Git Bash expands to a Unix-style path +# (e.g. /c/Users/foo) that Node on Windows cannot require(). +if node -e "const os=require('os'),p=require('path');const c=require(p.join(os.homedir(),'.claude.json'));process.exit(Object.keys(c.mcpServers||{}).some(k=>k.toLowerCase().includes('glean'))?0:1)" 2>/dev/null; then exit 0 else output_json "$TEMPLATES_DIR/session-unconfigured.txt"