@@ -526,12 +526,16 @@ HOME="$FAKE_HOME" PATH="$FAKE_HOME/.local/bin:$PATH" "$BINARY" install -y 2>&1 |
526526# Helper for JSON validation (pipe file to python — avoids MSYS2 path translation issues)
527527json_get () { cat " $1 " 2> /dev/null | python3 -c " import json,sys; d=json.load(sys.stdin); print($2 )" 2> /dev/null || echo " " ; }
528528
529+ # Helper: compare command paths (handles Windows D:\... vs POSIX /tmp/... mismatch)
530+ path_match () {
531+ [ " $1 " = " $2 " ] && return 0
532+ [ " $( basename " $1 " 2> /dev/null) " = " $( basename " $2 " 2> /dev/null) " ] && return 0
533+ return 1
534+ }
535+
529536# 8a: Claude Code MCP (new path) — correct command
530537CMD=$( json_get " $FAKE_HOME /.claude.json" " d.get('mcpServers',{}).get('codebase-memory-mcp',{}).get('command','')" )
531- # On Windows/MSYS2, paths differ (D:\... vs /tmp/...) — compare basename
532- CMD_BASE=$( basename " $CMD " 2> /dev/null || echo " " )
533- SELF_BASE=$( basename " $SELF_PATH " 2> /dev/null || echo " " )
534- if [ -z " $CMD " ] || ([ " $CMD " != " $SELF_PATH " ] && [ " $CMD_BASE " != " $SELF_BASE " ]); then
538+ if [ -z " $CMD " ] || ! path_match " $CMD " " $SELF_PATH " ; then
535539 echo " DEBUG 8a: file=$FAKE_HOME /.claude.json"
536540 cat " $FAKE_HOME /.claude.json" 2> /dev/null | head -5 || echo " (file not found)"
537541 echo " FAIL 8a: .claude.json command='$CMD ', expected '$SELF_PATH '"
@@ -549,7 +553,7 @@ echo "OK 8b: .claude.json preserved existing keys"
549553
550554# 8c: Claude Code MCP (legacy path)
551555CMD=$( json_get " $FAKE_HOME /.claude/.mcp.json" " d['mcpServers']['codebase-memory-mcp']['command']" )
552- if [ " $CMD " != " $SELF_PATH " ] ; then
556+ if ! path_match " $CMD " " $SELF_PATH " ; then
553557 echo " FAIL 8c: .claude/.mcp.json command='$CMD '"
554558 exit 1
555559fi
@@ -597,7 +601,7 @@ echo "OK 8i: Codex instructions"
597601
598602# 8j-l: Gemini MCP + hooks + merge
599603CMD=$( json_get " $FAKE_HOME /.gemini/settings.json" " d['mcpServers']['codebase-memory-mcp']['command']" )
600- if [ " $CMD " != " $SELF_PATH " ] ; then
604+ if ! path_match " $CMD " " $SELF_PATH " ; then
601605 echo " FAIL 8j: Gemini MCP command='$CMD '"
602606 exit 1
603607fi
634638fi
635639if [ -f " $ZED_CFG " ]; then
636640 CMD=$( json_get " $ZED_CFG " " d['context_servers']['codebase-memory-mcp']['command']" )
637- if [ " $CMD " != " $SELF_PATH " ] ; then
641+ if ! path_match " $CMD " " $SELF_PATH " ; then
638642 echo " FAIL 8n: Zed command='$CMD '"
639643 exit 1
640644 fi
646650# 8o-p: OpenCode MCP + instructions
647651# command is an array ["path"] per OpenCode spec (PR #134)
648652CMD=$( json_get " $FAKE_HOME /.config/opencode/opencode.json" " d['mcp']['codebase-memory-mcp']['command'][0]" )
649- CMD_BASE=$( basename " $CMD " 2> /dev/null || echo " " )
650- SELF_BASE=$( basename " $SELF_PATH " 2> /dev/null || echo " " )
651- if [ -z " $CMD " ] || ([ " $CMD " != " $SELF_PATH " ] && [ " $CMD_BASE " != " $SELF_BASE " ]); then
653+ if [ -z " $CMD " ] || ! path_match " $CMD " " $SELF_PATH " ; then
652654 echo " FAIL 8o: OpenCode command='$CMD '"
653655 exit 1
654656fi
@@ -661,7 +663,7 @@ echo "OK 8p: OpenCode instructions"
661663
662664# 8q-r: Antigravity
663665CMD=$( json_get " $FAKE_HOME /.gemini/antigravity/mcp_config.json" " d['mcpServers']['codebase-memory-mcp']['command']" )
664- if [ " $CMD " != " $SELF_PATH " ] ; then
666+ if ! path_match " $CMD " " $SELF_PATH " ; then
665667 echo " FAIL 8q: Antigravity command='$CMD '"
666668 exit 1
667669fi
@@ -682,7 +684,7 @@ echo "OK 8s: Aider instructions"
682684# 8t: KiloCode MCP (detection + install both use ~/.config/ on all platforms)
683685KILO_CFG=" $FAKE_HOME /.config/Code/User/globalStorage/kilocode.kilo-code/settings/mcp_settings.json"
684686CMD=$( json_get " $KILO_CFG " " d['mcpServers']['codebase-memory-mcp']['command']" )
685- if [ " $CMD " != " $SELF_PATH " ] ; then
687+ if ! path_match " $CMD " " $SELF_PATH " ; then
686688 echo " FAIL 8t: KiloCode command='$CMD '"
687689 exit 1
688690fi
@@ -702,15 +704,15 @@ else
702704 VSCODE_CFG=" $FAKE_HOME /.config/Code/User/mcp.json"
703705fi
704706CMD=$( json_get " $VSCODE_CFG " " d['servers']['codebase-memory-mcp']['command']" )
705- if [ " $CMD " != " $SELF_PATH " ] ; then
707+ if ! path_match " $CMD " " $SELF_PATH " ; then
706708 echo " FAIL 8v: VS Code command='$CMD '"
707709 exit 1
708710fi
709711echo " OK 8v: VS Code MCP"
710712
711713# 8w: OpenClaw MCP
712714CMD=$( json_get " $FAKE_HOME /.openclaw/openclaw.json" " d['mcpServers']['codebase-memory-mcp']['command']" )
713- if [ " $CMD " != " $SELF_PATH " ] ; then
715+ if ! path_match " $CMD " " $SELF_PATH " ; then
714716 echo " FAIL 8w: OpenClaw command='$CMD '"
715717 exit 1
716718fi
0 commit comments