Skip to content

🎨 Palette: Add visual progress bar for CLI operations#125

Merged
abhimehro merged 1 commit intomainfrom
palette/visual-progress-bar-12317048477751304272
Jan 27, 2026
Merged

🎨 Palette: Add visual progress bar for CLI operations#125
abhimehro merged 1 commit intomainfrom
palette/visual-progress-bar-12317048477751304272

Conversation

@google-labs-jules
Copy link

  • 💡 What: Replaced text-based progress counters with a visual progress bar ([██░░]).
  • 🎯 Why: Improves user feedback during long-running operations (cache warming, rule pushing) and ensures cleaner terminal output.
  • 📸 Before: 🚀 Folder X: Pushing batch 1/10...
  • 📸 After: 🚀 Folder X: [██░░░░░░░░] 10% (1/10)
  • ♿ Accessibility: Improved visual contrast and feedback.

PR created automatically by Jules for task 12317048477751304272 started by @abhimehro

* 💡 What: Replaced text-based progress counters with a visual progress bar (`[██░░]`).
* 🎯 Why: Improves user feedback during long-running operations (cache warming, rule pushing) and ensures cleaner terminal output.
* 📸 Before: `🚀 Folder X: Pushing batch 1/10...`
* 📸 After: `🚀 Folder X: [██░░░░░░░░] 10% (1/10)`
* ♿ Accessibility: Improved visual contrast and feedback.
@google-labs-jules
Copy link
Author

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@trunk-io
Copy link

trunk-io bot commented Jan 22, 2026

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

combined = "".join(writes)

# \033[K clear line
assert "\033[K" in combined

Check notice

Code scanning / Bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
# \033[K clear line
assert "\033[K" in combined
# Prefix and Label
assert "T Test" in combined

Check notice

Code scanning / Bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
# Prefix and Label
assert "T Test" in combined
# Progress bar and percentage
assert "50%" in combined

Check notice

Code scanning / Bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
assert "T Test" in combined
# Progress bar and percentage
assert "50%" in combined
assert "5/10" in combined

Check notice

Code scanning / Bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
assert "50%" in combined
assert "5/10" in combined
# Color codes
assert m.Colors.CYAN in combined

Check notice

Code scanning / Bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
assert "5/10" in combined
# Color codes
assert m.Colors.CYAN in combined
assert m.Colors.ENDC in combined

Check notice

Code scanning / Bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
combined = "".join(writes)

# \033[K clear line
assert "\033[K" in combined

Check notice

Code scanning / Bandit (reported by Codacy)

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
# \033[K clear line
assert "\033[K" in combined
# Prefix and Label
assert "T Test" in combined

Check notice

Code scanning / Bandit (reported by Codacy)

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
# Prefix and Label
assert "T Test" in combined
# Progress bar and percentage
assert "50%" in combined

Check notice

Code scanning / Bandit (reported by Codacy)

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
assert "T Test" in combined
# Progress bar and percentage
assert "50%" in combined
assert "5/10" in combined

Check notice

Code scanning / Bandit (reported by Codacy)

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
assert "50%" in combined
assert "5/10" in combined
# Color codes
assert m.Colors.CYAN in combined

Check notice

Code scanning / Bandit (reported by Codacy)

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
assert "5/10" in combined
# Color codes
assert m.Colors.CYAN in combined
assert m.Colors.ENDC in combined

Check notice

Code scanning / Bandit (reported by Codacy)

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
sys.stderr.flush()


def _clean_env_kv(value: Optional[str], key: str) -> Optional[str]:

Check warning

Code scanning / Pylint (reported by Codacy)

Black listed name "bar" Warning

Black listed name "bar"
@@ -481,15 +497,11 @@ def warm_up_cache(urls: Sequence[str]) -> None:
with concurrent.futures.ThreadPoolExecutor() as executor:

Check warning

Code scanning / Pylint (reported by Codacy)

