Files
meida_backend/Makefile
T
xsl 9e7a886863 chore(prep): shared groundwork for the parallel task batch
多 agent 并行批次的协调提交(消除全部共享文件冲突面):
- 迁移 0004:id_session + ob_event 两表(T3/T4 用,任务不再写迁移)
- ORM:UserSession / ObEvent;错误码:九个新码(40xxx/60006,含 meta)
- 配置:四档 tiers / refresh TTL / 任务奖励注册表 / 埋点上限 / COS 直传全套
- 骨架:packages/analytics + packages/storage + events/uploads 空路由(已注册)
- deps:AnalyticsServiceDep / StorageServiceDep;DailyBudgetGuard 接收 tiers
- uv add cos-python-sdk-v5;import-linter/CI/Makefile 纳入两个新包
2026-08-14 16:02:54 +08:00

80 lines
3.2 KiB
Makefile
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
.PHONY: help install up down logs migrate downgrade revision run worker \
test test-unit test-integration lint fmt typecheck imports secrets check smoke psql redis-cli
COMPOSE := docker compose -f deploy/docker-compose.dev.yml
help: ## 列出所有目标
@grep -hE '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) \
| awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-18s\033[0m %s\n", $$1, $$2}'
# ── 环境 ────────────────────────────────────────────────────────────────────
install: ## 安装依赖(uv 管理,含开发依赖)
uv sync --extra dev
uv run pre-commit install
up: ## 起 PostgreSQL(pgvector) + Redis
$(COMPOSE) up -d postgres redis
down: ## 停容器(保留数据卷)
$(COMPOSE) down
logs: ## 跟踪容器日志
$(COMPOSE) logs -f --tail=100
psql: ## 连进数据库
$(COMPOSE) exec postgres psql -U meida -d meida
redis-cli: ## 连进 Redis
$(COMPOSE) exec redis redis-cli
# ── 数据库 ──────────────────────────────────────────────────────────────────
migrate: ## 迁移到最新版本
uv run alembic upgrade head
downgrade: ## 回退一个版本
uv run alembic downgrade -1
revision: ## 生成迁移脚本:make revision m="描述"
uv run alembic revision --autogenerate -m "$(m)"
# ── 运行 ────────────────────────────────────────────────────────────────────
run: ## 本地起 API(热重载)
uv run uvicorn apps.api.main:app --reload --host 0.0.0.0 --port 8000
worker: ## 本地起 Celery worker
uv run celery -A apps.worker.celery_app.celery_app worker -Q cpu,io -l INFO
# ── 质量防线(与 CI 一致,见 .github/workflows/ci.yml)─────────────────────
lint: ## ruff 检查 + 格式校验
uv run ruff check .
uv run ruff format --check .
fmt: ## 自动修复与格式化
uv run ruff check --fix .
uv run ruff format .
typecheck: ## mypy(domain 与 llm 为 strict)
uv run mypy packages/domain packages/llm
uv run mypy apps packages/shared packages/identity packages/billing packages/task \
packages/agent packages/compliance packages/analytics packages/storage
imports: ## 分层依赖契约(架构文档 §4.2)
uv run lint-imports
secrets: ## 敏感信息扫描
uv run detect-secrets scan --baseline .secrets.baseline
test: test-unit ## 默认只跑单测(不连库、不发网络请求)
test-unit:
uv run pytest
test-integration: ## 需要 make up && make migrate
MEIDA_RUN_INTEGRATION=1 uv run pytest -m integration
check: lint typecheck imports test secrets ## 提交前一把过
# ── 真实链路验证(会花钱)──────────────────────────────────────────────────
smoke: ## 真调 DeepSeek,打印 ob_ai_call 与 bl_ledger
bash scripts/smoke.sh