Repo provider-aware auth¶
From v0.17, pkg/vcs/repo resolves clone/push credentials per forge and is TUI-free. No function signatures changed, but two behaviours did.
GetSSHKey no longer prompts for passphrases¶
Before: a passphrase-protected key triggered an interactive huh input form inside the library.
After: GetSSHKey (and NewRepo, when the configured <forge>.ssh.key is encrypted) returns an error wrapping the typed *ssh.PassphraseMissingError from golang.org/x/crypto/ssh. The CLI layer owns the prompt:
keys, err := repo.GetSSHKey(path, fs)
var missing *gossh.PassphraseMissingError
if errors.As(err, &missing) {
// Prompt the user however your tool prefers (e.g. a huh input form),
// then retry:
keys, err = repo.GetSSHKeyWithPassphrase(path, fs, passphrase)
}
If your tool relied on the implicit prompt, add the errors.As + retry block at your call site. Non-interactive contexts should load the key into ssh-agent instead.
Missing tokens are non-fatal for public repositories¶
Before: NewRepo returned an error when no github credential was configured, even for public clones.
After: NewRepo proceeds unauthenticated when no token resolves, unless Tool.ReleaseSource.Private is true β only private repositories enforce a credential. If your tool depended on the early failure as a configuration check, set Private: true on the release source or verify r.GetAuth() != nil after construction.
Forge selection¶
NewRepo now reads <forge>.auth / <forge>.ssh based on Tool.ReleaseSource.Type (overridable via the vcs.provider config key) instead of always github.*. Existing github.* configs are unaffected.