Skip to content

Create developer workflow guide #57

@benodiwal

Description

@benodiwal

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:

  1. Adding a new AI provider:

    • File structure to create
    • Interface to implement
    • Factory registration
    • Testing requirements
  2. Adding a configuration option:

    • Where to add the field
    • How to parse it
    • Documentation updates
  3. Writing tests:

    • Test file naming conventions
    • Using Google Test
    • Mocking external services
  4. Debugging:

    • Using PostgreSQL's elog for debugging
    • Reading extension logs
    • Common issues and solutions
  5. 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

Metadata

Metadata

Labels

documentationImprovements or additions to documentationgood first issueGood for newcomers

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions