Skip to main content

Module worktree_setup

Module worktree_setup 

Source
Expand description

[worktree] setup: what a fresh worktree needs beyond its tracked files.

magi makes its worktrees with plain git worktree add, so a .env or a one-off bootstrap that renri add would have produced is missing. Each step runs in order, right after the worktree exists and before any agent or verify command touches it. A failing step fails that worktree with the step and its output; nothing here is ever swallowed.

Three rules keep the competition honest:

  • Blindness. MAGI_RUN / MAGI_NODE are removed from a command’s environment, and nothing seat- or agent-shaped is exported.
  • Products are not work. Every path the steps leave untracked is recorded in the worktree’s own git dir (RECORD) and hidden from git add -A by a per-worktree core.excludesFile; withheld_paths is the second line, used by the rescue commits.
  • Setup does not edit tracked files. One that does fails the worktree, which also stops a kata apply-shaped step: every candidate would carry the same diff.

Constants§

RECORD
File in the worktree’s git dir listing the setup products, NUL-separated.

Functions§

prepare
Run cfg.worktree.setup in wt, a worktree of repo (the primary checkout).
unstage_products
Unstage whatever setup produced, so a rescue commit never carries it.
valid_destination
Is p a path that stays inside the worktree, and out of .git?
validate_copy
Validate a copy spec at load time.
withheld_paths
Paths a worktree’s setup recorded, relative to it. Empty when none.