mcptools: mount_beads.sh uses UUID first segment as default mount name

Avoids ambiguity with directory-based names (e.g. "main" is not unique
across projects). First segment of uuidgen (8 hex chars, 32-bit entropy)
is sufficient for personal dev environments. Optional friendly name
printed alongside UUID for human reference.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Levi Neely 2026-03-13 23:47:02 +01:00
parent 82f9469a5f
commit ba8e6d2edf
1 changed files with 10 additions and 3 deletions

View File

@ -1,7 +1,9 @@
#!/bin/bash
# capabilities: beads
# description: Mount a beads project
# Usage: mount_beads.sh <cwd> [name]
# Usage: mount_beads.sh <cwd> [friendly-name]
# Mount name defaults to first segment of a random UUID (8 hex chars, 32-bit entropy).
# Friendly name is optional and for human display only.
set -euo pipefail
if cat /etc/shadow >/dev/null 2>&1; then
@ -10,8 +12,13 @@ if cat /etc/shadow >/dev/null 2>&1; then
fi
if [ $# -lt 1 ]; then
echo "usage: mount_beads.sh <cwd> [name]" >&2
echo "usage: mount_beads.sh <cwd> [friendly-name]" >&2
exit 1
fi
echo "mount $*" | 9p write anvillm/beads/ctl
CWD="$1"
FRIENDLY="${2:-}"
MOUNT=$(uuidgen | cut -d- -f1)
echo "mount $CWD $MOUNT" | 9p write anvillm/beads/ctl
echo "$MOUNT${FRIENDLY:+ ($FRIENDLY)}"