Skip to content

Commit 043c06a

Browse files
committed
fix: use BUN_PATH consistently in ensure_mcp_compliance.sh
1 parent 1ad59d3 commit 043c06a

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

scripts/ensure_mcp_compliance.sh

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,19 @@ YELLOW='\033[1;33m'
2222
BLUE='\033[0;34m'
2323
NC='\033[0m' # No Color
2424

25+
# Find bun executable early (use full path for subprocess compatibility)
26+
# Python subprocess doesn't always inherit shell PATH, so we need absolute path
27+
BUN_PATH=$(which bun 2>/dev/null || echo "$HOME/.bun/bin/bun")
28+
if [ ! -x "$BUN_PATH" ]; then
29+
# Try common installation locations
30+
for candidate in "$HOME/.bun/bin/bun" "/usr/local/bin/bun" "/opt/homebrew/bin/bun"; do
31+
if [ -x "$candidate" ]; then
32+
BUN_PATH="$candidate"
33+
break
34+
fi
35+
done
36+
fi
37+
2538
# Get the directory where this script is located
2639
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
2740
PROJECT_ROOT="$( cd "$SCRIPT_DIR/.." && pwd )"
@@ -147,7 +160,8 @@ fi
147160

148161
# Build the bridge before testing
149162
echo -e "${BLUE}==== Building pierre-claude-bridge for compliance testing... ====${NC}"
150-
if bun run build; then
163+
echo -e "${BLUE} Using bun at: $BUN_PATH${NC}"
164+
if $BUN_PATH run build; then
151165
echo -e "${GREEN}[OK] Bridge built successfully${NC}"
152166
else
153167
echo -e "${RED}[FAIL] Bridge build failed${NC}"
@@ -237,14 +251,7 @@ fi
237251
# Run MCP compliance tests (REQUIRED - NO EXCEPTIONS POLICY)
238252
echo -e "${BLUE}==== Running MCP protocol compliance tests (REQUIRED)... ====${NC}"
239253
BRIDGE_PATH="$(pwd)/dist/cli.js"
240-
241-
# Find bun executable (use full path for Python subprocess compatibility)
242-
BUN_PATH=$(which bun 2>/dev/null || echo "bun")
243-
if [ "$BUN_PATH" = "bun" ]; then
244-
echo -e "${YELLOW}[WARN] Could not find bun in PATH, using 'bun' directly${NC}"
245-
else
246-
echo -e "${GREEN}[OK] Found bun at: $BUN_PATH${NC}"
247-
fi
254+
echo -e "${BLUE} Using bun at: $BUN_PATH${NC}"
248255

249256
cd "$MCP_VALIDATOR_DIR"
250257

0 commit comments

Comments
 (0)