Documentation
¶
Overview ¶
Package trunklog gathers stack-aware trunk commit history for the `stackit log` command. It reads trunk commits (a range or the most recent N), collapses consolidated stacks into a single entry, and enriches PR titles from the forge when available. The result is presentation-agnostic so CLI/JSON adapters can render it however they need.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Commit ¶
type Commit struct {
SHA string
Message string // PR title for enriched stack-merges, else the commit subject
Author string
Date time.Time
Kind git.RecentCommitKind
PRNumber int
StackSize int
StackPRs []int
StackPRTitles map[int]string
StackScope string
}
Commit is one collapsed trunk entry, decoupled from the git and HTTP types.
type CommitSource ¶
type CommitSource interface {
GetRecentTrunkCommits(count int) ([]git.RecentCommit, error)
GetTrunkCommitsInRange(from, to string) ([]git.RecentCommit, error)
}
CommitSource is the narrow engine dependency this action needs.
type Request ¶
type Request struct {
From string // lower-bound ref; empty selects the default recent-count view
To string // upper-bound ref; empty defaults to the trunk tip (used with From)
Count int // max commits for the default view; ignored when From is set
}
Request selects which trunk commits to gather.
type Result ¶
Result is the gathered, collapsed, enriched trunk history.
func Gather ¶
func Gather(ctx context.Context, src CommitSource, titles TitleResolver, req Request) (Result, error)
Gather fetches trunk commits (a range when req.From is set, otherwise the most recent req.Count), collapses consolidated stacks, and enriches PR titles when a resolver is available. A nil resolver, missing owner/repo, or a forge error all degrade gracefully to commits without PR titles rather than failing.
type TitleResolver ¶
type TitleResolver interface {
GetOwnerRepo() (owner, repo string)
BatchGetPRTitles(ctx context.Context, owner, repo string, prNumbers []int) (map[int]string, error)
}
TitleResolver resolves PR titles from the forge. It is nil-safe: pass a nil resolver when no GitHub client is available (offline) and PR titles are simply omitted rather than treated as an error.