Skip to content

feat: backend setup wizard and CLI switch commands#5

Merged
CCALITA merged 8 commits intomainfrom
feat/backend-setup
Apr 15, 2026
Merged

feat: backend setup wizard and CLI switch commands#5
CCALITA merged 8 commits intomainfrom
feat/backend-setup

Conversation

@CCALITA
Copy link
Copy Markdown
Owner

@CCALITA CCALITA commented Apr 15, 2026

Summary

  • Add interactive inline-cli setup command for first-time backend selection with automatic CLI tool detection (claude, gemini, opencode, codex)
  • Add inline-cli backend subcommand group: list, show, set <name> for runtime backend switching
  • Rename "cli" backend to "claude" (backward compatible — both names accepted)
  • Auto-restart daemon when switching backends via backend set
  • Install script now runs setup post-install when stdin is a terminal

Test plan

  • inline-cli setup — interactive flow works, writes config, detects installed CLIs
  • inline-cli backend list — shows all backends with availability and active marker
  • inline-cli backend show — prints current backend name
  • inline-cli backend set gemini — switches backend, restarts daemon
  • Shift+Enter after switch uses the new backend
  • go build ./... and go test ./... -race pass

fanxiyao.3 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
@CCALITA CCALITA merged commit fe6a8b9 into main Apr 15, 2026
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