Documentation
¶
Overview ¶
Package engine computes a release Plan from a repository's commit history.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RenderPlan ¶
RenderPlan executes tmplText (a config's Template) against plan, producing changelog body text. Compute uses this for the full repo-wide/multi Plan; multi-mode draft/publish commands reuse it to render an isolated body for a single Package's own draft release, by wrapping that one PackagePlan in a synthetic *Plan.
Types ¶
type Entry ¶
type Entry struct {
SHA string
// ShortSHA is SHA truncated to git's conventional 7-character
// abbreviation, for compact display — text/template has no string
// slicing of its own to derive this from SHA in a custom template.
ShortSHA string
// Author is the commit's plain git author name — always populated,
// independent of AuthorRef.
Author string
Type string
Scope string
Description string
// PR is the commit's resolved PR Reference, or nil when none was
// found — enrichment only, never required (ADR-0001, ADR-0003).
PR *commit.PRReference
// AuthorRef is the commit author's linked backend account, or nil when
// unresolved (no Backend, unsupported backend, or no linked account) —
// enrichment only, template authors should fall back to Author.
AuthorRef *backend.AuthorReference
// CommitURL links to the commit on the backend's web UI. Empty when be
// is nil (ADR-0001: enrichment only, never required for an Entry to
// exist) — Backend.CommitURL is pure string formatting, so it's always
// populated when a Backend is available, unlike PR which depends on a
// live lookup succeeding.
CommitURL string
}
Entry is one changelog line, derived from a single parsed commit.
type PackagePlan ¶
type PackagePlan struct {
Name string
Sections []Section
PreviousVersion string
SuggestedVersion string
}
PackagePlan is one Package's sectioned Entries. Name is empty when packages aren't configured — an implicit single package standing in for the whole repo.
PreviousVersion/SuggestedVersion are only populated in multi mode (ADR-0004), where each Package is versioned and tagged independently; in single mode they stay empty and the repo-wide Plan fields apply instead.
type Plan ¶
type Plan struct {
Packages []PackagePlan
PreviousVersion string
SuggestedVersion string
Rendered string
}
Plan is the computed result of a release: every affected Package's sectioned Entries, plus the changelog body rendered through the configured template. PreviousVersion/SuggestedVersion are the repo-wide version (single mode only — see PackagePlan for multi mode).
func Compute ¶
func Compute(ctx context.Context, repoPath string, cfg *config.Config, be backend.Backend) (*Plan, error)
Compute parses repoPath's commits as Conventional Commits, drops any carrying cfg's skip-changelog trailer, buckets the rest into cfg's sections, and computes a suggested next version from the highest-severity type seen (breaking > feat > fix). In single mode (default) this happens once, repo-wide, bounded by the last tag matching cfg.TagFormat, with Packages used only to section Entries (ADR-0004). In multi mode it happens independently per configured Package, each bounded by its own last tag (cfg.TagFormat with {{package}} resolved).
be is optional (nil is fine) — when a commit's PR Reference can't be extracted from its text (ADR-0001), be.ResolvePR is tried as a best-effort fallback. Whether that fallback does anything is entirely up to the adapter: only GitHub's actually looks anything up, so passing a Gitea/Forgejo Backend (or none) transparently yields the same text-extraction-only behavior.