@google/gemini-cli 0.39.0 → 0.39.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.
Files changed (46) hide show
  1. package/bundle/{chunk-NWD4JYMB.js → chunk-APBWRLCM.js} +1590 -6638
  2. package/bundle/{chunk-5GTZHSZV.js → chunk-BEUOMVKF.js} +1587 -6636
  3. package/bundle/{chunk-67TFD6HC.js → chunk-FNPZLVJU.js} +16 -0
  4. package/bundle/{chunk-UQGLVPZQ.js → chunk-GDRLBWZL.js} +3884 -2279
  5. package/bundle/{chunk-BL3XXS2L.js → chunk-GRNHS2XR.js} +2 -2
  6. package/bundle/{chunk-LUWQB4AS.js → chunk-N6R5LJKJ.js} +2 -2
  7. package/bundle/{chunk-6NW5RNNH.js → chunk-QPDKVNK5.js} +1656 -6692
  8. package/bundle/{chunk-QM5IP3NK.js → chunk-R32ABRMT.js} +16 -0
  9. package/bundle/chunk-RNWNACRD.js +96654 -0
  10. package/bundle/{chunk-YYY7NKKR.js → chunk-RVSGPQMZ.js} +2 -2
  11. package/bundle/{chunk-RTKRL6Y5.js → chunk-UGFPG7AM.js} +10090 -13916
  12. package/bundle/chunk-UIBQS45C.js +361893 -0
  13. package/bundle/{chunk-3YUTTNJ7.js → chunk-WFCK2Z32.js} +3916 -2286
  14. package/bundle/chunk-ZIXTYG56.js +156 -0
  15. package/bundle/{cleanup-3LELZME2.js → cleanup-DORKD3KW.js} +3 -3
  16. package/bundle/{cleanup-JJEXOHOA.js → cleanup-ROCPAQIR.js} +3 -3
  17. package/bundle/{cleanup-TTGHQXQN.js → cleanup-RV4C23S4.js} +3 -3
  18. package/bundle/cleanup-VFR4VRPU.js +33 -0
  19. package/bundle/{core-LKKLDF4Z.js → core-NHADWRAT.js} +28 -2
  20. package/bundle/{devtoolsService-UQCUIXV5.js → devtoolsService-65SKYXJR.js} +3 -3
  21. package/bundle/{devtoolsService-H64VB4IA.js → devtoolsService-6GKOMHGW.js} +3 -3
  22. package/bundle/{devtoolsService-L5LFSMIR.js → devtoolsService-OIMHTGLW.js} +5 -4
  23. package/bundle/devtoolsService-XJQQUBHU.js +871 -0
  24. package/bundle/{core-Z2SYVMM5.js → dist-2DBCGLDI.js} +28 -2
  25. package/bundle/{dist-FWHS5IHN.js → dist-7UL5MZ3N.js} +28 -2
  26. package/bundle/dist-FMEYWTZB.js +2036 -0
  27. package/bundle/docs/cli/cli-reference.md +1 -0
  28. package/bundle/docs/cli/trusted-folders.md +28 -0
  29. package/bundle/docs/reference/configuration.md +14 -0
  30. package/bundle/{gemini-BI2PCDUT.js → gemini-APY42TPN.js} +62 -18
  31. package/bundle/{gemini-CMXEUOSI.js → gemini-ASA6UVNB.js} +60 -17
  32. package/bundle/{gemini-YNLABPKW.js → gemini-JN2NUSDI.js} +238 -179
  33. package/bundle/gemini-ZVQNZBQE.js +15365 -0
  34. package/bundle/gemini.js +3 -3
  35. package/bundle/{interactiveCli-C46TDPVW.js → interactiveCli-7OEI5K4E.js} +15 -165
  36. package/bundle/{interactiveCli-P35Q3KZ2.js → interactiveCli-F6YUYJT5.js} +28 -177
  37. package/bundle/{interactiveCli-LXXBYVNU.js → interactiveCli-MSV2JUI2.js} +298 -430
  38. package/bundle/interactiveCli-WY7NQZAW.js +34344 -0
  39. package/bundle/{memoryDiscovery-U3XUU4QY.js → memoryDiscovery-OGUXPAKW.js} +1 -1
  40. package/bundle/{memoryDiscovery-MYQ3ZWKM.js → memoryDiscovery-OJZ52WPE.js} +1 -1
  41. package/bundle/node_modules/@google/gemini-cli-devtools/package.json +1 -1
  42. package/bundle/{oauth2-provider-7ZDLUOSM.js → oauth2-provider-5GKHTO3W.js} +2 -2
  43. package/bundle/{oauth2-provider-CRWFOXYR.js → oauth2-provider-J42P6NQU.js} +2 -2
  44. package/bundle/{oauth2-provider-FEM5AIRT.js → oauth2-provider-MJYS4GHA.js} +39 -73
  45. package/bundle/oauth2-provider-UI5C6WYR.js +237 -0
  46. package/package.json +1 -1
