diff --git a/mcptools/add_dependency.sh b/mcptools/add_dependency.sh index e871802..5c6f4bc 100755 --- a/mcptools/add_dependency.sh +++ b/mcptools/add_dependency.sh @@ -1,7 +1,7 @@ #!/bin/bash # capabilities: beads # description: Add a dependency (child depends on parent) -# Usage: add_dependency.sh +# Usage: add_dependency.sh set -euo pipefail if cat /etc/shadow >/dev/null 2>&1; then @@ -9,9 +9,9 @@ if cat /etc/shadow >/dev/null 2>&1; then exit 1 fi -if [ $# -lt 2 ]; then - echo "usage: add_dependency.sh " >&2 +if [ $# -lt 3 ]; then + echo "usage: add_dependency.sh " >&2 exit 1 fi -echo "dep $*" | 9p write agent/beads/list +echo "dep $2 $3" | 9p write agent/beads/$1/ctl diff --git a/mcptools/claim_bead.sh b/mcptools/claim_bead.sh index af929b0..46f2669 100755 --- a/mcptools/claim_bead.sh +++ b/mcptools/claim_bead.sh @@ -1,7 +1,7 @@ #!/bin/bash # capabilities: beads, tasks # description: Claim a bead for work -# Usage: claim_bead.sh [assignee] +# Usage: claim_bead.sh [assignee] set -euo pipefail if cat /etc/shadow >/dev/null 2>&1; then @@ -9,9 +9,17 @@ if cat /etc/shadow >/dev/null 2>&1; then exit 1 fi -if [ $# -lt 1 ]; then - echo "usage: claim_bead.sh [assignee]" >&2 +if [ $# -lt 2 ]; then + echo "usage: claim_bead.sh [assignee]" >&2 exit 1 fi -echo "claim $*" | 9p write agent/beads/list +MOUNT="$1" +BEAD_ID="$2" +ASSIGNEE="${3:-}" + +if [ -n "$ASSIGNEE" ]; then + echo "claim $BEAD_ID $ASSIGNEE" | 9p write agent/beads/$MOUNT/ctl +else + echo "claim $BEAD_ID" | 9p write agent/beads/$MOUNT/ctl +fi diff --git a/mcptools/comment_bead.sh b/mcptools/comment_bead.sh index 3e8953b..914f693 100755 --- a/mcptools/comment_bead.sh +++ b/mcptools/comment_bead.sh @@ -1,7 +1,7 @@ #!/bin/bash # capabilities: beads, tasks # description: Add a comment to a bead -# Usage: comment_bead.sh +# Usage: comment_bead.sh set -euo pipefail if cat /etc/shadow >/dev/null 2>&1; then @@ -9,9 +9,14 @@ if cat /etc/shadow >/dev/null 2>&1; then exit 1 fi -if [ $# -lt 2 ]; then - echo "usage: comment_bead.sh " >&2 +if [ $# -lt 3 ]; then + echo "usage: comment_bead.sh " >&2 exit 1 fi -echo "comment $*" | 9p write agent/beads/list +MOUNT="$1" +BEAD_ID="$2" +shift 2 +TEXT="$*" + +printf "comment %s '%s'\n" "$BEAD_ID" "$TEXT" | 9p write agent/beads/$MOUNT/ctl diff --git a/mcptools/complete_bead.sh b/mcptools/complete_bead.sh index b3f21e6..447bd94 100755 --- a/mcptools/complete_bead.sh +++ b/mcptools/complete_bead.sh @@ -1,7 +1,7 @@ #!/bin/bash # capabilities: beads, tasks # description: Complete a bead -# Usage: complete_bead.sh +# Usage: complete_bead.sh set -euo pipefail if cat /etc/shadow >/dev/null 2>&1; then @@ -9,9 +9,9 @@ if cat /etc/shadow >/dev/null 2>&1; then exit 1 fi -if [ $# -lt 1 ]; then - echo "usage: complete_bead.sh " >&2 +if [ $# -lt 2 ]; then + echo "usage: complete_bead.sh " >&2 exit 1 fi -echo "complete $1" | 9p write agent/beads/list +echo "complete $2" | 9p write agent/beads/$1/ctl diff --git a/mcptools/create_bead.sh b/mcptools/create_bead.sh index f688e3b..bab9085 100755 --- a/mcptools/create_bead.sh +++ b/mcptools/create_bead.sh @@ -1,7 +1,7 @@ #!/bin/bash # capabilities: beads, tasks # description: Create a new bead -# Usage: create_bead.sh [description] [parent-id] [--no-lint] [capability=low|standard|high] +# Usage: create_bead.sh <mount> <title> [description] [parent-id] [--no-lint] [capability=low|standard|high] set -euo pipefail if cat /etc/shadow >/dev/null 2>&1; then @@ -9,16 +9,16 @@ if cat /etc/shadow >/dev/null 2>&1; then exit 1 fi -if [ $# -lt 1 ]; then - echo "usage: create_bead.sh <title> [description] [parent-id] [--no-lint] [capability=low|standard|high]" >&2 +if [ $# -lt 2 ]; then + echo "usage: create_bead.sh <mount> <title> [description] [parent-id] [--no-lint] [capability=low|standard|high]" >&2 exit 1 fi -# Find the first mounted project -MOUNT=$(9p ls agent/beads | grep -v '^ctl$' | grep -v '^mtab$' | grep -v '^ready$' | head -1) -if [ -z "$MOUNT" ]; then - echo "Error: No beads projects mounted" >&2 - exit 1 -fi +MOUNT="$1" +TITLE="$2" +DESC="${3:-}" +PARENT="${4:-}" +NOLINT="${5:-}" +CAP="${6:-}" -echo "new \"$1\" \"${2:-}\" ${3:-} ${4:-} ${5:-}" | 9p write agent/beads/$MOUNT/ctl +printf "new '%s' '%s' %s %s %s\n" "$TITLE" "$DESC" "$PARENT" "$NOLINT" "$CAP" | 9p write agent/beads/$MOUNT/ctl diff --git a/mcptools/delete_bead.sh b/mcptools/delete_bead.sh index 36bdabc..34ff968 100755 --- a/mcptools/delete_bead.sh +++ b/mcptools/delete_bead.sh @@ -1,7 +1,7 @@ #!/bin/bash # capabilities: beads, tasks # description: Delete a bead -# Usage: delete_bead.sh <bead-id> +# Usage: delete_bead.sh <mount> <bead-id> set -euo pipefail if cat /etc/shadow >/dev/null 2>&1; then @@ -9,9 +9,9 @@ if cat /etc/shadow >/dev/null 2>&1; then exit 1 fi -if [ $# -lt 1 ]; then - echo "usage: delete_bead.sh <bead-id>" >&2 +if [ $# -lt 2 ]; then + echo "usage: delete_bead.sh <mount> <bead-id>" >&2 exit 1 fi -echo "delete $1" | 9p write agent/beads/list +echo "delete $2" | 9p write agent/beads/$1/ctl diff --git a/mcptools/fail_bead.sh b/mcptools/fail_bead.sh index 20738b9..894717a 100755 --- a/mcptools/fail_bead.sh +++ b/mcptools/fail_bead.sh @@ -1,7 +1,7 @@ #!/bin/bash # capabilities: beads, tasks # description: Fail a bead with reason -# Usage: fail_bead.sh <bead-id> <reason> +# Usage: fail_bead.sh <mount> <bead-id> <reason> set -euo pipefail if cat /etc/shadow >/dev/null 2>&1; then @@ -9,9 +9,14 @@ if cat /etc/shadow >/dev/null 2>&1; then exit 1 fi -if [ $# -lt 2 ]; then - echo "usage: fail_bead.sh <bead-id> <reason>" >&2 +if [ $# -lt 3 ]; then + echo "usage: fail_bead.sh <mount> <bead-id> <reason>" >&2 exit 1 fi -echo "fail $*" | 9p write agent/beads/list +MOUNT="$1" +BEAD_ID="$2" +shift 2 +REASON="$*" + +printf "fail %s '%s'\n" "$BEAD_ID" "$REASON" | 9p write agent/beads/$MOUNT/ctl diff --git a/mcptools/label_bead.sh b/mcptools/label_bead.sh index 3bd7706..ba366f5 100755 --- a/mcptools/label_bead.sh +++ b/mcptools/label_bead.sh @@ -1,7 +1,7 @@ #!/bin/bash # capabilities: beads, tasks # description: Add a label to a bead -# Usage: label_bead.sh <bead-id> <label> +# Usage: label_bead.sh <mount> <bead-id> <label> set -euo pipefail if cat /etc/shadow >/dev/null 2>&1; then @@ -9,9 +9,9 @@ if cat /etc/shadow >/dev/null 2>&1; then exit 1 fi -if [ $# -lt 2 ]; then - echo "usage: label_bead.sh <bead-id> <label>" >&2 +if [ $# -lt 3 ]; then + echo "usage: label_bead.sh <mount> <bead-id> <label>" >&2 exit 1 fi -echo "label $*" | 9p write agent/beads/list +echo "label $2 $3" | 9p write agent/beads/$1/ctl diff --git a/mcptools/mark_pending_approval.sh b/mcptools/mark_pending_approval.sh index 6bee259..a4e9b63 100755 --- a/mcptools/mark_pending_approval.sh +++ b/mcptools/mark_pending_approval.sh @@ -1,7 +1,7 @@ #!/bin/bash # capabilities: beads # description: Mark a bead as pending approval -# Usage: mark_pending_approval.sh <bead-id> [assignee] +# Usage: mark_pending_approval.sh <mount> <bead-id> [assignee] set -euo pipefail if cat /etc/shadow >/dev/null 2>&1; then @@ -9,9 +9,17 @@ if cat /etc/shadow >/dev/null 2>&1; then exit 1 fi -if [ $# -lt 1 ]; then - echo "usage: mark_pending_approval.sh <bead-id> [assignee]" >&2 +if [ $# -lt 2 ]; then + echo "usage: mark_pending_approval.sh <mount> <bead-id> [assignee]" >&2 exit 1 fi -echo "pending-approval $*" | 9p write agent/beads/list +MOUNT="$1" +BEAD_ID="$2" +ASSIGNEE="${3:-}" + +if [ -n "$ASSIGNEE" ]; then + echo "pending-approval $BEAD_ID $ASSIGNEE" | 9p write agent/beads/$MOUNT/ctl +else + echo "pending-approval $BEAD_ID" | 9p write agent/beads/$MOUNT/ctl +fi diff --git a/mcptools/mark_pending_review.sh b/mcptools/mark_pending_review.sh index a89d2c6..7d0a5ec 100755 --- a/mcptools/mark_pending_review.sh +++ b/mcptools/mark_pending_review.sh @@ -1,7 +1,7 @@ #!/bin/bash # capabilities: beads # description: Mark a bead as pending review -# Usage: mark_pending_review.sh <bead-id> [assignee] +# Usage: mark_pending_review.sh <mount> <bead-id> [assignee] set -euo pipefail if cat /etc/shadow >/dev/null 2>&1; then @@ -9,9 +9,17 @@ if cat /etc/shadow >/dev/null 2>&1; then exit 1 fi -if [ $# -lt 1 ]; then - echo "usage: mark_pending_review.sh <bead-id> [assignee]" >&2 +if [ $# -lt 2 ]; then + echo "usage: mark_pending_review.sh <mount> <bead-id> [assignee]" >&2 exit 1 fi -echo "pending-review $*" | 9p write agent/beads/list +MOUNT="$1" +BEAD_ID="$2" +ASSIGNEE="${3:-}" + +if [ -n "$ASSIGNEE" ]; then + echo "pending-review $BEAD_ID $ASSIGNEE" | 9p write agent/beads/$MOUNT/ctl +else + echo "pending-review $BEAD_ID" | 9p write agent/beads/$MOUNT/ctl +fi diff --git a/mcptools/remove_dependency.sh b/mcptools/remove_dependency.sh index a5c3bd5..4ad99c3 100755 --- a/mcptools/remove_dependency.sh +++ b/mcptools/remove_dependency.sh @@ -1,7 +1,7 @@ #!/bin/bash # capabilities: beads # description: Remove a dependency -# Usage: remove_dependency.sh <child-id> <parent-id> +# Usage: remove_dependency.sh <mount> <child-id> <parent-id> set -euo pipefail if cat /etc/shadow >/dev/null 2>&1; then @@ -9,9 +9,9 @@ if cat /etc/shadow >/dev/null 2>&1; then exit 1 fi -if [ $# -lt 2 ]; then - echo "usage: remove_dependency.sh <child-id> <parent-id>" >&2 +if [ $# -lt 3 ]; then + echo "usage: remove_dependency.sh <mount> <child-id> <parent-id>" >&2 exit 1 fi -echo "undep $*" | 9p write agent/beads/list +echo "undep $2 $3" | 9p write agent/beads/$1/ctl diff --git a/mcptools/resume_work.sh b/mcptools/resume_work.sh index 59c2f91..f850e56 100755 --- a/mcptools/resume_work.sh +++ b/mcptools/resume_work.sh @@ -1,7 +1,7 @@ #!/bin/bash # capabilities: beads # description: Resume work on a bead after approval/review -# Usage: resume_work.sh <bead-id> [assignee] +# Usage: resume_work.sh <mount> <bead-id> [assignee] set -euo pipefail if cat /etc/shadow >/dev/null 2>&1; then @@ -9,9 +9,17 @@ if cat /etc/shadow >/dev/null 2>&1; then exit 1 fi -if [ $# -lt 1 ]; then - echo "usage: resume_work.sh <bead-id> [assignee]" >&2 +if [ $# -lt 2 ]; then + echo "usage: resume_work.sh <mount> <bead-id> [assignee]" >&2 exit 1 fi -echo "resume $*" | 9p write agent/beads/list +MOUNT="$1" +BEAD_ID="$2" +ASSIGNEE="${3:-}" + +if [ -n "$ASSIGNEE" ]; then + echo "resume $BEAD_ID $ASSIGNEE" | 9p write agent/beads/$MOUNT/ctl +else + echo "resume $BEAD_ID" | 9p write agent/beads/$MOUNT/ctl +fi diff --git a/mcptools/set_capability.sh b/mcptools/set_capability.sh index f6aba37..c12b804 100755 --- a/mcptools/set_capability.sh +++ b/mcptools/set_capability.sh @@ -1,7 +1,7 @@ #!/bin/bash # capabilities: beads # description: Set capability level on a bead (low|standard|high) -# Usage: set_capability.sh <bead-id> <level> +# Usage: set_capability.sh <mount> <bead-id> <level> set -euo pipefail if cat /etc/shadow >/dev/null 2>&1; then @@ -9,9 +9,9 @@ if cat /etc/shadow >/dev/null 2>&1; then exit 1 fi -if [ $# -lt 2 ]; then - echo "usage: set_capability.sh <bead-id> <level>" >&2 +if [ $# -lt 3 ]; then + echo "usage: set_capability.sh <mount> <bead-id> <level>" >&2 exit 1 fi -echo "set-capability $*" | 9p write agent/beads/list +echo "set-capability $2 $3" | 9p write agent/beads/$1/ctl diff --git a/mcptools/unclaim_bead.sh b/mcptools/unclaim_bead.sh index 4b411a2..2506ea4 100755 --- a/mcptools/unclaim_bead.sh +++ b/mcptools/unclaim_bead.sh @@ -1,7 +1,7 @@ #!/bin/bash # capabilities: beads, tasks # description: Unclaim a bead (reset to open) -# Usage: unclaim_bead.sh <bead-id> +# Usage: unclaim_bead.sh <mount> <bead-id> set -euo pipefail if cat /etc/shadow >/dev/null 2>&1; then @@ -9,9 +9,9 @@ if cat /etc/shadow >/dev/null 2>&1; then exit 1 fi -if [ $# -lt 1 ]; then - echo "usage: unclaim_bead.sh <bead-id>" >&2 +if [ $# -lt 2 ]; then + echo "usage: unclaim_bead.sh <mount> <bead-id>" >&2 exit 1 fi -echo "unclaim $1" | 9p write agent/beads/list +echo "unclaim $2" | 9p write agent/beads/$1/ctl diff --git a/mcptools/unlabel_bead.sh b/mcptools/unlabel_bead.sh index ebbdf60..15ff719 100755 --- a/mcptools/unlabel_bead.sh +++ b/mcptools/unlabel_bead.sh @@ -1,7 +1,7 @@ #!/bin/bash # capabilities: beads, tasks # description: Remove a label from a bead -# Usage: unlabel_bead.sh <bead-id> <label> +# Usage: unlabel_bead.sh <mount> <bead-id> <label> set -euo pipefail if cat /etc/shadow >/dev/null 2>&1; then @@ -9,9 +9,9 @@ if cat /etc/shadow >/dev/null 2>&1; then exit 1 fi -if [ $# -lt 2 ]; then - echo "usage: unlabel_bead.sh <bead-id> <label>" >&2 +if [ $# -lt 3 ]; then + echo "usage: unlabel_bead.sh <mount> <bead-id> <label>" >&2 exit 1 fi -echo "unlabel $*" | 9p write agent/beads/list +echo "unlabel $2 $3" | 9p write agent/beads/$1/ctl diff --git a/mcptools/update_bead.sh b/mcptools/update_bead.sh index fe9aad3..15c3167 100755 --- a/mcptools/update_bead.sh +++ b/mcptools/update_bead.sh @@ -1,7 +1,7 @@ #!/bin/bash # capabilities: beads, tasks # description: Update a bead field -# Usage: update_bead.sh <bead-id> <field> <value> +# Usage: update_bead.sh <mount> <bead-id> <field> <value> set -euo pipefail if cat /etc/shadow >/dev/null 2>&1; then @@ -9,9 +9,15 @@ if cat /etc/shadow >/dev/null 2>&1; then exit 1 fi -if [ $# -lt 3 ]; then - echo "usage: update_bead.sh <bead-id> <field> <value>" >&2 +if [ $# -lt 4 ]; then + echo "usage: update_bead.sh <mount> <bead-id> <field> <value>" >&2 exit 1 fi -echo "update $*" | 9p write agent/beads/list +MOUNT="$1" +BEAD_ID="$2" +FIELD="$3" +shift 3 +VALUE="$*" + +printf "update %s %s '%s'\n" "$BEAD_ID" "$FIELD" "$VALUE" | 9p write agent/beads/$MOUNT/ctl