Skip to main content

Module worktree

Module worktree 

Source
Expand description

Isolation and checkpoints.

speccoder works in a git worktree on speccoder/<feature> under its own state directory, so the user’s checkout is never touched. A checkpoint is a git tree object of the whole working tree (tracked and untracked, not ignored), written through a temporary index: HEAD, the index and refs never move. Restoring a checkpoint rewrites only the paths that differ.

Structs§

Artifacts
Spec Kit paths a worktree must contain.
Change
One changed path (repository-relative).
Checkpoint
A snapshot of a working tree: a git tree object id.
Refusal
Why speccoder will not work in a worktree here.
Worktree
A worktree speccoder works in.

Enums§

ChangeKind
What happened to a path between two checkpoints.

Functions§

checkpoint
Snapshots the working tree of dir. tmp holds the temporary index (inside speccoder’s state directory).
diff
Paths that differ from from to to.
ensure_lane
A fresh lane worktree for lane of feature, started at start (the feature branch’s tip). A lane left behind is replaced: lanes are speccoder’s scratch space; their work reaches the feature branch only by merging.
ensure_worktree
Creates or reuses the worktree for feature.
files
Every file path in a checkpoint.
lane_branch
The branch of a lane: one task of feature run in parallel.
patch
The textual diff between two checkpoints, without context lines.
project_state_dir
A project’s directory under the state dir: per git repository when the project is in one (shared by its worktrees), else per canonical path.
remove_lane
Removes lane’s worktree and branch, if there are any.
repo_state_dir
A repository’s directory under the state dir, keyed by its canonical common git directory (shared by all of its worktrees).
require_clean
Refuses when the working tree has any uncommitted change (for in-place mode).
restore
Makes the working tree of dir equal to target: differing paths are rewritten from the checkpoint, paths the checkpoint lacks are removed. HEAD, the index and refs are not touched. Returns what changed.
state_dir
speccoder’s state directory: $SPECCODER_STATE_DIR, else $XDG_STATE_HOME/speccoder, else ~/.local/state/speccoder.