Skip to content

Offer Claude Code in the bot editor (#196) - #312

Merged
regnull merged 1 commit into
regnull:mainfrom
bymarvin:feat/cli-agent-ui
Nov 3, 2026
Merged

regnull merged 1 commit into
regnull:mainfrom
bymarvin:feat/cli-agent-ui

Conversation

@bymarvin

Copy link
Copy Markdown
Collaborator

Part of #196, after #285: the editor side for CLI bots.

  • Provider. The provider list offers Claude Code when the CLI is found. GET /providers gets a cli_agents field for that, a file lookup only; the existing providers list stays as it is, since Settings shows a key badge for each entry. A bot already on Claude Code keeps the option, marked "not found", when the CLI is gone.
  • Status. GET /providers/cli/{id} runs the CLI once for the editor: where it is, its version and whether claude auth status reports a login (its exit code; the output is not passed on), or why it can't run (not found, too old, not logged in). The editor shows that under the provider and refetches it on focus, so a login in a terminal shows up when you come back.
  • Model is a free field with sonnet, opus and haiku as suggestions; empty uses the CLI's default.
  • Access is the two levels from feat: run a bot's turns through a coding agent CLI, starting with Claude Code #285: "Read only" and "Read and edit files", each with one line on what it allows. Neither runs commands.
  • The tools and skills lists are replaced by one line for a CLI bot, since none of them reach the CLI. Effort, web search and the OpenRouter fallback warning don't apply and don't show.
  • The README's API-only note is gone.

I left the setup wizard alone: it sets up the chat provider that thread titles and memory need even for a CLI bot, and a CLI doesn't replace that.

Testing

  • Backend: three endpoint tests against the fake claude (found or not without running it, status with and without login, missing and too old). ruff check passes; the full suite passes on Windows 11 (Python 3.13).
  • Frontend: two editor tests (offered only when found, the access level saved, no tools or OpenRouter warning; the hints for a missing CLI). typecheck, lint and test pass, except electron/main.test.ts, which needs bash on PATH.
  • The installed CLI (2.1.283) in a local instance: I checked the status endpoint and the editor hints against it and created the bot in the editor. The reply run itself hit an expired login here and showed the login hint (screenshot below); a full run against the CLI is in feat: run a bot's turns through a coding agent CLI, starting with Claude Code #285.

claude auth status still reported the expired OAuth login as logged in until the first failed run, so the editor's login state is only as good as what the CLI says.

The provider list offers Claude Code when the CLI is found. A CLI bot gets a
free model field, the two access levels and the CLI's status from
GET /providers/cli/{id}: where it is, its version and whether
`claude auth status` reports a login, or why it can't run.

@regnull regnull left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Risk 3. CI is green (backend and frontend) and the merge state is CLEAN at 91c7f9b.

Musts: none.

External-author checks

  • No new dependencies. No CI or workflow changes. No secrets touched.
  • The new GET /providers/cli/{provider} is the only thing that runs a process. It only accepts providers in ADAPTERS (404 otherwise). The executable comes from find_executable(adapter, settings), never from the request. It runs only main's existing version and auth status argv, under child_env(), which strips OpenBot's private env such as provider keys. Only the exit code is returned from the login check, not its output.
  • The model string is still validated by main's settings_error (_MODEL regex) on save and before each run.
  • withCode renders backtick spans as React <code> elements, with no dangerouslySetInnerHTML.

Shoulds

  1. BotEditorPage.tsx: when a bot switches to a CLI provider, the Tools, Skills and MCP sections are hidden, but tool_names and skill_names stay in the form and get saved. Clear them, or say they're kept, so they don't silently come back when the bot switches away.
  2. BotEditorPage.tsx status hint: if version is null (an adapter with no minimum version), it shows "… null at /path". Not reachable for Claude Code today.

Verified

  • I tested on a local merge of this PR with main and #313; it had no conflicts.
  • uv run pytest tests/test_cli_agents.py passed 49/49, and ruff check . is clean.
  • vitest on BotEditorPage, SettingsPage and toolGroups passed 16/16 (under Node 22, since jsdom needs it). tsc -b is clean.

@regnull
regnull merged commit af667f7 into regnull:main Nov 3, 2026
2 checks passed
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.

2 participants