Add real-time GitHub sync to installers and sync script
Interactive installer (interactive-install-claude.sh): - Add fetch_latest_agents() function to check GitHub for updates - Clone latest agents from contains-studio/agents before installing - Update local agents directory with upstream changes - Gracefully fallback to local agents if GitHub fetch fails - Call fetch_latest_agents() before install_agents() in main flow Sync script (sync-agents.sh): - Add REPO_AGENTS_DIR environment variable support - Automatically update repository agents directory when syncing - Keep installer agents in sync with Claude Code agents This ensures users always get the latest agents from upstream GitHub while maintaining customizations in the local repository.
This commit is contained in:
@@ -594,6 +594,49 @@ create_directories() {
|
||||
log_success "Directories created"
|
||||
}
|
||||
|
||||
fetch_latest_agents() {
|
||||
log_info "Checking for agent updates from GitHub..."
|
||||
|
||||
local GITHUB_REPO="https://github.com/contains-studio/agents"
|
||||
local TEMP_AGENT_DIR="/tmp/claude-agents-latest-$RANDOM"
|
||||
local UPDATE_FOUND=false
|
||||
|
||||
# Create temp directory
|
||||
mkdir -p "$TEMP_AGENT_DIR"
|
||||
|
||||
# Try to clone using git
|
||||
if command -v git &> /dev/null; then
|
||||
if git clone --depth 1 --quiet "$GITHUB_REPO" "$TEMP_AGENT_DIR" 2>/dev/null; then
|
||||
UPDATE_FOUND=true
|
||||
log_success "Fetched latest agents from GitHub"
|
||||
|
||||
# Copy updated agents to source directory
|
||||
for category in engineering marketing product studio-operations project-management testing design bonus; do
|
||||
if [ -d "$TEMP_AGENT_DIR/$category" ]; then
|
||||
mkdir -p "$SCRIPT_DIR/agents/$category"
|
||||
cp -f "$TEMP_AGENT_DIR/$category"/*.md "$SCRIPT_DIR/agents/$category/" 2>/dev/null || true
|
||||
fi
|
||||
done
|
||||
|
||||
# Update README if present
|
||||
if [ -f "$TEMP_AGENT_DIR/README.md" ]; then
|
||||
cp -f "$TEMP_AGENT_DIR/README.md" "$SCRIPT_DIR/agents/README.md" 2>/dev/null || true
|
||||
fi
|
||||
|
||||
log_info "Local agents updated from GitHub"
|
||||
else
|
||||
log_warning "Failed to fetch from GitHub (using local agents)"
|
||||
fi
|
||||
else
|
||||
log_warning "Git not found (using local agents)"
|
||||
fi
|
||||
|
||||
# Cleanup
|
||||
rm -rf "$TEMP_AGENT_DIR"
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
install_agents() {
|
||||
if [ $SELECTED_AGENTS -eq 0 ]; then
|
||||
return
|
||||
@@ -1055,6 +1098,7 @@ perform_installation() {
|
||||
echo ""
|
||||
|
||||
create_directories
|
||||
fetch_latest_agents
|
||||
install_agents
|
||||
install_settings
|
||||
install_local_settings
|
||||
|
||||
Reference in New Issue
Block a user