pi-commandcode-provider icon indicating copy to clipboard operation
pi-commandcode-provider copied to clipboard

Provider id "commandcode" renders as [commandcode] in pi's model picker — consider "command-code"

Open Popcornnnnnnnn opened this issue 1 month ago • 4 comments

Summary

The extension registers its provider under the hardcoded id commandcode. pi's /model picker renders the provider id verbatim in its badge, so every Command Code model shows as [commandcode], while the provider's display name is "Command Code" and the extension's own auth parser already accepts command-code.

Would you consider registering the provider as command-code (or making the id configurable)? It is a small branding/consistency fix and matches the hyphenated convention of the other providers in the same list.

Where the id is hardcoded

  • src/runtime.ts:160 and src/runtime.ts:203 — this.pi.registerProvider("commandcode", this.options.createProviderConfig(...))
  • index.ts:196-197 — if (ctx.model?.provider !== "commandcode") return / ctx.modelRegistry.find("commandcode", ctx.model.id)
  • src/overflow.ts:1, src/usage.ts:25, src/quota-command.ts:44 — also key on the literal id

Why the picker can't show the display name today

  • pi renders the model list as <model id> [<provider id>]; the badge is model.provider, not the provider display name.
  • modelRegistry.getProviderDisplayName() exists, but pi 1.0.4's model picker does not use it, so there is no user-side alias/display-name setting.

Consistency argument

In the same picker, every other provider id is hyphenated (zai-coding-cn, opencode-go, ubuntu-4090, …), so [commandcode] reads like a typo. The package already anticipates the hyphenated form:

  • src/api-key.ts reads the command-code key (in addition to commandcode and ~/.commandcode/auth.json).
  • The README documents {"command-code": {"type": "api", "key": "user_..."}} as a supported auth.json shape.

Suggested scope

  • Register the provider as command-code.
  • Keep the existing /commandcode-quota, /commandcode-refresh, and /commandcode-status command names (optionally add command-code-* aliases) so nothing breaks.
  • Back-compat notes:
    • Chat auth keeps working: the extension resolves its API key itself via getConfiguredApiKey(), which already reads both commandcode and command-code. A fresh /login would store the credential under the new id, and getApiKeyForProvider("commandcode") in quota-command.ts would need the new id.
    • Users' settings.json enabledModels entries such as commandcode/deepseek/deepseek-v4.1-flash would stop matching; that is a one-line user change (and could be documented in the changelog).

Happy to open a PR if you'd like.

Environment

  • pi 1.0.4
  • pi-commandcode-provider 0.7.6
  • macOS (Apple Silicon)

Popcornnnnnnnn avatar Oct 07 '26 14:10 Popcornnnnnnnn

Thanks for the detailed write-up and the PR offer. I agree the picker could display a clearer label.

The extension already registers name: "Command Code"; as you point out, pi 1.0.4's picker renders the provider ID rather than that display name.

I'd keep commandcode as the stable ID for now. It is more than a badge: it identifies models in selection patterns such as enabledModels, provider/model references in saved sessions, and the host's credential namespace. Accepting command-code in our auth parser is credential-lookup compatibility, not a provider/model alias. Keeping the slash-command names would not preserve those other references after a rename.

A display-name improvement in pi's model picker — for example, using getProviderDisplayName() while retaining the technical ID for selection — seems like the better direction. That would address the presentation without asking users to migrate their configuration or session references.

Any provider-ID rename would need a deliberate compatibility/migration plan, rather than treating it as a cosmetic patch. So I wouldn't ask you to prepare a rename PR at this stage, but the upstream picker suggestion is worth pursuing. Thanks for raising it.

pierreraby avatar Oct 07 '26 19:10 pierreraby

Checked this against pi 1.4.0 before answering, and your diagnosis still holds.

  • The model picker builds its rows with providerBadge = theme.fg("muted", [${item.provider}]); the two other label builders (modelDisplayLabel, modelItemLabel) have the same ${model.id} [${model.provider}] shape.
  • ModelRegistry.getProviderDisplayName() exists — it landed with the upstream "displayName for providers registered by extensions" work — but it has no call sites in the shipped bundle, so the picker cannot use it yet.

