APP_NAME := faststore-plugin-buyer-portal

.DEFAULT_GOAL := help
SHELL := /usr/bin/env bash -o pipefail

.PHONY: help test coverage lint typecheck check install clean setup-tools

help: ## Show available targets
	@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n  make \033[36m<target>\033[0m\n\nTargets:\n"} \
	  /^[a-zA-Z_-]+:.*?##/ { printf "  \033[36m%-12s\033[0m %s\n", $$1, $$2 }' $(MAKEFILE_LIST)

setup-tools: ## Install global dev tools: spec-kit v0.6.0 (requires uv: https://docs.astral.sh/uv/)
	uv tool install specify-cli --from git+https://github.com/github/spec-kit.git@v0.6.0

install: ## Install dependencies
	@command -v node >/dev/null 2>&1 || { echo "node is required"; exit 1; }
	@command -v yarn >/dev/null 2>&1 || { echo "yarn is required"; exit 1; }
	yarn install --frozen-lockfile

test: ## Run unit tests
	yarn test

coverage: ## Run tests with coverage report
	yarn test:coverage

lint: ## Run ESLint
	yarn lint

typecheck: ## Run TypeScript type checker
	yarn typecheck

check: lint typecheck test ## Run all validations (lint + typecheck + test)

clean: ## Remove installed dependencies
	rm -rf node_modules
