fix(api): render 4 module --help functions in Rich (caught by tightened CLI checker)

The CLI help-checker fix (4d41065) immediately surfaced the same
console.print(parser.format_help()) laundering in 4 @api modules on its first
audit run — exactly the latent stragglers the static-scan loophole had been
hiding. Rewrote each print_help() to hand-rolled Rich markup (content was
already in the argparse epilogs); removed the help-only argparse parsers.

- api_key.py, usage_tracker.py, google_client.py, openrouter_client.py
- @api audit Cli + Overall back to 100% (38/38), 504 tests pass, no bypass

DPLAN-0217 (follow-on).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QEQZXCtgnF3NQtcttTErpq
This commit is contained in:
AIOSAI
2026-06-24 12:26:34 -07:00
co-authored by Claude Opus 4.8
parent 4d4106505f
commit 57767cc2a9
5 changed files with 139 additions and 204 deletions
+19 -25
View File
@@ -82,31 +82,25 @@ def print_introspection() -> None:
def print_help() -> None:
"""Print module help."""
import argparse
parser = argparse.ArgumentParser(
prog="drone @api",
description="Google Client - Google API authentication and service access",
formatter_class=argparse.RawDescriptionHelpFormatter,
epilog="""
COMMANDS (via drone @api):
validate google - Check Google OAuth2 credentials
reauth google - Re-run OAuth2 flow for Google
CROSS-BRANCH API:
from aipass.api.apps.modules.google_client import get_drive_service
service = get_drive_service()
CREDENTIAL SETUP:
1. Get OAuth client secret from Google Cloud Console
2. Save as: ~/.secrets/aipass/google_client_secret.json
3. Run: drone @api reauth google
4. Complete OAuth consent in browser
5. Credentials saved to: ~/.secrets/aipass/google_creds.json
""",
)
console.print(parser.format_help())
"""Print drone-compliant help output with Rich markup"""
console.print()
console.print("[bold cyan]GOOGLE_CLIENT — Google API authentication and service access[/bold cyan]")
console.print()
console.print("[yellow]COMMANDS:[/yellow] [dim](via drone @api)[/dim]")
console.print(" [cyan]validate google[/cyan] [dim]Check Google OAuth2 credentials[/dim]")
console.print(" [cyan]reauth google[/cyan] [dim]Re-run OAuth2 flow for Google[/dim]")
console.print()
console.print("[yellow]CROSS-BRANCH API:[/yellow]")
console.print(" [dim]from aipass.api.apps.modules.google_client import get_drive_service[/dim]")
console.print(" [dim]service = get_drive_service()[/dim]")
console.print()
console.print("[yellow]CREDENTIAL SETUP:[/yellow]")
console.print(" [dim]1.[/dim] Get OAuth client secret from Google Cloud Console")
console.print(" [dim]2.[/dim] Save as: [cyan]~/.secrets/aipass/google_client_secret.json[/cyan]")
console.print(" [dim]3.[/dim] Run: [cyan]drone @api reauth google[/cyan]")
console.print(" [dim]4.[/dim] Complete OAuth consent in browser")
console.print(" [dim]5.[/dim] Credentials saved to: [cyan]~/.secrets/aipass/google_creds.json[/cyan]")
console.print()
# =============================================