Files
MyAiConfiguration/scripts/commands/remove-credentials.ps1
T
fraujulianandClaude Opus 5.5 d4f76fb132
CI / CI configuration security checks (push) Successful in 4s
CI / Capabilities and shell quality (push) Successful in 12s
CI / Python tests and compilation (push) Successful in 31s
CI / QMD unit tests (push) Successful in 7s
CI / Build and inspect generated packages (push) Successful in 25s
CI / PowerShell tests on Ubuntu (push) Successful in 1m41s
CI / Installed client configuration smoke tests (push) Successful in 1m8s
CI / Bash integration and installation guards (push) Successful in 1m39s
fix(credentials): prompt for client when -Client is omitted
add-credentials.ps1 and remove-credentials.ps1 saved $Client and $Key
before dot-sourcing with-credential.ps1 and assigned them back
afterwards. Without -Client, that assignment put an empty string into
a ValidateSet variable, and the script stopped with ValidateSetFailure
before it could ask which client to use. with-credential.ps1 now uses
its own variable names, so the save-and-restore is no longer needed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 09:15:17 +01:00

24 lines
885 B
PowerShell

[CmdletBinding()]
param(
[ValidateSet('Codex','Claude','Both')][string]$Client,
[string]$Key
)
$ErrorActionPreference = 'Stop'
$root = Split-Path (Split-Path $PSScriptRoot -Parent) -Parent
. (Join-Path $root 'scripts/lib/install-targets.ps1')
. (Join-Path $root 'scripts/lib/with-credential.ps1')
if (-not $Client) { $Client = Read-InstallClient -Client $Client }
if (-not $Key) { $Key = Read-Host 'Credential key to remove' }
Assert-CredentialKey $Key
foreach ($target in $(if ($Client -eq 'Both') { @('Codex', 'Claude') } else { @($Client) })) {
try {
Remove-ManagedCredential $target $Key
Write-Output "Credential removed for $($target.ToLowerInvariant())."
} catch [ComponentModel.Win32Exception] {
if ($_.Exception.NativeErrorCode -ne 1168) { throw }
Write-Output "Credential not found for $($target.ToLowerInvariant())."
}
}