#!/bin/bash
# Build and run lf from the current repo's source tree.
# Usage: scripts/dev-lf [args...]   e.g.  scripts/dev-lf design
#
# Run directly — do NOT use `uv run scripts/dev-lf` (uv mangles args
# and breaks TTY passthrough for interactive agents).
set -e
set -o pipefail

REPO="$(git rev-parse --show-toplevel)"
export RUST_LOG="${RUST_LOG:-lf=debug,loopflow=debug}"
cargo build -p loopflow --bin lf --manifest-path "$REPO/Cargo.toml" </dev/null 2>&1 | grep -E '^   Compiling|^    Finished|^error' >&2
echo "running: $REPO/target/debug/lf $*" >&2
exec "$REPO/target/debug/lf" "$@"
