feat(widget): add Sandbox Status widget#481
Open
CorticalCode wants to merge 1 commit into
Open
Conversation
Shows whether Claude Code's bash sandbox mode is enabled, read from the effective sandbox.enabled setting across the layered Claude config (project-local -> project -> user-local -> user). Because /sandbox persists its toggle to .claude/settings.local.json, the widget reflects runtime toggles on each status refresh, not just the configured default.
Display modes (cycle 'f'): glyph 'SB: dot' (default), text 'SB: ON/OFF', word 'Sandbox: ON/OFF', bare glyph-only; optional Nerd Font lock glyphs ('n'). Standard per-widget color picker; raw value on/off for composition.
Reuses the layered-settings candidate-path reader shared with getVoiceConfig.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What
Adds a Sandbox Status widget that shows whether Claude Code's bash sandbox mode is currently enabled. Implements the request in #104.
Why it reads settings (not the status JSON)
Sandbox state isn't in the status-line JSON, and there's no environment variable for it — it's a runtime property of the Bash tool. The one durable source is
sandbox.enabledin Claude Code's settings, and/sandboxpersists its toggle to<cwd>/.claude/settings.local.json. So reading the effective setting on each refresh tracks the live state, not just a static default.The widget reads
sandbox.enabledacross the same layered config the Voice widget already uses (project-local → project → user-local → user, honoringCLAUDE_CONFIG_DIR) — it deliberately mirrorsgetVoiceConfig.Display & config
f):SB: ●/○(default),SB: ON/OFF,Sandbox: ON/OFF, and bare●/○. Optional Nerd Font lock/unlock glyphs (n).on/offfor composition.Defaults (calling these out so they're easy to change)
SB: ●/○.Implementation notes
getSandboxConfiglives inclaude-settings.tsnext togetVoiceConfig; the widget (src/widgets/SandboxStatus.ts) mirrorsVoiceStatus.ts.getVoiceConfigCandidatePathsByPriority→getLayeredSettingsCandidatePathsByPriorityso voice and sandbox share it.getVoiceConfig's behavior is unchanged (its existing tests still pass). The per-layer read (tryReadSandboxLayer) is kept parallel to the voice one rather than fully generalized.Tests
Widget tests (every format, nerd font, raw, preview, null-hide, cwd resolution) and
getSandboxConfiglayering tests (precedence, malformed/absent handling,CLAUDE_CONFIG_DIR). Full suite green, lint clean.Possible follow-up (not in this PR)
Letting the color encode state — green when on, red when off, chosen through the existing picker — would be a general "per-state / conditional color" capability that belongs in the shared color system rather than this one widget, so it's deliberately out of scope here.