Contributing Guide
Thank you for your interest in contributing to BrowserBee! This guide will help you get started with contributing to the project.
Code of Conduct#
Please be respectful and considerate of others when contributing to this project. We aim to foster an inclusive and welcoming community.
Getting Started#
Fork the repository
# Clone your forkgit clone https://github.com/yourusername/browserbee.gitcd browserbee # Install dependenciesnpm install # Create a branch for your changesgit checkout -b feature/your-feature-name
Development Workflow#
- Make your changes to the codebase
- Run the development server to test your changes
npm run dev - Test your changes in Chrome:
- Go to
chrome://extensions/ - Enable "Developer mode"
- Click "Load unpacked" and select the
distdirectory
- Go to
- Build the extension for production
npm run build
Project Structure#
The project is organized into several modules:
Agent Module#
The Agent Module processes user instructions and executes browser automation tasks:
src/agent/AgentCore.ts: Main agent classsrc/agent/TokenManager.ts: Token estimation and history trimmingsrc/agent/ToolManager.ts: Tool wrapping with health checkssrc/agent/PromptManager.ts: System prompt generationsrc/agent/MemoryManager.ts: Memory lookup and integrationsrc/agent/ErrorHandler.ts: Cancellation and error handlingsrc/agent/ExecutionEngine.ts: Streaming and non-streaming executionsrc/agent/approvalManager.ts: Handles user approval for sensitive actions
Background Module#
The Background Module manages the extension's background processes:
src/background/index.ts: Entry point for the background scriptsrc/background/tabManager.ts: Tab attachment and managementsrc/background/agentController.ts: Agent initialization and executionsrc/background/streamingManager.ts: Streaming functionalitysrc/background/messageHandler.ts: Message routing and handlingsrc/background/configManager.ts: Provider configuration management
UI Module#
The UI Module provides the user interface for interacting with the extension:
src/sidepanel/: Side panel UI componentssrc/options/: Options page UI components
Models Module#
The Models Module provides a flexible interface for multiple LLM providers:
src/models/providers/: LLM provider implementations
Pull Request Process#
- Ensure your code follows the project's coding style
- Update documentation if necessary
- Test your changes thoroughly
- Submit a pull request with a clear description of your changes
Coding Guidelines#
- Use TypeScript for all new code
- Follow the existing code style
- Add JSDoc comments for new functions and classes
- Use meaningful variable and function names
- Keep functions small and focused on a single responsibility
Testing#
- Test your changes in Chrome
- Ensure the extension builds without errors
- Verify that your changes don't break existing functionality
Documentation#
- Update the README.md if you add new features
- Add JSDoc comments to your code
- Document any non-obvious behavior
- Consider updating the documentation in the
docsdirectory
License#
By contributing to this project, you agree that your contributions will be licensed under the project's Apache 2.0 License.