#!/usr/bin/env bash
#
# Install or update the zed-eval Python CLI as an editable uv tool.
#
# Usage:
#   crates/eval_cli/script/install-zed-eval
#
# After this, `zed-eval` is available on PATH (assuming uv's tool bin directory
# is on PATH) and tracks changes in crates/eval_cli/zed_eval without reinstalling.

set -euo pipefail

SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
REPO_ROOT="$(cd "$SCRIPT_DIR/../../.." && pwd)"
PACKAGE_DIR="$REPO_ROOT/crates/eval_cli/zed_eval"

if ! command -v uv >/dev/null 2>&1; then
    echo "error: uv is required to install zed-eval" >&2
    echo "Install uv from https://docs.astral.sh/uv/getting-started/installation/" >&2
    exit 1
fi

uv tool install --editable "$PACKAGE_DIR" --force

echo ""
echo "Installed zed-eval from $PACKAGE_DIR"
echo "If your shell cannot find 'zed-eval', run: uv tool update-shell"
