diff options
| author | Olcan <[email protected]> | 2025-05-09 11:33:05 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-05-09 11:33:05 -0700 |
| commit | 92c1279de665055561be9c789a1d12439daa8a3c (patch) | |
| tree | e09cdee19e423ad88d38f258daca5732b47fff77 /packages/cli/src/utils/sandbox.ts | |
| parent | b8fa38a6e8f60acf6489fde545a91d3ba4c395d7 (diff) | |
sandbox/seatbelt-aware system prompt, support for custom seatbelt profiles under project settings (#304)
Diffstat (limited to 'packages/cli/src/utils/sandbox.ts')
| -rw-r--r-- | packages/cli/src/utils/sandbox.ts | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/packages/cli/src/utils/sandbox.ts b/packages/cli/src/utils/sandbox.ts index 73f50e83..3e766755 100644 --- a/packages/cli/src/utils/sandbox.ts +++ b/packages/cli/src/utils/sandbox.ts @@ -152,6 +152,21 @@ export async function start_sandbox(sandbox: string) { process.exit(1); } const profile = (process.env.SEATBELT_PROFILE ??= 'minimal'); + let profileFile = new URL(`sandbox-macos-${profile}.sb`, import.meta.url) + .pathname; + // if profile is anything other than 'minimal' or 'strict', then look for the profile file under the project settings directory + if (profile !== 'minimal' && profile !== 'strict') { + profileFile = path.join( + SETTINGS_DIRECTORY_NAME, + `sandbox-macos-${profile}.sb`, + ); + } + if (!fs.existsSync(profileFile)) { + console.error( + `ERROR: missing macos seatbelt profile file '${profileFile}'`, + ); + process.exit(1); + } console.log(`using macos seatbelt (profile: ${profile}) ...`); // if DEBUG is set, convert to --inspect-brk in NODE_OPTIONS if (process.env.DEBUG) { @@ -166,7 +181,7 @@ export async function start_sandbox(sandbox: string) { '-D', `HOME_DIR=${fs.realpathSync(os.homedir())}`, '-f', - new URL(`sandbox-macos-${profile}.sb`, import.meta.url).pathname, + profileFile, 'bash', '-c', [ |
