-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathbootstrap.sh
More file actions
executable file
·30 lines (26 loc) · 1.08 KB
/
bootstrap.sh
File metadata and controls
executable file
·30 lines (26 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash
# Bootstrap script to build silently and run the MCP server
# Validated for MCP Protocol Compliance (StdOut Cleaning) + Distribution
# 1. Resolve Directory (Handles Symlinks/Relative Paths)
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
cd "$SCRIPT_DIR" || exit 1
# 2. Ensure Cargo is in PATH (Common issue in cron/shell environments)
if ! command -v cargo &> /dev/null; then
if [ -f "$HOME/.cargo/bin/cargo" ]; then
export PATH="$HOME/.cargo/bin:$PATH"
fi
fi
# 3. Build (if needed) - SILENTLY to stderr
# We use >&2 to send any potential stdout from cargo to stderr
# We only build if the binary is missing or if explicitly requested (e.g. dev mode)
BINARY="./target/release/rust-agentic-skills"
if [ ! -f "$BINARY" ]; then
echo "Building Rust Agentic Skills (First Run)..." >&2
if ! cargo build --release --quiet >&2; then
echo "Error: Build failed. Check stderr for details." >&2
exit 1
fi
fi
# 4. Exec the binary directly (replacing this shell process)
# This preserves PID and signal handling
exec "$BINARY"