From 838619ee075fccf0733e5eb24fb15a51ad244b53 Mon Sep 17 00:00:00 2001 From: marcusquinn <6428977+marcusquinn@users.noreply.github.com> Date: Thu, 5 Feb 2026 20:49:34 +0000 Subject: [PATCH] fix: resolve setup onboarding errors (macOS head -z, model selection, agent routing) - Replace GNU-only 'head -z' with macOS-compatible 'while read' in deploy-templates.sh - Route /onboarding command to Onboarding agent instead of Build+ - Auto-detect authenticated provider when launching onboarding to avoid insufficient_quota errors (prefers Anthropic > Google > fallback to OpenCode default) --- .agent/scripts/generate-opencode-commands.sh | 2 +- setup.sh | 17 ++++++++++++++++- templates/deploy-templates.sh | 2 +- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/.agent/scripts/generate-opencode-commands.sh b/.agent/scripts/generate-opencode-commands.sh index d50a5f196..af4d495db 100755 --- a/.agent/scripts/generate-opencode-commands.sh +++ b/.agent/scripts/generate-opencode-commands.sh @@ -1017,7 +1017,7 @@ echo -e " ${GREEN}✓${NC} Created /webmaster-keywords command" cat > "$OPENCODE_COMMAND_DIR/onboarding.md" << 'EOF' --- description: Interactive onboarding wizard - discover services, configure integrations -agent: Build+ +agent: Onboarding --- Read ~/.aidevops/agents/onboarding.md and follow its instructions. diff --git a/setup.sh b/setup.sh index a1d96349d..a1f8dde96 100755 --- a/setup.sh +++ b/setup.sh @@ -3717,7 +3717,22 @@ echo " aidevops uninstall - Remove aidevops" if [[ "$launch_onboarding" =~ ^[Yy]?$ || "$launch_onboarding" == "Y" ]]; then echo "" echo "Starting OpenCode with Onboarding agent..." - opencode --agent Onboarding --prompt "/onboarding" + # Detect available auth provider and select appropriate model + # Prefer Anthropic (Claude) > Google (Gemini) > OpenCode Zen > OpenAI + local onboarding_model="" + local auth_file="$HOME/.local/share/opencode/auth.json" + if [[ -f "$auth_file" ]]; then + if jq -e '.anthropic' "$auth_file" &>/dev/null; then + onboarding_model="anthropic/claude-sonnet-4-5" + elif jq -e '.google' "$auth_file" &>/dev/null; then + onboarding_model="google/gemini-2.5-flash" + fi + fi + if [[ -n "$onboarding_model" ]]; then + opencode --agent Onboarding --prompt "/onboarding" --model "$onboarding_model" + else + opencode --agent Onboarding --prompt "/onboarding" + fi else echo "" echo "You can run /onboarding anytime in OpenCode to configure services." diff --git a/templates/deploy-templates.sh b/templates/deploy-templates.sh index 17326bff3..baf449ee4 100755 --- a/templates/deploy-templates.sh +++ b/templates/deploy-templates.sh @@ -63,7 +63,7 @@ create_backup_with_rotation() { if (( backup_count > BACKUP_KEEP_COUNT )); then local to_delete=$((backup_count - BACKUP_KEEP_COUNT)) # Delete oldest backups (sorted by name = sorted by date) - find "$backup_type_dir" -maxdepth 1 -type d -name "20*" -print0 2>/dev/null | sort -z | head -z -n "$to_delete" | xargs -0 rm -rf + find "$backup_type_dir" -maxdepth 1 -type d -name "20*" 2>/dev/null | sort | head -n "$to_delete" | while read -r old_backup; do rm -rf "$old_backup"; done print_info "Rotated backups: removed $to_delete old backup(s)" fi