Description
New contributors need guidance on common development tasks like adding a new AI provider, adding configuration options, or debugging. A developer workflow guide would lower the barrier to contribution.
File to Create
docs/src/contributing/developer-guide.md
Task
Create a guide covering:
-
Adding a new AI provider:
- File structure to create
- Interface to implement
- Factory registration
- Testing requirements
-
Adding a configuration option:
- Where to add the field
- How to parse it
- Documentation updates
-
Writing tests:
- Test file naming conventions
- Using Google Test
- Mocking external services
-
Debugging:
- Using PostgreSQL's elog for debugging
- Reading extension logs
- Common issues and solutions
-
Build and test workflow:
- Local development cycle
- Running specific tests
- Checking code style
Example Content
# Developer Guide
## Adding a New AI Provider
To add support for a new AI provider (e.g., "Cohere"), follow these steps:
### 1. Create Provider Files
Create new files in `src/providers/cohere/`:
src/providers/cohere/
├── client.hpp
└── client.cpp
### 2. Implement the Client Interface
```cpp
// client.hpp
#pragma once
#include "ai_client.hpp"
class CohereClient : public AIClient {
public:
CohereClient(const std::string& api_key, const std::string& model);
std::string generate(const std::string& prompt,
const std::string& system_prompt) override;
std::string provider_name() const override { return "cohere"; }
private:
std::string api_key_;
std::string model_;
};
3. Register in Factory
In src/core/ai_client_factory.cpp:
if (provider == "cohere") {
return std::make_unique<CohereClient>(
config.cohere_api_key,
config.cohere_model
);
}
4. Add Configuration
In src/include/config.hpp:
std::string cohere_api_key;
std::string cohere_model = "command-r-plus";
5. Add Tests
Create tests/unit/test_cohere_client.cpp with tests for:
- Request building
- Response parsing
- Error handling
...
## Acceptance Criteria
- [ ] Guide covers adding new AI provider
- [ ] Guide covers adding configuration options
- [ ] Guide covers writing tests
- [ ] Guide covers debugging techniques
- [ ] Document is added to mdbook navigation
## Skills Required
- Technical writing
- Understanding of the codebase
- Development experience
## Difficulty
🟠 Medium-Hard - Requires deep codebase understanding
Description
New contributors need guidance on common development tasks like adding a new AI provider, adding configuration options, or debugging. A developer workflow guide would lower the barrier to contribution.
File to Create
docs/src/contributing/developer-guide.mdTask
Create a guide covering:
Adding a new AI provider:
Adding a configuration option:
Writing tests:
Debugging:
Build and test workflow:
Example Content
3. Register in Factory
In
src/core/ai_client_factory.cpp:4. Add Configuration
In
src/include/config.hpp:std::string cohere_api_key; std::string cohere_model = "command-r-plus";5. Add Tests
Create
tests/unit/test_cohere_client.cppwith tests for:...