feat: claudely setup interactive wizard + config persistence#16
Merged
Conversation
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).
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
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 subsequentclaudelyrun.Closes #14
What's included
src/config.ts(new) — all config I/O consolidated:configDir()(XDG/macOS/Windows),loadConfig(),saveConfig(), plusloadSettings()moved from compat.tssrc/setup.ts(new) — interactive wizard: provider picker → base URL → auth token → connection test with model discovery → default model → confirm & savesrc/config.test.ts(new) — 11 unit tests: platform paths, round-trip, missing/corrupt file, directory creation, loadSettingssrc/compat.ts—loadSettingsremoved, pure business logic only (no morefsimport)src/cli.ts—setupsubcommand dispatch, config threaded into resolution chain (CLI flag > env var > config > provider default)src/providers.ts— llamacpp switched toauth_tokenenvStyle (fixes 401 for Claude Max users)Bug fixes included
Authorization: Bearerheader (was missing, caused silent 401 on servers requiring auth)api_keytoauth_tokenenvStyle — Claude Max users' OAuth session token was overridingANTHROPIC_API_KEY, causing the local server to reject requests with 401Test plan
npm test— 87 pass (1 pre-existing flaky lister test)npm run build— clean compileclaudely setup— wizard runs, discovers models, saves configclaudely --new --print "hello"— reads saved config, connects to llama-server