default:
  @just --list

act:
  act --pull=false

init:
  cargo install sea-orm-cli@^2.0.0-rc

db-migrate:
  cd crates && \
  rm temp.db || true && \
  touch temp.db && \
  sea-orm-cli migrate -u sqlite://temp.db && \
  sea-orm-cli generate entity \
  -u sqlite://temp.db \
  -o ../src-tauri/src/db/entities \
  --with-serde both \
  --date-time-crate chrono \
  --with-prelude all-allow-unused-imports \
  --model-extra-attributes 'allow(dead_code)' \
  --enum-extra-attributes 'allow(dead_code)'

  rm crates/temp.db

start-vnc:
    @echo "Run the manual VNC start script"
    bash .devcontainer/manual-start-vnc.sh

stop-vnc:
    @echo "Stop x11vnc and novnc proxy"
    pkill -f x11vnc || true
    pkill -f novnc_proxy || true

dev DISPLAY='1':
    # Note: this assumes that the VNC server is running and accessible at DISPLAY=:1
    # Check the start-vnc output for the correct DISPLAY value if you have multiple VNC sessions running
    DISPLAY=:{{DISPLAY}} pnpm tauri dev

test-cargo-integration:
    cargo test \
      --package otter integration_tests \
      -- --ignored

# docker images for ci
DOCKER_IMAGE_NAME := 'gitea.gwmc.dev/otter/otter-ci:latest'

build-ci-image:
  docker build -t {{DOCKER_IMAGE_NAME}} -f .github/Dockerfile .

push-ci-image:
  docker push {{DOCKER_IMAGE_NAME}}

update-ci-image: build-ci-image push-ci-image

pull-ci-image:
  docker pull {{DOCKER_IMAGE_NAME}}
