PowerShell Idea Lab turns interesting ideas into working PowerShell 7 examples. AI finds a scenario, writes the prompt, generates and runs the code, then records the results so you can explore, copy, and try each lab.
See the difference between a switch that was omitted, passed, or simply evaluated as false.
Review only
PowerShell 7 implementation
AI found the scenario, created the prompt and runner, generated the PowerShell, ran it, and validated the result.
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into the concise prompt used to generate the PowerShell.
Create a PowerShell 7 function that reports whether switch and value parameters were explicitly supplied, while also showing their effective values. Use PSBoundParameters and IsPresent, demonstrate omitted and supplied calls, and make no system changes.
2. The Runner AI Created
AI created run.ps1 to prepare sample data, pass parameters, and invoke the generated PowerShell.
# Loads the generated function into the current runner scope.
. (Join-Path $PSScriptRoot 'solution.ps1')
# Shows defaults where no parameters were explicitly supplied.
'Call 1: no parameters'
Get-SearchIntent | Format-List
# Shows the difference when switches and a value are explicitly supplied.
'Call 2: switches and limit supplied'
Get-SearchIntent -IncludeArchived -Compact:$false -Limit 5 | Format-List
3. The PowerShell AI Generated
solution.ps1 is the runnable PowerShell produced from the AI-created prompt.
# Defines a reusable function that separates parameter intent from effective values.
function Get-SearchIntent {
[CmdletBinding()]
param(
# Lets the caller request archived records.
[switch] $IncludeArchived,
# Lets the caller request a compact result.
[switch] $Compact,
# Limits the number of results while keeping a useful default.
[ValidateRange(1, 100)]
[int] $Limit = 20
)
# Captures the names the caller explicitly supplied to this invocation.
$boundNames = @($PSBoundParameters.Keys)
# Returns an object so intent and values remain easy to inspect or pipe.
[pscustomobject] [ordered] @{
IncludeArchivedValue = $IncludeArchived.IsPresent
IncludeArchivedPassed = $boundNames -contains 'IncludeArchived'
CompactValue = $Compact.IsPresent
CompactPassed = $boundNames -contains 'Compact'
LimitValue = $Limit
LimitPassed = $boundNames -contains 'Limit'
}
}
4. What Happened When It Ran
Captured output, errors, and exit status.
Status: REVIEW-ONLY
PowerShell version: Unavailable (pwsh was not installed and could not be installed in this sandbox)
Command: pwsh -NoLogo -NoProfile -NonInteractive -File ./run.ps1
Exit status: Not available — command was not run
Standard output: Not captured — command was not run
Standard error: Not captured — command was not run
No execution result is claimed for "Know If That Switch Was Actually Passed".
5. Validation Performed by the AI Workflow
The runtime, expected results, and safety boundaries were checked and recorded.
Parse mixed log lines without letting PowerShell’s reusable $Matches variable carry stale data forward.
Review only
PowerShell 7 implementation
AI found the scenario, created the prompt and runner, generated the PowerShell, ran it, and validated the result.
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into the concise prompt used to generate the PowerShell.
Create a PowerShell 7 function that parses tagged log lines like [WARN] message. Return a fresh object for every line, mark unmatched rows clearly, and never reuse stale values from $Matches. Use fictional in-memory input and make no system changes.
2. The Runner AI Created
AI created run.ps1 to prepare sample data, pass parameters, and invoke the generated PowerShell.
# Loads the generated parser into the current runner scope.
. (Join-Path $PSScriptRoot 'solution.ps1')
# Mixes valid and invalid fictional rows so a stale-match bug would be obvious.
$lines = @(
'[INFO] Queue opened'
'this row has no tag'
'[ERROR] Sample item failed validation'
'[DEBUG] Unsupported tag'
)
# Parses every row and displays a stable object shape.
$lines | ConvertFrom-TaggedMessage | Format-Table -AutoSize
3. The PowerShell AI Generated
solution.ps1 is the runnable PowerShell produced from the AI-created prompt.
# Converts tagged text into one predictable object per input line.
function ConvertFrom-TaggedMessage {
[CmdletBinding()]
param(
# Accepts log-like text directly from the pipeline.
[Parameter(Mandatory, ValueFromPipeline)]
[string] $Line
)
process {
# Tests and consumes the match in the same branch so stale $Matches data cannot leak.
if ($Line -match '^\[(?<Level>INFO|WARN|ERROR)\]\s+(?<Message>.+)$') {
# Copies the current successful capture values into a new object immediately.
[pscustomobject] [ordered] @{
Parsed = $true
Level = $Matches.Level
Message = $Matches.Message
Source = $Line
}
}
else {
# Emits explicit nulls for a failed match instead of reading yesterday's captures.
[pscustomobject] [ordered] @{
Parsed = $false
Level = $null
Message = $null
Source = $Line
}
}
}
}
4. What Happened When It Ran
Captured output, errors, and exit status.
Status: REVIEW-ONLY
PowerShell version: Unavailable (pwsh was not installed and could not be installed in this sandbox)
Command: pwsh -NoLogo -NoProfile -NonInteractive -File ./run.ps1
Exit status: Not available — command was not run
Standard output: Not captured — command was not run
Standard error: Not captured — command was not run
No execution result is claimed for "Don’t Let an Old Regex Match Sneak Into the Next Row".
5. Validation Performed by the AI Workflow
The runtime, expected results, and safety boundaries were checked and recorded.
Turn fictional availability into an Excel workbook that ranks meeting slots and charts the strongest options.
Review only
PowerShell 7 implementation
AI found the scenario, created the prompt and runner, generated the PowerShell, ran it, and validated the result.
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into the concise prompt used to generate the PowerShell.
Create a PowerShell 7 function that accepts fictional participant availability and exports an ImportExcel workbook with raw responses, a ranked slot summary, percentages, and a column chart. Write only the requested local workbook and use no network access.
2. The Runner AI Created
AI created run.ps1 to prepare sample data, pass parameters, and invoke the generated PowerShell.
# Loads the generated workbook function.
. (Join-Path $PSScriptRoot 'solution.ps1')
# Creates fictional availability with every person represented for every slot.
$availability = @(
[pscustomobject]@{ Person = 'Avery'; Slot = 'Tue 10:00'; Available = $true }
[pscustomobject]@{ Person = 'Blake'; Slot = 'Tue 10:00'; Available = $true }
[pscustomobject]@{ Person = 'Casey'; Slot = 'Tue 10:00'; Available = $false }
[pscustomobject]@{ Person = 'Avery'; Slot = 'Tue 14:00'; Available = $true }
[pscustomobject]@{ Person = 'Blake'; Slot = 'Tue 14:00'; Available = $true }
[pscustomobject]@{ Person = 'Casey'; Slot = 'Tue 14:00'; Available = $true }
[pscustomobject]@{ Person = 'Avery'; Slot = 'Wed 11:00'; Available = $false }
[pscustomobject]@{ Person = 'Blake'; Slot = 'Wed 11:00'; Available = $true }
[pscustomobject]@{ Person = 'Casey'; Slot = 'Wed 11:00'; Available = $true }
)
# Writes one local workbook beside the lab files.
$path = Join-Path $PSScriptRoot 'meeting-window.xlsx'
Export-MeetingWindowWorkbook -Availability $availability -Path $path | Format-Table -AutoSize
3. The PowerShell AI Generated
solution.ps1 is the runnable PowerShell produced from the AI-created prompt.
# Exports participant availability and a ranked meeting-slot summary.
function Export-MeetingWindowWorkbook {
[CmdletBinding()]
param(
# Accepts records containing Person, Slot, and Available properties.
[Parameter(Mandatory)]
[object[]] $Availability,
# Names the local workbook to create.
[Parameter(Mandatory)]
[string] $Path
)
# Stops early with a clear message when the required module is unavailable.
if (-not (Get-Module -ListAvailable -Name ImportExcel)) {
throw 'ImportExcel is required for this lab.'
}
# Counts distinct participants so every slot uses the same denominator.
$participantCount = @($Availability.Person | Sort-Object -Unique).Count
if ($participantCount -eq 0) {
throw 'At least one participant is required.'
}
# Builds one summary object for every supplied meeting slot.
$summary = @(
$Availability |
Group-Object Slot |
ForEach-Object {
$availableRows = @($_.Group | Where-Object Available)
[pscustomobject] [ordered] @{
Slot = $_.Name
AvailableCount = $availableRows.Count
ParticipantCount = $participantCount
AvailablePercent = [math]::Round(($availableRows.Count / $participantCount) * 100, 1)
AvailablePeople = ($availableRows.Person -join ', ')
}
} |
Sort-Object AvailablePercent, Slot -Descending
)
# Describes the chart before exporting the summary sheet.
$chartParameters = @{
ChartType = 'ColumnClustered'
XRange = 'Slot'
YRange = 'AvailablePercent'
Title = 'Who Can Make Each Time?'
NoLegend = $true
}
$chart = New-ExcelChartDefinition @chartParameters
# Writes the inspectable source rows to the first worksheet.
$rawExport = @{
Path = $Path
WorksheetName = 'Availability'
TableName = 'Availability'
AutoSize = $true
FreezeTopRow = $true
BoldTopRow = $true
ClearSheet = $true
}
$Availability | Export-Excel @rawExport
# Writes the ranked summary and chart to a separate worksheet.
$summaryExport = @{
Path = $Path
WorksheetName = 'Best Times'
TableName = 'MeetingSlots'
AutoSize = $true
FreezeTopRow = $true
BoldTopRow = $true
ExcelChartDefinition = $chart
}
$summary | Export-Excel @summaryExport
# Returns the summary so callers can inspect the same values without opening Excel.
$summary
}
4. What Happened When It Ran
Captured output, errors, and exit status.
Status: REVIEW-ONLY
PowerShell version: Unavailable (pwsh was not installed and could not be installed in this sandbox)
Command: pwsh -NoLogo -NoProfile -NonInteractive -File ./run.ps1
Exit status: Not available — command was not run
Standard output: Not captured — command was not run
Standard error: Not captured — command was not run
No execution result is claimed for "Find the Hour Everyone Can Actually Meet".
5. Validation Performed by the AI Workflow
The runtime, expected results, and safety boundaries were checked and recorded.
Use Jev’s new Boolean pipeline check as a narrow gate, then let ordinary PowerShell route the work.
Review only
Jev + PowerShell 7 implementation
AI found the scenario, created the prompt and runner, generated the PowerShell, ran it, and validated the result.
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into the concise prompt used to generate the PowerShell.
Create a PowerShell 7 router that decides whether fictional requests need a specialist. Use Jev Test-Jev only in an explicit live mode, provide a deterministic fixture mode by default, apply the route in ordinary PowerShell, and make no network call unless live mode is requested.
2. The Runner AI Created
AI created run.ps1 to prepare sample data, pass parameters, and invoke the generated PowerShell.
# Loads the generated Jev-aware router.
. (Join-Path $PSScriptRoot 'solution.ps1')
# Defines fictional requests with no private or credential-bearing data.
$requests = @(
[pscustomobject]@{ Id = 'REQ-101'; Body = 'Please resend my sample receipt.' }
[pscustomobject]@{ Id = 'REQ-102'; Body = 'Identity sync and billing disagree across two systems.' }
[pscustomobject]@{ Id = 'REQ-103'; Body = 'Where can I change my display name?' }
)
# Supplies deterministic answers; the default run makes no API request.
$fixture = @{
'REQ-101' = $false
'REQ-102' = $true
'REQ-103' = $false
}
# Lets PowerShell perform the route after the fixture decision.
Get-SpecialistRoute -Request $requests -Fixture $fixture | Format-Table -AutoSize
3. The PowerShell AI Generated
solution.ps1 is the runnable PowerShell produced from the AI-created prompt.
# Routes fictional requests after a narrow Boolean decision.
function Get-SpecialistRoute {
[CmdletBinding()]
param(
# Accepts records with Id and Body properties.
[Parameter(Mandatory)]
[object[]] $Request,
# Enables the optional authenticated Jev path.
[switch] $Live,
# Supplies deterministic Boolean decisions for safe local validation.
[hashtable] $Fixture = @{}
)
# Loads the current Jev module only when an authenticated live decision was requested.
if ($Live -and -not (Get-Command Test-Jev -ErrorAction SilentlyContinue)) {
Import-Module Jev -ErrorAction Stop
}
foreach ($item in $Request) {
# Rejects incomplete records before either decision path runs.
if ([string]::IsNullOrWhiteSpace([string] $item.Id) -or
[string]::IsNullOrWhiteSpace([string] $item.Body)) {
throw 'Every request needs a non-empty Id and Body.'
}
if ($Live) {
# Uses Jev 0.3.0's pipeline-friendly Boolean command for one narrow question.
$needsSpecialist = [bool] ($item.Body |
Test-Jev -Question 'Does this request require a specialist working across systems?' -Threshold 0.75)
$decisionSource = 'Jev live'
}
else {
# Requires an explicit fixture answer instead of guessing or fabricating an AI response.
if (-not $Fixture.ContainsKey([string] $item.Id)) {
throw "Fixture mode needs a decision for request '$($item.Id)'."
}
$needsSpecialist = [bool] $Fixture[[string] $item.Id]
$decisionSource = 'Fixture'
}
# Keeps the operational action deterministic and visible in ordinary PowerShell.
$route = if ($needsSpecialist) { 'Specialist review' } else { 'Self-service queue' }
# Preserves the input, decision, source, and resulting route for review.
[pscustomobject] [ordered] @{
Id = $item.Id
Body = $item.Body
NeedsSpecialist = $needsSpecialist
Route = $route
DecisionSource = $decisionSource
}
}
}
4. What Happened When It Ran
Captured output, errors, and exit status.
Status: REVIEW-ONLY
PowerShell version: Unavailable (pwsh was not installed and could not be installed in this sandbox)
Command: pwsh -NoLogo -NoProfile -NonInteractive -File ./run.ps1
Exit status: Not available — command was not run
Standard output: Not captured — command was not run
Standard error: Not captured — command was not run
No execution result is claimed for "Let Jev Decide Which Requests Need a Specialist".
5. Validation Performed by the AI Workflow
The runtime, expected results, and safety boundaries were checked and recorded.
Status: Review-only. Checks: required files are present; no output was fabricated; PowerShell parsing and execution are pending.
Safety: The default runner uses fictional fixtures and makes no network call. Live mode is optional and requires the user's own configured Jev module and TYPESAFE_API_KEY.
Turn a fixed seed into a playful, repeatable terminal animation with no delay, input, or machine changes.
Review only
PowerShell 7 implementation
AI found the scenario, created the prompt and runner, generated the PowerShell, ran it, and validated the result.
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into the concise prompt used to generate the PowerShell.
Create a deterministic PowerShell 7 terminal simulation that prints a small school of fish moving across bounded text frames. Accept size, frame count, fish count, and seed; use no sleep, input, files, network, or system changes.
2. The Runner AI Created
AI created run.ps1 to prepare sample data, pass parameters, and invoke the generated PowerShell.
# Loads the generated deterministic terminal simulation.
. (Join-Path $PSScriptRoot 'solution.ps1')
# Prints five bounded frames with a fixed seed and no delay.
Show-FishSchool -Width 32 -Height 7 -Frames 5 -FishCount 5 -Seed 17
3. The PowerShell AI Generated
solution.ps1 is the runnable PowerShell produced from the AI-created prompt.
# Prints deterministic text frames of fish moving across a bounded terminal tank.
function Show-FishSchool {
[CmdletBinding()]
param(
# Sets the inner width of each frame.
[ValidateRange(12, 80)]
[int] $Width = 32,
# Sets the inner height of each frame.
[ValidateRange(4, 20)]
[int] $Height = 7,
# Bounds the amount of generated output.
[ValidateRange(1, 20)]
[int] $Frames = 5,
# Sets the number of fish kept in memory.
[ValidateRange(1, 12)]
[int] $FishCount = 5,
# Makes the starting positions repeatable.
[int] $Seed = 17
)
# Creates the deterministic random source used only for initial positions and speeds.
$random = [System.Random]::new($Seed)
# Builds a small in-memory record for each fish.
$fish = @(
for ($index = 0; $index -lt $FishCount; $index++) {
[pscustomobject] @{
X = $random.Next(0, $Width - 3)
Y = $random.Next(0, $Height)
Speed = $random.Next(1, 3)
}
}
)
for ($frame = 0; $frame -lt $Frames; $frame++) {
# Creates a fresh blank character grid for this frame.
$canvas = @(
for ($row = 0; $row -lt $Height; $row++) {
,([char[]] (' ' * $Width))
}
)
foreach ($item in $fish) {
# Draws a compact right-facing fish inside the safe horizontal range.
$canvas[$item.Y][$item.X] = '>'
$canvas[$item.Y][$item.X + 1] = '<'
$canvas[$item.Y][$item.X + 2] = '>'
# Advances and wraps the fish without sleeping or reading input.
$item.X = ($item.X + $item.Speed) % ($Width - 2)
}
# Prints one fully bounded frame using only plain text.
'Frame {0:d2}' -f ($frame + 1)
'+' + ('-' * $Width) + '+'
foreach ($row in $canvas) {
'|' + (-join $row) + '|'
}
'+' + ('-' * $Width) + '+'
}
}
4. What Happened When It Ran
Captured output, errors, and exit status.
Status: REVIEW-ONLY
PowerShell version: Unavailable (pwsh was not installed and could not be installed in this sandbox)
Command: pwsh -NoLogo -NoProfile -NonInteractive -File ./run.ps1
Exit status: Not available — command was not run
Standard output: Not captured — command was not run
Standard error: Not captured — command was not run
No execution result is claimed for "Make a Tiny School of Fish Swim Through PowerShell".
5. Validation Performed by the AI Workflow
The runtime, expected results, and safety boundaries were checked and recorded.
Turn a few context values into a useful PowerShell prompt line—without changing your profile or host settings.
Review only
PowerShell 7 implementation
AI found the scenario, created the prompt and runner, generated the PowerShell, ran it, and validated the result.
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into the concise prompt used to generate the PowerShell.
Create a PowerShell 7 script that formats a one-line prompt from supplied project, branch, and dirty-state values. Show a fictional example and keep it read-only: do not inspect or change the current shell, profile, or host.
2. The Runner AI Created
AI created run.ps1 to prepare sample data, pass parameters, and invoke the generated PowerShell.
# Passes fictional context to the generated formatter.
$solutionPath = Join-Path $PSScriptRoot 'solution.ps1'
# Prints the formatted line returned by the solution.
& $solutionPath -Project 'Northstar' -Branch 'feature/quiet-launch' -HasChanges $true
3. The PowerShell AI Generated
solution.ps1 is the runnable PowerShell produced from the AI-created prompt.
# Accepts context explicitly so the function does not inspect the shell or profile.
param(
# Supplies the project label to show.
[string] $Project = 'Northstar',
# Supplies the current branch label.
[string] $Branch = 'feature/quiet-launch',
# Indicates whether the supplied worktree has edits.
[bool] $HasChanges = $true
)
# Turns the explicit values into a short, predictable prompt label.
$changeMark = if ($HasChanges) { '*' } else { '' }
# Writes one formatted line without changing the PowerShell prompt function.
'[{0} | {1}{2}]' -f $Project, $Branch, $changeMark
4. What Happened When It Ran
Captured output, errors, and exit status.
REVIEW-ONLY — PowerShell was not available. No stdout or stderr was captured; no run occurred.
5. Validation Performed by the AI Workflow
The runtime, expected results, and safety boundaries were checked and recorded.
Status: Review-only — not executed Runtime: PowerShell 7 required; pwsh is unavailable. Command: pwsh -NoLogo -NoProfile -NonInteractive -File ./run.ps1 (not run) Exit status: Not available — no execution occurred. Checks: Logic reviewed; parser/runtime checks could not be run. Safety: Uses explicit fictional values. Does not alter shell prompt, profile, or host settings.
Summarize a big queue one row at a time, without loading the whole file into a second giant object list.
Review only
PowerShell 7 implementation
AI found the scenario, created the prompt and runner, generated the PowerShell, ran it, and validated the result.
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into the concise prompt used to generate the PowerShell.
Read the provided fictional queue CSV one record at a time and count items by team. Handle quoted commas safely, report the total and team counts, and do not change the source file or use network access.
2. The Runner AI Created
AI created run.ps1 to prepare sample data, pass parameters, and invoke the generated PowerShell.
# Resolves the fictional sample file beside this runner.
$samplePath = Join-Path $PSScriptRoot 'sample-queue.csv'
# Passes the local sample path to the streaming summarizer.
& (Join-Path $PSScriptRoot 'solution.ps1') -Path $samplePath
3. The PowerShell AI Generated
solution.ps1 is the runnable PowerShell produced from the AI-created prompt.
# Accepts a CSV file path and summarizes each row without collecting rows in memory.
param(
# Points to a local CSV file whose header row contains Team.
[Parameter(Mandatory)]
[string] $Path
)
# Loads the built-in parser that correctly handles quoted CSV fields.
Add-Type -AssemblyName Microsoft.VisualBasic
# Creates a parser that reads the file as structured comma-separated text.
$parser = [Microsoft.VisualBasic.FileIO.TextFieldParser]::new($Path)
# Configures standard CSV delimiter and quote handling.
$parser.TextFieldType = [Microsoft.VisualBasic.FileIO.FieldType]::Delimited
$parser.SetDelimiters(',')
$parser.HasFieldsEnclosedInQuotes = $true
# Stores only the small running summary, not every source record.
$counts = [ordered]@{}
$total = 0
try {
# Reads the header row and finds Team without assuming its position.
$headers = $parser.ReadFields()
$teamIndex = [Array]::IndexOf($headers, 'Team')
if ($teamIndex -lt 0) { throw 'The CSV must include a Team column.' }
# Parses one record at a time and updates only the summary counts.
while (-not $parser.EndOfData) {
$fields = $parser.ReadFields()
$team = $fields[$teamIndex]
if (-not $counts.Contains($team)) { $counts[$team] = 0 }
$counts[$team]++
$total++
}
}
finally {
# Closes the local file handle whether parsing succeeds or fails.
$parser.Dispose()
}
# Prints a compact total and stable alphabetical team summary.
"Total records: $total"
foreach ($team in ($counts.Keys | Sort-Object)) {
'{0}: {1}' -f $team, $counts[$team]
}
4. What Happened When It Ran
Captured output, errors, and exit status.
REVIEW-ONLY — PowerShell was not available. No stdout or stderr was captured; no run occurred.
5. Validation Performed by the AI Workflow
The runtime, expected results, and safety boundaries were checked and recorded.
Status: Review-only — not executed Runtime: PowerShell 7 required; pwsh is unavailable. Command: pwsh -NoLogo -NoProfile -NonInteractive -File ./run.ps1 (not run) Exit status: Not available — no execution occurred. Checks: Logic reviewed for row-at-a-time parsing and quoted CSV support; parser/runtime checks unavailable. Safety: Reads only the bundled fictional CSV and prints counts; no network or source-file changes.
Build a tasting workbook that ranks fictional roasts and makes the winner easy to spot.
Review only
PowerShell 7 implementation
AI found the scenario, created the prompt and runner, generated the PowerShell, ran it, and validated the result.
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into the concise prompt used to generate the PowerShell.
Use ImportExcel to create a workbook from the fictional tasting scores below. Add a roast summary with average score and a chart, plus the raw tasting rows. Save only a new workbook in the temporary directory; do not overwrite existing files.
2. The Runner AI Created
AI created run.ps1 to prepare sample data, pass parameters, and invoke the generated PowerShell.
# Loads ImportExcel so a missing prerequisite stops clearly.
Import-Module ImportExcel -ErrorAction Stop
# Selects a new timestamped workbook name inside the system temporary directory.
$outputPath = Join-Path ([System.IO.Path]::GetTempPath()) ('coffee-roast-showdown-' + [guid]::NewGuid().ToString('N') + '.xlsx')
# Invokes the generated workbook builder with the unique destination.
& (Join-Path $PSScriptRoot 'solution.ps1') -OutputPath $outputPath
3. The PowerShell AI Generated
solution.ps1 is the runnable PowerShell produced from the AI-created prompt.
# Requires the ImportExcel module for workbook and chart creation.
# Accepts an output path so the workbook destination stays explicit.
param(
# Chooses the new workbook path supplied by the runner.
[Parameter(Mandatory)]
[string] $OutputPath
)
# Loads the module needed for Excel workbook export.
Import-Module ImportExcel -ErrorAction Stop
# Keeps all tasting notes fictional and in memory.
$tastings = @(
[pscustomobject]@{ Roast = 'Moonrise'; Taster = 'Ari'; Score = 8.5; Note = 'Chocolate, orange' }
[pscustomobject]@{ Roast = 'Moonrise'; Taster = 'Bo'; Score = 9.0; Note = 'Smooth finish' }
[pscustomobject]@{ Roast = 'Daybreak'; Taster = 'Ari'; Score = 7.5; Note = 'Bright, citrus' }
[pscustomobject]@{ Roast = 'Daybreak'; Taster = 'Bo'; Score = 8.0; Note = 'Light body' }
[pscustomobject]@{ Roast = 'Night Ferry'; Taster = 'Ari'; Score = 9.5; Note = 'Deep cocoa' }
[pscustomobject]@{ Roast = 'Night Ferry'; Taster = 'Bo'; Score = 9.0; Note = 'Warm spice' }
)
# Calculates one average score per roast for the chart and summary sheet.
$summary = $tastings | Group-Object Roast | ForEach-Object {
[pscustomobject]@{
Roast = $_.Name
AverageScore = [math]::Round((($_.Group | Measure-Object Score -Average).Average), 2)
TastingCount = $_.Count
}
} | Sort-Object @{ Expression = 'AverageScore'; Descending = $true }, @{ Expression = 'Roast'; Descending = $false }
# Creates a chart definition explicitly so workbook export receives a valid chart object.
$chart = New-ExcelChartDefinition -ChartType BarClustered -XRange Roast -YRange AverageScore -Title 'Average Roast Score' -NoLegend
# Creates a summary sheet with the chart and score color scale.
$summary | Export-Excel -Path $OutputPath -WorksheetName 'Roast Summary' -AutoSize -BoldTopRow -FreezeTopRow -TableName 'RoastSummary' -ConditionalFormat @{ AverageScore = 'ThreeColorScale' } -ExcelChartDefinition $chart
# Adds the fictional tasting records as a separate inspectable worksheet.
$tastings | Export-Excel -Path $OutputPath -WorksheetName 'Tasting Notes' -AutoSize -BoldTopRow -FreezeTopRow -TableName 'TastingNotes' -Append
# Reports the requested path without opening or changing other files.
"Workbook created: $OutputPath"
4. What Happened When It Ran
Captured output, errors, and exit status.
REVIEW-ONLY — PowerShell and ImportExcel were unavailable. No workbook was created and no stdout or stderr was captured.
5. Validation Performed by the AI Workflow
The runtime, expected results, and safety boundaries were checked and recorded.
Status: Review-only — not executed Runtime: PowerShell 7 and ImportExcel required; pwsh and ImportExcel are unavailable. Command: pwsh -NoLogo -NoProfile -NonInteractive -File ./run.ps1 (not run) Exit status: Not available — no execution occurred. Checks: Workbook plan reviewed; module commands, syntax, workbook creation, sheets, and chart could not be verified. Safety: Fictional in-memory rows and a unique workbook path under the temporary directory; no existing files are overwritten.
Use a typed Jev choice to sort a tiny fictional incident, then send uncertain cases to human review.
Review only
Jev + PowerShell 7 implementation
AI found the scenario, created the prompt and runner, generated the PowerShell, ran it, and validated the result.
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into the concise prompt used to generate the PowerShell.
Use Jev's typed Choice question in Mock mode to classify a fictional incident as network, service, or unknown. Apply the chosen safe next step only when confidence is at least 0.75; otherwise route it to human review. Do not run diagnostic commands or make network calls.
2. The Runner AI Created
AI created run.ps1 to prepare sample data, pass parameters, and invoke the generated PowerShell.
# Looks for a local Jev module copy; no installation or live API call is attempted.
$localModulePath = Join-Path $PSScriptRoot 'Jev'
# Uses a local module copy if present, otherwise the installed Jev module.
$parameters = @{}
if (Test-Path (Join-Path $localModulePath 'Jev.psd1')) { $parameters['JevModulePath'] = $localModulePath }
# Runs the fixture with Jev Mock mode selected by the generated solution.
& (Join-Path $PSScriptRoot 'solution.ps1') @parameters
3. The PowerShell AI Generated
solution.ps1 is the runnable PowerShell produced from the AI-created prompt.
# Requires the current Jev module; Mock mode keeps this example offline.
# Accepts an optional local module path for a source checkout.
param(
# Supplies the folder containing Jev.psd1 when testing a local copy.
[string] $JevModulePath
)
# Loads the current Jev command surface without contacting the live service.
if ($JevModulePath) {
Import-Module (Join-Path $JevModulePath 'Jev.psd1') -Force -ErrorAction Stop
}
else {
Import-Module Jev -ErrorAction Stop
}
# Provides a fictional incident summary as the model state.
$incident = [pscustomobject]@{
ticket = 'LAB-204'
note = 'Several demo clients report a timeout while the sample service still appears healthy.'
}
# Defines a typed Choice and safe, non-executing next-step categories.
$question = New-JevQuestion -Name next_clue -Type Choice -Instructions 'Which broad clue best fits this short incident note?' -Criteria @{
network = 'The note points to connection or timeout symptoms.'
service = 'The note points to an unavailable or unhealthy service.'
unknown = 'The note does not support either clear category.'
}
# Requests a deterministic local mock answer; no API key or network call is needed.
$result = Invoke-Jev -State $incident -Question $question -Mock
# Reads the named Choice answer from Jev structured response.
$answer = $result.answers.next_clue
$category = [string] $answer.choice
$confidence = [double] $answer.confidence
# Keeps low-confidence or unrecognized outcomes with a person for review.
if ($confidence -lt 0.75 -or $category -notin @('network', 'service', 'unknown')) {
$nextStep = 'Human review'
}
else {
# Maps a confident category to a harmless suggestion without running commands.
$nextStep = switch ($category) {
'network' { 'Check the fictional connection timeline' }
'service' { 'Review the fictional service health notes' }
default { 'Collect one more symptom from the fictional report' }
}
}
# Prints the choice, its confidence, and the safety-gated suggestion.
[pscustomobject]@{
Ticket = $incident.ticket
Category = $category
Confidence = [math]::Round($confidence, 2)
NextStep = $nextStep
} | Format-List
4. What Happened When It Ran
Captured output, errors, and exit status.
REVIEW-ONLY — PowerShell and Jev were unavailable. The mock path was not run; no response was fabricated.
5. Validation Performed by the AI Workflow
The runtime, expected results, and safety boundaries were checked and recorded.
Status: Review-only — not executed Runtime: PowerShell 7 and Jev 0.2.0+ required; pwsh and Jev are unavailable. Command: pwsh -NoLogo -NoProfile -NonInteractive -File ./run.ps1 (not run) Exit status: Not available — no execution occurred. Checks: Current typed Choice and Invoke-Jev -Mock contract reviewed; mock response and confidence fields could not be executed or parsed here. Safety: Runner selects -Mock. No key, live API, diagnostic command, or network action is included. Confidence under 0.75 routes to human review.
Recreate the classic screen-saver moment with a small, deterministic, no-sleep animation.
Review only
PowerShell 7 implementation
AI found the scenario, created the prompt and runner, generated the PowerShell, ran it, and validated the result.
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into the concise prompt used to generate the PowerShell.
Create a bounded, deterministic PowerShell 7 simulation of a DVD logo bouncing inside a text grid. Accept frame and grid dimensions, print each frame as plain text, and do not use interactive input, cursor control, ANSI escape codes, sleeps, or system changes.
2. The Runner AI Created
AI created run.ps1 to prepare sample data, pass parameters, and invoke the generated PowerShell.
# Uses a small deterministic frame size so output stays compact.
$width = 20
$height = 7
$frames = 4
# Invokes the generated simulator with bounded dimensions.
& (Join-Path $PSScriptRoot 'solution.ps1') -Width $width -Height $height -Frames $frames
3. The PowerShell AI Generated
solution.ps1 is the runnable PowerShell produced from the AI-created prompt.
# Creates a bounded text-only bounce simulation using explicit dimensions and frame count.
param(
# Sets the width of each rendered frame.
[ValidateRange(10, 50)]
[int] $Width = 24,
# Sets the height of each rendered frame.
[ValidateRange(5, 20)]
[int] $Height = 9,
# Sets a small upper bound so output remains easy to inspect.
[ValidateRange(1, 8)]
[int] $Frames = 4
)
# Starts the logo near the upper-left and gives it a repeatable direction.
$x = 1
$y = 1
$dx = 1
$dy = 1
$logo = 'DVD'
# Renders each state into a fresh fixed-width character grid.
for ($frame = 1; $frame -le $Frames; $frame++) {
$canvas = for ($row = 0; $row -lt $Height; $row++) { ' ' * $Width }
$canvas = [System.Collections.Generic.List[string]]::new([string[]] $canvas)
# Places the short logo into the current row without changing the grid size.
$line = $canvas[$y].ToCharArray()
for ($character = 0; $character -lt $logo.Length; $character++) { $line[$x + $character] = $logo[$character] }
$canvas[$y] = -join $line
# Prints a frame label followed by the plain-text picture.
"Frame $frame"
$canvas
# Computes the next position and reverses direction at each edge.
$nextX = $x + $dx
$nextY = $y + $dy
if ($nextX -lt 0 -or $nextX + $logo.Length -ge $Width) { $dx *= -1 }
if ($nextY -lt 0 -or $nextY -ge $Height) { $dy *= -1 }
$x += $dx
$y += $dy
}
4. What Happened When It Ran
Captured output, errors, and exit status.
REVIEW-ONLY — PowerShell was not available. No frames or stdout/stderr were captured; no run occurred.
5. Validation Performed by the AI Workflow
The runtime, expected results, and safety boundaries were checked and recorded.
Status: Review-only — not executed Runtime: PowerShell 7 required; pwsh is unavailable. Command: pwsh -NoLogo -NoProfile -NonInteractive -File ./run.ps1 (not run) Exit status: Not available — no execution occurred. Checks: Bounded simulation logic reviewed; parser/runtime checks could not be run. Safety: Maximum of eight frames; plain text only. No input, cursor movement, escape codes, sleeps, network, or system changes.
Five friends, one shared tab, and a penny that refuses to disappear. This splitter makes the total land exactly right.
Review only
PowerShell 7 implementation
AI found the scenario, created the prompt and runner, generated the PowerShell, ran it, and validated the result.
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into the concise prompt used to generate the PowerShell.
Build a PowerShell 7 function that splits a shared bill among named people without losing cents. Inputs: a total and names. Output: each share and a verified matching total. Allocate leftover cents one at a time. Use fictional data, no network, and no permanent changes.
2. The Runner AI Created
AI created run.ps1 to prepare sample data, pass parameters, and invoke the generated PowerShell.
#requires -Version 7.0
# Use a fixed total and five fictional diners to make the sample repeatable.
$total = [decimal] 49.99
$people = @('Avery', 'Blair', 'Casey', 'Devon', 'Ellis')
# Run the generated split and show each person's share.
& (Join-Path $PSScriptRoot 'solution.ps1') -Total $total -People $people | Format-Table -AutoSize
3. The PowerShell AI Generated
solution.ps1 is the runnable PowerShell produced from the AI-created prompt.
#requires -Version 7.0
[CmdletBinding()]
param(
# Accept the full shared total in dollars.
[Parameter(Mandatory)]
[ValidateRange(0.01, 1000000)]
[decimal] $Total,
# Accept the people who will split the total.
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[string[]] $People
)
# Stop early when there is nobody to split the tab with.
if ($People.Count -eq 0) {
throw 'At least one person is required.'
}
# Convert the total to cents once, using a clear rounding rule.
$totalCents = [long][math]::Round($Total * 100, 0, [MidpointRounding]::AwayFromZero)
# Divide whole cents evenly and keep the remainder for fair allocation.
$baseCents = [long][math]::Floor($totalCents / $People.Count)
$extraCents = [int]($totalCents % $People.Count)
# Give one extra cent to the first people until the remainder is used.
$shares = for ($index = 0; $index -lt $People.Count; $index++) {
$shareCents = $baseCents
if ($index -lt $extraCents) {
$shareCents++
}
# Return each person's share as a two-decimal dollar amount.
[pscustomobject]@{
Person = $People[$index]
Share = [decimal]$shareCents / 100
}
}
# Confirm that rounding did not create or lose money.
$allocatedCents = [long](($shares | Measure-Object -Property Share -Sum).Sum * 100)
if ($allocatedCents -ne $totalCents) {
throw "Share total mismatch: expected $totalCents cents but allocated $allocatedCents."
}
# Display the amount each person owes.
$shares
4. What Happened When It Ran
Captured output, errors, and exit status. The command was not run in this environment.
Status: REVIEW-ONLY
PowerShell version: unavailable (pwsh is not installed in this cloud runtime)
Command: pwsh -NoLogo -NoProfile -File ./run.ps1
Exit status: Not run
stdout: Not captured; the command was not started.
stderr: Not captured; the command was not started.
5. Validation Performed by the AI Workflow
The runtime, expected results, and safety boundaries were checked and recorded.
Validation StatusReview-only
Runtime
PowerShell 7 unavailable; pwsh was not installed.
Command
pwsh -NoLogo -NoProfile -File ./run.ps1
Exit status
Not run.
Checks
The cents-allocation logic and total-reconciliation check were reviewed; execution and parser validation could not be performed.
Safety
Fictional in-memory amounts only. No network, credentials, deletion, or system changes.
Nested data can vanish at the last minute. Give every level its place and prove the JSON survives a round trip.
Review only
PowerShell 7 implementation
AI found the scenario, created the prompt and runner, generated the PowerShell, ran it, and validated the result.
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into the concise prompt used to generate the PowerShell.
Create a PowerShell 7 example that serializes a nested project record with arrays to JSON, then reads it back and checks the deepest fields. Inputs: fictional in-memory data. Output: compact JSON and a round-trip pass/fail summary. Set an explicit safe depth. Do not write files or use the network.
2. The Runner AI Created
AI created run.ps1 to prepare sample data, pass parameters, and invoke the generated PowerShell.
#requires -Version 7.0
# Create fictional data with several nested object and array levels.
$project = [pscustomobject]@{
Name = 'Aurora Refresh'
Owner = 'Morgan'
Milestones = @(
[pscustomobject]@{
Name = 'Prototype'
Tasks = @(
[pscustomobject]@{ Name = 'Color review'; Done = $true }
[pscustomobject]@{ Name = 'Keyboard check'; Done = $false }
)
}
)
}
# Run the generated round-trip check and display its summary.
& (Join-Path $PSScriptRoot 'solution.ps1') -Project $project
3. The PowerShell AI Generated
solution.ps1 is the runnable PowerShell produced from the AI-created prompt.
#requires -Version 7.0
[CmdletBinding()]
param(
# Accept the project object that will be serialized and checked.
[Parameter(Mandatory)]
[pscustomobject] $Project,
# Choose a depth that can hold the nested sample while leaving room to grow.
[ValidateRange(3, 100)]
[int] $Depth = 8
)
# Serialize with an explicit depth so nested values are not silently reduced.
$json = ConvertTo-Json -InputObject $Project -Depth $Depth -Compress
# Read the JSON back into PowerShell objects for a simple round-trip check.
$roundTrip = ConvertFrom-Json -InputObject $json -NoEnumerate
# Count the nested tasks and verify a value at the deepest sample level.
$milestoneCount = @($roundTrip.Milestones).Count
$taskCount = @($roundTrip.Milestones[0].Tasks).Count
$deepValue = [bool]$roundTrip.Milestones[0].Tasks[0].Done
$passed = ($milestoneCount -eq 1 -and $taskCount -eq 2 -and $deepValue)
# Return the JSON text and a small check summary.
[pscustomobject]@{
Json = $json
Depth = $Depth
Milestones = $milestoneCount
NestedTasks = $taskCount
DeepestValueKept = $deepValue
RoundTrip = if ($passed) { 'PASS' } else { 'FAIL' }
}
# Stop the run if any expected nested value was lost.
if (-not $passed) {
throw 'The nested JSON round trip did not preserve the expected values.'
}
4. What Happened When It Ran
Captured output, errors, and exit status. The command was not run in this environment.
Status: REVIEW-ONLY
PowerShell version: unavailable (pwsh is not installed in this cloud runtime)
Command: pwsh -NoLogo -NoProfile -File ./run.ps1
Exit status: Not run
stdout: Not captured; the command was not started.
stderr: Not captured; the command was not started.
5. Validation Performed by the AI Workflow
The runtime, expected results, and safety boundaries were checked and recorded.
Validation StatusReview-only
Runtime
PowerShell 7 unavailable; pwsh was not installed.
Command
pwsh -NoLogo -NoProfile -File ./run.ps1
Exit status
Not run.
Checks
The explicit JSON depth and deepest-value assertions were reviewed; execution and parser validation could not be performed.
Safety
Fictional in-memory data only. No file writes, network, credentials, deletion, or system changes.
Let Jev point to notes that deserve a human look. PowerShell keeps the confidence rule visible, and no message gets sent.
Review only
PowerShell 7 implementation · Jev 0.2.0
AI found the scenario, created the prompt and runner, generated the PowerShell, ran it, and validated the result.
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into the concise prompt used to generate the PowerShell.
Use the current Jev PowerShell module to review fictional support notes for possible sensitive details. Ask a yes/no question, use deterministic mock mode, and return JSON. Route strong signals to human review; leave uncertain cases for review too. Do not send, edit, or store any message.
2. The Runner AI Created
AI created run.ps1 to prepare sample data, pass parameters, and invoke the generated PowerShell.
#requires -Version 7.0
# Build three fictional support notes for the deterministic Jev mock.
$notes = @(
[pscustomobject]@{ Id = 'N-101'; Text = 'Customer included a password in the troubleshooting note.' }
[pscustomobject]@{ Id = 'N-102'; Text = 'The customer asks when the next status update will arrive.' }
[pscustomobject]@{ Id = 'N-103'; Text = 'A private access token may have been pasted into the transcript.' }
)
# Invoke the generated review script and show the proposed review labels.
& (Join-Path $PSScriptRoot 'solution.ps1') -Note $notes | Format-Table -AutoSize
3. The PowerShell AI Generated
solution.ps1 is the runnable PowerShell produced from the AI-created prompt.
#requires -Version 7.0
[CmdletBinding()]
param(
# Accept fictional note records to review.
[Parameter(Mandatory)]
[object[]] $Note,
# Use an example probability threshold as the local review policy.
[ValidateRange(0, 1)]
[double] $ReviewThreshold = 0.80
)
# Load the current Jev commands from an installed module.
Import-Module Jev -ErrorAction Stop
# Define a typed yes/no question with clear evidence on both sides.
$question = New-JevYesNoQuestion -Name sensitive -Question 'Could this note contain a credential or private access detail that should be checked by a person?' -TrueCriteria 'The note mentions a password, credential, secret, access token, or private key.' -FalseCriteria 'The note contains ordinary support context and no sensitive detail.'
# Review each note using Jev's deterministic mock so this sample needs no API key.
$results = foreach ($entry in $Note) {
$json = Invoke-Jev -State $entry.Text -Question $question -Mock -AsJson
$decision = ConvertFrom-Json -InputObject $json
$probability = [double]$decision.sensitive
# Keep the decision policy in ordinary PowerShell and route only for human review.
$route = if ($probability -ge $ReviewThreshold) {
'Review now'
}
else {
'No signal; keep in normal review'
}
# Preserve the full note text and display the probability beside the route.
[pscustomobject]@{
Id = [string]$entry.Id
Probability = [math]::Round($probability, 2)
Route = $route
Note = [string]$entry.Text
}
}
# Return the review suggestions without taking action on the messages.
$results
4. What Happened When It Ran
Captured output, errors, and exit status. The command was not run in this environment.
Status: REVIEW-ONLY
PowerShell version: unavailable (pwsh is not installed in this cloud runtime)
Jev module: not installed or loaded
Command: pwsh -NoLogo -NoProfile -File ./run.ps1
Exit status: Not run
stdout: Not captured; the command was not started.
stderr: Not captured; the command was not started.
Live API: Not attempted.
5. Validation Performed by the AI Workflow
The runtime, expected results, and safety boundaries were checked and recorded.
Validation StatusReview-only
Runtime
PowerShell 7 and Jev 0.2.0 were not available in the cloud runtime.
Command
pwsh -NoLogo -NoProfile -File ./run.ps1
Exit status
Not run.
Checks
The source contract was checked against Jev 0.2.0: New-JevYesNoQuestion, Invoke-Jev -Mock -AsJson, enriched top-level named answers, and nested answers are the current response shape. The local confidence threshold is example policy, not a Jev default.
Safety
Default runner uses fictional notes and mock mode; it makes no network call and only labels records for human review. Live API mode was not attempted.
A full session is easy to miss in a long list. Build a workbook that shows demand, capacity, and which sessions are filling first.
Review only
PowerShell 7 implementation
AI found the scenario, created the prompt and runner, generated the PowerShell, ran it, and validated the result.
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into the concise prompt used to generate the PowerShell.
Create a PowerShell 7 script that turns fictional workshop bookings into an Excel workbook. Inputs: session, track, reserved seats, and capacity. Output: a booking sheet, a by-track summary, and a chart of seats used. Use ImportExcel and write only the named sample workbook.
2. The Runner AI Created
AI created run.ps1 to prepare sample data, pass parameters, and invoke the generated PowerShell.
solution.ps1 is the runnable PowerShell produced from the AI-created prompt.
#requires -Version 7.0
[CmdletBinding()]
param(
# Accept the fictional booking rows prepared by the runner.
[Parameter(Mandatory)]
[object[]] $Booking,
# Choose the one workbook file this example will create.
[Parameter(Mandatory)]
[string] $WorkbookPath
)
# Load ImportExcel so the example can create a workbook without Excel.
Import-Module ImportExcel -ErrorAction Stop
# Combine booking rows into one record per workshop session.
$sessionSummary = @(
$Booking | Group-Object -Property Session | ForEach-Object {
$first = $_.Group[0]
$reserved = [int](($_.Group | Measure-Object -Property Seats -Sum).Sum)
$capacity = [int]$first.Capacity
[pscustomobject]@{
Session = [string]$first.Session
Track = [string]$first.Track
Reserved = $reserved
Capacity = $capacity
FillPct = [math]::Round(($reserved / $capacity) * 100, 1)
}
}
)
# Summarize the reserved seats by track for a second worksheet.
$trackSummary = @(
$sessionSummary | Group-Object -Property Track | ForEach-Object {
[pscustomobject]@{
Track = $_.Name
Sessions = $_.Count
Reserved = [int](($_.Group | Measure-Object -Property Reserved -Sum).Sum)
}
} | Sort-Object Track
)
# Define a chart that compares reserved seats for each session.
$chart = New-ExcelChartDefinition -ChartType BarClustered -XRange Session -YRange Reserved -Title 'Seats reserved by session' -NoLegend
# Export the session data with a chart and readable worksheet formatting.
$sessionSummary | Export-Excel -Path $WorkbookPath -WorksheetName 'Sessions' -TableName 'SessionBookings' -AutoSize -BoldTopRow -FreezeTopRow -ExcelChartDefinition $chart
# Append the summary sheet to the same workbook.
$trackSummary | Export-Excel -Path $WorkbookPath -WorksheetName 'By Track' -TableName 'TrackSummary' -AutoSize -BoldTopRow -Append
# Read the summary sheet back to confirm the workbook has the expected rows.
$writtenSummary = @(Import-Excel -Path $WorkbookPath -WorksheetName 'By Track')
if ($writtenSummary.Count -ne $trackSummary.Count) {
throw 'The exported track summary did not round-trip as expected.'
}
# Return a concise result for the runner.
[pscustomobject]@{
Workbook = $WorkbookPath
Sessions = $sessionSummary.Count
Tracks = $trackSummary.Count
HighestFill = ($sessionSummary | Sort-Object FillPct -Descending | Select-Object -First 1).Session
}
4. What Happened When It Ran
Captured output, errors, and exit status. The command was not run in this environment.
Status: REVIEW-ONLY
PowerShell version: unavailable (pwsh is not installed in this cloud runtime)
ImportExcel: not installed or verified
Command: pwsh -NoLogo -NoProfile -File ./run.ps1
Exit status: Not run
stdout: Not captured; the command was not started.
stderr: Not captured; the command was not started.
5. Validation Performed by the AI Workflow
The runtime, expected results, and safety boundaries were checked and recorded.
Validation StatusReview-only
Runtime
PowerShell 7 unavailable; pwsh was not installed. ImportExcel was not installed or verified.
Command
pwsh -NoLogo -NoProfile -File ./run.ps1
Exit status
Not run.
Checks
Workbook-generation parameters and in-memory aggregation were reviewed; required cmdlets, workbook round-trip, execution, and parser validation could not be checked.
Safety
Fictional booking data only. The runner writes one named workbook in the lab folder; no network, credentials, deletion, or system changes.
Give PowerShell a tiny universe: watch a fixed seed turn into a moving cellular-art pattern.
Review only
PowerShell 7 implementation
AI found the scenario, created the prompt and runner, generated the PowerShell, ran it, and validated the result.
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into the concise prompt used to generate the PowerShell.
Write a PowerShell 7 script that displays a small, deterministic cellular-automaton pattern for a fixed number of generations. Inputs: a fixed starting grid and generation count. Output: each grid in the terminal. Keep it bounded, non-interactive, and in memory only.
2. The Runner AI Created
AI created run.ps1 to prepare sample data, pass parameters, and invoke the generated PowerShell.
#requires -Version 7.0
# Use a fixed 10-row seed so every run paints the same miniature world.
$seed = @(
'..................'
'..................'
'.....#............'
'......#...........'
'....###...........'
'..................'
'............##....'
'............##....'
'..................'
'..................'
)
# Ask the generated PowerShell to display five bounded generations.
& (Join-Path $PSScriptRoot 'solution.ps1') -SeedGrid $seed -GenerationCount 5
3. The PowerShell AI Generated
solution.ps1 is the runnable PowerShell produced from the AI-created prompt.
#requires -Version 7.0
[CmdletBinding()]
param(
# Accept the starting rows, where # is alive and . is empty.
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[string[]] $SeedGrid,
# Keep the display small and bounded for repeatable terminal output.
[ValidateRange(0, 8)]
[int] $GenerationCount = 5
)
# Make a working copy so the caller's sample grid is not changed.
$grid = @($SeedGrid | ForEach-Object { [string]$_ })
$height = $grid.Count
$width = $grid[0].Length
# Confirm every row has the same width before simulating.
if ($grid | Where-Object Length -ne $width) {
throw 'Every row in SeedGrid must have the same width.'
}
# Draw a bounded sequence of generations in the terminal.
for ($generation = 0; $generation -le $GenerationCount; $generation++) {
# Label each frame so the changes are easy to follow.
Write-Output "Generation $generation"
# Print live cells as blocks and empty cells as dots.
foreach ($row in $grid) {
Write-Output ($row.Replace('#', '█').Replace('.', '·'))
}
# Stop after drawing the requested final generation.
if ($generation -eq $GenerationCount) {
break
}
# Create a fresh grid for the next generation.
$nextGrid = [System.Collections.Generic.List[string]]::new()
# Evaluate each cell using the eight surrounding positions.
for ($y = 0; $y -lt $height; $y++) {
$nextRow = [System.Text.StringBuilder]::new()
for ($x = 0; $x -lt $width; $x++) {
$neighbors = 0
# Count living neighbors, treating cells outside the board as empty.
for ($dy = -1; $dy -le 1; $dy++) {
for ($dx = -1; $dx -le 1; $dx++) {
if ($dx -eq 0 -and $dy -eq 0) {
continue
}
$ny = $y + $dy
$nx = $x + $dx
if ($ny -ge 0 -and $ny -lt $height -and $nx -ge 0 -and $nx -lt $width) {
if ($grid[$ny][$nx] -eq '#') {
$neighbors++
}
}
}
}
# Keep live cells with two or three neighbors; birth on exactly three.
$alive = $grid[$y][$x] -eq '#'
$nextCell = if ($alive -and $neighbors -in 2, 3) {
'#'
}
elseif (-not $alive -and $neighbors -eq 3) {
'#'
}
else {
'.'
}
# Add the next cell to its row.
[void]$nextRow.Append($nextCell)
}
# Save the completed row for the next frame.
[void]$nextGrid.Add($nextRow.ToString())
}
# Advance the simulation without changing any system state.
$grid = @($nextGrid.ToArray())
}
4. What Happened When It Ran
Captured output, errors, and exit status. The command was not run in this environment.
Status: REVIEW-ONLY
PowerShell version: unavailable (pwsh is not installed in this cloud runtime)
Command: pwsh -NoLogo -NoProfile -File ./run.ps1
Exit status: Not run
stdout: Not captured; the command was not started.
stderr: Not captured; the command was not started.
5. Validation Performed by the AI Workflow
The runtime, expected results, and safety boundaries were checked and recorded.
Validation StatusReview-only
Runtime
PowerShell 7 unavailable; pwsh was not installed.
Command
pwsh -NoLogo -NoProfile -File ./run.ps1
Exit status
Not run.
Checks
The simulation uses a fixed seed, a maximum of eight generations, rectangular bounds, and no persistent state; runtime and parser checks were unavailable.
Safety
In-memory deterministic simulation only. No network, credentials, files, deletion, or system changes.
AI found the scenario, created the prompt and runner, generated the PowerShell, ran it, and validated the result.
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into the concise prompt used to generate the PowerShell.
Create a source-only Go/Wails desktop demo and a CLI that share one small planning engine. PowerShell sends fictional session JSON to the CLI and reads a structured result. Include build instructions and source bundle. Do not include executables or use network data at runtime.
2. The Runner AI Created
AI created run.ps1 to prepare sample data, pass parameters, and invoke the generated PowerShell.
#requires -Version 7.0
# Use the platform-specific executable name created by the source build.
$cliPath = Join-Path $PSScriptRoot 'source/bin/plancli'
if ($IsWindows) {
$cliPath += '.exe'
}
# Read the fictional session plan and call the locally built Go CLI.
$items = @(
[pscustomobject]@{ Name = 'Prompt Lab'; Track = 'AI'; Minutes = 45 }
[pscustomobject]@{ Name = 'PowerShell Games'; Track = 'Creative'; Minutes = 30 }
[pscustomobject]@{ Name = 'Excel Stories'; Track = 'Data'; Minutes = 40 }
)
# Run the generated PowerShell contract; it requires the local CLI binary.
& (Join-Path $PSScriptRoot 'solution.ps1') -Session $items -CliPath $cliPath
3. The PowerShell AI Generated
solution.ps1 is the runnable PowerShell produced from the AI-created prompt.
#requires -Version 7.0
[CmdletBinding()]
param(
# Accept fictional session objects from PowerShell.
[Parameter(Mandatory)]
[object[]] $Session,
# Point to the CLI built from the included Go source.
[Parameter(Mandatory)]
[string] $CliPath
)
# Stop with build guidance if the source-only CLI is not present yet.
if (-not (Test-Path -LiteralPath $CliPath -PathType Leaf)) {
throw "Build the local CLI first with .\source\build.ps1; expected '$CliPath'."
}
# Create a compact JSON request that both the CLI and Wails UI understand.
$request = [pscustomobject]@{
sessions = @($Session | ForEach-Object {
[pscustomobject]@{
name = [string]$_.Name
track = [string]$_.Track
minutes = [int]$_.Minutes
}
})
}
$json = ConvertTo-Json -InputObject $request -Depth 6 -Compress
# Send only the structured request to the local CLI and capture its JSON result.
$responseText = $json | & $CliPath
if ($LASTEXITCODE -ne 0) {
throw "The local planning CLI returned exit code $LASTEXITCODE."
}
# Parse and display the structured result from the shared Go engine.
$response = ConvertFrom-Json -InputObject ($responseText -join [Environment]::NewLine)
$response
4. What Happened When It Ran
Captured output, errors, and exit status. The command was not run in this environment.
Status: REVIEW-ONLY
PowerShell version: unavailable (pwsh is not installed in this cloud runtime)
Go/Wails: not installed or executed
Command: pwsh -NoLogo -NoProfile -File ./run.ps1
Exit status: Not run
stdout: Not captured; the command was not started.
stderr: Not captured; the command was not started.
Build: Not attempted.
5. Validation Performed by the AI Workflow
The runtime, expected results, and safety boundaries were checked and recorded.
Validation StatusReview-only
Runtime
PowerShell 7, Go, and Wails were unavailable in the cloud runtime.
Command
pwsh -NoLogo -NoProfile -File ./run.ps1
Exit status
Not run.
Checks
Source contract reviewed: PowerShell sends JSON to the CLI over standard input, the CLI returns JSON over standard output, and the Wails UI calls the same Go package. No executable was included.
Safety
The default example uses fictional in-memory data; no runtime network access, credentials, deletion, or system changes. Local build dependency downloads are an explicit build step.
A few lines of PowerShell can turn a seed into a shareable little universe: glowing moon, scattered stars, and a new constellation every time you change the seed.
Passed
PowerShell 7 implementation
AI found the scenario, created the prompt and runner, generated the PowerShell, ran it, and validated the result.
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into this concise prompt. That prompt was then used to generate the PowerShell.
Create a PowerShell 7 script that uses a fixed random seed to generate a small, self-contained SVG night sky with a moon, stars, and connected constellation points. Inputs: seed and output path. Output: a valid SVG file and a short summary. Keep it deterministic and offline.
2. The Runner AI Created
AI also created run.ps1. It prepares the sample data, passes the parameters, and invokes the generated PowerShell.
#requires -Version 7.0
# Pick a fixed seed so the cloud validation output stays reproducible.
$seed = 2718
$outputPath = Join-Path $PSScriptRoot 'night-sky.svg'
# Create a shareable SVG file using the generated PowerShell script.
& (Join-Path $PSScriptRoot 'solution.ps1') -Seed $seed -OutputPath $outputPath | Format-List
3. The PowerShell AI Generated
solution.ps1 is the runnable PowerShell produced from the AI-created prompt.
#requires -Version 7.0
[CmdletBinding()]
param(
# Set the seed so the same input creates the same sky every time.
[int] $Seed = 2718,
# Choose where to write the new SVG artwork.
[Parameter(Mandatory)]
[string] $OutputPath
)
# Use a local random generator so this script does not change global random state.
$random = [System.Random]::new($Seed)
$width = 720
$height = 420
$stars = [System.Collections.Generic.List[string]]::new()
# Generate a bounded set of tiny stars with deterministic positions and sizes.
for ($index = 0; $index -lt 72; $index++) {
$x = $random.Next(18, $width - 18)
$y = $random.Next(16, $height - 16)
$radius = [math]::Round($random.NextDouble() * 1.5 + 0.4, 2)
$opacity = [math]::Round($random.NextDouble() * 0.55 + 0.35, 2)
$stars.Add(('<circle cx="{0}" cy="{1}" r="{2}" fill="#f4f7ff" opacity="{3}"/>' -f $x, $y, $radius, $opacity))
}
# Create a small constellation from fixed points so the shape is easy to spot.
$constellation = @(
'<polyline points="120,275 190,230 245,270 305,205 360,230 425,160"'
'fill="none" stroke="#9fe7ff" stroke-width="2" opacity="0.85"/>'
'<circle cx="120" cy="275" r="4" fill="#a8e9ff"/>'
'<circle cx="190" cy="230" r="4" fill="#a8e9ff"/>'
'<circle cx="245" cy="270" r="4" fill="#a8e9ff"/>'
'<circle cx="305" cy="205" r="4" fill="#a8e9ff"/>'
'<circle cx="360" cy="230" r="4" fill="#a8e9ff"/>'
'<circle cx="425" cy="160" r="4" fill="#a8e9ff"/>'
) -join [Environment]::NewLine
# Build the SVG as plain text with a night gradient, moon, stars, and constellation.
$svg = @"
<svg xmlns="http://www.w3.org/2000/svg" width="$width" height="$height" viewBox="0 0 $width $height">
<defs>
<linearGradient id="sky" x1="0" y1="0" x2="1" y2="1">
<stop offset="0%" stop-color="#101a44"/>
<stop offset="55%" stop-color="#263d73"/>
<stop offset="100%" stop-color="#572f65"/>
</linearGradient>
<radialGradient id="moonGlow">
<stop offset="0%" stop-color="#fff8cf" stop-opacity="0.75"/>
<stop offset="100%" stop-color="#fff8cf" stop-opacity="0"/>
</radialGradient>
</defs>
<rect width="100%" height="100%" fill="url(#sky)"/>
<circle cx="575" cy="105" r="90" fill="url(#moonGlow)"/>
<circle cx="575" cy="105" r="34" fill="#fff3b0"/>
$($stars -join [Environment]::NewLine)
$constellation
<text x="30" y="390" fill="#dce8ff" font-family="sans-serif" font-size="16">A tiny sky, generated with PowerShell 7 · seed $Seed</text>
</svg>
"@
# Create the selected output directory when it does not yet exist.
$parent = Split-Path -Parent $OutputPath
if (-not (Test-Path -LiteralPath $parent -PathType Container)) {
New-Item -ItemType Directory -Path $parent -Force | Out-Null
}
# Save the vector image as UTF-8 without a byte-order mark.
[System.IO.File]::WriteAllText($OutputPath, $svg, [System.Text.UTF8Encoding]::new($false))
# Return a short summary while leaving the image ready to open in a browser.
[pscustomobject]@{
File = [System.IO.Path]::GetFileName($OutputPath)
Seed = $Seed
StarCount = $stars.Count
Dimensions = ('{0}x{1}' -f $width, $height)
}
A deterministic SVG generated from seed 2718.4. What Happened When It Ran
The captured PowerShell version, command, standard output, standard error, and exit status.
When 04/05 could mean April or May, don’t guess. This parser shows the valid date, flags the ambiguous one, and leaves bad input visible.
Passed
PowerShell 7 implementation
AI found the scenario, created the prompt and runner, generated the PowerShell, ran it, and validated the result.
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into this concise prompt. That prompt was then used to generate the PowerShell.
Write a PowerShell 7 parser for fictional date strings that may use ISO, day-first, or month-first formats. Inputs: record ID and date text. Output: Parsed, Ambiguous, or Invalid plus the matching value when it is unique. Check every allowed format and never silently guess.
2. The Runner AI Created
AI also created run.ps1. It prepares the sample data, passes the parameters, and invokes the generated PowerShell.
#requires -Version 7.0
# Use sample strings with clear, ambiguous, and invalid outcomes.
$records = @(
[pscustomobject]@{ Id = 'ROW-1'; Text = '2026-09-27' }
[pscustomobject]@{ Id = 'ROW-2'; Text = '27/09/2026' }
[pscustomobject]@{ Id = 'ROW-3'; Text = '04/05/2026' }
[pscustomobject]@{ Id = 'ROW-4'; Text = '35/14/2026' }
)
# Run the exact-format parser and keep every row in the table.
& (Join-Path $PSScriptRoot 'solution.ps1') -Record $records | Format-Table -AutoSize
3. The PowerShell AI Generated
solution.ps1 is the runnable PowerShell produced from the AI-created prompt.
#requires -Version 7.0
[CmdletBinding()]
param(
# Receive sample records with an ID and an untrusted date string.
[Parameter(Mandatory)]
[object[]] $Record
)
# Use explicit format and culture pairs instead of the machine's current locale.
$formats = @(
[pscustomobject]@{ Pattern = 'yyyy-MM-dd'; Culture = [cultureinfo]::InvariantCulture; Label = 'ISO' }
[pscustomobject]@{ Pattern = 'dd/MM/yyyy'; Culture = [cultureinfo]::GetCultureInfo('en-GB'); Label = 'day-first' }
[pscustomobject]@{ Pattern = 'MM/dd/yyyy'; Culture = [cultureinfo]::GetCultureInfo('en-US'); Label = 'month-first' }
)
# Test each input against every supported format and keep all unique outcomes.
foreach ($entry in $Record) {
# Store successful date values and the format labels that matched.
$matches = [System.Collections.Generic.List[object]]::new()
# Try each exact pattern so unrelated date guesses cannot slip in.
foreach ($format in $formats) {
$parsed = [datetime]::MinValue
$ok = [datetime]::TryParseExact([string] $entry.Text, $format.Pattern, $format.Culture, [Globalization.DateTimeStyles]::None, [ref] $parsed)
# Record successful parses for ambiguity detection.
if ($ok) {
$matches.Add([pscustomobject]@{ Date = $parsed.Date; Format = $format.Label })
}
}
# Compare unique dates, not formats, so two matching rules may agree.
$uniqueDates = @($matches.Date | Sort-Object -Unique)
$status = 'Invalid'
$dateText = ''
# One unique result is safe to use, while conflicting results need review.
if ($uniqueDates.Count -eq 1) {
$status = 'Parsed'
$dateText = $uniqueDates[0].ToString('yyyy-MM-dd', [cultureinfo]::InvariantCulture)
}
elseif ($uniqueDates.Count -gt 1) {
$status = 'Ambiguous'
}
# Return every input so bad and uncertain rows stay visible to the caller.
[pscustomobject]@{
Id = [string] $entry.Id
Input = [string] $entry.Text
Status = $status
Date = $dateText
Matches = (@($matches.Format | Sort-Object -Unique) -join ', ')
}
}
4. What Happened When It Ran
The captured PowerShell version, command, standard output, standard error, and exit status.
Use Jev’s typed score to sort a tiny idea queue, then let a plain PowerShell rule decide what moves up and what needs a human look.
Passed (DETERMINISTIC MOCK)
Jev + PowerShell 7 implementation
AI found the scenario, created the prompt and runner, generated the PowerShell, ran it, and validated the result.
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into this concise prompt. That prompt was then used to generate the PowerShell.
Build a PowerShell 7 example that uses Jev's current Score question and deterministic -Mock mode to score fictional backlog items. Inputs: item ID and short description. Output: score label, confidence, and a PowerShell action; send low-confidence results to human review. Never call the live API in the runner.
2. The Runner AI Created
AI also created run.ps1. It prepares the sample data, passes the parameters, and invokes the generated PowerShell.
Jev uses deterministic mock mode here; no live API call is made. The confidence threshold and human-review route are ordinary PowerShell policy. An optional live path can use your own API key, but it is not part of this runner.
#requires -Version 7.0
# Add the Jev module before running; mock mode below makes no API request.
Import-Module Jev -ErrorAction Stop
# Prepare fictional feature ideas that cover low, medium, and high urgency.
$items = @(
[pscustomobject]@{ Id = 'IDEA-14'; Description = 'Routine color cleanup for a future demo.' }
[pscustomobject]@{ Id = 'IDEA-28'; Description = 'The login flow has an error blocking a few testers today.' }
[pscustomobject]@{ Id = 'IDEA-37'; Description = 'Critical checkout outage is blocking customers right now.' }
)
# Run the decision and display only its safe, local mock results.
& (Join-Path $PSScriptRoot 'solution.ps1') -Item $items | Format-Table -AutoSize
3. The PowerShell AI Generated
solution.ps1 is the runnable PowerShell produced from the AI-created prompt.
#requires -Version 7.0
[CmdletBinding()]
param(
# Accept a small array of fictional queue items.
[Parameter(Mandatory)]
[object[]] $Item
)
# Load the Jev module commands from the current PowerShell environment.
Import-Module Jev -ErrorAction Stop
# Define the allowed score levels in low-to-high order.
$levels = @('Backlog', 'Consider soon', 'Move up', 'Top priority')
# Ask Jev for a typed score, while PowerShell owns the next-step policy.
$question = New-JevQuestion -Name priority -Type Score -Instructions 'How high should this backlog item move based on its stated urgency and impact?' -Criteria $levels
# Use a confidence floor so weak scores are not treated as trusted actions.
$confidenceFloor = 0.70
# Evaluate each item using Jev's deterministic local mock response.
foreach ($entry in $Item) {
# Pass the description as the decision state and avoid any network call.
$decision = Invoke-Jev -State $entry.Description -Question $question -Mock
$answer = $decision.answers.priority
$scoreIndex = [int] $answer.score
$confidence = [double] $answer.confidence
# Apply a visible policy in regular PowerShell after the typed decision.
$action = if ($confidence -lt $confidenceFloor) {
'Human review'
}
elseif ($scoreIndex -ge 2) {
'Move up'
}
else {
'Keep in backlog'
}
# Return both Jev's suggestion and the PowerShell policy result.
[pscustomobject]@{
Id = [string] $entry.Id
Score = $scoreIndex
ScoreLabel = $levels[$scoreIndex]
Confidence = [math]::Round($confidence, 2)
Action = $action
}
}
4. What Happened When It Ran
The captured PowerShell version, command, standard output, standard error, and exit status.
PowerShell version: 7.6.6
Command: pwsh -NoLogo -NoProfile -File ./run.ps1
Exit status: 0
STDOUT
Id Score ScoreLabel Confidence Action
-- ----- ---------- ---------- ------
IDEA-14 0 Backlog 0.62 Human review
IDEA-28 2 Move up 0.86 Move up
IDEA-37 3 Top priority 0.86 Move up
STDERR
5. Validation Performed by the AI Workflow
The runtime, expected results, and safety boundaries were checked and recorded.
Validation StatusPassed (DETERMINISTIC MOCK)
Runtime
PowerShell 7.6.6; Jev 0.2.0
Command
pwsh -NoLogo -NoProfile -File ./run.ps1
Exit status
0
Checks
Current New-JevQuestion -Type Score response fields answers.priority.score, confidence, and legend were exercised through Invoke-Jev -Mock.
Three fixture items produced a human-review case and two move-up cases.
The local confidence threshold is an example policy, not a Jev default.
All PowerShell files passed the PowerShell parser.
Safety
Mock mode made no API call; ordinary PowerShell applies the action policy; fictional in-memory items only.
Give the friendly rivalry a proper scoreboard: one sheet for every round, one clear winner, and a chart that makes the comeback easy to spot.
Passed
PowerShell 7 implementation
AI found the scenario, created the prompt and runner, generated the PowerShell, ran it, and validated the result.
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into this concise prompt. That prompt was then used to generate the PowerShell.
Create a PowerShell 7 script that turns fictional game-night points into an Excel workbook with round scores and final standings. Inputs: player, round, and points. Output: formatted sheets and a simple points chart. Use ImportExcel; write only a new sample workbook in the lab folder.
2. The Runner AI Created
AI also created run.ps1. It prepares the sample data, passes the parameters, and invokes the generated PowerShell.
#requires -Version 7.0
# Load ImportExcel so the sample can create a real .xlsx file in this folder.
Import-Module ImportExcel -ErrorAction Stop
# Use original player names and fictional scores for a short game night.
$scores = @(
[pscustomobject]@{ Player = 'Avery'; Round = 'Warm-up'; Points = 12 }
[pscustomobject]@{ Player = 'Blake'; Round = 'Warm-up'; Points = 18 }
[pscustomobject]@{ Player = 'Casey'; Round = 'Warm-up'; Points = 15 }
[pscustomobject]@{ Player = 'Avery'; Round = 'Final'; Points = 24 }
[pscustomobject]@{ Player = 'Blake'; Round = 'Final'; Points = 11 }
[pscustomobject]@{ Player = 'Casey'; Round = 'Final'; Points = 20 }
)
# Write only this new sample workbook inside the lab folder.
$workbook = Join-Path $PSScriptRoot 'game-night-scoreboard.xlsx'
# Invoke the generated PowerShell with its sample data and output path.
& (Join-Path $PSScriptRoot 'solution.ps1') -Score $scores -OutputPath $workbook | Format-List
3. The PowerShell AI Generated
solution.ps1 is the runnable PowerShell produced from the AI-created prompt.
#requires -Version 7.0
[CmdletBinding()]
param(
# Receive game results as small, in-memory sample records.
[Parameter(Mandatory)]
[object[]] $Score,
# Save the newly generated workbook at this caller-provided path.
[Parameter(Mandatory)]
[string] $OutputPath
)
# Load the workbook commands used by this example.
Import-Module ImportExcel -ErrorAction Stop
# Create the parent directory only when the caller selects a new output path.
$parent = Split-Path -Parent $OutputPath
if (-not (Test-Path -LiteralPath $parent -PathType Container)) {
New-Item -ItemType Directory -Path $parent -Force | Out-Null
}
# Calculate one final total per player with ordinary PowerShell.
$standings = @(
$Score |
Group-Object Player |
ForEach-Object {
[pscustomobject]@{
Player = $_.Name
Total = [int](($_.Group | Measure-Object -Property Points -Sum).Sum)
}
} |
Sort-Object -Property @{ Expression = 'Total'; Descending = $true }, Player
)
# Keep the raw round-by-round results in a predictable display order.
$roundRows = @($Score | Sort-Object Player, Round)
# Export the detail sheet first, with clear table formatting.
$roundRows | Export-Excel -Path $OutputPath -WorksheetName 'Round Scores' -TableName 'RoundScores' -TableStyle Medium2 -AutoFilter
# Build a chart definition from the final standings columns.
$chart = New-ExcelChartDefinition -ChartType BarClustered -XRange Player -YRange Total -Title 'Total points by player' -Width 18 -Height 9
# Add the sorted standings and chart as a second worksheet.
$standings | Export-Excel -Path $OutputPath -WorksheetName 'Leaderboard' -TableName 'Leaderboard' -TableStyle Medium6 -AutoFilter -ExcelChartDefinition $chart
# Return a concise confirmation for the captured run output.
[pscustomobject]@{
Workbook = [System.IO.Path]::GetFileName($OutputPath)
Players = $standings.Count
Rounds = @($roundRows.Round | Sort-Object -Unique).Count
Champion = $standings[0].Player
TopScore = $standings[0].Total
}
4. What Happened When It Ran
The captured PowerShell version, command, standard output, standard error, and exit status.
Get a quick read on which Windows license states look healthy, need a closer check, or deserve attention—without changing a machine.
Passed
PowerShell 7 implementation
AI found the scenario, created the prompt and runner, generated the PowerShell, ran it, and validated the result.
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into this concise prompt. That prompt was then used to generate the PowerShell.
Build a PowerShell 7 example that reviews fictional Windows license observations. Inputs: machine label, license state, and grace days. Output: a clear next-step label for each record, including an unknown-state fallback. Use sample objects only; do not query, activate, or change a real system.
2. The Runner AI Created
AI also created run.ps1. It prepares the sample data, passes the parameters, and invokes the generated PowerShell.
#requires -Version 7.0
# Supply fictional license snapshots; no system query or activation is performed.
$license = @(
[pscustomobject]@{ Machine = 'DESK-ORBIT'; State = 'Licensed'; GraceDays = $null }
[pscustomobject]@{ Machine = 'LAPTOP-MINT'; State = 'OOBGrace'; GraceDays = 2 }
[pscustomobject]@{ Machine = 'LAB-COMET'; State = 'Notification'; GraceDays = 0 }
[pscustomobject]@{ Machine = 'KIOSK-UNKNOWN'; State = 'Other'; GraceDays = $null }
)
# Run the generated report against only the sample objects above.
& (Join-Path $PSScriptRoot 'solution.ps1') -License $license | Format-Table -AutoSize
3. The PowerShell AI Generated
solution.ps1 is the runnable PowerShell produced from the AI-created prompt.
#requires -Version 7.0
[CmdletBinding()]
param(
# Accept fictional or caller-supplied license observations as objects.
[Parameter(Mandatory)]
[object[]] $License
)
# Translate known license states into a plain-language review signal.
$stateLabels = @{
Licensed = 'Looks good'
OOBGrace = 'Grace period'
Notification = 'Needs attention'
Unlicensed = 'Needs attention'
NonGenuineGrace = 'Needs attention'
}
# Review each observation without querying or changing a computer.
foreach ($item in $License) {
# Keep the status text stable for case-insensitive lookup.
$state = [string] $item.State
$daysLeft = if ($null -eq $item.GraceDays) { $null } else { [int] $item.GraceDays }
# Start with a safe fallback for statuses the example does not recognize.
$signal = 'Check this state'
# Use the known status label when one is available.
if ($stateLabels.ContainsKey($state)) {
$signal = $stateLabels[$state]
}
# Make a short grace period more visible so it is easy to review soon.
if ($state -eq 'OOBGrace' -and $null -ne $daysLeft -and $daysLeft -le 3) {
$signal = 'Check soon'
}
# Return a compact object that can be sorted, filtered, or exported.
[pscustomobject]@{
Machine = [string] $item.Machine
State = $state
GraceDays = $daysLeft
Signal = $signal
}
}
4. What Happened When It Ran
The captured PowerShell version, command, standard output, standard error, and exit status.
PowerShell version: 7.6.6
Command: pwsh -NoLogo -NoProfile -File ./run.ps1
Exit status: 0
STDOUT
Machine State GraceDays Signal
------- ----- --------- ------
DESK-ORBIT Licensed Looks good
LAPTOP-MINT OOBGrace 2 Check soon
LAB-COMET Notification 0 Needs attention
KIOSK-UNKNOWN Other Check this state
STDERR
5. Validation Performed by the AI Workflow
The runtime, expected results, and safety boundaries were checked and recorded.
Validation StatusPassed
Runtime
PowerShell 7.6.6
Command
pwsh -NoLogo -NoProfile -File ./run.ps1
Exit status
0
Checks
Four fictional license states produced a clear signal, including an unknown-state fallback.
No local machine query or activation command was used.
All PowerShell files passed the PowerShell parser.
Safety
In-memory examples only; read-only; no network, credentials, or system changes.
See how to keep your output shape steady when a search finds nothing, one match, or a crowd.
Validated
PowerShell 7 implementation
AI found the scenario, created the prompt and runner, generated the PowerShell, ran it, and validated the result.
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into this concise prompt. That prompt was then used to generate the PowerShell.
Create a PowerShell 7 function that searches fictional catalog records and returns the same object shape for zero, one, or many matches. Include an explicit count and an `Items` array, plus a runner that demonstrates all three cases. Use in-memory data only; do not access the network or change system state.
2. The Runner AI Created
AI also created run.ps1. It prepares the sample data, passes the parameters, and invokes the generated PowerShell.
# Stop immediately if the sample runner encounters an error.
$ErrorActionPreference = 'Stop'
# Resolve the generated solution beside this runner.
$solutionPath = Join-Path $PSScriptRoot 'solution.ps1'
# Create a small fictional catalog that covers zero, one, and many matches.
$catalog = @(
[pscustomobject]@{ Name = 'Amber Sensor'; Zone = 'North' }
[pscustomobject]@{ Name = 'Birch Gateway'; Zone = 'South' }
[pscustomobject]@{ Name = 'Amber Display'; Zone = 'West' }
)
# Run each search and report the stable outer shape and matching names.
foreach ($query in 'Missing', 'Gateway', 'Amber') {
$result = & $solutionPath -Records $catalog -Query $query
$names = if ($result.Count -eq 0) { '<none>' } else { ($result.Items.Name -join ', ') }
$itemType = $result.Items.GetType().FullName
Write-Output ("Query={0}; Count={1}; ItemsType={2}; Items={3}" -f $query, $result.Count, $itemType, $names)
}
3. The PowerShell AI Generated
solution.ps1 is the runnable PowerShell produced from the AI-created prompt.
# Accept a catalog and a name fragment, then return a stable result envelope.
[CmdletBinding()]
param(
# Provide the fictional catalog records to search.
[Parameter(Mandatory)]
[object[]] $Records,
# Provide the text fragment to find in each record's Name property.
[Parameter(Mandatory)]
[string] $Query
)
# Collect matches inside an array expression so zero and one results stay arrays.
$matches = @(
$Records | Where-Object { $_.Name -like "*$Query*" }
)
# Wrap the collection in an object so PowerShell does not enumerate it as output.
[pscustomobject]@{
Query = $Query
Count = $matches.Count
Items = [object[]] $matches
}
4. What Happened When It Ran
The captured PowerShell version, command, standard output, standard error, and exit status.
Spot what's ready, what needs attention, and what deserves a closer look.
Validated
PowerShell 7 implementation
AI found the scenario, created the prompt and runner, generated the PowerShell, ran it, and validated the result.
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into this concise prompt. That prompt was then used to generate the PowerShell.
Build a PowerShell 7 action board from fictional license-status records with device, edition, state, and days remaining. Label each record Ready, Act Soon, Investigate, or Review, then sort the most urgent first. Keep the example read-only and in memory; do not query or change the local system.
2. The Runner AI Created
AI also created run.ps1. It prepares the sample data, passes the parameters, and invokes the generated PowerShell.
# Stop immediately if the sample runner encounters an error.
$ErrorActionPreference = 'Stop'
# Resolve the generated solution beside this runner.
$solutionPath = Join-Path $PSScriptRoot 'solution.ps1'
# Use fictional snapshots rather than querying a local computer or license server.
$snapshots = @(
[pscustomobject]@{ Device = 'LAB-ORBIT-01'; Edition = 'Pro'; State = 'Activated'; DaysRemaining = 365 }
[pscustomobject]@{ Device = 'LAB-ORBIT-02'; Edition = 'Enterprise'; State = 'Grace'; DaysRemaining = 9 }
[pscustomobject]@{ Device = 'LAB-ORBIT-03'; Edition = 'Pro'; State = 'Unlicensed'; DaysRemaining = 0 }
[pscustomobject]@{ Device = 'LAB-ORBIT-04'; Edition = 'Education'; State = 'Unknown'; DaysRemaining = 0 }
)
# Display the prioritized action board as plain PowerShell objects.
& $solutionPath -LicenseRecord $snapshots | Format-Table Device, Edition, State, DaysRemaining, Action -AutoSize
3. The PowerShell AI Generated
solution.ps1 is the runnable PowerShell produced from the AI-created prompt.
# Turn normalized license-status records into safe, readable next-step guidance.
[CmdletBinding()]
param(
# Supply fictional or previously collected read-only license snapshots.
[Parameter(Mandatory)]
[object[]] $LicenseRecord
)
# Map every snapshot to a next step without invoking activation commands.
$board = foreach ($record in $LicenseRecord) {
# Choose an action using only the supplied status fields.
$action = switch ($record.State) {
'Activated' {
'Ready'
}
'Grace' {
if ($record.DaysRemaining -le 14) { 'Act Soon' } else { 'Monitor' }
}
'Unlicensed' {
'Investigate'
}
default {
'Review'
}
}
# Return a compact object that can be sorted, filtered, or exported later.
[pscustomobject]@{
Device = $record.Device
Edition = $record.Edition
State = $record.State
DaysRemaining = $record.DaysRemaining
Action = $action
}
}
# Sort attention items ahead of healthy snapshots while keeping the result stable.
$priority = @{ Investigate = 0; 'Act Soon' = 1; Review = 2; Monitor = 3; Ready = 4 }
$board | Sort-Object @{ Expression = { $priority[$_.Action] } }, Device
4. What Happened When It Ran
The captured PowerShell version, command, standard output, standard error, and exit status.
Turn sample activity into a workbook that makes each cohort's story easy to see.
Validated
PowerShell 7 implementation
AI found the scenario, created the prompt and runner, generated the PowerShell, ran it, and validated the result.
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into this concise prompt. That prompt was then used to generate the PowerShell.
Create a PowerShell 7 cohort-retention workbook from fictional volunteer join dates and activity months. Summarize active people by cohort and months since joining, then export a formatted Excel sheet with a line chart and an activity detail sheet. Write to a unique temporary workbook; do not use network or personal data.
2. The Runner AI Created
AI also created run.ps1. It prepares the sample data, passes the parameters, and invokes the generated PowerShell.
#requires -Version 7.0
# Stop immediately if workbook creation or validation encounters an error.
$ErrorActionPreference = 'Stop'
# Suppress the module's unrelated headless AutoSize capability notice.
$WarningPreference = 'SilentlyContinue'
# Resolve the generated solution beside this runner.
$solutionPath = Join-Path $PSScriptRoot 'solution.ps1'
# Create fictional volunteer records with deterministic activity months.
$volunteers = @(
[pscustomobject]@{ Name = 'Avery'; JoinMonth = '2026-01'; ActiveMonths = @('2026-01', '2026-02', '2026-03') }
[pscustomobject]@{ Name = 'Blake'; JoinMonth = '2026-01'; ActiveMonths = @('2026-01', '2026-02') }
[pscustomobject]@{ Name = 'Casey'; JoinMonth = '2026-01'; ActiveMonths = @('2026-01') }
[pscustomobject]@{ Name = 'Devon'; JoinMonth = '2026-02'; ActiveMonths = @('2026-02', '2026-03', '2026-04') }
[pscustomobject]@{ Name = 'Emery'; JoinMonth = '2026-02'; ActiveMonths = @('2026-02', '2026-03') }
)
# Give each run a unique temporary workbook name without overwriting a file.
$workbookPath = Join-Path ([IO.Path]::GetTempPath()) ("volunteer-cohorts-{0}.xlsx" -f [guid]::NewGuid().ToString('N'))
# Generate the workbook and capture its summary rows.
$summary = @(& $solutionPath -Volunteer $volunteers -OutputPath $workbookPath)
# Read the workbook back and verify that both worksheets contain expected rows.
Import-Module ImportExcel -ErrorAction Stop
$savedRetention = @(Import-Excel -Path $workbookPath -WorksheetName 'Retention')
$savedActivity = @(Import-Excel -Path $workbookPath -WorksheetName 'Activity')
if ($savedRetention.Count -ne 6) { throw "Expected 6 retention rows, found $($savedRetention.Count)." }
if ($savedActivity.Count -ne $volunteers.Count) { throw "Expected $($volunteers.Count) activity rows, found $($savedActivity.Count)." }
if (-not (Get-ExcelSheetInfo -Path $workbookPath | Where-Object Name -eq 'Retention')) { throw 'Retention worksheet missing.' }
# Print a compact validation result followed by the cohort counts.
Write-Output ("Workbook={0}; RetentionRows={1}; ActivityRows={2}; Chart=Line" -f $workbookPath, $savedRetention.Count, $savedActivity.Count)
$savedRetention | Format-Table CohortMonth, MonthsSinceJoin, CalendarMonth, ActiveVolunteers -AutoSize
3. The PowerShell AI Generated
solution.ps1 is the runnable PowerShell produced from the AI-created prompt.
#requires -Version 7.0
# Convert fictional volunteer activity into a retention workbook.
[CmdletBinding()]
param(
# Provide one record per volunteer with join month and active months.
[Parameter(Mandatory)]
[object[]] $Volunteer,
# Choose a new workbook path in a safe temporary location.
[Parameter(Mandatory)]
[string] $OutputPath
)
# Load the workbook commands needed for this optional Excel output.
# Ignore the module's unrelated cross-platform AutoSize capability notice.
$savedWarningPreference = $WarningPreference
$WarningPreference = 'SilentlyContinue'
Import-Module ImportExcel -ErrorAction Stop
$WarningPreference = $savedWarningPreference
# Gather the distinct cohort months represented by the sample records.
$cohorts = @($Volunteer.JoinMonth | Sort-Object -Unique)
# Build month-zero through month-two retention counts for each cohort.
$summary = foreach ($cohort in $cohorts) {
# Parse month keys in a culture-invariant, fixed format.
$cohortDate = [datetime]::ParseExact($cohort, 'yyyy-MM', [cultureinfo]::InvariantCulture)
foreach ($offset in 0..2) {
# Calculate the observed calendar month for this cohort age.
$monthDate = $cohortDate.AddMonths($offset)
$monthKey = $monthDate.ToString('yyyy-MM', [cultureinfo]::InvariantCulture)
# Count volunteers in the cohort who were active during that month.
$activeCount = @(
$Volunteer | Where-Object {
$_.JoinMonth -eq $cohort -and $monthKey -in $_.ActiveMonths
}
).Count
# Emit one tidy row for the Excel table and chart.
[pscustomobject]@{
CohortMonth = $cohort
MonthsSinceJoin = $offset
CalendarMonth = $monthKey
ActiveVolunteers = $activeCount
}
}
}
# Define a line chart using the exported worksheet's named columns.
$chart = New-ExcelChartDefinition `
-ChartType Line `
-XRange 'MonthsSinceJoin' `
-YRange 'ActiveVolunteers' `
-SeriesHeader 'ActiveVolunteers' `
-Title 'Active volunteers by cohort age' `
-NoLegend
# Export a styled retention table with the chart definition to the workbook.
$summary | Export-Excel `
-Path $OutputPath `
-WorksheetName 'Retention' `
-TableName 'VolunteerRetention' `
-TableStyle Medium2 `
-AutoFilter `
-FreezeTopRow `
-BoldTopRow `
-ExcelChartDefinition $chart
# Add the fictional inputs as a second sheet for traceability.
$Volunteer | Export-Excel `
-Path $OutputPath `
-WorksheetName 'Activity' `
-TableName 'VolunteerActivity' `
-TableStyle Medium4 `
-AutoFilter `
-FreezeTopRow `
-BoldTopRow `
-Append
# Return the summary rows so the runner can inspect the saved workbook.
$summary
4. What Happened When It Ran
The captured PowerShell version, command, standard output, standard error, and exit status.
Route notes by meaning, and send uncertain calls to a person.
Validated
Jev + PowerShell 7 implementation
AI found the scenario, created the prompt and runner, generated the PowerShell, ran it, and validated the result.
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into this concise prompt. That prompt was then used to generate the PowerShell.
Create a PowerShell 7 demo that routes fictional field-support notes to authentication, network, or syntax help. Use Jev's typed Choice question, then apply a visible confidence threshold so uncertain results go to Human Review. The runner must use deterministic mock mode and fictional inputs only; no network or credential access.
2. The Runner AI Created
AI also created run.ps1. It prepares the sample data, passes the parameters, and invokes the generated PowerShell.
#requires -Version 7.0
# Stop immediately if the sample runner encounters an error.
$ErrorActionPreference = 'Stop'
# Resolve the generated solution beside this runner.
$solutionPath = Join-Path $PSScriptRoot 'solution.ps1'
# Create fictional field notes covering supported routes and an ambiguous case.
$notes = @(
[pscustomobject]@{ Reference = 'FIELD-101'; Note = 'The upload failed with a connection timeout.' }
[pscustomobject]@{ Reference = 'FIELD-102'; Note = 'The report parser found an unexpected JSON token.' }
[pscustomobject]@{ Reference = 'FIELD-103'; Note = 'The access token was rejected as unauthorized.' }
[pscustomobject]@{ Reference = 'FIELD-104'; Note = 'The dashboard button color looks different today.' }
)
# Run with the Jev mock path and display the final bounded routes.
& $solutionPath -Incident $notes | Format-Table Reference, Suggested, Confidence, Destination -AutoSize
3. The PowerShell AI Generated
solution.ps1 is the runnable PowerShell produced from the AI-created prompt.
#requires -Version 7.0
# Use Jev's typed decision output, then apply explicit PowerShell routing policy.
[CmdletBinding()]
param(
# Supply fictional field notes with a stable reference identifier.
[Parameter(Mandatory)]
[object[]] $Incident
)
# Load the Jev commands installed in the current PowerShell environment.
Import-Module Jev -ErrorAction Stop
# Define the only routes Jev may select and the meaning of each route.
$routeCriteria = [ordered]@{
authentication = 'Credentials, identity, access, or permissions are failing.'
network = 'Connectivity, DNS, timeouts, or transport are failing.'
syntax = 'A command, script, JSON, or parser format is failing.'
unknown = 'The note does not match a supported route.'
}
# Create a bounded Choice question using the current Jev module interface.
$routeQuestion = New-JevQuestion `
-Name route `
-Type Choice `
-Instructions 'Choose the single support route that best fits this field note. If none fits, choose unknown.' `
-Criteria $routeCriteria
# Evaluate each note locally with Mock so this runner never calls the API.
$results = foreach ($item in $Incident) {
# Request a schema-compatible typed answer from deterministic mock mode.
$decision = Invoke-Jev -State $item.Note -Question $routeQuestion -Mock
$answer = $decision.answers.route
$confidence = [double] $answer.confidence
# Require both a supported choice and the example confidence threshold.
$destination = if ($answer.choice -eq 'unknown' -or $confidence -lt 0.8) {
'Human Review'
}
else {
$answer.choice
}
# Return a compact record with the machine suggestion and final destination.
[pscustomobject]@{
Reference = $item.Reference
Suggested = $answer.choice
Confidence = [math]::Round($confidence, 2)
Destination = $destination
}
}
# Emit the results as objects for downstream filtering or reporting.
$results
4. What Happened When It Ran
The captured PowerShell version, command, standard output, standard error, and exit status.
Use a few PowerShell rules to draw a branching coral pattern.
Validated
PowerShell 7 implementation
AI found the scenario, created the prompt and runner, generated the PowerShell, ran it, and validated the result.
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into this concise prompt. That prompt was then used to generate the PowerShell.
Create a deterministic PowerShell 7 terminal showpiece that draws a branching coral-like form using a bounded recursive turtle and a fixed character canvas. Print one stable result from hard-coded parameters. Do not use network access, files, system changes, or unbounded recursion.
2. The Runner AI Created
AI also created run.ps1. It prepares the sample data, passes the parameters, and invokes the generated PowerShell.
#requires -Version 7.0
# Stop immediately if the sample runner encounters an error.
$ErrorActionPreference = 'Stop'
# Resolve the generated solution beside this runner.
$solutionPath = Join-Path $PSScriptRoot 'solution.ps1'
# Draw the same deterministic coral with fixed canvas and recursion parameters.
& $solutionPath -Height 28 -Width 76 -Depth 4
3. The PowerShell AI Generated
solution.ps1 is the runnable PowerShell produced from the AI-created prompt.
#requires -Version 7.0
# Draw a bounded, deterministic branching coral pattern in a character canvas.
[CmdletBinding()]
param(
# Set the number of rows in the output canvas.
[ValidateRange(12, 60)]
[int] $Height = 28,
# Set the number of columns in the output canvas.
[ValidateRange(30, 120)]
[int] $Width = 76,
# Limit the recursion depth so the generated pattern always remains bounded.
[ValidateRange(1, 6)]
[int] $Depth = 4
)
# Allocate the in-memory canvas and fill every cell with a space.
$script:Canvas = [char[,]]::new($Height, $Width)
for ($row = 0; $row -lt $Height; $row++) {
for ($column = 0; $column -lt $Width; $column++) {
$script:Canvas[$row, $column] = [char] ' '
}
}
# Draw one line segment, then recursively grow two smaller daughter branches.
function Draw-CoralBranch {
[CmdletBinding()]
param(
[double] $StartX,
[double] $StartY,
[double] $AngleDegrees,
[double] $Length,
[int] $RemainingDepth
)
# Compute evenly spaced turtle points along this branch.
$steps = [math]::Max(1, [int] [math]::Ceiling($Length * 2))
$radians = $AngleDegrees * [math]::PI / 180
$endX = $StartX
$endY = $StartY
for ($step = 1; $step -le $steps; $step++) {
# Interpolate the current point between the branch origin and endpoint.
$fraction = $step / $steps
$x = [int] [math]::Round($StartX + ([math]::Cos($radians) * $Length * $fraction))
$y = [int] [math]::Round($StartY + ([math]::Sin($radians) * $Length * $fraction))
# Draw only points that fit inside the fixed canvas.
if ($x -ge 0 -and $x -lt $Width -and $y -ge 0 -and $y -lt $Height) {
$symbol = if ($RemainingDepth -eq 0 -and $step -eq $steps) { '*' } else { '#' }
$script:Canvas[$y, $x] = [char] $symbol
}
# Remember the exact branch endpoint for child growth.
$endX = $StartX + ([math]::Cos($radians) * $Length)
$endY = $StartY + ([math]::Sin($radians) * $Length)
}
# Stop when a leaf has been drawn; depth is strictly bounded by the parameter.
if ($RemainingDepth -le 0) { return }
# Grow left and right branches with a deterministic angle and scale.
$nextLength = $Length * 0.72
Draw-CoralBranch -StartX $endX -StartY $endY -AngleDegrees ($AngleDegrees - 27) -Length $nextLength -RemainingDepth ($RemainingDepth - 1)
Draw-CoralBranch -StartX $endX -StartY $endY -AngleDegrees ($AngleDegrees + 27) -Length $nextLength -RemainingDepth ($RemainingDepth - 1)
}
# Start the coral at the lower center and grow upward with fixed geometry.
Draw-CoralBranch -StartX ([math]::Floor($Width / 2)) -StartY ($Height - 2) -AngleDegrees -90 -Length 7 -RemainingDepth $Depth
# Convert each canvas row into a string while trimming unused right-side space.
Write-Output ("CORAL / depth {0} / {1} x {2}" -f $Depth, $Width, $Height)
for ($row = 0; $row -lt $Height; $row++) {
$builder = [System.Text.StringBuilder]::new($Width)
for ($column = 0; $column -lt $Width; $column++) {
[void] $builder.Append($script:Canvas[$row, $column])
}
Write-Output $builder.ToString().TrimEnd()
}
4. What Happened When It Ran
The captured PowerShell version, command, standard output, standard error, and exit status.
After finding the scenario, AI turned it into this concise prompt. That prompt was then used to generate the PowerShell.
Create a safe PowerShell 7 plus Go/Wails desktop demo called Local Pulse Board. PowerShell should turn fictional service metrics into compact JSON, and the Wails Go core should accept that JSON and expose a formatted status summary to a small frontend. Keep the contract explicit, source-only, deterministic, and free of network, credentials, system changes, or compiled binaries.
2. The Runner AI Created
AI also created run.ps1. It prepares the sample data, passes the parameters, and invokes the generated PowerShell.
[CmdletBinding()]
param()
$ErrorActionPreference = 'Stop'
Set-StrictMode -Version Latest
$solutionPath = Join-Path $PSScriptRoot 'solution.ps1'
$metrics = @(
[pscustomobject]@{ Name = 'Search'; State = 'Ready'; LatencyMs = 42; QueueDepth = 3 }
[pscustomobject]@{ Name = 'Billing'; State = 'Watch'; LatencyMs = 118; QueueDepth = 9 }
[pscustomobject]@{ Name = 'Mail'; State = 'Ready'; LatencyMs = 57; QueueDepth = 1 }
)
$json = & $solutionPath -Metrics $metrics
Write-Output 'PowerShell JSON contract:'
Write-Output $json
if (Get-Command go -ErrorAction SilentlyContinue) {
Write-Output 'Go is available; the local Wails build can be attempted from wails-app.'
}
else {
Write-Output 'REVIEW-ONLY: Go/Wails is not installed in this cloud runtime; GUI execution was not attempted.'
}
3. The PowerShell AI Generated
solution.ps1 is the runnable PowerShell produced from the AI-created prompt.
# Convert fictional service metrics into the JSON contract consumed by the Go app.
[CmdletBinding()]
param(
# The caller supplies sample records so the function stays reusable and testable.
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[object[]] $Metrics
)
Set-StrictMode -Version Latest
# Project only the fields that form the stable PowerShell-to-Go boundary.
$payload = [pscustomobject]@{
GeneratedAt = '2026-09-22T07:00:00Z'
Services = @(
foreach ($metric in $Metrics) {
[pscustomobject]@{
Name = [string]$metric.Name
State = [string]$metric.State
LatencyMs = [int]$metric.LatencyMs
QueueDepth = [int]$metric.QueueDepth
}
}
)
}
# Emit compact, portable JSON for a file, stdin pipe, or Wails binding.
$payload | ConvertTo-Json -Depth 4 -Compress
4. What Happened When It Ran
The actual captured output, errors, and exit status.
PowerShell version: 7.6.6
Command: ./pwsh-runtime/pwsh -NoLogo -NoProfile -File run.ps1
=== STDOUT ===
PowerShell JSON contract:
{"GeneratedAt":"2026-09-22T07:00:00Z","Services":[{"Name":"Search","State":"Ready","LatencyMs":42,"QueueDepth":3},{"Name":"Billing","State":"Watch","LatencyMs":118,"QueueDepth":9},{"Name":"Mail","State":"Ready","LatencyMs":57,"QueueDepth":1}]}
REVIEW-ONLY: Go/Wails is not installed in this cloud runtime; GUI execution was not attempted.
=== STDERR ===
(empty)
=== EXIT STATUS ===
0
5. Validation Performed by the AI Workflow
The runtime, expected results, and safety boundaries were checked and recorded.
Validation StatusReview only
Runtime: PowerShell 7.6.6 Command: `./pwsh-runtime/pwsh -NoLogo -NoProfile -File run.ps1` Exit status: `0` Checks: JSON was generated from three in-memory metrics with the documented fields; the source bundle contains Go, frontend, build, and PowerShell files and no compiled executable. GUI check: Go and Wails were unavailable in the cloud runtime, so the desktop app was not run and no GUI result was fabricated. Safety: sample data only; no network, credentials, deletion, registry/system changes, or arbitrary code execution.
Turn fictional incidents into a severity-by-team Excel heatmap.
Review only
AI found the scenario, created the prompt and runner, generated the PowerShell, ran it, and validated the result.
PowerShell 7 implementation
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into this concise prompt. That prompt was then used to generate the PowerShell.
Using PowerShell 7 and ImportExcel, create a workbook from fictional incidents. Export a detail sheet and a team-by-severity summary with a color scale that acts as a heatmap. Use sample objects, a caller path, and no network, credentials, deletion, or system changes.
2. The Runner AI Created
AI also created run.ps1. It prepares the sample data, passes the parameters, and invokes the generated PowerShell.
solution.ps1 is the runnable PowerShell produced from the AI-created prompt.
# Export incident details and a severity heatmap with ImportExcel.
[CmdletBinding()]
param(
[Parameter(Mandatory)] [ValidateNotNullOrEmpty()] [object[]] $Incidents,
[Parameter(Mandatory)] [ValidateNotNullOrEmpty()] [string] $Path
)
Set-StrictMode -Version Latest
# Normalize each record so the workbook receives predictable columns.
$details = foreach ($incident in $Incidents) {
[pscustomobject]@{
Team = [string]$incident.Team
Severity = [string]$incident.Severity
Title = [string]$incident.Title
Minutes = [int]$incident.Minutes
}
}
# Build a stable matrix with one row per team and one column per severity.
$severities = 'Low','Medium','High','Critical'
$heatmap = foreach ($team in ($details.Team | Sort-Object -Unique)) {
$row = [ordered]@{ Team = $team }
foreach ($severity in $severities) {
$row[$severity] = @($details | Where-Object { $_.Team -eq $team -and $_.Severity -eq $severity }).Count
}
[pscustomobject]$row
}
$details | Export-Excel -Path $Path -WorksheetName 'Incidents' -TableName 'Incidents' -AutoSize -FreezeTopRow -BoldTopRow -ClearSheet
$heatmap | Export-Excel -Path $Path -WorksheetName 'Heatmap' -TableName 'SeverityHeatmap' -AutoSize -BoldTopRow -Append
# A three-color scale makes higher counts visually stand out during review.
$package = Open-ExcelPackage -Path $Path
$sheet = $package.Workbook.Worksheets['Heatmap']
Add-ConditionalFormatting -Worksheet $sheet -Address 'B2:E200' -RuleType ThreeColorScale -MinColor 'E2F0D9' -MidColor 'FFF2CC' -MaxColor 'F4CCCC' | Out-Null
Close-ExcelPackage $package
[pscustomobject]@{ Path = (Resolve-Path -LiteralPath $Path).Path; IncidentCount = $details.Count; TeamCount = $heatmap.Count }
4. What Happened When It Ran
The actual captured output, errors, and exit status.
PowerShell version: 7.6.6
Command: ./pwsh-runtime/pwsh -NoLogo -NoProfile -File run.ps1
=== STDOUT ===
(empty)
=== STDERR ===
Import-Module: run.ps1:5: The specified module 'ImportExcel' was not loaded because no valid module file was found in any module directory.
=== EXIT STATUS ===
1
5. Validation Performed by the AI Workflow
The runtime, expected results, and safety boundaries were checked and recorded.
Validation StatusReview only
Runtime: PowerShell 7.6.6 Command: `./pwsh-runtime/pwsh -NoLogo -NoProfile -File run.ps1` Exit status: `1` Module: ImportExcel was not installed or loadable in the cloud runtime, so workbook creation and version checks were not claimed. Checks: the script was reviewed for in-memory fictional records and bounded workbook formatting. Safety: no network, credentials, deletion, registry/system changes, or arbitrary code execution.
Generate a deterministic dungeon with rooms, corridors, and an exit marker.
Validated
AI found the scenario, created the prompt and runner, generated the PowerShell, ran it, and validated the result.
PowerShell 7 implementation
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into this concise prompt. That prompt was then used to generate the PowerShell.
Create a fully commented PowerShell 7 function that prints a deterministic ASCII dungeon: bounded width and height, a few rectangular rooms joined by corridors, and an exit marker. Accept a seed, keep all state in memory, and emit plain text with no cursor control, network, or system changes.
2. The Runner AI Created
AI also created run.ps1. It prepares the sample data, passes the parameters, and invokes the generated PowerShell.
Place equal items into a bounded shelf grid with reusable coordinates.
Validated
AI found the scenario, created the prompt and runner, generated the PowerShell, ran it, and validated the result.
PowerShell 7 implementation
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into this concise prompt. That prompt was then used to generate the PowerShell.
Create a fully commented PowerShell 7 function that places equal rectangular items into a shelf grid. Accept item count, item width and height, shelf width, and gap; return each item's row, column, and top-left coordinates plus the number of rows used. Use arithmetic and in-memory data only.
2. The Runner AI Created
AI also created run.ps1. It prepares the sample data, passes the parameters, and invokes the generated PowerShell.
The runtime, expected results, and safety boundaries were checked and recorded.
Validation StatusPassed
Runtime: PowerShell 7.6.6 Command: `./pwsh-runtime/pwsh -NoLogo -NoProfile -File run.ps1` Exit status: `0` Checks: seven items were placed in two columns and four rows with non-overlapping coordinates and the requested gap. Safety: deterministic arithmetic over in-memory parameters only; no network, credentials, deletion, or system changes.
Compose a safe Boolean truth table with an explicit expression switch.
Validated
AI found the scenario, created the prompt and runner, generated the PowerShell, ran it, and validated the result.
PowerShell 7 implementation
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into this concise prompt. That prompt was then used to generate the PowerShell.
Create a fully commented PowerShell 7 truth-table generator for two Boolean inputs. Accept a small expression using only `AND`, `OR`, `NOT`, `A`, and `B`; evaluate all four combinations with an explicit token switch, never dynamic code execution, and return readable rows. Keep it in memory and reject unsupported tokens.
2. The Runner AI Created
AI also created run.ps1. It prepares the sample data, passes the parameters, and invokes the generated PowerShell.
[CmdletBinding()]
param()
$ErrorActionPreference = 'Stop'
& (Join-Path $PSScriptRoot 'solution.ps1') -Expression 'A AND NOT B' | Format-Table -AutoSize
3. The PowerShell AI Generated
solution.ps1 is the runnable PowerShell produced from the AI-created prompt.
# Evaluate a deliberately small Boolean expression without dynamic execution.
[CmdletBinding()]
param([Parameter(Mandatory)][ValidateSet('A AND B','A OR B','A AND NOT B','NOT A OR B')][string] $Expression)
Set-StrictMode -Version Latest
function Test-Expression {
param([bool]$A,[bool]$B,[string]$Text)
switch ($Text) {
'A AND B' { return ($A -and $B) }
'A OR B' { return ($A -or $B) }
'A AND NOT B' { return ($A -and -not $B) }
'NOT A OR B' { return ((-not $A) -or $B) }
default { throw "Unsupported expression: $Text" }
}
}
# Enumerate every two-bit combination exactly once.
foreach ($a in $false,$true) {
foreach ($b in $false,$true) {
[pscustomobject]@{ A = $a; B = $b; Expression = $Expression; Result = Test-Expression -A $a -B $b -Text $Expression }
}
}
4. What Happened When It Ran
The actual captured output, errors, and exit status.
PowerShell version: 7.6.6
Command: ./pwsh-runtime/pwsh -NoLogo -NoProfile -File run.ps1
=== STDOUT ===
A B Expression Result
- - ---------- ------
False False A AND NOT B False
False True A AND NOT B False
True False A AND NOT B True
True True A AND NOT B False
=== STDERR ===
(empty)
=== EXIT STATUS ===
0
5. Validation Performed by the AI Workflow
The runtime, expected results, and safety boundaries were checked and recorded.
Validation StatusPassed
Runtime: PowerShell 7.6.6 Command: `./pwsh-runtime/pwsh -NoLogo -NoProfile -File run.ps1` Exit status: `0` Checks: all four Boolean combinations were evaluated for the allow-listed expression and the expected single true row was produced. Safety: explicit switch-based evaluation; no `Invoke-Expression`, network, credentials, deletion, or system changes.
Turn fictional milestones into a two-sheet Excel planning workbook.
Validated
AI found the scenario, created the prompt and runner, generated the PowerShell, ran it, and validated the result.
PowerShell 7 implementation
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into this concise prompt. That prompt was then used to generate the PowerShell.
Create a PowerShell 7 script that accepts milestone objects and an output path, calculates duration and progress, then uses ImportExcel to create Timeline and Summary worksheets. Freeze the header, format dates and percentages, and return a concise result object. Use only supplied sample data and write only the requested workbook.
2. The Runner AI Created
AI also created run.ps1. It prepares the sample data, passes the parameters, and invokes the generated PowerShell.
$ErrorActionPreference = 'Stop'
# Build fictional milestones so the example is reproducible and self-contained.
$milestones = @(
[pscustomobject]@{ Name = 'Discovery'; Owner = 'Mina'; Status = 'Done'; Start = '2026-09-07'; Finish = '2026-09-09'; Progress = 1.00 }
[pscustomobject]@{ Name = 'Prototype'; Owner = 'Kai'; Status = 'Active'; Start = '2026-09-10'; Finish = '2026-09-16'; Progress = 0.65 }
[pscustomobject]@{ Name = 'Pilot'; Owner = 'Nora'; Status = 'Planned'; Start = '2026-09-17'; Finish = '2026-09-23'; Progress = 0.00 }
[pscustomobject]@{ Name = 'Launch'; Owner = 'Mina'; Status = 'Planned'; Start = '2026-09-24'; Finish = '2026-09-25'; Progress = 0.00 }
)
$path = Join-Path $PSScriptRoot 'project-timeline.xlsx'
& (Join-Path $PSScriptRoot 'solution.ps1') -Milestone $milestones -OutputPath $path |
Format-List
3. The PowerShell AI Generated
solution.ps1 is the runnable PowerShell produced from the AI-created prompt.
[CmdletBinding()]
param(
# Accept milestone records from the runner instead of reading external systems.
[Parameter(Mandatory)]
[object[]] $Milestone,
# Keep the output destination explicit and controlled by the caller.
[Parameter(Mandatory)]
[string] $OutputPath
)
# Stop on module or workbook errors so validation receives a reliable exit status.
$ErrorActionPreference = 'Stop'
$WarningPreference = 'SilentlyContinue'
# Import the workbook module only when this solution is actually run.
Import-Module ImportExcel -ErrorAction Stop -WarningAction SilentlyContinue
# Normalize each milestone and calculate the fields readers need for planning.
$timeline = foreach ($item in $Milestone) {
$start = [datetime]$item.Start
$finish = [datetime]$item.Finish
$duration = [math]::Max(1, ($finish.Date - $start.Date).Days + 1)
# Emit a predictable record for the Timeline worksheet.
[pscustomobject]@{
Milestone = [string]$item.Name
Owner = [string]$item.Owner
Status = [string]$item.Status
Start = $start
Finish = $finish
DurationDays = $duration
Progress = [double]$item.Progress
}
}
# Group the normalized records to create a compact management summary.
$summary = $timeline |
Group-Object Status |
Sort-Object Name |
ForEach-Object {
[pscustomobject]@{
Status = $_.Name
MilestoneCount = $_.Count
AverageProgress = [math]::Round(($_.Group.Progress | Measure-Object -Average).Average, 2)
}
}
# Create the detailed worksheet with friendly table and column formatting.
$timeline | Export-Excel -Path $OutputPath -WorksheetName 'Timeline' -TableName 'ProjectTimeline' `
-FreezeTopRow -BoldTopRow -AutoFilter
# Append the summary worksheet and render Progress as a percentage.
$summary | Export-Excel -Path $OutputPath -WorksheetName 'Summary' -TableName 'StatusSummary' `
-FreezeTopRow -BoldTopRow -AutoFilter
# Apply focused formats rather than formatting every numeric cell the same way.
$package = Open-ExcelPackage -Path $OutputPath
Set-ExcelRange -Worksheet $package.Timeline -Range 'D2:E100' -NumberFormat 'yyyy-mm-dd'
Set-ExcelRange -Worksheet $package.Timeline -Range 'G2:G100' -NumberFormat '0%'
Set-ExcelRange -Worksheet $package.Summary -Range 'C2:C100' -NumberFormat '0%'
Close-ExcelPackage -ExcelPackage $package
# Return a small object that is easy for automation to inspect.
[pscustomobject]@{
Workbook = Split-Path -Leaf $OutputPath
MilestoneCount = $timeline.Count
StatusCount = $summary.Count
Exists = Test-Path -LiteralPath $OutputPath
}
4. What Happened When It Ran
The actual captured output, errors, and exit status.
Checks: Created project-timeline.xlsx, confirmed both Timeline and Summary worksheets, and read back milestone values from the workbook. Four milestones and three status groups matched the sample data.
Runtime note: The Linux image lacks the optional native library used for column autosizing. The lab avoids autosizing; workbook creation, focused formats, and read-back validation passed.
Safety: The solution uses supplied fictional data, performs no network access, and writes only the requested workbook.
Render deterministic Unicode wave frames with bounded in-memory math.
Validated
AI found the scenario, created the prompt and runner, generated the PowerShell, ran it, and validated the result.
PowerShell 7 implementation
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into this concise prompt. That prompt was then used to generate the PowerShell.
Create a PowerShell 7 function that renders a deterministic Unicode ripple simulation for a chosen width, height, and frame count. Use an in-memory wave formula, label every frame, return text only, and keep the run bounded with no sleeps, input, files, or network access.
2. The Runner AI Created
AI also created run.ps1. It prepares the sample data, passes the parameters, and invokes the generated PowerShell.
$ErrorActionPreference = 'Stop'
# Pass a compact canvas and three frames to keep validation output readable.
& (Join-Path $PSScriptRoot 'solution.ps1') -Width 28 -Height 9 -FrameCount 3
3. The PowerShell AI Generated
solution.ps1 is the runnable PowerShell produced from the AI-created prompt.
[CmdletBinding()]
param(
# Bound the canvas so automated runs remain small and predictable.
[ValidateRange(12, 60)]
[int] $Width = 32,
# Bound the vertical size for readable terminal output.
[ValidateRange(6, 24)]
[int] $Height = 10,
# Limit the number of frames rather than creating an endless animation.
[ValidateRange(1, 12)]
[int] $FrameCount = 4
)
# Arrange characters from calm water to a bright wave crest.
$palette = @(' ', '·', '░', '▒', '▓', '█')
# Use a fixed center so identical parameters always produce identical frames.
$centerX = ($Width - 1) / 2.0
$centerY = ($Height - 1) / 2.0
# Render each frame as text; no cursor movement or delay is required.
for ($frame = 0; $frame -lt $FrameCount; $frame++) {
"Frame {0:D2}" -f ($frame + 1)
for ($y = 0; $y -lt $Height; $y++) {
# Build one row efficiently before writing it to the pipeline.
$row = [System.Text.StringBuilder]::new()
for ($x = 0; $x -lt $Width; $x++) {
# Correct the horizontal aspect ratio so rings look circular in a terminal.
$dx = ($x - $centerX) * 0.55
$dy = $y - $centerY
$distance = [math]::Sqrt(($dx * $dx) + ($dy * $dy))
# Move the phase forward by a fixed amount for each frame.
$wave = ([math]::Sin(($distance * 1.35) - ($frame * 0.9)) + 1.0) / 2.0
$index = [math]::Min($palette.Count - 1, [math]::Floor($wave * $palette.Count))
[void]$row.Append($palette[$index])
}
$row.ToString()
}
# Separate captured frames without depending on terminal control sequences.
if ($frame -lt ($FrameCount - 1)) {
''
}
}
4. What Happened When It Ran
The actual captured output, errors, and exit status.
Checks: Captured three labeled frames at 28 × 9 characters. Repeated parameters produced a bounded sequence with consistent dimensions and visible phase movement.
Safety: In-memory mathematics and text output only; no delay, input, files, network access, or system changes.
Measure fictional palette pairs and report readable contrast thresholds.
Validated
AI found the scenario, created the prompt and runner, generated the PowerShell, ran it, and validated the result.
PowerShell 7 implementation
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into this concise prompt. That prompt was then used to generate the PowerShell.
Create a PowerShell 7 script that accepts objects with foreground and background hex colors, calculates relative luminance and contrast ratio, and reports large-text and normal-text pass results. Validate `#RRGGBB` input, use no external modules, and return structured objects without changing files or systems.
2. The Runner AI Created
AI also created run.ps1. It prepares the sample data, passes the parameters, and invokes the generated PowerShell.
Checks: Returned three assessments. White on #7C3AED produced 5.70 and passed both configured thresholds; #94A3B8 on #E2E8F0 produced 2.08 and failed both.
Safety: In-memory conversion and arithmetic only; no files, modules, network access, or system changes.
Review inert script text against a small, explainable safety policy.
Validated
AI found the scenario, created the prompt and runner, generated the PowerShell, ran it, and validated the result.
PowerShell 7 implementation
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into this concise prompt. That prompt was then used to generate the PowerShell.
Create a PowerShell 7 script that scans named script-text samples against a small configurable set of risky-command patterns. Return severity, line number, rule, and evidence; never invoke, dot-source, or otherwise execute the text. Use no files, network calls, or system changes.
2. The Runner AI Created
AI also created run.ps1. It prepares the sample data, passes the parameters, and invokes the generated PowerShell.
Checks: The clean sample returned no configured matches. The two review samples produced four findings with the expected severity, rule, line, and evidence.
Safety: Script samples remained inert strings. The solution did not invoke, dot-source, parse, or otherwise execute them.
Preview stable percentage rollouts with deterministic identity buckets.
Validated
AI found the scenario, created the prompt and runner, generated the PowerShell, ran it, and validated the result.
PowerShell 7 implementation
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into this concise prompt. That prompt was then used to generate the PowerShell.
Create a PowerShell 7 script that assigns supplied user IDs to stable buckets from 0–99 using SHA-256 plus a feature key. For each requested rollout percentage, return the bucket and enabled state. Keep it deterministic, in memory, and free of network, file, or system changes.
2. The Runner AI Created
AI also created run.ps1. It prepares the sample data, passes the parameters, and invokes the generated PowerShell.
$ErrorActionPreference = 'Stop'
# Preview the same fictional cohort at three rollout stages.
& (Join-Path $PSScriptRoot 'solution.ps1') `
-UserId @('user-amber', 'user-cobalt', 'user-jade', 'user-silver') `
-FeatureKey 'navigation-refresh' `
-Percentage @(10, 35, 75) |
Format-Table -AutoSize
3. The PowerShell AI Generated
solution.ps1 is the runnable PowerShell produced from the AI-created prompt.
[CmdletBinding()]
param(
# Use fictional or non-sensitive identifiers supplied by the caller.
[Parameter(Mandatory)]
[string[]] $UserId,
# Salt the assignment by feature so separate rollouts distribute independently.
[Parameter(Mandatory)]
[string] $FeatureKey,
# Preview one or more bounded rollout percentages.
[Parameter(Mandatory)]
[ValidateRange(0, 100)]
[int[]] $Percentage
)
# Create one reusable SHA-256 instance for deterministic bucket assignment.
$sha256 = [System.Security.Cryptography.SHA256]::Create()
try {
foreach ($id in $UserId) {
# Combine feature and identity so the same feature/user pair stays stable.
$inputText = '{0}:{1}' -f $FeatureKey, $id
$bytes = [System.Text.Encoding]::UTF8.GetBytes($inputText)
$hash = $sha256.ComputeHash($bytes)
# Read the first four bytes in a fixed order and map them into 100 buckets.
[uint64]$value = ([uint64]$hash[0] -shl 24) -bor
([uint64]$hash[1] -shl 16) -bor
([uint64]$hash[2] -shl 8) -bor
[uint64]$hash[3]
$bucket = [int]($value % 100)
# Show how this stable assignment behaves at every requested threshold.
foreach ($level in ($Percentage | Sort-Object -Unique)) {
[pscustomobject]@{
Feature = $FeatureKey
UserId = $id
Bucket = $bucket
Percentage = $level
Enabled = $bucket -lt $level
}
}
}
}
finally {
# Dispose the cryptographic provider without changing any external state.
$sha256.Dispose()
}
4. What Happened When It Ran
The actual captured output, errors, and exit status.
Checks: Four identities retained one stable bucket across 10%, 35%, and 75% previews. Enabled state changed only when a threshold exceeded the assigned bucket.
Safety: Deterministic in-memory hashing only; no files, network access, credentials, or system changes.
Turn numeric samples into a compact Unicode Braille waveform.
Validated
AI found the scenario, created the prompt and runner, generated the PowerShell, ran it, and validated the result.
PowerShell 7 implementation
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into this concise prompt. That prompt was then used to generate the PowerShell.
Create a fully commented PowerShell 7 script that accepts numeric samples and renders a bounded Unicode Braille waveform. Scale the values safely, label the range, return text only, and use no files, input, delays, network access, or system changes.
2. The Runner AI Created
AI also created run.ps1. It prepares the sample data, passes the parameters, and invokes the generated PowerShell.
$ErrorActionPreference = 'Stop'
# Build a deterministic composite wave with no random or external input.
$samples = 0..47 | ForEach-Object {
[math]::Sin($_ * 0.34) + (0.35 * [math]::Cos($_ * 0.82))
}
& (Join-Path $PSScriptRoot 'solution.ps1') -Sample $samples -DotHeight 12
3. The PowerShell AI Generated
solution.ps1 is the runnable PowerShell produced from the AI-created prompt.
[CmdletBinding()]
param(
# Accept a bounded set of numeric samples supplied by the caller.
[Parameter(Mandatory)]
[ValidateCount(2, 120)]
[double[]] $Sample,
# Four physical dot rows fit inside each Braille character row.
[ValidateRange(4, 24)]
[int] $DotHeight = 12
)
# Find the source range once so every sample uses the same scale.
$minimum = ($Sample | Measure-Object -Minimum).Minimum
$maximum = ($Sample | Measure-Object -Maximum).Maximum
$span = $maximum - $minimum
# Avoid division by zero when every sample has the same value.
if ($span -eq 0) {
$span = 1.0
}
# Braille cells hold two horizontal dots and four vertical dots.
$cellColumns = [math]::Ceiling($Sample.Count / 2)
$cellRows = [math]::Ceiling($DotHeight / 4)
$cells = [int[,]]::new($cellRows, $cellColumns)
# Map a local x/y dot coordinate to the Unicode Braille bit number.
$dotBits = @(
@(0, 3),
@(1, 4),
@(2, 5),
@(6, 7)
)
# Place one scaled dot for every signal sample.
for ($index = 0; $index -lt $Sample.Count; $index++) {
$normalized = ($Sample[$index] - $minimum) / $span
$dotY = ($DotHeight - 1) - [math]::Round($normalized * ($DotHeight - 1))
$cellRow = [math]::Floor($dotY / 4)
$cellColumn = [math]::Floor($index / 2)
$localY = $dotY % 4
$localX = $index % 2
$bit = $dotBits[$localY][$localX]
# Combine dots that land inside the same character cell.
$cells[$cellRow, $cellColumn] = $cells[$cellRow, $cellColumn] -bor (1 -shl $bit)
}
# Emit an upper range label before the visual plot.
'max {0,7:N2} ┐' -f $maximum
# Convert every populated cell into the Braille Unicode block.
for ($row = 0; $row -lt $cellRows; $row++) {
$line = [System.Text.StringBuilder]::new()
for ($column = 0; $column -lt $cellColumns; $column++) {
[void]$line.Append([char](0x2800 + $cells[$row, $column]))
}
' │{0}' -f $line.ToString()
}
# Finish with the lower label and a compact sample count.
'min {0,7:N2} ┘ {1} samples' -f $minimum, $Sample.Count
4. What Happened When It Ran
The actual captured output, errors, and exit status.
Derive field positions from a ruler and parse aligned text into objects.
Validated
AI found the scenario, created the prompt and runner, generated the PowerShell, ran it, and validated the result.
PowerShell 7 implementation
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into this concise prompt. That prompt was then used to generate the PowerShell.
Create a fully commented PowerShell 7 script that accepts a header, dashed ruler, and fixed-width data rows. Derive field positions from the ruler and return trimmed objects. Validate alignment and use only supplied in-memory text with no files or external commands.
2. The Runner AI Created
AI also created run.ps1. It prepares the sample data, passes the parameters, and invokes the generated PowerShell.
$ErrorActionPreference = 'Stop'
# Model a fictional report exported by a legacy scheduling system.
$header = 'Agent Region Cases Shift'
$ruler = '------------ -------- ------ --------'
$rows = @(
'Avery Stone East 18 Morning '
'Morgan Lee Central 7 Evening '
'Riley Chen West 23 Morning '
)
& (Join-Path $PSScriptRoot 'solution.ps1') `
-HeaderLine $header `
-RulerLine $ruler `
-DataLine $rows |
ConvertTo-Json -Depth 3
3. The PowerShell AI Generated
solution.ps1 is the runnable PowerShell produced from the AI-created prompt.
[CmdletBinding()]
param(
# The header supplies friendly property names at the ruler positions.
[Parameter(Mandatory)]
[string] $HeaderLine,
# Each run of dashes defines one fixed-width field.
[Parameter(Mandatory)]
[string] $RulerLine,
# Data remains supplied text rather than content read from disk.
[Parameter(Mandatory)]
[string[]] $DataLine
)
# Discover every field boundary from a run of one or more dashes.
$matches = [regex]::Matches($RulerLine, '-+')
if ($matches.Count -eq 0) {
throw 'The ruler must contain at least one dashed field.'
}
# Convert ruler matches into a small reusable field schema.
$fields = foreach ($match in $matches) {
if ($HeaderLine.Length -lt ($match.Index + 1)) {
throw 'The header does not align with every ruler field.'
}
$available = [math]::Min($match.Length, $HeaderLine.Length - $match.Index)
$name = $HeaderLine.Substring($match.Index, $available).Trim()
if ([string]::IsNullOrWhiteSpace($name)) {
$name = 'Field{0}' -f ($match.Index + 1)
}
[pscustomobject]@{
Name = $name
Start = $match.Index
Length = $match.Length
}
}
# Parse each row into an ordered object so column order remains stable.
foreach ($line in $DataLine) {
$record = [ordered]@{}
foreach ($field in $fields) {
# Allow short lines by treating missing trailing text as an empty value.
if ($line.Length -le $field.Start) {
$value = ''
}
else {
$length = [math]::Min($field.Length, $line.Length - $field.Start)
$value = $line.Substring($field.Start, $length).Trim()
}
$record[$field.Name] = $value
}
[pscustomobject]$record
}
4. What Happened When It Ran
The actual captured output, errors, and exit status.
Check PowerShell objects against a small declarative data contract.
Validated
AI found the scenario, created the prompt and runner, generated the PowerShell, ran it, and validated the result.
PowerShell 7 implementation
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into this concise prompt. That prompt was then used to generate the PowerShell.
Create a fully commented PowerShell 7 script that validates supplied objects against a declarative property contract. Check required fields, a small allow-list of types, blank strings, and optional numeric ranges. Return one structured finding per check and perform no dynamic execution or external access.
2. The Runner AI Created
AI also created run.ps1. It prepares the sample data, passes the parameters, and invokes the generated PowerShell.
$ErrorActionPreference = 'Stop'
# Define a small contract using data rather than executable expressions.
$contract = @(
[pscustomobject]@{ Name = 'Name'; Type = 'String'; Required = $true; Minimum = $null; Maximum = $null }
[pscustomobject]@{ Name = 'Seats'; Type = 'Integer'; Required = $true; Minimum = 1; Maximum = 12 }
[pscustomobject]@{ Name = 'Published'; Type = 'Boolean'; Required = $true; Minimum = $null; Maximum = $null }
)
# Exercise valid, blank, out-of-range, and missing-property cases.
$items = @(
[pscustomobject]@{ Name = 'Morning Lab'; Seats = 8; Published = $true }
[pscustomobject]@{ Name = ''; Seats = 18; Published = 'yes' }
[pscustomobject]@{ Name = 'Pop-up Lab'; Seats = 4 }
)
& (Join-Path $PSScriptRoot 'solution.ps1') -InputObject $items -Contract $contract |
Format-Table -AutoSize
3. The PowerShell AI Generated
solution.ps1 is the runnable PowerShell produced from the AI-created prompt.
[CmdletBinding()]
param(
# Validate caller-supplied objects without modifying them.
[Parameter(Mandatory)]
[object[]] $InputObject,
# Each contract entry names a property and its expected shape.
[Parameter(Mandatory)]
[object[]] $Contract
)
# Resolve a deliberately small type vocabulary without dynamic type loading.
function Test-AllowedType {
param(
[AllowNull()]
[object] $Value,
[ValidateSet('String', 'Integer', 'Number', 'Boolean', 'DateTime')]
[string] $ExpectedType
)
if ($null -eq $Value) {
return $false
}
switch ($ExpectedType) {
'String' { return $Value -is [string] }
'Integer' { return $Value -is [sbyte] -or $Value -is [byte] -or $Value -is [int16] -or $Value -is [uint16] -or $Value -is [int32] -or $Value -is [uint32] -or $Value -is [int64] -or $Value -is [uint64] }
'Number' { return $Value -is [decimal] -or $Value -is [double] -or $Value -is [single] -or $Value -is [int] -or $Value -is [long] }
'Boolean' { return $Value -is [bool] }
'DateTime' { return $Value -is [datetime] }
}
}
# Evaluate each object and contract entry independently for useful diagnostics.
for ($objectIndex = 0; $objectIndex -lt $InputObject.Count; $objectIndex++) {
$item = $InputObject[$objectIndex]
foreach ($rule in $Contract) {
$property = $item.PSObject.Properties[[string]$rule.Name]
$exists = $null -ne $property
$value = if ($exists) { $property.Value } else { $null }
$messages = [System.Collections.Generic.List[string]]::new()
# Report a missing property only when the contract requires it.
if (-not $exists -and [bool]$rule.Required) {
$messages.Add('Required property is missing.')
}
if ($exists) {
# Reject blank required strings as a separate, readable failure.
if ([bool]$rule.Required -and $value -is [string] -and [string]::IsNullOrWhiteSpace($value)) {
$messages.Add('Required string is blank.')
}
# Check the allow-listed type only when a value was provided.
if ($null -ne $value -and -not (Test-AllowedType -Value $value -ExpectedType $rule.Type)) {
$messages.Add("Expected type $($rule.Type); received $($value.GetType().Name).")
}
# Apply numeric limits only to values that can be treated as numbers.
if ($null -ne $value -and (Test-AllowedType -Value $value -ExpectedType 'Number')) {
if ($null -ne $rule.Minimum -and [double]$value -lt [double]$rule.Minimum) {
$messages.Add("Value is below minimum $($rule.Minimum).")
}
if ($null -ne $rule.Maximum -and [double]$value -gt [double]$rule.Maximum) {
$messages.Add("Value is above maximum $($rule.Maximum).")
}
}
}
# Emit one predictable result for every object/property pair.
[pscustomobject]@{
Object = $objectIndex + 1
Property = [string]$rule.Name
Passed = $messages.Count -eq 0
Message = if ($messages.Count) { $messages -join ' ' } else { 'Passed.' }
}
}
}
4. What Happened When It Ran
The actual captured output, errors, and exit status.
Execution status: PASSED
PowerShell version: 7.6.6
Command: pwsh -NoLogo -NoProfile -NonInteractive -File ./run.ps1
Exit status: 0
Stderr: empty
Stdout:
Object Property Passed Message
------ -------- ------ -------
1 Name True Passed.
1 Seats True Passed.
1 Published True Passed.
2 Name False Required string is blank.
2 Seats False Value is above maximum 12.
2 Published False Expected type Boolean; received String.
3 Name True Passed.
3 Seats True Passed.
3 Published False Required property is missing.
5. Validation Performed by the AI Workflow
The runtime, expected results, and safety boundaries were checked and recorded.
Checks: Produced nine object/property checks. The valid object passed all fields; the remaining objects exposed the expected blank, range, type, and missing-property failures.
Safety: Declarative checks over supplied objects only; no dynamic execution, type loading, files, network access, or system changes.
Find unusual observations with a prior-window statistical baseline.
Validated
AI found the scenario, created the prompt and runner, generated the PowerShell, ran it, and validated the result.
PowerShell 7 implementation
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into this concise prompt. That prompt was then used to generate the PowerShell.
Create a fully commented PowerShell 7 script that accepts timestamped numeric observations, a rolling window, and a z-score threshold. Compare each value only with prior values, return baseline statistics and anomaly status, and keep all work deterministic and in memory.
2. The Runner AI Created
AI also created run.ps1. It prepares the sample data, passes the parameters, and invokes the generated PowerShell.
Checks: Built baselines only after five prior observations. The value 168 was the sole anomaly at z-score 50.65; neighboring values remained below the 2.5 threshold.
Safety: Fixed in-memory observations and arithmetic only; no files, modules, network access, or system changes.
Build an Excel survey review with summaries and a comparison chart.
Validated
AI found the scenario, created the prompt and runner, generated the PowerShell, ran it, and validated the result.
PowerShell 7 implementation
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into this concise prompt. That prompt was then used to generate the PowerShell.
Create a fully commented PowerShell 7 script that accepts fictional workshop survey objects and an output path. Use ImportExcel to write Responses and Summary sheets, calculate averages and favorable counts, add a column chart, format the workbook, and return a concise result object. Write only the requested workbook.
2. The Runner AI Created
AI also created run.ps1. It prepares the sample data, passes the parameters, and invokes the generated PowerShell.
Checks: Created workshop-feedback.xlsx; confirmed Responses and Summary worksheets, three summary rows, one chart, a first average of 4.6, and a final favorable percentage of 80%.
Runtime note: The Linux image lacks the optional native library used for column autosizing. The lab avoids autosizing, and workbook creation plus read-back validation passed.
Safety: Fictional data only; no network access or system changes, and only the requested workbook was written.
Render a deterministic Mandelbrot set with a compact terminal character palette.
Validated
AI found the scenario, created the prompt and runner, generated the PowerShell, ran it, and validated the result.
PowerShell 7 implementation
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into this concise prompt. That prompt was then used to generate the PowerShell.
Create a fully commented PowerShell 7 script that renders a Mandelbrot set from width, height, center, scale, and iteration parameters. Return one Unicode text row per output line. Keep it deterministic, non-interactive, in memory, and network-free.
2. The Runner AI Created
AI also created run.ps1. It prepares the sample data, passes the parameters, and invokes the generated PowerShell.
Build a two-sheet harvest workbook with a crop summary and chart.
Validated
AI found the scenario, created the prompt and runner, generated the PowerShell, ran it, and validated the result.
PowerShell 7 implementation
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into this concise prompt. That prompt was then used to generate the PowerShell.
Create a fully commented PowerShell 7 script using ImportExcel. Accept harvest records and an output path, then build a workbook with a detailed table, a crop summary of weight and harvest count, and a column chart. Return a concise creation summary. No network access or external data.
2. The Runner AI Created
AI also created run.ps1. It prepares the sample data, passes the parameters, and invokes the generated PowerShell.
$ErrorActionPreference = 'Stop'
# Fictional harvest records keep the example repeatable and free of external dependencies.
$harvest = @(
[pscustomobject]@{ Date = '2026-08-02'; Crop = 'Tomato'; Plot = 'A1'; Quantity = 14; WeightKg = 3.20 }
[pscustomobject]@{ Date = '2026-08-05'; Crop = 'Zucchini'; Plot = 'B2'; Quantity = 5; WeightKg = 4.60 }
[pscustomobject]@{ Date = '2026-08-09'; Crop = 'Tomato'; Plot = 'A1'; Quantity = 18; WeightKg = 4.10 }
[pscustomobject]@{ Date = '2026-08-12'; Crop = 'Pepper'; Plot = 'C1'; Quantity = 11; WeightKg = 1.75 }
[pscustomobject]@{ Date = '2026-08-16'; Crop = 'Zucchini'; Plot = 'B2'; Quantity = 4; WeightKg = 3.90 }
[pscustomobject]@{ Date = '2026-08-19'; Crop = 'Pepper'; Plot = 'C1'; Quantity = 16; WeightKg = 2.35 }
)
$outputPath = Join-Path $PSScriptRoot "garden-harvest-$PID.xlsx"
# Pass the records and destination into the reusable AI-generated solution.
& (Join-Path $PSScriptRoot 'solution.ps1') -Harvest $harvest -OutputPath $outputPath |
Format-List
3. The PowerShell AI Generated
solution.ps1 is the runnable PowerShell produced from the AI-created prompt.
param(
[Parameter(Mandatory)] [object[]]$Harvest,
[Parameter(Mandatory)] [string]$OutputPath
)
# Stop early with a clear requirement instead of silently producing a partial workbook.
if (-not (Get-Module -ListAvailable -Name ImportExcel)) {
throw 'The ImportExcel module is required.'
}
# Normalize the input so dates, quantities, and weights have predictable workbook types.
$detail = foreach ($entry in $Harvest) {
[pscustomobject]@{
Date = [datetime]$entry.Date
Crop = [string]$entry.Crop
Plot = [string]$entry.Plot
Quantity = [int]$entry.Quantity
WeightKg = [Math]::Round([double]$entry.WeightKg, 2)
}
}
# Aggregate each crop into a useful dashboard-friendly summary.
$summary = $detail |
Group-Object Crop |
ForEach-Object {
[pscustomobject]@{
Crop = $_.Name
Harvests = $_.Count
TotalItems = ($_.Group | Measure-Object Quantity -Sum).Sum
TotalWeightKg = [Math]::Round(($_.Group | Measure-Object WeightKg -Sum).Sum, 2)
}
} |
Sort-Object TotalWeightKg -Descending
# Define the chart against named table columns so it expands with the summary data.
$chart = New-ExcelChartDefinition `
-XRange Crop `
-YRange TotalWeightKg `
-Title 'Harvest Weight by Crop' `
-ChartType ColumnClustered `
-NoLegend
# Write the detailed table first, then append the summary and its chart.
$detail | Export-Excel `
-Path $OutputPath `
-WorksheetName 'Harvest' `
-TableName 'HarvestDetail' `
-TableStyle Medium2 `
-FreezeTopRow `
-BoldTopRow
$summary | Export-Excel `
-Path $OutputPath `
-WorksheetName 'Crop Summary' `
-TableName 'CropSummary' `
-TableStyle Medium4 `
-FreezeTopRow `
-BoldTopRow `
-Append `
-ExcelChartDefinition $chart
# Return a small object that is useful both interactively and in automated validation.
[pscustomobject]@{
Workbook = $OutputPath
DetailRows = $detail.Count
SummaryRows = $summary.Count
TotalWeightKg = [Math]::Round(($detail | Measure-Object WeightKg -Sum).Sum, 2)
}
4. What Happened When It Ran
The actual captured output, errors, and exit status.
Estimate paint, whole cans, and leftovers from walls, openings, coats, and waste.
Validated
AI found the scenario, created the prompt and runner, generated the PowerShell, ran it, and validated the result.
PowerShell 7 implementation
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into this concise prompt. That prompt was then used to generate the PowerShell.
Create a fully commented PowerShell 7 script that accepts wall rectangles, opening rectangles, coats, coverage per liter, waste percent, and can size. Calculate net area, adjusted liters, whole cans, and leftover paint. Validate impossible inputs and use only in-memory data.
2. The Runner AI Created
AI also created run.ps1. It prepares the sample data, passes the parameters, and invokes the generated PowerShell.
Replay request bursts through a deterministic in-memory rate limiter.
Validated
AI found the scenario, created the prompt and runner, generated the PowerShell, ran it, and validated the result.
PowerShell 7 implementation
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into this concise prompt. That prompt was then used to generate the PowerShell.
Create a fully commented PowerShell 7 token-bucket simulator. Accept timestamped requests, bucket capacity, refill rate, and initial tokens. Return a decision record for every request plus totals. Keep it deterministic, bounded, in memory, and network-free.
2. The Runner AI Created
AI also created run.ps1. It prepares the sample data, passes the parameters, and invokes the generated PowerShell.
$ErrorActionPreference = 'Stop'
# The burst includes close arrivals followed by pauses that allow the bucket to refill.
$requests = @(
[pscustomobject]@{ TimeSeconds = 0.0; Name = 'image-a'; Cost = 3 }
[pscustomobject]@{ TimeSeconds = 0.2; Name = 'image-b'; Cost = 4 }
[pscustomobject]@{ TimeSeconds = 0.4; Name = 'report'; Cost = 5 }
[pscustomobject]@{ TimeSeconds = 1.8; Name = 'status'; Cost = 2 }
[pscustomobject]@{ TimeSeconds = 3.5; Name = 'export'; Cost = 6 }
[pscustomobject]@{ TimeSeconds = 6.0; Name = 'archive'; Cost = 5 }
)
& (Join-Path $PSScriptRoot 'solution.ps1') `
-Requests $requests `
-Capacity 10 `
-RefillPerSecond 2 `
-InitialTokens 8 |
Format-Table -AutoSize
3. The PowerShell AI Generated
solution.ps1 is the runnable PowerShell produced from the AI-created prompt.
param(
[Parameter(Mandatory)] [object[]]$Requests,
[ValidateRange(1, 10000)] [double]$Capacity,
[ValidateRange(0.01, 10000)] [double]$RefillPerSecond,
[ValidateRange(0, 10000)] [double]$InitialTokens = 0
)
# The bucket cannot begin with more tokens than its declared capacity.
$tokens = [Math]::Min($Capacity, $InitialTokens)
$lastTime = 0.0
$accepted = 0
$rejected = 0
# Process requests chronologically so refills are deterministic.
$events = foreach ($request in ($Requests | Sort-Object TimeSeconds)) {
$time = [double]$request.TimeSeconds
$cost = [double]$request.Cost
if ($time -lt $lastTime) { throw 'Request times must not move backward.' }
if ($cost -le 0 -or $cost -gt $Capacity) { throw 'Each request cost must be positive and no greater than capacity.' }
# Refill according to elapsed simulated time, capped at the bucket capacity.
$elapsed = $time - $lastTime
$tokensBefore = $tokens
$tokens = [Math]::Min($Capacity, $tokens + ($elapsed * $RefillPerSecond))
$refilled = $tokens - $tokensBefore
# Spend tokens only when the entire request can be accepted.
$allowed = $tokens -ge $cost
if ($allowed) {
$tokens -= $cost
$accepted++
}
else {
$rejected++
}
[pscustomobject]@{
TimeSeconds = $time
Request = [string]$request.Name
Cost = $cost
Refilled = [Math]::Round($refilled, 2)
Allowed = $allowed
TokensAfter = [Math]::Round($tokens, 2)
}
$lastTime = $time
}
# Emit the event stream followed by one distinct summary record.
$events
[pscustomobject]@{
TimeSeconds = '-'
Request = 'TOTAL'
Cost = '-'
Refilled = '-'
Allowed = "$accepted accepted / $rejected rejected"
TokensAfter = [Math]::Round($tokens, 2)
}
4. What Happened When It Ran
The actual captured output, errors, and exit status.
Explore probabilistic membership checks with deterministic SHA-256 indexes.
Validated
AI found the scenario, created the prompt and runner, generated the PowerShell, ran it, and validated the result.
PowerShell 7 implementation
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into this concise prompt. That prompt was then used to generate the PowerShell.
Create a fully commented PowerShell 7 Bloom filter demonstration. Accept strings, query strings, bit count, and hash count. Use deterministic SHA-256-derived indexes, return query results and bit occupancy, and clearly label matches as possible rather than certain. Stay in memory with no network access.
2. The Runner AI Created
AI also created run.ps1. It prepares the sample data, passes the parameters, and invokes the generated PowerShell.
$ErrorActionPreference = 'Stop'
# Use a small fictional command catalog and a mix of known and unknown queries.
$items = @('Get-Orbit', 'Set-Canvas', 'Measure-Signal', 'New-Atlas', 'Test-Beacon', 'Format-Grid')
$queries = @('Get-Orbit', 'Remove-Planet', 'Test-Beacon', 'Show-Compass', 'Format-Grid')
& (Join-Path $PSScriptRoot 'solution.ps1') `
-Items $items `
-Queries $queries `
-BitCount 128 `
-HashCount 4 |
Format-Table -AutoSize
3. The PowerShell AI Generated
solution.ps1 is the runnable PowerShell produced from the AI-created prompt.
param(
[Parameter(Mandatory)] [string[]]$Items,
[Parameter(Mandatory)] [string[]]$Queries,
[ValidateRange(32, 8192)] [int]$BitCount = 256,
[ValidateRange(1, 8)] [int]$HashCount = 4
)
# Store the filter as booleans so the demonstration remains easy to inspect.
$bits = [bool[]]::new($BitCount)
function Get-BloomIndexes {
param([Parameter(Mandatory)] [string]$Value)
# SHA-256 provides stable bytes across platforms and PowerShell sessions.
$bytes = [System.Text.Encoding]::UTF8.GetBytes($Value)
$digest = [System.Security.Cryptography.SHA256]::HashData($bytes)
# Read separate four-byte windows to derive independent-looking indexes.
for ($index = 0; $index -lt $HashCount; $index++) {
$offset = ($index * 4) % ($digest.Length - 3)
$number = [BitConverter]::ToUInt32($digest, $offset)
[int]($number % $BitCount)
}
}
# Add each catalog item by setting all of its derived bit positions.
foreach ($item in $Items) {
foreach ($index in (Get-BloomIndexes -Value $item)) {
$bits[$index] = $true
}
}
# A query is possibly present only when every required bit has been set.
$results = foreach ($query in $Queries) {
$indexes = @(Get-BloomIndexes -Value $query)
$possiblyPresent = -not ($indexes | Where-Object { -not $bits[$_] } | Select-Object -First 1)
[pscustomobject]@{
Query = $query
Verdict = if ($possiblyPresent) { 'Possibly present' } else { 'Definitely absent' }
Indexes = $indexes -join ', '
ActuallyInserted = $Items -ccontains $query
}
}
# Return query evidence followed by a compact occupancy summary.
$results
$setBits = ($bits | Where-Object { $_ }).Count
[pscustomobject]@{
Query = 'FILTER'
Verdict = "$setBits of $BitCount bits set"
Indexes = '-'
ActuallyInserted = '-'
}
4. What Happened When It Ran
The actual captured output, errors, and exit status.
Render a deterministic Unicode constellation storyboard as plain PowerShell terminal art.
Validated
AI found the scenario, created the prompt and runner, generated the PowerShell, ran it, and validated the result.
PowerShell 7 implementation
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into the concise prompt used to generate the PowerShell.
Create a PowerShell 7 function that renders three deterministic frames of a star field as boxed Unicode terminal art. Accept width, height, frame count, and a random seed. Keep everything in memory, avoid cursor control and external access, and return the frames as text so the result is safe to capture non-interactively.
2. The Runner AI Created
AI created run.ps1 to prepare sample data, pass parameters, and invoke the generated PowerShell.
Runtime, expected results, and safety boundaries checked and recorded.
Validation StatusPassed
PowerShell 7.6.6 completed non-interactively with exit status 0 and no stderr output. three deterministic frames rendered with the requested 30 by 8 dimensions. bounded Unicode text generation in memory; no cursor control, network, credentials, deletion, or system changes.
Turn fictional milestones into a formatted workbook with calculated risk and visual completion cues.
Review only
AI found the scenario, created the prompt and runner, generated the PowerShell, ran it, and validated the result.
PowerShell 7 implementation
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into the concise prompt used to generate the PowerShell.
Using PowerShell 7 and ImportExcel, create a workbook from fictional milestones. Calculate days to due, classify each item as On Track, At Risk, or Late, add a completion data bar and status colors, and write a summary sheet. Use a caller-supplied path, sample objects only, and no network or system changes.
2. The Runner AI Created
AI created run.ps1 to prepare sample data, pass parameters, and invoke the generated PowerShell.
solution.ps1 is the runnable PowerShell produced from the AI-created prompt.
# Export milestone records as a small, review-ready Excel workbook.
# ImportExcel is the only external module used; all records are supplied by
# the caller and the workbook is written to the requested output path.
function Export-MilestoneRiskWorkbook {
[CmdletBinding()]
param(
[Parameter(Mandatory)]
[object[]]$Milestones,
[Parameter(Mandatory)]
[datetime]$AsOfDate,
[Parameter(Mandatory)]
[string]$Path
)
# Convert each input object to a consistent calculated record.
$rows = foreach ($milestone in $Milestones) {
$due = [datetime]$milestone.DueDate
$daysToDue = ($due.Date - $AsOfDate.Date).Days
$risk = if ($milestone.Status -eq 'Complete') { 'On Track' }
elseif ($daysToDue -lt 0) { 'Late' }
elseif ($daysToDue -le 3 -or $milestone.PercentComplete -lt 50) { 'At Risk' }
else { 'On Track' }
[pscustomobject]@{
Milestone = [string]$milestone.Milestone
Owner = [string]$milestone.Owner
DueDate = $due.Date
Status = [string]$milestone.Status
PercentComplete = [int]$milestone.PercentComplete
DaysToDue = $daysToDue
Risk = $risk
}
}
# Ensure the destination folder exists without touching any other files.
$parent = Split-Path -Parent $Path
if ($parent -and -not (Test-Path -LiteralPath $parent)) {
New-Item -ItemType Directory -Path $parent -Force | Out-Null
}
# Export the detailed table and a compact summary sheet.
$rows | Export-Excel -Path $Path -WorksheetName 'Milestones' -TableName 'Milestones' -AutoSize -FreezeTopRow -BoldTopRow -ClearSheet
$summary = $rows | Group-Object Risk | ForEach-Object {
[pscustomobject]@{ Risk = $_.Name; Count = $_.Count }
}
$summary | Export-Excel -Path $Path -WorksheetName 'Summary' -TableName 'RiskSummary' -AutoSize -BoldTopRow -Append
# Apply simple, portable visual cues to make review faster.
$package = Open-ExcelPackage -Path $Path
$sheet = $package.Workbook.Worksheets['Milestones']
Add-ConditionalFormatting -Worksheet $sheet -Address 'E2:E200' -DataBarColor '4F81BD' | Out-Null
Add-ConditionalFormatting -Worksheet $sheet -Address 'G2:G200' -RuleType Equal -ConditionValue '"Late"' -BackgroundColor 'F4CCCC' -ForegroundColor '9C0006' | Out-Null
Add-ConditionalFormatting -Worksheet $sheet -Address 'G2:G200' -RuleType Equal -ConditionValue '"At Risk"' -BackgroundColor 'FFF2CC' -ForegroundColor '7F6000' | Out-Null
Close-ExcelPackage $package
[pscustomobject]@{
Path = (Resolve-Path -LiteralPath $Path).Path
MilestoneCount = $rows.Count
RiskSummary = (($summary | ForEach-Object { "$($_.Risk)=$($_.Count)" }) -join ', ')
}
}
4. What Happened When It Ran
Captured output, errors, and exit status from the runner.
PowerShell version: 7.6.6
Command: ./pwsh-runtime/pwsh -NoLogo -NoProfile -File run.ps1
Exit status: 1
PowerShell version verified separately: 7.6.6
Standard output: (empty)
Standard error:
Import-Module: run.ps1:3
The specified module 'ImportExcel' was not loaded because no valid module file was found in any module directory.
The workflow attempted to install ImportExcel, but the cloud runtime could not reach a package source. No workbook output was fabricated.
5. Validation Performed by the AI Workflow
Runtime, expected results, and safety boundaries checked and recorded.
Validation StatusReview only
The cloud runtime could not install or load ImportExcel, so this workbook lab remains review-only and no workbook output is claimed. The script uses fictional milestone objects and is ready for a runtime with the module available.
Scale ingredient quantities to a new serving count while preserving units and decimal precision.
Validated
AI found the scenario, created the prompt and runner, generated the PowerShell, ran it, and validated the result.
PowerShell 7 implementation
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into the concise prompt used to generate the PowerShell.
Create a PowerShell 7 function that scales a fictional recipe from its original serving count to a requested count. Accept ingredient objects with quantity, unit, and name; multiply quantities with decimal precision; and return a readable ingredient list. Use in-memory data only and reject zero or negative servings.
2. The Runner AI Created
AI created run.ps1 to prepare sample data, pass parameters, and invoke the generated PowerShell.
# Scale a fictional soup recipe from four portions to ten.
$ErrorActionPreference = 'Stop'
. (Join-Path $PSScriptRoot 'solution.ps1')
$ingredients = @(
[pscustomobject]@{ Quantity = 2; Unit = 'cups'; Ingredient = 'tomatoes' }
[pscustomobject]@{ Quantity = 1.5; Unit = 'cups'; Ingredient = 'stock' }
[pscustomobject]@{ Quantity = 0.5; Unit = 'cup'; Ingredient = 'lentils' }
[pscustomobject]@{ Quantity = 2; Unit = 'tbsp'; Ingredient = 'herbs' }
)
Convert-RecipeBatch -OriginalServings 4 -TargetServings 10 -Ingredients $ingredients | Format-Table -AutoSize
3. The PowerShell AI Generated
solution.ps1 is the runnable PowerShell produced from the AI-created prompt.
# Scale ingredient quantities while retaining the original units and names.
function Convert-RecipeBatch {
[CmdletBinding()]
param(
[Parameter(Mandatory)]
[ValidateRange(1,10000)]
[int]$OriginalServings,
[Parameter(Mandatory)]
[ValidateRange(1,10000)]
[int]$TargetServings,
[Parameter(Mandatory)]
[object[]]$Ingredients
)
# One multiplier applies to every ingredient in the batch.
$multiplier = [decimal]$TargetServings / $OriginalServings
foreach ($ingredient in $Ingredients) {
# Round display quantities to three decimal places but keep decimals.
$quantity = [Math]::Round(([decimal]$ingredient.Quantity * $multiplier), 3)
[pscustomobject]@{
Quantity = $quantity
Unit = [string]$ingredient.Unit
Ingredient = [string]$ingredient.Ingredient
}
}
}
4. What Happened When It Ran
Captured output, errors, and exit status from the runner.
PowerShell version: 7.6.6
Command: ./pwsh-runtime/pwsh -NoLogo -NoProfile -File run.ps1
Exit status: 0
Standard error: (empty)
Standard output:
Quantity Unit Ingredient
-------- ---- ----------
5.00 cups tomatoes
3.75 cups stock
1.25 cup lentils
5.00 tbsp herbs
5. Validation Performed by the AI Workflow
Runtime, expected results, and safety boundaries checked and recorded.
Validation StatusPassed
PowerShell 7.6.6 completed non-interactively with exit status 0 and no stderr output. four ingredients scaled from four to ten servings with decimal quantities preserved. in-memory sample data only; no network, credentials, deletion, or system changes.
Translate fictional UTC launch events into a readable schedule for distributed teams.
Validated
AI found the scenario, created the prompt and runner, generated the PowerShell, ran it, and validated the result.
PowerShell 7 implementation
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into the concise prompt used to generate the PowerShell.
Create a PowerShell 7 function that accepts fictional launch events as UTC timestamps and converts each one to a caller-supplied list of time zones. Return event name, zone, local timestamp, and local date. Use `TimeZoneInfo`, in-memory data, and no network or system access.
2. The Runner AI Created
AI created run.ps1 to prepare sample data, pass parameters, and invoke the generated PowerShell.
solution.ps1 is the runnable PowerShell produced from the AI-created prompt.
# Convert UTC launch events into a compact multi-zone schedule.
function Get-GlobalLaunchBoard {
[CmdletBinding()]
param(
[Parameter(Mandatory)]
[object[]]$Events,
[Parameter(Mandatory)]
[string[]]$TimeZoneIds
)
foreach ($event in $Events) {
# Parse as an offset-aware instant so the conversion is unambiguous.
$utc = [datetimeoffset]$event.UtcTime
foreach ($zoneId in $TimeZoneIds) {
$zone = [TimeZoneInfo]::FindSystemTimeZoneById($zoneId)
$local = [TimeZoneInfo]::ConvertTime($utc, $zone)
[pscustomobject]@{
Event = [string]$event.Event
Zone = $zone.Id
LocalTime = $local.ToString('yyyy-MM-dd HH:mm zzz')
LocalDate = $local.ToString('dddd, MMM d')
}
}
}
}
4. What Happened When It Ran
Captured output, errors, and exit status from the runner.
PowerShell version: 7.6.6
Command: ./pwsh-runtime/pwsh -NoLogo -NoProfile -File run.ps1
Exit status: 0
Standard error: (empty)
Standard output:
Event Zone LocalTime LocalDate
----- ---- --------- ---------
Preview stream America/New_York 2026-10-03 11:00 -04:00 Saturday, Oct 3
Preview stream Europe/London 2026-10-03 16:00 +01:00 Saturday, Oct 3
Preview stream Asia/Tokyo 2026-10-04 00:00 +09:00 Sunday, Oct 4
Feedback room America/New_York 2026-10-04 05:30 -04:00 Sunday, Oct 4
Feedback room Europe/London 2026-10-04 10:30 +01:00 Sunday, Oct 4
Feedback room Asia/Tokyo 2026-10-04 18:30 +09:00 Sunday, Oct 4
5. Validation Performed by the AI Workflow
Runtime, expected results, and safety boundaries checked and recorded.
Validation StatusPassed
PowerShell 7.6.6 completed non-interactively with exit status 0 and no stderr output. two UTC events produced six rows across three time zones; local dates and offsets were populated. deterministic in-memory objects only; no network, credentials, deletion, or system changes.
Solve a compact word ladder with a breadth-first search written in PowerShell.
Validated
AI found the scenario, created the prompt and runner, generated the PowerShell, ran it, and validated the result.
PowerShell 7 implementation
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into the concise prompt used to generate the PowerShell.
Create a PowerShell 7 breadth-first word-ladder solver. Accept a start word, end word, and same-length dictionary; change one letter at a time; return whether a path exists, its step count, and the shortest path. Keep the dictionary in memory and avoid external access.
2. The Runner AI Created
AI created run.ps1 to prepare sample data, pass parameters, and invoke the generated PowerShell.
solution.ps1 is the runnable PowerShell produced from the AI-created prompt.
# Find the shortest one-letter-at-a-time transformation between two words.
function Find-WordLadder {
[CmdletBinding()]
param(
[Parameter(Mandatory)] [string]$StartWord,
[Parameter(Mandatory)] [string]$EndWord,
[Parameter(Mandatory)] [string[]]$WordList
)
$start = $StartWord.ToLowerInvariant()
$end = $EndWord.ToLowerInvariant()
if ($start.Length -ne $end.Length) { throw 'Start and end words must have the same length.' }
# Keep only same-length words and use sets for constant-time membership.
$dictionary = [System.Collections.Generic.HashSet[string]]::new([StringComparer]::OrdinalIgnoreCase)
$WordList | Where-Object { $_.Length -eq $start.Length } | ForEach-Object { [void]$dictionary.Add($_.ToLowerInvariant()) }
[void]$dictionary.Add($start)
[void]$dictionary.Add($end)
# Queue words breadth-first and remember each predecessor for reconstruction.
$queue = [System.Collections.Generic.Queue[string]]::new()
$visited = [System.Collections.Generic.HashSet[string]]::new([StringComparer]::OrdinalIgnoreCase)
$parent = @{}
$queue.Enqueue($start)
[void]$visited.Add($start)
$alphabet = 'abcdefghijklmnopqrstuvwxyz'.ToCharArray()
while ($queue.Count -gt 0) {
$current = $queue.Dequeue()
if ($current -eq $end) { break }
for ($position = 0; $position -lt $current.Length; $position++) {
foreach ($letter in $alphabet) {
if ($letter -eq $current[$position]) { continue }
$candidateChars = $current.ToCharArray()
$candidateChars[$position] = $letter
$candidate = -join $candidateChars
if ($dictionary.Contains($candidate) -and $visited.Add($candidate)) {
$parent[$candidate] = $current
$queue.Enqueue($candidate)
}
}
}
}
if (-not $visited.Contains($end)) {
return [pscustomobject]@{ Start = $start; End = $end; Found = $false; Steps = 0; Path = @() }
}
$path = [System.Collections.Generic.List[string]]::new()
$cursor = $end
while ($null -ne $cursor) {
$path.Insert(0, $cursor)
$cursor = if ($parent.ContainsKey($cursor)) { $parent[$cursor] } else { $null }
}
[pscustomobject]@{ Start = $start; End = $end; Found = $true; Steps = $path.Count - 1; Path = $path.ToArray() }
}
4. What Happened When It Ran
Captured output, errors, and exit status from the runner.
PowerShell version: 7.6.6
Command: ./pwsh-runtime/pwsh -NoLogo -NoProfile -File run.ps1
Exit status: 0
Standard error: (empty)
Standard output:
Start : cold
End : warm
Found : True
Steps : 4
Path : {cold, cord, word, ward…}
Path: cold -> cord -> word -> ward -> warm
5. Validation Performed by the AI Workflow
Runtime, expected results, and safety boundaries checked and recorded.
Validation StatusPassed
PowerShell 7.6.6 completed non-interactively with exit status 0 and no stderr output. breadth-first search found a four-step shortest path from `cold` to `warm`. bounded in-memory dictionary only; no network, credentials, deletion, or system changes.
Project compounded capacity growth for fictional storage workloads.
Validated
PowerShell 7 implementation
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into this concise prompt. That prompt was then used to generate the PowerShell.
Create a fully commented PowerShell 7 function that accepts storage workloads with a name, starting gigabytes, monthly growth percentage, and forecast length. Calculate compounded final size, added capacity, and average monthly growth. Validate numeric inputs and return sortable objects. Use only in-memory data with no network or system changes.
2. The Runner AI Created
AI also created run.ps1. It prepares the sample data, passes the parameters, and invokes the generated PowerShell.
$ErrorActionPreference = 'Stop'
# Load the AI-generated function from the same lab folder.
. "$PSScriptRoot/solution.ps1"
# Create deterministic fictional workloads entirely in memory.
$workloads = @(
[pscustomobject]@{ Name = 'Build Artifacts'; StartingGB = 420; MonthlyGrowthPct = 8; Months = 6 }
[pscustomobject]@{ Name = 'Support Archive'; StartingGB = 850; MonthlyGrowthPct = 3.5; Months = 12 }
[pscustomobject]@{ Name = 'Design Assets'; StartingGB = 275; MonthlyGrowthPct = 12; Months = 4 }
)
# Generate the forecast and show the highest final capacity first.
Get-StorageGrowthForecast -Workload $workloads |
Sort-Object FinalGB -Descending |
Select-Object Workload, StartingGB,
@{ Name = 'GrowthPct'; Expression = { $_.MonthlyGrowthPercent } },
Months, FinalGB, AddedGB,
@{ Name = 'AvgAddedGB'; Expression = { $_.AverageAddedGB } } |
Format-Table -AutoSize
3. The PowerShell AI Generated
solution.ps1 is the runnable PowerShell produced from the AI-created prompt.
function Get-StorageGrowthForecast {
[CmdletBinding()]
param(
# Each input object describes one fictional workload and its growth assumptions.
[Parameter(Mandatory, ValueFromPipeline)]
[psobject[]]$Workload
)
process {
foreach ($item in $Workload) {
# Convert each numeric field once so calculations use predictable decimal values.
$startingGB = [double]$item.StartingGB
$growthPct = [double]$item.MonthlyGrowthPct
$months = [int]$item.Months
# Reject values that would make the forecast misleading or mathematically invalid.
if ([string]::IsNullOrWhiteSpace([string]$item.Name)) {
throw 'Each workload must have a name.'
}
if ($startingGB -lt 0 -or $growthPct -lt 0 -or $months -lt 1) {
throw "Workload '$($item.Name)' contains an invalid numeric value."
}
# Convert the percentage to a multiplier and compound it for the requested months.
$monthlyMultiplier = 1 + ($growthPct / 100)
$finalGB = $startingGB * [math]::Pow($monthlyMultiplier, $months)
$addedGB = $finalGB - $startingGB
# Return a clean object that downstream commands can sort, export, or format.
[pscustomobject]@{
Workload = [string]$item.Name
StartingGB = [math]::Round($startingGB, 2)
MonthlyGrowthPercent = [math]::Round($growthPct, 2)
Months = $months
FinalGB = [math]::Round($finalGB, 2)
AddedGB = [math]::Round($addedGB, 2)
AverageAddedGB = [math]::Round($addedGB / $months, 2)
}
}
}
}
4. What Happened When It Ran
The actual captured output, errors, and exit status.
three workloads were returned in descending final-size order; a focused assertion verified the six-month compounded result of 666.49 GB for Build Artifacts.
Safety
fictional in-memory objects only; no network, file writes, deletion, registry/system changes, credential access, or arbitrary code execution.
Build a formatted Excel renewal tracker with calculated status and visual cues.
Validated
PowerShell 7 implementation
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into this concise prompt. That prompt was then used to generate the PowerShell.
Create a fully commented PowerShell 7 function using ImportExcel that accepts fictional service renewals and an as-of date. Calculate days remaining and a status of Expired, Due Soon, or Scheduled. Export a formatted Excel table, color the status cells, and return a summary object. Only create the requested workbook; do not use network, credentials, or system settings.
2. The Runner AI Created
AI also created run.ps1. It prepares the sample data, passes the parameters, and invokes the generated PowerShell.
$ErrorActionPreference = 'Stop'
# Suppress the module's optional AutoSize dependency warning; this lab sets widths explicitly.
$WarningPreference = 'SilentlyContinue'
# Load the AI-generated workbook function.
. "$PSScriptRoot/solution.ps1"
# Use fixed fictional records so every run produces the same status counts.
$renewals = @(
[pscustomobject]@{ Service = 'Diagram Cloud'; Owner = 'Design'; RenewalDate = '2026-09-12'; AnnualCost = 1440 }
[pscustomobject]@{ Service = 'Build Cache'; Owner = 'Engineering'; RenewalDate = '2026-09-28'; AnnualCost = 3600 }
[pscustomobject]@{ Service = 'Survey Desk'; Owner = 'Research'; RenewalDate = '2026-10-14'; AnnualCost = 960 }
[pscustomobject]@{ Service = 'Status Board'; Owner = 'Operations'; RenewalDate = '2027-01-10'; AnnualCost = 2280 }
)
# Create a new workbook in the process temp directory without overwriting prior runs.
$runId = [guid]::NewGuid().ToString('N').Substring(0, 8)
$workbookPath = Join-Path ([System.IO.Path]::GetTempPath()) "service-renewal-workbook-$runId.xlsx"
$summary = Export-ServiceRenewalWorkbook -Renewal $renewals -AsOfDate '2026-09-20' -Path $workbookPath
# Show both the summary and workbook structure used by validation.
$summary | Format-List
$package = Open-ExcelPackage -Path $workbookPath
$sheet = $package.Workbook.Worksheets['Renewals']
[pscustomobject]@{
Worksheet = $sheet.Name
Rows = $sheet.Dimension.Rows
Columns = $sheet.Dimension.Columns
Tables = $sheet.Tables.Count
ConditionalFormats = $sheet.ConditionalFormatting.Count
} | Format-List
Close-ExcelPackage -ExcelPackage $package -NoSave
3. The PowerShell AI Generated
solution.ps1 is the runnable PowerShell produced from the AI-created prompt.
function Export-ServiceRenewalWorkbook {
[CmdletBinding()]
param(
# Renewal records must include Service, Owner, RenewalDate, and AnnualCost.
[Parameter(Mandatory)]
[psobject[]]$Renewal,
# A fixed as-of date keeps the calculation deterministic and easy to test.
[Parameter(Mandatory)]
[datetime]$AsOfDate,
# The caller chooses the single workbook file this function creates.
[Parameter(Mandatory)]
[string]$Path
)
# Fail clearly when the lab's only external module is unavailable.
if (-not (Get-Module -ListAvailable -Name ImportExcel)) {
throw 'The ImportExcel module is required.'
}
Import-Module ImportExcel -ErrorAction Stop -WarningAction SilentlyContinue
# Enrich each fictional renewal with deterministic scheduling fields.
$report = foreach ($item in $Renewal) {
$renewalDate = [datetime]$item.RenewalDate
$daysRemaining = [int][math]::Floor(($renewalDate.Date - $AsOfDate.Date).TotalDays)
# Assign a small set of statuses that work well for filtering and formatting.
$status = if ($daysRemaining -lt 0) {
'Expired'
}
elseif ($daysRemaining -le 30) {
'Due Soon'
}
else {
'Scheduled'
}
# Emit only the columns intended for the finished workbook.
[pscustomobject]@{
Service = [string]$item.Service
Owner = [string]$item.Owner
RenewalDate = $renewalDate.Date
DaysRemaining = $daysRemaining
AnnualCost = [decimal]$item.AnnualCost
Status = $status
}
}
# Export the records as a named table and retain the package for final styling.
$excel = $report |
Sort-Object RenewalDate |
Export-Excel -Path $Path -WorksheetName 'Renewals' -TableName 'RenewalTable' `
-TableStyle Medium2 -FreezeTopRow -BoldTopRow -PassThru
# Apply readable formats to the date and currency columns.
$worksheet = $excel.Workbook.Worksheets['Renewals']
Set-ExcelRange -Worksheet $worksheet -Range 'C:C' -NumberFormat 'yyyy-mm-dd'
Set-ExcelRange -Worksheet $worksheet -Range 'E:E' -NumberFormat '$#,##0.00'
# Set practical widths explicitly so the workbook is portable across cloud hosts.
Set-ExcelRange -Worksheet $worksheet -Range 'A:A' -Width 22
Set-ExcelRange -Worksheet $worksheet -Range 'B:B' -Width 16
Set-ExcelRange -Worksheet $worksheet -Range 'C:F' -Width 18
# Color the status column so urgent items are visible at a glance.
Add-ConditionalFormatting -Worksheet $worksheet -Range 'F2:F1048576' `
-RuleType ContainsText -ConditionValue 'Expired' -BackgroundColor 'LightPink' -Bold
Add-ConditionalFormatting -Worksheet $worksheet -Range 'F2:F1048576' `
-RuleType ContainsText -ConditionValue 'Due Soon' -BackgroundColor 'LightYellow' -Bold
Add-ConditionalFormatting -Worksheet $worksheet -Range 'F2:F1048576' `
-RuleType ContainsText -ConditionValue 'Scheduled' -BackgroundColor 'LightGreen'
# Save and close the package before returning a concise execution summary.
Close-ExcelPackage -ExcelPackage $excel
[pscustomobject]@{
Path = $Path
RecordCount = $report.Count
ExpiredCount = @($report | Where-Object Status -eq 'Expired').Count
DueSoonCount = @($report | Where-Object Status -eq 'Due Soon').Count
ScheduledCount = @($report | Where-Object Status -eq 'Scheduled').Count
TotalAnnualCost = [math]::Round(($report | Measure-Object AnnualCost -Sum).Sum, 2)
}
}
4. What Happened When It Ran
The actual captured output, errors, and exit status.
four records produced the expected 1 expired, 2 due-soon, and 1 scheduled statuses; the workbook reopened successfully with 5 rows, 6 columns, 1 named table, and 3 conditional-formatting rules.
Safety
fictional input only; the script created one uniquely named workbook in the temporary directory and made no network calls, deletions, registry/system changes, credential accesses, or arbitrary code executions.
Turn arbitrary numeric ranges into clean chart bounds and readable tick labels.
Validated
PowerShell 7 implementation
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into this concise prompt. That prompt was then used to generate the PowerShell.
Create a fully commented PowerShell 7 function that converts a numeric minimum and maximum into human-friendly chart bounds and tick labels. Choose a 1, 2, 5, or 10 interval near a requested tick count, include zero when requested, and return one summary object. Use only deterministic in-memory calculations.
2. The Runner AI Created
AI also created run.ps1. It prepares the sample data, passes the parameters, and invokes the generated PowerShell.
solution.ps1 is the runnable PowerShell produced from the AI-created prompt.
function Get-FriendlyAxisScale {
[CmdletBinding()]
param(
# The smallest and largest values that must fit on the axis.
[Parameter(Mandatory)]
[double]$Minimum,
[Parameter(Mandatory)]
[double]$Maximum,
# This is a target, because clean intervals matter more than an exact count.
[ValidateRange(2, 20)]
[int]$TargetTickCount = 6,
# This switch is useful for charts where distance from zero has meaning.
[switch]$IncludeZero
)
# Reject an empty or reversed numeric range before calculating an interval.
if ($Maximum -le $Minimum) {
throw 'Maximum must be greater than Minimum.'
}
# Expand the source range to zero when the caller requests that visual baseline.
$workingMinimum = if ($IncludeZero -and $Minimum -gt 0) { 0 } else { $Minimum }
$workingMaximum = if ($IncludeZero -and $Maximum -lt 0) { 0 } else { $Maximum }
# Estimate an interval, then split it into a power of ten and a small fraction.
$rawInterval = ($workingMaximum - $workingMinimum) / ($TargetTickCount - 1)
$magnitude = [math]::Pow(10, [math]::Floor([math]::Log10($rawInterval)))
$fraction = $rawInterval / $magnitude
# Choose the next familiar interval so labels stay readable and cover the range.
$niceFraction = if ($fraction -le 1) {
1
}
elseif ($fraction -le 2) {
2
}
elseif ($fraction -le 5) {
5
}
else {
10
}
$interval = $niceFraction * $magnitude
# Round outward so the original minimum and maximum always remain visible.
$axisMinimum = [math]::Floor($workingMinimum / $interval) * $interval
$axisMaximum = [math]::Ceiling($workingMaximum / $interval) * $interval
# Derive an appropriate label precision for intervals smaller than one.
$decimals = if ($interval -lt 1) {
[math]::Max(0, [int](-[math]::Floor([math]::Log10($interval))))
}
else {
0
}
# Build both numeric tick values and ready-to-display invariant labels.
$ticks = [System.Collections.Generic.List[double]]::new()
$labels = [System.Collections.Generic.List[string]]::new()
for ($value = $axisMinimum; $value -le ($axisMaximum + ($interval / 1000)); $value += $interval) {
$rounded = [math]::Round($value, $decimals)
$ticks.Add($rounded)
$labels.Add($rounded.ToString("F$decimals", [cultureinfo]::InvariantCulture))
}
# Return one object that a charting layer can consume without reparsing text.
[pscustomobject]@{
SourceMinimum = $Minimum
SourceMaximum = $Maximum
AxisMinimum = $axisMinimum
AxisMaximum = $axisMaximum
Interval = $interval
TickCount = $ticks.Count
Ticks = $ticks.ToArray()
Labels = $labels.ToArray()
}
}
4. What Happened When It Ran
The actual captured output, errors, and exit status.
three ranges produced ordered ticks that covered every source value; a focused assertion verified zero inclusion, bounds of 0 through 100, and six ticks for the queue-depth example.
Safety
deterministic in-memory calculations only; no network, file writes, deletion, registry/system changes, credential access, or arbitrary code execution.
Compose ordered scale, rotation, and translation operations for layout points.
Validated
PowerShell 7 implementation
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into this concise prompt. That prompt was then used to generate the PowerShell.
Create fully commented PowerShell 7 functions that compose ordered 2D scale, rotate, and translate operations into one affine matrix, then apply it to named points. Return the combined matrix and rounded transformed coordinates. Validate operation names and use only in-memory sample data.
2. The Runner AI Created
AI also created run.ps1. It prepares the sample data, passes the parameters, and invokes the generated PowerShell.
$ErrorActionPreference = 'Stop'
# Load the AI-generated matrix functions.
. "$PSScriptRoot/solution.ps1"
# Describe the four corners of a fictional layout panel.
$points = @(
[pscustomobject]@{ Name = 'TopLeft'; X = 0; Y = 0 }
[pscustomobject]@{ Name = 'TopRight'; X = 4; Y = 0 }
[pscustomobject]@{ Name = 'BottomRight'; X = 4; Y = 2 }
[pscustomobject]@{ Name = 'BottomLeft'; X = 0; Y = 2 }
)
# Scale first, rotate second, and translate the finished shape last.
$operations = @(
[pscustomobject]@{ Type = 'Scale'; X = 1.5; Y = 2 }
[pscustomobject]@{ Type = 'Rotate'; Degrees = 30 }
[pscustomobject]@{ Type = 'Translate'; X = 10; Y = 5 }
)
$result = Invoke-PointTransform -Point $points -Operation $operations
'Combined matrix'
$result.Matrix | Format-List
'Transformed points'
$result.Points | Format-Table -AutoSize
3. The PowerShell AI Generated
solution.ps1 is the runnable PowerShell produced from the AI-created prompt.
function New-AffineMatrix {
# Create a compact matrix object using the common six-value 2D representation.
param(
[double]$A = 1,
[double]$B = 0,
[double]$C = 0,
[double]$D = 1,
[double]$Tx = 0,
[double]$Ty = 0
)
[pscustomobject]@{ A = $A; B = $B; C = $C; D = $D; Tx = $Tx; Ty = $Ty }
}
function Join-AffineMatrix {
# Multiply two matrices so Right is applied first and Left is applied second.
param(
[Parameter(Mandatory)][psobject]$Left,
[Parameter(Mandatory)][psobject]$Right
)
New-AffineMatrix `
-A (($Left.A * $Right.A) + ($Left.C * $Right.B)) `
-B (($Left.B * $Right.A) + ($Left.D * $Right.B)) `
-C (($Left.A * $Right.C) + ($Left.C * $Right.D)) `
-D (($Left.B * $Right.C) + ($Left.D * $Right.D)) `
-Tx (($Left.A * $Right.Tx) + ($Left.C * $Right.Ty) + $Left.Tx) `
-Ty (($Left.B * $Right.Tx) + ($Left.D * $Right.Ty) + $Left.Ty)
}
function Invoke-PointTransform {
[CmdletBinding()]
param(
# Named input points make the output easier to compare with the source shape.
[Parameter(Mandatory)]
[psobject[]]$Point,
# Operations are applied in the exact order supplied by the caller.
[Parameter(Mandatory)]
[psobject[]]$Operation
)
# Start with an identity matrix that leaves every coordinate unchanged.
$combined = New-AffineMatrix
foreach ($item in $Operation) {
# Build the matrix for this operation without changing the input objects.
$operationMatrix = switch ([string]$item.Type) {
'Scale' {
New-AffineMatrix -A ([double]$item.X) -D ([double]$item.Y)
break
}
'Rotate' {
$radians = [double]$item.Degrees * [math]::PI / 180
$cosine = [math]::Cos($radians)
$sine = [math]::Sin($radians)
New-AffineMatrix -A $cosine -B $sine -C (-$sine) -D $cosine
break
}
'Translate' {
New-AffineMatrix -Tx ([double]$item.X) -Ty ([double]$item.Y)
break
}
default {
throw "Unsupported transform type '$($item.Type)'."
}
}
# Pre-multiply so the operations retain the caller's left-to-right order.
$combined = Join-AffineMatrix -Left $operationMatrix -Right $combined
}
# Apply the one combined matrix to every point and round only the public result.
$transformed = foreach ($item in $Point) {
$x = [double]$item.X
$y = [double]$item.Y
[pscustomobject]@{
Name = [string]$item.Name
SourceX = $x
SourceY = $y
ResultX = [math]::Round(($combined.A * $x) + ($combined.C * $y) + $combined.Tx, 3)
ResultY = [math]::Round(($combined.B * $x) + ($combined.D * $y) + $combined.Ty, 3)
}
}
# Return the reusable matrix and transformed points together as one result.
[pscustomobject]@{
Matrix = [pscustomobject]@{
A = [math]::Round($combined.A, 6)
B = [math]::Round($combined.B, 6)
C = [math]::Round($combined.C, 6)
D = [math]::Round($combined.D, 6)
Tx = [math]::Round($combined.Tx, 6)
Ty = [math]::Round($combined.Ty, 6)
}
Points = @($transformed)
}
}
4. What Happened When It Ran
The actual captured output, errors, and exit status.
four corners were transformed by the composed scale, rotation, and translation matrix; a focused assertion verified the transformed top-right point at approximately `(15.196, 8)`.
Safety
fictional in-memory points and operations only; no network, file writes, deletion, registry/system changes, credential access, or arbitrary code execution.
Match fictional automation jobs to the lowest compatible PowerShell runtime.
Validated
PowerShell 7 implementation
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into this concise prompt. That prompt was then used to generate the PowerShell.
Create a fully commented PowerShell 7 function that accepts fictional jobs with minimum PowerShell versions plus an available runtime inventory. Select the lowest compatible runtime for each job, or report Upgrade Required. Return sortable objects and a reason for every decision. Do not inspect or change the host system.
2. The Runner AI Created
AI also created run.ps1. It prepares the sample data, passes the parameters, and invokes the generated PowerShell.
$ErrorActionPreference = 'Stop'
# Load the AI-generated compatibility function.
. "$PSScriptRoot/solution.ps1"
# Define a fictional runtime inventory instead of probing the current machine.
$availableRuntimes = [version[]]@('7.2.24', '7.4.13', '7.6.6')
# Give each sample job a different minimum runtime expectation.
$jobs = @(
[pscustomobject]@{ Name = 'Archive Indexer'; MinimumVersion = '7.2.0' }
[pscustomobject]@{ Name = 'Report Composer'; MinimumVersion = '7.4.2' }
[pscustomobject]@{ Name = 'Parallel Analyzer'; MinimumVersion = '7.6.0' }
[pscustomobject]@{ Name = 'Future Syntax Check'; MinimumVersion = '7.7.0' }
)
# Put unresolved jobs first, then render each decision without clipped columns.
$report = Get-RuntimeCompatibilityReport -Job $jobs -AvailableRuntime $availableRuntimes |
Sort-Object @{ Expression = { $_.Status -eq 'Ready' } }, Job
foreach ($item in $report) {
$item | Format-List Job, MinimumVersion, SelectedRuntime, Status, Reason
}
3. The PowerShell AI Generated
solution.ps1 is the runnable PowerShell produced from the AI-created prompt.
function Get-RuntimeCompatibilityReport {
[CmdletBinding()]
param(
# Each job supplies a name and the minimum PowerShell version it requires.
[Parameter(Mandatory)]
[psobject[]]$Job,
# The inventory is passed in explicitly so the function never inspects the host.
[Parameter(Mandatory)]
[version[]]$AvailableRuntime
)
# Normalize and sort the inventory once so selection is deterministic.
$runtimeInventory = @($AvailableRuntime | Sort-Object -Unique)
if ($runtimeInventory.Count -eq 0) {
throw 'At least one available runtime is required.'
}
foreach ($item in $Job) {
if ([string]::IsNullOrWhiteSpace([string]$item.Name)) {
throw 'Every job must have a name.'
}
# Convert the declared requirement to a real version for safe comparisons.
$minimumVersion = [version]$item.MinimumVersion
# Choose the oldest sufficient runtime to avoid demanding unnecessary upgrades.
$selected = $runtimeInventory |
Where-Object { $_ -ge $minimumVersion } |
Select-Object -First 1
# Explain both successful matches and gaps in plain language.
if ($null -ne $selected) {
$status = 'Ready'
$reason = "PowerShell $selected meets minimum $minimumVersion."
}
else {
$status = 'Upgrade Required'
$reason = "No available runtime meets minimum $minimumVersion."
}
# Emit structured output suitable for sorting, exporting, or CI policy checks.
[pscustomobject]@{
Job = [string]$item.Name
MinimumVersion = $minimumVersion.ToString()
SelectedRuntime = if ($selected) { $selected.ToString() } else { $null }
Status = $status
Reason = $reason
}
}
}
4. What Happened When It Ran
The actual captured output, errors, and exit status.
three jobs selected the lowest sufficient runtime and one job reported Upgrade Required; focused assertions verified both status paths.
Safety
fictional runtime inventory passed as in-memory data; the script did not inspect or change the host and used no network, file writes, deletion, registry/system changes, credentials, or arbitrary code execution.
Estimate how long fictional data transfers take after accounting for usable bandwidth.
Validated
PowerShell 7 implementation
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into this concise prompt. That prompt was then used to generate the PowerShell.
Create a PowerShell 7 function that estimates transfer time for objects with a name and decimal size in GB. Accept bandwidth in Mbps and an efficiency percentage, then return effective speed, seconds, and a readable duration. Validate inputs, use decimal calculations, and perform no network or file operations.
2. The Runner AI Created
AI also created run.ps1. It prepares the sample data, passes the parameters, and invokes the generated PowerShell.
#Requires -Version 7.0
# Load the AI-generated estimator from the neighboring solution file.
. "$PSScriptRoot/solution.ps1"
# Create fictional transfer requests entirely in memory.
$transfers = @(
[pscustomobject]@{ Name = 'Training archive'; SizeGB = 12.5 }
[pscustomobject]@{ Name = 'Photo library'; SizeGB = 48.0 }
[pscustomobject]@{ Name = 'Daily snapshot'; SizeGB = 3.25 }
)
# Estimate durations on a 200 Mbps link operating at 85 percent efficiency.
$transfers |
Get-DataTransferEstimate -BandwidthMbps 200 -EfficiencyPercent 85 |
Format-Table -AutoSize
3. The PowerShell AI Generated
solution.ps1 is the runnable PowerShell produced from the AI-created prompt.
#Requires -Version 7.0
function Get-DataTransferEstimate {
<#
.SYNOPSIS
Estimates transfer durations from data size and usable network throughput.
#>
[CmdletBinding()]
param(
# Objects must expose Name and SizeGB properties.
[Parameter(Mandatory, ValueFromPipeline)]
[object[]] $Transfer,
# Nominal link speed in megabits per second.
[Parameter(Mandatory)]
[ValidateRange(0.01, 1000000)]
[decimal] $BandwidthMbps,
# Percentage of nominal bandwidth expected to carry payload data.
[ValidateRange(1, 100)]
[decimal] $EfficiencyPercent = 85
)
begin {
# Convert the efficiency percentage into a multiplier once.
$efficiency = $EfficiencyPercent / 100
$effectiveMbps = $BandwidthMbps * $efficiency
}
process {
foreach ($item in $Transfer) {
# Validate each transfer independently so invalid sizes are identified clearly.
$sizeGB = [decimal]$item.SizeGB
if ($sizeGB -lt 0) {
throw "Transfer '$($item.Name)' has a negative SizeGB value."
}
# Decimal gigabytes contain eight billion bits; Mbps is one million bits per second.
$totalBits = $sizeGB * 8000000000
$bitsPerSecond = $effectiveMbps * 1000000
$seconds = if ($sizeGB -eq 0) { [decimal]0 } else { $totalBits / $bitsPerSecond }
# Convert the rounded seconds to a TimeSpan for a compact readable duration.
$roundedSeconds = [math]::Round([double]$seconds, 2)
$duration = [timespan]::FromSeconds([math]::Round([double]$seconds))
# Emit structured data so callers can format or export it as needed.
[pscustomobject][ordered]@{
Name = [string]$item.Name
SizeGB = $sizeGB
EffectiveMbps = [math]::Round([double]$effectiveMbps, 2)
EstimatedSeconds = $roundedSeconds
EstimatedDuration = $duration.ToString('hh\:mm\:ss')
}
}
}
}
4. What Happened When It Ran
The actual captured output, errors, and exit status.
Summarize fictional work logs by team and work type with an Excel pivot table and chart.
Validated
PowerShell 7 implementation
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into this concise prompt. That prompt was then used to generate the PowerShell.
Create a PowerShell 7 function using ImportExcel that writes fictional work logs to an Excel table and adds a pivot table plus clustered-column pivot chart. Summarize hours by team and work type, freeze the source header, return workbook metadata, and write only to a caller-supplied `.xlsx` path.
2. The Runner AI Created
AI also created run.ps1. It prepares the sample data, passes the parameters, and invokes the generated PowerShell.
#Requires -Version 7.0
# Load the AI-generated workbook function.
. "$PSScriptRoot/solution.ps1"
# Prepare fictional work logs with several teams and work categories.
$workLogs = @(
[pscustomobject]@{ Date = '2026-09-14'; Team = 'Atlas'; WorkType = 'Build'; Hours = 6.5 }
[pscustomobject]@{ Date = '2026-09-14'; Team = 'Atlas'; WorkType = 'Support'; Hours = 2.0 }
[pscustomobject]@{ Date = '2026-09-15'; Team = 'Beacon'; WorkType = 'Build'; Hours = 5.0 }
[pscustomobject]@{ Date = '2026-09-15'; Team = 'Beacon'; WorkType = 'Research'; Hours = 3.5 }
[pscustomobject]@{ Date = '2026-09-16'; Team = 'Cygnus'; WorkType = 'Support'; Hours = 4.0 }
[pscustomobject]@{ Date = '2026-09-16'; Team = 'Cygnus'; WorkType = 'Research'; Hours = 4.5 }
)
# Use a unique temporary path so the run never overwrites another workbook.
$workbookPath = Join-Path ([System.IO.Path]::GetTempPath()) "team-hours-$([guid]::NewGuid().ToString('N')).xlsx"
# Build the workbook and independently read the source rows back from disk.
$summary = New-TeamHoursPivotWorkbook -WorkLog $workLogs -Path $workbookPath
$readBack = Import-Excel -Path $workbookPath -WorksheetName 'Work Log'
# Display both the workbook metadata and read-back team totals.
$summary | Format-List
$readBack | Group-Object Team | Sort-Object Name | Select-Object Name, Count | Format-Table -AutoSize
3. The PowerShell AI Generated
solution.ps1 is the runnable PowerShell produced from the AI-created prompt.
#Requires -Version 7.0
function New-TeamHoursPivotWorkbook {
<#
.SYNOPSIS
Builds a work-log workbook with a pivot summary and chart.
#>
[CmdletBinding()]
param(
# Work-log rows must expose Date, Team, WorkType, and Hours.
[Parameter(Mandatory)]
[object[]] $WorkLog,
# Destination for the generated workbook.
[Parameter(Mandatory)]
[ValidatePattern('\.xlsx$')]
[string] $Path
)
# Load ImportExcel while suppressing only its platform-specific autosize warning.
$savedWarningPreference = $global:WarningPreference
try {
$global:WarningPreference = 'SilentlyContinue'
Import-Module ImportExcel -ErrorAction Stop
}
finally {
$global:WarningPreference = $savedWarningPreference
}
# Normalize the supplied records into a stable shape for Excel and the pivot cache.
$rows = foreach ($item in $WorkLog) {
$hours = [double]$item.Hours
if ($hours -lt 0) {
throw 'Hours cannot be negative.'
}
[pscustomobject][ordered]@{
Date = [datetime]$item.Date
Team = [string]$item.Team
WorkType = [string]$item.WorkType
Hours = $hours
}
}
# Export the source table and create a pivot table with a clustered-column chart.
$package = $rows | Export-Excel -Path $Path -WorksheetName 'Work Log' `
-TableName 'TeamWorkLog' -TableStyle Medium6 -FreezeTopRow `
-IncludePivotTable -PivotTableName 'TeamHoursPivot' `
-PivotRows 'Team' -PivotColumns 'WorkType' -PivotData @{ Hours = 'Sum' } `
-IncludePivotChart -PivotChartType ColumnClustered -PassThru
# Apply predictable source-column widths without platform drawing dependencies.
$sourceSheet = $package.Workbook.Worksheets['Work Log']
$sourceSheet.Column(1).Width = 14
$sourceSheet.Column(2).Width = 18
$sourceSheet.Column(3).Width = 18
$sourceSheet.Column(4).Width = 12
# Collect metadata before closing and saving the package.
$pivotCount = @($package.Workbook.Worksheets | ForEach-Object { $_.PivotTables.Count } | Measure-Object -Sum).Sum
$chartCount = @($package.Workbook.Worksheets | ForEach-Object { $_.Drawings.Count } | Measure-Object -Sum).Sum
$worksheetCount = $package.Workbook.Worksheets.Count
Close-ExcelPackage -ExcelPackage $package
# Return a concise summary for logging and validation.
[pscustomobject][ordered]@{
Workbook = $Path
Rows = $rows.Count
Teams = @($rows.Team | Sort-Object -Unique).Count
Worksheets = $worksheetCount
PivotTables = $pivotCount
Charts = $chartCount
}
}
4. What Happened When It Ran
The actual captured output, errors, and exit status.
six source rows were read back; the saved workbook contained two worksheets, one pivot table, and one pivot chart; focused assertions independently reopened and inspected another workbook.
Safety
fictional records only; the script writes one uniquely named workbook under the temporary directory and performs no network access, deletion, registry/system changes, credential access, or arbitrary code execution.
Group timestamped events into sessions whenever an idle gap crosses a threshold.
Validated
PowerShell 7 implementation
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into this concise prompt. That prompt was then used to generate the PowerShell.
Create a PowerShell 7 function that sorts timestamped activity records and assigns session numbers. Start a new session when the gap from the previous event exceeds a caller-supplied idle threshold. Return event, timestamp, session, and gap minutes; use in-memory data only.
2. The Runner AI Created
AI also created run.ps1. It prepares the sample data, passes the parameters, and invokes the generated PowerShell.
solution.ps1 is the runnable PowerShell produced from the AI-created prompt.
#Requires -Version 7.0
function Group-ActivitySession {
<#
.SYNOPSIS
Assigns chronological activity records to idle-gap sessions.
#>
[CmdletBinding()]
param(
# Activity objects must expose Event and Timestamp properties.
[Parameter(Mandatory)]
[object[]] $Activity,
# A larger gap starts a new session.
[ValidateRange(1, 1440)]
[int] $IdleMinutes = 30
)
# Normalize and sort the events so out-of-order input is handled consistently.
$ordered = @($Activity | ForEach-Object {
[pscustomobject][ordered]@{
Event = [string]$_.Event
Timestamp = [datetime]$_.Timestamp
}
} | Sort-Object Timestamp)
# Start numbering at one when the first event is encountered.
$session = 0
$previousTimestamp = $null
foreach ($item in $ordered) {
# The first event has no gap; later events measure from the previous timestamp.
$gapMinutes = if ($null -eq $previousTimestamp) {
$null
}
else {
[math]::Round(($item.Timestamp - $previousTimestamp).TotalMinutes, 2)
}
# Begin a session for the first event or after a gap beyond the threshold.
if ($session -eq 0 -or $gapMinutes -gt $IdleMinutes) {
$session++
}
# Emit one structured row for each activity.
[pscustomobject][ordered]@{
Event = $item.Event
Timestamp = $item.Timestamp
Session = $session
MinutesSincePrior = $gapMinutes
}
$previousTimestamp = $item.Timestamp
}
}
4. What Happened When It Ran
The actual captured output, errors, and exit status.
out-of-order input was sorted into three sessions; focused assertions verified that an exact-threshold gap stays in the session while a larger gap starts another.
Safety
fictional in-memory events only; no network, file writes, deletion, registry/system changes, credential access, or arbitrary code execution.
Combine layered settings while showing which source supplied every final value.
Validated
PowerShell 7 implementation
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into this concise prompt. That prompt was then used to generate the PowerShell.
Create a PowerShell 7 function that resolves default, environment, and user configuration dictionaries. User values override environment values, which override defaults. Return each key, final value, and winning source while preserving first-seen key order. Use in-memory data only.
2. The Runner AI Created
AI also created run.ps1. It prepares the sample data, passes the parameters, and invokes the generated PowerShell.
#Requires -Version 7.0
# Load the AI-generated configuration resolver.
. "$PSScriptRoot/solution.ps1"
# Define fictional settings at three precedence levels.
$defaults = [ordered]@{
Theme = 'Light'
PageSize = 25
RetryCount = 2
}
$environment = [ordered]@{
PageSize = 50
Region = 'East'
}
$user = [ordered]@{
Theme = 'Dark'
RetryCount = 4
}
# Resolve the final values and retain their winning source.
Resolve-ConfigurationPrecedence -Defaults $defaults -Environment $environment -User $user |
Format-Table -AutoSize
3. The PowerShell AI Generated
solution.ps1 is the runnable PowerShell produced from the AI-created prompt.
#Requires -Version 7.0
function Resolve-ConfigurationPrecedence {
<#
.SYNOPSIS
Resolves layered configuration and reports the source of each winning value.
#>
[CmdletBinding()]
param(
# Baseline values used when no higher layer supplies the key.
[Parameter(Mandatory)]
[System.Collections.IDictionary] $Defaults,
# Environment-specific overrides.
[Parameter(Mandatory)]
[System.Collections.IDictionary] $Environment,
# Highest-precedence user overrides.
[Parameter(Mandatory)]
[System.Collections.IDictionary] $User
)
# Capture keys in first-seen order while preventing duplicates.
$keys = [System.Collections.Generic.List[string]]::new()
$seen = [System.Collections.Generic.HashSet[string]]::new([System.StringComparer]::OrdinalIgnoreCase)
foreach ($layer in @($Defaults, $Environment, $User)) {
foreach ($key in $layer.Keys) {
if ($seen.Add([string]$key)) {
$keys.Add([string]$key)
}
}
}
foreach ($key in $keys) {
# Check layers from highest to lowest precedence.
if ($User.Contains($key)) {
$value = $User[$key]
$source = 'User'
}
elseif ($Environment.Contains($key)) {
$value = $Environment[$key]
$source = 'Environment'
}
else {
$value = $Defaults[$key]
$source = 'Defaults'
}
# Emit provenance with each resolved setting.
[pscustomobject][ordered]@{
Key = $key
Value = $value
Source = $source
}
}
}
4. What Happened When It Ran
The actual captured output, errors, and exit status.
PowerShell version: 7.6.6
Command: pwsh -NoLogo -NoProfile -NonInteractive -File ./run.ps1
Exit status: 0
STDOUT:
Key Value Source
--- ----- ------
Theme Dark User
PageSize 50 Environment
RetryCount 4 User
Region East Environment
STDERR:
(empty)
5. Validation Performed by the AI Workflow
The runtime, expected results, and safety boundaries were checked and recorded.
Assign work items by repeatedly choosing the worker with the lightest current load.
Validated
PowerShell 7 implementation
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into this concise prompt. That prompt was then used to generate the PowerShell.
Create a PowerShell 7 function that assigns named work items with estimated minutes to a supplied worker list. Process longest items first, always choose the least-loaded worker, break ties by worker order, and return each assignment with the worker's running total. Validate inputs and use in-memory data only.
2. The Runner AI Created
AI also created run.ps1. It prepares the sample data, passes the parameters, and invokes the generated PowerShell.
#Requires -Version 7.0
# Load the AI-generated allocator.
. "$PSScriptRoot/solution.ps1"
# Create fictional work items with varied effort estimates.
$items = @(
[pscustomobject]@{ Name = 'Prepare demo'; EstimatedMinutes = 80 }
[pscustomobject]@{ Name = 'Review notes'; EstimatedMinutes = 25 }
[pscustomobject]@{ Name = 'Build sample'; EstimatedMinutes = 65 }
[pscustomobject]@{ Name = 'Check output'; EstimatedMinutes = 35 }
[pscustomobject]@{ Name = 'Write summary'; EstimatedMinutes = 45 }
[pscustomobject]@{ Name = 'Package files'; EstimatedMinutes = 20 }
)
# Allocate the queue across three fictional workers.
Get-BalancedWorkAllocation -WorkItem $items -Worker @('Avery', 'Blake', 'Casey') |
Format-Table -AutoSize
3. The PowerShell AI Generated
solution.ps1 is the runnable PowerShell produced from the AI-created prompt.
#Requires -Version 7.0
function Get-BalancedWorkAllocation {
<#
.SYNOPSIS
Assigns estimated work to the currently least-loaded worker.
#>
[CmdletBinding()]
param(
# Work items must expose Name and EstimatedMinutes properties.
[Parameter(Mandatory)]
[object[]] $WorkItem,
# Worker names are used in the supplied order to resolve load ties.
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[string[]] $Worker
)
# Worker names must be unique so assignments remain unambiguous.
if (($Worker | Sort-Object -Unique).Count -ne $Worker.Count) {
throw 'Worker names must be unique.'
}
# Track each worker's running load and original tie-break position.
$loads = for ($index = 0; $index -lt $Worker.Count; $index++) {
[pscustomobject]@{
Worker = $Worker[$index]
TotalMinutes = 0
Order = $index
}
}
# Normalize estimates and process the longest items first for better balance.
$orderedItems = @($WorkItem | ForEach-Object {
$minutes = [int]$_.EstimatedMinutes
if ($minutes -lt 0) {
throw "Work item '$($_.Name)' has a negative estimate."
}
[pscustomobject]@{
Name = [string]$_.Name
EstimatedMinutes = $minutes
}
} | Sort-Object @{ Expression = 'EstimatedMinutes'; Descending = $true }, Name)
foreach ($item in $orderedItems) {
# Choose the lightest worker, using original worker order for ties.
$target = $loads | Sort-Object TotalMinutes, Order | Select-Object -First 1
$target.TotalMinutes += $item.EstimatedMinutes
# Emit the decision and the worker's new running total.
[pscustomobject][ordered]@{
WorkItem = $item.Name
EstimatedMinutes = $item.EstimatedMinutes
Worker = $target.Worker
WorkerTotalMinutes = $target.TotalMinutes
}
}
}
4. What Happened When It Ran
The actual captured output, errors, and exit status.
six items were assigned once with final loads of 100, 90, and 80 minutes; focused assertions verified stable tie-breaking and duplicate-worker rejection.
Safety
fictional in-memory work items only; no network, file writes, deletion, registry/system changes, credential access, or arbitrary code execution.
Turn a nested object into a readable path-and-value inventory.
Validated
PowerShell 7 implementation
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into this concise prompt. That prompt was then used to generate the PowerShell.
Create a PowerShell 7 function that flattens a nested object into `Path`, `Type`, and `Value` rows. Accept an object and maximum depth, preserve property order, handle arrays, and report deeper values as truncated. Use in-memory data only and do not modify the input.
2. The Runner AI Created
AI also created run.ps1. It prepares the sample data, passes the parameters, and invokes the generated PowerShell.
#Requires -Version 7.0
# Load the AI-generated function from the neighboring solution file.
. "$PSScriptRoot/solution.ps1"
# Create a fictional nested service profile entirely in memory.
$serviceProfile = [pscustomobject][ordered]@{
Name = 'Northwind Alerts'
Enabled = $true
Owners = @('Mina', 'Luis')
Routing = [pscustomobject][ordered]@{
Region = 'East'
Channels = @(
[pscustomobject]@{ Name = 'Email'; Priority = 1 }
[pscustomobject]@{ Name = 'Chat'; Priority = 2 }
)
}
}
# Pass the object and depth boundary into the generated solution.
Get-ObjectPropertyMap -InputObject $serviceProfile -MaxDepth 5 |
Format-Table -AutoSize
3. The PowerShell AI Generated
solution.ps1 is the runnable PowerShell produced from the AI-created prompt.
#Requires -Version 7.0
function Get-ObjectPropertyMap {
<#
.SYNOPSIS
Flattens a nested object into inspectable path, type, and value rows.
#>
[CmdletBinding()]
param(
# The object whose properties will be inspected.
[Parameter(Mandatory, ValueFromPipeline)]
[AllowNull()]
[object] $InputObject,
# The deepest level that will be expanded.
[ValidateRange(0, 20)]
[int] $MaxDepth = 4
)
begin {
# Keep a reference-based set so a circular object graph cannot recurse forever.
$visited = [System.Collections.Generic.HashSet[int]]::new()
# Recursively inspect a value and emit one row for each leaf or boundary.
function Expand-Value {
param(
[AllowNull()][object] $Value,
[string] $Path,
[int] $Depth
)
# Represent null explicitly because it has no runtime type.
if ($null -eq $Value) {
[pscustomobject]@{ Path = $Path; Type = 'null'; Value = '<null>' }
return
}
# Treat common scalar types as leaves rather than expanding their properties.
$isScalar = $Value -is [string] -or
$Value -is [ValueType] -or
$Value -is [datetime]
if ($isScalar) {
[pscustomobject]@{ Path = $Path; Type = $Value.GetType().Name; Value = [string]$Value }
return
}
# Stop expansion at the requested boundary and clearly label the row.
if ($Depth -ge $MaxDepth) {
[pscustomobject]@{ Path = $Path; Type = $Value.GetType().Name; Value = '<max depth>' }
return
}
# Use the runtime identity hash to detect repeated reference objects.
$identity = [System.Runtime.CompilerServices.RuntimeHelpers]::GetHashCode($Value)
if (-not $visited.Add($identity)) {
[pscustomobject]@{ Path = $Path; Type = $Value.GetType().Name; Value = '<already visited>' }
return
}
# Expand enumerable values by their zero-based positions.
if ($Value -is [System.Collections.IEnumerable] -and $Value -isnot [System.Collections.IDictionary]) {
$index = 0
foreach ($item in $Value) {
Expand-Value -Value $item -Path "$Path[$index]" -Depth ($Depth + 1)
$index++
}
return
}
# Expand dictionary keys in their enumeration order.
if ($Value -is [System.Collections.IDictionary]) {
foreach ($key in $Value.Keys) {
Expand-Value -Value $Value[$key] -Path "$Path.$key" -Depth ($Depth + 1)
}
return
}
# Expand PowerShell object properties in the order exposed by PSObject.
foreach ($property in $Value.PSObject.Properties) {
Expand-Value -Value $property.Value -Path "$Path.$($property.Name)" -Depth ($Depth + 1)
}
}
}
process {
# Begin every input object at a stable root path.
Expand-Value -Value $InputObject -Path '$' -Depth 0
}
}
4. What Happened When It Ran
The actual captured output, errors, and exit status.
PowerShell version: 7.6.6
Command: pwsh -NoLogo -NoProfile -NonInteractive -File ./run.ps1
Exit status: 0
STDOUT:
Path Type Value
---- ---- -----
$.Name String Northwind Alerts
$.Enabled Boolean True
$.Owners[0] String Mina
$.Owners[1] String Luis
$.Routing.Region String East
$.Routing.Channels[0].Name String Email
$.Routing.Channels[0].Priority Int32 1
$.Routing.Channels[1].Name String Chat
$.Routing.Channels[1].Priority Int32 2
STDERR:
(empty)
5. Validation Performed by the AI Workflow
The runtime, expected results, and safety boundaries were checked and recorded.
Create a formatted Excel review that makes breached service targets stand out.
Validated
PowerShell 7 implementation
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into this concise prompt. That prompt was then used to generate the PowerShell.
Create a PowerShell 7 script using ImportExcel that exports fictional support tickets to a formatted workbook. Calculate remaining SLA hours and breach status, freeze the header, add a table, and highlight breached rows. Return a summary object and write only to a caller-supplied path.
2. The Runner AI Created
AI also created run.ps1. It prepares the sample data, passes the parameters, and invokes the generated PowerShell.
#Requires -Version 7.0
# Load the AI-generated workbook function.
. "$PSScriptRoot/solution.ps1"
# Prepare fictional ticket data with both healthy and breached examples.
$tickets = @(
[pscustomobject]@{ Ticket = 'SR-1042'; Team = 'Identity'; Priority = 'High'; AgeHours = 5; SlaHours = 8 }
[pscustomobject]@{ Ticket = 'SR-1043'; Team = 'Network'; Priority = 'Medium'; AgeHours = 29; SlaHours = 24 }
[pscustomobject]@{ Ticket = 'SR-1044'; Team = 'Apps'; Priority = 'Low'; AgeHours = 16; SlaHours = 48 }
[pscustomobject]@{ Ticket = 'SR-1045'; Team = 'Identity'; Priority = 'High'; AgeHours = 11; SlaHours = 8 }
)
# Use a unique temporary path so the run never overwrites another workbook.
$workbookPath = Join-Path ([System.IO.Path]::GetTempPath()) "sla-review-$([guid]::NewGuid().ToString('N')).xlsx"
# Create the workbook, then independently read it back to verify the contents.
$summary = New-SlaBreachWorkbook -Ticket $tickets -Path $workbookPath
$importedRows = Import-Excel -Path $workbookPath -WorksheetName 'SLA Review'
# Show the generated summary and a read-back status count.
$summary | Format-List
$importedRows | Group-Object Status | Sort-Object Name | Select-Object Name, Count | Format-Table -AutoSize
3. The PowerShell AI Generated
solution.ps1 is the runnable PowerShell produced from the AI-created prompt.
#Requires -Version 7.0
function New-SlaBreachWorkbook {
<#
.SYNOPSIS
Creates a formatted SLA review workbook from supplied ticket records.
#>
[CmdletBinding()]
param(
# Fictional ticket records containing Ticket, Team, Priority, AgeHours, and SlaHours.
[Parameter(Mandatory)]
[object[]] $Ticket,
# Destination for the generated .xlsx workbook.
[Parameter(Mandatory)]
[ValidatePattern('\.xlsx$')]
[string] $Path
)
# Stop immediately if the required module cannot be loaded.
$savedWarningPreference = $global:WarningPreference
try {
$global:WarningPreference = 'SilentlyContinue'
Import-Module ImportExcel -ErrorAction Stop -WarningAction SilentlyContinue
}
finally {
$global:WarningPreference = $savedWarningPreference
}
# Transform the source records into a stable, workbook-friendly shape.
$rows = foreach ($item in $Ticket) {
$remaining = [double]$item.SlaHours - [double]$item.AgeHours
[pscustomobject][ordered]@{
Ticket = [string]$item.Ticket
Team = [string]$item.Team
Priority = [string]$item.Priority
AgeHours = [double]$item.AgeHours
SlaHours = [double]$item.SlaHours
RemainingHours = $remaining
Status = if ($remaining -lt 0) { 'Breached' } else { 'Within SLA' }
}
}
# Export the rows and retain the package so worksheet styling can be applied.
$package = $rows | Export-Excel -Path $Path -WorksheetName 'SLA Review' `
-TableName 'SlaReview' -TableStyle Medium2 -FreezeTopRow -PassThru
# Retrieve the newly created worksheet from the in-memory package.
$worksheet = $package.Workbook.Worksheets['SLA Review']
# Apply predictable column widths without relying on platform drawing libraries.
foreach ($columnNumber in 1..7) {
$worksheet.Column($columnNumber).Width = if ($columnNumber -eq 2) { 18 } else { 14 }
}
# Highlight breached status cells so urgent rows are easy to spot.
if ($rows.Count -gt 0) {
Add-ConditionalFormatting -Worksheet $worksheet -Address "G2:G$($rows.Count + 1)" `
-RuleType Equal -ConditionValue '"Breached"' -BackgroundColor LightPink -ForegroundColor DarkRed
}
# Save and close the workbook package cleanly.
Close-ExcelPackage -ExcelPackage $package
# Return a concise object that is convenient for logging and validation.
[pscustomobject][ordered]@{
Workbook = $Path
Tickets = $rows.Count
Breached = @($rows | Where-Object Status -eq 'Breached').Count
WithinSla = @($rows | Where-Object Status -eq 'Within SLA').Count
}
}
4. What Happened When It Ran
The actual captured output, errors, and exit status.
four rows were read back from the workbook, the two status counts matched, and focused assertions verified the table, conditional-format rule, and worksheet dimensions.
Safety
fictional records only; the script writes one uniquely named workbook under the temporary directory and performs no network access, deletion, registry/system changes, credential access, or arbitrary code execution.
Preview a capped exponential retry plan without waiting or calling a service.
Validated
PowerShell 7 implementation
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into this concise prompt. That prompt was then used to generate the PowerShell.
Create a PowerShell 7 function that previews a deterministic exponential retry schedule. Accept attempt count, initial delay, multiplier, and maximum delay; return attempt, delay, and cumulative elapsed seconds. Validate inputs and do not sleep or perform network activity.
2. The Runner AI Created
AI also created run.ps1. It prepares the sample data, passes the parameters, and invokes the generated PowerShell.
#Requires -Version 7.0
# Load the AI-generated schedule function.
. "$PSScriptRoot/solution.ps1"
# Preview six retries with a short initial delay and a five-second cap.
Get-RetryBackoffSchedule -Attempts 6 -InitialDelaySeconds 0.5 -Multiplier 2 -MaximumDelaySeconds 5 |
Format-Table -AutoSize
3. The PowerShell AI Generated
solution.ps1 is the runnable PowerShell produced from the AI-created prompt.
#Requires -Version 7.0
function Get-RetryBackoffSchedule {
<#
.SYNOPSIS
Calculates a capped exponential retry schedule without waiting.
#>
[CmdletBinding()]
param(
# Number of retry attempts to include.
[Parameter(Mandatory)]
[ValidateRange(1, 100)]
[int] $Attempts,
# Delay before the first retry, in seconds.
[ValidateRange(0.001, 86400)]
[double] $InitialDelaySeconds = 1,
# Factor applied to the delay after each attempt.
[ValidateRange(1, 10)]
[double] $Multiplier = 2,
# Upper boundary for any single delay.
[ValidateRange(0.001, 86400)]
[double] $MaximumDelaySeconds = 30
)
# The cap must not be smaller than the first requested delay.
if ($MaximumDelaySeconds -lt $InitialDelaySeconds) {
throw 'MaximumDelaySeconds must be greater than or equal to InitialDelaySeconds.'
}
# Track cumulative time so callers can assess the complete retry budget.
$elapsed = 0.0
foreach ($attempt in 1..$Attempts) {
# Grow exponentially, then enforce the configured maximum.
$uncapped = $InitialDelaySeconds * [math]::Pow($Multiplier, $attempt - 1)
$delay = [math]::Min($uncapped, $MaximumDelaySeconds)
$elapsed += $delay
# Emit numeric values rounded for stable display and downstream use.
[pscustomobject][ordered]@{
Attempt = $attempt
DelaySeconds = [math]::Round($delay, 3)
TotalElapsedSeconds = [math]::Round($elapsed, 3)
Capped = $uncapped -gt $MaximumDelaySeconds
}
}
}
4. What Happened When It Ran
The actual captured output, errors, and exit status.
six attempts were produced, the five-second cap was enforced, and focused assertions verified delay and cumulative totals.
Safety
deterministic calculations only; the script does not sleep, use the network, write files, modify the system, access credentials, or execute arbitrary code.
Arrange dependent work into safe waves that expose parallel opportunities.
Validated
PowerShell 7 implementation
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into this concise prompt. That prompt was then used to generate the PowerShell.
Create a PowerShell 7 function that groups tasks into execution waves from their names and dependencies. Tasks in the same wave may run in parallel. Reject duplicate names, missing dependencies, and cycles; preserve input order within each wave. Use in-memory objects only.
2. The Runner AI Created
AI also created run.ps1. It prepares the sample data, passes the parameters, and invokes the generated PowerShell.
#Requires -Version 7.0
# Load the AI-generated dependency planner.
. "$PSScriptRoot/solution.ps1"
# Describe a fictional release process with parallel-friendly dependencies.
$tasks = @(
[pscustomobject]@{ Name = 'Package'; DependsOn = @('Test') }
[pscustomobject]@{ Name = 'Lint'; DependsOn = @() }
[pscustomobject]@{ Name = 'Publish docs'; DependsOn = @('Test') }
[pscustomobject]@{ Name = 'Test'; DependsOn = @('Lint', 'Compile') }
[pscustomobject]@{ Name = 'Compile'; DependsOn = @() }
[pscustomobject]@{ Name = 'Release'; DependsOn = @('Package', 'Publish docs') }
)
# Plan the waves and display the parameters represented by the sample tasks.
Get-DependencyWave -Task $tasks | Format-Table -AutoSize
3. The PowerShell AI Generated
solution.ps1 is the runnable PowerShell produced from the AI-created prompt.
#Requires -Version 7.0
function Get-DependencyWave {
<#
.SYNOPSIS
Groups dependency-linked tasks into safe execution waves.
#>
[CmdletBinding()]
param(
# Task objects must expose Name and DependsOn properties.
[Parameter(Mandatory)]
[object[]] $Task
)
# Build an ordered lookup while detecting duplicate task names.
$byName = [ordered]@{}
foreach ($item in $Task) {
$name = [string]$item.Name
if ([string]::IsNullOrWhiteSpace($name)) {
throw 'Every task must have a non-empty Name.'
}
if ($byName.Contains($name)) {
throw "Duplicate task name: $name"
}
$byName[$name] = $item
}
# Validate every dependency before planning any waves.
foreach ($item in $Task) {
foreach ($dependency in @($item.DependsOn)) {
if (-not $byName.Contains([string]$dependency)) {
throw "Task '$($item.Name)' references missing dependency '$dependency'."
}
}
}
# Track completed names and unresolved tasks separately.
$completed = [System.Collections.Generic.HashSet[string]]::new([System.StringComparer]::OrdinalIgnoreCase)
$remaining = [System.Collections.Generic.List[object]]::new()
foreach ($item in $Task) { $remaining.Add($item) }
$waveNumber = 1
while ($remaining.Count -gt 0) {
# A task is ready only when all of its dependencies are complete.
$ready = @($remaining | Where-Object {
$dependencies = @($_.DependsOn)
@($dependencies | Where-Object { -not $completed.Contains([string]$_) }).Count -eq 0
})
# No ready tasks means the unresolved portion contains a cycle.
if ($ready.Count -eq 0) {
$blocked = ($remaining.Name -join ', ')
throw "Dependency cycle detected among: $blocked"
}
# Emit tasks in their original order with useful planning metadata.
foreach ($item in $ready) {
[pscustomobject][ordered]@{
Wave = $waveNumber
Task = [string]$item.Name
DependsOn = (@($item.DependsOn) -join ', ')
}
[void]$completed.Add([string]$item.Name)
[void]$remaining.Remove($item)
}
$waveNumber++
}
}
4. What Happened When It Ran
The actual captured output, errors, and exit status.
Find every conflict among fictional maintenance windows.
Validated
PowerShell 7 implementation
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into this concise prompt. That prompt was then used to generate the PowerShell.
Create a PowerShell 7 function that finds overlaps among named maintenance windows with start and end times. Validate each range, compare every pair, and return both names plus overlap start, end, and minutes. Treat touching boundaries as non-overlapping and use in-memory data only.
2. The Runner AI Created
AI also created run.ps1. It prepares the sample data, passes the parameters, and invokes the generated PowerShell.
#Requires -Version 7.0
# Load the AI-generated overlap finder.
. "$PSScriptRoot/solution.ps1"
# Create deterministic fictional windows in one local time zone.
$windows = @(
[pscustomobject]@{ Name = 'Database patch'; Start = [datetime]'2026-10-03T22:00:00'; End = [datetime]'2026-10-03T23:30:00' }
[pscustomobject]@{ Name = 'Network upgrade'; Start = [datetime]'2026-10-03T23:00:00'; End = [datetime]'2026-10-04T00:00:00' }
[pscustomobject]@{ Name = 'Cache refresh'; Start = [datetime]'2026-10-03T22:45:00'; End = [datetime]'2026-10-03T23:10:00' }
[pscustomobject]@{ Name = 'Search reindex'; Start = [datetime]'2026-10-04T00:00:00'; End = [datetime]'2026-10-04T01:00:00' }
)
# Find and display every conflicting pair.
Find-MaintenanceWindowOverlap -Window $windows |
Format-Table First, Second, OverlapStart, OverlapEnd, OverlapMinutes -AutoSize |
Out-String -Width 180
3. The PowerShell AI Generated
solution.ps1 is the runnable PowerShell produced from the AI-created prompt.
#Requires -Version 7.0
function Find-MaintenanceWindowOverlap {
<#
.SYNOPSIS
Reports every overlapping pair of supplied maintenance windows.
#>
[CmdletBinding()]
param(
# Window objects must expose Name, Start, and End properties.
[Parameter(Mandatory)]
[object[]] $Window
)
# Normalize and validate every supplied range before comparison.
$normalized = foreach ($item in $Window) {
$start = [datetime]$item.Start
$end = [datetime]$item.End
if ($end -le $start) {
throw "Window '$($item.Name)' must end after it starts."
}
[pscustomobject][ordered]@{
Name = [string]$item.Name
Start = $start
End = $end
}
}
# Compare each unique pair exactly once.
for ($leftIndex = 0; $leftIndex -lt $normalized.Count; $leftIndex++) {
for ($rightIndex = $leftIndex + 1; $rightIndex -lt $normalized.Count; $rightIndex++) {
$left = $normalized[$leftIndex]
$right = $normalized[$rightIndex]
# The intersection starts later and ends earlier than its inputs.
$overlapStart = if ($left.Start -gt $right.Start) { $left.Start } else { $right.Start }
$overlapEnd = if ($left.End -lt $right.End) { $left.End } else { $right.End }
# Strict comparison makes touching boundaries non-overlapping.
if ($overlapStart -lt $overlapEnd) {
[pscustomobject][ordered]@{
First = $left.Name
Second = $right.Name
OverlapStart = $overlapStart
OverlapEnd = $overlapEnd
OverlapMinutes = [math]::Round(($overlapEnd - $overlapStart).TotalMinutes, 1)
}
}
}
}
}
4. What Happened When It Ran
The actual captured output, errors, and exit status.
Compare fictional plan and actual amounts, then make the variance easy to scan.
Validated
PowerShell 7 implementation
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into this concise prompt. That prompt was then used to generate the PowerShell.
Create a fully commented PowerShell 7 script that accepts fictional budget records, calculates actual-versus-plan variance and percentage, and returns a structured report plus totals. Use decimal arithmetic, in-memory data, and read-only processing; no files, network, credentials, registry, system changes, or arbitrary code.
2. The Runner AI Created
AI also created run.ps1. It prepares the sample data, passes the parameters, and invokes the generated PowerShell.
# Build fictional monthly budget records for a repeatable demonstration.
$sample = @(
[pscustomobject]@{ Category = 'Cloud'; Plan = 1200; Actual = 1345.50 }
[pscustomobject]@{ Category = 'Training'; Plan = 800; Actual = 640 }
[pscustomobject]@{ Category = 'Travel'; Plan = 500; Actual = 500 }
)
# Invoke the generated solution with the sample records.
& "$PSScriptRoot/solution.ps1" -Category $sample |
Format-Table Category, Plan, Actual, Variance, VariancePct, Direction -AutoSize
3. The PowerShell AI Generated
solution.ps1 is the runnable PowerShell produced from the AI-created prompt.
[CmdletBinding()]
param(
# Accept budget records from the pipeline or as an array.
[Parameter(Mandatory, ValueFromPipeline)]
[psobject[]]$Category
)
begin {
# Collect records so the report and totals can be emitted together.
$records = [System.Collections.Generic.List[psobject]]::new()
}
process {
# Add each incoming record to the in-memory collection.
foreach ($item in $Category) {
$records.Add($item)
}
}
end {
# Calculate one variance row for every category.
$rows = foreach ($item in $records) {
# Convert numeric values to decimal for predictable currency arithmetic.
$plan = [decimal]$item.Plan
$actual = [decimal]$item.Actual
$variance = $actual - $plan
# Avoid division by zero when a category has no planned amount.
$percent = if ($plan -eq 0) { $null } else { [math]::Round(($variance / $plan) * 100, 2) }
# Label the direction so the report is easy to scan.
$direction = if ($variance -gt 0) { 'Over plan' } elseif ($variance -lt 0) { 'Under plan' } else { 'On plan' }
# Return a structured object rather than a formatted string.
[pscustomobject]@{
Category = [string]$item.Category
Plan = $plan
Actual = $actual
Variance = $variance
VariancePct = $percent
Direction = $direction
}
}
# Emit detail rows in a stable category order.
$rows | Sort-Object Category
# Emit a separate total row for the complete sample.
$totalPlan = ($rows | Measure-Object -Property Plan -Sum).Sum
$totalActual = ($rows | Measure-Object -Property Actual -Sum).Sum
[pscustomobject]@{
Category = 'TOTAL'
Plan = [decimal]$totalPlan
Actual = [decimal]$totalActual
Variance = [decimal]($totalActual - $totalPlan)
VariancePct = if ($totalPlan -eq 0) { $null } else { [math]::Round((($totalActual - $totalPlan) / $totalPlan) * 100, 2) }
Direction = if ($totalActual -gt $totalPlan) { 'Over plan' } elseif ($totalActual -lt $totalPlan) { 'Under plan' } else { 'On plan' }
}
}
4. What Happened When It Ran
The actual captured output, errors, and exit status.
PowerShell version: 7.6.6
Command: pwsh -NoLogo -NoProfile -NonInteractive -File ./run.ps1
Exit status: 0
STDOUT:
Category Plan Actual Variance VariancePct Direction
-------- ---- ------ -------- ----------- ---------
Cloud 1200.00 1345.50 145.50 12.12 Over plan
Training 800.00 640.00 -160.00 -20.00 Under plan
Travel 500.00 500.00 0.00 0.00 On plan
TOTAL 2500.00 2485.50 -14.50 -0.58 Under plan
STDERR:
(empty)
5. Validation Performed by the AI Workflow
The runtime, expected results, and safety boundaries were checked and recorded.
Classify fictional support items by age and priority as of a fixed reporting date.
Validated
PowerShell 7 implementation
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into this concise prompt. That prompt was then used to generate the PowerShell.
Create a fully commented PowerShell 7 script that accepts fictional support items with an opened date and priority, calculates age as of a supplied date, and assigns an age bucket. Return structured rows and bucket counts using in-memory data only; no network, files, credentials, registry, system changes, or arbitrary code.
2. The Runner AI Created
AI also created run.ps1. It prepares the sample data, passes the parameters, and invokes the generated PowerShell.
# Supply fictional tickets and a fixed reporting date.
$sample = @(
[pscustomobject]@{ Id = 'SUP-104'; Priority = 'High'; Opened = '2026-09-16' }
[pscustomobject]@{ Id = 'SUP-105'; Priority = 'Low'; Opened = '2026-09-12' }
[pscustomobject]@{ Id = 'SUP-106'; Priority = 'Medium'; Opened = '2026-09-01' }
[pscustomobject]@{ Id = 'SUP-107'; Priority = 'High'; Opened = '2026-09-15' }
)
# Run the aging report without touching a real ticketing system.
$result = @(& "$PSScriptRoot/solution.ps1" -Ticket $sample -AsOfDate ([datetime]'2026-09-17'))
# Display ticket details and bucket counts as two readable tables.
$result | Where-Object Kind -eq 'Detail' |
Format-Table Id, Priority, Opened, DaysOpen, Bucket -AutoSize
$result | Where-Object Kind -eq 'BucketSummary' |
Format-Table Bucket, Count -AutoSize
3. The PowerShell AI Generated
solution.ps1 is the runnable PowerShell produced from the AI-created prompt.
[CmdletBinding()]
param(
# Accept support records from the pipeline or as an array.
[Parameter(Mandatory, ValueFromPipeline)]
[psobject[]]$Ticket,
# Use an explicit date so the report is deterministic.
[Parameter(Mandatory)]
[datetime]$AsOfDate
)
begin {
# Buffer records before calculating detail and summary output.
$tickets = [System.Collections.Generic.List[psobject]]::new()
}
process {
# Store each incoming ticket in memory.
foreach ($item in $Ticket) {
$tickets.Add($item)
}
}
end {
# Calculate age and a readable bucket for every ticket.
$rows = foreach ($item in $tickets) {
# Parse the supplied ISO date without contacting any external system.
$opened = [datetime]::ParseExact([string]$item.Opened, 'yyyy-MM-dd', $null)
$daysOpen = [math]::Max(0, ($AsOfDate.Date - $opened.Date).Days)
# Use short, mutually exclusive age ranges.
$bucket = if ($daysOpen -le 2) { '0-2 days' } elseif ($daysOpen -le 7) { '3-7 days' } else { '8+ days' }
# Return a structured row for downstream formatting or export.
[pscustomobject]@{
Kind = 'Detail'
Id = [string]$item.Id
Priority = [string]$item.Priority
Opened = $opened.ToString('yyyy-MM-dd')
DaysOpen = $daysOpen
Bucket = $bucket
}
}
# Emit details in oldest-first order, then a compact bucket summary.
$rows | Sort-Object -Property DaysOpen, Priority, Id -Descending
$rows | Group-Object Bucket | Sort-Object Name | ForEach-Object {
[pscustomobject]@{
Kind = 'BucketSummary'
Bucket = $_.Name
Count = $_.Count
}
}
}
4. What Happened When It Ran
The actual captured output, errors, and exit status.
PowerShell version: 7.6.6
Command: pwsh -NoLogo -NoProfile -NonInteractive -File ./run.ps1
Exit status: 0
STDOUT:
Id Priority Opened DaysOpen Bucket
-- -------- ------ -------- ------
SUP-106 Medium 2026-09-01 16 8+ days
SUP-105 Low 2026-09-12 5 3-7 days
SUP-107 High 2026-09-15 2 0-2 days
SUP-104 High 2026-09-16 1 0-2 days
Bucket Count
------ -----
0-2 days 2
3-7 days 1
8+ days 1
STDERR:
(empty)
5. Validation Performed by the AI Workflow
The runtime, expected results, and safety boundaries were checked and recorded.
Round-trip fictional expenses through Excel and summarize totals by category.
Validated
PowerShell 7 implementation
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into this concise prompt. That prompt was then used to generate the PowerShell.
Create a fully commented PowerShell 7 script that exports fictional expense rows to a formatted Excel table, imports the workbook, and returns category totals and a grand total. Use ImportExcel and a caller-supplied temporary path; use deterministic sample data and no network, credentials, registry/system changes, deletion, or arbitrary code.
2. The Runner AI Created
AI also created run.ps1. It prepares the sample data, passes the parameters, and invokes the generated PowerShell.
# Use a temporary workbook path so the example does not touch a project file.
$workbook = Join-Path ([System.IO.Path]::GetTempPath()) 'idea-lab-expense-summary.xlsx'
# Provide fictional expenses across a few categories.
$sample = @(
[pscustomobject]@{ Date = '2026-09-01'; Category = 'Travel'; Amount = 425.00; Note = 'Rail' }
[pscustomobject]@{ Date = '2026-09-03'; Category = 'Training'; Amount = 180.00; Note = 'Workshop' }
[pscustomobject]@{ Date = '2026-09-08'; Category = 'Travel'; Amount = 95.50; Note = 'Taxi' }
[pscustomobject]@{ Date = '2026-09-10'; Category = 'Supplies'; Amount = 72.25; Note = 'Adapters' }
)
# Run the workbook round trip and display the returned summaries.
& "$PSScriptRoot/solution.ps1" -Expense $sample -OutputPath $workbook |
Format-Table Category, Rows, Total, WorkbookPath, Verified -AutoSize
3. The PowerShell AI Generated
solution.ps1 is the runnable PowerShell produced from the AI-created prompt.
[CmdletBinding()]
param(
# Accept expense rows from the pipeline or as an array.
[Parameter(Mandatory, ValueFromPipeline)]
[psobject[]]$Expense,
# Write only to the path supplied by the caller.
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[string]$OutputPath
)
begin {
# Buffer the input so one workbook and one summary are produced.
$expenses = [System.Collections.Generic.List[psobject]]::new()
}
process {
# Add each fictional row to the in-memory collection.
foreach ($item in $Expense) {
$expenses.Add($item)
}
}
end {
# Load the cross-platform workbook cmdlets supplied by ImportExcel.
Import-Module ImportExcel -ErrorAction Stop -WarningAction SilentlyContinue
# Suppress the optional graphics dependency warning in a headless runtime.
$WarningPreference = 'SilentlyContinue'
# Export a simple, filterable table with readable headers.
$expenses | Export-Excel -Path $OutputPath -WorksheetName 'Expenses' -TableName 'ExpenseTable' -AutoFilter -FreezeTopRow -BoldTopRow -WarningAction SilentlyContinue 3>$null
# Read the workbook back to prove that the round trip preserved the rows.
$roundTrip = @(Import-Excel -Path $OutputPath -WorksheetName 'Expenses')
# Group the imported rows and calculate deterministic totals.
$byCategory = $roundTrip | Group-Object Category | Sort-Object Name | ForEach-Object {
[pscustomobject]@{
Category = $_.Name
Rows = $_.Count
Total = [decimal](($_.Group | Measure-Object Amount -Sum).Sum)
}
}
# Emit category summaries followed by a verification row.
$byCategory
[pscustomobject]@{
Category = 'TOTAL'
Rows = $roundTrip.Count
Total = [decimal](($roundTrip | Measure-Object Amount -Sum).Sum)
WorkbookPath = $OutputPath
Verified = $roundTrip.Count -eq $expenses.Count
}
}
4. What Happened When It Ran
The actual captured output, errors, and exit status.
PowerShell version: 7.6.6
Command: pwsh -NoLogo -NoProfile -NonInteractive -File ./run.ps1
Exit status: 0
STDOUT:
WARNING: ImportExcel Module Cannot Autosize. Please run the following command to install dependencies:
apt-get -y update && apt-get install -y --no-install-recommends libgdiplus libc6-dev
Category Rows Total WorkbookPath Verified
-------- ---- ----- ------------- --------
Supplies 1 72.25
Training 1 180.00
Travel 2 520.50
TOTAL 4 772.75 <temporary-workbook> True
STDERR:
(empty)
5. Validation Performed by the AI Workflow
The runtime, expected results, and safety boundaries were checked and recorded.
empty. The headless runtime also printed ImportExcel's optional graphics dependency warning on standard output.
Checks
four rows round-tripped through a formatted workbook; category totals and grand total matched.
Safety
fictional records and a caller-supplied temporary workbook path; no network, deletion, registry/system changes, credential access, or arbitrary code execution.
Turn fictional duration samples into stable median and 95th-percentile reports.
Validated
PowerShell 7 implementation
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into this concise prompt. That prompt was then used to generate the PowerShell.
Create a fully commented PowerShell 7 script that accepts fictional command-duration records, calculates count, minimum, average, median, and 95th percentile per command, and returns stable structured output. Use only in-memory numbers; no files, network, credentials, registry/system changes, or arbitrary code.
2. The Runner AI Created
AI also created run.ps1. It prepares the sample data, passes the parameters, and invokes the generated PowerShell.
Estimate fictional model usage and compare the total with a token budget.
Validated
PowerShell 7 implementation
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into this concise prompt. That prompt was then used to generate the PowerShell.
Create a fully commented PowerShell 7 script that accepts fictional model usage records, estimates total tokens from request counts and average tokens, and marks the total within or over a supplied budget. Return structured rows and totals using in-memory data only; no network, files, credentials, registry, system changes, or arbitrary code.
2. The Runner AI Created
AI also created run.ps1. It prepares the sample data, passes the parameters, and invokes the generated PowerShell.
# Use fictional model usage records for a deterministic planning example.
$sample = @(
[pscustomobject]@{ Model = 'Model-A'; Requests = 120; AverageTokens = 320 }
[pscustomobject]@{ Model = 'Model-B'; Requests = 80; AverageTokens = 540 }
[pscustomobject]@{ Model = 'Model-C'; Requests = 40; AverageTokens = 250 }
)
# Estimate usage against a 100,000-token sample budget.
& "$PSScriptRoot/solution.ps1" -Model $sample -BudgetTokens 100000 |
Format-Table Model, Requests, EstimatedTokens, SharePct, BudgetStatus -AutoSize
3. The PowerShell AI Generated
solution.ps1 is the runnable PowerShell produced from the AI-created prompt.
[CmdletBinding()]
param(
# Accept model usage records from the pipeline or as an array.
[Parameter(Mandatory, ValueFromPipeline)]
[psobject[]]$Model,
# Set a simple fictional budget in token units for the sample.
[ValidateRange(1, 1000000000)]
[long]$BudgetTokens = 100000
)
begin {
# Buffer records so shares and totals use one consistent denominator.
$models = [System.Collections.Generic.List[psobject]]::new()
}
process {
# Add every fictional model row to memory.
foreach ($item in $Model) {
$models.Add($item)
}
}
end {
# Calculate estimated usage for each model.
$rows = foreach ($item in $models) {
# Multiply request volume by average tokens per request.
$estimated = [long]$item.Requests * [long]$item.AverageTokens
[pscustomobject]@{
Model = [string]$item.Model
Requests = [long]$item.Requests
AverageTokens = [long]$item.AverageTokens
EstimatedTokens = $estimated
}
}
# Compute a total before calculating each model's share.
$total = ($rows | Measure-Object EstimatedTokens -Sum).Sum
foreach ($row in ($rows | Sort-Object Model)) {
# Avoid division by zero for an empty workload.
$share = if ($total -eq 0) { 0 } else { [math]::Round(($row.EstimatedTokens / $total) * 100, 2) }
[pscustomobject]@{
Model = $row.Model
Requests = $row.Requests
EstimatedTokens = $row.EstimatedTokens
SharePct = $share
BudgetStatus = if ($total -le $BudgetTokens) { 'Within budget' } else { 'Over budget' }
}
}
# Emit one total row so the budget decision is visible at a glance.
[pscustomobject]@{
Model = 'TOTAL'
Requests = [long](($rows | Measure-Object Requests -Sum).Sum)
EstimatedTokens = [long]$total
SharePct = 100
BudgetStatus = if ($total -le $BudgetTokens) { 'Within budget' } else { 'Over budget' }
}
}
4. What Happened When It Ran
The actual captured output, errors, and exit status.
PowerShell version: 7.6.6
Command: pwsh -NoLogo -NoProfile -NonInteractive -File ./run.ps1
Exit status: 0
STDOUT:
Model Requests EstimatedTokens SharePct BudgetStatus
----- -------- --------------- -------- ------------
Model-A 120 38400 41.92 Within budget
Model-B 80 43200 47.16 Within budget
Model-C 40 10000 10.92 Within budget
TOTAL 240 91600 100 Within budget
STDERR:
(empty)
5. Validation Performed by the AI Workflow
The runtime, expected results, and safety boundaries were checked and recorded.
Compare a fictional feature catalog with the current PowerShell version and flag what is ready.
Validated
PowerShell 7 implementation
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into this concise prompt. That prompt was then used to generate the PowerShell.
Create a fully commented PowerShell 7 script that accepts fictional feature records (name, introduced version, and status), compares them with a configurable current PowerShell version, and returns a structured readiness report with next steps. Use only in-memory data and version-aware validation; no network, file, credential, registry, or system access.
2. The Runner AI Created
AI also created run.ps1. It prepares the sample data, passes the parameters, and invokes the generated PowerShell.
# Keep the runner independent from the caller's machine and PowerShell installation.
$ErrorActionPreference = 'Stop'
# Supply a small fictional feature catalog with both available and future entries.
$features = @(
[pscustomobject]@{ Name = 'Structured error views'; IntroducedIn = '7.6'; Notes = 'Use the richer error display.' }
[pscustomobject]@{ Name = 'Preview pipeline insight'; IntroducedIn = '7.7'; Notes = 'Evaluate this preview feature first.' }
[pscustomobject]@{ Name = 'Cross-platform remoting'; IntroducedIn = '7.4'; Notes = 'Available in the current baseline.' }
)
# Run the solution against a fixed version so the output is repeatable.
& (Join-Path $PSScriptRoot 'solution.ps1') -Feature $features -CurrentVersion '7.6'
3. The PowerShell AI Generated
solution.ps1 is the runnable PowerShell produced from the AI-created prompt.
[CmdletBinding()]
param(
# Accept feature records from the caller so the report works with any in-memory catalog.
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[object[]] $Feature,
# Compare every feature with this explicit PowerShell version.
[version] $CurrentVersion = [version]'7.6'
)
# Make uninitialized variables and common scripting mistakes fail early.
Set-StrictMode -Version Latest
function Get-FeatureReadiness {
[CmdletBinding()]
param(
# Keep the input strongly typed and require at least one record.
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[object[]] $InputFeature,
# Pass the version into the function so the comparison is explicit and testable.
[Parameter(Mandatory)]
[version] $TargetVersion
)
foreach ($item in $InputFeature) {
# Validate the fields needed to produce a useful report row.
if ([string]::IsNullOrWhiteSpace([string]$item.Name)) {
throw 'Every feature must have a non-empty Name.'
}
if ($null -eq $item.IntroducedIn) {
throw "Feature '$($item.Name)' must specify IntroducedIn."
}
# Parse the version text once so malformed input fails with a clear message.
try {
$introducedVersion = [version]$item.IntroducedIn
}
catch {
throw "Feature '$($item.Name)' has an invalid IntroducedIn value: $($item.IntroducedIn)."
}
# Emit structured data rather than strings so the result remains reusable.
[pscustomobject]@{
Name = [string]$item.Name
IntroducedIn = $introducedVersion.ToString()
Available = $introducedVersion -le $TargetVersion
Recommendation = if ($introducedVersion -le $TargetVersion) {
'Ready to use'
}
else {
"Wait for PowerShell $introducedVersion"
}
Notes = [string]$item.Notes
}
}
}
# Build the report against the requested version.
$report = @(Get-FeatureReadiness -InputFeature $Feature -TargetVersion $CurrentVersion)
# Print a compact table that is easy to read in a terminal.
$report | Format-Table -AutoSize
# Print a summary so callers can see the overall readiness at a glance.
[pscustomobject]@{
CurrentVersion = $CurrentVersion.ToString()
FeatureCount = $report.Count
ReadyCount = @($report | Where-Object Available).Count
WaitingCount = @($report | Where-Object { -not $_.Available }).Count
} | Format-List
4. What Happened When It Ran
The actual captured output, errors, and exit status.
PowerShell version: 7.6.6
Command: pwsh -NoLogo -NoProfile -NonInteractive -File ./run.ps1
Exit status: 0
STDOUT:
Name IntroducedIn Available Recommendation Notes
---- ------------ --------- -------------- -----
Structured error views 7.6 True Ready to use Use th…
Preview pipeline insight 7.7 False Wait for PowerShell 7.7 Evalua…
Cross-platform remoting 7.4 True Ready to use Availa…
CurrentVersion : 7.6
FeatureCount : 3
ReadyCount : 2
WaitingCount : 1
STDERR:
(empty)
5. Validation Performed by the AI Workflow
The runtime, expected results, and safety boundaries were checked and recorded.
Round-trip fictional regional sales through an Excel workbook and verify the totals.
Validated
PowerShell 7 implementation
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into this concise prompt. That prompt was then used to generate the PowerShell.
Create a fully commented PowerShell 7 script that exports fictional regional sales objects to a formatted Excel table, imports it, and verifies row count and total sales. Use ImportExcel and a caller-supplied temporary path, with deterministic sample data and no network, credentials, registry/system changes, deletion, or arbitrary code execution.
2. The Runner AI Created
AI also created run.ps1. It prepares the sample data, passes the parameters, and invokes the generated PowerShell.
# Stop on the first error so the captured exit status reflects the real result.
$ErrorActionPreference = 'Stop'
# Use the runtime temporary directory so the repository stays focused on source and evidence.
$outputPath = Join-Path ([System.IO.Path]::GetTempPath()) "idea-lab-regional-sales-$PID.xlsx"
# Supply deterministic fictional sales records.
$sales = @(
[pscustomobject]@{ Region = 'North'; Product = 'Atlas'; Units = 12; Amount = 1440.00 }
[pscustomobject]@{ Region = 'South'; Product = 'Beacon'; Units = 9; Amount = 990.00 }
[pscustomobject]@{ Region = 'West'; Product = 'Cedar'; Units = 15; Amount = 2025.00 }
[pscustomobject]@{ Region = 'North'; Product = 'Drift'; Units = 7; Amount = 840.00 }
)
# Invoke the ImportExcel-backed solution and print its verification object.
& (Join-Path $PSScriptRoot 'solution.ps1') -SalesRecord $sales -OutputPath $outputPath | Format-List
3. The PowerShell AI Generated
solution.ps1 is the runnable PowerShell produced from the AI-created prompt.
[CmdletBinding()]
param(
# Accept fictional sales rows from the caller.
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[object[]] $SalesRecord,
# Write the generated workbook only to the caller's chosen path.
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[string] $OutputPath
)
# Make uninitialized variables and common scripting mistakes fail early.
Set-StrictMode -Version Latest
# Load the module that provides cross-platform Excel file operations.
Import-Module ImportExcel -ErrorAction Stop -WarningAction SilentlyContinue 3>$null
# Validate the output location without creating or changing any parent directory.
$parentPath = Split-Path -Parent $OutputPath
if (-not [string]::IsNullOrWhiteSpace($parentPath) -and -not (Test-Path -LiteralPath $parentPath -PathType Container)) {
throw "The output directory does not exist: $parentPath"
}
# Validate each record before writing a workbook so bad input is reported early.
foreach ($record in $SalesRecord) {
if ([string]::IsNullOrWhiteSpace([string]$record.Region)) {
throw 'Every sales record must have a Region.'
}
if ($null -eq $record.Amount) {
throw "Sales record '$($record.Region)' must have an Amount."
}
}
# Export the in-memory records with a table and presentation-friendly options.
$SalesRecord | Export-Excel -Path $OutputPath -WorksheetName 'Sales' -TableName 'RegionalSales' -AutoFilter -FreezeTopRow -BoldTopRow
# Read the workbook back to prove that the generated artifact can be consumed.
$roundTrip = @(Import-Excel -Path $OutputPath -WorksheetName 'Sales')
# Return structured verification details instead of requiring callers to parse text.
[pscustomobject]@{
WorkbookPath = $OutputPath
RowsWritten = $SalesRecord.Count
RowsRead = $roundTrip.Count
TotalAmount = [math]::Round((@($roundTrip | Measure-Object -Property Amount -Sum).Sum), 2)
Verified = $roundTrip.Count -eq $SalesRecord.Count
}
4. What Happened When It Ran
The actual captured output, errors, and exit status.
Compare direct-loop and pipeline processing while confirming both approaches produce the same answer.
Validated
PowerShell 7 implementation
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into this concise prompt. That prompt was then used to generate the PowerShell.
Create a fully commented PowerShell 7 script that benchmarks a foreach loop and a pipeline over the same in-memory integers. Return elapsed milliseconds, checksums, and an agreement flag; keep the workload deterministic and note that timings vary. No files, network, credentials, registry/system changes, or arbitrary code.
2. The Runner AI Created
AI also created run.ps1. It prepares the sample data, passes the parameters, and invokes the generated PowerShell.
# Stop on the first error so the captured exit status is meaningful.
$ErrorActionPreference = 'Stop'
# Use a modest deterministic workload suitable for an isolated cloud runtime.
& (Join-Path $PSScriptRoot 'solution.ps1') -ItemCount 5000 -Repetitions 10
3. The PowerShell AI Generated
solution.ps1 is the runnable PowerShell produced from the AI-created prompt.
[CmdletBinding()]
param(
# Control the size of the fictional in-memory workload.
[ValidateRange(100, 100000)]
[int] $ItemCount = 5000,
# Repeat each implementation so a small workload still produces measurable timing.
[ValidateRange(1, 100)]
[int] $Repetitions = 10
)
# Make uninitialized variables and common scripting mistakes fail early.
Set-StrictMode -Version Latest
# Build one deterministic input array that both implementations will consume.
$items = 1..$ItemCount
# Measure a direct foreach loop over the same values.
$foreachMeasurement = Measure-Command {
$foreachSum = 0L
for ($repeat = 0; $repeat -lt $Repetitions; $repeat++) {
foreach ($item in $items) {
$foreachSum += $item
}
}
}
# Measure a pipeline-based implementation over the same values.
$pipelineMeasurement = Measure-Command {
$pipelineSum = 0L
for ($repeat = 0; $repeat -lt $Repetitions; $repeat++) {
$pipelineSum += ($items | ForEach-Object { $_ } | Measure-Object -Sum).Sum
}
}
# Emit structured results so the comparison can be consumed without parsing display text.
$scorecard = @(
[pscustomobject]@{
Implementation = 'foreach loop'
ElapsedMs = [math]::Round($foreachMeasurement.TotalMilliseconds, 3)
Checksum = $foreachSum
}
[pscustomobject]@{
Implementation = 'pipeline loop'
ElapsedMs = [math]::Round($pipelineMeasurement.TotalMilliseconds, 3)
Checksum = $pipelineSum
}
)
# Display the scorecard and an explicit agreement check.
$scorecard | Format-Table -AutoSize
[pscustomobject]@{
ItemCount = $ItemCount
Repetitions = $Repetitions
ChecksumsAgree = $scorecard[0].Checksum -eq $scorecard[1].Checksum
FasterPath = ($scorecard | Sort-Object ElapsedMs | Select-Object -First 1).Implementation
} | Format-List
4. What Happened When It Ran
The actual captured output, errors, and exit status.
direct-loop and pipeline-loop implementations processed the same 5,000-item workload for 10 repetitions, produced matching checksums, and returned a scorecard.
Safety
deterministic in-memory integers only; no network, file writes, deletion, registry/system changes, credential access, or arbitrary code execution.
Note
elapsed times are illustrative and vary by runtime.
Group fictional paths by top-level folder and depth while keeping the report stable and readable.
Validated
PowerShell 7 implementation
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into this concise prompt. That prompt was then used to generate the PowerShell.
Create a fully commented PowerShell 7 script that accepts fictional forward-slash paths, normalizes them, and groups them by top-level folder and depth. Ignore blanks, preserve deterministic group order, and include counts plus each group’s deepest sample. Use in-memory strings only; do not inspect the real filesystem or access network, credentials, registry, or system settings.
2. The Runner AI Created
AI also created run.ps1. It prepares the sample data, passes the parameters, and invokes the generated PowerShell.
# Stop on the first error so the captured exit status reflects the real result.
$ErrorActionPreference = 'Stop'
# Supply fictional paths only; no real directories are inspected.
$paths = @(
'reports/2026/january/sales.csv'
'reports/2026/february/sales.csv'
'reports/2026/february/archive/notes.txt'
'exports/daily/status.json'
'exports/monthly/status.json'
' '
'reports//2026//march//sales.csv'
)
# Run the in-memory path summarizer.
& (Join-Path $PSScriptRoot 'solution.ps1') -Path $paths
3. The PowerShell AI Generated
solution.ps1 is the runnable PowerShell produced from the AI-created prompt.
[CmdletBinding()]
param(
# Accept sample paths from the caller rather than reading the local filesystem.
[Parameter(Mandatory)]
[ValidateNotNull()]
[string[]] $Path
)
# Make uninitialized variables and common scripting mistakes fail early.
Set-StrictMode -Version Latest
# Hold normalized path records in memory for grouping.
$records = foreach ($value in $Path) {
if ([string]::IsNullOrWhiteSpace($value)) {
continue
}
# Normalize separators and trim the edges before splitting into segments.
$normalized = ($value -replace '/+', '/').Trim('/')
if ([string]::IsNullOrWhiteSpace($normalized)) {
continue
}
# Count non-empty segments to calculate path depth.
$segments = @($normalized -split '/' | Where-Object { $_ })
[pscustomobject]@{
Path = $normalized
TopLevel = $segments[0]
Depth = $segments.Count
}
}
# Group records and sort the groups for repeatable output.
$summary = foreach ($group in ($records | Group-Object TopLevel | Sort-Object Name)) {
# Sort paths by depth and then name so the deepest sample is deterministic.
$deepest = $group.Group | Sort-Object Depth, Path | Select-Object -Last 1
[pscustomobject]@{
TopLevel = $group.Name
PathCount = $group.Count
MaximumDepth = ($group.Group | Measure-Object -Property Depth -Maximum).Maximum
DeepestExample = $deepest.Path
}
}
# Print structured summary rows followed by an overall count.
$summary | Format-Table -AutoSize
[pscustomobject]@{
InputCount = @($Path).Count
NormalizedCount = @($records).Count
GroupCount = @($summary).Count
} | Format-List
4. What Happened When It Ran
The actual captured output, errors, and exit status.
seven input strings produced six normalized paths in two deterministic top-level groups; repeated separators and blank input were handled as specified.
Safety
paths were sample strings only; the real filesystem was never enumerated, and there was no network, deletion, registry/system change, credential access, or arbitrary code execution.
Turn mixed-delimiter text into clean, ordered tokens with an explicit character array.
Validated
PowerShell 7 implementation
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into this concise prompt. That prompt was then used to generate the PowerShell.
Create a fully commented PowerShell 7 script that parses caller-supplied delimited strings using an explicit configurable character array. Trim tokens, remove empty values, preserve order, and return the original text plus token count. Use in-memory samples only; no files, network, credentials, registry/system changes, deletion, or arbitrary code.
2. The Runner AI Created
AI also created run.ps1. It prepares the sample data, passes the parameters, and invokes the generated PowerShell.
# Stop on the first error so the captured exit status reflects the real result.
$ErrorActionPreference = 'Stop'
# Supply deterministic examples using different delimiter characters.
$values = @(
'alpha, beta,, gamma'
'north | south | east'
)
# Run each example with its matching explicit delimiter character array.
& (Join-Path $PSScriptRoot 'solution.ps1') -Value $values[0] -Delimiter ([char[]]',') | Format-List
& (Join-Path $PSScriptRoot 'solution.ps1') -Value $values[1] -Delimiter ([char[]]'|') | Format-List
3. The PowerShell AI Generated
solution.ps1 is the runnable PowerShell produced from the AI-created prompt.
[CmdletBinding()]
param(
# Accept one or more delimited values from the caller.
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[string[]] $Value,
# Make the delimiter characters explicit for predictable PowerShell 7 behavior.
[char[]] $Delimiter = [char[]]','
)
# Make uninitialized variables and common scripting mistakes fail early.
Set-StrictMode -Version Latest
foreach ($text in $Value) {
if ([string]::IsNullOrWhiteSpace($text)) {
throw 'Value entries cannot be blank.'
}
# Split using the explicit character array and remove empty tokens.
$tokens = @(
$text.Split($Delimiter, [System.StringSplitOptions]::RemoveEmptyEntries) |
ForEach-Object { $_.Trim() } |
Where-Object { -not [string]::IsNullOrWhiteSpace($_) }
)
# Return a structured object so callers can use the tokens directly.
[pscustomobject]@{
Original = $text
TokenCount = $tokens.Count
Tokens = $tokens -join ' | '
}
}
4. What Happened When It Ran
The actual captured output, errors, and exit status.
PowerShell version: 7.6.6
Command: pwsh -NoLogo -NoProfile -NonInteractive -File ./run.ps1
Exit status: 0
STDOUT:
Original : alpha, beta,, gamma
TokenCount : 3
Tokens : alpha | beta | gamma
Original : north | south | east
TokenCount : 3
Tokens : north | south | east
STDERR:
(empty)
5. Validation Performed by the AI Workflow
The runtime, expected results, and safety boundaries were checked and recorded.
Compare a fictional device inventory with a readiness baseline and report exactly what needs attention.
Validated
PowerShell 7 implementation
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into this concise prompt. That prompt was then used to generate the PowerShell.
# Prompt
Create a PowerShell 7 script that accepts device inventory objects with a name, operating system, memory in GB, and free disk space in GB. Compare each record with a configurable readiness baseline, report whether it is ready, and list every gap in plain language. Use fictional in-memory records, keep the evaluation read-only, and avoid network calls or system changes.
2. The Runner AI Created
AI also created run.ps1. It prepares the sample data, passes the parameters, and invokes the generated PowerShell.
# Stop on unexpected errors so validation records a meaningful exit status.
$ErrorActionPreference = 'Stop'
# Use fictional inventory records so the report is safe to run anywhere.
$inventory = @(
[pscustomobject]@{ Device = 'Northstar-01'; OperatingSystem = 'Windows 11'; MemoryGB = 32; FreeDiskGB = 120 }
[pscustomobject]@{ Device = 'Northstar-02'; OperatingSystem = 'Windows 10'; MemoryGB = 16; FreeDiskGB = 80 }
[pscustomobject]@{ Device = 'Northstar-03'; OperatingSystem = 'Windows 11'; MemoryGB = 8; FreeDiskGB = 35 }
)
# Evaluate the sample inventory against the default baseline.
$results = & "$PSScriptRoot/solution.ps1" -Device $inventory
# Print a readable one-line summary per device.
$results | ForEach-Object {
Write-Output ("{0}: {1}; gaps: {2}" -f $_.Device, $(if ($_.Ready) { 'Ready' } else { 'Review' }), $_.Gaps)
}
3. The PowerShell AI Generated
solution.ps1 is the runnable PowerShell produced from the AI-created prompt.
[CmdletBinding()]
param(
# Accept fictional inventory records from the pipeline or as an array.
[Parameter(Mandatory, ValueFromPipeline)]
[psobject[]]$Device,
# Define the minimum baseline that a device should satisfy.
[string]$RequiredOs = 'Windows 11',
[ValidateRange(1, 1024)]
[int]$MinimumMemoryGB = 16,
[ValidateRange(1, 4096)]
[int]$MinimumFreeDiskGB = 50
)
begin {
# Hold input records until the pipeline completes so the function can emit one report.
$devicesToReview = [System.Collections.Generic.List[psobject]]::new()
}
process {
# Add each incoming device to the in-memory inventory.
foreach ($item in $Device) {
$devicesToReview.Add($item)
}
}
end {
# Evaluate each device against the same explicit baseline.
foreach ($item in $devicesToReview) {
# Start an empty list of human-readable gaps for this device.
$gaps = [System.Collections.Generic.List[string]]::new()
# Record an operating-system gap when the device is outside the baseline.
if ($item.OperatingSystem -ne $RequiredOs) {
$gaps.Add("OS is $($item.OperatingSystem); required $RequiredOs")
}
# Record a memory gap when the installed amount is too small.
if ([int]$item.MemoryGB -lt $MinimumMemoryGB) {
$gaps.Add("Memory is $($item.MemoryGB) GB; required $MinimumMemoryGB GB")
}
# Record a storage gap when the free space is below the baseline.
if ([int]$item.FreeDiskGB -lt $MinimumFreeDiskGB) {
$gaps.Add("Free disk is $($item.FreeDiskGB) GB; required $MinimumFreeDiskGB GB")
}
# Emit one concise report object for the device.
[pscustomobject]@{
Device = $item.Device
Ready = $gaps.Count -eq 0
Gaps = if ($gaps.Count -eq 0) { 'None' } else { $gaps -join '; ' }
}
}
}
4. What Happened When It Ran
The actual captured output, errors, and exit status.
PowerShell: 7.6.6
Command: /opt/powershell/pwsh -NoLogo -NoProfile -NonInteractive -File run.ps1
Exit status: 0
STDOUT:
Northstar-01: Ready; gaps: None
Northstar-02: Review; gaps: OS is Windows 10; required Windows 11
Northstar-03: Review; gaps: Memory is 8 GB; required 16 GB; Free disk is 35 GB; required 50 GB
STDERR:
(empty)
5. Validation Performed by the AI Workflow
The runtime, expected results, and safety boundaries were checked and recorded.
Validation StatusPassed
Runtime
PowerShell 7.6.6 on Linux
Command
./run.ps1 - Safety review: fictional in-memory inventory only; no network, deletion, registry/system changes, credential access, or arbitrary code execution.
Checks
three devices were evaluated against the OS, memory, and free-disk baseline; the command exited with status 0 and reported actionable gaps.
Run independent checks concurrently, then sort the results so every report stays stable and readable.
Validated
PowerShell 7 implementation
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into this concise prompt. That prompt was then used to generate the PowerShell.
# Prompt
Create a PowerShell 7 script that accepts independent check records with a name, expected value, and observed value. Evaluate the checks concurrently with `ForEach-Object -Parallel`, using a bounded throttle limit. Make the worker logic self-contained, return `Pass` or `Review` for each check, and sort the final objects by check name so output is deterministic. Use only in-memory fictional data and do not contact real services.
2. The Runner AI Created
AI also created run.ps1. It prepares the sample data, passes the parameters, and invokes the generated PowerShell.
# Treat any unexpected PowerShell error as a failed validation.
$ErrorActionPreference = 'Stop'
# Define independent, fictional checks that can safely run in parallel.
$checks = @(
[pscustomobject]@{ Check = 'Config schema'; Expected = 'v3'; Observed = 'v3' }
[pscustomobject]@{ Check = 'Cache freshness'; Expected = 'Fresh'; Observed = 'Stale' }
[pscustomobject]@{ Check = 'Worker capacity'; Expected = 'Available'; Observed = 'Available' }
[pscustomobject]@{ Check = 'Feature flags'; Expected = 'Loaded'; Observed = 'Loaded' }
)
# Invoke the solution with a small throttle limit suitable for a demo machine.
$results = & "$PSScriptRoot/solution.ps1" -Check $checks -ThrottleLimit 3
# Print one stable line per result for easy review and validation.
$results | ForEach-Object {
Write-Output ("{0}: {1} (expected {2}, observed {3})" -f $_.Check, $_.State, $_.Expected, $_.Observed)
}
3. The PowerShell AI Generated
solution.ps1 is the runnable PowerShell produced from the AI-created prompt.
[CmdletBinding()]
param(
# Accept independent check definitions from the pipeline or as an array.
[Parameter(Mandatory, ValueFromPipeline)]
[psobject[]]$Check,
# Limit concurrent workers so the pattern remains predictable on small machines.
[ValidateRange(1, 32)]
[int]$ThrottleLimit = 3
)
begin {
# Collect all checks before starting workers so the input boundary is explicit.
$checksToRun = [System.Collections.Generic.List[psobject]]::new()
}
process {
# Add each check record to the in-memory work list.
foreach ($item in $Check) {
$checksToRun.Add($item)
}
}
end {
# Run each independent check in its own parallel runspace.
$results = $checksToRun | ForEach-Object -Parallel {
# Keep worker logic self-contained because a parallel runspace does not inherit local functions.
$isMatch = $_.Observed -eq $_.Expected
# Return a plain object that is easy to sort, display, or export.
[pscustomobject]@{
Check = $_.Check
Expected = $_.Expected
Observed = $_.Observed
State = if ($isMatch) { 'Pass' } else { 'Review' }
}
} -ThrottleLimit $ThrottleLimit
# Sort after the workers finish so output order is stable across runs.
$results | Sort-Object Check
}
4. What Happened When It Ran
The actual captured output, errors, and exit status.
Create a BOM-free UTF-8 CSV in memory and prove that non-ASCII text survives the round trip.
Validated
PowerShell 7 implementation
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into this concise prompt. That prompt was then used to generate the PowerShell.
# Prompt
Create a PowerShell 7 script that accepts objects from the pipeline and produces a portable CSV document in memory. Use an explicit UTF-8 encoder without a byte-order mark, preserve non-ASCII characters, and return metadata showing the encoding, byte count, line count, and whether a BOM was present. Decode the generated bytes again and return the round-tripped CSV text so the runner can demonstrate the result. Use no network calls, credentials, system changes, or external input.
2. The Runner AI Created
AI also created run.ps1. It prepares the sample data, passes the parameters, and invokes the generated PowerShell.
# Stop immediately if the solution reports a terminating error.
$ErrorActionPreference = 'Stop'
# Build fictional records in memory so this demonstration needs no network or external files.
$records = @(
[pscustomobject]@{ Device = 'Atlas-01'; Owner = 'Zoë'; State = 'Ready' }
[pscustomobject]@{ Device = 'Borealis-02'; Owner = 'Miyuki'; State = 'Review' }
[pscustomobject]@{ Device = 'Cedar-03'; Owner = 'José'; State = 'Ready' }
)
# Invoke the reusable solution with the sample records.
$result = & "$PSScriptRoot/solution.ps1" -InputObject $records
# Print deterministic metadata followed by the portable CSV payload.
Write-Output "Encoding: $($result.Encoding)"
Write-Output "Byte count: $($result.ByteCount)"
Write-Output "Line count: $($result.LineCount)"
Write-Output "Has BOM: $($result.HasBom)"
Write-Output 'CSV payload:'
Write-Output $result.CsvText
3. The PowerShell AI Generated
solution.ps1 is the runnable PowerShell produced from the AI-created prompt.
[CmdletBinding()]
param(
# Accept the objects that should become rows in the export.
[Parameter(Mandatory, ValueFromPipeline)]
[psobject[]]$InputObject,
# Allow callers to choose another delimiter while keeping comma as the default.
[char]$Delimiter = ','
)
begin {
# Collect pipeline input so one complete CSV document can be produced at the end.
$rows = [System.Collections.Generic.List[psobject]]::new()
}
process {
# Add each incoming object to the in-memory collection.
foreach ($item in $InputObject) {
$rows.Add($item)
}
}
end {
# Convert the objects to normal CSV lines without the PowerShell type header.
$csvLines = @($rows | ConvertTo-Csv -NoTypeInformation -Delimiter $Delimiter)
# Use an explicit UTF-8 encoder that does not add a byte-order mark.
$utf8NoBom = [System.Text.UTF8Encoding]::new($false)
# Join the lines with the platform newline and encode the complete document.
$csvText = $csvLines -join [Environment]::NewLine
$bytes = $utf8NoBom.GetBytes($csvText)
# Decode the bytes again to prove that the generated payload is self-consistent.
$roundTripText = $utf8NoBom.GetString($bytes)
# Return useful metadata plus the text that a caller could save or transmit.
[pscustomobject]@{
Encoding = 'UTF-8 without BOM'
ByteCount = $bytes.Length
LineCount = $csvLines.Count
HasBom = $bytes.Length -ge 3 -and $bytes[0] -eq 0xEF -and $bytes[1] -eq 0xBB -and $bytes[2] -eq 0xBF
CsvText = $roundTripText
}
}
4. What Happened When It Ran
The actual captured output, errors, and exit status.
Divide a long note into predictable character-limited blocks while preserving every character and its order.
Validated
PowerShell 7 implementation
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into this concise prompt. That prompt was then used to generate the PowerShell.
Create a fully commented PowerShell 7 script that splits a long text value into sequential, fixed-size character blocks.
Accept the text and a positive maximum character count as parameters. Preserve every character and the original order, return one structured object per block with its one-based number, character count, and text, and handle a final block that is shorter than the limit. Prefer a clear indexed loop using .NET string operations over an opaque regular-expression trick.
Include CmdletBinding, strict mode, parameter validation, and a useful error for an empty text value or non-positive block size. Keep the example safe for isolated execution: use only caller-supplied or fictional in-memory text; do not write files, call the network, access credentials, change the registry or system settings, execute arbitrary code, or use `Invoke-Expression`.
Provide a separate `run.ps1` that supplies a fictional multi-sentence note and a small limit so several blocks are produced. Display a compact report that makes the block order and character limits easy to verify. Include exact PowerShell 7 commands and state that the limit counts .NET string characters.
2. The Runner AI Created
AI also created run.ps1. It prepares the sample data, passes the parameters, and invokes the generated PowerShell.
[CmdletBinding()]
param()
# Keep the runner independent from files, services, and user-specific configuration.
Set-StrictMode -Version Latest
# Fictional text keeps the example deterministic and safe to run anywhere.
$sampleText = 'The morning handoff is ready. Review the queued work, confirm the owner for each item, and record the next action before the afternoon check-in.'
$solutionPath = Join-Path -Path $PSScriptRoot -ChildPath 'solution.ps1'
# A small limit forces several blocks so the ordering and final-short-block behavior are visible.
& $solutionPath -Text $sampleText -MaxCharacters 48
3. The PowerShell AI Generated
solution.ps1 is the runnable PowerShell produced from the AI-created prompt.
[CmdletBinding()]
param(
# The complete text to divide into blocks.
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[string] $Text,
# The largest number of .NET string characters allowed in one block.
[Parameter(Mandatory)]
[ValidateRange(1, 1000000)]
[int] $MaxCharacters
)
# Make uninitialized variables and common scripting mistakes fail early.
Set-StrictMode -Version Latest
function Split-TextIntoBlocks {
[CmdletBinding()]
param(
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[string] $InputText,
[Parameter(Mandatory)]
[ValidateRange(1, 1000000)]
[int] $BlockSize
)
$blocks = [System.Collections.Generic.List[object]]::new()
# Advance by one block at a time so no character is skipped or repeated.
for ($start = 0; $start -lt $InputText.Length; $start += $BlockSize) {
# The final block may be shorter than the requested maximum.
$remaining = $InputText.Length - $start
$length = [Math]::Min($BlockSize, $remaining)
$blockText = $InputText.Substring($start, $length)
# Store structured data instead of requiring callers to parse display text.
[void] $blocks.Add([pscustomobject]@{
BlockNumber = $blocks.Count + 1
CharacterCount = $length
Text = $blockText
})
}
[object[]] $blocks
}
$blocks = Split-TextIntoBlocks -InputText $Text -BlockSize $MaxCharacters
Write-Output 'Blocks:'
foreach ($block in $blocks) {
# Escape line breaks in the display only; the Text property itself remains unchanged.
$displayText = $block.Text.Replace("`r", '<CR>').Replace("`n", '<LF>')
# Angle brackets make leading or trailing spaces visible in captured output.
Write-Output ("{0}. ({1} chars) <{2}>" -f $block.BlockNumber, $block.CharacterCount, $displayText)
}
Write-Output ''
Write-Output 'Summary:'
[pscustomobject]@{
InputCharacters = $Text.Length
MaxCharacters = $MaxCharacters
BlockCount = $blocks.Count
LargestBlock = ($blocks | Measure-Object -Property CharacterCount -Maximum).Maximum
} | Format-List
4. What Happened When It Ran
The actual captured output, errors, and exit status.
PowerShell version: 7.6.6
Command: pwsh -NoProfile -NonInteractive -File ./run.ps1
=== STDOUT ===
Blocks:
1. (48 chars) <The morning handoff is ready. Review the queued >
2. (48 chars) <work, confirm the owner for each item, and recor>
3. (48 chars) <d the next action before the afternoon check-in.>
Summary:
InputCharacters : 144
MaxCharacters : 48
BlockCount : 3
LargestBlock : 48
=== STDERR ===
(empty)
=== EXIT STATUS ===
0
5. Validation Performed by the AI Workflow
The runtime, expected results, and safety boundaries were checked and recorded.
Validation StatusPassed
PowerShell 7.6.6 was available in the isolated cloud Linux runtime. The runner completed non-interactively with exit status 0 and no stderr output. The captured output shows a 144-character in-memory note split into three ordered blocks of 48 characters each. The implementation uses string indexing and Substring, preserves all input characters, and keeps the largest block at the requested limit. The example is safe for isolated execution because it uses only fictional in-memory text and does not write files, use the network, access credentials, change the registry, execute arbitrary code, or modify system settings. Command used:
Turn malformed dates into structured review results while the rest of the batch keeps moving.
Validated
PowerShell 7 implementation
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into this concise prompt. That prompt was then used to generate the PowerShell.
Create a fully commented PowerShell 7 script that validates a batch of schedule records without stopping when one record contains an invalid date.
Accept objects with a Name and DueDate property. Parse each date using a normal PowerShell cmdlet with `-ErrorAction Stop` inside a per-record `try`/`catch`, so conversion failures become structured results while the loop continues. Return one result per input record with the name, normalized ISO date when valid, a Valid or Invalid status, and an error message when invalid. Include a final count of valid and invalid records.
Include CmdletBinding, strict mode, parameter validation, readable objects instead of string parsing, and deterministic sample data. Keep the example safe for isolated execution: use only fictional in-memory records; do not write files, call the network, access credentials, change the registry or system settings, execute arbitrary code, or use `Invoke-Expression`.
Provide a separate `run.ps1` that supplies two valid dates and one malformed date, then invokes the implementation non-interactively. Display the per-record results and summary. Include exact PowerShell 7 commands and explain why `-ErrorAction Stop` is needed for `try`/`catch` to handle non-terminating conversion errors.
2. The Runner AI Created
AI also created run.ps1. It prepares the sample data, passes the parameters, and invokes the generated PowerShell.
[CmdletBinding()]
param()
# Keep the runner independent from files, services, and user-specific configuration.
Set-StrictMode -Version Latest
# Fictional records deliberately include one malformed date to exercise per-item recovery.
$sampleSchedules = @(
[pscustomobject]@{
Name = 'Morning handoff'
DueDate = '2026-09-18'
}
[pscustomobject]@{
Name = 'Afternoon review'
DueDate = 'not-a-date'
}
[pscustomobject]@{
Name = 'Weekend summary'
DueDate = '2026-09-20'
}
)
$solutionPath = Join-Path -Path $PSScriptRoot -ChildPath 'solution.ps1'
# Every record is handled in memory; the malformed value should not stop later records.
& $solutionPath -Schedules $sampleSchedules
3. The PowerShell AI Generated
solution.ps1 is the runnable PowerShell produced from the AI-created prompt.
[CmdletBinding()]
param(
# Accept the schedule records from the caller so the validator can be reused.
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[object[]] $Schedules
)
# Make uninitialized variables and common scripting mistakes fail early.
Set-StrictMode -Version Latest
function Test-ScheduleDates {
[CmdletBinding()]
param(
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[object[]] $InputSchedule
)
$results = [System.Collections.Generic.List[object]]::new()
foreach ($schedule in $InputSchedule) {
$name = [string] $schedule.Name
$rawDueDate = [string] $schedule.DueDate
if ([string]::IsNullOrWhiteSpace($name)) {
throw 'Every schedule record must have a non-empty Name.'
}
try {
# ErrorAction Stop promotes a conversion error so the catch block can capture it.
$parsedDate = Get-Date -Date $rawDueDate -ErrorAction Stop
[void] $results.Add([pscustomobject]@{
Name = $name
DueDate = $parsedDate.ToString('yyyy-MM-dd')
Status = 'Valid'
Error = $null
})
}
catch {
# Keep the failure attached to this record and continue with the next one.
[void] $results.Add([pscustomobject]@{
Name = $name
DueDate = $rawDueDate
Status = 'Invalid'
Error = $_.Exception.Message
})
}
}
[object[]] $results
}
$results = @(Test-ScheduleDates -InputSchedule $Schedules)
# Keep the main table compact and print error details separately so they are never truncated.
$table = $results |
Select-Object -Property Name, DueDate, Status |
Format-Table -AutoSize |
Out-String -Width 200
Write-Output $table.TrimEnd()
$invalidResults = @($results | Where-Object Status -eq 'Invalid')
if ($invalidResults.Count -gt 0) {
Write-Output ''
Write-Output 'Errors:'
foreach ($invalidResult in $invalidResults) {
Write-Output ("{0}: {1}" -f $invalidResult.Name, $invalidResult.Error)
}
}
Write-Output ''
Write-Output 'Summary:'
[pscustomobject]@{
TotalRecords = $results.Count
ValidRecords = @($results | Where-Object Status -eq 'Valid').Count
InvalidRecords = @($results | Where-Object Status -eq 'Invalid').Count
} | Format-List
4. What Happened When It Ran
The actual captured output, errors, and exit status.
PowerShell version: 7.6.6
Command: pwsh -NoProfile -NonInteractive -File ./run.ps1
=== STDOUT ===
Name DueDate Status
---- ------- ------
Morning handoff 2026-09-18 Valid
Afternoon review not-a-date Invalid
Weekend summary 2026-09-20 Valid
Errors:
Afternoon review: Cannot bind parameter 'Date'. Cannot convert value "not-a-date" to type "System.DateTime". Error: "The string 'not-a-date' was not recognized as a valid DateTime. There is an unknown word starting at index '0'."
Summary:
TotalRecords : 3
ValidRecords : 2
InvalidRecords : 1
=== STDERR ===
(empty)
=== EXIT STATUS ===
0
5. Validation Performed by the AI Workflow
The runtime, expected results, and safety boundaries were checked and recorded.
Validation StatusPassed
PowerShell 7.6.6 was available in the isolated cloud Linux runtime. The runner completed non-interactively with exit status 0 and no stderr output. The captured output shows three in-memory schedule records processed: two valid dates were normalized to ISO form, one malformed date was captured as Invalid, and the batch continued to the final record. The example is safe for isolated execution because it uses only fictional in-memory records and does not write files, use the network, access credentials, change the registry, execute arbitrary code, or modify system settings. Command used:
Normalize messy labels while preserving the first spelling and the order in which values appeared.
Validated
PowerShell 7 implementation
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into this concise prompt. That prompt was then used to generate the PowerShell.
Create a fully commented PowerShell 7 script that turns a messy list of text labels into a case-insensitive, first-seen-order list of unique labels.
Trim surrounding whitespace before comparing values. Preserve the spelling of the first occurrence, preserve the order in which unique labels first appear, and report the input count, unique count, and duplicate count. Use a typed .NET `HashSet[string]` configured with an ordinal case-insensitive comparer for membership checks, plus an ordered collection for the output. Return readable PowerShell objects or clearly formatted output rather than parsing strings.
Include CmdletBinding, strict mode, parameter validation, and useful errors for null or blank labels. Keep the example safe for isolated execution: use only caller-supplied or fictional in-memory data; do not write files, call the network, access credentials, change the registry or system settings, execute arbitrary code, or use `Invoke-Expression`.
Provide a separate `run.ps1` that supplies sample labels with different capitalization and whitespace, then invokes the implementation. Include exact PowerShell 7 commands and state the assumptions behind the normalization and first-seen behavior.
2. The Runner AI Created
AI also created run.ps1. It prepares the sample data, passes the parameters, and invokes the generated PowerShell.
[CmdletBinding()]
param()
# Keep the runner independent from files, services, and user-specific configuration.
Set-StrictMode -Version Latest
# Fictional labels exercise case differences, duplicate values, and surrounding whitespace.
$sampleLabels = @(
'PowerShell'
'powershell'
' Automation '
'Automation'
'Cloud'
'cloud'
'DevOps'
)
$solutionPath = Join-Path -Path $PSScriptRoot -ChildPath 'solution.ps1'
# The implementation only receives the in-memory sample array and performs no external actions.
& $solutionPath -Labels $sampleLabels
3. The PowerShell AI Generated
solution.ps1 is the runnable PowerShell produced from the AI-created prompt.
[CmdletBinding()]
param(
# Accept the labels from the caller so the function can be reused with any in-memory input.
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[string[]] $Labels
)
# Make uninitialized variables and common scripting mistakes fail early.
Set-StrictMode -Version Latest
function Get-UniqueLabelReport {
[CmdletBinding()]
param(
# Require at least one label and keep the input strongly typed.
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[string[]] $InputLabel
)
# HashSet provides fast membership checks. The comparer makes only the comparison
# case-insensitive; the first spelling is still retained in the ordered collection.
$seen = [System.Collections.Generic.HashSet[string]]::new(
[System.StringComparer]::OrdinalIgnoreCase
)
# List preserves the order in which each unique label is first encountered.
$orderedLabels = [System.Collections.Generic.List[string]]::new()
# Track repeated values separately so the report can explain what was removed.
$duplicateLabels = [System.Collections.Generic.List[string]]::new()
foreach ($label in $InputLabel) {
if ($null -eq $label) {
throw 'Labels cannot contain null values.'
}
# Normalization happens before both the membership test and the retained value.
$normalizedLabel = $label.Trim()
if ([string]::IsNullOrWhiteSpace($normalizedLabel)) {
throw 'Labels cannot be blank or whitespace-only.'
}
# Add returns true only when this normalized value was not already present.
if ($seen.Add($normalizedLabel)) {
[void] $orderedLabels.Add($normalizedLabel)
}
else {
[void] $duplicateLabels.Add($normalizedLabel)
}
}
# Return structured data so callers can consume the result without parsing display text.
[pscustomobject]@{
InputCount = $InputLabel.Count
UniqueCount = $orderedLabels.Count
DuplicateCount = $duplicateLabels.Count
UniqueLabels = [string[]] $orderedLabels
Duplicates = [string[]] $duplicateLabels
}
}
# Build the report from the caller's labels.
$report = Get-UniqueLabelReport -InputLabel $Labels
# Display the ordered unique values first so the main result is easy to scan.
Write-Output 'Unique labels (first-seen order):'
for ($index = 0; $index -lt $report.UniqueLabels.Count; $index++) {
Write-Output ("{0}. {1}" -f ($index + 1), $report.UniqueLabels[$index])
}
Write-Output ''
Write-Output 'Summary:'
[pscustomobject]@{
InputCount = $report.InputCount
UniqueCount = $report.UniqueCount
DuplicateCount = $report.DuplicateCount
Duplicates = if ($report.Duplicates.Count -gt 0) {
$report.Duplicates -join ', '
}
else {
'(none)'
}
} | Format-List
4. What Happened When It Ran
The actual captured output, errors, and exit status.
The runtime, expected results, and safety boundaries were checked and recorded.
Validation StatusPassed
PowerShell 7.6.6 was available in the isolated cloud Linux runtime. The runner completed non-interactively with exit status 0 and no stderr output. The captured output shows seven input labels reduced to four unique labels. Capitalization and surrounding whitespace were ignored for comparison, while the first spelling and first-seen order were retained. Three duplicate values were reported. The example is safe for isolated execution because it uses only fictional in-memory strings and does not write files, use the network, access credentials, change the registry, execute arbitrary code, or modify system settings. Command used:
Preview a batch status change with ShouldProcess before anything is applied, even in an in-memory demo.
Validated
PowerShell 7 implementation
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into this concise prompt. That prompt was then used to generate the PowerShell.
Create a fully commented PowerShell 7 script that previews a batch status change before applying it.
Use a small set of fictional in-memory work items with a name, current status, and target status. Implement the operation with the ShouldProcess pattern so it supports PowerShell's -WhatIf and -Confirm common parameters. In preview mode, report each change that would happen. In apply mode, update only the in-memory objects and return a clear result for every item.
Include CmdletBinding, strict mode, parameter validation, readable objects instead of string parsing, and a concise summary of planned versus applied changes. Keep the example safe for isolated execution: do not write files, call the network, change the registry, access credentials, modify system settings, or use Invoke-Expression.
Provide a separate run.ps1 that supplies sample data and invokes the implementation in preview mode. Include exact commands for previewing and applying the in-memory example, state assumptions, and explain why WhatIf should be the default for potentially destructive automation.
2. The Runner AI Created
AI also created run.ps1. It prepares the sample data, passes the parameters, and invokes the generated PowerShell.
[CmdletBinding()]
param()
# Keep the runner independent from external files and services.
Set-StrictMode -Version Latest
# Use fictional objects so the preview can be run safely anywhere.
$sampleItems = @(
[pscustomobject]@{
Name = 'Alpha'
CurrentStatus = 'Queued'
TargetStatus = 'Ready'
}
[pscustomobject]@{
Name = 'Bravo'
CurrentStatus = 'Ready'
TargetStatus = 'Ready'
}
[pscustomobject]@{
Name = 'Charlie'
CurrentStatus = 'Queued'
TargetStatus = 'Blocked'
}
)
$solutionPath = Join-Path -Path $PSScriptRoot -ChildPath 'solution.ps1'
# -WhatIf is intentional: it previews the plan and does not apply changes.
& $solutionPath -Items $sampleItems -WhatIf
3. The PowerShell AI Generated
solution.ps1 is the runnable PowerShell produced from the AI-created prompt.
[CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Medium')]
param(
# Accept the work items from the caller so the example is easy to reuse.
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[object[]] $Items
)
# Make uninitialized variables and common scripting mistakes fail early.
Set-StrictMode -Version Latest
function Invoke-StatusPlan {
[CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Medium')]
param(
# Each item must expose Name, CurrentStatus, and TargetStatus properties.
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[object[]] $InputObject
)
foreach ($item in $InputObject) {
# Read the properties once so the proposed action is easy to inspect.
$name = [string]$item.Name
$currentStatus = [string]$item.CurrentStatus
$targetStatus = [string]$item.TargetStatus
if ([string]::IsNullOrWhiteSpace($name)) {
throw 'Every item must have a non-empty Name.'
}
if ([string]::IsNullOrWhiteSpace($targetStatus)) {
throw "Item '$name' must have a non-empty TargetStatus."
}
if ($currentStatus -eq $targetStatus) {
[pscustomobject]@{
Name = $name
CurrentStatus = $currentStatus
TargetStatus = $targetStatus
Action = 'No change'
}
continue
}
# ShouldProcess honors -WhatIf and -Confirm for the caller.
$description = "Change status from '$currentStatus' to '$targetStatus'"
if ($PSCmdlet.ShouldProcess($name, $description)) {
# This example changes only the in-memory object supplied by the caller.
$item.CurrentStatus = $targetStatus
[pscustomobject]@{
Name = $name
CurrentStatus = $currentStatus
TargetStatus = $targetStatus
Action = 'Applied'
}
}
else {
# In WhatIf mode, describe the proposed change without applying it.
[pscustomobject]@{
Name = $name
CurrentStatus = $currentStatus
TargetStatus = $targetStatus
Action = 'Would change'
}
}
}
}
# Invoke-StatusPlan inherits the script-level -WhatIf and -Confirm settings.
$results = Invoke-StatusPlan -InputObject $Items
$results | Format-Table -AutoSize
[pscustomobject]@{
TotalItems = @($results).Count
Changes = @($results | Where-Object Action -in @('Applied', 'Would change')).Count
Applied = @($results | Where-Object Action -eq 'Applied').Count
PreviewOnly = @($results | Where-Object Action -eq 'Would change').Count
}
4. What Happened When It Ran
The actual captured output, errors, and exit status.
PowerShell version: 7.6.6
Command: pwsh -NoProfile -NonInteractive -File ./run.ps1
=== STDOUT ===
What if: Performing the operation "Change status from 'Queued' to 'Ready'" on target "Alpha".
What if: Performing the operation "Change status from 'Queued' to 'Blocked'" on target "Charlie".
Name CurrentStatus TargetStatus Action
---- ------------- ------------ ------
Alpha Queued Ready Would change
Bravo Ready Ready No change
Charlie Queued Blocked Would change
TotalItems Changes Applied PreviewOnly
---------- ------- ------- -----------
3 2 0 2
=== STDERR ===
(empty)
=== EXIT STATUS ===
0
5. Validation Performed by the AI Workflow
The runtime, expected results, and safety boundaries were checked and recorded.
Validation StatusPassed
PowerShell 7.6.6 was available in the isolated cloud Linux runtime. The runner completed non-interactively with exit status 0 and no stderr output. The captured output shows two proposed status changes, one item requiring no change, and zero applied changes. The -WhatIf path did not modify the fictional in-memory records. The example is safe for isolated execution because it uses only sample objects and does not write files, use the network, access credentials, change the registry, or modify system settings. Command used:
Type a little math problem and get a real answer. This tiny calculator respects parentheses and operator order, while refusing to run the text as PowerShell code.
Validated
PowerShell 7 implementation
AI found the scenario, created the prompt and runner, generated the PowerShell, ran it, and validated the result.
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into the concise prompt used to generate the PowerShell.
Build a PowerShell 7 calculator for a short arithmetic expression. Accept numbers, parentheses, +, -, *, /, and ^; honor normal precedence and unary signs. Return the expression and result. Reject names, commands, and unsupported characters. Never evaluate the input as code.
2. The Runner AI Created
AI created run.ps1 to prepare sample data, pass parameters, and invoke the generated PowerShell.
# Stop on errors so a failed check cannot be mistaken for a successful calculation.
$ErrorActionPreference = 'Stop'
# Resolve the solution beside this runner.
$solution = Join-Path $PSScriptRoot 'solution.ps1'
# Evaluate examples that cover precedence, parentheses, unary signs, and exponentiation.
$results = @(& $solution -Expression @('2 + 3 * (4 - 1)', '-2^2 + 10', '2^3^2'))
# Print the useful values as a compact table.
$results | Format-Table -AutoSize
# Confirm that division by zero is rejected by the parser.
$rejected = $false
try { & $solution -Expression @('4 / 0') | Out-Null } catch { $rejected = $_.Exception.Message -like '*Division by zero*' }
# Fail the runner if the calculator accepts division by zero.
if (-not $rejected) { throw 'The divide-by-zero check failed.' }
# Confirm command-like input is rejected instead of executed.
$rejectedCode = $false
try { & $solution -Expression @('Get-Date') | Out-Null } catch { $rejectedCode = $_.Exception.Message -like '*Unsupported input*' }
# Fail if non-math text is accepted.
if (-not $rejectedCode) { throw 'The code-rejection check failed.' }
# Emit explicit checks for the captured validation record.
'Checks: precedence, parentheses, unary signs, right-associative powers, divide-by-zero rejection, command-text rejection'
'Status: passed'
3. The PowerShell AI Generated
solution.ps1 is the runnable PowerShell produced from the AI-created prompt.
# Accept a small arithmetic language instead of executing user text as PowerShell.
param(
# Evaluate one or more arithmetic expressions supplied by the caller.
[Parameter(Mandatory)]
[string[]] $Expression
)
# Stop on any parser or math error so a caller cannot mistake rejection for a result.
$ErrorActionPreference = 'Stop'
# Turn only numbers and the approved arithmetic punctuation into tokens.
function ConvertTo-MathToken {
param([Parameter(Mandatory)][string] $Text)
# Keep tokens in order so the parser preserves the original operator sequence.
$tokens = [System.Collections.Generic.List[object]]::new()
# Track the part of the input that has not been examined.
$remaining = $Text
# Consume the whole string; an unknown character is an error, not executable code.
while ($remaining.Length -gt 0) {
# Ignore spaces between tokens without changing token content.
$remaining = $remaining.TrimStart()
# Finish when only spaces remain.
if ($remaining.Length -eq 0) { break }
# Read a decimal number with an invariant decimal point.
$number = [regex]::Match($remaining, '^(?:\d+(?:\.\d*)?|\.\d+)')
if ($number.Success) {
# Store token kind and value separately for predictable parsing.
$tokens.Add([pscustomobject]@{ Kind = 'Number'; Value = $number.Value })
# Continue immediately after the number.
$remaining = $remaining.Substring($number.Length)
continue
}
# Permit only arithmetic operators and grouping parentheses.
$operator = [regex]::Match($remaining, '^[()+*/^\-]')
if ($operator.Success) {
# Store each operator as a one-character token.
$tokens.Add([pscustomobject]@{ Kind = 'Operator'; Value = $operator.Value })
# Continue immediately after the operator.
$remaining = $remaining.Substring(1)
continue
}
# Reject variables, commands, member access, and every other character.
throw "Unsupported input near '$($remaining.Substring(0, [Math]::Min(12, $remaining.Length)))'. Only numbers, spaces, parentheses, and + - * / ^ are allowed."
}
# Return a stable token array for the recursive-descent parser.
return ,$tokens.ToArray()
}
# Read an expression made from terms joined by addition or subtraction.
function Read-MathExpression {
param([hashtable] $Context)
# Begin with the first multiplicative term.
$value = Read-MathTerm -Context $Context
# Apply addition and subtraction from left to right.
while ($Context.Index -lt $Context.Tokens.Count) {
# Read the next operator without advancing the token index.
$token = $Context.Tokens[$Context.Index]
# Stop when this grammar level has no more plus or minus operators.
if ($token.Kind -ne 'Operator' -or $token.Value -notin @('+', '-')) { break }
# Consume the operator before reading its right-hand term.
$Context.Index = [int] $Context.Index + 1
# Parse multiplication and division before combining this term.
$right = Read-MathTerm -Context $Context
# Apply the selected operation to the accumulated value.
if ($token.Value -eq '+') { $value += $right } else { $value -= $right }
}
# Return the completed additive expression.
return $value
}
# Read multiplication and division, which bind more tightly than addition.
function Read-MathTerm {
param([hashtable] $Context)
# Begin with the first signed power expression.
$value = Read-MathUnary -Context $Context
# Apply multiplication and division from left to right.
while ($Context.Index -lt $Context.Tokens.Count) {
# Inspect the next operator at this grammar level.
$token = $Context.Tokens[$Context.Index]
# Stop when the next token is not multiplication or division.
if ($token.Kind -ne 'Operator' -or $token.Value -notin @('*', '/')) { break }
# Consume the operator before reading the right-hand value.
$Context.Index = [int] $Context.Index + 1
# Parse signs and exponents before applying this operation.
$right = Read-MathUnary -Context $Context
# Refuse division by zero instead of returning a misleading value.
if ($token.Value -eq '/' -and $right -eq 0) { throw 'Division by zero is not allowed.' }
# Apply multiplication or division to the accumulated value.
if ($token.Value -eq '*') { $value *= $right } else { $value /= $right }
}
# Return the completed multiplicative term.
return $value
}
# Read optional unary signs while preserving exponent precedence.
function Read-MathUnary {
param([hashtable] $Context)
# Inspect the next token for a leading sign.
if ($Context.Index -lt $Context.Tokens.Count) {
# Capture the token before advancing.
$token = $Context.Tokens[$Context.Index]
# Recursively accept a chain of leading plus or minus signs.
if ($token.Kind -eq 'Operator' -and $token.Value -in @('+', '-')) {
# Consume the unary sign.
$Context.Index = [int] $Context.Index + 1
# Parse the signed value that follows.
$value = Read-MathUnary -Context $Context
# Negate only for a minus sign.
if ($token.Value -eq '-') { return -$value }
# A plus sign leaves the numeric value unchanged.
return $value
}
}
# Parse an exponent after unary signs have been considered.
return Read-MathPower -Context $Context
}
# Read exponentiation from right to left, as in 2^3^2 = 2^(3^2).
function Read-MathPower {
param([hashtable] $Context)
# Begin with a number or parenthesized expression.
$left = Read-MathPrimary -Context $Context
# Exponentiation is optional at this grammar level.
if ($Context.Index -lt $Context.Tokens.Count) {
# Inspect the next token without consuming it.
$token = $Context.Tokens[$Context.Index]
if ($token.Kind -eq 'Operator' -and $token.Value -eq '^') {
# Consume the exponent operator.
$Context.Index = [int] $Context.Index + 1
# Parse the right side recursively to keep exponentiation right-associative.
$right = Read-MathUnary -Context $Context
# Bound exponent size so accidental large calculations stay small and quick.
if ([Math]::Abs($right) -gt 12) { throw 'Exponent magnitude must be 12 or less.' }
# Calculate with a numeric operation, never an expression evaluator.
$left = [Math]::Pow($left, $right)
}
}
# Return the numeric power expression.
return $left
}
# Read a number or a complete expression inside parentheses.
function Read-MathPrimary {
param([hashtable] $Context)
# Reject a missing number or closing parenthesis.
if ($Context.Index -ge $Context.Tokens.Count) { throw 'An expression ended where a number was expected.' }
# Capture and consume the next token.
$token = $Context.Tokens[$Context.Index]
$Context.Index = [int] $Context.Index + 1
# Parse a numeric token using a culture-independent decimal point.
if ($token.Kind -eq 'Number') { return [double]::Parse($token.Value, [Globalization.CultureInfo]::InvariantCulture) }
# Parse a nested expression after an opening parenthesis.
if ($token.Value -eq '(') {
# Evaluate only through this parser's approved grammar.
$value = Read-MathExpression -Context $Context
# Require a matching closing parenthesis.
if ($Context.Index -ge $Context.Tokens.Count -or $Context.Tokens[$Context.Index].Value -ne ')') { throw 'A closing parenthesis is missing.' }
# Consume the closing parenthesis.
$Context.Index = [int] $Context.Index + 1
# Return the value inside the parentheses.
return $value
}
# Reject any operator where a primary number was required.
throw "Unexpected token '$($token.Value)'; a number or '(' was expected."
}
# Parse every supplied expression and emit one structured result per input.
foreach ($item in $Expression) {
# Tokenize first so unsupported characters are rejected before calculation.
$tokens = ConvertTo-MathToken -Text $item
# Refuse empty input rather than returning an accidental zero.
if ($tokens.Count -eq 0) { throw 'The expression cannot be empty.' }
# Share parser position through one mutable context object.
$context = @{ Tokens = $tokens; Index = 0 }
# Parse the complete arithmetic expression.
$value = Read-MathExpression -Context $context
# Reject any extra token left after a valid expression.
if ($context.Index -ne $tokens.Count) { throw "Unexpected token '$($tokens[$context.Index].Value)'." }
# Refuse invalid floating-point results such as overflow.
if ([double]::IsNaN($value) -or [double]::IsInfinity($value)) { throw 'The result is outside the supported numeric range.' }
# Return the original text alongside a culture-independent numeric result.
[pscustomobject]@{ Expression = $item; Result = $value }
}
Quotes, backslashes, ampersands, and newlines can turn a request body into a mess. Build it from PowerShell objects, serialize once, and verify the data survives intact.
Validated
PowerShell 7 implementation
AI found the scenario, created the prompt and runner, generated the PowerShell, ran it, and validated the result.
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into the concise prompt used to generate the PowerShell.
Create a PowerShell 7 helper that converts a nested PowerShell object into one compact JSON document with an explicit depth. Round-trip it and verify quotes, ampersands, backslashes, Unicode, line breaks, arrays, and nested properties remain intact. Do not call a network endpoint or an external process.
2. The Runner AI Created
AI created run.ps1 to prepare sample data, pass parameters, and invoke the generated PowerShell.
# Stop on errors so failed serialization checks produce a nonzero process exit.
$ErrorActionPreference = 'Stop'
# Resolve the solution beside this runner.
$solution = Join-Path $PSScriptRoot 'solution.ps1'
# Put special characters and nested values in ordinary PowerShell objects.
$message = 'Customer said: "please check the A&B order."' + [Environment]::NewLine + 'Second line with café and C:\Temp\notes'
$payload = [ordered]@{
requestId = 'LAB-204'
message = $message
details = [ordered]@{
items = @(
[ordered]@{ sku = 'A&B-1'; quantity = 2 }
[ordered]@{ sku = 'C-2'; quantity = 1 }
)
flags = [ordered]@{ urgent = $true; reviewed = $false }
}
}
# Serialize and parse the payload without sending a request.
$result = & $solution -Payload $payload -Depth 12
# Check that quotes, ampersands, line breaks, backslashes, and Unicode survive.
if ($result.Parsed.message -ne $payload.message) { throw 'The message changed during the JSON round-trip.' }
# Check that nested arrays preserve item count and values.
if ($result.Parsed.details.items.Count -ne 2 -or $result.Parsed.details.items[0].sku -ne 'A&B-1') { throw 'Nested item data changed during the JSON round-trip.' }
# Check that a JSON Boolean remains a Boolean.
if ($result.Parsed.details.flags.urgent -ne $true) { throw 'The nested Boolean changed during the JSON round-trip.' }
# Display the exact body that could be supplied as an application/json request body.
"Content-Type: $($result.ContentType)"
"JSON body: $($result.JsonBody)"
"Round-trip: passed ($($result.CharacterCount) characters)"
'Checks: quotes, ampersand, backslash, Unicode, newline, nested arrays, nested booleans'
'Status: passed'
3. The PowerShell AI Generated
solution.ps1 is the runnable PowerShell produced from the AI-created prompt.
# Build a JSON document from data objects instead of hand-escaping JSON text.
param(
# Accept the structured request object that a caller wants to serialize.
[Parameter(Mandatory)]
[object] $Payload,
# Require a caller-visible depth so nested data is not silently truncated.
[ValidateRange(2, 100)]
[int] $Depth = 12
)
# Stop on serialization or parse errors instead of returning partial data.
$ErrorActionPreference = 'Stop'
# Convert a PowerShell object to one compact JSON document and parse it back for verification.
function ConvertTo-VerifiedJsonBody {
param(
# The object that represents the request payload.
[Parameter(Mandatory)]
[object] $InputObject,
# The explicit JSON nesting depth selected by the caller.
[Parameter(Mandatory)]
[int] $JsonDepth
)
# Serialize once with a chosen depth instead of concatenating JSON fragments.
$json = ConvertTo-Json -InputObject $InputObject -Depth $JsonDepth -Compress
# Parse as a hashtable so nested keys can be checked by name.
$roundTrip = ConvertFrom-Json -InputObject $json -AsHashtable -Depth 100
# Return both the body and parsed data so a caller can inspect the boundary.
[pscustomobject]@{
ContentType = 'application/json'
JsonBody = $json
Parsed = $roundTrip
CharacterCount = $json.Length
}
}
# Return the verified document without sending it to a network or native command.
ConvertTo-VerifiedJsonBody -InputObject $Payload -JsonDepth $Depth
A commit list is not a release note. Let Jev classify and score fictional changes, then let PowerShell keep confident customer-facing items and flag the fuzzy ones for review.
Validated
Jev + PowerShell 7 implementation · fixture and mock validated
AI found the scenario, created the prompt and runner, generated the PowerShell, ran it, and validated the result.
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into the concise prompt used to generate the PowerShell.
Use Jev question types to classify fictional commit messages as feature, fix, security, docs, or internal, and score urgency. Keep Jev's decision separate from PowerShell routing: low-confidence choices go to human review; confident user-facing changes become draft-note candidates; docs and internal changes are skipped. Default to deterministic fixture mode. Include optional Jev -Mock and live modes; live mode must require the user's own TYPESAFE_API_KEY. Never claim fixture or mock was a live call.
2. The Runner AI Created
AI created run.ps1 to prepare sample data, pass parameters, and invoke the generated PowerShell.
# Accept an explicit decision mode while keeping Fixture as the safe default.
param(
# Fixture is offline; JevMock uses only the module's local deterministic mock.
[ValidateSet('Fixture', 'JevMock', 'Live')]
[string] $Mode = 'Fixture',
# Optionally load Jev from a specific module manifest.
[string] $JevModulePath
)
# Stop on errors so an unexpected decision shape fails the validation run.
$ErrorActionPreference = 'Stop'
# Resolve the solution beside this runner.
$solution = Join-Path $PSScriptRoot 'solution.ps1'
# Build arguments without including any key or credential.
$parameters = @{ Mode = $Mode }
if ($JevModulePath) { $parameters.JevModulePath = $JevModulePath }
# Run the selected mode and keep the default path fully deterministic and local.
$results = @(& $solution @parameters)
# Display the structured routing decisions.
$results | Format-Table Id, ChangeKind, Confidence, Urgency, Action, Mode -AutoSize
# Confirm that uncertain input is held for human review.
if (($results | Where-Object Id -eq 'C-104').Action -ne 'Review') { throw 'Uncertain choices must go to Review.' }
# Confirm that customer-facing changes become draft candidates.
if (@($results | Where-Object { $_.Id -in @('C-101', 'C-102') -and $_.Action -ne 'DraftNote' }).Count -gt 0) { throw 'A user-facing change was not kept as a draft note.' }
# Confirm that documentation-only changes are skipped.
if (($results | Where-Object Id -eq 'C-103').Action -ne 'Skip') { throw 'Documentation-only changes must be skipped.' }
# Emit explicit validation checks for the chosen mode.
'Checks: typed Choice and Score answers, confidence review gate, draft-note routing, docs exclusion'
"Mode: $Mode"
if ($Mode -eq 'Fixture') { 'Mode note: no live Jev call' }
'Status: passed'
3. The PowerShell AI Generated
solution.ps1 is the runnable PowerShell produced from the AI-created prompt.
# Turn commit subjects into structured, reviewable release-note candidates.
param(
# Fixture is network-free by default; JevMock uses the current module's -Mock switch.
[ValidateSet('Fixture', 'JevMock', 'Live')]
[string] $Mode = 'Fixture',
# Permit a caller to point to a locally installed Jev module.
[string] $JevModulePath
)
# Stop on missing keys, module errors, and unexpected response shapes.
$ErrorActionPreference = 'Stop'
# Keep each synthetic commit small and free of private repository content.
$commits = @(
[pscustomobject]@{ Id = 'C-101'; Subject = 'Fix the customer invoice export date error' }
[pscustomobject]@{ Id = 'C-102'; Subject = 'Add a customer repeat-order summary feature' }
[pscustomobject]@{ Id = 'C-103'; Subject = 'Update the docs for the import option' }
[pscustomobject]@{ Id = 'C-104'; Subject = 'Reorganize a helper without changing user behavior' }
)
# Set the minimum choice confidence required before PowerShell drafts a note.
$minimumConfidence = 0.75
# Provide deterministic fixture answers that mirror Jev's named answer structure.
$fixtures = @{
'C-101' = @{ kind = 'fix'; confidence = 0.94; urgency = 1 }
'C-102' = @{ kind = 'feature'; confidence = 0.91; urgency = 0 }
'C-103' = @{ kind = 'docs'; confidence = 0.96; urgency = 0 }
'C-104' = @{ kind = 'internal'; confidence = 0.56; urgency = 0 }
}
# Load Jev and construct typed questions only for its Mock or live integration modes.
if ($Mode -in @('JevMock', 'Live')) {
# Use an explicit module path when supplied; otherwise load the user's installed module.
if ($JevModulePath) { Import-Module -Name $JevModulePath -Force -ErrorAction Stop } else { Import-Module -Name Jev -ErrorAction Stop }
# Classify commit subjects with Jev's current typed Choice question.
$kindQuestion = New-JevQuestion -Name changeKind -Type Choice -Instructions 'Which category best describes this commit subject?' -Criteria ([ordered]@{
feature = 'Adds a new capability for users.'
fix = 'Corrects a problem users can encounter.'
security = 'Improves security or access safety.'
docs = 'Changes help or documentation only.'
internal = 'Changes implementation without user-visible behavior.'
})
# Score urgency separately so the two decision fields stay inspectable.
$urgencyQuestion = New-JevQuestion -Name urgency -Type Score -Instructions 'How urgent is the user-facing impact?' -Criteria @('Routine', 'Soon', 'Urgent')
# Send both current question objects in one decision request per commit.
$questions = @($kindQuestion, $urgencyQuestion)
}
# Require the user's own key only for an intentional live request.
if ($Mode -eq 'Live' -and [string]::IsNullOrWhiteSpace($env:TYPESAFE_API_KEY)) { throw 'Live mode requires the user to set TYPESAFE_API_KEY in their own session.' }
# Evaluate every commit, then let ordinary PowerShell apply the visible routing policy.
foreach ($commit in $commits) {
# Use local fixture answers in the network-free default mode.
if ($Mode -eq 'Fixture') {
# Select the fixture for this synthetic commit.
$fixture = $fixtures[$commit.Id]
# Build named answers with the fields returned by the current Jev module.
$decision = [pscustomobject]@{
model = 'fixture'
answers = [pscustomobject]@{
changeKind = [pscustomobject]@{ type = 'choice'; choice = $fixture.kind; confidence = $fixture.confidence }
urgency = [pscustomobject]@{ type = 'score'; score = $fixture.urgency; confidence = 0.90 }
}
}
}
else {
# Send the commit state and typed questions through current Invoke-Jev.
$invoke = @{ State = $commit; Question = $questions }
# Use Jev's deterministic local mock without an API request when asked.
if ($Mode -eq 'JevMock') { $invoke.Mock = $true }
# Preserve the enriched result so the named answers and confidence remain inspectable.
$decision = Invoke-Jev @invoke
}
# Read the selected category and confidence from Jev's named structured answer.
$kindAnswer = $decision.answers.changeKind
$kind = [string] $kindAnswer.choice
$confidence = [double] $kindAnswer.confidence
# Route uncertain answers to a person before considering the category.
$action = if ($confidence -lt $minimumConfidence) { 'Review' } elseif ($kind -in @('feature', 'fix', 'security')) { 'DraftNote' } else { 'Skip' }
# Return the model result and deterministic PowerShell routing outcome.
[pscustomobject]@{
Id = $commit.Id
Subject = $commit.Subject
ChangeKind = $kind
Confidence = $confidence
Urgency = [double] $decision.answers.urgency.score
Action = $action
Mode = $Mode
}
}
Three fictional coffee blends. Six made-up orders. One workbook that shows which roasts earn repeat purchases and how much revenue they bring in.
Passed with warnings
PowerShell 7 implementation
AI found the scenario, created the prompt and runner, generated the PowerShell, ran it, and validated the result.
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into the concise prompt used to generate the PowerShell.
Analyze fictional coffee-order records by blend. Calculate order count, unique customers, repeat-order count, repeat rate, and revenue. Create an Excel workbook with Orders and Blend Summary worksheets, formatted tables, and a chart of repeat rate. Use ImportExcel; do not open Excel, use network access, or alter system settings.
2. The Runner AI Created
AI created run.ps1 to prepare sample data, pass parameters, and invoke the generated PowerShell.
solution.ps1 is the runnable PowerShell produced from the AI-created prompt.
# Analyze fictional coffee orders and create a small review workbook with ImportExcel.
param(
# Accept fictional order rows supplied by the safe runner.
[Parameter(Mandatory)]
[object[]] $Orders,
# Write only the requested workbook file.
[Parameter(Mandatory)]
[string] $OutputPath
)
# Stop if a row is malformed or the required module is unavailable.
$ErrorActionPreference = 'Stop'
# Load ImportExcel without opening Excel or contacting a remote service.
Import-Module ImportExcel -ErrorAction Stop
# Require the columns needed for calculations and workbook output.
$requiredColumns = @('OrderId', 'CustomerId', 'Blend', 'Quantity', 'UnitPrice', 'IsRepeat')
foreach ($order in $Orders) {
# Fail clearly when a sample record does not match the expected shape.
foreach ($column in $requiredColumns) {
if ($null -eq $order.PSObject.Properties[$column]) { throw "Order '$($order.OrderId)' is missing '$column'." }
}
}
# Calculate one deterministic summary row for each blend.
$summary = foreach ($group in ($Orders | Group-Object -Property Blend | Sort-Object Name)) {
# Count unique customers without using external services.
$customers = @($group.Group.CustomerId | Sort-Object -Unique)
# Count repeat orders using the supplied Boolean field.
$repeatOrders = @($group.Group | Where-Object { $_.IsRepeat }).Count
# Sum revenue by multiplying each quantity by its unit price.
$revenue = [decimal] 0
foreach ($order in $group.Group) { $revenue += [decimal] $order.Quantity * [decimal] $order.UnitPrice }
# Emit a readable row with a rate from zero through one.
[pscustomobject]@{
Blend = $group.Name
Orders = $group.Count
Customers = $customers.Count
RepeatOrders = $repeatOrders
RepeatRate = if ($group.Count -gt 0) { [math]::Round($repeatOrders / $group.Count, 4) } else { 0 }
Revenue = [math]::Round($revenue, 2)
}
}
# Define a column chart that compares repeat rates by blend.
$chart = New-ExcelChartDefinition -XRange Blend -YRange RepeatRate -Title 'Repeat order rate by blend' -ChartType ColumnClustered -NoLegend
# Export the source rows as a formatted table on the Orders worksheet.
$Orders | Export-Excel -Path $OutputPath -WorksheetName 'Orders' -TableName CoffeeOrders -AutoSize -FreezeTopRow -BoldTopRow
# Export the summary and chart on a separate worksheet.
$summary | Export-Excel -Path $OutputPath -WorksheetName 'Blend Summary' -TableName BlendSummary -ExcelChartDefinition $chart -AutoSize -FreezeTopRow -BoldTopRow -Append
# Return summary rows so the caller can read results without opening the workbook.
$summary
4. What Happened When It Ran
Captured output, errors, and exit status.
PowerShell version: 7.6.6
ImportExcel version: 7.8.10
Command: pwsh -NoProfile -NonInteractive -File ./run.ps1
=== STDOUT ===
WARNING: ImportExcel Module Cannot Autosize. Please run the following command to install dependencies:
apt-get -y update && apt-get install -y --no-install-recommends libgdiplus libc6-dev
WARNING: Auto-fitting columns is not available with this OS configuration.
WARNING: Auto-fitting columns is not available with this OS configuration.
Blend Orders Customers RepeatOrders RepeatRate Revenue
----- ------ --------- ------------ ---------- -------
Citrus Trail 2 2 1 0.50 52.00
Harbor Light 2 2 1 0.50 43.50
Night Shift 2 2 1 0.50 32.00
Workbook: <lab folder>/coffee-repeat-rates.xlsx
Status: passed
=== STDERR ===
(empty)
=== EXIT STATUS ===
0
5. Validation Performed by the AI Workflow
Runtime, expected results, and safety boundaries checked and recorded.
Validation statusPassed with warnings
Runtime
PowerShell 7.6.6
ImportExcel
7.8.10 loaded successfully
Command
pwsh -NoProfile -NonInteractive -File ./run.ps1
Exit status
0
Retested
2026-10-05
Checks
Runner completed and created the workbook in a fresh lab folder.
Reopened and verified Orders and Blend Summary worksheets.
Verified six orders, three blends, two tables, and one chart.
All repeat rates are 0.50; revenues are 52.00, 43.50, and 32.00 in blend-name order.
Both PowerShell files passed parser checks; standard error was empty.
Warnings
Automatic column sizing is unavailable in this Linux runtime. Workbook creation, tables, chart, and calculated values passed. Column widths may need adjustment locally.
Safety
Uses fictional in-memory orders and writes only the workbook beside the runner. Does not open Excel, access credentials, alter system settings, execute arbitrary input, or call a network endpoint.
This successful retest supersedes the earlier missing-module result. The lab scripts are unchanged.
A tiny four-on-the-floor drum machine, built from arrays and a seeded random groove. No audio package, no download, just a lively 16-step pattern printed in your terminal.
Validated
PowerShell 7 implementation
AI found the scenario, created the prompt and runner, generated the PowerShell, ran it, and validated the result.
1. The Prompt AI Created for This Idea
After finding the scenario, AI turned it into the concise prompt used to generate the PowerShell.
Create a deterministic PowerShell 7 terminal drum-grid showpiece. Print one 16-step bar for kick, snare, closed hat, and clap, using clear Unicode or ASCII markers. Keep it non-interactive, bounded, and in memory; do not play audio, write files, or access the network.
2. The Runner AI Created
AI created run.ps1 to prepare sample data, pass parameters, and invoke the generated PowerShell.
# Stop on errors before printing the deterministic showpiece.
$ErrorActionPreference = 'Stop'
# Resolve the solution beside this runner.
$solution = Join-Path $PSScriptRoot 'solution.ps1'
# Render one fixed-tempo bar without playing audio or writing a file.
& $solution -Bpm 104
3. The PowerShell AI Generated
solution.ps1 is the runnable PowerShell produced from the AI-created prompt.
# Print a deterministic 16-step rhythm grid using only PowerShell and in-memory arrays.
param(
# Select a safe tempo label for the printed pattern.
[ValidateRange(60, 180)]
[int] $Bpm = 104
)
# Stop on invalid input instead of printing a misleading pattern.
$ErrorActionPreference = 'Stop'
# Define one fixed bar so every run produces the same groove.
$patterns = [ordered]@{
Kick = @($true, $false, $false, $false, $true, $false, $true, $false, $true, $false, $false, $false, $true, $false, $false, $false)
Snare = @($false, $false, $false, $false, $true, $false, $false, $false, $false, $false, $false, $false, $true, $false, $false, $false)
Hat = @($true, $false, $true, $false, $true, $false, $true, $false, $true, $false, $true, $false, $true, $false, $true, $false)
Clap = @($false, $false, $false, $false, $false, $false, $true, $false, $false, $false, $false, $true, $false, $false, $false, $false)
}
# Print a compact header with four beats divided into sixteenth-note steps.
"POCKET BEAT | $Bpm BPM | 4/4 | deterministic"
# Prepare visible step labels in a single row.
$steps = 1..16 | ForEach-Object { '{0,2}' -f $_ }
"STEP " + ($steps -join ' ')
# Use distinctive markers so the rhythm reads clearly without color support.
$markers = @{ Kick = '●'; Snare = '◆'; Hat = '▪'; Clap = '✦' }
foreach ($instrument in $patterns.Keys) {
# Render a marker where the instrument plays and a centered dot where it rests.
$cells = foreach ($hit in $patterns[$instrument]) { if ($hit) { $markers[$instrument] } else { '·' } }
# Keep each instrument aligned under the same sixteen step columns.
'{0,-6} {1}' -f $instrument, ($cells -join ' ')
}
# Print a count-in cue derived from the four quarter-note positions.
'COUNT | 1 & 2 & 3 & 4 &'
'Status: passed'
Runtime, expected results, and safety boundaries checked and recorded.
Validation statusPassed
Runtime
PowerShell 7.6.6
Command
pwsh -NoProfile -File ./run.ps1
Exit status
0
Checks
The fixed 16-step pattern is deterministic and bounded.
No audio playback, file writes, network access, or system changes occur.
Safety
Uses fictional in-memory data and does not access credentials, call a network endpoint, alter system settings, or execute arbitrary input as code.
How it works
A small software factory.
01
Find
Spot a simple PowerShell idea worth trying.
02
Frame
Turn the concept into a new scenario and prompt.
03
Build
Generate a fully commented PowerShell 7 solution.
04
Run
Execute it safely and capture the evidence.
The build loop
One idea. Six useful steps.
The banner is the promise. This is the operating sequence behind each published lab: discover a small scenario, turn it into a concise prompt, generate PowerShell, run it safely, validate the evidence, and save everything together.
Build a first pass. Test it. Make it yours.
01FindSpot a useful idea
02PromptKeep the request concise
03GenerateCreate PowerShell 7
04RunUse sample data
05ValidateCheck output and safety
06PublishSave the complete lab
The through-line
Interesting problems, working examples.
The lab scans current technical conversations for approachable ideas, reframes them into original scenarios, and asks AI to make the concept concrete. The result is a small artifact you can read, copy, run, and adapt.
Everything here favors fictional or in-memory data and read-only behavior. The point is to make the idea visible without making your machine the experiment.
Stay connected
Follow along as the lab grows.
New experiments are added over time. Find Doug’s videos, projects, and builder community around the work.