$ErrorActionPreference = 'Stop'
$Root = Split-Path -Parent $PSScriptRoot
$Python = Join-Path $Root '.venv\Scripts\python.exe'
if (!(Test-Path $Python)) {
  & (Join-Path $PSScriptRoot 'setup.ps1')
}
$Sample = Get-ChildItem -LiteralPath 'C:\Users\hiiam\OneDrive\Desktop' -Filter '*MT.pdf' |
  Where-Object { $_.Name -like '*MT.pdf' } |
  Select-Object -First 1 -ExpandProperty FullName
if (!$Sample) {
  Write-Error 'Sample PDF ending with MT.pdf was not found on the Desktop.'
}
& $Python -m pdf_to_md_local.cli --input $Sample --mode auto --output-dir (Join-Path $Root 'outputs')
