Documentation
¶
Overview ¶
Package bitbucket implements the interactive setup wizard for Bitbucket Cloud authentication.
Bitbucket uses a dual-credential model (username + app password), so the wizard collects or references both values in a single flow. Three storage modes are supported, matching the credential-storage hardening spec:
- Env-var reference (recommended default): two config entries, bitbucket.username.env and bitbucket.app_password.env, each pointing at an environment variable name. Neither value hits the config file. Refused under CI only for literal mode — env-var references are the permitted CI path.
- OS keychain: a single JSON blob {"username": ..., "app_password": ...} stored under <toolname>/bitbucket.auth. The config records only bitbucket.keychain: "<toolname>/bitbucket.auth".
- Literal: bitbucket.username and bitbucket.app_password written directly. Plaintext on disk; refused under CI.
Resolver side (pkg/vcs/bitbucket) walks the full per-field chain at runtime. Corrupt or incomplete keychain blobs abort resolution rather than falling through to stale literals (R3).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewCmdInitBitbucket ¶
NewCmdInitBitbucket creates the `init bitbucket` subcommand.
func RunBitbucketInit ¶
func RunBitbucketInit(p *props.Props, cfg config.Containable) error
RunBitbucketInit executes the wizard against an existing config container, typically invoked by NewCmdInitBitbucket.
Types ¶
type BitbucketConfig ¶
type BitbucketConfig struct {
StorageMode credentials.Mode
// Username and AppPassword hold the collected credentials for
// keychain and literal modes. Unused in env-var mode.
Username string
AppPassword string
// UsernameEnvName and AppPasswordEnvName hold env-var names for
// env-var mode. Default to BITBUCKET_USERNAME /
// BITBUCKET_APP_PASSWORD respectively.
UsernameEnvName string
AppPasswordEnvName string
}
BitbucketConfig captures the wizard's outputs. Fields unused by the selected storage mode are ignored.
type FormOption ¶
type FormOption func(*formConfig)
FormOption configures the Bitbucket init form for testability.
func WithForm ¶
func WithForm(creator func(*BitbucketConfig) []*huh.Form) FormOption
WithForm injects custom form creators into the wizard for testing. The creator returns forms in order:
[0] storage-mode selector [1] env-var names (env-var mode only) [2] username + app_password inputs (keychain / literal modes)
Returning fewer forms is allowed — the runner skips stages whose slot is nil or absent.
type Initialiser ¶
type Initialiser struct {
// contains filtered or unexported fields
}
Initialiser implements setup.Initialiser for Bitbucket auth.
func NewInitialiser ¶
func NewInitialiser(_ *props.Props, opts ...InitialiserOption) *Initialiser
NewInitialiser constructs a new Initialiser with the supplied options applied.
func (*Initialiser) Configure ¶
func (i *Initialiser) Configure(p *props.Props, cfg config.Containable) error
Configure runs the interactive wizard and persists the captured credentials according to the selected storage mode.
func (*Initialiser) IsConfigured ¶
func (i *Initialiser) IsConfigured(cfg config.Containable) bool
IsConfigured reports whether any of the three storage modes is already recorded in the config.
func (*Initialiser) Name ¶
func (i *Initialiser) Name() string
Name returns the human-readable label for this initialiser.
type InitialiserOption ¶
type InitialiserOption func(*Initialiser)
InitialiserOption configures the Initialiser.
func WithFormOptions ¶
func WithFormOptions(opts ...FormOption) InitialiserOption
WithFormOptions propagates [FormOption]s into the wizard. Tests use this to inject deterministic form creators.