Skip to content
This repository was archived by the owner on Feb 20, 2026. It is now read-only.

Commit 312c366

Browse files
authored
Improve GitHub implementation and state detection (#3)
* Checkpoint * Checkpoint * Checkpoint * Checkpoint * Checkpoint * Checkpoint * Checkpoint * Checkpoint * Pushing to github works * Sync with inotifywait + rsync * Checkpoint * Checkpoint * Gitignore works * Fix running setup commands * Checkpoint * Checkpoint * Checkpoint
1 parent cd93696 commit 312c366

18 files changed

Lines changed: 3759 additions & 1021 deletions

.gitignore

Lines changed: 138 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,141 @@ dist/
66
.DS_Store
77
claude-sandbox.config.json
88
!claude-sandbox.config.example.json
9-
reference-repos/
9+
reference-repos/
10+
scratch/
11+
# Logs
12+
logs
13+
*.log
14+
npm-debug.log*
15+
yarn-debug.log*
16+
yarn-error.log*
17+
lerna-debug.log*
18+
.pnpm-debug.log*
19+
20+
# Diagnostic reports (https://nodejs.org/api/report.html)
21+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
22+
23+
# Runtime data
24+
pids
25+
*.pid
26+
*.seed
27+
*.pid.lock
28+
29+
# Directory for instrumented libs generated by jscoverage/JSCover
30+
lib-cov
31+
32+
# Coverage directory used by tools like istanbul
33+
coverage
34+
*.lcov
35+
36+
# nyc test coverage
37+
.nyc_output
38+
39+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
40+
.grunt
41+
42+
# Bower dependency directory (https://bower.io/)
43+
bower_components
44+
45+
# node-waf configuration
46+
.lock-wscript
47+
48+
# Compiled binary addons (https://nodejs.org/api/addons.html)
49+
build/Release
50+
51+
# Dependency directories
52+
node_modules/
53+
jspm_packages/
54+
55+
# Snowpack dependency directory (https://snowpack.dev/)
56+
web_modules/
57+
58+
# TypeScript cache
59+
*.tsbuildinfo
60+
61+
# Optional npm cache directory
62+
.npm
63+
64+
# Optional eslint cache
65+
.eslintcache
66+
67+
# Optional stylelint cache
68+
.stylelintcache
69+
70+
# Microbundle cache
71+
.rpt2_cache/
72+
.rts2_cache_cjs/
73+
.rts2_cache_es/
74+
.rts2_cache_umd/
75+
76+
# Optional REPL history
77+
.node_repl_history
78+
79+
# Output of 'npm pack'
80+
*.tgz
81+
82+
# Yarn Integrity file
83+
.yarn-integrity
84+
85+
# dotenv environment variable files
86+
.env
87+
.env.development.local
88+
.env.test.local
89+
.env.production.local
90+
.env.local
91+
92+
# parcel-bundler cache (https://parceljs.org/)
93+
.cache
94+
.parcel-cache
95+
96+
# Next.js build output
97+
.next
98+
out
99+
100+
# Nuxt.js build / generate output
101+
.nuxt
102+
dist
103+
104+
# Gatsby files
105+
.cache/
106+
# Comment in the public line in if your project uses Gatsby and not Next.js
107+
# https://nextjs.org/blog/next-9-1#public-directory-support
108+
# public
109+
110+
# vuepress build output
111+
.vuepress/dist
112+
113+
# vuepress v2.x temp and cache directory
114+
.temp
115+
.cache
116+
117+
# vitepress build output
118+
**/.vitepress/dist
119+
120+
# vitepress cache directory
121+
**/.vitepress/cache
122+
123+
# Docusaurus cache and generated files
124+
.docusaurus
125+
126+
# Serverless directories
127+
.serverless/
128+
129+
# FuseBox cache
130+
.fusebox/
131+
132+
# DynamoDB Local files
133+
.dynamodb/
134+
135+
# TernJS port file
136+
.tern-port
137+
138+
# Stores VSCode versions used for testing VSCode extensions
139+
.vscode-test
140+
141+
# yarn v2
142+
.yarn/cache
143+
.yarn/unplugged
144+
.yarn/build-state.yml
145+
.yarn/install-state.gz
146+
.pnp.*

CLAUDE.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,17 @@ The tool looks for `claude-sandbox.config.json` in the working directory. Key op
7878
- `volumes`: Additional volume mounts
7979
- `allowedTools`: Claude tool permissions (default: all)
8080
- `autoPush`/`autoCreatePR`: Git workflow settings
81+
82+
## Development Workflow
83+
84+
Start a new sandbox:
85+
86+
```
87+
claude-sandbox start
88+
```
89+
90+
Kill all running sandbox containers:
91+
92+
```
93+
claude-sandbox purge -y
94+
```

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ claude-sandbox
6363
```
6464

6565
This will:
66+
6667
1. Create a new branch (`claude/[timestamp]`)
6768
2. Start a Docker container with Claude Code
6869
3. Launch a web UI at `http://localhost:3456`
@@ -71,13 +72,17 @@ This will:
7172
### Commands
7273

7374
#### `claude-sandbox` (default)
75+
7476
Start a new container with web UI (recommended):
77+
7578
```bash
7679
claude-sandbox
7780
```
7881

7982
#### `claude-sandbox start`
83+
8084
Explicitly start a new container with options:
85+
8186
```bash
8287
claude-sandbox start [options]
8388

@@ -90,7 +95,9 @@ Options:
9095
```
9196

9297
#### `claude-sandbox attach [container-id]`
98+
9399
Attach to an existing container:
100+
94101
```bash
95102
# Interactive selection
96103
claude-sandbox attach
@@ -103,7 +110,9 @@ Options:
103110
```
104111

105112
#### `claude-sandbox list`
113+
106114
List all Claude Sandbox containers:
115+
107116
```bash
108117
claude-sandbox list
109118
claude-sandbox ls # alias
@@ -113,7 +122,9 @@ Options:
113122
```
114123

115124
#### `claude-sandbox stop [container-id]`
125+
116126
Stop containers:
127+
117128
```bash
118129
# Interactive selection
119130
claude-sandbox stop
@@ -126,7 +137,9 @@ claude-sandbox stop --all
126137
```
127138

128139
#### `claude-sandbox logs [container-id]`
140+
129141
View container logs:
142+
130143
```bash
131144
claude-sandbox logs
132145
claude-sandbox logs abc123def456
@@ -137,14 +150,18 @@ Options:
137150
```
138151

139152
#### `claude-sandbox clean`
153+
140154
Remove stopped containers:
155+
141156
```bash
142157
claude-sandbox clean
143158
claude-sandbox clean --force # Remove all containers
144159
```
145160

146161
#### `claude-sandbox config`
162+
147163
Show current configuration:
164+
148165
```bash
149166
claude-sandbox config
150167
```
@@ -232,6 +249,7 @@ claude-sandbox --web
232249
```
233250

234251
This will:
252+
235253
- Start the container in detached mode
236254
- Launch a web server on `http://localhost:3456`
237255
- Open your browser automatically

TODO.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22
- [x] There is too much orchestration overhead to manage locally, so we need a UI to control, view, and do stuff outside of the container. The best thing is probably to create a web UI to be run locally, and the user will be redirected to this UI when they start a web app locally.
33
- [x] Flag for including vs not including non-tracked files
44
- [x] Specify with a flag which branch to switch to on container start
5-
- [ ] Create listener for Claude turn end, to commit, push and create a PR
6-
- [ ] GH token should not be copied into the container, huge security risk
7-
- [ ] Being able to specify which setup commands to run before and after the copying of Git files.
5+
- [x] Create listener for Claude turn end, to commit, push and create a PR
6+
- [x] GH token should not be copied into the container, huge security risk
7+
- [ ] Being able to specify which setup commands to run before and after the copying of Git files.
8+
- [ ] Being able to specify a PR to checkout the sandbox from
9+
- [ ] Reattaching to a running or stopped sandbox consistently, without losing work
10+
- [ ] More consistent pushing of changes to GitHub
11+
- [ ] How should we deal with it if the local shadow repo falls behind the remote branch? Options:
12+
- a. Let user merge changes from remote to local: We would need to implement a conflict resolver somehow.
13+
- b. If conflicts arise, we could just block the operation and let user dump the current state in order not to lose work. This is the simplest option.
14+
- Either way, we need to think about how to apply new commits from the remote, because changes currently only flow from the sandbox to the shadow repo.

0 commit comments

Comments
 (0)