fix(tui): sort provider presets alphabetically in the add-provider wizard - #94
Merged
Conversation
…zard The wizard's provider list keeps the two catalog kinds (OpenRouter, AI/ML API) on top and the manual OpenAI-compatible entry last, but the preset rows in between followed the order services were added to the code. Sort PROVIDER_PRESETS by label (plain code-unit order, no locale) so the list reads predictably: Cerebras, DeepSeek, Fireworks AI, Groq, LM Studio, Mistral, Nous Research, Ollama Cloud, Together AI, xAI. KIND_ROW_ORDER in providers-wizard-phases.ts derives the pick_kind rows from the array, and the render layer derives its labels from KIND_ROW_ORDER, so sorting the array keeps cursor, labels and key bindings consistent with no further changes. The LLM panel is untouched: connected providers still show in the order they were added. The order also survives new presets: a row's position comes from its label, not from where the entry is appended in the code. Tests: new invariants lock the alphabetical order of the presets and the catalogs-first / manual-last row layout; the two key-binding tests that hardcoded Nous's row now compute it from PROVIDER_PRESETS, and the fourth-row test lands on DeepSeek, the second preset. Co-Authored-By: Claude Fable 5 <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.
What
The add-provider wizard listed the ten service presets in code-insertion order (Nous, Groq, DeepSeek, ...). This sorts
PROVIDER_PRESETSby label (plain code-unit order), so the list reads: Cerebras, DeepSeek, Fireworks AI, Groq, LM Studio, Mistral, Nous Research, Ollama Cloud, Together AI, xAI. Catalogs stay first, manual entry stays last.Why it is safe
KIND_ROW_ORDERderives the rows from the array and the render layer derives labels from it, so cursor position, labels and key bindings stay consistent by construction. The LLM panel is untouched: connected providers still show in the order they were added. The order is stable as new presets land (for example the OrcaRouter preset in #89): a row's position comes from its label through the sort, not a hand-written order.Testing
New invariants lock the alphabetical preset order and the catalogs-first / presets-alphabetical / manual-last row order; the two key-binding tests that hardcoded row indexes now compute them.
tscclean; full run identical to origin/main baseline, zero new failures.