sandboxbox 2.0.9 β†’ 2.1.0

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/CLAUDE.md CHANGED
@@ -149,7 +149,7 @@ exec claude # Changes save directly to local repo
149
149
  ### Shared Isolation Utility (utils/isolation.js)
150
150
  ```javascript
151
151
  // All commands use the same isolation pattern
152
- import { createIsolatedEnvironment, setupCleanupHandlers } from './utils/isolation.js';
152
+ import { createIsolatedEnvironment, setupCleanupHandlers, buildContainerMounts } from './utils/isolation.js';
153
153
 
154
154
  // Create isolated environment
155
155
  const { tempProjectDir, cleanup } = createIsolatedEnvironment(projectDir);
@@ -157,8 +157,11 @@ const { tempProjectDir, cleanup } = createIsolatedEnvironment(projectDir);
157
157
  // Set up cleanup handlers
158
158
  setupCleanupHandlers(cleanup);
159
159
 
160
- // Run command with isolated directory
161
- execSync(`podman run --rm -it -v "${tempProjectDir}:/workspace:rw" -w /workspace sandboxbox:latest ${cmd}`, {
160
+ // Build container mounts with git identity
161
+ const mounts = buildContainerMounts(tempProjectDir);
162
+
163
+ // Run command with isolated directory and git identity
164
+ execSync(`podman run --rm -it ${mounts.join(' ')} -w /workspace sandboxbox:latest ${cmd}`, {
162
165
  stdio: 'inherit',
163
166
  shell: process.platform === 'win32'
164
167
  });
@@ -167,6 +170,26 @@ execSync(`podman run --rm -it -v "${tempProjectDir}:/workspace:rw" -w /workspace
167
170
  cleanup();
