chore(cli): complete renderer migration for remaining command modules #1059

Merged
brent.edwards merged 1 commit from chore/m6-renderer-migration into master 2026-03-19 23:30:55 +00:00
Member

Summary

Migrates 8 CLI command modules from module-level Console() objects to the shared _get_console() from renderers.py. This eliminates redundant Console instances and ensures consistent output handling across all CLI commands.

Modules Migrated

Module Change
auto_debug.py Console()_get_console()
context.py Console()_get_console()
automation_profile.py Console()_get_console()
tool.py Console()_get_console()
project.py Both stdout + stderr Console → shared instances
config.py Console()_get_console()
resource.py Console()_get_console()
skill.py Console()_get_console()

Approach

Each module-level console = Console() was replaced with console = _get_console(), keeping the module attribute name console intact for backward compatibility with existing test patches. The from rich.console import Console import was removed from each module.

Modules NOT migrated in this PR (documented for follow-up):

  • plan.py — uses streaming/Live display, too large for this scope
  • session.py, repl.py, lsp.py, server.py — specialized usage patterns

Quality Gates

Session Result
nox -s lint PASS
nox -s typecheck PASS (0 errors)
Unit tests (targeted) All affected scenarios pass

Partial implementation of #813 (step 2 of 4: Console consolidation). Steps 1, 3, 4 remain open on issue #813.

## Summary Migrates 8 CLI command modules from module-level `Console()` objects to the shared `_get_console()` from `renderers.py`. This eliminates redundant Console instances and ensures consistent output handling across all CLI commands. ### Modules Migrated | Module | Change | |--------|--------| | `auto_debug.py` | `Console()` → `_get_console()` | | `context.py` | `Console()` → `_get_console()` | | `automation_profile.py` | `Console()` → `_get_console()` | | `tool.py` | `Console()` → `_get_console()` | | `project.py` | Both stdout + stderr Console → shared instances | | `config.py` | `Console()` → `_get_console()` | | `resource.py` | `Console()` → `_get_console()` | | `skill.py` | `Console()` → `_get_console()` | ### Approach Each module-level `console = Console()` was replaced with `console = _get_console()`, keeping the module attribute name `console` intact for backward compatibility with existing test patches. The `from rich.console import Console` import was removed from each module. Modules NOT migrated in this PR (documented for follow-up): - `plan.py` — uses streaming/Live display, too large for this scope - `session.py`, `repl.py`, `lsp.py`, `server.py` — specialized usage patterns ### Quality Gates | Session | Result | |---------|--------| | `nox -s lint` | PASS | | `nox -s typecheck` | PASS (0 errors) | | Unit tests (targeted) | All affected scenarios pass | Partial implementation of #813 (step 2 of 4: Console consolidation). Steps 1, 3, 4 remain open on issue #813.
brent.edwards added this to the v3.5.0 milestone 2026-03-18 20:47:46 +00:00
freemo approved these changes 2026-03-19 04:54:00 +00:00
Dismissed
freemo left a comment

Code Review — PR #1059 chore(cli): complete renderer migration for remaining command modules

Clean mechanical refactor. The pattern is consistent across all 8 modules — replace from rich.console import Console / Console() with from cleveragents.cli.renderers import _get_console / _get_console(). The module attribute name console is preserved for backward compatibility with existing test patches. Good.

Approved with a note on scope:

  1. Partial completion of issue #813 — This PR addresses step 2 (Console consolidation) of the 4 steps outlined in issue #813. The render utility functions (render_error, render_success, render_warning, render_empty) are defined in the new renderers.py but are not yet called by any of the migrated modules. Steps 1 (replace console.print(Panel/Table) with renderer functions), 3 (error paths use render_error()), and 4 (Behave scenarios for new renderer paths) remain open.

    This is fine as an incremental step — just ensure issue #813 is not closed by this PR's merge since there is remaining work. The issue body should be updated to reflect what's done and what remains.

  2. renderers.py is 215 lines of new code — The lazy singleton pattern with module-level _console: Console | None = None is clean. The _get_console() / _get_err_console() design is sound.

