-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Problem
Scripts use environment variables and assume files exist without validation, leading to cryptic failures or undefined behavior.
Specific Issues
- No check that
.envexists and is properly sourced before using variables bootstrap.shdoesn't verify thatlocal/config.jsonexistsssh/install.shuses$USER_EMAILwithout checking if it's setmacos/install.shuses$DEVICE_NAMEwithout validationmacos/install.sh:156,159usesnodeandenvsubstwithout checking if they're installed
Impact
- Confusing error messages when required setup steps are skipped
- Variables evaluate to empty strings, causing weird behavior
- Hard to diagnose what went wrong
- Poor user experience for first-time setup
Recommended Solution
1. Create a validation function in bootstrap.sh
validate_environment() {
local errors=0
if [ ! -f ".env" ]; then
fail ".env file not found. Copy .env.template and fill in your details."
errors=$((errors + 1))
fi
if [ ! -f "local/config.json" ]; then
fail "local/config.json not found. Copy local/config.json.example and configure."
errors=$((errors + 1))
fi
source .env
if [ -z "$USER_EMAIL" ]; then
fail "USER_EMAIL not set in .env"
errors=$((errors + 1))
fi
if [ -z "$DEVICE_NAME" ]; then
fail "DEVICE_NAME not set in .env"
errors=$((errors + 1))
fi
if [ $errors -gt 0 ]; then
exit 1
fi
}2. Add tool checks before use
# Before using node
if ! command -v node &> /dev/null; then
fail "node is required but not installed"
fi3. Run validation early in bootstrap
Call validate_environment before any other operations.
Success Criteria
- Clear error messages when required files are missing
- Early failure with helpful guidance
- Validation before any system changes
- All environment variables validated before use
Priority
MEDIUM - Significantly improves user experience
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request