Documentation
¶
Overview ¶
Package triage ranks open issues by value and effort with fixed, documented rules, so the output is deterministic and every rank comes with its reasons. It makes no model or network calls; the caller supplies the issues (for example from gh issue list) and the current time.
Index ¶
Constants ¶
const DefaultStaleDays = 30
DefaultStaleDays is the default age, since the last update, after which an issue is flagged stale.
const DuplicateThreshold = 0.6
DuplicateThreshold is the title word overlap (Jaccard index of content words) at or above which a newer issue is flagged as a likely duplicate of an older one.
const SchemaVersion = 1
SchemaVersion is the version of the next-up document written by Encode.
Variables ¶
var BlockedLabels = []string{"amf:blocked", "blocked"}
BlockedLabels mark an issue as parked (see docs/project-context.md "Blocked tasks"); matched case-insensitively.
Functions ¶
Types ¶
type Document ¶
type Document struct {
SchemaVersion int `json:"schema_version"`
StaleDays int `json:"stale_days"`
Items []Ranked `json:"items"`
}
Document is the next-up file written by Encode.
type Issue ¶
type Issue struct {
Number int `json:"number"`
Title string `json:"title"`
Body string `json:"body"`
Labels []Label `json:"labels"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
PullRequest json.RawMessage `json:"pull_request,omitempty"`
IsPR bool `json:"isPullRequest,omitempty"`
}
Issue is one input item, in the shape of gh issue list --state open --json number,title,body,labels,createdAt,updatedAt. PullRequest is set by the GitHub REST issues API for pull requests.
type Label ¶
type Label struct {
Name string `json:"name"`
}
Label is an issue label. It decodes from either a string or an object with a "name" field (the shape gh issue list --json labels prints).
func (*Label) UnmarshalJSON ¶
type Options ¶
type Options struct {
// StaleDays flags issues not updated for more than this many days; 0
// disables the stale check.
StaleDays int
}
Options tune Rank.
type Ranked ¶
type Ranked struct {
Rank int `json:"rank"`
Number int `json:"number"`
Title string `json:"title"`
Score float64 `json:"score"`
Value int `json:"value"`
Effort int `json:"effort"`
Reasons []string `json:"reasons"`
Flags []string `json:"flags"`
}
Ranked is one entry of the next-up list.