surshar / claude-code
Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.
Built by Anthropic · github.com/anthropics
| 1 | #!/bin/bash |
| 2 | # Example SessionStart hook with "teleport" matcher for setting up environment |
| 3 | # after teleporting from web to CLI. This script pulls changes, installs |
| 4 | # dependencies, and starts the dev server. |
| 5 | |
| 6 | set -euo pipefail |
| 7 | |
| 8 | # Navigate to project directory |
| 9 | cd "$CLAUDE_PROJECT_DIR" || exit 0 |
| 10 | |
| 11 | echo "Setting up environment after teleport..." |
| 12 | |
| 13 | # Pull latest changes if in a git repository |
| 14 | if [ -d ".git" ]; then |
| 15 | current_branch=$(git branch --show-current) |
| 16 | echo "🔄 Pulling latest changes for branch: $current_branch" |
| 17 | git pull origin "$current_branch" 2>/dev/null || echo "Could not pull (may be offline or no upstream)" |
| 18 | fi |
| 19 | |
| 20 | # Install dependencies based on project type |
| 21 | if [ -f "package.json" ]; then |
| 22 | echo "📦 Installing Node.js dependencies..." |
| 23 | npm install --silent 2>/dev/null || npm install |
| 24 | fi |
| 25 | |
| 26 | if [ -f "requirements.txt" ]; then |
| 27 | echo "🐍 Installing Python dependencies..." |
| 28 | pip install -r requirements.txt --quiet 2>/dev/null || pip install -r requirements.txt |
| 29 | fi |
| 30 | |
| 31 | if [ -f "Cargo.toml" ]; then |
| 32 | echo "🦀 Building Rust project..." |
| 33 | cargo build 2>/dev/null || true |
| 34 | fi |
| 35 | |
| 36 | # Start development server if available |
| 37 | if [ -f "package.json" ]; then |
| 38 | # Check for common dev server scripts |
| 39 | if grep -q '"dev:staging"' package.json; then |
| 40 | echo "🚀 Starting staging dev server..." |
| 41 | npm run dev:staging & |
| 42 | elif grep -q '"dev"' package.json; then |
| 43 | echo "🚀 Starting dev server..." |
| 44 | npm run dev & |
| 45 | elif grep -q '"start"' package.json; then |
| 46 | echo "🚀 Starting server..." |
| 47 | npm start & |
| 48 | fi |
| 49 | fi |
| 50 | |
| 51 | echo "✅ Teleport complete! Environment ready." |
| 52 | exit 0 |