@google/gemini-cli 0.3.0-nightly.20250823.1a89d185 → 0.3.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.
Files changed (510) hide show
  1. package/dist/google-gemini-cli-0.3.0-preview.1.tgz +0 -0
  2. package/dist/index.js +9 -0
  3. package/dist/index.js.map +1 -1
  4. package/dist/package.json +7 -7
  5. package/dist/src/commands/extensions/disable.d.ts +14 -0
  6. package/dist/src/commands/extensions/disable.js +42 -0
  7. package/dist/src/commands/extensions/disable.js.map +1 -0
  8. package/dist/src/commands/extensions/enable.d.ts +14 -0
  9. package/dist/src/commands/extensions/enable.js +48 -0
  10. package/dist/src/commands/extensions/enable.js.map +1 -0
  11. package/dist/src/commands/extensions/install.d.ts +13 -0
  12. package/dist/src/commands/extensions/install.js +48 -0
  13. package/dist/src/commands/extensions/install.js.map +1 -0
  14. package/dist/src/commands/extensions/install.test.js +19 -0
  15. package/dist/src/commands/extensions/install.test.js.map +1 -0
  16. package/dist/src/commands/extensions/list.d.ts +8 -0
  17. package/dist/src/commands/extensions/list.js +32 -0
  18. package/dist/src/commands/extensions/list.js.map +1 -0
  19. package/dist/src/commands/extensions/uninstall.d.ts +12 -0
  20. package/dist/src/commands/extensions/uninstall.js +38 -0
  21. package/dist/src/commands/extensions/uninstall.js.map +1 -0
  22. package/dist/src/commands/extensions/uninstall.test.d.ts +6 -0
  23. package/dist/src/commands/extensions/uninstall.test.js +15 -0
  24. package/dist/src/commands/extensions/uninstall.test.js.map +1 -0
  25. package/dist/src/commands/extensions/update.d.ts +12 -0
  26. package/dist/src/commands/extensions/update.js +38 -0
  27. package/dist/src/commands/extensions/update.js.map +1 -0
  28. package/dist/src/commands/extensions.d.ts +7 -0
  29. package/dist/src/commands/extensions.js +29 -0
  30. package/dist/src/commands/extensions.js.map +1 -0
  31. package/dist/src/commands/mcp/list.js +1 -1
  32. package/dist/src/commands/mcp/list.js.map +1 -1
  33. package/dist/src/config/auth.js +0 -9
  34. package/dist/src/config/auth.js.map +1 -1
  35. package/dist/src/config/config.d.ts +6 -6
  36. package/dist/src/config/config.js +65 -59
  37. package/dist/src/config/config.js.map +1 -1
  38. package/dist/src/config/extension.d.ts +40 -2
  39. package/dist/src/config/extension.js +267 -14
  40. package/dist/src/config/extension.js.map +1 -1
  41. package/dist/src/config/extensions/variableSchema.d.ts +28 -0
  42. package/dist/src/config/extensions/variableSchema.js +18 -0
  43. package/dist/src/config/extensions/variableSchema.js.map +1 -0
  44. package/dist/src/config/extensions/variables.d.ts +17 -0
  45. package/dist/src/config/extensions/variables.js +40 -0
  46. package/dist/src/config/extensions/variables.js.map +1 -0
  47. package/dist/src/config/extensions/variables.test.d.ts +6 -0
  48. package/dist/src/config/extensions/variables.test.js +17 -0
  49. package/dist/src/config/extensions/variables.test.js.map +1 -0
  50. package/dist/src/config/keyBindings.test.js +1 -1
  51. package/dist/src/config/keyBindings.test.js.map +1 -1
  52. package/dist/src/config/sandboxConfig.d.ts +2 -2
  53. package/dist/src/config/sandboxConfig.js +5 -7
  54. package/dist/src/config/sandboxConfig.js.map +1 -1
  55. package/dist/src/config/settings.d.ts +9 -4
  56. package/dist/src/config/settings.js +369 -80
  57. package/dist/src/config/settings.js.map +1 -1
  58. package/dist/src/config/settingsSchema.d.ts +630 -440
  59. package/dist/src/config/settingsSchema.js +626 -436
  60. package/dist/src/config/settingsSchema.js.map +1 -1
  61. package/dist/src/config/settingsSchema.test.js +85 -98
  62. package/dist/src/config/settingsSchema.test.js.map +1 -1
  63. package/dist/src/config/trustedFolders.d.ts +1 -1
  64. package/dist/src/config/trustedFolders.js +5 -5
  65. package/dist/src/config/trustedFolders.js.map +1 -1
  66. package/dist/src/config/trustedFolders.test.js +9 -5
  67. package/dist/src/config/trustedFolders.test.js.map +1 -1
  68. package/dist/src/gemini.d.ts +3 -1
  69. package/dist/src/gemini.js +51 -44
  70. package/dist/src/gemini.js.map +1 -1
  71. package/dist/src/gemini.test.js +78 -24
  72. package/dist/src/gemini.test.js.map +1 -1
  73. package/dist/src/generated/git-commit.d.ts +2 -2
  74. package/dist/src/generated/git-commit.js +2 -2
  75. package/dist/src/generated/git-commit.js.map +1 -1
  76. package/dist/src/nonInteractiveCli.d.ts +1 -1
  77. package/dist/src/nonInteractiveCli.js +4 -6
  78. package/dist/src/nonInteractiveCli.js.map +1 -1
  79. package/dist/src/services/BuiltinCommandLoader.d.ts +3 -3
  80. package/dist/src/services/CommandService.d.ts +2 -2
  81. package/dist/src/services/CommandService.test.js +1 -0
  82. package/dist/src/services/CommandService.test.js.map +1 -1
  83. package/dist/src/services/FileCommandLoader.d.ts +3 -3
  84. package/dist/src/services/FileCommandLoader.js +22 -13
  85. package/dist/src/services/FileCommandLoader.js.map +1 -1
  86. package/dist/src/services/McpPromptLoader.d.ts +4 -4
  87. package/dist/src/services/McpPromptLoader.js +2 -2
  88. package/dist/src/services/McpPromptLoader.js.map +1 -1
  89. package/dist/src/services/prompt-processors/argumentProcessor.d.ts +3 -3
  90. package/dist/src/services/prompt-processors/argumentProcessor.js +3 -2
  91. package/dist/src/services/prompt-processors/argumentProcessor.js.map +1 -1
  92. package/dist/src/services/prompt-processors/atFileProcessor.d.ts +12 -0
  93. package/dist/src/services/prompt-processors/atFileProcessor.js +62 -0
  94. package/dist/src/services/prompt-processors/atFileProcessor.js.map +1 -0
  95. package/dist/src/services/prompt-processors/atFileProcessor.test.d.ts +6 -0
  96. package/dist/src/services/prompt-processors/atFileProcessor.test.js +174 -0
  97. package/dist/src/services/prompt-processors/atFileProcessor.test.js.map +1 -0
  98. package/dist/src/services/prompt-processors/injectionParser.d.ts +29 -0
  99. package/dist/src/services/prompt-processors/injectionParser.js +60 -0
  100. package/dist/src/services/prompt-processors/injectionParser.js.map +1 -0
  101. package/dist/src/services/prompt-processors/injectionParser.test.d.ts +6 -0
  102. package/dist/src/services/prompt-processors/injectionParser.test.js +189 -0
  103. package/dist/src/services/prompt-processors/injectionParser.test.js.map +1 -0
  104. package/dist/src/services/prompt-processors/shellProcessor.d.ts +4 -12
  105. package/dist/src/services/prompt-processors/shellProcessor.js +17 -58
  106. package/dist/src/services/prompt-processors/shellProcessor.js.map +1 -1
  107. package/dist/src/services/prompt-processors/types.d.ts +13 -8
  108. package/dist/src/services/prompt-processors/types.js +4 -0
  109. package/dist/src/services/prompt-processors/types.js.map +1 -1
  110. package/dist/src/services/types.d.ts +1 -1
  111. package/dist/src/test-utils/customMatchers.js +0 -6
  112. package/dist/src/test-utils/customMatchers.js.map +1 -1
  113. package/dist/src/test-utils/mockCommandContext.d.ts +1 -1
  114. package/dist/src/test-utils/render.d.ts +1 -1
  115. package/dist/src/ui/App.d.ts +2 -2
  116. package/dist/src/ui/App.js +47 -28
  117. package/dist/src/ui/App.js.map +1 -1
  118. package/dist/src/ui/IdeIntegrationNudge.d.ts +1 -1
  119. package/dist/src/ui/IdeIntegrationNudge.js +2 -7
  120. package/dist/src/ui/IdeIntegrationNudge.js.map +1 -1
  121. package/dist/src/ui/colors.d.ts +1 -1
  122. package/dist/src/ui/commands/aboutCommand.d.ts +1 -1
  123. package/dist/src/ui/commands/aboutCommand.js +2 -9
  124. package/dist/src/ui/commands/aboutCommand.js.map +1 -1
  125. package/dist/src/ui/commands/authCommand.d.ts +1 -1
  126. package/dist/src/ui/commands/authCommand.js.map +1 -1
  127. package/dist/src/ui/commands/chatCommand.d.ts +1 -1
  128. package/dist/src/ui/commands/chatCommand.js +3 -3
  129. package/dist/src/ui/commands/chatCommand.js.map +1 -1
  130. package/dist/src/ui/commands/clearCommand.d.ts +1 -1
  131. package/dist/src/ui/commands/clearCommand.js.map +1 -1
  132. package/dist/src/ui/commands/compressCommand.d.ts +1 -1
  133. package/dist/src/ui/commands/compressCommand.js +2 -0
  134. package/dist/src/ui/commands/compressCommand.js.map +1 -1
  135. package/dist/src/ui/commands/copyCommand.d.ts +1 -1
  136. package/dist/src/ui/commands/copyCommand.js +1 -1
  137. package/dist/src/ui/commands/copyCommand.js.map +1 -1
  138. package/dist/src/ui/commands/directoryCommand.d.ts +1 -1
  139. package/dist/src/ui/commands/directoryCommand.js +5 -4
  140. package/dist/src/ui/commands/directoryCommand.js.map +1 -1
  141. package/dist/src/ui/commands/helpCommand.d.ts +1 -1
  142. package/dist/src/ui/commands/helpCommand.js.map +1 -1
  143. package/dist/src/ui/commands/ideCommand.d.ts +2 -2
  144. package/dist/src/ui/commands/ideCommand.js +6 -8
  145. package/dist/src/ui/commands/ideCommand.js.map +1 -1
  146. package/dist/src/ui/commands/initCommand.d.ts +1 -1
  147. package/dist/src/ui/commands/initCommand.js +3 -3
  148. package/dist/src/ui/commands/initCommand.js.map +1 -1
  149. package/dist/src/ui/commands/mcpCommand.d.ts +1 -1
  150. package/dist/src/ui/commands/mcpCommand.js +1 -1
  151. package/dist/src/ui/commands/mcpCommand.js.map +1 -1
  152. package/dist/src/ui/commands/memoryCommand.d.ts +1 -1
  153. package/dist/src/ui/commands/memoryCommand.js +4 -3
  154. package/dist/src/ui/commands/memoryCommand.js.map +1 -1
  155. package/dist/src/ui/commands/privacyCommand.d.ts +1 -1
  156. package/dist/src/ui/commands/privacyCommand.js.map +1 -1
  157. package/dist/src/ui/commands/restoreCommand.d.ts +1 -1
  158. package/dist/src/ui/commands/restoreCommand.js +2 -2
  159. package/dist/src/ui/commands/restoreCommand.js.map +1 -1
  160. package/dist/src/ui/commands/settingsCommand.d.ts +1 -1
  161. package/dist/src/ui/commands/settingsCommand.js.map +1 -1
  162. package/dist/src/ui/commands/setupGithubCommand.d.ts +2 -1
  163. package/dist/src/ui/commands/setupGithubCommand.js +10 -9
  164. package/dist/src/ui/commands/setupGithubCommand.js.map +1 -1
  165. package/dist/src/ui/commands/setupGithubCommand.test.js +2 -7
  166. package/dist/src/ui/commands/setupGithubCommand.test.js.map +1 -1
  167. package/dist/src/ui/commands/statsCommand.js.map +1 -1
  168. package/dist/src/ui/commands/terminalSetupCommand.d.ts +1 -1
  169. package/dist/src/ui/commands/terminalSetupCommand.js.map +1 -1
  170. package/dist/src/ui/commands/themeCommand.d.ts +1 -1
  171. package/dist/src/ui/commands/themeCommand.js.map +1 -1
  172. package/dist/src/ui/commands/toolsCommand.js +1 -1
  173. package/dist/src/ui/commands/toolsCommand.js.map +1 -1
  174. package/dist/src/ui/commands/types.d.ts +7 -8
  175. package/dist/src/ui/commands/types.js +1 -0
  176. package/dist/src/ui/commands/types.js.map +1 -1
  177. package/dist/src/ui/commands/vimCommand.d.ts +1 -1
  178. package/dist/src/ui/commands/vimCommand.js.map +1 -1
  179. package/dist/src/ui/components/AboutBox.d.ts +1 -3
  180. package/dist/src/ui/components/AboutBox.js +1 -2
  181. package/dist/src/ui/components/AboutBox.js.map +1 -1
  182. package/dist/src/ui/components/AuthDialog.d.ts +3 -2
  183. package/dist/src/ui/components/AuthDialog.js +4 -13
  184. package/dist/src/ui/components/AuthDialog.js.map +1 -1
  185. package/dist/src/ui/components/AuthDialog.test.js +83 -49
  186. package/dist/src/ui/components/AuthDialog.test.js.map +1 -1
  187. package/dist/src/ui/components/AuthInProgress.d.ts +1 -1
  188. package/dist/src/ui/components/AuthInProgress.js +0 -5
  189. package/dist/src/ui/components/AuthInProgress.js.map +1 -1
  190. package/dist/src/ui/components/AutoAcceptIndicator.d.ts +1 -1
  191. package/dist/src/ui/components/ConsoleSummaryDisplay.d.ts +1 -1
  192. package/dist/src/ui/components/ContextSummaryDisplay.d.ts +1 -1
  193. package/dist/src/ui/components/ContextSummaryDisplay.js +1 -0
  194. package/dist/src/ui/components/ContextSummaryDisplay.js.map +1 -1
  195. package/dist/src/ui/components/DetailedMessagesDisplay.d.ts +2 -2
  196. package/dist/src/ui/components/EditorSettingsDialog.d.ts +4 -3
  197. package/dist/src/ui/components/EditorSettingsDialog.js +8 -11
  198. package/dist/src/ui/components/EditorSettingsDialog.js.map +1 -1
  199. package/dist/src/ui/components/FolderTrustDialog.d.ts +1 -1
  200. package/dist/src/ui/components/FolderTrustDialog.js +2 -2
  201. package/dist/src/ui/components/FolderTrustDialog.js.map +1 -1
  202. package/dist/src/ui/components/FolderTrustDialog.test.js +1 -1
  203. package/dist/src/ui/components/FolderTrustDialog.test.js.map +1 -1
  204. package/dist/src/ui/components/Footer.d.ts +1 -1
  205. package/dist/src/ui/components/GeminiRespondingSpinner.d.ts +1 -1
  206. package/dist/src/ui/components/Header.d.ts +1 -1
  207. package/dist/src/ui/components/Help.d.ts +2 -2
  208. package/dist/src/ui/components/HistoryItemDisplay.d.ts +4 -4
  209. package/dist/src/ui/components/HistoryItemDisplay.js +1 -1
  210. package/dist/src/ui/components/HistoryItemDisplay.js.map +1 -1
  211. package/dist/src/ui/components/HistoryItemDisplay.test.js +2 -0
  212. package/dist/src/ui/components/HistoryItemDisplay.test.js.map +1 -1
  213. package/dist/src/ui/components/InputPrompt.d.ts +5 -5
  214. package/dist/src/ui/components/InputPrompt.js +1 -6
  215. package/dist/src/ui/components/InputPrompt.js.map +1 -1
  216. package/dist/src/ui/components/LoadingIndicator.d.ts +2 -2
  217. package/dist/src/ui/components/MemoryUsageDisplay.d.ts +1 -1
  218. package/dist/src/ui/components/MemoryUsageDisplay.js +0 -5
  219. package/dist/src/ui/components/MemoryUsageDisplay.js.map +1 -1
  220. package/dist/src/ui/components/ModelStatsDisplay.d.ts +1 -1
  221. package/dist/src/ui/components/ModelStatsDisplay.js.map +1 -1
  222. package/dist/src/ui/components/PrepareLabel.d.ts +1 -1
  223. package/dist/src/ui/components/SessionSummaryDisplay.d.ts +1 -1
  224. package/dist/src/ui/components/SettingsDialog.d.ts +2 -1
  225. package/dist/src/ui/components/SettingsDialog.js +2 -2
  226. package/dist/src/ui/components/SettingsDialog.js.map +1 -1
  227. package/dist/src/ui/components/SettingsDialog.test.js +32 -14
  228. package/dist/src/ui/components/SettingsDialog.test.js.map +1 -1
  229. package/dist/src/ui/components/ShellConfirmationDialog.d.ts +1 -1
  230. package/dist/src/ui/components/ShellConfirmationDialog.js +1 -1
  231. package/dist/src/ui/components/ShellConfirmationDialog.js.map +1 -1
  232. package/dist/src/ui/components/ShellModeIndicator.d.ts +1 -1
  233. package/dist/src/ui/components/StatsDisplay.d.ts +1 -1
  234. package/dist/src/ui/components/StatsDisplay.js.map +1 -1
  235. package/dist/src/ui/components/SuggestionsDisplay.js +2 -1
  236. package/dist/src/ui/components/SuggestionsDisplay.js.map +1 -1
  237. package/dist/src/ui/components/ThemeDialog.d.ts +3 -2
  238. package/dist/src/ui/components/ThemeDialog.js +5 -10
  239. package/dist/src/ui/components/ThemeDialog.js.map +1 -1
  240. package/dist/src/ui/components/Tips.d.ts +1 -1
  241. package/dist/src/ui/components/Tips.js +1 -0
  242. package/dist/src/ui/components/Tips.js.map +1 -1
  243. package/dist/src/ui/components/ToolStatsDisplay.d.ts +1 -1
  244. package/dist/src/ui/components/WorkspaceMigrationDialog.d.ts +11 -0
  245. package/dist/src/ui/components/WorkspaceMigrationDialog.js +42 -0
  246. package/dist/src/ui/components/WorkspaceMigrationDialog.js.map +1 -0
  247. package/dist/src/ui/components/messages/CompressionMessage.d.ts +2 -2
  248. package/dist/src/ui/components/messages/DiffRenderer.d.ts +1 -1
  249. package/dist/src/ui/components/messages/DiffRenderer.js +2 -3
  250. package/dist/src/ui/components/messages/DiffRenderer.js.map +1 -1
  251. package/dist/src/ui/components/messages/DiffRenderer.test.js +10 -11
  252. package/dist/src/ui/components/messages/DiffRenderer.test.js.map +1 -1
  253. package/dist/src/ui/components/messages/ErrorMessage.d.ts +1 -1
  254. package/dist/src/ui/components/messages/GeminiMessage.d.ts +1 -1
  255. package/dist/src/ui/components/messages/GeminiMessageContent.d.ts +1 -1
  256. package/dist/src/ui/components/messages/InfoMessage.d.ts +1 -1
  257. package/dist/src/ui/components/messages/ToolConfirmationMessage.d.ts +3 -3
  258. package/dist/src/ui/components/messages/ToolConfirmationMessage.js +41 -24
  259. package/dist/src/ui/components/messages/ToolConfirmationMessage.js.map +1 -1
  260. package/dist/src/ui/components/messages/ToolConfirmationMessage.test.js +87 -2
  261. package/dist/src/ui/components/messages/ToolConfirmationMessage.test.js.map +1 -1
  262. package/dist/src/ui/components/messages/ToolGroupMessage.d.ts +4 -4
  263. package/dist/src/ui/components/messages/ToolGroupMessage.js +1 -6
  264. package/dist/src/ui/components/messages/ToolGroupMessage.js.map +1 -1
  265. package/dist/src/ui/components/messages/ToolGroupMessage.test.d.ts +6 -0
  266. package/dist/src/ui/components/messages/ToolGroupMessage.test.js +259 -0
  267. package/dist/src/ui/components/messages/ToolGroupMessage.test.js.map +1 -0
  268. package/dist/src/ui/components/messages/ToolMessage.d.ts +1 -1
  269. package/dist/src/ui/components/messages/ToolMessage.js +2 -1
  270. package/dist/src/ui/components/messages/ToolMessage.js.map +1 -1
  271. package/dist/src/ui/components/messages/ToolMessage.test.js +6 -6
  272. package/dist/src/ui/components/messages/ToolMessage.test.js.map +1 -1
  273. package/dist/src/ui/components/messages/UserMessage.d.ts +1 -1
  274. package/dist/src/ui/components/messages/UserMessage.js +2 -1
  275. package/dist/src/ui/components/messages/UserMessage.js.map +1 -1
  276. package/dist/src/ui/components/messages/UserShellMessage.d.ts +1 -1
  277. package/dist/src/ui/components/shared/RadioButtonSelect.d.ts +1 -1
  278. package/dist/src/ui/components/shared/RadioButtonSelect.js +0 -5
  279. package/dist/src/ui/components/shared/RadioButtonSelect.js.map +1 -1
  280. package/dist/src/ui/components/shared/text-buffer.js +4 -4
  281. package/dist/src/ui/components/shared/text-buffer.js.map +1 -1
  282. package/dist/src/ui/components/shared/vim-buffer-actions.d.ts +1 -1
  283. package/dist/src/ui/components/shared/vim-buffer-actions.js.map +1 -1
  284. package/dist/src/ui/constants.d.ts +8 -0
  285. package/dist/src/ui/constants.js +9 -0
  286. package/dist/src/ui/constants.js.map +1 -1
  287. package/dist/src/ui/contexts/KeypressContext.d.ts +2 -2
  288. package/dist/src/ui/contexts/KeypressContext.js +12 -22
  289. package/dist/src/ui/contexts/KeypressContext.js.map +1 -1
  290. package/dist/src/ui/contexts/KeypressContext.test.js +66 -11
  291. package/dist/src/ui/contexts/KeypressContext.test.js.map +1 -1
  292. package/dist/src/ui/contexts/OverflowContext.d.ts +1 -1
  293. package/dist/src/ui/contexts/OverflowContext.js +0 -5
  294. package/dist/src/ui/contexts/OverflowContext.js.map +1 -1
  295. package/dist/src/ui/contexts/SessionContext.d.ts +2 -2
  296. package/dist/src/ui/contexts/SessionContext.js +1 -6
  297. package/dist/src/ui/contexts/SessionContext.js.map +1 -1
  298. package/dist/src/ui/contexts/SettingsContext.d.ts +1 -1
  299. package/dist/src/ui/contexts/StreamingContext.d.ts +1 -1
  300. package/dist/src/ui/contexts/VimModeContext.d.ts +1 -1
  301. package/dist/src/ui/contexts/VimModeContext.js +4 -4
  302. package/dist/src/ui/contexts/VimModeContext.js.map +1 -1
  303. package/dist/src/ui/hooks/atCommandProcessor.d.ts +3 -3
  304. package/dist/src/ui/hooks/atCommandProcessor.js +3 -3
  305. package/dist/src/ui/hooks/atCommandProcessor.js.map +1 -1
  306. package/dist/src/ui/hooks/atCommandProcessor.test.js +11 -4
  307. package/dist/src/ui/hooks/atCommandProcessor.test.js.map +1 -1
  308. package/dist/src/ui/hooks/shellCommandProcessor.d.ts +3 -3
  309. package/dist/src/ui/hooks/shellCommandProcessor.js +7 -6
  310. package/dist/src/ui/hooks/shellCommandProcessor.js.map +1 -1
  311. package/dist/src/ui/hooks/shellCommandProcessor.test.js +5 -4
  312. package/dist/src/ui/hooks/shellCommandProcessor.test.js.map +1 -1
  313. package/dist/src/ui/hooks/slashCommandProcessor.d.ts +5 -4
  314. package/dist/src/ui/hooks/slashCommandProcessor.js +3 -1
  315. package/dist/src/ui/hooks/slashCommandProcessor.js.map +1 -1
  316. package/dist/src/ui/hooks/useAtCompletion.d.ts +2 -2
  317. package/dist/src/ui/hooks/useAtCompletion.js +2 -2
  318. package/dist/src/ui/hooks/useAtCompletion.js.map +1 -1
  319. package/dist/src/ui/hooks/useAuthCommand.d.ts +2 -2
  320. package/dist/src/ui/hooks/useAuthCommand.js +5 -4
  321. package/dist/src/ui/hooks/useAuthCommand.js.map +1 -1
  322. package/dist/src/ui/hooks/useAutoAcceptIndicator.d.ts +3 -1
  323. package/dist/src/ui/hooks/useAutoAcceptIndicator.js +13 -4
  324. package/dist/src/ui/hooks/useAutoAcceptIndicator.js.map +1 -1
  325. package/dist/src/ui/hooks/useAutoAcceptIndicator.test.js +122 -2
  326. package/dist/src/ui/hooks/useAutoAcceptIndicator.test.js.map +1 -1
  327. package/dist/src/ui/hooks/useCommandCompletion.d.ts +5 -5
  328. package/dist/src/ui/hooks/useCommandCompletion.js +2 -2
  329. package/dist/src/ui/hooks/useCommandCompletion.js.map +1 -1
  330. package/dist/src/ui/hooks/useCompletion.d.ts +1 -1
  331. package/dist/src/ui/hooks/useCompletion.js +1 -1
  332. package/dist/src/ui/hooks/useCompletion.js.map +1 -1
  333. package/dist/src/ui/hooks/useConsoleMessages.d.ts +1 -1
  334. package/dist/src/ui/hooks/useEditorSettings.d.ts +2 -2
  335. package/dist/src/ui/hooks/useEditorSettings.js.map +1 -1
  336. package/dist/src/ui/hooks/useEditorSettings.test.js.map +1 -1
  337. package/dist/src/ui/hooks/useFolderTrust.d.ts +1 -1
  338. package/dist/src/ui/hooks/useFolderTrust.js +3 -2
  339. package/dist/src/ui/hooks/useFolderTrust.js.map +1 -1
  340. package/dist/src/ui/hooks/useGeminiStream.d.ts +4 -3
  341. package/dist/src/ui/hooks/useGeminiStream.js +18 -6
  342. package/dist/src/ui/hooks/useGeminiStream.js.map +1 -1
  343. package/dist/src/ui/hooks/useGitBranchName.js +1 -1
  344. package/dist/src/ui/hooks/useGitBranchName.js.map +1 -1
  345. package/dist/src/ui/hooks/useGitBranchName.test.js +1 -1
  346. package/dist/src/ui/hooks/useGitBranchName.test.js.map +1 -1
  347. package/dist/src/ui/hooks/useHistoryManager.d.ts +1 -1
  348. package/dist/src/ui/hooks/useKeypress.d.ts +2 -2
  349. package/dist/src/ui/hooks/useKeypress.js +1 -1
  350. package/dist/src/ui/hooks/useKeypress.js.map +1 -1
  351. package/dist/src/ui/hooks/useLogger.d.ts +2 -1
  352. package/dist/src/ui/hooks/useLogger.js.map +1 -1
  353. package/dist/src/ui/hooks/usePrivacySettings.d.ts +1 -1
  354. package/dist/src/ui/hooks/usePrivacySettings.js.map +1 -1
  355. package/dist/src/ui/hooks/usePrivacySettings.test.js.map +1 -1
  356. package/dist/src/ui/hooks/usePromptCompletion.d.ts +2 -2
  357. package/dist/src/ui/hooks/usePromptCompletion.js +3 -2
  358. package/dist/src/ui/hooks/usePromptCompletion.js.map +1 -1
  359. package/dist/src/ui/hooks/useReactToolScheduler.d.ts +2 -2
  360. package/dist/src/ui/hooks/useReactToolScheduler.js +2 -2
  361. package/dist/src/ui/hooks/useReactToolScheduler.js.map +1 -1
  362. package/dist/src/ui/hooks/useReverseSearchCompletion.d.ts +2 -2
  363. package/dist/src/ui/hooks/useShellHistory.js +2 -2
  364. package/dist/src/ui/hooks/useShellHistory.js.map +1 -1
  365. package/dist/src/ui/hooks/useShellHistory.test.js +4 -4
  366. package/dist/src/ui/hooks/useShellHistory.test.js.map +1 -1
  367. package/dist/src/ui/hooks/useShowMemoryCommand.d.ts +3 -3
  368. package/dist/src/ui/hooks/useShowMemoryCommand.js +1 -1
  369. package/dist/src/ui/hooks/useShowMemoryCommand.js.map +1 -1
  370. package/dist/src/ui/hooks/useSlashCompletion.d.ts +2 -2
  371. package/dist/src/ui/hooks/useThemeCommand.d.ts +1 -1
  372. package/dist/src/ui/hooks/useThemeCommand.js +8 -8
  373. package/dist/src/ui/hooks/useThemeCommand.js.map +1 -1
  374. package/dist/src/ui/hooks/useToolScheduler.test.js +9 -6
  375. package/dist/src/ui/hooks/useToolScheduler.test.js.map +1 -1
  376. package/dist/src/ui/hooks/useWorkspaceMigration.d.ts +13 -0
  377. package/dist/src/ui/hooks/useWorkspaceMigration.js +53 -0
  378. package/dist/src/ui/hooks/useWorkspaceMigration.js.map +1 -0
  379. package/dist/src/ui/keyMatchers.d.ts +2 -1
  380. package/dist/src/ui/keyMatchers.js +1 -1
  381. package/dist/src/ui/keyMatchers.js.map +1 -1
  382. package/dist/src/ui/keyMatchers.test.js.map +1 -1
  383. package/dist/src/ui/privacy/CloudFreePrivacyNotice.d.ts +1 -1
  384. package/dist/src/ui/semantic-colors.d.ts +1 -1
  385. package/dist/src/ui/themes/atom-one-dark.js +1 -2
  386. package/dist/src/ui/themes/atom-one-dark.js.map +1 -1
  387. package/dist/src/ui/themes/ayu-light.js +1 -2
  388. package/dist/src/ui/themes/ayu-light.js.map +1 -1
  389. package/dist/src/ui/themes/ayu.js +1 -2
  390. package/dist/src/ui/themes/ayu.js.map +1 -1
  391. package/dist/src/ui/themes/default-light.js +1 -2
  392. package/dist/src/ui/themes/default-light.js.map +1 -1
  393. package/dist/src/ui/themes/default.js +1 -2
  394. package/dist/src/ui/themes/default.js.map +1 -1
  395. package/dist/src/ui/themes/dracula.js +1 -2
  396. package/dist/src/ui/themes/dracula.js.map +1 -1
  397. package/dist/src/ui/themes/github-dark.js +1 -2
  398. package/dist/src/ui/themes/github-dark.js.map +1 -1
  399. package/dist/src/ui/themes/github-light.js +1 -2
  400. package/dist/src/ui/themes/github-light.js.map +1 -1
  401. package/dist/src/ui/themes/googlecode.js +2 -3
  402. package/dist/src/ui/themes/googlecode.js.map +1 -1
  403. package/dist/src/ui/themes/no-color.js.map +1 -1
  404. package/dist/src/ui/themes/shades-of-purple.js +1 -2
  405. package/dist/src/ui/themes/shades-of-purple.js.map +1 -1
  406. package/dist/src/ui/themes/theme-manager.d.ts +2 -2
  407. package/dist/src/ui/themes/theme-manager.js +1 -1
  408. package/dist/src/ui/themes/theme-manager.js.map +1 -1
  409. package/dist/src/ui/themes/theme.d.ts +3 -3
  410. package/dist/src/ui/themes/theme.js +30 -2
  411. package/dist/src/ui/themes/theme.js.map +1 -1
  412. package/dist/src/ui/themes/xcode.js +1 -2
  413. package/dist/src/ui/themes/xcode.js.map +1 -1
  414. package/dist/src/ui/types.d.ts +4 -3
  415. package/dist/src/ui/types.js.map +1 -1
  416. package/dist/src/ui/utils/CodeColorizer.d.ts +2 -2
  417. package/dist/src/ui/utils/CodeColorizer.js +1 -1
  418. package/dist/src/ui/utils/CodeColorizer.js.map +1 -1
  419. package/dist/src/ui/utils/ConsolePatcher.d.ts +1 -1
  420. package/dist/src/ui/utils/ConsolePatcher.js +1 -1
  421. package/dist/src/ui/utils/ConsolePatcher.js.map +1 -1
  422. package/dist/src/ui/utils/MarkdownDisplay.js +1 -1
  423. package/dist/src/ui/utils/MarkdownDisplay.js.map +1 -1
  424. package/dist/src/ui/utils/MarkdownDisplay.test.js +3 -3
  425. package/dist/src/ui/utils/MarkdownDisplay.test.js.map +1 -1
  426. package/dist/src/ui/utils/clipboardUtils.js +4 -4
  427. package/dist/src/ui/utils/clipboardUtils.js.map +1 -1
  428. package/dist/src/ui/utils/commandUtils.d.ts +1 -1
  429. package/dist/src/ui/utils/commandUtils.js +16 -3
  430. package/dist/src/ui/utils/commandUtils.js.map +1 -1
  431. package/dist/src/ui/utils/commandUtils.test.js +12 -2
  432. package/dist/src/ui/utils/commandUtils.test.js.map +1 -1
  433. package/dist/src/ui/utils/computeStats.d.ts +1 -1
  434. package/dist/src/ui/utils/platformConstants.d.ts +2 -0
  435. package/dist/src/ui/utils/platformConstants.js +2 -0
  436. package/dist/src/ui/utils/platformConstants.js.map +1 -1
  437. package/dist/src/ui/utils/terminalSetup.js +5 -5
  438. package/dist/src/ui/utils/terminalSetup.js.map +1 -1
  439. package/dist/src/ui/utils/textUtils.js +1 -1
  440. package/dist/src/ui/utils/textUtils.js.map +1 -1
  441. package/dist/src/ui/utils/updateCheck.d.ts +1 -1
  442. package/dist/src/ui/utils/updateCheck.js.map +1 -1
  443. package/dist/src/utils/cleanup.js +2 -2
  444. package/dist/src/utils/cleanup.js.map +1 -1
  445. package/dist/src/utils/dialogScopeUtils.d.ts +2 -1
  446. package/dist/src/utils/dialogScopeUtils.js.map +1 -1
  447. package/dist/src/utils/errors.d.ts +6 -0
  448. package/dist/src/utils/errors.js +12 -0
  449. package/dist/src/utils/errors.js.map +1 -0
  450. package/dist/src/utils/events.d.ts +1 -1
  451. package/dist/src/utils/events.js +1 -1
  452. package/dist/src/utils/events.js.map +1 -1
  453. package/dist/src/utils/gitUtils.js +1 -1
  454. package/dist/src/utils/gitUtils.js.map +1 -1
  455. package/dist/src/utils/gitUtils.test.js +4 -4
  456. package/dist/src/utils/gitUtils.test.js.map +1 -1
  457. package/dist/src/utils/handleAutoUpdate.d.ts +4 -4
  458. package/dist/src/utils/handleAutoUpdate.js +4 -3
  459. package/dist/src/utils/handleAutoUpdate.js.map +1 -1
  460. package/dist/src/utils/installationInfo.js +3 -3
  461. package/dist/src/utils/installationInfo.js.map +1 -1
  462. package/dist/src/utils/installationInfo.test.js +3 -3
  463. package/dist/src/utils/installationInfo.test.js.map +1 -1
  464. package/dist/src/utils/package.js +2 -2
  465. package/dist/src/utils/package.js.map +1 -1
  466. package/dist/src/utils/readStdin.js +32 -56
  467. package/dist/src/utils/readStdin.js.map +1 -1
  468. package/dist/src/utils/readStdin.test.d.ts +6 -0
  469. package/dist/src/utils/readStdin.test.js +88 -0
  470. package/dist/src/utils/readStdin.test.js.map +1 -0
  471. package/dist/src/utils/resolvePath.js +2 -2
  472. package/dist/src/utils/resolvePath.js.map +1 -1
  473. package/dist/src/utils/sandbox.d.ts +1 -1
  474. package/dist/src/utils/sandbox.js +11 -19
  475. package/dist/src/utils/sandbox.js.map +1 -1
  476. package/dist/src/utils/settingsUtils.d.ts +2 -2
  477. package/dist/src/utils/settingsUtils.js +2 -8
  478. package/dist/src/utils/settingsUtils.js.map +1 -1
  479. package/dist/src/utils/settingsUtils.test.js +145 -148
  480. package/dist/src/utils/settingsUtils.test.js.map +1 -1
  481. package/dist/src/utils/spawnWrapper.d.ts +1 -1
  482. package/dist/src/utils/spawnWrapper.js +1 -1
  483. package/dist/src/utils/spawnWrapper.js.map +1 -1
  484. package/dist/src/utils/startupWarnings.js +2 -2
  485. package/dist/src/utils/startupWarnings.js.map +1 -1
  486. package/dist/src/utils/updateEventEmitter.d.ts +1 -1
  487. package/dist/src/utils/updateEventEmitter.js +1 -1
  488. package/dist/src/utils/updateEventEmitter.js.map +1 -1
  489. package/dist/src/utils/userStartupWarnings.js +3 -3
  490. package/dist/src/utils/userStartupWarnings.js.map +1 -1
  491. package/dist/src/utils/userStartupWarnings.test.js +3 -3
  492. package/dist/src/utils/userStartupWarnings.test.js.map +1 -1
  493. package/dist/src/validateNonInterActiveAuth.d.ts +2 -1
  494. package/dist/src/validateNonInterActiveAuth.js.map +1 -1
  495. package/dist/src/zed-integration/acp.d.ts +1 -1
  496. package/dist/src/zed-integration/acp.js +1 -1
  497. package/dist/src/zed-integration/acp.js.map +1 -1
  498. package/dist/src/zed-integration/fileSystemService.d.ts +2 -2
  499. package/dist/src/zed-integration/schema.d.ts +306 -306
  500. package/dist/src/zed-integration/zedIntegration.d.ts +4 -4
  501. package/dist/src/zed-integration/zedIntegration.js +58 -58
  502. package/dist/src/zed-integration/zedIntegration.js.map +1 -1
  503. package/dist/tsconfig.tsbuildinfo +1 -1
  504. package/package.json +6 -6
  505. package/dist/src/utils/license.d.ts +0 -13
  506. package/dist/src/utils/license.js +0 -35
  507. package/dist/src/utils/license.js.map +0 -1
  508. package/dist/src/utils/license.test.js +0 -77
  509. package/dist/src/utils/license.test.js.map +0 -1
  510. /package/dist/src/{utils/license.test.d.ts → commands/extensions/install.test.d.ts} +0 -0
