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.
Prerequisites
Section titled “Prerequisites”git clone https://github.com/amine-amaach/miravo.gitcd miravobun installMonorepo Structure
Section titled “Monorepo Structure”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 scriptsPackages use "workspace:*" for inter-package dependencies.
Development Commands
Section titled “Development Commands”Run the CLI in dev mode:
bun run devRun all tests:
bun run testRun tests for a specific package:
bun run test --cwd packages/coreType check (required — Bun does not typecheck):
bun run typecheckLint:
bun run lintLint and auto-fix:
bun run lint:fixFormat:
bun run formatType Checking
Section titled “Type Checking”Bun transpiles TypeScript but does not type check. Always run:
bun run typecheckThis runs tsc -b (build mode) which follows project references. Do not use tsc --noEmit — it checks nothing with the monorepo’s root config.
Testing Conventions
Section titled “Testing Conventions”- Test files:
*.test.tscolocated 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:
bun run test packages/core/src/scheduler.test.tsLinting
Section titled “Linting”Miravo uses Biome for linting and formatting (not ESLint/Prettier):
Check:
bun run lintAuto-fix:
bun run lint:fixFormat all files:
bun run formatCode Style
Section titled “Code Style”- ES modules only (
import/export) - Use
import type { X }for type-only imports - Prefer Bun APIs over Node.js (
Bun.write()overwriteFile) - No
any— useunknownand narrow with Zod or type guards - Prefer
interfaceovertypefor object shapes - Zod schemas are the single source of truth — derive types with
z.infer<>
Definition of Done
Section titled “Definition of Done”A task is complete when:
bun run typecheck && bun run test && bun run lintAll three must pass with zero failures.
Branch Naming
Section titled “Branch Naming”feat/— New featuresfix/— Bug fixesrefactor/— Code restructuringdocs/— Documentation changes
Commit Messages
Section titled “Commit Messages”Use conventional commits:
feat: add transport-delay generatorfix: correct lifecycle stage transition timingrefactor: extract generator input resolutiondocs: update MQTT adapter reference