"""
Post-install prompt for swe-copilot-agents.
This .pth file is executed by Python after pip install completes.
"""

import subprocess
import sys


def _show_install_prompt():
    """Show a prompt to install agents after pip install."""
    # Check if agents are already installed
    from pathlib import Path

    cwd = Path.cwd()
    github_agents = cwd / ".github" / "agents"

    if github_agents.exists() and any(github_agents.glob("*.agent.md")):
        return  # Already installed, don't prompt

    # Show the prompt
    print()
    print("=" * 60)
    print("  swe-copilot-agents installed successfully!")
    print("=" * 60)
    print()
    print("To install the GitHub Copilot agents to your project, run:")
    print()
    print("    awesome-copilot")
    print()
    print("This will copy all agent files to .github/agents/")
    print()
    print("=" * 60)
    print()

    # Optionally offer to run it now
    try:
        response = input("Run 'awesome-copilot' now? [Y/n]: ").strip().lower()
        if response in ("", "y", "yes"):
            subprocess.run([sys.executable, "-m", "awesome_copilot.cli"], check=True)
    except (KeyboardInterrupt, EOFError):
        print()


_show_install_prompt()
# Clean up the function from namespace
del _show_install_prompt
