Vscode / README.md
Hemifield's picture
Upload 3 files
373bb4f verified
|
Raw
History Blame Contribute Delete
1.89 kB
metadata
title: VS Code + Claude Code + Codex
emoji: 💻
colorFrom: blue
colorTo: purple
sdk: docker
app_port: 7860

VS Code (code-server) with Claude Code & OpenAI Codex

Browser-based VS Code, with the claude and codex CLIs preinstalled, and persistent storage via a Hugging Face Storage Bucket mounted at /data.

1. Set a password secret

In Space settings → Variables and secrets, add a secret:

  • PASSWORD = a password of your choice

(If you skip this, code-server generates a random password each restart and prints it to the Space's container logs — check there if you didn't set one.)

2. Create and attach a storage bucket (free persistent storage)

# create the bucket (one-time)
hf buckets create my-vscode-data

# attach it to this Space, mounted at /data
hf spaces volumes set <your-username>/<this-space> -v hf://buckets/<your-username>/my-vscode-data:/data

You can also do this from the Space's Settings → Storage Buckets UI, mount path /data. Note that /data is only available at runtime, not during the Docker build — the entrypoint.sh script detects it on container start and, if present, points $HOME at /data/home (seeding it from the image's default home on first run). Everything under your home directory persists: your workspace, VS Code settings/extensions, claude/codex logins, shell config, the works. Without an attached bucket, everything still works, just ephemerally (lost on restart).

3. Log in to Claude Code and Codex

Open a terminal inside VS Code (Ctrl+` ) and run:

claude    # follow the login prompt (or set ANTHROPIC_API_KEY as a Space secret)
codex     # follow the login prompt (or set OPENAI_API_KEY as a Space secret)

With a bucket attached, you only need to log in once — credentials persist across restarts.