@machina.ai/cell-cli 1.11.0-rc1 → 1.13.0-rc2

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 (538) hide show
  1. package/dist/package.json +16 -10
  2. package/dist/src/commands/extensions/disable.d.ts +1 -1
  3. package/dist/src/commands/extensions/disable.js +15 -7
  4. package/dist/src/commands/extensions/disable.js.map +1 -1
  5. package/dist/src/commands/extensions/enable.d.ts +1 -1
  6. package/dist/src/commands/extensions/enable.js +15 -7
  7. package/dist/src/commands/extensions/enable.js.map +1 -1
  8. package/dist/src/commands/extensions/install.js +14 -3
  9. package/dist/src/commands/extensions/install.js.map +1 -1
  10. package/dist/src/commands/extensions/install.test.js +39 -19
  11. package/dist/src/commands/extensions/install.test.js.map +1 -1
  12. package/dist/src/commands/extensions/link.js +14 -3
  13. package/dist/src/commands/extensions/link.js.map +1 -1
  14. package/dist/src/commands/extensions/list.js +13 -4
  15. package/dist/src/commands/extensions/list.js.map +1 -1
  16. package/dist/src/commands/extensions/uninstall.js +13 -2
  17. package/dist/src/commands/extensions/uninstall.js.map +1 -1
  18. package/dist/src/commands/extensions/update.js +18 -13
  19. package/dist/src/commands/extensions/update.js.map +1 -1
  20. package/dist/src/commands/extensions/validate.d.ts +12 -0
  21. package/dist/src/commands/extensions/validate.js +83 -0
  22. package/dist/src/commands/extensions/validate.js.map +1 -0
  23. package/dist/src/commands/extensions/validate.test.js +93 -0
  24. package/dist/src/commands/extensions/validate.test.js.map +1 -0
  25. package/dist/src/commands/extensions.js +3 -0
  26. package/dist/src/commands/extensions.js.map +1 -1
  27. package/dist/src/commands/mcp/add.test.js +3 -0
  28. package/dist/src/commands/mcp/add.test.js.map +1 -1
  29. package/dist/src/commands/mcp/list.js +10 -3
  30. package/dist/src/commands/mcp/list.js.map +1 -1
  31. package/dist/src/commands/mcp/list.test.js +37 -27
  32. package/dist/src/commands/mcp/list.test.js.map +1 -1
  33. package/dist/src/config/auth.js +0 -5
  34. package/dist/src/config/auth.js.map +1 -1
  35. package/dist/src/config/config.d.ts +6 -3
  36. package/dist/src/config/config.js +65 -80
  37. package/dist/src/config/config.js.map +1 -1
  38. package/dist/src/config/config.test.js +235 -212
  39. package/dist/src/config/config.test.js.map +1 -1
  40. package/dist/src/config/extension-manager.d.ts +63 -0
  41. package/dist/src/config/extension-manager.js +450 -0
  42. package/dist/src/config/extension-manager.js.map +1 -0
  43. package/dist/src/config/extension.d.ts +4 -51
  44. package/dist/src/config/extension.js +1 -535
  45. package/dist/src/config/extension.js.map +1 -1
  46. package/dist/src/config/extension.test.js +525 -201
  47. package/dist/src/config/extension.test.js.map +1 -1
  48. package/dist/src/config/extensions/consent.d.ts +38 -0
  49. package/dist/src/config/extensions/consent.js +123 -0
  50. package/dist/src/config/extensions/consent.js.map +1 -0
  51. package/dist/src/config/extensions/extensionEnablement.d.ts +1 -1
  52. package/dist/src/config/extensions/extensionEnablement.js +4 -3
  53. package/dist/src/config/extensions/extensionEnablement.js.map +1 -1
  54. package/dist/src/config/extensions/extensionEnablement.test.js +10 -10
  55. package/dist/src/config/extensions/extensionEnablement.test.js.map +1 -1
  56. package/dist/src/config/extensions/extensionSettings.d.ts +15 -0
  57. package/dist/src/config/extensions/extensionSettings.js +113 -0
  58. package/dist/src/config/extensions/extensionSettings.js.map +1 -0
  59. package/dist/src/config/extensions/extensionSettings.test.d.ts +6 -0
  60. package/dist/src/config/extensions/extensionSettings.test.js +254 -0
  61. package/dist/src/config/extensions/extensionSettings.test.js.map +1 -0
  62. package/dist/src/config/extensions/github.d.ts +2 -2
  63. package/dist/src/config/extensions/github.js +5 -10
  64. package/dist/src/config/extensions/github.js.map +1 -1
  65. package/dist/src/config/extensions/github.test.js +153 -167
  66. package/dist/src/config/extensions/github.test.js.map +1 -1
  67. package/dist/src/config/extensions/github_fetch.d.ts +1 -1
  68. package/dist/src/config/extensions/github_fetch.js +13 -1
  69. package/dist/src/config/extensions/github_fetch.js.map +1 -1
  70. package/dist/src/config/extensions/github_fetch.test.d.ts +6 -0
  71. package/dist/src/config/extensions/github_fetch.test.js +169 -0
  72. package/dist/src/config/extensions/github_fetch.test.js.map +1 -0
  73. package/dist/src/config/extensions/storage.d.ts +14 -0
  74. package/dist/src/config/extensions/storage.js +32 -0
  75. package/dist/src/config/extensions/storage.js.map +1 -0
  76. package/dist/src/config/extensions/update.d.ts +4 -4
  77. package/dist/src/config/extensions/update.js +39 -39
  78. package/dist/src/config/extensions/update.js.map +1 -1
  79. package/dist/src/config/extensions/update.test.js +72 -74
  80. package/dist/src/config/extensions/update.test.js.map +1 -1
  81. package/dist/src/config/extensions/variableSchema.d.ts +0 -6
  82. package/dist/src/config/extensions/variableSchema.js.map +1 -1
  83. package/dist/src/config/extensions/variables.d.ts +4 -0
  84. package/dist/src/config/extensions/variables.js +6 -0
  85. package/dist/src/config/extensions/variables.js.map +1 -1
  86. package/dist/src/config/keyBindings.d.ts +3 -0
  87. package/dist/src/config/keyBindings.js +30 -8
  88. package/dist/src/config/keyBindings.js.map +1 -1
  89. package/dist/src/config/keyBindings.test.js +17 -0
  90. package/dist/src/config/keyBindings.test.js.map +1 -1
  91. package/dist/src/config/policies/read-only.toml +56 -0
  92. package/dist/src/config/policies/write.toml +63 -0
  93. package/dist/src/config/policies/yolo.toml +31 -0
  94. package/dist/src/config/policy-engine.integration.test.js +41 -38
  95. package/dist/src/config/policy-engine.integration.test.js.map +1 -1
  96. package/dist/src/config/policy.d.ts +2 -2
  97. package/dist/src/config/policy.js +10 -148
  98. package/dist/src/config/policy.js.map +1 -1
  99. package/dist/src/config/sandboxConfig.d.ts +1 -1
  100. package/dist/src/config/sandboxConfig.js +6 -3
  101. package/dist/src/config/sandboxConfig.js.map +1 -1
  102. package/dist/src/config/settings.d.ts +2 -1
  103. package/dist/src/config/settings.js +58 -18
  104. package/dist/src/config/settings.js.map +1 -1
  105. package/dist/src/config/settings.test.js +128 -69
  106. package/dist/src/config/settings.test.js.map +1 -1
  107. package/dist/src/config/settingsSchema.d.ts +170 -28
  108. package/dist/src/config/settingsSchema.js +418 -27
  109. package/dist/src/config/settingsSchema.js.map +1 -1
  110. package/dist/src/config/settingsSchema.test.js +42 -1
  111. package/dist/src/config/settingsSchema.test.js.map +1 -1
  112. package/dist/src/config/trustedFolders.d.ts +1 -1
  113. package/dist/src/config/trustedFolders.js +4 -2
  114. package/dist/src/config/trustedFolders.js.map +1 -1
  115. package/dist/src/core/initializer.js +2 -1
  116. package/dist/src/core/initializer.js.map +1 -1
  117. package/dist/src/gemini.d.ts +1 -1
  118. package/dist/src/gemini.js +46 -16
  119. package/dist/src/gemini.js.map +1 -1
  120. package/dist/src/gemini.test.js +88 -30
  121. package/dist/src/gemini.test.js.map +1 -1
  122. package/dist/src/generated/git-commit.d.ts +2 -2
  123. package/dist/src/generated/git-commit.js +2 -2
  124. package/dist/src/nonInteractiveCli.d.ts +9 -1
  125. package/dist/src/nonInteractiveCli.js +114 -7
  126. package/dist/src/nonInteractiveCli.js.map +1 -1
  127. package/dist/src/nonInteractiveCli.test.js +355 -112
  128. package/dist/src/nonInteractiveCli.test.js.map +1 -1
  129. package/dist/src/services/BuiltinCommandLoader.js +4 -0
  130. package/dist/src/services/BuiltinCommandLoader.js.map +1 -1
  131. package/dist/src/services/BuiltinCommandLoader.test.js +22 -0
  132. package/dist/src/services/BuiltinCommandLoader.test.js.map +1 -1
  133. package/dist/src/services/FeedbackService.js +2 -2
  134. package/dist/src/services/FeedbackService.js.map +1 -1
  135. package/dist/src/services/McpPromptLoader.js +2 -2
  136. package/dist/src/services/McpPromptLoader.js.map +1 -1
  137. package/dist/src/services/McpPromptLoader.test.js +4 -2
  138. package/dist/src/services/McpPromptLoader.test.js.map +1 -1
  139. package/dist/src/test-utils/async.d.ts +9 -0
  140. package/dist/src/test-utils/async.js +29 -0
  141. package/dist/src/test-utils/async.js.map +1 -0
  142. package/dist/src/test-utils/createExtension.d.ts +3 -1
  143. package/dist/src/test-utils/createExtension.js +3 -3
  144. package/dist/src/test-utils/createExtension.js.map +1 -1
  145. package/dist/src/test-utils/render.d.ts +16 -2
  146. package/dist/src/test-utils/render.js +66 -4
  147. package/dist/src/test-utils/render.js.map +1 -1
  148. package/dist/src/test-utils/render.test.d.ts +6 -0
  149. package/dist/src/test-utils/render.test.js +79 -0
  150. package/dist/src/test-utils/render.test.js.map +1 -0
  151. package/dist/src/ui/App.test.js +1 -1
  152. package/dist/src/ui/App.test.js.map +1 -1
  153. package/dist/src/ui/AppContainer.js +181 -65
  154. package/dist/src/ui/AppContainer.js.map +1 -1
  155. package/dist/src/ui/AppContainer.test.js +505 -147
  156. package/dist/src/ui/AppContainer.test.js.map +1 -1
  157. package/dist/src/ui/IdeIntegrationNudge.js +1 -1
  158. package/dist/src/ui/IdeIntegrationNudge.js.map +1 -1
  159. package/dist/src/ui/auth/ApiAuthDialog.d.ts +14 -0
  160. package/dist/src/ui/auth/ApiAuthDialog.js +26 -0
  161. package/dist/src/ui/auth/ApiAuthDialog.js.map +1 -0
  162. package/dist/src/ui/auth/ApiAuthDialog.test.d.ts +6 -0
  163. package/dist/src/ui/auth/ApiAuthDialog.test.js +91 -0
  164. package/dist/src/ui/auth/ApiAuthDialog.test.js.map +1 -0
  165. package/dist/src/ui/auth/AuthDialog.js +7 -3
  166. package/dist/src/ui/auth/AuthDialog.js.map +1 -1
  167. package/dist/src/ui/auth/useAuth.d.ts +2 -0
  168. package/dist/src/ui/auth/useAuth.js +31 -2
  169. package/dist/src/ui/auth/useAuth.js.map +1 -1
  170. package/dist/src/ui/colors.js +3 -0
  171. package/dist/src/ui/colors.js.map +1 -1
  172. package/dist/src/ui/commands/directoryCommand.js +1 -1
  173. package/dist/src/ui/commands/directoryCommand.js.map +1 -1
  174. package/dist/src/ui/commands/extensionsCommand.js +64 -11
  175. package/dist/src/ui/commands/extensionsCommand.js.map +1 -1
  176. package/dist/src/ui/commands/extensionsCommand.test.js +72 -1
  177. package/dist/src/ui/commands/extensionsCommand.test.js.map +1 -1
  178. package/dist/src/ui/commands/mcpCommand.js +14 -14
  179. package/dist/src/ui/commands/mcpCommand.js.map +1 -1
  180. package/dist/src/ui/commands/mcpCommand.test.js +4 -0
  181. package/dist/src/ui/commands/mcpCommand.test.js.map +1 -1
  182. package/dist/src/ui/commands/memoryCommand.js +1 -1
  183. package/dist/src/ui/commands/memoryCommand.js.map +1 -1
  184. package/dist/src/ui/commands/memoryCommand.test.js +3 -1
  185. package/dist/src/ui/commands/memoryCommand.test.js.map +1 -1
  186. package/dist/src/ui/commands/policiesCommand.d.ts +7 -0
  187. package/dist/src/ui/commands/policiesCommand.js +59 -0
  188. package/dist/src/ui/commands/policiesCommand.js.map +1 -0
  189. package/dist/src/ui/commands/policiesCommand.test.d.ts +6 -0
  190. package/dist/src/ui/commands/policiesCommand.test.js +83 -0
  191. package/dist/src/ui/commands/policiesCommand.test.js.map +1 -0
  192. package/dist/src/ui/components/AnsiOutput.test.js +1 -1
  193. package/dist/src/ui/components/AnsiOutput.test.js.map +1 -1
  194. package/dist/src/ui/components/AsciiArt.d.ts +3 -3
  195. package/dist/src/ui/components/AsciiArt.js +3 -3
  196. package/dist/src/ui/components/Composer.js +1 -1
  197. package/dist/src/ui/components/Composer.js.map +1 -1
  198. package/dist/src/ui/components/Composer.test.js +5 -2
  199. package/dist/src/ui/components/Composer.test.js.map +1 -1
  200. package/dist/src/ui/components/ConfigInitDisplay.js +4 -6
  201. package/dist/src/ui/components/ConfigInitDisplay.js.map +1 -1
  202. package/dist/src/ui/components/ConsentPrompt.test.js +18 -8
  203. package/dist/src/ui/components/ConsentPrompt.test.js.map +1 -1
  204. package/dist/src/ui/components/ConsoleSummaryDisplay.js +1 -1
  205. package/dist/src/ui/components/ConsoleSummaryDisplay.js.map +1 -1
  206. package/dist/src/ui/components/ContextSummaryDisplay.test.js +11 -6
  207. package/dist/src/ui/components/ContextSummaryDisplay.test.js.map +1 -1
  208. package/dist/src/ui/components/DetailedMessagesDisplay.js +1 -1
  209. package/dist/src/ui/components/DetailedMessagesDisplay.js.map +1 -1
  210. package/dist/src/ui/components/DialogManager.js +4 -0
  211. package/dist/src/ui/components/DialogManager.js.map +1 -1
  212. package/dist/src/ui/components/FolderTrustDialog.test.js +2 -1
  213. package/dist/src/ui/components/FolderTrustDialog.test.js.map +1 -1
  214. package/dist/src/ui/components/Footer.js +4 -3
  215. package/dist/src/ui/components/Footer.js.map +1 -1
  216. package/dist/src/ui/components/Footer.test.js +83 -0
  217. package/dist/src/ui/components/Footer.test.js.map +1 -1
  218. package/dist/src/ui/components/Header.test.js +13 -5
  219. package/dist/src/ui/components/Header.test.js.map +1 -1
  220. package/dist/src/ui/components/Help.test.js +5 -4
  221. package/dist/src/ui/components/Help.test.js.map +1 -1
  222. package/dist/src/ui/components/HistoryItemDisplay.js +1 -1
  223. package/dist/src/ui/components/HistoryItemDisplay.js.map +1 -1
  224. package/dist/src/ui/components/InputPrompt.js +27 -8
  225. package/dist/src/ui/components/InputPrompt.js.map +1 -1
  226. package/dist/src/ui/components/InputPrompt.test.js +776 -727
  227. package/dist/src/ui/components/InputPrompt.test.js.map +1 -1
  228. package/dist/src/ui/components/LoadingIndicator.js +2 -2
  229. package/dist/src/ui/components/LoadingIndicator.js.map +1 -1
  230. package/dist/src/ui/components/LoadingIndicator.test.js +28 -15
  231. package/dist/src/ui/components/LoadingIndicator.test.js.map +1 -1
  232. package/dist/src/ui/components/LoopDetectionConfirmation.js +1 -1
  233. package/dist/src/ui/components/LoopDetectionConfirmation.js.map +1 -1
  234. package/dist/src/ui/components/LoopDetectionConfirmation.test.js +2 -2
  235. package/dist/src/ui/components/LoopDetectionConfirmation.test.js.map +1 -1
  236. package/dist/src/ui/components/MainContent.js +15 -4
  237. package/dist/src/ui/components/MainContent.js.map +1 -1
  238. package/dist/src/ui/components/ModelDialog.js +1 -1
  239. package/dist/src/ui/components/ModelDialog.js.map +1 -1
  240. package/dist/src/ui/components/ModelDialog.test.js +23 -13
  241. package/dist/src/ui/components/ModelDialog.test.js.map +1 -1
  242. package/dist/src/ui/components/ModelStatsDisplay.test.js +1 -1
  243. package/dist/src/ui/components/ModelStatsDisplay.test.js.map +1 -1
  244. package/dist/src/ui/components/Notifications.js +38 -5
  245. package/dist/src/ui/components/Notifications.js.map +1 -1
  246. package/dist/src/ui/components/PermissionsModifyTrustDialog.test.js +2 -2
  247. package/dist/src/ui/components/PermissionsModifyTrustDialog.test.js.map +1 -1
  248. package/dist/src/ui/components/PrepareLabel.test.js +14 -8
  249. package/dist/src/ui/components/PrepareLabel.test.js.map +1 -1
  250. package/dist/src/ui/components/ProQuotaDialog.test.js +14 -6
  251. package/dist/src/ui/components/ProQuotaDialog.test.js.map +1 -1
  252. package/dist/src/ui/components/QueuedMessageDisplay.test.js +11 -6
  253. package/dist/src/ui/components/QueuedMessageDisplay.test.js.map +1 -1
  254. package/dist/src/ui/components/SessionSummaryDisplay.test.js +1 -1
  255. package/dist/src/ui/components/SessionSummaryDisplay.test.js.map +1 -1
  256. package/dist/src/ui/components/SettingsDialog.js +32 -25
  257. package/dist/src/ui/components/SettingsDialog.js.map +1 -1
  258. package/dist/src/ui/components/SettingsDialog.test.js +428 -532
  259. package/dist/src/ui/components/SettingsDialog.test.js.map +1 -1
  260. package/dist/src/ui/components/ShellConfirmationDialog.js +1 -1
  261. package/dist/src/ui/components/ShellConfirmationDialog.js.map +1 -1
  262. package/dist/src/ui/components/ShellConfirmationDialog.test.js +2 -2
  263. package/dist/src/ui/components/ShellConfirmationDialog.test.js.map +1 -1
  264. package/dist/src/ui/components/StatsDisplay.test.js +1 -1
  265. package/dist/src/ui/components/StatsDisplay.test.js.map +1 -1
  266. package/dist/src/ui/components/SuggestionsDisplay.js +1 -1
  267. package/dist/src/ui/components/SuggestionsDisplay.js.map +1 -1
  268. package/dist/src/ui/components/ThemeDialog.test.js +2 -2
  269. package/dist/src/ui/components/ThemeDialog.test.js.map +1 -1
  270. package/dist/src/ui/components/ToolStatsDisplay.test.js +1 -1
  271. package/dist/src/ui/components/ToolStatsDisplay.test.js.map +1 -1
  272. package/dist/src/ui/components/messages/CompressionMessage.test.js +25 -17
  273. package/dist/src/ui/components/messages/CompressionMessage.test.js.map +1 -1
  274. package/dist/src/ui/components/messages/DiffRenderer.test.js +1 -1
  275. package/dist/src/ui/components/messages/DiffRenderer.test.js.map +1 -1
  276. package/dist/src/ui/components/messages/InfoMessage.js +1 -1
  277. package/dist/src/ui/components/messages/InfoMessage.js.map +1 -1
  278. package/dist/src/ui/components/messages/Todo.js +27 -5
  279. package/dist/src/ui/components/messages/Todo.js.map +1 -1
  280. package/dist/src/ui/components/messages/Todo.test.js +20 -8
  281. package/dist/src/ui/components/messages/Todo.test.js.map +1 -1
  282. package/dist/src/ui/components/messages/ToolConfirmationMessage.js +1 -1
  283. package/dist/src/ui/components/messages/ToolConfirmationMessage.js.map +1 -1
  284. package/dist/src/ui/components/messages/ToolGroupMessage.test.js +29 -15
  285. package/dist/src/ui/components/messages/ToolGroupMessage.test.js.map +1 -1
  286. package/dist/src/ui/components/messages/WarningMessage.js +2 -2
  287. package/dist/src/ui/components/messages/WarningMessage.js.map +1 -1
  288. package/dist/src/ui/components/shared/BaseSelectionList.test.js +1 -1
  289. package/dist/src/ui/components/shared/BaseSelectionList.test.js.map +1 -1
  290. package/dist/src/ui/components/shared/MaxSizedBox.test.js +43 -22
  291. package/dist/src/ui/components/shared/MaxSizedBox.test.js.map +1 -1
  292. package/dist/src/ui/components/shared/TextInput.d.ts +15 -0
  293. package/dist/src/ui/components/shared/TextInput.js +38 -0
  294. package/dist/src/ui/components/shared/TextInput.js.map +1 -0
  295. package/dist/src/ui/components/shared/TextInput.test.d.ts +6 -0
  296. package/dist/src/ui/components/shared/TextInput.test.js +242 -0
  297. package/dist/src/ui/components/shared/TextInput.test.js.map +1 -0
  298. package/dist/src/ui/components/shared/text-buffer.d.ts +9 -2
  299. package/dist/src/ui/components/shared/text-buffer.js +51 -13
  300. package/dist/src/ui/components/shared/text-buffer.js.map +1 -1
  301. package/dist/src/ui/components/shared/text-buffer.test.js +385 -202
  302. package/dist/src/ui/components/shared/text-buffer.test.js.map +1 -1
  303. package/dist/src/ui/components/views/ChatList.test.js +7 -4
  304. package/dist/src/ui/components/views/ChatList.test.js.map +1 -1
  305. package/dist/src/ui/components/views/ExtensionsList.d.ts +7 -1
  306. package/dist/src/ui/components/views/ExtensionsList.js +9 -11
  307. package/dist/src/ui/components/views/ExtensionsList.js.map +1 -1
  308. package/dist/src/ui/components/views/ExtensionsList.test.js +43 -22
  309. package/dist/src/ui/components/views/ExtensionsList.test.js.map +1 -1
  310. package/dist/src/ui/components/views/McpStatus.test.js +23 -12
  311. package/dist/src/ui/components/views/McpStatus.test.js.map +1 -1
  312. package/dist/src/ui/contexts/KeypressContext.d.ts +3 -2
  313. package/dist/src/ui/contexts/KeypressContext.js +610 -540
  314. package/dist/src/ui/contexts/KeypressContext.js.map +1 -1
  315. package/dist/src/ui/contexts/KeypressContext.test.js +438 -718
  316. package/dist/src/ui/contexts/KeypressContext.test.js.map +1 -1
  317. package/dist/src/ui/contexts/MouseContext.d.ts +21 -0
  318. package/dist/src/ui/contexts/MouseContext.js +89 -0
  319. package/dist/src/ui/contexts/MouseContext.js.map +1 -0
  320. package/dist/src/ui/contexts/MouseContext.test.d.ts +6 -0
  321. package/dist/src/ui/contexts/MouseContext.test.js +164 -0
  322. package/dist/src/ui/contexts/MouseContext.test.js.map +1 -0
  323. package/dist/src/ui/contexts/SessionContext.test.js +35 -17
  324. package/dist/src/ui/contexts/SessionContext.test.js.map +1 -1
  325. package/dist/src/ui/contexts/UIActionsContext.d.ts +2 -0
  326. package/dist/src/ui/contexts/UIActionsContext.js.map +1 -1
  327. package/dist/src/ui/contexts/UIStateContext.d.ts +2 -0
  328. package/dist/src/ui/contexts/UIStateContext.js.map +1 -1
  329. package/dist/src/ui/hooks/atCommandProcessor.js +31 -9
  330. package/dist/src/ui/hooks/atCommandProcessor.js.map +1 -1
  331. package/dist/src/ui/hooks/atCommandProcessor.test.js +163 -64
  332. package/dist/src/ui/hooks/atCommandProcessor.test.js.map +1 -1
  333. package/dist/src/ui/hooks/shellCommandProcessor.test.js +64 -35
  334. package/dist/src/ui/hooks/shellCommandProcessor.test.js.map +1 -1
  335. package/dist/src/ui/hooks/slashCommandProcessor.test.js +193 -165
  336. package/dist/src/ui/hooks/slashCommandProcessor.test.js.map +1 -1
  337. package/dist/src/ui/hooks/useAtCompletion.test.js +16 -5
  338. package/dist/src/ui/hooks/useAtCompletion.test.js.map +1 -1
  339. package/dist/src/ui/hooks/useAutoAcceptIndicator.js +10 -0
  340. package/dist/src/ui/hooks/useAutoAcceptIndicator.js.map +1 -1
  341. package/dist/src/ui/hooks/useAutoAcceptIndicator.test.js +32 -1
  342. package/dist/src/ui/hooks/useAutoAcceptIndicator.test.js.map +1 -1
  343. package/dist/src/ui/hooks/useCommandCompletion.test.js +66 -64
  344. package/dist/src/ui/hooks/useCommandCompletion.test.js.map +1 -1
  345. package/dist/src/ui/hooks/useConsoleMessages.test.js +26 -9
  346. package/dist/src/ui/hooks/useConsoleMessages.test.js.map +1 -1
  347. package/dist/src/ui/hooks/useEditorSettings.test.js +40 -34
  348. package/dist/src/ui/hooks/useEditorSettings.test.js.map +1 -1
  349. package/dist/src/ui/hooks/useExtensionUpdates.d.ts +14 -5
  350. package/dist/src/ui/hooks/useExtensionUpdates.js +18 -13
  351. package/dist/src/ui/hooks/useExtensionUpdates.js.map +1 -1
  352. package/dist/src/ui/hooks/useExtensionUpdates.test.js +49 -44
  353. package/dist/src/ui/hooks/useExtensionUpdates.test.js.map +1 -1
  354. package/dist/src/ui/hooks/useFlickerDetector.test.js +9 -5
  355. package/dist/src/ui/hooks/useFlickerDetector.test.js.map +1 -1
  356. package/dist/src/ui/hooks/useFocus.test.js +25 -9
  357. package/dist/src/ui/hooks/useFocus.test.js.map +1 -1
  358. package/dist/src/ui/hooks/useFolderTrust.test.js +46 -22
  359. package/dist/src/ui/hooks/useFolderTrust.test.js.map +1 -1
  360. package/dist/src/ui/hooks/useGeminiStream.js +56 -19
  361. package/dist/src/ui/hooks/useGeminiStream.js.map +1 -1
  362. package/dist/src/ui/hooks/useGeminiStream.test.js +260 -411
  363. package/dist/src/ui/hooks/useGeminiStream.test.js.map +1 -1
  364. package/dist/src/ui/hooks/useGitBranchName.js +4 -0
  365. package/dist/src/ui/hooks/useGitBranchName.js.map +1 -1
  366. package/dist/src/ui/hooks/useGitBranchName.test.js +46 -34
  367. package/dist/src/ui/hooks/useGitBranchName.test.js.map +1 -1
  368. package/dist/src/ui/hooks/useHistoryManager.test.js +2 -1
  369. package/dist/src/ui/hooks/useHistoryManager.test.js.map +1 -1
  370. package/dist/src/ui/hooks/useIdeTrustListener.test.js +40 -9
  371. package/dist/src/ui/hooks/useIdeTrustListener.test.js.map +1 -1
  372. package/dist/src/ui/hooks/useInputHistory.test.js +2 -1
  373. package/dist/src/ui/hooks/useInputHistory.test.js.map +1 -1
  374. package/dist/src/ui/hooks/useInputHistoryStore.test.js +2 -1
  375. package/dist/src/ui/hooks/useInputHistoryStore.test.js.map +1 -1
  376. package/dist/src/ui/hooks/useKeypress.test.js +103 -114
  377. package/dist/src/ui/hooks/useKeypress.test.js.map +1 -1
  378. package/dist/src/ui/hooks/useLoadingIndicator.test.js +24 -6
  379. package/dist/src/ui/hooks/useLoadingIndicator.test.js.map +1 -1
  380. package/dist/src/ui/hooks/useMemoryMonitor.test.js +10 -5
  381. package/dist/src/ui/hooks/useMemoryMonitor.test.js.map +1 -1
  382. package/dist/src/ui/hooks/useMessageQueue.test.js +62 -45
  383. package/dist/src/ui/hooks/useMessageQueue.test.js.map +1 -1
  384. package/dist/src/ui/hooks/useModelCommand.test.js +21 -11
  385. package/dist/src/ui/hooks/useModelCommand.test.js.map +1 -1
  386. package/dist/src/ui/hooks/useMouse.d.ts +17 -0
  387. package/dist/src/ui/hooks/useMouse.js +27 -0
  388. package/dist/src/ui/hooks/useMouse.js.map +1 -0
  389. package/dist/src/ui/hooks/useMouse.test.d.ts +6 -0
  390. package/dist/src/ui/hooks/useMouse.test.js +57 -0
  391. package/dist/src/ui/hooks/useMouse.test.js.map +1 -0
  392. package/dist/src/ui/hooks/usePermissionsModifyTrust.test.js +2 -2
  393. package/dist/src/ui/hooks/usePermissionsModifyTrust.test.js.map +1 -1
  394. package/dist/src/ui/hooks/usePhraseCycler.js +1 -1
  395. package/dist/src/ui/hooks/usePhraseCycler.js.map +1 -1
  396. package/dist/src/ui/hooks/usePhraseCycler.test.js +109 -106
  397. package/dist/src/ui/hooks/usePhraseCycler.test.js.map +1 -1
  398. package/dist/src/ui/hooks/usePrivacySettings.test.js +26 -6
  399. package/dist/src/ui/hooks/usePrivacySettings.test.js.map +1 -1
  400. package/dist/src/ui/hooks/usePromptCompletion.js +2 -2
  401. package/dist/src/ui/hooks/usePromptCompletion.js.map +1 -1
  402. package/dist/src/ui/hooks/useQuotaAndFallback.js +13 -14
  403. package/dist/src/ui/hooks/useQuotaAndFallback.js.map +1 -1
  404. package/dist/src/ui/hooks/useQuotaAndFallback.test.js +55 -48
  405. package/dist/src/ui/hooks/useQuotaAndFallback.test.js.map +1 -1
  406. package/dist/src/ui/hooks/useReactToolScheduler.d.ts +8 -1
  407. package/dist/src/ui/hooks/useReactToolScheduler.js +59 -34
  408. package/dist/src/ui/hooks/useReactToolScheduler.js.map +1 -1
  409. package/dist/src/ui/hooks/useReactToolScheduler.test.d.ts +6 -0
  410. package/dist/src/ui/hooks/useReactToolScheduler.test.js +65 -0
  411. package/dist/src/ui/hooks/useReactToolScheduler.test.js.map +1 -0
  412. package/dist/src/ui/hooks/useReverseSearchCompletion.test.js +2 -2
  413. package/dist/src/ui/hooks/useReverseSearchCompletion.test.js.map +1 -1
  414. package/dist/src/ui/hooks/useSelectionList.js +5 -4
  415. package/dist/src/ui/hooks/useSelectionList.js.map +1 -1
  416. package/dist/src/ui/hooks/useSelectionList.test.js +272 -183
  417. package/dist/src/ui/hooks/useSelectionList.test.js.map +1 -1
  418. package/dist/src/ui/hooks/useShellHistory.test.js +52 -20
  419. package/dist/src/ui/hooks/useShellHistory.test.js.map +1 -1
  420. package/dist/src/ui/hooks/useSlashCompletion.js +18 -7
  421. package/dist/src/ui/hooks/useSlashCompletion.js.map +1 -1
  422. package/dist/src/ui/hooks/useSlashCompletion.test.js +275 -137
  423. package/dist/src/ui/hooks/useSlashCompletion.test.js.map +1 -1
  424. package/dist/src/ui/hooks/useTimer.test.js +43 -14
  425. package/dist/src/ui/hooks/useTimer.test.js.map +1 -1
  426. package/dist/src/ui/hooks/useToolScheduler.test.js +226 -242
  427. package/dist/src/ui/hooks/useToolScheduler.test.js.map +1 -1
  428. package/dist/src/ui/hooks/vim.test.js +235 -355
  429. package/dist/src/ui/hooks/vim.test.js.map +1 -1
  430. package/dist/src/ui/keyMatchers.test.js +30 -3
  431. package/dist/src/ui/keyMatchers.test.js.map +1 -1
  432. package/dist/src/ui/state/extensions.d.ts +1 -0
  433. package/dist/src/ui/state/extensions.js +1 -0
  434. package/dist/src/ui/state/extensions.js.map +1 -1
  435. package/dist/src/ui/themes/ansi-light.js +1 -0
  436. package/dist/src/ui/themes/ansi-light.js.map +1 -1
  437. package/dist/src/ui/themes/ansi.js +1 -0
  438. package/dist/src/ui/themes/ansi.js.map +1 -1
  439. package/dist/src/ui/themes/atom-one-dark.js +2 -0
  440. package/dist/src/ui/themes/atom-one-dark.js.map +1 -1
  441. package/dist/src/ui/themes/ayu-light.js +2 -0
  442. package/dist/src/ui/themes/ayu-light.js.map +1 -1
  443. package/dist/src/ui/themes/ayu.js +2 -0
  444. package/dist/src/ui/themes/ayu.js.map +1 -1
  445. package/dist/src/ui/themes/color-utils.d.ts +1 -0
  446. package/dist/src/ui/themes/color-utils.js +6 -0
  447. package/dist/src/ui/themes/color-utils.js.map +1 -1
  448. package/dist/src/ui/themes/color-utils.test.js +13 -1
  449. package/dist/src/ui/themes/color-utils.test.js.map +1 -1
  450. package/dist/src/ui/themes/dracula.js +2 -0
  451. package/dist/src/ui/themes/dracula.js.map +1 -1
  452. package/dist/src/ui/themes/github-dark.js +2 -0
  453. package/dist/src/ui/themes/github-dark.js.map +1 -1
  454. package/dist/src/ui/themes/github-light.js +2 -0
  455. package/dist/src/ui/themes/github-light.js.map +1 -1
  456. package/dist/src/ui/themes/googlecode.js +2 -0
  457. package/dist/src/ui/themes/googlecode.js.map +1 -1
  458. package/dist/src/ui/themes/no-color.js +3 -0
  459. package/dist/src/ui/themes/no-color.js.map +1 -1
  460. package/dist/src/ui/themes/semantic-tokens.d.ts +2 -0
  461. package/dist/src/ui/themes/semantic-tokens.js +6 -0
  462. package/dist/src/ui/themes/semantic-tokens.js.map +1 -1
  463. package/dist/src/ui/themes/shades-of-purple.js +2 -0
  464. package/dist/src/ui/themes/shades-of-purple.js.map +1 -1
  465. package/dist/src/ui/themes/theme.d.ts +3 -0
  466. package/dist/src/ui/themes/theme.js +14 -3
  467. package/dist/src/ui/themes/theme.js.map +1 -1
  468. package/dist/src/ui/themes/theme.test.js +67 -1
  469. package/dist/src/ui/themes/theme.test.js.map +1 -1
  470. package/dist/src/ui/themes/xcode.js +2 -0
  471. package/dist/src/ui/themes/xcode.js.map +1 -1
  472. package/dist/src/ui/types.d.ts +3 -1
  473. package/dist/src/ui/types.js +2 -0
  474. package/dist/src/ui/types.js.map +1 -1
  475. package/dist/src/ui/utils/CodeColorizer.js +2 -1
  476. package/dist/src/ui/utils/CodeColorizer.js.map +1 -1
  477. package/dist/src/ui/utils/InlineMarkdownRenderer.d.ts +1 -0
  478. package/dist/src/ui/utils/InlineMarkdownRenderer.js +11 -10
  479. package/dist/src/ui/utils/InlineMarkdownRenderer.js.map +1 -1
  480. package/dist/src/ui/utils/MarkdownDisplay.js +11 -9
  481. package/dist/src/ui/utils/MarkdownDisplay.js.map +1 -1
  482. package/dist/src/ui/utils/clipboardUtils.js +2 -2
  483. package/dist/src/ui/utils/clipboardUtils.js.map +1 -1
  484. package/dist/src/ui/utils/input.d.ts +17 -0
  485. package/dist/src/ui/utils/input.js +51 -0
  486. package/dist/src/ui/utils/input.js.map +1 -0
  487. package/dist/src/ui/utils/input.test.d.ts +6 -0
  488. package/dist/src/ui/utils/input.test.js +44 -0
  489. package/dist/src/ui/utils/input.test.js.map +1 -0
  490. package/dist/src/ui/utils/kittyProtocolDetector.js +13 -4
  491. package/dist/src/ui/utils/kittyProtocolDetector.js.map +1 -1
  492. package/dist/src/ui/utils/mouse.d.ts +31 -0
  493. package/dist/src/ui/utils/mouse.js +164 -0
  494. package/dist/src/ui/utils/mouse.js.map +1 -0
  495. package/dist/src/ui/utils/mouse.test.d.ts +6 -0
  496. package/dist/src/ui/utils/mouse.test.js +131 -0
  497. package/dist/src/ui/utils/mouse.test.js.map +1 -0
  498. package/dist/src/ui/utils/textOutput.d.ts +25 -0
  499. package/dist/src/ui/utils/textOutput.js +49 -0
  500. package/dist/src/ui/utils/textOutput.js.map +1 -0
  501. package/dist/src/ui/utils/textOutput.test.d.ts +6 -0
  502. package/dist/src/ui/utils/textOutput.test.js +79 -0
  503. package/dist/src/ui/utils/textOutput.test.js.map +1 -0
  504. package/dist/src/ui/utils/updateCheck.d.ts +7 -1
  505. package/dist/src/ui/utils/updateCheck.js +33 -29
  506. package/dist/src/ui/utils/updateCheck.js.map +1 -1
  507. package/dist/src/ui/utils/updateCheck.test.js +24 -50
  508. package/dist/src/ui/utils/updateCheck.test.js.map +1 -1
  509. package/dist/src/utils/commentJson.js +2 -2
  510. package/dist/src/utils/commentJson.js.map +1 -1
  511. package/dist/src/utils/commentJson.test.js +7 -6
  512. package/dist/src/utils/commentJson.test.js.map +1 -1
  513. package/dist/src/utils/envVarResolver.d.ts +2 -2
  514. package/dist/src/utils/envVarResolver.js +10 -7
  515. package/dist/src/utils/envVarResolver.js.map +1 -1
  516. package/dist/src/utils/events.d.ts +11 -2
  517. package/dist/src/utils/events.js +1 -0
  518. package/dist/src/utils/events.js.map +1 -1
  519. package/dist/src/utils/handleAutoUpdate.js +9 -3
  520. package/dist/src/utils/handleAutoUpdate.js.map +1 -1
  521. package/dist/src/utils/sandbox.js +16 -18
  522. package/dist/src/utils/sandbox.js.map +1 -1
  523. package/dist/src/utils/version.js +6 -2
  524. package/dist/src/utils/version.js.map +1 -1
  525. package/dist/src/zed-integration/acp.js +2 -1
  526. package/dist/src/zed-integration/acp.js.map +1 -1
  527. package/dist/src/zed-integration/schema.d.ts +4 -4
  528. package/dist/src/zed-integration/zedIntegration.d.ts +2 -2
  529. package/dist/src/zed-integration/zedIntegration.js +12 -19
  530. package/dist/src/zed-integration/zedIntegration.js.map +1 -1
  531. package/dist/tsconfig.tsbuildinfo +1 -1
  532. package/package.json +18 -14
  533. package/dist/src/config/policy.test.js +0 -360
  534. package/dist/src/config/policy.test.js.map +0 -1
  535. package/dist/src/utils/package.d.ts +0 -12
  536. package/dist/src/utils/package.js +0 -24
  537. package/dist/src/utils/package.js.map +0 -1
  538. /package/dist/src/{config/policy.test.d.ts → commands/extensions/validate.test.d.ts} +0 -0
