scripts: add bd wrapper to x/; prepend $OLLIE/x/ to PATH in execute server

The bd wrapper walks up from CWD to find a .beads directory and sets
BEADS_DIR, so bd works from any subdirectory of a monorepo without the
model needing to know about it.

The execute server now always prepends $OLLIE/x/ to PATH for tool
subprocesses, so wrappers placed there shadow system binaries transparently.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Levi Neely 2026-04-19 11:07:15 +02:00
parent 6165ed86e3
commit 78cd60581d
2 changed files with 16 additions and 1 deletions

3
mkfile
View File

@ -48,7 +48,8 @@ scripts:V:
cp -f scripts/b/cleanup $HOME/.config/ollie/scripts/b/cleanup
cp -f scripts/u/optimize $HOME/.config/ollie/scripts/u/optimize
cp -f scripts/x/elevate $HOME/.config/ollie/scripts/x/elevate
chmod 755 $HOME/.config/ollie/scripts/u/optimize $HOME/.config/ollie/scripts/x/elevate
cp -f scripts/x/bd $HOME/.config/ollie/scripts/x/bd
chmod 755 $HOME/.config/ollie/scripts/u/optimize $HOME/.config/ollie/scripts/x/elevate $HOME/.config/ollie/scripts/x/bd
help:V:
echo 'Ollie monorepo build targets:'

14
scripts/x/bd Normal file
View File

@ -0,0 +1,14 @@
#!/bin/bash
# Wrapper for bd that resolves BEADS_DIR by walking up from CWD when unset.
# Placed in $OLLIE/x/ so it shadows the real bd on PATH for tool subprocesses.
if [ -z "$BEADS_DIR" ]; then
dir="$PWD"
while [ "$dir" != "/" ]; do
if [ -d "$dir/.beads" ]; then
export BEADS_DIR="$dir/.beads"
break
fi
dir="$(dirname "$dir")"
done
fi
exec "$HOME/.local/bd" "$@"