feat: harvest crew-generated untracked files into the project on teardown - #2
Merged
Merged
Conversation
…down On a ship teardown, copy every untracked, non-ignored file the crew left in its worktree into the project's primary checkout at the same relative path (never overwriting an existing file), then remove it from the worktree. treehouse return hard-resets the worktree, so this preserves generated notes/docs/scratch that would otherwise be lost, and leaves the tree clean so leftover untracked files no longer refuse teardown. Purely additive, no git-state change; committed-but- unlanded work is untouched and still refuses. Scout (scratch worktree) and secondmate teardowns are exempt. - bin/fm-teardown.sh: harvest_untracked_into_project() + call before the safety check; header updated. - tests/fm-teardown.test.sh: copy-into-project, no-clobber, scout-exemption cases. - AGENTS.md: seventh sanctioned write exception (section 1) + teardown note (section 7).
jonathan-edgar
pushed a commit
that referenced
this pull request
Sep 22, 2026
* fix(bin): handle dash-leading harness process names (#2) * fix: handle dash-leading harness process names * no-mistakes(review): Make dash-leading harness regression hermetic * fix: preserve secondmate reply routes across relative homes Resolve relative home, data, and state inputs before durable charter generation, and fail when caller-relative directories cannot be resolved. Use absolute paths at the related spawn, AFK daemon, and X-mode cross-process handoffs so later processes cannot reinterpret them from another working directory. * no-mistakes(review): Preserve absolute overrides and normalize relative durable paths * no-mistakes(review): Normalize relative home before deriving durable paths * no-mistakes(document): Document relative durable-path normalization * no-mistakes(review): Captain: Ignore inherited CDPATH during relative path normalization * no-mistakes(lint): Fix empty CDPATH assignments for ShellCheck
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
On a ship teardown,
fm-teardownnow copies every untracked, non-ignored file the crew generated in its worktree into the project's primary checkout (same relative path, never overwriting an existing file), then removes it from the worktree.Why
treehouse returnhard-resets the worktree, so crew-generated notes/docs/scratch were lost on teardown - and their presence made teardown refuse as "dirty." This preserves them and lets teardown close out cleanly.How
harvest_untracked_into_project()runs before the safety check, on ship teardowns only (scout worktrees are scratch; secondmate homes aren't project worktrees).git ls-files --others --exclude-standard, so firstmate's own gitignored hook files are never harvested.Validation
shellcheck bin/*.sh bin/backends/*.sh tests/*.shclean.tests/fm-teardown.test.shpasses, incl. 3 new cases: copy-into-project (allows an otherwise-dirty teardown), no-clobber preserves existing, scout exemption.Note: raised directly (no-mistakes not installed locally); the 'Require no-mistakes' check will flag.