sandboxbox 2.4.7 → 2.4.9

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.7",
3
+ "version": "2.4.9",
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",
@@ -85,6 +85,7 @@ export function runCommand(projectDir, cmd = 'bash') {
85
85
 
86
86
  while (retries < maxRetries) {
87
87
  try {
88
+ // Try container operation first
88
89
  execSync(`"${podmanPath}" run --rm -it ${mounts.join(' ')} -w /workspace sandboxbox:latest ${cmd}`, {
89
90
  stdio: 'inherit',
90
91
  shell: process.platform === 'win32',
@@ -98,7 +99,55 @@ export function runCommand(projectDir, cmd = 'bash') {
98
99
  } catch (error) {
99
100
  retries++;
100
101
  if (retries < maxRetries && (error.message.includes('Cannot connect to Podman') || error.message.includes('connectex') || error.message.includes('No connection could be made') || error.message.includes('actively refused') || error.message.includes('Command failed'))) {
101
- console.log(color('yellow', ` Backend not ready yet (${retries}/${maxRetries}), waiting 15 seconds...`));
102
+ console.log(color('yellow', ` Backend not ready yet (${retries}/${maxRetries}), initializing machine...`));
103
+
104
+ // Actually initialize the machine instead of just waiting
105
+ if (process.platform === 'win32') {
106
+ try {
107
+ // First try to start existing machine
108
+ console.log(color('cyan', ' Starting Podman machine...'));
109
+ execSync(`"${podmanPath}" machine start`, {
110
+ stdio: 'pipe',
111
+ shell: true,
112
+ windowsHide: true,
113
+ timeout: 60000 // 1 minute for machine start
114
+ });
115
+
116
+ console.log(color('green', ' ✅ Podman machine started!'));
117
+ continue; // Try container again immediately
118
+ } catch (startError) {
119
+ // Machine doesn't exist or failed to start, try initializing it
120
+ if (startError.message.includes('does not exist') || startError.message.includes('not found')) {
121
+ try {
122
+ console.log(color('cyan', ' Initializing new Podman machine...'));
123
+ execSync(`"${podmanPath}" machine init --rootful=false`, {
124
+ stdio: 'pipe',
125
+ shell: true,
126
+ windowsHide: true,
127
+ timeout: 180000 // 3 minutes for machine init
128
+ });
129
+
130
+ console.log(color('cyan', ' Starting new Podman machine...'));
131
+ execSync(`"${podmanPath}" machine start`, {
132
+ stdio: 'pipe',
133
+ shell: true,
134
+ windowsHide: true,
135
+ timeout: 60000 // 1 minute for machine start
136
+ });
137
+
138
+ console.log(color('green', ' ✅ Podman machine ready!'));
139
+ continue; // Try container again immediately
140
+ } catch (initError) {
141
+ console.log(color('red', ` Machine init failed: ${initError.message}`));
142
+ }
143
+ } else {
144
+ console.log(color('red', ` Machine start failed: ${startError.message}`));
145
+ }
146
+ }
147
+ }
148
+
149
+ // If machine setup failed or not Windows, wait and retry
150
+ console.log(color('yellow', ` Waiting 15 seconds before retry...`));
102
151
  const start = Date.now();
103
152
  while (Date.now() - start < 15000) {
104
153
  // Wait 15 seconds
@@ -154,7 +203,55 @@ export function shellCommand(projectDir) {
154
203
  } catch (error) {
155
204
  retries++;
156
205
  if (retries < maxRetries && (error.message.includes('Cannot connect to Podman') || error.message.includes('connectex') || error.message.includes('No connection could be made') || error.message.includes('actively refused') || error.message.includes('Command failed'))) {
157
- console.log(color('yellow', ` Backend not ready yet (${retries}/${maxRetries}), waiting 15 seconds...`));
206
+ console.log(color('yellow', ` Backend not ready yet (${retries}/${maxRetries}), initializing machine...`));
207
+
208
+ // Actually initialize the machine instead of just waiting
209
+ if (process.platform === 'win32') {
210
+ try {
211
+ // First try to start existing machine
212
+ console.log(color('cyan', ' Starting Podman machine...'));
213
+ execSync(`"${podmanPath}" machine start`, {
214
+ stdio: 'pipe',
215
+ shell: true,
216
+ windowsHide: true,
217
+ timeout: 60000 // 1 minute for machine start
218
+ });
219
+
220
+ console.log(color('green', ' ✅ Podman machine started!'));
221
+ continue; // Try container again immediately
222
+ } catch (startError) {
223
+ // Machine doesn't exist or failed to start, try initializing it
224
+ if (startError.message.includes('does not exist') || startError.message.includes('not found')) {
225
+ try {
226
+ console.log(color('cyan', ' Initializing new Podman machine...'));
227
+ execSync(`"${podmanPath}" machine init --rootful=false`, {
228
+ stdio: 'pipe',
229
+ shell: true,
230
+ windowsHide: true,
231
+ timeout: 180000 // 3 minutes for machine init
232
+ });
233
+
234
+ console.log(color('cyan', ' Starting new Podman machine...'));
235
+ execSync(`"${podmanPath}" machine start`, {
236
+ stdio: 'pipe',
237
+ shell: true,
238
+ windowsHide: true,
239
+ timeout: 60000 // 1 minute for machine start
240
+ });
241
+
242
+ console.log(color('green', ' ✅ Podman machine ready!'));
243
+ continue; // Try container again immediately
244
+ } catch (initError) {
245
+ console.log(color('red', ` Machine init failed: ${initError.message}`));
246
+ }
247
+ } else {
248
+ console.log(color('red', ` Machine start failed: ${startError.message}`));
249
+ }
250
+ }
251
+ }
252
+
253
+ // If machine setup failed or not Windows, wait and retry
254
+ console.log(color('yellow', ` Waiting 15 seconds before retry...`));
158
255
  const start = Date.now();
159
256
  while (Date.now() - start < 15000) {
160
257
  // Wait 15 seconds