Claude Code. Any Model. The most powerful AI coding agent now speaks every language.
fix(cli): list every provider shortcut in --help from the definitions
Jack Rudenko6324876e91fe
diff --git a/packages/cli/src/cli-provider-shortcuts.test.ts b/packages/cli/src/cli-provider-shortcuts.test.tsnew file mode 100644index 00000000..cf052360--- /dev/null+++ b/packages/cli/src/cli-provider-shortcuts.test.ts@@ -0,0 +1,35 @@+import { describe, expect, test } from "bun:test";+import { providerShortcutRows } from "./cli.js";+import { isPickableProvider } from "./model-selector.js";+import { BUILTIN_PROVIDERS } from "./providers/provider-definitions.js";+import { TIER_LABEL } from "./providers/routing-rules.js";++describe("providerShortcutRows", () => {+ test("derives every pickable provider and all of its shortcuts from the definitions", () => {+ const rows = providerShortcutRows();+ const pickable = BUILTIN_PROVIDERS.filter(isPickableProvider);++ expect(rows).toHaveLength(pickable.length);+ for (const def of pickable) {+ expect(rows).toContainEqual({+ shortcuts: def.shortcuts,+ displayName: def.displayName,+ kind: def.isLocal ? "local" : def.tier ? TIER_LABEL[def.tier] : "",+ });+ }+ });++ test("includes the shortcuts the old hand-written table omitted", () => {+ const shortcuts = new Set(providerShortcutRows().flatMap((row) => row.shortcuts));++ for (const shortcut of ["ag", "dv", "gk", "mistral", "qtoken", "qcode", "qpay"]) {+ expect(shortcuts.has(shortcut), shortcut).toBe(true);+ }+ });++ test("contains provider facts only, with no concrete model-id column", () => {+ for (const row of providerShortcutRows()) {+ expect(Object.keys(row).sort()).toEqual(["displayName", "kind", "shortcuts"]);+ }+ });+});diff --git a/packages/cli/src/cli.ts b/packages/cli/src/cli.tsindex 0c912471..268e746e 100644--- a/packages/cli/src/cli.ts+++ b/packages/cli/src/cli.ts@@ -29,7 +29,7 @@ import {searchModels,} from "./model-loader.js";import { parseModelParams } from "./model-params.js";-import { compareByReleaseDateDesc } from "./model-selector.js";+import { compareByReleaseDateDesc, isPickableProvider } from "./model-selector.js";import {type CredentialLookup,type ProbeChainLink,@@ -59,13 +59,18 @@ import { NATIVE_NOT_PROBED } from "./providers/native-route.js";import { fetchOllamaModels } from "./providers/ollama-discovery.js";import { type ProbeResult, describeProbeState, probeLink } from "./providers/probe-live.js";import { type ProbeTarget, describeDropped, probeTargets } from "./providers/probe-runner.js";-import { BUILTIN_PROVIDERS, getProviderByName } from "./providers/provider-definitions.js";+import {+ BUILTIN_PROVIDERS,+ type ProviderDefinition,+ getProviderByName,+} from "./providers/provider-definitions.js";import { resolveProviderSlug } from "./providers/provider-slug-resolve.js";import { nativeProviderForVendor } from "./providers/route-candidates.js";import {type RouteExplanation,type RouteWarning,type RuleScope,+ TIER_LABEL,explainRoute,} from "./providers/routing-rules.js";import { setRecoveryFlagOverrides } from "./recovery/settings.js";@@ -1891,6 +1896,39 @@ async function probeModelRouting(}}+/** One row of `--help`'s provider shortcut table. */+export interface ProviderShortcutRow {+ /** Every shortcut the provider answers to before `@`. */+ shortcuts: string[];+ displayName: string;+ /** `local`, or the tier label routing gives the provider's hops. */+ kind: string;+}++/**+ * `--help`'s provider shortcut table, derived from the definitions: every+ * pickable built-in provider (`isPickableProvider`: it has shortcuts) with all of+ * its shortcuts, remote providers first, then local ones. A hand-written table+ * here missed seven providers and carried model ids that went stale.+ *+ * No model ids: which models a provider serves is the cloud models catalog's and+ * the account's to say, never a help screen's.+ */+export function providerShortcutRows(+ providers: readonly ProviderDefinition[] = BUILTIN_PROVIDERS+): ProviderShortcutRow[] {+ const pickable = providers.filter(isPickableProvider);+ const ordered = [+ ...pickable.filter((def) => !def.isLocal),+ ...pickable.filter((def) => def.isLocal),+ ];+ return ordered.map((def) => ({+ shortcuts: [...def.shortcuts],+ displayName: def.displayName,+ kind: def.isLocal ? "local" : def.tier ? TIER_LABEL[def.tier] : "",+ }));+}+/*** Print help message*/@@ -1913,6 +1951,18 @@ function printHelp(): void {// Section header helper — a colored, underlined title with a leading rule mark.const h = (title: string) => bold(cyan(`▌ ${title}`));+ // Padded before colouring: an escape sequence has no width on screen.+ const shortcutRows = providerShortcutRows();+ const shortcutsOf = (row: ProviderShortcutRow) => row.shortcuts.join(", ");+ const shortcutWidth = Math.max(...shortcutRows.map((row) => shortcutsOf(row).length));+ const nameWidth = Math.max(...shortcutRows.map((row) => row.displayName.length));+ const shortcutTable = shortcutRows+ .map(+ (row) =>+ ` ${magenta(shortcutsOf(row).padEnd(shortcutWidth))} ${dim("->")} ${row.displayName.padEnd(nameWidth)} ${dim(row.kind)}`+ )+ .join("\n");+console.log(`${bold("claudish")} ${dim("·")} Run Claude Code with any AI model${dim("OpenRouter · Gemini · OpenAI · xAI · MiniMax · Kimi · GLM · Z.AI · Sakana · Poe · LiteLLM · Local")}@@ -1931,32 +1981,8 @@ ${h("MODEL ROUTING")}${magenta("[email protected]:3")} ${dim("Local Ollama, 3 concurrent requests")}${magenta("[email protected]:0")} ${dim("Local Ollama, no limits")}- ${bold("Provider shortcuts:")}- ${magenta("g, gemini")} ${dim("->")} Google Gemini ${dim("google@gemini-3-pro")}- ${magenta("oai")} ${dim("->")} OpenAI Direct ${dim("[email protected]")}- ${magenta("cx, codex")} ${dim("->")} OpenAI Codex ${dim("[email protected] (Responses API)")}- ${magenta("or")} ${dim("->")} OpenRouter ${dim("or@openai/gpt-5.3")}- ${magenta("x-ai, xai, grok")} ${dim("->")} xAI / Grok ${dim("x-ai@grok-3")}- ${magenta("mm, mmax")} ${dim("->")} MiniMax Direct ${dim("[email protected]")}- ${magenta("mmc")} ${dim("->")} MiniMax Coding ${dim("[email protected]")}- ${magenta("kimi, moon")} ${dim("->")} Kimi Direct ${dim("kimi@kimi-k2-thinking-turbo")}- ${magenta("kc")} ${dim("->")} Kimi Coding ${dim("kc@kimi-k2-thinking-turbo")}- ${magenta("glm, zhipu")} ${dim("->")} GLM Direct ${dim("[email protected]")}- ${magenta("gc")} ${dim("->")} GLM Coding ${dim("[email protected]")}- ${magenta("z-ai, zai")} ${dim("->")} Z.AI Direct ${dim("[email protected]")}- ${magenta("oc, llama, lc, meta")} ${dim("->")} OllamaCloud ${dim("[email protected]")}- ${magenta("zen")} ${dim("->")} OpenCode Zen ${dim("zen@grok-code")}- ${magenta("zengo, zgo")} ${dim("->")} OpenCode Zen Go ${dim("zengo@grok-code")}- ${magenta("v, vertex")} ${dim("->")} Vertex AI ${dim("[email protected]")}- ${magenta("poe")} ${dim("->")} Poe ${dim("poe@GPT-4o")}- ${magenta("litellm, ll")} ${dim("->")} LiteLLM ${dim("ll@gpt-4o (needs LITELLM_BASE_URL)")}- ${magenta("ds")} ${dim("->")} DeepSeek ${dim("ds@deepseek-chat")}- ${magenta("sakana, fugu")} ${dim("->")} Sakana Fugu ${dim("fugu@fugu-ultra")}- ${magenta("sc")} ${dim("->")} Sakana Subscription ${dim("sc@fugu-ultra")}- ${magenta("ollama")} ${dim("->")} Ollama (local) ${dim("[email protected]")}- ${magenta("lms, lmstudio")} ${dim("->")} LM Studio (local) ${dim("lms@qwen")}- ${magenta("vllm")} ${dim("->")} vLLM (local) ${dim("vllm@model")}- ${magenta("mlx")} ${dim("->")} MLX (local) ${dim("mlx@model")}+ ${bold("Provider shortcuts:")} ${dim("(<shortcut>@<model>)")}+${shortcutTable}${bold("Native auto-detection")} ${dim("(when no provider specified):")}${yellow("google/*, gemini-*")} ${dim("->")} Google API