Thank you for your interest in contributing to Composio SDK! This document provides guidelines and instructions for contributing to the project.
- Development Setup
- Project Structure
- Coding Standards
- Documentation Requirements
- Pull Request Process
- Creating New Providers
- Testing Guidelines
- Release Process
-
Fork and clone the repository:
git clone https://github.com/YOUR_USERNAME/composio.git cd composio -
Install dependencies:
pnpm install
-
Build the project:
pnpm build
-
Run tests:
pnpm test
# Lint code
pnpm lint
# Fix linting issues
pnpm lint:fix
# Format code
pnpm format
# Create a new provider
pnpm create:provider <provider-name> [--agentic]
# Create a new example
pnpm create:example <example-name>
# Check peer dependencies
pnpm check:peer-deps
# Update peer dependencies
pnpm update:peer-depscomposio/
├── packages/ # Main packages directory
│ ├── core/ # Core SDK package
│ └── providers/ # Provider implementations
├── examples/ # Example implementations
├── docs/ # Documentation
├── scripts/ # Development and build scripts
└── .github/ # GitHub configuration
Every source file must include a header comment with:
/**
* @file Description of what this file does/contains
* @module path/to/module
* @description Detailed description of the file's purpose
*
* @author Original Author <email@example.com>
* @contributors
* - Contributor Name <email@example.com>
*
* @copyright Composio 2024
* @license ISC
*
* @see {@link https://related.documentation.link}
* @see {@link https://another.related.link}
*/Every user-facing function must include:
- TSDoc documentation
- Example usage
- Parameter and return type descriptions
- Error cases
Example:
/**
* Executes a tool with the given parameters.
*
* @description
* This function executes a tool with the provided parameters and returns the result.
* It handles authentication, parameter validation, and error cases automatically.
*
* @example
* ```typescript
* const result = await executeTool('GMAIL_SEND_EMAIL', {
* userId: 'user123',
* arguments: {
* to: 'recipient@example.com',
* subject: 'Hello',
* body: 'Message content'
* }
* });
* ```
*
* @param {string} toolId - The unique identifier of the tool to execute
* @param {ExecuteToolOptions} options - Tool execution options
* @returns {Promise<ExecuteToolResult>} The result of the tool execution
*
* @throws {ToolNotFoundError} When the specified tool doesn't exist
* @throws {ValidationError} When required parameters are missing
* @throws {AuthenticationError} When authentication fails
*
* @see {@link https://docs.composio.dev/api/tools#execute}
*/
export async function executeTool(
toolId: string,
options: ExecuteToolOptions
): Promise<ExecuteToolResult> {
// Implementation
}- Use TypeScript for all new code
- Follow the existing code style in the repository
- Use ESLint and Prettier for code formatting
- Use meaningful variable and function names
- Keep functions small and focused
- Write unit tests for all new code
- Use async/await instead of Promises
- Use named exports instead of default exports
- Use const assertions for constants
- Use type assertions sparingly
- Use custom error classes
- Include meaningful error messages
- Document error cases in TSDoc
- Include error codes for API errors
- Log errors appropriately
Example:
/**
* Custom error for tool execution failures.
*/
export class ToolExecutionError extends ComposioError {
constructor(
message: string,
public readonly toolId: string,
public readonly cause?: Error
) {
super(message, 'TOOL_EXECUTION_ERROR');
this.name = 'ToolExecutionError';
}
}Each package must include:
-
README.md with:
- Package description
- Installation instructions
- Usage examples
- API reference
- Environment variables
- Contributing guidelines
-
API documentation:
- TSDoc for all public APIs
- Example code snippets
- Error handling documentation
- Type definitions
-
Example implementations:
- Basic usage example
- Advanced usage examples
- Integration examples
Provider packages must additionally include:
- Provider-specific setup instructions
- Authentication requirements
- Supported features
- Limitations and constraints
- Integration examples
- Streaming support details
- Error handling examples
-
Create a new branch for your changes:
git checkout -b feature/your-feature-name
-
Make your changes following the coding standards
-
Add tests for new functionality
-
Update documentation as needed
-
Create a changeset:
pnpm changeset
-
Push your changes and create a pull request
-
Wait for review and address any feedback
-
Use the provider creation script:
pnpm create:provider my-provider [--agentic]
-
Implement required methods:
- For non-agentic providers:
wrapToolandwrapTools, and helper functions - For agentic providers:
wrapTool,wrapTools, and execution handlers
- For non-agentic providers:
-
Add comprehensive tests
-
Add provider documentation
-
Create example implementations
- Write unit tests for all new code
- Include integration tests for providers
- Test error cases
- Test edge cases
- Use mocks appropriately
- Test streaming functionality
- Test with different Node.js versions
Example test:
describe('ToolExecution', () => {
it('should execute a tool successfully', async () => {
const result = await executeTool('TEST_TOOL', {
userId: 'user123',
arguments: { test: true },
});
expect(result.successful).toBe(true);
});
it('should handle errors appropriately', async () => {
await expect(
executeTool('INVALID_TOOL', {
userId: 'user123',
arguments: {},
})
).rejects.toThrow(ToolNotFoundError);
});
});-
Create a release branch:
git checkout -b release/v1.2.3
-
Update version numbers:
pnpm changeset version
-
Update CHANGELOG.md
-
Create a release commit:
git commit -am "Release v1.2.3" -
Create a pull request for the release
-
After approval, merge and tag:
git tag v1.2.3 git push origin v1.2.3
-
Publish to npm:
pnpm changeset publish
- Join our Discord Community
- Check our Documentation
- File issues on GitHub
By contributing to Composio SDK, you agree that your contributions will be licensed under the ISC License.