app

package
v0.32.0 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2026 License: MIT Imports: 21 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildChangelogPipeline added in v0.6.0

func BuildChangelogPipeline(runner port.Runner, cfg *config.Config, resolver versioning.Resolver, opts PipelineOpts) (*pipeline.ChangelogPipeline, error)

BuildChangelogPipeline constructs a ChangelogPipeline from config.

func BuildPipeline

func BuildPipeline(runner port.Runner, cfg *config.Config, resolver versioning.Resolver, opts PipelineOpts) (*pipeline.Pipeline, error)

BuildPipeline constructs a release Pipeline from config. All generator and platform instances are created here — none are created in internal/cmd/.

func CheckBranch added in v0.20.0

func CheckBranch(runner port.Runner, cfg *config.Config, env string, force bool) error

CheckBranch enforces the per-environment branch guard: when the active environment declares a branch, the current git branch must match it. This prevents operating on an environment (e.g. releasing prod) from the wrong branch. It is a no-op when env is empty or the environment has no branch set. force bypasses the check entirely.

func CheckCliff added in v0.6.0

func CheckCliff(runner port.Runner, driver *config.ContentDriver, mode, policy string) (bool, error)

CheckCliff runs git-cliff --context --no-exec against the effective merged config for the given content driver, applying the remote_metadata policy. mode must be "changelog" or "release-notes". Returns whether the check fell back to --offline (degraded, optional policy) and an error if git-cliff rejected the config. The caller's driver is never mutated — the policy is applied to a copy.

func CurrentTag added in v0.4.0

func CurrentTag(runner port.Runner, cfg *config.Config, env string) (string, error)

CurrentTag returns the latest existing git tag for the given strategy and environment. For single-env strategies, env is ignored. For per-env strategies, env is required.

func CurrentVersion added in v0.19.0

func CurrentVersion(runner port.Runner, cfg *config.Config, env string) (string, error)

CurrentVersion returns the bare semantic version of the latest tag (the tag with any prefix / env / build components stripped). For per-env strategies the version is parsed via the effective tag_format; for single-env strategies the tag prefix is stripped.

func EffectiveCliffConfig added in v0.6.0

func EffectiveCliffConfig(cfg *config.Config, driver *config.ContentDriver, mode, env string) (string, error)

EffectiveCliffConfig returns the effective merged git-cliff TOML for the given content driver and mode ("changelog" or "release-notes"). cfg and env are used to derive the build-id postprocessor (when versioning.tag_format contains {build}) so the output matches what the pipeline actually feeds git-cliff.

If driver is nil or has no generator set, the embedded default TOML is returned. Returns an error if driver.Generator is set to something other than "git-cliff".

func IsPromotionGuard added in v0.8.0

func IsPromotionGuard(err error) bool

IsPromotionGuard reports whether err is one of the per-env promotion guards (E001/E002/E003 from ADR-0007). The cmd layer uses this to map such failures to exit code 4 without importing the perenv package directly.

func NewResolver

func NewResolver(cfg *config.Config, env string, force bool, versionOverride, buildID string, runner port.Runner) (versioning.Resolver, error)

NewResolver builds the appropriate versioning.Resolver from config. env is the active environment name (empty for non-per-env strategies). force is the --force flag value. versionOverride is set when --version X.Y.Z is passed; when non-empty a StaticResolver is returned for all strategies, bypassing git calls entirely. buildID is set when --build <id> is passed; requires versionOverride to be set.

func PreflightCheck added in v0.6.0

func PreflightCheck(runner port.Runner) error

PreflightCheck verifies git binary availability and git user name/email. Called automatically before heraut release and heraut changelog.

func ReadGPGSign added in v0.12.0

func ReadGPGSign(runner port.Runner) bool

ReadGPGSign reads tag.gpgSign from git config and returns true when it is set to "true". Any error (key absent, git not available) is treated as false — non-signing is the safe default. Callers should pass a non-dry-run runner so the config is always read regardless of --dry-run.

func RuntimeCheck added in v0.6.0

func RuntimeCheck(
	runner port.Runner,
	cfg *config.Config,
	env string,
	header func(title string),
	dispatch func(name string, run func() RuntimeCheckItem),
)

RuntimeCheck verifies all runtime dependencies, grouped into three sections: Git, Platforms, and Generators. header is called once per section before its items. dispatch is called once per item with the label shown while the check runs; the run function performs the check and returns the result.

env selects the active environment for the Platforms section: when non-empty and cfg.Environments[env].Release.Platforms is non-empty, it replaces the root release.platforms list entirely (same semantics as the release pipeline's effective-platforms resolution). An empty env, or an env with no platform override, checks the root list.

Check order:

Git:        git binary → user.name → user.email → working tree
Platforms:  one row per effective release.platforms entry, or
            glab (GitLab) → gh (GitHub) as a binary-only fallback
Generators: git-cliff → cocogitto → communique

Configured tools are hard errors when missing; unconfigured-but-supported tools warn when absent and succeed silently when present.

func ValidateBuildID added in v0.19.0

func ValidateBuildID(build string) error

ValidateBuildID reports whether a --build value is usable as a tag component. Delegates to tagfmt so cmd does not import the versioning layer directly.

func ValidateVersionOverride added in v0.32.0

func ValidateVersionOverride(version string) error

ValidateVersionOverride reports whether a --version value is usable as a tag/version override. Delegates to tagfmt so cmd does not import the versioning layer directly.

Types

type PipelineOpts

type PipelineOpts struct {
	DryRun          bool
	Force           bool
	VersionOverride string
	Env             string
	Out             io.Writer
	// Commit and Tag are used by the changelog pipeline only.
	Commit bool
	Tag    bool
	// NoPush is used by the changelog pipeline only: when true, the commit and tag
	// are created locally but not pushed.
	NoPush bool
	// SignTags mirrors git config tag.gpgSign — when true the pipeline creates
	// signed tags (-s) instead of annotated ones. Set by the caller via ReadGPGSign.
	SignTags bool
	// Logger receives operator-debug diagnostics (nil discards them). See forge ADR-0011.
	Logger *slog.Logger
}

PipelineOpts carries runtime options for building a pipeline.

type RuntimeCheckItem added in v0.6.0

type RuntimeCheckItem struct {
	Name   string
	Value  string // resolved value (e.g. version string, identity, "clean")
	Err    error
	IsWarn bool // advisory only — shown with ! but does not fail the overall check
}

RuntimeCheckItem records the outcome of one runtime check.

Jump to

Keyboard shortcuts

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