iFacto.AICodeReview.psm1

#Requires -Version 7.0

<#
.SYNOPSIS
AICodeReview PowerShell Module - Model-agnostic AI code review for Business Central (AL) development
 
.DESCRIPTION
This module provides AI-powered code review capabilities for Azure DevOps pipelines.
It supports multiple AI providers (Azure AI Foundry, Claude, OpenAI, GitHub Models) through
a unified, configuration-driven interface.
 
.NOTES
Author: iFacto Team
Version: 0.1.0
Module: iFacto.AICodeReview
#>


# Get public and private function definition files
$publicFunctions = @(Get-ChildItem -Path $PSScriptRoot\Public\*.ps1 -ErrorAction SilentlyContinue)
$privateFunctions = @(Get-ChildItem -Path $PSScriptRoot\Private\*.ps1 -ErrorAction SilentlyContinue)

# Dot source the files
foreach ($import in @($publicFunctions + $privateFunctions)) {
    try {
        Write-Verbose "Importing $($import.FullName)"
        . $import.FullName
    }
    catch {
        Write-Error "Failed to import function $($import.FullName): $_"
        throw
    }
}

# Export public functions (defined in manifest FunctionsToExport)
Export-ModuleMember -Function $publicFunctions.BaseName

Write-Verbose "AICodeReview module loaded successfully. Available functions: $($publicFunctions.BaseName -join ', ')"