Skip to content
ConsoleMonster

Build steps

Follow a dry-run build from restore to package without running build tools.

Demos Dashboards

Use it when a script needs to explain the current build stage and overall progress.

  • Live
  • 88×26
  • PowerShell 7.4+
  • .NET 8.0+
Build steps 88×2624-bitFull

How it's built

The whole program in one file, with its sample data at the top. It drew the recording above; both languages draw the same cells.

PowerShellbuild-steps.ps1View on GitHub
# Animate a build checklist and overall progress without running a build.
[CmdletBinding()]
param(
    [switch] $StaticSnapshot,
    [ValidateRange(0, 4)] [int] $Step = 0
)

Import-Module ConsoleMonster
# All data is synthetic and inline; no services are contacted or changed.
# All values are synthetic. This example never connects to a host.

# Data: fictional inputs kept in memory.
$stages = @('Restore', 'Compile', 'Test', 'Package')
# Layout: construct the widgets shown on screen.
function New-DemoFrame($Tick) {
    New-ConsoleRows -Gap 1 {
        '[bold]Build pipeline[/] [muted]· Orbit.Tools[/]'
        New-ConsolePanel -Title 'Release checklist' {
            foreach ($index in 0..3) {
                $status = if ($index -lt $Tick) { 'pass' } elseif ($index -eq $Tick) { 'accent' } else { 'muted' }
                $label = if ($index -lt $Tick) { 'complete' } elseif ($index -eq $Tick) { 'running' } else { 'pending' }
                "[$status]$($stages[$index])[/]  $label"
            }
        }
        New-ConsoleProgress -Label Overall -Value $Tick -Total 4
        New-ConsoleKeyValue -Data ([ordered] @{
            'Project' = 'Orbit.Tools'
            'Version' = '1.2.0'
            'Artifacts' = './artifacts/'
            'Publish' = 'manual approval'
        })
        '[muted]Ctrl+C stops the live run.[/]'
    }
}

# Live updates: print one state headlessly, or run the bounded simulation.
if ($StaticSnapshot -or [Console]::IsInputRedirected) {
    New-DemoFrame $Step | Write-ConsoleWidget
    return
}
$frames = @(0..4 | ForEach-Object { New-DemoFrame $_ })
$screen = New-ConsoleRegion -Name demo -Widget $frames[0]
Start-ConsoleDashboard $screen -ArgumentList (, $frames) {
    param($Frames)
    foreach ($frame in $Frames) {
        if ($ConsoleSession.Cancellation.IsCancellationRequested) { break }
        Set-ConsoleRegion -Name demo -Widget $frame
        Start-Sleep -Milliseconds 650
    }
}
C#Program.csView on GitHub
// Animate a build checklist and overall progress without running a build.
// All data is synthetic and inline; no services are contacted or changed.
using ConsoleMonster;
using ConsoleMonster.Layout;
using ConsoleMonster.Live;
using ConsoleMonster.Widgets;

// All values are synthetic. This example never connects to a host.

// Data: fictional inputs kept in memory.
string[] stages = { "Restore", "Compile", "Test", "Package" };
// Run options: redirected input selects a deterministic snapshot.
bool snapshot = args.Contains("--snapshot") || (!args.Contains("--interactive") && Console.IsInputRedirected);
int stepAt = Array.IndexOf(args, "--step");
int step = stepAt < 0 ? 0 : int.Parse(args[stepAt + 1], System.Globalization.CultureInfo.InvariantCulture);
if (step < 0 || step > 4) throw new ArgumentOutOfRangeException(nameof(step));

// Layout: construct the widgets shown on screen.
IWidget Frame(int tick) {
    Rows checklist = new Rows();
    for (int index = 0; index < stages.Length; index++) {
        string status = index < tick ? "pass" : index == tick ? "accent" : "muted";
        string label = index < tick ? "complete" : index == tick ? "running" : "pending";
        checklist.Add(new TextBlock("[" + status + "]" + stages[index] + "[/]  " + label));
    }
    return new Rows(new TextBlock("[bold]Build pipeline[/] [muted]· Orbit.Tools[/]"),
        new Panel(checklist, "Release checklist"), new ProgressBar("Overall").WithValue(tick).WithTotal(4),
        new KeyValueList().Add("Project", "Orbit.Tools").Add("Version", "1.2.0")
            .Add("Artifacts", "./artifacts/").Add("Publish", "manual approval"),
        new TextBlock("[muted]Ctrl+C stops the live run.[/]")) { Gap = 1 };
}

// Live updates: print one state headlessly, or run the bounded simulation.
if (snapshot) {
    Terminal.Write(Frame(step));
    return;
}
Slot screen = new Slot("demo", Frame(0));
using LiveSession session = new LiveSession(screen);
session.Run(live => {
    for (int tick = 0; tick <= 4 && !live.Cancellation.IsCancellationRequested; tick++) {
        screen.Handle(live).Set(Frame(tick));
        if (live.Cancellation.WaitHandle.WaitOne(650)) break;
    }
});

Run it yourself

Three steps in PowerShell, four in C#. Every command copies with one click.

  1. Install the module

    Once. Windows PowerShell 5.1 or PowerShell 7 on Windows, macOS or Linux.

    Install-Module ConsoleMonster -Scope CurrentUser
  2. Save the program

    Download it, or copy it from above into build-steps.ps1.

  3. Run it

    From the folder you saved it in.

    ./build-steps.ps1
  1. Create a project

    A plain console app; .NET 8 or later.

    dotnet new console -n Buildsteps; cd Buildsteps
  2. Add ConsoleMonster

    The only package the program needs.

    dotnet add package ConsoleMonster
  3. Replace Program.cs

    Download it, or copy the program from above.

  4. Run it

    dotnet run

Or skip the copying. Every demo ships with the module and the project template.

Show-ConsoleDemo build-steps
Get-ConsoleDemo build-steps -Path ./build-steps.ps1
dotnet new install ConsoleMonster.Templates
dotnet new consolemonster --demo build-steps -n Buildsteps

Make it yours

Start with these, then read the rest of the file.

  1. Replace the four stage names with your build steps.

  2. Post real completion events from your build process.

  3. Change project facts and artifact directory.

More dashboards

All demos