.PHONY: build run test lint image clean

APP_NAME   := ops-mcp
IMAGE_NAME := ops-mcp
GO         := go
GOFLAGS    := -ldflags="-s -w"

# ---- Build ----

build:
	$(GO) build $(GOFLAGS) -o $(APP_NAME) ./cmd/server

run: build
	./$(APP_NAME) -env=dev

# ---- Test ----

test:
	$(GO) test -race -v ./...

test-integration:
	$(GO) test -race -v ./test/...

# ---- Lint ----

lint:
	golangci-lint run ./...

# ---- Docker Compose ----

up:
	docker compose up -d --build

up-dev:
	docker compose --profile dev up -d --build

down:
	docker compose down

logs:
	docker compose logs -f

# ---- Docker ----

image:
	docker build -t $(IMAGE_NAME):latest .

# ---- Utils ----

clean:
	rm -f $(APP_NAME)

tidy:
	$(GO) mod tidy
