feat: conductor.json lifecycle hooks + .env propagation across worktrees

bin/dev-setup now copies .env from main worktree so API keys carry
over to Conductor workspaces automatically. conductor.json wires up
setup and archive hooks.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Garry Tan
2026-03-13 22:56:49 -05:00
parent c5f40465a8
commit 7e62f4bd0f
5 changed files with 121 additions and 12 deletions
+21 -3
View File
@@ -4,16 +4,34 @@
# Creates .claude/skills/gstack → (symlink to repo root) so Claude Code
# discovers skills from your working tree. Changes take effect immediately.
#
# Also copies .env from the main worktree if this is a Conductor workspace
# or git worktree (so API keys carry over automatically).
#
# Usage: bin/dev-setup # set up
# bin/dev-teardown # clean up
set -e
REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
# 1. Create .claude/skills/ inside the repo
# 1. Copy .env from main worktree (if we're a worktree and don't have one)
if [ ! -f "$REPO_ROOT/.env" ]; then
MAIN_WORKTREE="$(git -C "$REPO_ROOT" worktree list --porcelain 2>/dev/null | head -1 | sed 's/^worktree //')"
if [ -n "$MAIN_WORKTREE" ] && [ "$MAIN_WORKTREE" != "$REPO_ROOT" ] && [ -f "$MAIN_WORKTREE/.env" ]; then
cp "$MAIN_WORKTREE/.env" "$REPO_ROOT/.env"
echo "Copied .env from main worktree ($MAIN_WORKTREE)"
fi
fi
# 2. Install dependencies
if [ ! -d "$REPO_ROOT/node_modules" ]; then
echo "Installing dependencies..."
(cd "$REPO_ROOT" && bun install)
fi
# 3. Create .claude/skills/ inside the repo
mkdir -p "$REPO_ROOT/.claude/skills"
# 2. Symlink .claude/skills/gstack → repo root
# 4. Symlink .claude/skills/gstack → repo root
# This makes setup think it's inside a real .claude/skills/ directory
GSTACK_LINK="$REPO_ROOT/.claude/skills/gstack"
if [ -L "$GSTACK_LINK" ]; then
@@ -26,7 +44,7 @@ elif [ -d "$GSTACK_LINK" ]; then
fi
ln -s "$REPO_ROOT" "$GSTACK_LINK"
# 3. Run setup via the symlink so it detects .claude/skills/ as its parent
# 5. Run setup via the symlink so it detects .claude/skills/ as its parent
"$GSTACK_LINK/setup"
echo ""