Documentation
¶
Overview ¶
Package commits keeps the latest default-branch commits of every catalogued repository and serves the merged commit feeds.
Index ¶
- Constants
- func ArchiveEntry(s *snapshot.Snapshot, e *snapshot.RepoEntry, a *oapi.ArchiveEntry)
- func Assistant(name string) string
- func Authorship(s *snapshot.Snapshot, e *snapshot.RepoEntry) (people, top int)
- func Dashboard(s *snapshot.Snapshot, d *oapi.Dashboard)
- func Detail(s *snapshot.Snapshot, e *snapshot.RepoEntry, d *oapi.RepoDetail)
- func Feeds(r *Rules) snapshot.Indexer
- func LastAuthored(s *snapshot.Snapshot, k snapshot.RepoKey, w Work) (at time.Time, before bool)
- func LastCommit(e *snapshot.RepoEntry) (time.Time, snapshot.Freshness)
- func Repo(s *snapshot.Snapshot, e *snapshot.RepoEntry, r *oapi.Repo)
- func RepoActivity(s *snapshot.Snapshot, k snapshot.RepoKey, w Work) oapi.Activity
- func Sweep(s *snapshot.Snapshot, c *Commit) bool
- type API
- type AssistantRule
- type Commit
- type CommitInfo
- type Commits
- type Edge
- type Fetcher
- type History
- type Label
- type Origin
- type REST
- type Ref
- type RefInfo
- type Row
- type Rules
- type Stats
- type Work
Constants ¶
const Kind = "commits"
Kind is the job kind of the per-repository refresh.
Variables ¶
This section is empty.
Functions ¶
func ArchiveEntry ¶
ArchiveEntry completes a retired repository's row: when it was last active (its newest commit, when one is held) and how many authors its newest commits have, people's work only, counted and never named (design/archive.md).
func Assistant ¶
Assistant is the family of an assistant's name, its first word: "Claude Opus 5" is "Claude".
func Authorship ¶
Authorship is how the people's recent work on a repository is shared (design/insights.md): how many of its newest default-branch commits are people's (automation and sweeps left out) and how many the busiest author wrote. Authors are counted, never returned.
func Dashboard ¶
Dashboard adds the commits to the dashboard through its lens (d.Work): the latest commits of the work that counts, the activity of the fleet and of each group (with its members' last change of that work), each group's last activity and the commits' freshness counts.
func Feeds ¶
Feeds is the indexer of the merged commit feeds, for snapshot.NewPublisher, classifying with r (nil: the built-in rules).
func LastAuthored ¶
LastAuthored returns the time of the newest commit of the repository k in the view s that is work of the lens w (Counts). When no read commit is, it returns the oldest read commit's time with before set: the last such commit is older. Zero when there are no commits.
func LastCommit ¶
LastCommit returns the time of the newest commit of e (zero when there is none) and the commits' freshness.
func RepoActivity ¶
RepoActivity is the activity of the repository k in the view s through the lens w, as a group's is summed.
Types ¶
type API ¶
API serves the merged commit feeds from the current snapshot. It implements the commits methods of the strict server.
func (API) GetHistory ¶
func (a API) GetHistory(ctx context.Context, req oapi.GetHistoryRequestObject) (oapi.GetHistoryResponseObject, error)
GetHistory serves a page of a repository's history in graph order.
func (API) ListCommits ¶
func (a API) ListCommits(ctx context.Context, req oapi.ListCommitsRequestObject) (oapi.ListCommitsResponseObject, error)
type AssistantRule ¶
type AssistantRule struct {
Name string
Authors []string // an author's login or name
CoAuthors []string // a Co-authored-by trailer's name, address or local part
}
AssistantRule is an assistant a deployment names (commits.assistants, design/layout.md, P-127): the authors that are it as a coding agent, and the co-authors that mark a person's commit as made with it. Every entry is matched case-insensitively; a co-author entry matches a trailer's name, its address, or its address's local part (after a noreply address's "<id>+", on any host).
type Commit ¶
type Commit struct {
SHA string `json:"sha"`
Subject string `json:"subject"` // first line of the message
Body string `json:"body,omitempty"` // the rest of the message
AuthorName string `json:"authorName"`
AuthorLogin string `json:"authorLogin,omitempty"`
CommitterName string `json:"committerName,omitempty"`
URL string `json:"url"`
CommittedAt time.Time `json:"committedAt"`
Parents []string `json:"parents"` // first parent first
Stats *Stats `json:"stats,omitempty"` // nil until asked (design/diffstat.md)
NoStats bool `json:"noStats,omitempty"` // asked, and GitHub had none: never asked again
}
Commit is one commit of a repository's history.
type CommitInfo ¶
type CommitInfo struct {
SHA, Message, AuthorName, AuthorLogin, CommitterName, HTMLURL string
Date time.Time // committer date
Parents []string // first parent first
}
CommitInfo is a commit as GitHub lists it; normalise cleans the fields.
type Commits ¶
type Commits struct {
// contains filtered or unexported fields
}
Commits is the commits feature.
type Edge ¶
type Edge struct {
From, To int
Color int // the lane's colour, 0..5
Open bool // the line leads to a parent older than the stored history
}
Edge is a line through a row of the git graph, from a lane at its top (or its node) to a lane at its bottom (or its node).
type Fetcher ¶
type Fetcher interface {
// Commits lists page (from 1) of the commits reachable from ref ("" for the default branch), 100 per page, newest first; more
// tells whether another page follows.
Commits(ctx context.Context, owner, name, ref string, page int) (cs []CommitInfo, more bool, err error)
// Branches and Tags list the first 100 branches and tags.
Branches(ctx context.Context, owner, name string) ([]RefInfo, error)
Tags(ctx context.Context, owner, name string) ([]RefInfo, error)
// Stats asks the diff stats of at most statsBatch commits by SHA; a commit GitHub does not answer is left out.
Stats(ctx context.Context, owner, name string, shas []string) (map[string]Stats, error)
}
Fetcher reads a repository's history.
type History ¶
type History struct {
Main []Commit
Side []Commit
Labels []Label // the default branch first, then branches, then tags
Order []*Commit
Rows []Row // the git graph of Order
// contains filtered or unexported fields
}
History is a repository's stored history: the default branch, the commits only on other branches, their labels, and the graph order the navigator pages through (newest first by commit time, a parent never before its child).
type Label ¶
type Label struct {
Name string `json:"name"`
Kind string `json:"kind"` // branch | tag
SHA string `json:"sha"`
Default bool `json:"-"` // the default branch; set at publish
}
Label is a branch or a tag at a commit of the history.
type Origin ¶
type Origin uint8
Origin is who made a commit (design/layout.md, P-40): a person, a person with an AI, a coding agent, or automation.
func Classify ¶
Classify is the origin of c and the assistant it names in the view s, by the rules its feeds were built with.
type REST ¶
type REST interface {
REST(ctx context.Context, owner, name string) (*gh.Client, error)
GraphQLURL() string
}
REST is a source's GitHub API client per owner and its GraphQL endpoint; *github.Source implements it.
type Ref ¶
type Ref struct {
Repo snapshot.RepoKey
Commit *Commit // points into the repository's facet
Person bool // a person's work in the view (not automation, not a sweep), an agent's included; set in the feeds index only
Origin Origin // set in the feeds index only
AI string // the assistant's family (Assistant) when Origin.AI
Named string // the assistant's full name when Origin.AI
}
Ref is a commit in a merged feed.
type RefInfo ¶
type RefInfo struct{ Name, SHA string }
RefInfo is a branch or a tag and the commit it points at.
type Row ¶
Row is how one commit's row of the git graph draws: its node, the lines in from above and the lines out below.
type Rules ¶
type Rules struct {
// contains filtered or unexported fields
}
Rules classify commits: the built-in tables and the assistants a deployment adds. The nil Rules are the built-in ones.
func NewRules ¶
func NewRules(added []AssistantRule) *Rules
NewRules returns the built-in rules with the assistants added; an added entry wins over the built-in reading of the same author or co-author (a configured "[bot]" co-author is an AI, not automation).
func (*Rules) Automated ¶
Automated reports whether a commit was made by automation (Classify): CI, dependency and release bots, not coding agents.
func (*Rules) Classify ¶
Classify returns the origin of c and the assistant it names: the AI co-author's or agent's name ("Claude Opus 5", "Copilot"), "" for none. The order: a release plugin is automation; a known agent is an agent; a bot author is automation; an AI co-author or footer is assisted; a bot co-author (a bot's pull request merged by a person) is automation.
type Stats ¶
type Stats struct {
Additions int `json:"additions"`
Deletions int `json:"deletions"`
Files int `json:"files"`
}
Stats are what a commit changed: lines added and removed, and files (-1 when GitHub does not say).
type Work ¶
type Work uint8
Work is the reader's lens, the work that counts (P-42, P-43): a set of kinds. People's work is by hand or with an AI; automation (CI, dependency and release bots) and sweeps are maintenance.