sandboxbox 1.2.2 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,150 +1,231 @@
1
1
  # SandboxBox
2
2
 
3
- **Zero-privilege container runner with Playwright support**
3
+ **Cross-platform container runner with Claude Code and Playwright support**
4
4
 
5
- Run containers without Docker, root privileges, or external dependencies. Just bubblewrap and Node.js.
5
+ Run your projects in isolated containers using Podman. Works on **Windows, macOS, and Linux**.
6
6
 
7
- ## 🚀 Quick Start
7
+ ## Installation
8
+
9
+ No installation required! Use with `npx`:
8
10
 
9
- ### One-Time Setup
10
11
  ```bash
11
- # Install bubblewrap (requires sudo ONCE)
12
- sudo apt-get install bubblewrap # Ubuntu/Debian
13
- sudo apk add bubblewrap # Alpine
12
+ npx sandboxbox build
13
+ npx sandboxbox run ./my-project
14
+ ```
15
+
16
+ ## Quick Start
14
17
 
15
- # Setup Alpine environment
16
- npx sandboxbox setup
18
+ ### 1. Install Podman (One-time)
19
+
20
+ **Windows:**
21
+ ```powershell
22
+ winget install RedHat.Podman
17
23
  ```
18
24
 
19
- ### Run Playwright Tests
25
+ **macOS:**
20
26
  ```bash
21
- # Test any project
22
- npx sandboxbox run ./my-project
27
+ brew install podman
28
+ podman machine init
29
+ podman machine start
30
+ ```
23
31
 
24
- # Quick test with sample Dockerfile
25
- npx sandboxbox quick-test ./my-app
32
+ **Linux:**
33
+ ```bash
34
+ sudo apt-get install podman # Ubuntu/Debian
35
+ sudo dnf install podman # Fedora
36
+ sudo apk add podman # Alpine
37
+ ```
26
38
 
27
- # Interactive shell
28
- npx sandboxbox shell ./my-project
39
+ ### 2. Build Container
40
+
41
+ ```bash
42
+ npx sandboxbox build
29
43
  ```
30
44
 
31
- ### Build from Dockerfile
45
+ This builds a container with:
46
+ - Node.js v22
47
+ - Claude Code CLI
48
+ - Playwright with all browser dependencies
49
+ - Git, npm, and essential build tools
50
+
51
+ ### 3. Run Your Project
52
+
32
53
  ```bash
33
- # Build container
34
- npx sandboxbox build ./Dockerfile
54
+ # Run with default shell
55
+ npx sandboxbox run ./my-project
35
56
 
36
- # Run the built container
37
- npx sandboxbox run ./project-directory
38
- ```
57
+ # Run custom command
58
+ npx sandboxbox run ./my-project "npm test"
59
+
60
+ # Run Claude Code
61
+ npx sandboxbox run ./my-project "claude --help"
39
62
 
