blob: 42b7fc9794c0ba5417a8972b26b7f51d51777a40 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
#!/usr/bin/env bash
set -e
if [ -z "$1" ]; then
echo "Usage: $0 <worker-name>"
echo "Example: $0 omni-worker-1"
exit 1
fi
WORKER_NAME="$1"
REPO_ROOT="$(git rev-parse --show-toplevel)"
WORKTREE_PATH="$REPO_ROOT/../$WORKER_NAME"
# We create a new branch for the worker based on 'live'
# This avoids the "branch already checked out" error if 'live' is checked out elsewhere
BRANCH_NAME="${WORKER_NAME}"
echo "Creating worktree '$WORKTREE_PATH' on branch '$BRANCH_NAME' (from live)..."
git worktree add -b "$BRANCH_NAME" "$WORKTREE_PATH" live
# Copy .envrc.local if it exists (user-specific config)
if [ -f "$REPO_ROOT/.envrc.local" ]; then
echo "Copying .envrc.local..."
cp "$REPO_ROOT/.envrc.local" "$WORKTREE_PATH/"
fi
# Configure git identity for the worker
echo "Configuring git identity for worker..."
git -C "$WORKTREE_PATH" config user.name "Omni Worker"
git -C "$WORKTREE_PATH" config user.email "bot@omni.agent"
echo "Worker setup complete at $WORKTREE_PATH"
|