Skip to content

Latest commit

 

History

History
70 lines (58 loc) · 5.25 KB

File metadata and controls

70 lines (58 loc) · 5.25 KB

GenXdev.Helpers

Overview

GenXdev.Helpers provides general helpers that don't fit any of the other categories. Mockable Spectre.Console terminal UI integration, LLM tool-call execution, JSON Schema example generation, NuGet assembly loading, file output formatting with hyperlinks, module import utilities, and user consent management.

What It Offers

Command Aliases What it does
Invoke-SpectrePrompt Display a Spectre.Console selection or input prompt
Invoke-SpectreAsk Prompt for text input via Spectre.Console
Invoke-SpectreConfirm Display a yes/no confirmation dialog
Write-SpectreMarkupLine Write Spectre.Console markup-formatted output
ConvertTo-LLMOpenAIApiFunctionDefinition Convert a PowerShell function to an OpenAI tool definition
Invoke-CommandFromToolCall Execute a validated LLM tool call as a PowerShell command
Get-LLMJsonOutput Extract valid JSON from LLM response text
Get-JsonExampleFromSchema Generate example JSON from a JSON Schema
ResolveInputObjectFileNames Expand pipeline input into resolved file/directory paths
Import-GenXdevModules reloadgenxdev Import all GenXdev modules into the global scope
Invoke-OnEachGenXdevModule foreach-genxdev-module-do Run a script block against every GenXdev module
EnsureNuGetAssembly Download and load .NET assemblies from NuGet
EnsureGenXdev Ensure all GenXdev modules are loaded
Confirm-InstallationConsent Prompt for and persist third-party installation consent
Show-Verb showverbs Display all approved PowerShell verbs
WriteFileOutput Output file paths as clickable terminal hyperlinks

How It All Comes Together

The Spectre.Console cmdlets (Invoke-SpectrePrompt, Invoke-SpectreAsk, Invoke-SpectreConfirm, Write-SpectreMarkupLine, Write-SpectreLine) provide terminal UI prompts and markup-formatted output.

ConvertTo-LLMOpenAIApiFunctionDefinition converts a PowerShell function into an OpenAI-compatible tool definition. Invoke-CommandFromToolCall executes a validated LLM tool call as a PowerShell command. Get-LLMJsonOutput extracts valid JSON from LLM response text that may contain markdown fences or other non-JSON content.

ResolveInputObjectFileNames expands pipeline input into resolved file and directory paths. WriteFileOutput outputs file paths as clickable terminal hyperlinks.

Import-GenXdevModules (reloadgenxdev) imports all GenXdev modules. Invoke-OnEachGenXdevModule (foreach-genxdev-module-do) runs a script block against each GenXdev module. EnsureGenXdev ensures all GenXdev modules are loaded. EnsureNuGetAssembly downloads and loads .NET assemblies from NuGet packages.

Get-JsonExampleFromSchema generates an example JSON string from a JSON Schema definition. Get-AIDefaultLLMSettings returns available default LLM settings. Get-PowerShellRoot returns the PowerShell workspace root path. Show-Verb (showverbs) lists approved PowerShell verbs. Confirm-InstallationConsent prompts for and persists third-party installation consent. Assert-RefactorFile executes a refactoring operation on a source file. Approve-NewTextFileContent provides interactive file content comparison and approval using WinMerge. Test-RefactorLLMSelection evaluates source files for refactoring eligibility using LLM analysis. GenerateMasonryLayoutHtml generates a responsive masonry layout HTML gallery from image data.

See Also