68 lines
1.6 KiB
Bash
Executable File
68 lines
1.6 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
REPO_URL="${RESEARCH_PI_REPO:-https://github.com/sleepyeldrazi/research-pi.git}"
|
|
|
|
INSTALL_DIR="${HOME}/.pi/research"
|
|
BIN_TARGET="${HOME}/.local/bin/research"
|
|
|
|
echo "==> Installing research-pi..."
|
|
|
|
# Dependencies
|
|
if ! command -v node >/dev/null 2>&1; then
|
|
echo "Error: Node.js is required but not installed."
|
|
exit 1
|
|
fi
|
|
|
|
if ! command -v pi >/dev/null 2>&1; then
|
|
echo "Error: pi (pi-coding-agent) is required but not installed."
|
|
exit 1
|
|
fi
|
|
|
|
if ! command -v pnpm >/dev/null 2>&1; then
|
|
echo "Error: pnpm is required but not installed."
|
|
exit 1
|
|
fi
|
|
|
|
# Clone or update
|
|
if [ -d "$INSTALL_DIR/.git" ]; then
|
|
echo "==> Updating existing installation..."
|
|
git -C "$INSTALL_DIR" pull --ff-only
|
|
else
|
|
echo "==> Cloning repository..."
|
|
mkdir -p "$(dirname "$INSTALL_DIR")"
|
|
git clone "$REPO_URL" "$INSTALL_DIR"
|
|
fi
|
|
|
|
# Build
|
|
cd "$INSTALL_DIR"
|
|
if [ ! -d "node_modules" ]; then
|
|
echo "==> Installing dependencies..."
|
|
pnpm install
|
|
fi
|
|
|
|
echo "==> Building..."
|
|
pnpm build
|
|
|
|
# Symlink
|
|
mkdir -p "$(dirname "$BIN_TARGET")"
|
|
if [ -L "$BIN_TARGET" ] || [ -e "$BIN_TARGET" ]; then
|
|
rm -f "$BIN_TARGET"
|
|
fi
|
|
ln -s "$INSTALL_DIR/bin/research" "$BIN_TARGET"
|
|
|
|
# Default config
|
|
CONFIG_DIR="${HOME}/.pi/research"
|
|
CONFIG_FILE="${CONFIG_DIR}/config.json"
|
|
if [ ! -f "$CONFIG_FILE" ]; then
|
|
echo "==> Creating default config..."
|
|
cp "$INSTALL_DIR/config/default.json" "$CONFIG_FILE"
|
|
fi
|
|
|
|
echo "==> Installation complete!"
|
|
echo " Binary: $BIN_TARGET"
|
|
echo " Source: $INSTALL_DIR"
|
|
echo ""
|
|
echo "Usage example:"
|
|
echo ' research --model k2p5 --start_research --task "native android app using gemma 4 e4b"'
|