feat(tui): add and remove providers from the Providers tab (PR-4) - #70
Merged
xjoker merged 1 commit intoAug 26, 2026
Merged
Conversation
On the Providers tab: - 'a' opens a multi-step add wizard (alias -> base URL -> model -> API key) reusing the single-line input pattern; the API-key step is masked in the status bar and the key is never echoed. Each step validates (alias rules + collision with providers/accounts, http(s) base URL, non-empty model/key); on completion it derives env_key/provider_id, saves via provider::save, and reloads. - 'd' removes the selected provider after a y/n confirmation (ConfirmAction::RemoveProvider). - Keys route per tab; the wizard consumes raw case-sensitive input. A tab-aware footer shows the Providers key hints. Unit tests: wizard collects fields and saves (with hermetic CODEX_SWITCH_HOME/ CODEX_HOME), stays on-step for a bad base URL, and request+confirm removes a provider. Co-authored-by: xJoker <xjoker@users.noreply.github.com>
xjoker
marked this pull request as ready for review
August 26, 2026 05:01
This was referenced Aug 26, 2026
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.
Fourth slice of custom-provider support (方案 A). Makes the Providers tab interactive.
Stacked on PR-3 (#69) — base branch is
cursor/provider-tui-panel-5a91; retarget down the stack as they merge.What's in this PR
On the Providers tab:
a— add wizard: a multi-step, single-line prompt walking throughalias → base URL → model → API key, reusing the existing input pattern. The API-key step is masked in the status bar and the key is never echoed. Each step validates (alias rules + collision with existing providers/accounts,http(s)://base URL, non-empty model/key). On completion it derivesenv_key(CODEX_SWITCH_<ALIAS>_KEY) andprovider_id, saves viaprovider::save, reloads, and selects the new row.d— remove: deletes the selected provider after ay/nconfirmation (ConfirmAction::RemoveProvider).j/k nav · a add · d remove · Tab accounts · h help · q quit).Now both entry points requested — CLI (PR-1) and TUI — can add providers.
Tests
provider_add_wizard_collects_fields_and_saves— drives the wizard key-by-key (hermeticCODEX_SWITCH_HOME/CODEX_HOME) and asserts the saved profile (base_url/model/derived env_key/key/wire_api), tab switch, and reload.provider_add_wizard_stays_on_step_for_a_bad_base_url— invalid base URL keeps the wizard on that step.request_and_confirm_remove_provider_deletes_it—dasks for confirmation;yremoves and reloads.cargo fmt --check,cargo clippy --all-targets --all-features -- -D warnings,cargo test --all— all pass, 0 failed.Manual demo (real TUI, verified via video review)
Empty Providers tab →
a→ typed alias/base URL/model/masked API key → provider appears in the table (no secret) →d→Remove provider 'openrouter'? (y/n)→y→ table empty again.tui_provider_add_remove_wizard_demo.mp4
API-key step masked:
add wizard API key masked
Provider added (no secret shown):
provider added
Remove confirmation:
remove confirmation
Note: CI Format and audit will be red until #63 (webbrowser RUSTSEC bump) merges to
dev; pre-existing and unrelated.To show artifacts inline, enable in settings.