@google/gemini-cli 0.42.0-preview.0 → 0.42.0-preview.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundle/{chunk-GFPE65Z3.js → chunk-47QC6PWE.js} +7 -7
- package/bundle/{chunk-CBWESCDG.js → chunk-5AFGMGVT.js} +7 -7
- package/bundle/{chunk-NOEPPT4R.js → chunk-5MQ5VMQK.js} +1 -1
- package/bundle/{chunk-6KCFSK2J.js → chunk-66C7JVNE.js} +2 -2
- package/bundle/{chunk-EW6BCPVC.js → chunk-6K3EFSDX.js} +1 -1
- package/bundle/{chunk-J3JE6HQX.js → chunk-7H3CQGS6.js} +1 -1
- package/bundle/{chunk-F7B6HX6S.js → chunk-7LOMS5HP.js} +2 -2
- package/bundle/{chunk-KILMJEVY.js → chunk-A3GDBSEI.js} +9 -8
- package/bundle/{chunk-NQ7WZMXX.js → chunk-A564QXJJ.js} +4 -5
- package/bundle/{chunk-M4GY7DCE.js → chunk-ARLWCFGI.js} +6834 -12733
- package/bundle/{chunk-VUENLVGO.js → chunk-AS4E6DX7.js} +3 -3
- package/bundle/{chunk-4LCWAZQL.js → chunk-BI5ZICGL.js} +1 -1
- package/bundle/{chunk-6QYD32J3.js → chunk-BUJZOWQ7.js} +9 -6
- package/bundle/chunk-BZZHETT5.js +512 -0
- package/bundle/{chunk-Y2QKRHXR.js → chunk-GZ4FSF4B.js} +2 -2
- package/bundle/{chunk-J6LCLN2Y.js → chunk-I5JMJ2LU.js} +1 -1
- package/bundle/chunk-IBIKJW2L.js +17230 -0
- package/bundle/{chunk-HSZC7H6N.js → chunk-KSNNZBTV.js} +2 -2
- package/bundle/{chunk-6BMBSK77.js → chunk-L6GBKGQX.js} +3 -3
- package/bundle/chunk-L7GACEVA.js +118 -0
- package/bundle/chunk-LCB7VVYS.js +356008 -0
- package/bundle/{chunk-WSLK3AUT.js → chunk-LK7LIPO6.js} +1 -1
- package/bundle/{chunk-CLT3IJGB.js → chunk-NHDN46IK.js} +1 -1
- package/bundle/chunk-OGZGOFAJ.js +1571 -0
- package/bundle/{chunk-N3W3RYXN.js → chunk-PBD26LJQ.js} +68 -55
- package/bundle/{chunk-IGYW5IPQ.js → chunk-QZ2JZRLK.js} +3 -4
- package/bundle/chunk-UKCYYERR.js +391 -0
- package/bundle/{chunk-ETRUTVTR.js → chunk-UVBJHP26.js} +1 -1
- package/bundle/{chunk-UO7OO22U.js → chunk-UZZVXATH.js} +1 -1
- package/bundle/chunk-VERP26KN.js +81544 -0
- package/bundle/{chunk-QMK75Y7E.js → chunk-WX6CHISQ.js} +2 -2
- package/bundle/chunk-YDSDSLSO.js +156 -0
- package/bundle/{cleanup-T2HYKF7I.js → cleanup-6PVHIK4C.js} +2 -2
- package/bundle/{cleanup-LH7RU457.js → cleanup-FRS7FPOS.js} +2 -2
- package/bundle/{cleanup-ZBHF7PUC.js → cleanup-NDTUQVOW.js} +3 -3
- package/bundle/cleanup-O4IDJYU2.js +33 -0
- package/bundle/{core-QH4PNJQ3.js → core-RZFMBCSX.js} +1 -1
- package/bundle/{devtoolsService-NXXQULSB.js → devtoolsService-6D355RSX.js} +2 -2
- package/bundle/{devtoolsService-NIEGPNPT.js → devtoolsService-7SBW23VD.js} +5 -4
- package/bundle/devtoolsService-SPV43SGI.js +857 -0
- package/bundle/{devtoolsService-USWJ4OCC.js → devtoolsService-WER5PRLG.js} +2 -2
- package/bundle/{dist-P6VZ5KI4.js → dist-7BJPFNU7.js} +1 -1
- package/bundle/{core-IIB5TH4W.js → dist-DTPIOJ3P.js} +2 -2
- package/bundle/dist-ZZ5HEQGP.js +2096 -0
- package/bundle/{gemini-H26TLDOV.js → gemini-3NXWUDHV.js} +13 -13
- package/bundle/{gemini-NFPXCHZM.js → gemini-GLORNPU2.js} +200 -186
- package/bundle/gemini-HCJBP42A.js +16256 -0
- package/bundle/{gemini-U45ZMNQE.js → gemini-KMMF6AK3.js} +13 -13
- package/bundle/gemini.js +7 -7
- package/bundle/{interactiveCli-AT7D6KM5.js → interactiveCli-5UVCH7FM.js} +8 -8
- package/bundle/{interactiveCli-MMM7Z6CJ.js → interactiveCli-BNDKNCVJ.js} +294 -276
- package/bundle/{interactiveCli-O6EFASZD.js → interactiveCli-HBRMSAIT.js} +8 -8
- package/bundle/interactiveCli-TWDP2H52.js +34505 -0
- package/bundle/{liteRtServerManager-G5EHBOWM.js → liteRtServerManager-3YA2HL46.js} +4 -4
- package/bundle/{liteRtServerManager-QB74ZF32.js → liteRtServerManager-BYQVAM6Y.js} +4 -4
- package/bundle/{liteRtServerManager-JCITNPUM.js → liteRtServerManager-IQHHDTUM.js} +5 -5
- package/bundle/liteRtServerManager-RTBP2SLV.js +66 -0
- package/bundle/node_modules/@google/gemini-cli-devtools/package.json +1 -1
- package/bundle/{oauth2-provider-V6ROFUMU.js → oauth2-provider-C66JRVDQ.js} +1 -1
- package/bundle/{oauth2-provider-K5IZHYDJ.js → oauth2-provider-OAXWX3Z3.js} +39 -73
- package/bundle/{oauth2-provider-ZKX2USIN.js → oauth2-provider-TUVQXNLY.js} +1 -1
- package/bundle/oauth2-provider-ZPJOR5SG.js +237 -0
- package/bundle/{start-WILIWWLN.js → start-ELTWFVNO.js} +6 -6
- package/bundle/{start-B4GKBYKT.js → start-HHZI73VV.js} +7 -7
- package/bundle/start-NCMR7HOQ.js +19 -0
- package/bundle/{start-SW3EMEQ2.js → start-S3TEO5BN.js} +6 -6
- package/package.json +1 -1
|
@@ -0,0 +1,391 @@
|
|
|
1
|
+
const require = (await import('node:module')).createRequire(import.meta.url); const __chunk_filename = (await import('node:url')).fileURLToPath(import.meta.url); const __chunk_dirname = (await import('node:path')).dirname(__chunk_filename);
|
|
2
|
+
import {
|
|
3
|
+
runExitCleanup
|
|
4
|
+
} from "./chunk-WX6CHISQ.js";
|
|
5
|
+
import {
|
|
6
|
+
RELEASE_CHANNEL_STABILITY,
|
|
7
|
+
getChannelFromVersion,
|
|
8
|
+
isGitRepository
|
|
9
|
+
} from "./chunk-LCB7VVYS.js";
|
|
10
|
+
import {
|
|
11
|
+
debugLogger
|
|
12
|
+
} from "./chunk-JEW7ZIWE.js";
|
|
13
|
+
|
|
14
|
+
// packages/cli/src/utils/installationInfo.ts
|
|
15
|
+
import * as fs from "node:fs";
|
|
16
|
+
import * as path from "node:path";
|
|
17
|
+
import * as childProcess from "node:child_process";
|
|
18
|
+
import process2 from "node:process";
|
|
19
|
+
var isDevelopment = process2.env["NODE_ENV"] === "development";
|
|
20
|
+
function getInstallationInfo(projectRoot, isAutoUpdateEnabled) {
|
|
21
|
+
const cliPath = process2.argv[1];
|
|
22
|
+
if (!cliPath) {
|
|
23
|
+
return { packageManager: "unknown" /* UNKNOWN */, isGlobal: false };
|
|
24
|
+
}
|
|
25
|
+
try {
|
|
26
|
+
if (process2.env["IS_BINARY"] === "true") {
|
|
27
|
+
return {
|
|
28
|
+
packageManager: "binary" /* BINARY */,
|
|
29
|
+
isGlobal: true,
|
|
30
|
+
updateMessage: "Running as a standalone binary. Please update by downloading the latest version from GitHub."
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
const realPath = fs.realpathSync(cliPath).replace(/\\/g, "/");
|
|
34
|
+
const normalizedProjectRoot = projectRoot?.replace(/\\/g, "/");
|
|
35
|
+
const isGit = isGitRepository(process2.cwd());
|
|
36
|
+
if (isGit && normalizedProjectRoot && realPath.startsWith(normalizedProjectRoot) && !realPath.includes("/node_modules/")) {
|
|
37
|
+
return {
|
|
38
|
+
packageManager: "unknown" /* UNKNOWN */,
|
|
39
|
+
// Not managed by a package manager in this sense
|
|
40
|
+
isGlobal: false,
|
|
41
|
+
updateMessage: 'Running from a local git clone. Please update with "git pull".'
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
if (realPath.includes("/.npm/_npx") || realPath.includes("/npm/_npx")) {
|
|
45
|
+
return {
|
|
46
|
+
packageManager: "npx" /* NPX */,
|
|
47
|
+
isGlobal: false,
|
|
48
|
+
updateMessage: "Running via npx, update not applicable."
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
if (realPath.includes("/.pnpm/_pnpx") || realPath.includes("/.cache/pnpm/dlx")) {
|
|
52
|
+
return {
|
|
53
|
+
packageManager: "pnpx" /* PNPX */,
|
|
54
|
+
isGlobal: false,
|
|
55
|
+
updateMessage: "Running via pnpx, update not applicable."
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
if (process2.platform === "darwin") {
|
|
59
|
+
try {
|
|
60
|
+
const brewPrefix = childProcess.execSync("brew --prefix gemini-cli", {
|
|
61
|
+
encoding: "utf8",
|
|
62
|
+
stdio: ["ignore", "pipe", "ignore"]
|
|
63
|
+
}).trim();
|
|
64
|
+
const brewRealPath = fs.realpathSync(brewPrefix);
|
|
65
|
+
if (realPath.startsWith(brewRealPath)) {
|
|
66
|
+
return {
|
|
67
|
+
packageManager: "homebrew" /* HOMEBREW */,
|
|
68
|
+
isGlobal: true,
|
|
69
|
+
updateMessage: 'Installed via Homebrew. Please update with "brew upgrade gemini-cli".'
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
} catch {
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
if (realPath.includes("/.pnpm/global") || realPath.includes("/.local/share/pnpm")) {
|
|
76
|
+
const updateCommand2 = "pnpm add -g @google/gemini-cli@latest";
|
|
77
|
+
return {
|
|
78
|
+
packageManager: "pnpm" /* PNPM */,
|
|
79
|
+
isGlobal: true,
|
|
80
|
+
updateCommand: updateCommand2,
|
|
81
|
+
updateMessage: isAutoUpdateEnabled ? "Installed with pnpm. Attempting to automatically update now..." : `Please run ${updateCommand2} to update`
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
if (realPath.includes("/.yarn/global")) {
|
|
85
|
+
const updateCommand2 = "yarn global add @google/gemini-cli@latest";
|
|
86
|
+
return {
|
|
87
|
+
packageManager: "yarn" /* YARN */,
|
|
88
|
+
isGlobal: true,
|
|
89
|
+
updateCommand: updateCommand2,
|
|
90
|
+
updateMessage: isAutoUpdateEnabled ? "Installed with yarn. Attempting to automatically update now..." : `Please run ${updateCommand2} to update`
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
if (realPath.includes("/.bun/install/cache")) {
|
|
94
|
+
return {
|
|
95
|
+
packageManager: "bunx" /* BUNX */,
|
|
96
|
+
isGlobal: false,
|
|
97
|
+
updateMessage: "Running via bunx, update not applicable."
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
if (realPath.includes("/.bun/install/global")) {
|
|
101
|
+
const updateCommand2 = "bun add -g @google/gemini-cli@latest";
|
|
102
|
+
return {
|
|
103
|
+
packageManager: "bun" /* BUN */,
|
|
104
|
+
isGlobal: true,
|
|
105
|
+
updateCommand: updateCommand2,
|
|
106
|
+
updateMessage: isAutoUpdateEnabled ? "Installed with bun. Attempting to automatically update now..." : `Please run ${updateCommand2} to update`
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
if (normalizedProjectRoot && realPath.startsWith(`${normalizedProjectRoot}/node_modules`)) {
|
|
110
|
+
let pm = "npm" /* NPM */;
|
|
111
|
+
if (fs.existsSync(path.join(projectRoot, "yarn.lock"))) {
|
|
112
|
+
pm = "yarn" /* YARN */;
|
|
113
|
+
} else if (fs.existsSync(path.join(projectRoot, "pnpm-lock.yaml"))) {
|
|
114
|
+
pm = "pnpm" /* PNPM */;
|
|
115
|
+
} else if (fs.existsSync(path.join(projectRoot, "bun.lockb"))) {
|
|
116
|
+
pm = "bun" /* BUN */;
|
|
117
|
+
}
|
|
118
|
+
return {
|
|
119
|
+
packageManager: pm,
|
|
120
|
+
isGlobal: false,
|
|
121
|
+
updateMessage: "Locally installed. Please update via your project's package.json."
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
const updateCommand = "npm install -g @google/gemini-cli@latest";
|
|
125
|
+
return {
|
|
126
|
+
packageManager: "npm" /* NPM */,
|
|
127
|
+
isGlobal: true,
|
|
128
|
+
updateCommand,
|
|
129
|
+
updateMessage: isAutoUpdateEnabled ? "Installed with npm. Attempting to automatically update now..." : `Please run ${updateCommand} to update`
|
|
130
|
+
};
|
|
131
|
+
} catch (error) {
|
|
132
|
+
debugLogger.log(error);
|
|
133
|
+
return { packageManager: "unknown" /* UNKNOWN */, isGlobal: false };
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// packages/cli/src/utils/updateEventEmitter.ts
|
|
138
|
+
import { EventEmitter } from "node:events";
|
|
139
|
+
var updateEventEmitter = new EventEmitter();
|
|
140
|
+
|
|
141
|
+
// packages/cli/src/utils/spawnWrapper.ts
|
|
142
|
+
import { spawn } from "node:child_process";
|
|
143
|
+
var spawnWrapper = spawn;
|
|
144
|
+
|
|
145
|
+
// packages/cli/src/utils/handleAutoUpdate.ts
|
|
146
|
+
var _updateInProgress = false;
|
|
147
|
+
async function waitForUpdateCompletion(timeoutMs = 3e4) {
|
|
148
|
+
if (!_updateInProgress) {
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
debugLogger.log(
|
|
152
|
+
"\nGemini CLI is waiting for a background update to complete before restarting..."
|
|
153
|
+
);
|
|
154
|
+
return new Promise((resolve) => {
|
|
155
|
+
if (!_updateInProgress) {
|
|
156
|
+
resolve();
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
const timer = setTimeout(cleanup, timeoutMs);
|
|
160
|
+
function cleanup() {
|
|
161
|
+
clearTimeout(timer);
|
|
162
|
+
updateEventEmitter.off("update-success", cleanup);
|
|
163
|
+
updateEventEmitter.off("update-failed", cleanup);
|
|
164
|
+
resolve();
|
|
165
|
+
}
|
|
166
|
+
updateEventEmitter.once("update-success", cleanup);
|
|
167
|
+
updateEventEmitter.once("update-failed", cleanup);
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
function handleAutoUpdate(info, settings, projectRoot, isSandboxEnabled, spawnFn = spawnWrapper) {
|
|
171
|
+
if (!info) {
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
if (isSandboxEnabled) {
|
|
175
|
+
updateEventEmitter.emit("update-info", {
|
|
176
|
+
message: `${info.message}
|
|
177
|
+
Automatic update is not available in sandbox mode.`
|
|
178
|
+
});
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
if (!settings.merged.general.enableAutoUpdateNotification) {
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
const installationInfo = getInstallationInfo(
|
|
185
|
+
projectRoot,
|
|
186
|
+
settings.merged.general.enableAutoUpdate
|
|
187
|
+
);
|
|
188
|
+
if ([
|
|
189
|
+
"npx" /* NPX */,
|
|
190
|
+
"pnpx" /* PNPX */,
|
|
191
|
+
"bunx" /* BUNX */,
|
|
192
|
+
"binary" /* BINARY */
|
|
193
|
+
].includes(installationInfo.packageManager)) {
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
let combinedMessage = info.message;
|
|
197
|
+
if (installationInfo.updateMessage) {
|
|
198
|
+
combinedMessage += `
|
|
199
|
+
${installationInfo.updateMessage}`;
|
|
200
|
+
}
|
|
201
|
+
if (!installationInfo.updateCommand || !settings.merged.general.enableAutoUpdate) {
|
|
202
|
+
updateEventEmitter.emit("update-received", {
|
|
203
|
+
...info,
|
|
204
|
+
message: combinedMessage,
|
|
205
|
+
isUpdating: false
|
|
206
|
+
});
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
updateEventEmitter.emit("update-received", {
|
|
210
|
+
...info,
|
|
211
|
+
message: combinedMessage,
|
|
212
|
+
isUpdating: true
|
|
213
|
+
});
|
|
214
|
+
if (_updateInProgress) {
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
const currentVersion = info.update.current;
|
|
218
|
+
if (!currentVersion) {
|
|
219
|
+
debugLogger.warn(
|
|
220
|
+
"Update check: current version is missing. Skipping automatic update for safety."
|
|
221
|
+
);
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
const currentChannel = getChannelFromVersion(currentVersion);
|
|
225
|
+
const targetChannel = getChannelFromVersion(info.update.latest);
|
|
226
|
+
if (RELEASE_CHANNEL_STABILITY[targetChannel] < RELEASE_CHANNEL_STABILITY[currentChannel]) {
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
const isNightly = info.update.latest.includes("nightly");
|
|
230
|
+
const updateCommand = installationInfo.updateCommand.replace(
|
|
231
|
+
"@latest",
|
|
232
|
+
isNightly ? "@nightly" : `@${info.update.latest}`
|
|
233
|
+
);
|
|
234
|
+
const updateProcess = spawnFn(updateCommand, {
|
|
235
|
+
stdio: "ignore",
|
|
236
|
+
shell: true,
|
|
237
|
+
detached: true
|
|
238
|
+
});
|
|
239
|
+
_updateInProgress = true;
|
|
240
|
+
updateProcess.unref();
|
|
241
|
+
updateProcess.on("close", (code) => {
|
|
242
|
+
_updateInProgress = false;
|
|
243
|
+
if (code === 0) {
|
|
244
|
+
updateEventEmitter.emit("update-success", {
|
|
245
|
+
message: "Update successful! The new version will be used on your next run."
|
|
246
|
+
});
|
|
247
|
+
} else {
|
|
248
|
+
updateEventEmitter.emit("update-failed", {
|
|
249
|
+
message: `Automatic update failed. Please try updating manually:
|
|
250
|
+
|
|
251
|
+
${updateCommand}`
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
});
|
|
255
|
+
updateProcess.on("error", (err) => {
|
|
256
|
+
_updateInProgress = false;
|
|
257
|
+
updateEventEmitter.emit("update-failed", {
|
|
258
|
+
message: `Automatic update failed. Please try updating manually. (error: ${err.message})
|
|
259
|
+
|
|
260
|
+
${updateCommand}`
|
|
261
|
+
});
|
|
262
|
+
});
|
|
263
|
+
return updateProcess;
|
|
264
|
+
}
|
|
265
|
+
function setUpdateHandler(addItem, setUpdateInfo) {
|
|
266
|
+
let successfullyInstalled = false;
|
|
267
|
+
const handleUpdateReceived = (info) => {
|
|
268
|
+
setUpdateInfo(info);
|
|
269
|
+
const savedMessage = info.message;
|
|
270
|
+
setTimeout(() => {
|
|
271
|
+
if (!successfullyInstalled) {
|
|
272
|
+
addItem(
|
|
273
|
+
{
|
|
274
|
+
type: "info" /* INFO */,
|
|
275
|
+
text: savedMessage
|
|
276
|
+
},
|
|
277
|
+
Date.now()
|
|
278
|
+
);
|
|
279
|
+
}
|
|
280
|
+
setUpdateInfo(null);
|
|
281
|
+
}, 6e4);
|
|
282
|
+
};
|
|
283
|
+
const handleUpdateFailed = (data) => {
|
|
284
|
+
setUpdateInfo(null);
|
|
285
|
+
addItem(
|
|
286
|
+
{
|
|
287
|
+
type: "error" /* ERROR */,
|
|
288
|
+
text: data?.message || `Automatic update failed. Please try updating manually`
|
|
289
|
+
},
|
|
290
|
+
Date.now()
|
|
291
|
+
);
|
|
292
|
+
};
|
|
293
|
+
const handleUpdateSuccess = () => {
|
|
294
|
+
successfullyInstalled = true;
|
|
295
|
+
setUpdateInfo(null);
|
|
296
|
+
addItem(
|
|
297
|
+
{
|
|
298
|
+
type: "info" /* INFO */,
|
|
299
|
+
text: `Update successful! The new version will be used on your next run.`
|
|
300
|
+
},
|
|
301
|
+
Date.now()
|
|
302
|
+
);
|
|
303
|
+
};
|
|
304
|
+
const handleUpdateInfo = (data) => {
|
|
305
|
+
addItem(
|
|
306
|
+
{
|
|
307
|
+
type: "info" /* INFO */,
|
|
308
|
+
text: data.message
|
|
309
|
+
},
|
|
310
|
+
Date.now()
|
|
311
|
+
);
|
|
312
|
+
};
|
|
313
|
+
updateEventEmitter.on("update-received", handleUpdateReceived);
|
|
314
|
+
updateEventEmitter.on("update-failed", handleUpdateFailed);
|
|
315
|
+
updateEventEmitter.on("update-success", handleUpdateSuccess);
|
|
316
|
+
updateEventEmitter.on("update-info", handleUpdateInfo);
|
|
317
|
+
return () => {
|
|
318
|
+
updateEventEmitter.off("update-received", handleUpdateReceived);
|
|
319
|
+
updateEventEmitter.off("update-failed", handleUpdateFailed);
|
|
320
|
+
updateEventEmitter.off("update-success", handleUpdateSuccess);
|
|
321
|
+
updateEventEmitter.off("update-info", handleUpdateInfo);
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
// packages/cli/src/utils/processUtils.ts
|
|
326
|
+
var RELAUNCH_EXIT_CODE = 199;
|
|
327
|
+
var isRelaunching = false;
|
|
328
|
+
async function relaunchApp() {
|
|
329
|
+
if (isRelaunching) return;
|
|
330
|
+
isRelaunching = true;
|
|
331
|
+
await waitForUpdateCompletion();
|
|
332
|
+
await runExitCleanup();
|
|
333
|
+
process.exit(RELAUNCH_EXIT_CODE);
|
|
334
|
+
}
|
|
335
|
+
function isStandardSea() {
|
|
336
|
+
return process.argv[0] !== process.argv[1] && (process.env["IS_BINARY"] === "true" || process.isSea?.() === true);
|
|
337
|
+
}
|
|
338
|
+
function getScriptArgs() {
|
|
339
|
+
return process.argv.slice(isStandardSea() ? 1 : 2);
|
|
340
|
+
}
|
|
341
|
+
function isSeaEnvironment() {
|
|
342
|
+
return process.env["IS_BINARY"] === "true" || process.isSea?.() === true || process.argv[0] === process.argv[1];
|
|
343
|
+
}
|
|
344
|
+
function getSpawnConfig(nodeArgs, scriptArgs) {
|
|
345
|
+
const isBinary = isSeaEnvironment();
|
|
346
|
+
const newEnv = {
|
|
347
|
+
...process.env,
|
|
348
|
+
GEMINI_CLI_NO_RELAUNCH: "true"
|
|
349
|
+
};
|
|
350
|
+
const finalSpawnArgs = [];
|
|
351
|
+
if (isBinary) {
|
|
352
|
+
if (nodeArgs.length > 0) {
|
|
353
|
+
for (const arg of nodeArgs) {
|
|
354
|
+
if (/[\s"'\\]/.test(arg)) {
|
|
355
|
+
throw new Error(
|
|
356
|
+
`Unsupported node argument for SEA relaunch: ${arg}. Complex escaping is not supported.`
|
|
357
|
+
);
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
const existingNodeOptions = process.env["NODE_OPTIONS"] || "";
|
|
361
|
+
newEnv["NODE_OPTIONS"] = `${existingNodeOptions} ${nodeArgs.join(" ")}`.trim();
|
|
362
|
+
}
|
|
363
|
+
finalSpawnArgs.push(process.execPath, ...scriptArgs);
|
|
364
|
+
} else {
|
|
365
|
+
finalSpawnArgs.push(
|
|
366
|
+
...process.execArgv,
|
|
367
|
+
...nodeArgs,
|
|
368
|
+
process.argv[1],
|
|
369
|
+
...scriptArgs
|
|
370
|
+
);
|
|
371
|
+
}
|
|
372
|
+
return {
|
|
373
|
+
spawnArgs: finalSpawnArgs,
|
|
374
|
+
env: newEnv
|
|
375
|
+
};
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
export {
|
|
379
|
+
isDevelopment,
|
|
380
|
+
handleAutoUpdate,
|
|
381
|
+
setUpdateHandler,
|
|
382
|
+
RELAUNCH_EXIT_CODE,
|
|
383
|
+
relaunchApp,
|
|
384
|
+
getScriptArgs,
|
|
385
|
+
getSpawnConfig
|
|
386
|
+
};
|
|
387
|
+
/**
|
|
388
|
+
* @license
|
|
389
|
+
* Copyright 2025 Google LLC
|
|
390
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
391
|
+
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const require = (await import('node:module')).createRequire(import.meta.url); const __chunk_filename = (await import('node:url')).fileURLToPath(import.meta.url); const __chunk_dirname = (await import('node:path')).dirname(__chunk_filename);
|
|
2
2
|
import {
|
|
3
3
|
checkExhaustive
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-QZ2JZRLK.js";
|
|
5
5
|
import {
|
|
6
6
|
__commonJS,
|
|
7
7
|
__toESM
|