Skip to content

Fix writeFile quote escaping that corrupted single quotes in sandbox #499

Fix writeFile quote escaping that corrupted single quotes in sandbox

Fix writeFile quote escaping that corrupted single quotes in sandbox #499

name: Test Clean Installation
on:
pull_request:
branches: [main]
push:
branches: [main]
workflow_dispatch:
jobs:
test-clean-installs:
strategy:
matrix:
os: [macos-latest]
node: [22]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
# Install pnpm
- uses: pnpm/action-setup@v3
with:
version: 9
# Install dependencies and build
- run: pnpm install
- run: pnpm run build
- run: cd mcp-server && pnpm run build
- run: pnpm pack
# Test 1: Clean npm global install
- name: Test Clean NPM Global Install
run: |
# Save current directory
WORK_DIR=$(pwd)
# Create clean environment
export CLEAN_HOME=$(mktemp -d)
# Get full path to tarball
TARBALL=$(ls $WORK_DIR/dev3000-*.tgz)
echo "Installing from tarball: $TARBALL"
# Configure npm to install to clean location
npm config set prefix $CLEAN_HOME/.npm
export PATH="$CLEAN_HOME/.npm/bin:$PATH"
# Install globally
npm install -g "$TARBALL"
# Verify installation
echo "Checking installation..."
ls -la $CLEAN_HOME/.npm/bin/
# Test that d3k works
d3k --version
# Test 2: Server startup test
- name: Test MCP Server Startup
run: |
# Need to re-export the npm bin path since this is a new step
export CLEAN_HOME=$(mktemp -d)
npm config set prefix $CLEAN_HOME/.npm
export PATH="$CLEAN_HOME/.npm/bin:$PATH"
# Re-install to this step's environment
TARBALL=$(ls dev3000-*.tgz)
npm install -g "$TARBALL"
# Create minimal test app
TEST_DIR=$(mktemp -d)
cd $TEST_DIR
cat > package.json << 'EOF'
{
"name": "test",
"scripts": {
"dev": "node -e \"console.log('Server running'); setInterval(()=>{},1000)\""
}
}
EOF
# Verify d3k is available
which d3k || echo "d3k not found in PATH"
# Run d3k in background and capture output
d3k --debug --servers-only > d3k.log 2>&1 &
D3K_PID=$!
# Wait for up to 30 seconds
COUNTER=0
while [ $COUNTER -lt 30 ]; do
if ! kill -0 $D3K_PID 2>/dev/null; then
# Process died
wait $D3K_PID
CODE=$?
break
fi
sleep 1
COUNTER=$((COUNTER + 1))
done
# If still running after 30 seconds, kill it (this is success)
if [ $COUNTER -eq 30 ]; then
kill $D3K_PID 2>/dev/null || true
CODE=124 # Simulate timeout exit code
fi
# Show output for debugging
echo "=== d3k output ==="
cat d3k.log || true
echo "=== end output ==="
# Check if it started (exit code 124 means timeout, which is expected)
if [ "$CODE" = "124" ]; then
echo "✅ Server started successfully"
else
echo "❌ Server failed to start with exit code: $CODE"
exit 1
fi
# Docker tests disabled - macOS runners don't have Docker
# test-docker-install:
# runs-on: ubuntu-latest # Would need Ubuntu for Docker
# ... (test commented out)