diff --git a/AGENTS.md b/AGENTS.md index a00c9f6..1a1b774 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -4,8 +4,9 @@ Guidelines for agentic coding agents working on this repository. ## Project Overview -- **Backend**: ASP.NET Core 8.0 Web API (C#) -- **Frontend**: Vue 3 + TypeScript + Vite + Element Plus +- **Backend**: ASP.NET Core 8.0 Web API (C#) with PostgreSQL and SqlSugar ORM +- **Admin Frontend**: Vue 3 + TypeScript + Vite + Element Plus (port 5173) +- **Game Frontend**: Vue 3 + TypeScript + Vite + Element Plus + TailwindCSS + Three.js (port 5174) --- @@ -14,16 +15,19 @@ Guidelines for agentic coding agents working on this repository. ### Backend (.NET API) ```bash -# Build the solution (from Build_God_Api directory) -dotnet build Build_God_Api/Build_God_Api.csproj +# Build the solution +dotnet build Build_God_Api/Build_God_Api/Build_God_Api.csproj -# Run the API -dotnet run --project Build_God_Api/Build_God_Api.csproj +# Run the API (launches on https://localhost:59447, http://localhost:59448) +dotnet run --project Build_God_Api/Build_God_Api/Build_God_Api.csproj + +# Run with specific URL +dotnet run --urls "http://localhost:5091" ``` **Note**: No test framework or linting is currently configured for the backend. -### Frontend (Vue 3) +### Admin Frontend (Build_God_Admin_Frontend/Frontend) ```bash # Install dependencies @@ -42,7 +46,23 @@ npm run type-check npm run preview ``` -**Note**: No test framework or ESLint is currently configured for the frontend. +### Game Frontend (Build_God_Game) + +```bash +# Install dependencies +npm install + +# Start development server (http://localhost:5174) +npm run dev + +# Build for production +npm run build + +# Type-check only +vue-tsc --build +``` + +**Note**: No test framework or ESLint is configured for either frontend. --- @@ -52,36 +72,43 @@ npm run preview #### Conventions - Use **file-scoped namespaces** (`namespace Build_God_Api.Controllers;`) -- Enable **nullable reference types** +- Enable **nullable reference types** (`enable`) - Use **primary constructors** for dependency injection - Use **async/await** for all I/O operations +- Use **region** sparingly - prefer natural code organization #### Naming - **Classes/Types**: PascalCase (`AccountController`, `AccountService`) - **Methods/Properties**: PascalCase (`GetAccount`, `UserName`) - **Local variables/Parameters**: camelCase (`accountId`, `emailAddress`) - **Interfaces**: Prefix with `I` (`IAccountService`) +- **DTOs**: Postfix with `Cmd` for commands, `Dto` for responses #### Project Structure ``` -Build_God_Api/ - Controllers/ # API endpoints - Services/ # Business logic (interface + implementation) - Services/Game/ # Game-specific services - DB/ # Database entities (extend BaseEntity) - Dto/ # Data transfer objects - Common/ # Utilities - Hubs/ # SignalR hubs +Build_God_Api/Build_God_Api/ + Controllers/ # API endpoints + Services/ # Business logic interfaces + Services/Game/ # Game-specific services + DB/ # Database entities (extend BaseEntity) + Dto/ # Data transfer objects + Common/ # Utilities and helpers + Hubs/ # SignalR hubs ``` #### Error Handling - Return `BadRequest("error message")` for validation errors - Return `Ok(result)` for successful operations -- Use try-catch with `ILogger` for error logging +- Use try-catch with `Console.WriteLine` for error logging +- Validate inputs at controller level using DataAnnotations #### Route Conventions - Use `[Route("api/god/[controller]")]` -- Use `[ApiController]` and HTTP method attributes +- Use `[ApiController]` and HTTP method attributes (`[HttpGet]`, `[HttpPost]`) + +#### Database Entities (SqlSugar) +- All entities extend `BaseEntity` which provides `Id`, `CreatedOn`, `UpdatedOn`, `CreatedBy`, `UpdatedBy` +- Use `[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]` for auto-increment primary keys --- @@ -90,35 +117,57 @@ Build_God_Api/ #### Conventions - Use **Composition API** with `