40
- ## 📋 Commands
63
+ # Run Playwright tests
64
+ npx sandboxbox run ./my-project "npx playwright test"
65
+ ```
41
66
 
42
- | Command | Description |
43
- |---------|-------------|
44
- | `setup` | Set up Alpine Linux environment (one-time) |
45
- | `build <dockerfile>` | Build container from Dockerfile |
46
- | `run <project>` | Run Playwright tests in isolation |
47
- | `shell <project>` | Interactive shell in container |
48
- | `quick-test <project>` | Quick test with sample Dockerfile |
49
- | `version` | Show version information |
67
+ ### 4. Interactive Shell
50
68
 
51
- ## ⚡ Performance
69
+ ```bash
70
+ npx sandboxbox shell ./my-project
71
+ ```
52
72
 
53
- - **8ms startup** (37x faster than Docker)
54
- - **1MB memory overhead** (50x less than Docker)
55
- - **True isolation** with Linux namespaces
56
- - **Zero privileges** after bubblewrap installation
73
+ ## Features
57
74
 
58
- ## 🎯 What Works
75
+ ### 🌍 Cross-Platform
76
+ - **Windows** - Full support with Podman Desktop
77
+ - **macOS** - Works with Podman machine
78
+ - **Linux** - Native Podman support
59
79
 
60
- **Chromium testing** - Full Playwright support
61
- ✅ **Node.js projects** - Complete npm ecosystem
62
- **Filesystem isolation** - Separate container environment
63
- **Network access** - Full connectivity
64
- ✅ **Process isolation** - Separate PID namespace
80
+ ### 🔒 Isolation
81
+ - Complete container isolation
82
+ - Your host system stays clean
83
+ - Workspace mounted at `/workspace`
65
84
 
66
- ## ⚠️ Limitations
85
+ ### 🚀 Pre-installed Tools
86
+ - **Node.js v22**
87
+ - **Claude Code CLI** - AI-powered development
88
+ - **Playwright** - Browser automation with all dependencies
89
+ - **Git** - Version control
90
+ - **npm** - Package management
67
91
 
68
- **Firefox/WebKit** - Need glibc (use Ubuntu for these)
69
- **GPU acceleration** - Limited support
70
- ❌ **System packages** - Can't install with apt/yum
92
+ ### 📦 NPX-First Design
93
+ - No global installation needed
94
+ - Single command execution
95
+ - Works with any project directory
71
96
 
72
- ## 🔧 Alternative Usage
97
+ ## Commands
73
98
 
74
- ### Local Script
75
99
  ```bash
76
- # Using the wrapper script
77
- ./run.sh run ./my-project
100
+ # Build container from Dockerfile
101
+ npx sandboxbox build
102
+ npx sandboxbox build ./Dockerfile.custom
103
+
104
+ # Run project in container
105
+ npx sandboxbox run <project-dir> [command]
78
106
 
79
- # Direct Node.js execution
80
- node cli.js run ./my-project
107
+ # Interactive shell
108
+ npx sandboxbox shell <project-dir>
109
+
110
+ # Show version
111
+ npx sandboxbox version
81
112
  ```
82
113
 
83
- ### As npm dependency
84
- ```bash
85
- # Install in your project
86
- npm install sandboxbox
114
+ ## How It Works
87
115
 
88
- # Use in package.json scripts
89
- {
90
- "scripts": {
91
- "test:isolated": "sandboxbox run .",
92
- "test:container": "sandboxbox quick-test ."
93
- }
94
- }
116
+ 1. **Builds** a container image from the Dockerfile using Podman
117
+ 2. **Mounts** your project directory to `/workspace` in the container
118
+ 3. **Runs** your command in the isolated container environment
119
+ 4. **Removes** the container automatically when done
120
+
121
+ ```
122
+ Your Project Container
123
+ ./my-project ━━━━━> /workspace
124
+ (host) (isolated)
95
125
  ```
96
126
 
97
- ## 📖 Examples
127
+ ## Use Cases
128
+
129
+ ### Run Claude Code
130
+ ```bash
131
+ npx sandboxbox run ./my-app "claude --version"
132
+ npx sandboxbox run ./my-app "claude code review lib/"
133
+ ```
134
+
135
+ ### Run Playwright Tests
136
+ ```bash
137
+ npx sandboxbox run ./my-app "npx playwright test"
138
+ npx sandboxbox run ./my-app "npx playwright test --headed"
139
+ ```
98
140
 
99
- ### Basic Playwright Testing
141
+ ### Development Workflow
100
142
  ```bash
101
- # Create a simple project
102
- mkdir my-test && cd my-test
103
- npm init -y
104
- npm install playwright
143
+ # Build once
144
+ npx sandboxbox build
105
145
 
106
- # Create a test
107
- cat > test.spec.js << 'EOF'
108
- import { test, expect } from '@playwright/test';
146
+ # Interactive development
147
+ npx sandboxbox shell ./my-app
109
148
 
110
- test('basic test', async ({ page }) => {
111
- await page.goto('https://example.com');
112
- await expect(page).toHaveTitle(/Example/);
113
- });
114
- EOF
149
+ # Inside container:
150
+ npm install
151
+ npm test
152
+ git commit -am "Update"
153
+ exit
154
+ ```
115
155
 
