We love your input! We want to make contributing to PromptLens as easy and transparent as possible.
This project and everyone participating in it is governed by our Code of Conduct. By participating, you are expected to uphold this code.
- Fork the repo and create your branch from
main - Name your branch based on the type of change:
- Feature:
feature/description - Bug fix:
fix/description - Documentation:
docs/description - Refactor:
refactor/description
- Feature:
- Write clear, concise commit messages
- Include tests for new functionality
- Update documentation as needed
- Ensure all tests pass and there are no linting errors
-
Update documentation
- README.md for any interface changes
- API.md for API changes
- Update JSDoc comments for new functions/components
- Add ADR for architectural decisions
-
Version Updates
- Update version numbers in package.json
- Update CHANGELOG.md with your changes
-
Quality Checks
- Run
npm run lintto check for linting errors - Run
npm run typecheckfor type checking - Ensure no console errors or warnings
- Run
-
PR Requirements
- Clear description of changes
- Link to related issue(s)
- Screenshots for UI changes
- List of testing steps
- Tag relevant reviewers
- Install Dependencies:
npm install- Set up environment:
cp .env.example .env- Start development servers:
npm run dev- Run tests:
npm run test- Use TypeScript for all new code
- Define interfaces for props and state
- Use type inference where possible
- Avoid
anytype - Use functional components with hooks
- Use functional components
- Keep components small and focused
- Use proper prop types
- Implement error boundaries
- Follow React hooks rules
- Use Tailwind CSS classes
- Follow mobile-first approach
- Use DaisyUI components when possible
- Keep custom CSS minimal
- Write tests for all new components
- Test both success and error cases
- Mock external dependencies
- Aim for high test coverage
- Test component interactions
- Test API integration
- Test form submissions
- Test error handling
- Test critical user flows
- Test across different browsers
- Test responsive design
- Use JSDoc comments for functions
- Document complex logic
- Include usage examples
- Document props and return types
- Write ADRs for significant decisions
- Document API changes
- Update component documentation
- Keep README up to date
When reporting bugs:
- Use the bug report template
- Include:
- Quick summary
- Steps to reproduce
- Expected behavior
- Actual behavior
- Screenshots if applicable
- Environment details
- Possible solution (if you have one)
PromptLens supports multiple LLM models from different providers. Here's how to work with models in the project:
Models are configured in server/src/config/models.ts. This file contains:
- TypeScript interfaces for model configuration
- Default models included in the initial schema
- Helper functions for model management
- Documentation and examples
To add a new model to PromptLens:
- Check
server/src/config/models.tsfor the current model configuration structure - Create a new migration file in
server/src/migrations/- Use the example file
003_example_add_model.ts.exampleas a template - Follow the version numbering pattern
- Include both up and down migrations
- Use the example file
- Test your migration:
# From the server directory npm run migrate:up # Test the up migration npm run migrate:down # Test the down migration
When adding a new model, ensure you provide:
- Unique model ID matching the provider's naming
- Accurate cost information (per 1M tokens)
- Correct capability flags (vision, multilingual, etc.)
- Appropriate context window and token limits
-
Versioning
- Always create a new migration for model changes
- Never modify the initial schema models directly
- Keep migrations forward-only
-
Documentation
- Comment any special model characteristics
- Update relevant documentation
- Include provider-specific notes
-
Testing
- Test both up and down migrations
- Verify model appears in UI correctly
- Check model can be used for comparisons
-
Cost Management
- Use consistent units (per 1M tokens)
- Keep costs up-to-date with provider pricing
- Document any special pricing conditions
By contributing, you agree that your contributions will be licensed under the MIT License.