From 4c6e0d1bc279d918bd2ab6983cf0a350dcbb9553 Mon Sep 17 00:00:00 2001 From: zsxsoft Date: Sat, 4 Jul 2026 11:40:06 +0800 Subject: [PATCH] feat: export auth hook so `auth login --provider axonhub` works MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit opencode's `auth login` builds its provider candidate list only from the models.dev database plus plugins that export an `auth` hook (resolvePluginProviders skips any hook without `auth`). Providers defined only in opencode.jsonc are never added, so `--provider axonhub` fails with `Unknown provider "axonhub"`. Add a minimal `api`-type auth hook for the axonhub provider. The CLI now lists axonhub in the login picker and, on `--provider axonhub`, prompts for the API key and stores it under the `axonhub` key in auth.json — exactly where authFileKey() already reads it. This restores the README's documented `opencode auth login --provider axonhub` workflow, which broke once opencode tightened `--provider` validation (anomalyco/opencode PR #14470, first shipped in v1.2.18). Co-Authored-By: Claude Opus 4.8 (1M context) --- src/index.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/index.ts b/src/index.ts index f0c1f74..6a92d8e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -566,6 +566,15 @@ export const server: Plugin = async ({ client }, options?: PluginOptions): Promi }) return { + auth: { + provider: PROVIDER_ID, + methods: [ + { + type: "api", + label: "API Key", + }, + ], + }, async config(config: Config) { config.provider ??= {} config.provider[PROVIDER_ID] ??= {