sandboxbox 3.0.14 → 3.0.15

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sandboxbox",
3
- "version": "3.0.14",
3
+ "version": "3.0.15",
4
4
  "description": "Lightweight process containment sandbox for CLI tools - Playwright, Claude Code, and more. Pure Node.js, no dependencies.",
5
5
  "type": "module",
6
6
  "main": "cli.js",
package/test.txt ADDED
@@ -0,0 +1 @@
1
+ This is a test file created by Claude Code.
@@ -85,10 +85,16 @@ export async function claudeCommand(projectDir, prompt) {
85
85
  const claudeStartTime = Date.now();
86
86
  console.log(color('cyan', '⏱️ Stage 3: Starting Claude Code...'));
87
87
 
88
- const proc = spawn('sh', ['-c', `cd "${join(sandboxDir, 'workspace')}" && claude ${claudeArgs.join(' ')}`], {
88
+ const workspacePath = join(sandboxDir, 'workspace');
89
+
90
+ // Modify the prompt to include directory change instruction
91
+ const modifiedPrompt = `You are working in a sandboxed environment. Your working directory is "${workspacePath}". All operations should be performed in this directory. ${prompt}`;
92
+
93
+ const proc = spawn('claude', claudeArgs, {
94
+ cwd: workspacePath, // Set working directory directly
89
95
  env: env, // Use the environment directly without modification
90
96
  stdio: ['pipe', 'pipe', 'pipe'],
91
- shell: true, // Use shell for proper directory handling
97
+ shell: false, // Don't use shell since we're setting cwd directly
92
98
  detached: false
93
99
  });
94
100
 
@@ -139,8 +145,10 @@ export async function claudeCommand(projectDir, prompt) {
139
145
  }
140
146
  }
141
147
  } catch (jsonError) {
142
- // Skip malformed JSON lines - might be incomplete chunks
143
- // Silently continue to avoid breaking the stream
148
+ // Log JSON parsing errors for troubleshooting
149
+ console.log(color('red', `🔍 JSON parse error: ${jsonError.message}`));
150
+ console.log(color('yellow', `🔍 Problematic line: ${line}`));
151
+ console.log(color('cyan', '🔍 This suggests an issue with the output stream formatting'));
144
152
  }
145
153
  }
146
154
  }
@@ -151,8 +159,8 @@ export async function claudeCommand(projectDir, prompt) {
151
159
  reject(error);
152
160
  });
153
161
 
154
- // Write prompt to stdin
155
- proc.stdin.write(prompt);
162
+ // Write modified prompt to stdin
163
+ proc.stdin.write(modifiedPrompt);
156
164
  proc.stdin.end();
157
165
 
158
166
  let stdoutOutput = '';
@@ -162,20 +170,6 @@ export async function claudeCommand(projectDir, prompt) {
162
170
  proc.stdout.on('data', (data) => {
163
171
  stdoutOutput += data.toString();
164
172
 
165
- // Check for errors in JSON output with error handling
166
- const lines = data.toString().split('\n').filter(l => l.trim());
167
- for (const line of lines) {
168
- try {
169
- const event = JSON.parse(line);
170
- if (event.type === 'result' && event.is_error) {
171
- lastError = event.result;
172
- }
173
- } catch (jsonError) {
174
- // Ignore JSON parsing errors - might be incomplete chunks
175
- console.error('JSON parse error:', jsonError.message);
176
- }
177
- }
178
-
179
173
  handleStreamingOutput(data);
180
174
  });
181
175
 
package/utils/sandbox.js CHANGED
@@ -30,11 +30,15 @@ export function createSandbox(projectDir) {
30
30
  });
31
31
 
32
32
  // Configure host repository to accept pushes to current branch
33
- execSync(`cd "${projectDir}" && git config receive.denyCurrentBranch updateInstead`, {
34
- stdio: 'pipe',
35
- shell: true,
36
- windowsHide: true
37
- });
33
+ try {
34
+ execSync(`cd "${projectDir}" && git config receive.denyCurrentBranch updateInstead`, {
35
+ stdio: 'pipe',
36
+ shell: true,
37
+ windowsHide: true
38
+ });
39
+ } catch (error) {
40
+ console.log(`⚠️ Warning: Could not configure host repository: ${error.message}`);
41
+ }
38
42
 
39
43
  // Copy/clone the project to workspace
40
44
  if (existsSync(join(projectDir, '.git'))) {
@@ -67,6 +71,7 @@ export function createSandbox(projectDir) {
67
71
  stdio: 'pipe',
68
72
  shell: true
69
73
  });
74
+ console.log(`✅ Configured host directory as remote 'origin': ${projectDir}`);
70
75
  } catch (e) {
71
76
  // Remote already exists, update it
72
77
  execSync(`git remote set-url origin "${projectDir}"`, {
@@ -74,6 +79,7 @@ export function createSandbox(projectDir) {
74
79
  stdio: 'pipe',
75
80
  shell: true
76
81
  });
82
+ console.log(`✅ Updated remote 'origin' to host directory: ${projectDir}`);
77
83
  }
78
84
 
79
85
  // Set up upstream tracking for current branch
@@ -84,6 +90,20 @@ export function createSandbox(projectDir) {
84
90
  stdio: 'pipe'
85
91
  }).trim();
86
92
 
93
+ // Ensure the branch exists on the host side
94
+ try {
95
+ execSync(`cd "${projectDir}" && git checkout ${currentBranch}`, {
96
+ stdio: 'pipe',
97
+ shell: true
98
+ });
99
+ } catch (e) {
100
+ // Branch doesn't exist on host, create it
101
+ execSync(`cd "${projectDir}" && git checkout -b ${currentBranch}`, {
102
+ stdio: 'pipe',
103
+ shell: true
104
+ });
105
+ }
106
+
87
107
  execSync(`git branch --set-upstream-to=origin/${currentBranch} ${currentBranch}`, {
88
108
  cwd: workspaceDir,
89
109
  stdio: 'pipe',
@@ -91,6 +111,7 @@ export function createSandbox(projectDir) {
91
111
  });
92
112
  } catch (e) {
93
113
  // Upstream may not exist yet, ignore error
114
+ console.log(`⚠️ Warning: Could not set up upstream tracking: ${e.message}`);
94
115
  }
95
116
 
96
117
  // Batch fetch git identity settings for efficiency
package/.vexify.db DELETED
Binary file
package/index.html DELETED
@@ -1,38 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>SandboxBox</title>
7
- <style>
8
- body {
9
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
10
- margin: 0;
11
- padding: 2rem;
12
- background-color: #f5f5f5;
13
- }
14
- .container {
15
- max-width: 800px;
16
- margin: 0 auto;
17
- background: white;
18
- padding: 2rem;
19
- border-radius: 8px;
20
- box-shadow: 0 2px 10px rgba(0,0,0,0.1);
21
- }
22
- h1 {
23
- color: #333;
24
- margin-bottom: 1rem;
25
- }
26
- p {
27
- color: #666;
28
- line-height: 1.6;
29
- }
30
- </style>
31
- </head>
32
- <body>
33
- <div class="container">
34
- <h1>SandboxBox</h1>
35
- <p>Portable containerized environments using Podman with automatic WSL management and Claude Code integration.</p>
36
- </div>
37
- </body>
38
- </html>
package/tools.txt DELETED
@@ -1,55 +0,0 @@
1
- # Claude Code Available Tools
2
-
3
- ## Core Tools
4
- - **Task**: Launch specialized agents for complex multi-step tasks
5
- - **Bash**: Execute shell commands with persistent session and optional timeout
6
- - **Glob**: Fast file pattern matching (supports **/*.js, src/**/*.ts)
7
- - **Grep**: Powerful search tool using ripgrep with regex support
8
- - **Read**: Read files from local filesystem (supports images, PDFs, Jupyter notebooks)
9
- - **Edit**: Perform exact string replacements in files
10
- - **Write**: Write files to local filesystem (overwrites existing files)
11
- - **NotebookEdit**: Edit specific cells in Jupyter notebooks (.ipynb files)
12
- - **WebFetch**: Fetch and analyze web content from URLs
13
- - **TodoWrite**: Create and manage structured task lists for coding sessions
14
- - **WebSearch**: Search the web for current information beyond knowledge cutoff
15
- - **BashOutput**: Retrieve output from running or completed background bash shells
16
- - **KillShell**: Kill running background bash shells by ID
17
- - **SlashCommand**: Execute custom slash commands from .claude/commands/
18
- - **ExitPlanMode**: Present implementation plan and exit plan mode
19
-
20
- ## MCP Tools
21
- - **mcp__glootie__execute**: Execute code via Glootie MCP server
22
- - **mcp__glootie__ast_tool**: AST analysis and manipulation via Glootie
23
- - **mcp__glootie__caveat**: Code analysis and warnings via Glootie
24
- - **mcp__playwright__browser_navigate**: Navigate browser to URLs
25
- - **mcp__playwright__browser_snapshot**: Take browser screenshots
26
- - **mcp__playwright__browser_click**: Click elements on web pages
27
- - **mcp__playwright__browser_type**: Type text into browser elements
28
- - **mcp__playwright__browser_evaluate**: Execute JavaScript in browser context
29
- - **mcp__playwright__browser_close**: Close browser sessions
30
- - **mcp__vexify__search_code**: Search codebases with Vexify MCP server
31
-
32
- ## Tool Categories
33
-
34
- ### File Operations
35
- - Read, Edit, Write, NotebookEdit
36
- - Glob (file discovery)
37
- - Grep (content search)
38
-
39
- ### Execution & Testing
40
- - Bash (shell commands)
41
- - Task (specialized agents)
42
- - BashOutput/KillShell (background processes)
43
-
44
- ### Web & Research
45
- - WebFetch, WebSearch
46
- - Playwright tools (browser automation)
47
-
48
- ### Code Analysis
49
- - Glootie tools (AST, execution, analysis)
50
- - Vexify (code search)
51
-
52
- ### Project Management
53
- - TodoWrite (task tracking)
54
- - SlashCommand (custom commands)
55
- - ExitPlanMode (planning workflow)