# SPDX-FileCopyrightText: 2026 Rohan R
# SPDX-License-Identifier: Apache-2.0

.PHONY: install install-dev test test-cov lint format type-check build clean \
	test-sdk build-sdk examples release-check release-pypi release-npm

# Python targets
install:
	pip install -e .

install-dev:
	pip install -r requirements.txt -r requirements-dev.txt

test:
	python -m pytest tests/ -v --tb=short

test-cov:
	python -m pytest tests/ -v --cov=context_fission --cov-report=term-missing

lint:
	ruff check src/

format:
	ruff format src/

type-check:
	mypy src/

build:
	python -m build

release-check:
	python -m build
	python -m twine check dist/*

clean:
	rm -rf dist/ build/ *.egg-info
	rm -rf packages/context-fission-sdk/dist
	find . -type d -name __pycache__ -exec rm -rf {} +

# npm SDK targets
install-sdk:
	cd packages/context-fission-sdk && npm install

test-sdk:
	cd packages/context-fission-sdk && npm test

build-sdk:
	cd packages/context-fission-sdk && npm run build

release-pypi: build
	python -m twine upload dist/*

release-npm:
	cd packages/context-fission-sdk && npm publish --access public

# Full checks
all-checks: test test-sdk lint type-check

# Examples
examples:
	@echo "Running Python examples..."
	python examples/python/compression_demo.py || true
	@echo "Running TypeScript examples..."
	cd packages/context-fission-sdk && node ../../examples/javascript/compression_example.ts || true
