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 +1 -1
- package/npx-test-sandboxbox/package.json +12 -0
- package/package.json +1 -1
- package/utils/commands/claude.js +3 -3
- package/utils/commands/container.js +4 -4
- package/utils/podman.js +9 -23
package/cli.js
CHANGED
package/package.json
CHANGED
package/utils/commands/claude.js
CHANGED
@@ -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,
|
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 (!
|
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 (!
|
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,
|
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 (!
|
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 (!
|
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 (!
|
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
|
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 (
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
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
|
|