Files
claudetools/verify-error-logging.ps1
Mike Swanson b87e97d3ba feat: Add directives system and DOS management utilities
Implemented comprehensive directives system for agent coordination:
- Created directives.md (590 lines) - Core operational rules defining
  coordinator vs executor roles, agent delegation patterns, and coding
  standards (NO EMOJIS, ASCII markers only)
- Added DIRECTIVES_ENFORCEMENT.md - Documentation of enforcement
  mechanisms and checklist for validating compliance
- Created refresh-directives command - Allows reloading directives
  after Gitea updates without restarting Claude Code
- Updated checkpoint and save commands to verify directives compliance
- Updated .claude/claude.md to mandate reading directives.md first

Added DOS system management PowerShell utilities:
- check-bat-on-nas.ps1 - Verify BAT files on NAS match source
- check-latest-errors.ps1 - Scan DOS error logs for recent issues
- check-plink-references.ps1 - Find plink.exe usage in scripts
- check-scp-errors.ps1 - Analyze SCP transfer errors
- check-sync-log.ps1 (modified) - Enhanced sync log analysis
- check-sync-status.ps1 - Monitor sync process status
- copy-to-nas-now.ps1 - Manual NAS file deployment
- find-error-logging.ps1 - Locate error logging patterns
- fix-copy-tonas-logging.ps1 - Repair logging in copy scripts
- fix-dos-files.ps1 - Batch DOS file corrections
- fix-line-break.ps1 - Fix line ending issues
- fix-plink-usage.ps1 - Modernize plink.exe to WinRM
- push-fixed-bat-files.ps1 - Deploy corrected BAT files
- run-sync-direct.ps1 - Direct sync execution
- test-error-logging.ps1 - Validate error logging functionality
- trigger-sync-push.ps1 - Initiate sync push operations
- verify-error-logging.ps1 - Confirm error logging working
- scripts/fix-ad2-error-logging.ps1 - Fix AD2 error logging

Added Gitea password management scripts:
- Reset-GiteaPassword.ps1 - Windows PowerShell password reset
- reset-gitea-password.sh - Unix shell password reset

Key architectural decisions:
- Directives system establishes clear separation between Main Claude
  (coordinator) and specialized agents (executors)
- DOS utilities modernize legacy plink.exe usage to WinRM
- Error logging enhancements improve troubleshooting capabilities
- All scripts follow PSScriptAnalyzer standards

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-19 15:52:28 -07:00

74 lines
3.0 KiB
PowerShell

# Verify the error logging is working and check where generic errors come from
$password = ConvertTo-SecureString "Paper123!@#" -AsPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential("INTRANET\sysadmin", $password)
Invoke-Command -ComputerName 192.168.0.6 -Credential $cred -ScriptBlock {
$scriptPath = "C:\Shares\test\scripts\Sync-FromNAS.ps1"
$content = Get-Content $scriptPath
Write-Host "=== Verification Check ===" -ForegroundColor Cyan
Write-Host ""
Write-Host "[1] Copy-ToNAS function (lines 82-97)" -ForegroundColor Yellow
Write-Host "=" * 80 -ForegroundColor Gray
for ($i = 81; $i -le 96; $i++) {
if ($content[$i] -match 'SCP PUSH ERROR') {
Write-Host "$($i+1): $($content[$i])" -ForegroundColor Green
} else {
Write-Host "$($i+1): $($content[$i])" -ForegroundColor Gray
}
}
Write-Host ""
Write-Host "[2] Generic error logging locations" -ForegroundColor Yellow
Write-Host "=" * 80 -ForegroundColor Gray
$genericErrorLines = @()
for ($i = 0; $i -lt $content.Count; $i++) {
if ($content[$i] -match 'Write-Log.*ERROR: Failed to push') {
$genericErrorLines += $i
Write-Host "Line $($i+1): $($content[$i])" -ForegroundColor Red
}
}
Write-Host ""
Write-Host "[3] Analysis" -ForegroundColor Yellow
Write-Host "=" * 80 -ForegroundColor Gray
if ($genericErrorLines.Count -gt 0) {
Write-Host "[FOUND] $($genericErrorLines.Count) generic error logging location(s)" -ForegroundColor Yellow
Write-Host ""
Write-Host "These generic errors are logged by the CALLING CODE," -ForegroundColor Yellow
Write-Host "which happens AFTER Copy-ToNAS returns false." -ForegroundColor Yellow
Write-Host ""
Write-Host "The detailed SCP errors should appear BEFORE the generic errors." -ForegroundColor Cyan
Write-Host "Example expected log sequence:" -ForegroundColor Gray
Write-Host " SCP PUSH ERROR (exit 1): scp: /data/test/path: Permission denied" -ForegroundColor Red
Write-Host " ERROR: Failed to push filename.dat" -ForegroundColor Red
}
Write-Host ""
Write-Host "[4] Recent error examples from log" -ForegroundColor Yellow
Write-Host "=" * 80 -ForegroundColor Gray
$logFile = "C:\Shares\test\scripts\sync-from-nas.log"
$recentErrors = Get-Content $logFile -Tail 1000 | Where-Object {
$_ -match "Failed to push.*hvin\.dat" -or $_ -match "Failed to push.*hvsort\.dat" -or $_ -match "SCP PUSH ERROR"
}
if ($recentErrors) {
$recentErrors | Select-Object -Last 10 | ForEach-Object {
if ($_ -match "SCP PUSH ERROR") {
Write-Host $_ -ForegroundColor Green
} else {
Write-Host $_ -ForegroundColor Red
}
}
} else {
Write-Host "[INFO] No relevant errors found in recent log" -ForegroundColor Yellow
}
}
Write-Host ""
Write-Host "=== Verification Complete ===" -ForegroundColor Cyan