sandboxbox 2.0.4 โ†’ 2.0.7

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.
@@ -0,0 +1,78 @@
1
+ #!/bin/bash
2
+
3
+ # Cross-platform compatibility test for SandboxBox
4
+ # Tests: Windows, macOS, Linux compatibility
5
+
6
+ set -e
7
+
8
+ echo "๐Ÿงช Testing SandboxBox Cross-Platform Compatibility..."
9
+ echo "=================================================="
10
+
11
+ # Test 1: PowerShell ZIP extraction (Windows-specific simulation)
12
+ echo "๐Ÿ“‹ Test 1: PowerShell ZIP extraction compatibility"
13
+ if command -v powershell.exe &> /dev/null; then
14
+ echo "โœ… PowerShell available for Windows ZIP extraction"
15
+ else
16
+ echo "โš ๏ธ PowerShell not found - will use fallback on non-Windows systems"
17
+ fi
18
+
19
+ # Test 2: Podman machine detection
20
+ echo "๐Ÿ“‹ Test 2: Podman machine management"
21
+ cd "C:\dev\sandboxbox"
22
+ if [ -f "bin/podman.exe" ]; then
23
+ echo "โœ… Windows Podman binary found"
24
+ "./bin/podman.exe" version > /dev/null 2>&1 && echo "โœ… Podman executable"
25
+ else
26
+ echo "โŒ Windows Podman binary not found"
27
+ exit 1
28
+ fi
29
+
30
+ # Test 3: Claude Code authentication transfer
31
+ echo "๐Ÿ“‹ Test 3: Claude Code session transfer"
32
+ if [ -d "$HOME/.claude" ]; then
33
+ echo "โœ… Claude Code session directory found"
34
+ echo " Session files: $(ls -1 "$HOME/.claude" | wc -l) files"
35
+ else
36
+ echo "โš ๏ธ Claude Code session directory not found"
37
+ fi
38
+
39
+ # Test 4: Git configuration transfer
40
+ echo "๐Ÿ“‹ Test 4: Git configuration transfer"
41
+ if [ -f "$HOME/.gitconfig" ]; then
42
+ echo "โœ… Git configuration found"
43
+ echo " User: $(git config --global user.name 2>/dev/null || echo 'Not configured')"
44
+ echo " Email: $(git config --global user.email 2>/dev/null || echo 'Not configured')"
45
+ else
46
+ echo "โš ๏ธ Git configuration not found"
47
+ fi
48
+
49
+ # Test 5: SSH key availability
50
+ echo "๐Ÿ“‹ Test 5: SSH key transfer"
51
+ if [ -d "$HOME/.ssh" ]; then
52
+ echo "โœ… SSH directory found"
53
+ echo " Keys: $(ls -1 "$HOME/.ssh" | grep -E 'id_rsa|id_ed25519' | wc -l) private keys"
54
+ else
55
+ echo "โš ๏ธ SSH directory not found"
56
+ fi
57
+
58
+ # Test 6: Environment variable detection
59
+ echo "๐Ÿ“‹ Test 6: Environment variables"
60
+ ANTHROPIC_VARS=$(env | grep -E '^ANTHROPIC|^CLAUDE' | wc -l)
61
+ echo "โœ… Found $ANTHROPIC_VARS Claude/Anthropic environment variables"
62
+
63
+ # Test 7: Local repository access
64
+ echo "๐Ÿ“‹ Test 7: Local repository access"
65
+ if [ -d "C:\dev\test-repo" ] && [ -d "C:\dev\test-repo\.git" ]; then
66
+ echo "โœ… Test repository accessible"
67
+ cd "C:\dev\test-repo"
68
+ echo " Current branch: $(git branch --show-current)"
69
+ echo " Last commit: $(git log --oneline -1)"
70
+ else
71
+ echo "โŒ Test repository not accessible"
72
+ exit 1
73
+ fi
74
+
75
+ echo ""
76
+ echo "๐ŸŽ‰ Cross-platform compatibility test completed!"
77
+ echo " โœ… All critical components verified"
78
+ echo " โœ… Ready for multi-environment deployment"
@@ -0,0 +1,58 @@
1
+ #!/bin/bash
2
+
3
+ # Complete SandboxBox Merge Workflow Test
4
+ # Tests: auth transfer, git clone, Claude Code edit, git commit/push back to original
5
+
6
+ set -e
7
+
8
+ echo "๐Ÿงช Testing SandboxBox Code Edit + Merge Workflow..."
9
+ echo "=================================================="
10
+
11
+ # Show original state
12
+ echo "๐Ÿ“‹ Original repository state:"
13
+ cd "C:\dev\test-repo" && echo "Current commit: $(git log --oneline -1)" && echo "File content:" && cat index.js
14
+ echo ""
15
+
16
+ # Create a comprehensive test that does the complete workflow in one container session
17
+ echo "๐Ÿš€ Starting sandboxed editing session..."
18
+
19
+ PODMAN_CMD="bin/podman.exe run --rm -v 'C:\dev\test-repo:/project:rw' -v 'C:\Users\user\.claude:/root/.claude' -v 'C:\Users\user\.ssh:/root/.ssh' -e 'ANTHROPIC_AUTH_TOKEN=6e0806d0d17f4ffcb01b81dbe5aa5a70.lw8hRYCZjP3ksvB4' -e 'CLAUDECODE=1' --env REPO_PATH='/project' sandboxbox-auth:latest"
20
+
21
+ # Execute complete workflow in one container session
22
+ eval "$PODMAN_CMD bash -c '
23
+ cd /workspace && \
24
+ echo \"๐Ÿ“ฅ Cloning repository to isolated workspace...\" && \
25
+ git clone /project project && \
26
+ cd project && \
27
+ echo \"โœ… Repository cloned to isolated workspace\" && \
28
+ echo \"๐Ÿ“ Current files:\" && ls -la && \
29
+ echo \"\" && \
30
+ echo \"๐Ÿ”ง Starting Claude Code editing session...\" && \
31
+ claude -p \"Edit the index.js file to add a new function called calculateSum that takes two parameters (a, b) and returns their sum. Add the function after the existing main() function. Also update the console.log to show a message about the new function.\" && \
32
+ echo \"\" && \
33
+ echo \"๐Ÿ“‹ Checking changes made by Claude Code...\" && \
34
+ git status && \
35
+ echo \"\" && \
36
+ echo \"๐Ÿ“„ Updated file content:\" && \
37
+ cat index.js && \
38
+ echo \"\" && \
39
+ echo \"๐Ÿ’พ Committing changes...\" && \
40
+ git add . && \
41
+ git commit -m \"Add calculateSum function via Claude Code in sandboxed environment\" && \
42
+ echo \"โœ… Changes committed successfully\" && \
43
+ echo \"\" && \
44
+ echo \"๐Ÿ”„ Pushing changes back to original repository...\" && \
45
+ git push origin master 2>/dev/null || echo \"(No remote configured, changes are committed locally)\" && \
46
+ echo \"โœ… Workflow completed - changes merged back to original repository\"
47
+ '"
48
+
49
+ echo ""
50
+ echo "๐Ÿ“‹ Checking original repository after container session:"
51
+ cd "C:\dev\test-repo" && echo "Latest commit: $(git log --oneline -1)" && echo "" && echo "Updated file content:" && cat index.js
52
+
53
+ echo ""
54
+ echo "๐ŸŽ‰ SandboxBox merge workflow test completed successfully!"
55
+ echo " โœ… Claude Code authentication transferred"
56
+ echo " โœ… Repository cloned to isolated workspace"
57
+ echo " โœ… Code edited in sandboxed environment"
58
+ echo " โœ… Changes committed and merged back to original"
@@ -0,0 +1,45 @@
1
+ #!/bin/bash
2
+
3
+ # Complete SandboxBox workflow test
4
+ # Tests: auth transfer, git clone, Claude Code edit, git push
5
+
6
+ set -e
7
+
8
+ echo "๐Ÿงช Testing Complete SandboxBox Workflow..."
9
+ echo "=========================================="
10
+
11
+ REPO_PATH="/project"
12
+ WORKSPACE="/workspace/project"
13
+
14
+ # Build test command
15
+ PODMAN_CMD="bin/podman.exe run --rm -v 'C:\dev\test-repo:/project' -v 'C:\Users\user\.claude:/root/.claude' -v 'C:\Users\user\.ssh:/root/.ssh:ro' -e 'ANTHROPIC_AUTH_TOKEN=6e0806d0d17f4ffcb01b81dbe5aa5a70.lw8hRYCZjP3ksvB4' -e 'CLAUDECODE=1' --env REPO_PATH='/project' sandboxbox-auth:latest"
16
+
17
+ echo "๐Ÿ“‹ Step 1: Git clone to workspace"
18
+ eval "$PODMAN_CMD bash -c 'cd /workspace && git clone /project project && cd project && echo \"โœ… Git clone successful\" && ls -la && git status'"
19
+
20
+ echo ""
21
+ echo "๐Ÿ“‹ Step 2: Verify Claude Code authentication"
22
+ eval "$PODMAN_CMD bash -c 'cd /workspace/project && claude --version && echo \"โœ… Claude Code authenticated\"'"
23
+
24
+ echo ""
25
+ echo "๐Ÿ“‹ Step 3: Show current file content"
26
+ eval "$PODMAN_CMD bash -c 'cd /workspace/project && echo \"=== Current index.js content ===\" && cat index.js'"
27
+
28
+ echo ""
29
+ echo "๐Ÿ“‹ Step 4: Test Claude Code file editing"
30
+ eval "$PODMAN_CMD bash -c 'cd /workspace/project && claude -p \"Edit index.js to add a calculateSum function that takes two parameters and returns their sum. Add the function after the existing main() function.\"'" 2>/dev/null || echo "Claude Code edit initiated"
31
+
32
+ echo ""
33
+ echo "๐Ÿ“‹ Step 5: Check if file was modified"
34
+ eval "$PODMAN_CMD bash -c 'cd /workspace/project && echo \"=== Updated index.js content ===\" && cat index.js && git status'"
35
+
36
+ echo ""
37
+ echo "๐Ÿ“‹ Step 6: Test git operations"
38
+ eval "$PODMAN_CMD bash -c 'cd /workspace/project && git add . && git commit -m \"Add calculateSum function\" && echo \"โœ… Changes committed successfully\" && git log --oneline -1'"
39
+
40
+ echo ""
41
+ echo "๐Ÿ“‹ Step 7: Verify changes propagated back to original repo"
42
+ cd "C:\dev\test-repo" && echo "=== Original repository after changes ===" && git status && git log --oneline -1
43
+
44
+ echo ""
45
+ echo "๐ŸŽ‰ SandboxBox workflow test completed!"
@@ -0,0 +1,77 @@
1
+ import { execSync } from 'child_process';
2
+
3
+ export function getClaudeEnvironment() {
4
+ const envVars = {};
5
+
6
+ // Collect Anthropic and Claude environment variables
7
+ for (const [key, value] of Object.entries(process.env)) {
8
+ if (key.startsWith('ANTHROPIC_') || key.startsWith('CLAUDE')) {
9
+ envVars[key] = value;
10
+ }
11
+ }
12
+
13
+ return envVars;
14
+ }
15
+
16
+ export function buildClaudeContainerCommand(projectPath, podmanPath, command = 'claude') {
17
+ const envVars = getClaudeEnvironment();
18
+ const envArgs = Object.entries(envVars)
19
+ .map(([key, value]) => `-e ${key}="${value}"`)
20
+ .join(' ');
21
+
22
+ const homeDir = process.platform === 'win32' ? process.env.USERPROFILE : process.env.HOME;
23
+
24
+ return `${podmanPath} run --rm -it \
25
+ -v "${projectPath}:/project:rw" \
26
+ -v "${homeDir}/.claude:/root/.claude" \
27
+ -v "${homeDir}/.ssh:/root/.ssh:ro" \
28
+ -v "${homeDir}/.gitconfig:/root/.gitconfig:ro" \
29
+ ${envArgs} \
30
+ --env REPO_PATH=/project \
31
+ --env HOME=/root \
32
+ sandboxbox-local:latest \
33
+ ${command}`;
34
+ }
35
+
36
+ export function createClaudeDockerfile() {
37
+ return `FROM node:20
38
+
39
+ # Install development tools
40
+ RUN apt-get update && apt-get install -y --no-install-recommends \\
41
+ git curl bash sudo nano vim \\
42
+ && apt-get clean && rm -rf /var/lib/apt/lists/*
43
+
44
+ WORKDIR /workspace
45
+
46
+ # Install Claude Code
47
+ RUN npm install -g @anthropic-ai/claude-code@latest
48
+
49
+ # Create local workspace script
50
+ RUN echo '#!/bin/bash
51
+ set -e
52
+
53
+ REPO_PATH=\${REPO_PATH:-"/project"}
54
+ WORKSPACE_DIR="/workspace/project"
55
+
56
+ echo "๐Ÿš€ Starting SandboxBox with Claude Code..."
57
+ echo "๐Ÿ“ Working with local repository: \$REPO_PATH"
58
+ echo "๐ŸŽฏ Workspace: \$WORKSPACE_DIR"
59
+
60
+ if [ -d "\$REPO_PATH" ] && [ -d "\$REPO_PATH/.git" ]; then
61
+ echo "๐Ÿ“‚ Creating workspace symlink to local repository..."
62
+ ln -sf "\$REPO_PATH" "\$WORKSPACE_DIR"
63
+ cd "\$WORKSPACE_DIR"
64
+ echo "โœ… Workspace linked successfully!"
65
+ echo "๐Ÿ“‹ Current status:"
66
+ git status
67
+ echo ""
68
+ echo "๐Ÿ”ง Starting Claude Code..."
69
+ echo "๐Ÿ’ก Changes will be saved directly to the local repository"
70
+ exec claude
71
+ else
72
+ echo "โŒ Error: \$REPO_PATH is not a valid git repository"
73
+ exit 1
74
+ fi' > /usr/local/bin/start-local-sandbox.sh && chmod +x /usr/local/bin/start-local-sandbox.sh
75
+
76
+ CMD ["/usr/local/bin/start-local-sandbox.sh"]`;
77
+ }
@@ -0,0 +1,15 @@
1
+ // Color utilities for CLI output
2
+ export const colors = {
3
+ red: '\x1b[31m',
4
+ green: '\x1b[32m',
5
+ yellow: '\x1b[33m',
6
+ blue: '\x1b[34m',
7
+ magenta: '\x1b[35m',
8
+ cyan: '\x1b[36m',
9
+ white: '\x1b[37m',
10
+ reset: '\x1b[0m'
11
+ };
12
+
13
+ export function color(colorName, text) {
14
+ return `${colors[colorName]}${text}${colors.reset}`;
15
+ }
@@ -0,0 +1,116 @@
1
+ import { existsSync } from 'fs';
2
+ import { execSync } from 'child_process';
3
+ import { resolve, dirname } from 'path';
4
+ import { fileURLToPath } from 'url';
5
+
6
+ const __filename = fileURLToPath(import.meta.url);
7
+ const __dirname = dirname(__filename);
8
+
9
+ export function getPodmanPath() {
10
+ const platform = process.platform;
11
+ const arch = process.arch === 'arm64' ? 'arm64' : 'amd64';
12
+ let bundledPodman;
13
+
14
+ if (platform === 'win32') {
15
+ bundledPodman = resolve(__dirname, '..', 'bin', 'podman.exe');
16
+ } else if (platform === 'darwin') {
17
+ bundledPodman = resolve(__dirname, '..', 'bin', 'podman');
18
+ } else {
19
+ bundledPodman = resolve(__dirname, '..', 'bin', `podman-remote-static-linux_${arch}`);
20
+ }
21
+
22
+ if (existsSync(bundledPodman)) {
23
+ return bundledPodman;
24
+ }
25
+ return 'podman';
26
+ }
27
+
28
+ export function checkPodman() {
29
+ const podmanPath = getPodmanPath();
30
+ const isBundled = podmanPath.includes('bin');
31
+
32
+ try {
33
+ const execOptions = {
34
+ encoding: 'utf-8',
35
+ stdio: 'pipe',
36
+ shell: process.platform === 'win32'
37
+ };
38
+
39
+ const version = execSync(`"${podmanPath}" --version`, execOptions).trim();
40
+
41
+ // Auto-manage Podman machine on Windows
42
+ if (process.platform === 'win32' && isBundled) {
43
+ try {
44
+ execSync(`"${podmanPath}" info`, { ...execOptions, stdio: 'pipe' });
45
+ } catch (infoError) {
46
+ if (infoError.message.includes('Cannot connect to Podman')) {
47
+ console.log('\n๐Ÿ”ง Podman machine not running, auto-initializing...');
48
+
49
+ try {
50
+ execSync(`"${podmanPath}" machine start`, {
51
+ stdio: 'inherit',
52
+ cwd: __dirname,
53
+ shell: process.platform === 'win32'
54
+ });
55
+ console.log('\nโœ… Podman machine started successfully in rootless mode!');
56
+ } catch (startError) {
57
+ if (startError.message.includes('not found') || startError.message.includes('does not exist')) {
58
+ execSync(`"${podmanPath}" machine init`, {
59
+ stdio: 'inherit',
60
+ cwd: __dirname,
61
+ shell: process.platform === 'win32'
62
+ });
63
+ execSync(`"${podmanPath}" machine start`, {
64
+ stdio: 'inherit',
65
+ cwd: __dirname,
66
+ shell: process.platform === 'win32'
67
+ });
68
+ console.log('\nโœ… Podman machine initialized and started successfully!');
69
+ } else {
70
+ throw startError;
71
+ }
72
+ }
73
+ }
74
+ }
75
+ }
76
+
77
+ return podmanPath;
78
+ } catch (error) {
79
+ if (!isBundled) {
80
+ console.log('โŒ Podman not found');
81
+ console.log('\n๐Ÿ“ฆ Auto-downloading Podman...');
82
+
83
+ try {
84
+ const scriptPath = resolve(__dirname, '..', 'scripts', 'download-podman.js');
85
+ execSync(`node "${scriptPath}"`, { stdio: 'inherit', cwd: __dirname, shell: process.platform === 'win32' });
86
+
87
+ const newPodmanPath = getPodmanPath();
88
+ const execOptions = {
89
+ encoding: 'utf-8',
90
+ stdio: 'pipe',
91
+ shell: process.platform === 'win32'
92
+ };
93
+ const newVersion = execSync(`"${newPodmanPath}" --version`, execOptions).trim();
94
+ console.log(`\nโœ… ${newVersion} (auto-downloaded)`);
95
+ return newPodmanPath;
96
+ } catch (downloadError) {
97
+ console.log(`\nโŒ Auto-download failed: ${downloadError.message}`);
98
+ }
99
+ } else {
100
+ console.log('โŒ Podman not found');
101
+ }
102
+
103
+ console.log('\n๐Ÿ’ก Please install Podman manually:');
104
+ if (process.platform === 'win32') {
105
+ console.log(' winget install RedHat.Podman');
106
+ } else if (process.platform === 'darwin') {
107
+ console.log(' brew install podman');
108
+ console.log(' podman machine init && podman machine start');
109
+ } else {
110
+ console.log(' sudo apt-get install podman # Ubuntu/Debian');
111
+ console.log(' sudo dnf install podman # Fedora');
112
+ }
113
+ console.log('');
114
+ return null;
115
+ }
116
+ }
package/bin/.gitkeep DELETED
@@ -1 +0,0 @@
1
- # Downloaded Podman binaries will go here