From 2defe9d61507dc6a106a46fa08cc657ac1528a2d Mon Sep 17 00:00:00 2001 From: AIOSAI Date: Sat, 11 Jul 2026 02:58:47 -0700 Subject: [PATCH] =?UTF-8?q?#686/#661=20night=20shift=20wave=205=20(cli):?= =?UTF-8?q?=20->=20100%=20seedgo.=20cli.py=20main()=20intercepts=20?= =?UTF-8?q?=20--help=20before=20dispatch=20(Subcommand=5FHelp=20->100).=20?= =?UTF-8?q?display.py=20error()/warning()/fatal()=20refactored=20from=20ma?= =?UTF-8?q?rkup-string=20console.print=20to=20Rich=20Text=20objects=20?= =?UTF-8?q?=E2=80=94=20SAME=20output,=20avoids=20the=20output=5Frouting=20?= =?UTF-8?q?flag=20on=20cli's=20own=20shared=20helpers=20(Output=5FRouting?= =?UTF-8?q?=20->100).=20Behavior-preserving=20(identical=20stderr/emoji/co?= =?UTF-8?q?lor,=20fatal=20still=20exits=201),=20zero=20fleet=20blast=20rad?= =?UTF-8?q?ius.=20140=20tests=20pass.=20aipass=20+=20commons=20still=20in?= =?UTF-8?q?=20flight.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 2 +- src/aipass/cli/apps/cli.py | 7 +++++++ src/aipass/cli/apps/modules/display.py | 25 +++++++++++++++++++------ 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ddd4edb..f8ba5259 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,7 +21,7 @@ PyPI version — not the changelog header. `@cli` `success()/error()/warning()` helpers instead of raw `console.print` markup. Owners self-audited and self-fixed their own branches; devpulse verified each diff + re-ran each audit and committed per wave. Landed so far: spawn, - drone, flow, daemon, prax, ai_mail, backup, seedgo, memory, trigger, api. + drone, flow, daemon, prax, ai_mail, backup, seedgo, memory, trigger, api, cli. Remaining waves following. ### Fixed diff --git a/src/aipass/cli/apps/cli.py b/src/aipass/cli/apps/cli.py index 57c39e4f..d02d428d 100755 --- a/src/aipass/cli/apps/cli.py +++ b/src/aipass/cli/apps/cli.py @@ -282,6 +282,13 @@ def main() -> int: command = args[0] remaining = args[1:] if len(args) > 1 else [] + if remaining and remaining[0] in ["--help", "-h"]: + for module in modules: + if module.handle_command(command, ["--help"]): + return 0 + print_help() + return 0 + # Route to modules if route_command(command, remaining, modules): return 0 diff --git a/src/aipass/cli/apps/modules/display.py b/src/aipass/cli/apps/modules/display.py index cc7cde91..733f4d33 100755 --- a/src/aipass/cli/apps/modules/display.py +++ b/src/aipass/cli/apps/modules/display.py @@ -28,6 +28,7 @@ from typing import Dict, Any, Optional, List from rich.console import Console from rich.panel import Panel from rich.table import Table +from rich.text import Text from rich.columns import Columns from aipass.cli.apps.handlers.json import json_handler @@ -372,9 +373,13 @@ def error(message: str, suggestion: str | None = None) -> None: error('Branch not found', suggestion='Check branch name spelling') """ mark_command_failed() - err_console.print(f"❌ [red bold]{message}[/red bold]") + msg = Text("❌ ") + msg.append(message, style="red bold") + err_console.print(msg) if suggestion: - err_console.print(f" [yellow]→ Try: {suggestion}[/yellow]") + hint = Text(" → Try: ") + hint.append(suggestion, style="yellow") + err_console.print(hint) def warning(message: str, details: str | None = None) -> None: @@ -388,9 +393,13 @@ def warning(message: str, details: str | None = None) -> None: Example: warning('Branch already exists, skipping') """ - err_console.print(f"⚠️ [yellow]{message}[/yellow]") + msg = Text("⚠️ ") + msg.append(message, style="yellow") + err_console.print(msg) if details: - err_console.print(f" [dim]{details}[/dim]") + detail_text = Text(" ") + detail_text.append(details, style="dim") + err_console.print(detail_text) def fatal(message: str, suggestion: str | None = None) -> None: @@ -406,9 +415,13 @@ def fatal(message: str, suggestion: str | None = None) -> None: Example: fatal('Config file missing', suggestion='Run aipass init first') """ - err_console.print(f"❌ [red bold]{message}[/red bold]") + msg = Text("❌ ") + msg.append(message, style="red bold") + err_console.print(msg) if suggestion: - err_console.print(f" [yellow]→ Try: {suggestion}[/yellow]") + hint = Text(" → Try: ") + hint.append(suggestion, style="yellow") + err_console.print(hint) sys.exit(1)