Skip to content

docs: add Xcode DerivedData cleanup recipe - #1423

Merged
max-sixty merged 2 commits into
max-sixty:mainfrom
RickeyBoy:docs/xcode-deriveddata-cleanup
Mar 10, 2026
Merged

max-sixty merged 2 commits into
max-sixty:mainfrom
RickeyBoy:docs/xcode-deriveddata-cleanup

Conversation

@RickeyBoy

@RickeyBoy RickeyBoy commented Mar 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

For iOS developers, this PR add a post-remove hook recipe to Tips & Patterns that cleans up Xcode's DerivedData when removing a worktree.

Context

Xcode's DerivedData directory names are hashed from the .xcodeproj path, making them hard to match by name alone. Each DerivedData directory contains an info.plist with a WorkspacePath field that records the original project path. This recipe leverages that to find and remove only the matching cache.

Add a post-remove hook recipe that cleans up Xcode's DerivedData
when removing a worktree, by grepping info.plist for the worktree path.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@RickeyBoy
RickeyBoy marked this pull request as ready for review March 10, 2026 10:51
@max-sixty

Copy link
Copy Markdown
Owner

thank you @RickeyBoy ! this looks like a great example.

@worktrunk-bot I am totally green to this specific area. please can you do a really thorough check / research that this is correct?

@worktrunk-bot

Copy link
Copy Markdown
Collaborator

Did a thorough review of this recipe — the worktrunk hook configuration is correct, and the overall approach is sound. A couple of observations:

What's correct:

  • [post-remove] is the right TOML table, and {{ worktree_path }} is a valid template variable for post-remove hooks (it captures the removed worktree's path before deletion)
  • ~/Library/Developer/Xcode/DerivedData/ is the standard default location
  • Each DerivedData subdirectory does contain an info.plist with a WorkspacePath key recording the original .xcodeproj/.xcworkspace path
  • DerivedData info.plist files are XML (not binary), so grep works
  • Template variables are automatically shell-escaped by worktrunk's formatter, so paths with spaces are handled safely
  • The while read plist + "$plist" quoting is correct

Minor suggestions:

  1. grep -Frl instead of grep -rl — Adding -F (fixed-string) avoids interpreting the path as a regex pattern. A path like /Users/joe/proj++(test) would break without it. Small risk, but easy fix.

  2. The -r flag is redundant — since the glob */info.plist already targets specific files, -r (recursive) does nothing. -Fl alone is cleaner.

So the grep line could be:

grep -Fl {{ worktree_path }} \

Neither of these is a correctness bug — the recipe will work as-is for typical paths. Just minor hardening.

-F avoids interpreting worktree paths as regex patterns, and -r is
redundant since the glob already targets specific files.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@RickeyBoy

Copy link
Copy Markdown
Contributor Author

Good one. I've improved the script 😄

@worktrunk-bot

Copy link
Copy Markdown
Collaborator

Looks great, thanks for the quick update!

@max-sixty
max-sixty merged commit 26333bc into max-sixty:main Mar 10, 2026
23 checks passed
worktrunk-bot added a commit that referenced this pull request Mar 10, 2026
Two issues caused the bot to post prose comments instead of inline
suggestions in #1423:

1. The claude-mention prompt had no guidance about using inline
   suggestions when providing code feedback on PRs. Added explicit
   instructions to use the review-pr skill for inline suggestions.

2. The review-pr skill blocked push offers on human PRs entirely.
   Updated section 7 to allow offering (not auto-pushing) a commit
   for mechanical fixes on human PRs.

Closes #1433

Co-Authored-By: Claude Opus 4.6 <[email protected]>
max-sixty pushed a commit that referenced this pull request Mar 11, 2026
…ers (#1435)

## Summary
- **`claude-mention` prompt**: Added explicit guidance to use the
`review-pr` skill for inline suggestions when providing code feedback on
PRs — both for `@worktrunk-bot` mentions and bot-engaged conversation
comments. This tells the bot to post inline suggestions on exact diff
lines (not prose in a conversation comment) and to offer pushing a
commit for mechanical fixes.
- **`review-pr` skill section 7**: Updated from "bot PRs only" to also
allow **offering** to push a commit on human PRs when fixes are
mechanical and correctness is obvious. The bot still posts inline
suggestions first and only pushes after the author accepts.

Addresses both failures from #1423: the bot will now (a) use inline
`suggestion` blocks instead of conversation comments, and (b) offer to
push the changes.

## Test plan
- [ ] Trigger `claude-mention` on a PR with a review request and verify
inline suggestions are posted
- [ ] Verify the bot offers to push mechanical fixes on human PRs
- [ ] Verify bot PRs still get direct pushes without asking

Closes #1433

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: worktrunk-bot <[email protected]>
Co-authored-by: Claude Opus 4.6 <[email protected]>
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.

3 participants