vcs

package
v0.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 3, 2026 License: MIT Imports: 5 Imported by: 0

README

VCS

Abstractions for Version Control System operations, supporting multiple backends like GitHub and GitLab.

Package Structure

  • github: GitHub-specific client and release implementation.
  • gitlab: GitLab release provider implementation.
  • repo: Generic Git repository management (Local and In-memory).
  • release: Domain interfaces for releases, assets, and providers.

Pluggable Release Providers

The VCS package provides a release.Provider interface that abstracts release operations across different platforms:

  • Programmatic API interaction (PRs, releases, etc.)
  • Unified authentication layer for SSH and tokens
  • Backend-agnostic asset downloads

For detailed documentation, testing strategies, and configuration options, see the Version Control Component Documentation.

Documentation

Overview

Package vcs defines the version control system abstraction layer for querying releases and repository metadata across GitHub and GitLab backends.

The sub-packages provide concrete implementations: github for the GitHub API (repository management, PRs, releases, asset downloads), gitlab for GitLab, release for the unified provider factory, and repo for repository URL parsing and metadata extraction.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ResolveToken

func ResolveToken(cfg config.Containable, fallbackEnv string) string

ResolveToken resolves an authentication token from a config subtree.

Resolution order:

  1. cfg.auth.env — NAME of an environment variable to read
  2. cfg.auth.keychain — "<service>/<account>" reference in the OS keychain; active only when the process has imported pkg/credentials/keychain (or otherwise registered a backend). Silently skipped when no backend is registered or when the keychain is unreachable at the time of the call.
  3. cfg.auth.value — literal token value stored in config. Viper's AutomaticEnv + tool prefix also surfaces <TOOL>_AUTH_VALUE style env vars via this step.
  4. fallbackEnv — well-known unprefixed environment variable (pass "" to skip).

Returns an empty string when no token is found; callers decide whether that is an error condition (e.g. private repositories require a token, public repositories can proceed without one).

The callers-supplied `cfg` is typically `props.Config.Sub("<vcs>")` — GTB's env-aware Sub ensures prefix-aware env binding fires even inside sub-containers (see pkg/config).

ResolveToken uses context.Background when calling the keychain backend. Callers who have a request context (HTTP handler, cobra command, chat provider) SHOULD use ResolveTokenContext instead so a slow remote backend (Vault, SSM) cannot stall the caller beyond its own deadline.

func ResolveTokenContext

func ResolveTokenContext(ctx context.Context, cfg config.Containable, fallbackEnv string) string

ResolveTokenContext is the context-aware form of ResolveToken. The context is propagated to the credentials backend so remote stores honour deadlines and cancellation. Recommended for any call path that already has a context in scope.

Types

This section is empty.

Directories

Path Synopsis
Package bitbucket provides a release.Provider implementation for Bitbucket Cloud using the Downloads API.
Package bitbucket provides a release.Provider implementation for Bitbucket Cloud using the Downloads API.
Package direct provides a release.Provider implementation for tools distributed via arbitrary HTTP servers.
Package direct provides a release.Provider implementation for tools distributed via arbitrary HTTP servers.
Package gitea provides a release.Provider implementation for Gitea and Forgejo instances, including Codeberg (codeberg.org).
Package gitea provides a release.Provider implementation for Gitea and Forgejo instances, including Codeberg (codeberg.org).
Package github implements the VCS release provider and API client for GitHub repositories, supporting both public and token-authenticated access.
Package github implements the VCS release provider and API client for GitHub repositories, supporting both public and token-authenticated access.
Package gitlab implements the VCS release provider for GitLab repositories, supporting both public and token-authenticated access with nested group paths.
Package gitlab implements the VCS release provider for GitLab repositories, supporting both public and token-authenticated access with nested group paths.
Package release provides the shared release model (Release, ReleaseAsset) and a Provider factory that resolves the correct VCS backend (GitHub or GitLab) from tool configuration for use by the self-update system.
Package release provides the shared release model (Release, ReleaseAsset) and a Provider factory that resolves the correct VCS backend (GitHub or GitLab) from tool configuration for use by the self-update system.
Package repo provides repository URL parsing and metadata extraction, converting host/owner/repo paths into a RepoLike abstraction that supports both GitHub (org/repo) and GitLab (group/subgroup/repo) path formats.
Package repo provides repository URL parsing and metadata extraction, converting host/owner/repo paths into a RepoLike abstraction that supports both GitHub (org/repo) and GitLab (group/subgroup/repo) path formats.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL