#!/bin/bash
# Ensure UTF-8 everywhere (console and Python), including on Windows msys/cygwin
case "$OSTYPE" in
  msys*|cygwin*)
    if command -v chcp.com >/dev/null 2>&1; then
      chcp.com 65001 >NUL 2>NUL || chcp.com 65001 >/dev/null 2>&1
    fi
    ;;
  *)
    :
    ;;
esac
export LANG=C.UTF-8
export LC_ALL=C.UTF-8
export PYTHONUTF8=1
export PYTHONIOENCODING=UTF-8

set -x

# cd to the directory of the script
cd "$(dirname "$0")"

rm -rf .venv
rm -rf .build
rm -rf .pio
rm -rf .pio_cache
rm -rf ci/tmp
rm -rf tests/.build

rm -rf .*_cache
rm -rf __pycache__
rm -rf .tools

# JavaScript linting cleanup
rm -rf .js-tools

rm -rf ci/__pycache__
rm -rf ci/.*_cache



# remove any CMakeCache.txt files
find . -name "CMakeCache.txt" -type f -delete
rm -f uv.lock

# Remove generated compile_commands.json
rm -f compile_commands.json