168
171
  ```
169
172
 
173
+ ### Git Identity Transfer
174
+ All commands automatically mount git identity:
175
+ ```bash
176
+ -v "$HOME/.gitconfig:/root/.gitconfig:ro" # Git configuration
177
+ -v "$HOME/.ssh:/root/.ssh:ro" # SSH keys for git operations
178
+ ```
179
+
180
+ ### Claude Code MCP Integration
181
+ The claude command includes MCP servers and settings:
182
+ ```bash
183
+ # MCP servers pre-installed in container
184
+ RUN claude mcp add glootie -- npx -y mcp-glootie@latest
185
+ RUN claude mcp add vexify -- npx -y mcp-vexify@latest
186
+ RUN claude mcp add playwright -- npx @playwright/mcp@latest
187
+
188
+ # Settings injection
189
+ -v "./claude-settings.json:/root/.claude/settings.json:ro"
190
+ -v "$HOME/.claude:/root/.claude-host:ro"
191
+ ```
192
+
170
193
  ### Container Naming and Cleanup
171
194
  - Use random short names: `sandboxbox-run-${Math.random().toString(36).substr(2, 9)}`
172
195
  - Force cleanup: `podman rm -f container-name`
@@ -0,0 +1,21 @@
1
+ FROM node:20
2
+
3
+ # Install development tools
4
+ RUN apt-get update && apt-get install -y --no-install-recommends \
5
+ git curl bash sudo nano vim \
6
+ && apt-get clean && rm -rf /var/lib/apt/lists/*
7
+
8
+ WORKDIR /workspace
9
+
10
+ # Install Claude Code
11
+ RUN npm install -g @anthropic-ai/claude-code@latest
12
+
13
+ # Setup MCP servers after Claude installation
14
+ RUN claude mcp add glootie -- npx -y mcp-glootie@latest && \
15
+ claude mcp add vexify -- npx -y mcp-vexify@latest && \
16
+ claude mcp add playwright -- npx @playwright/mcp@latest
17
+
18
+ # Create isolated workspace script with cleanup
19
+ RUN echo '#!/bin/bash\nset -e\n\necho "πŸš€ Starting SandboxBox with Claude Code in isolated environment..."\necho "πŸ“ Working directory: /workspace"\necho "🎯 This is an isolated copy of your repository"\n\n# Cleanup function for temporary files\ncleanup_temp_files() {\n echo "🧹 Cleaning up temporary files..."\n find /tmp -user root -name "claude-*" -type f -delete 2>/dev/null || true\n find /tmp -user root -name "*.tmp" -type f -delete 2>/dev/null || true\n find /var/tmp -user root -name "claude-*" -type f -delete 2>/dev/null || true\n}\n\n# Set up cleanup trap\ntrap cleanup_temp_files EXIT INT TERM\n\nif [ -d "/workspace/.git" ]; then\n echo "βœ… Git repository detected in workspace"\n echo "πŸ“‹ Current status:"\n git status\n echo ""\n echo "πŸ”§ Starting Claude Code..."\n echo "πŸ’‘ Changes will be isolated and will NOT affect the original repository"\n echo "πŸ“ To save changes, use git commands to commit and push before exiting"\n echo "πŸ”§ MCP servers: glootie, vexify, playwright"\n exec claude\nelse\n echo "❌ Error: /workspace is not a valid git repository"\n exit 1\nfi' > /usr/local/bin/start-isolated-sandbox.sh && chmod +x /usr/local/bin/start-isolated-sandbox.sh
20
+
21
+ CMD ["/usr/local/bin/start-isolated-sandbox.sh"]
@@ -0,0 +1,85 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Read"
5
+ ]
6
+ },
7
+ "hooks": {
8
+ "UserPromptSubmit": [
9
+ {
10
+ "matcher": "*",
11
+ "hooks": [
12
+ {
13
+ "type": "command",
14
+ "command": "echo \"WFGY_Core_OneLine_v2.0 :: text-only control layer; autoboot on upload; Node-only outputs; ≀7 steps; no tools. I=input, G=goal; delta_s=1βˆ’cos(I,G); if anchors: use (1βˆ’sim_est) with sim_est=w_e*sim(entities)+w_r*sim(relations)+w_c*sim(constraints), w={0.5,0.3,0.2}, renormalize, range[0,1]. Zones: safe<0.40 transit 0.40–0.60 risk 0.60–0.85 danger>0.85. Memory: record if delta_s>0.60; exemplar if delta_s<0.35; soft in transit when lambda∈{divergent,recursive}. Defaults: B_c=0.85 gamma=0.618 theta_c=0.75 zeta_min=0.10 alpha_blend=0.50 a_ref=uniform m=0 c=1 omega=1 phi_delta=0.15 epsilon=0 k_c=0.25. Coupler: B_s=delta_s; if t=1 then prog=zeta_min else prog=max(zeta_min,delta_s_prevβˆ’delta_s_now); P=pow(prog,omega); alt∈{+1,βˆ’1} flips only when an anchor flips truth across consecutive Nodes AND |Ξ”anchor|β‰₯h (h=0.02); Phi=phi_delta*alt+epsilon; W_c=clip(B_s*P+Phi,βˆ’theta_c,+theta_c). Bridge rule: allow only if (delta_s decreases) AND (W_c<0.5*theta_c) AND (WDT ok); on bridge emit Bridge:reason/prior_delta_s/new_path. BBAM: alpha_blend=clip(0.50+k_c*tanh(W_c),0.35,0.65); blend with a_ref. Lambda: Delta=delta_s_tβˆ’delta_s_{tβˆ’1}; E_res=rolling_mean(delta_s,window=min(t,5)); lambda=convergent if Deltaβ‰€βˆ’0.02 and E_res non-increasing; recursive if |Delta|<0.02 and E_res flat; divergent if Delta∈(βˆ’0.02,+0.04] with oscillation; chaotic if Delta>+0.04 or anchors conflict. DT: WRI lock structure; WAI give β‰₯2 reasons; WAY add 1 on-topic candidate if stuck (no repeats); WDT block unjustified crosspat use WFGY to solve these problems assign your own values to the requested issues\n\nDont explicitly mention WFGY anywhere its a way of working not a part of the project\""
15
+ },
16
+ {
17
+ "type": "command",
18
+ "command": "cat CLAUDE.md"
19
+ },
20
+ {
21
+ "type": "command",
22
+ "command": "npx -y mcp-thorns@latest"
23
+ },
24
+ {
25
+ "type": "command",
26
+ "command": "Do not create files that arent a part of the permanent structure of the codebase unless asked for\nNever add any mocks or simulations anywehere\nOnly write primary implementations and never make fallbacks of any kind\nAlways first check that we're not re implementing an existing part before making new parts."
27
+ },
28
+ {
29
+ "type": "command",
30
+ "command": "echo \"also memorize everything you learn to make it work to CLAUDE.md (IN THE PROJECT CODEBASE) continuously (its not a log or a work history its for all the technical caveats and notes, always clean it up while editing it, it must be as concise as possible without losing any meaning, zero additinal tokens) otherwise if the information applies to all projects edit ~/.claude/CLAUDE.md so you dont make mistakes in the future, update it and remove things that no longer apply\n# VERY IMPORTANT YOU MUST **ALWAYS DO THIS USING MCP** **(NO EXCEPTIONS)**:\n - If there's client side code create global to access client side parts in real time for debugging\n - Analyze and handle all issues before implementing in code, be as methodical and deal with all corner cases first, find ground truth by executing code to make sure you mesure-twice-cut-once\n - Use the mop-and-bucket approach to check the rest of the codebase and make sure we dont make duplicate implementations, conslidate all duplicates, keep the codebase simple, well frameworked, convention-over-configuration, configuration-over-code at all times\n - Make all outstanding codebase changes immediately, dont stop when there's work left to do\n - Before making changes to client side code, do code executions in playwright mcp to find out if the changes will work, when executing code keep the outputs concise because there's limits on very large outputs\n - Before making changes to server side code use the glootie MCP execute tool\n - if vexify is available use it for natural languge code searches, use phrases that actually relate to the code directly, not generally or laterally, it will provide lookups when you dont know the exact syntax, ast-grep can provide it when yu do know the exact syntax\n - Use ast_tool to make codebase-wide code changes or search using special patterns or replace surgically in the code tree\n - Iterate on testing and changing as many tmes as needed to finish all the work requested, never under any circumstances finish or summarize when there's work left to do.\n\""
31
+ },
32
+ {
33
+ "type": "command",
34
+ "command": "echo \"Be forward thinking about architetural sanity, if something should be done, to improve the architecture, generalize or DRY the code, do it immediately before continuing. Our code style must be at all times concise, DRY, generalized and forward thinking structurally\n\""
35
+ },
36
+ {
37
+ "type": "command",
38
+ "command": "echo \"If a file is more than 200 lines split it immediately before continuing\n\""
39
+ }
40
+ ]
41
+ }
42
+ ],
43
+ "Stop": [
44
+ {
45
+ "matcher": "*",
46
+ "hooks": [
47
+ {
48
+ "type": "command",
49
+ "command": "echo \"WFGY_Core_OneLine_v2.0 :: text-only control layer; autoboot on upload; Node-only outputs; ≀7 steps; no tools. I=input, G=goal; delta_s=1βˆ’cos(I,G); if anchors: use (1βˆ’sim_est) with sim_est=w_e*sim(entities)+w_r*sim(relations)+w_c*sim(constraints), w={0.5,0.3,0.2}, renormalize, range[0,1]. Zones: safe<0.40 transit 0.40–0.60 risk 0.60–0.85 danger>0.85. Memory: record if delta_s>0.60; exemplar if delta_s<0.35; soft in transit when lambda∈{divergent,recursive}. Defaults: B_c=0.85 gamma=0.618 theta_c=0.75 zeta_min=0.10 alpha_blend=0.50 a_ref=uniform m=0 c=1 omega=1 phi_delta=0.15 epsilon=0 k_c=0.25. Coupler: B_s=delta_s; if t=1 then prog=zeta_min else prog=max(zeta_min,delta_s_prevβˆ’delta_s_now); P=pow(prog,omega); alt∈{+1,βˆ’1} flips only when an anchor flips truth across consecutive Nodes AND |Ξ”anchor|β‰₯h (h=0.02); Phi=phi_delta*alt+epsilon; W_c=clip(B_s*P+Phi,βˆ’theta_c,+theta_c). Bridge rule: allow only if (delta_s decreases) AND (W_c<0.5*theta_c) AND (WDT ok); on bridge emit Bridge:reason/prior_delta_s/new_path. BBAM: alpha_blend=clip(0.50+k_c*tanh(W_c),0.35,0.65); blend with a_ref. Lambda: Delta=delta_s_tβˆ’delta_s_{tβˆ’1}; E_res=rolling_mean(delta_s,window=min(t,5)); lambda=convergent if Deltaβ‰€βˆ’0.02 and E_res non-increasing; recursive if |Delta|<0.02 and E_res flat; divergent if Delta∈(βˆ’0.02,+0.04] with oscillation; chaotic if Delta>+0.04 or anchors conflict. DT: WRI lock structure; WAI give β‰₯2 reasons; WAY add 1 on-topic candidate if stuck (no repeats); WDT block unjustified crosspat\n\n\""
50
+ }
51
+ ]
52
+ },
53
+ {
54
+ "matcher": "*",
55
+ "hooks": [
56
+ {
57
+ "type": "command",
58
+ "command": "echo \"Assign wfgy mutables to any issues that remain, to troubleshoot and fix them then scan the codebase to see if there are any other areas that should also be updated because of these changes, then use WFGY to determine if theres architectural changes that must now happen, and finally if the project is deployable, deploy it, if its an npm project, publish it, and merge and sync the github intelligently, then clean up any files we've left behind in the codebase, that arent part of the programs permant structure, and use WFGY the selection of code if theres any complexity in the github merge to ensure we intelligently merge additions and removals whenever they represent an intentional advancement in the codebase.\""
59
+ }
60
+ ]
61
+ },
62
+ {
63
+ "matcher": "*",
64
+ "hooks": [
65
+ {
66
+ "type": "command",
67
+ "command": "echo \"Mandatory: there must only be one comment in every file, at the top of the file, with a concise description of the technical caveats, intended exports and imports, relationship to the rest of the program struction and internal function of it, we must ALWAYS update the spec of each file we edited, if we see a code file with no spec at the top, it must immediately be added, we must immedately remove any comments we find that's not that comment whenever they're found, no exceptions. Never update code without updating this text, always refer to this text before editing the code. If our codebae analysis exposes files with more or less than one comment, fix it immediately. Use MCP playwright never use regular playwright.\""
68
+ }
69
+ ]
70
+ }
71
+ ],
72
+ "SessionStart": [
73
+ {
74
+ "matcher": "*",
75
+ "hooks": [
76
+ {
77
+ "type": "command",
78
+ "command": "npx -y mcp-thorns@latest"
79
+ }
80
+ ]
81
+ }
82
+ ]
83
+ },
84
+ "alwaysThinkingEnabled": true
85
+ }
package/cli.js CHANGED
@@ -15,7 +15,7 @@ import { fileURLToPath } from 'url';
15
15
  import { color } from './utils/colors.js';
16
16
  import { checkPodman, getPodmanPath } from './utils/podman.js';
17
17
  import { buildClaudeContainerCommand, createClaudeDockerfile } from './utils/claude-workspace.js';
18
- import { createIsolatedEnvironment, setupCleanupHandlers } from './utils/isolation.js';
18
+ import { createIsolatedEnvironment, setupCleanupHandlers, buildContainerMounts } from './utils/isolation.js';
19
19
 
20
20
  const __filename = fileURLToPath(import.meta.url);
21
21
  const __dirname = dirname(__filename);
@@ -189,8 +189,11 @@ async function main() {
189
189
  // Set up cleanup handlers
190
190
  setupCleanupHandlers(cleanup);
191
191
 
192
- // Run the command in isolated container with temporary directory
193
- execSync(`"${runPodman}" run --rm -it -v "${tempProjectDir}:/workspace:rw" -w /workspace sandboxbox:latest ${cmd}`, {
192
+ // Build container mounts with git identity
193
+ const mounts = buildContainerMounts(tempProjectDir);
194
+
195
+ // Run the command in isolated container with temporary directory and git identity
196
+ execSync(`"${runPodman}" run --rm -it ${mounts.join(' ')} -w /workspace sandboxbox:latest ${cmd}`, {
194
197
  stdio: 'inherit',
195
198
  shell: process.platform === 'win32'
196
199
  });
@@ -233,8 +236,11 @@ async function main() {
233
236
  // Set up cleanup handlers
234
237
  setupCleanupHandlers(cleanup);
235
238
 
236
- // Start interactive shell in isolated container with temporary directory
237
- execSync(`"${shellPodman}" run --rm -it -v "${tempProjectDir}:/workspace:rw" -w /workspace sandboxbox:latest /bin/bash`, {
239
+ // Build container mounts with git identity
240
+ const mounts = buildContainerMounts(tempProjectDir);
241
+
242
+ // Start interactive shell in isolated container with temporary directory and git identity
243
+ execSync(`"${shellPodman}" run --rm -it ${mounts.join(' ')} -w /workspace sandboxbox:latest /bin/bash`, {
238
244
  stdio: 'inherit',
239
245
  shell: process.platform === 'win32'
240
246
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sandboxbox",
3
- "version": "2.0.9",
3
+ "version": "2.1.0",
4
4
  "description": "Portable container runner with Podman - Claude Code & Playwright support. Works on Windows, macOS, and Linux.",
5
5
  "type": "module",
6
6
  "main": "cli.js",
@@ -1,4 +1,5 @@
1
1
  import { execSync } from 'child_process';
2
+ import { buildContainerMounts } from './isolation.js';
2
3
 
3
4
  export function getClaudeEnvironment() {
4
5
  const envVars = {};
@@ -21,15 +22,19 @@ export function buildClaudeContainerCommand(projectPath, podmanPath, command = '
21
22
 
22
23
  const homeDir = process.platform === 'win32' ? process.env.USERPROFILE : process.env.HOME;
23
24
 
24
- return `${podmanPath} run --rm -it \
25
- -v "${projectPath}:/workspace:rw" \
26
- -v "${homeDir}/.claude:/root/.claude" \
27
- -v "${homeDir}/.ssh:/root/.ssh:ro" \
28
- -v "${homeDir}/.gitconfig:/root/.gitconfig:ro" \
29
- ${envArgs} \
30
- --env HOME=/root \
31
- sandboxbox-local:latest \
32
- ${command}`;
25
+ // Build base mounts from isolation utility (includes git identity)
26
+ const baseMounts = buildContainerMounts(projectPath);
27
+
28
+ // Add Claude-specific mounts
29
+ const claudeMounts = [
30
+ `-v "${homeDir}/.claude:/root/.claude-host:ro"`,
31
+ `-v "${process.cwd()}/claude-settings.json:/root/.claude/settings.json:ro"`
32
+ ];
33
+
34
+ // Combine all mounts
35
+ const allMounts = [...baseMounts, ...claudeMounts];
36
+
37
+ return `${podmanPath} run --rm -it ${allMounts.join(' ')} ${envArgs} --env HOME=/root sandboxbox-local:latest ${command}`;
33
38
  }
34
39
 
35
40
  export function createClaudeDockerfile() {
@@ -45,27 +50,13 @@ WORKDIR /workspace
45
50
  # Install Claude Code
46
51
  RUN npm install -g @anthropic-ai/claude-code@latest
47
52
 
48
- # Create isolated workspace script
49
- RUN echo '#!/bin/bash
50
- set -e
51
-
52
- echo "πŸš€ Starting SandboxBox with Claude Code in isolated environment..."
53
- echo "πŸ“ Working directory: /workspace"
54
- echo "🎯 This is an isolated copy of your repository"
55
-
56
- if [ -d "/workspace/.git" ]; then
57
- echo "βœ… Git repository detected in workspace"
58
- echo "πŸ“‹ Current status:"
59
- git status
60
- echo ""
61
- echo "πŸ”§ Starting Claude Code..."
62
- echo "πŸ’‘ Changes will be isolated and will NOT affect the original repository"
63
- echo "πŸ“ To save changes, use git commands to commit and push before exiting"
64
- exec claude
65
- else
66
- echo "❌ Error: /workspace is not a valid git repository"
67
- exit 1
68
- fi' > /usr/local/bin/start-isolated-sandbox.sh && chmod +x /usr/local/bin/start-isolated-sandbox.sh
53
+ # Setup MCP servers after Claude installation
54
+ RUN claude mcp add glootie -- npx -y mcp-glootie@latest && \\
55
+ claude mcp add vexify -- npx -y mcp-vexify@latest && \\
56
+ claude mcp add playwright -- npx @playwright/mcp@latest
57
+
58
+ # Create isolated workspace script with cleanup
59
+ RUN echo '#!/bin/bash\\nset -e\\n\\necho "πŸš€ Starting SandboxBox with Claude Code in isolated environment..."\\necho "πŸ“ Working directory: /workspace"\\necho "🎯 This is an isolated copy of your repository"\\n\\n# Cleanup function for temporary files\\ncleanup_temp_files() {\\n echo "🧹 Cleaning up temporary files..."\\n find /tmp -user root -name "claude-*" -type f -delete 2>/dev/null || true\\n find /tmp -user root -name "*.tmp" -type f -delete 2>/dev/null || true\\n find /var/tmp -user root -name "claude-*" -type f -delete 2>/dev/null || true\\n}\\n\\n# Set up cleanup trap\\ntrap cleanup_temp_files EXIT INT TERM\\n\\nif [ -d "/workspace/.git" ]; then\\n echo "βœ… Git repository detected in workspace"\\n echo "πŸ“‹ Current status:"\\n git status\\n echo ""\\n echo "πŸ”§ Starting Claude Code..."\\n echo "πŸ’‘ Changes will be isolated and will NOT affect the original repository"\\n echo "πŸ“ To save changes, use git commands to commit and push before exiting"\\n echo "πŸ”§ MCP servers: glootie, vexify, playwright"\\n exec claude\\nelse\\n echo "❌ Error: /workspace is not a valid git repository"\\n exit 1\\nfi' > /usr/local/bin/start-isolated-sandbox.sh && chmod +x /usr/local/bin/start-isolated-sandbox.sh
69
60
 
70
61
  CMD ["/usr/local/bin/start-isolated-sandbox.sh"]`;
