OpenWriterControle/update.sh
darrenhinde 777b3fc702 feat: add interactive installer with component registry system
- Add component registry (registry.json) with 4 installation profiles
- Create interactive installer (install.sh) with profile and custom selection
- Add auto-registration script for CI/CD integration
- Create validation script for component structure
- Add update script for keeping components current
- Include GitHub Actions workflow for auto-registry updates
- Update README with installation instructions
- Add CONTRIBUTING guide for new components

Features:
- Interactive CLI with colored output and menus
- Smart dependency resolution
- Backup existing installations
- Profile-based installation (core, developer, full, advanced)
- Custom component selection
- Component validation and testing tools
2025-11-17 23:43:13 +00:00

83 lines
2.6 KiB
Bash
Executable file
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env bash
#############################################################################
# OpenCode Agents Updater
# Updates existing OpenCode components to latest versions
#############################################################################
set -e
# Colors
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
CYAN='\033[0;36m'
BOLD='\033[1m'
NC='\033[0m'
REPO_URL="https://raw.githubusercontent.com/darrenhinde/opencode-agents/main"
INSTALL_DIR=".opencode"
print_success() { echo -e "${GREEN}✓${NC} $1"; }
print_info() { echo -e "${BLUE}ℹ${NC} $1"; }
print_step() { echo -e "\n${CYAN}${BOLD}▶${NC} $1\n"; }
print_header() {
echo -e "${CYAN}${BOLD}"
echo "╔════════════════════════════════════════════════════════════════╗"
echo "║ ║"
echo "║ OpenCode Agents Updater v1.0.0 ║"
echo "║ ║"
echo "╚════════════════════════════════════════════════════════════════╝"
echo -e "${NC}"
}
update_component() {
local path=$1
local url="${REPO_URL}/${path}"
if [ ! -f "$path" ]; then
print_info "Skipping $path (not installed)"
return
fi
# Backup existing file
cp "$path" "${path}.backup"
if curl -fsSL "$url" -o "$path"; then
print_success "Updated $path"
rm "${path}.backup"
else
print_info "Failed to update $path, restoring backup"
mv "${path}.backup" "$path"
fi
}
main() {
print_header
if [ ! -d "$INSTALL_DIR" ]; then
echo "Error: $INSTALL_DIR directory not found"
echo "Run install.sh first to install components"
exit 1
fi
print_step "Updating components..."
# Update all markdown files in .opencode
while IFS= read -r -d '' file; do
update_component "$file"
done < <(find "$INSTALL_DIR" -name "*.md" -type f -print0)
# Update TypeScript files
while IFS= read -r -d '' file; do
update_component "$file"
done < <(find "$INSTALL_DIR" -name "*.ts" -type f -not -path "*/node_modules/*" -print0)
# Update config files
[ -f "env.example" ] && update_component "env.example"
print_success "Update complete!"
}
main "$@"