set shell := ["nix", "develop", "--command", "bash", "-c"]

# Run dev mode for both front & backend. Live reload enabled.
dev: install-deps
  cd front && bun run dev

# Install dependencies if not already installed. This is a no-op if node_modules already exists.
install-deps:
  cd front && ([ -d node_modules ] || bun install)

# Regenerate .github/docs/ from registered tools
docs:
  cd back && go run ./cmd/gendocs/

# Build the default Nix package (backend + frontend)
nix-build:
  nix build ".#packages.x86_64-linux.default"

# Run the app directly via Nix
nix-run:
  nix run ".#"

update: update-flake update-bun-nix

# Regenerate front/bun.nix from the current bun.lock
update-bun-nix:
  cd front && bun2nix > bun.nix

# Update the flake.lock file
update-flake:
  nix flake update
