Commit 7fbc71cb authored by Jan Reimes's avatar Jan Reimes
Browse files

feat(ai): add AI command set for document processing and workspace management

* Implement AI commands for summarization, conversion, querying, and processing of documents.
* Introduce workspace management commands including creation, listing, and member management.
* Enhance error handling and output formatting for user-friendly CLI experience.
* Integrate AI features as optional dependency in the main CLI application.
parent 3685ea61
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2,6 +2,6 @@

from __future__ import annotations

from tdoc_crawler.cli.app import app
from tdoc_crawler.cli.tdoc_app import app

__all__ = ["app"]
+2 −809

File changed.

Preview size limit exceeded, changes collapsed.

+898 −0

File added.

Preview size limit exceeded, changes collapsed.

+7 −6
Original line number Diff line number Diff line
@@ -37,9 +37,14 @@ from tdoc_crawler.tdocs.models import TDocQueryConfig
from tdoc_crawler.tdocs.operations.checkout import checkout_tdoc, prepare_tdoc_file
from tdoc_crawler.tdocs.operations.fetch import fetch_missing_tdocs

try:
    from tdoc_crawler.cli.ai import ai_app
except ImportError:  # pragma: no cover - optional dependency
    ai_app = None

load_dotenv()

app = typer.Typer(help="TDoc crawler - crawl and query structured 3GPP metadata")
app = typer.Typer(help="3GPP crawler - crawl and query structured 3GPP metadata")

HELP_PANEL_MAIN = "Main Commands"
HELP_PANEL_CRAWLING = "Crawling Commands"
@@ -230,11 +235,7 @@ def _register_optional_ai_commands() -> None:
        version("tdoc-ai")
    except PackageNotFoundError:
        return

    try:
        # Importing here to avoid hard dependency on tdoc-ai for users who don't need AI features
        from tdoc_crawler.cli.ai import ai_app  # noqa: PLC0415
    except ImportError:
    if ai_app is None:
        return
    app.add_typer(ai_app, name="ai", help="AI document processing")

+43 −0
Original line number Diff line number Diff line
"""Spec-focused CLI application with Typer command definitions."""

from __future__ import annotations

import typer

from tdoc_crawler.cli.args import CacheDirOption, VerbosityOption
from tdoc_crawler.cli.crawl import crawl_specs
from tdoc_crawler.cli.query import query_specs
from tdoc_crawler.cli.specs import checkout_spec, open_spec
from tdoc_crawler.logging import DEFAULT_LEVEL as DEFAULT_VERBOSITY
from tdoc_crawler.logging import set_verbosity

spec_app = typer.Typer(help="3GPP Crawler - Technical Specifications")

HELP_PANEL_MAIN = "Main Commands"
HELP_PANEL_CRAWLING = "Crawling Commands"
HELP_PANEL_QUERY = "Query Commands"


@spec_app.callback()
def _spec_app_callback(
    ctx: typer.Context,
    cache_dir: CacheDirOption = None,
    verbosity: VerbosityOption = str(DEFAULT_VERBOSITY),
) -> None:
    """Global CLI options for the spec-only app."""
    _ = ctx, cache_dir
    set_verbosity(verbosity)


# Register crawl commands
spec_app.command("crawl-specs", rich_help_panel=HELP_PANEL_CRAWLING)(crawl_specs)

# Register query commands
spec_app.command("query-specs", rich_help_panel=HELP_PANEL_QUERY)(query_specs)

# Register spec commands
spec_app.command("checkout-spec", rich_help_panel=HELP_PANEL_MAIN)(checkout_spec)
spec_app.command("open-spec", rich_help_panel=HELP_PANEL_MAIN)(open_spec)


__all__ = ["spec_app"]
Loading