First off, thank you for considering contributing to MCP Server GPT Image! It's people like you that make this project better.
This project and everyone participating in it is governed by our Code of Conduct. By participating, you are expected to uphold this code.
Before creating bug reports, please check existing issues as you might find out that you don't need to create one. When you are creating a bug report, please include as many details as possible:
- Use a clear and descriptive title
- Describe the exact steps which reproduce the problem
- Provide specific examples to demonstrate the steps
- Describe the behavior you observed after following the steps
- Explain which behavior you expected to see instead and why
- Include logs and error messages if any
Enhancement suggestions are tracked as GitHub issues. When creating an enhancement suggestion, please include:
- Use a clear and descriptive title
- Provide a step-by-step description of the suggested enhancement
- Provide specific examples to demonstrate the steps
- Describe the current behavior and explain which behavior you expected to see instead
- Explain why this enhancement would be useful
- Fill in the required template
- Do not include issue numbers in the PR title
- Follow the TypeScript styleguide
- Include comprehensive tests with good coverage
- Tests must pass before PR review
- Document new code and update existing docs
- Follow SOLID principles for new components
- End all files with a newline
- Tests written and passing
- Test coverage ≥ 80% for new code
- TypeScript types properly defined
- Documentation updated
- No console.logs or debugging code
- Error handling implemented
- SOLID principles followed
We follow TDD practices for all new features and bug fixes:
- Write the test first - Define what success looks like
- Run the test - Ensure it fails (Red phase)
- Write minimal code - Just enough to pass the test (Green phase)
- Refactor - Improve code quality while keeping tests green
- Repeat - Continue until feature is complete
- Fork the repo and create your branch from
main - Set up your development environment:
npm install cp .env.example .env # Add your OpenAI API key - Write tests first for your feature/fix
- Implement the feature following SOLID principles
- Ensure all tests pass:
npm test - Check test coverage:
npm run test:coverage - Run type checking:
npm run typecheck - Update documentation if needed
- Commit with clear, descriptive messages
- Push to your fork and create a Pull Request
- Test Coverage: Maintain minimum 80% coverage for new code
- SOLID Principles: Follow the architecture patterns in ARCHITECTURE.md
- Dependency Injection: Use interfaces for all dependencies
- Type Safety: No
anytypes without justification - Error Handling: Proper error handling with meaningful messages
- Use the present tense ("Add feature" not "Added feature")
- Use the imperative mood ("Move cursor to..." not "Moves cursor to...")
- Limit the first line to 72 characters or less
- Reference issues and pull requests liberally after the first line
- Use TypeScript strict mode
- Prefer
constoverlet - Use meaningful variable names
- Add types to all function parameters and return values
- Use async/await over promises when possible
- Define interfaces for all service contracts
- Avoid
anytype - useunknownif type is truly unknown - Use type guards for runtime type checking
- Prefer composition over inheritance
- Follow AAA pattern: Arrange, Act, Assert
- Use descriptive test names that explain the behavior
- One assertion per test when possible
- Mock external dependencies
- Test edge cases and error conditions
- Use test data builders for complex objects
- Group related tests with
describeblocks
Example:
describe('ImageGenerator', () => {
describe('generate', () => {
it('should return cached result when available', async () => {
// Arrange
const cachedResult = { images: ['cached-image'] };
mockCache.get.mockResolvedValue(cachedResult);
// Act
const result = await generator.generate(input);
// Assert
expect(result).toEqual(cachedResult);
});
});
});- Use Markdown
- Reference functions and classes in backticks: `functionName()`
- Include code examples when relevant
# Run all tests
npm test
# Run tests in watch mode during development
npm test -- --watch
# Run tests for a specific file
npm test -- src/utils/cache.test.ts
# Check coverage
npm run test:coverageSee TESTING.md for comprehensive testing guidelines.
Please read ARCHITECTURE.md to understand the project structure and design principles.
- Single Responsibility: Each class should have one reason to change
- Dependency Injection: Depend on abstractions, not concretions
- Interface Segregation: Create focused interfaces
- Open/Closed: Open for extension, closed for modification
bug- Something isn't workingenhancement- New feature or requestdocumentation- Improvements or additions to documentationgood first issue- Good for newcomershelp wanted- Extra attention is neededneeds tests- PR needs test coveragebreaking change- Introduces breaking changes
If you need help:
- Check the documentation
- Search existing issues
- Ask in discussions
- Create an issue with your question
Thank you for contributing! 🎉