Line too long (115/100) Warning

Line too long (115/100)
sys.stderr.write(f"\r\033[K{Colors.GREEN}✅ Folder {sanitize_for_log(folder_name)}: Finished ({len(filtered_hostnames)} rules){Colors.ENDC}\n")
sys.stderr.flush()
else:
log.info("Folder %s – finished (%d new rules added)", sanitize_for_log(folder_name), len(filtered_hostnames))

Check warning

Code scanning / Pylint (reported by Codacy)

Line too long (109/100) Warning

Line too long (109/100)
main.py Outdated

Check warning

Code scanning / Pylint (reported by Codacy)

Line too long (154/100) Warning

Line too long (154/100)
assert "Network failure" in str(mock_log.error.call_args)

# Case 8: render_progress_bar renders correctly
def test_render_progress_bar(monkeypatch):

Check warning

Code scanning / Pylint (reported by Codacy)

Missing function docstring Warning test

Missing function docstring

# Case 8: render_progress_bar renders correctly
def test_render_progress_bar(monkeypatch):
m = reload_main_with_env(monkeypatch, no_color=None, isatty=True)

Check warning

Code scanning / Pylint (reported by Codacy)

Variable name "m" doesn't conform to snake_case naming style Warning test

Variable name "m" doesn't conform to snake_case naming style
sys.stderr.flush()


def _clean_env_kv(value: Optional[str], key: str) -> Optional[str]:

Check warning

Code scanning / Pylintpython3 (reported by Codacy)

Black listed name "bar" Warning

Black listed name "bar"
@@ -481,15 +497,11 @@ def warm_up_cache(urls: Sequence[str]) -> None:
with concurrent.futures.ThreadPoolExecutor() as executor:

Check warning

Code scanning / Pylintpython3 (reported by Codacy)

Line too long (115/100) Warning

Line too long (115/100)
sys.stderr.write(f"\r\033[K{Colors.GREEN}✅ Folder {sanitize_for_log(folder_name)}: Finished ({len(filtered_hostnames)} rules){Colors.ENDC}\n")
sys.stderr.flush()
else:
log.info("Folder %s – finished (%d new rules added)", sanitize_for_log(folder_name), len(filtered_hostnames))

Check warning

Code scanning / Pylintpython3 (reported by Codacy)

Line too long (109/100) Warning

Line too long (109/100)
main.py Outdated

Check warning

Code scanning / Pylintpython3 (reported by Codacy)

Line too long (154/100) Warning

Line too long (154/100)
m.render_progress_bar(5, 10, "Test", prefix="T")

# Check output
writes = [args[0] for args, _ in mock_stderr.write.call_args_list]

Check warning

Code scanning / Pylintpython3 (reported by Codacy)

Missing function or method docstring Warning test

Missing function or method docstring
@abhimehro abhimehro marked this pull request as ready for review January 27, 2026 07:23
Copilot AI review requested due to automatic review settings January 27, 2026 07:23
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR centralizes CLI progress reporting by introducing a reusable visual progress bar helper and adopting it in long-running operations to produce cleaner terminal output.

Changes:

  • Added render_progress_bar() helper to render a consistent progress bar to stderr in TTY/color mode.
  • Updated cache warm-up and rule-push batch progress output to use the new helper and clear-line handling (\033[K).
  • Added a unit test validating progress bar rendering output and ANSI color wrapping.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
main.py Introduces render_progress_bar() and replaces ad-hoc progress counter writes with the centralized progress bar + clear-line handling.
test_main.py Adds a unit test asserting the progress bar emits expected text, percentages, and ANSI codes.
.Jules/palette.md Documents the “centralized CLI progress” learning and action item aligned with this refactor.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@abhimehro abhimehro merged commit a273f24 into main Jan 27, 2026
24 checks passed
@abhimehro abhimehro deleted the palette/visual-progress-bar-12317048477751304272 branch January 27, 2026 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants