sandboxbox 2.4.0 → 2.4.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sandboxbox",
3
- "version": "2.4.0",
3
+ "version": "2.4.1",
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",
package/podman.zip ADDED
@@ -0,0 +1 @@
1
+ Not Found
@@ -45,17 +45,18 @@ export function claudeCommand(projectDir, command = 'claude') {
45
45
  if (!buildPodman) return false;
46
46
  if (!setupBackendNonBlocking(buildPodman)) return false;
47
47
 
48
+ // Create isolated environment once (outside retry loop)
49
+ const { tempProjectDir, cleanup } = createIsolatedEnvironment(projectDir);
50
+ setupCleanupHandlers(cleanup);
51
+ const mounts = buildContainerMounts(tempProjectDir, projectDir);
52
+ const containerCommand = buildClaudeContainerCommand(tempProjectDir, buildPodman, command, mounts);
53
+
48
54
  // Retry container operation with backend readiness check
49
55
  let retries = 0;
50
56
  const maxRetries = process.platform === 'linux' ? 3 : 12; // More retries for Windows/macOS
51
57
 
52
58
  while (retries < maxRetries) {
53
59
  try {
54
- const { tempProjectDir, cleanup } = createIsolatedEnvironment(projectDir);
55
- setupCleanupHandlers(cleanup);
56
- const mounts = buildContainerMounts(tempProjectDir, projectDir);
57
- const containerCommand = buildClaudeContainerCommand(tempProjectDir, buildPodman, command, mounts);
58
-
59
60
  execSync(containerCommand, {
60
61
  stdio: 'inherit',
61
62
  shell: process.platform === 'win32',
@@ -76,6 +77,7 @@ export function claudeCommand(projectDir, command = 'claude') {
76
77
  }
77
78
  continue;
78
79
  }
80
+ cleanup(); // Cleanup on final failure
79
81
  console.log(color('red', `\n❌ Claude Code failed: ${error.message}`));
80
82
  return false;
81
83
  }
@@ -74,16 +74,17 @@ export function runCommand(projectDir, cmd = 'bash') {
74
74
  return false; // Only block on Linux for rootless service
75
75
  }
76
76
 
77
+ // Create isolated environment once (outside retry loop)
78
+ const { tempProjectDir, cleanup } = createIsolatedEnvironment(projectDir);
79
+ setupCleanupHandlers(cleanup);
80
+ const mounts = buildContainerMounts(tempProjectDir, projectDir);
81
+
77
82
  // Retry container operation with backend readiness check
78
83
  let retries = 0;
79
84
  const maxRetries = process.platform === 'linux' ? 3 : 12; // More retries for Windows/macOS
80
85
 
81
86
  while (retries < maxRetries) {
82
87
  try {
83
- const { tempProjectDir, cleanup } = createIsolatedEnvironment(projectDir);
84
- setupCleanupHandlers(cleanup);
85
- const mounts = buildContainerMounts(tempProjectDir, projectDir);
86
-
87
88
  execSync(`"${podmanPath}" run --rm -it ${mounts.join(' ')} -w /workspace sandboxbox:latest ${cmd}`, {
88
89
  stdio: 'inherit',
89
90
  shell: process.platform === 'win32',
@@ -104,6 +105,7 @@ export function runCommand(projectDir, cmd = 'bash') {
104
105
  }
105
106
  continue;
106
107
  }
108
+ cleanup(); // Cleanup on final failure
107
109
  console.log(color('red', `\n❌ Run failed: ${error.message}`));
108
110
  return false;
109
111
  }
@@ -129,16 +131,17 @@ export function shellCommand(projectDir) {
129
131
  return false; // Only block on Linux for rootless service
130
132
  }
131
133
 
134
+ // Create isolated environment once (outside retry loop)
135
+ const { tempProjectDir, cleanup } = createIsolatedEnvironment(projectDir);
136
+ setupCleanupHandlers(cleanup);
137
+ const mounts = buildContainerMounts(tempProjectDir, projectDir);
138
+
132
139
  // Retry container operation with backend readiness check
133
140
  let retries = 0;
134
141
  const maxRetries = process.platform === 'linux' ? 3 : 12; // More retries for Windows/macOS
135
142
 
136
143
  while (retries < maxRetries) {
137
144
  try {
138
- const { tempProjectDir, cleanup } = createIsolatedEnvironment(projectDir);
139
- setupCleanupHandlers(cleanup);
140
- const mounts = buildContainerMounts(tempProjectDir, projectDir);
141
-
142
145
  execSync(`"${podmanPath}" run --rm -it ${mounts.join(' ')} -w /workspace sandboxbox:latest /bin/bash`, {
143
146
  stdio: 'inherit',
144
147
  shell: process.platform === 'win32',
@@ -158,6 +161,7 @@ export function shellCommand(projectDir) {
158
161
  }
159
162
  continue;
160
163
  }
164
+ cleanup(); // Cleanup on final failure
161
165
  console.log(color('red', `\n❌ Shell failed: ${error.message}`));
162
166
  return false;
163
167
  }