hostops

package
v0.60.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: MIT Imports: 20 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 hostops is how commands reach the host: the host CLI with the title template, the issue and PR calls, task rows and the After: line. The task sources that stand on a Host live in package tasksource.

Index

Constants

View Source
const IssuePage = 30

IssuePage is the first page `task open --print` and `task search` show.

Variables

This section is empty.

Functions

func AfterID

func AfterID(line string) string

AfterID is the id one line names as an After: line, or "".

func AfterIn

func AfterIn(body string) string

AfterIn is the id the body's After: line names, or "": bare or as a link to the task, with emphasis or code marks around either part ignored.

func OneIDHeading

func OneIDHeading(doc string, r ref.Ref, titles tasktitle.Template) string

OneIDHeading collapses `# <id>: <id>: <title>`, the id a driver adds over the one tracker.title wrote, to one id.

func PriorityLabel added in v0.60.0

func PriorityLabel(level string, priorities map[string]string) string

PriorityLabel takes the first label in name order when several carry the level; the index is lower-cased, and the hosts match case-insensitively.

func RetitleAfter

func RetitleAfter(ctx context.Context, warnTo io.Writer, t *target.Target, r ref.Ref, verb string)

RetitleAfter writes tracker.title onto an issue just written, since the template needs the number and a driver has no title verb; the write stands, so a failure is a warning.

func RowRefs

func RowRefs(rows []Row) []ledger.TaskRef

func StaleAt

func StaleAt(created time.Time, staleAfter facts.StaleAfter, now time.Time) bool

StaleAt is task read's stale mark and task stale's age check in one place, so the two never disagree; an undeclared or bad stale_after is never stale.

func TaskTitle

func TaskTitle(doc string) string

func WriteRows

func WriteRows(w io.Writer, rows []Row, none string) error

WriteRows applies the rule reading a task does: a terminal gets a table, anything else the JSON. f10 never picks a winner among rows: choosing is fzf's job in a shell and the agent's in a turn.

Types

type Host

type Host struct {
	forge.Host

	Titles tasktitle.Template // tracker.title; zero leaves titles as the host holds them
	Prefix string             // the task id prefix titles are rendered and stripped with
}

A Host is the forge binding with the nouns only this command acts on; the reads standup and the board share live on forge.Host itself.

func HostOf

func HostOf(t *target.Target) (Host, error)

HostOf is the CLI the probe settled on; a wrong guess opens the wrong site, so "unknown" refuses rather than picking.

func NewHost

func NewHost(name, dir string) Host

func OptionalHostOf

func OptionalHostOf(t *target.Target) *Host

OptionalHostOf is the host, or nil for a checkout with no host CLI: a reader that works without one skips it rather than failing.

func (Host) In

func (h Host) In(dir string) Host

func (Host) IssueCreated

func (h Host) IssueCreated(ctx context.Context, number string) (time.Time, error)

IssueCreated is the issue's created date, zero when the host gives none.

func (Host) IssueDoc

func (h Host) IssueDoc(
	ctx context.Context,
	id, number string,
	staleAfter facts.StaleAfter,
) (string, forge.Issue, error)

func (Host) IssueTitle

func (h Host) IssueTitle(ctx context.Context, number string) (string, error)

IssueTitle is the one field the default branch name carries.

func (Host) IssueURL

func (h Host) IssueURL(ctx context.Context, number string) (string, error)

func (Host) ListIssues

func (h Host) ListIssues(
	ctx context.Context, query, prefix string, priorities map[string]string, limit int,
) ([]Row, error)

func (Host) MergeMethod

func (h Host) MergeMethod(ctx context.Context, declared string) (string, string, error)

MergeMethod is the declared method, else the one the repo allows; a GitHub repo allowing several gets squash with a note, since a history-rewriting default is not silent.

func (Host) OpenPull

func (h Host) OpenPull(ctx context.Context, n forge.NewPull) (string, error)

OpenPull opens the request and reads the url back from the host, since neither CLI prints it in a form worth parsing.

func (Host) PRURL

func (h Host) PRURL(ctx context.Context, number string) (string, error)

func (Host) PickupOf

func (h Host) PickupOf(number string, p forge.PR) *Pickup

PickupOf reads the request through f10 pr, which reads one in any state on either host, so the prompt is the same text on GitHub and GitLab.

func (Host) PullRows

func (h Host) PullRows(ctx context.Context) ([]Row, error)

PullRows is the first page of open requests, newest first.

func (h Host) Relink(ctx context.Context, parent, child string) error

Relink puts child under parent, or with parent "" takes it out from under the parent it has.

func (Host) SetTitle

func (h Host) SetTitle(ctx context.Context, number, title string) error

func (Host) StripTitle added in v0.60.0

func (h Host) StripTitle(raw, number string) string

StripTitle is raw with the prefix the title template wrote taken off.

func (Host) TitleChanges

func (h Host) TitleChanges(ctx context.Context, number string) ([]titleChange, error)

func (Host) Update

func (h Host) Update(ctx context.Context, number string, p Props, priorities map[string]string) error

Update: an issue has two states and no custom properties, so `--status` takes open or closed and `--set` is refused; the labels of every other priority level come off, so the issue carries one; an assignee replaces the issue's, as glab's flag does; a title renamed by hand gets its prefix back.

type Pickup

type Pickup struct {
	Number string
	URL    string
	Branch string // the request's head, as the host names it
	View   string // the f10 command that reads the request with its comments
	Diff   string
	// Sha is where a merged or closed request is checked out, "" for an open
	// one; state says which it is, for the prompt and the report; headRef is
	// the host's ref for a closed request's head, which no branch holds
	SHA     string
	State   string
	HeadRef string
}

func (*Pickup) Landed

func (p *Pickup) Landed() bool

Landed reports a request that merged or closed, checked out at sha.

type Props

type Props struct {
	Status, Priority, Assignee string
	Labels, Set                []string
}

func (Props) Args added in v0.60.0

func (p Props) Args() []string

Args is the props as the tracker driver's flags.

func (Props) Empty

func (p Props) Empty() bool

type Row

type Row struct {
	ID       string    `json:"id"`
	Title    string    `json:"title"`
	Status   string    `json:"status,omitempty"`
	URL      string    `json:"url,omitempty"`
	Priority string    `json:"priority,omitempty"`
	After    string    `json:"after,omitempty"`    // the base its body's After: line names, where the source gives one
	Body     string    `json:"body,omitempty"`     // read for its After: line; never printed
	Assignee string    `json:"assignee,omitempty"` // the tracker's assignee, where the source gives one
	Created  time.Time `json:"created,omitzero"`
}

A Row holds the fields f10 relies on; a driver may carry more, which f10 neither requires nor reads.

func SettlePriorities

func SettlePriorities(rows []Row, warn io.Writer) []Row

SettlePriorities warns once per distinct unknown value: a driver emitting its tracker's own word does so on every row of the page.

func StripTitles

func StripTitles(rows []Row, titles tasktitle.Template) []Row

StripTitles is for driver rows; the host's come stripped from ListIssues.

Jump to

Keyboard shortcuts

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