.PHONY: install test lint fmt fmt-check check docker hooks build clean dev

install:
	@yarn install

test:
	@echo "Running tests..."
	@timeout 30 yarn run test 2>&1

lint:
	@echo "Linting..."
	@yarn run lint 2>&1

fmt:
	@echo "Formatting..."
	@yarn run fmt 2>&1

fmt-check:
	@echo "Checking formatting..."
	@yarn run fmt-check 2>&1

check: test lint fmt-check

build:
	@echo "Building extension..."
	@yarn run build 2>&1

clean:
	@rm -rf dist/

dev:
	@echo "Building in watch mode..."
	@yarn run build --watch 2>&1

docker:
	@docker build -t autistmask .

hooks:
	@echo "Installing pre-commit hook..."
	@mkdir -p .git/hooks
	@echo '#!/usr/bin/env bash' > .git/hooks/pre-commit
	@echo 'set -euo pipefail' >> .git/hooks/pre-commit
	@echo 'make check' >> .git/hooks/pre-commit
	@chmod +x .git/hooks/pre-commit
	@echo "Pre-commit hook installed."
