From ec79fe1ab269866567bd636aa62c9806f5f7c4ac Mon Sep 17 00:00:00 2001 From: christine betts Date: Tue, 30 Dec 2025 14:50:33 -0500 Subject: [PATCH] Add instructions to the extensions update info notification (#14907) --- .../cli/src/ui/hooks/useExtensionUpdates.test.tsx | 4 ++-- packages/cli/src/ui/hooks/useExtensionUpdates.ts | 12 +++++------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/packages/cli/src/ui/hooks/useExtensionUpdates.test.tsx b/packages/cli/src/ui/hooks/useExtensionUpdates.test.tsx index 2987926add..ae19a1fc55 100644 --- a/packages/cli/src/ui/hooks/useExtensionUpdates.test.tsx +++ b/packages/cli/src/ui/hooks/useExtensionUpdates.test.tsx @@ -107,7 +107,7 @@ describe('useExtensionUpdates', () => { expect(addItem).toHaveBeenCalledWith( { type: MessageType.INFO, - text: 'You have 1 extension with an update available, run "/extensions list" for more information.', + text: `You have 1 extension with an update available. Run "/extensions update test-extension".`, }, expect.any(Number), ); @@ -319,7 +319,7 @@ describe('useExtensionUpdates', () => { expect(addItem).toHaveBeenCalledWith( { type: MessageType.INFO, - text: 'You have 2 extensions with an update available, run "/extensions list" for more information.', + text: `You have 2 extensions with an update available. Run "/extensions update test-extension-1 test-extension-2".`, }, expect.any(Number), ); diff --git a/packages/cli/src/ui/hooks/useExtensionUpdates.ts b/packages/cli/src/ui/hooks/useExtensionUpdates.ts index 9270235d5b..771b0f2cb3 100644 --- a/packages/cli/src/ui/hooks/useExtensionUpdates.ts +++ b/packages/cli/src/ui/hooks/useExtensionUpdates.ts @@ -133,10 +133,9 @@ export const useExtensionUpdates = ( } } - let extensionsWithUpdatesCount = 0; // We only notify if we have unprocessed extensions in the UPDATE_AVAILABLE // state. - let shouldNotifyOfUpdates = false; + const pendingUpdates = []; const updatePromises: Array> = []; for (const extension of extensions) { const currentState = extensionsUpdateState.extensionStatuses.get( @@ -150,14 +149,13 @@ export const useExtensionUpdates = ( } const shouldUpdate = shouldDoUpdate(extension); if (!shouldUpdate) { - extensionsWithUpdatesCount++; if (!currentState.notified) { // Mark as processed immediately to avoid re-triggering. dispatchExtensionStateUpdate({ type: 'SET_NOTIFIED', payload: { name: extension.name, notified: true }, }); - shouldNotifyOfUpdates = true; + pendingUpdates.push(extension.name); } } else { const updatePromise = updateExtension( @@ -190,12 +188,12 @@ export const useExtensionUpdates = ( }); } } - if (shouldNotifyOfUpdates) { - const s = extensionsWithUpdatesCount > 1 ? 's' : ''; + if (pendingUpdates.length > 0) { + const s = pendingUpdates.length > 1 ? 's' : ''; addItem( { type: MessageType.INFO, - text: `You have ${extensionsWithUpdatesCount} extension${s} with an update available, run "/extensions list" for more information.`, + text: `You have ${pendingUpdates.length} extension${s} with an update available. Run "/extensions update ${pendingUpdates.join(' ')}".`, }, Date.now(), );