.PHONY: help build run run-local down logs check ci-lint-test claude-test

LOCAL_COMPOSE = -f docker-compose.yaml -f docker-compose.local.yaml

CLIENT_ID = axdhcX5MLHiK2qgQPKwRiw44fwXTTYpa
CALLBACK_PORT = 8511

help:
	@echo "Available targets:"
	@echo "  make build        - Build the image"
	@echo "  make run          - Run on :8080 with the deployed (QA-posture) env defaults"
	@echo "  make run-local    - Run on :8080 with local overrides (docker DNS, localhost origin; be on VPN)"
	@echo "  make down         - Stop and remove the compose containers"
	@echo "  make logs         - Tail the proxy access/error logs"
	@echo "  make check        - nginx -t config check (templates env-substituted first)"
	@echo "  make claude-test  - Throwaway Claude Code session against the local proxy (session-only MCP)"

build:
	docker compose build

run:
	docker compose up --build

run-local:
	docker compose $(LOCAL_COMPOSE) up --build

down:
	docker compose down
	docker compose $(LOCAL_COMPOSE) down

logs:
	docker compose logs -f mcp-proxy

check:
	docker compose $(LOCAL_COMPOSE) run --rm mcp-proxy nginx -t

ci-lint-test: check

claude-test:
	claude --strict-mcp-config --mcp-config '{"mcpServers":{"pdego-mcp-local":{"type":"http","url":"http://localhost:8080/mcp","oauth":{"clientId":"$(CLIENT_ID)","callbackPort":$(CALLBACK_PORT)}}}}'
