Mr Command

Usage no npm install needed!

<script type="module">
  import cirrusctMrCommand from 'https://cdn.skypack.dev/@cirrusct/mr-command';



The command system is completely extensible with Command handlers that conform to defined interfaces and are registered with mr-core when mr is initialized.

Command Handlers

Command handlers are exposed by a package with Command Manifests that define the handlers for a particular command.

A Manifest defines 2 types of handlers, each defining a map keyed on the name of the command:

export interface MrCommandManifest {
    packageHandlers?: { [name: string]: MrPackageCommandHandler };
    commandHandlers?: { [name: string]: MrCommandHandler };


A MrPackageCommandHandler defines a command the operates on a single package in the monorepo. Depending on cli options, the handler may be called separately for multiple packages, but the handler itself only executes for a single package.

export type MrPackageCommandHandler = <TOptions extends MrCommandOptions>(
    mrPackage: MonoRepoPackage,
    options: TOptions,
    buildConfig: BuildConfig,
    logger: Logger
) => Promise<void>;


A MrCommandHandler defines a command that operates on the monorepo generally.

export interface MrCommandHandlerArgs<TOptions extends MrCommandOptions> {
    monoRepo: MonoRepo;
    packages: MonoRepoPackage[];
    cwd: string;
    entryPackage: MonoRepoPackage | null;
    options: TOptions;
    logger: Logger;

export type MrCommandHandler<TOptions extends MrCommandOptions = {}> = (
    args: MrCommandHandlerArgs<TOptions>
) => Promise<void>;