Contributing to ai.matey
Thank you for your interest in contributing to ai.matey! This guide will help you get started.
Ways to Contribute
Section titled “Ways to Contribute”There are many ways to contribute to ai.matey:
- 🐛 Report bugs - Help us identify and fix issues
- ✨ Suggest features - Share ideas for new capabilities
- 📝 Improve documentation - Help others learn ai.matey
- 🔧 Submit pull requests - Contribute code improvements
- 💬 Answer questions - Help users in GitHub discussions
- 🎨 Create examples - Show how to use ai.matey in new ways
Quick Start
Section titled “Quick Start”1. Fork and Clone
Section titled “1. Fork and Clone”# Fork the repository on GitHub, then:git clone https://github.com/YOUR_USERNAME/ai.matey.gitcd ai.matey2. Install Dependencies
Section titled “2. Install Dependencies”npm install3. Build Packages
Section titled “3. Build Packages”npm run build4. Run Tests
Section titled “4. Run Tests”npm testProject Structure
Section titled “Project Structure”ai.matey is a monorepo containing multiple packages:
ai.matey/├── packages/│ ├── ai.matey.core/ # Bridge and Router│ ├── ai.matey.frontend/ # Frontend adapters (7)│ ├── ai.matey.backend/ # Backend adapters (24+)│ ├── ai.matey.middleware/ # Middleware (logging, caching, etc.)│ ├── ai.matey.http/ # HTTP server integrations│ ├── ai.matey.wrapper/ # SDK wrappers│ ├── ai.matey.cli/ # Command-line interface│ ├── ai.matey.react.hooks/ # React hooks│ ├── ai.matey.utils/ # Shared utilities│ ├── ai.matey.types/ # TypeScript type definitions│ └── ai.matey.docs/ # Documentation site (this site!)├── examples/ # Example applications├── scripts/ # Build and utility scripts└── turbo.json # Monorepo build configurationDevelopment Workflow
Section titled “Development Workflow”Making Changes
Section titled “Making Changes”-
Create a branch
Terminal window git checkout -b feature/your-feature-name -
Make your changes
- Write code
- Add tests
- Update documentation
-
Test locally
Terminal window npm run buildnpm test -
Commit your changes
Terminal window git add .git commit -m "feat: add your feature" -
Push and create PR
Terminal window git push origin feature/your-feature-name
Commit Convention
Section titled “Commit Convention”We use Conventional Commits:
<type>(<scope>): <description>
[optional body]
[optional footer]Types:
feat: New featurefix: Bug fixdocs: Documentation changesstyle: Code style changes (formatting, etc.)refactor: Code refactoringtest: Adding or updating testschore: Maintenance tasks
Examples:
feat(core): add new routing strategyfix(backend): resolve Anthropic streaming issuedocs(middleware): improve caching examplestest(frontend): add OpenAI adapter testsTesting
Section titled “Testing”Running Tests
Section titled “Running Tests”# Run all testsnpm test
# Run tests for specific packagenpm test --workspace=ai.matey.core
# Run tests in watch modenpm test -- --watchWriting Tests
Section titled “Writing Tests”We use Jest for testing. Tests live alongside source code:
src/├── bridge.ts└── bridge.test.tsExample test:
import { Bridge } from './bridge';import { MockFrontendAdapter, MockBackendAdapter } from '../test-utils';
describe('Bridge', () => { it('should process chat requests', async () => { const mockBackend = new MockBackendAdapter({ response: { choices: [{ message: { content: 'Hello' } }] } });
const bridge = new Bridge( new MockFrontendAdapter(), mockBackend );
const response = await bridge.chat({ model: 'test', messages: [{ role: 'user', content: 'Hi' }] });
expect(response.choices[0].message.content).toBe('Hello'); });});Code Style
Section titled “Code Style”TypeScript
Section titled “TypeScript”- Use TypeScript for all new code
- Follow existing code style
- Use meaningful variable names
- Add JSDoc comments for public APIs
Example:
/** * Creates a new Bridge instance. * * @param frontendAdapter - Adapter for input format * @param backendAdapter - Adapter for AI provider * @returns Bridge instance */export function createBridge( frontendAdapter: FrontendAdapter, backendAdapter: BackendAdapter): Bridge { return new Bridge(frontendAdapter, backendAdapter);}Formatting
Section titled “Formatting”We use Prettier for code formatting:
npm run formatLinting
Section titled “Linting”We use ESLint for code quality:
npm run lintnpm run lint:fix # Auto-fix issuesDocumentation
Section titled “Documentation”Updating Docs
Section titled “Updating Docs”Documentation lives in packages/ai.matey.docs/:
cd packages/ai.matey.docsnpm start # Start dev server- Guides:
docs/guides/ - API Reference:
docs/api/ - Tutorials:
docs/tutorials/ - Examples:
docs/examples/
Writing Good Docs
Section titled “Writing Good Docs”- Use clear, concise language
- Include code examples
- Add “why” not just “how”
- Keep examples minimal and focused
- Test all code examples
Adding New Features
Section titled “Adding New Features”Adding a Backend Adapter
Section titled “Adding a Backend Adapter”-
Create adapter file:
packages/ai.matey.backend/src/adapters/newprovider.ts -
Implement
BackendAdapterinterface:import type { BackendAdapter, IRChatCompletionRequest } from 'ai.matey.types';export class NewProviderBackendAdapter implements BackendAdapter {name = 'newprovider';constructor(private options: NewProviderOptions) {}async chat(request: IRChatCompletionRequest) {// Convert IR to provider formatconst providerRequest = this.toProviderFormat(request);// Make API callconst providerResponse = await this.api.chat(providerRequest);// Convert back to IRreturn this.toIRFormat(providerResponse);}async *chatStream(request: IRChatCompletionRequest) {// Implement streaming}} -
Add tests:
packages/ai.matey.backend/src/adapters/newprovider.test.ts -
Export adapter:
packages/ai.matey.backend/src/index.ts export { NewProviderBackendAdapter } from './adapters/newprovider'; -
Add documentation:
packages/ai.matey.docs/docs/packages/backend.md -
Create example:
packages/ai.matey.docs/examples/02-providers/newprovider.ts
Adding Middleware
Section titled “Adding Middleware”-
Create middleware file:
packages/ai.matey.middleware/src/newmiddleware.ts -
Implement middleware creator:
import type { Middleware } from 'ai.matey.types';export interface NewMiddlewareOptions {option1: string;option2?: number;}export function createNewMiddleware(options: NewMiddlewareOptions): Middleware {return {name: 'new-middleware',async execute(request, next) {// Before requestconsole.log('Before:', request);// Processconst response = await next(request);// After responseconsole.log('After:', response);return response;}};} -
Add tests and documentation
Pull Request Process
Section titled “Pull Request Process”Before Submitting
Section titled “Before Submitting”- ✅ Tests pass (
npm test) - ✅ Code is formatted (
npm run format) - ✅ No linting errors (
npm run lint) - ✅ Documentation updated
- ✅ Examples added/updated if needed
PR Template
Section titled “PR Template”## DescriptionBrief description of changes
## Type of Change- [ ] Bug fix- [ ] New feature- [ ] Documentation update- [ ] Breaking change
## TestingHow was this tested?
## Checklist- [ ] Tests pass- [ ] Documentation updated- [ ] Examples added/updatedReview Process
Section titled “Review Process”- Automated checks run on PR
- Maintainer review (may request changes)
- Approval and merge
- Release in next version
Getting Help
Section titled “Getting Help”- 💬 GitHub Discussions: Ask questions, share ideas
- 🐛 GitHub Issues: Report bugs, request features
- 📧 Email: For security issues only
Code of Conduct
Section titled “Code of Conduct”- Be respectful and inclusive
- Provide constructive feedback
- Focus on the code, not the person
- Help others learn and grow
License
Section titled “License”By contributing, you agree that your contributions will be licensed under the same license as the project (MIT).
Thank you for contributing to ai.matey! 🎉
Your contributions help make AI more accessible and portable for everyone.
Next Steps
Section titled “Next Steps”- Development Guide - Detailed development setup
- Architecture Guide - Understanding the codebase