From c62aa7af377e74d617ba09fe97b9df4718c6f1c4 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Mon, 11 May 2026 07:38:07 -0500 Subject: chore(ai): sync template updates from claude-templates Pull in the latest maildir-flag-manager.py and cross-agent-comms doc updates from the claude-templates source. --- .ai/scripts/maildir-flag-manager.py | 38 +++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) (limited to '.ai/scripts/maildir-flag-manager.py') diff --git a/.ai/scripts/maildir-flag-manager.py b/.ai/scripts/maildir-flag-manager.py index 9c4a59c..97ed1d8 100755 --- a/.ai/scripts/maildir-flag-manager.py +++ b/.ai/scripts/maildir-flag-manager.py @@ -119,28 +119,34 @@ def process_maildir(maildir_path, flag, dry_run=False): print(f" Skipping {maildir_path} (not found)", file=sys.stderr) return 0, 0, 0 - changed = 0 - skipped = 0 - errors = 0 - + # Snapshot the file list before any rename. Adding S to a new/ file + # moves it to cur/ via rename_with_flag; without a snapshot, the + # moved file gets re-encountered during the cur/ scan and inflates + # the skipped count. + file_paths = [] for subdir in ('new', 'cur'): subdir_path = os.path.join(maildir_path, subdir) if not os.path.isdir(subdir_path): continue - for filename in os.listdir(subdir_path): file_path = os.path.join(subdir_path, filename) - if not os.path.isfile(file_path): - continue - - try: - if rename_with_flag(file_path, flag, dry_run): - changed += 1 - else: - skipped += 1 - except Exception as e: - print(f" Error on {filename}: {e}", file=sys.stderr) - errors += 1 + if os.path.isfile(file_path): + file_paths.append(file_path) + + changed = 0 + skipped = 0 + errors = 0 + + for file_path in file_paths: + try: + if rename_with_flag(file_path, flag, dry_run): + changed += 1 + else: + skipped += 1 + except Exception as e: + print(f" Error on {os.path.basename(file_path)}: {e}", + file=sys.stderr) + errors += 1 return changed, skipped, errors -- cgit v1.2.3