feat: add --readonly flag for worker sandboxes (gt-ymo)
Add a --readonly flag that blocks all write operations, allowing workers to read beads state without modifying it. Workers can use: - bd show, bd list, bd ready (read operations) Workers cannot use: - bd create, bd update, bd close, bd sync, etc. (write operations) The flag can be set via: - --readonly flag on command line - BD_READONLY=true environment variable - readonly: true in config file This enables swarm workers to see their assigned work from a static snapshot of the beads database without accidentally modifying it. Commands protected by readonly mode: - create, update, close, delete, edit - sync, import, reopen - comment add, dep add/remove, label add/remove - repair-deps, compact, migrate, migrate-hash-ids, migrate-issues - rename-prefix, validate --fix-all, duplicates --auto-merge - epic close-eligible, jira sync 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -456,6 +456,7 @@ var updateCmd = &cobra.Command{
|
||||
Short: "Update one or more issues",
|
||||
Args: cobra.MinimumNArgs(1),
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
CheckReadonly("update")
|
||||
jsonOutput, _ := cmd.Flags().GetBool("json")
|
||||
updates := make(map[string]interface{})
|
||||
|
||||
@@ -717,6 +718,7 @@ Examples:
|
||||
bd edit bd-42 --acceptance # Edit acceptance criteria`,
|
||||
Args: cobra.ExactArgs(1),
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
CheckReadonly("edit")
|
||||
id := args[0]
|
||||
ctx := rootCtx
|
||||
|
||||
@@ -904,6 +906,7 @@ var closeCmd = &cobra.Command{
|
||||
Short: "Close one or more issues",
|
||||
Args: cobra.MinimumNArgs(1),
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
CheckReadonly("close")
|
||||
reason, _ := cmd.Flags().GetString("reason")
|
||||
if reason == "" {
|
||||
reason = "Closed"
|
||||
|
||||
Reference in New Issue
Block a user