summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDax Raad <[email protected]>2025-06-16 15:09:49 -0400
committerDax Raad <[email protected]>2025-06-16 15:09:49 -0400
commitfcaf0e6dbf91f5bdb2ce8ade41ecb69713f0d12e (patch)
treec90669990a8ad8cfafba5c9f1aaf8f0598a4db13
parent19e259d90d406a481149e931f596f60077125bfc (diff)
downloadopencode-fcaf0e6dbf91f5bdb2ce8ade41ecb69713f0d12e.tar.gz
opencode-fcaf0e6dbf91f5bdb2ce8ade41ecb69713f0d12e.zip
opencode auth login: validation on provider id and better error messages
-rw-r--r--packages/opencode/src/cli/cmd/auth.ts9
1 files changed, 7 insertions, 2 deletions
diff --git a/packages/opencode/src/cli/cmd/auth.ts b/packages/opencode/src/cli/cmd/auth.ts
index 37df11e4c..85d165207 100644
--- a/packages/opencode/src/cli/cmd/auth.ts
+++ b/packages/opencode/src/cli/cmd/auth.ts
@@ -78,11 +78,16 @@ export const AuthLoginCommand = cmd({
if (provider === "other") {
provider = await prompts.text({
- message:
- "Enter provider - must be package name from https://ai-sdk.dev/providers",
+ message: "Enter provider id",
+ validate: (x) =>
+ x.match(/^[a-z-]+$/) ? undefined : "a-z and hyphens only",
})
+ if (prompts.isCancel(provider)) throw new UI.CancelledError()
provider = provider.replace(/^@ai-sdk\//, "")
if (prompts.isCancel(provider)) throw new UI.CancelledError()
+ prompts.log.warn(
+ `This only stores a credential for ${provider} - you will need configure it in opencode.json, check the docs for examples.`,
+ )
}
if (provider === "amazon-bedrock") {