Skip to content

feat(cli): smooth path 1a — non-interactive init + better docker errors#41

Closed
VarunGitGood wants to merge 1 commit into
mainfrom
feat/smooth-1a
Closed

feat(cli): smooth path 1a — non-interactive init + better docker errors#41
VarunGitGood wants to merge 1 commit into
mainfrom
feat/smooth-1a

Conversation

@VarunGitGood
Copy link
Copy Markdown
Owner

Summary

Three rough edges discovered during a clean-clone walk of path 1a (uv sync → `repi init --with-docker` → `repi serve` → `repi ui`):

  1. `repi init` was prompt-only — no way to drive it from a script or CI. Adds `--provider `, `--api-key `, and `--api-key-stdin` flags. Interactive prompts remain the default. Two failure modes get explicit exit codes:

    • `--api-key` + `--api-key-stdin` together → exit 2 (mutually exclusive).
    • Unknown `--provider` → exit 2 with the allowed values listed.

    Ollama correctly skips the key prompt entirely.

  2. "docker compose failed" hid a daemon-down problem. When Docker Desktop isn't running but the CLI is installed, the previous flow surfaced an unactionable error. Split the probe into `_docker_compose_cmd()` (CLI presence) and `_docker_daemon_up()` (daemon reachable, via `docker info`). Each emits a distinct message pointing at the right fix.

  3. `repi ui`'s first run looked frozen. The first run does `npm install` (~10–30s cold cache). The previous "node_modules missing — running npm install..." line was easy to read as "it's hanging." Updated to set duration expectations and clarify it's a one-time cost.

Usage examples

# Fully unattended
repi init --provider mistral --api-key sk-... --with-docker

# From a secrets manager
pass show repi/mistral | repi init --provider mistral --api-key-stdin --with-docker

# Interactive (unchanged)
repi init --with-docker

Test plan

  • `uv run pytest tests/ -v` — 80/80 pass (was 74; +6 init flag tests in `tests/test_cli_init_flags.py`)
  • Clean-clone walk: `uv sync` → `repi init --provider mistral --api-key sk-walk --with-docker` → `repi serve` → `repi ui` → `repi stop` all work without prompts
  • `echo sk-... | repi init --provider mistral --api-key-stdin --force` writes the key correctly
  • `--api-key + --api-key-stdin` exits 2
  • `--provider azure-openai` exits 2 with allowed list
  • `--provider ollama` writes config without prompting for a key

…error

Three rough edges discovered during a clean-clone walk of path 1a
(uv sync → repi init --with-docker → repi serve → repi ui):

1. repi init was prompt-only

No way to drive it from a script or CI. Adds three new flags:

  --provider <name>        Pre-select the LLM provider, skip the prompt.
  --api-key <key>          Pre-supply the key, skip the prompt.
  --api-key-stdin          Read the key from stdin's first line — for
                           piping from a secrets manager.

Interactive prompts remain the default when no flags are passed.
--api-key and --api-key-stdin are mutually exclusive (exit 2). An
invalid --provider exits 2 with the allowed values listed. Ollama
correctly skips the key prompt entirely (no key required).

Six new tests in tests/test_cli_init_flags.py cover all paths.

2. "docker compose failed" hid a daemon-down problem

When Docker Desktop isn't running but the CLI is installed, the previous
flow surfaced "docker compose failed" with no hint at the actual cause.
Splits the probe into _docker_compose_cmd() (CLI presence) and
_docker_daemon_up() (daemon reachable, via `docker info`). Each emits a
distinct actionable message — install Docker / start Docker — so the
user knows which knob to turn.

3. repi ui's first run looked frozen

The first run of `repi ui` runs `npm install` (~10–30s on cold cache).
The previous "node_modules missing — running npm install..." line was
easy to read as "it's hanging." Now prints a clearer one-liner that
sets expectations on duration and clarifies it's a one-time cost.

Tests: 80 pass (was 74; +6 init flag tests).
@vercel
Copy link
Copy Markdown

vercel Bot commented May 30, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
repi Ready Ready Preview, Comment May 30, 2026 1:15pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant