MagicMirror-3rd-Party-Modules

Pipeline Orchestrator CLI — Reference

Last updated: 2026-04-16

A lightweight Node.js command-line interface reads the declarative stage graph, executes the pipeline end-to-end, and provides structured feedback to contributors. This document now serves as the reference for the shipped implementation.

Key capabilities

Stakeholders

Context & Inputs

Architecture Overview

  1. Command Surface — Implemented with commander, exposing the pipeline root command and subcommands:
    • pipeline list — enumerate available pipelines/stages from the graph.
    • pipeline describe <stage|pipeline> — print detailed metadata for inspection.
    • pipeline run <pipelineId> — execute stages sequentially (default: full-refresh-parallel).
    • pipeline logs [runId|--latest] — inspect structured run metadata saved to .pipeline-runs/.
    • pipeline doctor — check external prerequisites (Node.js version, Git availability, required env vars).
    • pipeline benchmark — summarize persisted run durations for performance baselining.
    • pipeline progress — summarize run outcomes, stage reliability trends, baseline median deltas, and telemetry coverage consistency.
    • pipeline dashboard — render a compact release-check dashboard combining duration, reliability, and resource trends.
  2. Execution Engine — Core runtime that:
    • Loads the stage graph via loadStageGraph and resolves an execution plan with buildExecutionPlan.
    • Applies stage filters derived from --only/--skip and validates referenced stage IDs.
    • Runs stages strictly sequentially (no parallel execution), prepares the environment, logs start/end, and invokes the configured command.
    • Captures exit codes, stdout/stderr, and wraps failures with actionable messages before persisting result metadata.
  3. Stage Runner Abstraction — Normalizes execution for the Node runtime:
    • All supported stages run via node <script>. The current stage graph executes collect-metadata, parallel-processing, and aggregate-catalogue, with publication output generation separated from worker analysis.
  4. State & Artifacts — Maintains an execution ledger (.pipeline-runs/<timestamp>_<pipeline>.json) with start/end timestamps, per-stage status (succeeded, skipped, failed, pending), durations, filters, and failure metadata, enabling future resume functionality and local auditing even when stages are filtered out.
    • Run records also capture resource usage snapshots (CPU usage and RSS/heap memory peak+average) for each orchestrator execution.
  5. Hooks & Validation — After each stage, hooks:
    • Validate declared artifacts against schemas using validateStageFile (Ajv-based).
    • Leave room for future cleanup/cache hooks (e.g. restoring modules_temp) without additional artifact drift checks beyond schema validation.

CLI Options & Flags

Currently available

Commander validates the mutually exclusive options (--only/--skip) so that unknown stage IDs or conflicting filters surface errors before execution. Skipped stages are still recorded in the run ledger so you can see exactly what was omitted.

Future enhancements

The original exploration surfaced a few ideas that remain on the backlog:

Structured Logging

Error Handling & Retry

Integration with Existing Scripts