diff --git a/README.md b/README.md index ccb9f3e..3fa2fb1 100644 --- a/README.md +++ b/README.md @@ -40,3 +40,21 @@ It is a small script to remove junk files from our windows operating system such 6 - Configure any additional options you want for the task, such as conditions and advanced settings. 7 - Click "OK" to save the scheduled task. + +## Claude wrapper fix (Windows) + +If `prompt-engineer` exits with code `0` but prints no response, apply this wrapper fix: + +1 - Use a Windows launcher (`prompt-engineer.cmd`) that calls Node: +`node "%~dp0prompt-engineer.js" %*` + +2 - In `prompt-engineer.js`, resolve the agent file path with `path.resolve(...)` instead of a hardcoded escaped string path. + +3 - Invoke Claude with argument arrays and a direct Windows binary path (for example `...\\@anthropic-ai\\claude-code\\bin\\claude.exe`) to avoid shell escaping and command-length issues. + +4 - Forward captured stdout/stderr back to the terminal so the agent response is visible. + +Quick verification: + +- `prompt-engineer "Return exactly: WRAPPER_OK"` +- Expected stdout: `WRAPPER_OK` diff --git a/cleanerOS.bat b/cleanerOS.bat index 8d2a884..a7f3cc2 100644 --- a/cleanerOS.bat +++ b/cleanerOS.bat @@ -1,7 +1,5 @@ @echo off -cd C:\Users\YourUser\Documents\CleanerOS - python cleanerOS.py pause diff --git a/cleanerOS.py b/cleanerOS.py index 3202d94..fbabc3e 100644 --- a/cleanerOS.py +++ b/cleanerOS.py @@ -52,7 +52,7 @@ def progress_bar(total, progress): directoriesToOptimize = [ r"C:\Windows\Logs", r"C:\Windows\Temp", - r"C:\Users\YourUser\AppData\Local\Temp" + r"C:\Users\Diego Chavez\AppData\Local\Temp" ] # Ejecución diff --git a/cleanup_temp.py b/cleanup_temp.py new file mode 100644 index 0000000..8c3eeed --- /dev/null +++ b/cleanup_temp.py @@ -0,0 +1,43 @@ +import os +import sys +from pathlib import Path + +def cleanup_directory(directory): + """Elimina archivos temporales de un directorio.""" + deleted_count = 0 + error_count = 0 + total_size = 0 + + # Verificar si el directorio existe + if not os.path.exists(directory): + print(f"ERROR|{directory}|Directory not found|0|0") + return + + # Recorrer todos los archivos recursivamente + for root, dirs, files in os.walk(directory): + for filename in files: + filepath = os.path.join(root, filename) + try: + # Obtener tamaño del archivo + file_size = os.path.getsize(filepath) + total_size += file_size + + # Eliminar archivo + os.remove(filepath) + deleted_count += 1 + + except (PermissionError, OSError, FileNotFoundError) as e: + error_count += 1 + + # Convertir tamaño a MB + size_mb = round(total_size / (1024 * 1024), 2) + + print(f"SUCCESS|{directory}|{deleted_count}|{error_count}|{size_mb}") + +if __name__ == "__main__": + if len(sys.argv) != 2: + print("ERROR|No directory provided|Usage: python cleanup.py |0|0") + sys.exit(1) + + directory = sys.argv[1] + cleanup_directory(directory)