2026-09-03 12:21:54 +08:00

78 lines
3.0 KiB
Makefile

.PHONY: help install run run-mcp run-worker images images-print images-push deploy deploy-lint deploy-render format format-check lint typecheck test test-unit test-integration migration-check eval live-acceptance up down
UV_CACHE_DIR ?= /tmp/ekp-uv-cache
export UV_CACHE_DIR
help:
@echo "Enterprise Knowledge Platform"
@echo " install Install development dependencies"
@echo " run Start the development API"
@echo " run-mcp Start the authenticated MCP gateway"
@echo " run-worker Start the ingestion worker and recovery scheduler"
@echo " images Build production images for the current builder"
@echo " images-print Render the multi-architecture image build plan"
@echo " images-push Build and push amd64/arm64 production images"
@echo " deploy Install or upgrade Kubernetes with VALUES=<file>"
@echo " deploy-lint Validate Helm values and templates"
@echo " deploy-render Render non-secret Kubernetes manifests"
@echo " format Format code"
@echo " format-check Check formatting without modifying files"
@echo " lint Run linters"
@echo " typecheck Run static type checks"
@echo " test Run default tests"
@echo " test-unit Run unit tests"
@echo " test-integration Run integration tests"
@echo " migration-check Validate the forward migration path"
@echo " eval Run RAG evaluation"
@echo " live-acceptance Run controlled target-provider acceptance"
@echo " up Start local dependencies"
@echo " down Stop local dependencies"
install:
uv sync --all-groups
run:
uv run uvicorn ekp_api.main:app --host "$${API_HOST:-0.0.0.0}" --port "$${API_PORT:-8000}"
run-mcp:
uv run ekp-mcp
run-worker:
uv run ekp-worker
images:
docker buildx bake -f deploy/docker/docker-bake.hcl
images-print:
docker buildx bake -f deploy/docker/docker-bake.hcl --print
images-push:
docker buildx bake -f deploy/docker/docker-bake.hcl --push
deploy:
./scripts/deploy.sh "$(VALUES)"
deploy-lint:
@test -n "$(VALUES)" || (echo "VALUES must point to an environment values file" >&2; exit 2)
helm lint deploy/helm/knowledge-platform --values "$(VALUES)"
deploy-render:
@test -n "$(VALUES)" || (echo "VALUES must point to an environment values file" >&2; exit 2)
helm template "$${RELEASE:-knowledge-platform}" deploy/helm/knowledge-platform --namespace "$${NAMESPACE:-knowledge-platform}" --values "$(VALUES)"
format:
uv run ruff format .
format-check:
uv run ruff format --check .
lint:
uv run ruff check .
typecheck:
uv run mypy apps/api/src apps/mcp-server/src packages tests
test:
uv run pytest tests/unit tests/integration
test-unit:
uv run pytest tests/unit
test-integration:
uv run pytest tests/integration
migration-check:
uv run alembic heads
uv run alembic upgrade head --sql >/dev/null
eval:
uv run pytest tests/evaluation
live-acceptance:
uv run ekp-live-acceptance
up:
docker compose -f docker-compose.dev.yml up -d
down:
docker compose -f docker-compose.dev.yml down