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.

fix(cli): print whole decision titles in decision health lists (#4389)

Steve Jasonb5176c701a80
diff --git a/packages/cli/src/repowise/cli/commands/decision_cmd.py b/packages/cli/src/repowise/cli/commands/decision_cmd.py
index 93f59ed24..aa4a3ef7c 100644
--- a/packages/cli/src/repowise/cli/commands/decision_cmd.py
+++ b/packages/cli/src/repowise/cli/commands/decision_cmd.py
@@ -8,6 +8,7 @@ from pathlib import Path
import click
import structlog
+from rich.markup import escape
from rich.panel import Panel
from rich.table import Table
@@ -1130,7 +1131,7 @@ def _print_health_lists(health: dict) -> None:
"Stale decisions",
health["stale_decisions"],
5,
- lambda d: f"{d.id[:8]} {d.title[:50]} (staleness: {d.staleness_score:.2f})",
+ lambda d: f"{d.id[:8]} {escape(d.title)} (staleness: {d.staleness_score:.2f})",
)
_print_capped("yellow", "Ungoverned hotspots", health["ungoverned_hotspots"], 10, str)
_print_capped(
@@ -1138,7 +1139,7 @@ def _print_health_lists(health: dict) -> None:
"Proposed decisions",
health["proposed_awaiting_review"],
5,
- lambda d: f"{d.id[:8]} {d.title[:50]} (source: {d.source})",
+ lambda d: f"{d.id[:8]} {escape(d.title)} (source: {d.source})",
)
diff --git a/tests/unit/cli/test_decision_cmd.py b/tests/unit/cli/test_decision_cmd.py
index 12f73addf..9d53f88db 100644
--- a/tests/unit/cli/test_decision_cmd.py
+++ b/tests/unit/cli/test_decision_cmd.py
@@ -551,6 +551,60 @@ def test_decision_health_prints_summary(indexed_repo: Path) -> None:
assert "Proposed (needs review)" in result.output
+def test_decision_health_lists_print_the_whole_title(indexed_repo: Path) -> None:
+ title = "Backfill path mapping needs repo-tied evidence for deleted directories"
+ assert len(title) > 50
+ _seed_wiki_db(
+ indexed_repo,
+ [
+ {
+ "id": "jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj",
+ "title": title,
+ "status": "proposed",
+ },
+ {
+ "id": "kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk",
+ "title": title,
+ "status": "active",
+ "staleness": 0.8,
+ },
+ ],
+ )
+
+ result = CliRunner().invoke(cli, ["decision", "health", str(indexed_repo)])
+ assert result.exit_code == 0, result.output
+ # Rich wraps long lines at the terminal width, so compare ignoring whitespace.
+ flattened = " ".join(result.output.split())
+ assert flattened.count(title) == 2, result.output
+
+
+def test_decision_health_lists_treat_titles_as_plain_text(indexed_repo: Path) -> None:
+ markup_title = "Use [bold]x[/bold] for the cache key"
+ closing_title = "Drop the [/] shorthand"
+ _seed_wiki_db(
+ indexed_repo,
+ [
+ {
+ "id": "llllllllllllllllllllllllllllllll",
+ "title": markup_title,
+ "status": "proposed",
+ },
+ {
+ "id": "mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm",
+ "title": closing_title,
+ "status": "active",
+ "staleness": 0.8,
+ },
+ ],
+ )
+
+ result = CliRunner().invoke(cli, ["decision", "health", str(indexed_repo)])
+ assert result.exit_code == 0, result.output
+ flattened = " ".join(result.output.split())
+ assert markup_title in flattened, result.output
+ assert closing_title in flattened, result.output
+
+
class TestTheLifecycleIsDrivableByAnAgent:
"""Confirm/dismiss/deprecate are how a decision gains and loses authority.