Help us shape the future of Go! Take the 2026 Go Developer Survey

triage

package
v0.15.1 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2026 License: MIT Imports: 8 Imported by: 0

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

View Source
const DefaultStaleDays = 30

DefaultStaleDays is the default age, since the last update, after which an issue is flagged stale.

View Source
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.

View Source
const SchemaVersion = 1

SchemaVersion is the version of the next-up document written by Encode.

Variables

View Source
var BlockedLabels = []string{"amf:blocked", "blocked"}

BlockedLabels mark an issue as parked (see docs/project-context.md "Blocked tasks"); matched case-insensitively.

Functions

func Encode

func Encode(ranked []Ranked, opts Options) ([]byte, error)

Encode writes the next-up document as indented JSON with a trailing newline.

func Markdown

func Markdown(ranked []Ranked) string

Markdown renders the ranked list as a table for people.

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.

func Decode

func Decode(b []byte) ([]Issue, error)

Decode reads a JSON array of issues.

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

func (l *Label) UnmarshalJSON(b []byte) error

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.

func Rank

func Rank(issues []Issue, now time.Time, opts Options) []Ranked

Rank scores every issue and returns them all, best first. Nothing is dropped: duplicates, blocked items and pull requests stay in the list with flags, ranked after the rest. Ties break by issue number ascending.

Jump to

Keyboard shortcuts

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