@@ -52,6 +52,7 @@ These commands are available within the interactive REPL.
52
52
  | `--prompt-interactive` | `-i` | string | - | Execute prompt and continue in interactive mode |
53
53
  | `--worktree` | `-w` | string | - | Start Gemini in a new git worktree. If no name is provided, one is generated automatically. Requires `experimental.worktrees: true` in settings. |
54
54
  | `--sandbox` | `-s` | boolean | `false` | Run in a sandboxed environment for safer execution |
55
+ | `--skip-trust` | - | boolean | `false` | Trust the current workspace for this session, skipping the folder trust check. |
55
56
  | `--approval-mode` | - | string | `default` | Approval mode for tool execution. Choices: `default`, `auto_edit`, `yolo`, `plan` |
56
57
  | `--yolo` | `-y` | boolean | `false` | **Deprecated.** Auto-approve all actions. Use `--approval-mode=yolo` instead. |
57
58
  | `--experimental-acp` | - | boolean | - | Start in ACP (Agent Code Pilot) mode. **Experimental feature.** |
@@ -100,6 +100,34 @@ protect you. In this mode, the following features are disabled:
100
100
  Granting trust to a folder unlocks the full functionality of Gemini CLI for that
101
101
  workspace.
102
102
 
103
+ ## Headless and automated environments
104
+
105
+ When running Gemini CLI in a headless environment (for example, a CI/CD
106
+ pipeline) where interactive prompts are not possible, the trust dialog cannot be
107
+ displayed. If the folder is untrusted and the Folder Trust feature is enabled,
108
+ the CLI will throw a `FatalUntrustedWorkspaceError` and exit.
109
+
110
+ To proceed in these environments, you can bypass the trust check using one of
111
+ the following methods:
112
+
113
+ - **Command-line flag:** Run the CLI with the `--skip-trust` flag.
114
+ - **Environment variable:** Set the `GEMINI_CLI_TRUST_WORKSPACE=true`
115
+ environment variable.
116
+
117
+ These methods will trust the current workspace for the duration of the session
118
+ without prompting.
119
+
120
+ For detailed instructions on managing folder trust within CI/CD workflows,
121
+ review the
122
+ [Gemini CLI trust guidance for GitHub Actions](https://github.com/google-github-actions/run-gemini-cli/blob/main/docs/trust-guidance.md).
123
+
124
+ ## Overriding the trust file location
125
+
126
+ By default, trust settings are saved to `~/.gemini/trustedFolders.json`. If you
127
+ need to store this file in a different location, you can set the
128
+ `GEMINI_CLI_TRUSTED_FOLDERS_PATH` environment variable to the desired absolute
129
+ file path.
130
+
103
131
  ## Managing your trust settings
104
132
 
105
133
  If you need to change a decision or see all your settings, you have a couple of
@@ -1437,6 +1437,12 @@ their corresponding top-level category object in your `settings.json` file.
1437
1437
  - **Default:** `undefined`
1438
1438
  - **Requires restart:** Yes
1439
1439
 
1440
+ - **`tools.confirmationRequired`** (array):
1441
+ - **Description:** Tool names that always require user confirmation. Takes
1442
+ precedence over allowed tools and core tool allowlists.
1443
+ - **Default:** `undefined`
1444
+ - **Requires restart:** Yes
1445
+
1440
1446
  - **`tools.exclude`** (array):
1441
1447
  - **Description:** Tool names to exclude from discovery.
1442
1448
  - **Default:** `undefined`
@@ -2099,6 +2105,14 @@ the `advanced.excludedEnvVars` setting in your `settings.json` file.
2099
2105
  - Overrides the hardcoded default
2100
2106
  - Example: `export GEMINI_MODEL="gemini-3-flash-preview"` (Windows PowerShell:
2101
2107
  `$env:GEMINI_MODEL="gemini-3-flash-preview"`)
2108
+ - **`GEMINI_CLI_TRUST_WORKSPACE`**:
2109
+ - If set to `"true"`, trusts the current workspace for the duration of the
2110
+ session, bypassing the folder trust check.
2111
+ - Useful for headless environments (for example, CI/CD pipelines).
2112
+ - **`GEMINI_CLI_TRUSTED_FOLDERS_PATH`**:
2113
+ - Overrides the default location for the `trustedFolders.json` file.
2114
+ - Useful if you want to store this configuration in a custom location instead
2115
+ of the default `~/.gemini/`.
2102
2116
  - **`GEMINI_CLI_IDE_PID`**:
2103
2117
  - Manually specifies the PID of the IDE process to use for integration. This
2104
2118
  is useful when running Gemini CLI in a standalone terminal while still
@@ -25,7 +25,6 @@ import {
25
25
  configureSpecificSetting,
26
26
  disableSkill,
27
27
  enableSkill,
28
- execa,
29
28
  formatRelativeTime,
30
29
  getExtensionManager,
31
30
  getThemeTypeFromBackgroundColor,
@@ -35,6 +34,7 @@ import {
35
34
  installSkill,
36
35
  isAlternateBufferEnabled,
37
36
  isFolderTrustEnabled,
37
+ isRecord,
38
38
  isSlashCommand,
39
39
  isWorkspaceTrusted,
40
40
  isWorktreeEnabled,
@@ -58,7 +58,7 @@ import {
58
58
  updateAllUpdatableExtensions,
59
59
  updateExtension,
60
60
  validateAuthMethod
61
- } from "./chunk-NWD4JYMB.js";
61
+ } from "./chunk-QPDKVNK5.js";
62
62
  import {
63
63
  appEvents
64
64
  } from "./chunk-5PS3AYFU.js";
@@ -70,7 +70,7 @@ import {
70
70
  runExitCleanup,
71
71
  runSyncCleanup,
72
72
  setupSignalHandlers
73
- } from "./chunk-BL3XXS2L.js";
73
+ } from "./chunk-RVSGPQMZ.js";
74
74
  import {
75
75
  AuthType,
76
76
  ChatRecordingService,
@@ -102,6 +102,7 @@ import {
102
102
  StreamEventType,
103
103
  StreamJsonFormatter,
104
104
  ToolCallEvent,
105
+ TrustLevel,
105
106
  UserAccountManager,
106
107
  UserPromptEvent,
107
108
  ValidationCancelledError,
@@ -121,6 +122,7 @@ import {
121
122
  createWorktreeService,
122
123
  detectIdeFromEnv,
123
124
  displayContentToString,
125
+ execa,
124
126
  external_exports as external_exports2,
125
127
  geminiPartsToContentParts,
126
128
  generalistProfile,
@@ -167,7 +169,7 @@ import {
167
169
  updatePolicy,
168
170
  writeToStderr,
169
171
  writeToStdout
170
- } from "./chunk-UQGLVPZQ.js";
172
+ } from "./chunk-UGFPG7AM.js";
171
173
  import {
172
174
  ASK_USER_TOOL_NAME,
173
175
  ApprovalMode,
@@ -188,6 +190,7 @@ import {
188
190
  FatalSandboxError,
189
191
  FatalToolExecutionError,
190
192
  FatalTurnLimitedError,
193
+ FatalUntrustedWorkspaceError,
191
194
  GEMINI_DIR,
192
195
  GEMINI_MODEL_ALIAS_AUTO,
193
196
  Kind,
@@ -214,7 +217,7 @@ import {
214
217
  loadServerHierarchicalMemory,
215
218
  resolveToRealPath,
216
219
  setGeminiMdFilename
217
- } from "./chunk-67TFD6HC.js";
220
+ } from "./chunk-FNPZLVJU.js";
218
221
  import "./chunk-664ZODQF.js";
219
222
  import "./chunk-RJTRUG2J.js";
220
223
  import "./chunk-IUUIT4SU.js";
@@ -5901,7 +5904,7 @@ async function handleInstall(args) {
5901
5904
  );
5902
5905
  if (confirmed) {
5903
5906
  const trustedFolders = loadTrustedFolders();
5904
- await trustedFolders.setValue(realPath, "TRUST_FOLDER" /* TRUST_FOLDER */);
5907
+ await trustedFolders.setValue(realPath, TrustLevel.TRUST_FOLDER);
5905
5908
  } else {
5906
5909
  throw new Error(
5907
5910
  `Installation aborted: Folder "${absolutePath}" is not trusted.`
@@ -7475,6 +7478,10 @@ async function parseArguments(settings) {
7475
7478
  type: "string",
7476
7479
  nargs: 1,
7477
7480
  description: "Execute the provided prompt and continue in interactive mode"
7481
+ }).option("skip-trust", {
7482
+ type: "boolean",
7483
+ description: "Trust the current workspace for this session.",
7484
+ default: false
7478
7485
  }).option("worktree", {
7479
7486
  alias: "w",
7480
7487
  type: "string",
@@ -7596,9 +7603,16 @@ async function parseArguments(settings) {
7596
7603
  yargsInstance.wrap(yargsInstance.terminalWidth());
7597
7604
  let result;
7598
7605
  try {
7599
- result = await yargsInstance.parse();
7606
+ const parsed = await yargsInstance.parse();
7607
+ if (!isRecord(parsed)) {
7608
+ throw new Error("Failed to parse arguments");
7609
+ }
7610
+ result = parsed;
7611
+ if (result["skip-trust"]) {
7612
+ process3.env["GEMINI_CLI_TRUST_WORKSPACE"] = "true";
7613
+ }
7600
7614
  } catch (e) {
7601
- const msg = e instanceof Error ? e.message : String(e);
7615
+ const msg = getErrorMessage(e);
7602
7616
  debugLogger.error(msg);
7603
7617
  yargsInstance.showHelp();
7604
7618
  await runExitCleanup();
@@ -7608,8 +7622,13 @@ async function parseArguments(settings) {
7608
7622
  await runExitCleanup();
7609
7623
  process3.exit(0);
7610
7624
  }
7611
- const queryArg = result.query;
7612
- const q = Array.isArray(queryArg) ? queryArg.join(" ") : queryArg;
7625
+ const queryArg = result["query"];
7626
+ let q;
7627
+ if (Array.isArray(queryArg)) {
7628
+ q = queryArg.join(" ");
7629
+ } else if (typeof queryArg === "string") {
7630
+ q = queryArg;
7631
+ }
7613
7632
  if (q && !result["prompt"]) {
7614
7633
  if (!isHeadlessMode()) {
7615
7634
  startupMessages.push(
@@ -7640,7 +7659,7 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
7640
7659
  const includeDirectoryTree = settings.context?.includeDirectoryTree ?? true;
7641
7660
  const ideMode = settings.ide?.enabled ?? false;
7642
7661
  const folderTrust = process3.env["GEMINI_CLI_INTEGRATION_TEST"] === "true" || process3.env["VITEST"] === "true" ? false : settings.security?.folderTrust?.enabled ?? false;
7643
- const trustedFolder = isWorkspaceTrusted(settings, cwd, void 0, {
7662
+ const trustedFolder = isWorkspaceTrusted(settings, cwd, {
7644
7663
  prompt: argv.prompt,
7645
7664
  query: argv.query
7646
7665
  })?.isTrusted ?? false;
@@ -7669,7 +7688,7 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
7669
7688
  return resolveToRealPath(trimmedPath) !== realCwd;
7670
7689
  } catch (e) {
7671
7690
  debugLogger.debug(
7672
- `[IDE] Skipping inaccessible workspace folder: ${trimmedPath} (${e instanceof Error ? e.message : String(e)})`
7691
+ `[IDE] Skipping inaccessible workspace folder: ${trimmedPath} (${getErrorMessage(e)})`
7673
7692
  );
7674
7693
  return false;
7675
7694
  }
@@ -8060,7 +8079,7 @@ async function resolveWorktreeSettings(cwd) {
8060
8079
  worktreeBaseSha = stdout.trim();
8061
8080
  } catch (e) {
8062
8081
  debugLogger.debug(
8063
- `Failed to resolve worktree base SHA at ${worktreePath}: ${e instanceof Error ? e.message : String(e)}`
8082
+ `Failed to resolve worktree base SHA at ${worktreePath}: ${getErrorMessage(e)}`
8064
8083
  );
8065
8084
  }
8066
8085
  if (!worktreeBaseSha) {
@@ -9195,9 +9214,29 @@ var rootDirectoryCheck = {
9195
9214
  }
9196
9215
  }
9197
9216
  };
9217
+ var folderTrustCheck = {
9218
+ id: "folder-trust",
9219
+ priority: WarningPriority.High,
9220
+ check: async (workspaceRoot, settings) => {
9221
+ if (!isFolderTrustEnabled(settings)) {
9222
+ return null;
9223
+ }
9224
+ const { isTrusted } = isWorkspaceTrusted(settings, workspaceRoot);
9225
+ if (isTrusted === true) {
9226
+ return null;
9227
+ }
9228
+ if (isHeadlessMode()) {
9229
+ throw new FatalUntrustedWorkspaceError(
9230
+ "Gemini CLI is not running in a trusted directory. To proceed, either use `--skip-trust`, set the `GEMINI_CLI_TRUST_WORKSPACE=true` environment variable, or trust this directory in interactive mode. For more details, see https://geminicli.com/docs/cli/trusted-folders/#headless-and-automated-environments"
9231
+ );
9232
+ }
9233
+ return null;
9234
+ }
9235
+ };
9198
9236
  var WARNING_CHECKS = [
9199
9237
  homeDirectoryCheck,
9200
- rootDirectoryCheck
9238
+ rootDirectoryCheck,
9239
+ folderTrustCheck
9201
9240
  ];
9202
9241
  async function getUserStartupWarnings(settings, workspaceRoot = process4.cwd(), options) {
9203
9242
  const results = await Promise.all(
@@ -9562,7 +9601,7 @@ async function runNonInteractive({
9562
9601
  }
9563
9602
  });
9564
9603
  if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
9565
- const { setupInitialActivityLogger } = await import("./devtoolsService-H64VB4IA.js");
9604
+ const { setupInitialActivityLogger } = await import("./devtoolsService-OIMHTGLW.js");
9566
9605
  await setupInitialActivityLogger(config);
9567
9606
  }
9568
9607
  const { stdout: workingStdout } = createWorkingStdio();
@@ -10013,7 +10052,7 @@ async function runNonInteractive2(params) {
10013
10052
  }
10014
10053
  });
10015
10054
  if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
10016
- const { setupInitialActivityLogger } = await import("./devtoolsService-H64VB4IA.js");
10055
+ const { setupInitialActivityLogger } = await import("./devtoolsService-OIMHTGLW.js");
10017
10056
  await setupInitialActivityLogger(config);
10018
10057
  }
10019
10058
  const { stdout: workingStdout } = createWorkingStdio();
@@ -14860,7 +14899,7 @@ async function resolveSessionId(resumeArg) {
14860
14899
  }
14861
14900
  }
14862
14901
  async function startInteractiveUI(config, settings, startupWarnings, workspaceRoot = process.cwd(), resumedSessionData, initializationResult) {
14863
- const { startInteractiveUI: doStartUI } = await import("./interactiveCli-P35Q3KZ2.js");
14902
+ const { startInteractiveUI: doStartUI } = await import("./interactiveCli-MSV2JUI2.js");
14864
14903
  await doStartUI(
14865
14904
  config,
14866
14905
  settings,
@@ -15062,7 +15101,7 @@ ${finalArgs[promptIndex + 1]}`;
15062
15101
  await config.storage.initialize();
15063
15102
  adminControlsListner.setConfig(config);
15064
15103
  if (config.isInteractive() && settings.merged.general.devtools) {
15065
- const { setupInitialActivityLogger } = await import("./devtoolsService-H64VB4IA.js");
15104
+ const { setupInitialActivityLogger } = await import("./devtoolsService-OIMHTGLW.js");
15066
15105
  await setupInitialActivityLogger(config);
15067
15106
  }
15068
15107
  registerTelemetryConfig(config);
@@ -15141,6 +15180,11 @@ ${finalArgs[promptIndex + 1]}`;
15141
15180
  })
15142
15181
  ];
15143
15182
  cliStartupHandle?.end();
15183
+ if (!config.isInteractive()) {
15184
+ for (const warning of startupWarnings) {
15185
+ writeToStderr(warning.message + "\n");
15186
+ }
15187
+ }
15144
15188
  if (config.isInteractive()) {
15145
15189
  if (process.stdin.isTTY) {
15146
15190
  process.stdin.resume();
@@ -25,7 +25,6 @@ import {
25
25
  configureSpecificSetting,
26
26
  disableSkill,
27
27
  enableSkill,
28
- execa,
29
28
  formatRelativeTime,
30
29
  getExtensionManager,
31
30
  getThemeTypeFromBackgroundColor,
@@ -35,6 +34,7 @@ import {
35
34
  installSkill,
36
35
  isAlternateBufferEnabled,
37
36
  isFolderTrustEnabled,
37
+ isRecord,
38
38
  isSlashCommand,
39
39
  isWorkspaceTrusted,
40
40
  isWorktreeEnabled,
@@ -58,7 +58,7 @@ import {
58
58
  updateAllUpdatableExtensions,
59
59
  updateExtension,
60
60
  validateAuthMethod
61
- } from "./chunk-6NW5RNNH.js";
61
+ } from "./chunk-BEUOMVKF.js";
62
62
  import {
63
63
  appEvents
64
64
  } from "./chunk-5PS3AYFU.js";
@@ -70,7 +70,7 @@ import {
70
70
  runExitCleanup,
71
71
  runSyncCleanup,
72
72
  setupSignalHandlers
73
- } from "./chunk-LUWQB4AS.js";
73
+ } from "./chunk-GRNHS2XR.js";
74
74
  import {
75
75
  AuthType,
76
76
  ChatRecordingService,
@@ -110,6 +110,7 @@ import {
110
110
  createWorktreeService,
111
111
  detectIdeFromEnv,
112
112
  displayContentToString,
113
+ execa,
113
114
  external_exports as external_exports2,
114
115
  geminiPartsToContentParts,
115
116
  generalistProfile,
@@ -156,7 +157,7 @@ import {
156
157
  updatePolicy,
157
158
  writeToStderr,
158
159
  writeToStdout
159
- } from "./chunk-RTKRL6Y5.js";
160
+ } from "./chunk-WFCK2Z32.js";
160
161
  import {
161
162
  ASK_USER_TOOL_NAME,
162
163
  DEFAULT_FILE_FILTERING_OPTIONS,
@@ -175,6 +176,7 @@ import {
175
176
  FatalSandboxError,
176
177
  FatalToolExecutionError,
177
178
  FatalTurnLimitedError,
179
+ FatalUntrustedWorkspaceError,
178
180
  GEMINI_DIR,
179
181
  GEMINI_MODEL_ALIAS_AUTO,
180
182
  PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL,
@@ -199,7 +201,7 @@ import {
199
201
  loadServerHierarchicalMemory,
200
202
  resolveToRealPath,
201
203
  setGeminiMdFilename
202
- } from "./chunk-QM5IP3NK.js";
204
+ } from "./chunk-R32ABRMT.js";
203
205
  import "./chunk-664ZODQF.js";
204
206
  import "./chunk-RJTRUG2J.js";
205
207
  import "./chunk-IUUIT4SU.js";
@@ -7460,6 +7462,10 @@ async function parseArguments(settings) {
7460
7462
  type: "string",
7461
7463
  nargs: 1,
7462
7464
  description: "Execute the provided prompt and continue in interactive mode"
7465
+ }).option("skip-trust", {
7466
+ type: "boolean",
7467
+ description: "Trust the current workspace for this session.",
7468
+ default: false
7463
7469
  }).option("worktree", {
7464
7470
  alias: "w",
7465
7471
  type: "string",
@@ -7581,9 +7587,16 @@ async function parseArguments(settings) {
7581
7587
  yargsInstance.wrap(yargsInstance.terminalWidth());
7582
7588
  let result;
7583
7589
  try {
7584
- result = await yargsInstance.parse();
7590
+ const parsed = await yargsInstance.parse();
7591
+ if (!isRecord(parsed)) {
7592
+ throw new Error("Failed to parse arguments");
7593
+ }
7594
+ result = parsed;
7595
+ if (result["skip-trust"]) {
7596
+ process3.env["GEMINI_CLI_TRUST_WORKSPACE"] = "true";
7597
+ }
7585
7598
  } catch (e) {
7586
- const msg = e instanceof Error ? e.message : String(e);
7599
+ const msg = getErrorMessage(e);
7587
7600
  debugLogger.error(msg);
7588
7601
  yargsInstance.showHelp();
7589
7602
  await runExitCleanup();
@@ -7593,8 +7606,13 @@ async function parseArguments(settings) {
7593
7606
  await runExitCleanup();
7594
7607
  process3.exit(0);
7595
7608
  }
7596
- const queryArg = result.query;
7597
- const q = Array.isArray(queryArg) ? queryArg.join(" ") : queryArg;
7609
+ const queryArg = result["query"];
7610
+ let q;
7611
+ if (Array.isArray(queryArg)) {
7612
+ q = queryArg.join(" ");
7613
+ } else if (typeof queryArg === "string") {
7614
+ q = queryArg;
7615
+ }
7598
7616
  if (q && !result["prompt"]) {
7599
7617
  if (!isHeadlessMode()) {
7600
7618
  startupMessages.push(
@@ -7625,7 +7643,7 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
7625
7643
  const includeDirectoryTree = settings.context?.includeDirectoryTree ?? true;
7626
7644
  const ideMode = settings.ide?.enabled ?? false;
7627
7645
  const folderTrust = process3.env["GEMINI_CLI_INTEGRATION_TEST"] === "true" || process3.env["VITEST"] === "true" ? false : settings.security?.folderTrust?.enabled ?? false;
7628
- const trustedFolder = isWorkspaceTrusted(settings, cwd, void 0, {
7646
+ const trustedFolder = isWorkspaceTrusted(settings, cwd, {
7629
7647
  prompt: argv.prompt,
7630
7648
  query: argv.query
7631
7649
  })?.isTrusted ?? false;
@@ -7654,7 +7672,7 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
7654
7672
  return resolveToRealPath(trimmedPath) !== realCwd;
7655
7673
  } catch (e) {
7656
7674
  debugLogger.debug(
7657
- `[IDE] Skipping inaccessible workspace folder: ${trimmedPath} (${e instanceof Error ? e.message : String(e)})`
7675
+ `[IDE] Skipping inaccessible workspace folder: ${trimmedPath} (${getErrorMessage(e)})`
7658
7676
  );
7659
7677
  return false;
7660
7678
  }
@@ -8045,7 +8063,7 @@ async function resolveWorktreeSettings(cwd) {
8045
8063
  worktreeBaseSha = stdout.trim();
8046
8064
  } catch (e) {
8047
8065
  debugLogger.debug(
8048
- `Failed to resolve worktree base SHA at ${worktreePath}: ${e instanceof Error ? e.message : String(e)}`
8066
+ `Failed to resolve worktree base SHA at ${worktreePath}: ${getErrorMessage(e)}`
8049
8067
  );
8050
8068
  }
8051
8069
  if (!worktreeBaseSha) {
@@ -9180,9 +9198,29 @@ var rootDirectoryCheck = {
9180
9198
  }
9181
9199
  }
9182
9200
  };
9201
+ var folderTrustCheck = {
9202
+ id: "folder-trust",
9203
+ priority: "high" /* High */,
9204
+ check: async (workspaceRoot, settings) => {
9205
+ if (!isFolderTrustEnabled(settings)) {
9206
+ return null;
9207
+ }
9208
+ const { isTrusted } = isWorkspaceTrusted(settings, workspaceRoot);
9209
+ if (isTrusted === true) {
9210
+ return null;
9211
+ }
9212
+ if (isHeadlessMode()) {
9213
+ throw new FatalUntrustedWorkspaceError(
9214
+ "Gemini CLI is not running in a trusted directory. To proceed, either use `--skip-trust`, set the `GEMINI_CLI_TRUST_WORKSPACE=true` environment variable, or trust this directory in interactive mode. For more details, see https://geminicli.com/docs/cli/trusted-folders/#headless-and-automated-environments"
9215
+ );
9216
+ }
9217
+ return null;
9218
+ }
9219
+ };
9183
9220
  var WARNING_CHECKS = [
9184
9221
  homeDirectoryCheck,
9185
- rootDirectoryCheck
9222
+ rootDirectoryCheck,
9223
+ folderTrustCheck
9186
9224
  ];
9187
9225
  async function getUserStartupWarnings(settings, workspaceRoot = process4.cwd(), options) {
9188
9226
  const results = await Promise.all(
@@ -9547,7 +9585,7 @@ async function runNonInteractive({
9547
9585
  }
9548
9586
  });
9549
9587
  if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
9550
- const { setupInitialActivityLogger } = await import("./devtoolsService-L5LFSMIR.js");
9588
+ const { setupInitialActivityLogger } = await import("./devtoolsService-65SKYXJR.js");
9551
9589
  await setupInitialActivityLogger(config);
9552
9590
  }
9553
9591
  const { stdout: workingStdout } = createWorkingStdio();
@@ -9998,7 +10036,7 @@ async function runNonInteractive2(params) {
9998
10036
  }
9999
10037
  });
10000
10038
  if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
10001
- const { setupInitialActivityLogger } = await import("./devtoolsService-L5LFSMIR.js");
10039
+ const { setupInitialActivityLogger } = await import("./devtoolsService-65SKYXJR.js");
10002
10040
  await setupInitialActivityLogger(config);
10003
10041
  }
10004
10042
  const { stdout: workingStdout } = createWorkingStdio();
@@ -14845,7 +14883,7 @@ async function resolveSessionId(resumeArg) {
14845
14883
  }
14846
14884
  }
14847
14885
  async function startInteractiveUI(config, settings, startupWarnings, workspaceRoot = process.cwd(), resumedSessionData, initializationResult) {
14848
- const { startInteractiveUI: doStartUI } = await import("./interactiveCli-C46TDPVW.js");
14886
+ const { startInteractiveUI: doStartUI } = await import("./interactiveCli-7OEI5K4E.js");
14849
14887
  await doStartUI(
14850
14888
  config,
14851
14889
  settings,
@@ -15047,7 +15085,7 @@ ${finalArgs[promptIndex + 1]}`;
15047
15085
  await config.storage.initialize();
15048
15086
  adminControlsListner.setConfig(config);
15049
15087
  if (config.isInteractive() && settings.merged.general.devtools) {
15050
- const { setupInitialActivityLogger } = await import("./devtoolsService-L5LFSMIR.js");
15088
+ const { setupInitialActivityLogger } = await import("./devtoolsService-65SKYXJR.js");
15051
15089
  await setupInitialActivityLogger(config);
15052
15090
  }
15053
15091
  registerTelemetryConfig(config);
@@ -15126,6 +15164,11 @@ ${finalArgs[promptIndex + 1]}`;
15126
15164
  })
15127
15165
  ];
15128
15166
  cliStartupHandle?.end();
15167
+ if (!config.isInteractive()) {
15168
+ for (const warning of startupWarnings) {
15169
+ writeToStderr(warning.message + "\n");
15170
+ }
15171
+ }
15129
15172
  if (config.isInteractive()) {
15130
15173
  if (process.stdin.isTTY) {
15131
15174
  process.stdin.resume();