mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-13 05:12:55 -07:00
fix(cli): provide manual update command when automatic update fails (#26052)
This commit is contained in:
@@ -301,7 +301,7 @@ describe('handleAutoUpdate', () => {
|
|||||||
|
|
||||||
expect(updateEventEmitter.emit).toHaveBeenCalledWith('update-failed', {
|
expect(updateEventEmitter.emit).toHaveBeenCalledWith('update-failed', {
|
||||||
message:
|
message:
|
||||||
'Automatic update failed. Please try updating manually. (command: npm i -g @google/gemini-cli@2.0.0)',
|
'Automatic update failed. Please try updating manually:\n\nnpm i -g @google/gemini-cli@2.0.0',
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -325,7 +325,7 @@ describe('handleAutoUpdate', () => {
|
|||||||
|
|
||||||
expect(updateEventEmitter.emit).toHaveBeenCalledWith('update-failed', {
|
expect(updateEventEmitter.emit).toHaveBeenCalledWith('update-failed', {
|
||||||
message:
|
message:
|
||||||
'Automatic update failed. Please try updating manually. (error: Spawn error)',
|
'Automatic update failed. Please try updating manually. (error: Spawn error)\n\nnpm i -g @google/gemini-cli@2.0.0',
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -435,13 +435,15 @@ describe('setUpdateHandler', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should handle update-failed event', () => {
|
it('should handle update-failed event', () => {
|
||||||
updateEventEmitter.emit('update-failed', { message: 'Failed' });
|
updateEventEmitter.emit('update-failed', {
|
||||||
|
message: 'Failed message with command',
|
||||||
|
});
|
||||||
|
|
||||||
expect(setUpdateInfo).toHaveBeenCalledWith(null);
|
expect(setUpdateInfo).toHaveBeenCalledWith(null);
|
||||||
expect(addItem).toHaveBeenCalledWith(
|
expect(addItem).toHaveBeenCalledWith(
|
||||||
{
|
{
|
||||||
type: MessageType.ERROR,
|
type: MessageType.ERROR,
|
||||||
text: 'Automatic update failed. Please try updating manually',
|
text: 'Failed message with command',
|
||||||
},
|
},
|
||||||
expect.any(Number),
|
expect.any(Number),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ export function handleAutoUpdate(
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
updateEventEmitter.emit('update-failed', {
|
updateEventEmitter.emit('update-failed', {
|
||||||
message: `Automatic update failed. Please try updating manually. (command: ${updateCommand})`,
|
message: `Automatic update failed. Please try updating manually:\n\n${updateCommand}`,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -156,7 +156,7 @@ export function handleAutoUpdate(
|
|||||||
updateProcess.on('error', (err) => {
|
updateProcess.on('error', (err) => {
|
||||||
_updateInProgress = false;
|
_updateInProgress = false;
|
||||||
updateEventEmitter.emit('update-failed', {
|
updateEventEmitter.emit('update-failed', {
|
||||||
message: `Automatic update failed. Please try updating manually. (error: ${err.message})`,
|
message: `Automatic update failed. Please try updating manually. (error: ${err.message})\n\n${updateCommand}`,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
return updateProcess;
|
return updateProcess;
|
||||||
@@ -184,12 +184,14 @@ export function setUpdateHandler(
|
|||||||
}, 60000);
|
}, 60000);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleUpdateFailed = () => {
|
const handleUpdateFailed = (data?: { message: string }) => {
|
||||||
setUpdateInfo(null);
|
setUpdateInfo(null);
|
||||||
addItem(
|
addItem(
|
||||||
{
|
{
|
||||||
type: MessageType.ERROR,
|
type: MessageType.ERROR,
|
||||||
text: `Automatic update failed. Please try updating manually`,
|
text:
|
||||||
|
data?.message ||
|
||||||
|
`Automatic update failed. Please try updating manually`,
|
||||||
},
|
},
|
||||||
Date.now(),
|
Date.now(),
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user