From 6db90d1e42e5fcfae25301f91b309509fcfd0f26 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 25 Jun 2026 20:29:23 +0000 Subject: [PATCH] Add SessionStart hook to install deps in web sessions A fresh Claude Code on the web session starts with no node_modules, so yarn typecheck, yarn test and yarn build all fail (tsc/vite not found) until dependencies are installed. Add a synchronous SessionStart hook that runs `yarn install` and fetches the Chromium build the pinned @playwright/test version expects, so typecheck and the Playwright suite work out of the box in remote sessions. Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_016apmoXLgCfaB4NEFJZ64QM --- .claude/hooks/session-start.sh | 24 ++++++++++++++++++++++++ .claude/settings.json | 14 ++++++++++++++ 2 files changed, 38 insertions(+) create mode 100755 .claude/hooks/session-start.sh create mode 100644 .claude/settings.json diff --git a/.claude/hooks/session-start.sh b/.claude/hooks/session-start.sh new file mode 100755 index 0000000..f9105ab --- /dev/null +++ b/.claude/hooks/session-start.sh @@ -0,0 +1,24 @@ +#!/bin/bash +# +# SessionStart hook for Claude Code on the web. +# +# A fresh remote session starts with no node_modules, so yarn typecheck, +# yarn test and yarn build all fail (e.g. "tsc: not found", "vite: not found") +# until dependencies are installed. This hook installs them, and fetches the +# Playwright browser build that the pinned @playwright/test version expects so +# the test suite can run. +# +# Runs synchronously so dependencies are guaranteed ready before the agent +# starts. Idempotent and non-interactive. +set -euo pipefail + +cd "$CLAUDE_PROJECT_DIR" + +# Install JS dependencies (uses yarn's cache; safe to re-run). +yarn install + +# Install the Chromium build that the pinned Playwright version needs so +# `yarn test` works. Skipped automatically if already present. +yarn playwright install chromium + +echo "session-start hook complete: dependencies and Playwright browser ready" diff --git a/.claude/settings.json b/.claude/settings.json new file mode 100644 index 0000000..e06b033 --- /dev/null +++ b/.claude/settings.json @@ -0,0 +1,14 @@ +{ + "hooks": { + "SessionStart": [ + { + "hooks": [ + { + "type": "command", + "command": "$CLAUDE_PROJECT_DIR/.claude/hooks/session-start.sh" + } + ] + } + ] + } +}