Gutcheck.psm1

#Requires -Version 5.1

# Importing this module must do nothing but define functions: no diagnostics, no files,
# no console output, no prompts. Everything a Run does happens inside Invoke-Gutcheck.

$ErrorActionPreference = 'Stop'

# The one thing in the package that is not Gutcheck's own: Lantern, which asks a Run's
# questions and draws its cards. Carried as a file, so that there is still nothing to
# install beside the module. See ADR-0007.
. (Join-Path $PSScriptRoot 'Vendor\Lantern.ps1')

$private:files = @(
    Get-ChildItem -Path (Join-Path $PSScriptRoot 'Private') -Filter '*.ps1' -Recurse -File
    Get-ChildItem -Path (Join-Path $PSScriptRoot 'Public')  -Filter '*.ps1' -Recurse -File
)

foreach ($private:file in $private:files) {
    . $private:file.FullName
}

# Closes the set of Kinds a Check Definition may select from. Building a lookup table is
# not a diagnostic: nothing is examined, written or prompted for here.
Initialize-KindVocabulary

# Nor is this: Lantern is told the words and the look of a Run, and keeps them.
Initialize-Console

# What a Technician actually types. The function has to be called Invoke-Gutcheck, because
# a published module obeys verb-noun and the Gallery complains when it does not - but
# nobody standing at a Customer's machine should have to type a verb to run the one thing
# this module does. The alias is the command; Invoke-Gutcheck is its full name.
Set-Alias -Name 'gutcheck' -Value 'Invoke-Gutcheck'

Export-ModuleMember -Function 'Invoke-Gutcheck' -Alias 'gutcheck'