diff options
| author | Dax Raad <[email protected]> | 2025-06-16 15:09:49 -0400 |
|---|---|---|
| committer | Dax Raad <[email protected]> | 2025-06-16 15:09:49 -0400 |
| commit | fcaf0e6dbf91f5bdb2ce8ade41ecb69713f0d12e (patch) | |
| tree | c90669990a8ad8cfafba5c9f1aaf8f0598a4db13 /packages | |
| parent | 19e259d90d406a481149e931f596f60077125bfc (diff) | |
| download | opencode-fcaf0e6dbf91f5bdb2ce8ade41ecb69713f0d12e.tar.gz opencode-fcaf0e6dbf91f5bdb2ce8ade41ecb69713f0d12e.zip | |
opencode auth login: validation on provider id and better error messages
Diffstat (limited to 'packages')
| -rw-r--r-- | packages/opencode/src/cli/cmd/auth.ts | 9 |
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") { |
