Documentation
¶
Index ¶
- Constants
- func AllStatusLabels() []string
- func AllTypeLabels() []string
- func HasLabel(labels []string, label string) bool
- func IsStatusLabel(label string) bool
- func RenderBody(body IssueBody) string
- func SplitOverflowComments(overflow string) []string
- func StatusLabel(labels []string) string
- func StripFrontMatter(raw string) string
- func TruncateIssueBody(body string) (truncated string, overflow string)
- func ValidateTransition(from, to string) error
- type FrontMatter
- type IssueBody
- type LabelDef
Constants ¶
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)
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
const ( TypeFeature = "herd/type:feature" TypeBugfix = "herd/type:bugfix" TypeFix = "herd/type:fix" TypeStandaloneFix = "herd/type:standalone-fix" TypeManual = "herd/type:manual" )
Type labels
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 IsStatusLabel ¶
IsStatusLabel returns true if the label is a herd status label.
func RenderBody ¶
RenderBody generates the full issue body from structured data.
func SplitOverflowComments ¶ added in v0.7.0
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 ¶
StatusLabel returns the status label from a list of labels, or empty string.
func StripFrontMatter ¶ added in v0.8.2
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
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 ¶
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.