Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ jobs:
Install-Module Pester -MinimumVersion 5.0 -Force -Scope CurrentUser
}

- name: Install PSFramework
shell: pwsh
run: |
if (-not (Get-Module PSFramework -ListAvailable | Where-Object Version -ge '1.0.0')) {
Install-Module PSFramework -MinimumVersion 1.0.0 -Force -Scope CurrentUser
}

- name: Run Pester tests
shell: pwsh
run: |
Expand Down
4 changes: 3 additions & 1 deletion PasskeyDiagnostics/PasskeyDiagnostics.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ PowerShellVersion = '7.0'
# ProcessorArchitecture = ''

# Modules that must be imported into the global environment prior to importing this module
# RequiredModules = @()
RequiredModules = @(
@{ ModuleName = 'PSFramework'; ModuleVersion = '1.0.0' }
)

# Assemblies that must be loaded prior to importing this module
# RequiredAssemblies = @()
Expand Down
54 changes: 50 additions & 4 deletions PasskeyDiagnostics/PasskeyDiagnostics.psm1
Original file line number Diff line number Diff line change
@@ -1,14 +1,60 @@
#Requires -Version 7.0
#Requires -Modules PSFramework
# PasskeyDiagnostics.psm1
# Placeholder — replace with your implementation.
# This file is loaded automatically by the module manifest.

# Example export (remove when providing the real implementation):
# ---------------------------------------------------------------------------
# Module configuration (PSFramework)
# ---------------------------------------------------------------------------
Set-PSFConfig -Module 'PasskeyDiagnostics' -Name 'LogLevel' `
-Value 'Verbose' `
-Description 'Minimum message level written to the PSFramework log provider.' `
-Initialize -Validation string

# ---------------------------------------------------------------------------
# Public functions
# ---------------------------------------------------------------------------

function Get-PasskeyDiagnosticInfo {
<#
.SYNOPSIS
Returns diagnostic information about the PasskeyDiagnostics module and
the current PowerShell environment.

.DESCRIPTION
Collects version and platform information useful when troubleshooting
passkey/WebAuthn issues. All progress messages are routed through
Write-PSFMessage so they appear in the structured PSFramework log as
well as the standard Verbose stream.

.EXAMPLE
PS> Get-PasskeyDiagnosticInfo

Returns a PSCustomObject with ModuleVersion, PSVersion, and Platform.
#>
[CmdletBinding()]
[OutputType([PSCustomObject])]
param()

Write-Output 'PasskeyDiagnostics module loaded. Replace this placeholder with the real implementation.'
Write-PSFMessage -Level Verbose -Message 'Gathering passkey diagnostic information.'

$moduleInfo = Get-Module PasskeyDiagnostics -ErrorAction SilentlyContinue

if (-not $moduleInfo) {
Stop-PSFFunction -Message 'PasskeyDiagnostics module is not loaded; cannot retrieve version.' `
-EnableException $false
return
}

$result = [PSCustomObject]@{
ModuleVersion = $moduleInfo.Version.ToString()
PSVersion = $PSVersionTable.PSVersion.ToString()
Platform = $PSVersionTable.Platform
OS = $PSVersionTable.OS
}

Write-PSFMessage -Level Verbose -Message "Collected diagnostics: PSVersion=$($result.PSVersion), Platform=$($result.Platform)"

$result
}

Export-ModuleMember -Function 'Get-PasskeyDiagnosticInfo'
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,23 @@ Import-Module PasskeyDiagnostics

# List available commands
Get-Command -Module PasskeyDiagnostics

# Collect passkey diagnostic information
Get-PasskeyDiagnosticInfo

# View structured log messages captured by PSFramework
Get-PSFMessage
```

PSFramework routes all module messages through its structured logging infrastructure. Use `Get-PSFMessage` to inspect the in-memory log and configure logging providers (file, event log, etc.) via `Set-PSFLoggingProvider`.

### Development

#### Prerequisites

- PowerShell 7+
- [Pester](https://pester.dev) 5.x (`Install-Module Pester -MinimumVersion 5.0 -Scope CurrentUser`)
- [PSFramework](https://psframework.org) 1.x (`Install-Module PSFramework -MinimumVersion 1.0.0 -Scope CurrentUser`)

#### Running tests

Expand Down
34 changes: 34 additions & 0 deletions tests/PasskeyDiagnostics.Tests.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#Requires -Modules @{ ModuleName = 'Pester'; ModuleVersion = '5.0' }
#Requires -Modules @{ ModuleName = 'PSFramework'; ModuleVersion = '1.0.0' }

BeforeAll {
$modulePath = Join-Path $PSScriptRoot '..' 'PasskeyDiagnostics' 'PasskeyDiagnostics.psd1'
Expand All @@ -20,5 +21,38 @@ Describe 'PasskeyDiagnostics module' {
$commands = Get-Command -Module PasskeyDiagnostics
$commands | Should -Not -BeNullOrEmpty
}

It 'PSFramework is available as a dependency' {
Get-Module PSFramework -ListAvailable | Should -Not -BeNullOrEmpty
}
}

Context 'Get-PasskeyDiagnosticInfo' {
It 'returns a result object' {
$result = Get-PasskeyDiagnosticInfo
$result | Should -Not -BeNullOrEmpty
}

It 'result includes ModuleVersion' {
$result = Get-PasskeyDiagnosticInfo
$result.ModuleVersion | Should -Not -BeNullOrEmpty
}

It 'result includes PSVersion' {
$result = Get-PasskeyDiagnosticInfo
$result.PSVersion | Should -Not -BeNullOrEmpty
}
}

Context 'PSFramework configuration' {
It 'registers PasskeyDiagnostics.LogLevel config entry' {
$config = Get-PSFConfig -Module PasskeyDiagnostics -Name LogLevel
$config | Should -Not -BeNullOrEmpty
}

It 'PasskeyDiagnostics.LogLevel defaults to Verbose' {
$value = Get-PSFConfigValue -FullName 'PasskeyDiagnostics.LogLevel'
$value | Should -Be 'Verbose'
}
}
}
Loading