Expand description
Package-manager and toolchain repair after a worktree is created. What: Package-manager and toolchain repair after a worktree is created. Why: Repair runs after worktree creation and has its own report.
In TS you’d write (pseudocode):
// repair/index.ts: one `export * from './file'` per module below.Modules§
- package_
repair - The repair of a new worktree’s package-manager state after a rung filled it and the ignored files were copied. What: The repair of a new worktree’s package-manager state: after a rung filled the worktree and the ignored files were copied, run each tool’s own offline repair so the state it keeps for the old location works at the new one. Why: A copy keeps links and build state exactly as they were. pnpm’s links climb out of the tree by a fixed number of levels, Cargo’s build state bakes in the source’s paths, and the toolchain launchers name the source’s lock. Each tool knows how to rebuild its own layout, so the wrapper starts it (the owner’s exemption, 2026-11-03) and never edits its files itself. A repair never fails the add: it ends in a line that names the command to run, and a tool the environment does not provide is a verdict, not an error. Another process changing the files while they are copied or repaired is the person’s risk and is not defended against.
- package_
repair_ cargo - The Cargo repair of a new worktree: clone external build state, then clean the worktree’s own crates.
What:
The Cargo repair: for each Cargo workspace of a new worktree, clone the source workspace’s build state when Cargo keeps
it outside the worktree, then
cargo clean --package <member>for every member so only the worktree’s own crates rebuild. Why: Cargo bakes absolute paths into what it builds (CARGO_MANIFEST_DIR, build script output), so build state copied from another location is wrong for the worktree’s own crates, but registry and git dependencies hold nothing path-specific and can be reused. The owner chose this on 2026-11-03: “Reuse deps, rebuild own”, done with “Run cargo clean -p”. Wherebuild-diris outside the worktree (the person’s~/.cargo/config.tomlkeys it by workspace path) a copy of ignored files does not carry it, so it is cloned; under Cargo’s default layout it is insidetarget/, which is already copied.cargo metadatanames both directories, so no configuration is read by the wrapper. - package_
repair_ command - Starting one package-manager program for a worktree repair: finding it, running it with a limit, saying how it ended.
What:
Starting one package-manager program for a worktree repair: finding it on a search path, running it in a directory with
its output captured and a quiet window, and saying how it ended.
Why:
The repairs of a new worktree (
package_repair.rs) start tools the repository uses (pnpm, Cargo, mpm-shadow). Each one must end in a plain verdict the add can word for the person: the program is missing, it failed with a reason, it showed no sign of work for its window, or it worked. A tool that works is never ended for being slow (owner, 2026-11-03: “Install online during the add”; pick 9 ofdoc/planning/cli-git-shipped-limits-audit.md, the coordinator’s under the owner’s delegation and open to the owner’s veto), with the signs of work the push reads (push_progress.rs). Nothing here decides which tool runs or what its output means. - package_
repair_ pnpm - The pnpm repair of a new worktree: relink the copied
node_modulesoffline against the frozen lockfile. What: The pnpm repair:pnpm install --offline --frozen-lockfilein a new worktree whosenode_moduleswas copied. Why: pnpm’s links reach its store by a path counted in directory levels from the project, so a copy at another depth holds links that are dead or, worse, resolve through a parent directory’snode_modulesto the source’s packages. pnpm rewrites its own layout for the new location in about the time of a no-op install. - package_
repair_ report - What a worktree repair prints: one line for success, one plain line per repair that could not finish.
What:
What a worktree repair tells the person: one line when the repairs worked, and one plain line per repair that could not
finish, each naming the command that finishes it.
Why:
A repair never fails the add. The person must still learn that a worktree needs one more command, and which, so a
failure is always printed (even under
--quiet, which silences only the report of success). - package_
repair_ toolchain - The toolchain repair of a new worktree: rebuild the links and launchers that name another checkout’s lock.
What:
The toolchain repair: when the launchers copied into a new worktree’s
.cache/toolchain-launchersstill name another checkout’stoolchain.lock.json, rebuild the worktree’s own links and launchers withmpm-shadow install --frozen-lockfile. Why: mpm-shadow ownstoolchain.plan.jsonc,toolchain.lock.jsonand the pinned tools. Its exposed links and launcher records hold absolute paths, so a copy would run the source checkout’s tool versions and guard, and a branch that changes the lock would silently use the source’s. The install is lock-constrained: it relinks what is installed and, when this worktree’s lock names tools that are not installed, downloads them. The owner chose that on 2026-11-03 (“Install online during the add”), knowing an add can then download and can retire tool copies another checkout still links. The summary line mpm-shadow prints says what was installed. A failed install never fails the add: it prints the reason andmise run toolchain:install. - package_
repair_ tree_ clone - Cloning one directory tree with its modes, times and links, for the build state Cargo keeps outside a worktree. What: Cloning one directory tree for a worktree repair: every file cloned (or copied when the filesystem cannot clone), every directory recreated with its mode, every link recreated with its exact target, modes and times kept. Why: Cargo keeps its build state outside the worktree when the person’s configuration says so, so a copy of the worktree’s ignored files does not carry it. The state is reused by the new worktree’s registry and git dependencies, and Cargo decides what is fresh from file times, so the clone keeps them. The destination must not exist: nothing is overwritten.