tools: add .beads project file as third guard for plan_* enforcement

All three conditions must hold to block plan_* in favor of bd:
  OLLIE_BEADS_ENABLE=1, bd on PATH, and .beads exists in CWD.
This makes enforcement purely opt-in per project.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Levi Neely 2026-04-19 10:47:22 +02:00
parent 112a6049d0
commit 4f3e04de13
3 changed files with 3 additions and 3 deletions

View File

@ -8,7 +8,7 @@ if len(sys.argv) < 3:
sys.exit(1)
import shutil
if os.environ.get('OLLIE_BEADS_ENABLE') == '1' and shutil.which('bd'):
if os.environ.get('OLLIE_BEADS_ENABLE') == '1' and shutil.which('bd') and os.path.exists('.beads'):
print("error: beads is available — use 'bd' for planning instead of plan_check", file=sys.stderr)
sys.exit(2)

View File

@ -4,7 +4,7 @@
# Output: plan filename in pl/
set -euo pipefail
if [ "${OLLIE_BEADS_ENABLE:-0}" = "1" ] && command -v bd >/dev/null 2>&1; then
if [ "${OLLIE_BEADS_ENABLE:-0}" = "1" ] && command -v bd >/dev/null 2>&1 && [ -f ".beads" ]; then
echo "error: beads is available — use 'bd' for planning instead of plan_create" >&2
exit 2
fi

View File

@ -4,7 +4,7 @@
# Output: new filename
set -euo pipefail
if [ "${OLLIE_BEADS_ENABLE:-0}" = "1" ] && command -v bd >/dev/null 2>&1; then
if [ "${OLLIE_BEADS_ENABLE:-0}" = "1" ] && command -v bd >/dev/null 2>&1 && [ -f ".beads" ]; then
echo "error: beads is available — use 'bd' for planning instead of plan_start" >&2
exit 2
fi