@@ -3,8 +3,10 @@
3
3
  * Copyright 2025 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
- import { act, renderHook, waitFor } from '@testing-library/react';
7
- import { vi, describe, it, expect, beforeEach } from 'vitest';
6
+ import { vi, describe, it, expect, beforeEach, afterEach } from 'vitest';
7
+ import { act } from 'react';
8
+ import { renderHook } from '../../test-utils/render.js';
9
+ import { waitFor } from '../../test-utils/async.js';
8
10
  import { useSlashCommandProcessor } from './slashCommandProcessor.js';
9
11
  import { CommandKind } from '../commands/types.js';
10
12
  import { MessageType } from '../types.js';
@@ -21,6 +23,12 @@ vi.mock('@google/gemini-cli-core', async (importOriginal) => {
21
23
  ...original,
22
24
  logSlashCommand,
23
25
  getIdeInstaller: vi.fn().mockReturnValue(null),
26
+ IdeClient: {
27
+ getInstance: vi.fn().mockResolvedValue({
28
+ addStatusChangeListener: vi.fn(),
29
+ removeStatusChangeListener: vi.fn(),
30
+ }),
31
+ },
24
32
  };
25
33
  });
26
34
  const { mockProcessExit } = vi.hoisted(() => ({
@@ -82,6 +90,7 @@ describe('useSlashCommandProcessor', () => {
82
90
  const mockSetQuittingMessages = vi.fn();
83
91
  const mockConfig = makeFakeConfig({});
84
92
  const mockSettings = {};
93
+ let unmountHook;
85
94
  beforeEach(() => {
86
95
  vi.clearAllMocks();
87
96
  vi.mocked(BuiltinCommandLoader).mockClear();
@@ -89,41 +98,67 @@ describe('useSlashCommandProcessor', () => {
89
98
  mockFileLoadCommands.mockResolvedValue([]);
90
99
  mockMcpLoadCommands.mockResolvedValue([]);
91
100
  });
92
- const setupProcessorHook = (builtinCommands = [], fileCommands = [], mcpCommands = [], setIsProcessing = vi.fn()) => {
101
+ afterEach(async () => {
102
+ if (unmountHook) {
103
+ await unmountHook();
104
+ unmountHook = undefined;
105
+ }
106
+ });
107
+ const setupProcessorHook = async (builtinCommands = [], fileCommands = [], mcpCommands = [], setIsProcessing = vi.fn()) => {
93
108
  mockBuiltinLoadCommands.mockResolvedValue(Object.freeze(builtinCommands));
94
109
  mockFileLoadCommands.mockResolvedValue(Object.freeze(fileCommands));
95
110
  mockMcpLoadCommands.mockResolvedValue(Object.freeze(mcpCommands));
96
- const { result } = renderHook(() => useSlashCommandProcessor(mockConfig, mockSettings, mockAddItem, mockClearItems, mockLoadHistory, vi.fn(), // refreshStatic
97
- vi.fn(), // toggleVimEnabled
98
- setIsProcessing, vi.fn(), // setGeminiMdFileCount
99
- {
100
- openAuthDialog: mockOpenAuthDialog,
101
- openThemeDialog: mockOpenThemeDialog,
102
- openEditorDialog: vi.fn(),
103
- openPrivacyNotice: vi.fn(),
104
- openSettingsDialog: vi.fn(),
105
- openModelDialog: mockOpenModelDialog,
106
- openPermissionsDialog: vi.fn(),
107
- quit: mockSetQuittingMessages,
108
- setDebugMessage: vi.fn(),
109
- toggleCorgiMode: vi.fn(),
110
- toggleDebugProfiler: vi.fn(),
111
- dispatchExtensionStateUpdate: vi.fn(),
112
- addConfirmUpdateExtensionRequest: vi.fn(),
113
- }, new Map(), // extensionsUpdateState
114
- true));
115
- return result;
111
+ let result;
112
+ let unmount;
113
+ let rerender;
114
+ await act(async () => {
115
+ const hook = renderHook(() => useSlashCommandProcessor(mockConfig, mockSettings, mockAddItem, mockClearItems, mockLoadHistory, vi.fn(), // refreshStatic
116
+ vi.fn(), // toggleVimEnabled
117
+ setIsProcessing, vi.fn(), // setGeminiMdFileCount
118
+ {
119
+ openAuthDialog: mockOpenAuthDialog,
120
+ openThemeDialog: mockOpenThemeDialog,
121
+ openEditorDialog: vi.fn(),
122
+ openPrivacyNotice: vi.fn(),
123
+ openSettingsDialog: vi.fn(),
124
+ openModelDialog: mockOpenModelDialog,
125
+ openPermissionsDialog: vi.fn(),
126
+ quit: mockSetQuittingMessages,
127
+ setDebugMessage: vi.fn(),
128
+ toggleCorgiMode: vi.fn(),
129
+ toggleDebugProfiler: vi.fn(),
130
+ dispatchExtensionStateUpdate: vi.fn(),
131
+ addConfirmUpdateExtensionRequest: vi.fn(),
132
+ }, new Map(), // extensionsUpdateState
133
+ true));
134
+ result = hook.result;
135
+ unmount = hook.unmount;
136
+ rerender = hook.rerender;
137
+ });
138
+ unmountHook = async () => unmount();
139
+ await waitFor(() => {
140
+ expect(result.current.slashCommands).toBeDefined();
141
+ });
142
+ return {
143
+ get current() {
144
+ return result.current;
145
+ },
146
+ unmount,
147
+ rerender: async () => {
148
+ rerender();
149
+ },
150
+ };
116
151
  };
117
152
  describe('Initialization and Command Loading', () => {
118
- it('should initialize CommandService with all required loaders', () => {
119
- setupProcessorHook();
153
+ it('should initialize CommandService with all required loaders', async () => {
154
+ await setupProcessorHook();
120
155
  expect(BuiltinCommandLoader).toHaveBeenCalledWith(mockConfig);
121
156
  expect(FileCommandLoader).toHaveBeenCalledWith(mockConfig);
122
157
  expect(McpPromptLoader).toHaveBeenCalledWith(mockConfig);
123
158
  });
124
159
  it('should call loadCommands and populate state after mounting', async () => {
125
160
  const testCommand = createTestCommand({ name: 'test' });
126
- const result = setupProcessorHook([testCommand]);
161
+ const result = await setupProcessorHook([testCommand]);
127
162
  await waitFor(() => {
128
163
  expect(result.current.slashCommands).toHaveLength(1);
129
164
  });
@@ -134,7 +169,7 @@ describe('useSlashCommandProcessor', () => {
134
169
  });
135
170
  it('should provide an immutable array of commands to consumers', async () => {
136
171
  const testCommand = createTestCommand({ name: 'test' });
137
- const result = setupProcessorHook([testCommand]);
172
+ const result = await setupProcessorHook([testCommand]);
138
173
  await waitFor(() => {
139
174
  expect(result.current.slashCommands).toHaveLength(1);
140
175
  });
@@ -153,7 +188,7 @@ describe('useSlashCommandProcessor', () => {
153
188
  action: builtinAction,
154
189
  });
155
190
  const fileCommand = createTestCommand({ name: 'override', description: 'file', action: fileAction }, CommandKind.FILE);
156
- const result = setupProcessorHook([builtinCommand], [fileCommand]);
191
+ const result = await setupProcessorHook([builtinCommand], [fileCommand]);
157
192
  await waitFor(() => {
158
193
  // The service should only return one command with the name 'override'
159
194
  expect(result.current.slashCommands).toHaveLength(1);
@@ -168,7 +203,7 @@ describe('useSlashCommandProcessor', () => {
168
203
  });
169
204
  describe('Command Execution Logic', () => {
170
205
  it('should display an error for an unknown command', async () => {
171
- const result = setupProcessorHook();
206
+ const result = await setupProcessorHook();
172
207
  await waitFor(() => expect(result.current.slashCommands).toBeDefined());
173
208
  await act(async () => {
174
209
  await result.current.handleSlashCommand('/nonexistent');
@@ -193,7 +228,7 @@ describe('useSlashCommandProcessor', () => {
193
228
  },
194
229
  ],
195
230
  };
196
- const result = setupProcessorHook([parentCommand]);
231
+ const result = await setupProcessorHook([parentCommand]);
197
232
  await waitFor(() => expect(result.current.slashCommands).toHaveLength(1));
198
233
  await act(async () => {
199
234
  await result.current.handleSlashCommand('/parent');
@@ -219,7 +254,7 @@ describe('useSlashCommandProcessor', () => {
219
254
  },
220
255
  ],
221
256
  };
222
- const result = setupProcessorHook([parentCommand]);
257
+ const result = await setupProcessorHook([parentCommand]);
223
258
  await waitFor(() => expect(result.current.slashCommands).toHaveLength(1));
224
259
  await act(async () => {
225
260
  await result.current.handleSlashCommand('/parent child with args');
@@ -236,7 +271,7 @@ describe('useSlashCommandProcessor', () => {
236
271
  });
237
272
  it('sets isProcessing to false if the the input is not a command', async () => {
238
273
  const setMockIsProcessing = vi.fn();
239
- const result = setupProcessorHook([], [], [], setMockIsProcessing);
274
+ const result = await setupProcessorHook([], [], [], setMockIsProcessing);
240
275
  await act(async () => {
241
276
  await result.current.handleSlashCommand('imnotacommand');
242
277
  });
@@ -248,7 +283,7 @@ describe('useSlashCommandProcessor', () => {
248
283
  name: 'fail',
249
284
  action: vi.fn().mockRejectedValue(new Error('oh no!')),
250
285
  });
251
- const result = setupProcessorHook([failCommand], [], [], setMockIsProcessing);
286
+ const result = await setupProcessorHook([failCommand], [], [], setMockIsProcessing);
252
287
  await waitFor(() => expect(result.current.slashCommands).toBeDefined());
253
288
  await act(async () => {
254
289
  await result.current.handleSlashCommand('/fail');
@@ -262,7 +297,7 @@ describe('useSlashCommandProcessor', () => {
262
297
  name: 'long-running',
263
298
  action: () => new Promise((resolve) => setTimeout(resolve, 50)),
264
299
  });
265
- const result = setupProcessorHook([command], [], [], mockSetIsProcessing);
300
+ const result = await setupProcessorHook([command], [], [], mockSetIsProcessing);
266
301
  await waitFor(() => expect(result.current.slashCommands).toHaveLength(1));
267
302
  const executionPromise = act(async () => {
268
303
  await result.current.handleSlashCommand('/long-running');
@@ -278,29 +313,32 @@ describe('useSlashCommandProcessor', () => {
278
313
  });
279
314
  });
280
315
  describe('Action Result Handling', () => {
281
- it('should handle "dialog: theme" action', async () => {
282
- const command = createTestCommand({
283
- name: 'themecmd',
284
- action: vi.fn().mockResolvedValue({ type: 'dialog', dialog: 'theme' }),
285
- });
286
- const result = setupProcessorHook([command]);
287
- await waitFor(() => expect(result.current.slashCommands).toHaveLength(1));
288
- await act(async () => {
289
- await result.current.handleSlashCommand('/themecmd');
290
- });
291
- expect(mockOpenThemeDialog).toHaveBeenCalled();
292
- });
293
- it('should handle "dialog: model" action', async () => {
294
- const command = createTestCommand({
295
- name: 'modelcmd',
296
- action: vi.fn().mockResolvedValue({ type: 'dialog', dialog: 'model' }),
297
- });
298
- const result = setupProcessorHook([command]);
299
- await waitFor(() => expect(result.current.slashCommands).toHaveLength(1));
300
- await act(async () => {
301
- await result.current.handleSlashCommand('/modelcmd');
316
+ describe('Dialog actions', () => {
317
+ it.each([
318
+ {
319
+ dialogType: 'theme',
320
+ commandName: 'themecmd',
321
+ mockFn: mockOpenThemeDialog,
322
+ },
323
+ {
324
+ dialogType: 'model',
325
+ commandName: 'modelcmd',
326
+ mockFn: mockOpenModelDialog,
327
+ },
328
+ ])('should handle "dialog: $dialogType" action', async ({ dialogType, commandName, mockFn }) => {
329
+ const command = createTestCommand({
330
+ name: commandName,
331
+ action: vi
332
+ .fn()
333
+ .mockResolvedValue({ type: 'dialog', dialog: dialogType }),
334
+ });
335
+ const result = await setupProcessorHook([command]);
336
+ await waitFor(() => expect(result.current.slashCommands).toHaveLength(1));
337
+ await act(async () => {
338
+ await result.current.handleSlashCommand(`/${commandName}`);
339
+ });
340
+ expect(mockFn).toHaveBeenCalled();
302
341
  });
303
- expect(mockOpenModelDialog).toHaveBeenCalled();
304
342
  });
305
343
  it('should handle "load_history" action', async () => {
306
344
  const mockClient = {
@@ -316,7 +354,7 @@ describe('useSlashCommandProcessor', () => {
316
354
  clientHistory: [{ role: 'user', parts: [{ text: 'old prompt' }] }],
317
355
  }),
318
356
  });
319
- const result = setupProcessorHook([command]);
357
+ const result = await setupProcessorHook([command]);
320
358
  await waitFor(() => expect(result.current.slashCommands).toHaveLength(1));
321
359
  await act(async () => {
322
360
  await result.current.handleSlashCommand('/load');
@@ -344,7 +382,7 @@ describe('useSlashCommandProcessor', () => {
344
382
  clientHistory: historyWithThoughts,
345
383
  }),
346
384
  });
347
- const result = setupProcessorHook([command]);
385
+ const result = await setupProcessorHook([command]);
348
386
  await waitFor(() => expect(result.current.slashCommands).toHaveLength(1));
349
387
  await act(async () => {
350
388
  await result.current.handleSlashCommand('/loadwiththoughts');
@@ -360,7 +398,7 @@ describe('useSlashCommandProcessor', () => {
360
398
  name: 'exit',
361
399
  action: quitAction,
362
400
  });
363
- const result = setupProcessorHook([command]);
401
+ const result = await setupProcessorHook([command]);
364
402
  await waitFor(() => expect(result.current.slashCommands).toHaveLength(1));
365
403
  await act(async () => {
366
404
  await result.current.handleSlashCommand('/exit');
@@ -376,7 +414,7 @@ describe('useSlashCommandProcessor', () => {
376
414
  content: [{ text: 'The actual prompt from the TOML file.' }],
377
415
  }),
378
416
  }, CommandKind.FILE);
379
- const result = setupProcessorHook([], [fileCommand]);
417
+ const result = await setupProcessorHook([], [fileCommand]);
380
418
  await waitFor(() => expect(result.current.slashCommands).toHaveLength(1));
381
419
  let actionResult;
382
420
  await act(async () => {
@@ -397,7 +435,7 @@ describe('useSlashCommandProcessor', () => {
397
435
  content: [{ text: 'The actual prompt from the mcp command.' }],
398
436
  }),
399
437
  }, CommandKind.MCP_PROMPT);
400
- const result = setupProcessorHook([], [], [mcpCommand]);
438
+ const result = await setupProcessorHook([], [], [mcpCommand]);
401
439
  await waitFor(() => expect(result.current.slashCommands).toHaveLength(1));
402
440
  let actionResult;
403
441
  await act(async () => {
@@ -428,30 +466,33 @@ describe('useSlashCommandProcessor', () => {
428
466
  });
429
467
  });
430
468
  it('should set confirmation request when action returns confirm_shell_commands', async () => {
431
- const result = setupProcessorHook([shellCommand]);
469
+ const result = await setupProcessorHook([shellCommand]);
432
470
  await waitFor(() => expect(result.current.slashCommands).toHaveLength(1));
433
- // This is intentionally not awaited, because the promise it returns
434
- // will not resolve until the user responds to the confirmation.
435
- act(() => {
436
- result.current.handleSlashCommand('/shellcmd');
471
+ // Trigger command, don't await it yet as it suspends for confirmation
472
+ await act(async () => {
473
+ void result.current.handleSlashCommand('/shellcmd');
437
474
  });
438
475
  // We now wait for the state to be updated with the request.
439
- await waitFor(() => {
440
- expect(result.current.shellConfirmationRequest).not.toBeNull();
476
+ await act(async () => {
477
+ await waitFor(() => {
478
+ expect(result.current.shellConfirmationRequest).not.toBeNull();
479
+ });
441
480
  });
442
481
  expect(result.current.shellConfirmationRequest?.commands).toEqual([
443
482
  'rm -rf /',
444
483
  ]);
445
484
  });
446
485
  it('should do nothing if user cancels confirmation', async () => {
447
- const result = setupProcessorHook([shellCommand]);
486
+ const result = await setupProcessorHook([shellCommand]);
448
487
  await waitFor(() => expect(result.current.slashCommands).toHaveLength(1));
449
- act(() => {
450
- result.current.handleSlashCommand('/shellcmd');
488
+ await act(async () => {
489
+ void result.current.handleSlashCommand('/shellcmd');
451
490
  });
452
491
  // Wait for the confirmation dialog to be set
453
- await waitFor(() => {
454
- expect(result.current.shellConfirmationRequest).not.toBeNull();
492
+ await act(async () => {
493
+ await waitFor(() => {
494
+ expect(result.current.shellConfirmationRequest).not.toBeNull();
495
+ });
455
496
  });
456
497
  const onConfirm = result.current.shellConfirmationRequest?.onConfirm;
457
498
  expect(onConfirm).toBeDefined();
@@ -470,13 +511,16 @@ describe('useSlashCommandProcessor', () => {
470
511
  expect(mockCommandAction).toHaveBeenCalledTimes(1);
471
512
  });
472
513
  it('should re-run command with one-time allowlist on "Proceed Once"', async () => {
473
- const result = setupProcessorHook([shellCommand]);
514
+ const result = await setupProcessorHook([shellCommand]);
474
515
  await waitFor(() => expect(result.current.slashCommands).toHaveLength(1));
475
- act(() => {
476
- result.current.handleSlashCommand('/shellcmd');
516
+ let commandPromise;
517
+ await act(async () => {
518
+ commandPromise = result.current.handleSlashCommand('/shellcmd');
477
519
  });
478
- await waitFor(() => {
479
- expect(result.current.shellConfirmationRequest).not.toBeNull();
520
+ await act(async () => {
521
+ await waitFor(() => {
522
+ expect(result.current.shellConfirmationRequest).not.toBeNull();
523
+ });
480
524
  });
481
525
  const onConfirm = result.current.shellConfirmationRequest?.onConfirm;
482
526
  // **Change the mock's behavior for the SECOND run.**
@@ -489,6 +533,9 @@ describe('useSlashCommandProcessor', () => {
489
533
  await act(async () => {
490
534
  onConfirm(ToolConfirmationOutcome.ProceedOnce, ['rm -rf /']);
491
535
  });
536
+ await act(async () => {
537
+ await commandPromise;
538
+ });
492
539
  expect(result.current.shellConfirmationRequest).toBeNull();
493
540
  // The action should have been called twice (initial + re-run).
494
541
  await waitFor(() => {
@@ -503,19 +550,22 @@ describe('useSlashCommandProcessor', () => {
503
550
  // Verify the session-wide allowlist was NOT permanently updated.
504
551
  // Re-render the hook by calling a no-op command to get the latest context.
505
552
  await act(async () => {
506
- result.current.handleSlashCommand('/no-op');
553
+ await result.current.handleSlashCommand('/no-op');
507
554
  });
508
555
  const finalContext = result.current.commandContext;
509
556
  expect(finalContext.session.sessionShellAllowlist.size).toBe(0);
510
557
  });
511
558
  it('should re-run command and update session allowlist on "Proceed Always"', async () => {
512
- const result = setupProcessorHook([shellCommand]);
559
+ const result = await setupProcessorHook([shellCommand]);
513
560
  await waitFor(() => expect(result.current.slashCommands).toHaveLength(1));
514
- act(() => {
515
- result.current.handleSlashCommand('/shellcmd');
561
+ let commandPromise;
562
+ await act(async () => {
563
+ commandPromise = result.current.handleSlashCommand('/shellcmd');
516
564
  });
517
- await waitFor(() => {
518
- expect(result.current.shellConfirmationRequest).not.toBeNull();
565
+ await act(async () => {
566
+ await waitFor(() => {
567
+ expect(result.current.shellConfirmationRequest).not.toBeNull();
568
+ });
519
569
  });
520
570
  const onConfirm = result.current.shellConfirmationRequest?.onConfirm;
521
571
  mockCommandAction.mockResolvedValue({
@@ -526,6 +576,9 @@ describe('useSlashCommandProcessor', () => {
526
576
  await act(async () => {
527
577
  onConfirm(ToolConfirmationOutcome.ProceedAlways, ['rm -rf /']);
528
578
  });
579
+ await act(async () => {
580
+ await commandPromise;
581
+ });
529
582
  expect(result.current.shellConfirmationRequest).toBeNull();
530
583
  await waitFor(() => {
531
584
  expect(mockCommandAction).toHaveBeenCalledTimes(2);
@@ -541,7 +594,7 @@ describe('useSlashCommandProcessor', () => {
541
594
  describe('Command Parsing and Matching', () => {
542
595
  it('should be case-sensitive', async () => {
543
596
  const command = createTestCommand({ name: 'test' });
544
- const result = setupProcessorHook([command]);
597
+ const result = await setupProcessorHook([command]);
545
598
  await waitFor(() => expect(result.current.slashCommands).toHaveLength(1));
546
599
  await act(async () => {
547
600
  // Use uppercase when command is lowercase
@@ -561,7 +614,7 @@ describe('useSlashCommandProcessor', () => {
561
614
  description: 'a command with an alias',
562
615
  action,
563
616
  });
564
- const result = setupProcessorHook([command]);
617
+ const result = await setupProcessorHook([command]);
565
618
  await waitFor(() => expect(result.current.slashCommands).toHaveLength(1));
566
619
  await act(async () => {
567
620
  await result.current.handleSlashCommand('/alias');
@@ -572,7 +625,7 @@ describe('useSlashCommandProcessor', () => {
572
625
  it('should handle extra whitespace around the command', async () => {
573
626
  const action = vi.fn();
574
627
  const command = createTestCommand({ name: 'test', action });
575
- const result = setupProcessorHook([command]);
628
+ const result = await setupProcessorHook([command]);
576
629
  await waitFor(() => expect(result.current.slashCommands).toHaveLength(1));
577
630
  await act(async () => {
578
631
  await result.current.handleSlashCommand(' /test with-args ');
@@ -582,7 +635,7 @@ describe('useSlashCommandProcessor', () => {
582
635
  it('should handle `?` as a command prefix', async () => {
583
636
  const action = vi.fn();
584
637
  const command = createTestCommand({ name: 'help', action });
585
- const result = setupProcessorHook([command]);
638
+ const result = await setupProcessorHook([command]);
586
639
  await waitFor(() => expect(result.current.slashCommands).toHaveLength(1));
587
640
  await act(async () => {
588
641
  await result.current.handleSlashCommand('?help');
@@ -600,7 +653,7 @@ describe('useSlashCommandProcessor', () => {
600
653
  action: mcpAction,
601
654
  }, CommandKind.MCP_PROMPT);
602
655
  const fileCommand = createTestCommand({ name: 'override', description: 'file', action: fileAction }, CommandKind.FILE);
603
- const result = setupProcessorHook([], [fileCommand], [mcpCommand]);
656
+ const result = await setupProcessorHook([], [fileCommand], [mcpCommand]);
604
657
  await waitFor(() => {
605
658
  // The service should only return one command with the name 'override'
606
659
  expect(result.current.slashCommands).toHaveLength(1);
@@ -626,7 +679,7 @@ describe('useSlashCommandProcessor', () => {
626
679
  }, CommandKind.FILE);
627
680
  // The order of commands in the final loaded array is not guaranteed,
628
681
  // so the test must work regardless of which comes first.
629
- const result = setupProcessorHook([quitCommand], [exitCommand]);
682
+ const result = await setupProcessorHook([quitCommand], [exitCommand]);
630
683
  await waitFor(() => {
631
684
  expect(result.current.slashCommands).toHaveLength(2);
632
685
  });
@@ -645,7 +698,7 @@ describe('useSlashCommandProcessor', () => {
645
698
  action: vi.fn(),
646
699
  });
647
700
  const exitCommand = createTestCommand({ name: 'exit', action: vi.fn() }, CommandKind.FILE);
648
- const result = setupProcessorHook([quitCommand], [exitCommand]);
701
+ const result = await setupProcessorHook([quitCommand], [exitCommand]);
649
702
  await waitFor(() => expect(result.current.slashCommands).toHaveLength(2));
650
703
  await act(async () => {
651
704
  await result.current.handleSlashCommand('/exit');
@@ -655,28 +708,9 @@ describe('useSlashCommandProcessor', () => {
655
708
  });
656
709
  });
657
710
  describe('Lifecycle', () => {
658
- it('should abort command loading when the hook unmounts', () => {
711
+ it('should abort command loading when the hook unmounts', async () => {
659
712
  const abortSpy = vi.spyOn(AbortController.prototype, 'abort');
660
- const { unmount } = renderHook(() => useSlashCommandProcessor(mockConfig, mockSettings, mockAddItem, mockClearItems, mockLoadHistory, vi.fn(), // refreshStatic
661
- vi.fn().mockResolvedValue(false), // toggleVimEnabled
662
- vi.fn(), // setIsProcessing
663
- vi.fn(), // setGeminiMdFileCount
664
- {
665
- openAuthDialog: vi.fn(),
666
- openThemeDialog: vi.fn(),
667
- openEditorDialog: vi.fn(),
668
- openPrivacyNotice: vi.fn(),
669
- openSettingsDialog: vi.fn(),
670
- openModelDialog: vi.fn(),
671
- openPermissionsDialog: vi.fn(),
672
- quit: vi.fn(),
673
- setDebugMessage: vi.fn(),
674
- toggleCorgiMode: vi.fn(),
675
- toggleDebugProfiler: vi.fn(),
676
- dispatchExtensionStateUpdate: vi.fn(),
677
- addConfirmUpdateExtensionRequest: vi.fn(),
678
- }, new Map(), // extensionsUpdateState
679
- true));
713
+ const { unmount } = await setupProcessorHook();
680
714
  unmount();
681
715
  expect(abortSpy).toHaveBeenCalledTimes(1);
682
716
  });
@@ -713,64 +747,58 @@ describe('useSlashCommandProcessor', () => {
713
747
  mockCommandAction.mockClear();
714
748
  vi.mocked(logSlashCommand).mockClear();
715
749
  });
716
- it('should log a simple slash command', async () => {
717
- const result = setupProcessorHook(loggingTestCommands);
718
- await waitFor(() => expect(result.current.slashCommands?.length).toBeGreaterThan(0));
719
- await act(async () => {
720
- await result.current.handleSlashCommand('/logtest');
721
- });
722
- expect(logSlashCommand).toHaveBeenCalledWith(mockConfig, expect.objectContaining({
723
- command: 'logtest',
724
- subcommand: undefined,
725
- status: SlashCommandStatus.SUCCESS,
726
- }));
727
- });
728
- it('logs nothing for a bogus command', async () => {
729
- const result = setupProcessorHook(loggingTestCommands);
730
- await waitFor(() => expect(result.current.slashCommands?.length).toBeGreaterThan(0));
731
- await act(async () => {
732
- await result.current.handleSlashCommand('/bogusbogusbogus');
733
- });
734
- expect(logSlashCommand).not.toHaveBeenCalled();
735
- });
736
- it('logs a failure event for a failed command', async () => {
737
- const result = setupProcessorHook(loggingTestCommands);
738
- await waitFor(() => expect(result.current.slashCommands?.length).toBeGreaterThan(0));
739
- await act(async () => {
740
- await result.current.handleSlashCommand('/fail');
741
- });
742
- expect(logSlashCommand).toHaveBeenCalledWith(mockConfig, expect.objectContaining({
743
- command: 'fail',
744
- status: 'error',
745
- subcommand: undefined,
746
- }));
747
- });
748
- it('should log a slash command with a subcommand', async () => {
749
- const result = setupProcessorHook(loggingTestCommands);
750
- await waitFor(() => expect(result.current.slashCommands?.length).toBeGreaterThan(0));
750
+ it.each([
751
+ {
752
+ command: '/logtest',
753
+ expectedLog: {
754
+ command: 'logtest',
755
+ subcommand: undefined,
756
+ status: SlashCommandStatus.SUCCESS,
757
+ },
758
+ desc: 'simple slash command',
759
+ },
760
+ {
761
+ command: '/fail',
762
+ expectedLog: {
763
+ command: 'fail',
764
+ status: 'error',
765
+ subcommand: undefined,
766
+ },
767
+ desc: 'failure event for failed command',
768
+ },
769
+ {
770
+ command: '/logwithsub sub',
771
+ expectedLog: {
772
+ command: 'logwithsub',
773
+ subcommand: 'sub',
774
+ },
775
+ desc: 'slash command with subcommand',
776
+ },
777
+ {
778
+ command: '/la',
779
+ expectedLog: {
780
+ command: 'logalias',
781
+ },
782
+ desc: 'command path when alias is used',
783
+ },
784
+ ])('should log $desc', async ({ command, expectedLog }) => {
785
+ const result = await setupProcessorHook(loggingTestCommands);
786
+ await waitFor(() => expect(result.current.slashCommands).toBeDefined());
751
787
  await act(async () => {
752
- await result.current.handleSlashCommand('/logwithsub sub');
788
+ await result.current.handleSlashCommand(command);
753
789
  });
754
- expect(logSlashCommand).toHaveBeenCalledWith(mockConfig, expect.objectContaining({
755
- command: 'logwithsub',
756
- subcommand: 'sub',
757
- }));
758
- });
759
- it('should log the command path when an alias is used', async () => {
760
- const result = setupProcessorHook(loggingTestCommands);
761
- await waitFor(() => expect(result.current.slashCommands?.length).toBeGreaterThan(0));
762
- await act(async () => {
763
- await result.current.handleSlashCommand('/la');
790
+ await waitFor(() => {
791
+ expect(logSlashCommand).toHaveBeenCalledWith(mockConfig, expect.objectContaining(expectedLog));
764
792
  });
765
- expect(logSlashCommand).toHaveBeenCalledWith(mockConfig, expect.objectContaining({
766
- command: 'logalias',
767
- }));
768
793
  });
769
- it('should not log for unknown commands', async () => {
770
- const result = setupProcessorHook(loggingTestCommands);
771
- await waitFor(() => expect(result.current.slashCommands?.length).toBeGreaterThan(0));
794
+ it.each([
795
+ { command: '/bogusbogusbogus', desc: 'bogus command' },
796
+ { command: '/unknown', desc: 'unknown command' },
797
+ ])('should not log for $desc', async ({ command }) => {
798
+ const result = await setupProcessorHook(loggingTestCommands);
799
+ await waitFor(() => expect(result.current.slashCommands).toBeDefined());
772
800
  await act(async () => {
773
- await result.current.handleSlashCommand('/unknown');
801
+ await result.current.handleSlashCommand(command);
774
802
  });
775
803
  expect(logSlashCommand).not.toHaveBeenCalled();
776
804
  });