Version: 3.0.0
Target Platform: macOS 10.14+ (Mojave and newer)
Primary Use Case: Educational environments with shared Macs
# Main Interface (RECOMMENDED)
sudo ./schoolcode.sh # Install everything
sudo ./schoolcode.sh --install # Same as above (explicit)
sudo ./schoolcode.sh --uninstall # Remove SchoolCode (no prompts)
sudo ./schoolcode.sh --interactive # Compatibility alias for the main install flow
sudo ./schoolcode.sh --status # Check system health
sudo ./schoolcode.sh --help # Show help
# Advanced CLI (Legacy)
sudo ./scripts/schoolcode-cli.sh install-auto # Legacy alias for install
sudo ./scripts/schoolcode-cli.sh install-interactive # Legacy alias for install
sudo ./scripts/schoolcode-cli.sh status detailed # Detailed status
sudo ./scripts/schoolcode-cli.sh repair # Fix system issues
sudo ./scripts/schoolcode-cli.sh uninstall # Remove SchoolCode
sudo ./scripts/schoolcode-cli.sh logs error # View error logsschoolcode.sh- Main entry point (NEW - use this first)scripts/schoolcode-cli.sh- CLI interface (legacy)scripts/install.sh- Core installation logicsystem_repair.sh- System repair functionalityold_mac_compatibility.sh- Compatibility checkingscripts/utils/logging.sh- Logging systemscripts/utils/ui.sh- Shared Gum-backed terminal UI layerscripts/utils/gum.sh- Vendored Gum runtime resolvervendor/gum/- Pinned Gum binaries for macOSscripts/setup/- Guest account management
SchoolCode/
├── schoolcode.sh # Main entry point (NEW)
├── scripts/
│ ├── schoolcode-cli.sh # CLI interface (legacy)
│ ├── install.sh # Core installation
│ ├── uninstall.sh # Uninstall system
│ ├── utils/ # Utility scripts
│ │ ├── logging.sh # Centralized logging
│ │ ├── config.sh # Configuration management
│ │ ├── ui.sh # Shared CLI presentation layer
│ │ ├── gum.sh # Vendored Gum resolver
│ │ ├── monitoring.sh # System health monitoring
│ │ ├── homebrew_repair.sh # Homebrew-specific repairs
│ │ ├── install_official_python.sh # Python installation
│ │ └── python_utils.sh # Python management
│ └── setup/ # Guest account setup
│ ├── guest_login_setup.sh
│ ├── guest_tools_setup.sh
│ └── setup_guest_shell_init.sh
├── system_repair.sh # System repair utility
├── old_mac_compatibility.sh # Compatibility checker
├── vendor/gum/ # Pinned Gum binaries
└── tests/ # Test suite
# Start with main interface
./schoolcode.sh --help
# Check current status
sudo ./schoolcode.sh --status
# Understand installation process
sudo ./schoolcode.sh --interactive# Test changes with dry-run (legacy alias still supported)
sudo ./scripts/schoolcode-cli.sh --dry-run install-auto
# Test in Guest account
sudo ./schoolcode.sh --install
# Then switch to Guest account and test
# Check system health after changes
sudo ./schoolcode.sh --status# Check system health
sudo ./schoolcode.sh --status
# View error logs
sudo ./scripts/schoolcode-cli.sh logs error
# Run system repair
sudo ./scripts/schoolcode-cli.sh repair
# Check compatibility
./old_mac_compatibility.sh- Add to
scripts/install.shcore installation logic - Update CLI commands in
scripts/schoolcode-cli.sh - Test both installation modes
- Update documentation
- Add repair logic to
system_repair.sh - Test repair function independently
- Integrate into installation flow
- Add CLI command for manual repair
- Update troubleshooting documentation
- Add command function to
scripts/schoolcode-cli.sh - Add to help text and examples
- Add to main command dispatcher
- Test command functionality
- Update README.md with new command
- Guest Account Isolation: All changes must be temporary and isolated to Guest accounts
- No System Modification: Never modify system-level configurations
- Temporary Changes: All modifications must be reversible
- Cleanup on Logout: Ensure all changes are removed when Guest account logs out
- Prefer macOS account isolation and normal filesystem permissions over custom blocking wrappers unless there is a real privilege gap to close.
# Secure file creation
touch /tmp/schoolcode_secure_file
chmod 600 /tmp/schoolcode_secure_file
chown guest:staff /tmp/schoolcode_secure_file
# Validate user context
if [ "$(whoami)" != "guest" ]; then
echo "Error: Must run as guest user"
exit 1
fi# Run shell script tests
./tests/test_installation.sh
# Test installation modes
sudo ./schoolcode.sh --install
sudo ./schoolcode.sh --interactive
# Test uninstall
sudo ./schoolcode.sh --uninstall- Functional Tests: Installation modes, system repair, guest setup
- Security Tests: Guest account isolation, permission management
- Compatibility Tests: macOS version compatibility, architecture support
- Error Handling Tests: Network failures, permission issues, recovery
- schoolcode_tools: ✅ HEALTHY /
⚠️ DEGRADED / ❌ UNHEALTHY - guest_setup: ✅ HEALTHY /
⚠️ DEGRADED / ❌ UNHEALTHY - launchagent: ✅ HEALTHY /
⚠️ DEGRADED / ❌ UNHEALTHY - homebrew: ✅ HEALTHY /
⚠️ DEGRADED / ❌ UNHEALTHY - permissions: ✅ HEALTHY /
⚠️ DEGRADED / ❌ UNHEALTHY - disk_space: ✅ HEALTHY /
⚠️ DEGRADED / ❌ UNHEALTHY
# Basic health check
sudo ./schoolcode.sh --status
# Detailed health check
sudo ./scripts/schoolcode-cli.sh status detailed
# JSON output for parsing
sudo ./scripts/schoolcode-cli.sh status json
# Monitor continuously
sudo ./scripts/schoolcode-cli.sh monitor 30# Check compatibility
./old_mac_compatibility.sh
# Run system repair
sudo ./scripts/schoolcode-cli.sh repair
# Check logs
sudo ./scripts/schoolcode-cli.sh logs error# Check guest setup
sudo ./scripts/schoolcode-cli.sh guest status
# Test guest environment
sudo ./scripts/schoolcode-cli.sh guest test
# Cleanup guest tools
sudo ./scripts/schoolcode-cli.sh guest cleanup# Repair Homebrew
sudo ./scripts/utils/homebrew_repair.sh
# Fix permissions
sudo ./scripts/utils/fix_homebrew_permissions.sh
# Check Homebrew status
brew doctor- Main logs:
/var/log/schoolcode/schoolcode.log - Error logs:
/var/log/schoolcode/schoolcode-error.log - Guest logs:
/var/log/schoolcode/guest-setup.log - Installation logs:
/var/log/schoolcode/install_YYYYMMDD_HHMMSS.log
- Use
set -euo pipefailfor strict error handling - Use
BASH_SOURCE[0]instead of$0for script path detection - Implement proper return codes and error propagation
- Use centralized logging system (
scripts/utils/logging.sh)
# Proper error handling pattern
if ! command -v tool &>/dev/null; then
log_error "Tool not found: tool"
return 1
fi
# With cleanup
cleanup() {
rm -f /tmp/temp_file
log_info "Cleanup completed"
}
trap cleanup EXIT# Robust path detection
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
# Dynamic path construction
if [[ -d "/opt/homebrew/bin" ]]; then
export PATH="/opt/homebrew/bin:$PATH"
fi- Check Status:
sudo ./schoolcode.sh --status - View Logs:
sudo ./scripts/schoolcode-cli.sh logs error - Run Repair:
sudo ./scripts/schoolcode-cli.sh repair - Test Installation:
sudo ./schoolcode.sh --install
- Understand Current: Read relevant scripts
- Test Changes: Use dry-run and Guest account testing
- Update Documentation: Update README.md and agents.md
- Commit Changes: Use descriptive commit messages
- Check Health:
sudo ./schoolcode.sh --status - View Logs:
sudo ./scripts/schoolcode-cli.sh logs - Run Compatibility:
./old_mac_compatibility.sh - Test Components: Individual script testing
- SECURITY.md: Detailed security architecture
- docs/INSTALLATION.md: Comprehensive installation guide
- tests/: Test suite for validation
- scripts/utils/: Utility functions and helpers
- Always test in Guest account after making changes
- Never modify system files (
/etc,/usr,/System,/Library) - Use centralized logging for all operations
- Implement proper cleanup for temporary files
- Validate permissions before file operations
- Test both installation modes (automatic and interactive)
- Check system health after modifications
- Use
--forceflag for non-interactive operations when needed
Remember: SchoolCode is designed for educational environments. Always prioritize security, isolation, and ease of use for students.