sandboxbox 2.2.9 → 2.3.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/cli.js CHANGED
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env node
1
+ #!/usr/bin/env node
2
2
 
3
3
  /**
4
4
  * SandboxBox CLI - Portable Container Runner with Podman
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "npx-test-sandboxbox",
3
+ "version": "1.0.0",
4
+ "main": "index.js",
5
+ "scripts": {
6
+ "test": "echo \"Error: no test specified\" && exit 1"
7
+ },
8
+ "keywords": [],
9
+ "author": "",
10
+ "license": "ISC",
11
+ "description": ""
12
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sandboxbox",
3
- "version": "2.2.9",
3
+ "version": "2.3.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",
@@ -3,7 +3,7 @@ import { execSync } from 'child_process';
3
3
  import { resolve, dirname } from 'path';
4
4
  import { fileURLToPath } from 'url';
5
5
  import { color } from '../colors.js';
6
- import { checkPodman, ensureBackend, getPodmanPath } from '../podman.js';
6
+ import { checkPodman, checkBackend, getPodmanPath } from '../podman.js';
7
7
  import { buildClaudeContainerCommand, createClaudeDockerfile } from '../claude-workspace.js';
8
8
  import { createIsolatedEnvironment, setupCleanupHandlers, buildContainerMounts } from '../isolation.js';
9
9
 
@@ -42,7 +42,7 @@ export function claudeCommand(projectDir, command = 'claude') {
42
42
 
43
43
  const buildPodman = checkPodman();
44
44
  if (!buildPodman) return false;
45
- if (!ensureBackend(buildPodman)) return false;
45
+ if (!checkBackend(buildPodman)) return false;
46
46
 
47
47
  try {
48
48
  const { tempProjectDir, cleanup } = createIsolatedEnvironment(projectDir);
@@ -73,7 +73,7 @@ function buildClaudeContainer() {
73
73
 
74
74
  const podmanPath = checkPodman();
75
75
  if (!podmanPath) return false;
76
- if (!ensureBackend(podmanPath)) return false;
76
+ if (!checkBackend(podmanPath)) return false;
77
77
 
78
78
  try {
79
79
  execSync(`"${podmanPath}" build -f "${dockerfilePath}" -t sandboxbox-local:latest .`, {
@@ -2,7 +2,7 @@ import { existsSync } from 'fs';
2
2
  import { execSync } from 'child_process';
3
3
  import { dirname } from 'path';
4
4
  import { color } from '../colors.js';
5
- import { checkPodman, ensureBackend } from '../podman.js';
5
+ import { checkPodman, checkBackend } from '../podman.js';
6
6
  import { createIsolatedEnvironment, setupCleanupHandlers, buildContainerMounts } from '../isolation.js';
7
7
 
8
8
  export function buildCommand(dockerfilePath) {
@@ -16,7 +16,7 @@ export function buildCommand(dockerfilePath) {
16
16
 
17
17
  const podmanPath = checkPodman();
18
18
  if (!podmanPath) return false;
19
- if (!ensureBackend(podmanPath)) return false;
19
+ if (!checkBackend(podmanPath)) return false;
20
20
 
21
21
  try {
22
22
  execSync(`"${podmanPath}" build -f "${dockerfilePath}" -t sandboxbox:latest .`, {
@@ -45,7 +45,7 @@ export function runCommand(projectDir, cmd = 'bash') {
45
45
 
46
46
  const podmanPath = checkPodman();
47
47
  if (!podmanPath) return false;
48
- if (!ensureBackend(podmanPath)) return false;
48
+ if (!checkBackend(podmanPath)) return false;
49
49
 
50
50
  try {
51
51
  const { tempProjectDir, cleanup } = createIsolatedEnvironment(projectDir);
@@ -78,7 +78,7 @@ export function shellCommand(projectDir) {
78
78
 
79
79
  const podmanPath = checkPodman();
80
80
  if (!podmanPath) return false;
81
- if (!ensureBackend(podmanPath)) return false;
81
+ if (!checkBackend(podmanPath)) return false;
82
82
 
83
83
  try {
84
84
  const { tempProjectDir, cleanup } = createIsolatedEnvironment(projectDir);
package/utils/podman.js CHANGED
@@ -26,7 +26,7 @@ export function getPodmanPath() {
26
26
  return 'podman';
27
27
  }
28
28
 
29
- export function ensureBackend(podmanPath) {
29
+ export function checkBackend(podmanPath) {
30
30
  if (process.platform === 'linux') return true;
31
31
 
32
32
  const execOptions = { encoding: 'utf-8', stdio: 'pipe', shell: true };
@@ -35,30 +35,16 @@ export function ensureBackend(podmanPath) {
35
35
  execSync(`"${podmanPath}" info`, execOptions);
36
36
  return true;
37
37
  } catch (infoError) {
38
- if (!infoError.message.includes('Cannot connect to Podman')) throw infoError;
39
-
40
- console.log(color('yellow', '\nšŸ”§ Initializing Podman backend (first run, takes 2-3 minutes)...'));
41
-
42
- try {
43
- const machineListOutput = execSync(`"${podmanPath}" machine list --format json`, execOptions);
44
- const machines = JSON.parse(machineListOutput || '[]');
45
-
46
- if (machines.length === 0) {
47
- console.log(color('cyan', ' Creating Podman machine...'));
48
- const initCmd = process.platform === 'win32'
49
- ? `"${podmanPath}" machine init --rootful=false`
50
- : `"${podmanPath}" machine init`;
51
- execSync(initCmd, { stdio: 'inherit', shell: true });
52
- }
53
-
54
- console.log(color('cyan', ' Starting Podman machine...'));
55
- execSync(`"${podmanPath}" machine start`, { stdio: 'inherit', shell: true });
56
- console.log(color('green', 'āœ… Podman backend ready\n'));
57
- return true;
58
- } catch (backendError) {
59
- console.log(color('red', `\nāŒ Backend setup failed: ${backendError.message}`));
38
+ if (infoError.message.includes('Cannot connect to Podman')) {
39
+ console.log(color('red', '\nāŒ Podman backend not running'));
40
+ console.log(color('yellow', '\nšŸ“‹ One-time setup required:'));
41
+ console.log(color('cyan', process.platform === 'win32'
42
+ ? ' Run: podman machine init --rootful=false && podman machine start'
43
+ : ' Run: podman machine init && podman machine start'));
44
+ console.log(color('yellow', '\nā±ļø This takes 2-3 minutes, then works instantly forever.\n'));
60
45
  return false;
61
46
  }
47
+ throw infoError;
62
48
  }
63
49
  }
64
50