"""TripWire CLI - Smart environment variable management.

This module provides the main CLI entry point and command registration.
"""

import click

from tripwire.branding import LOGO_BANNER, LOGO_SIMPLE

# Import all commands
from tripwire.cli.commands import (
    audit,
    check,
    diff,
    docs,
    generate,
    init,
    install_hooks,
    scan,
    schema,
    sync,
    validate,
)
from tripwire.cli.utils import console, print_help_with_banner


@click.group()
@click.option(
    "--help",
    "-h",
    is_flag=True,
    is_eager=True,
    expose_value=False,
    callback=print_help_with_banner,
    help="Show this message and exit.",
)
@click.version_option(version="0.7.1", prog_name="tripwire", message=f"{LOGO_SIMPLE}\nVersion: %(version)s")
def main() -> None:
    """TripWire - Catch config errors before they explode.

    Validate environment variables at import time with type safety,
    format validation, secret detection, and git audit capabilities.
    """
    pass


# Register all main commands
main.add_command(init.init)
main.add_command(generate.generate)
main.add_command(check.check)
main.add_command(validate.validate)
main.add_command(sync.sync)
main.add_command(scan.scan)
main.add_command(audit.audit)
main.add_command(docs.docs)
main.add_command(diff.diff)
main.add_command(install_hooks.install_hooks, name="install-hooks")

# Register schema command group
main.add_command(schema.schema)

__all__ = ["main"]
