trail

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2026 License: MIT Imports: 2 Imported by: 0

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

func HumanizeBranchName(branch string) string

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

type Author struct {
	ID    string  `json:"id"`
	Login *string `json:"login"`
}

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.

func (ID) IsEmpty

func (id ID) IsEmpty() bool

IsEmpty returns true if the trail ID is empty or unset.

func (ID) String

func (id ID) String() string

String returns the trail ID as a string.

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

func (m *Metadata) AuthorLogin() string

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.

const (
	PriorityUrgent Priority = "urgent"
	PriorityHigh   Priority = "high"
	PriorityMedium Priority = "medium"
	PriorityLow    Priority = "low"
	PriorityNone   Priority = "none"
)

func ValidPriorities added in v0.9.0

func ValidPriorities() []Priority

ValidPriorities returns all valid priorities in descending urgency order.

func (Priority) IsValid added in v0.9.0

func (p Priority) IsValid() bool

IsValid reports whether p is a recognized priority.

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.

func (Status) IsValid

func (s Status) IsValid() bool

IsValid returns true if the status is a recognized trail status.

type Type

type Type string

Type represents the category of a trail. Mirrors VALID_TRAIL_TYPES server-side.

const (
	TypeBug     Type = "bug"
	TypeFeature Type = "feature"
	TypeTask    Type = "task"
)

func ValidTypes added in v0.9.0

func ValidTypes() []Type

ValidTypes returns all valid trail types.

func (Type) IsValid added in v0.9.0

func (t Type) IsValid() bool

IsValid reports whether t is a recognized trail type.

Jump to

Keyboard shortcuts

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