@@ -243,6 +243,78 @@ export class Commands {
243243 await this . performLogin ( ) ;
244244 }
245245
246+ /**
247+ * Manage stored credentials for all deployments.
248+ * Shows a list of deployments with options to remove individual or all credentials.
249+ */
250+ public async manageCredentials ( ) : Promise < void > {
251+ try {
252+ const hostnames = await this . secretsManager . getKnownSafeHostnames ( ) ;
253+ if ( hostnames . length === 0 ) {
254+ vscode . window . showInformationMessage ( "No stored credentials." ) ;
255+ return ;
256+ }
257+
258+ const items : Array < {
259+ label : string ;
260+ description : string ;
261+ hostname : string | undefined ;
262+ } > = hostnames . map ( ( hostname ) => ( {
263+ label : `$(key) ${ hostname } ` ,
264+ description : "Remove stored credentials" ,
265+ hostname,
266+ } ) ) ;
267+
268+ // Only show "Remove All" when there are multiple deployments
269+ if ( hostnames . length > 1 ) {
270+ items . push ( {
271+ label : "$(trash) Remove All" ,
272+ description : `Remove credentials for all ${ hostnames . length } deployments` ,
273+ hostname : undefined ,
274+ } ) ;
275+ }
276+
277+ const selected = await vscode . window . showQuickPick ( items , {
278+ title : "Manage Stored Credentials" ,
279+ placeHolder : "Select a deployment to remove" ,
280+ } ) ;
281+
282+ if ( ! selected ) {
283+ return ;
284+ }
285+
286+ if ( selected . hostname ) {
287+ await this . secretsManager . clearAllAuthData ( selected . hostname ) ;
288+ vscode . window . showInformationMessage (
289+ `Removed credentials for ${ selected . hostname } ` ,
290+ ) ;
291+ } else {
292+ const confirm = await vscodeProposed . window . showWarningMessage (
293+ `Remove ${ hostnames . length } Credentials` ,
294+ {
295+ useCustom : true ,
296+ modal : true ,
297+ detail : `This will remove credentials for: ${ hostnames . join ( ", " ) } \n\nYou'll need to log in again to access them.` ,
298+ } ,
299+ "Remove All" ,
300+ ) ;
301+ if ( confirm === "Remove All" ) {
302+ await Promise . all (
303+ hostnames . map ( ( h ) => this . secretsManager . clearAllAuthData ( h ) ) ,
304+ ) ;
305+ vscode . window . showInformationMessage (
306+ "Removed credentials for all deployments" ,
307+ ) ;
308+ }
309+ }
310+ } catch ( error : unknown ) {
311+ this . logger . error ( "Failed to manage stored credentials" , error ) ;
312+ vscode . window . showErrorMessage (
313+ "Failed to manage stored credentials. Storage may be corrupted." ,
314+ ) ;
315+ }
316+ }
317+
246318 /**
247319 * Create a new workspace for the currently logged-in deployment.
248320 *
0 commit comments