@@ -3,18 +3,20 @@
3
3
  * Copyright 2025 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
- import { Settings, MemoryImportFormat } from './settingsSchema.js';
6
+ import type { Settings, MemoryImportFormat } from './settingsSchema.js';
7
7
  export type { Settings, MemoryImportFormat };
8
8
  export declare const SETTINGS_DIRECTORY_NAME = ".gemini";
9
9
  export declare const USER_SETTINGS_PATH: string;
10
10
  export declare const USER_SETTINGS_DIR: string;
11
11
  export declare const DEFAULT_EXCLUDED_ENV_VARS: string[];
12
12
  export declare function getSystemSettingsPath(): string;
13
+ export declare function getSystemDefaultsPath(): string;
13
14
  export type { DnsResolutionOrder } from './settingsSchema.js';
14
15
  export declare enum SettingScope {
15
16
  User = "User",
16
17
  Workspace = "Workspace",
17
- System = "System"
18
+ System = "System",
19
+ SystemDefaults = "SystemDefaults"
18
20
  }
19
21
  export interface CheckpointingSettings {
20
22
  enabled?: boolean;
@@ -34,18 +36,21 @@ export interface SettingsFile {
34
36
  settings: Settings;
35
37
  path: string;
36
38
  }
39
+ export declare function migrateSettingsToV1(v2Settings: Record<string, unknown>): Record<string, unknown>;
37
40
  export declare class LoadedSettings {
38
- constructor(system: SettingsFile, user: SettingsFile, workspace: SettingsFile, errors: SettingsError[], isTrusted: boolean);
41
+ constructor(system: SettingsFile, systemDefaults: SettingsFile, user: SettingsFile, workspace: SettingsFile, errors: SettingsError[], isTrusted: boolean, migratedInMemorScopes: Set<SettingScope>);
39
42
  readonly system: SettingsFile;
43
+ readonly systemDefaults: SettingsFile;
40
44
  readonly user: SettingsFile;
41
45
  readonly workspace: SettingsFile;
42
46
  readonly errors: SettingsError[];
43
47
  readonly isTrusted: boolean;
48
+ readonly migratedInMemorScopes: Set<SettingScope>;
44
49
  private _merged;
45
50
  get merged(): Settings;
46
51
  private computeMergedSettings;
47
52
  forScope(scope: SettingScope): SettingsFile;
48
- setValue<K extends keyof Settings>(scope: SettingScope, key: K, value: Settings[K]): void;
53
+ setValue(scope: SettingScope, key: string, value: unknown): void;
49
54
  }
50
55
  export declare function setUpCloudShellEnvironment(envFilePath: string | null): void;
51
56
  export declare function loadEnvironment(settings?: Settings): void;
@@ -3,19 +3,70 @@
3
3
  * Copyright 2025 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
- import * as fs from 'fs';
7
- import * as path from 'path';
8
- import { homedir, platform } from 'os';
6
+ import * as fs from 'node:fs';
7
+ import * as path from 'node:path';
8
+ import { homedir, platform } from 'node:os';
9
9
  import * as dotenv from 'dotenv';
10
10
  import { GEMINI_CONFIG_DIR as GEMINI_DIR, getErrorMessage, Storage, } from '@google/gemini-cli-core';
11
11
  import stripJsonComments from 'strip-json-comments';
12
12
  import { DefaultLight } from '../ui/themes/default-light.js';
13
13
  import { DefaultDark } from '../ui/themes/default.js';
14
14
  import { isWorkspaceTrusted } from './trustedFolders.js';
15
+ import { mergeWith } from 'lodash-es';
15
16
  export const SETTINGS_DIRECTORY_NAME = '.gemini';
16
17
  export const USER_SETTINGS_PATH = Storage.getGlobalSettingsPath();
17
18
  export const USER_SETTINGS_DIR = path.dirname(USER_SETTINGS_PATH);
18
19
  export const DEFAULT_EXCLUDED_ENV_VARS = ['DEBUG', 'DEBUG_MODE'];
20
+ const MIGRATE_V2_OVERWRITE = false;
21
+ const MIGRATION_MAP = {
22
+ preferredEditor: 'general.preferredEditor',
23
+ vimMode: 'general.vimMode',
24
+ disableAutoUpdate: 'general.disableAutoUpdate',
25
+ disableUpdateNag: 'general.disableUpdateNag',
26
+ checkpointing: 'general.checkpointing',
27
+ theme: 'ui.theme',
28
+ customThemes: 'ui.customThemes',
29
+ hideWindowTitle: 'ui.hideWindowTitle',
30
+ hideTips: 'ui.hideTips',
31
+ hideBanner: 'ui.hideBanner',
32
+ hideFooter: 'ui.hideFooter',
33
+ showMemoryUsage: 'ui.showMemoryUsage',
34
+ showLineNumbers: 'ui.showLineNumbers',
35
+ accessibility: 'ui.accessibility',
36
+ ideMode: 'ide.enabled',
37
+ hasSeenIdeIntegrationNudge: 'ide.hasSeenNudge',
38
+ usageStatisticsEnabled: 'privacy.usageStatisticsEnabled',
39
+ telemetry: 'telemetry',
40
+ model: 'model.name',
41
+ maxSessionTurns: 'model.maxSessionTurns',
42
+ summarizeToolOutput: 'model.summarizeToolOutput',
43
+ chatCompression: 'model.chatCompression',
44
+ skipNextSpeakerCheck: 'model.skipNextSpeakerCheck',
45
+ contextFileName: 'context.fileName',
46
+ memoryImportFormat: 'context.importFormat',
47
+ memoryDiscoveryMaxDirs: 'context.discoveryMaxDirs',
48
+ includeDirectories: 'context.includeDirectories',
49
+ loadMemoryFromIncludeDirectories: 'context.loadFromIncludeDirectories',
50
+ fileFiltering: 'context.fileFiltering',
51
+ sandbox: 'tools.sandbox',
52
+ shouldUseNodePtyShell: 'tools.usePty',
53
+ allowedTools: 'tools.allowed',
54
+ coreTools: 'tools.core',
55
+ excludeTools: 'tools.exclude',
56
+ toolDiscoveryCommand: 'tools.discoveryCommand',
57
+ toolCallCommand: 'tools.callCommand',
58
+ mcpServerCommand: 'mcp.serverCommand',
59
+ allowMCPServers: 'mcp.allowed',
60
+ excludeMCPServers: 'mcp.excluded',
61
+ folderTrustFeature: 'security.folderTrust.featureEnabled',
62
+ folderTrust: 'security.folderTrust.enabled',
63
+ selectedAuthType: 'security.auth.selectedType',
64
+ useExternalAuth: 'security.auth.useExternal',
65
+ autoConfigureMaxOldSpaceSize: 'advanced.autoConfigureMemory',
66
+ dnsResolutionOrder: 'advanced.dnsResolutionOrder',
67
+ excludedProjectEnvVars: 'advanced.excludedEnvVars',
68
+ bugCommand: 'advanced.bugCommand',
69
+ };
19
70
  export function getSystemSettingsPath() {
20
71
  if (process.env['GEMINI_CLI_SYSTEM_SETTINGS_PATH']) {
21
72
  return process.env['GEMINI_CLI_SYSTEM_SETTINGS_PATH'];
@@ -30,63 +81,288 @@ export function getSystemSettingsPath() {
30
81
  return '/etc/gemini-cli/settings.json';
31
82
  }
32
83
  }
84
+ export function getSystemDefaultsPath() {
85
+ if (process.env['GEMINI_CLI_SYSTEM_DEFAULTS_PATH']) {
86
+ return process.env['GEMINI_CLI_SYSTEM_DEFAULTS_PATH'];
87
+ }
88
+ return path.join(path.dirname(getSystemSettingsPath()), 'system-defaults.json');
89
+ }
33
90
  export var SettingScope;
34
91
  (function (SettingScope) {
35
92
  SettingScope["User"] = "User";
36
93
  SettingScope["Workspace"] = "Workspace";
37
94
  SettingScope["System"] = "System";
95
+ SettingScope["SystemDefaults"] = "SystemDefaults";
38
96
  })(SettingScope || (SettingScope = {}));
39
- function mergeSettings(system, user, workspace, isTrusted) {
97
+ function setNestedProperty(obj, path, value) {
98
+ const keys = path.split('.');
99
+ const lastKey = keys.pop();
100
+ if (!lastKey)
101
+ return;
102
+ let current = obj;
103
+ for (const key of keys) {
104
+ if (current[key] === undefined) {
105
+ current[key] = {};
106
+ }
107
+ const next = current[key];
108
+ if (typeof next === 'object' && next !== null) {
109
+ current = next;
110
+ }
111
+ else {
112
+ // This path is invalid, so we stop.
113
+ return;
114
+ }
115
+ }
116
+ current[lastKey] = value;
117
+ }
118
+ function needsMigration(settings) {
119
+ return !('general' in settings);
120
+ }
121
+ function migrateSettingsToV2(flatSettings) {
122
+ if (!needsMigration(flatSettings)) {
123
+ return null;
124
+ }
125
+ const v2Settings = {};
126
+ const flatKeys = new Set(Object.keys(flatSettings));
127
+ for (const [oldKey, newPath] of Object.entries(MIGRATION_MAP)) {
128
+ if (flatKeys.has(oldKey)) {
129
+ setNestedProperty(v2Settings, newPath, flatSettings[oldKey]);
130
+ flatKeys.delete(oldKey);
131
+ }
132
+ }
133
+ // Preserve mcpServers at the top level
134
+ if (flatSettings['mcpServers']) {
135
+ v2Settings['mcpServers'] = flatSettings['mcpServers'];
136
+ flatKeys.delete('mcpServers');
137
+ }
138
+ // Carry over any unrecognized keys
139
+ for (const remainingKey of flatKeys) {
140
+ v2Settings[remainingKey] = flatSettings[remainingKey];
141
+ }
142
+ return v2Settings;
143
+ }
144
+ function getNestedProperty(obj, path) {
145
+ const keys = path.split('.');
146
+ let current = obj;
147
+ for (const key of keys) {
148
+ if (typeof current !== 'object' || current === null || !(key in current)) {
149
+ return undefined;
150
+ }
151
+ current = current[key];
152
+ }
153
+ return current;
154
+ }
155
+ const REVERSE_MIGRATION_MAP = Object.fromEntries(Object.entries(MIGRATION_MAP).map(([key, value]) => [value, key]));
156
+ // Dynamically determine the top-level keys from the V2 settings structure.
157
+ const KNOWN_V2_CONTAINERS = new Set(Object.values(MIGRATION_MAP).map((path) => path.split('.')[0]));
158
+ export function migrateSettingsToV1(v2Settings) {
159
+ const v1Settings = {};
160
+ const v2Keys = new Set(Object.keys(v2Settings));
161
+ for (const [newPath, oldKey] of Object.entries(REVERSE_MIGRATION_MAP)) {
162
+ const value = getNestedProperty(v2Settings, newPath);
163
+ if (value !== undefined) {
164
+ v1Settings[oldKey] = value;
165
+ v2Keys.delete(newPath.split('.')[0]);
166
+ }
167
+ }
168
+ // Preserve mcpServers at the top level
169
+ if (v2Settings['mcpServers']) {
170
+ v1Settings['mcpServers'] = v2Settings['mcpServers'];
171
+ v2Keys.delete('mcpServers');
172
+ }
173
+ // Carry over any unrecognized keys
174
+ for (const remainingKey of v2Keys) {
175
+ const value = v2Settings[remainingKey];
176
+ if (value === undefined) {
177
+ continue;
178
+ }
179
+ // Don't carry over empty objects that were just containers for migrated settings.
180
+ if (KNOWN_V2_CONTAINERS.has(remainingKey) &&
181
+ typeof value === 'object' &&
182
+ value !== null &&
183
+ !Array.isArray(value) &&
184
+ Object.keys(value).length === 0) {
185
+ continue;
186
+ }
187
+ v1Settings[remainingKey] = value;
188
+ }
189
+ return v1Settings;
190
+ }
191
+ function mergeSettings(system, systemDefaults, user, workspace, isTrusted) {
40
192
  const safeWorkspace = isTrusted ? workspace : {};
41
193
  // folderTrust is not supported at workspace level.
42
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
43
- const { folderTrust, ...safeWorkspaceWithoutFolderTrust } = safeWorkspace;
194
+ const { security, ...restOfWorkspace } = safeWorkspace;
195
+ const safeWorkspaceWithoutFolderTrust = security
196
+ ? {
197
+ ...restOfWorkspace,
198
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
199
+ security: (({ folderTrust, ...rest }) => rest)(security),
200
+ }
201
+ : {
202
+ ...restOfWorkspace,
203
+ security: {},
204
+ };
205
+ // Settings are merged with the following precedence (last one wins for
206
+ // single values):
207
+ // 1. System Defaults
208
+ // 2. User Settings
209
+ // 3. Workspace Settings
210
+ // 4. System Settings (as overrides)
211
+ //
212
+ // For properties that are arrays (e.g., includeDirectories), the arrays
213
+ // are concatenated. For objects (e.g., customThemes), they are merged.
44
214
  return {
215
+ ...systemDefaults,
45
216
  ...user,
46
217
  ...safeWorkspaceWithoutFolderTrust,
47
218
  ...system,
48
- customThemes: {
49
- ...(user.customThemes || {}),
50
- ...(safeWorkspace.customThemes || {}),
51
- ...(system.customThemes || {}),
219
+ general: {
220
+ ...(systemDefaults.general || {}),
221
+ ...(user.general || {}),
222
+ ...(safeWorkspaceWithoutFolderTrust.general || {}),
223
+ ...(system.general || {}),
224
+ },
225
+ ui: {
226
+ ...(systemDefaults.ui || {}),
227
+ ...(user.ui || {}),
228
+ ...(safeWorkspaceWithoutFolderTrust.ui || {}),
229
+ ...(system.ui || {}),
230
+ customThemes: {
231
+ ...(systemDefaults.ui?.customThemes || {}),
232
+ ...(user.ui?.customThemes || {}),
233
+ ...(safeWorkspaceWithoutFolderTrust.ui?.customThemes || {}),
234
+ ...(system.ui?.customThemes || {}),
235
+ },
236
+ },
237
+ ide: {
238
+ ...(systemDefaults.ide || {}),
239
+ ...(user.ide || {}),
240
+ ...(safeWorkspaceWithoutFolderTrust.ide || {}),
241
+ ...(system.ide || {}),
242
+ },
243
+ privacy: {
244
+ ...(systemDefaults.privacy || {}),
245
+ ...(user.privacy || {}),
246
+ ...(safeWorkspaceWithoutFolderTrust.privacy || {}),
247
+ ...(system.privacy || {}),
248
+ },
249
+ telemetry: {
250
+ ...(systemDefaults.telemetry || {}),
251
+ ...(user.telemetry || {}),
252
+ ...(safeWorkspaceWithoutFolderTrust.telemetry || {}),
253
+ ...(system.telemetry || {}),
254
+ },
255
+ security: {
256
+ ...(systemDefaults.security || {}),
257
+ ...(user.security || {}),
258
+ ...(safeWorkspaceWithoutFolderTrust.security || {}),
259
+ ...(system.security || {}),
260
+ },
261
+ mcp: {
262
+ ...(systemDefaults.mcp || {}),
263
+ ...(user.mcp || {}),
264
+ ...(safeWorkspaceWithoutFolderTrust.mcp || {}),
265
+ ...(system.mcp || {}),
52
266
  },
53
267
  mcpServers: {
268
+ ...(systemDefaults.mcpServers || {}),
54
269
  ...(user.mcpServers || {}),
55
- ...(safeWorkspace.mcpServers || {}),
270
+ ...(safeWorkspaceWithoutFolderTrust.mcpServers || {}),
56
271
  ...(system.mcpServers || {}),
57
272
  },
58
- includeDirectories: [
59
- ...(system.includeDirectories || []),
60
- ...(user.includeDirectories || []),
61
- ...(safeWorkspace.includeDirectories || []),
62
- ],
63
- chatCompression: {
64
- ...(system.chatCompression || {}),
65
- ...(user.chatCompression || {}),
66
- ...(safeWorkspace.chatCompression || {}),
273
+ tools: {
274
+ ...(systemDefaults.tools || {}),
275
+ ...(user.tools || {}),
276
+ ...(safeWorkspaceWithoutFolderTrust.tools || {}),
277
+ ...(system.tools || {}),
278
+ },
279
+ context: {
280
+ ...(systemDefaults.context || {}),
281
+ ...(user.context || {}),
282
+ ...(safeWorkspaceWithoutFolderTrust.context || {}),
283
+ ...(system.context || {}),
284
+ includeDirectories: [
285
+ ...(systemDefaults.context?.includeDirectories || []),
286
+ ...(user.context?.includeDirectories || []),
287
+ ...(safeWorkspaceWithoutFolderTrust.context?.includeDirectories || []),
288
+ ...(system.context?.includeDirectories || []),
289
+ ],
290
+ },
291
+ model: {
292
+ ...(systemDefaults.model || {}),
293
+ ...(user.model || {}),
294
+ ...(safeWorkspaceWithoutFolderTrust.model || {}),
295
+ ...(system.model || {}),
296
+ chatCompression: {
297
+ ...(systemDefaults.model?.chatCompression || {}),
298
+ ...(user.model?.chatCompression || {}),
299
+ ...(safeWorkspaceWithoutFolderTrust.model?.chatCompression || {}),
300
+ ...(system.model?.chatCompression || {}),
301
+ },
302
+ },
303
+ advanced: {
304
+ ...(systemDefaults.advanced || {}),
305
+ ...(user.advanced || {}),
306
+ ...(safeWorkspaceWithoutFolderTrust.advanced || {}),
307
+ ...(system.advanced || {}),
308
+ excludedEnvVars: [
309
+ ...new Set([
310
+ ...(systemDefaults.advanced?.excludedEnvVars || []),
311
+ ...(user.advanced?.excludedEnvVars || []),
312
+ ...(safeWorkspaceWithoutFolderTrust.advanced?.excludedEnvVars || []),
313
+ ...(system.advanced?.excludedEnvVars || []),
314
+ ]),
315
+ ],
316
+ },
317
+ extensions: {
318
+ ...(systemDefaults.extensions || {}),
319
+ ...(user.extensions || {}),
320
+ ...(safeWorkspaceWithoutFolderTrust.extensions || {}),
321
+ ...(system.extensions || {}),
322
+ disabled: [
323
+ ...new Set([
324
+ ...(systemDefaults.extensions?.disabled || []),
325
+ ...(user.extensions?.disabled || []),
326
+ ...(safeWorkspaceWithoutFolderTrust.extensions?.disabled || []),
327
+ ...(system.extensions?.disabled || []),
328
+ ]),
329
+ ],
330
+ workspacesWithMigrationNudge: [
331
+ ...new Set([
332
+ ...(systemDefaults.extensions?.workspacesWithMigrationNudge || []),
333
+ ...(user.extensions?.workspacesWithMigrationNudge || []),
334
+ ...(safeWorkspaceWithoutFolderTrust.extensions
335
+ ?.workspacesWithMigrationNudge || []),
336
+ ...(system.extensions?.workspacesWithMigrationNudge || []),
337
+ ]),
338
+ ],
67
339
  },
68
340
  };
69
341
  }
70
342
  export class LoadedSettings {
71
- constructor(system, user, workspace, errors, isTrusted) {
343
+ constructor(system, systemDefaults, user, workspace, errors, isTrusted, migratedInMemorScopes) {
72
344
  this.system = system;
345
+ this.systemDefaults = systemDefaults;
73
346
  this.user = user;
74
347
  this.workspace = workspace;
75
348
  this.errors = errors;
76
349
  this.isTrusted = isTrusted;
350
+ this.migratedInMemorScopes = migratedInMemorScopes;
77
351
  this._merged = this.computeMergedSettings();
78
352
  }
79
353
  system;
354
+ systemDefaults;
80
355
  user;
81
356
  workspace;
82
357
  errors;
83
358
  isTrusted;
359
+ migratedInMemorScopes;
84
360
  _merged;
85
361
  get merged() {
86
362
  return this._merged;
87
363
  }
88
364
  computeMergedSettings() {
89
- return mergeSettings(this.system.settings, this.user.settings, this.workspace.settings, this.isTrusted);
365
+ return mergeSettings(this.system.settings, this.systemDefaults.settings, this.user.settings, this.workspace.settings, this.isTrusted);
90
366
  }
91
367
  forScope(scope) {
92
368
  switch (scope) {
@@ -96,13 +372,15 @@ export class LoadedSettings {
96
372
  return this.workspace;
97
373
  case SettingScope.System:
98
374
  return this.system;
375
+ case SettingScope.SystemDefaults:
376
+ return this.systemDefaults;
99
377
  default:
100
378
  throw new Error(`Invalid scope: ${scope}`);
101
379
  }
102
380
  }
103
381
  setValue(scope, key, value) {
104
382
  const settingsFile = this.forScope(scope);
105
- settingsFile.settings[key] = value;
383
+ setNestedProperty(settingsFile.settings, key, value);
106
384
  this._merged = this.computeMergedSettings();
107
385
  saveSettings(settingsFile);
108
386
  }
@@ -219,7 +497,8 @@ export function loadEnvironment(settings) {
219
497
  try {
220
498
  const envFileContent = fs.readFileSync(envFilePath, 'utf-8');
221
499
  const parsedEnv = dotenv.parse(envFileContent);
222
- const excludedVars = resolvedSettings?.excludedProjectEnvVars || DEFAULT_EXCLUDED_ENV_VARS;
500
+ const excludedVars = resolvedSettings?.advanced?.excludedEnvVars ||
501
+ DEFAULT_EXCLUDED_ENV_VARS;
223
502
  const isProjectEnvFile = !envFilePath.includes(GEMINI_DIR);
224
503
  for (const key in parsedEnv) {
225
504
  if (Object.hasOwn(parsedEnv, key)) {
@@ -245,10 +524,13 @@ export function loadEnvironment(settings) {
245
524
  */
246
525
  export function loadSettings(workspaceDir) {
247
526
  let systemSettings = {};
527
+ let systemDefaultSettings = {};
248
528
  let userSettings = {};
249
529
  let workspaceSettings = {};
250
530
  const settingsErrors = [];
251
531
  const systemSettingsPath = getSystemSettingsPath();
532
+ const systemDefaultsPath = getSystemDefaultsPath();
533
+ const migratedInMemorScopes = new Set();
252
534
  // Resolve paths to their canonical representation to handle symlinks
253
535
  const resolvedWorkspaceDir = path.resolve(workspaceDir);
254
536
  const resolvedHomeDir = path.resolve(homedir());
@@ -263,66 +545,74 @@ export function loadSettings(workspaceDir) {
263
545
  // We expect homedir to always exist and be resolvable.
264
546
  const realHomeDir = fs.realpathSync(resolvedHomeDir);
265
547
  const workspaceSettingsPath = new Storage(workspaceDir).getWorkspaceSettingsPath();
266
- // Load system settings
267
- try {
268
- if (fs.existsSync(systemSettingsPath)) {
269
- const systemContent = fs.readFileSync(systemSettingsPath, 'utf-8');
270
- systemSettings = JSON.parse(stripJsonComments(systemContent));
271
- }
272
- }
273
- catch (error) {
274
- settingsErrors.push({
275
- message: getErrorMessage(error),
276
- path: systemSettingsPath,
277
- });
278
- }
279
- // Load user settings
280
- try {
281
- if (fs.existsSync(USER_SETTINGS_PATH)) {
282
- const userContent = fs.readFileSync(USER_SETTINGS_PATH, 'utf-8');
283
- userSettings = JSON.parse(stripJsonComments(userContent));
284
- // Support legacy theme names
285
- if (userSettings.theme && userSettings.theme === 'VS') {
286
- userSettings.theme = DefaultLight.name;
287
- }
288
- else if (userSettings.theme && userSettings.theme === 'VS2015') {
289
- userSettings.theme = DefaultDark.name;
290
- }
291
- }
292
- }
293
- catch (error) {
294
- settingsErrors.push({
295
- message: getErrorMessage(error),
296
- path: USER_SETTINGS_PATH,
297
- });
298
- }
299
- if (realWorkspaceDir !== realHomeDir) {
300
- // Load workspace settings
548
+ const loadAndMigrate = (filePath, scope) => {
301
549
  try {
302
- if (fs.existsSync(workspaceSettingsPath)) {
303
- const projectContent = fs.readFileSync(workspaceSettingsPath, 'utf-8');
304
- workspaceSettings = JSON.parse(stripJsonComments(projectContent));
305
- if (workspaceSettings.theme && workspaceSettings.theme === 'VS') {
306
- workspaceSettings.theme = DefaultLight.name;
550
+ if (fs.existsSync(filePath)) {
551
+ const content = fs.readFileSync(filePath, 'utf-8');
552
+ const rawSettings = JSON.parse(stripJsonComments(content));
553
+ if (typeof rawSettings !== 'object' ||
554
+ rawSettings === null ||
555
+ Array.isArray(rawSettings)) {
556
+ settingsErrors.push({
557
+ message: 'Settings file is not a valid JSON object.',
558
+ path: filePath,
559
+ });
560
+ return {};
307
561
  }
308
- else if (workspaceSettings.theme &&
309
- workspaceSettings.theme === 'VS2015') {
310
- workspaceSettings.theme = DefaultDark.name;
562
+ let settingsObject = rawSettings;
563
+ if (needsMigration(settingsObject)) {
564
+ const migratedSettings = migrateSettingsToV2(settingsObject);
565
+ if (migratedSettings) {
566
+ if (MIGRATE_V2_OVERWRITE) {
567
+ try {
568
+ fs.renameSync(filePath, `${filePath}.orig`);
569
+ fs.writeFileSync(filePath, JSON.stringify(migratedSettings, null, 2), 'utf-8');
570
+ }
571
+ catch (e) {
572
+ console.error(`Error migrating settings file on disk: ${getErrorMessage(e)}`);
573
+ }
574
+ }
575
+ else {
576
+ migratedInMemorScopes.add(scope);
577
+ }
578
+ settingsObject = migratedSettings;
579
+ }
311
580
  }
581
+ return settingsObject;
312
582
  }
313
583
  }
314
584
  catch (error) {
315
585
  settingsErrors.push({
316
586
  message: getErrorMessage(error),
317
- path: workspaceSettingsPath,
587
+ path: filePath,
318
588
  });
319
589
  }
590
+ return {};
591
+ };
592
+ systemSettings = loadAndMigrate(systemSettingsPath, SettingScope.System);
593
+ systemDefaultSettings = loadAndMigrate(systemDefaultsPath, SettingScope.SystemDefaults);
594
+ userSettings = loadAndMigrate(USER_SETTINGS_PATH, SettingScope.User);
595
+ if (realWorkspaceDir !== realHomeDir) {
596
+ workspaceSettings = loadAndMigrate(workspaceSettingsPath, SettingScope.Workspace);
597
+ }
598
+ // Support legacy theme names
599
+ if (userSettings.ui?.theme === 'VS') {
600
+ userSettings.ui.theme = DefaultLight.name;
601
+ }
602
+ else if (userSettings.ui?.theme === 'VS2015') {
603
+ userSettings.ui.theme = DefaultDark.name;
604
+ }
605
+ if (workspaceSettings.ui?.theme === 'VS') {
606
+ workspaceSettings.ui.theme = DefaultLight.name;
607
+ }
608
+ else if (workspaceSettings.ui?.theme === 'VS2015') {
609
+ workspaceSettings.ui.theme = DefaultDark.name;
320
610
  }
321
611
  // For the initial trust check, we can only use user and system settings.
322
- const initialTrustCheckSettings = { ...systemSettings, ...userSettings };
612
+ const initialTrustCheckSettings = mergeWith({}, systemSettings, userSettings);
323
613
  const isTrusted = isWorkspaceTrusted(initialTrustCheckSettings) ?? true;
324
614
  // Create a temporary merged settings object to pass to loadEnvironment.
325
- const tempMergedSettings = mergeSettings(systemSettings, userSettings, workspaceSettings, isTrusted);
615
+ const tempMergedSettings = mergeSettings(systemSettings, systemDefaultSettings, userSettings, workspaceSettings, isTrusted);
326
616
  // loadEnviroment depends on settings so we have to create a temp version of
327
617
  // the settings to avoid a cycle
328
618
  loadEnvironment(tempMergedSettings);
@@ -334,21 +624,16 @@ export function loadSettings(workspaceDir) {
334
624
  const loadedSettings = new LoadedSettings({
335
625
  path: systemSettingsPath,
336
626
  settings: systemSettings,
627
+ }, {
628
+ path: systemDefaultsPath,
629
+ settings: systemDefaultSettings,
337
630
  }, {
338
631
  path: USER_SETTINGS_PATH,
339
632
  settings: userSettings,
340
633
  }, {
341
634
  path: workspaceSettingsPath,
342
635
  settings: workspaceSettings,
343
- }, settingsErrors, isTrusted);
344
- // Validate chatCompression settings
345
- const chatCompression = loadedSettings.merged.chatCompression;
346
- const threshold = chatCompression?.contextPercentageThreshold;
347
- if (threshold != null &&
348
- (typeof threshold !== 'number' || threshold < 0 || threshold > 1)) {
349
- console.warn(`Invalid value for chatCompression.contextPercentageThreshold: "${threshold}". Please use a value between 0 and 1. Using default compression settings.`);
350
- delete loadedSettings.merged.chatCompression;
351
- }
636
+ }, settingsErrors, isTrusted, migratedInMemorScopes);
352
637
  return loadedSettings;
353
638
  }
354
639
  export function saveSettings(settingsFile) {
@@ -358,7 +643,11 @@ export function saveSettings(settingsFile) {
358
643
  if (!fs.existsSync(dirPath)) {
359
644
  fs.mkdirSync(dirPath, { recursive: true });
360
645
  }
361
- fs.writeFileSync(settingsFile.path, JSON.stringify(settingsFile.settings, null, 2), 'utf-8');
646
+ let settingsToSave = settingsFile.settings;
647
+ if (!MIGRATE_V2_OVERWRITE) {
648
+ settingsToSave = migrateSettingsToV1(settingsToSave);
649
+ }
650
+ fs.writeFileSync(settingsFile.path, JSON.stringify(settingsToSave, null, 2), 'utf-8');
362
651
  }
363
652
  catch (error) {
364
653
  console.error('Error saving user settings file:', error);