Skip to content

Split root CLI command implementations out of adapters/cli/main.py #2224

@jioffe502

Description

@jioffe502

Context

PR #2209 moved root ingest/query toward a thinner CLI adapter architecture. PR #2221 adds first-class service-mode ingest under retriever ingest --run-mode service and keeps retriever pipeline run --run-mode service as a compatibility wrapper that delegates service execution into ingest core.

That direction is right, but nemo_retriever/adapters/cli/main.py is now close to the 1k-line maintainability threshold because it owns app registration plus the full ingest and query command implementations. Future work, especially service-mode query support and Issue #2218, should avoid adding another large branch directly into main.py.

Goal

Split root CLI command implementations into focused command modules while preserving existing root CLI behavior.

Suggested shape:

  • adapters/cli/main.py: Typer app creation, command registration, lazy sub-app registration, shared app-level helpers.
  • adapters/cli/ingest_command.py: retriever ingest Typer options and request construction.
  • adapters/cli/query_command.py: retriever query Typer options and query request/workflow dispatch.
  • Keep command modules as adapters only; core ingest/query policy should stay in nemo_retriever/ingest, nemo_retriever/query, or workflow modules as appropriate.

Relationship To Current Work

Non-goals

  • Do not introduce a generic ingest/query common framework.
  • Do not move eval, harness, or legacy pipeline reporting here.
  • Do not change root CLI flags or defaults unless required by the extraction.
  • Do not make retriever pipeline run the owner of new root behavior.

Acceptance Criteria

  • adapters/cli/main.py is reduced to app setup/registration and small shared helpers.
  • retriever ingest behavior remains unchanged.
  • retriever query behavior remains unchanged.
  • Future service query support has a natural home outside main.py.
  • Tests covering root ingest/query continue to pass with minimal behavior changes.

Rationale

This keeps the ongoing migration aligned with the intended ownership model: root ingest and query are first-class commands, while pipeline run is gradually sunset as a legacy/development compatibility path. It also prevents main.py from becoming a catch-all command implementation file as service-mode support expands.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions