Skip to content

feat: claudely setup interactive wizard + config persistence#16

Merged
mforce merged 6 commits intomainfrom
feat/setup-wizard
May 4, 2026
Merged

feat: claudely setup interactive wizard + config persistence#16
mforce merged 6 commits intomainfrom
feat/setup-wizard

Conversation

@mforce
Copy link
Copy Markdown
Owner

@mforce mforce commented May 4, 2026

Summary

Adds claudely setup — an interactive wizard that configures provider, base URL, auth token, and default model. Persists to a platform-native config file and loads on every subsequent claudely run.

Closes #14

What's included

  • src/config.ts (new) — all config I/O consolidated: configDir() (XDG/macOS/Windows), loadConfig(), saveConfig(), plus loadSettings() moved from compat.ts
  • src/setup.ts (new) — interactive wizard: provider picker → base URL → auth token → connection test with model discovery → default model → confirm & save
  • src/config.test.ts (new) — 11 unit tests: platform paths, round-trip, missing/corrupt file, directory creation, loadSettings
  • src/compat.tsloadSettings removed, pure business logic only (no more fs import)
  • src/cli.tssetup subcommand dispatch, config threaded into resolution chain (CLI flag > env var > config > provider default)
  • src/providers.ts — llamacpp switched to auth_token envStyle (fixes 401 for Claude Max users)

Bug fixes included

  • Setup wizard connection test now sends Authorization: Bearer header (was missing, caused silent 401 on servers requiring auth)
  • llamacpp provider switched from api_key to auth_token envStyle — Claude Max users' OAuth session token was overriding ANTHROPIC_API_KEY, causing the local server to reject requests with 401

Test plan

  • npm test — 87 pass (1 pre-existing flaky lister test)
  • npm run build — clean compile
  • claudely setup — wizard runs, discovers models, saves config
  • claudely --new --print "hello" — reads saved config, connects to llama-server
  • llamacpp auth verified via curl (x-api-key + Bearer both work on /v1/messages)
  • CI matrix (Node 20 + 22) green

mforce added 6 commits May 3, 2026 19:10
Decouples config I/O from compat business logic. config.ts now owns all
disk reads (claudely config + claude settings). compat.ts keeps only
applyCompat and the incompatibility table.
loadConfig() now participates in provider/baseUrl/token/model resolution.
Precedence: CLI flag > env var > config file > provider default.
Walks the user through provider, base URL, token, connection test, and
default model selection. Saves to platform-native config file. Re-run
pre-fills with saved values.

Closes #14
The connection test was fetching /v1/models without an Authorization
header, causing servers with API key auth to return 401 and skip model
discovery silently.
Claude Max users authenticate via OAuth — Claude Code ignores
ANTHROPIC_API_KEY and sends its session token instead, which the local
server rejects as invalid. Switching llamacpp to auth_token envStyle
sets ANTHROPIC_AUTH_TOKEN, which Claude Code uses regardless of the
auth mode (Max vs API key).
@mforce mforce merged commit 98bdb58 into main May 4, 2026
3 checks passed
@mforce mforce deleted the feat/setup-wizard branch May 4, 2026 02:44
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.

feat: claudely setup — interactive configuration wizard

1 participant