fix(scripts): verify_agent_work.ps1 - remove unicode em-dashes, add cargo PATH discovery

This commit is contained in:
Mike Kell 2026-08-22 08:44:04 -04:00
parent a332b304e9
commit 2039f5ae48
1 changed files with 36 additions and 14 deletions

View File

@ -9,9 +9,32 @@ $RootDir = "$PSScriptRoot\.."
$StartTime = Get-Date $StartTime = Get-Date
$FailCount = 0 $FailCount = 0
# Locate cargo — try common install locations if not already on PATH
$CargoExe = "cargo"
if (-not (Get-Command cargo -ErrorAction SilentlyContinue)) {
$CandidatePaths = @(
"$env:USERPROFILE\.cargo\bin\cargo.exe",
"C:\Users\$env:USERNAME\.cargo\bin\cargo.exe",
"$env:LOCALAPPDATA\Programs\Rust\bin\cargo.exe"
)
foreach ($candidate in $CandidatePaths) {
if (Test-Path $candidate) {
$CargoExe = $candidate
$env:PATH = "$([System.IO.Path]::GetDirectoryName($candidate));$env:PATH"
Write-Host " INFO: Found cargo at $candidate" -ForegroundColor Yellow
break
}
}
if ($CargoExe -eq "cargo") {
Write-Host " WARN: cargo not found on PATH or common locations. Rust checks will be skipped." -ForegroundColor Yellow
Write-Host " Run this script from a terminal where 'cargo' is available." -ForegroundColor Yellow
}
}
function Write-Step { function Write-Step {
param([string]$Message) param([string]$Message)
Write-Host "`n[$([int]((Get-Date) - $StartTime).TotalSeconds)s] $Message" -ForegroundColor Cyan $elapsed = [int]((Get-Date) - $StartTime).TotalSeconds
Write-Host "`n[${elapsed}s] $Message" -ForegroundColor Cyan
} }
function Write-Pass { function Write-Pass {
@ -30,7 +53,7 @@ Write-Host " CHRONOGRID P2P - AGENT VERIFICATION PIPELINE v2" -ForegroundColor
Write-Host " $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')" -ForegroundColor Cyan Write-Host " $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')" -ForegroundColor Cyan
Write-Host "============================================================" -ForegroundColor Cyan Write-Host "============================================================" -ForegroundColor Cyan
# ── 1. chronogrid_crypto ───────────────────────────────────────────────────── # --- 1. chronogrid_crypto ---
Write-Step "1. Checking chronogrid_crypto (compile + tests)..." Write-Step "1. Checking chronogrid_crypto (compile + tests)..."
Set-Location "$RootDir\crates\chronogrid_crypto" Set-Location "$RootDir\crates\chronogrid_crypto"
@ -42,7 +65,7 @@ cargo test --quiet 2>&1
if ($LASTEXITCODE -ne 0) { Write-Fail "chronogrid_crypto tests failed" } if ($LASTEXITCODE -ne 0) { Write-Fail "chronogrid_crypto tests failed" }
else { Write-Pass "chronogrid_crypto tests pass" } else { Write-Pass "chronogrid_crypto tests pass" }
# ── 2. chronogrid_core ─────────────────────────────────────────────────────── # --- 2. chronogrid_core ---
Write-Step "2. Checking chronogrid_core (compile + tests)..." Write-Step "2. Checking chronogrid_core (compile + tests)..."
Set-Location "$RootDir\crates\chronogrid_core" Set-Location "$RootDir\crates\chronogrid_core"
@ -54,7 +77,7 @@ cargo test --quiet 2>&1
if ($LASTEXITCODE -ne 0) { Write-Fail "chronogrid_core tests failed" } if ($LASTEXITCODE -ne 0) { Write-Fail "chronogrid_core tests failed" }
else { Write-Pass "chronogrid_core tests pass" } else { Write-Pass "chronogrid_core tests pass" }
# ── 3. chronogrid_net ──────────────────────────────────────────────────────── # --- 3. chronogrid_net ---
Write-Step "3. Checking chronogrid_net (compile + tests)..." Write-Step "3. Checking chronogrid_net (compile + tests)..."
Set-Location "$RootDir\crates\chronogrid_net" Set-Location "$RootDir\crates\chronogrid_net"
@ -66,7 +89,7 @@ cargo test --quiet 2>&1
if ($LASTEXITCODE -ne 0) { Write-Fail "chronogrid_net tests failed" } if ($LASTEXITCODE -ne 0) { Write-Fail "chronogrid_net tests failed" }
else { Write-Pass "chronogrid_net tests pass" } else { Write-Pass "chronogrid_net tests pass" }
# ── 4. chronogrid_ai ───────────────────────────────────────────────────────── # --- 4. chronogrid_ai ---
Write-Step "4. Checking chronogrid_ai (compile + tests)..." Write-Step "4. Checking chronogrid_ai (compile + tests)..."
Set-Location "$RootDir\crates\chronogrid_ai" Set-Location "$RootDir\crates\chronogrid_ai"
@ -78,7 +101,7 @@ cargo test --quiet 2>&1
if ($LASTEXITCODE -ne 0) { Write-Fail "chronogrid_ai tests failed" } if ($LASTEXITCODE -ne 0) { Write-Fail "chronogrid_ai tests failed" }
else { Write-Pass "chronogrid_ai tests pass" } else { Write-Pass "chronogrid_ai tests pass" }
# ── 5. chronogrid_ffi ──────────────────────────────────────────────────────── # --- 5. chronogrid_ffi ---
Write-Step "5. Checking chronogrid_ffi (compile + tests)..." Write-Step "5. Checking chronogrid_ffi (compile + tests)..."
Set-Location "$RootDir\crates\chronogrid_ffi" Set-Location "$RootDir\crates\chronogrid_ffi"
@ -90,7 +113,7 @@ cargo test --quiet 2>&1
if ($LASTEXITCODE -ne 0) { Write-Fail "chronogrid_ffi tests failed" } if ($LASTEXITCODE -ne 0) { Write-Fail "chronogrid_ffi tests failed" }
else { Write-Pass "chronogrid_ffi tests pass" } else { Write-Pass "chronogrid_ffi tests pass" }
# ── 6. chronogrid_daemon (if scaffolded) ───────────────────────────────────── # --- 6. chronogrid_daemon (if scaffolded) ---
Write-Step "6. Checking chronogrid_daemon (if scaffolded)..." Write-Step "6. Checking chronogrid_daemon (if scaffolded)..."
$DaemonCargoToml = "$RootDir\apps\chronogrid_daemon\Cargo.toml" $DaemonCargoToml = "$RootDir\apps\chronogrid_daemon\Cargo.toml"
if (Test-Path $DaemonCargoToml) { if (Test-Path $DaemonCargoToml) {
@ -102,7 +125,7 @@ if (Test-Path $DaemonCargoToml) {
Write-Host " SKIP: chronogrid_daemon not yet scaffolded (Task 2.7)" -ForegroundColor Yellow Write-Host " SKIP: chronogrid_daemon not yet scaffolded (Task 2.7)" -ForegroundColor Yellow
} }
# ── 7. Schema Validation ───────────────────────────────────────────────────── # --- 7. Schema Validation ---
Write-Step "7. Validating schema.sql contains required tables..." Write-Step "7. Validating schema.sql contains required tables..."
$SchemaPath = "$RootDir\docs\API_CONTRACTS\schema.sql" $SchemaPath = "$RootDir\docs\API_CONTRACTS\schema.sql"
$SchemaContent = Get-Content $SchemaPath -Raw $SchemaContent = Get-Content $SchemaPath -Raw
@ -117,7 +140,6 @@ $RequiredTables = @(
"crdt_docs" "crdt_docs"
) )
# Phase 2+ tables (checked only if present — not a failure if missing pre-Phase 2)
$Phase2Tables = @( $Phase2Tables = @(
"time_blocks", "time_blocks",
"attachments", "attachments",
@ -151,7 +173,7 @@ if ($Phase2Count -eq $Phase2Tables.Count) {
Write-Host " INFO: $Phase2Count/$($Phase2Tables.Count) Phase 2 tables present (add remaining in Task 2.1)" -ForegroundColor Yellow Write-Host " INFO: $Phase2Count/$($Phase2Tables.Count) Phase 2 tables present (add remaining in Task 2.1)" -ForegroundColor Yellow
} }
# ── 8. Flutter Analysis ─────────────────────────────────────────────────────── # --- 8. Flutter Analysis ---
Write-Step "8. Checking Flutter shell (analyze)..." Write-Step "8. Checking Flutter shell (analyze)..."
$FlutterDir = "$RootDir\apps\chronogrid_flutter" $FlutterDir = "$RootDir\apps\chronogrid_flutter"
if (Test-Path "$FlutterDir\pubspec.yaml") { if (Test-Path "$FlutterDir\pubspec.yaml") {
@ -166,7 +188,7 @@ if (Test-Path "$FlutterDir\pubspec.yaml") {
Write-Fail "Flutter pubspec.yaml not found at $FlutterDir" Write-Fail "Flutter pubspec.yaml not found at $FlutterDir"
} }
# ── 9. FRB Codegen Output Check ─────────────────────────────────────────────── # --- 9. FRB Codegen Output Check ---
Write-Step "9. Checking FRB codegen output (if generated)..." Write-Step "9. Checking FRB codegen output (if generated)..."
$FrbGenerated = "$RootDir\crates\chronogrid_ffi\src\frb_generated.rs" $FrbGenerated = "$RootDir\crates\chronogrid_ffi\src\frb_generated.rs"
$DartGenerated = "$RootDir\apps\chronogrid_flutter\lib\src\rust\frb_generated.dart" $DartGenerated = "$RootDir\apps\chronogrid_flutter\lib\src\rust\frb_generated.dart"
@ -183,7 +205,7 @@ if (Test-Path $DartGenerated) {
Write-Host " INFO: frb_generated.dart not yet generated (run: flutter_rust_bridge_codegen generate)" -ForegroundColor Yellow Write-Host " INFO: frb_generated.dart not yet generated (run: flutter_rust_bridge_codegen generate)" -ForegroundColor Yellow
} }
# ── 10. DECISION_LOG.md Check ──────────────────────────────────────────────── # --- 10. DECISION_LOG.md Check ---
Write-Step "10. Checking DECISION_LOG.md is present and non-empty..." Write-Step "10. Checking DECISION_LOG.md is present and non-empty..."
$DecisionLog = "$RootDir\DECISION_LOG.md" $DecisionLog = "$RootDir\DECISION_LOG.md"
if (Test-Path $DecisionLog) { if (Test-Path $DecisionLog) {
@ -191,13 +213,13 @@ if (Test-Path $DecisionLog) {
if ($LogSize -gt 500) { if ($LogSize -gt 500) {
Write-Pass "DECISION_LOG.md present ($LogSize bytes)" Write-Pass "DECISION_LOG.md present ($LogSize bytes)"
} else { } else {
Write-Fail "DECISION_LOG.md is suspiciously small ($LogSize bytes) — may be empty" Write-Fail "DECISION_LOG.md is suspiciously small ($LogSize bytes) - may be empty"
} }
} else { } else {
Write-Fail "DECISION_LOG.md not found" Write-Fail "DECISION_LOG.md not found"
} }
# ── Summary ─────────────────────────────────────────────────────────────────── # --- Summary ---
$Elapsed = [int]((Get-Date) - $StartTime).TotalSeconds $Elapsed = [int]((Get-Date) - $StartTime).TotalSeconds
Write-Host "`n============================================================" -ForegroundColor Cyan Write-Host "`n============================================================" -ForegroundColor Cyan