Documentation
¶
Overview ¶
Package worktree is a task's checkout and the backend hosting its agent: where the worktree goes, how it is made and removed, and the names and pull tokens that point at one.
Index ¶
- Variables
- func Checkout(ctx context.Context, main, branch, base string, create bool) (string, error)
- func PrefixOf(r ref.Ref) string
- func PullToken(token string) (string, bool)
- func ReachableAgents(dir string) agentctl.Backend
- func RemoveCheckout(ctx context.Context, main, path, branch string) error
- func RequireAgents() error
- func SiblingPath(main, branch string) string
- func SuffixOf(s string) string
- func TitleLookup(t *target.Target, number string) func(context.Context) (string, error)
- func WorkspaceAt(wss []agentctl.Workspace, path string) *agentctl.Workspace
- func WorkspaceByID(wss []agentctl.Workspace, id string) *agentctl.Workspace
- func WorkspaceLabel(ws *agentctl.Workspace) string
Constants ¶
This section is empty.
Variables ¶
Agents is the backend hosting task agents, answering from dir: Herdr, the only one. A variable so a test can host agents without it.
var PullPathRE = regexp.MustCompile(`/(?:pull|merge_requests)/(\d+)(?:[/?#]|$)`)
PullPathRE matches GitHub's `/pull/12` and GitLab's `/-/merge_requests/12`.
Functions ¶
func PullToken ¶
PullToken's probe is true for a bare `#12`, which may name a task instead: ask the host before taking it (GitHub's issues and PRs share one counter).
func ReachableAgents ¶
ReachableAgents is the backend answering from dir, or nil when this process cannot reach it.
func RemoveCheckout ¶
RemoveCheckout deletes the branch with -D: the host confirmed the merge, which a squash or rebase hides from git.
func RequireAgents ¶
func RequireAgents() error
RequireAgents is the check start, forward, drive and finish make before anything else: they run inside a Herdr session and nowhere else, with no fallback by design.
func SiblingPath ¶
SiblingPath matches worktrunk's layout, which per-project cleanup scripts already scan.
func TitleLookup ¶
TitleLookup asks the host for the task's title, needed only when no driver names the branch. A checkout with no host CLI answers with the reason, so the note beneath the report can quote it.
func WorkspaceAt ¶
WorkspaceAt is the workspace opened on path, nil for none.
func WorkspaceByID ¶
WorkspaceByID is the workspace with id, nil for none.
func WorkspaceLabel ¶
WorkspaceLabel is ws's label, "" for no workspace.
Types ¶
This section is empty.