@google/gemini-cli 0.42.0-preview.0 → 0.42.0-preview.2
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-2KRAWFEQ.js} +7 -7
- package/bundle/{chunk-J3JE6HQX.js → chunk-4NXNVHPO.js} +1 -1
- package/bundle/{chunk-F7B6HX6S.js → chunk-6QBZKEWW.js} +2 -2
- package/bundle/{chunk-6KCFSK2J.js → chunk-76KOJPMV.js} +2 -2
- package/bundle/{chunk-NQ7WZMXX.js → chunk-77HSANAH.js} +5 -6
- package/bundle/{chunk-ETRUTVTR.js → chunk-AAU5XCLJ.js} +1 -1
- package/bundle/{chunk-NOEPPT4R.js → chunk-BLNG7CSO.js} +1 -1
- package/bundle/{chunk-EW6BCPVC.js → chunk-DEKZKOVU.js} +1 -1
- package/bundle/{chunk-M4GY7DCE.js → chunk-E54WEGH3.js} +6834 -12733
- package/bundle/{chunk-VUENLVGO.js → chunk-FIIOJPLW.js} +3 -3
- package/bundle/{chunk-6QYD32J3.js → chunk-I6IY72IP.js} +9 -6
- package/bundle/{chunk-QMK75Y7E.js → chunk-JW36FWGZ.js} +2 -2
- package/bundle/{chunk-CBWESCDG.js → chunk-LHVIO4J4.js} +7 -7
- package/bundle/{chunk-KILMJEVY.js → chunk-LYMYMKWM.js} +9 -8
- package/bundle/{chunk-UO7OO22U.js → chunk-M6ZQAQKH.js} +1 -1
- package/bundle/chunk-ODIOD5TJ.js +391 -0
- package/bundle/{chunk-4LCWAZQL.js → chunk-OFOKTVUH.js} +1 -1
- package/bundle/{chunk-Y2QKRHXR.js → chunk-OP6THN3K.js} +2 -2
- package/bundle/{chunk-HSZC7H6N.js → chunk-Q24MYLMP.js} +2 -2
- package/bundle/{chunk-J6LCLN2Y.js → chunk-QM234EIA.js} +1 -1
- package/bundle/{chunk-WSLK3AUT.js → chunk-R7BHIYZD.js} +1 -1
- package/bundle/chunk-RO2XVFEU.js +512 -0
- package/bundle/{chunk-CLT3IJGB.js → chunk-S3WIE72K.js} +1 -1
- package/bundle/{chunk-N3W3RYXN.js → chunk-SJ6AOVZF.js} +68 -55
- package/bundle/{chunk-6BMBSK77.js → chunk-THNM4JU6.js} +3 -3
- package/bundle/chunk-WFKT4UTI.js +118 -0
- package/bundle/chunk-WLPWIJ3Y.js +81544 -0
- package/bundle/{chunk-IGYW5IPQ.js → chunk-WOGMVEEF.js} +5 -6
- package/bundle/chunk-WRDVEMWE.js +1571 -0
- package/bundle/chunk-YDC4M26X.js +156 -0
- package/bundle/chunk-ZDP2ZWKG.js +17230 -0
- package/bundle/chunk-ZFOGBX2H.js +356008 -0
- package/bundle/{cleanup-LH7RU457.js → cleanup-5FPOUEHR.js} +2 -2
- package/bundle/{cleanup-T2HYKF7I.js → cleanup-G7DNOS4V.js} +2 -2
- package/bundle/{cleanup-ZBHF7PUC.js → cleanup-GZM5KIZA.js} +3 -3
- package/bundle/cleanup-J6AUEKWI.js +33 -0
- package/bundle/{core-QH4PNJQ3.js → core-IYSSLWMM.js} +1 -1
- package/bundle/{devtoolsService-NXXQULSB.js → devtoolsService-3XOQOECV.js} +2 -2
- package/bundle/{devtoolsService-NIEGPNPT.js → devtoolsService-7ZN7CSSO.js} +5 -4
- package/bundle/devtoolsService-KTUMQHXG.js +857 -0
- package/bundle/{devtoolsService-USWJ4OCC.js → devtoolsService-UADEEKOH.js} +2 -2
- package/bundle/{dist-P6VZ5KI4.js → dist-D7FZVGG3.js} +1 -1
- package/bundle/{core-IIB5TH4W.js → dist-GF2RNVWZ.js} +2 -2
- package/bundle/dist-HBMVDPXB.js +2096 -0
- package/bundle/{gemini-H26TLDOV.js → gemini-IMX43TZ4.js} +14 -14
- package/bundle/{gemini-U45ZMNQE.js → gemini-IRKIMLB4.js} +14 -14
- package/bundle/{gemini-NFPXCHZM.js → gemini-MWN2MSYV.js} +200 -186
- package/bundle/gemini-SYFUC6XO.js +16256 -0
- package/bundle/gemini.js +7 -7
- package/bundle/{interactiveCli-AT7D6KM5.js → interactiveCli-37SKHAKX.js} +8 -8
- package/bundle/{interactiveCli-O6EFASZD.js → interactiveCli-752P4PTI.js} +8 -8
- package/bundle/{interactiveCli-MMM7Z6CJ.js → interactiveCli-SAMKYHUU.js} +294 -276
- package/bundle/interactiveCli-VX6GBWOV.js +34505 -0
- package/bundle/{liteRtServerManager-QB74ZF32.js → liteRtServerManager-CDLVKT7N.js} +4 -4
- package/bundle/{liteRtServerManager-G5EHBOWM.js → liteRtServerManager-FPYU5KEK.js} +4 -4
- package/bundle/{liteRtServerManager-JCITNPUM.js → liteRtServerManager-OWPZ35U6.js} +5 -5
- package/bundle/liteRtServerManager-OWTQEYE6.js +66 -0
- package/bundle/node_modules/@google/gemini-cli-devtools/package.json +1 -1
- package/bundle/{oauth2-provider-V6ROFUMU.js → oauth2-provider-446FDCUW.js} +1 -1
- package/bundle/{oauth2-provider-K5IZHYDJ.js → oauth2-provider-6W4IY3LC.js} +39 -73
- package/bundle/{oauth2-provider-ZKX2USIN.js → oauth2-provider-RQNNLGWV.js} +1 -1
- package/bundle/oauth2-provider-TITPL3DN.js +237 -0
- package/bundle/{start-WILIWWLN.js → start-6U3XBAVH.js} +6 -6
- package/bundle/{start-SW3EMEQ2.js → start-KUNHDGRA.js} +6 -6
- package/bundle/{start-B4GKBYKT.js → start-TTLMBKNX.js} +7 -7
- package/bundle/start-TZXEJLTH.js +19 -0
- package/package.json +1 -1
|
@@ -1,15 +1,15 @@
|
|
|
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
|
runExitCleanup
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-AAU5XCLJ.js";
|
|
5
5
|
import {
|
|
6
6
|
RELEASE_CHANNEL_STABILITY,
|
|
7
7
|
getChannelFromVersion,
|
|
8
8
|
isGitRepository
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-77HSANAH.js";
|
|
10
10
|
import {
|
|
11
11
|
debugLogger
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-JEW7ZIWE.js";
|
|
13
13
|
|
|
14
14
|
// packages/cli/src/utils/installationInfo.ts
|
|
15
15
|
import * as fs from "node:fs";
|
|
@@ -1,6 +1,8 @@
|
|
|
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
|
AuthProviderType,
|
|
4
|
+
AuthType,
|
|
5
|
+
CoreToolCallStatus,
|
|
4
6
|
DEFAULT_MODEL_CONFIGS,
|
|
5
7
|
DEFAULT_TRUNCATE_TOOL_OUTPUT_THRESHOLD,
|
|
6
8
|
SESSION_FILE_PREFIX,
|
|
@@ -20,8 +22,9 @@ import {
|
|
|
20
22
|
require_strip_json_comments,
|
|
21
23
|
sanitizeFilenamePart,
|
|
22
24
|
stripAnsi
|
|
23
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-ZFOGBX2H.js";
|
|
24
26
|
import {
|
|
27
|
+
CoreEvent,
|
|
25
28
|
FatalConfigError,
|
|
26
29
|
GEMINI_DIR,
|
|
27
30
|
Storage,
|
|
@@ -30,7 +33,7 @@ import {
|
|
|
30
33
|
external_exports,
|
|
31
34
|
getErrorMessage,
|
|
32
35
|
homedir
|
|
33
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-JEW7ZIWE.js";
|
|
34
37
|
import {
|
|
35
38
|
__commonJS,
|
|
36
39
|
__require,
|
|
@@ -10205,7 +10208,7 @@ function convertSessionToHistoryFormats(messages) {
|
|
|
10205
10208
|
args: tool.args,
|
|
10206
10209
|
description: tool.description || "",
|
|
10207
10210
|
renderOutputAsMarkdown: tool.renderOutputAsMarkdown ?? true,
|
|
10208
|
-
status: tool.status === "success" ?
|
|
10211
|
+
status: tool.status === "success" ? CoreToolCallStatus.Success : CoreToolCallStatus.Error,
|
|
10209
10212
|
resultDisplay: tool.resultDisplay,
|
|
10210
10213
|
confirmationDetails: void 0
|
|
10211
10214
|
}))
|
|
@@ -16229,8 +16232,8 @@ var LoadedSettings = class {
|
|
|
16229
16232
|
// React will pass a listener fn into this subscribe fn
|
|
16230
16233
|
// that listener fn will perform an object identity check on the snapshot and trigger a React re render if the snapshot has changed
|
|
16231
16234
|
subscribe(listener) {
|
|
16232
|
-
coreEvents.on(
|
|
16233
|
-
return () => coreEvents.off(
|
|
16235
|
+
coreEvents.on(CoreEvent.SettingsChanged, listener);
|
|
16236
|
+
return () => coreEvents.off(CoreEvent.SettingsChanged, listener);
|
|
16234
16237
|
}
|
|
16235
16238
|
getSnapshot() {
|
|
16236
16239
|
return this._snapshot;
|
|
@@ -16333,7 +16336,7 @@ function setUpCloudShellEnvironment(envFilePath, isTrusted, isSandboxed, selecte
|
|
|
16333
16336
|
}
|
|
16334
16337
|
}
|
|
16335
16338
|
let value = "cloudshell-gca";
|
|
16336
|
-
if (selectedAuthType ===
|
|
16339
|
+
if (selectedAuthType === AuthType.USE_VERTEX_AI) {
|
|
16337
16340
|
value = process2.env[USER_GCP_PROJECT];
|
|
16338
16341
|
}
|
|
16339
16342
|
if (envFilePath && fs4.existsSync(envFilePath)) {
|
|
@@ -4,10 +4,10 @@ import {
|
|
|
4
4
|
isTelemetrySdkInitialized,
|
|
5
5
|
resetBrowserSession,
|
|
6
6
|
shutdownTelemetry
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-E54WEGH3.js";
|
|
8
8
|
import {
|
|
9
9
|
Storage
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-JEW7ZIWE.js";
|
|
11
11
|
|
|
12
12
|
// packages/cli/src/utils/cleanup.ts
|
|
13
13
|
import { promises as fs } from "node:fs";
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
import {
|
|
7
7
|
exitCli,
|
|
8
8
|
require_source
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-OFOKTVUH.js";
|
|
10
10
|
import {
|
|
11
11
|
DEFAULT_BACKGROUND_OPACITY,
|
|
12
12
|
DEFAULT_BORDER_OPACITY,
|
|
@@ -57,14 +57,14 @@ import {
|
|
|
57
57
|
stripUnsafeCharacters,
|
|
58
58
|
toCodePoints,
|
|
59
59
|
validateCustomTheme
|
|
60
|
-
} from "./chunk-
|
|
60
|
+
} from "./chunk-ZDP2ZWKG.js";
|
|
61
61
|
import {
|
|
62
62
|
isDevelopment
|
|
63
|
-
} from "./chunk-
|
|
63
|
+
} from "./chunk-FIIOJPLW.js";
|
|
64
64
|
import {
|
|
65
65
|
emptyIcon,
|
|
66
66
|
require_react
|
|
67
|
-
} from "./chunk-
|
|
67
|
+
} from "./chunk-4NXNVHPO.js";
|
|
68
68
|
import {
|
|
69
69
|
AsyncFzf,
|
|
70
70
|
AuthType,
|
|
@@ -212,7 +212,7 @@ import {
|
|
|
212
212
|
stripAnsi,
|
|
213
213
|
tokenLimit,
|
|
214
214
|
uiTelemetryService
|
|
215
|
-
} from "./chunk-
|
|
215
|
+
} from "./chunk-77HSANAH.js";
|
|
216
216
|
import {
|
|
217
217
|
ApprovalMode,
|
|
218
218
|
CoreEvent,
|
|
@@ -56454,7 +56454,7 @@ var authCommand = {
|
|
|
56454
56454
|
import process28 from "node:process";
|
|
56455
56455
|
|
|
56456
56456
|
// packages/cli/src/generated/git-commit.ts
|
|
56457
|
-
var GIT_COMMIT_INFO = "
|
|
56457
|
+
var GIT_COMMIT_INFO = "6837b08a0";
|
|
56458
56458
|
|
|
56459
56459
|
// packages/cli/src/ui/utils/historyExportUtils.ts
|
|
56460
56460
|
import * as fsPromises from "node:fs/promises";
|
|
@@ -62122,7 +62122,7 @@ Use /mcp auth <server-name> to authenticate.`
|
|
|
62122
62122
|
type: "info",
|
|
62123
62123
|
text: `Starting OAuth authentication for MCP server '${serverName}'...`
|
|
62124
62124
|
});
|
|
62125
|
-
const { MCPOAuthProvider } = await import("./dist-
|
|
62125
|
+
const { MCPOAuthProvider } = await import("./dist-HBMVDPXB.js");
|
|
62126
62126
|
let oauthConfig = server.oauth;
|
|
62127
62127
|
if (!oauthConfig) {
|
|
62128
62128
|
oauthConfig = { enabled: false };
|
|
@@ -1,7 +1,8 @@
|
|
|
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
|
+
CoreToolCallStatus,
|
|
3
4
|
checkExhaustive
|
|
4
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-E54WEGH3.js";
|
|
5
6
|
import {
|
|
6
7
|
__commonJS,
|
|
7
8
|
__toESM
|
|
@@ -464,19 +465,19 @@ var require_react = __commonJS({
|
|
|
464
465
|
var import_react = __toESM(require_react(), 1);
|
|
465
466
|
function mapCoreStatusToDisplayStatus(coreStatus) {
|
|
466
467
|
switch (coreStatus) {
|
|
467
|
-
case
|
|
468
|
+
case CoreToolCallStatus.Validating:
|
|
468
469
|
return "Pending" /* Pending */;
|
|
469
|
-
case
|
|
470
|
+
case CoreToolCallStatus.AwaitingApproval:
|
|
470
471
|
return "Confirming" /* Confirming */;
|
|
471
|
-
case
|
|
472
|
+
case CoreToolCallStatus.Executing:
|
|
472
473
|
return "Executing" /* Executing */;
|
|
473
|
-
case
|
|
474
|
+
case CoreToolCallStatus.Success:
|
|
474
475
|
return "Success" /* Success */;
|
|
475
|
-
case
|
|
476
|
+
case CoreToolCallStatus.Cancelled:
|
|
476
477
|
return "Canceled" /* Canceled */;
|
|
477
|
-
case
|
|
478
|
+
case CoreToolCallStatus.Error:
|
|
478
479
|
return "Error" /* Error */;
|
|
479
|
-
case
|
|
480
|
+
case CoreToolCallStatus.Scheduled:
|
|
480
481
|
return "Pending" /* Pending */;
|
|
481
482
|
default:
|
|
482
483
|
return checkExhaustive(coreStatus);
|
|
@@ -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-WOGMVEEF.js";
|
|
5
5
|
import {
|
|
6
6
|
__commonJS,
|
|
7
7
|
__toESM
|
|
@@ -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-JW36FWGZ.js";
|
|
5
|
+
import {
|
|
6
|
+
RELEASE_CHANNEL_STABILITY,
|
|
7
|
+
getChannelFromVersion,
|
|
8
|
+
isGitRepository
|
|
9
|
+
} from "./chunk-E54WEGH3.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
|
runExitCleanup
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-AAU5XCLJ.js";
|
|
5
5
|
import {
|
|
6
6
|
__commonJS,
|
|
7
7
|
__require
|
|
@@ -2,7 +2,7 @@ const require = (await import('node:module')).createRequire(import.meta.url); co
|
|
|
2
2
|
import {
|
|
3
3
|
exitCli,
|
|
4
4
|
require_source
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-R7BHIYZD.js";
|
|
6
6
|
import {
|
|
7
7
|
DEFAULT_PORT,
|
|
8
8
|
SERVER_START_WAIT_MS,
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
isServerRunning,
|
|
15
15
|
resolveGemmaConfig,
|
|
16
16
|
writeServerProcessInfo
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-S3WIE72K.js";
|
|
18
18
|
import {
|
|
19
19
|
debugLogger
|
|
20
20
|
} from "./chunk-ECNYAST2.js";
|
|
@@ -2,7 +2,7 @@ const require = (await import('node:module')).createRequire(import.meta.url); co
|
|
|
2
2
|
import {
|
|
3
3
|
exitCli,
|
|
4
4
|
require_source
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-WRDVEMWE.js";
|
|
6
6
|
import {
|
|
7
7
|
DEFAULT_PORT,
|
|
8
8
|
SERVER_START_WAIT_MS,
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
isServerRunning,
|
|
15
15
|
resolveGemmaConfig,
|
|
16
16
|
writeServerProcessInfo
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-BLNG7CSO.js";
|
|
18
18
|
import {
|
|
19
19
|
debugLogger
|
|
20
20
|
} from "./chunk-JEW7ZIWE.js";
|
|
@@ -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
|
runExitCleanup
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-YDC4M26X.js";
|
|
5
5
|
import {
|
|
6
6
|
__commonJS,
|
|
7
7
|
__require
|
|
@@ -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
|
runExitCleanup
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-DEKZKOVU.js";
|
|
5
5
|
import {
|
|
6
6
|
__commonJS,
|
|
7
7
|
__require
|