sandboxbox 3.0.75 → 3.0.76
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/CHANGELOG.md
CHANGED
package/CLAUDE.md
CHANGED
|
@@ -78,8 +78,15 @@ if (process.platform === 'win32') {
|
|
|
78
78
|
1. Copy project to temporary directory (including .git)
|
|
79
79
|
2. Mount temporary directory as /workspace in container
|
|
80
80
|
3. Run commands in isolated environment
|
|
81
|
-
4.
|
|
82
|
-
5.
|
|
81
|
+
4. Auto-commit and push changes to host repository
|
|
82
|
+
5. Clean up temporary directory on exit
|
|
83
|
+
|
|
84
|
+
### Auto-Commit & Push (v3.0.76+)
|
|
85
|
+
- Cleanup function automatically detects uncommitted changes
|
|
86
|
+
- Auto-commits with timestamped message: "sandboxbox auto-commit: {ISO timestamp}"
|
|
87
|
+
- Auto-pushes to host repository before sandbox cleanup
|
|
88
|
+
- Changes persist automatically without manual git operations
|
|
89
|
+
- Graceful error handling - cleanup continues even if git operations fail
|
|
83
90
|
|
|
84
91
|
### Pattern
|
|
85
92
|
```javascript
|
package/package.json
CHANGED
package/utils/sandbox.js
CHANGED
|
@@ -325,6 +325,66 @@ node_modules/
|
|
|
325
325
|
}
|
|
326
326
|
|
|
327
327
|
const cleanup = () => {
|
|
328
|
+
const VERBOSE_OUTPUT = process.env.SANDBOX_VERBOSE === 'true' || process.argv.includes('--verbose');
|
|
329
|
+
|
|
330
|
+
// Push any committed changes back to host before cleanup
|
|
331
|
+
try {
|
|
332
|
+
// Check if there are any uncommitted changes
|
|
333
|
+
const status = execSync(`git status --porcelain`, {
|
|
334
|
+
cwd: workspaceDir,
|
|
335
|
+
encoding: 'utf8',
|
|
336
|
+
stdio: 'pipe'
|
|
337
|
+
}).trim();
|
|
338
|
+
|
|
339
|
+
if (status) {
|
|
340
|
+
// Add all changes
|
|
341
|
+
execSync(`git add -A`, {
|
|
342
|
+
cwd: workspaceDir,
|
|
343
|
+
stdio: 'pipe',
|
|
344
|
+
shell: true
|
|
345
|
+
});
|
|
346
|
+
|
|
347
|
+
// Commit with timestamp
|
|
348
|
+
const commitMessage = `sandboxbox auto-commit: ${new Date().toISOString()}
|
|
349
|
+
|
|
350
|
+
🤖 Generated with SandboxBox
|
|
351
|
+
Changes made during sandboxbox session`;
|
|
352
|
+
|
|
353
|
+
execSync(`git commit -m "${commitMessage}"`, {
|
|
354
|
+
cwd: workspaceDir,
|
|
355
|
+
stdio: 'pipe',
|
|
356
|
+
shell: true
|
|
357
|
+
});
|
|
358
|
+
|
|
359
|
+
if (VERBOSE_OUTPUT) {
|
|
360
|
+
console.log('✅ Committed sandbox changes');
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
// Push to host repository (origin points to host)
|
|
365
|
+
try {
|
|
366
|
+
execSync(`git push origin HEAD`, {
|
|
367
|
+
cwd: workspaceDir,
|
|
368
|
+
stdio: 'pipe',
|
|
369
|
+
shell: true
|
|
370
|
+
});
|
|
371
|
+
|
|
372
|
+
if (VERBOSE_OUTPUT) {
|
|
373
|
+
console.log('✅ Pushed changes to host repository');
|
|
374
|
+
}
|
|
375
|
+
} catch (pushError) {
|
|
376
|
+
// Push might fail if there are no changes or network issues
|
|
377
|
+
if (VERBOSE_OUTPUT) {
|
|
378
|
+
console.log('⚠️ Could not push to host repository');
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
} catch (error) {
|
|
382
|
+
// Don't fail cleanup if git operations fail
|
|
383
|
+
if (VERBOSE_OUTPUT) {
|
|
384
|
+
console.log(`⚠️ Git sync failed: ${error.message}`);
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
|
|
328
388
|
// Close any log files that might be open
|
|
329
389
|
if (global.logFileHandle) {
|
|
330
390
|
try {
|
|
@@ -334,6 +394,7 @@ node_modules/
|
|
|
334
394
|
// Don't fail on log cleanup
|
|
335
395
|
}
|
|
336
396
|
}
|
|
397
|
+
|
|
337
398
|
rmSync(sandboxDir, { recursive: true, force: true });
|
|
338
399
|
};
|
|
339
400
|
|