issues

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: May 28, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusReady      = "herd/status:ready"
	StatusInProgress = "herd/status:in-progress"
	StatusDone       = "herd/status:done"
	StatusFailed     = "herd/status:failed"
	StatusBlocked    = "herd/status:blocked"
	StatusCancelled  = "herd/status:cancelled"
)

Status labels (mutually exclusive)

View Source
const (
	// CIFixPending is added to a batch PR when the monitor posts /herd fix-ci.
	// It is removed once CI passes, allowing future failures to re-trigger the command.
	CIFixPending = "herd/ci-fix-pending"

	// RetryPending is added to a failed issue when the monitor posts /herd retry.
	// It is removed by the retry handler, preventing duplicate retry comments
	// when two patrol runs execute before the first retry is processed.
	RetryPending = "herd/retry-pending"

	// RebasePending is added to a batch PR when the monitor detects a merge
	// conflict with the base branch and dispatches a rebase conflict resolution
	// worker. It is removed once the conflict is resolved (PR becomes mergeable
	// again), preventing duplicate dispatches from concurrent patrol runs.
	RebasePending = "herd/rebase-pending"

	// CascadeFailed is added to a batch PR when a conflict-resolution cascade
	// exhausts max_conflict_resolution_attempts. It is removed manually by a
	// human after they handle the underlying problem, and acts as a circuit
	// breaker preventing further conflict-resolution issues from being created
	// for the batch.
	CascadeFailed = "herd/cascade-failed"

	// StableDisagreement is added to a batch PR when the integrator detects
	// that the reviewer is re-flagging findings that a previous fix worker
	// already determined to be no-ops. While present, automatic review is
	// skipped — the user removes the label (or runs /herd review or
	// /herd integrate manually) to resume.
	StableDisagreement = "herd/stable-disagreement"
)

PR state labels

View Source
const (
	TypeFeature       = "herd/type:feature"
	TypeBugfix        = "herd/type:bugfix"
	TypeFix           = "herd/type:fix"
	TypeStandaloneFix = "herd/type:standalone-fix"
	TypeManual        = "herd/type:manual"
)

Type labels

View Source
const MaxIssueBodyChars = githubIssueBodyMaxChars

MaxIssueBodyChars is the safety-margin limit (under GitHub's 65536 hard cap) that TruncateIssueBody enforces. Exported for callers that need to guard a body size before calling Issues().Update.

Variables

This section is empty.

Functions

func AllStatusLabels

func AllStatusLabels() []string

AllStatusLabels returns all status labels.

func AllTypeLabels

func AllTypeLabels() []string

AllTypeLabels returns all type labels.

func HasLabel

func HasLabel(labels []string, label string) bool

HasLabel returns true if the label list contains the given label.

func IsStatusLabel

func IsStatusLabel(label string) bool

IsStatusLabel returns true if the label is a herd status label.

func RenderBody

func RenderBody(body IssueBody) string

RenderBody generates the full issue body from structured data.

func SplitOverflowComments added in v0.7.0

func SplitOverflowComments(overflow string) []string

SplitOverflowComments takes overflow content and returns a slice of comment bodies, each <= githubIssueBodyMaxChars. If overflow fits in one comment, returns a single-element slice with the content unchanged. Otherwise each comment is prefixed with a "_Part N of M (continued from issue body)._" header. Returns nil for an empty input.

func StatusLabel

func StatusLabel(labels []string) string

StatusLabel returns the status label from a list of labels, or empty string.

func StripFrontMatter added in v0.8.2

func StripFrontMatter(raw string) string

StripFrontMatter returns the issue body with any leading YAML front matter block removed. If there is no front matter, the input is returned trimmed.

func TruncateIssueBody added in v0.7.0

func TruncateIssueBody(body string) (truncated string, overflow string)

TruncateIssueBody returns the body unchanged if it fits under githubIssueBodyMaxChars. Otherwise it returns a truncated body ending in truncationMarker plus the overflow content (everything that was cut, prefixed with a header explaining its origin).

Truncation prefers a clean boundary: if a newline ("\n\n" preferred, then "\n") exists within ~200 chars before the cutoff, truncate there. Otherwise fall back to a hard cut at the cutoff. The cut is adjusted backwards if necessary so that it lands on a UTF-8 rune boundary.

func ValidateTransition

func ValidateTransition(from, to string) error

ValidateTransition checks whether transitioning from one status to another is allowed.

Types

type FrontMatter

type FrontMatter struct {
	Version             int      `yaml:"version"`
	Batch               int      `yaml:"batch,omitempty"`
	DependsOn           []int    `yaml:"depends_on,omitempty"`
	Scope               []string `yaml:"scope,omitempty"`
	EstimatedComplexity string   `yaml:"estimated_complexity,omitempty"`
	RunnerLabel         string   `yaml:"runner_label,omitempty"`
	// Integrator-generated fields
	Type                string   `yaml:"type,omitempty"`
	FixCycle            int      `yaml:"fix_cycle,omitempty"`
	TargetPR            int      `yaml:"target_pr,omitempty"`
	TargetBranch        string   `yaml:"target_branch,omitempty"`
	BatchPR             int      `yaml:"batch_pr,omitempty"`
	CIFixCycle          int      `yaml:"ci_fix_cycle,omitempty"`
	ConflictResolution  bool     `yaml:"conflict_resolution,omitempty"`
	ConflictingBranches []string `yaml:"conflicting_branches,omitempty"`
}

FrontMatter holds the YAML front matter fields for a herd issue.

type IssueBody

type IssueBody struct {
	FrontMatter           FrontMatter
	Task                  string
	ImplementationDetails string
	Conventions           []string
	ContextFromDeps       []string
	Criteria              []string
	Context               string
	ConversationHistory   string
	FilesToModify         []string
}

IssueBody holds the parsed content of a herd issue body.

func ParseBody

func ParseBody(raw string) (*IssueBody, error)

ParseBody parses a herd issue body into structured data.

type LabelDef

type LabelDef struct {
	Name        string
	Color       string
	Description string
}

LabelDef defines a label with its name, color, and description.

func AllLabels

func AllLabels() []LabelDef

AllLabels returns all herd labels.

Jump to

Keyboard shortcuts

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