e63165f898
- 重写 README:补充技术栈徽标、快速开始、项目结构、线上体验链接 - 简化 CLAUDE.md:目录结构和架构说明改为引用 docs/architecture.md - 移除不存在的 lint/test 命令 - 删除无内容的 README.en.md
74 lines
1.7 KiB
Markdown
74 lines
1.7 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/architecture.md](docs/architecture.md) 中的后端分层结构与前端组件树。
|
|
|
|
## Common Commands
|
|
|
|
### Backend (Go + Gin)
|
|
|
|
```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/architecture.md](docs/architecture.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 使用中文或英文均可,但需要清晰描述变更内容。
|