Documentation
¶
Overview ¶
Package trail provides types and helpers for managing trail metadata. Trails are branch-centric work-tracking abstractions served by the core API. They answer "why/what" (human intent) while checkpoints answer "how/when" (machine snapshots).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HumanizeBranchName ¶
HumanizeBranchName converts a branch name into a human-readable title. It strips common prefixes (feature/, fix/, etc.), replaces dashes/underscores with spaces, and capitalizes the first word.
Types ¶
type Author ¶ added in v0.6.0
Author identifies the user who created a trail. On the wire the whole object may be null when the original author can no longer be resolved (e.g. the GitHub user no longer exists), and login may independently be null while the id is retained.
type ID ¶
type ID string
ID is a 12-character hex identifier for trails.
const EmptyID ID = ""
EmptyID represents an unset or invalid trail ID.
type Metadata ¶
type Metadata struct {
Number int `json:"number,omitempty"`
TrailID ID `json:"trail_id"`
URL string `json:"url,omitempty"`
Branch string `json:"branch"`
Base string `json:"base"`
Title string `json:"title"`
Body string `json:"body"`
Status Status `json:"status"`
Phase string `json:"phase,omitempty"`
Author *Author `json:"author"`
Assignees []string `json:"assignees"`
Labels []string `json:"labels"`
Type Type `json:"type,omitempty"`
Priority Priority `json:"priority,omitempty"`
Reviewers []Reviewer `json:"reviewers,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
MergedAt *time.Time `json:"merged_at"`
}
Metadata represents the metadata for a trail, matching the web PR format.
func (*Metadata) AuthorLogin ¶ added in v0.6.0
AuthorLogin returns the trail author's login, or an empty string if the author is unknown (object null) or the login is null.
type Priority ¶
type Priority string
Priority represents a trail's priority. Mirrors VALID_PRIORITIES server-side.
func ValidPriorities ¶ added in v0.9.0
func ValidPriorities() []Priority
ValidPriorities returns all valid priorities in descending urgency order.
type Reviewer ¶
type Reviewer struct {
Login string `json:"login"`
Status ReviewerStatus `json:"status"`
}
Reviewer represents a reviewer assigned to a trail.
type ReviewerStatus ¶
type ReviewerStatus string
ReviewerStatus represents the review status for a reviewer.
const ( ReviewerPending ReviewerStatus = "pending" ReviewerApproved ReviewerStatus = "approved" ReviewerChangesRequested ReviewerStatus = "changes_requested" )
type Status ¶
type Status string
Status represents the lifecycle status of a trail.
const ( StatusDraft Status = "draft" StatusOpen Status = "open" StatusMerged Status = "merged" StatusClosed Status = "closed" )
The status set mirrors the server's repo_trails check constraint ('draft', 'open', 'merged', 'closed'). The former in_progress and in_review statuses were folded into open server-side.
func ValidStatuses ¶
func ValidStatuses() []Status
ValidStatuses returns all valid trail statuses in lifecycle order.