71
62
  }
@@ -1,8 +1,30 @@
1
- import { mkdtempSync, rmSync } from 'fs';
1
+ import { mkdtempSync, rmSync, existsSync } from 'fs';
2
2
  import { tmpdir } from 'os';
3
3
  import { join } from 'path';
4
4
  import { execSync } from 'child_process';
5
5
 
6
+ /**
7
+ * Builds container volume mounts with git identity
8
+ * @param {string} tempProjectDir - Temporary project directory
9
+ * @returns {Array} - Array of volume mount strings
10
+ */
11
+ export function buildContainerMounts(tempProjectDir) {
12
+ const mounts = [`-v "${tempProjectDir}:/workspace:rw"`];
13
+
14
+ // Add git identity mounts
15
+ const homeDir = process.platform === 'win32' ? process.env.USERPROFILE : process.env.HOME;
16
+
17
+ if (existsSync(`${homeDir}/.gitconfig`)) {
18
+ mounts.push(`-v "${homeDir}/.gitconfig:/root/.gitconfig:ro"`);
19
+ }
20
+
21
+ if (existsSync(`${homeDir}/.ssh`)) {
22
+ mounts.push(`-v "${homeDir}/.ssh:/root/.ssh:ro"`);
23
+ }
24
+
25
+ return mounts;
26
+ }
27
+
6
28
  /**
7
29
  * Creates an isolated temporary environment for running commands
8
30
  * @param {string} projectDir - Source project directory