workspace

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2026 License: MIT Imports: 10 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 workspace manages per-agent git worktrees and thread branches (RFC 6.4, D5). Merging is always a human action.

Index

Constants

This section is empty.

Variables

View Source
var ErrDirty = errors.New("the main checkout has uncommitted changes; commit or stash them first")

ErrDirty is returned when apply finds uncommitted changes.

View Source
var ErrMerged = errors.New("the branch is already merged into the main checkout's current branch")

ErrMerged is returned when the branch is already in the current branch.

Functions

func Apply

func Apply(repo, branch, runID string) (string, error)

Apply merges branch into the main checkout's current branch. It refuses on a dirty tree.

func BranchName

func BranchName(agent, thread string) string

BranchName is smif/<agent>/<thread-ulid-short>.

func Diff

func Diff(repo, branch string) (string, error)

Diff shows a branch against the merge base with the repo's current HEAD.

func Git

func Git(dir string, args ...string) (string, error)

Git runs git in dir and returns trimmed stdout.

Types

type Manager

type Manager struct {
	Root string
}

Manager owns worktrees under Root/<agent>.

func (*Manager) Finish

func (m *Manager) Finish(ws *Workspace, summary, runID string) (head, diffstat string, err error)

Finish commits a dirty worktree ("smif: <summary> [run <id>]") and returns the head SHA and the branch diffstat against its base.

func (*Manager) GC

func (m *Manager) GC(a *config.Agent, retention time.Duration, now time.Time) int

GC deletes smif/<agent>/* branches whose last commit is older than retention, detaching the worktree first when needed. Returns how many.

func (*Manager) Prepare

func (m *Manager) Prepare(a *config.Agent, scope, thread, existingBranch string) (*Workspace, error)

Prepare returns the workspace for a run.

none, direct: the main checkout.
worktree:     Root/<agent> on the thread branch, cleaned and verified.

existingBranch is the branch already recorded for this thread, if any.

type Workspace

type Workspace struct {
	Dir     string
	Scope   string
	Branch  string
	BaseSHA string
}

Workspace is where a run executes.

Jump to

Keyboard shortcuts

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