Bug Description
The setup-wizard.sh script calls log_debug function on line 26 before the logging module is sourced, causing a "command not found" error.
Error Output
./src/setup-wizard.sh: line 26: log_debug: command not found
Root Cause
The script structure has:
- Line 26:
log_debug "Loaded wizard module: $module" inside load_wizard_modules()
- Much later in the file:
source "$SCRIPT_DIR/utils/logging.sh"
The function is called before the logging module that defines it is sourced.
Impact
- Severity: Medium
- Component: Setup Wizard
- The setup wizard fails when running with --dry-run or other options
- First-time setup experience is broken
- May prevent users from properly configuring the system
Proposed Fix
Move the logging module source statement to the beginning of the file, right after the shebang and initial variable declarations, before any function definitions:
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
# Load logging module first
if [[ -f "$SCRIPT_DIR/utils/logging.sh" ]]; then
source "$SCRIPT_DIR/utils/logging.sh"
else
echo "ERROR: Cannot find logging utilities" >&2
exit 1
fi
# Then continue with rest of the script...
Test Command to Reproduce
./src/setup-wizard.sh --dry-run
Environment
- OS: macOS Darwin 24.6.0
- Bash: 5.3.3
Bug Description
The setup-wizard.sh script calls
log_debugfunction on line 26 before the logging module is sourced, causing a "command not found" error.Error Output
./src/setup-wizard.sh: line 26: log_debug: command not foundRoot Cause
The script structure has:
log_debug "Loaded wizard module: $module"inside load_wizard_modules()source "$SCRIPT_DIR/utils/logging.sh"The function is called before the logging module that defines it is sourced.
Impact
Proposed Fix
Move the logging module source statement to the beginning of the file, right after the shebang and initial variable declarations, before any function definitions:
Test Command to Reproduce
Environment