Skip to content

A8: CLI — repi ask, repi investigate, repi sessions (supersedes #29) #61

@VarunGitGood

Description

@VarunGitGood

Why

Investigation and chat should both be usable from the terminal without curl-ing the HTTP API. This issue is the CLI mirror of the chat and Deep-Research endpoints, and supersedes the older single-command framing in #29.

Scope (in)

repi ask "<query>"

Calls POST /chat. Streams tokens to stdout. Flags:

  • --service <name> — pre-fills filters.service
  • --since <natural-language> — pre-fills filters.time_from (parsed via the time helpers in repi/intent/resolver.py, or passed as-is appended to the query)
  • --until <natural-language> — pre-fills filters.time_to
  • --conversation <id> — continues an existing conversation; otherwise starts a new one and prints the id at the end

repi investigate "<query>"

Calls POST /investigate (creates the investigation) then opens GET /investigations/{id}/stream (SSE).

  • Prints each step as it arrives: thought block (wrapped) + action (tool name + args, one line) + observation (truncated to ~200 chars).
  • Final answer printed at the end, then exits.
  • Same --service, --since, --until, --conversation flags as ask.

repi sessions list

Wraps GET /conversations (or GET /investigations until conversations land). Prints id, created_at, mode (chat / investigate / mixed), first line of the query.

repi sessions show <id>

Wraps GET /conversations/{id} (or GET /investigations/{id} fallback). Re-renders the transcript: alternating user / assistant turns with mode markers.

General

  • All commands respect REPI_API_URL (default http://localhost:8000).
  • Clear error if the server isn't reachable: "Could not reach repi server at . Is repi serve running?".

Scope (out)

Acceptance

  • Round-trip: repi serve in one terminal, repi ask "errors in cart-svc" in another prints a streamed answer.
  • repi investigate "..." streams steps and prints a final answer.
  • repi sessions list shows recent conversations; repi sessions show <id> re-renders the transcript.
  • Clean error message when the server isn't running.
  • D9: CLI-first investigation UX — repi investigate, repi sessions, repi watch #29 closed with a comment linking this issue.

Files

  • repi/cli.py

Depends on

The chat API and the conversations API.

Closes

#29

Metadata

Metadata

Assignees

No one assigned

    Labels

    distributionPackaging, install, publishenhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions