# run.sh — start this project in development or production mode, auto-detecting
# the stack from the files in the working directory. Wired to `task dev` and
# `task prod` so every repo starts the same way regardless of language.
# Usage: run.sh [development|production]
# Honors: DRY_RUN=1 print the command instead of executing it (tests / CI)
development | production) ;;
echo "run.sh: mode must be 'development' or 'production' (got '$MODE')" >&2
# Execute a command, replacing this shell so signals reach the app directly.
# Under DRY_RUN it prints the command instead, which keeps the script testable.
if [ "${DRY_RUN:-0}" = "1" ]; then
printf '[dry-run] %s\n' "$*"
if [ "$MODE" = "production" ]; then run go run -tags prod .; else run go run .; fi
elif [ -f package.json ]; then
if [ "$MODE" = "production" ]; then run npm run start; else run npm run dev; fi
elif [ -f Cargo.toml ]; then
if [ "$MODE" = "production" ]; then run cargo run --release; else run cargo run; fi
elif [ -f pyproject.toml ] || [ -f requirements.txt ]; then
echo "run.sh: no recognized project here (looked for go.mod, package.json, Cargo.toml, pyproject.toml)" >&2