From 8bbf6c75e399d39551ae4c633be7344320dd7b54 Mon Sep 17 00:00:00 2001 From: Sojan Jose Date: Thu, 29 May 2025 21:18:02 -0600 Subject: [PATCH] chore: Improvements to codespaces (#11635) - Remove the deprecated extensions - Install claude code in base image - Fix rails deprecation warning --- .devcontainer/Dockerfile.base | 4 ++-- .devcontainer/devcontainer.json | 17 +++++++++++++---- .devcontainer/scripts/setup.sh | 8 ++++++++ Makefile | 1 + config/environments/development.rb | 2 +- 5 files changed, 25 insertions(+), 7 deletions(-) diff --git a/.devcontainer/Dockerfile.base b/.devcontainer/Dockerfile.base index 2b74602b8..dc7d4eb8c 100644 --- a/.devcontainer/Dockerfile.base +++ b/.devcontainer/Dockerfile.base @@ -77,8 +77,8 @@ RUN curl -L https://github.com/DarthSim/overmind/releases/download/v2.1.0/overmi WORKDIR /workspace RUN chown vscode:vscode /workspace -# set up node js and pnpm in single layer -RUN npm install -g pnpm@${PNPM_VERSION} \ +# set up node js, pnpm and claude code in single layer +RUN npm install -g pnpm@${PNPM_VERSION} @anthropic-ai/claude-code \ && npm cache clean --force # Switch to vscode user diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index c51338b51..2e237bbcb 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -4,17 +4,26 @@ "dockerComposeFile": "docker-compose.yml", "settings": { - "terminal.integrated.shell.linux": "/bin/zsh" + "terminal.integrated.shell.linux": "/bin/zsh", + "extensions.showRecommendationsOnlyOnDemand": true, + "editor.formatOnSave": true, + "files.trimTrailingWhitespace": true, + "files.insertFinalNewline": true, + "search.exclude": { + "**/node_modules": true, + "**/tmp": true, + "**/log": true, + "**/coverage": true, + "**/public/packs": true + } }, // Add the IDs of extensions you want installed when the container is created. "extensions": [ - "rebornix.Ruby", + "Shopify.ruby-lsp", "misogi.ruby-rubocop", - "wingrunr21.vscode-ruby", "davidpallinder.rails-test-runner", - "eamodio.gitlens", "github.copilot", "mrmlnc.vscode-duplicate" ], diff --git a/.devcontainer/scripts/setup.sh b/.devcontainer/scripts/setup.sh index 6beb2ff57..36db5cfd9 100755 --- a/.devcontainer/scripts/setup.sh +++ b/.devcontainer/scripts/setup.sh @@ -4,5 +4,13 @@ sed -i -e '/POSTGRES_HOST/ s/=.*/=localhost/' .env sed -i -e '/SMTP_ADDRESS/ s/=.*/=localhost/' .env sed -i -e "/FRONTEND_URL/ s/=.*/=https:\/\/$CODESPACE_NAME-3000.app.github.dev/" .env +# Setup Claude Code API key if available +if [ -n "$CLAUDE_CODE_API_KEY" ]; then + mkdir -p ~/.claude + echo '{"apiKeyHelper": "~/.claude/anthropic_key.sh"}' > ~/.claude/settings.json + echo "echo \"$CLAUDE_CODE_API_KEY\"" > ~/.claude/anthropic_key.sh + chmod +x ~/.claude/anthropic_key.sh +fi + # codespaces make the ports public gh codespace ports visibility 3000:public 3036:public 8025:public -c $CODESPACE_NAME diff --git a/Makefile b/Makefile index 1c5ce297c..b7a936dc4 100644 --- a/Makefile +++ b/Makefile @@ -41,6 +41,7 @@ run: force_run: rm -f ./.overmind.sock + rm -f tmp/pids/*.pid overmind start -f Procfile.dev debug: diff --git a/config/environments/development.rb b/config/environments/development.rb index 7f72e6d2f..822a67939 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -66,7 +66,7 @@ Rails.application.configure do # GitHub Codespaces configuration if ENV['CODESPACES'] # Allow web console access from any IP - config.web_console.whitelisted_ips = %w(0.0.0.0/0 ::/0) + config.web_console.allowed_ips = %w(0.0.0.0/0 ::/0) # Allow CSRF from codespace URLs config.force_ssl = false config.action_controller.forgery_protection_origin_check = false