@@ -2462,8 +2462,7 @@ init_interactive() {
24622462# Provides actionable error messages with unique codes
24632463# ═══════════════════════════════════════════════════════════════════════════════
24642464
2465- # Error code registry
2466- declare -A ERROR_MESSAGES 2> /dev/null || true
2465+ # Error code registry (bash 3.2 compatible - uses regular array)
24672466ERROR_CODES=(
24682467 " E001:OPENAI_API_KEY not set:export OPENAI_API_KEY=\" sk-...\" && orchestrate.sh preflight:help api-setup"
24692468 " E002:GEMINI_API_KEY not set:export GEMINI_API_KEY=\" AIza...\" && orchestrate.sh preflight:help api-setup"
@@ -5797,6 +5796,90 @@ open_browser() {
57975796 fi
57985797}
57995798
5799+ # ═══════════════════════════════════════════════════════════════════════════════
5800+ # ESSENTIAL DEVELOPER TOOLS - Detection and Installation (v4.8.2)
5801+ # Tools that AI coding assistants rely on for auditing, testing, and browser work
5802+ # Compatible with bash 3.2+ (macOS default)
5803+ # ═══════════════════════════════════════════════════════════════════════════════
5804+
5805+ # Essential tools list (space-separated for bash 3.2 compat)
5806+ ESSENTIAL_TOOLS_LIST= " jq shellcheck gh imagemagick playwright"
5807+
5808+ # Get tool description
5809+ get_tool_description () {
5810+ case " $1 " in
5811+ jq) echo " JSON processor (critical for AI workflows)" ;;
5812+ shellcheck) echo " Shell script static analysis" ;;
5813+ gh) echo " GitHub CLI for PR/issue automation" ;;
5814+ imagemagick) echo " Screenshot compression (5MB API limits)" ;;
5815+ playwright) echo " Modern browser automation & screenshots" ;;
5816+ * ) echo " Developer tool" ;;
5817+ esac
5818+ }
5819+
5820+ # Check if a tool is installed
5821+ is_tool_installed () {
5822+ local tool=" $1 "
5823+ case " $tool " in
5824+ imagemagick)
5825+ command -v convert & > /dev/null || command -v magick & > /dev/null
5826+ ;;
5827+ playwright)
5828+ # Check for playwright in node_modules or global
5829+ command -v playwright & > /dev/null || [[ -f " node_modules/.bin/playwright" ]] || npx playwright --version & > /dev/null 2>&1
5830+ ;;
5831+ * )
5832+ command -v " $tool " & > /dev/null
5833+ ;;
5834+ esac
5835+ }
5836+
5837+ # Get install command for current platform
5838+ get_install_command () {
5839+ local tool=" $1 "
5840+
5841+ if [[ " $OSTYPE " == " darwin" * ]]; then
5842+ # macOS - prefer brew
5843+ case " $tool " in
5844+ jq) echo " brew install jq" ;;
5845+ shellcheck) echo " brew install shellcheck" ;;
5846+ gh) echo " brew install gh" ;;
5847+ imagemagick) echo " brew install imagemagick" ;;
5848+ playwright) echo " npx playwright install" ;;
5849+ esac
5850+ else
5851+ # Linux - apt-get
5852+ case " $tool " in
5853+ jq) echo " sudo apt-get install -y jq" ;;
5854+ shellcheck) echo " sudo apt-get install -y shellcheck" ;;
5855+ gh) echo " sudo apt-get install -y gh" ;;
5856+ imagemagick) echo " sudo apt-get install -y imagemagick" ;;
5857+ playwright) echo " npx playwright install" ;;
5858+ esac
5859+ fi
5860+ }
5861+
5862+ # Install a single tool
5863+ install_tool () {
5864+ local tool=" $1 "
5865+ local install_cmd
5866+ install_cmd=$( get_install_command " $tool " )
5867+
5868+ if [[ -z " $install_cmd " ]]; then
5869+ echo -e " ${RED} ✗${NC} No install command for $tool "
5870+ return 1
5871+ fi
5872+
5873+ echo -e " ${CYAN} →${NC} $install_cmd "
5874+ if eval " $install_cmd " 2>&1 | sed ' s/^/ /' ; then
5875+ echo -e " ${GREEN} ✓${NC} $tool installed"
5876+ return 0
5877+ else
5878+ echo -e " ${RED} ✗${NC} Failed to install $tool "
5879+ return 1
5880+ fi
5881+ }
5882+
58005883# Interactive setup wizard
58015884setup_wizard () {
58025885 echo " "
@@ -5808,7 +5891,7 @@ setup_wizard() {
58085891 echo -e " This wizard will help you install dependencies and configure API keys."
58095892 echo " "
58105893
5811- local total_steps=9
5894+ local total_steps=10
58125895 local current_step=0
58135896 local shell_profile=" "
58145897 local keys_to_add=" "
@@ -6150,6 +6233,89 @@ setup_wizard() {
61506233 preflight_cache_invalidate # Invalidate cache after config change
61516234 echo -e " ${GREEN} ✓${NC} Provider configuration saved"
61526235
6236+ # ═══════════════════════════════════════════════════════════════════════════
6237+ # STEP 10: Essential Developer Tools (v4.8.2)
6238+ # ═══════════════════════════════════════════════════════════════════════════
6239+ (( current_step++ ))
6240+ echo " "
6241+ echo -e " ${CYAN} Step $current_step /$total_steps : Essential Developer Tools${NC} "
6242+ echo -e " ${YELLOW} Tools that AI coding assistants rely on for auditing, QA, and browser work.${NC} "
6243+ echo " "
6244+
6245+ # Detect tool status
6246+ local missing_tools=()
6247+ local installed_tools=()
6248+ local tool desc
6249+
6250+ for tool in jq shellcheck gh imagemagick playwright; do
6251+ desc=$( get_tool_description " $tool " )
6252+
6253+ if is_tool_installed " $tool " ; then
6254+ installed_tools+=(" $tool " )
6255+ echo -e " ${GREEN} ✓${NC} $tool - $desc "
6256+ else
6257+ missing_tools+=(" $tool " )
6258+ echo -e " ${YELLOW} ✗${NC} $tool - $desc "
6259+ fi
6260+ done
6261+
6262+ echo " "
6263+
6264+ if [[ ${# missing_tools[@]} -gt 0 ]]; then
6265+ echo -e " ${YELLOW}${# missing_tools[@]} tools missing.${NC} These improve AI agent capabilities:"
6266+ echo " "
6267+ echo -e " ${CYAN} Why these tools matter:${NC} "
6268+ echo -e " • ${GREEN} jq${NC} - Parse JSON from API responses (critical!)"
6269+ echo -e " • ${GREEN} shellcheck${NC} - Validate shell scripts before running"
6270+ echo -e " • ${GREEN} gh${NC} - Create PRs/issues directly from CLI"
6271+ echo -e " • ${GREEN} imagemagick${NC} - Compress screenshots for API limits (5MB)"
6272+ echo -e " • ${GREEN} playwright${NC} - Browser automation, screenshots, QA testing"
6273+ echo " "
6274+
6275+ echo -e " ${GREEN} [1]${NC} Install all missing tools ${CYAN} (Recommended)${NC} "
6276+ echo -e " ${GREEN} [2]${NC} Install critical only (jq, shellcheck)"
6277+ echo -e " ${GREEN} [3]${NC} Skip for now"
6278+ echo " "
6279+ read -p " Enter choice [1-3, default 1]: " tools_choice
6280+ tools_choice=" ${tools_choice:- 1} "
6281+
6282+ local tools_to_install=()
6283+ case " $tools_choice " in
6284+ 1)
6285+ tools_to_install=(" ${missing_tools[@]} " )
6286+ ;;
6287+ 2)
6288+ for tool in jq shellcheck; do
6289+ if [[ " ${missing_tools[*]} " =~ " $tool " ]]; then
6290+ tools_to_install+=(" $tool " )
6291+ fi
6292+ done
6293+ ;;
6294+ 3)
6295+ echo -e " ${YELLOW} ⚠${NC} Skipped. Some AI features may be limited."
6296+ ;;
6297+ esac
6298+
6299+ if [[ ${# tools_to_install[@]} -gt 0 ]]; then
6300+ echo " "
6301+ echo -e " ${CYAN} Installing ${# tools_to_install[@]} tools...${NC} "
6302+ echo " "
6303+
6304+ local installed_count=0
6305+ for tool in " ${tools_to_install[@]} " ; do
6306+ if install_tool " $tool " ; then
6307+ (( installed_count++ ))
6308+ fi
6309+ done
6310+
6311+ echo " "
6312+ echo -e " ${GREEN} ✓${NC} Installed $installed_count /${# tools_to_install[@]} tools"
6313+ fi
6314+ else
6315+ echo -e " ${GREEN} All essential tools already installed!${NC} "
6316+ fi
6317+ echo " "
6318+
61536319 # ═══════════════════════════════════════════════════════════════════════════
61546320 # SUMMARY & PERSISTENCE
61556321 # ═══════════════════════════════════════════════════════════════════════════
@@ -6201,6 +6367,17 @@ setup_wizard() {
62016367 echo -e " Claude: ${GREEN} $PROVIDER_CLAUDE_TIER ${NC} ($PROVIDER_CLAUDE_COST_TIER )"
62026368 echo -e " Strategy: ${GREEN} $COST_OPTIMIZATION_STRATEGY ${NC} "
62036369 echo " "
6370+ echo -e " ${CYAN} Essential Tools (v4.8.2):${NC} "
6371+ local tool_status_count=0
6372+ for tool in jq shellcheck gh imagemagick playwright; do
6373+ if is_tool_installed " $tool " ; then
6374+ echo -e " ${GREEN} ✓${NC} $tool "
6375+ (( tool_status_count++ ))
6376+ else
6377+ echo -e " ${YELLOW} ○${NC} $tool (optional)"
6378+ fi
6379+ done
6380+ echo " "
62046381
62056382 # Offer to persist keys
62066383 if [[ -n " $keys_to_add " ]]; then
0 commit comments