Thank you for your interest in contributing to NeoKai! This document provides guidelines and information for contributors.
- Fork the repository
- Clone your fork locally
- Install dependencies:
bun install - Create a new branch from
devfor your changes
This project uses a two-branch workflow to optimize development speed while maintaining quality:
-
dev(default branch) - Active development branch- All feature branches should target
dev - PRs to
devrun fast checks only (lint, type check, unit tests, integration tests) - E2E tests run automatically after merge to
dev - Provides fast feedback loops for rapid iteration
- All feature branches should target
-
main- Production-ready code- Only accepts PRs from
devbranch - Full test suite runs for PRs to
main(including E2E tests) - Represents stable, release-ready code
- Only accepts PRs from
-
Feature Development
git checkout dev git pull origin dev git checkout -b feature/my-feature # make changes git push origin feature/my-feature # create PR targeting dev
-
After PR is merged to
dev- E2E tests run automatically
- Monitor CI to ensure all tests pass
- Dev branch remains stable for other contributors
-
Releasing to
main- Create PR from
devtomain - Full test suite runs (all tests including E2E)
- After merge, production deployment can proceed
- Create PR from
| Event | Target Branch | Tests Run |
|---|---|---|
PR → dev |
dev |
Lint, type check, unit tests, integration tests (⚡ fast) |
Merge to dev |
dev |
All tests including E2E (📊 comprehensive) |
PR → main |
main |
All tests including E2E (📊 comprehensive) |
Merge to main |
main |
All tests including E2E (📊 comprehensive) |
Why this approach?
- Speed: Skip expensive E2E tests during active feature development
- Quality: Full validation before production deployment
- Stability: Dev branch validated with E2E after merge
To maintain code quality and workflow integrity, only the dev branch can merge into main. This protection is enforced automatically by CI - no manual approval needed.
How it works:
- The
enforce-merge-policyCI job runs on every PR tomain - It validates that the source branch is
devand nothing else - Attempting to create a PR from any other branch to
mainwill fail immediately
What happens on bypass attempt:
- The CI check will fail with a clear error message:
❌ Only 'dev' branch can merge into 'main'. Current source: <branch> - The PR cannot be merged until the source branch is changed to
dev - This prevents accidental or intentional bypass of the intended workflow
Proper workflow reminder:
- Feature branches →
dev(fast feedback, quick iteration) - After
devis validated with E2E tests → create PR fromdevtomain
This ensures all code going to production has been properly validated through the dev branch.
- Follow the existing code style in the codebase
- Run
bun run lintto check for linting errors - Run
bun run formatto format code automatically
- Write tests for new features and bug fixes
- Ensure all tests pass before submitting a PR:
bun test - For E2E tests:
cd packages/e2e && bun test
Use clear and descriptive commit messages following conventional commit format:
feat:for new featuresfix:for bug fixesdocs:for documentation changestest:for test-related changesrefactor:for code refactoringchore:for maintenance tasksci:for CI/CD changes
Example:
feat: add model switching support in coordinator mode
- Add model parameter to coordinator options
- Update UI to show current model
- Add tests for model switching
-
Ensure your branch is up to date with
devgit checkout dev git pull origin dev git checkout your-feature-branch git rebase dev
-
Create a pull request targeting the
devbranch -
Provide a clear description of your changes
- What problem does it solve?
- How does it work?
- Are there any breaking changes?
-
Wait for CI checks to pass
- PRs to dev will skip E2E tests (faster feedback)
- All other checks must pass
-
Request review from maintainers
-
Address feedback from reviewers
- Make requested changes
- Push updates to your branch
-
Merge will happen after approval and passing checks
- Bun 1.3.8 or later
- Node.js 20.x or later (for compatibility)
- Git
# Clone your fork
git clone https://github.com/YOUR_USERNAME/neokai.git
cd neokai
# Add upstream remote
git remote add upstream https://github.com/lsm/neokai.git
# Install dependencies
bun install
# Build packages
bun run build# Start the development server
cd packages/cli
bun run dev
# Run tests
bun test
# Run specific package tests
cd packages/daemon
bun testCreate a .env file in the root directory:
ANTHROPIC_API_KEY=your_api_key_here
GLM_API_KEY=your_glm_key_here # Optional, for GLM providerIf you have questions or run into issues:
- Check existing issues on GitHub
- Open a new issue with a clear description
- Join our community discussions
- Be respectful and inclusive
- Provide constructive feedback
- Help others learn and grow
- Focus on what is best for the community
Thank you for contributing to NeoKai! 🚀