Skip to content

ink-pipeline

A step-by-step pipeline visualisation with status indicators, progress bars, and duration tracking.

Installation

bash
npm install @matthesketh/ink-pipeline

Peer dependencies: ink (>=5.0.0), react (>=18.0.0), ink-spinner.

Usage

tsx
import React, { useState, useEffect } from 'react';
import { render } from 'ink';
import { Pipeline } from '@matthesketh/ink-pipeline';
import type { PipelineStep } from '@matthesketh/ink-pipeline';

function App() {
  const [steps, setSteps] = useState<PipelineStep[]>([
    { label: 'Install dependencies', status: 'success', duration: 4200 },
    { label: 'Run tests', status: 'running', progress: 0.6 },
    { label: 'Build', status: 'pending' },
    { label: 'Deploy', status: 'pending' },
  ]);

  return <Pipeline steps={steps} title="Release Pipeline" />;
}

render(<App />);

Props

PipelineProps

PropTypeDefaultDescription
stepsPipelineStep[](required)Array of pipeline steps to render.
titlestringundefinedOptional bold title displayed above the steps.
showDurationbooleantrueShow duration next to completed/running steps when duration is set.
showProgressbooleantrueShow a progress bar for running steps when progress is set.
compactbooleanfalseWhen true, hides step output text and connector lines between steps.

PipelineStep

PropertyTypeDefaultDescription
labelstring(required)Display name of the step.
statusStepStatus(required)Current status of the step.
progressnumberundefinedProgress value between 0 and 1. Only displayed when status is running and showProgress is true.
durationnumberundefinedDuration in milliseconds. Formatted automatically (e.g. 420ms, 4.2s).
outputstringundefinedExtra output text displayed below the step (hidden in compact mode).

StepStatus

ts
type StepStatus = 'pending' | 'running' | 'success' | 'error' | 'skipped' | 'rolling-back';
StatusIndicatorColour
pendinghollow circledim
runninganimated spinner (dots)cyan
successcheckmarkgreen
errorcrossred
skippeddashdim
rolling-backloop arrowyellow

Examples

Compact mode

tsx
<Pipeline
  steps={steps}
  compact
  showDuration={false}
/>

With step output

tsx
<Pipeline steps={[
  {
    label: 'Run tests',
    status: 'error',
    duration: 1200,
    output: 'FAIL src/utils.test.ts - Expected 3, received 4',
  },
  { label: 'Deploy', status: 'skipped' },
]} />

Rolling back

tsx
<Pipeline steps={[
  { label: 'Deploy v2.1', status: 'error', duration: 8500 },
  { label: 'Rollback to v2.0', status: 'rolling-back' },
]} />

Notes

  • The progress bar is 8 characters wide and displays a percentage alongside it.
  • Duration is formatted as milliseconds below 1000ms and seconds (one decimal) at or above 1000ms.
  • The running status uses an animated spinner from ink-spinner (dots variant).
  • The component is display-only and does not handle keyboard input.

Released under the MIT Licence.