75 lines
1.8 KiB
Markdown
75 lines
1.8 KiB
Markdown
# CLAUDE.md
|
|
|
|
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
|
|
## Project Overview
|
|
|
|
gen2d — AI 驱动的 2D 游戏素材生成工具。用户通过文本提示词或可视化参数,生成风格一致、管线友好的 Sprite、背景、UI 元素与动画帧。目标是无缝融入 Unity / Godot 等主流 2D 游戏引擎的工作流。
|
|
|
|
## Directory Structure
|
|
|
|
详见 [docs/_index.md](docs/_index.md) 中的后端分层结构与前端组件树。
|
|
|
|
## Common Commands
|
|
|
|
### Backend (Go + Gin + Eino)
|
|
|
|
```bash
|
|
cd backend
|
|
|
|
# 安装依赖
|
|
go mod tidy
|
|
|
|
# 运行开发服务器
|
|
go run cmd/main.go
|
|
|
|
# 构建
|
|
go build -o bin/gen2d cmd/main.go
|
|
|
|
# 运行全部测试
|
|
go test ./...
|
|
|
|
# 运行单个包的测试
|
|
go test ./internal/service/...
|
|
|
|
# 运行单个测试函数
|
|
go test -run TestFunctionName ./internal/service/
|
|
|
|
# 代码检查
|
|
golangci-lint run
|
|
```
|
|
|
|
### Frontend (Vite + React)
|
|
|
|
```bash
|
|
cd frontend
|
|
|
|
# 安装依赖
|
|
npm install
|
|
|
|
# 开发服务器
|
|
npm run dev
|
|
|
|
# 构建生产版本
|
|
npm run build
|
|
|
|
# 预览生产构建
|
|
npm run preview
|
|
|
|
# 类型检查
|
|
npm run typecheck
|
|
```
|
|
|
|
## Architecture
|
|
|
|
详见 [docs/_index.md](docs/_index.md),涵盖多智能体管线、后端分层、前端组件树、API 设计、素材生成约束等。
|
|
|
|
## Conventions
|
|
|
|
- 后端 Go 代码遵循 [Effective Go](https://go.dev/doc/effective_go) 和 Go 官方 style。
|
|
- 前端使用 ESLint + Prettier,提交前自动格式化。
|
|
- API 路径统一使用 `/api/v1/` 前缀。
|
|
- 错误响应统一格式:`{"code": int, "message": string, "data": any}`。
|
|
- Git commit message 使用中文或英文均可,但需要清晰描述变更内容。
|
|
- 每次小任务执行完毕后,检查并更新 `docs/` 下相关文档(如 API 状态、后端文件结构等),然后自动提交 commit,但不要 push。commit message 禁止使用 Co-Authored-By 签名。
|