diff --git a/launcher.sh b/launcher.sh index af2cbc6..687bd8a 100755 --- a/launcher.sh +++ b/launcher.sh @@ -780,13 +780,59 @@ main() { echo "═══════════════════════════════════════════════════════════════" return 0 ;; + --clear-cache) + # Initialize directories first + init_directories || { + echo "ERROR: Failed to initialize directories" + return 1 + } + + # Clear all caches + local cache_cleared=0 + + # Production cache + if [ -f "$BASE_DIR/.sysref" ] || [ -f "$BASE_DIR/.sysref.timestamp" ]; then + rm -f "$BASE_DIR/.sysref" "$BASE_DIR/.sysref.timestamp" 2>/dev/null || true + echo "✓ Cleared production cache (.sysref)" + cache_cleared=1 + fi + + # Dev cache + if [ -f "$BASE_DIR/.sysref.beta" ] || [ -f "$BASE_DIR/.sysref.beta.timestamp" ]; then + rm -f "$BASE_DIR/.sysref.beta" "$BASE_DIR/.sysref.beta.timestamp" 2>/dev/null || true + echo "✓ Cleared dev cache (.sysref.beta)" + cache_cleared=1 + fi + + # Temp files + if [ -d "$BASE_DIR/tmp" ]; then + rm -rf "$BASE_DIR/tmp"/* 2>/dev/null || true + echo "✓ Cleared temporary files" + cache_cleared=1 + fi + + if [ $cache_cleared -eq 0 ]; then + echo "ℹ️ No cache files to clear" + else + echo "" + echo "Cache cleared successfully!" + echo "System will auto-detect and rebuild cache on next run." + fi + return 0 + ;; --help|--usage|-h|-?) echo "Usage: launcher.sh [OPTIONS]" echo "" echo "Options:" echo " --detect-only Show system detection results and exit" + echo " --clear-cache Clear all cache and temporary files" echo " --help Show this help message" echo "" + echo "Examples:" + echo " bash launcher.sh --detect-only # Check what was detected" + echo " bash launcher.sh --clear-cache # Clear stale cache data" + echo " bash launcher.sh # Normal interactive mode" + echo "" return 0 ;; esac