Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"test:e2e:debug": "playwright test --debug",
"promo": "pnpm -s script src/scripts/encrypt-promo-codes.ts",
"dev:discord-gateway-cron": "tsx dev/discord-gateway-cron.ts",
"worktree:prepare": "bash scripts/worktree-prepare.sh"
"dev:start": "tsx --tsconfig tsconfig.scripts.json dev/local/cli.ts up",
"dev:stop": "tsx --tsconfig tsconfig.scripts.json dev/local/cli.ts stop",
"dev:env": "tsx --tsconfig tsconfig.scripts.json dev/local/cli.ts env"
Expand Down
31 changes: 31 additions & 0 deletions scripts/worktree-prepare.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env bash
set -euo pipefail
# Prepares a git worktree by installing dependencies, linking the Vercel
# project, and copying .env.development.local from the main worktree.

MAIN_WORKTREE="$(git worktree list --porcelain | head -1 | sed 's/^worktree //')"
ENV_FILE=".env.development.local"

if command -v nvm &>/dev/null || [ -s "${NVM_DIR:-$HOME/.nvm}/nvm.sh" ]; then
echo "==> Switching to correct Node version…"
# nvm is a shell function, not a binary — source it if needed
if ! command -v nvm &>/dev/null; then
source "${NVM_DIR:-$HOME/.nvm}/nvm.sh"
fi
nvm use
fi

echo "==> Installing dependencies…"
pnpm install

echo "==> Linking Vercel project…"
vercel link --yes --project kilocode-app --scope kilocode

if [ "$(cd "$MAIN_WORKTREE" && pwd -P)" = "$(pwd -P)" ]; then
echo "==> Skipping $ENV_FILE copy (already in primary worktree)"
elif [ -f "$MAIN_WORKTREE/$ENV_FILE" ]; then
echo "==> Copying $ENV_FILE from main worktree…"
cp "$MAIN_WORKTREE/$ENV_FILE" "./$ENV_FILE"
Comment thread
jeanduplessis marked this conversation as resolved.
fi

echo "==> Worktree ready."
Loading