Files
homelab-agents/scripts/bootstrap-agents.sh
Homelab Automation 1602733fad Rename Sysadmin Session Closer Agent to Finish Up Agent
Renamed the agent from 'sysadmin-session-closer' to 'finish-up' and added VPS hostname functionality to session summary filenames.

Changes:
- Renamed agent file: agents/sysadmin-session-closer.md → agents/finish-up.md
- Updated agent version to 1.1.0
- Modified agent to include VPS hostname in session summary filenames
  - Session summaries now use format: [PROJECT_NAME]-[HOSTNAME]-session-summary.md
  - Hostname is auto-detected using `hostname` command
- Updated all documentation references:
  - README.md, QUICK-START.md, agents/README.md
  - scripts/README.md, scripts/bootstrap-agents.sh, scripts/init-project.sh
- Improved agent description to mention VPS hostname functionality

Repository: http://100.120.125.113:3000/pdm/homelab-agents
Next Session Focus: Test the renamed agent on a VPS project to verify hostname detection works correctly

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-27 14:19:56 +00:00

98 lines
3.1 KiB
Bash
Executable File

#!/bin/bash
# Bootstrap script for VPS - Ensures latest homelab agents are available
#
# Usage: source <(curl -s http://100.120.125.113:3000/pdm/homelab-agents/raw/branch/main/scripts/bootstrap-agents.sh)
#
# IMPORTANT: Use 'source' not 'bash' so PATH updates take effect immediately!
#
# This script:
# - Clones or updates the homelab-agents repo
# - Sets up git remotes for pushing VPS work
# - Makes agents available for Claude Code
# - Installs helper scripts (init-project)
# - Adds scripts to PATH permanently
set -e
GITEA_URL="http://100.120.125.113:3000"
AGENTS_REPO="$GITEA_URL/pdm/homelab-agents.git"
AGENTS_DIR="$HOME/.homelab-agents"
SCRIPTS_DIR="$HOME/.homelab-scripts"
echo "🔧 Bootstrapping homelab agents..."
# Create agents directory if needed
if [[ ! -d "$AGENTS_DIR" ]]; then
echo "📦 Cloning homelab-agents from Gitea..."
git clone "$AGENTS_REPO" "$AGENTS_DIR"
echo "✅ homelab-agents cloned to $AGENTS_DIR"
else
echo "📂 homelab-agents directory exists, updating..."
cd "$AGENTS_DIR"
# Ensure git is initialized
if [[ ! -d .git ]]; then
git init
git remote add origin "$AGENTS_REPO"
fi
# Update remote URL in case it changed
git remote set-url origin "$AGENTS_REPO" 2>/dev/null || git remote add origin "$AGENTS_REPO"
# Pull latest agents
if git pull origin main 2>/dev/null; then
echo "✅ homelab-agents updated to latest version"
else
echo "⚠️ Could not pull from main branch (might not exist yet)"
fi
fi
# Install helper scripts
echo ""
echo "📋 Installing helper scripts..."
mkdir -p "$SCRIPTS_DIR"
if [[ -f "$AGENTS_DIR/scripts/init-project.sh" ]]; then
cp "$AGENTS_DIR/scripts/init-project.sh" "$SCRIPTS_DIR/init-project"
chmod +x "$SCRIPTS_DIR/init-project"
echo "✅ init-project installed to $SCRIPTS_DIR"
fi
# Add scripts directory to PATH permanently (in ~/.bashrc)
BASHRC="$HOME/.bashrc"
PATH_EXPORT="export PATH=\"\$HOME/.homelab-scripts:\$PATH\""
if [[ -f "$BASHRC" ]]; then
if ! grep -q "homelab-scripts" "$BASHRC"; then
echo "" >> "$BASHRC"
echo "# Homelab scripts directory" >> "$BASHRC"
echo "$PATH_EXPORT" >> "$BASHRC"
echo "✅ Added scripts directory to ~/.bashrc"
else
echo "✅ Scripts directory already in ~/.bashrc"
fi
else
# Create ~/.bashrc if it doesn't exist
echo "$PATH_EXPORT" > "$BASHRC"
echo "✅ Created ~/.bashrc with scripts directory"
fi
# Also add to current session PATH (this is why we use 'source' not 'bash')
export PATH="$SCRIPTS_DIR:$PATH"
echo "✅ Scripts directory added to current session PATH"
# Verify agents are available
if [[ -f "$AGENTS_DIR/agents/finish-up.md" ]]; then
echo "✅ finish-up agent available"
else
echo "⚠️ Warning: finish-up.md not found"
fi
echo ""
echo "✨ Homelab agents bootstrap complete!"
echo ""
echo "📚 Available commands (ready to use now):"
echo " init-project <name> - Initialize a new project with git remote"
echo " cd ~/.homelab-agents - Browse agents and scripts"
echo ""
echo "📋 Agent location: $AGENTS_DIR/agents/finish-up.md"