#!/bin/bash source .venv/bin/activate if [ -f .env ]; then source .env export REPLICATE_API_TOKEN else echo "No .env file found." echo "Write a .env file with the variables: REPLICATE_API_TOKEN" fi case "$1" in "") data_dir=$(realpath ./local-data) mkdir -p $data_dir python backend/src/app.py $data_dir ;; "cli") node cli/main.js "$2" ;; "test") # Setup test data directory data_dir=$(realpath ./test-data) mkdir -p $data_dir rm -rf $data_dir/* # Start backend in the background python backend/src/app.py $data_dir & BACKEND_PID=$! echo "Started backend: $BACKEND_PID" sleep 5 # Run tests cd testing bash signup.sh #node login.js node suite.js # Finalize the backend server kill $BACKEND_PID ;; "watch") # requires 'inotify-tools' package cd frontend while inotifywait -r -e modify,create,delete lib; do flutter build web done ;; *) if [ -d "$1" ]; then data_dir=$(realpath $1) python backend/src/app.py $data_dir else echo "Error: unknown command or directory '$1'" fi ;; esac