From 9146677bc4ad97bf6e1b4d228ea7e9d7904ffad4 Mon Sep 17 00:00:00 2001 From: BasaiCorp Date: Sun, 16 Mar 2025 09:18:54 +0530 Subject: [PATCH] update v2 of totally_reset_cursor.py --- totally_reset_cursor.py | 79 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 72 insertions(+), 7 deletions(-) diff --git a/totally_reset_cursor.py b/totally_reset_cursor.py index c130fdc..8d27eb1 100644 --- a/totally_reset_cursor.py +++ b/totally_reset_cursor.py @@ -2,20 +2,70 @@ import os import shutil import platform import time +import sys + +def display_banner(): + """Displays a stylized banner for the tool.""" + print("\n" + "="*70) + print(" CURSOR AI RESET TOOL") + print(" Developed by Prathmesh (Discord: prathmesh_pro)") + print("="*70 + "\n") + +def display_features(): + """Displays the features of the Cursor AI Reset Tool.""" + print("\nšŸ“‹ FEATURES:") + print(" • Complete removal of Cursor AI settings and configurations") + print(" • Clears all cached data including AI history and prompts") + print(" • Removes custom extensions and preferences") + print(" • Resets trial information and activation data") + print(" • Helps resolve common issues with Cursor AI editor") + print(" • Compatible with Windows, macOS, and Linux\n") + +def display_disclaimer(): + """Displays a disclaimer for the user.""" + print("\nāš ļø DISCLAIMER:") + print(" This tool will permanently delete all Cursor AI settings,") + print(" extensions, and cached data. This action cannot be undone.") + print(" Your code files will NOT be affected, but all editor") + print(" preferences and AI history will be reset to default.") + print(" You will need to set up Cursor AI again after running this tool.") + print(" Use at your own risk.\n") + +def get_confirmation(): + """Gets confirmation from the user to proceed.""" + while True: + choice = input("āš ļø Do you want to proceed with resetting Cursor AI? (Y/n): ").strip().lower() + if choice == "y" or choice == "": + return True + elif choice == "n": + return False + else: + print("Please enter 'Y' or 'n'") def remove_dir(path): """Removes a directory if it exists and logs the action.""" if os.path.exists(path): - shutil.rmtree(path, ignore_errors=True) - print(f"[āœ”] Deleted: {path}") + try: + shutil.rmtree(path, ignore_errors=True) + print(f"[āœ…] Deleted: {path}") + except Exception as e: + print(f"[āŒ] Error deleting {path}: {str(e)}") else: - print(f"[✘] Not Found: {path}") + print(f"[ā„¹ļø] Not Found: {path}") def reset_cursor(): """Completely resets Cursor AI by removing all settings, caches, and extensions.""" system = platform.system() home = os.path.expanduser("~") + display_banner() + display_features() + display_disclaimer() + + if not get_confirmation(): + print("\nšŸ›‘ Reset cancelled. Exiting without making any changes.\n") + return + print("\nšŸš€ Resetting Cursor AI Editor... Please wait.\n") if system == "Windows": @@ -59,10 +109,25 @@ def reset_cursor(): print("\nšŸ”„ Removing trial data and license information...\n") for path in cursor_trial_paths: - remove_dir(path) + if os.path.isfile(path): + try: + os.remove(path) + print(f"[āœ…] Deleted file: {path}") + except Exception as e: + print(f"[āŒ] Error deleting file {path}: {str(e)}") + else: + remove_dir(path) # In case it's a directory - print("\nāœ… Cursor AI has been fully reset! Restart your system for changes to take effect.\n") + print("\nāœ… Cursor AI has been fully reset! Restart your system for changes to take effect.") + print(" You will need to reinstall and reconfigure Cursor AI.") + print(" If you encounter any issues, contact Prathmesh on Discord: prathmesh_pro\n") if __name__ == "__main__": - reset_cursor() - + try: + reset_cursor() + except KeyboardInterrupt: + print("\n\nšŸ›‘ Process interrupted by user. Exiting...\n") + sys.exit(1) + except Exception as e: + print(f"\nāŒ An unexpected error occurred: {str(e)}\n") + sys.exit(1)