← Files Cache StatsARCHIVED FILE
skills/cache-stats/scripts/status-cache-stats.ps1
1.37 KB · Oct 4, 2026 · 12:30 UTC
[CmdletBinding()]
param(
[string]$InstallRoot = (Join-Path $env:LOCALAPPDATA 'OpenAI\CacheStats'),
[string]$ConfigPath = (Join-Path $(if ($env:CODEX_HOME) { $env:CODEX_HOME } else { Join-Path $env:USERPROFILE '.codex' }) 'config.toml')
)
$ErrorActionPreference = 'Stop'
$receiptPath = Join-Path ([IO.Path]::GetFullPath($InstallRoot)) 'install.json'
$configPathFull = [IO.Path]::GetFullPath($ConfigPath)
$beginMarker = '# BEGIN CACHE STATS LOCAL - managed by openai-cache-stats-local'
$endMarker = '# END CACHE STATS LOCAL - managed by openai-cache-stats-local'
$configText = if (Test-Path -LiteralPath $configPathFull -PathType Leaf) { [IO.File]::ReadAllText($configPathFull) } else { '' }
$result = [ordered]@{
platform = if ($env:OS -eq 'Windows_NT') { 'Windows' } else { 'Unsupported' }
receiptPresent = Test-Path -LiteralPath $receiptPath -PathType Leaf
runtimePresent = $false
registrationPresent = ($configText.Contains($beginMarker) -and $configText.Contains($endMarker))
version = $null
serverName = 'cache-stats-local'
configPath = $configPathFull
}
if ($result.receiptPresent) {
$receipt = Get-Content -LiteralPath $receiptPath -Raw | ConvertFrom-Json
$result.version = $receipt.version
$result.serverName = $receipt.serverName
$result.runtimePresent = Test-Path -LiteralPath $receipt.serverPath -PathType Leaf
}
$result | ConvertTo-Json
SHA-256: 5eb00371d7c4b51f5a0e6429c94e3d37733508a902f300da06f2f4b4a521b43c