DevXToolkit.psm1

# DevXToolkit.psm1
# Root module for the migrated flat src/core layout.

$privateFiles = @(
    "Common.ps1"
    "Paths.ps1"
    "Output.ps1"
    "TemplatesStore.ps1"
    "Metadata.ps1"
    "Cleanup-DevXToolkit.ps1"
)

$publicFiles = @(
    "Files.ps1"
    "Python.ps1"
    "PowerShell.ps1"
    "Templates.ps1"
    "Introspection.ps1"
    "Lifecycle.ps1"
    "Invoke-MkReadme.ps1"
    "Invoke-MkProj.ps1"
    "Invoke-MkLicense.ps1"
    "Invoke-MkDocs.ps1"
    "Invoke-MkConfig.ps1"
    "Invoke-MkCi.ps1"
    "Invoke-MkVenv.ps1"
    "Invoke-DevCleanup.ps1"
    "New-DevProject.ps1"
    "New-DevConfig.ps1"
    "New-DevBootstrap.ps1"
    "New-DevEnvironment.ps1"
)

foreach ($file in $privateFiles + $publicFiles) {
    $path = Join-Path $PSScriptRoot $file
    if (Test-Path -LiteralPath $path) {
        . $path
    }
}

function mni {
    param(
        [Parameter(Mandatory = $true)]
        [string]$Path
    )

    $fullPath = Resolve-Path -LiteralPath $Path -ErrorAction SilentlyContinue
    if (-not $fullPath) {
        $fullPath = Join-Path (Get-Location) $Path
    }

    $directory = Split-Path $fullPath -Parent
    if (-not (Test-Path $directory)) {
        New-Item -ItemType Directory -Path $directory -Force | Out-Null
    }

    if (-not (Test-Path $fullPath)) {
        New-Item -ItemType File -Path $fullPath -Force | Out-Null
    }

    code $fullPath
}

function Get-DevCommands {
    @(
        'mni - Make New Item (create file + open in VS Code)'
        'Get-DevCommands - List available DevXToolkit commands'
        'Show-DevHelp - Display help information'
    )
}

function Show-DevHelp {
@"
DevXToolkit — Basic Commands
 
mni <path>
    Creates a new file (and directories if needed) and opens it in VS Code.
 
Get-DevCommands
    Lists all available DevXToolkit commands.
 
Show-DevHelp
    Displays this help text.
"@

}