CodeCompass.Release.psm1

Set-StrictMode -Version Latest
$ErrorActionPreference = 'Stop'

# Load the bundled CodeCompass.Core .NET library (and its dependencies) from ./lib.
# Populate ./lib by running build.ps1 (also done automatically by CI before publish).
$libPath = Join-Path $PSScriptRoot 'lib'
if (-not (Test-Path (Join-Path $libPath 'CodeCompass.Core.dll'))) {
    throw "CodeCompass.Core.dll not found in '$libPath'. Run build.ps1 to bundle the Core library."
}
foreach ($dll in Get-ChildItem -Path $libPath -Filter '*.dll') {
    Add-Type -Path $dll.FullName
}

# Dot-source and export the public functions.
$public = @(Get-ChildItem -Path (Join-Path $PSScriptRoot 'Public') -Filter '*.ps1' -ErrorAction SilentlyContinue)
foreach ($file in $public) {
    . $file.FullName
}
Export-ModuleMember -Function $public.BaseName