22 lines
521 B
Bash
22 lines
521 B
Bash
#!/bin/bash
|
|
|
|
TITLE="opencode"
|
|
DESCRIPTION="Sign in to AI providers"
|
|
|
|
is_installed() {
|
|
[ -x /usr/bin/opencode ]
|
|
}
|
|
|
|
# Signed in to at least one provider
|
|
is_configured() {
|
|
jq -e 'length > 0' "$HOME/.local/share/opencode/auth.json"
|
|
}
|
|
|
|
run_configure() {
|
|
echo "Choose a provider and sign in or paste its API key. You can pick the model inside opencode with /models."
|
|
unsandboxed opencode auth login || return 1
|
|
while confirm "Sign in to another provider?"; do
|
|
unsandboxed opencode auth login || return 1
|
|
done
|
|
}
|