Files
digital-psychology/.ai/commands.md
T
jackyu66gitandCursor 0f320e040b feat: P1 profile/portrait API and freeze local-dev environment
Add host-first environment contracts (Local vs CI vs Prod), deps-only
compose, and the Profile → Portrait → deep-access mock payment slice
with device identity and auto-migrate on API startup.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-02 16:24:57 +08:00

1.7 KiB
Raw Blame History

Commands — Do Not Guess

Run from repo root unless noted.
Policy: environment.md · development.md

本仓库用 npm workspacesnpm run …);等价于文档中的 pnpm 习惯用法。


Local Development — First time

  1. Install host toolchains: Go 1.22+ · Node 20+ · Docker Desktop(仅依赖服务)
  2. npm install
  3. npm run deps:up(或 docker compose -f docker-compose.dev.yml up -d
  4. Start API once so migrations apply: cd apps/api && go run ./cmd/server
  5. Verify: curl -s http://127.0.0.1:8080/api/v1/healthz
  6. Start H5: npm run dev:h5http://127.0.0.1:5173

Optional CN Go proxy: export GOPROXY=https://goproxy.cn,direct
Optional API hot reload: install air, then cd apps/api && air(见 .air.toml


Local Development — Daily

# Terminal 1 — infrastructure only
npm run deps:up

# Terminal 2 — backend (host)
cd apps/api
air
# 或: go run ./cmd/server

# Terminal 3 — frontend (host)
npm run dev:h5

Stop deps: npm run deps:down


Go API

cd apps/api
go mod tidy
go test ./...
go build ./...
go run ./cmd/server

Env defaults / template: deploy/.env.example
Migrate: applied on API startup (apps/api/migrations/*.up.sql)

curl -s http://127.0.0.1:8080/api/v1/healthz
curl -s http://127.0.0.1:8080/api/v1/ping

Do not docker build the API for everyday coding.


User H5

npm run dev:h5
npm run build:h5

Do not dockerize Vite for everyday coding.


CI / production

deployment.md · docker.md
仅在发布/CI 任务使用镜像与 deploy/docker-compose.prod.yml