"""CLI entry point — slim wrapper that registers command modules."""

from __future__ import annotations

import click

from .config import Config
from .db import Database

# Re-export shared utilities for backward compatibility
from .commands.common import console, _get_config, pass_cfg_db


@click.group()
@click.version_option(version="0.3.0")
@click.pass_context
def main(ctx):
    """IETF Draft Analyzer — track, categorize, and rate AI/agent Internet-Drafts."""
    ctx.ensure_object(dict)
    cfg = Config.load()
    db = Database(cfg)
    ctx.obj["cfg"] = cfg
    ctx.obj["db"] = db
    ctx.call_on_close(db.close)


# Register all command modules
from .commands import register_commands
register_commands(main)
