feat: Phase 0 — monorepo 骨架 + 全表迁移 + FastAPI/Next 骨架 + CI

- uv(workspace) + pnpm monorepo;docker-compose(pg+api+web)
- SQLAlchemy 16 MVP 表 + Alembic 初版迁移(无漂移,users stub)
- FastAPI 骨架:统一错误信封(带 request_id) + structlog + /jobs/:id + OpenAPI
- Next.js 骨架:纸感主题 token + OpenAPI→TS 客户端代码生成(gen:api)
- CI(ruff/mypy/pytest + pg service + alembic 漂移校验)
- 四份设计规格(PRODUCT/UX/ARCHITECTURE/DEV_PLAN) + CLAUDE.md
This commit is contained in:
Yaojia Wang
2026-06-18 11:38:28 +02:00
commit d3dc620a71
74 changed files with 12960 additions and 0 deletions

64
.github/workflows/ci.yml vendored Normal file
View File

@@ -0,0 +1,64 @@
name: CI
on:
push:
branches: [main]
pull_request:
jobs:
backend:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_USER: writer
POSTGRES_PASSWORD: writer
POSTGRES_DB: writer
ports: ["5432:5432"]
options: >-
--health-cmd "pg_isready -U writer"
--health-interval 5s --health-timeout 3s --health-retries 10
env:
DATABASE_URL: postgresql+asyncpg://writer:writer@localhost:5432/writer
DATABASE_URL_SYNC: postgresql+psycopg://writer:writer@localhost:5432/writer
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v5
- run: uv sync
- name: ruff
run: uv run ruff check .
- name: mypy
run: uv run mypy packages apps
- name: alembic upgrade + drift check
run: |
uv run alembic upgrade head
uv run alembic check
- name: pytest
run: uv run pytest -q
frontend:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v5
- run: uv sync
- uses: actions/setup-node@v4
with:
node-version: 22
- run: corepack enable
- name: install
working-directory: apps/web
run: pnpm install --frozen-lockfile
- name: gen api types
working-directory: apps/web
run: pnpm gen:api
- name: lint
working-directory: apps/web
run: pnpm lint
- name: typecheck
working-directory: apps/web
run: pnpm typecheck
- name: test
working-directory: apps/web
run: pnpm test