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_NODEare 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 fromgit add -Aby a per-worktreecore.excludesFile;withheld_pathsis 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.setupinwt, a worktree ofrepo(the primary checkout). - unstage_
products - Unstage whatever setup produced, so a rescue commit never carries it.
- valid_
destination - Is
pa path that stays inside the worktree, and out of.git? - validate_
copy - Validate a
copyspec at load time. - withheld_
paths - Paths a worktree’s setup recorded, relative to it. Empty when none.