Add --sandbox flag for Claude Code sandbox mode

- New --sandbox flag combines --no-daemon, --no-auto-flush, --no-auto-import
- Disables daemon and auto-sync for network-restricted environments
- Document sandbox mode workaround in TROUBLESHOOTING.md
- Addresses #112
This commit is contained in:
Steve Yegge
2025-10-23 17:22:10 -07:00
parent 80dc536256
commit c4d4a852fa
2 changed files with 39 additions and 0 deletions

View File

@@ -334,6 +334,36 @@ ps aux | grep "bd daemon"
See [integrations/beads-mcp/README.md](integrations/beads-mcp/README.md) for MCP-specific troubleshooting. See [integrations/beads-mcp/README.md](integrations/beads-mcp/README.md) for MCP-specific troubleshooting.
### Claude Code sandbox mode
**Issue:** Claude Code's sandbox restricts network access to a single socket, conflicting with bd's daemon and git operations.
**Solution:** Use the `--sandbox` flag:
```bash
# Sandbox mode disables daemon and auto-sync
bd --sandbox ready
bd --sandbox create "Fix bug" -p 1
bd --sandbox update bd-42 --status in_progress
# Or set individual flags
bd --no-daemon --no-auto-flush --no-auto-import <command>
```
**What sandbox mode does:**
- Disables daemon (uses direct SQLite mode)
- Disables auto-export to JSONL
- Disables auto-import from JSONL
- Allows bd to work in network-restricted environments
**Note:** You'll need to manually sync when outside the sandbox:
```bash
# After leaving sandbox, sync manually
bd sync
```
**Related:** See [Claude Code sandboxing documentation](https://www.anthropic.com/engineering/claude-code-sandboxing) for more about sandbox restrictions.
## Platform-Specific Issues ## Platform-Specific Issues
### Windows: Path issues ### Windows: Path issues

View File

@@ -88,6 +88,13 @@ var rootCmd = &cobra.Command{
return return
} }
// If sandbox mode is set, enable all sandbox flags
if sandboxMode {
noDaemon = true
noAutoFlush = true
noAutoImport = true
}
// Set auto-flush based on flag (invert no-auto-flush) // Set auto-flush based on flag (invert no-auto-flush)
autoFlushEnabled = !noAutoFlush autoFlushEnabled = !noAutoFlush
@@ -1341,6 +1348,7 @@ func flushToJSONL() {
var ( var (
noAutoFlush bool noAutoFlush bool
noAutoImport bool noAutoImport bool
sandboxMode bool
) )
func init() { func init() {
@@ -1350,6 +1358,7 @@ func init() {
rootCmd.PersistentFlags().BoolVar(&noDaemon, "no-daemon", false, "Force direct storage mode, bypass daemon if running") rootCmd.PersistentFlags().BoolVar(&noDaemon, "no-daemon", false, "Force direct storage mode, bypass daemon if running")
rootCmd.PersistentFlags().BoolVar(&noAutoFlush, "no-auto-flush", false, "Disable automatic JSONL sync after CRUD operations") rootCmd.PersistentFlags().BoolVar(&noAutoFlush, "no-auto-flush", false, "Disable automatic JSONL sync after CRUD operations")
rootCmd.PersistentFlags().BoolVar(&noAutoImport, "no-auto-import", false, "Disable automatic JSONL import when newer than DB") rootCmd.PersistentFlags().BoolVar(&noAutoImport, "no-auto-import", false, "Disable automatic JSONL import when newer than DB")
rootCmd.PersistentFlags().BoolVar(&sandboxMode, "sandbox", false, "Sandbox mode: disables daemon and auto-sync (equivalent to --no-daemon --no-auto-flush --no-auto-import)")
} }
// createIssuesFromMarkdown parses a markdown file and creates multiple issues // createIssuesFromMarkdown parses a markdown file and creates multiple issues