Contribution Workflow
This guide outlines how to contribute to the MiningOS ecosystem, covering everything from setting up your development environment to submitting pull requests.
For repository organization and naming conventions, see Repository Structure. For Git branching strategy, see Branching & PR Conventions.
Getting Started
Prerequisites
Before contributing, ensure you have the following installed:
For complete system requirements, see Installation — Prerequisites.
Licensing
MiningOS is released under the Apache License 2.0. By contributing, you agree that your contributions will be licensed under the same terms. Key points:
You retain copyright of your contributions
You grant a perpetual, royalty-free license to use your contributions
Contributions are provided "AS IS" without warranty
For license documentation requirements, see Code Documentation — License Section.
Development Environment Setup
1. Fork and Clone
Fork the repository on GitHub.
Clone your fork locally and navigate into the directory:
Add the upstream remote to sync with the main repository:
For upstream synchronization procedures, see Branching Conventions — Upstream Synchronization.
2. Install Dependencies
Install all required Node.js packages:
3. Configure the Worker
All MiningOS workers use a setup script to initialize configuration files.
Run the setup script to copy configuration templates to their working location:
This copies
.exampleconfiguration files to working copies.(Optional) Generate test-specific configuration files using the
-tflag:
For configuration file structure, see Repository Structure — Standard Directory Structure.
4. Configuration Files
Check out the Repository Structure chapter to learn which files to edit for configuring your worker. Key configuration files include:
5. Verify Setup
Start your worker in development mode with debug logging enabled:
Check the status of the running worker:
For complete installation examples, see Installation Guide.
Pull Request Workflow
Branch Naming Convention
Use descriptive branch names following the {type}/{short-description} pattern.
Types:
feature/— New features or workersfix/— Bug fixesdocs/— Documentation changesrefactor/— Code refactoringtest/— Test additions or modifications
Examples
Create a new branch for a feature:
Create a new branch for a bug fix:
Create a new branch for documentation:
For detailed branching strategy, see Branching & PR Conventions.
Keeping Your Fork Updated
Fetch the latest changes from the main repository:
Switch to your local
mainbranch:Merge the upstream changes into your local branch:
Push the synchronized changes to your fork on GitHub:
For automated upstream merging, see Branching Conventions — Upstream Synchronization.
Pull Request Steps
Create a feature branch from
mainMake changes following Code Standards
Write/update tests (see Testing Guidelines)
Run linting and tests
Commit with meaningful messages (see Branching Conventions — Commit Message Conventions)
Push and create pull request
PR Title Format
Use the convention {type}({scope}): {description}.
Types: feat, fix, docs, refactor, test, chore
Examples:
feat(miner): add Antminer S21 supportfix(orchestrator): resolve action timeout handlingdocs(api): update listThings documentation
For complete PR guidelines, see Branching Conventions — Pull Request Workflow.
Code Standards
JavaScript Style
MiningOS uses Standard style. Key rules:
2-space indentation
No semicolons
Single quotes for strings
Space after keywords (
if,for,while)No unused variables
For complete linting guidelines, see Testing & Linting Guidelines — Linting with Standard.js.
Linting
Check your code for style violations:
Automatically fix style issues where possible:
Naming Conventions
Files (workers)
dot.separated.wrk.js
pm5340.rack.powermeter.wrk.js
Error Handling
Use consistent error codes with the ERR_ prefix.
Throw an error for an invalid request parameter:
Throw an error when a requested resource is not found:
Standard error patterns:
ERR_*_MISSING
Required field missing
—
For error documentation standards, see Code Documentation — Error Message Documentation.
RPC Method Implementation Pattern
Follow this structure for Remote Procedure Call (RPC) methods:
Actual example from Orchestrator worker, file miningos-wrk-ork/workers/aggr.proc.ork.wrk.js:
For RPC communication architecture, see Architecture — RPC Protocol. For function documentation, see Code Documentation — Function Documentation.
Debug Logging
Initialize a debug logger with a namespace:
Log informational messages, errors, and thing-specific errors within your methods:
Enable debug output when running your worker:
Enable logs for all
thingmodules:Enable logs for all
ork(orchestrator) modules:Enable logs for all modules (verbose):
For inline comment standards, see Code Documentation — Inline Comments.
Related Documentation
Contributor Guide
Repository Structure — Code organization and naming conventions
Branching & PR Conventions — Git workflow and commit messages
Testing & Linting Guidelines — Test framework and code style
Code Documentation Standards — JSDoc and documentation requirements
Adding New Worker Type — Creating Level 4 and Level 5 workers
General Documentation
Overview — What is MiningOS
Architecture — System design and RPC communication
Supported Devices — Hardware compatibility
Installation — Complete setup instructions
Operator Manual
Dashboard — Main monitoring interface
Explorer — Device search and management
Requests & Approvals — Action authorization workflow
Alerts Manual — Alert types and error handling
Settings — User management and permissions
Last updated