fix: worktrunk setup

This commit is contained in:
Felarof
2025-12-31 12:51:25 -08:00
parent 90068f915f
commit 27124baccb
4 changed files with 7 additions and 26 deletions

View File

@@ -28,4 +28,6 @@ wt config shell install
## Hooks
- **on_create**: Runs `setup-worktree.sh` which installs dependencies and copies env files
Hooks are configured in `.config/wt.toml`:
- **post-create**: Runs `bun install` and copies env files from the main worktree

4
.config/wt.toml Normal file
View File

@@ -0,0 +1,4 @@
[post-create]
install = "bun install"
env-server = "cp {{ repo_root }}/apps/server/.env.development apps/server/.env.development"
env-agent = "cp {{ repo_root }}/apps/agent/.env.development apps/agent/.env.development"

View File

@@ -1,2 +0,0 @@
[hooks]
on_create = [".worktrunk/setup-worktree.sh"]

View File

@@ -1,23 +0,0 @@
#!/bin/bash
set -e
echo "Setting up worktree..."
# Install dependencies
bun install
# Get the main worktree (trunk) path
TRUNK=$(git worktree list | head -1 | awk '{print $1}')
# Copy env files from trunk if they exist
if [ -f "$TRUNK/apps/server/.env.development" ]; then
cp "$TRUNK/apps/server/.env.development" apps/server/.env.development
echo "✓ Copied apps/server/.env.development"
fi
if [ -f "$TRUNK/apps/agent/.env.development" ]; then
cp "$TRUNK/apps/agent/.env.development" apps/agent/.env.development
echo "✓ Copied apps/agent/.env.development"
fi
echo "Worktree setup complete!"