feat(tui): Claude auth field selector and template chip horizontal scrolling - #417
Open
Lingrui98 wants to merge 2 commits into
Open
feat(tui): Claude auth field selector and template chip horizontal scrolling#417Lingrui98 wants to merge 2 commits into
Lingrui98 wants to merge 2 commits into
Conversation
…rolling Add a TUI row for Claude providers to toggle the authentication field between ANTHROPIC_AUTH_TOKEN (default) and ANTHROPIC_API_KEY, persisting meta.apiKeyField only when ApiKey is selected. Keep the template chip selector as a single horizontal row and implement horizontal scrolling so the focused chip remains visible in narrow terminals. Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR enhances the Rust TUI provider-add/edit experience by (1) introducing a Claude-specific auth-field selector that controls whether Claude Code settings use ANTHROPIC_AUTH_TOKEN (default) or ANTHROPIC_API_KEY, and (2) improving template “chip” rendering so the selected chip remains visible via horizontal windowing instead of wrapping.
Changes:
- Add
ClaudeAnthropicApiKeyFieldto the provider add/edit form, including help text, keybar behavior, rendering, and Enter-to-toggle handling. - Update provider JSON serialization to migrate the entered Claude key between
ANTHROPIC_AUTH_TOKENandANTHROPIC_API_KEY, and to writemeta.apiKeyFieldonly whenANTHROPIC_API_KEYis selected. - Rework template chip rendering to keep chips on a single row and scroll the visible window to keep the selected chip in view; add UI tests for the new behavior.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src-tauri/src/cli/tui/ui/tests.rs | Adds regression tests ensuring template chips keep the selected chip visible and scroll to reveal off-screen chips. |
| src-tauri/src/cli/tui/ui/forms/shared.rs | Implements horizontal “windowing” for template chip rendering and updates keybar behavior for new selector fields. |
| src-tauri/src/cli/tui/ui/forms/provider.rs | Adds label/value rendering for the new Claude auth-field selector in the provider form. |
| src-tauri/src/cli/tui/help.rs | Adds help content for the Claude auth-field selector. |
| src-tauri/src/cli/tui/form/tests.rs | Adds tests covering field presence and correct env/meta output when switching Claude auth-field selection. |
| src-tauri/src/cli/tui/form/provider_state.rs | Exposes the new selector field for applicable Claude providers and treats it as a non-text-edit field. |
| src-tauri/src/cli/tui/form.rs | Introduces the ProviderAddField::ClaudeAnthropicApiKeyField enum variant. |
| src-tauri/src/cli/tui/app/tests.rs | Adds an app-level key-handling test verifying Enter toggles the Claude auth-field selector. |
| src-tauri/src/cli/tui/app/form_handlers/provider.rs | Handles Enter activation for the new Claude selector (shared handling with the existing Codex selector). |
| src-tauri/src/cli/i18n.rs | Refactors shared “auth field” label/value text and adds Claude-specific accessors for UI/help usage. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…llback When only one of ANTHROPIC_API_KEY / ANTHROPIC_AUTH_TOKEN is configured, Claude Code may fall back to the other field from the user's global ~/.claude/settings.json. Write an explicit empty string for the unused alternate field in the temporary launch settings so the provider's choice is honored. Co-Authored-By: Claude <noreply@anthropic.com>
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.
This PR adds a TUI auth-field selector for Claude providers and keeps the template chip selector visible with horizontal scrolling.
🤖 Generated with Claude Code