MCPcopy Create free account
hub / github.com/google-gemini/gemini-cli / handleAutoUpdate

Function handleAutoUpdate

packages/cli/src/utils/handleAutoUpdate.ts:67–187  ·  view source on GitHub ↗
(
  info: UpdateObject | null,
  settings: LoadedSettings,
  projectRoot: string,
  isSandboxEnabled: boolean,
  spawnFn: typeof spawn = spawnWrapper,
)

Source from the content-addressed store, hash-verified

65}
66
67export function handleAutoUpdate(
68 info: UpdateObject | null,
69 settings: LoadedSettings,
70 projectRoot: string,
71 isSandboxEnabled: boolean,
72 spawnFn: typeof spawn = spawnWrapper,
73) {
74 if (!info) {
75 return;
76 }
77
78 if (isSandboxEnabled) {
79 updateEventEmitter.emit('update-info', {
80 message: `${info.message}\nAutomatic update is not available in sandbox mode.`,
81 });
82 return;
83 }
84
85 if (!settings.merged.general.enableAutoUpdateNotification) {
86 return;
87 }
88
89 const installationInfo = getInstallationInfo(
90 projectRoot,
91 settings.merged.general.enableAutoUpdate,
92 );
93
94 if (
95 [
96 PackageManager.NPX,
97 PackageManager.PNPX,
98 PackageManager.BUNX,
99 PackageManager.BINARY,
100 ].includes(installationInfo.packageManager)
101 ) {
102 return;
103 }
104
105 let combinedMessage = info.message;
106 if (installationInfo.updateMessage) {
107 combinedMessage += `\n${installationInfo.updateMessage}`;
108 }
109
110 if (
111 !installationInfo.updateCommand ||
112 !settings.merged.general.enableAutoUpdate
113 ) {
114 updateEventEmitter.emit('update-received', {
115 ...info,
116 message: combinedMessage,
117 isUpdating: false,
118 });
119 return;
120 }
121 updateEventEmitter.emit('update-received', {
122 ...info,
123 message: combinedMessage,
124 isUpdating: true,

Callers 2

startInteractiveUIFunction · 0.85

Calls 6

getInstallationInfoFunction · 0.85
getChannelFromVersionFunction · 0.85
unrefMethod · 0.80
onMethod · 0.80
emitMethod · 0.45
warnMethod · 0.45

Tested by

no test coverage detected