@google/gemini-cli 0.1.9-rc.1 → 0.1.10-dev.0

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 (430) hide show
  1. package/package.json +4 -8
  2. package/LICENSE +0 -202
  3. package/README.md +0 -142
  4. package/dist/.last_build +0 -0
  5. package/dist/google-gemini-cli-0.1.9-rc.1.tgz +0 -0
  6. package/dist/index.d.ts +0 -7
  7. package/dist/index.js +0 -20
  8. package/dist/index.js.map +0 -1
  9. package/dist/package.json +0 -81
  10. package/dist/src/config/auth.d.ts +0 -6
  11. package/dist/src/config/auth.js +0 -32
  12. package/dist/src/config/auth.js.map +0 -1
  13. package/dist/src/config/config.d.ts +0 -14
  14. package/dist/src/config/config.js +0 -235
  15. package/dist/src/config/config.js.map +0 -1
  16. package/dist/src/config/extension.d.ts +0 -20
  17. package/dist/src/config/extension.js +0 -81
  18. package/dist/src/config/extension.js.map +0 -1
  19. package/dist/src/config/sandboxConfig.d.ts +0 -13
  20. package/dist/src/config/sandboxConfig.js +0 -75
  21. package/dist/src/config/sandboxConfig.js.map +0 -1
  22. package/dist/src/config/settings.d.ts +0 -70
  23. package/dist/src/config/settings.js +0 -165
  24. package/dist/src/config/settings.js.map +0 -1
  25. package/dist/src/gemini.d.ts +0 -6
  26. package/dist/src/gemini.js +0 -217
  27. package/dist/src/gemini.js.map +0 -1
  28. package/dist/src/gemini.test.d.ts +0 -6
  29. package/dist/src/gemini.test.js +0 -122
  30. package/dist/src/gemini.test.js.map +0 -1
  31. package/dist/src/generated/git-commit.d.ts +0 -6
  32. package/dist/src/generated/git-commit.js +0 -9
  33. package/dist/src/generated/git-commit.js.map +0 -1
  34. package/dist/src/nonInteractiveCli.d.ts +0 -7
  35. package/dist/src/nonInteractiveCli.js +0 -115
  36. package/dist/src/nonInteractiveCli.js.map +0 -1
  37. package/dist/src/ui/App.d.ts +0 -14
  38. package/dist/src/ui/App.js +0 -387
  39. package/dist/src/ui/App.js.map +0 -1
  40. package/dist/src/ui/App.test.d.ts +0 -6
  41. package/dist/src/ui/App.test.js +0 -299
  42. package/dist/src/ui/App.test.js.map +0 -1
  43. package/dist/src/ui/colors.d.ts +0 -7
  44. package/dist/src/ui/colors.js +0 -48
  45. package/dist/src/ui/colors.js.map +0 -1
  46. package/dist/src/ui/components/AboutBox.d.ts +0 -16
  47. package/dist/src/ui/components/AboutBox.js +0 -6
  48. package/dist/src/ui/components/AboutBox.js.map +0 -1
  49. package/dist/src/ui/components/AsciiArt.d.ts +0 -7
  50. package/dist/src/ui/components/AsciiArt.js +0 -26
  51. package/dist/src/ui/components/AsciiArt.js.map +0 -1
  52. package/dist/src/ui/components/AuthDialog.d.ts +0 -15
  53. package/dist/src/ui/components/AuthDialog.js +0 -47
  54. package/dist/src/ui/components/AuthDialog.js.map +0 -1
  55. package/dist/src/ui/components/AuthDialog.test.d.ts +0 -6
  56. package/dist/src/ui/components/AuthDialog.test.js +0 -69
  57. package/dist/src/ui/components/AuthDialog.test.js.map +0 -1
  58. package/dist/src/ui/components/AuthInProgress.d.ts +0 -11
  59. package/dist/src/ui/components/AuthInProgress.js +0 -27
  60. package/dist/src/ui/components/AuthInProgress.js.map +0 -1
  61. package/dist/src/ui/components/AutoAcceptIndicator.d.ts +0 -12
  62. package/dist/src/ui/components/AutoAcceptIndicator.js +0 -26
  63. package/dist/src/ui/components/AutoAcceptIndicator.js.map +0 -1
  64. package/dist/src/ui/components/ConsolePatcher.d.ts +0 -12
  65. package/dist/src/ui/components/ConsolePatcher.js +0 -40
  66. package/dist/src/ui/components/ConsolePatcher.js.map +0 -1
  67. package/dist/src/ui/components/ConsoleSummaryDisplay.d.ts +0 -11
  68. package/dist/src/ui/components/ConsoleSummaryDisplay.js +0 -11
  69. package/dist/src/ui/components/ConsoleSummaryDisplay.js.map +0 -1
  70. package/dist/src/ui/components/ContextSummaryDisplay.d.ts +0 -15
  71. package/dist/src/ui/components/ContextSummaryDisplay.js +0 -41
  72. package/dist/src/ui/components/ContextSummaryDisplay.js.map +0 -1
  73. package/dist/src/ui/components/DetailedMessagesDisplay.d.ts +0 -14
  74. package/dist/src/ui/components/DetailedMessagesDisplay.js +0 -34
  75. package/dist/src/ui/components/DetailedMessagesDisplay.js.map +0 -1
  76. package/dist/src/ui/components/EditorSettingsDialog.d.ts +0 -15
  77. package/dist/src/ui/components/EditorSettingsDialog.js +0 -73
  78. package/dist/src/ui/components/EditorSettingsDialog.js.map +0 -1
  79. package/dist/src/ui/components/Footer.d.ts +0 -20
  80. package/dist/src/ui/components/Footer.js +0 -13
  81. package/dist/src/ui/components/Footer.js.map +0 -1
  82. package/dist/src/ui/components/GeminiRespondingSpinner.d.ts +0 -17
  83. package/dist/src/ui/components/GeminiRespondingSpinner.js +0 -16
  84. package/dist/src/ui/components/GeminiRespondingSpinner.js.map +0 -1
  85. package/dist/src/ui/components/Header.d.ts +0 -12
  86. package/dist/src/ui/components/Header.js +0 -20
  87. package/dist/src/ui/components/Header.js.map +0 -1
  88. package/dist/src/ui/components/Help.d.ts +0 -12
  89. package/dist/src/ui/components/Help.js +0 -9
  90. package/dist/src/ui/components/Help.js.map +0 -1
  91. package/dist/src/ui/components/HistoryItemDisplay.d.ts +0 -18
  92. package/dist/src/ui/components/HistoryItemDisplay.js +0 -17
  93. package/dist/src/ui/components/HistoryItemDisplay.js.map +0 -1
  94. package/dist/src/ui/components/HistoryItemDisplay.test.d.ts +0 -6
  95. package/dist/src/ui/components/HistoryItemDisplay.test.js +0 -81
  96. package/dist/src/ui/components/HistoryItemDisplay.test.js.map +0 -1
  97. package/dist/src/ui/components/InputPrompt.d.ts +0 -24
  98. package/dist/src/ui/components/InputPrompt.js +0 -331
  99. package/dist/src/ui/components/InputPrompt.js.map +0 -1
  100. package/dist/src/ui/components/InputPrompt.test.d.ts +0 -6
  101. package/dist/src/ui/components/InputPrompt.test.js +0 -154
  102. package/dist/src/ui/components/InputPrompt.test.js.map +0 -1
  103. package/dist/src/ui/components/LoadingIndicator.d.ts +0 -15
  104. package/dist/src/ui/components/LoadingIndicator.js +0 -19
  105. package/dist/src/ui/components/LoadingIndicator.js.map +0 -1
  106. package/dist/src/ui/components/LoadingIndicator.test.d.ts +0 -6
  107. package/dist/src/ui/components/LoadingIndicator.test.js +0 -141
  108. package/dist/src/ui/components/LoadingIndicator.test.js.map +0 -1
  109. package/dist/src/ui/components/MemoryUsageDisplay.d.ts +0 -7
  110. package/dist/src/ui/components/MemoryUsageDisplay.js +0 -27
  111. package/dist/src/ui/components/MemoryUsageDisplay.js.map +0 -1
  112. package/dist/src/ui/components/ModelStatsDisplay.d.ts +0 -7
  113. package/dist/src/ui/components/ModelStatsDisplay.js +0 -33
  114. package/dist/src/ui/components/ModelStatsDisplay.js.map +0 -1
  115. package/dist/src/ui/components/ModelStatsDisplay.test.d.ts +0 -6
  116. package/dist/src/ui/components/ModelStatsDisplay.test.js +0 -217
  117. package/dist/src/ui/components/ModelStatsDisplay.test.js.map +0 -1
  118. package/dist/src/ui/components/SessionSummaryDisplay.d.ts +0 -11
  119. package/dist/src/ui/components/SessionSummaryDisplay.js +0 -4
  120. package/dist/src/ui/components/SessionSummaryDisplay.js.map +0 -1
  121. package/dist/src/ui/components/SessionSummaryDisplay.test.d.ts +0 -6
  122. package/dist/src/ui/components/SessionSummaryDisplay.test.js +0 -60
  123. package/dist/src/ui/components/SessionSummaryDisplay.test.js.map +0 -1
  124. package/dist/src/ui/components/ShellModeIndicator.d.ts +0 -7
  125. package/dist/src/ui/components/ShellModeIndicator.js +0 -5
  126. package/dist/src/ui/components/ShellModeIndicator.js.map +0 -1
  127. package/dist/src/ui/components/ShowMoreLines.d.ts +0 -10
  128. package/dist/src/ui/components/ShowMoreLines.js +0 -24
  129. package/dist/src/ui/components/ShowMoreLines.js.map +0 -1
  130. package/dist/src/ui/components/StatsDisplay.d.ts +0 -12
  131. package/dist/src/ui/components/StatsDisplay.js +0 -42
  132. package/dist/src/ui/components/StatsDisplay.js.map +0 -1
  133. package/dist/src/ui/components/StatsDisplay.test.d.ts +0 -6
  134. package/dist/src/ui/components/StatsDisplay.test.js +0 -275
  135. package/dist/src/ui/components/StatsDisplay.test.js.map +0 -1
  136. package/dist/src/ui/components/SuggestionsDisplay.d.ts +0 -21
  137. package/dist/src/ui/components/SuggestionsDisplay.js +0 -32
  138. package/dist/src/ui/components/SuggestionsDisplay.js.map +0 -1
  139. package/dist/src/ui/components/ThemeDialog.d.ts +0 -19
  140. package/dist/src/ui/components/ThemeDialog.js +0 -126
  141. package/dist/src/ui/components/ThemeDialog.js.map +0 -1
  142. package/dist/src/ui/components/Tips.d.ts +0 -12
  143. package/dist/src/ui/components/Tips.js +0 -8
  144. package/dist/src/ui/components/Tips.js.map +0 -1
  145. package/dist/src/ui/components/ToolStatsDisplay.d.ts +0 -7
  146. package/dist/src/ui/components/ToolStatsDisplay.js +0 -41
  147. package/dist/src/ui/components/ToolStatsDisplay.js.map +0 -1
  148. package/dist/src/ui/components/ToolStatsDisplay.test.d.ts +0 -6
  149. package/dist/src/ui/components/ToolStatsDisplay.test.js +0 -160
  150. package/dist/src/ui/components/ToolStatsDisplay.test.js.map +0 -1
  151. package/dist/src/ui/components/UpdateNotification.d.ts +0 -10
  152. package/dist/src/ui/components/UpdateNotification.js +0 -10
  153. package/dist/src/ui/components/UpdateNotification.js.map +0 -1
  154. package/dist/src/ui/components/messages/CompressionMessage.d.ts +0 -11
  155. package/dist/src/ui/components/messages/CompressionMessage.js +0 -16
  156. package/dist/src/ui/components/messages/CompressionMessage.js.map +0 -1
  157. package/dist/src/ui/components/messages/DiffRenderer.d.ts +0 -15
  158. package/dist/src/ui/components/messages/DiffRenderer.js +0 -212
  159. package/dist/src/ui/components/messages/DiffRenderer.js.map +0 -1
  160. package/dist/src/ui/components/messages/DiffRenderer.test.d.ts +0 -6
  161. package/dist/src/ui/components/messages/DiffRenderer.test.js +0 -239
  162. package/dist/src/ui/components/messages/DiffRenderer.test.js.map +0 -1
  163. package/dist/src/ui/components/messages/ErrorMessage.d.ts +0 -11
  164. package/dist/src/ui/components/messages/ErrorMessage.js +0 -9
  165. package/dist/src/ui/components/messages/ErrorMessage.js.map +0 -1
  166. package/dist/src/ui/components/messages/GeminiMessage.d.ts +0 -14
  167. package/dist/src/ui/components/messages/GeminiMessage.js +0 -10
  168. package/dist/src/ui/components/messages/GeminiMessage.js.map +0 -1
  169. package/dist/src/ui/components/messages/GeminiMessageContent.d.ts +0 -14
  170. package/dist/src/ui/components/messages/GeminiMessageContent.js +0 -15
  171. package/dist/src/ui/components/messages/GeminiMessageContent.js.map +0 -1
  172. package/dist/src/ui/components/messages/InfoMessage.d.ts +0 -11
  173. package/dist/src/ui/components/messages/InfoMessage.js +0 -9
  174. package/dist/src/ui/components/messages/InfoMessage.js.map +0 -1
  175. package/dist/src/ui/components/messages/ToolConfirmationMessage.d.ts +0 -15
  176. package/dist/src/ui/components/messages/ToolConfirmationMessage.js +0 -111
  177. package/dist/src/ui/components/messages/ToolConfirmationMessage.js.map +0 -1
  178. package/dist/src/ui/components/messages/ToolConfirmationMessage.test.d.ts +0 -6
  179. package/dist/src/ui/components/messages/ToolConfirmationMessage.test.js +0 -37
  180. package/dist/src/ui/components/messages/ToolConfirmationMessage.test.js.map +0 -1
  181. package/dist/src/ui/components/messages/ToolGroupMessage.d.ts +0 -18
  182. package/dist/src/ui/components/messages/ToolGroupMessage.js +0 -53
  183. package/dist/src/ui/components/messages/ToolGroupMessage.js.map +0 -1
  184. package/dist/src/ui/components/messages/ToolMessage.d.ts +0 -15
  185. package/dist/src/ui/components/messages/ToolMessage.js +0 -61
  186. package/dist/src/ui/components/messages/ToolMessage.js.map +0 -1
  187. package/dist/src/ui/components/messages/ToolMessage.test.d.ts +0 -6
  188. package/dist/src/ui/components/messages/ToolMessage.test.js +0 -116
  189. package/dist/src/ui/components/messages/ToolMessage.test.js.map +0 -1
  190. package/dist/src/ui/components/messages/UserMessage.d.ts +0 -11
  191. package/dist/src/ui/components/messages/UserMessage.js +0 -9
  192. package/dist/src/ui/components/messages/UserMessage.js.map +0 -1
  193. package/dist/src/ui/components/messages/UserShellMessage.d.ts +0 -11
  194. package/dist/src/ui/components/messages/UserShellMessage.js +0 -9
  195. package/dist/src/ui/components/messages/UserShellMessage.js.map +0 -1
  196. package/dist/src/ui/components/shared/MaxSizedBox.d.ts +0 -61
  197. package/dist/src/ui/components/shared/MaxSizedBox.js +0 -384
  198. package/dist/src/ui/components/shared/MaxSizedBox.js.map +0 -1
  199. package/dist/src/ui/components/shared/MaxSizedBox.test.d.ts +0 -6
  200. package/dist/src/ui/components/shared/MaxSizedBox.test.js +0 -134
  201. package/dist/src/ui/components/shared/MaxSizedBox.test.js.map +0 -1
  202. package/dist/src/ui/components/shared/RadioButtonSelect.d.ts +0 -41
  203. package/dist/src/ui/components/shared/RadioButtonSelect.js +0 -52
  204. package/dist/src/ui/components/shared/RadioButtonSelect.js.map +0 -1
  205. package/dist/src/ui/components/shared/text-buffer.d.ts +0 -128
  206. package/dist/src/ui/components/shared/text-buffer.js +0 -1122
  207. package/dist/src/ui/components/shared/text-buffer.js.map +0 -1
  208. package/dist/src/ui/constants.d.ts +0 -8
  209. package/dist/src/ui/constants.js +0 -12
  210. package/dist/src/ui/constants.js.map +0 -1
  211. package/dist/src/ui/contexts/OverflowContext.d.ts +0 -19
  212. package/dist/src/ui/contexts/OverflowContext.js +0 -43
  213. package/dist/src/ui/contexts/OverflowContext.js.map +0 -1
  214. package/dist/src/ui/contexts/SessionContext.d.ts +0 -33
  215. package/dist/src/ui/contexts/SessionContext.js +0 -49
  216. package/dist/src/ui/contexts/SessionContext.js.map +0 -1
  217. package/dist/src/ui/contexts/SessionContext.test.d.ts +0 -6
  218. package/dist/src/ui/contexts/SessionContext.test.js +0 -96
  219. package/dist/src/ui/contexts/SessionContext.test.js.map +0 -1
  220. package/dist/src/ui/contexts/StreamingContext.d.ts +0 -9
  221. package/dist/src/ui/contexts/StreamingContext.js +0 -15
  222. package/dist/src/ui/contexts/StreamingContext.js.map +0 -1
  223. package/dist/src/ui/editors/editorSettingsManager.d.ts +0 -19
  224. package/dist/src/ui/editors/editorSettingsManager.js +0 -54
  225. package/dist/src/ui/editors/editorSettingsManager.js.map +0 -1
  226. package/dist/src/ui/hooks/atCommandProcessor.d.ts +0 -31
  227. package/dist/src/ui/hooks/atCommandProcessor.js +0 -312
  228. package/dist/src/ui/hooks/atCommandProcessor.js.map +0 -1
  229. package/dist/src/ui/hooks/shellCommandProcessor.d.ts +0 -16
  230. package/dist/src/ui/hooks/shellCommandProcessor.js +0 -261
  231. package/dist/src/ui/hooks/shellCommandProcessor.js.map +0 -1
  232. package/dist/src/ui/hooks/slashCommandProcessor.d.ts +0 -31
  233. package/dist/src/ui/hooks/slashCommandProcessor.js +0 -965
  234. package/dist/src/ui/hooks/slashCommandProcessor.js.map +0 -1
  235. package/dist/src/ui/hooks/useAuthCommand.d.ts +0 -14
  236. package/dist/src/ui/hooks/useAuthCommand.js +0 -54
  237. package/dist/src/ui/hooks/useAuthCommand.js.map +0 -1
  238. package/dist/src/ui/hooks/useAutoAcceptIndicator.d.ts +0 -10
  239. package/dist/src/ui/hooks/useAutoAcceptIndicator.js +0 -37
  240. package/dist/src/ui/hooks/useAutoAcceptIndicator.js.map +0 -1
  241. package/dist/src/ui/hooks/useBracketedPaste.d.ts +0 -12
  242. package/dist/src/ui/hooks/useBracketedPaste.js +0 -32
  243. package/dist/src/ui/hooks/useBracketedPaste.js.map +0 -1
  244. package/dist/src/ui/hooks/useCompletion.d.ts +0 -21
  245. package/dist/src/ui/hooks/useCompletion.js +0 -322
  246. package/dist/src/ui/hooks/useCompletion.js.map +0 -1
  247. package/dist/src/ui/hooks/useConsoleMessages.d.ts +0 -12
  248. package/dist/src/ui/hooks/useConsoleMessages.js +0 -60
  249. package/dist/src/ui/hooks/useConsoleMessages.js.map +0 -1
  250. package/dist/src/ui/hooks/useEditorSettings.d.ts +0 -16
  251. package/dist/src/ui/hooks/useEditorSettings.js +0 -43
  252. package/dist/src/ui/hooks/useEditorSettings.js.map +0 -1
  253. package/dist/src/ui/hooks/useGeminiStream.d.ts +0 -23
  254. package/dist/src/ui/hooks/useGeminiStream.js +0 -524
  255. package/dist/src/ui/hooks/useGeminiStream.js.map +0 -1
  256. package/dist/src/ui/hooks/useGeminiStream.test.d.ts +0 -6
  257. package/dist/src/ui/hooks/useGeminiStream.test.js +0 -775
  258. package/dist/src/ui/hooks/useGeminiStream.test.js.map +0 -1
  259. package/dist/src/ui/hooks/useGitBranchName.d.ts +0 -6
  260. package/dist/src/ui/hooks/useGitBranchName.js +0 -61
  261. package/dist/src/ui/hooks/useGitBranchName.js.map +0 -1
  262. package/dist/src/ui/hooks/useHistoryManager.d.ts +0 -22
  263. package/dist/src/ui/hooks/useHistoryManager.js +0 -72
  264. package/dist/src/ui/hooks/useHistoryManager.js.map +0 -1
  265. package/dist/src/ui/hooks/useInputHistory.d.ts +0 -19
  266. package/dist/src/ui/hooks/useInputHistory.js +0 -84
  267. package/dist/src/ui/hooks/useInputHistory.js.map +0 -1
  268. package/dist/src/ui/hooks/useKeypress.d.ts +0 -29
  269. package/dist/src/ui/hooks/useKeypress.js +0 -86
  270. package/dist/src/ui/hooks/useKeypress.js.map +0 -1
  271. package/dist/src/ui/hooks/useLoadingIndicator.d.ts +0 -10
  272. package/dist/src/ui/hooks/useLoadingIndicator.js +0 -44
  273. package/dist/src/ui/hooks/useLoadingIndicator.js.map +0 -1
  274. package/dist/src/ui/hooks/useLogger.d.ts +0 -10
  275. package/dist/src/ui/hooks/useLogger.js +0 -29
  276. package/dist/src/ui/hooks/useLogger.js.map +0 -1
  277. package/dist/src/ui/hooks/usePhraseCycler.d.ts +0 -14
  278. package/dist/src/ui/hooks/usePhraseCycler.js +0 -189
  279. package/dist/src/ui/hooks/usePhraseCycler.js.map +0 -1
  280. package/dist/src/ui/hooks/usePrivacySettings.d.ts +0 -16
  281. package/dist/src/ui/hooks/usePrivacySettings.js +0 -115
  282. package/dist/src/ui/hooks/usePrivacySettings.js.map +0 -1
  283. package/dist/src/ui/hooks/useReactToolScheduler.d.ts +0 -33
  284. package/dist/src/ui/hooks/useReactToolScheduler.js +0 -186
  285. package/dist/src/ui/hooks/useReactToolScheduler.js.map +0 -1
  286. package/dist/src/ui/hooks/useRefreshMemoryCommand.d.ts +0 -6
  287. package/dist/src/ui/hooks/useRefreshMemoryCommand.js +0 -7
  288. package/dist/src/ui/hooks/useRefreshMemoryCommand.js.map +0 -1
  289. package/dist/src/ui/hooks/useShellHistory.d.ts +0 -11
  290. package/dist/src/ui/hooks/useShellHistory.js +0 -89
  291. package/dist/src/ui/hooks/useShellHistory.js.map +0 -1
  292. package/dist/src/ui/hooks/useShowMemoryCommand.d.ts +0 -9
  293. package/dist/src/ui/hooks/useShowMemoryCommand.js +0 -58
  294. package/dist/src/ui/hooks/useShowMemoryCommand.js.map +0 -1
  295. package/dist/src/ui/hooks/useStateAndRef.d.ts +0 -7
  296. package/dist/src/ui/hooks/useStateAndRef.js +0 -26
  297. package/dist/src/ui/hooks/useStateAndRef.js.map +0 -1
  298. package/dist/src/ui/hooks/useTerminalSize.d.ts +0 -9
  299. package/dist/src/ui/hooks/useTerminalSize.js +0 -27
  300. package/dist/src/ui/hooks/useTerminalSize.js.map +0 -1
  301. package/dist/src/ui/hooks/useThemeCommand.d.ts +0 -15
  302. package/dist/src/ui/hooks/useThemeCommand.js +0 -78
  303. package/dist/src/ui/hooks/useThemeCommand.js.map +0 -1
  304. package/dist/src/ui/hooks/useTimer.d.ts +0 -12
  305. package/dist/src/ui/hooks/useTimer.js +0 -58
  306. package/dist/src/ui/hooks/useTimer.js.map +0 -1
  307. package/dist/src/ui/privacy/CloudFreePrivacyNotice.d.ts +0 -12
  308. package/dist/src/ui/privacy/CloudFreePrivacyNotice.js +0 -40
  309. package/dist/src/ui/privacy/CloudFreePrivacyNotice.js.map +0 -1
  310. package/dist/src/ui/privacy/CloudPaidPrivacyNotice.d.ts +0 -10
  311. package/dist/src/ui/privacy/CloudPaidPrivacyNotice.js +0 -17
  312. package/dist/src/ui/privacy/CloudPaidPrivacyNotice.js.map +0 -1
  313. package/dist/src/ui/privacy/GeminiPrivacyNotice.d.ts +0 -10
  314. package/dist/src/ui/privacy/GeminiPrivacyNotice.js +0 -17
  315. package/dist/src/ui/privacy/GeminiPrivacyNotice.js.map +0 -1
  316. package/dist/src/ui/privacy/PrivacyNotice.d.ts +0 -12
  317. package/dist/src/ui/privacy/PrivacyNotice.js +0 -25
  318. package/dist/src/ui/privacy/PrivacyNotice.js.map +0 -1
  319. package/dist/src/ui/themes/ansi-light.d.ts +0 -7
  320. package/dist/src/ui/themes/ansi-light.js +0 -139
  321. package/dist/src/ui/themes/ansi-light.js.map +0 -1
  322. package/dist/src/ui/themes/ansi.d.ts +0 -7
  323. package/dist/src/ui/themes/ansi.js +0 -149
  324. package/dist/src/ui/themes/ansi.js.map +0 -1
  325. package/dist/src/ui/themes/atom-one-dark.d.ts +0 -7
  326. package/dist/src/ui/themes/atom-one-dark.js +0 -136
  327. package/dist/src/ui/themes/atom-one-dark.js.map +0 -1
  328. package/dist/src/ui/themes/ayu-light.d.ts +0 -7
  329. package/dist/src/ui/themes/ayu-light.js +0 -128
  330. package/dist/src/ui/themes/ayu-light.js.map +0 -1
  331. package/dist/src/ui/themes/ayu.d.ts +0 -7
  332. package/dist/src/ui/themes/ayu.js +0 -102
  333. package/dist/src/ui/themes/ayu.js.map +0 -1
  334. package/dist/src/ui/themes/default-light.d.ts +0 -7
  335. package/dist/src/ui/themes/default-light.js +0 -100
  336. package/dist/src/ui/themes/default-light.js.map +0 -1
  337. package/dist/src/ui/themes/default.d.ts +0 -7
  338. package/dist/src/ui/themes/default.js +0 -143
  339. package/dist/src/ui/themes/default.js.map +0 -1
  340. package/dist/src/ui/themes/dracula.d.ts +0 -7
  341. package/dist/src/ui/themes/dracula.js +0 -113
  342. package/dist/src/ui/themes/dracula.js.map +0 -1
  343. package/dist/src/ui/themes/github-dark.d.ts +0 -7
  344. package/dist/src/ui/themes/github-dark.js +0 -136
  345. package/dist/src/ui/themes/github-dark.js.map +0 -1
  346. package/dist/src/ui/themes/github-light.d.ts +0 -7
  347. package/dist/src/ui/themes/github-light.js +0 -138
  348. package/dist/src/ui/themes/github-light.js.map +0 -1
  349. package/dist/src/ui/themes/googlecode.d.ts +0 -7
  350. package/dist/src/ui/themes/googlecode.js +0 -135
  351. package/dist/src/ui/themes/googlecode.js.map +0 -1
  352. package/dist/src/ui/themes/no-color.d.ts +0 -7
  353. package/dist/src/ui/themes/no-color.js +0 -84
  354. package/dist/src/ui/themes/no-color.js.map +0 -1
  355. package/dist/src/ui/themes/shades-of-purple.d.ts +0 -11
  356. package/dist/src/ui/themes/shades-of-purple.js +0 -302
  357. package/dist/src/ui/themes/shades-of-purple.js.map +0 -1
  358. package/dist/src/ui/themes/theme-manager.d.ts +0 -33
  359. package/dist/src/ui/themes/theme-manager.js +0 -109
  360. package/dist/src/ui/themes/theme-manager.js.map +0 -1
  361. package/dist/src/ui/themes/theme.d.ts +0 -67
  362. package/dist/src/ui/themes/theme.js +0 -304
  363. package/dist/src/ui/themes/theme.js.map +0 -1
  364. package/dist/src/ui/themes/xcode.d.ts +0 -7
  365. package/dist/src/ui/themes/xcode.js +0 -143
  366. package/dist/src/ui/themes/xcode.js.map +0 -1
  367. package/dist/src/ui/types.d.ts +0 -162
  368. package/dist/src/ui/types.js +0 -43
  369. package/dist/src/ui/types.js.map +0 -1
  370. package/dist/src/ui/utils/CodeColorizer.d.ts +0 -14
  371. package/dist/src/ui/utils/CodeColorizer.js +0 -97
  372. package/dist/src/ui/utils/CodeColorizer.js.map +0 -1
  373. package/dist/src/ui/utils/MarkdownDisplay.d.ts +0 -14
  374. package/dist/src/ui/utils/MarkdownDisplay.js +0 -276
  375. package/dist/src/ui/utils/MarkdownDisplay.js.map +0 -1
  376. package/dist/src/ui/utils/MarkdownDisplay.test.d.ts +0 -6
  377. package/dist/src/ui/utils/MarkdownDisplay.test.js +0 -176
  378. package/dist/src/ui/utils/MarkdownDisplay.test.js.map +0 -1
  379. package/dist/src/ui/utils/TableRenderer.d.ts +0 -17
  380. package/dist/src/ui/utils/TableRenderer.js +0 -66
  381. package/dist/src/ui/utils/TableRenderer.js.map +0 -1
  382. package/dist/src/ui/utils/commandUtils.d.ts +0 -22
  383. package/dist/src/ui/utils/commandUtils.js +0 -25
  384. package/dist/src/ui/utils/commandUtils.js.map +0 -1
  385. package/dist/src/ui/utils/computeStats.d.ts +0 -10
  386. package/dist/src/ui/utils/computeStats.js +0 -55
  387. package/dist/src/ui/utils/computeStats.js.map +0 -1
  388. package/dist/src/ui/utils/displayUtils.d.ts +0 -17
  389. package/dist/src/ui/utils/displayUtils.js +0 -24
  390. package/dist/src/ui/utils/displayUtils.js.map +0 -1
  391. package/dist/src/ui/utils/errorParsing.d.ts +0 -15
  392. package/dist/src/ui/utils/errorParsing.js +0 -79
  393. package/dist/src/ui/utils/errorParsing.js.map +0 -1
  394. package/dist/src/ui/utils/formatters.d.ts +0 -13
  395. package/dist/src/ui/utils/formatters.js +0 -56
  396. package/dist/src/ui/utils/formatters.js.map +0 -1
  397. package/dist/src/ui/utils/markdownUtilities.d.ts +0 -6
  398. package/dist/src/ui/utils/markdownUtilities.js +0 -110
  399. package/dist/src/ui/utils/markdownUtilities.js.map +0 -1
  400. package/dist/src/ui/utils/textUtils.d.ts +0 -22
  401. package/dist/src/ui/utils/textUtils.js +0 -58
  402. package/dist/src/ui/utils/textUtils.js.map +0 -1
  403. package/dist/src/ui/utils/updateCheck.d.ts +0 -6
  404. package/dist/src/ui/utils/updateCheck.js +0 -36
  405. package/dist/src/ui/utils/updateCheck.js.map +0 -1
  406. package/dist/src/utils/cleanup.d.ts +0 -6
  407. package/dist/src/utils/cleanup.js +0 -19
  408. package/dist/src/utils/cleanup.js.map +0 -1
  409. package/dist/src/utils/package.d.ts +0 -12
  410. package/dist/src/utils/package.js +0 -24
  411. package/dist/src/utils/package.js.map +0 -1
  412. package/dist/src/utils/readStdin.d.ts +0 -6
  413. package/dist/src/utils/readStdin.js +0 -34
  414. package/dist/src/utils/readStdin.js.map +0 -1
  415. package/dist/src/utils/sandbox-macos-permissive-closed.sb +0 -26
  416. package/dist/src/utils/sandbox-macos-permissive-open.sb +0 -19
  417. package/dist/src/utils/sandbox-macos-permissive-proxied.sb +0 -31
  418. package/dist/src/utils/sandbox-macos-restrictive-closed.sb +0 -87
  419. package/dist/src/utils/sandbox-macos-restrictive-open.sb +0 -90
  420. package/dist/src/utils/sandbox-macos-restrictive-proxied.sb +0 -92
  421. package/dist/src/utils/sandbox.d.ts +0 -7
  422. package/dist/src/utils/sandbox.js +0 -680
  423. package/dist/src/utils/sandbox.js.map +0 -1
  424. package/dist/src/utils/startupWarnings.d.ts +0 -6
  425. package/dist/src/utils/startupWarnings.js +0 -40
  426. package/dist/src/utils/startupWarnings.js.map +0 -1
  427. package/dist/src/utils/version.d.ts +0 -6
  428. package/dist/src/utils/version.js +0 -11
  429. package/dist/src/utils/version.js.map +0 -1
  430. package/dist/tsconfig.tsbuildinfo +0 -1