116
- # Run in isolated container
117
- npx sandboxbox quick-test .
156
+ ### Run npm Scripts
157
+ ```bash
158
+ npx sandboxbox run ./my-app "npm run build"
159
+ npx sandboxbox run ./my-app "npm run lint"
160
+ npx sandboxbox run ./my-app "npm run test:e2e"
118
161
  ```
119
162
 
120
- ### Custom Dockerfile
163
+ ## Custom Dockerfile
164
+
165
+ Create your own `Dockerfile`:
166
+
121
167
  ```dockerfile
122
- # Dockerfile.custom
123
- FROM alpine
168
+ FROM node:22-alpine
169
+
170
+ # Install system dependencies
171
+ RUN apk add --no-cache git bash curl
124
172
 
125
- RUN apk add --no-cache nodejs npm curl
126
- WORKDIR /app
127
- COPY package*.json ./
128
- RUN npm install
129
- COPY . .
173
+ # Install global packages
174
+ RUN npm install -g @anthropic-ai/claude-code @playwright/test
130
175
 
131
- CMD ["npm", "start"]
176
+ # Install Playwright browsers
177
+ RUN npx playwright install --with-deps chromium
178
+
179
+ WORKDIR /workspace
180
+
181
+ CMD ["/bin/bash"]
132
182
  ```
133
183
 
184
+ Then build:
134
185
  ```bash
135
- # Build and run
136
- npx sandboxbox build Dockerfile.custom
137
- npx sandboxbox run .
186
+ npx sandboxbox build ./Dockerfile
187
+ ```
188
+
189
+ ## Requirements
190
+
191
+ - **Podman** (https://podman.io/getting-started/installation)
192
+ - **Node.js 16+** (for running npx)
193
+
194
+ ## Project Structure
195
+
196
+ ```
197
+ sandboxbox/
198
+ ├── cli.js # Main CLI - Podman integration
199
+ ├── Dockerfile # Container definition
200
+ ├── package.json # NPM package config
201
+ └── README.md # This file
138
202
  ```
139
203
 
140
- ## 🏗️ Architecture
204
+ ## Why Podman?
205
+
206
+ - ✅ **Cross-platform** - Works on Windows, macOS, Linux
207
+ - ✅ **Rootless** - No daemon, runs as regular user
208
+ - ✅ **Docker-compatible** - Uses OCI standard containers
209
+ - ✅ **Secure** - Better security model than Docker
210
+ - ✅ **Fast** - Lightweight and efficient
211
+
212
+ ## Differences from v1.x
213
+
214
+ **v1.x (bubblewrap):**
215
+ - Linux-only
216
+ - Required bubblewrap installation
217
+ - Direct process isolation
218
+
219
+ **v2.x (Podman):**
220
+ - Cross-platform (Windows/macOS/Linux)
221
+ - Uses Podman containers
222
+ - OCI-standard container images
223
+ - More portable and widely supported
224
+
225
+ ## License
141
226
 
142
- SandboxBox uses:
143
- - **Bubblewrap (bwrap)** - Linux namespace isolation
144
- - **Alpine Linux** - Lightweight base filesystem
145
- - **System Chromium** - Avoids glibc compatibility issues
146
- - **Xvfb** - Virtual display for headless testing
227
+ MIT
147
228
 
148
- ## 📄 License
229
+ ## Contributing
149
230
 
150
- MIT
231
+ Contributions welcome! This project focuses on cross-platform container execution with Claude Code and Playwright support using Podman.