beads: add --id lookup to search_beads.sh

This commit is contained in:
Levi Neely 2026-03-19 10:25:39 +01:00
parent 2b7f663599
commit 868638afc0
2 changed files with 24 additions and 2 deletions

View File

@ -2,22 +2,38 @@
# capabilities: beads
# description: Search beads by id, title, or description content. Filters by scope derived from cwd.
# Usage: search_beads.sh --mount <mount> --query <query>
# search_beads.sh --mount <mount> --id <bead-id>
set -euo pipefail
MOUNT=""
QUERY=""
BEAD_ID=""
while [[ $# -gt 0 ]]; do
case "$1" in
--mount) MOUNT="$2"; shift 2 ;;
--query) QUERY="$2"; shift 2 ;;
--id) BEAD_ID="$2"; shift 2 ;;
*) echo "unknown argument: $1" >&2; exit 1 ;;
esac
done
if [ -z "$MOUNT" ] || [ -z "$QUERY" ]; then
if [ -z "$MOUNT" ]; then
echo "usage: search_beads.sh --mount <mount> --query <query>" >&2
echo " search_beads.sh --mount <mount> --id <bead-id>" >&2
exit 1
fi
# Direct ID lookup
if [ -n "$BEAD_ID" ]; then
9p read "anvillm/beads/$MOUNT/$BEAD_ID/json" 2>/dev/null || echo "null"
exit 0
fi
if [ -z "$QUERY" ]; then
echo "usage: search_beads.sh --mount <mount> --query <query>" >&2
echo " search_beads.sh --mount <mount> --id <bead-id>" >&2
exit 1
fi

View File

@ -71,7 +71,13 @@ Search beads by id, title, or description (includes closed):
Tool: execute_code
tool: search_beads.sh
args: ["--mount", "<mount>", "--query", "<query>"]
sandbox: default
```
Lookup bead by ID:
```
Tool: execute_code
tool: search_beads.sh
args: ["--mount", "<mount>", "--id", "<id>"]
```
**Note:** `list_beads.sh` and `list_ready_beads.sh` only return open beads. To find closed beads, use `search_beads.sh`.