Skip to content

[T-008] CLI skeleton: Typer app, global options, error → exit-code mapping #20

Closed

Description

@CodewithJha

Task T-008 · Milestone M1 — Foundation · Size S · Priority P0 · Epic #1

Implements FR-CLI-001

Branch feat/t-008-cli-skeleton-typer-app-global — one task = one branch = one PR (doc 32 §6)

Summary

Create the roboprobe console entry point with Typer/Rich, global --config/--log-level options, sub-app registration and the exit-code contract of doc 05 §11.

Context / motivation

Many tasks add CLI commands (config, db, space, campaign, worker, …). A skeleton with one module per command group lets them be added in parallel with only a one-line registration each.

Scope

In scope

  • backend/src/roboprobe/cli/main.py: Typer root app, --version, global options, COMMAND_GROUPS registration list.
  • [project.scripts] roboprobe = "roboprobe.cli.main:app".
  • Error handling: ConfigError/ValidationError → exit 2, other RoboProbeError → exit 1, success 0; exit 3 reserved for --fail-on-failure (doc 05 §11).
  • Rich-based presentation helpers in cli/_output.py (tables, JSON output flag --json).

Out of scope

  • Actual commands (T-003b, T-045a–c, T-013b, T-026, …)

Implementation guidance

  • Each command group lives in its own module cli/<group>.py exposing app = typer.Typer(); main.py only imports and registers them — keeps merge conflicts to one line.
  • print is allowed only in CLI presentation code (doc 16 §3).
  • The CLI must build services through roboprobe.bootstrap.cli (T-046) once that exists; until then commands receive settings via load_settings.
  • Standards: respect the layering contracts (doc 16 §2) and conventions in doc 34; no hard-coded tunables — thresholds/defaults come from typed settings (doc 27); no magic numbers (ruff PLR2004); public APIs typed (mypy strict) and documented.

Acceptance criteria

  • uv run roboprobe --help and --version work.
  • Exit codes verified for success, validation error, runtime error.
  • Adding a command group requires one import + one list entry (documented in module docstring).
  • Tests listed below added and green in CI; coverage of new code meets the gate in doc 18 §3.
  • Docs, config reference and CHANGELOG Unreleased updated where behaviour, keys or interfaces changed.
  • Definition of Done (doc 32 §3) satisfied.

Tests required

  • tests/unit/cli/test_main.py using typer.testing.CliRunner.

Dependencies

Blocked by: #12 (T-001), #16 (T-002b)

Blocks: #21 (T-003b), #67 (T-013b), #125 (T-014), #93 (T-039b), #89 (T-045a)

Parallelization notes

Files / paths owned by this task — avoid editing other paths; shared files (pyproject.toml entry points, cli/main.py, api/routers/__init__.py, router.tsx, docker/compose.yaml, ci.yml) are append-only:

  • backend/src/roboprobe/cli/main.py
  • backend/src/roboprobe/cli/_output.py
  • backend/pyproject.toml ([project.scripts])
  • backend/tests/unit/cli/test_main.py

After merge, cli/main.py becomes an append-only registration list; conflicts are trivial.

Definition of Done

Per doc 32 §3 and AGENTS.md §5: lint, format, mypy strict and import-linter green; tests added and passing; docs updated; PR template completed with Closes #<this issue>; Conventional Commit messages referencing T-008 (doc 16 §6); commits authored only by the repository owner identity (AGENTS.md §4); CI green; reviewer checklist (doc 32 §5.1) satisfied.

References

Design docs: doc 05 §11 · doc 34 §5 · doc 16 §3

Requirements: FR-CLI-001 (traceability: doc 28)

External:

Activity

  1. added this to the M1 — Foundation milestone on Nov 19, 2026
  2. added
    area:cliCommand-line interface
    priority:P0Critical path / blocks others
    taskChild task of a milestone epic
    on Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:cliCommand-line interfacemilestone:M1M1 — Foundationpriority:P0Critical path / blocks otherssize:S<= 1 daytaskChild task of a milestone epictype:featureNew functionality

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions