Documentation
¶
Overview ¶
Package worktree manages native-Git effort worktrees.
Index ¶
- type Manager
- func (m *Manager) Add(ctx context.Context, slug, base string) (Result, error)
- func (m *Manager) Integrate(ctx context.Context, slug, gateCommand string) (Result, error)
- func (m *Manager) Observe(ctx context.Context, slug string) Observation
- func (m *Manager) Remove(ctx context.Context, slug string) (Result, error)
- type Observation
- type OpenCheckout
- type OpenResident
- type RefusalError
- type ResidentHandle
- type Result
- type Runner
- type TopologyEffects
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func Open ¶
func Open(roots awfgit.ControlRoots, open OpenCheckout, openResident OpenResident) (*Manager, error)
Open composes managed-worktree mechanics over resolved control roots and explicit Git and resident capabilities. Effort lifecycle coordination belongs to the application boundary above this manager.
type Observation ¶ added in v0.46.0
type Observation struct {
Path string
Branch string
Topology TopologyEffects
}
Observation is one best-effort snapshot used by application-level creation rollback. Probe failures become explicit uncertainty rather than invented topology facts.
type OpenCheckout ¶
OpenCheckout opens the Git surface of the checkout rooted at root. The manager reasons about two checkouts at once - the one it was invoked from and the managed one it is creating or retiring - so it opens each by root instead of holding a single handle.
type OpenResident ¶ added in v0.41.0
type OpenResident func(root awfgit.ResidentName) (ResidentHandle, error)
OpenResident provides the selected resident-root filesystem capability.
type RefusalError ¶
type RefusalError struct {
Category string
Condition string
ChangedTopology bool // legacy summary; Topology carries exact axes.
Topology TopologyEffects
ManagedPath string
ManagedBranch string
NextAction string
NextActions []string
Err error
}
func (*RefusalError) Error ¶
func (e *RefusalError) Error() string
func (*RefusalError) Unwrap ¶
func (e *RefusalError) Unwrap() error
type ResidentHandle ¶ added in v0.41.0
type ResidentHandle interface {
Close() error
MkdirAll(string, fs.FileMode) error
LinkInfo(string) (fs.FileInfo, error)
ExpectedIdentity(string) (*filesystem.ExpectedIdentity, error)
RetireExpected(string, *filesystem.ExpectedIdentity) error
}
ResidentHandle is the confined resident-root capability the manager needs.
type Result ¶
type Result struct {
Condition string
ChangedTopology bool // legacy summary; Topology contains exact axes.
Topology TopologyEffects
NextAction string
Path string
Branch string
}
Result carries structured managed-topology facts for orchestration and presentation mapping.
type Runner ¶
type Runner interface {
WorktreeList(ctx context.Context) ([]awfgit.WorktreeRegistration, error)
WorktreeAdd(ctx context.Context, path, branch, base string) error
WorktreeRemove(ctx context.Context, path string) error
WorktreePrune(ctx context.Context) error
BranchExists(ctx context.Context, name string) (bool, error)
BranchDelete(ctx context.Context, name string) error
Ancestor(ctx context.Context, older, newer string) (bool, error)
MergeBase(ctx context.Context, a, b string) (string, error)
MergeFastForward(ctx context.Context, rev string) error
MergeNoCommit(ctx context.Context, rev string) error
ResolveCommit(ctx context.Context, revision string) (string, error)
CurrentBranch(ctx context.Context) (string, error)
ChangeCounts(ctx context.Context) (tracked, untracked int, err error)
GitPath(ctx context.Context, name string) (string, error)
}
Runner is this package's own contract on one checkout's Git surface. It names exactly the operations the manager performs and nothing more, so the manager depends on what it uses rather than on a repository object; the composition root satisfies it with the Git seam's handle.
type TopologyEffects ¶ added in v0.41.0
type TopologyEffects struct {
ManagedPath bool
GitRegistration bool
Branch bool
ReceivingHEAD bool
Uncertain bool
}
TopologyEffects records independently observable Git topology axes. Git remains the reconciliation owner: uncertainty is explicit when a probe could not establish an axis after a failed native operation.
func (TopologyEffects) Changed ¶ added in v0.41.0
func (e TopologyEffects) Changed() bool