11#! /bin/bash
22set -uo pipefail
33
4- # Non-interactive health check β runs on every container start.
5- # Never prompts for input. Reports status and directs to 'make setup' if needed.
4+ # Unified environment health check and troubleshooting.
5+ # Runs non-interactively on every container start and can be invoked manually.
6+ # Never prompts for input. Reports status, auto-fixes what it can,
7+ # and directs to 'make setup' for the rest.
68
79SCRIPT_DIR=" $( dirname " ${BASH_SOURCE[0]} " ) "
810# shellcheck source=scripts/utils.sh
@@ -18,7 +20,12 @@ echo "ββββββββββββββββββββββββ
1820
1921# --- Load .env and apply git config ---
2022if [ -f .env ]; then
21- log_success " .env file found."
23+ if grep -q " YOUR_GIT_NAME_HERE" .env || grep -q " YOUR_GIT_EMAIL_HERE" .env; then
24+ log_warn " .env file contains placeholder values. Run 'make setup' to configure."
25+ ISSUES=$(( ISSUES + 1 ))
26+ else
27+ log_success " .env file found."
28+ fi
2229 safe_export_env
2330
2431 # Apply git config from .env
@@ -37,7 +44,7 @@ if [ -f .env ]; then
3744 gh auth setup-git 2> /dev/null || true
3845 fi
3946else
40- log_warn " .env file not found."
47+ log_warn " .env file not found. Run 'make setup' to configure. "
4148 ISSUES=$(( ISSUES + 1 ))
4249fi
4350
@@ -64,7 +71,7 @@ if command -v gh &> /dev/null; then
6471 if gh auth status & > /dev/null; then
6572 log_success " GitHub CLI authenticated."
6673 else
67- log_warn " GitHub CLI installed but not authenticated."
74+ log_warn " GitHub CLI installed but not authenticated. Run 'gh auth login'. "
6875 ISSUES=$(( ISSUES + 1 ))
6976 fi
7077else
@@ -100,6 +107,23 @@ for var in GEMINI_API_KEY ANTHROPIC_API_KEY GITHUB_TOKEN; do
100107 fi
101108done
102109
110+ # --- Script permissions ---
111+ echo " "
112+ echo " π Script Permissions"
113+ echo " ββββββββββββββββββββββββββββββββββββββ"
114+ PERM_ISSUE=0
115+ for script in scripts/* .sh templates/scripts/* .sh; do
116+ if [ -f " $script " ] && [ ! -x " $script " ]; then
117+ PERM_ISSUE=1
118+ fi
119+ done
120+ if [ $PERM_ISSUE -eq 1 ]; then
121+ chmod +x scripts/* .sh templates/scripts/* .sh 2> /dev/null || true
122+ log_success " Fixed missing execute permissions on scripts."
123+ else
124+ log_success " All scripts have correct permissions."
125+ fi
126+
103127# --- Git hooks ---
104128echo " "
105129echo " π§ Git Hooks"
0 commit comments