# Makefile for Firehose app

MISE_BIN ?= $(HOME)/.local/bin/mise
MISE_EXEC = $(MISE_BIN) exec --

.PHONY: check precommit deps compile test format credo

# Run all static analysis checks (no database required)
check: credo format

# Precommit target for CI/pre-commit hooks
precommit: check compile

# Sync dependencies
deps:
	$(MISE_EXEC) mix deps.get

# Compile the project
compile:
	$(MISE_EXEC) mix compile --warnings-as-errors

# Run tests (requires PostgreSQL running on localhost:5432)
# Note: If you don't have PostgreSQL, you can skip tests with `make check`
test: deps compile
	$(MISE_EXEC) mix test

# Format code
format:
	$(MISE_EXEC) mix format

# Run Credo static analysis
credo:
	$(MISE_EXEC) mix credo --strict