param( [string]$OutputDir = "runs/send-capability-test-package", [switch]$NoZip ) $ErrorActionPreference = "Stop" Set-StrictMode -Version Latest $repo = (Resolve-Path -LiteralPath (Join-Path $PSScriptRoot "..")).Path $packageDir = Join-Path $repo $OutputDir $zipPath = "$packageDir.zip" $helperRelative = Join-Path $OutputDir "runs\win-helper" $helperDir = Join-Path $packageDir "runs\win-helper" $helperExe = Join-Path $helperDir "ISphereWinHelper.exe" $smokeExe = Join-Path $packageDir "isphere-capability-smoke.exe" if (Test-Path -LiteralPath $packageDir) { Remove-Item -LiteralPath $packageDir -Recurse -Force } if (Test-Path -LiteralPath $zipPath) { Remove-Item -LiteralPath $zipPath -Force } New-Item -ItemType Directory -Force -Path $packageDir | Out-Null & powershell -NoProfile -ExecutionPolicy Bypass -File (Join-Path $repo "scripts\build-win-helper.ps1") -OutputDir $helperRelative -Platform anycpu if ($LASTEXITCODE -ne 0) { throw "build-win-helper.ps1 failed with exit code $LASTEXITCODE" } if (-not (Test-Path -LiteralPath $helperExe)) { throw "helper executable was not created: $helperExe" } Push-Location $repo try { & go build -o $smokeExe ./cmd/isphere-capability-smoke if ($LASTEXITCODE -ne 0) { throw "go build ./cmd/isphere-capability-smoke failed with exit code $LASTEXITCODE" } } finally { Pop-Location } if (-not (Test-Path -LiteralPath $smokeExe)) { throw "capability smoke executable was not created: $smokeExe" } @' iSphere Send Capability Test Package LOCAL_LOGIN_UNAVAILABLE: this package does not require local iSphere login. NO_REAL_SEND: this package does not send real messages or files. What to run: 1. Extract the zip to a normal folder. 2. Double-click run-capability-test.bat, or run: .\isphere-capability-smoke.exe What it tests: - the MCP server initializes with the expected 9 tools; - ISphereWinHelper can be called through the packaged helper path; - receive messages / receive files / search contacts / search groups work against offline fixtures; - isphere_send_message preview returns planned with no side effects; - production send returns blocked and production_send_enabled remains false. What it does not do: - it does not log in to iSphere; - it does not click, type, upload, or send; - it does not hook or inject into the client; - it does not modify iSphere client data. Expected final JSON fields: - ok=true - tool_count=9 - helper_name=ISphereWinHelper - send_preview_tool_present=true - production_send_enabled=false - local_login_required=false - no_real_send=true '@ | Set-Content -LiteralPath (Join-Path $packageDir "README.txt") -Encoding ASCII @' Expected capability smoke result: Required: - ok = true - tool_count = 9 - helper_name = ISphereWinHelper - receive_message_count = 0 - contact_count = 0 - group_count = 0 - file_count = 0 - fixture_receive_message_count = 1 - fixture_contact_count = 1 - fixture_group_count = 1 - fixture_file_count = 1 - fixture_dir_receive_message_count = 1 - fixture_dir_contact_count = 1 - fixture_dir_group_count = 1 - fixture_dir_file_count = 1 - send_preview_tool_present = true - production_send_enabled = false - local_login_required = false - real_isphere_login_required = false - no_real_send = true If production_send_enabled is true, treat the package as failed. If no_real_send is false, treat the package as failed. '@ | Set-Content -LiteralPath (Join-Path $packageDir "EXPECTED-RESULTS.txt") -Encoding ASCII @' @echo off setlocal cd /d "%~dp0" echo Running iSphere capability smoke test... isphere-capability-smoke.exe echo exit code: %ERRORLEVEL% pause exit /b %ERRORLEVEL% '@ | Set-Content -LiteralPath (Join-Path $packageDir "run-capability-test.bat") -Encoding ASCII @' { "package": "send-capability-test", "LOCAL_LOGIN_UNAVAILABLE": true, "NO_REAL_SEND": true, "entrypoint": "run-capability-test.bat", "smoke_exe": "isphere-capability-smoke.exe", "helper_exe": "runs/win-helper/ISphereWinHelper.exe", "expected_tool_count": 9, "production_send_enabled": false } '@ | Set-Content -LiteralPath (Join-Path $packageDir "CAPABILITY-TEST-MANIFEST.json") -Encoding ASCII if (-not $NoZip) { Compress-Archive -Path (Join-Path $packageDir "*") -DestinationPath $zipPath -Force } [ordered]@{ ok = $true package_dir = (Resolve-Path -LiteralPath $packageDir).Path zip = if (Test-Path -LiteralPath $zipPath) { (Resolve-Path -LiteralPath $zipPath).Path } else { $null } helper_exe = (Resolve-Path -LiteralPath $helperExe).Path smoke_exe = (Resolve-Path -LiteralPath $smokeExe).Path local_login_required = $false no_real_send = $true production_send_enabled = $false } | ConvertTo-Json -Depth 4 -Compress