Documentation
¶
Overview ¶
Package worktrees creates and validates the isolated Git worktrees used for human and agent development. Canonical clones remain clean, current mirrors of their base branches; all feature work lives below .wb/worktrees.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CreateOptions ¶
type CreateOptions struct {
ProjectsRoot string
Operation string
Branch string
Base string
Resume bool
}
CreateOptions controls one coordinated worktree creation operation.
type CreateResult ¶
type CreateResult struct {
Repository string `json:"repository"`
CanonicalDir string `json:"canonical_dir"`
WorktreeDir string `json:"worktree_dir"`
Branch string `json:"branch"`
Base string `json:"base"`
Action string `json:"action"`
}
CreateResult identifies the isolated checkout prepared for one repository.
func Create ¶
func Create(ctx context.Context, repositories []string, options CreateOptions) ([]CreateResult, error)
Create synchronizes each clean canonical base branch with origin, then creates (or explicitly resumes) the corresponding isolated worktree.
Synchronization happens before any branch is created. This is deliberate: every new feature branch must be based on the latest remote base, while an unsafe canonical clone causes the whole request to fail before feature work starts.
type GuardOptions ¶
GuardOptions defines the local checkout policy checked by hooks and agents.
type GuardResult ¶
type GuardResult struct {
Path string `json:"path"`
CanonicalDir string `json:"canonical_dir"`
WorktreesRoot string `json:"worktrees_root"`
Branch string `json:"branch"`
Kind string `json:"kind"`
}
GuardResult describes a checkout that satisfies the worktree policy.
func Guard ¶
func Guard(ctx context.Context, path string, options GuardOptions) (GuardResult, error)
Guard verifies that path is either a clean canonical checkout of the base branch or a non-base linked worktree in WB's central worktree hierarchy.