Files
businessman/install-businessman.sh
T

90 lines
2.5 KiB
Bash
Executable File

#!/usr/bin/env bash
#
# install-businessman — Install the businessman binary and skill files
#
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
BUSINESSMAN_BIN="$SCRIPT_DIR/businessman"
BUSINESSMAN_TEMP="/tmp/businessman-installer-$$"
SKILL_MD="$SCRIPT_DIR/skills/businessman/SKILL.md"
# Target directories
BIN_DIR="/usr/local/bin"
SKILLS_DIR="$HOME/.claude/skills/businessman"
echo "=== Businessman Installation ==="
echo ""
# Check if businessman binary exists
if [ ! -f "$BUSINESSMAN_BIN" ]; then
echo "ERROR: businessman binary not found at $BUSINESSMAN_BIN"
exit 1
fi
# Check if SKILL.md exists
if [ ! -f "$SKILL_MD" ]; then
echo "ERROR: SKILL.md not found at $SKILL_MD"
exit 1
fi
# Check if .claude directory exists
if [ ! -d "$HOME/.claude" ]; then
echo "WARNING: $HOME/.claude directory does not exist."
echo "The businessman skill will not be installed."
echo "Please create $HOME/.claude before running this script again."
exit 0
fi
# Prompt for API endpoint
echo "Please enter your local API endpoint for llama-swap"
echo "This is the URL where llama-swap is running (e.g., http://192.168.50.21:6901)"
echo ""
read -p "API endpoint [http://192.168.50.21:6901]: " API_ENDPOINT
# Use default if empty
API_ENDPOINT="${API_ENDPOINT:-http://192.168.50.21:6901}"
# Create a temporary modified copy of the businessman binary
echo ""
echo "Configuring businessman binary with API endpoint: $API_ENDPOINT"
cp "$BUSINESSMAN_BIN" "$BUSINESSMAN_TEMP"
sed -i "s|LLAMA_SWAP_API.*http.*|LLAMA_SWAP_API=\"${API_ENDPOINT}\"|" "$BUSINESSMAN_TEMP"
# Verify the modification worked
if ! grep -q "LLAMA_SWAP_API=\"$API_ENDPOINT\"" "$BUSINESSMAN_TEMP"; then
echo "ERROR: Failed to update API endpoint in businessman binary"
rm -f "$BUSINESSMAN_TEMP"
exit 1
fi
# Create skills/businessman directory
echo "Creating $SKILLS_DIR..."
mkdir -p "$SKILLS_DIR"
# Copy SKILL.md
echo "Copying SKILL.md to $SKILLS_DIR..."
cp "$SKILL_MD" "$SKILLS_DIR/SKILL.md"
# Copy businessman binary to /usr/local/bin
echo "Copying businessman to $BIN_DIR..."
cp "$BUSINESSMAN_TEMP" "$BIN_DIR/businessman"
chmod +x "$BIN_DIR/businessman"
# Cleanup
rm -f "$BUSINESSMAN_TEMP"
echo ""
echo "=== Installation Complete ==="
echo ""
echo "The following files were installed:"
echo " - $BIN_DIR/businessman (executable)"
echo " - $SKILLS_DIR/SKILL.md"
echo ""
echo "API endpoint configured: $API_ENDPOINT"
echo ""
echo "To use the businessman skill, run:"
echo " claude \"Use the businessman skill to initialize our session\""
echo ""