Codebase intelligence for AI and humans: code health scores, auto-generated docs, git analytics, dead code detection, and architectural decisions via MCP.
Python aicode-complexitycode-healthcode-intelligencecode-qualitydead-codedeveloper-toolsdocumentationgit-analyticsmcpopen-sourcepythonrefactoringstatic-analysistechnical-debt
refactor(cli): make the init screens one system, and delete the paint that meant nothing (#1571)
Swati Ahuja58e985529ad5
diff --git a/packages/cli/src/repowise/cli/commands/init_cmd/_interactive.py b/packages/cli/src/repowise/cli/commands/init_cmd/_interactive.pyindex f4b19560c..40180230d 100644--- a/packages/cli/src/repowise/cli/commands/init_cmd/_interactive.py+++ b/packages/cli/src/repowise/cli/commands/init_cmd/_interactive.py@@ -8,6 +8,8 @@ from typing import Anyimport click+from repowise.cli.ui.brand import OK, WARN+def offer_distill_rewrite_hook(console_obj: Any,@@ -108,9 +110,9 @@ def offer_distill_rewrite_hook(if flag:path = adapter.install_rewrite_hook()if path:- console_obj.print(f" [green]✓[/green] Rewrite hook installed ({path})")+ console_obj.print(f" [{OK}]✓[/] Rewrite hook installed ({path})")else:- console_obj.print(" [yellow]Rewrite hook install failed.[/yellow]")+ console_obj.print(f" [{WARN}]Rewrite hook install failed.[/]")else:console_obj.print(" [dim]Skipped. Run 'repowise hook rewrite install' later to set up.[/dim]"@@ -156,7 +158,7 @@ def _record_distill_verdict(save_hook_surface_enabled(repo_path, surface, enabled=enabled)except Exception as exc: # init must not crash on a config writeconsole_obj.print(- f" [yellow]Could not record hook verdict for {repo_path.name}: {exc}[/yellow]"+ f" [{WARN}]Could not record hook verdict for {repo_path.name}: {exc}[/]")@@ -219,7 +221,7 @@ def _offer_hook_install_prompts(rp, label = candidates[0]if click.confirm(f" Install post-commit hook for {label}?", default=True):result = install(rp)- console_obj.print(f" [green]✓[/green] {label}: {result}")+ console_obj.print(f" [{OK}]✓[/] {label}: {result}")else:console_obj.print(" [dim]Skipped. Run 'repowise hook install' later to set up.[/dim]")else:@@ -248,7 +250,7 @@ def _offer_hook_install_prompts(if 0 <= idx < len(candidates):rp, label = candidates[idx]result = install(rp)- console_obj.print(f" [green]✓[/green] {label}: {result}")+ console_obj.print(f" [{OK}]✓[/] {label}: {result}")installed += 1if installed == 0:diff --git a/packages/cli/src/repowise/cli/commands/init_cmd/command.py b/packages/cli/src/repowise/cli/commands/init_cmd/command.pyindex ecf5902a4..57c2523dc 100644--- a/packages/cli/src/repowise/cli/commands/init_cmd/command.py+++ b/packages/cli/src/repowise/cli/commands/init_cmd/command.py@@ -53,7 +53,10 @@ from repowise.cli.state_persistence import build_kg_state, save_knowledge_graph_from repowise.cli.ui import (BRAND,BRAND_STYLE,+ OK,OWL_SPINNER,+ VALUE,+ WARN,MaybeCountColumn,RichProgressCallback,interactive_advanced_config,@@ -335,7 +338,7 @@ def _run_generation_phase(# Warn when a local provider runs with default concurrencyif provider.provider_name in ("ollama", "codex_cli", "opencode") and concurrency > 4:console.print(- f" [yellow]Warning:[/yellow] {provider.provider_name} is a local provider "+ f" [{WARN}]Warning:[/] {provider.provider_name} is a local provider "f"running with concurrency={concurrency}. "f"If you see timeout errors, try [bold]--concurrency 1[/bold].")@@ -367,7 +370,7 @@ def _run_generation_phase(concept_n = concept_page_count(plans)console.print(f" Writing [bold]{concept_n:,}[/bold] subsystem pages with "- f"[cyan]{provider.model_name}[/cyan]. Estimated [bold]{format_cost(est)}[/bold]."+ f"[{VALUE}]{provider.model_name}[/]. Estimated [bold]{format_cost(est)}[/bold].")structural = structural_page_summary(plans)if structural:@@ -818,7 +821,7 @@ def init_command()if seeded:console.print(- "[green]Worktree index seeded successfully. Delegating to update...[/green]"+ f"[{OK}]Worktree index seeded successfully. Delegating to update...[/]")from repowise.cli.commands.update_cmd.command import run_update@@ -945,7 +948,7 @@ def init_command(except EOFError:is_interactive = Falseconsole.print(- "\n[yellow]No answer available on stdin[/yellow] "+ f"\n[{WARN}]No answer available on stdin[/] ""[dim]- continuing with defaults. Pass --yes to skip the ""questions, or --prose / --no-prose to choose directly.[/dim]")@@ -1105,7 +1108,7 @@ def init_command(_prior_docs_mode = resolve_docs_mode(_prior_state)if index_only and _prior_docs_mode == "llm" and not (force or yes):console.print(- "\n[yellow]This repo already has a model-written wiki.[/yellow] "+ f"\n[{WARN}]This repo already has a model-written wiki.[/] ""Indexing without a model\nrewrites every page from templates; the ""written versions stay in page history.")@@ -1154,7 +1157,7 @@ def init_command(console.print("Building the wiki from structure [dim]— no model, no spend.[/dim]")if decision_provider:console.print(- f"Decision extraction provider: [cyan]{decision_provider.provider_name}[/cyan]"+ f"Decision extraction provider: [{VALUE}]{decision_provider.provider_name}[/]")else:# No prompt here. ``is_interactive`` (line ~800) is already false only@@ -1180,7 +1183,7 @@ def init_command(if not is_interactive:console.print(f"[bold]repowise init[/bold] — {repo_path}")console.print(- "[yellow]No model configured.[/yellow] Building the wiki from "+ f"[{WARN}]No model configured.[/] Building the wiki from ""structure instead — no key, no spend.\n""[dim]Set a key (or pass --provider) and run [bold]repowise ""update --full[/bold] to have a model write it.[/dim]"@@ -1200,13 +1203,13 @@ def init_command(console.print(f"[bold]repowise init[/bold] — {repo_path}")if provider is not None:console.print(- f" Provider: [cyan]{provider.provider_name}[/cyan] / Model: [cyan]{provider.model_name}[/cyan]"+ f" Provider: [{VALUE}]{provider.provider_name}[/] / Model: [{VALUE}]{provider.model_name}[/]")- console.print(f" Embedder: [cyan]{embedder_name_resolved}[/cyan]")+ console.print(f" Embedder: [{VALUE}]{embedder_name_resolved}[/]")if language != "en":- console.print(f" Language: [cyan]{language}[/cyan]")+ console.print(f" Language: [{VALUE}]{language}[/]")if resolved_reasoning != "auto":- console.print(f" Reasoning: [cyan]{resolved_reasoning}[/cyan]")+ console.print(f" Reasoning: [{VALUE}]{resolved_reasoning}[/]")# Validate provider connection. Nothing to verify when there is no# provider: this run renders from templates and never calls a model.@@ -1226,7 +1229,7 @@ def init_command(except ProviderError as exc:telemetry.add_command_outcome(failure_reason="provider_validation_failed")raise click.ClickException(f"Provider validation failed: {exc}") from exc- console.print(" [green]✓[/green] Provider connection verified")+ console.print(f" [{OK}]✓[/] Provider connection verified")# ---- Phase 1 & 2: Ingestion + Analysis (always) ----# Index-only generates too, it just renders templates instead of prompting@@ -1257,7 +1260,7 @@ def init_command(# unanswered question rather than an answer (same call generation.py makes# for the generation bar).if llm_client is not None:- index_columns.append(TextColumn("[green]${task.fields[cost]:.3f}[/green]"))+ index_columns.append(TextColumn("[" + OK + "]${task.fields[cost]:.3f}[/]"))with Progress(*index_columns, console=console) as progress_bar:rich_callback = RichProgressCallback(progress_bar, console, total_phases=total_phases)@@ -1324,7 +1327,7 @@ def init_command(from repowise.cli.ui.mascot import EYES_SLEEPY, miniconsole.print(- f"\n{mini(EYES_SLEEPY)} [yellow]Interrupted.[/] Indexed work so far has been "+ f"\n{mini(EYES_SLEEPY)} [{WARN}]Interrupted.[/] Indexed work so far has been ""saved — run [bold]repowise init --resume[/] to continue where it stopped.")return@@ -1448,7 +1451,7 @@ def init_command(with console.status(" Persisting to database…", spinner=OWL_SPINNER):run_async(persist_result(result, repo_path))- console.print(" [green]✓[/green] Database updated")+ console.print(f" [{OK}]✓[/] Database updated")# Persist the onboarding choice so subsequent `repowise update` runs# honor it without re-passing the flag. Default True is omitted to keepdiff --git a/packages/cli/src/repowise/cli/commands/init_cmd/generation.py b/packages/cli/src/repowise/cli/commands/init_cmd/generation.pyindex 9309d7772..78333f068 100644--- a/packages/cli/src/repowise/cli/commands/init_cmd/generation.py+++ b/packages/cli/src/repowise/cli/commands/init_cmd/generation.py@@ -37,7 +37,14 @@ from repowise.cli.providers import (build_vector_store,flush_cost_tracker,)-from repowise.cli.ui import BRAND_STYLE, OWL_SPINNER, MaybeCountColumn, RichProgressCallback+from repowise.cli.ui import (+ BRAND_STYLE,+ OK,+ OWL_SPINNER,+ WARN,+ MaybeCountColumn,+ RichProgressCallback,+)from repowise.core.generation.models import (STUB_FALLBACK_ERROR,count_stub_fallbacks,@@ -234,11 +241,11 @@ def _enrich_knowledge_graph(result.knowledge_graph_result = _run()enriched = result.knowledge_graph_resultconsole.print(- f" [green]✓[/green] KG enriched: "+ f" [{OK}]✓[/] KG enriched: "f"{len(enriched.layers)} layers, {len(enriched.tour)} tour steps")except Exception as exc:- console.print(f" [yellow]KG enrichment skipped: {exc}[/yellow]")+ console.print(f" [{WARN}]KG enrichment skipped: {exc}[/]")def run_repo_generation(@@ -302,7 +309,7 @@ def run_repo_generation(TimeElapsedColumn(),]if not deterministic:- columns.append(TextColumn("[green]${task.fields[cost]:.3f}[/green]"))+ columns.append(TextColumn("[" + OK + "]${task.fields[cost]:.3f}[/]"))# Filled by a resumed run with the pages it skipped because they already# exist. Persistence needs them: they are absent from ``generated_pages``,@@ -382,7 +389,7 @@ def run_repo_generation(if failed_page_ids:type_counts = Counter(pid.split(":")[0] for pid in failed_page_ids)console.print(- f" [yellow]⚠[/yellow] Generated [bold]{written_count}[/bold] pages "+ f" [{WARN}]⚠[/] Generated [bold]{written_count}[/bold] pages "f"([bold yellow]{len(failed_page_ids)} failed[/bold yellow])\n")console.print(" [bold yellow]Failed pages by type:[/bold yellow]")@@ -415,14 +422,14 @@ def run_repo_generation()reason_note = "".join(f" [dim]· {r[:160]}[/dim]\n" for r in reasons[:3])console.print(- "\n [yellow]The wiki is incomplete: some pages were not written.[/yellow]\n"+ f"\n [{WARN}]The wiki is incomplete: some pages were not written.[/]\n"f"{placeholder_note}"f"{reason_note}"" [dim]Run [bold]repowise init --resume[/bold] to generate the pages that ""failed, without re-spending on the ones that succeeded.[/dim]\n")elif verbose:- console.print(f" [green]✓[/green] Generated [bold]{written_count}[/bold] pages")+ console.print(f" [{OK}]✓[/] Generated [bold]{written_count}[/bold] pages")# KG enrichment is layer naming and the guided tour, both pure prompting.# A deterministic run has no model to ask, and the skeleton's structuraldiff --git a/packages/cli/src/repowise/cli/commands/init_cmd/reporting.py b/packages/cli/src/repowise/cli/commands/init_cmd/reporting.pyindex 5d976b455..6af3db716 100644--- a/packages/cli/src/repowise/cli/commands/init_cmd/reporting.py+++ b/packages/cli/src/repowise/cli/commands/init_cmd/reporting.py@@ -12,11 +12,14 @@ from typing import Anyfrom repowise.cli.helpers import consolefrom repowise.cli.ui import (- build_analysis_summary_panel,+ ERR,+ OK,+ WARN,build_completion_panel,build_contextual_next_steps,- build_mcp_status_lines,+ build_status_notes,format_elapsed,+ print_analysis_summary,)@@ -54,23 +57,22 @@ def show_analysis_summary(result: Any) -> None:passconsole.print()- console.print(- build_analysis_summary_panel(- file_count=result.file_count,- symbol_count=result.symbol_count,- graph_nodes=_graph.number_of_nodes(),- graph_edges=_graph.number_of_edges(),- dead_unreachable=_dc_unreachable_pre,- dead_unused=_dc_unused_pre,- dead_lines=_dc_lines_pre,- decision_count=_n_decisions_pre,- git_files=result.git_summary.files_indexed if result.git_summary else 0,- hotspot_count=result.git_summary.hotspots- if result.git_summary and hasattr(result.git_summary, "hotspots")- else 0,- community_count=_community_count,- lang_summary=_lang_summary,- )+ print_analysis_summary(+ console,+ file_count=result.file_count,+ symbol_count=result.symbol_count,+ graph_nodes=_graph.number_of_nodes(),+ graph_edges=_graph.number_of_edges(),+ dead_unreachable=_dc_unreachable_pre,+ dead_unused=_dc_unused_pre,+ dead_lines=_dc_lines_pre,+ decision_count=_n_decisions_pre,+ git_files=result.git_summary.files_indexed if result.git_summary else 0,+ hotspot_count=result.git_summary.hotspots+ if result.git_summary and hasattr(result.git_summary, "hotspots")+ else 0,+ community_count=_community_count,+ lang_summary=_lang_summary,)@@ -233,7 +235,7 @@ def show_completion(" Re-run without [bold]--mode fast[/bold] to render the wiki from ""structure.[/dim]")- for _line in build_mcp_status_lines(setup):+ for _line in build_status_notes(setup):console.print(_line)console.print()_render_defect_accuracy(result)@@ -295,7 +297,7 @@ def show_completion(# A concise, dynamic MCP note (who is connected, how others connect)# replaces the old wall of manual per-client config: init already wrote# the Claude Code / VS Code registrations and repo `.mcp.json`.- for _line in build_mcp_status_lines(setup):+ for _line in build_status_notes(setup):console.print(_line)console.print()@@ -320,7 +322,7 @@ def _show_generation_checks(result: Any) -> None:# A first index that could not check itself must not read like one that# checked itself clean. The run still exits 0; the wiki is written.console.print(- f"[bold red]Generation checks did not run:[/bold red] {type(exc).__name__}: {exc}"+ f"[{ERR}]Generation checks did not run:[/] {type(exc).__name__}: {exc}")@@ -379,10 +381,10 @@ def show_workspace_completion(for alias, (count, reason) in docs_outcomes.items():if reason:console.print(- f" [yellow]✗[/yellow] {alias:<20} [yellow]skipped[/yellow] [dim]({reason})[/dim]"+ f" [{WARN}]✗[/] {alias:<20} [{WARN}]skipped[/] [dim]({reason})[/dim]")else:- console.print(f" [green]✓[/green] {alias:<20} [green]{count} pages[/green]")+ console.print(f" [{OK}]✓[/] {alias:<20} [{OK}]{count} pages[/]")if docs_skipped:first = docs_skipped[0][0]console.print()diff --git a/packages/cli/src/repowise/cli/commands/init_cmd/workspace.py b/packages/cli/src/repowise/cli/commands/init_cmd/workspace.pyindex b000d61e0..164401d07 100644--- a/packages/cli/src/repowise/cli/commands/init_cmd/workspace.py+++ b/packages/cli/src/repowise/cli/commands/init_cmd/workspace.py@@ -50,7 +50,10 @@ from repowise.cli.ui import (BRAND,BRAND_STYLE,ERR,+ OK,OWL_SPINNER,+ VALUE,+ WARN,MaybeCountColumn,RichProgressCallback,interactive_advanced_config,@@ -131,7 +134,7 @@ def _run_workspace_generation(# a dozen times, which makes plain text easier to miss, not harder.console.print(f" Writing [bold]{concept_page_count(plans):,}[/bold] subsystem pages with "- f"[cyan]{provider.model_name}[/cyan]. Estimated [bold]{format_cost(est)}[/bold]."+ f"[{VALUE}]{provider.model_name}[/]. Estimated [bold]{format_cost(est)}[/bold].")structural = structural_page_summary(plans)if structural:@@ -145,7 +148,7 @@ def _run_workspace_generation(est, yes=yes, message=f" Continue with {repo_path.name} at this cost?"):console.print(- " [yellow]Skipped.[/yellow] "+ f" [{WARN}]Skipped.[/] ""[dim]Index will be saved without docs; ""future `repowise update` runs default to index-only.[/dim]")@@ -337,7 +340,7 @@ def _ingest_and_generate_repo(repo: Any, idx: int, total: int, ctx: _WorkspaceCt)repo_phase_timings: dict[str, float] = callback.timingsconsole.print(- f" [green]✓[/green] {result.file_count:,} files, {result.symbol_count:,} symbols"+ f" [{OK}]✓[/] {result.file_count:,} files, {result.symbol_count:,} symbols")except Exception as exc:console.print(f" [{ERR}]✗ Failed: {exc}[/]\n")@@ -374,12 +377,12 @@ def _ingest_and_generate_repo(repo: Any, idx: int, total: int, ctx: _WorkspaceCtpages_generated = len(generated_pages)docs_mode = "deterministic"console.print(- f" [green]✓[/green] Rendered {len(generated_pages)} pages from structure "+ f" [{OK}]✓[/] Rendered {len(generated_pages)} pages from structure ""(no model)\n")if ctx.dry_run:- console.print(" [yellow]Dry run — skipping generation for this repo.[/yellow]\n")+ console.print(f" [{WARN}]Dry run — skipping generation for this repo.[/]\n")skip_reason = "dry run"elif ctx.run_mode == "fast":# Fast mode is a graph-and-git index by design; it skips the wiki so a@@ -416,7 +419,7 @@ def _ingest_and_generate_repo(repo: Any, idx: int, total: int, ctx: _WorkspaceCtpages_generated = len(generated_pages) - count_stub_fallbacks(generated_pages)docs_mode = "llm"- console.print(f" [green]✓[/green] Generated {pages_generated} pages\n")+ console.print(f" [{OK}]✓[/] Generated {pages_generated} pages\n")except CostGateDeclined:# Declining only ever meant "not at that price". Fall back to the# free template renderer rather than leaving the repo with no wiki@@ -536,9 +539,9 @@ def _run_cross_repo_analysis(ws_config: Any, root: Any, selected: list[Any], errfrom repowise.core.workspace.update import run_cross_repo_hooksrun_async(run_cross_repo_hooks(ws_config, root, indexed_aliases))- console.print(" [green]✓[/green] Cross-repo analysis complete")+ console.print(f" [{OK}]✓[/] Cross-repo analysis complete")except Exception as exc:- console.print(f" [yellow]⚠ Cross-repo analysis failed: {exc}[/yellow]")+ console.print(f" [{WARN}]⚠ Cross-repo analysis failed: {exc}[/]")def _workspace_init(@@ -604,7 +607,7 @@ def _workspace_init()if not selected:- console.print("[yellow]No repositories selected. Aborting.[/yellow]")+ console.print(f"[{WARN}]No repositories selected. Aborting.[/]")return# Step 2: Select primary repo@@ -690,15 +693,15 @@ def _workspace_init(# the initial resolution happened before the key was available.embedder_name_resolved = resolve_embedder(embedder_name)console.print(- f" Provider: [cyan]{provider.provider_name}[/cyan] / "- f"Model: [cyan]{provider.model_name}[/cyan]"+ f" Provider: [{VALUE}]{provider.provider_name}[/] / "+ f"Model: [{VALUE}]{provider.model_name}[/]")- console.print(f" Embedder: [cyan]{embedder_name_resolved}[/cyan]\n")+ console.print(f" Embedder: [{VALUE}]{embedder_name_resolved}[/]\n")if resolved_reasoning != "auto":- console.print(f" Reasoning: [cyan]{resolved_reasoning}[/cyan]\n")+ console.print(f" Reasoning: [{VALUE}]{resolved_reasoning}[/]\n")except Exception as exc:console.print(- f" [yellow]Provider setup failed ({exc}); falling back to index-only.[/yellow]"+ f" [{WARN}]Provider setup failed ({exc}); falling back to index-only.[/]")index_only = Trueprovider = None@@ -718,7 +721,7 @@ def _workspace_init(default_repo=primary_alias,)config_path = ws_config.save(root)- console.print(f" [green]✓[/green] Created {config_path.name}")+ console.print(f" [{OK}]✓[/] Created {config_path.name}")console.print()# Step 4: Index each selected repo (always generate_docs=False; generation is separate)diff --git a/packages/cli/src/repowise/cli/ui/__init__.py b/packages/cli/src/repowise/cli/ui/__init__.pyindex f50a373e3..bf144677d 100644--- a/packages/cli/src/repowise/cli/ui/__init__.py+++ b/packages/cli/src/repowise/cli/ui/__init__.py@@ -13,11 +13,14 @@ from repowise.cli.ui.brand import (DIM,ERR,OK,+ VALUE,WARN,format_bytes,format_elapsed,+ key_value_table,print_banner,print_phase_header,+ print_section,)from repowise.cli.ui.env_persistence import load_dotenvfrom repowise.cli.ui.mascot import (@@ -50,10 +53,10 @@ from repowise.cli.ui.repo_scanner import (quick_repo_scan,)from repowise.cli.ui.result_panels import (- build_analysis_summary_panel,build_completion_panel,build_contextual_next_steps,- build_mcp_status_lines,+ build_status_notes,+ print_analysis_summary,)from repowise.cli.ui.workspace_selection import (interactive_primary_select,@@ -69,16 +72,16 @@ __all__ = ["OK","OWL_SPINNER","THINKING_FRAMES",+ "VALUE","WARN","MaybeCountColumn","ProviderSelection","RepoScanInfo","RichProgressCallback","banner_text",- "build_analysis_summary_panel","build_completion_panel","build_contextual_next_steps",- "build_mcp_status_lines",+ "build_status_notes","format_bytes","format_elapsed","interactive_advanced_config",@@ -90,12 +93,15 @@ __all__ = ["interactive_provider_config_select","interactive_provider_select","interactive_repo_select",+ "key_value_table","load_dotenv","mini",+ "print_analysis_summary","print_banner","print_index_only_intro","print_phase_header","print_scan_summary",+ "print_section","prompt_file_page_volume","prompt_wiki_style","quick_repo_scan",diff --git a/packages/cli/src/repowise/cli/ui/brand.py b/packages/cli/src/repowise/cli/ui/brand.pyindex 3fec624a0..07da8d425 100644--- a/packages/cli/src/repowise/cli/ui/brand.py+++ b/packages/cli/src/repowise/cli/ui/brand.py@@ -1,4 +1,22 @@-"""Brand / theme constants and basic banner + phase-header rendering."""+"""Brand constants and the shared rendering primitives every init screen uses.++Four primitives live here, and they are here rather than beside their first+caller because each one had two or three near-copies before it did:++* :func:`print_banner` — the owl lockup.+* :func:`print_phase_header` — the full-width rule between pipeline phases.+* :func:`print_section` — the unbordered section opener (brand heading, dim+ blurb). Advanced config had it as a private helper; the readout screens that+ should never have been panels now use the same one.+* :func:`key_value_table` — the two-column label/value table. Rich owns the+ gutter, which is the whole point: every hand-padded version of this drifted+ by a column the moment a label grew.++The colour vocabulary is four names and no more. ``cyan`` used to be a de-facto+fifth on fourteen call sites, always on a machine-produced token — a model name,+an env var, a language code. That is what mono is for, so those sites take+``VALUE`` and the palette stays closed.+"""from __future__ import annotations@@ -7,6 +25,7 @@ import mathfrom rich.console import Consolefrom rich.markup import escapefrom rich.rule import Rule+from rich.table import Table# ---------------------------------------------------------------------------# Brand / theme@@ -19,8 +38,14 @@ OK = "green"WARN = "yellow"ERR = "bold red"+#: Anything a machine produced and a human might retype: a model id, an env var+#: name, a path, an embedder. Rule 5 of the design language — the distinction+#: between a measured fact and written prose is carried by the face, not by+#: spending a colour on it.+VALUE = "bold"+# ----------------------------------------------------------------------------# Banner — owl mascot + heatmap wordmark (art lives in ui/mascot.py)+# Banner — owl mascot + wordmark (art lives in ui/mascot.py)# ---------------------------------------------------------------------------# Breathing room required beyond the rendered banner width before we pick the@@ -29,18 +54,13 @@ _BANNER_WIDTH_MARGIN = 4def print_banner(console: Console, repo_name: str | None = None) -> None:- """Print the repowise owl banner, tagline, and optional repo name.-- Always renders the compact art (1-char strokes — about two thirds the- width of the full variant) so the banner stays understated; only the- tagline grows on wide terminals.- """+ """Print the repowise owl banner, tagline, and optional repo name."""from repowise.cli import __version__from repowise.cli.ui import mascotnarrow = console.width < mascot.banner_width() + _BANNER_WIDTH_MARGINconsole.print()- console.print(mascot.banner_text(repo_name, compact=True))+ console.print(mascot.banner_text())console.print()if narrow:console.print(f" [dim]codebase intelligence · v{__version__}[/dim]", highlight=False)@@ -75,6 +95,50 @@ def print_phase_header(console.print()+def print_section(console: Console, title: str, blurb: str = "") -> None:+ """Open a section: blank line, brand heading, optional dim blurb.++ The unbordered alternative to a panel, and the default for anything that is+ not a question. A border means "a discrete object you act on"; a forecast, a+ readout and a receipt are none of those, and giving all three the same+ border as the two real questions is what made the interactive path cross+ five boxes before the first phase started.+ """+ console.print()+ console.print(f" [{BRAND}]{title}[/]")+ if blurb:+ console.print(f" [dim]{blurb}[/dim]")+++def key_value_table(+ rows: list[tuple[str, str]],+ *,+ label_width: int = 20,+ label_style: str = DIM,+ value_style: str = VALUE,+) -> Table:+ """Two-column ``label / value`` table — the shape every readout uses.++ Rich owns the gutter, which is what the hand-padded versions of this could+ not do: a label one character longer than the pad started its value a column+ right of the others, and the fix was always to widen the pad until the next+ label outgrew it too.++ The two styles are arguments because emphasis does not always fall on the+ right-hand column. A metrics row is a dim label naming a bold figure, but a+ "what's next" row is a **command** you are meant to type, described by a dim+ gloss — the same table with the emphasis the other way round. Defaulting+ both and then reusing it for next steps is how the command ends up dimmed+ and its own description ends up bold.+ """+ table = Table(box=None, padding=(0, 2), show_header=False)+ table.add_column("Label", style=label_style, min_width=label_width)+ table.add_column("Value", style=value_style)+ for label, value in rows:+ table.add_row(label, value)+ return table++def format_elapsed(seconds: float) -> str:"""Format seconds as ``Xm Ys`` or ``X.Ys``."""if seconds >= 60:diff --git a/packages/cli/src/repowise/cli/ui/mascot.py b/packages/cli/src/repowise/cli/ui/mascot.pyindex 20b7cc957..53f63e981 100644--- a/packages/cli/src/repowise/cli/ui/mascot.py+++ b/packages/cli/src/repowise/cli/ui/mascot.py@@ -1,18 +1,27 @@-"""Owl mascot: banner art, state frames, and the heatmap wordmark.--Single home for every piece of the init-banner identity: the owl, the-REPOWISE block wordmark (full + compact variants), the GitHub-heatmap-colouring, and the spinner frames used while repowise thinks.--All render functions are pure and deterministic — the heatmap pattern is-seeded from the repo name, so the same repo always gets the same banner.+"""Owl mascot: banner art, eye states, and the block wordmark.++Single home for every piece of the init-banner identity: the owl, the REPOWISE+block wordmark, and the spinner frames used while repowise thinks.++All render functions are pure and deterministic, and there is exactly one size+of everything. The banner used to ship two — a full variant at 2-char strokes+and a compact one at 1 — with the caller hardcoding compact and the width maths+measuring full, so on an 80-column terminal the tagline shortened to fit art+that was 47 columns wide. Nothing rendered the full art in its whole life, so it+is gone rather than fixed: one size cannot desync from itself.++The wordmark is painted in the one brand colour. It used to run a five-shade+"heatmap" ramp that swept left to right and then jittered each cell by ±1.1+shades. Across the 31-cell wordmark the sweep moves 0.133 shades per cell while+the jitter moves up to 2.2, so the gradient never survived: counted over the+real grid, all 155 painted cells landed near-uniformly across the five shades.+It rendered as orange static in the first thing a user ever sees, which is the+"decorate only what does something" rule with nothing behind the paint."""from __future__ import annotations-import zlibfrom functools import cache-from random import Randomfrom rich.text import Text@@ -24,23 +33,11 @@ from repowise.cli.ui.brand import BRANDWHITE = "#E8E8E8" # owl body strokes (logo white)-# Floored 5-shade heatmap ramp: deep ember → blazing. No near-black shade so-# the wordmark always reads, even at the cold end of the gradient.-HEAT = ["#5C3208", "#9C5710", "#D97A16", "#F59520", "#FFC06A"]-# ---------------------------------------------------------------------------# Owl# ----------------------------------------------------------------------------OWL_FULL = [- " ,_____,",- " (◉ , ◉)",- " ( ▼ )",- " /)___(\\",- ' " " ',-]--OWL_COMPACT = [+OWL = [" ,___,"," (◉,◉)"," ( ▼ )",@@ -48,11 +45,9 @@ OWL_COMPACT = [' " " ',]-EYES_THINKING = ["◐", "◓", "◑", "◒"] # eye-roll cycle (kept for callers that want it)EYES_IDLE = "◉"EYES_SLEEPY = "─" # interrupt messageEYES_HAPPY = "^" # completion panels-EYES_ERROR = "x" # reserved: error output deliberately stays sober (no owl) for nowdef mini(eyes: str = EYES_IDLE) -> str:@@ -84,22 +79,11 @@ except Exception: # pragma: no cover — depends on rich internalsOWL_SPINNER = "dots"# ----------------------------------------------------------------------------# Wordmark fonts — half-block finished letterforms (R tail = stepped taper).-# FONT_FULL uses 2-char stroke cells; FONT_COMPACT is the same design at-# 1-char strokes for narrow terminals.+# Wordmark font — half-block letterforms at 1-char strokes (R tail = stepped+# taper).# ----------------------------------------------------------------------------FONT_FULL = {- "R": ["██████▄", "██ ██", "██████▀", "██ ▀█▄ ", "██ ▀█▄"],- "E": ["██████", "██ ", "█████ ", "██ ", "██████"],- "P": ["██████▄", "██ ██", "██████▀", "██ ", "██ "],- "O": ["▄█████▄", "██ ██", "██ ██", "██ ██", "▀█████▀"],- "W": ["██ ██", "██ ██", "██ █ ██", "██ ███ ██", "▀██▀ ▀██▀"],- "I": ["████", " ██ ", " ██ ", " ██ ", "████"],- "S": ["▄█████▄", "██ ", "▀█████▄", " ██", "▀█████▀"],-}--FONT_COMPACT = {+FONT = {"R": ["███▄ ", "█ █ ", "███▀ ", "█ ▀▄ ", "█ ▀▄"],"E": ["███", "█ ", "██ ", "█ ", "███"],"P": ["███▄", "█ █", "███▀", "█ ", "█ "],@@ -110,76 +94,32 @@ FONT_COMPACT = {}_WORD = "REPOWISE"+_LETTER_GAP = 1+_OWL_GAP = 2+_INDENT = 1@cache-def render_wordmark(compact: bool = False) -> tuple[tuple[str, ...], tuple[int, ...]]:- """Wordmark rows + per-column heat-cell ids.-- Cell ids are aligned to each letter's own grid (one cell = ``cell_w``- columns starting at the letter's left edge) so every coloured unit is a- true square — a cell never slices a stroke or bleeds across the- inter-letter gap. Gap columns map to ``-1`` (unpainted).- """- font = FONT_COMPACT if compact else FONT_FULL- cell_w = 1 if compact else 2- gap = 1 if compact else 2-+def render_wordmark() -> tuple[str, ...]:+ """The five wordmark rows, letters separated by a single column."""rows = ["", "", "", "", ""]- cellmap: list[int] = []- cell_base = 0- for li, ch in enumerate(_WORD):- glyph = font[ch]- width = len(glyph[0])- n_cells = (width + cell_w - 1) // cell_w- for lx in range(width):- cellmap.append(cell_base + min(lx // cell_w, n_cells - 1))- cell_base += n_cells+ for index, char in enumerate(_WORD):+ glyph = FONT[char]for r in range(5):rows[r] += glyph[r]- if li < len(_WORD) - 1:- for r in range(5):- rows[r] += " " * gap- cellmap.extend([-1] * gap)- return tuple(rows), tuple(cellmap)+ if index < len(_WORD) - 1:+ rows[r] += " " * _LETTER_GAP+ return tuple(rows)-def banner_width(compact: bool = False) -> int:+def banner_width() -> int:"""Total rendered banner width in columns (indent + owl + gap + wordmark).- Single source of truth for layout maths — ``print_banner`` derives its- full/compact switch threshold from this, so font or owl changes can't- silently desync the two.+ Single source of truth for layout maths, and now actually single: the+ tagline switch in ``print_banner`` calls this, and there is no second+ variant left for it to measure by mistake."""- owl = OWL_COMPACT if compact else OWL_FULL- rows, _ = render_wordmark(compact)- return 1 + max(len(line) for line in owl) + 2 + len(rows[0])---def seed_for(repo_name: str | None) -> int:- """Stable cross-process seed for a repo's heatmap pattern.-- Uses ``zlib.crc32`` deliberately — the built-in ``hash()`` is salted per- process, which would give every run a different banner.- """- return zlib.crc32((repo_name or "repowise").encode())---def heat_grid(seed: int, n_cells: int) -> list[list[int]]:- """Gradient + jitter shade grid (5 rows by *n_cells*), deterministic.-- Base shade sweeps linearly left→right across cells; each cell jitters- ±1 shade around the sweep, clamped to the palette bounds.- """- rng = Random(seed)- span = max(n_cells - 1, 1)- grid = [[0] * n_cells for _ in range(5)]- for r in range(5):- for c in range(n_cells):- base = (c / span) * (len(HEAT) - 1)- idx = round(base + rng.uniform(-1.1, 1.1))- grid[r][c] = min(max(idx, 0), len(HEAT) - 1)- return grid+ return _INDENT + max(len(line) for line in OWL) + _OWL_GAP + len(render_wordmark()[0])def _paint_owl(line: str) -> Text:@@ -195,24 +135,16 @@ def _paint_owl(line: str) -> Text:return out-def banner_text(repo_name: str | None, compact: bool = False) -> Text:- """Compose owl + heatmap wordmark into a single renderable ``Text``."""- owl = OWL_COMPACT if compact else OWL_FULL- rows, cellmap = render_wordmark(compact)- n_cells = max(c for c in cellmap if c >= 0) + 1- grid = heat_grid(seed_for(repo_name), n_cells)-- owl_w = max(len(line) for line in owl)+def banner_text() -> Text:+ """Compose owl + wordmark into a single renderable ``Text``."""+ rows = render_wordmark()+ owl_w = max(len(line) for line in OWL)out = Text()for r in range(5):if r:out.append("\n")- out.append(" ")- out.append_text(_paint_owl(owl[r].ljust(owl_w)))- out.append(" ")- for x, ch in enumerate(rows[r]):- if ch == " " or cellmap[x] < 0:- out.append(" ")- else:- out.append(ch, style=f"bold {HEAT[grid[r][cellmap[x]]]}")+ out.append(" " * _INDENT)+ out.append_text(_paint_owl(OWL[r].ljust(owl_w)))+ out.append(" " * _OWL_GAP)+ out.append(rows[r], style=f"bold {BRAND}")return outdiff --git a/packages/cli/src/repowise/cli/ui/mode_selection.py b/packages/cli/src/repowise/cli/ui/mode_selection.pyindex 486962d0f..ee6cf108f 100644--- a/packages/cli/src/repowise/cli/ui/mode_selection.py+++ b/packages/cli/src/repowise/cli/ui/mode_selection.py@@ -10,10 +10,16 @@ from rich.console import Consolefrom rich.panel import Panelfrom rich.prompt import Promptfrom rich.rule import Rule-from rich.table import Tablefrom rich.text import Text-from repowise.cli.ui.brand import BRAND, BRAND_STYLE, DIM+from repowise.cli.ui.brand import (+ BRAND,+ BRAND_STYLE,+ DIM,+ VALUE,+ key_value_table,+ print_section,+)from repowise.cli.ui.repo_scanner import (RepoScanInfo,estimated_documentable_files,@@ -167,7 +173,7 @@ def prompt_wiki_style(console: Console) -> str:console.print("\n[bold]Documentation style[/bold]")for idx, spec in enumerate(styles, 1):marker = " [dim](default)[/dim]" if spec.name == DEFAULT_STYLE else ""- console.print(f" {idx}. [cyan]{spec.name}[/cyan]{marker} — {spec.description}")+ console.print(f" {idx}. [{VALUE}]{spec.name}[/]{marker} — {spec.description}")default_idx = next((i for i, s in enumerate(styles, 1) if s.name == DEFAULT_STYLE), 1)choice = click.prompt(" Choose a style",@@ -200,22 +206,9 @@ def prompt_language(console: Console) -> str:)-def _section(console: Console, title: str, blurb: str) -> None:- """Open an advanced-config section: blank line, brand heading, dim blurb.-- Every section in this screen opens the same way, so the shape lives here- rather than in seven near-identical call sites. Titles are sentence case and- the blurb is required, which is what keeps a section from shipping as a bare- heading followed by a prompt the user has no context for.- """- console.print()- console.print(f" [{BRAND}]{title}[/]")- console.print(f" [dim]{blurb}[/dim]")--def _prompt_scope(console: Console, scan: RepoScanInfo | None, result: dict[str, Any]) -> None:"""Scope section: which file classes to include."""- _section(console, "Scope", "Choose what to include in the analysis")+ print_section(console, "Scope", "Choose what to include in the analysis")console.print()test_hint = f" ({scan.test_file_count:,} found)" if scan and scan.test_file_count else ""@@ -276,7 +269,7 @@ def prompt_file_page_volume(return Nonewould_be_capped_anyway = estimate > FILE_PAGE_AUTO_CEILING- _section(+ print_section(console,"Page volume",f"About [bold]{estimate:,}[/bold] files here would each get a file page "@@ -329,7 +322,7 @@ def _prompt_run_mode(# by default on large repos; off otherwise. Only offered for single-repo# init (allow_fast); the workspace path leaves this untouched.if allow_fast:- _section(+ print_section(console,"Run mode","standard = full depth · fast = quick graph + essential git, no LLM docs",@@ -347,7 +340,7 @@ def _prompt_exclude(console: Console, scan: RepoScanInfo | None, result: dict[str, Any]) -> list[str]:"""Exclude-patterns section. Returns the parsed pattern list."""- _section(+ print_section(console,"Exclude patterns","Keep whole directories or globs out of the index entirely",@@ -387,7 +380,7 @@ def _prompt_git(console: Console, scan: RepoScanInfo | None, result: dict[str, Acommit_hint = ""if scan and scan.total_commits:commit_hint = f" (repo has ~{scan.total_commits:,} total commits)"- _section(console, "Git analysis", f"Controls how deeply git history is analyzed{commit_hint}")+ print_section(console, "Git analysis", f"Controls how deeply git history is analyzed{commit_hint}")console.print()# Smart default based on repo size@@ -430,7 +423,7 @@ def _prompt_generation(prompt is skipped so the flag wins. *language* works the same way for the``--language`` flag."""- _section(console, "Generation", "LLM page generation settings")+ print_section(console, "Generation", "LLM page generation settings")console.print()# Smart concurrency default@@ -491,66 +484,69 @@ def _prompt_generation(result["language"] = language if language is not None else prompt_language(console)-def _build_summary_table(+def _summary_rows(result: dict[str, Any],patterns: list[str],*,allow_fast: bool,generate_docs: bool = True,-) -> Table:- """Build the configuration-summary table from the gathered answers.+) -> list[tuple[str, str]]:+ """The configuration-summary rows gathered from the answers.++ Returns rows rather than a table so the one shared ``key_value_table``+ renders them, which is what keeps this screen's gutter identical to the+ completion panel's instead of merely similar.Generation rows are shown only when *generate_docs* is True, so anindex-only advanced run doesn't list knobs that never apply."""- summary = Table(box=None, padding=(0, 2), show_header=False)- summary.add_column("Option", style="dim")- summary.add_column("Value", style="bold")+ summary: list[tuple[str, str]] = []++ def add(label: str, value: str) -> None:+ summary.append((label, value))# ── Indexing (always) ──────────────────────────────────────────────────- summary.add_row("Generate docs", "yes" if generate_docs else "no (index only)")- summary.add_row("Skip tests", "yes" if result["skip_tests"] else "no")- summary.add_row("Skip infra", "yes" if result["skip_infra"] else "no")+ add("Generate docs", "yes" if generate_docs else "no (index only)")+ add("Skip tests", "yes" if result["skip_tests"] else "no")+ add("Skip infra", "yes" if result["skip_infra"] else "no")if result["include_submodules"]:- summary.add_row("Include submodules", "yes")- summary.add_row("Commit limit", str(result["commit_limit"]))- summary.add_row("Follow renames", "yes" if result["follow_renames"] else "no")+ add("Include submodules", "yes")+ add("Commit limit", str(result["commit_limit"]))+ add("Follow renames", "yes" if result["follow_renames"] else "no")if allow_fast:- summary.add_row("Run mode", result["run_mode"])+ add("Run mode", result["run_mode"])if patterns:if len(patterns) <= 5:- summary.add_row("Exclude", ", ".join(patterns))+ add("Exclude", ", ".join(patterns))else:# Bullet-list when many patterns — comma-joined wraps unreadably.- summary.add_row("Exclude", "\n".join(f"• {p}" for p in patterns))+ add("Exclude", "\n".join(f"• {p}" for p in patterns))cap = result.get("max_file_pages")if cap:- summary.add_row("File pages", f"top {cap:,} by importance")+ add("File pages", f"top {cap:,} by importance")elif cap == 0:- summary.add_row("File pages", "one per eligible file (uncapped)")+ add("File pages", "one per eligible file (uncapped)")if not generate_docs and result.get("embedder"):- summary.add_row("Embedder", result["embedder"])+ add("Embedder", result["embedder"])# ── Generation (docs only) ─────────────────────────────────────────────if generate_docs:- summary.add_row("Concurrency", str(result["concurrency"]))+ add("Concurrency", str(result["concurrency"]))if result.get("reasoning"):- summary.add_row("Reasoning", result["reasoning"])- summary.add_row("Embedder", result["embedder"])+ add("Reasoning", result["reasoning"])+ add("Embedder", result["embedder"])if result.get("wiki_style"):- summary.add_row("Wiki style", result["wiki_style"])+ add("Wiki style", result["wiki_style"])if result.get("language") and result["language"] != "en":- summary.add_row(+ add("Language",f"{result['language']} ({SUPPORTED_LANGUAGES.get(result['language'], '?')})",)- summary.add_row("Onboarding", "yes" if result.get("onboarding", True) else "no")- summary.add_row(- "Harvest decisions", "yes" if result.get("harvest_decisions", True) else "no"- )- summary.add_row("Test run", "yes" if result["test_run"] else "no")+ add("Onboarding", "yes" if result.get("onboarding", True) else "no")+ add("Harvest decisions", "yes" if result.get("harvest_decisions", True) else "no")+ add("Test run", "yes" if result["test_run"] else "no")return summary@@ -623,16 +619,14 @@ def interactive_advanced_config(result["generate_docs"] = generate_docs# ── Summary ───────────────────────────────────────────────────────────+ # A receipt, not a question: no border. The two panels left on this flow are+ # the two screens that actually ask something.+ print_section(console, "Configuration summary")console.print()- summary = _build_summary_table(- result, patterns, allow_fast=allow_fast, generate_docs=generate_docs- )console.print(- Panel(- summary,- title="[bold]Configuration Summary[/bold]",- border_style=BRAND,- padding=(0, 1),+ key_value_table(+ _summary_rows(result, patterns, allow_fast=allow_fast, generate_docs=generate_docs),+ label_width=18,))console.print()@@ -648,7 +642,7 @@ def _prompt_index_only_search(console: Console, result: dict[str, Any]) -> None:picked up automatically from an API key in the environment, and this modepromises no spend. Choosing one here counts as asking for it."""- _section(+ print_section(console,"Search","Full-text search always works. Semantic search needs an embedder;\n"@@ -676,9 +670,15 @@ def _resolve_embedder_from_env() -> str:def print_index_only_intro(console: Console, has_provider: bool = False) -> None:- """Show what index-only mode will do before starting."""+ """Show what index-only mode will do before starting.++ A forecast, so no border — nothing here is a thing to act on, and it used to+ carry the same box as the question two screens earlier.+ """+ print_section(console, "Index only", "No LLM calls. No API key. No cost.")+ console.print()# Bullets, not checkmarks: every green ✓ elsewhere in a run means "already- # done", and this panel is a forecast.+ # done", and this is a forecast.lines = [" [dim]•[/dim] Parse all source files (AST)"," [dim]•[/dim] Build dependency graph (PageRank, communities)",@@ -694,19 +694,11 @@ def print_index_only_intro(console: Console, has_provider: bool = False) -> Nonelines.append(" [dim]•[/dim] [dim]Decision extraction enhanced (provider key detected)[/dim]")- lines.append("")- lines.append(" [dim]No LLM calls. No API key. No cost.[/dim]")- lines.append(+ for line in lines:+ console.print(line)+ console.print()+ console.print(" [dim]The subsystem pages read as stubs. Add a key and run ""[bold]repowise generate[/bold] to write them as prose.[/dim]")-- console.print(- Panel(- "\n".join(lines),- title="[bold]Index only: what this will do[/bold]",- border_style=BRAND,- padding=(1, 1),- )- )console.print()diff --git a/packages/cli/src/repowise/cli/ui/provider_selection.py b/packages/cli/src/repowise/cli/ui/provider_selection.pyindex 1b2c8a347..2b2218421 100644--- a/packages/cli/src/repowise/cli/ui/provider_selection.py+++ b/packages/cli/src/repowise/cli/ui/provider_selection.py@@ -15,7 +15,7 @@ from rich.console import Consolefrom rich.prompt import Promptfrom rich.table import Table-from repowise.cli.ui.brand import BRAND, BRAND_STYLE, OK, WARN+from repowise.cli.ui.brand import BRAND, BRAND_STYLE, OK, VALUE, WARNfrom repowise.cli.ui.env_persistence import _save_key_to_dotenvfrom repowise.core.providers.llm.base import ProviderModelOptionfrom repowise.core.reasoning import ReasoningMode, normalize_reasoning@@ -322,7 +322,7 @@ def _interactive_provider_name(env_var = _PROVIDER_ENV[chosen]signup_url = _PROVIDER_SIGNUP.get(chosen, "")console.print()- console.print(f" [bold]{chosen}[/bold] requires [cyan]{env_var}[/cyan].")+ console.print(f" [bold]{chosen}[/bold] requires [{VALUE}]{env_var}[/].")if signup_url:console.print(f" Get your API key here: [{BRAND}]{signup_url}[/]")console.print()diff --git a/packages/cli/src/repowise/cli/ui/repo_scanner.py b/packages/cli/src/repowise/cli/ui/repo_scanner.pyindex 66cc9b79f..afbdd5e4a 100644--- a/packages/cli/src/repowise/cli/ui/repo_scanner.py+++ b/packages/cli/src/repowise/cli/ui/repo_scanner.py@@ -8,7 +8,6 @@ from dataclasses import dataclass, fieldfrom pathlib import Pathfrom rich.console import Console-from rich.panel import Panelfrom repowise.core.fs_walk import PRUNED_DIRS, walk_repofrom repowise.core.ingestion.languages.registry import REGISTRY as _LANG_REGISTRY@@ -214,13 +213,9 @@ def print_scan_summary(console: Console, scan: RepoScanInfo) -> None:f"~{render_min}-{render_max} min more to render and embed the wiki")- body = f" {header_line}\n [dim]{lang_line}[/dim]\n [dim]{eta_line}[/dim]"-- console.print(- Panel(- body,- border_style="dim",- padding=(0, 1),- )- )+ # A readout, so no border. It sits directly under the banner and used to be+ # the first of five boxes a user crossed before anything was asked of them.+ console.print(f" {header_line}")+ console.print(f" [dim]{lang_line}[/dim]")+ console.print(f" [dim]{eta_line}[/dim]")console.print()diff --git a/packages/cli/src/repowise/cli/ui/result_panels.py b/packages/cli/src/repowise/cli/ui/result_panels.pyindex dcf179734..32bcd2f58 100644--- a/packages/cli/src/repowise/cli/ui/result_panels.py+++ b/packages/cli/src/repowise/cli/ui/result_panels.py@@ -1,35 +1,35 @@-"""Analysis-summary, completion, and next-step panels."""+"""Analysis readout, completion panel, and the notes that sit beside it.++One panel per run, and it is the last thing printed. Everything else on these+screens is a readout — the analysis interstitial, the MCP note, the list of+files init wrote into the working tree — and readouts get a section heading and+vertical rhythm rather than a border, because a border means "a discrete object+you act on" and none of them is.++The completion panel carries **two** commands. It used to carry up to seven,+assembled from every signal the run produced: the dashboard, the mode's upgrade+path, a manual MCP row, two hook installs, dead code, the top hotspot, and the+decision count. Each was individually justified and the pile was not — a list+of seven next steps does not tell you what to do next, it tells you the program+knows seven things. So the panel names the dashboard and the one move that most+needs making, and the states that are not commands moved out to the dim notes+below it, where they were always supposed to live.+"""from __future__ import annotationsfrom typing import Any-from rich.console import Group+from rich.console import Console, Groupfrom rich.panel import Panel-from rich.table import Tablefrom rich.text import Text-from repowise.cli.ui.brand import BRAND+from repowise.cli.ui.brand import BRAND, DIM, VALUE, key_value_table, print_sectionfrom repowise.cli.ui.mascot import EYES_HAPPY, mini-def build_metrics_table(metrics: list[tuple[str, str]], *, label_width: int = 20) -> Table:- """Two-column ``label / value`` table, the shape every summary panel uses.-- Rich owns the gutter, which is what the analysis panel's hand-padded row- labels could not do: ``Decisions`` is one character longer than the 9-column- gutter ``Graph`` / ``Git`` / ``Dead`` were padded to, so its value started a- column right of the others.- """- table = Table(box=None, padding=(0, 2), show_header=False)- table.add_column("Metric", style="dim", min_width=label_width)- table.add_column("Value", style="bold")- for label, value in metrics:- table.add_row(label, value)- return table---def build_analysis_summary_panel(+def print_analysis_summary(+ console: Console,*,file_count: int,symbol_count: int,@@ -43,61 +43,43 @@ def build_analysis_summary_panel(hotspot_count: int = 0,community_count: int = 0,lang_summary: str = "",-) -> Panel:- """Compact analysis-complete interstitial shown before generation."""- header = Text.from_markup(- f" [bold]{file_count:,}[/bold] files · "- f"[bold]{symbol_count:,}[/bold] symbols"+) -> None:+ """Print the analysis-complete readout shown before generation."""+ # The headline is printed rather than passed as the blurb: ``print_section``+ # dims its blurb, and a bold count inside a dim wrapper renders bold *and*+ # dim, which is quieter than the plain bold it replaced.+ print_section(console, "Analysis complete")+ headline = (+ f"[bold]{file_count:,}[/bold] files · [bold]{symbol_count:,}[/bold] symbols"+ (f" · [bold]{community_count}[/bold] communities" if community_count else ""))- parts: list[Any] = [header]+ console.print(f" {headline}")if lang_summary:- parts.append(Text(f" {lang_summary}", style="dim"))- parts.append(Text(""))+ console.print(f" [dim]{lang_summary}[/dim]")+ console.print()- metrics: list[tuple[str, str]] = [- ("Graph", f"[bold]{graph_nodes:,}[/bold] nodes · [bold]{graph_edges:,}[/bold] edges")+ rows: list[tuple[str, str]] = [+ ("Graph", f"{graph_nodes:,} nodes · {graph_edges:,} edges"),]if git_files:- metrics.append(+ rows.append(("Git",- f"[bold]{git_files:,}[/bold] files indexed"- + (f" · [bold]{hotspot_count}[/bold] hotspots" if hotspot_count else ""),+ f"{git_files:,} files indexed"+ + (f" · {hotspot_count} hotspots" if hotspot_count else ""),))if dead_unreachable or dead_unused:- # "Dead" was an adjective with the noun dropped for column width; the- # table has no fixed width to protect.- metrics.append(+ rows.append(("Dead code",- f"[bold]{dead_unreachable}[/bold] unreachable · "- f"[bold]{dead_unused}[/bold] unused exports"+ f"{dead_unreachable} unreachable · {dead_unused} unused exports"+ (f" · ~{dead_lines:,} lines" if dead_lines else ""),))if decision_count:- metrics.append(("Decisions", f"[bold]{decision_count}[/bold] extracted"))- parts.append(build_metrics_table(metrics, label_width=11))-- return Panel(- Group(*parts),- title="[bold]Analysis Complete[/bold]",- border_style=BRAND,- padding=(1, 1),- )---def _render_what_next_lines(next_steps: list[tuple[str, str]]) -> list[str]:- """Format the ``What's next:`` rows for the completion panel.-- Pads short commands to a 28-column gutter for alignment, but always- inserts at least one space between command and description so a long- command like ``repowise init --provider gemini`` (>28 chars) doesn't- run straight into its description text.- """- return [f" {cmd:<28} {desc}" for cmd, desc in next_steps]+ rows.append(("Decisions", f"{decision_count} extracted"))+ console.print(key_value_table(rows, label_width=11))def build_completion_panel(@@ -106,20 +88,29 @@ def build_completion_panel(*,next_steps: list[tuple[str, str]] | None = None,) -> Panel:- """Build a bordered summary panel, titled with the happy owl.+ """Build the run's one bordered panel, titled with the happy owl.- *metrics* is a list of ``(label, value)`` pairs.- *next_steps* is an optional list of ``(command, description)`` pairs.- The mascot prefix lives here (not at call sites) so every completion- panel gets it consistently.+ *metrics* is a list of ``(label, value)`` pairs. *next_steps* is at most two+ ``(command, description)`` pairs — see :func:`build_contextual_next_steps`.+ Both columns are laid out by Rich rather than padded by hand, so a command+ longer than the gutter pushes the gutter instead of running into its own+ description."""- parts: list[Any] = [build_metrics_table(metrics)]+ parts: list[Any] = [key_value_table(metrics)]if next_steps:parts.append(Text(""))parts.append(Text(" What's next:", style="bold"))- for line in _render_what_next_lines(next_steps):- parts.append(Text(line, style="dim"))+ # Emphasis inverted against the metrics rows above: here the left column+ # is the command you type and the right is a gloss on it.+ parts.append(+ key_value_table(+ list(next_steps),+ label_width=24,+ label_style=VALUE,+ value_style=DIM,+ )+ )return Panel(Group(*parts),@@ -140,99 +131,109 @@ def build_contextual_next_steps(top_hotspot: str = "",setup: Any = None,) -> list[tuple[str, str]]:- """Build next-step suggestions from what the run actually did.+ """The dashboard, then the single move that most needs making.``repowise serve`` is the headline in every mode: the dashboard is the one- place the graph, hotspots, dead code, decisions and wiki are all browsable.- The second row is the mode's natural next move (upgrade for fast/index-only,- search for a written wiki).-- *setup* is an optional :class:`~repowise.cli.editor_setup.EditorSetupOutcome`.- When present, the panel reacts to it: a headless run gets a manual MCP row,- and a **non-interactive** run whose hooks are missing gets install rows- (an interactive run was already offered them live, so re-listing would nag).- The Claude Code "already connected, restart it" status is a note rendered- beside the panel, not a command row — see :func:`build_mcp_status_lines`.+ place the graph, hotspots, dead code, decisions and wiki are all browsable,+ and it is useful before any upgrade.++ The second row is the first of these that applies, in this order, which is+ "what is stopping this index from being used at all" before "what is+ stopping it from being finished" before "what did it find":++ 1. nothing wired an MCP client, so no agent can reach any of this yet;+ 2. the index is deliberately partial (fast, or index-only), so completing it+ beats exploring it;+ 3. otherwise the largest concrete finding, and only a generic search row+ when the run genuinely found nothing to point at.++ The MCP row goes **first**, not after the mode rows. A headless index-only+ run is the single most likely way to reach this function — it is what+ ``--no-editor-setup --index-only`` does, which is the flag pair CI uses —+ and with the mode check first, that run was told to go write prose while+ nothing on the screen said how to connect a client to the index it had just+ built. :func:`build_status_notes` stays silent for a disabled run by design,+ so this row is the only place that information exists.++ Everything that is a *state* rather than a command — a client that needs a+ restart, a hook that is not installed — is rendered by+ :func:`build_status_notes` below the panel instead."""- steps: list[tuple[str, str]] = []-- # Headline: the dashboard, always. Graph, hotspots and dead code are there- # even in fast/index-only mode, so it is useful before any upgrade.- steps.append(("repowise serve", "open the dashboard at http://localhost:3000"))+ steps: list[tuple[str, str]] = [+ ("repowise serve", "open the dashboard at http://localhost:3000"),+ ]- if fast_mode:+ if setup is not None and getattr(setup, "editor_setup_disabled", False):+ # Headless / CI / --no-editor-setup: nothing was wired, so the tools are+ # unreachable until someone connects a client by hand.+ steps.append(("repowise mcp .", "connect an MCP client (Cursor, Codex, Claude Code)"))+ elif fast_mode:# Fast index: graph + essential git, no docs. Point at the full result.steps.append(("repowise init", "upgrade to full git history + a generated wiki"))elif index_only:# `generate` is the scoped, cost-gated upgrade path — a coverage, a# directory or one page at a time, each behind an estimate — not the# all-or-nothing `update --full` this used to suggest.- steps.append(("repowise generate", "upgrade the wiki to model-written prose (needs a key)"))- else:- steps.append(('repowise search "<query>"', "search the generated wiki"))-- # MCP: only a manual row when nothing was auto-wired (headless/CI). When a- # client was registered, the "restart to load the tools" status goes in the- # note beside the panel instead of as a command.- if setup is not None and getattr(setup, "editor_setup_disabled", False):- steps.append(("repowise mcp .", "connect an MCP client (Cursor, Codex, Claude Code)"))-- # Hooks the interactive offers would have covered live. Surface them here- # only for a non-interactive run (where the offers were skipped silently)- # and only when the hook is actually missing. A headless / skip-setup run- # opted out of all editor wiring, so it is never nagged to install hooks.- if (- setup is not None- and not getattr(setup, "interactive", False)- and not getattr(setup, "editor_setup_disabled", False)- ):- if not getattr(setup, "autosync_hook_installed", False):- steps.append(("repowise hook install", "auto-sync the index on every commit"))- if not getattr(setup, "rewrite_hook_installed", False):- steps.append(- ("repowise hook rewrite install", "compress noisy command output via distill")- )-- if dead_unreachable + dead_unused > 0:+ steps.append(("repowise generate", "write the subsystem pages with a model (needs a key)"))+ elif dead_unreachable + dead_unused > 0:steps.append(("repowise dead-code", f"explore {dead_unreachable + dead_unused} dead code findings"))-- if hotspot_count > 0 and top_hotspot:- steps.append((f"repowise risk {top_hotspot}", "assess risk for top hotspot"))-- if decision_count > 0:+ elif hotspot_count > 0 and top_hotspot:+ steps.append((f"repowise risk {top_hotspot}", "assess risk for the top hotspot"))+ elif decision_count > 0:steps.append(("repowise decision list", f"browse {decision_count} architectural decisions"))+ else:+ steps.append(('repowise search "<query>"', "search the generated wiki"))return steps-def build_mcp_status_lines(setup: Any) -> list[str]:- """Rich-markup status lines about MCP wiring, shown beside the panel.+def build_status_notes(setup: Any) -> list[str]:+ """Rich-markup notes about MCP and hook wiring, shown beside the panel.Separate from the command rows because "already connected, restart it" is a- state, not something to run. Returns an empty list for a headless run (the- manual ``repowise mcp .`` command row carries that case instead).+ state, not something to run — and because a note can say a thing is missing+ without implying the user must act on it now.++ A run that opted out of editor wiring entirely gets nothing: it asked for+ that, and the ``repowise mcp .`` command row already carries the one case+ where it matters."""if setup is None or getattr(setup, "editor_setup_disabled", False):return []- lines: list[str] = []+ notes: list[str] = []if getattr(setup, "claude_code_connected", False):if getattr(setup, "first_index", True):- lines.append(+ notes.append(" [dim]Claude Code is connected to this repo. Restart it (or run ""[bold]/mcp[/bold]) to load the repowise tools.[/dim]")else:- lines.append(+ notes.append(" [dim]Claude Code stays connected; restart it only if the tools ""aren't showing.[/dim]")# Cursor and Codex are not auto-wired (init writes the Claude/VS Code configs# and repo `.mcp.json`, not `.cursor/mcp.json`), so always point the way.- lines.append(+ notes.append(" [dim]Cursor or Codex: run [bold]repowise mcp .[/bold] ""(config in [bold].repowise/mcp.json[/bold]).[/dim]")- return lines++ # Hooks the interactive offers would have covered live. Surfaced only for a+ # non-interactive run, where those offers were skipped in silence. These+ # used to be command rows in the panel, which gave a thing nobody asked for+ # the same weight as the dashboard.+ if not getattr(setup, "interactive", False):+ missing = []+ if not getattr(setup, "autosync_hook_installed", False):+ missing.append("[bold]repowise hook install[/bold] keeps the index synced on commit")+ if not getattr(setup, "rewrite_hook_installed", False):+ missing.append(+ "[bold]repowise hook rewrite install[/bold] compresses noisy command output"+ )+ notes.extend(f" [dim]{line}.[/dim]" for line in missing)++ return notesdiff --git a/tests/unit/cli/test_fast_mode_offer.py b/tests/unit/cli/test_fast_mode_offer.pyindex d93df6c68..cf3b1d1f6 100644--- a/tests/unit/cli/test_fast_mode_offer.py+++ b/tests/unit/cli/test_fast_mode_offer.py@@ -7,7 +7,7 @@ from repowise.cli.ui import (LARGE_REPO_FILE_THRESHOLD,RepoScanInfo,build_contextual_next_steps,- build_mcp_status_lines,+ build_status_notes,should_offer_fast_mode,)@@ -63,12 +63,60 @@ def test_next_steps_full_mode():assert any("search" in c for c in cmds)+def test_next_steps_are_exactly_two_rows():+ """The panel names the dashboard and one move, never a pile.++ It used to assemble up to seven rows from every signal the run produced.+ Each was individually justified and the list was not: seven next steps do+ not tell you what to do next, they tell you the program knows seven things.+ """+ for kwargs in (+ {"index_only": True, "fast_mode": True},+ {"index_only": True, "fast_mode": False},+ {"index_only": False},+ {"index_only": False, "dead_unreachable": 12, "dead_unused": 30},+ {"index_only": False, "hotspot_count": 4, "top_hotspot": "a.py"},+ {"index_only": False, "decision_count": 9},+ ):+ assert len(build_contextual_next_steps(**kwargs)) == 2+++def test_next_steps_findings_rank_below_finishing_the_index():+ """A partial index is a worse problem than an unexplored finding."""+ steps = build_contextual_next_steps(+ index_only=True, fast_mode=False, dead_unreachable=40, decision_count=9+ )+ assert steps[1][0] == "repowise generate"++ # With the index complete, the largest finding gets the row.+ found = build_contextual_next_steps(+ index_only=False, dead_unreachable=12, dead_unused=30, decision_count=9+ )+ assert found[1][0] == "repowise dead-code"+++def test_next_steps_fall_back_to_search_when_nothing_was_found():+ steps = build_contextual_next_steps(index_only=False)+ assert steps[1][0].startswith("repowise search")++def test_next_steps_headless_run_gets_manual_mcp_row():"""A skipped-setup run (CI/headless) can't auto-wire a client, so the paneloffers the manual connect command naming the real clients."""setup = EditorSetupOutcome(editor_setup_disabled=True, claude_code_connected=False)cmds = [c for c, _ in build_contextual_next_steps(index_only=True, setup=setup)]assert "repowise mcp ." in cmds+ # It outranks the index-only upgrade row: `--no-editor-setup --index-only`+ # is the CI shape, and `build_status_notes` is silent for a disabled run,+ # so this row is the only place the connect instructions exist.+ assert cmds[1] == "repowise mcp ."++ # Fast mode too, for the same reason.+ fast = [+ c+ for c, _ in build_contextual_next_steps(index_only=True, fast_mode=True, setup=setup)+ ]+ assert fast[1] == "repowise mcp ."# A skip-setup run opted out of all wiring, so it is never nagged to install# hooks even though it is non-interactive with none present.assert not any(c.startswith("repowise hook") for c in cmds)@@ -88,9 +136,11 @@ def test_next_steps_non_interactive_surfaces_missing_hooks():rewrite_hook_installed=False,claude_code_connected=True,)- cmds = [c for c, _ in build_contextual_next_steps(index_only=True, setup=setup)]- assert "repowise hook install" in cmds- assert "repowise hook rewrite install" in cmds+ notes = " ".join(build_status_notes(setup))+ assert "repowise hook install" in notes+ assert "repowise hook rewrite install" in notes+ # ...and they are notes, not command rows: the panel stays at two.+ assert len(build_contextual_next_steps(index_only=True, setup=setup)) == 2# Already installed → not re-suggested.setup_installed = EditorSetupOutcome(@@ -99,8 +149,7 @@ def test_next_steps_non_interactive_surfaces_missing_hooks():rewrite_hook_installed=True,claude_code_connected=True,)- cmds2 = [c for c, _ in build_contextual_next_steps(index_only=True, setup=setup_installed)]- assert not any(c.startswith("repowise hook") for c in cmds2)+ assert not any("repowise hook" in n for n in build_status_notes(setup_installed))def test_next_steps_interactive_run_does_not_nag_about_hooks():@@ -112,41 +161,37 @@ def test_next_steps_interactive_run_does_not_nag_about_hooks():rewrite_hook_installed=False,claude_code_connected=True,)- cmds = [c for c, _ in build_contextual_next_steps(index_only=True, setup=setup)]- assert not any(c.startswith("repowise hook") for c in cmds)+ assert not any("repowise hook" in n for n in build_status_notes(setup))def test_mcp_status_lines_restart_note_only_on_first_index():first = EditorSetupOutcome(claude_code_connected=True, first_index=True)- text = " ".join(build_mcp_status_lines(first)).lower()+ text = " ".join(build_status_notes(first)).lower()assert "restart" in text and "claude code" in textassert "cursor" in text and "codex" in text # others are pointed the way toorerun = EditorSetupOutcome(claude_code_connected=True, first_index=False)- rerun_text = " ".join(build_mcp_status_lines(rerun)).lower()+ rerun_text = " ".join(build_status_notes(rerun)).lower()assert "stays connected" in rerun_textdef test_mcp_status_lines_empty_when_headless_or_absent():- assert build_mcp_status_lines(None) == []- assert build_mcp_status_lines(EditorSetupOutcome(editor_setup_disabled=True)) == []+ assert build_status_notes(None) == []+ assert build_status_notes(EditorSetupOutcome(editor_setup_disabled=True)) == []-def test_next_steps_rendered_lines_have_space_before_description():- """Regression: long commands like ``repowise init --provider gemini``- (>28 chars) used to run straight into the description because the format- spec only padded *up to* 28 columns. Every rendered line must have at- least one space between the command and its description."""- from repowise.cli.ui.result_panels import _render_what_next_lines+def test_next_steps_render_without_truncation_or_collision():+ """Regression, rehomed: a command longer than the gutter used to run into+ its own description because the format spec only padded *up to* 28 columns.+ Rich owns the column now, so the check is that both halves survive rendering+ intact rather than that a pad was wide enough."""+ from rich.console import Console- steps = build_contextual_next_steps(index_only=True, fast_mode=False)- lines = _render_what_next_lines(steps)- for cmd, desc in steps:- matching = [line for line in lines if cmd in line and desc in line]- assert matching, f"expected a rendered line for ({cmd!r}, {desc!r})"- line = matching[0]- idx_cmd_end = line.index(cmd) + len(cmd)- idx_desc = line.index(desc, idx_cmd_end)- gap = line[idx_cmd_end:idx_desc]- assert gap.strip() == "", f"unexpected non-space chars between cmd and desc: {gap!r}"- assert len(gap) >= 1, f"no separator between {cmd!r} and {desc!r}: {line!r}"+ from repowise.cli.ui import build_completion_panel++ steps = [("repowise hook rewrite install", "compress noisy command output")]+ console = Console(width=120, record=True, force_terminal=True)+ console.print(build_completion_panel("done", [("Files", "1")], next_steps=steps))+ out = console.export_text()+ assert "repowise hook rewrite install" in out+ assert "compress noisy command output" in outdiff --git a/tests/unit/cli/test_mascot.py b/tests/unit/cli/test_mascot.pyindex bbb732b56..29c68d6d5 100644--- a/tests/unit/cli/test_mascot.py+++ b/tests/unit/cli/test_mascot.py@@ -1,84 +1,54 @@"""Tests for the owl mascot banner (``ui/mascot.py``).-Pins the locked banner design: layout width, heatmap determinism (seeded from-the repo name), letter-aligned colour cells, spinner frame geometry, and the-Windows-safe character set.+Pins the locked banner design: one size, one accent, spinner frame geometry,+and the Windows-safe character set.++The heatmap tests these replace are gone with the heatmap. They pinned a+five-shade ramp that swept left to right and jittered each cell by ±1.1 shades+— which, across the 31-cell wordmark, moved 0.133 shades of sweep against up to+2.2 of jitter, so what shipped was uniform orange static rather than a gradient.+The tests were correct about the code and the code was wrong about the design,+which is worth remembering before pinning a visual detail again: assert the+thing you would defend in review, not the thing the implementation happens to+do."""from __future__ import annotationsimport unicodedata-import zlib-import pytestfrom rich.console import Consolefrom repowise.cli.ui import mascot-from repowise.cli.ui.brand import print_banner+from repowise.cli.ui.brand import BRAND, print_banner-FULL_BANNER_MAX_COLS = 79-COMPACT_BANNER_MAX_COLS = 47+BANNER_MAX_COLS = 47-def _banner_lines(repo_name: str | None, *, compact: bool = False) -> list[str]:- return mascot.banner_text(repo_name, compact=compact).plain.split("\n")+def _banner_lines() -> list[str]:+ return mascot.banner_text().plain.split("\n")-def test_banner_width() -> None:- for line in _banner_lines("my-cool-repo"):- assert len(line.rstrip()) <= FULL_BANNER_MAX_COLS+def test_banner_fits_its_declared_width() -> None:+ for line in _banner_lines():+ assert len(line.rstrip()) <= BANNER_MAX_COLS-def test_banner_deterministic() -> None:- a1 = mascot.banner_text("repo-a")- a2 = mascot.banner_text("repo-a")- b = mascot.banner_text("repo-b")- assert a1.markup == a2.markup # same repo -> identical styled render- assert a1.markup != b.markup # different repo -> different heat pattern- assert a1.plain == b.plain # ... but identical letterforms+def test_banner_is_deterministic_and_repo_independent() -> None:+ # The banner takes no arguments at all now, so there is nothing left for a+ # per-repo signature to key on. Two calls are byte-identical, styles too.+ first = mascot.banner_text()+ second = mascot.banner_text()+ assert first.plain == second.plain+ assert first.markup == second.markup-def test_seed_is_stable_across_processes() -> None:- # seed must come from zlib.crc32 (stable), never the salted built-in- # hash() — pin a known value so a "simplification" to hash() fails loudly.- assert mascot.seed_for("repowise") == zlib.crc32(b"repowise") == 3401388275- assert mascot.seed_for(None) == mascot.seed_for("repowise")---def test_heat_grid_bounds() -> None:- grid = mascot.heat_grid(seed=5, n_cells=30)- assert len(grid) == 5- for row in grid:- assert len(row) == 30- assert all(0 <= cell <= len(mascot.HEAT) - 1 for cell in row)--[email protected]("compact", [False, True])-def test_cells_align_to_letters(compact: bool) -> None:- _rows, cellmap = mascot.render_wordmark(compact)- cell_w = 1 if compact else 2-- # Gap columns are unpainted; letter columns carry nonnegative cell ids.- assert min(cellmap) == -1- painted = [c for c in cellmap if c >= 0]- assert painted[0] == 0- assert sorted(set(painted)) == list(range(max(painted) + 1))-- # Cell ids never decrease left->right, each cell spans at most cell_w- # contiguous columns, and an id never recurs after a gap (no bleed- # across the inter-letter gap).- last = -1- run = 0- after_gap: set[int] = set()- for c in cellmap:- if c < 0:- after_gap.update(range(last + 1))- continue- assert c >= last- run = run + 1 if c == last else 1- assert run <= cell_w- assert c not in after_gap- last = c+def test_wordmark_is_one_accent() -> None:+ # Rule 2: one accent. Every styled span in the banner is either the brand+ # orange (wordmark + eyes) or the logo white (owl strokes) — no ramp, no+ # third hue.+ styles = {str(span.style) for span in mascot.banner_text().spans}+ assert styles == {f"bold {BRAND}", f"bold {mascot.WHITE}"}def test_frames_are_uniform_width() -> None:@@ -92,82 +62,74 @@ def test_frames_are_uniform_width() -> None:def test_art_is_utf8_clean() -> None:+ # Every glyph must be single-width: a wide character shifts the whole+ # lockup by a column on the terminals that render it wide.art: list[str] = [- *mascot.OWL_FULL,- *mascot.OWL_COMPACT,+ *mascot.OWL,*mascot.THINKING_FRAMES,mascot.mini(mascot.EYES_IDLE),mascot.mini(mascot.EYES_SLEEPY),mascot.mini(mascot.EYES_HAPPY),- mascot.mini(mascot.EYES_ERROR),]- for font in (mascot.FONT_FULL, mascot.FONT_COMPACT):- for glyph in font.values():- art.extend(glyph)+ for glyph in mascot.FONT.values():+ art.extend(glyph)for s in art:s.encode("utf-8") # must not raisefor ch in s:assert unicodedata.east_asian_width(ch) not in ("W", "F")-def test_compact_banner_under_80() -> None:- console = Console(width=70, record=True, force_terminal=True)- print_banner(console, repo_name="my-cool-repo")- out = console.export_text()- assert ",___," in out # compact owl used- assert ",_____," not in out # full owl absent- for line in out.split("\n"):- assert len(line.rstrip()) <= COMPACT_BANNER_MAX_COLS+def test_wordmark_rows_are_rectangular() -> None:+ rows = mascot.render_wordmark()+ assert len(rows) == 5+ assert len({len(row) for row in rows}) == 1, "ragged rows would skew the lockup"-def test_banner_width_single_source_of_truth() -> None:- # print_banner derives its full/compact threshold from these — pin the- # current layout so an accidental font/owl width change fails loudly.- assert mascot.banner_width() == 78- assert mascot.banner_width(compact=True) == 47- for compact, width in ((False, mascot.banner_width()), (True, 47)):- for line in _banner_lines("my-cool-repo", compact=compact):- assert len(line.rstrip()) <= width+def test_banner_width_is_a_single_source_of_truth() -> None:+ # The whole point of deleting the second size: `print_banner` derives its+ # tagline threshold from this number, and there is no other variant left for+ # it to measure by mistake. It used to measure 78 (the full art) while+ # drawing 47 (the compact art), so an 80-column terminal — the most common+ # width there is — got the short tagline for no reason.+ assert mascot.banner_width() == BANNER_MAX_COLS+ for line in _banner_lines():+ assert len(line.rstrip()) <= mascot.banner_width()-def test_repo_name_with_markup_is_escaped() -> None:- # A directory name containing rich markup must render literally, not- # crash with MarkupError or inject styling.- console = Console(width=100, record=True, force_terminal=True)- print_banner(console, repo_name="evil[/bold]name")- assert "evil[/bold]name" in console.export_text()+def test_long_tagline_appears_at_eighty_columns() -> None:+ # The regression the single source of truth exists to prevent.+ console = Console(width=80, record=True, force_terminal=True)+ print_banner(console, repo_name="my-cool-repo")+ out = console.export_text()+ assert "codebase intelligence for developers and AI" in out+++def test_short_tagline_below_the_banner_width() -> None:+ console = Console(width=40, record=True, force_terminal=True)+ print_banner(console, repo_name="my-cool-repo")+ out = console.export_text()+ assert "codebase intelligence ·" in out+ assert "for developers and AI" not in out-def test_banner_at_wide_width_stays_compact_with_long_tagline() -> None:- # The banner art is always the compact variant; only the tagline grows- # on wide terminals.+def test_banner_renders_the_owl_and_repo_name() -> None:console = Console(width=100, record=True, force_terminal=True)print_banner(console, repo_name="my-cool-repo")out = console.export_text()- assert ",___," in out # compact owl used- assert ",_____," not in out # full owl never rendered- assert "codebase intelligence for developers and AI" in out+ assert ",___," in outassert "Repository: my-cool-repo" in out+ # Only the art is held to the banner width. The tagline is allowed past it+ # — that is the whole point of `_BANNER_WIDTH_MARGIN`, which picks the long+ # tagline whenever the terminal can carry it.+ art = [line for line in out.split("\n") if "█" in line]+ assert len(art) == 5+ for line in art:+ assert len(line.rstrip()) <= BANNER_MAX_COLS[email protected]("compact", [False, True])-def test_banner_colors_derive_from_repo_seed(compact: bool) -> None:- # Behavioral pin: every painted wordmark cell in the rendered banner must- # carry exactly the shade predicted by heat_grid(seed_for(repo), n) — for- # BOTH sizes, so full and compact share one seed (pattern parity).- rows, cellmap = mascot.render_wordmark(compact)- n_cells = max(c for c in cellmap if c >= 0) + 1- grid = mascot.heat_grid(mascot.seed_for("repo-x"), n_cells)-- text = mascot.banner_text("repo-x", compact=compact)- owl = mascot.OWL_COMPACT if compact else mascot.OWL_FULL- offset = 1 + max(len(line) for line in owl) + 2 # indent + owl + gap- style_at = {span.start: str(span.style) for span in text.spans}-- checked = 0- for x, ch in enumerate(rows[0]):- if ch == " " or cellmap[x] < 0:- continue- assert style_at[offset + x] == f"bold {mascot.HEAT[grid[0][cellmap[x]]]}"- checked += 1- assert checked > 20 # the whole top row of the wordmark was verified+def test_repo_name_with_markup_is_escaped() -> None:+ # A directory name containing rich markup must render literally, not+ # crash with MarkupError or inject styling.+ console = Console(width=100, record=True, force_terminal=True)+ print_banner(console, repo_name="evil[/bold]name")+ assert "evil[/bold]name" in console.export_text()diff --git a/tests/unit/cli/test_ui_package.py b/tests/unit/cli/test_ui_package.pyindex 38db96a43..37f662285 100644--- a/tests/unit/cli/test_ui_package.py+++ b/tests/unit/cli/test_ui_package.py@@ -35,10 +35,10 @@ def test_facade_reexports_public_surface() -> None:"print_scan_summary","print_index_only_intro","quick_repo_scan",- "build_analysis_summary_panel",+ "print_analysis_summary","build_completion_panel","build_contextual_next_steps",- "build_mcp_status_lines",+ "build_status_notes","format_bytes","format_elapsed","LARGE_REPO_FILE_THRESHOLD",