Add Claude session initialization with npm dependency setup#2
Closed
MahammadNuriyev62 wants to merge 1 commit intomasterfrom
Closed
Add Claude session initialization with npm dependency setup#2MahammadNuriyev62 wants to merge 1 commit intomasterfrom
MahammadNuriyev62 wants to merge 1 commit intomasterfrom
Conversation
Set up .claude/hooks/session-start.sh to install npm dependencies when running in Claude Code on the web. Register the hook in .claude/settings.json and update .gitignore to track the .claude config files. https://claude.ai/code/session_01JgNTrM3pwNC2NDT97TBJj5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds automatic dependency installation for Claude remote sessions by introducing a session start hook that runs
npm installwhen Claude connects in web environments.Changes
.claude/hooks/session-start.sh: A bash script that automatically installs npm dependencies when a remote Claude session starts. The script only executes in remote (web) environments to avoid unnecessary runs in local development..claude/settings.json: Configuration file that registers the session start hook to run during Claude session initialization..gitignore: Modified to allow.claude/settings.jsonand.claude/hooks/to be committed to the repository while keeping other.claude/contents ignored.Implementation Details
CLAUDE_CODE_REMOTEenvironment variable to ensure it only runs in remote environmentsset -euo pipefailfor robust error handling in the bash scriptCLAUDE_PROJECT_DIRenvironment variable for proper project directory resolution.claude/files while excluding othersThis ensures that Claude sessions in web environments have all necessary dependencies installed automatically without manual intervention.
https://claude.ai/code/session_01JgNTrM3pwNC2NDT97TBJj5