item

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: MIT Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package item names the pull requests and issues the app works on: their kind, a reference to one item, and the name of the worktree a session on an item runs in.

The inbox, the launcher, the prompt library, the launch records, and the worktree sweep all share these, so a kind stored by one is read the same way by the others, and a worktree made for an item is always found again under the same name.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotFound is returned for an item that is not in the local inbox.
	ErrNotFound = errors.New("item not found; refresh the inbox and try again")

	// ErrInvalidKind is returned for a kind other than "pr" or "issue".
	ErrInvalidKind = errors.New(`kind must be "pr" or "issue"`)
)

Functions

func WorktreeName

func WorktreeName(kind Kind, number int) string

WorktreeName is the name of the worktree a session on an item runs in: "pr-<n>" for a pull request and "issue-<n>" for an issue. The same item always gets the same name, so launching it again finds its worktree. The coding agent gives a worktree started at a pull request's head the same "pr-<n>" name.

Types

type Kind

type Kind string

Kind is what an item is: a pull request or an issue. It is stored as "pr" or "issue".

const (
	KindPR    Kind = "pr"
	KindIssue Kind = "issue"
)

The kinds of item.

func Kinds

func Kinds() []Kind

Kinds returns every kind, pull requests first.

func ParseKind

func ParseKind(s string) (Kind, error)

ParseKind reads a stored kind, or returns ErrInvalidKind.

func ParseWorktreeName

func ParseWorktreeName(name string) (kind Kind, number int, ok bool)

ParseWorktreeName reads a name WorktreeName gives: the kind and a positive number of at most ten digits without a leading zero. ok is false for any other name.

func (Kind) Noun

func (k Kind) Noun() string

Noun names the kind in a sentence: "pull request" or "issue".

func (Kind) Plural

func (k Kind) Plural() string

Plural names the kind's items in a sentence: "pull requests" or "issues".

func (Kind) Valid

func (k Kind) Valid() bool

Valid reports whether k is KindPR or KindIssue.

type Ref

type Ref struct {
	Repo   repo.Name
	Number int
	Kind   Kind
}

Ref names one pull request or issue. GitHub's numbers are shared by a repository's pull requests and issues, so the repository and number alone pick the item; Kind says which it is when the caller knows.

func (Ref) Key

func (r Ref) Key() string

Key is the item's case-folded "owner/repo#number", for comparing items and keying maps; the kind is left out, since the number alone picks the item.

func (Ref) String

func (r Ref) String() string

String writes the item as "owner/repo#number".

Jump to

Keyboard shortcuts

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