Problem
Authentication is currently handled inline in _fetch_latest_release_tag() with hardcoded GH_TOKEN/GITHUB_TOKEN env var lookups and GitHub-specific Bearer token headers. As we add Azure DevOps support (and potentially GitLab, Bitbucket), this approach won't scale without scattering provider-specific logic across the codebase.
Proposal
After #2331 lands, create src/specify_cli/authentication/ as a self-contained subdirectory with a provider registry, following the same pattern as src/specify_cli/integrations/:
src/specify_cli/authentication/
├── __init__.py # AUTH_REGISTRY + register_builtins()
├── base.py # AuthProvider ABC
├── github.py # GitHubAuth provider
└── azure_devops.py # AzureDevOpsAuth provider
AuthProvider base class exposes:
key — provider identifier (e.g., "github", "azure-devops")
get_token() -> str | None — resolve credentials from env vars / config
auth_headers() -> dict — provider-specific auth headers
api_base_url() -> str — API endpoint root
is_configured() -> bool — whether credentials are available
Scope
Benefits
- Follows existing registry pattern (
integrations/)
- Extensible for GitLab, Bitbucket, etc. without touching core CLI
- Testable in isolation
Problem
Authentication is currently handled inline in
_fetch_latest_release_tag()with hardcodedGH_TOKEN/GITHUB_TOKENenv var lookups and GitHub-specific Bearer token headers. As we add Azure DevOps support (and potentially GitLab, Bitbucket), this approach won't scale without scattering provider-specific logic across the codebase.Proposal
After #2331 lands, create
src/specify_cli/authentication/as a self-contained subdirectory with a provider registry, following the same pattern assrc/specify_cli/integrations/:AuthProviderbase class exposes:key— provider identifier (e.g.,"github","azure-devops")get_token() -> str | None— resolve credentials from env vars / configauth_headers() -> dict— provider-specific auth headersapi_base_url() -> str— API endpoint rootis_configured() -> bool— whether credentials are availableScope
GitHubAuthAzureDevOpsAuthwith PAT / env var support (AZURE_DEVOPS_PAT,ADO_TOKEN, etc.)_fetch_latest_release_tag()delegates to the registryauthentication/subdirectoryBenefits
integrations/)