Thank you for your interest in contributing to Nanocoder! We welcome contributions from developers of all skill levels. This guide will help you get started with contributing to the project.
- Getting Started
- Development Setup
- Making Changes
- Testing
- Coding Standards
- Submitting Changes
- Issue Guidelines
- Community and Communication
Before contributing, please:
- Read our README to understand what Nanocoder does
- Check our issue tracker for existing issues
- Look for issues labeled
good first issueorhelp wantedif you're new to the project
- Node.js 18+
- npm or pnpm
- Git
-
Fork and clone the repository:
git clone https://github.com/YOUR-USERNAME/nanocoder.git cd nanocoder -
Install dependencies:
npm install
-
Build the project:
npm run build
-
Test your setup:
npm run start
-
For development with auto-rebuild:
npm run dev
- Bug Fixes: Address existing issues or problems
- New Features: Add functionality (new AI providers, tools, commands)
- Improvements: Enhance existing features or performance
- Documentation: Improve README, comments, or guides
- Testing: Add or improve tests
- Model Cards: For our recommendations database
-
Create a branch:
git checkout -b feature/your-feature-name
-
Make your changes:
- Follow the existing code style
- Add appropriate TypeScript types
- Update documentation if needed
-
Test your changes:
npm run build npm run start
-
Commit your changes:
git add . git commit -m "feat: add your feature description"
We follow conventional commits:
feat:- New featuresmod:– Smaller modifications to existing featuresfix:- Bug fixesdocs:- Documentation changesrefactor:- Code refactoringtest:- Adding or modifying testschore:- Build process or auxiliary tool changes
All new features and bug fixes should include appropriate tests:
-
Test Suite: We use AVA for testing with TypeScript support
-
Test Files: Place test files alongside source code with
.spec.tsextension (e.g.,source/utils/parser.spec.ts) -
Running Tests: Execute the full test suite with:
pnpm test:all
This command runs: formatting with Prettier, type checks, Eslint checks, AVA tests and Knip.
-
Test Requirements for PRs:
- New features must include passing tests in
.spec.ts/tsxfiles - Bug fixes should include regression tests when possible
- All tests must pass before merging (
pnpm test:allshould complete successfully) - Tests should cover both success cases and error scenarios
- New features must include passing tests in
In addition to automated tests, manual testing is important for CLI interactions:
-
Test different AI providers:
- Ollama (local)
- OpenRouter (API)
- OpenAI-compatible endpoints
-
Test core functionality:
- File operations (read, write, edit)
- Bash command execution
- Custom commands
- MCP server integration
-
Test error scenarios:
- Network failures
- Invalid configurations
- Missing dependencies
When adding tests:
- Use descriptive test names that explain what is being tested
- Follow the existing test patterns in the codebase
- Test edge cases and error conditions
- Keep tests focused and isolated
- Mock external dependencies (APIs, file system) when appropriate
Test File Organization:
For simple cases, place test files alongside the source code:
source/utils/parser.ts
source/utils/parser.spec.ts
For complex testing scenarios requiring multiple test files or shared test utilities, use a __tests__ directory:
source/hooks/useInputState.ts
source/hooks/__tests__/
├── test-helpers.ts
├── useInputState.deletion.spec.ts
├── useInputState.state-management.spec.ts
└── useInputState.undo-redo.spec.ts
This pattern is useful when:
- A single module requires multiple test files organized by category or feature
- Tests need shared fixtures, mocks, or helper functions
- Test complexity benefits from separation of concerns
See source/hooks/__tests__/ for examples of this pattern in practice.
- Strict Mode: The project uses strict TypeScript settings
- Types First: Always define proper TypeScript types
- No
any: Avoid usinganytype; use proper type definitions - ESNext: Use modern JavaScript/TypeScript features
- Formatting: Code is auto-formatted (maintain existing style)
- Naming: Use descriptive variable and function names
- Comments: Add comments for complex logic, not obvious code
- Error Handling: Always handle errors gracefully
- Imports: Group external imports, then internal imports
- Exports: Use named exports; avoid default exports where possible
- Modules: Keep files focused on a single responsibility
- Update Documentation: If your change affects user-facing behavior
- Test Thoroughly: Ensure your changes work across different scenarios
- Create Pull Request: With a clear title and description
## Description
Brief description of what this PR does
## Type of Change
- [ ] Bug fix
- [ ] New feature
- [ ] Breaking change
- [ ] Documentation update
## Testing
- [ ] Tested with Ollama
- [ ] Tested with OpenRouter
- [ ] Tested with OpenAI-compatible API
- [ ] Tested MCP integration (if applicable)
## Checklist
- [ ] Code follows project style guidelines
- [ ] Self-review completed
- [ ] Documentation updated (if needed)
- [ ] No breaking changes (or clearly documented)- Maintainers will review your PR
- Address feedback promptly
- Be open to suggestions and changes
- Once approved, we'll merge your contribution
When reporting bugs, please include:
- Environment: OS, Node.js version, Nanocoder version
- AI Provider: Which provider you were using
- Configuration: Relevant config (sanitize API keys)
- Steps to Reproduce: Clear, step-by-step instructions
- Expected vs Actual: What should happen vs what actually happens
- Logs: Any relevant error messages or debug output
For feature requests:
- Use Case: Explain why this feature would be useful
- Proposed Solution: If you have ideas on implementation
- Alternatives: Other ways you've considered solving this
- Additional Context: Screenshots, examples, or references
bug- Something isn't workingenhancement- New feature or improvementgood first issue- Good for newcomershelp wanted- Extra attention neededdocumentation- Documentation improvementsquestion- Questions or discussions
- GitHub Issues: For bugs, features, and questions
- Discord Server: Join our community Discord server for real-time discussions, help, and collaboration: Join our Discord server
- Be respectful and inclusive
- Focus on constructive feedback
- Help create a welcoming environment for all contributors
- Remember that everyone is learning and contributing voluntarily
All contributors are recognized in the project. We appreciate:
- Code contributions
- Bug reports and testing
- Documentation improvements
- Feature suggestions and feedback
- Community support and discussions
- Test with multiple providers to ensure compatibility
- Handle API failures gracefully
- Respect rate limits and API quotas
- New tools should implement the common tool interface
- Always validate inputs and handle errors
- Document tool capabilities clearly
- Follow MCP protocol specifications
- Test with real MCP servers
- Handle connection failures properly
- Maintain consistent CLI interface
- Provide clear feedback to users
- Handle long-running operations gracefully
Thank you for contributing to Nanocoder! Your efforts help make local-first AI coding tools more accessible and powerful for everyone.