Skip to content

Codebase intelligence for AI and humans: code health scores, auto-generated docs, git analytics, dead code detection, and architectural decisions via MCP.

feat(init): a brand theme, ASCII glyphs on non-UTF-8 terminals, and an owl that shows how the run ended (#4257)

Raghav Chamadiya4be2f9d96763
diff --git a/packages/cli/src/repowise/cli/_helpers/console.py b/packages/cli/src/repowise/cli/_helpers/console.py
index 4ec1b8ed2..657a5d447 100644
--- a/packages/cli/src/repowise/cli/_helpers/console.py
+++ b/packages/cli/src/repowise/cli/_helpers/console.py
@@ -11,12 +11,32 @@ import click
from rich.console import Console
from repowise.cli.output import resolve_console_width
+from repowise.cli.ui.brand import THEME
+from repowise.cli.ui.glyphs import ascii_only
+
+
+class _CliConsole(Console):
+ """The CLI console: the brand theme, and ASCII where the terminal needs it.
+
+ Stdout is reconfigured to UTF-8 at import, so Rich would always see UTF-8
+ and draw Unicode boxes, bars and rules. Reporting the terminal's own
+ encoding instead lets Rich pick its ASCII forms exactly when the glyph
+ module does. A console pointed at another file keeps that file's encoding.
+ Both streams follow stdout's encoding: one choice per run keeps them consistent.
+ """
+
+ @property
+ def encoding(self) -> str:
+ if self._file is None and ascii_only():
+ return "ascii"
+ return super().encoding
+
# Width is pinned only when the stream is not a terminal — see
# `output.resolve_console_width`. Without it rich renders a pipe at 80 columns
# and ellipsises the very paths an agent needs to act on.
-console = Console(width=resolve_console_width(sys.stdout))
-err_console = Console(stderr=True, width=resolve_console_width(sys.stderr))
+console = _CliConsole(theme=THEME, width=resolve_console_width(sys.stdout))
+err_console = _CliConsole(theme=THEME, stderr=True, width=resolve_console_width(sys.stderr))
def warn(text: str) -> None:
diff --git a/packages/cli/src/repowise/cli/_stdio.py b/packages/cli/src/repowise/cli/_stdio.py
index d825b98c3..449f57cd2 100644
--- a/packages/cli/src/repowise/cli/_stdio.py
+++ b/packages/cli/src/repowise/cli/_stdio.py
@@ -11,6 +11,15 @@ import contextlib
import sys
from typing import IO
+#: What stdout could carry before it was reconfigured: the terminal's real
+#: encoding, which decides whether glyphs print as Unicode or ASCII.
+_original_stdout_encoding: str | None = None
+
+
+def original_stdout_encoding() -> str | None:
+ """Stdout's encoding as the process found it, before the UTF-8 reconfigure."""
+ return _original_stdout_encoding
+
def _ensure_utf8_stdio() -> None:
"""Reconfigure ``sys.stdout``/``sys.stderr`` to UTF-8 with replacement.
@@ -32,6 +41,8 @@ def _ensure_utf8_stdio() -> None:
silently tolerant of any reconfigure failure — the original behavior
is preserved in that case rather than masked by an exception.
"""
+ global _original_stdout_encoding
+ _original_stdout_encoding = getattr(sys.stdout, "encoding", None)
for stream in (sys.stdout, sys.stderr):
_reconfigure(stream)
diff --git a/packages/cli/src/repowise/cli/commands/init_cmd/_exit.py b/packages/cli/src/repowise/cli/commands/init_cmd/_exit.py
index b74a88344..95b406ac3 100644
--- a/packages/cli/src/repowise/cli/commands/init_cmd/_exit.py
+++ b/packages/cli/src/repowise/cli/commands/init_cmd/_exit.py
@@ -20,11 +20,13 @@ COST_UNCONFIRMED_KEPT = f"documentation kept as it was, {_NO_TERMINAL}"
def exit_interrupted() -> NoReturn:
"""Ctrl-C at any point: one line, then the shell's interrupt code."""
from repowise.cli.hints import maybe_hint
- from repowise.cli.ui.mascot import EYES_SLEEPY, mini
+ from repowise.cli.ui import mascot
+ console.print()
console.print(
- f"\n{mini(EYES_SLEEPY)} [{WARN}]Interrupted.[/] "
- "Run [bold]repowise init --resume[/] to continue."
+ mascot.mini_text(mascot.INTERRUPTED),
+ f"[{WARN}]Interrupted.[/] Indexed work so far is saved. Run "
+ "[bold]repowise init --resume[/] to continue where it stopped.",
)
maybe_hint("interrupt")
raise SystemExit(EXIT_INTERRUPTED)
diff --git a/packages/cli/src/repowise/cli/commands/init_cmd/_finish.py b/packages/cli/src/repowise/cli/commands/init_cmd/_finish.py
index e0ccb3215..755f40a91 100644
--- a/packages/cli/src/repowise/cli/commands/init_cmd/_finish.py
+++ b/packages/cli/src/repowise/cli/commands/init_cmd/_finish.py
@@ -20,7 +20,8 @@ from repowise.cli.helpers import (
save_state,
)
from repowise.cli.state_persistence import build_kg_state, save_knowledge_graph_json
-from repowise.cli.ui import OK, print_stage, progress_steps
+from repowise.cli.ui import OK, mascot, print_stage, progress_steps
+from repowise.cli.ui.glyphs import glyph
from repowise.core.analysis.health import HEALTH_ANALYZER_VERSION
from repowise.core.analysis.security_scan import SECURITY_SCANNER_VERSION
from repowise.core.decision_lanes import record_decision_lanes
@@ -75,7 +76,7 @@ def catch_up_savings(repo_path: Path) -> None:
return
if outcome.recorded:
console.print(
- f" [{OK}]✓[/] Recovered {outcome.saved_input_tokens:,} saved tokens "
+ f" [{OK}]{glyph('ok')}[/] Recovered {outcome.saved_input_tokens:,} saved tokens "
f"from agent history"
)
@@ -468,24 +469,40 @@ def complete_setup(run: InitRun) -> None:
setup=setup_outcome,
files_written=files_written,
verbose=opts.verbose,
+ owl=_finish_owl(run),
)
-def exit_with_gaps(run: InitRun) -> None:
- """Exit degraded when the run left a gap; last, so everything else is kept."""
- from repowise.cli.agent_events import active
+def _gaps(run: InitRun) -> list[str]:
+ """Everything the run was asked for and did not get; non-empty means exit 2."""
from repowise.cli.providers import embed_failure_message
- from ._agent_summary import run_summary
- from ._exit import exit_on_gaps, run_gaps
+ from ._exit import run_gaps
result = run.result
- gaps = run.gaps + run_gaps(
+ return run.gaps + run_gaps(
failed_pages=len(getattr(result, "failed_page_ids", None) or []),
embed_error=embed_failure_message(
run.scope_embedder, getattr(result, "embed_failed_pages", 0)
),
)
+
+
+def _finish_owl(run: InitRun) -> str:
+ """Failed when the run is about to exit non-zero, warn when it degraded, else done."""
+ if _gaps(run):
+ return mascot.FAILED
+ return mascot.WARNED if run.run_warnings else mascot.DONE
+
+
+def exit_with_gaps(run: InitRun) -> None:
+ """Exit degraded when the run left a gap; last, so everything else is kept."""
+ from repowise.cli.agent_events import active
+
+ from ._agent_summary import run_summary
+ from ._exit import exit_on_gaps
+
+ gaps = _gaps(run)
events = active()
if events is not None:
events.summary(run_summary(run, gaps))
diff --git a/packages/cli/src/repowise/cli/commands/init_cmd/_generate.py b/packages/cli/src/repowise/cli/commands/init_cmd/_generate.py
index a287b9ac1..51c48335a 100644
--- a/packages/cli/src/repowise/cli/commands/init_cmd/_generate.py
+++ b/packages/cli/src/repowise/cli/commands/init_cmd/_generate.py
@@ -69,7 +69,7 @@ def _print_structural_plan(
)
table = Table(title="Generation Plan (dry run)", border_style=BRAND)
- table.add_column("Pages", style="cyan")
+ table.add_column("Pages", style=VALUE)
table.add_column("Count", justify="right")
total = 0
for plan in plans:
@@ -185,7 +185,7 @@ def _print_generation_plan(
# "Written by" answers the question the price below raises: most of this
# total is free.
table = Table(title="Generation Plan", border_style=BRAND)
- table.add_column("Pages", style="cyan")
+ table.add_column("Pages", style=VALUE)
table.add_column("Count", justify="right")
table.add_column("Written by")
model_pages = 0
diff --git a/packages/cli/src/repowise/cli/commands/init_cmd/_interactive.py b/packages/cli/src/repowise/cli/commands/init_cmd/_interactive.py
index d12e4ab80..245fc203a 100644
--- a/packages/cli/src/repowise/cli/commands/init_cmd/_interactive.py
+++ b/packages/cli/src/repowise/cli/commands/init_cmd/_interactive.py
@@ -9,6 +9,7 @@ from typing import Any
import click
from repowise.cli.ui.brand import OK, WARN
+from repowise.cli.ui.glyphs import glyph
def offer_distill_rewrite_hook(
@@ -110,7 +111,7 @@ def offer_distill_rewrite_hook(
if flag:
path = adapter.install_rewrite_hook()
if path:
- console_obj.print(f" [{OK}]✓[/] Rewrite hook installed ({path})")
+ console_obj.print(f" [{OK}]{glyph('ok')}[/] Rewrite hook installed ({path})")
else:
console_obj.print(f" [{WARN}]Rewrite hook install failed.[/]")
else:
@@ -246,7 +247,7 @@ def _install_hook(console_obj: Any, repo_path: Path, label: str) -> bool:
if result.startswith("not "):
console_obj.print(f" [dim]{label}: no post-commit hook, {result}.[/dim]")
return False
- console_obj.print(f" [{OK}]✓[/] {label}: post-commit hook {result}")
+ console_obj.print(f" [{OK}]{glyph('ok')}[/] {label}: post-commit hook {result}")
return True
diff --git a/packages/cli/src/repowise/cli/commands/init_cmd/_provider.py b/packages/cli/src/repowise/cli/commands/init_cmd/_provider.py
index 0cb9d12d0..58f1c4097 100644
--- a/packages/cli/src/repowise/cli/commands/init_cmd/_provider.py
+++ b/packages/cli/src/repowise/cli/commands/init_cmd/_provider.py
@@ -10,7 +10,9 @@ import click
from repowise.cli.errors import reasoned_error
from repowise.cli.helpers import console, resolve_explicit_provider_or_prompt, run_async
from repowise.cli.providers import resolve_embedder_choice, template_run_embedder
-from repowise.cli.ui import OK, OWL_SPINNER, VALUE, WARN
+from repowise.cli.ui import MODEL, OK, VALUE, WARN
+from repowise.cli.ui.glyphs import glyph
+from repowise.cli.ui.mascot import owl_status
from repowise.cli.ui.mode_names import BUILT_FROM_CODE, INDEX_ONLY, model_name, written_by
from ._options import InitRun
@@ -110,7 +112,7 @@ def _print_provider_summary(run: InitRun) -> None:
if provider is not None:
shown = model_name(provider.provider_name, provider.model_name)
console.print(
- f" Provider: [{VALUE}]{provider.provider_name}[/] / Model: [{VALUE}]{shown}[/]"
+ f" Provider: [{VALUE}]{provider.provider_name}[/] / Model: [{MODEL}]{shown}[/]"
)
console.print(f" Embedder: [{VALUE}]{_stated_embedder(run)}[/]")
if run.language != "en":
@@ -136,7 +138,7 @@ def _verify_provider(provider: Any, reasoning: str) -> None:
"""One tiny generate call, so a bad key fails before the index is built."""
from repowise.core.providers.llm.base import ProviderError
- with console.status(" Verifying provider connection…", spinner=OWL_SPINNER):
+ with owl_status(console, f" Verifying provider connection{glyph('ellipsis')}"):
try:
run_async(
provider.generate(
@@ -154,7 +156,7 @@ def _verify_provider(provider: Any, reasoning: str) -> None:
f"Provider validation failed: {exc}",
reason="provider_validation_failed",
) from exc
- console.print(f" [{OK}]✓[/] Provider connection verified")
+ console.print(f" [{OK}]{glyph('ok')}[/] Provider connection verified")
def resolve_docs_provider(run: InitRun) -> None:
diff --git a/packages/cli/src/repowise/cli/commands/init_cmd/_questions.py b/packages/cli/src/repowise/cli/commands/init_cmd/_questions.py
index 5b6848150..e0b11c3d0 100644
--- a/packages/cli/src/repowise/cli/commands/init_cmd/_questions.py
+++ b/packages/cli/src/repowise/cli/commands/init_cmd/_questions.py
@@ -6,7 +6,9 @@ from dataclasses import replace
from typing import Any
from repowise.cli.helpers import console
-from repowise.cli.ui import OWL_SPINNER, print_banner, quick_repo_scan
+from repowise.cli.ui import print_banner, quick_repo_scan
+from repowise.cli.ui.glyphs import glyph
+from repowise.cli.ui.mascot import owl_status
from ._options import InitRun
@@ -55,6 +57,6 @@ def _ask_questions(run: InitRun) -> None:
from ._plan import run_plan_screen
print_banner(console)
- with console.status(" Scanning repository…", spinner=OWL_SPINNER):
+ with owl_status(console, f" Scanning repository{glyph('ellipsis')}"):
scan_info = quick_repo_scan(run.repo_path)
run_plan_screen(run, scan_info)
diff --git a/packages/cli/src/repowise/cli/commands/init_cmd/_workspace_config.py b/packages/cli/src/repowise/cli/commands/init_cmd/_workspace_config.py
index 9ef6af8b4..f3e6d5d2c 100644
--- a/packages/cli/src/repowise/cli/commands/init_cmd/_workspace_config.py
+++ b/packages/cli/src/repowise/cli/commands/init_cmd/_workspace_config.py
@@ -19,6 +19,7 @@ from rich.console import Console
from rich.markup import escape
from repowise.cli.ui import OK, WARN
+from repowise.cli.ui.glyphs import glyph
from repowise.core.ci.markdown import plural
_NAMES_SHOWN = 5
@@ -163,7 +164,7 @@ def _confirm_replace(console: Console, left_out: list[Any], picked: int) -> bool
def _report_kept(console: Console, kept: list[Any], clashed: list[Any], gone: list[Any]) -> None:
if kept:
console.print(
- f" [{OK}]✓[/] Kept {plural(len(kept), 'existing repo')} in the workspace "
+ f" [{OK}]{glyph('ok')}[/] Kept {plural(len(kept), 'existing repo')} in the workspace "
f"({_names(kept)}). Remove one with `repowise workspace remove <alias>`."
)
if clashed:
diff --git a/packages/cli/src/repowise/cli/commands/init_cmd/_workspace_plan.py b/packages/cli/src/repowise/cli/commands/init_cmd/_workspace_plan.py
index 7eae26d3d..10e4ba777 100644
--- a/packages/cli/src/repowise/cli/commands/init_cmd/_workspace_plan.py
+++ b/packages/cli/src/repowise/cli/commands/init_cmd/_workspace_plan.py
@@ -10,12 +10,13 @@ import click
from repowise.cli.helpers import console, load_config
from repowise.cli.providers import resolve_embedder
from repowise.cli.ui import (
- OWL_SPINNER,
agent_providers_set_up,
interactive_advanced_config,
interactive_provider_config_select,
quick_repo_scan,
)
+from repowise.cli.ui.glyphs import glyph
+from repowise.cli.ui.mascot import owl_status
from repowise.cli.ui.plan_screen import (
EDIT,
MODEL,
@@ -229,7 +230,7 @@ def run_workspace_plan_screen(
from repowise.cli.ui.provider_selection import _detect_provider_status
repos = list(scan.repos)
- with console.status(" Scanning repositories…", spinner=OWL_SPINNER):
+ with owl_status(console, f" Scanning repositories{glyph('ellipsis')}"):
rows = [WorkspaceRepo(repo, quick_repo_scan(repo.path)) for repo in repos]
with console.status(" Checking for a model…"):
detected = _detect_provider_status(repos[0].path)
diff --git a/packages/cli/src/repowise/cli/commands/init_cmd/generation.py b/packages/cli/src/repowise/cli/commands/init_cmd/generation.py
index 4f13bd096..72b87f1a0 100644
--- a/packages/cli/src/repowise/cli/commands/init_cmd/generation.py
+++ b/packages/cli/src/repowise/cli/commands/init_cmd/generation.py
@@ -40,10 +40,11 @@ from repowise.cli.providers import (
)
from repowise.cli.ui import (
OK,
- OWL_SPINNER,
WARN,
progress_steps,
)
+from repowise.cli.ui.glyphs import glyph
+from repowise.cli.ui.mascot import owl_status
from repowise.core.generation.models import (
STUB_FALLBACK_ERROR,
count_stub_fallbacks,
@@ -242,12 +243,12 @@ def _enrich_knowledge_graph(
result.knowledge_graph_result = _run()
return
- with console.status(" Enriching knowledge graph (layers + tour)…", spinner=OWL_SPINNER):
+ with owl_status(console, f" Enriching knowledge graph (layers + tour){glyph('ellipsis')}"):
try:
result.knowledge_graph_result = _run()
enriched = result.knowledge_graph_result
console.print(
- f" [{OK}]✓[/] KG enriched: "
+ f" [{OK}]{glyph('ok')}[/] KG enriched: "
f"{len(enriched.layers)} layers, {len(enriched.tour)} tour steps"
)
except Exception as exc:
@@ -430,12 +431,12 @@ def run_repo_generation(
if failed_page_ids:
type_counts = Counter(pid.split(":")[0] for pid in failed_page_ids)
console.print(
- f" [{WARN}]⚠[/] Generated [bold]{written_count}[/bold] pages "
- f"([bold yellow]{len(failed_page_ids)} failed[/bold yellow])\n"
+ f" [{WARN}]{glyph('warn')}[/] Generated [bold]{written_count}[/bold] pages "
+ f"([bold][{WARN}]{len(failed_page_ids)} failed[/][/bold])\n"
)
- console.print(" [bold yellow]Failed pages by type:[/bold yellow]")
+ console.print(f" [bold][{WARN}]Failed pages by type:[/][/bold]")
for page_type, count in sorted(type_counts.items(), key=lambda x: -x[1]):
- console.print(f" • {page_type}: {count}")
+ console.print(f" {glyph('bullet')} {page_type}: {count}")
# Saying only "missing" sends the user looking for absent pages and
# finding present ones, which reads as the report being wrong. Most
# failures leave a placeholder behind; --resume replaces those too,
diff --git a/packages/cli/src/repowise/cli/commands/init_cmd/reporting.py b/packages/cli/src/repowise/cli/commands/init_cmd/reporting.py
index f71c13339..dba7ed7e4 100644
--- a/packages/cli/src/repowise/cli/commands/init_cmd/reporting.py
+++ b/packages/cli/src/repowise/cli/commands/init_cmd/reporting.py
@@ -15,6 +15,7 @@ from repowise.cli.helpers import console, load_config, load_state
from repowise.cli.ui import (
build_contextual_next_steps,
format_elapsed,
+ mascot,
)
from repowise.cli.ui.finish_panel import FinishFacts, print_finish_panel
from repowise.cli.ui.mode_names import pages, provider_model
@@ -108,9 +109,12 @@ def show_completion(
setup: Any = None,
files_written: list[Path] | None = None,
verbose: bool = False,
+ owl: str = mascot.DONE,
) -> list[tuple[str, str]]:
"""Render the one finish panel and return its next steps; generation checks only under ``-v``.
+ *owl* is the mini owl state on the panel title: how the run finished.
+
*setup* is the :class:`~repowise.cli.editor_setup.EditorSetupOutcome`
snapshot and *files_written* what editor setup put in the working tree,
so the panel reports what setup actually did.
@@ -162,6 +166,7 @@ def show_completion(
setup=setup,
repo_path=Path(repo_path),
files_written=files_written,
+ owl=owl,
)
console.print()
_render_defect_accuracy(result)
@@ -259,5 +264,7 @@ def show_workspace_completion(
else provider_model(provider.provider_name, provider.model_name),
)
console.print()
- print_workspace_finish_panel(console, facts, setup=setup)
+ print_workspace_finish_panel(
+ console, facts, setup=setup, owl=mascot.WARNED if errors else mascot.DONE
+ )
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.py
index bae5b328d..2b14b8c4b 100644
--- a/packages/cli/src/repowise/cli/commands/init_cmd/workspace.py
+++ b/packages/cli/src/repowise/cli/commands/init_cmd/workspace.py
@@ -60,6 +60,7 @@ from repowise.cli.ui import (
print_banner,
progress_steps,
)
+from repowise.cli.ui.glyphs import glyph
from repowise.cli.ui.mode_names import pages
from repowise.core.decision_lanes import record_decision_lanes
from repowise.core.docs_mode import docs_mode_state_fields
@@ -350,7 +351,7 @@ def _ingest_and_generate_repo(repo: Any, idx: int, total: int, ctx: _WorkspaceCt
On pipeline failure the outcome carries ``error`` and nothing is persisted.
"""
console.print(
- f" [{BRAND}][{idx}/{total}][/] Indexing [bold]{repo.alias}[/bold] ({repo.path.name})…"
+ f" [{BRAND}][{idx}/{total}][/] Indexing [bold]{repo.alias}[/bold] ({repo.path.name}){glyph('ellipsis')}"
)
ensure_repowise_dir(repo.path)
@@ -362,7 +363,7 @@ def _ingest_and_generate_repo(repo: Any, idx: int, total: int, ctx: _WorkspaceCt
try:
index = _index_repo(repo, ctx, repo_provider)
except Exception as exc:
- console.print(f" [{ERR}]✗ Failed: {exc}[/]\n")
+ console.print(f" [{ERR}]{glyph('fail')} Failed: {exc}[/]\n")
return _RepoOutcome(error=str(exc))
result = index.result
@@ -450,7 +451,7 @@ def _index_repo(repo: Any, ctx: _WorkspaceCtx, repo_provider: Any) -> _RepoIndex
generation_config=structural_generation_config(ctx.index_only),
)
)
- console.print(f" [{OK}]✓[/] {result.file_count:,} files, {result.symbol_count:,} symbols")
+ console.print(f" [{OK}]{glyph('ok')}[/] {result.file_count:,} files, {result.symbol_count:,} symbols")
return _RepoIndex(result=result, callback=callback, provider=repo_provider)
@@ -507,7 +508,7 @@ def _generate_repo_with_model(
docs.pages_generated = len(generated_pages) - count_stub_fallbacks(generated_pages)
docs.docs_mode = "llm"
- console.print(f" [{OK}]✓[/] Wrote {pages(docs.pages_generated)} with the model\n")
+ console.print(f" [{OK}]{glyph('ok')}[/] Wrote {pages(docs.pages_generated)} with the model\n")
except CostGateDeclined:
# Declining only meant "not at that price": fall back to the free
# template renderer rather than leave the repo with no wiki.
@@ -520,7 +521,7 @@ def _generate_repo_with_model(
)
_render_repo_from_templates(repo, ctx, index, docs)
except Exception as gen_exc:
- console.print(f" [{ERR}]✗ Generation failed: {gen_exc}[/]\n")
+ console.print(f" [{ERR}]{glyph('fail')} Generation failed: {gen_exc}[/]\n")
docs.skip_reason = f"generation error: {gen_exc}"
ctx.gaps.append(f"{repo.alias}: documentation not written ({gen_exc})")
result.generated_pages = []
@@ -546,7 +547,7 @@ def _render_repo_from_templates(
docs.pages_generated = len(generated_pages)
docs.docs_mode = "deterministic"
console.print(
- f" [{OK}]✓[/] Built {pages(len(generated_pages))} from code (no model)\n"
+ f" [{OK}]{glyph('ok')}[/] Built {pages(len(generated_pages))} from code (no model)\n"
)
@@ -732,9 +733,9 @@ def _run_cross_repo_analysis(ws_config: Any, root: Any, selected: list[Any], err
from repowise.core.workspace.update import run_cross_repo_hooks
run_async(run_cross_repo_hooks(ws_config, root, indexed_aliases))
- console.print(f" [{OK}]✓[/] Cross-repo analysis complete")
+ console.print(f" [{OK}]{glyph('ok')}[/] Cross-repo analysis complete")
except Exception as exc:
- console.print(f" [{WARN}]⚠ Cross-repo analysis failed: {exc}[/]")
+ console.print(f" [{WARN}]{glyph('warn')} Cross-repo analysis failed: {exc}[/]")
@dataclass
@@ -797,7 +798,7 @@ def _workspace_init(
start = time.monotonic()
root = scan.root
- print_banner(console, repo_name=f"Workspace: {root.name}")
+ print_banner(console, repo_name=root.name, workspace=True)
answers = WorkspaceAnswers(
index_only=index_only,
@@ -1089,7 +1090,7 @@ def _workspace_config(pick: WorkspacePick, *, ask: bool, dry_run: bool) -> Any:
)
else:
config_path = ws_config.save(root)
- console.print(f" [{OK}]✓[/] {verb} {config_path.name}")
+ console.print(f" [{OK}]{glyph('ok')}[/] {verb} {config_path.name}")
console.print()
return ws_config
diff --git a/packages/cli/src/repowise/cli/editor_integrations/claude.py b/packages/cli/src/repowise/cli/editor_integrations/claude.py
index 8867eb9b8..339f82f93 100644
--- a/packages/cli/src/repowise/cli/editor_integrations/claude.py
+++ b/packages/cli/src/repowise/cli/editor_integrations/claude.py
@@ -8,6 +8,7 @@ from typing import Any
from repowise.cli.agent_targets.targets import claude_code as claude_target
from repowise.cli.editor_setup import EditorSetupOptions
from repowise.cli.helpers import get_db_url_for_repo, load_config, run_async
+from repowise.cli.ui.glyphs import glyph
class ClaudeCodeSetup:
@@ -54,16 +55,16 @@ class ClaudeCodeSetup:
# repoint the single global "repowise" entry.
desktop = register_with_claude_desktop(repo_path)
if desktop:
- console_obj.print(f" [{OK}]✓[/] Claude Desktop MCP registered ({desktop})")
+ console_obj.print(f" [{OK}]{glyph('ok')}[/] Claude Desktop MCP registered ({desktop})")
code = register_with_claude_code(repo_path)
if code:
- console_obj.print(f" [{OK}]✓[/] Claude Code MCP registered ({code})")
+ console_obj.print(f" [{OK}]{glyph('ok')}[/] Claude Code MCP registered ({code})")
hooks = install_claude_code_hooks()
if hooks:
console_obj.print(
- f" [{OK}]✓[/] Claude Code hooks registered (PostToolUse, SessionStart)"
+ f" [{OK}]{glyph('ok')}[/] Claude Code hooks registered (PostToolUse, SessionStart)"
)
if _uses_lean_tool_surface(repo_path):
@@ -73,7 +74,7 @@ class ClaudeCodeSetup:
)
elif enable_tool_search_in_claude_code():
console_obj.print(
- f" [{OK}]✓[/] Claude Code tool-search enabled (defers MCP tool schemas)"
+ f" [{OK}]{glyph('ok')}[/] Claude Code tool-search enabled (defers MCP tool schemas)"
)
def refresh_project_files(
@@ -153,11 +154,11 @@ def maybe_generate_claude_md(
if not _claude_md_enabled(repo_path):
return None
- from repowise.cli.ui import OWL_SPINNER
from repowise.cli.ui.brand import OK, WARN
+ from repowise.cli.ui.mascot import owl_status
try:
- with console_obj.status(" Generating .claude/CLAUDE.md…", spinner=OWL_SPINNER):
+ with owl_status(console_obj, f" Generating .claude/CLAUDE.md{glyph('ellipsis')}"):
written = run_async(_write_claude_md_async(repo_path))
except Exception as exc:
console_obj.print(f" [{WARN}].claude/CLAUDE.md skipped: {exc}[/]")
@@ -168,7 +169,7 @@ def maybe_generate_claude_md(
# is how a run could print no error and produce no file.
console_obj.print(f" [{WARN}].claude/CLAUDE.md skipped: repo not indexed yet[/]")
return None
- console_obj.print(f" [{OK}]✓[/] .claude/CLAUDE.md updated")
+ console_obj.print(f" [{OK}]{glyph('ok')}[/] .claude/CLAUDE.md updated")
return written
diff --git a/packages/cli/src/repowise/cli/editor_integrations/codex.py b/packages/cli/src/repowise/cli/editor_integrations/codex.py
index 73c4c6787..db912bf70 100644
--- a/packages/cli/src/repowise/cli/editor_integrations/codex.py
+++ b/packages/cli/src/repowise/cli/editor_integrations/codex.py
@@ -7,6 +7,7 @@ from typing import Any
from repowise.cli.agent_targets.targets import codex as codex_target
from repowise.cli.editor_setup import EditorSetupOptions
+from repowise.cli.ui.glyphs import glyph
class CodexSetup:
@@ -53,9 +54,9 @@ class CodexSetup:
logged_in = is_codex_logged_in() if installed else False
config_path = save_codex_mcp_config(repo_path)
- console_obj.print(f" [{OK}]✓[/] Codex MCP registered ({config_path})")
+ console_obj.print(f" [{OK}]{glyph('ok')}[/] Codex MCP registered ({config_path})")
hooks_path = save_codex_hooks_config(repo_path)
- console_obj.print(f" [{OK}]✓[/] Codex hooks registered ({hooks_path})")
+ console_obj.print(f" [{OK}]{glyph('ok')}[/] Codex hooks registered ({hooks_path})")
written = [Path(config_path), Path(hooks_path)]
if not agents_disabled:
agents_path = maybe_generate_agents_md(
@@ -115,8 +116,8 @@ def maybe_generate_agents_md(
from repowise.cli.editor_files import should_generate_editor_file
from repowise.cli.helpers import run_async
- from repowise.cli.ui import OWL_SPINNER
from repowise.cli.ui.brand import OK, WARN
+ from repowise.cli.ui.mascot import owl_status
if not should_generate_editor_file(
repo_path,
@@ -126,9 +127,9 @@ def maybe_generate_agents_md(
):
return None
try:
- with console_obj.status(" Generating AGENTS.md…", spinner=OWL_SPINNER):
+ with owl_status(console_obj, f" Generating AGENTS.md{glyph('ellipsis')}"):
run_async(_write_agents_md_async(repo_path))
- console_obj.print(f" [{OK}]✓[/] AGENTS.md updated")
+ console_obj.print(f" [{OK}]{glyph('ok')}[/] AGENTS.md updated")
except Exception as exc:
console_obj.print(f" [{WARN}]AGENTS.md skipped: {exc}[/]")
return None
diff --git a/packages/cli/src/repowise/cli/editor_integrations/vscode.py b/packages/cli/src/repowise/cli/editor_integrations/vscode.py
index 0a4991cfb..d64c2fc49 100644
--- a/packages/cli/src/repowise/cli/editor_integrations/vscode.py
+++ b/packages/cli/src/repowise/cli/editor_integrations/vscode.py
@@ -8,6 +8,7 @@ from typing import Any
from repowise.cli.agent_targets.targets import vscode as vscode_target
from repowise.cli.agent_targets.types import FileAction
from repowise.cli.editor_setup import EditorSetupOptions
+from repowise.cli.ui.glyphs import glyph
class VSCodeSetup:
@@ -71,7 +72,7 @@ def _write_vscode_files(console_obj: Any, repo_path: Path) -> list[Path]:
written: list[Path] = []
try:
mcp_path = save_vscode_mcp_config(repo_path)
- console_obj.print(f" [{OK}]✓[/] VS Code MCP configured ({mcp_path})")
+ console_obj.print(f" [{OK}]{glyph('ok')}[/] VS Code MCP configured ({mcp_path})")
written.append(Path(mcp_path))
except ValueError:
console_obj.print(
@@ -81,7 +82,7 @@ def _write_vscode_files(console_obj: Any, repo_path: Path) -> list[Path]:
try:
ext_path = save_vscode_extensions_config(repo_path)
- console_obj.print(f" [{OK}]✓[/] VS Code extension recommended ({ext_path})")
+ console_obj.print(f" [{OK}]{glyph('ok')}[/] VS Code extension recommended ({ext_path})")
written.append(Path(ext_path))
except ValueError:
console_obj.print(
@@ -101,6 +102,6 @@ def _write_vscode_files(console_obj: Any, repo_path: Path) -> list[Path]:
"markers are unpaired or duplicated, or it could not be read.[/]"
)
else:
- console_obj.print(f" [{OK}]✓[/] Copilot instructions updated ({instructions.path})")
+ console_obj.print(f" [{OK}]{glyph('ok')}[/] Copilot instructions updated ({instructions.path})")
written.append(instructions.path)
return written
diff --git a/packages/cli/src/repowise/cli/ui/__init__.py b/packages/cli/src/repowise/cli/ui/__init__.py
index a2909d724..227a40d86 100644
--- a/packages/cli/src/repowise/cli/ui/__init__.py
+++ b/packages/cli/src/repowise/cli/ui/__init__.py
@@ -27,9 +27,11 @@ _LAZY: dict[str, str] = {
"BRAND_STYLE": "brand",
"DIM": "brand",
"ERR": "brand",
+ "INFO": "brand",
"LARGE_REPO_FILE_THRESHOLD": "mode_selection",
+ "MODEL": "brand",
"OK": "brand",
- "OWL_SPINNER": "mascot",
+ "THEME": "brand",
"THINKING_FRAMES": "mascot",
"VALUE": "brand",
"WARN": "brand",
@@ -55,6 +57,7 @@ _LAZY: dict[str, str] = {
"make_progress": "progress_display",
"mini": "mascot",
"model_call_count": "subscription",
+ "owl_status": "mascot",
"print_banner": "brand",
"print_completion_panel": "result_panels",
"print_phase_header": "brand",
diff --git a/packages/cli/src/repowise/cli/ui/brand.py b/packages/cli/src/repowise/cli/ui/brand.py
index 07da8d425..24bfb3c3c 100644
--- a/packages/cli/src/repowise/cli/ui/brand.py
+++ b/packages/cli/src/repowise/cli/ui/brand.py
@@ -12,10 +12,10 @@ caller because each one had two or three near-copies before it did:
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.
+The colour vocabulary is the style names in :data:`THEME` and no more. Init
+markup names a style (``[warn]``, ``[ok]``), never a colour, so the palette is
+changed here and only here. A machine-produced token (a model id, an env var,
+a language code) takes ``VALUE``: the face carries that distinction, not a hue.
"""
from __future__ import annotations
@@ -26,52 +26,80 @@ from rich.console import Console
from rich.markup import escape
from rich.rule import Rule
from rich.table import Table
+from rich.theme import Theme
+
+from repowise.cli.ui.glyphs import ascii_only, for_terminal, glyph
# ---------------------------------------------------------------------------
# Brand / theme
# ---------------------------------------------------------------------------
-BRAND = "#F59520"
-BRAND_STYLE = f"bold {BRAND}"
-DIM = "dim"
-OK = "green"
-WARN = "yellow"
-ERR = "bold red"
+BRAND_HEX = "#F59520"
+#: The logo stroke colour on dark surfaces; the owl's strokes.
+CREAM_HEX = "#FCE9DD"
+#: The design language's violet for optional model work.
+MODEL_HEX = "#A98FC4"
+# Style names, registered on the CLI console by :data:`THEME`. Markup uses
+# these, never a raw colour.
+BRAND = "brand"
+BRAND_STYLE = "brand.bold"
+DIM = "dim"
+OK = "ok"
+WARN = "warn"
+ERR = "err"
+INFO = "info"
+MODEL = "model"
#: 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
+#: 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"
+VALUE = "value"
+OWL = "owl"
+
+# ok / warn / err stay ANSI names so they follow the terminal's own palette,
+# which keeps them readable on light and dark backgrounds alike.
+THEME = Theme(
+ {
+ BRAND: BRAND_HEX,
+ BRAND_STYLE: f"bold {BRAND_HEX}",
+ DIM: "dim",
+ OK: "green",
+ WARN: "yellow",
+ ERR: "bold red",
+ INFO: "default",
+ MODEL: MODEL_HEX,
+ VALUE: "bold",
+ OWL: f"bold {CREAM_HEX}",
+ }
+)
# ---------------------------------------------------------------------------
# Banner — owl mascot + wordmark (art lives in ui/mascot.py)
# ---------------------------------------------------------------------------
-# Breathing room required beyond the rendered banner width before we pick the
-# long tagline; below that we use the short one.
-_BANNER_WIDTH_MARGIN = 4
+# Breathing room beyond the banner's own width (53 columns) before it is drawn,
+# so it needs 60; below that the one-line header stands in.
+_BANNER_WIDTH_MARGIN = 7
+
+def print_banner(console: Console, repo_name: str | None = None, *, workspace: bool = False) -> None:
+ """Print the owl banner, or the one-line header when the art cannot show, then the repo.
-def print_banner(console: Console, repo_name: str | None = None) -> None:
- """Print the repowise owl banner, tagline, and optional repo name."""
+ *repo_name* is a bare name; *workspace* labels it ``Workspace:`` instead of ``Repository:``.
+ """
from repowise.cli import __version__
from repowise.cli.ui import mascot
- narrow = console.width < mascot.banner_width() + _BANNER_WIDTH_MARGIN
- console.print()
- console.print(mascot.banner_text())
console.print()
- if narrow:
- console.print(f" [dim]codebase intelligence · v{__version__}[/dim]", highlight=False)
+ if ascii_only() or console.width < mascot.banner_width() + _BANNER_WIDTH_MARGIN:
+ console.print(mascot.header_text(__version__, console.width), highlight=False)
else:
- console.print(
- f" [dim]codebase intelligence for developers and AI · v{__version__}[/dim]",
- highlight=False,
- )
+ console.print(mascot.banner_text(__version__), highlight=False)
if repo_name:
console.print()
- console.print(f" Repository: [bold]{escape(repo_name)}[/bold]", highlight=False)
+ label = "Workspace" if workspace else "Repository"
+ console.print(f" {label}: [bold]{escape(repo_name)}[/bold]", highlight=False)
console.print()
@@ -86,7 +114,7 @@ def print_phase_header(
console.print()
console.print(
Rule(
- f"[{BRAND}]Phase {num} of {total}[/] · [bold]{title}[/bold]",
+ f"[{BRAND}]Phase {num} of {total}[/] {glyph('sep')} [bold]{title}[/bold]",
style=DIM,
)
)
@@ -135,7 +163,7 @@ def key_value_table(
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)
+ table.add_row(for_terminal(label), for_terminal(value))
return table
diff --git a/packages/cli/src/repowise/cli/ui/checklist.py b/packages/cli/src/repowise/cli/ui/checklist.py
index dc1acb605..ab13d2f7f 100644
--- a/packages/cli/src/repowise/cli/ui/checklist.py
+++ b/packages/cli/src/repowise/cli/ui/checklist.py
@@ -3,8 +3,9 @@
Pure formatting, no live display: :mod:`repowise.cli.ui.progress_display`
draws the running rows and :class:`~repowise.cli.ui.progress.RichProgressCallback`
prints a done row as each step finishes. Every glyph and style a step state
-uses is in :data:`STATE_MARKS`, so a theme swaps them in one place. Each state
-carries a glyph as well as a colour, so it still reads with colour off.
+uses is in :data:`STATE_MARKS`: the glyph comes from
+:mod:`repowise.cli.ui.glyphs` and the style from the theme. Each state carries a
+glyph as well as a colour, so it still reads with colour off.
"""
from __future__ import annotations
@@ -14,14 +15,15 @@ from dataclasses import dataclass
from rich.markup import escape
from repowise.cli.ui.brand import DIM, OK, format_elapsed
+from repowise.cli.ui.glyphs import GLYPHS, glyph
DONE = "done"
PENDING = "pending"
-#: state -> (glyph, style). The running state is the live spinner row.
+#: state -> (glyph name, style). The running state is the live owl row.
STATE_MARKS: dict[str, tuple[str, str]] = {
- DONE: ("✓", OK),
- PENDING: ("○", DIM),
+ DONE: ("ok", OK),
+ PENDING: ("pending", DIM),
}
#: A step running longer than this gets the long-step line.
@@ -35,17 +37,30 @@ _MIN_RATE_SECONDS = 3.0
_MIN_TOTAL_ITEMS = 20
_MIN_DONE_ITEMS = 5
-_SUBSTEP_PREFIX = "↳"
+_SUBSTEP_PREFIX, _ = GLYPHS["substep"]
+_ELLIPSIS, _ = GLYPHS["ellipsis"]
+
+
+def running_label(raw: str) -> str:
+ """A step label as a running row shows it: its ``↳`` and ``…`` in this terminal's form."""
+ return raw.replace(_SUBSTEP_PREFIX, glyph("substep")).replace(_ELLIPSIS, glyph("ellipsis"))
def split_label(raw: str) -> tuple[str, int]:
- """``" ↳ Resolving imports"`` -> ``("Resolving imports", 1)``; trailing ``…`` dropped."""
+ """``" ↳ Resolving imports"`` -> ``("Resolving imports", 1)``; trailing ``…`` dropped.
+
+ Takes the label in either form, as written or as :func:`running_label` made it.
+ """
text = raw.strip()
depth = 0
- if text.startswith(_SUBSTEP_PREFIX):
- depth = 1
- text = text[len(_SUBSTEP_PREFIX) :].strip()
- return text.rstrip("…").rstrip(), depth
+ for prefix in GLYPHS["substep"]:
+ if text.startswith(prefix):
+ depth = 1
+ text = text[len(prefix) :].strip()
+ break
+ for more in GLYPHS["ellipsis"]:
+ text = text.removesuffix(more)
+ return text.rstrip(), depth
def count_text(completed: float, total: float | None, unit: str) -> str:
@@ -100,13 +115,14 @@ class FinishedStep:
def done_line(step: FinishedStep) -> str:
"""The markup line a finished step leaves behind: `` ✓ Parsing files · 30 files · 0.4s``."""
label, depth = split_label(step.label)
- glyph, style = STATE_MARKS[DONE]
+ name, style = STATE_MARKS[DONE]
indent = " " * (depth + 1)
amount = step.total or step.completed
count = count_text(amount, None, step.unit) if amount else ""
facts = [f for f in (count, format_elapsed(step.elapsed or 0.0)) if f]
- tail = f" [{DIM}]· {' · '.join(facts)}[/]" if facts else ""
- return f"{indent}[{style}]{glyph}[/] {escape(label)}{tail}"
+ sep = glyph("sep")
+ tail = f" [{DIM}]{sep} {f' {sep} '.join(facts)}[/]" if facts else ""
+ return f"{indent}[{style}]{glyph(name)}[/] {escape(label)}{tail}"
def long_step_line(resume_command: str) -> str:
@@ -119,5 +135,6 @@ def long_step_line(resume_command: str) -> str:
def upcoming_line(titles: list[str]) -> str:
"""The stages still to run, e.g. `` ○ Next: Analysis · Generation · Persistence``."""
- glyph, style = STATE_MARKS[PENDING]
- return f" [{style}]{glyph} Next: {escape(' · '.join(titles))}[/]"
+ name, style = STATE_MARKS[PENDING]
+ sep = glyph("sep")
+ return f" [{style}]{glyph(name)} Next: {escape(f' {sep} '.join(titles))}[/]"
diff --git a/packages/cli/src/repowise/cli/ui/finish_panel.py b/packages/cli/src/repowise/cli/ui/finish_panel.py
index 4d1089c21..47ecfb6af 100644
--- a/packages/cli/src/repowise/cli/ui/finish_panel.py
+++ b/packages/cli/src/repowise/cli/ui/finish_panel.py
@@ -16,6 +16,7 @@ from rich.markup import escape
from rich.padding import Padding
from rich.text import Text
+from repowise.cli.ui import mascot
from repowise.cli.ui.brand import BRAND, WARN, key_value_table
from repowise.cli.ui.mode_names import INDEX_ONLY, completion_title, mode_label, scope_line
from repowise.cli.ui.result_panels import build_completion_panel, print_completion_panel
@@ -240,10 +241,16 @@ def build_finish_panel(
setup: Any = None,
repo_path: Path | None = None,
files_written: list[Path] | None = None,
+ owl: str = mascot.DONE,
) -> Any:
- """The init completion panel: counts, Connected, questions, steps, receipt."""
+ """The init completion panel: counts, Connected, questions, steps, receipt.
+
+ *owl* is the title owl's state: how the run finished.
+ """
title, metrics, body, footer = _panel_parts(facts, setup, repo_path, files_written)
- return build_completion_panel(title, metrics, next_steps=steps, body=body, footer=footer)
+ return build_completion_panel(
+ title, metrics, next_steps=steps, body=body, footer=footer, owl=owl
+ )
def print_finish_panel(
@@ -254,10 +261,11 @@ def print_finish_panel(
setup: Any = None,
repo_path: Path | None = None,
files_written: list[Path] | None = None,
+ owl: str = mascot.DONE,
) -> None:
"""The finish panel on a terminal; the same rows as plain lines off one."""
title, metrics, body, footer = _panel_parts(facts, setup, repo_path, files_written)
- print_completion_panel(console, title, metrics, steps, body=body, footer=footer)
+ print_completion_panel(console, title, metrics, steps, body=body, footer=footer, owl=owl)
def _panel_parts(
diff --git a/packages/cli/src/repowise/cli/ui/glyphs.py b/packages/cli/src/repowise/cli/ui/glyphs.py
new file mode 100644
index 000000000..125fb9307
--- /dev/null
+++ b/packages/cli/src/repowise/cli/ui/glyphs.py
@@ -0,0 +1,55 @@
+"""Terminal glyphs, each with an ASCII form for a stream that cannot show Unicode.
+
+The choice follows stdout's encoding as the process found it (see
+:func:`repowise.cli._stdio.original_stdout_encoding`): a UTF encoding gets the
+Unicode glyph, anything else (cp1252, a non-UTF-8 pipe) gets ASCII. The CLI
+reconfigures stdout to UTF-8 at import, so the live encoding always says UTF-8
+and cannot be the signal.
+"""
+
+from __future__ import annotations
+
+from repowise.cli import _stdio
+
+#: name -> (unicode, ascii). Every ASCII form is one column wide unless the
+#: Unicode one is not, so columns line up in both.
+GLYPHS: dict[str, tuple[str, str]] = {
+ "ok": ("✓", "+"),
+ "fail": ("✗", "x"),
+ "warn": ("⚠", "!"),
+ "pending": ("○", "o"),
+ "bullet": ("•", "*"),
+ "substep": ("↳", ">"),
+ "sep": ("·", "-"),
+ "ellipsis": ("…", "..."),
+ "arrow": ("→", "->"),
+}
+
+_TO_ASCII = str.maketrans({unicode: ascii_form for unicode, ascii_form in GLYPHS.values()})
+
+
+def supports_unicode(encoding: str | None) -> bool:
+ """True for a UTF encoding; no encoding at all (a StringIO) counts as UTF-8."""
+ if not encoding:
+ return True
+ return encoding.lower().replace("-", "").replace("_", "").startswith("utf")
+
+
+def ascii_only() -> bool:
+ """Whether this process prints the ASCII forms."""
+ return not supports_unicode(_stdio.original_stdout_encoding())
+
+
+def glyph(name: str) -> str:
+ """The glyph *name* in the form this terminal can show."""
+ unicode, ascii_form = GLYPHS[name]
+ return ascii_form if ascii_only() else unicode
+
+
+def for_terminal(text: str) -> str:
+ """*text* with every known glyph in this terminal's form.
+
+ For text written elsewhere (pipeline messages, readout values), where the
+ glyph is already baked into the string.
+ """
+ return text.translate(_TO_ASCII) if ascii_only() else text
diff --git a/packages/cli/src/repowise/cli/ui/mascot.py b/packages/cli/src/repowise/cli/ui/mascot.py
index 53f63e981..5dfaa1a18 100644
--- a/packages/cli/src/repowise/cli/ui/mascot.py
+++ b/packages/cli/src/repowise/cli/ui/mascot.py
@@ -1,37 +1,27 @@
-"""Owl mascot: banner art, eye states, and the block wordmark.
+"""Owl mascot: banner art, the one-line header, eye states, and the 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.
+wordmark, the mini owl and its states, and the spinner that blinks while
+repowise thinks. All render functions are pure and deterministic.
+
+Colours: owl strokes cream, eyes and wordmark brand orange, tagline dim. The
+wordmark is one colour on purpose: decoration that carries no meaning gets one
+accent, not a ramp.
"""
from __future__ import annotations
-from functools import cache
+from typing import Any
+from rich.console import Console, ConsoleOptions, RenderResult
+from rich.live import Live
from rich.text import Text
-from repowise.cli.ui.brand import BRAND
-
-# ---------------------------------------------------------------------------
-# Palette
-# ---------------------------------------------------------------------------
+from repowise.cli.ui.brand import BRAND_STYLE, DIM
+from repowise.cli.ui.brand import OWL as OWL_STYLE
+from repowise.cli.ui.glyphs import ascii_only, glyph
-WHITE = "#E8E8E8" # owl body strokes (logo white)
+TAGLINE = "codebase intelligence for developers and AI"
# ---------------------------------------------------------------------------
# Owl
@@ -39,112 +29,165 @@ WHITE = "#E8E8E8" # owl body strokes (logo white)
OWL = [
" ,___,",
- " (◉,◉)",
+ " {◉,◉}",
" ( ▼ )",
" /)_(\\",
' " " ',
]
-EYES_IDLE = "◉"
-EYES_SLEEPY = "─" # interrupt message
-EYES_HAPPY = "^" # completion panels
+# The mini owl is the big owl's face line. Its eyes say how the run went, so a
+# state reads with colour off. state -> (unicode eyes, ascii eyes).
+IDLE = "idle"
+BLINK = "blink"
+SHUT = "shut"
+DONE = "done"
+INTERRUPTED = "interrupted"
+WARNED = "warn"
+FAILED = "failed"
+
+EYES: dict[str, tuple[str, str]] = {
+ IDLE: ("◉", "o"),
+ BLINK: ("◒", "o"),
+ SHUT: ("─", "o"),
+ DONE: ("^", "^"),
+ INTERRUPTED: ("─", "-"),
+ WARNED: ("•", "."),
+ FAILED: ("×", "x"),
+}
+
+
+def _eyes(state: str) -> str:
+ unicode, ascii_form = EYES[state]
+ return ascii_form if ascii_only() else unicode
-def mini(eyes: str = EYES_IDLE) -> str:
- """Single-line mini owl face, e.g. ``{◉ ◉}`` — always 5 chars wide."""
- return "{" + eyes + " " + eyes + "}"
+def mini(state: str = IDLE) -> str:
+ """The mini owl face for *state*, e.g. ``{◉,◉}``. Always 5 columns."""
+ eyes = _eyes(state)
+ return f"{{{eyes},{eyes}}}"
+
+
+def mini_text(state: str = IDLE) -> Text:
+ """:func:`mini` with cream strokes and orange eyes."""
+ eyes = _eyes(state)
+ return Text.assemble(
+ ("{", OWL_STYLE),
+ (eyes, BRAND_STYLE),
+ (",", OWL_STYLE),
+ (eyes, BRAND_STYLE),
+ ("}", OWL_STYLE),
+ )
# The spinner is a slow blink, not a spin. A continuous eye-roll at 5fps reads
# as a cheap loading GIF and draws the eye away from the progress bar next to
# it; holding the eyes open and closing them once per cycle reads as alive
# without competing for attention. Motion lives in the last three frames.
-_BLINK_CYCLE = [EYES_IDLE] * 7 + ["◒", EYES_SLEEPY, "◒"]
+_BLINK_CYCLE = [IDLE] * 7 + [BLINK, SHUT, BLINK]
+_FRAME_SECONDS = 0.18
-THINKING_FRAMES = [mini(e) for e in _BLINK_CYCLE]
+THINKING_FRAMES = [mini(state) for state in _BLINK_CYCLE]
+
+
+def thinking_text(time: float) -> Text:
+ """The spinner frame for *time*, in seconds."""
+ return mini_text(_BLINK_CYCLE[int(time / _FRAME_SECONDS) % len(_BLINK_CYCLE)])
-# ---------------------------------------------------------------------------
-# Spinner registration — ``rich._spinners.SPINNERS`` is private API (a plain
-# dict consumed by ``rich.spinner.Spinner``), so registration is wrapped: if a
-# future rich version moves it, everything silently stays on "dots". Always
-# reference ``OWL_SPINNER`` at call sites, never the literal ``"owl"``.
-# ---------------------------------------------------------------------------
-try:
- from rich._spinners import SPINNERS
+class OwlSpinner:
+ """The blinking mini owl in front of a status line; see :func:`owl_status`."""
+
+ def __init__(self, text: str = "") -> None:
+ self.text = Text.from_markup(text)
+
+ def __rich_console__(self, console: Console, options: ConsoleOptions) -> RenderResult:
+ frame = thinking_text(console.get_time())
+ yield Text.assemble(frame, " ", self.text) if self.text else frame
+
+
+def owl_status(console: Console, text: str, **live_kwargs: Any) -> Live:
+ """``console.status`` with the owl: a transient line that blinks while work runs.
+
+ Built the way Rich builds a status, so it behaves the same on a pipe.
+ """
+ return Live(
+ OwlSpinner(text),
+ console=console,
+ refresh_per_second=12.5,
+ transient=True,
+ **live_kwargs,
+ )
- SPINNERS["owl"] = {"interval": 180, "frames": THINKING_FRAMES}
- OWL_SPINNER = "owl"
-except Exception: # pragma: no cover — depends on rich internals
- OWL_SPINNER = "dots"
# ---------------------------------------------------------------------------
-# Wordmark font — half-block letterforms at 1-char strokes (R tail = stepped
-# taper).
+# Wordmark: thin box-drawing letters, three rows, beside the owl's top three.
# ---------------------------------------------------------------------------
FONT = {
- "R": ["███▄ ", "█ █ ", "███▀ ", "█ ▀▄ ", "█ ▀▄"],
- "E": ["███", "█ ", "██ ", "█ ", "███"],
- "P": ["███▄", "█ █", "███▀", "█ ", "█ "],
- "O": ["▄██▄", "█ █", "█ █", "█ █", "▀██▀"],
- "W": ["█ █", "█ █", "█ █ █", "█ █ █", "▀█▀█▀"],
- "I": ["███", " █ ", " █ ", " █ ", "███"],
- "S": ["▄██▄", "█ ", "▀██▄", " █", "▀██▀"],
+ "R": ["┬─┐", "├┬┘", "┴└─"],
+ "E": ["┌─┐", "├┤ ", "└─┘"],
+ "P": ["┌─┐", "├─┘", "┴ "],
+ "O": ["┌─┐", "│ │", "└─┘"],
+ "W": ["┬ ┬", "│││", "└┴┘"],
+ "I": ["┬", "│", "┴"],
+ "S": ["┌─┐", "└─┐", "└─┘"],
}
_WORD = "REPOWISE"
-_LETTER_GAP = 1
-_OWL_GAP = 2
+_OWL_GAP = 3
_INDENT = 1
-@cache
def render_wordmark() -> tuple[str, ...]:
- """The five wordmark rows, letters separated by a single column."""
- rows = ["", "", "", "", ""]
- for index, char in enumerate(_WORD):
- glyph = FONT[char]
- for r in range(5):
- rows[r] += glyph[r]
- if index < len(_WORD) - 1:
- rows[r] += " " * _LETTER_GAP
- return tuple(rows)
+ """The three wordmark rows, letters set solid."""
+ return tuple("".join(FONT[char][r] for char in _WORD) for r in range(3))
def banner_width() -> int:
- """Total rendered banner width in columns (indent + owl + gap + wordmark).
-
- 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.
- """
- return _INDENT + max(len(line) for line in OWL) + _OWL_GAP + len(render_wordmark()[0])
+ """Total rendered banner width in columns: indent, owl, gap, then the widest text."""
+ text_width = max(len(render_wordmark()[0]), len(TAGLINE))
+ return _INDENT + max(len(line) for line in OWL) + _OWL_GAP + text_width
def _paint_owl(line: str) -> Text:
- """Owl strokes in logo white, eyes in brand orange."""
+ """Owl strokes in cream, eyes in brand orange."""
out = Text()
for ch in line:
- if ch == EYES_IDLE:
- out.append(ch, style=f"bold {BRAND}")
+ if ch == EYES[IDLE][0]:
+ out.append(ch, style=BRAND_STYLE)
elif ch == " ":
out.append(" ")
else:
- out.append(ch, style=f"bold {WHITE}")
+ out.append(ch, style=OWL_STYLE)
return out
-def banner_text() -> Text:
- """Compose owl + wordmark into a single renderable ``Text``."""
- rows = render_wordmark()
+def banner_text(version: str = "") -> Text:
+ """The owl beside the wordmark, the tagline and the version. Unicode only."""
owl_w = max(len(line) for line in OWL)
+ right: list[tuple[str, str]] = [(row, BRAND_STYLE) for row in render_wordmark()]
+ right.append((TAGLINE, DIM))
+ right.append((f"v{version}" if version else "", DIM))
out = Text()
- for r in range(5):
+ for r, (text, style) in enumerate(right):
if r:
out.append("\n")
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}")
+ out.append(text, style=style)
+ out.rstrip()
return out
+
+
+def header_text(version: str, width: int | None = None) -> Text:
+ """The one-line header: ``{◉,◉} repowise v0.57.0 · codebase intelligence ...``.
+
+ For a terminal narrower than the banner, or one that cannot show it. The
+ tagline is dropped when the line would not fit in *width* columns.
+ """
+ line = Text.assemble(" ", mini_text(IDLE), " ", ("repowise", BRAND_STYLE), " ")
+ full = f"v{version} {glyph('sep')} {TAGLINE}"
+ fits = width is None or line.cell_len + len(full) <= width
+ line.append(full if fits else f"v{version}", style=DIM)
+ return line
diff --git a/packages/cli/src/repowise/cli/ui/progress.py b/packages/cli/src/repowise/cli/ui/progress.py
index 3171362e7..244a26f4c 100644
--- a/packages/cli/src/repowise/cli/ui/progress.py
+++ b/packages/cli/src/repowise/cli/ui/progress.py
@@ -10,6 +10,7 @@ from rich.console import Console
from repowise.cli.ui import checklist
from repowise.cli.ui.brand import ERR, WARN, print_phase_header
+from repowise.cli.ui.glyphs import GLYPHS, for_terminal
from repowise.core.redaction import redact_secrets
# Message levels that mean "this run degraded". ``notice`` is deliberately not
@@ -240,7 +241,7 @@ class RichProgressCallback:
self._print_above_live(lambda: print_stage(self._progress.console, stage, total))
def on_phase_start(self, phase: str, total: int | None) -> None:
- label = _PHASE_LABELS.get(phase, f"{phase}…")
+ label = checklist.running_label(_PHASE_LABELS.get(phase, f"{phase}…"))
self._done.discard(phase)
self._done_counts.pop(phase, None)
# If phase already has a task, update its total and make visible
@@ -336,8 +337,9 @@ class RichProgressCallback:
style = style_map.get(level, "")
if level in _DEGRADING_LEVELS:
self.warnings.append(redact_secrets(text))
- # Insight lines (indented with →) get special formatting
- if text.lstrip().startswith("→"):
+ text = for_terminal(text)
+ # Insight lines (indented with →, in either form) get special formatting
+ if text.lstrip().startswith(GLYPHS["arrow"]):
line = f" [dim]{text}[/dim]"
elif style:
line = f" [{style}]{text}[/{style}]"
diff --git a/packages/cli/src/repowise/cli/ui/progress_display.py b/packages/cli/src/repowise/cli/ui/progress_display.py
index 7708e675d..30d1f01ec 100644
--- a/packages/cli/src/repowise/cli/ui/progress_display.py
+++ b/packages/cli/src/repowise/cli/ui/progress_display.py
@@ -13,17 +13,24 @@ from collections.abc import Iterable
from typing import Any
from rich.console import Console, RenderableType
-from rich.progress import BarColumn, Progress, ProgressColumn, SpinnerColumn, Task, TextColumn
+from rich.progress import BarColumn, Progress, ProgressColumn, Task, TextColumn
from rich.text import Text
-from repowise.cli.ui import checklist
-from repowise.cli.ui.brand import BRAND_STYLE, DIM, OK
-from repowise.cli.ui.mascot import OWL_SPINNER
+from repowise.cli.ui import checklist, mascot
+from repowise.cli.ui.brand import DIM, OK
+from repowise.cli.ui.glyphs import glyph
# The item a step is on is a path; keep its tail, which is the part that changes.
_DETAIL_WIDTH = 36
+class OwlColumn(ProgressColumn):
+ """The blinking mini owl at the head of a running row."""
+
+ def render(self, task: Task) -> Text:
+ return mascot.thinking_text(task.get_time())
+
+
class MaybeCountColumn(ProgressColumn):
"""``completed/total unit``, or ``completed unit`` when the total is unknown.
@@ -63,7 +70,8 @@ class DetailColumn(ProgressColumn):
def render(self, task: Task) -> Text:
detail = str(task.fields.get("detail") or "")
if len(detail) > _DETAIL_WIDTH:
- detail = "…" + detail[-(_DETAIL_WIDTH - 1) :]
+ more = glyph("ellipsis")
+ detail = more + detail[-(_DETAIL_WIDTH - len(more)) :]
return Text(detail, style=DIM, overflow="ellipsis", no_wrap=True)
@@ -112,7 +120,7 @@ def make_progress(
only where Ctrl-C really is safe, since the long-step line says so.
"""
columns: list[Any] = [
- SpinnerColumn(spinner_name=OWL_SPINNER, style=BRAND_STYLE),
+ OwlColumn(),
TextColumn("[progress.description]{task.description}"),
BarColumn(bar_width=24),
MaybeCountColumn(),
diff --git a/packages/cli/src/repowise/cli/ui/result_panels.py b/packages/cli/src/repowise/cli/ui/result_panels.py
index 926d7bfcd..b542ce105 100644
--- a/packages/cli/src/repowise/cli/ui/result_panels.py
+++ b/packages/cli/src/repowise/cli/ui/result_panels.py
@@ -21,8 +21,8 @@ from rich.markup import escape
from rich.panel import Panel
from rich.text import Text
+from repowise.cli.ui import mascot
from repowise.cli.ui.brand import BRAND, DIM, VALUE, key_value_table
-from repowise.cli.ui.mascot import EYES_HAPPY, mini
def build_completion_panel(
@@ -32,8 +32,12 @@ def build_completion_panel(
next_steps: list[tuple[str, str]] | None = None,
body: list[Any] | None = None,
footer: list[Any] | None = None,
+ owl: str = mascot.DONE,
) -> Panel:
- """Build the run's one bordered panel, titled with the happy owl.
+ """Build the run's one bordered panel, titled with the owl in state *owl*.
+
+ ``mascot.DONE`` for a clean run, ``mascot.WARNED`` for one that finished
+ degraded, ``mascot.FAILED`` for one that is about to exit non-zero.
*metrics* is a list of ``(label, value)`` pairs. *next_steps* is at most
three ``(command, description)`` pairs, see :func:`build_contextual_next_steps`.
@@ -66,7 +70,7 @@ def build_completion_panel(
return Panel(
Group(*parts),
- title=f"[bold]{mini(EYES_HAPPY)} {title}[/bold]",
+ title=Text.assemble(mascot.mini_text(owl), " ", (title, "bold")),
border_style=BRAND,
padding=(1, 1),
)
@@ -80,6 +84,7 @@ def print_completion_panel(
*,
body: list[Any] | None = None,
footer: list[Any] | None = None,
+ owl: str = mascot.DONE,
) -> None:
"""The completion panel on a terminal; off one, the same rows as plain lines.
@@ -88,11 +93,11 @@ def print_completion_panel(
if console.is_terminal:
console.print(
build_completion_panel(
- title, metrics, next_steps=next_steps, body=body, footer=footer
+ title, metrics, next_steps=next_steps, body=body, footer=footer, owl=owl
)
)
return
- console.print(f"{mini(EYES_HAPPY)} {title}", highlight=False)
+ console.print(Text.assemble(mascot.mini_text(owl), " ", title), highlight=False)
console.print(key_value_table(metrics))
for line in body or []:
console.print(line)
diff --git a/packages/cli/src/repowise/cli/ui/workspace_finish.py b/packages/cli/src/repowise/cli/ui/workspace_finish.py
index 24d0a3565..4cd91fd26 100644
--- a/packages/cli/src/repowise/cli/ui/workspace_finish.py
+++ b/packages/cli/src/repowise/cli/ui/workspace_finish.py
@@ -17,6 +17,7 @@ from rich.markup import escape
from rich.padding import Padding
from rich.text import Text
+from repowise.cli.ui import mascot
from repowise.cli.ui.brand import ERR, OK, WARN, key_value_table
from repowise.cli.ui.finish_panel import (
agent_questions,
@@ -26,6 +27,7 @@ from repowise.cli.ui.finish_panel import (
dim_line,
line,
)
+from repowise.cli.ui.glyphs import glyph
from repowise.cli.ui.mode_names import (
INDEX_ONLY,
TITLE_WORKSPACE,
@@ -124,17 +126,17 @@ def _metrics(facts: WorkspaceFacts) -> list[tuple[str, str]]:
def _repo_row(repo: RepoOutcome, *, mixed: bool) -> tuple[str, str]:
name = escape(repo.alias)
if repo.error:
- return f"[{ERR}]✗[/] {name}", f"[{ERR}]failed[/] [dim]({escape(repo.error)})[/dim]"
+ return f"[{ERR}]{glyph('fail')}[/] {name}", f"[{ERR}]failed[/] [dim]({escape(repo.error)})[/dim]"
if repo.skipped:
return (
- f"[{WARN}]✗[/] {name}",
+ f"[{WARN}]{glyph('fail')}[/] {name}",
f"[{WARN}]documentation skipped[/] [dim]({escape(repo.skipped)})[/dim]",
)
label = mode_label(repo.scope)
value = pages(repo.pages) if repo.pages else f"no documentation ({label})"
if mixed and repo.pages:
value += f" [dim]· {escape(label)}[/dim]"
- return f"[{OK}]✓[/] {name}", value
+ return f"[{OK}]{glyph('ok')}[/] {name}", value
def _repo_lines(facts: WorkspaceFacts) -> list[RenderableType]:
@@ -190,18 +192,26 @@ def _questions() -> list[str]:
]
-def build_workspace_finish_panel(facts: WorkspaceFacts, *, setup: Any = None) -> Any:
- """The workspace completion panel: counts, repos, Connected, questions, steps."""
+def build_workspace_finish_panel(
+ facts: WorkspaceFacts, *, setup: Any = None, owl: str = mascot.DONE
+) -> Any:
+ """The workspace completion panel: counts, repos, Connected, questions, steps.
+
+ *owl* is the title owl's state: how the run finished.
+ """
return build_completion_panel(
TITLE_WORKSPACE,
_metrics(facts),
next_steps=workspace_steps(facts, setup),
body=_body(facts, setup),
footer=autosync_lines(setup),
+ owl=owl,
)
-def print_workspace_finish_panel(console: Any, facts: WorkspaceFacts, *, setup: Any = None) -> None:
+def print_workspace_finish_panel(
+ console: Any, facts: WorkspaceFacts, *, setup: Any = None, owl: str = mascot.DONE
+) -> None:
"""The workspace panel on a terminal; the same rows as plain lines off one."""
print_completion_panel(
console,
@@ -210,6 +220,7 @@ def print_workspace_finish_panel(console: Any, facts: WorkspaceFacts, *, setup:
workspace_steps(facts, setup),
body=_body(facts, setup),
footer=autosync_lines(setup),
+ owl=owl,
)
diff --git a/tests/unit/cli/_provider_picker.py b/tests/unit/cli/_provider_picker.py
index 2d560c4f2..c4d5ca03f 100644
--- a/tests/unit/cli/_provider_picker.py
+++ b/tests/unit/cli/_provider_picker.py
@@ -8,6 +8,7 @@ from typing import Any
from rich.console import Console
from repowise.cli.ui import provider_selection as ui
+from repowise.cli.ui.brand import THEME
def pick_default(monkeypatch: Any, **kwargs: Any) -> tuple[str, str]:
@@ -20,5 +21,5 @@ def pick_default(monkeypatch: Any, **kwargs: Any) -> tuple[str, str]:
monkeypatch.setattr(ui.Prompt, "ask", ask)
buf = io.StringIO()
- ui._interactive_provider_name(Console(file=buf, width=160), None, **kwargs)
+ ui._interactive_provider_name(Console(file=buf, width=160, theme=THEME), None, **kwargs)
return ui._PROVIDER_CHOICES[int(seen["default"]) - 1], buf.getvalue()
diff --git a/tests/unit/cli/conftest.py b/tests/unit/cli/conftest.py
index 437586b63..58d40a04a 100644
--- a/tests/unit/cli/conftest.py
+++ b/tests/unit/cli/conftest.py
@@ -51,3 +51,16 @@ def _isolated_home(tmp_path_factory, monkeypatch):
monkeypatch.setenv("LOCALAPPDATA", str(fake_home / "AppData" / "Local"))
monkeypatch.setattr(Path, "home", lambda: fake_home)
return fake_home
+
+
[email protected](autouse=True)
+def _unicode_terminal(monkeypatch):
+ """Pin the Unicode glyphs, whatever stdout the test runner itself has.
+
+ Glyphs follow the encoding stdout had when ``repowise.cli`` was imported, so
+ a ``-s`` run on a cp1252 pipe would otherwise switch every test to ASCII.
+ Tests of the ASCII forms set the encoding themselves.
+ """
+ from repowise.cli import _stdio
+
+ monkeypatch.setattr(_stdio, "_original_stdout_encoding", "utf-8")
diff --git a/tests/unit/cli/test_embed_failure_reporting.py b/tests/unit/cli/test_embed_failure_reporting.py
index d2c1edc07..62e70c123 100644
--- a/tests/unit/cli/test_embed_failure_reporting.py
+++ b/tests/unit/cli/test_embed_failure_reporting.py
@@ -22,6 +22,7 @@ from click.testing import CliRunner
from rich.console import Console
from repowise.cli.providers import embed_failure_message, semantic_search_status
+from repowise.cli.ui.brand import THEME
from repowise.core.generation.models import GeneratedPage
@@ -155,7 +156,7 @@ def _closing_card(tmp_path: Path, monkeypatch, *, semantic: str, failed: int) ->
buf = io.StringIO()
monkeypatch.setattr(
"repowise.cli.commands.init_cmd.reporting.console",
- Console(file=buf, width=200, force_terminal=False),
+ Console(file=buf, width=200, force_terminal=False, theme=THEME),
)
graph = MagicMock()
graph.number_of_nodes.return_value = 1
diff --git a/tests/unit/cli/test_fast_mode_offer.py b/tests/unit/cli/test_fast_mode_offer.py
index 54aa70386..1551db052 100644
--- a/tests/unit/cli/test_fast_mode_offer.py
+++ b/tests/unit/cli/test_fast_mode_offer.py
@@ -10,6 +10,7 @@ from repowise.cli.ui import (
keyless_upgrade_note,
should_offer_fast_mode,
)
+from repowise.cli.ui.brand import THEME
from repowise.cli.ui.finish_panel import connected_lines
@@ -17,7 +18,7 @@ def build_status_notes(setup) -> list[str]:
"""The Connected lines as plain text."""
from rich.console import Console
- console = Console(width=200, record=True)
+ console = Console(width=200, record=True, theme=THEME)
for line in connected_lines(setup):
console.print(line)
return [line for line in console.export_text().splitlines() if line.strip()]
@@ -200,7 +201,7 @@ def test_next_steps_render_without_truncation_or_collision():
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 = Console(width=120, record=True, force_terminal=True, theme=THEME)
console.print(build_completion_panel("done", [("Files", "1")], next_steps=steps))
out = console.export_text()
assert "repowise hook rewrite install" in out
diff --git a/tests/unit/cli/test_finish_panel.py b/tests/unit/cli/test_finish_panel.py
index 4d44ed1b9..dc58e835f 100644
--- a/tests/unit/cli/test_finish_panel.py
+++ b/tests/unit/cli/test_finish_panel.py
@@ -11,6 +11,7 @@ from repowise.cli.commands.serve_cmd._ports import DEFAULT_UI_PORT
from repowise.cli.commands.serve_cmd._web_assets import _NODE_MIN_MAJOR
from repowise.cli.editor_setup import EditorSetupOutcome
from repowise.cli.ui import build_contextual_next_steps
+from repowise.cli.ui.brand import THEME
from repowise.cli.ui.finish_panel import FinishFacts, build_finish_panel
from repowise.cli.ui.mode_names import completion_title, scope_line
from repowise.cli.ui.result_panels import serve_step
@@ -57,7 +58,7 @@ def _render(mode: str, setup=None, files_written=None) -> str:
top_hotspot="serializer.py",
setup=setup,
)
- console = Console(record=True, width=100)
+ console = Console(record=True, width=100, theme=THEME)
console.print(
build_finish_panel(
facts, steps=steps, setup=setup, repo_path=Path("/r"), files_written=files_written
@@ -164,7 +165,7 @@ def test_bracketed_file_names_render_literally():
steps = build_contextual_next_steps(
index_only=False, hotspot_count=1, top_hotspot="[id].tsx", setup=setup
)
- console = Console(record=True, width=100)
+ console = Console(record=True, width=100, theme=THEME)
console.print(
build_finish_panel(
facts, steps=steps, setup=setup, repo_path=Path("/r"),
@@ -194,7 +195,7 @@ def test_semantic_search_line_names_who_pays_for_the_embedder(command, tail, abs
scope=scope, files=1, symbols=1, languages="Python 100%", graph_nodes=1,
graph_edges=0, elapsed="1.0s", pages="1 page",
)
- console = Console(record=True, width=120)
+ console = Console(record=True, width=120, theme=THEME)
console.print(build_finish_panel(facts, steps=[serve_step()]))
line = next(x for x in console.export_text().splitlines() if "Semantic search is off" in x)
assert f"{command} turns it on {tail}" in line
diff --git a/tests/unit/cli/test_init_agent_mode.py b/tests/unit/cli/test_init_agent_mode.py
index b5cd49d51..7b9605d2e 100644
--- a/tests/unit/cli/test_init_agent_mode.py
+++ b/tests/unit/cli/test_init_agent_mode.py
@@ -16,7 +16,7 @@ from repowise.cli.commands.init_cmd import _ingest
from repowise.cli.commands.init_cmd._agent_summary import init_output
from repowise.cli.main import cli
from repowise.cli.output import LINE_OUTPUT_WIDTH, line_output_width
-from repowise.cli.ui.brand import print_phase_header
+from repowise.cli.ui.brand import THEME, print_phase_header
from repowise.cli.ui.mode_names import TITLE_BUILT_FROM_CODE
from repowise.cli.ui.progress_json import JsonProgressCallback
from repowise.cli.ui.result_panels import print_completion_panel
@@ -149,7 +149,7 @@ def test_status_follows_the_exit_code():
def test_off_a_terminal_lines_are_capped_and_panels_are_plain(monkeypatch):
monkeypatch.delenv("COLUMNS", raising=False)
buf = io.StringIO()
- console = Console(file=buf, width=400)
+ console = Console(file=buf, width=400, theme=THEME)
with line_output_width(console, buf):
assert console.width == LINE_OUTPUT_WIDTH
print_phase_header(console, 1, 4, "Ingestion", "Walking the tree")
diff --git a/tests/unit/cli/test_init_failure_reporting.py b/tests/unit/cli/test_init_failure_reporting.py
index 4edbb61c2..18bbb5a59 100644
--- a/tests/unit/cli/test_init_failure_reporting.py
+++ b/tests/unit/cli/test_init_failure_reporting.py
@@ -9,6 +9,7 @@ import pytest
from repowise.cli.commands.init_cmd.generation import run_repo_generation
from repowise.cli.commands.init_cmd.reporting import show_completion
+from repowise.cli.ui.brand import THEME
from repowise.core.generation.job_system import JobSystem
from repowise.core.generation.models import GeneratedPage
@@ -319,7 +320,7 @@ class TestInitRendersGenerationChecks:
buf = io.StringIO()
monkeypatch.setattr(
"repowise.cli.commands.init_cmd.reporting.console",
- Console(file=buf, width=200, force_terminal=False),
+ Console(file=buf, width=200, force_terminal=False, theme=THEME),
)
show_completion(
repo_path="/fake",
@@ -564,7 +565,7 @@ class TestInitClosingKeylessNote:
buf = io.StringIO()
monkeypatch.setattr(
"repowise.cli.commands.init_cmd.reporting.console",
- Console(file=buf, width=200, force_terminal=False),
+ Console(file=buf, width=200, force_terminal=False, theme=THEME),
)
monkeypatch.setattr(
"repowise.cli.commands.init_cmd.reporting.load_state",
diff --git a/tests/unit/cli/test_init_plan_screen.py b/tests/unit/cli/test_init_plan_screen.py
index 7149658e6..0d1ac559d 100644
--- a/tests/unit/cli/test_init_plan_screen.py
+++ b/tests/unit/cli/test_init_plan_screen.py
@@ -13,6 +13,7 @@ from rich.console import Console
from repowise.cli.main import cli
from repowise.cli.ui import provider_selection
+from repowise.cli.ui.brand import THEME
from repowise.cli.ui.plan_screen import (
EDIT,
MODEL,
@@ -34,7 +35,7 @@ _OUTSIDE = ("Global repowise MCP entry (Claude Code) now points at /old, will po
def _render(state: PlanState) -> str:
- console = Console(record=True, width=100, color_system=None)
+ console = Console(record=True, width=100, color_system=None, theme=THEME)
render_plan(console, state)
# Flattened: where the console wraps at 100 columns is not the copy's business.
return " ".join(console.export_text().split())
@@ -130,11 +131,11 @@ def _keys(*answers: str):
[("", START), ("m", MODEL), ("E", EDIT), (" q ", QUIT)],
)
def test_each_key_maps_to_its_action(typed: str, action: str) -> None:
- assert read_plan_key(Console(width=100), _state(), _keys(typed)) == action
+ assert read_plan_key(Console(width=100, theme=THEME), _state(), _keys(typed)) == action
def test_s_needs_a_global_entry_that_would_move() -> None:
- console = Console(record=True, width=100)
+ console = Console(record=True, width=100, theme=THEME)
assert read_plan_key(console, _state(), _keys("s", "x", "")) == START
assert "Press Enter to start, or m, e or q." in console.export_text()
assert read_plan_key(console, _state(outside=_OUTSIDE), _keys("s")) == THIS_REPO
@@ -145,7 +146,7 @@ def test_eof_propagates_to_the_caller() -> None:
raise EOFError
with pytest.raises(EOFError):
- read_plan_key(Console(width=100), _state(), eof)
+ read_plan_key(Console(width=100, theme=THEME), _state(), eof)
# -- the no-key path ----------------------------------------------------------
@@ -157,7 +158,7 @@ def test_no_key_offers_to_continue_without_a_model(monkeypatch: Any) -> None:
gemini = str(list(provider_selection._PROVIDER_CHOICES).index("gemini") + 1)
answers = iter([gemini, "1"])
monkeypatch.setattr(provider_selection.Prompt, "ask", lambda *a, **k: next(answers))
- console = Console(record=True, width=100)
+ console = Console(record=True, width=100, theme=THEME)
selection = provider_selection.interactive_provider_config_select(
console, None, subscription=SubscriptionContext(allow_skip=True)
@@ -183,7 +184,7 @@ def test_no_key_can_still_pick_another_provider(monkeypatch: Any) -> None:
monkeypatch.setattr(provider_selection.Prompt, "ask", lambda *a, **k: next(answers))
chosen = provider_selection._interactive_provider_name(
- Console(width=100), None, subscription=SubscriptionContext(allow_skip=True)
+ Console(width=100, theme=THEME), None, subscription=SubscriptionContext(allow_skip=True)
)
assert chosen == "openai"
@@ -436,7 +437,7 @@ def test_back_from_the_gateway_keeps_the_picker_context(monkeypatch: Any) -> Non
context = SubscriptionContext(allow_skip=True)
selection = provider_selection.interactive_provider_config_select(
- Console(width=100), None, subscription=context
+ Console(width=100, theme=THEME), None, subscription=context
)
assert selection is None
@@ -492,7 +493,7 @@ def test_click_prompts_are_restored_after_the_screen(plan: Any, tmp_path: Path)
def _announce(run: Any, monkeypatch: Any) -> str:
from repowise.cli.commands.init_cmd import _provider
- console = Console(record=True, width=100, color_system=None)
+ console = Console(record=True, width=100, color_system=None, theme=THEME)
monkeypatch.setattr(_provider, "console", console)
_provider.announce_index_only(run)
return " ".join(console.export_text().split())
diff --git a/tests/unit/cli/test_init_theme.py b/tests/unit/cli/test_init_theme.py
new file mode 100644
index 000000000..97e85b1b5
--- /dev/null
+++ b/tests/unit/cli/test_init_theme.py
@@ -0,0 +1,176 @@
+"""The init theme: style names on the console, glyphs with an ASCII form, the owl's states."""
+
+from __future__ import annotations
+
+import io
+import re
+import sys
+from pathlib import Path
+from types import SimpleNamespace
+
+import pytest
+from rich.console import Console
+
+from repowise.cli import _stdio
+from repowise.cli._helpers.console import _CliConsole
+from repowise.cli.commands.init_cmd._finish import _finish_owl
+from repowise.cli.ui import checklist, glyphs, mascot
+from repowise.cli.ui.brand import THEME
+from repowise.cli.ui.result_panels import build_completion_panel
+
+_CLI = Path(__file__).resolve().parents[3] / "packages" / "cli" / "src" / "repowise" / "cli"
+
+
+def terminal_encoding(monkeypatch: pytest.MonkeyPatch):
+ """Set what stdout could carry before the CLI's UTF-8 reconfigure."""
+
+ def _set(encoding: str) -> None:
+ monkeypatch.setattr(_stdio, "_original_stdout_encoding", encoding)
+
+ return _set
+
+
+def test_a_cp1252_stdout_gets_the_ascii_forms(monkeypatch: pytest.MonkeyPatch) -> None:
+ monkeypatch.setattr(_stdio, "_original_stdout_encoding", None)
+ stream = io.TextIOWrapper(io.BytesIO(), encoding="cp1252")
+ monkeypatch.setattr(sys, "stdout", stream)
+ _stdio._ensure_utf8_stdio()
+
+ # The stream now writes UTF-8; the encoding it started with still decides.
+ assert stream.encoding == "utf-8"
+ assert glyphs.ascii_only()
+ assert glyphs.glyph("ok") == "+"
+ assert mascot.mini(mascot.IDLE) == "{o,o}"
+ assert mascot.header_text("1.2.3").plain.isascii()
+
+ console = _CliConsole(theme=THEME, width=80, force_terminal=False)
+ console.print(build_completion_panel("repowise init complete", [("Files", "3 files")]))
+ console.print(checklist.done_line(checklist.FinishedStep(" ↳ Resolving imports", 3, 3, "files", 0.2)))
+ stream.flush()
+ out = stream.buffer.getvalue().decode("utf-8")
+ assert out.isascii(), out
+ assert "{^,^} repowise init complete" in out
+ assert "+ Resolving imports - 3 files" in out
+
+
+def test_a_utf8_stdout_gets_the_unicode_forms(terminal_encoding) -> None:
+ terminal_encoding("utf-8")
+ assert not glyphs.ascii_only()
+ assert glyphs.glyph("ok") == "✓"
+ assert mascot.mini(mascot.IDLE) == "{◉,◉}"
+ assert checklist.running_label(" ↳ Resolving imports") == " ↳ Resolving imports"
+
+
+def test_every_glyph_has_a_one_line_ascii_form() -> None:
+ for unicode, ascii_form in glyphs.GLYPHS.values():
+ assert ascii_form.isascii()
+ assert not unicode.isascii()
+
+
+ ("state", "unicode", "ascii_form"),
+ [
+ (mascot.IDLE, "{◉,◉}", "{o,o}"),
+ (mascot.BLINK, "{◒,◒}", "{o,o}"),
+ (mascot.SHUT, "{─,─}", "{o,o}"),
+ (mascot.DONE, "{^,^}", "{^,^}"),
+ (mascot.INTERRUPTED, "{─,─}", "{-,-}"),
+ (mascot.WARNED, "{•,•}", "{.,.}"),
+ (mascot.FAILED, "{×,×}", "{x,x}"),
+ ],
+)
+def test_owl_states(terminal_encoding, state: str, unicode: str, ascii_form: str) -> None:
+ terminal_encoding("utf-8")
+ assert mascot.mini(state) == unicode
+ terminal_encoding("cp1252")
+ assert mascot.mini(state) == ascii_form
+
+
+def test_the_mini_owl_has_cream_strokes_and_orange_eyes() -> None:
+ owl = mascot.mini_text(mascot.DONE)
+ styles = [str(span.style) for span in owl.spans]
+ assert styles == ["owl", "brand.bold", "owl", "brand.bold", "owl"]
+
+
+def _run(*, embed_failed: int = 0, warnings: tuple[str, ...] = ()) -> SimpleNamespace:
+ return SimpleNamespace(
+ scope_embedder="openai",
+ result=SimpleNamespace(embed_failed_pages=embed_failed),
+ run_warnings=list(warnings),
+ gaps=[],
+ )
+
+
+def test_the_finish_owl_follows_how_the_run_ended() -> None:
+ assert _finish_owl(_run()) == mascot.DONE
+ assert _finish_owl(_run(warnings=("git history skipped",))) == mascot.WARNED
+ # An embed failure exits non-zero, so it outranks a warning.
+ assert _finish_owl(_run(embed_failed=2, warnings=("x",))) == mascot.FAILED
+
+
+def test_the_panel_title_carries_the_owl_state(terminal_encoding) -> None:
+ terminal_encoding("utf-8")
+ console = Console(file=io.StringIO(), width=80, theme=THEME)
+ console.print(build_completion_panel("repowise init complete", [], owl=mascot.FAILED))
+ assert "{×,×} repowise init complete" in console.file.getvalue()
+
+
+def test_the_theme_is_registered_on_the_cli_consoles() -> None:
+ from repowise.cli.helpers import console, err_console
+
+ for name in ("brand", "ok", "warn", "err", "info", "model", "dim", "value", "owl"):
+ assert console.get_style(name) == THEME.styles[name]
+ assert err_console.get_style(name) == THEME.styles[name]
+
+
+_COLOUR_SGR = re.compile(r"\x1b\[[0-9;]*?(?:3[0-79]|38;[25];[0-9;]+)m")
+
+
+def test_no_color_drops_colour_and_keeps_the_glyph(
+ monkeypatch: pytest.MonkeyPatch, terminal_encoding
+) -> None:
+ terminal_encoding("utf-8")
+ monkeypatch.setenv("NO_COLOR", "1")
+ console = _CliConsole(theme=THEME, file=io.StringIO(), force_terminal=True, width=80)
+ console.print(f"[ok]{glyphs.glyph('ok')}[/] done [warn]careful[/] [brand]repowise[/]")
+ console.print(mascot.mini_text(mascot.WARNED))
+ out = console.file.getvalue()
+ assert not _COLOUR_SGR.search(out), repr(out)
+ plain = re.sub(r"\x1b\[[0-9;]*m", "", out)
+ assert "✓ done" in plain
+ assert "{•,•}" in plain
+
+
+# The init path names theme styles; the theme module is the one place a colour lives.
+_INIT_PATH = [
+ *sorted((_CLI / "commands" / "init_cmd").glob("*.py")),
+ *(
+ _CLI / "ui" / name
+ for name in (
+ "checklist.py",
+ "glyphs.py",
+ "mascot.py",
+ "mode_selection.py",
+ "progress.py",
+ "progress_display.py",
+ "result_panels.py",
+ )
+ ),
+]
+_RAW_COLOUR = re.compile(
+ r"\[/?(?:bold |dim |italic )*(?:yellow|green|cyan|red|magenta)\]"
+ r"|style=\"(?:bold )?(?:yellow|green|cyan|red|magenta)\""
+ r"|#E8E8E8",
+ re.IGNORECASE,
+)
+
+
[email protected]("path", _INIT_PATH, ids=lambda p: p.name)
+def test_init_path_markup_names_no_raw_colour(path: Path) -> None:
+ hits = [
+ f"{path.name}:{number}: {line.strip()}"
+ for number, line in enumerate(path.read_text(encoding="utf-8").splitlines(), 1)
+ if _RAW_COLOUR.search(line)
+ ]
+ assert not hits, "use a theme style from ui/brand.py:\n" + "\n".join(hits)
diff --git a/tests/unit/cli/test_init_ux.py b/tests/unit/cli/test_init_ux.py
index 52a04c4c4..ec1013d62 100644
--- a/tests/unit/cli/test_init_ux.py
+++ b/tests/unit/cli/test_init_ux.py
@@ -16,13 +16,14 @@ from rich.console import Console
from rich.progress import Progress, TextColumn
from repowise.cli.ui import provider_selection
+from repowise.cli.ui.brand import THEME
from repowise.cli.ui.progress import RichProgressCallback
from repowise.core.pipeline.progress import STAGE_ANALYSIS, STAGE_INGESTION, emit_stage
def _console() -> tuple[Console, StringIO]:
buf = StringIO()
- return Console(file=buf, force_terminal=False, width=100), buf
+ return Console(file=buf, force_terminal=False, width=100, theme=THEME), buf
# --- stage headers ---------------------------------------------------------
diff --git a/tests/unit/cli/test_init_workspace_plan_screen.py b/tests/unit/cli/test_init_workspace_plan_screen.py
index 5107627b2..2c9f5e48f 100644
--- a/tests/unit/cli/test_init_workspace_plan_screen.py
+++ b/tests/unit/cli/test_init_workspace_plan_screen.py
@@ -12,6 +12,7 @@ import pytest
from rich.console import Console
from repowise.cli.ui import workspace_selection
+from repowise.cli.ui.brand import THEME
from repowise.cli.ui.plan_screen import (
EDIT,
MODEL,
@@ -60,7 +61,7 @@ def _state(n: int, **plan: Any) -> WorkspacePlanState:
def _lines(state: WorkspacePlanState) -> list[str]:
- console = Console(record=True, width=100, color_system=None)
+ console = Console(record=True, width=100, color_system=None, theme=THEME)
render_workspace_plan(console, state)
return console.export_text().splitlines()
@@ -141,12 +142,12 @@ def test_a_long_path_is_cut_to_fit_100_columns() -> None:
def test_r_is_offered_on_the_workspace_screen_only() -> None:
- console = Console(record=True, width=100)
+ console = Console(record=True, width=100, theme=THEME)
plan = _state(3).plan
assert read_plan_key(console, plan, _keys("r"), extra={"r": REPOS}) == REPOS
assert read_plan_key(console, plan, _keys("r", ""), extra=None) == START
assert "Press Enter to start, or m, e or q." in console.export_text()
- console = Console(record=True, width=100)
+ console = Console(record=True, width=100, theme=THEME)
read_plan_key(console, plan, _keys("x", ""), extra={"r": REPOS})
assert "Press Enter to start, or m, e, r or q." in console.export_text()
@@ -154,7 +155,7 @@ def test_r_is_offered_on_the_workspace_screen_only() -> None:
def test_choose_repos_takes_numbers_and_ranges_then_the_primary(monkeypatch: Any) -> None:
monkeypatch.setattr(workspace_selection.Prompt, "ask", lambda *a, **k: "2")
state = _state(5)
- choose_repos(Console(width=100), state, _keys("1,3-4"))
+ choose_repos(Console(width=100, theme=THEME), state, _keys("1,3-4"))
assert state.selected == [0, 2, 3]
assert state.primary == "service-3"
@@ -169,14 +170,14 @@ def test_choose_repos_keeps_the_primary_when_it_stays_picked(monkeypatch: Any) -
monkeypatch.setattr(workspace_selection.Prompt, "ask", ask)
state = _state(4)
state.primary = "service-3"
- choose_repos(Console(width=100), state, _keys("2-3"))
+ choose_repos(Console(width=100, theme=THEME), state, _keys("2-3"))
assert state.selected == [1, 2]
assert defaults == ["2"]
assert state.primary == "service-3"
def test_choose_repos_rejects_none_and_nonsense_and_enter_keeps(monkeypatch: Any) -> None:
- console = Console(record=True, width=100)
+ console = Console(record=True, width=100, theme=THEME)
state = _state(3)
choose_repos(console, state, _keys("none", "9", "x", "3"))
out = console.export_text()
diff --git a/tests/unit/cli/test_mascot.py b/tests/unit/cli/test_mascot.py
index 29c68d6d5..10a371796 100644
--- a/tests/unit/cli/test_mascot.py
+++ b/tests/unit/cli/test_mascot.py
@@ -1,16 +1,7 @@
-"""Tests for the owl mascot banner (``ui/mascot.py``).
-
-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.
+"""Tests for the owl mascot (``ui/mascot.py``): banner, one-line header, mini owl.
+
+Assert the thing you would defend in review (the layout, the one accent, the
+fallback), not the thing the implementation happens to do.
"""
from __future__ import annotations
@@ -19,117 +10,122 @@ import unicodedata
from rich.console import Console
+from repowise.cli import _stdio
from repowise.cli.ui import mascot
-from repowise.cli.ui.brand import BRAND, print_banner
+from repowise.cli.ui.brand import BRAND_STYLE, DIM, OWL, THEME, print_banner
+
+BANNER_COLS = 53
-BANNER_MAX_COLS = 47
+EXPECTED_BANNER = [
+ " ,___, ┬─┐┌─┐┌─┐┌─┐┬ ┬┬┌─┐┌─┐",
+ " {◉,◉} ├┬┘├┤ ├─┘│ │││││└─┐├┤",
+ " ( ▼ ) ┴└─└─┘┴ └─┘└┴┘┴└─┘└─┘",
+ " /)_(\\ codebase intelligence for developers and AI",
+ ' " " v1.2.3',
+]
def _banner_lines() -> list[str]:
- return mascot.banner_text().plain.split("\n")
+ return [line.rstrip() for line in mascot.banner_text("1.2.3").plain.split("\n")]
-def test_banner_fits_its_declared_width() -> None:
- for line in _banner_lines():
- assert len(line.rstrip()) <= BANNER_MAX_COLS
+def test_banner_layout() -> None:
+ assert _banner_lines() == EXPECTED_BANNER
-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_wordmark_rows_are_rectangular_and_set_solid() -> None:
+ rows = mascot.render_wordmark()
+ assert len(rows) == 3
+ assert {len(row) for row in rows} == {22}
+ for char in mascot.FONT.values():
+ assert len({len(row) for row in char}) == 1, "ragged letters skew the wordmark"
+
+
+def test_banner_width_is_a_single_source_of_truth() -> None:
+ assert mascot.banner_width() == BANNER_COLS
+ assert max(len(line) for line in _banner_lines()) == BANNER_COLS
-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_banner_is_one_accent_with_cream_strokes() -> None:
+ # Wordmark and eyes orange, owl strokes cream, tagline and version dim.
+ styles = {str(span.style) for span in mascot.banner_text("1.2.3").spans}
+ assert styles == {BRAND_STYLE, OWL, DIM}
+
+
+def test_banner_is_deterministic() -> None:
+ first, second = mascot.banner_text("1.2.3"), mascot.banner_text("1.2.3")
+ assert first.plain == second.plain
+ assert first.spans == second.spans
def test_frames_are_uniform_width() -> None:
assert all(len(frame) == 5 for frame in mascot.THINKING_FRAMES)
- assert mascot.OWL_SPINNER in ("owl", "dots")
- if mascot.OWL_SPINNER == "owl":
- from rich.spinner import Spinner
+ for tick in range(len(mascot.THINKING_FRAMES)):
+ frame = mascot.thinking_text(tick * 0.18 + 0.01)
+ assert frame.plain == mascot.THINKING_FRAMES[tick]
+ assert frame.cell_len == 5
- spinner = Spinner("owl")
- assert spinner.frames == mascot.THINKING_FRAMES
+def test_the_mini_owl_is_the_banner_owls_face() -> None:
+ assert mascot.mini() == mascot.OWL[1].strip()
-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.
+
+def test_art_is_single_width() -> None:
+ # A wide character shifts the whole lockup by a column on the terminals
+ # that render it wide.
art: list[str] = [
*mascot.OWL,
*mascot.THINKING_FRAMES,
- mascot.mini(mascot.EYES_IDLE),
- mascot.mini(mascot.EYES_SLEEPY),
- mascot.mini(mascot.EYES_HAPPY),
+ *(mascot.mini(state) for state in mascot.EYES),
+ *mascot.render_wordmark(),
]
- for glyph in mascot.FONT.values():
- art.extend(glyph)
for s in art:
- s.encode("utf-8") # must not raise
for ch in s:
assert unicodedata.east_asian_width(ch) not in ("W", "F")
-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 _printed(width: int, repo_name: str | None = "my-cool-repo") -> str:
+ console = Console(width=width, record=True, force_terminal=True, theme=THEME)
+ print_banner(console, repo_name=repo_name)
+ return console.export_text()
-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_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()
+def test_wide_terminal_gets_the_banner() -> None:
+ out = _printed(80)
+ assert ",___," in out
assert "codebase intelligence for developers and AI" in out
+ assert "Repository: my-cool-repo" 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_narrow_terminal_gets_the_one_line_header() -> None:
+ out = _printed(59)
+ assert ",___," not in out
+ assert "{◉,◉} repowise v" in out
+ # The tagline is dropped rather than wrapped.
+ assert "codebase intelligence" not in out
+ assert all(len(line) <= 59 for line in out.splitlines())
-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
- assert "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
+def test_header_keeps_the_tagline_when_it_fits() -> None:
+ header = mascot.header_text("1.2.3", 100).plain
+ assert header == " {◉,◉} repowise v1.2.3 · codebase intelligence for developers and AI"
+
+
+def test_ascii_terminal_gets_the_ascii_header(monkeypatch) -> None:
+ monkeypatch.setattr(_stdio, "_original_stdout_encoding", "cp1252")
+ out = _printed(100)
+ assert out.isascii()
+ assert "{o,o} repowise v" in out
+ assert " - codebase intelligence for developers and AI" in out
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()
+ assert "evil[/bold]name" in _printed(100, repo_name="evil[/bold]name")
+
+
+def test_a_workspace_is_labelled_once() -> None:
+ console = Console(width=100, record=True, force_terminal=True, theme=THEME)
+ print_banner(console, repo_name="ws", workspace=True)
+ out = console.export_text()
+ assert "Workspace: ws" in out
+ assert "Repository:" not in out
diff --git a/tests/unit/cli/test_progress_checklist.py b/tests/unit/cli/test_progress_checklist.py
index 1c0467b2a..152ff5691 100644
--- a/tests/unit/cli/test_progress_checklist.py
+++ b/tests/unit/cli/test_progress_checklist.py
@@ -9,6 +9,7 @@ from rich.console import Console
from rich.progress import TextColumn
from repowise.cli.ui import checklist
+from repowise.cli.ui.glyphs import glyph
from repowise.cli.ui.progress import RichProgressCallback, print_stage, upcoming_stages
from repowise.cli.ui.progress_display import ChecklistProgress, make_progress
@@ -92,7 +93,7 @@ def test_pending_and_done_states_carry_a_glyph_not_only_a_colour() -> None:
assert Console().render_str(checklist.upcoming_line(["Analysis", "Persistence"])).plain == (
" ○ Next: Analysis · Persistence"
)
- assert checklist.STATE_MARKS[checklist.DONE][0] == "✓"
+ assert glyph(checklist.STATE_MARKS[checklist.DONE][0]) == "✓"
def test_no_em_dashes_in_checklist_copy() -> None:
diff --git a/tests/unit/cli/test_subscription_providers.py b/tests/unit/cli/test_subscription_providers.py
index 98af7fa20..f4f89203c 100644
--- a/tests/unit/cli/test_subscription_providers.py
+++ b/tests/unit/cli/test_subscription_providers.py
@@ -15,6 +15,7 @@ from repowise.cli.commands.init_cmd import _provider
from repowise.cli.cost_gate import spend_phrase
from repowise.cli.ui import provider_selection as ui
from repowise.cli.ui import subscription
+from repowise.cli.ui.brand import THEME
from repowise.core.cost_estimator import approximate_generation_plan, estimate_cost
from repowise.core.providers.llm import resolve
from repowise.core.providers.llm.specs import PROVIDER_SPECS
@@ -146,7 +147,7 @@ def _run(**overrides: Any) -> SimpleNamespace:
def _note(monkeypatch: Any, run: SimpleNamespace) -> str:
buf = io.StringIO()
- monkeypatch.setattr(_provider, "console", Console(file=buf, width=200))
+ monkeypatch.setattr(_provider, "console", Console(file=buf, width=200, theme=THEME))
_provider.note_subscription_cli(run)
return buf.getvalue()
diff --git a/tests/unit/cli/test_ui_package.py b/tests/unit/cli/test_ui_package.py
index 47bc3f95e..8536eef0f 100644
--- a/tests/unit/cli/test_ui_package.py
+++ b/tests/unit/cli/test_ui_package.py
@@ -42,7 +42,7 @@ def test_facade_reexports_public_surface() -> None:
# owl mascot additions (additive — everything above is the original surface)
"banner_text",
"mini",
- "OWL_SPINNER",
+ "owl_status",
"THINKING_FRAMES",
}
missing = {name for name in expected if not hasattr(ui, name)}
diff --git a/tests/unit/cli/test_ui_reasoning.py b/tests/unit/cli/test_ui_reasoning.py
index cfcdc608d..594e7f25b 100644
--- a/tests/unit/cli/test_ui_reasoning.py
+++ b/tests/unit/cli/test_ui_reasoning.py
@@ -7,12 +7,13 @@ from rich.console import Console
from repowise.cli import ui
from repowise.cli.ui import mode_selection, provider_selection
+from repowise.cli.ui.brand import THEME
from repowise.core.providers.llm.base import ProviderModelOption
from repowise.core.reasoning import REASONING_MODES
def _silent_console() -> Console:
- return Console(file=StringIO(), force_terminal=False)
+ return Console(file=StringIO(), force_terminal=False, theme=THEME)
def test_interactive_advanced_config_uses_shared_reasoning_modes(
diff --git a/tests/unit/cli/test_update_full_keyless.py b/tests/unit/cli/test_update_full_keyless.py
index 8c2363292..d9c8831fe 100644
--- a/tests/unit/cli/test_update_full_keyless.py
+++ b/tests/unit/cli/test_update_full_keyless.py
@@ -16,6 +16,7 @@ from rich.console import Console
from repowise.cli.commands import upgrade_flow
from repowise.cli.errors import reasoned_error
from repowise.cli.helpers import load_state, save_state
+from repowise.cli.ui.brand import THEME
_KEYS = (
"GEMINI_API_KEY",
@@ -76,7 +77,7 @@ def keyless(monkeypatch: pytest.MonkeyPatch) -> dict:
monkeypatch.setattr(upgrade_flow, "try_acquire_update_lock", lambda *a, **k: None)
monkeypatch.setattr(upgrade_flow, "release_update_lock", lambda *a, **k: None)
out = io.StringIO()
- monkeypatch.setattr(upgrade_flow, "console", Console(file=out, width=200))
+ monkeypatch.setattr(upgrade_flow, "console", Console(file=out, width=200, theme=THEME))
seen["out"] = out
return seen
@@ -190,7 +191,7 @@ def test_reindex_on_an_index_only_repo_names_the_fast_to_full_command(tmp_path)
def _plain(monkeypatch, module) -> io.StringIO:
out = io.StringIO()
- monkeypatch.setattr(module, "console", Console(file=out, width=200))
+ monkeypatch.setattr(module, "console", Console(file=out, width=200, theme=THEME))
return out
@@ -227,7 +228,7 @@ def test_workspace_init_on_fast_repos_names_update_full(monkeypatch) -> None:
elapsed="1s",
)
out = io.StringIO()
- Console(file=out, width=200).print(build_workspace_finish_panel(facts))
+ Console(file=out, width=200, theme=THEME).print(build_workspace_finish_panel(facts))
printed = out.getvalue()
assert "repowise update --repo api --full" in printed
assert "repowise generate" not in printed
diff --git a/tests/unit/cli/test_update_reporting.py b/tests/unit/cli/test_update_reporting.py
index 122170a0f..cb69cda34 100644
--- a/tests/unit/cli/test_update_reporting.py
+++ b/tests/unit/cli/test_update_reporting.py
@@ -12,6 +12,7 @@ from types import SimpleNamespace
from rich.console import Console
from repowise.cli.commands.update_cmd import reporting
+from repowise.cli.ui.brand import THEME
class _Buffer:
@@ -23,7 +24,7 @@ class _Buffer:
def __init__(self) -> None:
self._buf = io.StringIO()
- self._console = Console(file=self._buf, width=200, force_terminal=False)
+ self._console = Console(file=self._buf, width=200, force_terminal=False, theme=THEME)
def print(self, *args, **kwargs):
self._console.print(*args, **kwargs)
diff --git a/tests/unit/cli/test_workspace_finish.py b/tests/unit/cli/test_workspace_finish.py
index 2b5f476fb..ac9ef74e0 100644
--- a/tests/unit/cli/test_workspace_finish.py
+++ b/tests/unit/cli/test_workspace_finish.py
@@ -7,6 +7,7 @@ import io
from rich.console import Console
from repowise.cli.editor_setup import EditorSetupOutcome
+from repowise.cli.ui.brand import THEME
from repowise.cli.ui.mode_names import model_name, provider_model
from repowise.cli.ui.workspace_finish import (
MAX_REPO_ROWS,
@@ -27,7 +28,7 @@ _INDEX_ONLY = {"content_provenance": "none", "git_tier": "full", "git_commit_cap
def _render(facts: WorkspaceFacts, setup=None) -> str:
- console = Console(record=True, width=100)
+ console = Console(record=True, width=100, theme=THEME)
console.print(build_workspace_finish_panel(facts, setup=setup))
return console.export_text()
@@ -117,7 +118,7 @@ def test_model_name_drops_a_repeated_provider_prefix():
def test_off_a_terminal_the_workspace_panel_is_plain_lines():
- console = Console(file=io.StringIO(), width=100, force_terminal=False)
+ console = Console(file=io.StringIO(), width=100, force_terminal=False, theme=THEME)
print_workspace_finish_panel(console, _facts([RepoOutcome("api", _FROM_CODE, pages=3)]))
out = console.file.getvalue()
diff --git a/tests/unit/cli/test_workspace_init_config.py b/tests/unit/cli/test_workspace_init_config.py
index ff09dc24e..4a2a10d04 100644
--- a/tests/unit/cli/test_workspace_init_config.py
+++ b/tests/unit/cli/test_workspace_init_config.py
@@ -19,6 +19,7 @@ from repowise.cli.commands.init_cmd._workspace_config import (
build_workspace_config,
)
from repowise.cli.commands.init_cmd._workspace_repos import select_workspace_repos
+from repowise.cli.ui.brand import THEME
from repowise.cli.ui.workspace_selection import interactive_repo_select
from repowise.core.workspace import WorkspaceConfig
@@ -41,7 +42,7 @@ def _write(root: Path, aliases: list[str], default: str, **extra: object) -> Non
def _build(root: Path, picked: list[str], primary: str, **kw: bool) -> WorkspaceConfig:
- console = Console(record=True, width=200)
+ console = Console(record=True, width=200, theme=THEME)
repos = [_repo(root, n) for n in picked]
pick = WorkspacePick(repos, root.resolve(), primary, repos[0], kw.get("primary_picked", False))
cfg = build_workspace_config(pick, console=console, ask=kw.get("ask", False))
@@ -132,7 +133,7 @@ def test_picker_number_column_fits_three_digits() -> None:
SimpleNamespace(name=f"r{i}", path=Path(f"/w/r{i}"), has_repowise=False, is_submodule=False)
for i in range(226)
]
- console = Console(record=True, width=120)
+ console = Console(record=True, width=120, theme=THEME)
with patch("repowise.cli.ui.workspace_selection.Prompt.ask", return_value="none"):
interactive_repo_select(console, repos)
text = console.export_text()