mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-10 22:21:22 -07:00
Add instructions to the extensions update info notification (#14907)
This commit is contained in:
@@ -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),
|
||||
);
|
||||
|
||||
@@ -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<Promise<ExtensionUpdateInfo | undefined>> = [];
|
||||
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(),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user