native

package
v0.62.0 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2026 License: MIT Imports: 15 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

Overview

Package native is heraut's built-in, zero-external-dependency content generator (ADR-0032). This file covers commit collection: walking a git revision range into structured records and resolving the previous tag for compare links. Conventional-commit classification (T123), rendering (T124), and remote enrichment (Phase 2) build on it.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoAnchors = errors.New("no heraut-release anchors")

ErrNoAnchors reports that a non-empty changelog has no heraut-release anchors — it was produced by another tool and cannot be safely spliced incrementally (the caller directs to --regenerate).

Functions

This section is empty.

Types

type Author added in v0.48.0

type Author struct {
	Name     string
	Email    string
	Username string // platform handle, e.g. "octocat"; empty offline
}

Author is a contributor identity: git-first (Name/Email always present), with an optional platform handle resolved from remote enrichment. Email is the first_time identity key.

type Contributor added in v0.48.0

type Contributor struct {
	Author      Author
	IsFirstTime bool
	PR          *PullRequest // their first PR in this release; nil offline
}

Contributor is a per-release contributor for the "New Contributors" block.

type Generator

type Generator struct {
	// contains filtered or unexported fields
}

Generator is heraut's built-in, zero-external-dependency content generator (ADR-0032). It walks git history, classifies commits against the effective commits.types / rendering.excludes (propagated onto the ContentDriver by the app layer), and renders Markdown with internal templates. With an injected port.Forge (ADR-0043) it enriches commits with PR metadata, honouring the remote_metadata policy; Degraded reports an optional fetch failure.

func New

func New(runner port.Runner, cfg *config.ContentDriver, mode Mode, opts ...Option) *Generator

New constructs a native Generator.

func (*Generator) Check

func (g *Generator) Check() error

Check verifies the generator is usable. native has no external dependency, so it always succeeds.

func (*Generator) Degraded

func (g *Generator) Degraded() bool

Degraded reports whether an optional remote-enrichment fetch failed during the last run.

func (*Generator) DegradedReason added in v0.54.0

func (g *Generator) DegradedReason() string

DegradedReason returns the human-readable reason enrichment was skipped (the underlying fetch failure), or "" when the run did not degrade. The pipeline surfaces it as a step sub-result rather than writing it to os.Stderr mid-step, where it collided with the live spinner line.

func (*Generator) Generate

func (g *Generator) Generate(tag string, lc *port.LinkContext) (string, error)

Generate produces the changelog (writing it to cfg.Output when set) or the release-notes string for tag, resolving commit/compare links against lc.

func (*Generator) Validate

func (g *Generator) Validate() error

Validate checks generator-specific config. native has no required config in Phase 1 (user templates are deferred — ADR-0033), so it always succeeds.

type Mode

type Mode int

Mode selects which content the native generator produces.

const (
	ModeChangelog Mode = iota
	ModeReleaseNotes
)

type Option added in v0.55.0

type Option func(*Generator)

Option customizes a Generator at construction.

func WithDegraded added in v0.57.0

func WithDegraded(reason string) Option

WithDegraded seeds a degraded state at construction time — used when the pipeline could not resolve an enrichment forge under a non-required policy (T175): the run proceeds without PR attribution, the same outcome as a post-resolution fetch failure under "optional", rather than failing outright.

func WithForge added in v0.55.0

func WithForge(f port.Forge) Option

WithForge injects the resolved enrichment forge (ADR-0043) the generator uses to fetch PR/MR metadata.

type PullRequest added in v0.48.0

type PullRequest struct {
	Number      int
	URL         string
	AuthorLogin string // PR author handle (drives "by @login")
	RefPrefix   string
	Title       string
	Labels      []string
	Platforms   map[string]any
	// CreatedAt / MergedAt are the PR/MR creation and merge timestamps (remote-only, zero offline).
	CreatedAt time.Time
	MergedAt  time.Time
	// MergedBy is the actor who merged the PR/MR (remote-only; empty Author when unknown).
	MergedBy Author
	// Approvers are the reviewers who approved (best-effort: GitHub + Azure; empty on GitLab).
	Approvers []Author
}

PullRequest is the normalized PR/MR for a commit: flat common fields plus a per-platform escape hatch. RefPrefix is "!" for GitLab MRs and Azure DevOps PRs; GitHub leaves it empty and prRef (render.go) defaults it to "#". It is derived at fetch time.

type TicketMatch added in v0.59.0

type TicketMatch = ticketLink

TicketMatch is one ticket reference found in commit text: the matched display text and its resolved URL. Exported so callers outside native (internal/app is allowed to import internal/generators/* per the Layer rules table in .claude/rules/coding.md) can verify commits.tickets patterns against real commit text — heraut commit tickets (T241) — using the exact same matching logic that drives changelog/release-notes ticket-link rendering.

func MatchTickets added in v0.59.0

func MatchTickets(text string, tickets []config.Ticket) []TicketMatch

MatchTickets finds every match of each configured ticket pattern in text, in config order. It is resolveTickets exported under a stable name for callers outside native.

Jump to

Keyboard shortcuts

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