Files
clean-architecture-frontend…/tasks/lanes/setup-lane.sh
T
DongHyeonkaandClaude Opus 5.5 54ba358892 docs: hand off the maturity review fixes to another machine
tasks/handoff.md records merged and pending lanes, the remaining tasks
and follow-ups, and the integration procedure. tasks/lanes/ carries the
lane brief and a machine-independent worktree setup script. todo.md
marks the tasks already merged into this branch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-26 01:11:04 +09:00

43 lines
1.7 KiB
Bash
Executable File

#!/usr/bin/env bash
# Usage: tasks/lanes/setup-lane.sh <LANE> [base-ref]
# LANE lane letter (B, D, ...) -> worktree $LANES_DIR/<LANE>/wt on branch lane/<LANE>
# INT* names make a detached worktree for integration checks
# base-ref defaults to fix/maturity-review-2026-09-25; an existing lane/<LANE>
# branch is checked out as is instead of created
# LANES_DIR defaults to <repo>/../<repo-name>-lanes.
# node_modules is a real directory of per-entry symlinks into the repo's own
# node_modules; pnpm's state files are copied and retargeted so `corepack pnpm`
# in the worktree does not start an install through the shared packages.
set -euo pipefail
LANE="$1"
BASE="${2:-fix/maturity-review-2026-09-25}"
R="$(git -C "$(dirname "$0")" rev-parse --show-toplevel)"
LANES_DIR="${LANES_DIR:-$(dirname "$R")/$(basename "$R")-lanes}"
W="$LANES_DIR/$LANE/wt"
mkdir -p "$(dirname "$W")"
if [[ "$LANE" == INT* ]]; then
git -C "$R" worktree add --detach "$W" "$BASE"
elif git -C "$R" show-ref --verify --quiet "refs/heads/lane/$LANE"; then
git -C "$R" worktree add "$W" "lane/$LANE"
else
git -C "$R" worktree add -b "lane/$LANE" "$W" "$BASE"
fi
mkdir "$W/node_modules"
for e in $(ls -A "$R/node_modules"); do
case "$e" in
.pnpm-workspace-state-v1.json|.modules.yaml|.package-map.json) cp "$R/node_modules/$e" "$W/node_modules/$e" ;;
.vite) ;;
*) ln -s "$R/node_modules/$e" "$W/node_modules/$e" ;;
esac
done
node -e '
const fs = require("fs");
const f = process.argv[1] + "/node_modules/.pnpm-workspace-state-v1.json";
const s = JSON.parse(fs.readFileSync(f, "utf8"));
const v = Object.values(s.projects)[0];
s.projects = { [process.argv[1]]: v };
s.lastValidatedTimestamp = Date.now();
fs.writeFileSync(f, JSON.stringify(s, null, 2));
' "$W"
echo "$W"