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.
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 serviceand keepsretriever pipeline run --run-mode serviceas a compatibility wrapper that delegates service execution into ingest core.That direction is right, but
nemo_retriever/adapters/cli/main.pyis now close to the 1k-line maintainability threshold because it owns app registration plus the fullingestandquerycommand implementations. Future work, especially service-mode query support and Issue #2218, should avoid adding another large branch directly intomain.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 ingestTyper options and request construction.adapters/cli/query_command.py:retriever queryTyper options and query request/workflow dispatch.nemo_retriever/ingest,nemo_retriever/query, or workflow modules as appropriate.Relationship To Current Work
Non-goals
retriever pipeline runthe owner of new root behavior.Acceptance Criteria
adapters/cli/main.pyis reduced to app setup/registration and small shared helpers.retriever ingestbehavior remains unchanged.retriever querybehavior remains unchanged.main.py.Rationale
This keeps the ongoing migration aligned with the intended ownership model: root
ingestandqueryare first-class commands, whilepipeline runis gradually sunset as a legacy/development compatibility path. It also preventsmain.pyfrom becoming a catch-all command implementation file as service-mode support expands.