Contribution Guide
We welcome contributions to ThinkCode! This guide will help you set up your development environment, understand our coding standards, and navigate the contribution process.
Getting Started
Contributing to ThinkCode can be a rewarding experience. Whether you're fixing bugs, adding features, improving documentation, or extending functionality, your contributions help make ThinkCode better for everyone.
Types of Contributions
There are many ways to contribute to ThinkCode:
- Code contributions: Bug fixes, feature implementations, performance improvements
- Documentation: Improving guides, examples, and API documentation
- Testing: Writing tests, testing on different platforms, test automation
- Design: UI/UX improvements, accessibility enhancements
- Translations: Helping make ThinkCode available in more languages
- Bug reports: Identifying and reporting issues
- Feature requests: Suggesting new features or enhancements
Setting Up the Development Environment
Follow these steps to set up your development environment for ThinkCode:
Prerequisites
Before you begin, ensure you have the following installed:
- Node.js: v18.x or higher (LTS recommended)
- pnpm: v8.x or higher
- Git: Recent version
- Visual Studio Code: Latest stable version (recommended)
- Python: v3.10 or higher (for certain components)
Cloning the Repository
- Fork the ThinkCode repository on GitHub
- Clone your fork locally:
- Add the upstream repository as a remote:
Installing Dependencies
ThinkCode uses pnpm workspaces to manage its monorepo structure:
Setting Up Local AI Services
For developing AI-related features, you'll need to set up local AI services:
- Create a
.env.local
file in the root directory with the following variables:
- Start the local AI service:
Running ThinkCode for Development
To start ThinkCode in development mode:
Extension Development
To develop a ThinkCode extension:
Project Structure
Understanding the project structure will help you navigate the codebase:
Coding Standards
ThinkCode follows strict coding standards to ensure code quality and consistency.
TypeScript Guidelines
- Use TypeScript for all new code
- Follow the official TypeScript style guide
- Use strict mode and explicit types
- Prefer interfaces over types for public APIs
- Use nullable types (
type | null
) rather than undefined parameters
Code Style
ThinkCode uses ESLint and Prettier to enforce code style:
- 2 spaces for indentation
- Single quotes for strings
- Semicolons at the end of statements
- No trailing commas in function calls
- Trailing commas in object and array literals
- Maximum line length of 100 characters
Our ESLint configuration enforces these rules. You can check your code using:
Component Architecture
When developing UI components:
- Follow a functional approach
- Use React hooks instead of class components
- Keep components small and focused
- Document component props with JSDoc comments
- Include accessibility attributes
Testing Guidelines
All code should be tested:
- Unit tests: For individual functions and components
- Integration tests: For interactions between components
- End-to-end tests: For complete features
- Visual regression tests: For UI components
We use the following testing tools:
- Jest for unit and integration tests
- Playwright for end-to-end tests
- Storybook for component testing
Tests should be placed in a __tests__
directory adjacent to the code being tested:
The Contribution Process
Finding Issues to Work On
- Check the Good First Issues label
- Look at the Help Wanted issues
- Read the Roadmap for future plans
Making Changes
- Create a new branch for your feature or bugfix:
- Make your changes and commit them following our commit message guidelines
- Keep your branch updated with upstream:
- Ensure your changes pass all tests:
Commit Message Guidelines
We follow conventional commits for our commit messages:
feat:
- A new featurefix:
- A bug fixdocs:
- Documentation changesstyle:
- Changes that don't affect the code's meaning (formatting, etc.)refactor:
- Code changes that neither fix a bug nor add a featureperf:
- Changes that improve performancetest:
- Adding or correcting testschore:
- Changes to the build process or auxiliary tools
Examples:
Pull Request Process
- Push your branch to your fork:
- Open a pull request against the main ThinkCode repository
- Fill out the pull request template with all required information
- Wait for the CI checks to complete
- Address any review comments
Code Review Process
All contributions go through a code review process:
- A maintainer will review your code for:
- Functionality
- Code quality
- Test coverage
- Documentation
- CI checks verify that your changes:
- Build successfully
- Pass all tests
- Meet code style requirements
- Don't introduce performance regressions
- You may need to make changes based on review feedback
- Once approved, a maintainer will merge your pull request
Documentation
Documentation is crucial for any contribution:
Code Documentation
- Use JSDoc comments for functions, classes, and interfaces
- Document parameters, return values, and thrown exceptions
- Provide examples for complex APIs
Feature Documentation
For new features, update or create:
- User documentation in the
/docs
directory - API reference documentation
- Examples in the
/examples
directory - Developer notes in code comments
Releasing and Versioning
ThinkCode follows Semantic Versioning (SemVer):
- Major version (1.0.0): Incompatible API changes
- Minor version (0.1.0): New features in a backward-compatible manner
- Patch version (0.0.1): Backward-compatible bug fixes
Release process:
- Version bump and changelog updates are automated based on conventional commits
- Release candidates are created for testing before final releases
- Stable releases are created from the
main
branch - Hot fixes may be applied to release branches
Community Guidelines
Communication Channels
- GitHub Issues: For bug reports and feature requests
- Discussions: For questions and general discussion
- Discord: For real-time communication
- Weekly Meetings: For contributors and maintainers
Code of Conduct
All contributors must follow our Code of Conduct, which ensures a welcoming and inclusive environment for everyone.
Recognition
Contributors are recognized in several ways:
- Attribution in the changelog
- Listing in the Contributors section
- Recognition in release notes
- Community spotlights for significant contributions
Working with AI Features
ThinkCode integrates various AI technologies. When contributing to AI features:
AI Model Integration
- Understand the models being used
- Test with both online and offline models
- Document API parameters and expected outputs
- Consider model version compatibility
Context Management
When modifying context providers:
- Respect privacy considerations
- Maintain backward compatibility
- Document the context format
- Test with various context sizes
AI Ethics Guidelines
- Ensure AI features respect user privacy
- Avoid bias in AI-generated content
- Provide user control over AI functionality
- Document limitations and potential issues
Troubleshooting
If you encounter issues during development:
Common Development Issues
- Dependency errors: Run
pnpm install --force
to resolve dependency conflicts - Build failures: Check the error log and ensure you have the correct Node.js version
- Test failures: Run tests with
--verbose
flag for detailed output - TypeScript errors: Use VSCode to identify issues or run
pnpm type-check
Getting Help
- Ask in the Discord developer channel
- Create a "Help Wanted" issue
- Check the developer documentation
- Attend office hours for contributor support
Additional Resources
- ThinkCode Architecture Reference
- API Documentation
- Extension Development Guide
- ThinkCode Design System
- Performance Profiling Guide
Thank you for contributing to ThinkCode! Your efforts help build a better tool for developers worldwide.