Public/Test-CCFilePresence.ps1

function Test-CCFilePresence {
    [CmdletBinding()]
    param(
        [Parameter(Mandatory)][string]$Path,
        [string]$Standard = 'core',
        [string]$Config
    )

    $cfg = Get-CCRepoConfig -Path $Path -Standard $Standard -ConfigFile $Config
    $disabled = $cfg['disabled_checks'] ?? @()
    $results = @()

    # Check ID mapping for required files
    $fileCheckMap = @{
        'README.md'      = 'FILE-001'
        '.gitignore'     = 'FILE-002'
        'LICENSE'        = 'FILE-003'
        'CHANGELOG.md'   = 'FILE-004'
        '.editorconfig'  = 'FILE-005'
        'CODEOWNERS'     = 'FILE-006'
    }

    foreach ($file in $cfg['files_required']) {
        $checkId = if ($fileCheckMap.ContainsKey($file)) { $fileCheckMap[$file] }
                   else { "FILE-{0:D3}" -f ($fileCheckMap.Count + 1 + $cfg['files_required'].IndexOf($file)) }

        if ($checkId -in $disabled) { continue }

        $filePath = Join-Path $Path $file
        $exists = Test-Path $filePath

        $results += New-CCRepoCheckResult -CheckId $checkId -Category 'Required Files' -Item $file `
            -Status $(if ($exists) { 'Pass' } else { 'Fail' }) `
            -Severity 'Error' `
            -Message $(if ($exists) { "$file exists" } else { "$file is missing" }) `
            -Standard $Standard `
            -FixAvailable $true `
            -FixAction "Create $file"
    }

    # Recommended files (warnings only)
    $recCheckMap = @{
        'CONTRIBUTING.md'                     = 'FILE-010'
        '.github/PULL_REQUEST_TEMPLATE.md'    = 'FILE-011'
        '.github/ISSUE_TEMPLATE/'             = 'FILE-012'
    }

    foreach ($file in $cfg['files_recommended']) {
        $checkId = if ($recCheckMap.ContainsKey($file)) { $recCheckMap[$file] }
                   else { "FILE-0{0}" -f (10 + $cfg['files_recommended'].IndexOf($file)) }

        if ($checkId -in $disabled) { continue }

        $filePath = Join-Path $Path $file
        $exists = Test-Path $filePath

        $results += New-CCRepoCheckResult -CheckId $checkId -Category 'Recommended Files' -Item $file `
            -Status $(if ($exists) { 'Pass' } else { 'Warning' }) `
            -Severity 'Warning' `
            -Message $(if ($exists) { "$file exists" } else { "$file is missing (recommended)" }) `
            -Standard $Standard `
            -FixAvailable $true `
            -FixAction "Create $file"
    }

    $results
}