Contributing
Contribution workflow for all MDK repositories
Thank you for your interest in contributing to MDK!
This document outlines the contribution workflow for all MDK repositories, from setting up your development environment to submitting pull requests and participating in releases.
Getting Started
Prerequisites
Before contributing, make sure you have the following installed:
- Node.js (version 20.0 or higher)
- Git (latest stable version)
- npm (included with Node.js)
Licensing
MDK is released under the Apache License 2.0.
By contributing, you agree that:
- You retain copyright over your contributions
- You grant a perpetual, worldwide, royalty-free license for their use
- Contributions are provided "AS IS", without warranty
For full details, see the Apache License 2.0.
Development Environment Setup
Fork and Clone
-
Fork the repository on GitHub.
-
Clone your fork locally and navigate into the project directory:
git clone https://github.com/YOUR_USERNAME/REPOSITORY_NAME.git cd REPOSITORY_NAME -
Add the upstream remote to keep your fork in sync with the main repository:
git remote add upstream https://github.com/tetherto/REPOSITORY_NAME.git
Replace
REPOSITORY_NAMEwith the actual repository name.
Pull Request Workflow
Branch Naming Convention
Create branches using the following pattern:
{type}/{short-description}Supported types:
feature/— New features or workersfix/— Bug fixesdocs/— Documentation changesrefactor/— Code refactoringtest/— Test additions or changes
Examples
# New feature
git checkout -b feature/mdk-new-device
# Bug fix
git checkout -b fix/timeout-handlingKeeping Your Fork Updated
Regularly sync your fork with the upstream repository:
git fetch upstream
git checkout main
git merge upstream/main
git push origin mainPull Request Steps
- Create a branch from
main - Make your code changes
- Write or update tests
- Run linting and tests locally
- Commit changes with meaningful messages
- Push your branch and open a Pull Request targeting
main
PR Checklist
Before submitting your PR, ensure that:
- Code builds locally
- Tests pass (
npm test) - Linting passes (
npm run lintornpm run lint:fix) - New features include tests
- Documentation is updated if applicable
PR Title Format
Use the following convention:
{type}({scope}): {description}Types:
featfixdocsrefactortestchore
Examples:
feat(miner): add Antminer S21 supportfix(timeout): resolve action timeout handlingdocs(api): update stats documentation
Release Process
PR Review
All pull requests go through the following review steps:
- Automated Checks — Linting and tests must pass
- Code Review — At least one maintainer approval is required
- Feedback Resolution — All requested changes must be addressed
- Squash and Merge — Maintainers squash commits to keep history clean
Release Workflow
Releases are created by merging approved branches into main and tagging a version when applicable.
Workflow:
- Contributor creates a feature or fix branch from
main - Contributor runs tests locally
- If tests fail, fixes are applied and tests re-run
- Contributor opens a PR targeting
main - Reviewer performs code review
- Contributor addresses feedback (if requested)
- Reviewer approves or rejects the PR
- Approved PRs are merged into
main - Reviewer tags a release version (if applicable)
- Reviewer deploys to production
- On failure, rollback to the previous tag
Workflow Diagram
Versioning and Tagging
Version Tagging
git checkout main
git pull origin main
git tag -a v1.2.0 -m "Release v1.2.0: Add RTD support"
git push origin main
git push origin v1.2.0Versioning Scheme
MDK follows Semantic Versioning:
- MAJOR (
1.x.x) — Breaking changes - MINOR (
x.1.x) — New backward-compatible features - PATCH (
x.x.1) — Backward-compatible bug fixes
Code Standards
JavaScript Style
MDK uses StandardJS style to keep the codebase consistent and easy to review across repositories.
Key rules:
- 2-space indentation
- No semicolons
- Single quotes for strings
- Space after keywords (
if,for,while) - No unused variables
Quick Reference
Common Git Commands
# Start a new feature
git checkout main && git pull && git checkout -b feature/my-feature
# Sync with upstream
git fetch upstream && git merge upstream/main
# Prepare for PR
npm run lint:fix && npm test
# Squash commits
git rebase -i HEAD~N
# Amend last commit
git commit --amend
# Force push after rebase (feature branches only)
git push --force-with-lease origin feature/my-feature
