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.0arrow-up-right. 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

  1. Fork the repository on GitHub.

  2. Clone your fork locally and navigate into the directory:

  3. Add the upstream remote to sync with the main repository:

For upstream synchronization procedures, see Branching Conventions — Upstream Synchronization.

2. Install Dependencies

  1. Install all required Node.js packages:

3. Configure the Worker

All MiningOS workers use a setup script to initialize configuration files.

  1. Run the setup script to copy configuration templates to their working location:

    This copies .example configuration files to working copies.

  2. (Optional) Generate test-specific configuration files using the -t flag:

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:

File
Purpose
Documentation

config/common.json

Worker-wide settings

config/base.thing.json

Thing-specific configuration

config/facs/net.config.json

Network/RPC configuration

5. Verify Setup

  1. Start your worker in development mode with debug logging enabled:

  2. 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 workers

  • fix/ — Bug fixes

  • docs/ — Documentation changes

  • refactor/ — Code refactoring

  • test/ — Test additions or modifications

Examples

  1. Create a new branch for a feature:

  2. Create a new branch for a bug fix:

  3. Create a new branch for documentation:

For detailed branching strategy, see Branching & PR Conventions.

Keeping Your Fork Updated

  1. Fetch the latest changes from the main repository:

  2. Switch to your local main branch:

  3. Merge the upstream changes into your local branch:

  4. Push the synchronized changes to your fork on GitHub:

For automated upstream merging, see Branching Conventions — Upstream Synchronization.

Pull Request Steps

  1. Create a feature branch from main

  2. Make changes following Code Standards

  3. Write/update tests (see Testing Guidelines)

  4. Run linting and tests

  5. Commit with meaningful messages (see Branching Conventions — Commit Message Conventions)

  6. 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 support

  • fix(orchestrator): resolve action timeout handling

  • docs(api): update listThings documentation

For complete PR guidelines, see Branching Conventions — Pull Request Workflow.

Code Standards

JavaScript Style

MiningOS uses Standardarrow-up-right 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

  1. Check your code for style violations:

  2. Automatically fix style issues where possible:

Naming Conventions

Element
Convention
Example
Documentation

Classes

PascalCase

WrkPowerMeterRack

Methods

camelCase

collectThingSnap

Constants

SCREAMING_SNAKE_CASE

RPC_METHODS

Files (workers)

dot.separated.wrk.js

pm5340.rack.powermeter.wrk.js

Files (libs)

kebab-case.js

wrk-fun-stats.js

Config keys

camelCase

collectSnapsItvMs

Error Handling

Use consistent error codes with the ERR_ prefix.

  1. Throw an error for an invalid request parameter:

  2. Throw an error when a requested resource is not found:

Standard error patterns:

Error Code
Meaning
Related UI

ERR_*_INVALID

Invalid parameter value

ERR_*_NOTFOUND

Resource not found

ERR_*_MISSING

Required field missing

ERR_SLAVE_BLOCK

Operation blocked on slave

ERR_MISSING_WRITE_PERMISSIONS

Insufficient permissions

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 workerarrow-up-right, 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

  1. Initialize a debug logger with a namespace:

  2. Log informational messages, errors, and thing-specific errors within your methods:

Enable debug output when running your worker:

  1. Enable logs for all thing modules:

  2. Enable logs for all ork (orchestrator) modules:

  3. Enable logs for all modules (verbose):

For inline comment standards, see Code Documentation — Inline Comments.


Contributor Guide

General Documentation

Operator Manual

Last updated