feat(cli): Allow SEATBELT profiles in user settings directory #554
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description:
This PR enhances the SEATBELT profile resolution logic to support both project-local and global user profiles. Specifically, the resolver now:
This change enables users to define and reuse global SEATBELT sandbox profiles across multiple projects — eliminating the need to duplicate profile files in every project directory.
Background:
Currently, SEATBELT supports the following predefined profiles:
As documented in
docs/sandbox.md
, users may also define custom profiles via theSEATBELT_PROFILE
environment variable. However, the system previously only looked for custom profile files (e.g.,sandbox-macos-<profile>.sb
) within<project>/.qwen/name.sb
. If the file was absent, resolution would fail — even if a valid profile existed in the user’s global settings directory.Impact:
With this change, users can now place commonly used sandbox profiles in their global
~/.qwen/
directory and reference them from any project — streamlining setup and reducing redundancy.Reviewer Test Plan
This only applies to macOS (because Seatbelt).
~/.qwen
. You may copy and modify one e.g.packages/cli/src/utils/sandbox-macos-permissive-open.sb
into~/.qwen/sandbox-macos-custom.sb
,SEATBELT_PROFILE=custom qwen -s
,macOS Seatbelt (custom)
in the status.Fixes #559