Skip to content

Stepper is a PowerShell utility module for creating resumable, step-by-step scripts with automatic state persistence and cross-platform support.

License

Notifications You must be signed in to change notification settings

jakehildreth/Stepper

Repository files navigation

The Stepper logo features the word Stepper in a bold, stylized font with a set of stairs ascending diagonally to the right. The design conveys a sense of progress and upward movement, aligning with the tool's purpose of step-by-step automation. The background is plain, ensuring the logo remains the focal point. Font used: https://www.dafont.com/pix.font?fpp=200

Stepper

A PowerShell utility module for creating resumable, step-by-step scripts with automatic state persistence and cross-platform support.

Demo

Test.ps1.mp4

Created with VHS by Charm.

How It Works

  • Each step is tracked by its location in the script (file:line)
  • State is saved after each successful step in a .stepper file (includes ScriptContents, LastCompletedStep, timestamp, and persisted $Stepper data)
  • On resume, completed steps can be skipped automatically
  • If the script has changed between runs, Stepper prompts the user to Resume, Start over (removes the state file), view More details, or Quit
  • Non-resumable code is detected and can be suppressed with #region Stepper ignore/#endregion Stepper ignore or handled interactively
  • Use the More details view to inspect saved step body, Stepper variables, and restart context
  • Call Stop-Stepper at the end to clean up

Installation

Install-Module -Name Stepper

Usage

Wrap your script steps in New-Step blocks. If the script fails inside of a New-Step block, the next run of the script resumes at the step that failed.

#Requires -Modules Stepper
[CmdletBinding()]
param()

New-Step {
    Write-Host "Step 1: Download files..."
    # Your code here
}

New-Step {
    Write-Host "Step 2: Process data..."
    # Your code here
}

New-Step {
    Write-Host "Step 3: Upload results..."
    # Your code here
}

Stop-Stepper

Data Persistence

Use the $Stepper variable to share data between steps:

New-Step {
    $Stepper.Data = Get-Process
}

New-Step {
    $Stepper.Data | Where-Object CPU -gt 100
}

License

MIT License w/Commons Clause - see LICENSE file for details.


Made with 💜 by Jake Hildreth

About

Stepper is a PowerShell utility module for creating resumable, step-by-step scripts with automatic state persistence and cross-platform support.

Resources

License

Stars

Watchers

Forks

Sponsor this project

  •  

Contributors 4

  •  
  •  
  •  
  •