Skip to content

feat: harvest crew-generated untracked files into the project on teardown - #2

Merged
jonathan-edgar merged 1 commit into
mainfrom
feat/teardown-harvest-untracked
Jul 7, 2026
Merged

jonathan-edgar merged 1 commit into
mainfrom
feat/teardown-harvest-untracked

Conversation

@jonathan-edgar

Copy link
Copy Markdown
Owner

What

On a ship teardown, fm-teardown now 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 return hard-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).
  • Uses git ls-files --others --exclude-standard, so firstmate's own gitignored hook files are never harvested.
  • Purely additive at the destination, no git-state change. A file that can't be copied is left in place, so a copy failure surfaces as the normal dirty refusal rather than a silent loss.
  • Committed-but-unlanded work is untouched and still refuses teardown (prime directive fix(spawn): require the resolved task worktree to belong to the project #3 intact).
  • AGENTS.md: recorded as the seventh sanctioned write exception (section 1) with a teardown note (section 7).

Validation

  • shellcheck bin/*.sh bin/backends/*.sh tests/*.sh clean.
  • tests/fm-teardown.test.sh passes, 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.

…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
jonathan-edgar merged commit 0b9406d into main Jul 7, 2026
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant