Skip to content

Contributing

Set up Miravo for local development. Learn about the Bun monorepo structure, testing conventions, Biome linting, type checking, and how to submit changes.

Miravo is open source and welcomes contributions.

Terminal window
git clone https://github.com/amine-amaach/miravo.git
cd miravo
bun install
miravo/
packages/
cli/ # CLI entry point (Commander.js)
core/ # Engine, scheduler, generators, twin runtime
shared/ # Zod schemas, types, constants
content/ # Built-in models and templates
console/ # Web dashboard (React + shadcn/ui + Vite)
protocols/
mqtt/ # MQTT adapter (aedes embedded + mqtt.js external)
opcua/ # OPC UA adapter (node-opcua)
web/ # Documentation site (Astro + Starlight)
tests/fixtures/ # Stress templates
scripts/ # Build and release scripts

Packages use "workspace:*" for inter-package dependencies.

Run the CLI in dev mode:

Terminal window
bun run dev

Run all tests:

Terminal window
bun run test

Run tests for a specific package:

Terminal window
bun run test --cwd packages/core

Type check (required — Bun does not typecheck):

Terminal window
bun run typecheck

Lint:

Terminal window
bun run lint

Lint and auto-fix:

Terminal window
bun run lint:fix

Format:

Terminal window
bun run format

Bun transpiles TypeScript but does not type check. Always run:

Terminal window
bun run typecheck

This runs tsc -b (build mode) which follows project references. Do not use tsc --noEmit — it checks nothing with the monorepo’s root config.

  • Test files: *.test.ts colocated next to source files
  • Import from bun:test: import { describe, test, expect } from "bun:test"
  • Tests must assert specific values, not that code runs without throwing
  • Never modify a failing test to make it pass — fix the implementation
  • Never mock the thing being tested

Run a single test file:

Terminal window
bun run test packages/core/src/scheduler.test.ts

Miravo uses Biome for linting and formatting (not ESLint/Prettier):

Check:

Terminal window
bun run lint

Auto-fix:

Terminal window
bun run lint:fix

Format all files:

Terminal window
bun run format
  • ES modules only (import/export)
  • Use import type { X } for type-only imports
  • Prefer Bun APIs over Node.js (Bun.write() over writeFile)
  • No any — use unknown and narrow with Zod or type guards
  • Prefer interface over type for object shapes
  • Zod schemas are the single source of truth — derive types with z.infer<>

A task is complete when:

Terminal window
bun run typecheck && bun run test && bun run lint

All three must pass with zero failures.

  • feat/ — New features
  • fix/ — Bug fixes
  • refactor/ — Code restructuring
  • docs/ — Documentation changes

Use conventional commits:

feat: add transport-delay generator
fix: correct lifecycle stage transition timing
refactor: extract generator input resolution
docs: update MQTT adapter reference