Skip to content

fix(tui): sort provider presets alphabetically in the add-provider wizard - #94

Merged
Ooooze merged 1 commit into
mainfrom
fix/wizard-preset-order-v2
Aug 11, 2026
Merged

fix(tui): sort provider presets alphabetically in the add-provider wizard#94
Ooooze merged 1 commit into
mainfrom
fix/wizard-preset-order-v2

Conversation

@sosidudku1

Copy link
Copy Markdown
Collaborator

What

The add-provider wizard listed the ten service presets in code-insertion order (Nous, Groq, DeepSeek, ...). This sorts PROVIDER_PRESETS by 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_ORDER derives 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. tsc clean; full run identical to origin/main baseline, zero new failures.

…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>
@Ooooze
Ooooze merged commit 0d7c1af into main Aug 11, 2026
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.

2 participants