mirror of
https://github.com/actualbudget/actual.git
synced 2026-10-11 22:49:59 +00:00
[AI] Improve post-checkout hook to handle git worktree creation (#7393)
* [AI] Add worktree creation hook to run yarn install Add a WorktreeCreate hook in .claude/settings.json that runs a setup script after creating a new git worktree. The script creates a detached worktree and runs yarn install to ensure dependencies are available. https://claude.ai/code/session_01MjuJLWcxNU6nbWQDrgGpPr * [AI] Move worktree setup hook to husky post-checkout for universal support Instead of a Claude Code-specific hook, detect new worktree creation in the existing husky post-checkout hook by checking for missing node_modules. This works with any tool that creates git worktrees (Claude Code, Cursor, CLI, etc.) since git runs post-checkout after worktree creation. https://claude.ai/code/session_01MjuJLWcxNU6nbWQDrgGpPr * Add release notes for PR #7393 * Update 7393.md * [AI] Fix post-checkout hook to propagate yarn install failures Co-authored-by: Matiss Janis Aboltins <[email protected]> --------- Co-authored-by: Claude <[email protected]> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Cursor Agent <[email protected]> Co-authored-by: Matiss Janis Aboltins <[email protected]>
This commit is contained in:
co-authored by
Matiss Janis Aboltins
Claude
github-actions[bot]
Cursor Agent
parent
477fed1607
commit
799db6c496
@@ -1,11 +1,19 @@
|
||||
#!/bin/sh
|
||||
# Run yarn install when switching branches (if yarn.lock changed)
|
||||
# or when creating a new worktree (node_modules won't exist yet)
|
||||
|
||||
# $3 is 1 for branch checkout, 0 for file checkout
|
||||
if [ "$3" != "1" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Worktree creation: node_modules doesn't exist yet, always install
|
||||
if [ ! -d "node_modules" ]; then
|
||||
echo "New worktree detected — running yarn install..."
|
||||
yarn install || exit 1
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Check if yarn.lock changed between the old and new HEAD
|
||||
if git diff --name-only "$1" "$2" | grep -q "^yarn.lock$"; then
|
||||
echo "yarn.lock changed — running yarn install..."
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
---
|
||||
category: Maintenance
|
||||
authors: [MatissJanis]
|
||||
---
|
||||
|
||||
Improve post-checkout hook to automatically install dependencies for newly created git worktrees.
|
||||
Reference in New Issue
Block a user