started changes
This commit is contained in:
90
.opencode/AGENTS.md
Normal file
90
.opencode/AGENTS.md
Normal file
@@ -0,0 +1,90 @@
|
||||
# Project Agent Guidelines
|
||||
|
||||
## Build, Lint, and Test Commands
|
||||
|
||||
### Build Commands
|
||||
```bash
|
||||
# Create build directory and configure
|
||||
mkdir -p build && cd build && cmake ..
|
||||
|
||||
# Build all targets
|
||||
make
|
||||
|
||||
# Build specific target
|
||||
make <target_name>
|
||||
|
||||
# Build with specific configuration
|
||||
make Release
|
||||
```
|
||||
|
||||
### Lint Commands
|
||||
```bash
|
||||
# C++ linting with clang-tidy (if available)
|
||||
clang-tidy src/*.cpp -- -std=c++23 -I include/
|
||||
|
||||
# C++ formatting with clang-format
|
||||
clang-format -i src/*.cpp include/*.h
|
||||
```
|
||||
|
||||
### Test Commands
|
||||
```bash
|
||||
# Run all tests (if any exist)
|
||||
make test
|
||||
|
||||
# Run a single test (if using a testing framework like Google Test)
|
||||
./build/<test_name>
|
||||
|
||||
# For CMake-based projects with tests
|
||||
ctest -R <test_regex>
|
||||
```
|
||||
|
||||
## Code Style Guidelines
|
||||
|
||||
### General
|
||||
- Use C++23 standard features
|
||||
- Follow Google C++ Style Guide principles
|
||||
- Keep functions small and focused
|
||||
- Use meaningful, descriptive names
|
||||
- Write clear, self-documenting code
|
||||
- Add comments for complex logic
|
||||
|
||||
### Naming Conventions
|
||||
- Classes: PascalCase (e.g., `MyClass`)
|
||||
- Functions: camelCase (e.g., `calculateSum`)
|
||||
- Variables: camelCase (e.g., `myVariable`)
|
||||
- Constants: UPPER_SNAKE_CASE (e.g., `MAX_SIZE`)
|
||||
- Files: snake_case (e.g., `my_file.cpp`)
|
||||
|
||||
### Imports and Includes
|
||||
- Use angle brackets for system headers: `#include <iostream>`
|
||||
- Use quotes for local headers: `#include "my_header.h"`
|
||||
- Order includes: system headers, then local headers
|
||||
- Avoid `using namespace` in headers
|
||||
- Use forward declarations when possible
|
||||
|
||||
### Formatting
|
||||
- Use 2-space indentation (no tabs)
|
||||
- No trailing whitespace
|
||||
- Single space around operators
|
||||
- Function parameters on same line if short, otherwise one parameter per line
|
||||
- Braces on same line for functions, new line for control structures
|
||||
|
||||
### Types
|
||||
- Use `auto` when type is obvious from initialization
|
||||
- Prefer `const` and `constexpr` for immutable values
|
||||
- Use smart pointers (`std::unique_ptr`, `std::shared_ptr`) instead of raw pointers
|
||||
- Use `std::optional` for optional values
|
||||
- Use `std::string_view` for string views
|
||||
|
||||
### Error Handling
|
||||
- Use exceptions for error conditions
|
||||
- Prefer RAII for resource management
|
||||
- Use `std::optional` or `std::expected` for operations that can fail
|
||||
- Don't ignore return values of functions that can fail
|
||||
|
||||
### Code Structure
|
||||
- Keep lines under 100 characters
|
||||
- Separate logical sections with blank lines
|
||||
- Group related functions together
|
||||
- Use namespaces to avoid naming conflicts
|
||||
- Break large functions into smaller, reusable components
|
||||
Reference in New Issue
Block a user