worktree

package
v0.67.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: MIT Imports: 15 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 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

Constants

This section is empty.

Variables

View Source
var PullPathRE = regexp.MustCompile(`/` + forge.PullPath + `(\d+)(?:[/?#]|$)`)

PullPathRE matches GitHub's `/pull/12` and GitLab's `/-/merge_requests/12`.

Functions

func Checkout

func Checkout(ctx context.Context, main, branch, base string, create bool) (string, error)

Checkout reads the new worktree's path back from git, never predicted.

func PrefixOf

func PrefixOf(r ref.Ref) string

func PullToken

func PullToken(token string) (string, bool)

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 RemoveCheckout

func RemoveCheckout(ctx context.Context, main, path, branch string) error

RemoveCheckout deletes the branch with -D: the host confirmed the merge, which a squash or rebase hides from git.

func SiblingPath

func SiblingPath(main, branch string) string

SiblingPath matches worktrunk's layout, which per-project cleanup scripts already scan.

func SuffixOf

func SuffixOf(s string) string

func TitleLookup

func TitleLookup(t *target.Target, number string) func(context.Context) (string, error)

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

func WorkspaceAt(wss []agentctl.Workspace, path string) *agentctl.Workspace

WorkspaceAt is the workspace opened on path, nil for none.

func WorkspaceByID

func WorkspaceByID(wss []agentctl.Workspace, id string) *agentctl.Workspace

WorkspaceByID is the workspace with id, nil for none.

func WorkspaceLabel

func WorkspaceLabel(ws *agentctl.Workspace) string

WorkspaceLabel is ws's label, "" for no workspace.

Types

This section is empty.

Jump to

Keyboard shortcuts

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