# Build and Test Script for GeViSoft Action Mapping Implementation # PowerShell script to build SDK Bridge and verify implementation Write-Host "========================================" -ForegroundColor Cyan Write-Host "GeViSoft Action Mapping Build & Test" -ForegroundColor Cyan Write-Host "========================================" -ForegroundColor Cyan Write-Host "" $ErrorActionPreference = "Continue" $ProjectRoot = "C:\DEV\COPILOT\geutebruck-api" # Step 1: Build SDK Bridge Write-Host "Step 1: Building SDK Bridge..." -ForegroundColor Yellow Write-Host "" Set-Location "$ProjectRoot\src\sdk-bridge\GeViScopeBridge" Write-Host " - Restoring NuGet packages..." -ForegroundColor Gray dotnet restore Write-Host " - Building in Release configuration..." -ForegroundColor Gray dotnet build --configuration Release if ($LASTEXITCODE -eq 0) { Write-Host " ✓ SDK Bridge build successful" -ForegroundColor Green } else { Write-Host " ✗ SDK Bridge build failed" -ForegroundColor Red exit 1 } Write-Host "" # Step 2: Build DiagnoseActionMapping tool Write-Host "Step 2: Building Diagnostic Tool..." -ForegroundColor Yellow Write-Host "" Set-Location "$ProjectRoot\src\sdk-bridge\DiagnoseActionMapping" Write-Host " - Restoring NuGet packages..." -ForegroundColor Gray dotnet restore Write-Host " - Building diagnostic tool..." -ForegroundColor Gray dotnet build --configuration Release if ($LASTEXITCODE -eq 0) { Write-Host " ✓ Diagnostic tool build successful" -ForegroundColor Green } else { Write-Host " ✗ Diagnostic tool build failed" -ForegroundColor Red exit 1 } Write-Host "" # Step 3: Verify Python dependencies Write-Host "Step 3: Verifying Python Dependencies..." -ForegroundColor Yellow Write-Host "" Set-Location "$ProjectRoot\src\api" Write-Host " - Checking Python version..." -ForegroundColor Gray python --version Write-Host " - Checking required packages..." -ForegroundColor Gray $packages = @("fastapi", "sqlalchemy", "alembic", "pydantic", "structlog") foreach ($package in $packages) { $installed = python -c "import $package; print($package.__version__)" 2>$null if ($installed) { Write-Host " ✓ $package installed: $installed" -ForegroundColor Green } else { Write-Host " ✗ $package not found" -ForegroundColor Red } } Write-Host "" # Step 4: Verify file creation Write-Host "Step 4: Verifying Implementation Files..." -ForegroundColor Yellow Write-Host "" $filesToCheck = @( # SDK Bridge files @{Path="$ProjectRoot\src\sdk-bridge\GeViScopeBridge\appsettings.json"; Type="Config"}, @{Path="$ProjectRoot\src\sdk-bridge\GeViScopeBridge\SDK\ActionMappingHandler.cs"; Type="SDK Handler"}, @{Path="$ProjectRoot\src\sdk-bridge\GeViScopeBridge\Services\ActionMappingService.cs"; Type="gRPC Service"}, @{Path="$ProjectRoot\src\sdk-bridge\Protos\actionmapping.proto"; Type="Proto Definition"}, # Python API files @{Path="$ProjectRoot\src\api\models\action_mapping.py"; Type="Database Model"}, @{Path="$ProjectRoot\src\api\schemas\action_mapping.py"; Type="Pydantic Schema"}, @{Path="$ProjectRoot\src\api\services\action_mapping_service.py"; Type="Service Layer"}, @{Path="$ProjectRoot\src\api\routers\action_mappings.py"; Type="API Router"}, @{Path="$ProjectRoot\src\api\migrations\versions\20251210_action_mappings.py"; Type="Migration"}, # Tools & Docs @{Path="$ProjectRoot\tools\test_action_mappings.py"; Type="Test Tool"}, @{Path="$ProjectRoot\docs\ACTION_MAPPING_IMPLEMENTATION.md"; Type="Documentation"} ) $allFilesExist = $true foreach ($file in $filesToCheck) { if (Test-Path $file.Path) { Write-Host " ✓ $($file.Type) exists" -ForegroundColor Green } else { Write-Host " ✗ $($file.Type) missing: $($file.Path)" -ForegroundColor Red $allFilesExist = $false } } if (-not $allFilesExist) { Write-Host "" Write-Host "✗ Some files are missing!" -ForegroundColor Red exit 1 } Write-Host "" # Step 5: Test SDK Bridge Configuration Write-Host "Step 5: Validating SDK Bridge Configuration..." -ForegroundColor Yellow Write-Host "" Set-Location "$ProjectRoot\src\sdk-bridge\GeViScopeBridge" $config = Get-Content "appsettings.json" | ConvertFrom-Json Write-Host " GeViScope Configuration:" -ForegroundColor Gray Write-Host " Host: $($config.GeViScope.Host)" -ForegroundColor Gray Write-Host " Username: $($config.GeViScope.Username)" -ForegroundColor Gray Write-Host " GeViSoft Configuration:" -ForegroundColor Gray Write-Host " Host: $($config.GeViSoft.Host)" -ForegroundColor Gray Write-Host " Username: $($config.GeViSoft.Username)" -ForegroundColor Gray Write-Host " gRPC Server:" -ForegroundColor Gray Write-Host " Port: $($config.GrpcServer.Port)" -ForegroundColor Gray Write-Host "" # Step 6: Summary Write-Host "========================================" -ForegroundColor Cyan Write-Host "Build & Verification Complete" -ForegroundColor Cyan Write-Host "========================================" -ForegroundColor Cyan Write-Host "" Write-Host "Next Steps:" -ForegroundColor Yellow Write-Host "" Write-Host "1. Start GeViServer (GeViSoft)" -ForegroundColor White Write-Host " - Ensure GeViServer is running on localhost" -ForegroundColor Gray Write-Host "" Write-Host "2. Run Database Migration:" -ForegroundColor White Write-Host " cd $ProjectRoot\src\api" -ForegroundColor Gray Write-Host " alembic upgrade head" -ForegroundColor Gray Write-Host "" Write-Host "3. Start SDK Bridge:" -ForegroundColor White Write-Host " cd $ProjectRoot\src\sdk-bridge\GeViScopeBridge" -ForegroundColor Gray Write-Host " dotnet run" -ForegroundColor Gray Write-Host "" Write-Host "4. Start Python API:" -ForegroundColor White Write-Host " cd $ProjectRoot\src\api" -ForegroundColor Gray Write-Host " python main.py" -ForegroundColor Gray Write-Host "" Write-Host "5. Test Implementation:" -ForegroundColor White Write-Host " cd $ProjectRoot" -ForegroundColor Gray Write-Host " python tools\test_action_mappings.py" -ForegroundColor Gray Write-Host "" Write-Host "6. Run Diagnostic Tool:" -ForegroundColor White Write-Host " cd $ProjectRoot\src\sdk-bridge\DiagnoseActionMapping" -ForegroundColor Gray Write-Host " dotnet run -- localhost sysadmin password" -ForegroundColor Gray Write-Host "" Write-Host "Documentation:" -ForegroundColor Yellow Write-Host " $ProjectRoot\docs\ACTION_MAPPING_IMPLEMENTATION.md" -ForegroundColor Gray Write-Host "" Set-Location $ProjectRoot