Files
claudetools/copy-to-nas-now.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

101 lines
3.9 KiB
PowerShell

# Manually copy fixed BAT files from AD2 to NAS immediately
$password = ConvertTo-SecureString "Paper123!@#" -AsPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential("INTRANET\sysadmin", $password)
Write-Host "=== Copying BAT Files to NAS ===" -ForegroundColor Cyan
Write-Host ""
Invoke-Command -ComputerName 192.168.0.6 -Credential $cred -ScriptBlock {
$SCP = "C:\Program Files\OpenSSH\scp.exe"
$NAS_IP = "192.168.0.9"
$NAS_USER = "admin"
Write-Host "[1] Copying root-level BAT files to NAS" -ForegroundColor Yellow
Write-Host "=" * 80 -ForegroundColor Gray
$rootFiles = @(
"DEPLOY.BAT",
"NWTOC.BAT",
"CTONW.BAT",
"UPDATE.BAT",
"STAGE.BAT",
"CHECKUPD.BAT",
"REBOOT.BAT",
"DOSTEST.BAT"
)
$successCount = 0
$errorCount = 0
foreach ($file in $rootFiles) {
$localPath = "C:\Shares\test\$file"
$remotePath = "/volume1/test/$file"
if (Test-Path $localPath) {
Write-Host "Copying $file..." -ForegroundColor Cyan
$result = & $SCP -o StrictHostKeyChecking=accept-new -o UserKnownHostsFile="C:\Shares\test\scripts\.ssh\known_hosts" -o PreferredAuthentications=password -o PubkeyAuthentication=no -o PasswordAuthentication=yes $localPath "${NAS_USER}@${NAS_IP}:$remotePath" 2>&1
if ($LASTEXITCODE -eq 0) {
Write-Host " [OK] $file" -ForegroundColor Green
$successCount++
} else {
Write-Host " [ERROR] $file - $result" -ForegroundColor Red
$errorCount++
}
} else {
Write-Host " [SKIP] $file - not found" -ForegroundColor Yellow
}
}
Write-Host ""
Write-Host "[2] Creating COMMON/DOS directory on NAS" -ForegroundColor Yellow
Write-Host "=" * 80 -ForegroundColor Gray
# SSH to NAS and create directory
$SSH = "C:\Program Files\OpenSSH\ssh.exe"
$mkdirResult = & $SSH -o StrictHostKeyChecking=accept-new -o UserKnownHostsFile="C:\Shares\test\scripts\.ssh\known_hosts" -o PreferredAuthentications=password -o PubkeyAuthentication=no -o PasswordAuthentication=yes "${NAS_USER}@${NAS_IP}" "mkdir -p /volume1/test/COMMON/DOS" 2>&1
if ($LASTEXITCODE -eq 0) {
Write-Host "[OK] Directory created/verified" -ForegroundColor Green
} else {
Write-Host "[WARNING] Directory creation: $mkdirResult" -ForegroundColor Yellow
}
Write-Host ""
Write-Host "[3] Copying DOS system files to NAS" -ForegroundColor Yellow
Write-Host "=" * 80 -ForegroundColor Gray
$dosFiles = @("AUTOEXEC.BAT", "STARTNET.BAT")
foreach ($file in $dosFiles) {
$localPath = "C:\Shares\test\COMMON\DOS\$file"
$remotePath = "/volume1/test/COMMON/DOS/$file"
if (Test-Path $localPath) {
Write-Host "Copying $file..." -ForegroundColor Cyan
$result = & $SCP -o StrictHostKeyChecking=accept-new -o UserKnownHostsFile="C:\Shares\test\scripts\.ssh\known_hosts" -o PreferredAuthentications=password -o PubkeyAuthentication=no -o PasswordAuthentication=yes $localPath "${NAS_USER}@${NAS_IP}:$remotePath" 2>&1
if ($LASTEXITCODE -eq 0) {
Write-Host " [OK] $file" -ForegroundColor Green
$successCount++
} else {
Write-Host " [ERROR] $file - $result" -ForegroundColor Red
$errorCount++
}
} else {
Write-Host " [SKIP] $file - not found" -ForegroundColor Yellow
}
}
Write-Host ""
Write-Host "=" * 80 -ForegroundColor Gray
Write-Host "Summary: $successCount successful, $errorCount errors" -ForegroundColor Cyan
}
Write-Host ""
Write-Host "=== Copy Complete ===" -ForegroundColor Cyan
Write-Host "[INFO] Files are now available on NAS at /volume1/test/" -ForegroundColor Green
Write-Host "[INFO] DOS machines can access via T:\ drive" -ForegroundColor Green