#!/usr/bin/env bash
# Invoke the ResumeBuilder engine CLI.
#
# RESUMEBUILDER_TOOLS_MODE=dev  -> run unpackaged local code via `uv run -m`
# anything else / unset          -> run the published package via `uvx`
#
# This is the single entry point referenced by skills. The version lives
# only here (production branch) and in python_engine/cli_invoke.py.
set -euo pipefail

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"

MODE="${RESUMEBUILDER_TOOLS_MODE:-production}"

if [[ "$MODE" == "dev" ]]; then
    # Dev mode: run unpackaged local code. No publish / version bump required.
    exec uv run --directory "$REPO_ROOT" -m python_engine.resume_tools "$@"
else
    # Production mode: run the latest published package.
    exec uvx resumebuilder-tools@latest "$@"
fi
