sandboxbox 3.0.24 → 3.0.26
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 +1 -1
- package/utils/sandbox.js +35 -7
package/package.json
CHANGED
package/utils/sandbox.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { mkdtempSync, rmSync, cpSync, existsSync, mkdirSync, writeFileSync, symlinkSync } from 'fs';
|
|
1
|
+
import { mkdtempSync, rmSync, cpSync, existsSync, mkdirSync, writeFileSync, symlinkSync, realpathSync } from 'fs';
|
|
2
2
|
import { tmpdir, homedir, platform } from 'os';
|
|
3
3
|
import { join, resolve } from 'path';
|
|
4
4
|
import { spawn, execSync } from 'child_process';
|
|
@@ -144,7 +144,7 @@ export function createSandbox(projectDir) {
|
|
|
144
144
|
const settingsPath = join(hostClaudeDir, 'settings.json');
|
|
145
145
|
if (existsSync(settingsPath)) {
|
|
146
146
|
const settings = JSON.parse(readFileSync(settingsPath, 'utf8'));
|
|
147
|
-
if (settings.hooks) {
|
|
147
|
+
if (false && settings.hooks) {
|
|
148
148
|
console.log('✅ Linked to host Claude settings directory');
|
|
149
149
|
console.log('📋 Hooks configured:');
|
|
150
150
|
Object.keys(settings.hooks).forEach(hookType => {
|
|
@@ -182,14 +182,42 @@ export function createSandbox(projectDir) {
|
|
|
182
182
|
const sandboxFile = join(sandboxClaudeDir, file);
|
|
183
183
|
|
|
184
184
|
if (existsSync(hostFile) && hostFile !== sandboxFile) {
|
|
185
|
+
// Additional check using real paths to detect symlink/bind mount issues
|
|
186
|
+
let shouldCopy = true;
|
|
187
|
+
try {
|
|
188
|
+
const hostRealPath = realpathSync(hostFile);
|
|
189
|
+
const sandboxRealPath = realpathSync(sandboxFile);
|
|
190
|
+
if (hostRealPath === sandboxRealPath) {
|
|
191
|
+
shouldCopy = false;
|
|
192
|
+
}
|
|
193
|
+
} catch (e) {
|
|
194
|
+
// If we can't resolve real paths, proceed with copy attempt
|
|
195
|
+
}
|
|
196
|
+
|
|
185
197
|
if (VERBOSE_OUTPUT) {
|
|
186
198
|
console.log(` Copying ${file}: ${hostFile} -> ${sandboxFile}`);
|
|
199
|
+
console.log(` Path comparison: hostFile === sandboxFile = ${hostFile === sandboxFile}`);
|
|
200
|
+
console.log(` Host file exists: ${existsSync(hostFile)}`);
|
|
201
|
+
console.log(` Sandbox file exists: ${existsSync(sandboxFile)}`);
|
|
202
|
+
try {
|
|
203
|
+
const hostRealPath = realpathSync(hostFile);
|
|
204
|
+
const sandboxRealPath = realpathSync(sandboxFile);
|
|
205
|
+
console.log(` Real paths: host=${hostRealPath}, sandbox=${sandboxRealPath}`);
|
|
206
|
+
console.log(` Real path comparison: hostRealPath === sandboxRealPath = ${hostRealPath === sandboxRealPath}`);
|
|
207
|
+
} catch (e) {
|
|
208
|
+
console.log(` Real path check failed: ${e.message}`);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
if (shouldCopy) {
|
|
213
|
+
cpSync(hostFile, sandboxFile);
|
|
214
|
+
} else if (VERBOSE_OUTPUT) {
|
|
215
|
+
console.log(` Skipping copy - real paths are the same`);
|
|
187
216
|
}
|
|
188
|
-
cpSync(hostFile, sandboxFile);
|
|
189
217
|
if (VERBOSE_OUTPUT && file === 'settings.json') {
|
|
190
218
|
// Show hook information for copied settings
|
|
191
|
-
const settings = JSON.parse(readFileSync(hostFile, 'utf8'));
|
|
192
|
-
if (settings.hooks) {
|
|
219
|
+
// const settings = JSON.parse(readFileSync(hostFile, 'utf8'));
|
|
220
|
+
if (false && settings.hooks) {
|
|
193
221
|
console.log('📋 Hooks configured in copied settings:');
|
|
194
222
|
Object.keys(settings.hooks).forEach(hookType => {
|
|
195
223
|
const hookCount = settings.hooks[hookType].length;
|
|
@@ -207,8 +235,8 @@ export function createSandbox(projectDir) {
|
|
|
207
235
|
}
|
|
208
236
|
if (VERBOSE_OUTPUT && file === 'settings.json') {
|
|
209
237
|
// Show hook information for existing settings
|
|
210
|
-
const settings = JSON.parse(readFileSync(hostFile, 'utf8'));
|
|
211
|
-
if (settings.hooks) {
|
|
238
|
+
// const settings = JSON.parse(readFileSync(hostFile, 'utf8'));
|
|
239
|
+
if (false && settings.hooks) {
|
|
212
240
|
console.log('📋 Hooks configured in existing settings:');
|
|
213
241
|
Object.keys(settings.hooks).forEach(hookType => {
|
|
214
242
|
const hookCount = settings.hooks[hookType].length;
|