@@ -1,965 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2025 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- import { useCallback, useMemo } from 'react';
7
- import open from 'open';
8
- import process from 'node:process';
9
- import { useStateAndRef } from './useStateAndRef.js';
10
- import { GitService, Logger, MCPDiscoveryState, MCPServerStatus, getMCPDiscoveryState, getMCPServerStatus, } from '@google/gemini-cli-core';
11
- import { useSessionStats } from '../contexts/SessionContext.js';
12
- import { MessageType, } from '../types.js';
13
- import { promises as fs } from 'fs';
14
- import path from 'path';
15
- import { createShowMemoryAction } from './useShowMemoryCommand.js';
16
- import { GIT_COMMIT_INFO } from '../../generated/git-commit.js';
17
- import { formatDuration, formatMemoryUsage } from '../utils/formatters.js';
18
- import { getCliVersion } from '../../utils/version.js';
19
- /**
20
- * Hook to define and process slash commands (e.g., /help, /clear).
21
- */
22
- export const useSlashCommandProcessor = (config, settings, history, addItem, clearItems, loadHistory, refreshStatic, setShowHelp, onDebugMessage, openThemeDialog, openAuthDialog, openEditorDialog, performMemoryRefresh, toggleCorgiMode, showToolDescriptions = false, setQuittingMessages, openPrivacyNotice) => {
23
- const session = useSessionStats();
24
- const gitService = useMemo(() => {
25
- if (!config?.getProjectRoot()) {
26
- return;
27
- }
28
- return new GitService(config.getProjectRoot());
29
- }, [config]);
30
- const pendingHistoryItems = [];
31
- const [pendingCompressionItemRef, setPendingCompressionItem] = useStateAndRef(null);
32
- if (pendingCompressionItemRef.current != null) {
33
- pendingHistoryItems.push(pendingCompressionItemRef.current);
34
- }
35
- const addMessage = useCallback((message) => {
36
- // Convert Message to HistoryItemWithoutId
37
- let historyItemContent;
38
- if (message.type === MessageType.ABOUT) {
39
- historyItemContent = {
40
- type: 'about',
41
- cliVersion: message.cliVersion,
42
- osVersion: message.osVersion,
43
- sandboxEnv: message.sandboxEnv,
44
- modelVersion: message.modelVersion,
45
- selectedAuthType: message.selectedAuthType,
46
- gcpProject: message.gcpProject,
47
- };
48
- }
49
- else if (message.type === MessageType.STATS) {
50
- historyItemContent = {
51
- type: 'stats',
52
- duration: message.duration,
53
- };
54
- }
55
- else if (message.type === MessageType.MODEL_STATS) {
56
- historyItemContent = {
57
- type: 'model_stats',
58
- };
59
- }
60
- else if (message.type === MessageType.TOOL_STATS) {
61
- historyItemContent = {
62
- type: 'tool_stats',
63
- };
64
- }
65
- else if (message.type === MessageType.QUIT) {
66
- historyItemContent = {
67
- type: 'quit',
68
- duration: message.duration,
69
- };
70
- }
71
- else if (message.type === MessageType.COMPRESSION) {
72
- historyItemContent = {
73
- type: 'compression',
74
- compression: message.compression,
75
- };
76
- }
77
- else {
78
- historyItemContent = {
79
- type: message.type,
80
- text: message.content,
81
- };
82
- }
83
- addItem(historyItemContent, message.timestamp.getTime());
84
- }, [addItem]);
85
- const showMemoryAction = useCallback(async () => {
86
- const actionFn = createShowMemoryAction(config, settings, addMessage);
87
- await actionFn();
88
- }, [config, settings, addMessage]);
89
- const addMemoryAction = useCallback((_mainCommand, _subCommand, args) => {
90
- if (!args || args.trim() === '') {
91
- addMessage({
92
- type: MessageType.ERROR,
93
- content: 'Usage: /memory add <text to remember>',
94
- timestamp: new Date(),
95
- });
96
- return;
97
- }
98
- // UI feedback for attempting to schedule
99
- addMessage({
100
- type: MessageType.INFO,
101
- content: `Attempting to save to memory: "${args.trim()}"`,
102
- timestamp: new Date(),
103
- });
104
- // Return info for scheduling the tool call
105
- return {
106
- shouldScheduleTool: true,
107
- toolName: 'save_memory',
108
- toolArgs: { fact: args.trim() },
109
- };
110
- }, [addMessage]);
111
- const savedChatTags = useCallback(async () => {
112
- const geminiDir = config?.getProjectTempDir();
113
- if (!geminiDir) {
114
- return [];
115
- }
116
- try {
117
- const files = await fs.readdir(geminiDir);
118
- return files
119
- .filter((file) => file.startsWith('checkpoint-') && file.endsWith('.json'))
120
- .map((file) => file.replace('checkpoint-', '').replace('.json', ''));
121
- }
122
- catch (_err) {
123
- return [];
124
- }
125
- }, [config]);
126
- const slashCommands = useMemo(() => {
127
- const commands = [
128
- {
129
- name: 'help',
130
- altName: '?',
131
- description: 'for help on gemini-cli',
132
- action: (_mainCommand, _subCommand, _args) => {
133
- onDebugMessage('Opening help.');
134
- setShowHelp(true);
135
- },
136
- },
137
- {
138
- name: 'docs',
139
- description: 'open full Gemini CLI documentation in your browser',
140
- action: async (_mainCommand, _subCommand, _args) => {
141
- const docsUrl = 'https://goo.gle/gemini-cli-docs';
142
- if (process.env.SANDBOX && process.env.SANDBOX !== 'sandbox-exec') {
143
- addMessage({
144
- type: MessageType.INFO,
145
- content: `Please open the following URL in your browser to view the documentation:\n${docsUrl}`,
146
- timestamp: new Date(),
147
- });
148
- }
149
- else {
150
- addMessage({
151
- type: MessageType.INFO,
152
- content: `Opening documentation in your browser: ${docsUrl}`,
153
- timestamp: new Date(),
154
- });
155
- await open(docsUrl);
156
- }
157
- },
158
- },
159
- {
160
- name: 'clear',
161
- description: 'clear the screen and conversation history',
162
- action: async (_mainCommand, _subCommand, _args) => {
163
- onDebugMessage('Clearing terminal and resetting chat.');
164
- clearItems();
165
- await config?.getGeminiClient()?.resetChat();
166
- console.clear();
167
- refreshStatic();
168
- },
169
- },
170
- {
171
- name: 'theme',
172
- description: 'change the theme',
173
- action: (_mainCommand, _subCommand, _args) => {
174
- openThemeDialog();
175
- },
176
- },
177
- {
178
- name: 'auth',
179
- description: 'change the auth method',
180
- action: (_mainCommand, _subCommand, _args) => {
181
- openAuthDialog();
182
- },
183
- },
184
- {
185
- name: 'editor',
186
- description: 'set external editor preference',
187
- action: (_mainCommand, _subCommand, _args) => {
188
- openEditorDialog();
189
- },
190
- },
191
- {
192
- name: 'privacy',
193
- description: 'display the privacy notice',
194
- action: (_mainCommand, _subCommand, _args) => {
195
- openPrivacyNotice();
196
- },
197
- },
198
- {
199
- name: 'stats',
200
- altName: 'usage',
201
- description: 'check session stats. Usage: /stats [model|tools]',
202
- action: (_mainCommand, subCommand, _args) => {
203
- if (subCommand === 'model') {
204
- addMessage({
205
- type: MessageType.MODEL_STATS,
206
- timestamp: new Date(),
207
- });
208
- return;
209
- }
210
- else if (subCommand === 'tools') {
211
- addMessage({
212
- type: MessageType.TOOL_STATS,
213
- timestamp: new Date(),
214
- });
215
- return;
216
- }
217
- const now = new Date();
218
- const { sessionStartTime } = session.stats;
219
- const wallDuration = now.getTime() - sessionStartTime.getTime();
220
- addMessage({
221
- type: MessageType.STATS,
222
- duration: formatDuration(wallDuration),
223
- timestamp: new Date(),
224
- });
225
- },
226
- },
227
- {
228
- name: 'mcp',
229
- description: 'list configured MCP servers and tools',
230
- action: async (_mainCommand, _subCommand, _args) => {
231
- // Check if the _subCommand includes a specific flag to control description visibility
232
- let useShowDescriptions = showToolDescriptions;
233
- if (_subCommand === 'desc' || _subCommand === 'descriptions') {
234
- useShowDescriptions = true;
235
- }
236
- else if (_subCommand === 'nodesc' ||
237
- _subCommand === 'nodescriptions') {
238
- useShowDescriptions = false;
239
- }
240
- else if (_args === 'desc' || _args === 'descriptions') {
241
- useShowDescriptions = true;
242
- }
243
- else if (_args === 'nodesc' || _args === 'nodescriptions') {
244
- useShowDescriptions = false;
245
- }
246
- // Check if the _subCommand includes a specific flag to show detailed tool schema
247
- let useShowSchema = false;
248
- if (_subCommand === 'schema' || _args === 'schema') {
249
- useShowSchema = true;
250
- }
251
- const toolRegistry = await config?.getToolRegistry();
252
- if (!toolRegistry) {
253
- addMessage({
254
- type: MessageType.ERROR,
255
- content: 'Could not retrieve tool registry.',
256
- timestamp: new Date(),
257
- });
258
- return;
259
- }
260
- const mcpServers = config?.getMcpServers() || {};
261
- const serverNames = Object.keys(mcpServers);
262
- if (serverNames.length === 0) {
263
- const docsUrl = 'https://goo.gle/gemini-cli-docs-mcp';
264
- if (process.env.SANDBOX && process.env.SANDBOX !== 'sandbox-exec') {
265
- addMessage({
266
- type: MessageType.INFO,
267
- content: `No MCP servers configured. Please open the following URL in your browser to view documentation:\n${docsUrl}`,
268
- timestamp: new Date(),
269
- });
270
- }
271
- else {
272
- addMessage({
273
- type: MessageType.INFO,
274
- content: `No MCP servers configured. Opening documentation in your browser: ${docsUrl}`,
275
- timestamp: new Date(),
276
- });
277
- await open(docsUrl);
278
- }
279
- return;
280
- }
281
- // Check if any servers are still connecting
282
- const connectingServers = serverNames.filter((name) => getMCPServerStatus(name) === MCPServerStatus.CONNECTING);
283
- const discoveryState = getMCPDiscoveryState();
284
- let message = '';
285
- // Add overall discovery status message if needed
286
- if (discoveryState === MCPDiscoveryState.IN_PROGRESS ||
287
- connectingServers.length > 0) {
288
- message += `\u001b[33m⏳ MCP servers are starting up (${connectingServers.length} initializing)...\u001b[0m\n`;
289
- message += `\u001b[90mNote: First startup may take longer. Tool availability will update automatically.\u001b[0m\n\n`;
290
- }
291
- message += 'Configured MCP servers:\n\n';
292
- for (const serverName of serverNames) {
293
- const serverTools = toolRegistry.getToolsByServer(serverName);
294
- const status = getMCPServerStatus(serverName);
295
- // Add status indicator with descriptive text
296
- let statusIndicator = '';
297
- let statusText = '';
298
- switch (status) {
299
- case MCPServerStatus.CONNECTED:
300
- statusIndicator = '🟢';
301
- statusText = 'Ready';
302
- break;
303
- case MCPServerStatus.CONNECTING:
304
- statusIndicator = '🔄';
305
- statusText = 'Starting... (first startup may take longer)';
306
- break;
307
- case MCPServerStatus.DISCONNECTED:
308
- default:
309
- statusIndicator = '🔴';
310
- statusText = 'Disconnected';
311
- break;
312
- }
313
- // Get server description if available
314
- const server = mcpServers[serverName];
315
- // Format server header with bold formatting and status
316
- message += `${statusIndicator} \u001b[1m${serverName}\u001b[0m - ${statusText}`;
317
- // Add tool count with conditional messaging
318
- if (status === MCPServerStatus.CONNECTED) {
319
- message += ` (${serverTools.length} tools)`;
320
- }
321
- else if (status === MCPServerStatus.CONNECTING) {
322
- message += ` (tools will appear when ready)`;
323
- }
324
- else {
325
- message += ` (${serverTools.length} tools cached)`;
326
- }
327
- // Add server description with proper handling of multi-line descriptions
328
- if ((useShowDescriptions || useShowSchema) && server?.description) {
329
- const greenColor = '\u001b[32m';
330
- const resetColor = '\u001b[0m';
331
- const descLines = server.description.trim().split('\n');
332
- if (descLines) {
333
- message += ':\n';
334
- for (const descLine of descLines) {
335
- message += ` ${greenColor}${descLine}${resetColor}\n`;
336
- }
337
- }
338
- else {
339
- message += '\n';
340
- }
341
- }
342
- else {
343
- message += '\n';
344
- }
345
- // Reset formatting after server entry
346
- message += '\u001b[0m';
347
- if (serverTools.length > 0) {
348
- serverTools.forEach((tool) => {
349
- if ((useShowDescriptions || useShowSchema) &&
350
- tool.description) {
351
- // Format tool name in cyan using simple ANSI cyan color
352
- message += ` - \u001b[36m${tool.name}\u001b[0m`;
353
- // Apply green color to the description text
354
- const greenColor = '\u001b[32m';
355
- const resetColor = '\u001b[0m';
356
- // Handle multi-line descriptions by properly indenting and preserving formatting
357
- const descLines = tool.description.trim().split('\n');
358
- if (descLines) {
359
- message += ':\n';
360
- for (const descLine of descLines) {
361
- message += ` ${greenColor}${descLine}${resetColor}\n`;
362
- }
363
- }
364
- else {
365
- message += '\n';
366
- }
367
- // Reset is handled inline with each line now
368
- }
369
- else {
370
- // Use cyan color for the tool name even when not showing descriptions
371
- message += ` - \u001b[36m${tool.name}\u001b[0m\n`;
372
- }
373
- if (useShowSchema) {
374
- // Prefix the parameters in cyan
375
- message += ` \u001b[36mParameters:\u001b[0m\n`;
376
- // Apply green color to the parameter text
377
- const greenColor = '\u001b[32m';
378
- const resetColor = '\u001b[0m';
379
- const paramsLines = JSON.stringify(tool.schema.parameters, null, 2)
380
- .trim()
381
- .split('\n');
382
- if (paramsLines) {
383
- for (const paramsLine of paramsLines) {
384
- message += ` ${greenColor}${paramsLine}${resetColor}\n`;
385
- }
386
- }
387
- }
388
- });
389
- }
390
- else {
391
- message += ' No tools available\n';
392
- }
393
- message += '\n';
394
- }
395
- // Make sure to reset any ANSI formatting at the end to prevent it from affecting the terminal
396
- message += '\u001b[0m';
397
- addMessage({
398
- type: MessageType.INFO,
399
- content: message,
400
- timestamp: new Date(),
401
- });
402
- },
403
- },
404
- {
405
- name: 'memory',
406
- description: 'manage memory. Usage: /memory <show|refresh|add> [text for add]',
407
- action: (mainCommand, subCommand, args) => {
408
- switch (subCommand) {
409
- case 'show':
410
- showMemoryAction();
411
- return;
412
- case 'refresh':
413
- performMemoryRefresh();
414
- return;
415
- case 'add':
416
- return addMemoryAction(mainCommand, subCommand, args); // Return the object
417
- case undefined:
418
- addMessage({
419
- type: MessageType.ERROR,
420
- content: 'Missing command\nUsage: /memory <show|refresh|add> [text for add]',
421
- timestamp: new Date(),
422
- });
423
- return;
424
- default:
425
- addMessage({
426
- type: MessageType.ERROR,
427
- content: `Unknown /memory command: ${subCommand}. Available: show, refresh, add`,
428
- timestamp: new Date(),
429
- });
430
- return;
431
- }
432
- },
433
- },
434
- {
435
- name: 'tools',
436
- description: 'list available Gemini CLI tools',
437
- action: async (_mainCommand, _subCommand, _args) => {
438
- // Check if the _subCommand includes a specific flag to control description visibility
439
- let useShowDescriptions = showToolDescriptions;
440
- if (_subCommand === 'desc' || _subCommand === 'descriptions') {
441
- useShowDescriptions = true;
442
- }
443
- else if (_subCommand === 'nodesc' ||
444
- _subCommand === 'nodescriptions') {
445
- useShowDescriptions = false;
446
- }
447
- else if (_args === 'desc' || _args === 'descriptions') {
448
- useShowDescriptions = true;
449
- }
450
- else if (_args === 'nodesc' || _args === 'nodescriptions') {
451
- useShowDescriptions = false;
452
- }
453
- const toolRegistry = await config?.getToolRegistry();
454
- const tools = toolRegistry?.getAllTools();
455
- if (!tools) {
456
- addMessage({
457
- type: MessageType.ERROR,
458
- content: 'Could not retrieve tools.',
459
- timestamp: new Date(),
460
- });
461
- return;
462
- }
463
- // Filter out MCP tools by checking if they have a serverName property
464
- const geminiTools = tools.filter((tool) => !('serverName' in tool));
465
- let message = 'Available Gemini CLI tools:\n\n';
466
- if (geminiTools.length > 0) {
467
- geminiTools.forEach((tool) => {
468
- if (useShowDescriptions && tool.description) {
469
- // Format tool name in cyan using simple ANSI cyan color
470
- message += ` - \u001b[36m${tool.displayName} (${tool.name})\u001b[0m:\n`;
471
- // Apply green color to the description text
472
- const greenColor = '\u001b[32m';
473
- const resetColor = '\u001b[0m';
474
- // Handle multi-line descriptions by properly indenting and preserving formatting
475
- const descLines = tool.description.trim().split('\n');
476
- // If there are multiple lines, add proper indentation for each line
477
- if (descLines) {
478
- for (const descLine of descLines) {
479
- message += ` ${greenColor}${descLine}${resetColor}\n`;
480
- }
481
- }
482
- }
483
- else {
484
- // Use cyan color for the tool name even when not showing descriptions
485
- message += ` - \u001b[36m${tool.displayName}\u001b[0m\n`;
486
- }
487
- });
488
- }
489
- else {
490
- message += ' No tools available\n';
491
- }
492
- message += '\n';
493
- // Make sure to reset any ANSI formatting at the end to prevent it from affecting the terminal
494
- message += '\u001b[0m';
495
- addMessage({
496
- type: MessageType.INFO,
497
- content: message,
498
- timestamp: new Date(),
499
- });
500
- },
501
- },
502
- {
503
- name: 'corgi',
504
- action: (_mainCommand, _subCommand, _args) => {
505
- toggleCorgiMode();
506
- },
507
- },
508
- {
509
- name: 'about',
510
- description: 'show version info',
511
- action: async (_mainCommand, _subCommand, _args) => {
512
- const osVersion = process.platform;
513
- let sandboxEnv = 'no sandbox';
514
- if (process.env.SANDBOX && process.env.SANDBOX !== 'sandbox-exec') {
515
- sandboxEnv = process.env.SANDBOX;
516
- }
517
- else if (process.env.SANDBOX === 'sandbox-exec') {
518
- sandboxEnv = `sandbox-exec (${process.env.SEATBELT_PROFILE || 'unknown'})`;
519
- }
520
- const modelVersion = config?.getModel() || 'Unknown';
521
- const cliVersion = await getCliVersion();
522
- const selectedAuthType = settings.merged.selectedAuthType || '';
523
- const gcpProject = process.env.GOOGLE_CLOUD_PROJECT || '';
524
- addMessage({
525
- type: MessageType.ABOUT,
526
- timestamp: new Date(),
527
- cliVersion,
528
- osVersion,
529
- sandboxEnv,
530
- modelVersion,
531
- selectedAuthType,
532
- gcpProject,
533
- });
534
- },
535
- },
536
- {
537
- name: 'bug',
538
- description: 'submit a bug report',
539
- action: async (_mainCommand, _subCommand, args) => {
540
- let bugDescription = _subCommand || '';
541
- if (args) {
542
- bugDescription += ` ${args}`;
543
- }
544
- bugDescription = bugDescription.trim();
545
- const osVersion = `${process.platform} ${process.version}`;
546
- let sandboxEnv = 'no sandbox';
547
- if (process.env.SANDBOX && process.env.SANDBOX !== 'sandbox-exec') {
548
- sandboxEnv = process.env.SANDBOX.replace(/^gemini-(?:code-)?/, '');
549
- }
550
- else if (process.env.SANDBOX === 'sandbox-exec') {
551
- sandboxEnv = `sandbox-exec (${process.env.SEATBELT_PROFILE || 'unknown'})`;
552
- }
553
- const modelVersion = config?.getModel() || 'Unknown';
554
- const cliVersion = await getCliVersion();
555
- const memoryUsage = formatMemoryUsage(process.memoryUsage().rss);
556
- const info = `
557
- * **CLI Version:** ${cliVersion}
558
- * **Git Commit:** ${GIT_COMMIT_INFO}
559
- * **Operating System:** ${osVersion}
560
- * **Sandbox Environment:** ${sandboxEnv}
561
- * **Model Version:** ${modelVersion}
562
- * **Memory Usage:** ${memoryUsage}
563
- `;
564
- let bugReportUrl = 'https://github.com/google-gemini/gemini-cli/issues/new?template=bug_report.yml&title={title}&info={info}';
565
- const bugCommand = config?.getBugCommand();
566
- if (bugCommand?.urlTemplate) {
567
- bugReportUrl = bugCommand.urlTemplate;
568
- }
569
- bugReportUrl = bugReportUrl
570
- .replace('{title}', encodeURIComponent(bugDescription))
571
- .replace('{info}', encodeURIComponent(info));
572
- addMessage({
573
- type: MessageType.INFO,
574
- content: `To submit your bug report, please open the following URL in your browser:\n${bugReportUrl}`,
575
- timestamp: new Date(),
576
- });
577
- (async () => {
578
- try {
579
- await open(bugReportUrl);
580
- }
581
- catch (error) {
582
- const errorMessage = error instanceof Error ? error.message : String(error);
583
- addMessage({
584
- type: MessageType.ERROR,
585
- content: `Could not open URL in browser: ${errorMessage}`,
586
- timestamp: new Date(),
587
- });
588
- }
589
- })();
590
- },
591
- },
592
- {
593
- name: 'chat',
594
- description: 'Manage conversation history. Usage: /chat <list|save|resume> [tag]',
595
- action: async (_mainCommand, subCommand, args) => {
596
- const tag = (args || '').trim();
597
- const logger = new Logger(config?.getSessionId() || '');
598
- await logger.initialize();
599
- const chat = await config?.getGeminiClient()?.getChat();
600
- if (!chat) {
601
- addMessage({
602
- type: MessageType.ERROR,
603
- content: 'No chat client available for conversation status.',
604
- timestamp: new Date(),
605
- });
606
- return;
607
- }
608
- if (!subCommand) {
609
- addMessage({
610
- type: MessageType.ERROR,
611
- content: 'Missing command\nUsage: /chat <list|save|resume> [tag]',
612
- timestamp: new Date(),
613
- });
614
- return;
615
- }
616
- switch (subCommand) {
617
- case 'save': {
618
- const history = chat.getHistory();
619
- if (history.length > 0) {
620
- await logger.saveCheckpoint(chat?.getHistory() || [], tag);
621
- addMessage({
622
- type: MessageType.INFO,
623
- content: `Conversation checkpoint saved${tag ? ' with tag: ' + tag : ''}.`,
624
- timestamp: new Date(),
625
- });
626
- }
627
- else {
628
- addMessage({
629
- type: MessageType.INFO,
630
- content: 'No conversation found to save.',
631
- timestamp: new Date(),
632
- });
633
- }
634
- return;
635
- }
636
- case 'resume':
637
- case 'restore':
638
- case 'load': {
639
- const conversation = await logger.loadCheckpoint(tag);
640
- if (conversation.length === 0) {
641
- addMessage({
642
- type: MessageType.INFO,
643
- content: `No saved checkpoint found${tag ? ' with tag: ' + tag : ''}.`,
644
- timestamp: new Date(),
645
- });
646
- return;
647
- }
648
- clearItems();
649
- chat.clearHistory();
650
- const rolemap = {
651
- user: MessageType.USER,
652
- model: MessageType.GEMINI,
653
- };
654
- let hasSystemPrompt = false;
655
- let i = 0;
656
- for (const item of conversation) {
657
- i += 1;
658
- // Add each item to history regardless of whether we display
659
- // it.
660
- chat.addHistory(item);
661
- const text = item.parts
662
- ?.filter((m) => !!m.text)
663
- .map((m) => m.text)
664
- .join('') || '';
665
- if (!text) {
666
- // Parsing Part[] back to various non-text output not yet implemented.
667
- continue;
668
- }
669
- if (i === 1 && text.match(/context for our chat/)) {
670
- hasSystemPrompt = true;
671
- }
672
- if (i > 2 || !hasSystemPrompt) {
673
- addItem({
674
- type: (item.role && rolemap[item.role]) || MessageType.GEMINI,
675
- text,
676
- }, i);
677
- }
678
- }
679
- console.clear();
680
- refreshStatic();
681
- return;
682
- }
683
- case 'list':
684
- addMessage({
685
- type: MessageType.INFO,
686
- content: 'list of saved conversations: ' +
687
- (await savedChatTags()).join(', '),
688
- timestamp: new Date(),
689
- });
690
- return;
691
- default:
692
- addMessage({
693
- type: MessageType.ERROR,
694
- content: `Unknown /chat command: ${subCommand}. Available: list, save, resume`,
695
- timestamp: new Date(),
696
- });
697
- return;
698
- }
699
- },
700
- completion: async () => (await savedChatTags()).map((tag) => 'resume ' + tag),
701
- },
702
- {
703
- name: 'quit',
704
- altName: 'exit',
705
- description: 'exit the cli',
706
- action: async (mainCommand, _subCommand, _args) => {
707
- const now = new Date();
708
- const { sessionStartTime } = session.stats;
709
- const wallDuration = now.getTime() - sessionStartTime.getTime();
710
- setQuittingMessages([
711
- {
712
- type: 'user',
713
- text: `/${mainCommand}`,
714
- id: now.getTime() - 1,
715
- },
716
- {
717
- type: 'quit',
718
- duration: formatDuration(wallDuration),
719
- id: now.getTime(),
720
- },
721
- ]);
722
- setTimeout(() => {
723
- process.exit(0);
724
- }, 100);
725
- },
726
- },
727
- {
728
- name: 'compress',
729
- altName: 'summarize',
730
- description: 'Compresses the context by replacing it with a summary.',
731
- action: async (_mainCommand, _subCommand, _args) => {
732
- if (pendingCompressionItemRef.current !== null) {
733
- addMessage({
734
- type: MessageType.ERROR,
735
- content: 'Already compressing, wait for previous request to complete',
736
- timestamp: new Date(),
737
- });
738
- return;
739
- }
740
- setPendingCompressionItem({
741
- type: MessageType.COMPRESSION,
742
- compression: {
743
- isPending: true,
744
- originalTokenCount: null,
745
- newTokenCount: null,
746
- },
747
- });
748
- try {
749
- const compressed = await config
750
- .getGeminiClient()
751
- .tryCompressChat(true);
752
- if (compressed) {
753
- addMessage({
754
- type: MessageType.COMPRESSION,
755
- compression: {
756
- isPending: false,
757
- originalTokenCount: compressed.originalTokenCount,
758
- newTokenCount: compressed.newTokenCount,
759
- },
760
- timestamp: new Date(),
761
- });
762
- }
763
- else {
764
- addMessage({
765
- type: MessageType.ERROR,
766
- content: 'Failed to compress chat history.',
767
- timestamp: new Date(),
768
- });
769
- }
770
- }
771
- catch (e) {
772
- addMessage({
773
- type: MessageType.ERROR,
774
- content: `Failed to compress chat history: ${e instanceof Error ? e.message : String(e)}`,
775
- timestamp: new Date(),
776
- });
777
- }
778
- setPendingCompressionItem(null);
779
- },
780
- },
781
- ];
782
- if (config?.getCheckpointingEnabled()) {
783
- commands.push({
784
- name: 'restore',
785
- description: 'restore a tool call. This will reset the conversation and file history to the state it was in when the tool call was suggested',
786
- completion: async () => {
787
- const checkpointDir = config?.getProjectTempDir()
788
- ? path.join(config.getProjectTempDir(), 'checkpoints')
789
- : undefined;
790
- if (!checkpointDir) {
791
- return [];
792
- }
793
- try {
794
- const files = await fs.readdir(checkpointDir);
795
- return files
796
- .filter((file) => file.endsWith('.json'))
797
- .map((file) => file.replace('.json', ''));
798
- }
799
- catch (_err) {
800
- return [];
801
- }
802
- },
803
- action: async (_mainCommand, subCommand, _args) => {
804
- const checkpointDir = config?.getProjectTempDir()
805
- ? path.join(config.getProjectTempDir(), 'checkpoints')
806
- : undefined;
807
- if (!checkpointDir) {
808
- addMessage({
809
- type: MessageType.ERROR,
810
- content: 'Could not determine the .gemini directory path.',
811
- timestamp: new Date(),
812
- });
813
- return;
814
- }
815
- try {
816
- // Ensure the directory exists before trying to read it.
817
- await fs.mkdir(checkpointDir, { recursive: true });
818
- const files = await fs.readdir(checkpointDir);
819
- const jsonFiles = files.filter((file) => file.endsWith('.json'));
820
- if (!subCommand) {
821
- if (jsonFiles.length === 0) {
822
- addMessage({
823
- type: MessageType.INFO,
824
- content: 'No restorable tool calls found.',
825
- timestamp: new Date(),
826
- });
827
- return;
828
- }
829
- const truncatedFiles = jsonFiles.map((file) => {
830
- const components = file.split('.');
831
- if (components.length <= 1) {
832
- return file;
833
- }
834
- components.pop();
835
- return components.join('.');
836
- });
837
- const fileList = truncatedFiles.join('\n');
838
- addMessage({
839
- type: MessageType.INFO,
840
- content: `Available tool calls to restore:\n\n${fileList}`,
841
- timestamp: new Date(),
842
- });
843
- return;
844
- }
845
- const selectedFile = subCommand.endsWith('.json')
846
- ? subCommand
847
- : `${subCommand}.json`;
848
- if (!jsonFiles.includes(selectedFile)) {
849
- addMessage({
850
- type: MessageType.ERROR,
851
- content: `File not found: ${selectedFile}`,
852
- timestamp: new Date(),
853
- });
854
- return;
855
- }
856
- const filePath = path.join(checkpointDir, selectedFile);
857
- const data = await fs.readFile(filePath, 'utf-8');
858
- const toolCallData = JSON.parse(data);
859
- if (toolCallData.history) {
860
- loadHistory(toolCallData.history);
861
- }
862
- if (toolCallData.clientHistory) {
863
- await config
864
- ?.getGeminiClient()
865
- ?.setHistory(toolCallData.clientHistory);
866
- }
867
- if (toolCallData.commitHash) {
868
- await gitService?.restoreProjectFromSnapshot(toolCallData.commitHash);
869
- addMessage({
870
- type: MessageType.INFO,
871
- content: `Restored project to the state before the tool call.`,
872
- timestamp: new Date(),
873
- });
874
- }
875
- return {
876
- shouldScheduleTool: true,
877
- toolName: toolCallData.toolCall.name,
878
- toolArgs: toolCallData.toolCall.args,
879
- };
880
- }
881
- catch (error) {
882
- addMessage({
883
- type: MessageType.ERROR,
884
- content: `Could not read restorable tool calls. This is the error: ${error}`,
885
- timestamp: new Date(),
886
- });
887
- }
888
- },
889
- });
890
- }
891
- return commands;
892
- }, [
893
- onDebugMessage,
894
- setShowHelp,
895
- refreshStatic,
896
- openThemeDialog,
897
- openAuthDialog,
898
- openEditorDialog,
899
- clearItems,
900
- performMemoryRefresh,
901
- showMemoryAction,
902
- addMemoryAction,
903
- addMessage,
904
- toggleCorgiMode,
905
- savedChatTags,
906
- config,
907
- settings,
908
- showToolDescriptions,
909
- session,
910
- gitService,
911
- loadHistory,
912
- addItem,
913
- setQuittingMessages,
914
- pendingCompressionItemRef,
915
- setPendingCompressionItem,
916
- openPrivacyNotice,
917
- ]);
918
- const handleSlashCommand = useCallback(async (rawQuery) => {
919
- if (typeof rawQuery !== 'string') {
920
- return false;
921
- }
922
- const trimmed = rawQuery.trim();
923
- if (!trimmed.startsWith('/') && !trimmed.startsWith('?')) {
924
- return false;
925
- }
926
- const userMessageTimestamp = Date.now();
927
- if (trimmed !== '/quit' && trimmed !== '/exit') {
928
- addItem({ type: MessageType.USER, text: trimmed }, userMessageTimestamp);
929
- }
930
- let subCommand;
931
- let args;
932
- const commandToMatch = (() => {
933
- if (trimmed.startsWith('?')) {
934
- return 'help';
935
- }
936
- const parts = trimmed.substring(1).trim().split(/\s+/);
937
- if (parts.length > 1) {
938
- subCommand = parts[1];
939
- }
940
- if (parts.length > 2) {
941
- args = parts.slice(2).join(' ');
942
- }
943
- return parts[0];
944
- })();
945
- const mainCommand = commandToMatch;
946
- for (const cmd of slashCommands) {
947
- if (mainCommand === cmd.name || mainCommand === cmd.altName) {
948
- const actionResult = await cmd.action(mainCommand, subCommand, args);
949
- if (typeof actionResult === 'object' &&
950
- actionResult?.shouldScheduleTool) {
951
- return actionResult; // Return the object for useGeminiStream
952
- }
953
- return true; // Command was handled, but no tool to schedule
954
- }
955
- }
956
- addMessage({
957
- type: MessageType.ERROR,
958
- content: `Unknown command: ${trimmed}`,
959
- timestamp: new Date(),
960
- });
961
- return true; // Indicate command was processed (even if unknown)
962
- }, [addItem, slashCommands, addMessage]);
963
- return { handleSlashCommand, slashCommands, pendingHistoryItems };
964
- };
965
- //# sourceMappingURL=slashCommandProcessor.js.map