Status: open on purpose. This is a decision we owe you, not a stale issue.

Why it is not a patch. The provider ID is a namespace, not just a badge: it identifies models in enabledModels patterns (commandcode/...), provider/model references in saved sessions, and the host's credential namespace; quota-command.ts also resolves it through getApiKeyForProvider("commandcode"). Renaming is breaking, so it can only ride a major — the next one, which we are tracking as 0.8.0, the same vehicle as #164 (already a feat(core)!).

Two ways it can land:

  1. Upstream: the picker uses getProviderDisplayName() while keeping the technical ID for selection. No user migration at all — the better fix if pi's maintainers take it.
  2. Here: register command-code in 0.8.0 with a documented migration note — enabledModels patterns updated, a fresh /login (the credential namespace changes), and the /commandcode-* command names kept as they are.

Your offer to write the rename PR stands for that milestone. If you prepare it against the 0.8.0 line it will get reviewed there; it cannot ship in a 0.7.x patch, and I would not ask you to write it before that breaking-change branch exists.

Thanks again for the precise report — the file map you included made this quick to verify.

pierreraby avatar Oct 28 '26 09:10 pierreraby

I have opened an upstream proposal to use the provider’s existing display name in the /model picker: https://github.com/earendil-works/pi/issues/11795.

That would let the badge show [Command Code] without changing the commandcode ID or requiring users to migrate model-selection patterns and provider/model references. The proposal is awaiting upstream review; it is not an accepted or shipped fix yet.

For now, the provider ID stays unchanged and this issue remains open while we pursue that non-breaking option. Thanks again for the original report.

pierreraby avatar Nov 04 '26 10:11 pierreraby

Closing this as not planned. You deserve a straight answer rather than more waiting, so here is the state of both routes we promised in October.

The upstream option was rejected. I opened https://github.com/earendil-works/pi/issues/11795 on 2026-11-04 asking the picker to use the registered display name. It was triaged the same day by the pi maintainer (badlogic) and labelled no-action, which the repository defines as "This issue has been rejected after triage". I re-checked the shipped 1.5.2 bundle before writing this: getProviderDisplayName() exists and resolves runtime.getProvider(p)?.name ?? p, but the picker still builds providerBadge = theme.fg("muted", [${provider}]) from the technical ID. So the label cannot be fixed upstream without a new decision there, and I am not going to re-file a rejected request.

The rename did not happen in 0.8.0 either, and I should have said so earlier. In October I told you a rename could only ride a breaking release and named 0.8.0 as the vehicle. 0.8.0 shipped without it, and the provider ID is still commandcode in src/runtime.ts. That was our gap, not yours.

Why I am not doing it now. Having worked through the cost, the rename is worse than the badge it fixes:

  • enabledModels patterns (commandcode/...), provider/model references in saved sessions, and the host's credential namespace all key on the ID, so every user migrates for a cosmetic change.
  • quota-command.ts resolves credentials through getApiKeyForProvider("commandcode"), and a rename forces a fresh /login because the credential namespace changes.
  • The commandcode ID is also what the Go-plan variant of this provider registers, so the two can serve the same commandcode/<model> entry depending on which is active. Renaming one would quietly change that arbitration.
  • models.schema.json accepts a name field per provider, but it is not read by the picker, so there is no configuration-level workaround to offer you either.

Trading a real migration for a label is not a good deal, and I would rather say no than keep this open on the hope of a nicer release to bury it in.

What you can do today. Nothing breaks and there is no workaround I can recommend in good faith: the badge is cosmetic and the ID is correct everywhere it matters. If upstream ever revisits the display-name path, the request is on record in #11795 and I will reopen or file anew with your report as the motivating case.

Thank you for the precise write-up — the file map you included is what made the two options clear enough to decide between. Sorry the answer took a month to become a no.

pierreraby avatar Nov 13 '26 12:11 pierreraby