Skip to content

Commit d005d77

Browse files
committed
fix: replace hardcoded macOS path with dynamic PROJECT_ROOT variable in DXT build script
The build-dxt-clean.sh script had /Users/arul/Projects/ncp-production-clean hardcoded in multiple places, causing permission errors on Linux CI runners. Now uses PROJECT_ROOT=$(cd $(dirname ${BASH_SOURCE[0]})/..; pwd) to dynamically determine the project root directory, making it portable across all environments.
1 parent 890e22e commit d005d77

1 file changed

Lines changed: 14 additions & 10 deletions

File tree

scripts/build-dxt-clean.sh

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ set -e
33

44
echo "🔨 Building NCP DXT from clean directory..."
55

6+
# Store project root directory
7+
PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
8+
echo "📍 Project root: $PROJECT_ROOT"
9+
610
# Build TypeScript first
711
echo "📦 Building TypeScript..."
812
npm run build
@@ -47,14 +51,14 @@ fi
4751

4852
# Pack DXT from clean directory
4953
echo "📦 Packing DXT..."
50-
npx @anthropic-ai/mcpb pack . /Users/arul/Projects/ncp-production-clean/ncp.dxt
54+
npx @anthropic-ai/mcpb pack . "$PROJECT_ROOT/ncp.dxt"
5155

5256
# WORKAROUND: mcpb excludes build/ directories from node_modules
5357
# Extract DXT (zip format), manually add build directories, re-pack
5458
echo "🔧 Fixing missing build directories (mcpb workaround)..."
5559
PATCH_DIR=$(mktemp -d)
5660
cd "$PATCH_DIR"
57-
unzip -q /Users/arul/Projects/ncp-production-clean/ncp.dxt
61+
unzip -q "$PROJECT_ROOT/ncp.dxt"
5862

5963
# Copy missing build directories from temp install
6064
if [ -d "$TEMP_DIR/node_modules/human-signals/build" ]; then
@@ -69,9 +73,9 @@ if [ -d "$TEMP_DIR/node_modules/execa/node_modules/human-signals/build" ]; then
6973
fi
7074

7175
# Re-pack as zip (DXT is zip format, not tar.gz)
72-
rm -f /Users/arul/Projects/ncp-production-clean/ncp.dxt
73-
zip -qr /Users/arul/Projects/ncp-production-clean/ncp.dxt .
74-
cd /Users/arul/Projects/ncp-production-clean
76+
rm -f "$PROJECT_ROOT/ncp.dxt"
77+
zip -qr "$PROJECT_ROOT/ncp.dxt" .
78+
cd "$PROJECT_ROOT"
7579

7680
# Cleanup temp directories
7781
rm -rf "$TEMP_DIR" "$PATCH_DIR"
@@ -82,28 +86,28 @@ echo "🧪 Testing DXT (MCP spec compliance)..."
8286

8387
# Verify it's a valid zip file
8488
echo " • Verifying zip format..."
85-
if ! unzip -t /Users/arul/Projects/ncp-production-clean/ncp.dxt > /dev/null 2>&1; then
89+
if ! unzip -t "$PROJECT_ROOT/ncp.dxt" > /dev/null 2>&1; then
8690
echo " ❌ FAILED: DXT is not a valid zip file"
8791
exit 1
8892
fi
8993
echo " ✅ Valid zip format"
9094

9195
TEST_DIR=$(mktemp -d)
9296
cd "$TEST_DIR"
93-
unzip -q /Users/arul/Projects/ncp-production-clean/ncp.dxt > /dev/null 2>&1
97+
unzip -q "$PROJECT_ROOT/ncp.dxt" > /dev/null 2>&1
9498

9599
# Quick verification test
96100
echo " • Checking dependencies..."
97101
if [ ! -d "node_modules/human-signals/build" ]; then
98102
echo " ❌ FAILED: human-signals/build missing"
99-
cd /Users/arul/Projects/ncp-production-clean
103+
cd "$PROJECT_ROOT"
100104
rm -rf "$TEST_DIR"
101105
exit 1
102106
fi
103107

104108
if [ ! -d "node_modules/execa/node_modules/human-signals/build" ]; then
105109
echo " ❌ FAILED: execa/node_modules/human-signals/build missing"
106-
cd /Users/arul/Projects/ncp-production-clean
110+
cd "$PROJECT_ROOT"
107111
rm -rf "$TEST_DIR"
108112
exit 1
109113
fi
@@ -127,7 +131,7 @@ else
127131
echo " ⚠️ Server test skipped (requires stdio mode)"
128132
fi
129133

130-
cd /Users/arul/Projects/ncp-production-clean
134+
cd "$PROJECT_ROOT"
131135
rm -rf "$TEST_DIR"
132136

133137
echo ""

0 commit comments

Comments
 (0)