import typer
from rich.console import Console
from rich import print
from src.pr_summary.cli import app as pr_cli
from src.jira.cli import app as jira_cli

# Create console for rich output
console = Console()

# Create main app with better help
app = typer.Typer(
    name="giji",
    help="🛠️  Giji - Development Tools CLI\n\n"
         "A collection of tools for development workflow:\n"
         "- 📝 PR Summary Generation\n"
         "- 🎫 Jira Integration",
    no_args_is_help=True
)

# Add sub-commands with improved help messages
app.add_typer(
    pr_cli,
    name="pr",
    help="📝 Generate and manage PR summaries"
)

app.add_typer(
    jira_cli,
    name="jira",
    help="🎫 Interact with Jira issues"
)

def main():
    """Main entry point for the CLI"""
    try:
        app()
    except Exception as e:
        print(f"[red]Error:[/red] {str(e)}")
        raise typer.Exit(1) 