feat: add treehouse setup hook and manual PR validation flow - #53
Closed
michael-sb wants to merge 6 commits into
Closed
feat: add treehouse setup hook and manual PR validation flow#53michael-sb wants to merge 6 commits into
michael-sb wants to merge 6 commits into
Conversation
Treehouse v1.8.0 adds post_create/pre_destroy hooks that fire at worktree lifecycle points. Use post_create to run per-project setup scripts (data/<project>-setup.sh) right before treehouse get hands the worktree over, which is earlier and simpler than waiting inside fm-spawn. Add bin/fm-treehouse-post-create.sh, a single global hook script wired in ~/.config/treehouse/config.toml. It locates firstmate's data/ from its own location and runs data/<project>-setup.sh if it exists (project name = worktree directory basename, matching the data/projects.md convention). Output is logged to state/treehouse-setup-<project>.log. A failing setup script is non-fatal: treehouse continues on hook failure by design, and the hook exits with the setup script's code so the failure surfaces in treehouse's own logs. The mechanism is general - any project can get a data/<name>-setup.sh and the hook picks it up automatically, no per-project hardcoding. Secondmates have no project worktree, so the hook is irrelevant to them. fm-spawn passes FM_HOME and FM_* overrides through treehouse get so the hook resolves the correct firstmate home even for alternate/secondmate homes. fm-bootstrap detects the hook wiring and offers an install step. Validated through the no-mistakes pipeline (review, test, lint, CI green).
This was referenced Aug 9, 2026
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.
Intent
Captain, the developer wanted AGENTS.md updated so all firstmate instructions to crewmates for running the no-mistakes pipeline use the manual-PR workflow with --skip=pr,ci. They wanted validation to run through push without no-mistakes opening a GitHub PR, leaving the captain to open the PR manually afterward, while preserving the explicit rule that firstmate must not merge without approval. They asked for the change to be tightly scoped to the no-mistakes validation and PR-ready instructions, with a caveat that manual PR bodies may need to preserve the no-mistakes marker required by the current workflow checks. They also required creating branch fm/nomistakes-skip-pr-ci-v5, committing the change, staying inside the worktree, not pushing to origin or GitHub, and using only the local no-mistakes remote/bare gate if needed to start validation with push/pr/ci steps skipped.
What Changed
fm-treehouse-post-create.shhelper.--skip=pr,ci, leaving PR creation/manual merge approval outside the pipeline.Risk Assessment
Testing
Captain, I inspected the branch diff and no-mistakes instructions, ran the focused changed-area tests, generated an actual crewmate brief as end-user evidence, verified it contains the manual-PR workflow and not the old push-skipping wording, ran the full shell test suite, and confirmed the working tree was left clean.
Evidence: Manual PR generated brief excerpt
Generated brief excerpt shows:--skip=pr,ci, branch push through no-mistakes, no PR/CI monitoring, and manual PR-ready status.Evidence: Full generated crewmate brief
Evidence: Evidence transcript
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
🔧 **Review** - 2 issues found → auto-fixed ✅
AGENTS.md:421- The new rule requires every no-mistakes instruction to include--skip=push,pr,ci, but generated no-mistakes briefs still say firstmate will run/no-mistakesto ship a PR and that the crewmate should reportdone: PR {url} checks greenafter CI. New tasks will get conflicting instructions and may still push/open PRs despite this workflow change; updatebin/fm-brief.sh's no-mistakes definition of done to match the manual PR flow.bin/fm-bootstrap.sh:386- Appending to a valid single-line TOML array with a trailing comma, such aspost_create = ["existing",], producespost_create = ["existing",, "<hook>"], corrupting the Treehouse config. Strip an existing trailing comma before inserting, or rewrite the array through a safer parser path.🔧 Fix: Align generated no-mistakes brief contract
✅ Re-checked - no issues remain.
🔧 **Test** - 1 issue found → auto-fixed ✅
AGENTS.md:421- Captain, the implemented no-mistakes instructions skip the push step too: AGENTS.md requires--skip=push,pr,ciand says no-mistakes skips branch push. The generated crewmate brief mirrors that by telling the crewmate never to push and to stop before manual push+PR. That does not demonstrate the stated intent of validation running through push while only PR/CI are skipped with--skip=pr,ci.git diff 2a2fe0566e63b883ec53dc3e34dc14306689f989..0b9ac82dd25e61de49e59221918dce3dbab2f965 -- AGENTS.md bin/fm-brief.sh tests/fm-brief.test.sh README.md .github/workflows/no-mistakes-required.ymltests/fm-brief.test.shFM_HOME=/var/folders/t0/dws_m6l52lj97dkt9f4hd_sh0000gn/T/no-mistakes-evidence/01KVTKFHBWBD1CHR7ZPTDJ1T17/home bin/fm-brief.sh ship-test appnl -ba AGENTS.md | sed -n '406,440p'andnl -ba bin/fm-brief.sh | sed -n '184,198p'git status --short🔧 Fix: Captain, allow no-mistakes push before manual PR
✅ Re-checked - no issues remain.
sed -n '1,220p' /Users/michael/.agents/skills/no-mistakes/SKILL.mdpwd;git status --short;git rev-parse --show-toplevel;git log --oneline --decorate -5git diff --stat 2a2fe0566e63b883ec53dc3e34dc14306689f989..HEAD;git diff --name-only 2a2fe0566e63b883ec53dc3e34dc14306689f989..HEADsed -n '380,445p' AGENTS.md;sed -n '170,205p' bin/fm-brief.sh;sed -n '1,260p' tests/fm-brief.test.shtests/fm-brief.test.sh && tests/fm-bootstrap.test.sh && tests/fm-spawn-treehouse-env.test.sh && tests/fm-treehouse-post-create.test.shfor t in tests/*.test.sh; do echo "== $t =="; "$t" || exit $?; doneFM_HOME=/var/folders/t0/dws_m6l52lj97dkt9f4hd_sh0000gn/T/no-mistakes-evidence/01KVTKFHBWBD1CHR7ZPTDJ1T17/manual-pr-home bin/fm-brief.sh ship-evidence-prci appgrepchecks on the generated brief for--skip=pr,ci, branch-push wording, manual PR-ready status, and absence of--skip=push,pr,ci/ old PR+CI status wordinggit status --short && find . -maxdepth 1 -type d -name '.tmp.*' -print⏭️ **Document** - skipped
.github/workflows/no-mistakes-required.yml:18- Workflow UI/error text still says PRs must be raised throughgit push no-mistakesand that the pipeline writes the PR body. I left it unchanged because it is executable workflow configuration, not a documentation file or doc comment.✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.