refactor(cli_display): replace boxed panels with a minimal log

- Introduce ok()/warn()/err()/info() as the four output primitives,
  replacing all rich.Panel/rich.Table usage.
- Merge the old 'Scanned N files' + 'Packed N files' steps into one
  print_scan_and_pack() line.
- Drop the contextzip vX.X.X / project-path banner from every command.
- Full file listings and exclusion breakdowns move to the report file
  (report.py) and behind -v/--verbose; the terminal shows one line
  per step.
- Add print_auto_cleanup() and print_redaction_summary() for the two
  newer background steps (workspace cleanup, secret redaction).
This commit is contained in:
akadeepesh
2026-08-30 23:24:06 +05:30
parent db597e04c2
commit afd0331a4e
+25
View File
@@ -370,11 +370,36 @@ def print_apply_result(result, *, con: Console = console) -> None:
ok("Archived zip to", str(result.applied_zip_path), con=con)
# ---------------------------------------------------------------------------
# Cleanup
# ---------------------------------------------------------------------------
def print_auto_cleanup(result, *, con: Console = console) -> None:
"""
One quiet, dim line after an automatic cleanup pass — only shown when
something was actually removed, so a workspace with nothing stale
produces zero extra output. Failures (rare — a locked file, etc.) get
a short warning; they never interrupt or roll back the command that
was actually run.
"""
if result.removed:
console_line = f"[dim]🧹 Auto-cleaned {len(result.removed)} old file(s) from .contextzip/ · freed {human_size(result.freed_bytes)}[/]"
con.print(console_line)
if result.failed:
n = len(result.failed)
warn(f"{n} old file{'s' if n != 1 else ''} in .contextzip/ couldn't be auto-cleaned", con=con)
for path, reason in result.failed[:5]:
con.print(f" [yellow]![/] {path} [dim]{reason}[/]")
# ---------------------------------------------------------------------------
# Utility
# ---------------------------------------------------------------------------
def human_size(n: int) -> str:
"""Format *n* bytes as a human-readable string (B / KB / MB / GB / TB)."""
for unit in ("B", "KB", "MB", "GB"):