vcs

package
v0.39.0 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2026 License: MIT Imports: 4 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 holds the thin configuration adapters that bridge GTB's resolved configuration to the extracted version-control modules.

The forge backends themselves no longer live here. Release querying and the provider registry are the standalone module gitlab.com/phpboyscout/go/forge (with per-provider adapters forge-github, forge-gitlab, forge-gitea, forge-bitbucket, plus the built-in direct source); repository cloning and metadata are gitlab.com/phpboyscout/go/repo. What remains in this package is GTB-side glue:

  • ConfigFromReader adapts a GTB config.Reader to the narrow forge.Config seam the provider factories consume.
  • the repo sub-package's config adapter maps GTB props/config to go/repo Settings.

These adapters stay in GTB because they encode GTB's config-key layout and credential-resolution conventions, which are not the modules' concern.

Index

Constants

View Source
const (
	// OriginNone means no rung produced a credential.
	OriginNone = credentialposture.OriginNone
	// OriginEnvRef is {forge}.auth.env, dereferenced.
	OriginEnvRef = credentialposture.OriginEnvRef
	// OriginKeychain is {forge}.auth.keychain, dereferenced.
	OriginKeychain = credentialposture.OriginKeychain
	// OriginLiteral is the {forge}.auth.value literal.
	OriginLiteral = credentialposture.OriginLiteral
	// OriginFallbackEnv is the well-known fallback variable (e.g. GITHUB_TOKEN).
	OriginFallbackEnv = credentialposture.OriginFallbackEnv
)

Variables

This section is empty.

Functions

func ConfigFromReader added in v0.32.0

func ConfigFromReader(cfg config.Reader) forge.Config

ConfigFromReader adapts GTB's resolved configuration to the narrow VCS release config reader used by release providers.

func ForgeCredential added in v0.36.0

func ForgeCredential(sub forge.Config, fallbackEnv string) forge.CredentialSource

ForgeCredential composes the credential chain for one forge over an already-scoped config reader.

sub is the forge's subtree — vcs.ConfigFromReader(cfg).Sub("github") — so the per-forge namespacing is stated by the Sub and never repeated in a key literal here. A nil sub (absent section) is not an error: the environment fallback still applies, which is what lets a tool be configured purely by environment.

Every rung is lazy. Nothing is read, and no keychain is touched, until the returned source is called — so a repository authenticating over SSH never triggers an unlock prompt for a token it does not need.

Types

type CredentialOrigin added in v0.36.0

type CredentialOrigin = credentialposture.Origin

CredentialOrigin names the rung that supplied a credential. It is an alias for the general vocabulary in pkg/credentialposture rather than a second copy: forges and AI providers report the same facts, and two enumerations that mean the same thing eventually disagree. Spec 0189 D4.

func ResolveForgeCredentialOrigin added in v0.36.0

func ResolveForgeCredentialOrigin(
	ctx context.Context,
	sub forge.Config,
	fallbackEnv string,
) (CredentialOrigin, error)

ResolveForgeCredentialOrigin reports WHICH rung supplies a forge's credential, without returning the credential itself.

It exists so a diagnostic can tell an operator that their configuration resolves, and from where, without printing a secret to a terminal or a support bundle. "It resolves, from auth.env" and "nothing resolves" are the two facts worth having, and neither needs the value.

The walk itself lives in pkg/credentialposture, shared with every other credential GTB reports on. Error handling is that package's: a rung that fails does not stop the walk, because a later rung may still supply a working credential — and the retained error is returned only when nothing resolved, which is exactly when a bare "no credential" would otherwise hide the reason.

Directories

Path Synopsis
Package repo adapts GTB's runtime configuration into the typed settings used by the standalone gitlab.com/phpboyscout/go/repo module.
Package repo adapts GTB's runtime configuration into the typed settings used by the standalone gitlab.com/phpboyscout/go/repo module.

Jump to

Keyboard shortcuts

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