feat: backend setup wizard and CLI switch commands#5
Merged
Conversation
added 8 commits
April 15, 2026 15:10
Add interactive `inline-cli setup` for first-time backend selection with CLI tool detection, and `inline-cli backend` subcommands (list/show/set) for switching backends at runtime. Rename "cli" backend to "claude" with backward compatibility. Auto-restart daemon on backend switch. Install script now runs setup post-install.
- Remove codex from backend registry (no server handler exists) - Extract installStatus(), findBackend(), restartDaemonIfRunning() helpers to eliminate duplication between setup.go and backend.go - Extract extractPromptAndHistory() and formatHistory() in backend package to deduplicate prompt-building logic across cli, gemini, and opencode - Fix config file permissions: use 0600 instead of default 0666 - Remove TOCTOU os.Stat guard in SaveBackend, handle os.IsNotExist directly - Remove unused ConfigFilePath() export - Remove redundant comments that restate the code Net -72 lines.
Update install instructions to use setup wizard instead of hardcoded API key. Document new backend commands (setup, backend list/show/set). Update backends table with claude, gemini, opencode. Add env vars for gemini and opencode paths. Update architecture diagram to show multiple backend targets.
- OpenCode backend now resolves the binary lazily at query time (matching claude and gemini backends) instead of eagerly at daemon startup. This fixes daemon startup failures when opencode is not yet in PATH. - Gemini backend now returns the response without error when output was produced but the CLI exits non-zero (e.g. skill conflict warnings). Previously this was treated as a hard error, stopping the response.
The env var silently overrode config file backend selection, making `backend set` and `setup` appear broken. Backend switching is now solely through `inline-cli backend set` or `inline-cli setup`, which write to the config file. Remove all INLINE_CLI_BACKEND references from config loading, CLI warnings, and documentation.
- Shell-quote API key output in setup wizard to prevent injection (C1) - Use os.Stat before toml.DecodeFile in SaveBackend matching Load() pattern, avoiding unreliable os.IsNotExist with wrapped TOML errors (C2) - Atomic config writes via temp file + os.Rename to prevent corruption (H3/H4) - Warn on stderr when config.Load() fails in restartDaemonIfRunning (H2) - Fix stale Backend comment in Config struct (M1)
Replace firstLine() with extractError() that skips known non-fatal warnings (skill conflicts, stack traces) and prioritizes actionable API error messages (INVALID_ARGUMENT, PERMISSION_DENIED, etc.).
- Replace make install with explicit cp to ~/.local/bin - Consolidate shell init + setup + restart into one numbered block - Fix Go version requirement (1.22 → 1.26) - Add make targets reference table
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
inline-cli setupcommand for first-time backend selection with automatic CLI tool detection (claude, gemini, opencode, codex)inline-cli backendsubcommand group:list,show,set <name>for runtime backend switchingbackend setsetuppost-install when stdin is a terminalTest plan
inline-cli setup— interactive flow works, writes config, detects installed CLIsinline-cli backend list— shows all backends with availability and active markerinline-cli backend show— prints current backend nameinline-cli backend set gemini— switches backend, restarts daemongo build ./...andgo test ./... -racepass