From 708a65031a9dec83fa22d2a20d5966246f7a9199 Mon Sep 17 00:00:00 2001 From: Raincloud Date: Wed, 21 Jan 2026 01:23:19 -0700 Subject: [PATCH] user prompt to del files --- ...ck-files-py-small-output-error-handling.md | 40 +++++++++++++++++++ check_files.py | 32 +++++++++++++++ 2 files changed, 72 insertions(+) diff --git a/.specstory/history/2026-01-21_08-11Z-check-files-py-small-output-error-handling.md b/.specstory/history/2026-01-21_08-11Z-check-files-py-small-output-error-handling.md index 7b738b5..9b666b4 100644 --- a/.specstory/history/2026-01-21_08-11Z-check-files-py-small-output-error-handling.md +++ b/.specstory/history/2026-01-21_08-11Z-check-files-py-small-output-error-handling.md @@ -133,3 +133,43 @@ The `format_file_size` function was also removed since it's no longer needed. Th --- +_**User**_ + +though now I think of it, add a user prompt to delete all detected problem files./ + +--- + +_**Agent (model default, mode Agent)**_ + + +Adding a user prompt to delete all detected problem files. Reviewing the current file structure: + + +--- + + +
Tool use: **read_file_v2** • Read file: R:\Videos\mux\check_files.py + +
+
+ +--- + + +Adding a user prompt to delete all detected problem files after the summary: + + +--- + + + +
Tool use: **edit_file_v2** • Edit file: R:\Videos\mux\check_files.py + +Status: **loading** + +
+ +
+ +--- + diff --git a/check_files.py b/check_files.py index 5055cff..89639ee 100644 --- a/check_files.py +++ b/check_files.py @@ -264,6 +264,38 @@ def main(): for file, issue in issues_found: print(f"\n{file}:") print(f"{Colors.RED} {issue}{Colors.ENDC}") + + # Prompt to delete problem files + print(f"\n{Colors.YELLOW}Files with issues detected.{Colors.ENDC}") + response = input("Delete all problematic output files? (yes/no): ").strip().lower() + + if response in ['yes', 'y']: + deleted_count = 0 + failed_count = 0 + + for file, issue in issues_found: + # Skip "Missing from output" - nothing to delete + if issue == "Missing from output": + continue + + # Delete output file for all other issues + output_path = os.path.join(output_dir, file) + if os.path.exists(output_path): + try: + os.remove(output_path) + deleted_count += 1 + logging.info(f"Deleted problematic output file: {output_path} (Issue: {issue})") + print(f"{Colors.GREEN}Deleted: {file}{Colors.ENDC}") + except Exception as e: + failed_count += 1 + logging.error(f"Failed to delete {output_path}: {str(e)}") + print(f"{Colors.RED}Failed to delete {file}: {str(e)}{Colors.ENDC}") + + print(f"\n{Colors.GREEN}Deleted {deleted_count} file(s){Colors.ENDC}") + if failed_count > 0: + print(f"{Colors.RED}Failed to delete {failed_count} file(s){Colors.ENDC}") + else: + print("Deletion cancelled.") else: print(f"{Colors.GREEN}No issues found in any files!{Colors.ENDC}") print("\nIssue counts:")