## Code Review — PR #1059 `chore(cli): complete renderer migration for remaining command modules` Clean mechanical refactor. The pattern is consistent across all 8 modules — replace `from rich.console import Console` / `Console()` with `from cleveragents.cli.renderers import _get_console` / `_get_console()`. The module attribute name `console` is preserved for backward compatibility with existing test patches. Good. **Approved** with a note on scope: 1. **Partial completion of issue #813** — This PR addresses step 2 (Console consolidation) of the 4 steps outlined in issue #813. The render utility functions (`render_error`, `render_success`, `render_warning`, `render_empty`) are defined in the new `renderers.py` but are not yet called by any of the migrated modules. Steps 1 (replace `console.print(Panel/Table)` with renderer functions), 3 (error paths use `render_error()`), and 4 (Behave scenarios for new renderer paths) remain open. This is fine as an incremental step — just ensure issue #813 is not closed by this PR's merge since there is remaining work. The issue body should be updated to reflect what's done and what remains. 2. **`renderers.py` is 215 lines of new code** — The lazy singleton pattern with module-level `_console: Console | None = None` is clean. The `_get_console()` / `_get_err_console()` design is sound.
brent.edwards force-pushed chore/m6-renderer-migration from 4795406d12
Some checks failed
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 17s
CI / build (pull_request) Successful in 17s
CI / quality (pull_request) Successful in 30s
CI / typecheck (pull_request) Successful in 44s
CI / security (pull_request) Successful in 1m6s
CI / unit_tests (pull_request) Successful in 3m26s
CI / integration_tests (pull_request) Successful in 3m46s
CI / docker (pull_request) Successful in 57s
CI / e2e_tests (pull_request) Successful in 4m38s
CI / coverage (pull_request) Failing after 6m42s
CI / benchmark-regression (pull_request) Successful in 37m33s
to be71481873
Some checks failed
CI / lint (pull_request) Successful in 19s
CI / typecheck (pull_request) Successful in 43s
CI / security (pull_request) Successful in 53s
CI / quality (pull_request) Successful in 27s
CI / benchmark-publish (pull_request) Has been skipped
CI / build (pull_request) Successful in 11s
CI / unit_tests (pull_request) Successful in 3m36s
CI / integration_tests (pull_request) Successful in 3m53s
CI / docker (pull_request) Successful in 1m5s
CI / coverage (pull_request) Failing after 4m37s
CI / e2e_tests (pull_request) Successful in 6m27s
CI / benchmark-regression (pull_request) Failing after 22m7s
2026-03-19 22:15:29 +00:00
Compare
brent.edwards dismissed freemo's review 2026-03-19 22:15:30 +00:00
Reason:

New commits pushed, approval review dismissed automatically according to repository settings

brent.edwards force-pushed chore/m6-renderer-migration from be71481873
Some checks failed
CI / lint (pull_request) Successful in 19s
CI / typecheck (pull_request) Successful in 43s
CI / security (pull_request) Successful in 53s
CI / quality (pull_request) Successful in 27s
CI / benchmark-publish (pull_request) Has been skipped
CI / build (pull_request) Successful in 11s
CI / unit_tests (pull_request) Successful in 3m36s
CI / integration_tests (pull_request) Successful in 3m53s
CI / docker (pull_request) Successful in 1m5s
CI / coverage (pull_request) Failing after 4m37s
CI / e2e_tests (pull_request) Successful in 6m27s
CI / benchmark-regression (pull_request) Failing after 22m7s
to ef096e976f
Some checks failed
CI / lint (pull_request) Failing after 20s
CI / benchmark-publish (pull_request) Has been skipped
CI / quality (pull_request) Successful in 28s
CI / build (pull_request) Successful in 16s
CI / typecheck (pull_request) Successful in 56s
CI / coverage (pull_request) Has been skipped
CI / benchmark-regression (pull_request) Has been skipped
CI / security (pull_request) Successful in 1m5s
CI / unit_tests (pull_request) Failing after 54s
CI / docker (pull_request) Has been skipped
CI / integration_tests (pull_request) Successful in 4m3s
CI / e2e_tests (pull_request) Successful in 5m20s
2026-03-19 22:45:38 +00:00
Compare
brent.edwards force-pushed chore/m6-renderer-migration from ef096e976f
Some checks failed
CI / lint (pull_request) Failing after 20s
CI / benchmark-publish (pull_request) Has been skipped
CI / quality (pull_request) Successful in 28s
CI / build (pull_request) Successful in 16s
CI / typecheck (pull_request) Successful in 56s
CI / coverage (pull_request) Has been skipped
CI / benchmark-regression (pull_request) Has been skipped
CI / security (pull_request) Successful in 1m5s
CI / unit_tests (pull_request) Failing after 54s
CI / docker (pull_request) Has been skipped
CI / integration_tests (pull_request) Successful in 4m3s
CI / e2e_tests (pull_request) Successful in 5m20s
to 9a699ce6fd
Some checks failed
CI / lint (pull_request) Successful in 23s
CI / quality (pull_request) Successful in 44s
CI / security (pull_request) Successful in 50s
CI / typecheck (pull_request) Successful in 57s
CI / benchmark-publish (pull_request) Has been skipped
CI / build (pull_request) Successful in 21s
CI / unit_tests (pull_request) Successful in 3m52s
CI / integration_tests (pull_request) Successful in 3m55s
CI / docker (pull_request) Successful in 1m13s
CI / e2e_tests (pull_request) Successful in 6m26s
CI / coverage (pull_request) Successful in 8m12s
CI / benchmark-regression (pull_request) Failing after 20m48s
2026-03-19 23:03:55 +00:00
Compare
brent.edwards deleted branch chore/m6-renderer-migration 2026-03-19 23:30:55 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
cleveragents/cleveragents-core!1059
No description provided.