- Follow PowerShell best practices for error handling, logging, and documentation
- All code must execute with
$ErrorActionPreference = 'Stop'and$PSNativeCommandUseErrorActionPreference = $true - Use
Write-Debugfor debug information ($DebugPreference = 'Continue'to enable) - Use
Write-Warningfor important warnings
- Always use
Assert-DeviceSessionbefore device operations - Use consistent error messages: "No active device session" for session validation failures
- Mark unimplemented features with
# TODO: Implement <functionality>
- Only one device session active at a time
- Auto-disconnect when connecting to a new platform
- All functions must validate session before executing
Run tests before committing (needs to run in a new shell to avoid caching the module):
# Run all tests (device tests automatically skip if SDKs not available)
pwsh -c 'Invoke-Pester -Path ./app-runner/Tests/ -Output Detailed'
# Run only unit tests (excluding device integration tests)
pwsh -c 'Invoke-Pester -Path ./app-runner/Tests/ -ExcludeTag "RequiresDevice" -Output Detailed'
# Run device tests for specific platform (requires SDK installed)
pwsh -c 'Invoke-Pester -Path ./app-runner/Tests/Device.Tests.ps1 -TagFilter "Xbox" -Output Detailed'Device integration tests (Device.Tests.ps1) automatically detect SDK availability:
- Xbox: Requires
$env:GameDKset orxbconnect.exein PATH - PlayStation5: Requires
$env:SCE_ROOT_DIRset orprospero-ctrl.exein PATH - Switch: Requires
$env:NINTENDO_SDK_ROOTset orControlTarget.exein PATH
If no SDKs are detected, device tests are automatically skipped with a warning. This allows:
- CI to run without platform SDKs installed
- Developers to run tests locally with only the SDKs they have access to
- Full platform coverage when all SDKs are available
All tests must pass before committing.
# Run PSScriptAnalyzer
Invoke-ScriptAnalyzer -Path ./app-runner -Recurse -Settings ./PSScriptAnalyzerSettings.psd1- Keep changes focused and small
- Include tests for new functionality
- Ensure CI passes (unit tests, integration tests, PSScriptAnalyzer)
- Update documentation if needed