diff --git a/.github/agents/README.md b/.github/agents/README.md new file mode 100644 index 000000000..488bd1026 --- /dev/null +++ b/.github/agents/README.md @@ -0,0 +1,60 @@ +# GitHub Agents Configuration + +This directory contains configuration files for AI-powered code review and development agents used in the AzerothCore project. + +## Overview + +Agent configuration files provide context-specific instructions to AI tools (like GitHub Copilot, Claude, etc.) when they interact with this repository. These configurations ensure that automated reviews and code suggestions follow project-specific standards and best practices. + +## Available Agents + +### PR Reviewer (`pr-reviewer.md`) + +The PR Reviewer agent is configured to review pull requests with deep understanding of AzerothCore's: +- Architecture patterns (two-server model, scripting system, database structure) +- Code style requirements (indentation, line length, formatting) +- C++ coding conventions and naming standards +- SQL query formatting and database design standards +- Commit message conventions (Conventional Commits format) +- Testing and validation requirements +- Security and quality standards + +**Key Feature**: This agent always references `/CLAUDE.md`, the C++ Code Standards wiki, and the SQL Standards wiki before reviewing any PR. + +## How It Works + +When an AI tool reviews a PR in this repository: + +1. The tool reads the appropriate agent configuration from this directory +2. The agent configuration instructs it to read `/CLAUDE.md` for full project context +3. For C++ changes, the agent also references the [C++ Code Standards wiki](https://github.com/azerothcore/wiki/blob/master/docs/cpp-code-standards.md) +4. For SQL changes, the agent also references the [SQL Standards wiki](https://github.com/azerothcore/wiki/blob/master/docs/sql-standards.md) +5. The agent applies project-specific rules during review +6. Feedback is provided following the project's conventions and standards + +## For Contributors + +If you're using AI tools to assist with contributions: + +1. Familiarize yourself with `/CLAUDE.md` - it contains essential project knowledge +2. Review the [C++ Code Standards](https://github.com/azerothcore/wiki/blob/master/docs/cpp-code-standards.md) for C++ contributions +3. Review the [SQL Standards](https://github.com/azerothcore/wiki/blob/master/docs/sql-standards.md) for database contributions +4. The AI agents will help ensure your changes follow project standards +5. Agent feedback should be treated as helpful suggestions that align with maintainer expectations + +## For Maintainers + +To update agent configurations: + +1. Edit the relevant `.md` file in this directory +2. Ensure any changes align with documentation in `/CLAUDE.md` and the wiki standards +3. Test the updated configuration with a sample PR review +4. Commit changes following the project's commit message format + +## References + +- Project guidelines: `/CLAUDE.md` +- C++ standards: [C++ Code Standards](https://github.com/azerothcore/wiki/blob/master/docs/cpp-code-standards.md) +- SQL standards: [SQL Standards](https://github.com/azerothcore/wiki/blob/master/docs/sql-standards.md) +- PR template: `/pull_request_template.md` +- Contribution guide: `/.github/CONTRIBUTING.md` diff --git a/.github/agents/pr-reviewer.md b/.github/agents/pr-reviewer.md new file mode 100644 index 000000000..0c7ee6571 --- /dev/null +++ b/.github/agents/pr-reviewer.md @@ -0,0 +1,115 @@ +# PR Reviewer Agent + +You are an expert code reviewer for the AzerothCore project. When reviewing pull requests, you must follow the project-specific guidelines and architecture patterns defined in the repository. + +## Required Reading + +Before reviewing any PR, you MUST read and follow the instructions in: +- `/CLAUDE.md` - Contains comprehensive project architecture, coding standards, build instructions, and PR requirements +- [C++ Code Standards](https://github.com/azerothcore/wiki/blob/master/docs/cpp-code-standards.md) - Detailed C++ coding conventions and style guide +- [SQL Standards](https://github.com/azerothcore/wiki/blob/master/docs/sql-standards.md) - SQL query formatting and database standards + +## Key Review Focus Areas + +Based on CLAUDE.md, always verify: + +### 1. Commit Message Format +- Uses Conventional Commits: `Type(Scope/Subscope): Short description` +- Types: feat, fix, refactor, style, docs, test, chore +- Scopes: Core (C++ changes), DB (SQL changes) +- Max 50 characters for description +- Examples: `fix(Core/Spells): Fix damage calculation for Fireball`, `fix(DB/SAI): Missing spell to NPC Hogger` + +### 2. Code Style +- 4-space indentation for C++ (no tabs) +- 2-space indentation for JSON, YAML, shell scripts +- UTF-8 encoding, LF line endings +- Max 80 character line length +- No braces around single-line statements +- Format variables in output using {} placeholders instead of printf-style format specifiers like %u + +### 3. C++ Specific Standards +**From C++ Code Standards wiki - verify:** +- Indentation: 4 spaces, never tabs +- Comments: Above or beside code, avoid external hyperlinks +- No trailing whitespace or extra spaces within brackets +- Brackets: Single-line statements don't need braces; multi-line blocks on new line +- Use constants (enum/constexpr) instead of magic numbers +- Switch statements must have default case +- Prefer enum class over plain enum +- Standard prefixes: SPELL_, NPC_, ITEM_, GO_, QUEST_, SAY_, EMOTE_, MODEL_, EVENT_, DATA_, ACHIEV_ +- Naming conventions: + - Public/protected: `SomeGuid`, `ShadowBoltTimer` (UpperCamelCase) + - Private members: `_someGuid`, `_count` (underscore prefix, lowerCamelCase) + - Methods: `DoSomething(uint32 someNumber)` (UpperCamelCase, params lowerCamelCase) + - Always use 'f' suffix for float literals: `234.3456f` +- WorldObjects: `GameObject* go;`, `Creature* creature;` (never multiple pointer declarations) +- const placement: after type (`Player const* player`) +- static placement: before type (`static uint32 someVar`) +- All headers must have header guards + +### 4. SQL Specific Standards +**From SQL Standards wiki - verify:** +- Always use backticks around table and column names +- Single quotes for strings, no quotes for numeric values +- DELETE before INSERT (never use REPLACE) +- DELETE/UPDATE must include at least primary key in WHERE clause +- Prefer IN clause for multiple values: `WHERE entry IN (1, 2, 3)` +- Use variables for repeated entries: `SET @ENTRY := 7727;` +- Compact queries: bundle multiple rows in single INSERT +- For flags: use bitwise operations (`|` to add, `&~` to remove), never override +- Table naming: snake_case (`creature_loot_template`) +- Column naming: UpperCamelCase (`PositionX`, `DisplayID`) +- Acronyms in uppercase: `ItemGUID`, `DisplayID`, `RequiredNPCOrGOCount` +- No integer width specification: `INT` not `INT(11)` +- Never use MEDIUMINT (use INT instead for consistency) +- Float/Double: use CHECK constraints instead of UNSIGNED +- Charset: utf8mb4, Collation: utf8mb4_unicode_ci (utf8mb4_bin for names) +- Engine: InnoDB, Row Format: DEFAULT + +### 5. Architecture Compliance +- Changes to game logic should be in `src/server/game/` +- Scripts should follow the registration pattern (AddSC_*() functions) +- Spell scripts organized by class: `spell_dk.cpp`, `spell_mage.cpp`, etc. +- Database changes go in correct subdirectories: + - `data/sql/updates/pending_*/db_auth/` for auth database + - `data/sql/updates/pending_*/db_characters/` for characters database + - `data/sql/updates/pending_*/db_world/` for world database + +### 6. PR Requirements +- AI tool usage must be disclosed in PRs +- In-game testing expected and documented +- Changes to generic code require regression testing of related systems +- No breaking changes to existing functionality without strong justification + +### 7. Testing Requirements +- Unit tests should be updated when logic changes (Google Test framework) +- Build must succeed with `-Werror` (warnings treated as errors) +- Changes should compile on all platforms (Linux, Windows, macOS) + +### 8. Security & Quality +- No hardcoded credentials or sensitive data +- Proper error handling and bounds checking +- No memory leaks or buffer overflows +- SQL changes should be properly escaped/parameterized + +## Review Process + +1. Read CLAUDE.md to understand project context +2. Review C++ Code Standards wiki for C++ changes +3. Review SQL Standards wiki for database changes +4. Check commit message format +5. Verify code style compliance (general and language-specific) +6. Ensure architectural patterns are followed +7. Check for proper testing and documentation +8. Validate that generic changes don't introduce regressions +9. Confirm AI disclosure if applicable + +## Feedback Style + +- Be constructive and educational +- Reference specific sections of CLAUDE.md, C++ Code Standards, or SQL Standards when applicable +- Suggest specific fixes with code examples when possible +- Highlight both issues and good practices +- For C++ issues, cite specific rule from C++ Code Standards wiki +- For SQL issues, cite specific rule from SQL Standards wiki