From 16c1610d03ca672312ddaa41e3d9beba1a6d1c81 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Mon, 5 Jan 2026 22:36:02 +0000 Subject: [PATCH] feat(cli): reduce log fatigue with in-place progress updates Replaces repetitive batch success logs with an ephemeral progress indicator when running in an interactive terminal. This keeps the log history clean for important signals like start, finish, and errors. --- .jules/palette.md | 6 ++++-- main.py | 21 +++++++++++++++++---- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/.jules/palette.md b/.jules/palette.md index fbedb30..44ce8e3 100644 --- a/.jules/palette.md +++ b/.jules/palette.md @@ -1,5 +1,3 @@ -# Palette's Journal - ## 2024-10-18 - CLI UX Adaptation **Learning:** When a "frontend" agent encounters a CLI-only repo, the "interface" becomes the terminal output. Accessibility principles (contrast, readability, clear feedback) still apply but translate to ANSI colors, clear spacing, and descriptive log messages instead of ARIA labels. **Action:** Adapting web-centric UX patterns (like "toast notifications") to CLI equivalents (colored log lines or summary tables). @@ -14,3 +12,7 @@ ## 2024-03-22 - CLI Interactive Fallbacks **Learning:** CLI tools often fail hard when config is missing, but interactive contexts allow for graceful recovery. Users appreciate being asked for missing info instead of just receiving an error. **Action:** When `sys.stdin.isatty()` is true, prompt for missing configuration instead of exiting with an error code. + +## 2025-06-15 - Reduce Log Fatigue +**Learning:** High-volume success logs (like batch processing) can drown out important errors. +**Action:** Use ephemeral in-place updates (via `\r`) for repetitive "working" states to keep the log history clean for true signals (start, finish, error). diff --git a/main.py b/main.py index e6aabc5..f5f5f6d 100644 --- a/main.py +++ b/main.py @@ -504,10 +504,18 @@ def push_rules( try: _api_post_form(client, f"{API_BASE}/{profile_id}/rules", data=data) - log.info( - "Folder %s – batch %d: added %d rules", - sanitize_for_log(folder_name), i, len(batch) - ) + + if USE_COLORS: + sys.stderr.write( + f"\r{Colors.CYAN}🚀 Folder {sanitize_for_log(folder_name)}: Pushing batch {i}/{total_batches}...{Colors.ENDC}" + ) + sys.stderr.flush() + else: + log.info( + "Folder %s – batch %d: added %d rules", + sanitize_for_log(folder_name), i, len(batch) + ) + successful_batches += 1 if existing_rules_lock: with existing_rules_lock: @@ -519,6 +527,11 @@ def push_rules( if hasattr(e, 'response') and e.response is not None: log.debug(f"Response content: {e.response.text}") + if USE_COLORS: + # Clear the progress line + sys.stderr.write("\r" + " " * 80 + "\r") + sys.stderr.flush() + if successful_batches == total_batches: log.info("Folder %s – finished (%d new rules added)", sanitize_for_log(folder_name), len(filtered_hostnames)) return True