Files
SuperClaude/superclaude/cli/app.py
kazuki a4ffe52724 refactor: consolidate PM Agent optimization and pending changes
PM Agent optimization (already committed separately):
- superclaude/commands/pm.md: 1652→14 lines
- superclaude/agents/pm-agent.md: 735→429 lines
- docs/agents/pm-agent-guide.md: new guide file

Other pending changes:
- setup: framework_docs, mcp, logger, remove ui.py
- superclaude: __main__, cli/app, cli/commands/install
- tests: test_ui updates
- scripts: workflow metrics analysis tools
- docs/memory: session state updates

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-17 04:54:31 +09:00

71 lines
2.0 KiB
Python

"""
SuperClaude CLI - Root application with typer
Modern, type-safe command-line interface with rich formatting
"""
import sys
import typer
from typing import Optional
from superclaude.cli._console import console
from superclaude.cli.commands import install, doctor, config
# Create root typer app
app = typer.Typer(
name="superclaude",
help="SuperClaude Framework CLI - AI-enhanced development framework for Claude Code",
add_completion=False, # Disable shell completion for now
no_args_is_help=True, # Show help when no args provided
pretty_exceptions_enable=True, # Rich exception formatting
)
# Register command groups
app.add_typer(install.app, name="install", help="Install SuperClaude components")
app.add_typer(doctor.app, name="doctor", help="Diagnose system environment")
app.add_typer(config.app, name="config", help="Manage configuration")
def version_callback(value: bool):
"""Show version and exit"""
if value:
from superclaude import __version__
console.print(f"[bold cyan]SuperClaude[/bold cyan] version [green]{__version__}[/green]")
raise typer.Exit()
@app.callback()
def main(
version: Optional[bool] = typer.Option(
None,
"--version",
"-v",
callback=version_callback,
is_eager=True,
help="Show version and exit",
),
):
"""
SuperClaude Framework CLI
Modern command-line interface for managing SuperClaude installation,
configuration, and diagnostic operations.
"""
pass
def cli_main():
"""Entry point for CLI (called from pyproject.toml)"""
try:
app()
except KeyboardInterrupt:
console.print("\n[yellow]Operation cancelled by user[/yellow]")
sys.exit(130)
except Exception as e:
console.print(f"[bold red]Unhandled error:[/bold red] {e}")
if "--debug" in sys.argv or "--verbose" in sys.argv:
console.print_exception()
sys.exit(1)
if __name__ == "__main__":
cli_main()