Thanks for your interest in contributing! nex-code is an open, multi-provider CLI coding agent. We welcome contributions of all kinds.
git clone https://github.com/hybridpicker/nex-code.git
cd nex-code
npm install
npm run build
cp .env.example .env
npm run install-hooks
npm test # verify everything worksUsers don't need to clone — just run
npx nex-codeornpm install -g nex-code.
- Node.js 20+
- npm 9+
- Git
- Optional:
ghCLI for GitHub Actions tools
Copy .env.example to .env and configure at least one provider:
| Variable | Description | Required |
|---|---|---|
ANTHROPIC_API_KEY |
Anthropic API key | One of these |
OPENAI_API_KEY |
OpenAI API key | is required |
GEMINI_API_KEY |
Google Gemini API key | for testing |
OLLAMA_HOST |
Ollama server URL (default: localhost) | Optional |
npm test # Full suite with coverage (~2000+ tests)
npm run test:watch # Watch mode during development
npx jest tests/tools.test.js # Run specific test file
npx jest --testPathPattern fuzzy # Run tests matching patternTests use Jest. Coverage target is >85%. All tests must pass before PR merge.
npm run build # Build the dist bundleThe build creates dist/nex-code.js — a single-file bundle. Always rebuild after changing source files.
- Branch from
devel:git checkout -b feat/my-feature devel - Make changes in
cli/directory - Write tests in
tests/directory - Run tests:
npm test - Build:
npm run build - Commit with conventional message:
feat: add X,fix: resolve Y - Push and open a Pull Request against
devel
Note:
mainis the release branch. PRs should targetdevel.
bin/nex-code.js # CLI entrypoint (wrapper)
cli/ # All source code
index.js # Main REPL + slash commands
agent.js # Agentic loop (streaming + tool execution)
tools.js # Tool definitions + handlers (44 tools)
tool-tiers.js # Model capability tiers + edit modes
tool-validator.js # Tool argument validation
context-engine.js # Token management + context compression
providers/ # Provider implementations
registry.js # Provider dispatch + model management
anthropic.js # Anthropic provider
openai.js # OpenAI provider
gemini.js # Google Gemini provider
ollama.js # Ollama provider
local.js # Local model provider
skills.js # Skills system (prompt + script skills)
brain.js # Knowledge base with keyword retrieval
file-history.js # Undo/redo + persistent history
session.js # Session save/load/resume
diff.js # Diff display + confirmation
ssh.js # SSH connection management
deploy-config.js # Named deployment configs
index-engine.js # File index + content index
plugins.js # Plugin API (registerTool/registerHook)
audit.js # Tool execution audit logging
dist/ # Built bundle
tests/ # Jest test files
.nex/ # Project-local config (gitignored)
- Add the tool definition to
TOOL_DEFINITIONSincli/tools.js - Add the handler in the
_executeToolInner()switch statement - Add the tool to appropriate tier lists in
cli/tool-tiers.js - Write tests in
tests/tools.test.js - Update the tool count in
tests/tool-format.test.jsif it uses exact count
- Create
cli/providers/your-provider.jsextendingBaseProvider - Register it in
cli/providers/registry.js - Add pricing to
cli/costs.js - Add model tiers to
cli/tool-tiers.js - Add edit mode defaults to
getEditMode()incli/tool-tiers.js - Write tests in
tests/providers/your-provider.test.js
Skills extend nex-code's capabilities. Place them in .nex/skills/:
- Prompt Skills (
.md): Inject instructions into the system prompt - Script Skills (
.js): Provide commands, tools, and handlers
See examples/skills/ for examples.
- No external linter — keep consistent with existing code
constoverletwhere possible- Early returns over deep nesting
- Keep functions focused and short
- Comments only where logic isn't self-evident
- All code, comments, and commits in English
feat: add new feature
fix: resolve bug
docs: update documentation
test: add or update tests
refactor: restructure without behavior change
chore: maintenance tasks
- Keep PRs focused — one feature or fix per PR
- Include tests for new functionality
- Target
develbranch (notmain) - All CI checks must pass
- Update CONTRIBUTING.md if adding new architectural components
Use GitHub Issues with:
- Steps to reproduce
- Expected vs actual behavior
- Node version and OS
- Provider and model (if relevant)
By contributing, you agree that your contributions will be licensed under the MIT License.