* Resolve the best git token for *url*. * * Sources, in priority order: * 1. The OpenCode-managed credential from the plugin's AuthHook. * Used only when *url* resolves to a known git host * (github.com / gitlab.com). The keychain stores one token at a * time and doesn't recor
(url?: string)
| 81 | * CLI just doesn't receive a `--token` flag. |
| 82 | */ |
| 83 | async function resolveToken(url?: string): Promise<string | null> { |
| 84 | const hostname = url ? extractHostname(url) : null |
| 85 | const token = await getStoredToken(hostname) |
| 86 | // Only log when we actually tried to match a host — "no token for a |
| 87 | // local path" isn't useful; the auth plumbing only does anything when |
| 88 | // there's a hostname to match against, and local-path indexing ignores |
| 89 | // the returned token anyway (indexRepo skips --token for non-URLs). |
| 90 | if (!token && hostname) { |
| 91 | debug("auth", "resolveToken: no token for", hostname) |
| 92 | } |
| 93 | return token |
| 94 | } |
| 95 | |
| 96 | const server: Plugin = async ( |
| 97 | input: PluginInput, |
no test coverage detected