centaurus-cli 3.0.0 → 3.1.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 (552) hide show
  1. package/dist/ai/types.js +0 -1
  2. package/dist/ai/types.js.map +1 -1
  3. package/dist/cli-adapter.js +5047 -5037
  4. package/dist/cli-adapter.js.map +1 -1
  5. package/dist/commands/CommandParser.js +372 -315
  6. package/dist/commands/CommandParser.js.map +1 -1
  7. package/dist/config/build-config.js +11 -42
  8. package/dist/config/build-config.js.map +1 -1
  9. package/dist/config/defaultConfig.js +94 -82
  10. package/dist/config/defaultConfig.js.map +1 -1
  11. package/dist/config/manager.js +144 -160
  12. package/dist/config/manager.js.map +1 -1
  13. package/dist/config/mcp-config-manager.js +411 -364
  14. package/dist/config/mcp-config-manager.js.map +1 -1
  15. package/dist/config/models.js +118 -185
  16. package/dist/config/models.js.map +1 -1
  17. package/dist/config/slash-commands.js +186 -184
  18. package/dist/config/slash-commands.js.map +1 -1
  19. package/dist/config/types.js +33 -26
  20. package/dist/config/types.js.map +1 -1
  21. package/dist/context/command-detector.js +63 -67
  22. package/dist/context/command-detector.js.map +1 -1
  23. package/dist/context/context-manager.js +533 -518
  24. package/dist/context/context-manager.js.map +1 -1
  25. package/dist/context/handlers/docker-handler.js +518 -576
  26. package/dist/context/handlers/docker-handler.js.map +1 -1
  27. package/dist/context/handlers/ssh-handler.js +1050 -1109
  28. package/dist/context/handlers/ssh-handler.js.map +1 -1
  29. package/dist/context/handlers/wsl-handler.js +558 -630
  30. package/dist/context/handlers/wsl-handler.js.map +1 -1
  31. package/dist/context/index.js +42 -6
  32. package/dist/context/index.js.map +1 -1
  33. package/dist/context/subshell-handler.js +0 -4
  34. package/dist/context/subshell-handler.js.map +1 -1
  35. package/dist/context/types.js +20 -31
  36. package/dist/context/types.js.map +1 -1
  37. package/dist/hooks/useConnectivity.js +13 -10
  38. package/dist/hooks/useConnectivity.js.map +1 -1
  39. package/dist/hooks/useTerminalDimensions.js +67 -79
  40. package/dist/hooks/useTerminalDimensions.js.map +1 -1
  41. package/dist/index.js +228 -251
  42. package/dist/index.js.map +1 -1
  43. package/dist/mcp/mcp-command-handler.js +297 -260
  44. package/dist/mcp/mcp-command-handler.js.map +1 -1
  45. package/dist/mcp/mcp-server-manager.js +139 -155
  46. package/dist/mcp/mcp-server-manager.js.map +1 -1
  47. package/dist/mcp/mcp-tool-wrapper.js +74 -94
  48. package/dist/mcp/mcp-tool-wrapper.js.map +1 -1
  49. package/dist/services/ai-autocomplete-agent.js +169 -181
  50. package/dist/services/ai-autocomplete-agent.js.map +1 -1
  51. package/dist/services/ai-context-injector.js +180 -93
  52. package/dist/services/ai-context-injector.js.map +1 -1
  53. package/dist/services/ai-service-client.js +513 -456
  54. package/dist/services/ai-service-client.js.map +1 -1
  55. package/dist/services/api-client.js +443 -441
  56. package/dist/services/api-client.js.map +1 -1
  57. package/dist/services/auth-handler.js +162 -198
  58. package/dist/services/auth-handler.js.map +1 -1
  59. package/dist/services/background-task-manager.js +258 -282
  60. package/dist/services/background-task-manager.js.map +1 -1
  61. package/dist/services/checkpoint-manager.js +1513 -973
  62. package/dist/services/checkpoint-manager.js.map +1 -1
  63. package/dist/services/clipboard-service.js +151 -200
  64. package/dist/services/clipboard-service.js.map +1 -1
  65. package/dist/services/connectivity-manager.js +63 -65
  66. package/dist/services/connectivity-manager.js.map +1 -1
  67. package/dist/services/conversation-manager.js +118 -121
  68. package/dist/services/conversation-manager.js.map +1 -1
  69. package/dist/services/environment-context-injector.js +160 -187
  70. package/dist/services/environment-context-injector.js.map +1 -1
  71. package/dist/services/fast-context-agent.js +203 -243
  72. package/dist/services/fast-context-agent.js.map +1 -1
  73. package/dist/services/input-detection-agent.js +190 -202
  74. package/dist/services/input-detection-agent.js.map +1 -1
  75. package/dist/services/input-requirement-detector.js +155 -189
  76. package/dist/services/input-requirement-detector.js.map +1 -1
  77. package/dist/services/local-chat-storage.js +342 -365
  78. package/dist/services/local-chat-storage.js.map +1 -1
  79. package/dist/services/monitored-shell-manager.js +225 -233
  80. package/dist/services/monitored-shell-manager.js.map +1 -1
  81. package/dist/services/ollama-service.js +293 -310
  82. package/dist/services/ollama-service.js.map +1 -1
  83. package/dist/services/rules-storage.js +142 -0
  84. package/dist/services/rules-storage.js.map +1 -0
  85. package/dist/services/session-quota-manager.js +219 -235
  86. package/dist/services/session-quota-manager.js.map +1 -1
  87. package/dist/services/shell-input-agent.js +299 -334
  88. package/dist/services/shell-input-agent.js.map +1 -1
  89. package/dist/services/sub-agent-manager.js +459 -501
  90. package/dist/services/sub-agent-manager.js.map +1 -1
  91. package/dist/services/warpify-detector.js +133 -183
  92. package/dist/services/warpify-detector.js.map +1 -1
  93. package/dist/services/workflow-storage.js +202 -217
  94. package/dist/services/workflow-storage.js.map +1 -1
  95. package/dist/test-ssh-handler.js +148 -193
  96. package/dist/test-ssh-handler.js.map +1 -1
  97. package/dist/tools/add-mcp.js +161 -0
  98. package/dist/tools/add-mcp.js.map +1 -0
  99. package/dist/tools/background-command.js +240 -273
  100. package/dist/tools/background-command.js.map +1 -1
  101. package/dist/tools/command.js +447 -440
  102. package/dist/tools/command.js.map +1 -1
  103. package/dist/tools/create-image.js +172 -202
  104. package/dist/tools/create-image.js.map +1 -1
  105. package/dist/tools/enter-remote-session.js +169 -215
  106. package/dist/tools/enter-remote-session.js.map +1 -1
  107. package/dist/tools/fast-context.js +60 -67
  108. package/dist/tools/fast-context.js.map +1 -1
  109. package/dist/tools/file-ops.js +605 -537
  110. package/dist/tools/file-ops.js.map +1 -1
  111. package/dist/tools/find-files.js +262 -303
  112. package/dist/tools/find-files.js.map +1 -1
  113. package/dist/tools/get-diff.js +423 -400
  114. package/dist/tools/get-diff.js.map +1 -1
  115. package/dist/tools/grep-search.js +966 -948
  116. package/dist/tools/grep-search.js.map +1 -1
  117. package/dist/tools/inspect-symbol.js +308 -323
  118. package/dist/tools/inspect-symbol.js.map +1 -1
  119. package/dist/tools/plan-mode.js +459 -503
  120. package/dist/tools/plan-mode.js.map +1 -1
  121. package/dist/tools/read-binary-file.js +160 -190
  122. package/dist/tools/read-binary-file.js.map +1 -1
  123. package/dist/tools/registry.js +100 -84
  124. package/dist/tools/registry.js.map +1 -1
  125. package/dist/tools/reproduce_issue.js +170 -151
  126. package/dist/tools/reproduce_issue.js.map +1 -1
  127. package/dist/tools/sub-agent.js +223 -228
  128. package/dist/tools/sub-agent.js.map +1 -1
  129. package/dist/tools/task-complete.js +28 -27
  130. package/dist/tools/task-complete.js.map +1 -1
  131. package/dist/tools/types.js +0 -1
  132. package/dist/tools/types.js.map +1 -1
  133. package/dist/tools/validation.js +96 -118
  134. package/dist/tools/validation.js.map +1 -1
  135. package/dist/tools/web-search.js +194 -194
  136. package/dist/tools/web-search.js.map +1 -1
  137. package/dist/tools/workflow-tool.js +77 -82
  138. package/dist/tools/workflow-tool.js.map +1 -1
  139. package/dist/types/index.js +0 -1
  140. package/dist/types/index.js.map +1 -1
  141. package/dist/types/rule.js +1 -0
  142. package/dist/types/rule.js.map +1 -0
  143. package/dist/types/workflow.js +0 -7
  144. package/dist/types/workflow.js.map +1 -1
  145. package/dist/ui/components/AgentTimer.js +24 -25
  146. package/dist/ui/components/AgentTimer.js.map +1 -1
  147. package/dist/ui/components/App.js +3266 -3249
  148. package/dist/ui/components/App.js.map +1 -1
  149. package/dist/ui/components/AuthScreen.js +22 -34
  150. package/dist/ui/components/AuthScreen.js.map +1 -1
  151. package/dist/ui/components/AuthWelcomeScreen.js +30 -24
  152. package/dist/ui/components/AuthWelcomeScreen.js.map +1 -1
  153. package/dist/ui/components/Breadcrumbs.js +53 -82
  154. package/dist/ui/components/Breadcrumbs.js.map +1 -1
  155. package/dist/ui/components/CircularSelectInput.js +59 -67
  156. package/dist/ui/components/CircularSelectInput.js.map +1 -1
  157. package/dist/ui/components/ClipboardFileAutocomplete.js +78 -39
  158. package/dist/ui/components/ClipboardFileAutocomplete.js.map +1 -1
  159. package/dist/ui/components/CodeBlock.js +24 -42
  160. package/dist/ui/components/CodeBlock.js.map +1 -1
  161. package/dist/ui/components/ConfigViewer.js +18 -25
  162. package/dist/ui/components/ConfigViewer.js.map +1 -1
  163. package/dist/ui/components/ConfirmPrompt.js +49 -71
  164. package/dist/ui/components/ConfirmPrompt.js.map +1 -1
  165. package/dist/ui/components/ConnectionStatusMessage.js +32 -83
  166. package/dist/ui/components/ConnectionStatusMessage.js.map +1 -1
  167. package/dist/ui/components/ContextWindowIndicator.js +34 -49
  168. package/dist/ui/components/ContextWindowIndicator.js.map +1 -1
  169. package/dist/ui/components/DetailedPlanReviewScreen.js +104 -106
  170. package/dist/ui/components/DetailedPlanReviewScreen.js.map +1 -1
  171. package/dist/ui/components/DiffViewer.js +68 -121
  172. package/dist/ui/components/DiffViewer.js.map +1 -1
  173. package/dist/ui/components/ErrorBoundary.js +40 -48
  174. package/dist/ui/components/ErrorBoundary.js.map +1 -1
  175. package/dist/ui/components/FileCreationPreview.js +29 -60
  176. package/dist/ui/components/FileCreationPreview.js.map +1 -1
  177. package/dist/ui/components/FileOperation.js +34 -29
  178. package/dist/ui/components/FileOperation.js.map +1 -1
  179. package/dist/ui/components/FileTagAutocomplete.js +55 -25
  180. package/dist/ui/components/FileTagAutocomplete.js.map +1 -1
  181. package/dist/ui/components/FontRecommendation.js.map +1 -1
  182. package/dist/ui/components/GitDiffBreadcrumb.js +29 -0
  183. package/dist/ui/components/GitDiffBreadcrumb.js.map +1 -0
  184. package/dist/ui/components/InputBox.js +1620 -2150
  185. package/dist/ui/components/InputBox.js.map +1 -1
  186. package/dist/ui/components/InteractiveShell.js +234 -352
  187. package/dist/ui/components/InteractiveShell.js.map +1 -1
  188. package/dist/ui/components/KeyboardHelp.js +34 -35
  189. package/dist/ui/components/KeyboardHelp.js.map +1 -1
  190. package/dist/ui/components/LoadingIndicator.js +22 -25
  191. package/dist/ui/components/LoadingIndicator.js.map +1 -1
  192. package/dist/ui/components/MCPAddScreen.js +40 -51
  193. package/dist/ui/components/MCPAddScreen.js.map +1 -1
  194. package/dist/ui/components/MCPListScreen.js +40 -48
  195. package/dist/ui/components/MCPListScreen.js.map +1 -1
  196. package/dist/ui/components/MCPServerListScreen.js +49 -56
  197. package/dist/ui/components/MCPServerListScreen.js.map +1 -1
  198. package/dist/ui/components/MarkdownRenderer.js +69 -96
  199. package/dist/ui/components/MarkdownRenderer.js.map +1 -1
  200. package/dist/ui/components/MessageBox.js +66 -48
  201. package/dist/ui/components/MessageBox.js.map +1 -1
  202. package/dist/ui/components/MessageDisplay.js +150 -142
  203. package/dist/ui/components/MessageDisplay.js.map +1 -1
  204. package/dist/ui/components/MonitorModeAIPanel.js +46 -65
  205. package/dist/ui/components/MonitorModeAIPanel.js.map +1 -1
  206. package/dist/ui/components/MultiLineInput.js +243 -277
  207. package/dist/ui/components/MultiLineInput.js.map +1 -1
  208. package/dist/ui/components/PasswordPrompt.js +37 -18
  209. package/dist/ui/components/PasswordPrompt.js.map +1 -1
  210. package/dist/ui/components/PlanAcceptedMessage.js +27 -38
  211. package/dist/ui/components/PlanAcceptedMessage.js.map +1 -1
  212. package/dist/ui/components/PlanReviewScreen.js +46 -50
  213. package/dist/ui/components/PlanReviewScreen.js.map +1 -1
  214. package/dist/ui/components/RulesEditorScreen.js +81 -0
  215. package/dist/ui/components/RulesEditorScreen.js.map +1 -0
  216. package/dist/ui/components/SelectPrompt.js +19 -8
  217. package/dist/ui/components/SelectPrompt.js.map +1 -1
  218. package/dist/ui/components/ShimmerText.js +44 -0
  219. package/dist/ui/components/ShimmerText.js.map +1 -0
  220. package/dist/ui/components/SlashCommandAutocomplete.js +49 -22
  221. package/dist/ui/components/SlashCommandAutocomplete.js.map +1 -1
  222. package/dist/ui/components/StatusBar.js +56 -87
  223. package/dist/ui/components/StatusBar.js.map +1 -1
  224. package/dist/ui/components/StreamingMessageDisplay.js +116 -99
  225. package/dist/ui/components/StreamingMessageDisplay.js.map +1 -1
  226. package/dist/ui/components/TaskCompletedMessage.js +28 -23
  227. package/dist/ui/components/TaskCompletedMessage.js.map +1 -1
  228. package/dist/ui/components/TaskProgressIndicator.js +44 -70
  229. package/dist/ui/components/TaskProgressIndicator.js.map +1 -1
  230. package/dist/ui/components/ThinkingDisplay.js +44 -41
  231. package/dist/ui/components/ThinkingDisplay.js.map +1 -1
  232. package/dist/ui/components/ToolExecutionMessage.js +772 -1326
  233. package/dist/ui/components/ToolExecutionMessage.js.map +1 -1
  234. package/dist/ui/components/ToolExecutionStatus.js +53 -84
  235. package/dist/ui/components/ToolExecutionStatus.js.map +1 -1
  236. package/dist/ui/components/ToolResult.js +22 -15
  237. package/dist/ui/components/ToolResult.js.map +1 -1
  238. package/dist/ui/components/VersionUpdatePrompt.js +88 -120
  239. package/dist/ui/components/VersionUpdatePrompt.js.map +1 -1
  240. package/dist/ui/components/WelcomeBanner.js +176 -26
  241. package/dist/ui/components/WelcomeBanner.js.map +1 -1
  242. package/dist/ui/components/WorkflowCreatorScreen.js +94 -161
  243. package/dist/ui/components/WorkflowCreatorScreen.js.map +1 -1
  244. package/dist/utils/ansi-encoder.js +30 -61
  245. package/dist/utils/ansi-encoder.js.map +1 -1
  246. package/dist/utils/chat-formatter.js +327 -305
  247. package/dist/utils/chat-formatter.js.map +1 -1
  248. package/dist/utils/command-history.js +152 -174
  249. package/dist/utils/command-history.js.map +1 -1
  250. package/dist/utils/context-sanitizer.js +49 -112
  251. package/dist/utils/context-sanitizer.js.map +1 -1
  252. package/dist/utils/conversation-logger.js +292 -324
  253. package/dist/utils/conversation-logger.js.map +1 -1
  254. package/dist/utils/custom-commands-manager.js +126 -131
  255. package/dist/utils/custom-commands-manager.js.map +1 -1
  256. package/dist/utils/editor-utils.js +732 -837
  257. package/dist/utils/editor-utils.js.map +1 -1
  258. package/dist/utils/file.js +174 -213
  259. package/dist/utils/file.js.map +1 -1
  260. package/dist/utils/git-stats.js +169 -0
  261. package/dist/utils/git-stats.js.map +1 -0
  262. package/dist/utils/input-classifier.js +960 -482
  263. package/dist/utils/input-classifier.js.map +1 -1
  264. package/dist/utils/logger.js +48 -73
  265. package/dist/utils/logger.js.map +1 -1
  266. package/dist/utils/markdown-parser.js +277 -310
  267. package/dist/utils/markdown-parser.js.map +1 -1
  268. package/dist/utils/rule-reference-resolver.js +54 -0
  269. package/dist/utils/rule-reference-resolver.js.map +1 -0
  270. package/dist/utils/shell.js +144 -156
  271. package/dist/utils/shell.js.map +1 -1
  272. package/dist/utils/state.js +23 -22
  273. package/dist/utils/state.js.map +1 -1
  274. package/dist/utils/syntax-checker.js +279 -327
  275. package/dist/utils/syntax-checker.js.map +1 -1
  276. package/dist/utils/terminal-output.js +199 -302
  277. package/dist/utils/terminal-output.js.map +1 -1
  278. package/dist/utils/text-clipboard.js +47 -70
  279. package/dist/utils/text-clipboard.js.map +1 -1
  280. package/dist/utils/unicode-sanitizer.js +134 -197
  281. package/dist/utils/unicode-sanitizer.js.map +1 -1
  282. package/dist/utils/version-checker.js +46 -56
  283. package/dist/utils/version-checker.js.map +1 -1
  284. package/package.json +6 -4
  285. package/dist/ai/types.d.ts +0 -20
  286. package/dist/ai/types.d.ts.map +0 -1
  287. package/dist/cli-adapter.d.ts +0 -511
  288. package/dist/cli-adapter.d.ts.map +0 -1
  289. package/dist/commands/CommandParser.d.ts +0 -27
  290. package/dist/commands/CommandParser.d.ts.map +0 -1
  291. package/dist/config/build-config.d.ts +0 -42
  292. package/dist/config/build-config.d.ts.map +0 -1
  293. package/dist/config/defaultConfig.d.ts +0 -79
  294. package/dist/config/defaultConfig.d.ts.map +0 -1
  295. package/dist/config/manager.d.ts +0 -62
  296. package/dist/config/manager.d.ts.map +0 -1
  297. package/dist/config/mcp-config-manager.d.ts +0 -79
  298. package/dist/config/mcp-config-manager.d.ts.map +0 -1
  299. package/dist/config/models.d.ts +0 -83
  300. package/dist/config/models.d.ts.map +0 -1
  301. package/dist/config/slash-commands.d.ts +0 -23
  302. package/dist/config/slash-commands.d.ts.map +0 -1
  303. package/dist/config/types.d.ts +0 -35
  304. package/dist/config/types.d.ts.map +0 -1
  305. package/dist/context/command-detector.d.ts +0 -50
  306. package/dist/context/command-detector.d.ts.map +0 -1
  307. package/dist/context/context-manager.d.ts +0 -157
  308. package/dist/context/context-manager.d.ts.map +0 -1
  309. package/dist/context/handlers/docker-handler.d.ts +0 -130
  310. package/dist/context/handlers/docker-handler.d.ts.map +0 -1
  311. package/dist/context/handlers/ssh-handler.d.ts +0 -201
  312. package/dist/context/handlers/ssh-handler.d.ts.map +0 -1
  313. package/dist/context/handlers/wsl-handler.d.ts +0 -146
  314. package/dist/context/handlers/wsl-handler.d.ts.map +0 -1
  315. package/dist/context/index.d.ts +0 -8
  316. package/dist/context/index.d.ts.map +0 -1
  317. package/dist/context/subshell-handler.d.ts +0 -165
  318. package/dist/context/subshell-handler.d.ts.map +0 -1
  319. package/dist/context/types.d.ts +0 -70
  320. package/dist/context/types.d.ts.map +0 -1
  321. package/dist/hooks/useConnectivity.d.ts +0 -2
  322. package/dist/hooks/useConnectivity.d.ts.map +0 -1
  323. package/dist/hooks/useTerminalDimensions.d.ts +0 -41
  324. package/dist/hooks/useTerminalDimensions.d.ts.map +0 -1
  325. package/dist/index.d.ts +0 -9
  326. package/dist/index.d.ts.map +0 -1
  327. package/dist/mcp/mcp-command-handler.d.ts +0 -47
  328. package/dist/mcp/mcp-command-handler.d.ts.map +0 -1
  329. package/dist/mcp/mcp-server-manager.d.ts +0 -30
  330. package/dist/mcp/mcp-server-manager.d.ts.map +0 -1
  331. package/dist/mcp/mcp-tool-wrapper.d.ts +0 -12
  332. package/dist/mcp/mcp-tool-wrapper.d.ts.map +0 -1
  333. package/dist/services/ai-autocomplete-agent.d.ts +0 -39
  334. package/dist/services/ai-autocomplete-agent.d.ts.map +0 -1
  335. package/dist/services/ai-context-injector.d.ts +0 -41
  336. package/dist/services/ai-context-injector.d.ts.map +0 -1
  337. package/dist/services/ai-service-client.d.ts +0 -128
  338. package/dist/services/ai-service-client.d.ts.map +0 -1
  339. package/dist/services/api-client.d.ts +0 -353
  340. package/dist/services/api-client.d.ts.map +0 -1
  341. package/dist/services/auth-handler.d.ts +0 -30
  342. package/dist/services/auth-handler.d.ts.map +0 -1
  343. package/dist/services/background-task-manager.d.ts +0 -114
  344. package/dist/services/background-task-manager.d.ts.map +0 -1
  345. package/dist/services/checkpoint-manager.d.ts +0 -167
  346. package/dist/services/checkpoint-manager.d.ts.map +0 -1
  347. package/dist/services/clipboard-service.d.ts +0 -37
  348. package/dist/services/clipboard-service.d.ts.map +0 -1
  349. package/dist/services/connectivity-manager.d.ts +0 -18
  350. package/dist/services/connectivity-manager.d.ts.map +0 -1
  351. package/dist/services/conversation-manager.d.ts +0 -73
  352. package/dist/services/conversation-manager.d.ts.map +0 -1
  353. package/dist/services/environment-context-injector.d.ts +0 -69
  354. package/dist/services/environment-context-injector.d.ts.map +0 -1
  355. package/dist/services/fast-context-agent.d.ts +0 -12
  356. package/dist/services/fast-context-agent.d.ts.map +0 -1
  357. package/dist/services/input-detection-agent.d.ts +0 -40
  358. package/dist/services/input-detection-agent.d.ts.map +0 -1
  359. package/dist/services/input-requirement-detector.d.ts +0 -28
  360. package/dist/services/input-requirement-detector.d.ts.map +0 -1
  361. package/dist/services/local-chat-storage.d.ts +0 -182
  362. package/dist/services/local-chat-storage.d.ts.map +0 -1
  363. package/dist/services/monitored-shell-manager.d.ts +0 -120
  364. package/dist/services/monitored-shell-manager.d.ts.map +0 -1
  365. package/dist/services/ollama-service.d.ts +0 -197
  366. package/dist/services/ollama-service.d.ts.map +0 -1
  367. package/dist/services/session-quota-manager.d.ts +0 -101
  368. package/dist/services/session-quota-manager.d.ts.map +0 -1
  369. package/dist/services/shell-input-agent.d.ts +0 -89
  370. package/dist/services/shell-input-agent.d.ts.map +0 -1
  371. package/dist/services/sub-agent-manager.d.ts +0 -140
  372. package/dist/services/sub-agent-manager.d.ts.map +0 -1
  373. package/dist/services/warpify-detector.d.ts +0 -43
  374. package/dist/services/warpify-detector.d.ts.map +0 -1
  375. package/dist/services/workflow-storage.d.ts +0 -72
  376. package/dist/services/workflow-storage.d.ts.map +0 -1
  377. package/dist/test-ssh-handler.d.ts +0 -8
  378. package/dist/test-ssh-handler.d.ts.map +0 -1
  379. package/dist/tools/background-command.d.ts +0 -11
  380. package/dist/tools/background-command.d.ts.map +0 -1
  381. package/dist/tools/command.d.ts +0 -3
  382. package/dist/tools/command.d.ts.map +0 -1
  383. package/dist/tools/create-image.d.ts +0 -10
  384. package/dist/tools/create-image.d.ts.map +0 -1
  385. package/dist/tools/enter-remote-session.d.ts +0 -48
  386. package/dist/tools/enter-remote-session.d.ts.map +0 -1
  387. package/dist/tools/fast-context.d.ts +0 -3
  388. package/dist/tools/fast-context.d.ts.map +0 -1
  389. package/dist/tools/file-ops.d.ts +0 -7
  390. package/dist/tools/file-ops.d.ts.map +0 -1
  391. package/dist/tools/find-files.d.ts +0 -49
  392. package/dist/tools/find-files.d.ts.map +0 -1
  393. package/dist/tools/get-diff.d.ts +0 -14
  394. package/dist/tools/get-diff.d.ts.map +0 -1
  395. package/dist/tools/grep-search.d.ts +0 -155
  396. package/dist/tools/grep-search.d.ts.map +0 -1
  397. package/dist/tools/inspect-symbol.d.ts +0 -32
  398. package/dist/tools/inspect-symbol.d.ts.map +0 -1
  399. package/dist/tools/plan-mode.d.ts +0 -140
  400. package/dist/tools/plan-mode.d.ts.map +0 -1
  401. package/dist/tools/read-binary-file.d.ts +0 -10
  402. package/dist/tools/read-binary-file.d.ts.map +0 -1
  403. package/dist/tools/registry.d.ts +0 -31
  404. package/dist/tools/registry.d.ts.map +0 -1
  405. package/dist/tools/reproduce_issue.d.ts +0 -2
  406. package/dist/tools/reproduce_issue.d.ts.map +0 -1
  407. package/dist/tools/sub-agent.d.ts +0 -9
  408. package/dist/tools/sub-agent.d.ts.map +0 -1
  409. package/dist/tools/task-complete.d.ts +0 -3
  410. package/dist/tools/task-complete.d.ts.map +0 -1
  411. package/dist/tools/types.d.ts +0 -40
  412. package/dist/tools/types.d.ts.map +0 -1
  413. package/dist/tools/validation.d.ts +0 -47
  414. package/dist/tools/validation.d.ts.map +0 -1
  415. package/dist/tools/web-search.d.ts +0 -24
  416. package/dist/tools/web-search.d.ts.map +0 -1
  417. package/dist/tools/workflow-tool.d.ts +0 -11
  418. package/dist/tools/workflow-tool.d.ts.map +0 -1
  419. package/dist/types/index.d.ts +0 -123
  420. package/dist/types/index.d.ts.map +0 -1
  421. package/dist/types/workflow.d.ts +0 -110
  422. package/dist/types/workflow.d.ts.map +0 -1
  423. package/dist/ui/components/AgentTimer.d.ts +0 -7
  424. package/dist/ui/components/AgentTimer.d.ts.map +0 -1
  425. package/dist/ui/components/App.d.ts +0 -197
  426. package/dist/ui/components/App.d.ts.map +0 -1
  427. package/dist/ui/components/AuthScreen.d.ts +0 -8
  428. package/dist/ui/components/AuthScreen.d.ts.map +0 -1
  429. package/dist/ui/components/AuthWelcomeScreen.d.ts +0 -8
  430. package/dist/ui/components/AuthWelcomeScreen.d.ts.map +0 -1
  431. package/dist/ui/components/Breadcrumbs.d.ts +0 -13
  432. package/dist/ui/components/Breadcrumbs.d.ts.map +0 -1
  433. package/dist/ui/components/CircularSelectInput.d.ts +0 -24
  434. package/dist/ui/components/CircularSelectInput.d.ts.map +0 -1
  435. package/dist/ui/components/ClipboardFileAutocomplete.d.ts +0 -10
  436. package/dist/ui/components/ClipboardFileAutocomplete.d.ts.map +0 -1
  437. package/dist/ui/components/CodeBlock.d.ts +0 -9
  438. package/dist/ui/components/CodeBlock.d.ts.map +0 -1
  439. package/dist/ui/components/ConfigViewer.d.ts +0 -11
  440. package/dist/ui/components/ConfigViewer.d.ts.map +0 -1
  441. package/dist/ui/components/ConfirmPrompt.d.ts +0 -13
  442. package/dist/ui/components/ConfirmPrompt.d.ts.map +0 -1
  443. package/dist/ui/components/ConnectionStatusMessage.d.ts +0 -17
  444. package/dist/ui/components/ConnectionStatusMessage.d.ts.map +0 -1
  445. package/dist/ui/components/ContextWindowIndicator.d.ts +0 -8
  446. package/dist/ui/components/ContextWindowIndicator.d.ts.map +0 -1
  447. package/dist/ui/components/DetailedPlanReviewScreen.d.ts +0 -17
  448. package/dist/ui/components/DetailedPlanReviewScreen.d.ts.map +0 -1
  449. package/dist/ui/components/DiffViewer.d.ts +0 -9
  450. package/dist/ui/components/DiffViewer.d.ts.map +0 -1
  451. package/dist/ui/components/ErrorBoundary.d.ts +0 -17
  452. package/dist/ui/components/ErrorBoundary.d.ts.map +0 -1
  453. package/dist/ui/components/FileCreationPreview.d.ts +0 -8
  454. package/dist/ui/components/FileCreationPreview.d.ts.map +0 -1
  455. package/dist/ui/components/FileOperation.d.ts +0 -10
  456. package/dist/ui/components/FileOperation.d.ts.map +0 -1
  457. package/dist/ui/components/FileTagAutocomplete.d.ts +0 -11
  458. package/dist/ui/components/FileTagAutocomplete.d.ts.map +0 -1
  459. package/dist/ui/components/FontRecommendation.d.ts +0 -1
  460. package/dist/ui/components/FontRecommendation.d.ts.map +0 -1
  461. package/dist/ui/components/InputBox.d.ts +0 -42
  462. package/dist/ui/components/InputBox.d.ts.map +0 -1
  463. package/dist/ui/components/InteractiveShell.d.ts +0 -30
  464. package/dist/ui/components/InteractiveShell.d.ts.map +0 -1
  465. package/dist/ui/components/KeyboardHelp.d.ts +0 -7
  466. package/dist/ui/components/KeyboardHelp.d.ts.map +0 -1
  467. package/dist/ui/components/LoadingIndicator.d.ts +0 -3
  468. package/dist/ui/components/LoadingIndicator.d.ts.map +0 -1
  469. package/dist/ui/components/MCPAddScreen.d.ts +0 -13
  470. package/dist/ui/components/MCPAddScreen.d.ts.map +0 -1
  471. package/dist/ui/components/MCPListScreen.d.ts +0 -17
  472. package/dist/ui/components/MCPListScreen.d.ts.map +0 -1
  473. package/dist/ui/components/MCPServerListScreen.d.ts +0 -16
  474. package/dist/ui/components/MCPServerListScreen.d.ts.map +0 -1
  475. package/dist/ui/components/MarkdownRenderer.d.ts +0 -8
  476. package/dist/ui/components/MarkdownRenderer.d.ts.map +0 -1
  477. package/dist/ui/components/MessageBox.d.ts +0 -10
  478. package/dist/ui/components/MessageBox.d.ts.map +0 -1
  479. package/dist/ui/components/MessageDisplay.d.ts +0 -14
  480. package/dist/ui/components/MessageDisplay.d.ts.map +0 -1
  481. package/dist/ui/components/MonitorModeAIPanel.d.ts +0 -23
  482. package/dist/ui/components/MonitorModeAIPanel.d.ts.map +0 -1
  483. package/dist/ui/components/MultiLineInput.d.ts +0 -13
  484. package/dist/ui/components/MultiLineInput.d.ts.map +0 -1
  485. package/dist/ui/components/PasswordPrompt.d.ts +0 -9
  486. package/dist/ui/components/PasswordPrompt.d.ts.map +0 -1
  487. package/dist/ui/components/PlanAcceptedMessage.d.ts +0 -20
  488. package/dist/ui/components/PlanAcceptedMessage.d.ts.map +0 -1
  489. package/dist/ui/components/PlanReviewScreen.d.ts +0 -14
  490. package/dist/ui/components/PlanReviewScreen.d.ts.map +0 -1
  491. package/dist/ui/components/SelectPrompt.d.ts +0 -12
  492. package/dist/ui/components/SelectPrompt.d.ts.map +0 -1
  493. package/dist/ui/components/SlashCommandAutocomplete.d.ts +0 -13
  494. package/dist/ui/components/SlashCommandAutocomplete.d.ts.map +0 -1
  495. package/dist/ui/components/StatusBar.d.ts +0 -14
  496. package/dist/ui/components/StatusBar.d.ts.map +0 -1
  497. package/dist/ui/components/StreamingMessageDisplay.d.ts +0 -15
  498. package/dist/ui/components/StreamingMessageDisplay.d.ts.map +0 -1
  499. package/dist/ui/components/TaskCompletedMessage.d.ts +0 -14
  500. package/dist/ui/components/TaskCompletedMessage.d.ts.map +0 -1
  501. package/dist/ui/components/TaskProgressIndicator.d.ts +0 -18
  502. package/dist/ui/components/TaskProgressIndicator.d.ts.map +0 -1
  503. package/dist/ui/components/ThinkingDisplay.d.ts +0 -15
  504. package/dist/ui/components/ThinkingDisplay.d.ts.map +0 -1
  505. package/dist/ui/components/ToolExecutionMessage.d.ts +0 -8
  506. package/dist/ui/components/ToolExecutionMessage.d.ts.map +0 -1
  507. package/dist/ui/components/ToolExecutionStatus.d.ts +0 -10
  508. package/dist/ui/components/ToolExecutionStatus.d.ts.map +0 -1
  509. package/dist/ui/components/ToolResult.d.ts +0 -10
  510. package/dist/ui/components/ToolResult.d.ts.map +0 -1
  511. package/dist/ui/components/VersionUpdatePrompt.d.ts +0 -9
  512. package/dist/ui/components/VersionUpdatePrompt.d.ts.map +0 -1
  513. package/dist/ui/components/WelcomeBanner.d.ts +0 -3
  514. package/dist/ui/components/WelcomeBanner.d.ts.map +0 -1
  515. package/dist/ui/components/WorkflowCreatorScreen.d.ts +0 -25
  516. package/dist/ui/components/WorkflowCreatorScreen.d.ts.map +0 -1
  517. package/dist/utils/ansi-encoder.d.ts +0 -7
  518. package/dist/utils/ansi-encoder.d.ts.map +0 -1
  519. package/dist/utils/chat-formatter.d.ts +0 -12
  520. package/dist/utils/chat-formatter.d.ts.map +0 -1
  521. package/dist/utils/command-history.d.ts +0 -24
  522. package/dist/utils/command-history.d.ts.map +0 -1
  523. package/dist/utils/context-sanitizer.d.ts +0 -50
  524. package/dist/utils/context-sanitizer.d.ts.map +0 -1
  525. package/dist/utils/conversation-logger.d.ts +0 -142
  526. package/dist/utils/conversation-logger.d.ts.map +0 -1
  527. package/dist/utils/custom-commands-manager.d.ts +0 -59
  528. package/dist/utils/custom-commands-manager.d.ts.map +0 -1
  529. package/dist/utils/editor-utils.d.ts +0 -101
  530. package/dist/utils/editor-utils.d.ts.map +0 -1
  531. package/dist/utils/file.d.ts +0 -61
  532. package/dist/utils/file.d.ts.map +0 -1
  533. package/dist/utils/input-classifier.d.ts +0 -25
  534. package/dist/utils/input-classifier.d.ts.map +0 -1
  535. package/dist/utils/logger.d.ts +0 -17
  536. package/dist/utils/logger.d.ts.map +0 -1
  537. package/dist/utils/markdown-parser.d.ts +0 -60
  538. package/dist/utils/markdown-parser.d.ts.map +0 -1
  539. package/dist/utils/shell.d.ts +0 -47
  540. package/dist/utils/shell.d.ts.map +0 -1
  541. package/dist/utils/state.d.ts +0 -13
  542. package/dist/utils/state.d.ts.map +0 -1
  543. package/dist/utils/syntax-checker.d.ts +0 -24
  544. package/dist/utils/syntax-checker.d.ts.map +0 -1
  545. package/dist/utils/terminal-output.d.ts +0 -25
  546. package/dist/utils/terminal-output.d.ts.map +0 -1
  547. package/dist/utils/text-clipboard.d.ts +0 -12
  548. package/dist/utils/text-clipboard.d.ts.map +0 -1
  549. package/dist/utils/unicode-sanitizer.d.ts +0 -44
  550. package/dist/utils/unicode-sanitizer.d.ts.map +0 -1
  551. package/dist/utils/version-checker.d.ts +0 -14
  552. package/dist/utils/version-checker.d.ts.map +0 -1
@@ -1,511 +1,989 @@
1
- /**
2
- * Input Classification Utilities
3
- *
4
- * Provides intelligent heuristic-based detection of user intent (Terminal Command vs AI Message).
5
- * Uses sentence structure analysis, command syntax detection, and context-aware disambiguation.
6
- */
7
- import { CustomCommandsManager } from './custom-commands-manager.js';
8
- // Valid slash commands that should be handled by the Agent/CLI logic
9
- const SLASH_COMMANDS = new Set([
10
- 'help', 'h', '?',
11
- 'model', 'm', 'models',
12
- 'config', 'c', 'settings',
13
- 'clear', 'cls', 'reset',
14
- 'sync',
15
- 'clean-ui', 'refresh-ui', 'redraw',
16
- 'exit', 'quit', 'q',
17
- 'session', 's',
18
- 'session-limits',
19
- 'tools', 't',
20
- 'plan',
21
- 'init', 'i',
22
- 'mcp',
23
- 'chat',
24
- 'docs',
25
- 'sign-in',
26
- 'logout',
27
- 'quality',
28
- 'autonomous',
29
- 'add-command', 'add-command-auto-detect',
30
- 'background-task', 'bkg', 'bg-task',
31
- 'copy-chat-context',
32
- 'workflow', 'wf',
33
- 'revert'
1
+ import { CustomCommandsManager } from "./custom-commands-manager.js";
2
+ const SLASH_COMMANDS = /* @__PURE__ */ new Set([
3
+ "help",
4
+ "h",
5
+ "?",
6
+ "model",
7
+ "m",
8
+ "models",
9
+ "config",
10
+ "c",
11
+ "settings",
12
+ "clear",
13
+ "cls",
14
+ "reset",
15
+ "sync",
16
+ "clean-ui",
17
+ "refresh-ui",
18
+ "redraw",
19
+ "exit",
20
+ "quit",
21
+ "q",
22
+ "session",
23
+ "s",
24
+ "session-limits",
25
+ "tools",
26
+ "t",
27
+ "plan",
28
+ "init",
29
+ "i",
30
+ "mcp",
31
+ "chat",
32
+ "docs",
33
+ "sign-in",
34
+ "logout",
35
+ "quality",
36
+ "autonomous",
37
+ "add-command",
38
+ "add-command-auto-detect",
39
+ "background-task",
40
+ "bkg",
41
+ "bg-task",
42
+ "copy-chat-context",
43
+ "workflow",
44
+ "wf",
45
+ "rules",
46
+ "revert"
34
47
  ]);
35
- // Commands that are definitely terminal commands (not ambiguous with natural language)
36
- const DEFINITE_COMMANDS = new Set([
37
- // Package Managers
38
- 'npm', 'yarn', 'pnpm', 'bun', 'npx', 'gem', 'pip', 'pip3', 'conda', 'cargo', 'composer', 'mvn', 'gradle',
39
- // Package managers (extended)
40
- 'apt', 'apt-get', 'apt-cache', 'dpkg', 'yum', 'dnf', 'rpm', 'zypper', 'pacman', 'emerge',
41
- 'port', 'brew', 'choco', 'scoop', 'winget', 'snap', 'flatpak', 'nix', 'nix-env', 'apk',
42
- // Version Control
43
- 'git', 'svn', 'hg', 'gh', 'gitk', 'tig',
44
- // File Operations (non-ambiguous)
45
- 'ls', 'cd', 'pwd', 'mkdir', 'rm', 'cp', 'mv', 'cat', 'less', 'more', 'chmod', 'chown', 'chgrp', 'ln',
46
- 'stat', 'file', 'realpath', 'basename', 'dirname', 'readlink', 'dd', 'truncate', 'shred', 'sync',
47
- 'mktemp', 'install', 'xargs', 'tee', 'touch',
48
- // Editors
49
- 'vim', 'nvim', 'vi', 'nano', 'emacs', 'micro', 'helix', 'hx', 'pico', 'joe', 'ne', 'mcedit', 'code',
50
- 'subl', 'atom', 'gedit', 'kate', 'notepad', 'notepad++',
51
- // System / Process
52
- 'ps', 'kill', 'killall', 'htop', 'btop', 'free', 'df', 'du', 'whoami', 'su', 'sudo',
53
- 'nice', 'renice', 'nohup', 'timeout', 'strace', 'ltrace', 'pgrep', 'pkill', 'fuser', 'pstree',
54
- // Network
55
- 'curl', 'wget', 'ssh', 'scp', 'ping', 'telnet', 'nc', 'netstat', 'lsof', 'dig', 'nslookup', 'ip', 'ifconfig', 'traceroute',
56
- 'arp', 'route', 'ss', 'tcpdump', 'nmap', 'iptables', 'ip6tables', 'firewall-cmd', 'ufw',
57
- 'socat', 'rsync', 'ftp', 'sftp', 'sshfs', 'rclone', 'mtr', 'host', 'whois',
58
- // Build / Run (non-ambiguous)
59
- 'cmake', 'docker', 'docker-compose', 'kubectl', 'python', 'python3', 'ruby', 'perl', 'php', 'java', 'gcc', 'g++', 'clang',
60
- 'javac', 'dotnet', 'mono', 'swift', 'swiftc', 'kotlinc', 'scalac', 'elixir', 'mix', 'iex',
61
- // Shell / Subshells
62
- 'echo', 'env', 'cal', 'printenv',
63
- 'wsl', 'bash', 'sh', 'zsh', 'fish', 'powershell', 'pwsh', 'cmd',
64
- 'ksh', 'csh', 'tcsh', 'ash', 'dash',
65
- // Shell built-ins (critical additions)
66
- 'exit', 'logout', 'return', 'break', 'continue',
67
- 'alias', 'unalias', 'builtin', 'command',
68
- 'exec', 'eval', 'declare', 'local', 'readonly',
69
- 'enable', 'disable', 'ulimit', 'umask', 'trap',
70
- 'jobs', 'fg', 'bg', 'disown', 'suspend', 'times',
71
- 'pushd', 'popd', 'dirs', 'cd', 'pwd',
72
- 'fc', 'bind', 'complete', 'compgen', 'compopt', 'shopt',
73
- 'history', 'clear', 'reset', 'tput', 'stty',
74
- // Session/User management
75
- 'login', 'newgrp', 'groups', 'id', 'users', 'finger', 'w', 'who', 'last', 'lastlog',
76
- 'useradd', 'userdel', 'usermod', 'passwd', 'chpasswd',
77
- 'groupadd', 'groupdel', 'groupmod', 'adduser', 'deluser',
78
- // Archives
79
- 'tar', 'zip', 'unzip', 'gzip', 'gunzip', '7z', 'rar', 'bzip2', 'bunzip2', 'xz', 'unxz', 'zstd',
80
- // Search (non-ambiguous)
81
- 'grep', 'egrep', 'fgrep', 'locate', 'sed', 'awk', 'gawk', 'ack', 'ag', 'rg', 'fd', 'fzf',
82
- // Text processing
83
- 'tr', 'wc', 'nl', 'uniq', 'rev', 'tac', 'hexdump', 'xxd', 'od', 'strings',
84
- 'expand', 'unexpand', 'column', 'colrm', 'csplit', 'pr', 'tsort', 'comm',
85
- // Misc
86
- 'jq', 'yq', 'crontab', 'visudo', 'vipw', 'sudoedit', 'at', 'batch',
87
- // Cloud / DevOps
88
- 'aws', 'az', 'gcloud', 'terraform', 'ansible', 'ansible-playbook', 'kubectl', 'helm', 'vagrant',
89
- 'pulumi', 'cdk', 'sam', 'serverless', 'flyctl', 'heroku', 'vercel', 'netlify',
90
- // Database
91
- 'mysql', 'psql', 'mongo', 'mongod', 'mongosh', 'redis-cli', 'sqlite3', 'pg_dump', 'mysqldump',
92
- // Web / Security
93
- 'openssl', 'certbot', 'nginx', 'apache2', 'httpd', 'gpg', 'ssh-keygen', 'ssh-agent', 'ssh-add',
94
- // Language runtimes (non-ambiguous)
95
- 'node', 'deno', 'ts-node', 'tsx', 'esbuild', 'webpack', 'vite', 'rollup', 'parcel',
96
- 'jest', 'vitest', 'mocha', 'pytest', 'phpunit', 'rspec',
97
- // Go
98
- 'go', 'gofmt', 'golint', 'gopls',
99
- // Rust
100
- 'rustc', 'rustup', 'rustfmt', 'clippy',
101
- // System info
102
- 'uname', 'hostname', 'uptime', 'arch', 'nproc', 'lscpu', 'lsblk', 'lsusb', 'lspci',
103
- 'dmidecode', 'dmesg', 'sysctl', 'modprobe', 'lsmod', 'insmod', 'rmmod',
104
- // Services/Daemons
105
- 'systemctl', 'service', 'journalctl', 'loginctl', 'chkconfig', 'update-rc.d', 'launchctl',
106
- // Disk/Storage
107
- 'mount', 'umount', 'fdisk', 'parted', 'mkfs', 'fsck', 'blkid', 'findmnt', 'quota', 'hdparm',
108
- // Windows-specific commands
109
- 'dir', 'copy', 'move', 'del', 'ren', 'rename', 'attrib', 'cls', 'md', 'rd', 'rmdir',
110
- 'xcopy', 'robocopy', 'icacls', 'cacls', 'takeown',
111
- 'tasklist', 'taskkill', 'systeminfo', 'ipconfig', 'netsh', 'pathping',
112
- 'reg', 'regedit', 'schtasks', 'wmic', 'where', 'findstr', 'fc', 'comp',
113
- 'chkdsk', 'sfc', 'dism', 'bcdedit', 'diskpart', 'format', 'label', 'vol',
114
- 'net', 'netstat', 'nbtstat', 'klist', 'gpresult', 'gpupdate', 'shutdown', 'logoff',
115
- // PowerShell aliases that look like commands
116
- 'gci', 'gc', 'sl', 'gi', 'gm', 'gwmi', 'iwr', 'irm',
117
- // Date/Time
118
- 'timedatectl', 'hwclock', 'ntpdate', 'chronyc',
119
- // Containers/Virtualization
120
- 'podman', 'crictl', 'ctr', 'nerdctl', 'lxc', 'lxd', 'virsh', 'vboxmanage', 'multipass', 'lima',
121
- // Kubernetes ecosystem
122
- 'k9s', 'kubectx', 'kubens', 'kustomize', 'skaffold', 'minikube', 'kind', 'k3s', 'k3d',
123
- // Misc utilities
124
- 'xdg-open', 'open', 'wslpath', 'cygpath', 'explorer', 'start',
125
- 'yes', 'seq', 'factor', 'bc', 'dc', 'expr',
126
- 'sleep', 'usleep', 'watch',
127
- // Common CLI tools
128
- 'ffmpeg', 'ffprobe', 'convert', 'identify', 'magick', 'pandoc', 'latex', 'pdflatex', 'bibtex',
129
- 'youtube-dl', 'yt-dlp', 'aria2c', 'axel',
48
+ const DEFINITE_COMMANDS = /* @__PURE__ */ new Set([
49
+ // Package Managers
50
+ "npm",
51
+ "yarn",
52
+ "pnpm",
53
+ "bun",
54
+ "npx",
55
+ "gem",
56
+ "pip",
57
+ "pip3",
58
+ "conda",
59
+ "cargo",
60
+ "composer",
61
+ "mvn",
62
+ "gradle",
63
+ // Package managers (extended)
64
+ "apt",
65
+ "apt-get",
66
+ "apt-cache",
67
+ "dpkg",
68
+ "yum",
69
+ "dnf",
70
+ "rpm",
71
+ "zypper",
72
+ "pacman",
73
+ "emerge",
74
+ "port",
75
+ "brew",
76
+ "choco",
77
+ "scoop",
78
+ "winget",
79
+ "snap",
80
+ "flatpak",
81
+ "nix",
82
+ "nix-env",
83
+ "apk",
84
+ // Version Control
85
+ "git",
86
+ "svn",
87
+ "hg",
88
+ "gh",
89
+ "gitk",
90
+ "tig",
91
+ // File Operations (non-ambiguous)
92
+ "ls",
93
+ "cd",
94
+ "pwd",
95
+ "mkdir",
96
+ "rm",
97
+ "cp",
98
+ "mv",
99
+ "cat",
100
+ "less",
101
+ "more",
102
+ "chmod",
103
+ "chown",
104
+ "chgrp",
105
+ "ln",
106
+ "stat",
107
+ "file",
108
+ "realpath",
109
+ "basename",
110
+ "dirname",
111
+ "readlink",
112
+ "dd",
113
+ "truncate",
114
+ "shred",
115
+ "sync",
116
+ "mktemp",
117
+ "install",
118
+ "xargs",
119
+ "tee",
120
+ "touch",
121
+ // Editors
122
+ "vim",
123
+ "nvim",
124
+ "vi",
125
+ "nano",
126
+ "emacs",
127
+ "micro",
128
+ "helix",
129
+ "hx",
130
+ "pico",
131
+ "joe",
132
+ "ne",
133
+ "mcedit",
134
+ "code",
135
+ "subl",
136
+ "atom",
137
+ "gedit",
138
+ "kate",
139
+ "notepad",
140
+ "notepad++",
141
+ // System / Process
142
+ "ps",
143
+ "kill",
144
+ "killall",
145
+ "htop",
146
+ "btop",
147
+ "free",
148
+ "df",
149
+ "du",
150
+ "whoami",
151
+ "su",
152
+ "sudo",
153
+ "nice",
154
+ "renice",
155
+ "nohup",
156
+ "timeout",
157
+ "strace",
158
+ "ltrace",
159
+ "pgrep",
160
+ "pkill",
161
+ "fuser",
162
+ "pstree",
163
+ // Network
164
+ "curl",
165
+ "wget",
166
+ "ssh",
167
+ "scp",
168
+ "ping",
169
+ "telnet",
170
+ "nc",
171
+ "netstat",
172
+ "lsof",
173
+ "dig",
174
+ "nslookup",
175
+ "ip",
176
+ "ifconfig",
177
+ "traceroute",
178
+ "arp",
179
+ "route",
180
+ "ss",
181
+ "tcpdump",
182
+ "nmap",
183
+ "iptables",
184
+ "ip6tables",
185
+ "firewall-cmd",
186
+ "ufw",
187
+ "socat",
188
+ "rsync",
189
+ "ftp",
190
+ "sftp",
191
+ "sshfs",
192
+ "rclone",
193
+ "mtr",
194
+ "host",
195
+ "whois",
196
+ // Build / Run (non-ambiguous)
197
+ "cmake",
198
+ "docker",
199
+ "docker-compose",
200
+ "kubectl",
201
+ "python",
202
+ "python3",
203
+ "ruby",
204
+ "perl",
205
+ "php",
206
+ "java",
207
+ "gcc",
208
+ "g++",
209
+ "clang",
210
+ "javac",
211
+ "dotnet",
212
+ "mono",
213
+ "swift",
214
+ "swiftc",
215
+ "kotlinc",
216
+ "scalac",
217
+ "elixir",
218
+ "mix",
219
+ "iex",
220
+ // Shell / Subshells
221
+ "echo",
222
+ "env",
223
+ "cal",
224
+ "printenv",
225
+ "wsl",
226
+ "bash",
227
+ "sh",
228
+ "zsh",
229
+ "fish",
230
+ "powershell",
231
+ "pwsh",
232
+ "cmd",
233
+ "ksh",
234
+ "csh",
235
+ "tcsh",
236
+ "ash",
237
+ "dash",
238
+ // Shell built-ins (critical additions)
239
+ "exit",
240
+ "logout",
241
+ "return",
242
+ "break",
243
+ "continue",
244
+ "alias",
245
+ "unalias",
246
+ "builtin",
247
+ "command",
248
+ "exec",
249
+ "eval",
250
+ "declare",
251
+ "local",
252
+ "readonly",
253
+ "enable",
254
+ "disable",
255
+ "ulimit",
256
+ "umask",
257
+ "trap",
258
+ "jobs",
259
+ "fg",
260
+ "bg",
261
+ "disown",
262
+ "suspend",
263
+ "times",
264
+ "pushd",
265
+ "popd",
266
+ "dirs",
267
+ "cd",
268
+ "pwd",
269
+ "fc",
270
+ "bind",
271
+ "complete",
272
+ "compgen",
273
+ "compopt",
274
+ "shopt",
275
+ "history",
276
+ "clear",
277
+ "reset",
278
+ "tput",
279
+ "stty",
280
+ // Session/User management
281
+ "login",
282
+ "newgrp",
283
+ "groups",
284
+ "id",
285
+ "users",
286
+ "finger",
287
+ "w",
288
+ "who",
289
+ "last",
290
+ "lastlog",
291
+ "useradd",
292
+ "userdel",
293
+ "usermod",
294
+ "passwd",
295
+ "chpasswd",
296
+ "groupadd",
297
+ "groupdel",
298
+ "groupmod",
299
+ "adduser",
300
+ "deluser",
301
+ // Archives
302
+ "tar",
303
+ "zip",
304
+ "unzip",
305
+ "gzip",
306
+ "gunzip",
307
+ "7z",
308
+ "rar",
309
+ "bzip2",
310
+ "bunzip2",
311
+ "xz",
312
+ "unxz",
313
+ "zstd",
314
+ // Search (non-ambiguous)
315
+ "grep",
316
+ "egrep",
317
+ "fgrep",
318
+ "locate",
319
+ "sed",
320
+ "awk",
321
+ "gawk",
322
+ "ack",
323
+ "ag",
324
+ "rg",
325
+ "fd",
326
+ "fzf",
327
+ // Text processing
328
+ "tr",
329
+ "wc",
330
+ "nl",
331
+ "uniq",
332
+ "rev",
333
+ "tac",
334
+ "hexdump",
335
+ "xxd",
336
+ "od",
337
+ "strings",
338
+ "expand",
339
+ "unexpand",
340
+ "column",
341
+ "colrm",
342
+ "csplit",
343
+ "pr",
344
+ "tsort",
345
+ "comm",
346
+ // Misc
347
+ "jq",
348
+ "yq",
349
+ "crontab",
350
+ "visudo",
351
+ "vipw",
352
+ "sudoedit",
353
+ "at",
354
+ "batch",
355
+ // Cloud / DevOps
356
+ "aws",
357
+ "az",
358
+ "gcloud",
359
+ "terraform",
360
+ "ansible",
361
+ "ansible-playbook",
362
+ "kubectl",
363
+ "helm",
364
+ "vagrant",
365
+ "pulumi",
366
+ "cdk",
367
+ "sam",
368
+ "serverless",
369
+ "flyctl",
370
+ "heroku",
371
+ "vercel",
372
+ "netlify",
373
+ // Database
374
+ "mysql",
375
+ "psql",
376
+ "mongo",
377
+ "mongod",
378
+ "mongosh",
379
+ "redis-cli",
380
+ "sqlite3",
381
+ "pg_dump",
382
+ "mysqldump",
383
+ // Web / Security
384
+ "openssl",
385
+ "certbot",
386
+ "nginx",
387
+ "apache2",
388
+ "httpd",
389
+ "gpg",
390
+ "ssh-keygen",
391
+ "ssh-agent",
392
+ "ssh-add",
393
+ // Language runtimes (non-ambiguous)
394
+ "node",
395
+ "deno",
396
+ "ts-node",
397
+ "tsx",
398
+ "esbuild",
399
+ "webpack",
400
+ "vite",
401
+ "rollup",
402
+ "parcel",
403
+ "jest",
404
+ "vitest",
405
+ "mocha",
406
+ "pytest",
407
+ "phpunit",
408
+ "rspec",
409
+ // Go
410
+ "go",
411
+ "gofmt",
412
+ "golint",
413
+ "gopls",
414
+ // Rust
415
+ "rustc",
416
+ "rustup",
417
+ "rustfmt",
418
+ "clippy",
419
+ // System info
420
+ "uname",
421
+ "hostname",
422
+ "uptime",
423
+ "arch",
424
+ "nproc",
425
+ "lscpu",
426
+ "lsblk",
427
+ "lsusb",
428
+ "lspci",
429
+ "dmidecode",
430
+ "dmesg",
431
+ "sysctl",
432
+ "modprobe",
433
+ "lsmod",
434
+ "insmod",
435
+ "rmmod",
436
+ // Services/Daemons
437
+ "systemctl",
438
+ "service",
439
+ "journalctl",
440
+ "loginctl",
441
+ "chkconfig",
442
+ "update-rc.d",
443
+ "launchctl",
444
+ // Disk/Storage
445
+ "mount",
446
+ "umount",
447
+ "fdisk",
448
+ "parted",
449
+ "mkfs",
450
+ "fsck",
451
+ "blkid",
452
+ "findmnt",
453
+ "quota",
454
+ "hdparm",
455
+ // Windows-specific commands
456
+ "dir",
457
+ "copy",
458
+ "move",
459
+ "del",
460
+ "ren",
461
+ "rename",
462
+ "attrib",
463
+ "cls",
464
+ "md",
465
+ "rd",
466
+ "rmdir",
467
+ "xcopy",
468
+ "robocopy",
469
+ "icacls",
470
+ "cacls",
471
+ "takeown",
472
+ "tasklist",
473
+ "taskkill",
474
+ "systeminfo",
475
+ "ipconfig",
476
+ "netsh",
477
+ "pathping",
478
+ "reg",
479
+ "regedit",
480
+ "schtasks",
481
+ "wmic",
482
+ "where",
483
+ "findstr",
484
+ "fc",
485
+ "comp",
486
+ "chkdsk",
487
+ "sfc",
488
+ "dism",
489
+ "bcdedit",
490
+ "diskpart",
491
+ "format",
492
+ "label",
493
+ "vol",
494
+ "net",
495
+ "netstat",
496
+ "nbtstat",
497
+ "klist",
498
+ "gpresult",
499
+ "gpupdate",
500
+ "shutdown",
501
+ "logoff",
502
+ // PowerShell aliases that look like commands
503
+ "gci",
504
+ "gc",
505
+ "sl",
506
+ "gi",
507
+ "gm",
508
+ "gwmi",
509
+ "iwr",
510
+ "irm",
511
+ // Date/Time
512
+ "timedatectl",
513
+ "hwclock",
514
+ "ntpdate",
515
+ "chronyc",
516
+ // Containers/Virtualization
517
+ "podman",
518
+ "crictl",
519
+ "ctr",
520
+ "nerdctl",
521
+ "lxc",
522
+ "lxd",
523
+ "virsh",
524
+ "vboxmanage",
525
+ "multipass",
526
+ "lima",
527
+ // Kubernetes ecosystem
528
+ "k9s",
529
+ "kubectx",
530
+ "kubens",
531
+ "kustomize",
532
+ "skaffold",
533
+ "minikube",
534
+ "kind",
535
+ "k3s",
536
+ "k3d",
537
+ // Misc utilities
538
+ "xdg-open",
539
+ "open",
540
+ "wslpath",
541
+ "cygpath",
542
+ "explorer",
543
+ "start",
544
+ "yes",
545
+ "seq",
546
+ "factor",
547
+ "bc",
548
+ "dc",
549
+ "expr",
550
+ "sleep",
551
+ "usleep",
552
+ "watch",
553
+ // Common CLI tools
554
+ "ffmpeg",
555
+ "ffprobe",
556
+ "convert",
557
+ "identify",
558
+ "magick",
559
+ "pandoc",
560
+ "latex",
561
+ "pdflatex",
562
+ "bibtex",
563
+ "youtube-dl",
564
+ "yt-dlp",
565
+ "aria2c",
566
+ "axel"
130
567
  ]);
131
- // Shell built-ins that work standalone or with simple arguments (exit codes, etc.)
132
- // These get special handling for disambiguation
133
- const SHELL_BUILTINS = new Set([
134
- 'exit', 'logout', 'return', 'break', 'continue',
135
- 'jobs', 'fg', 'bg', 'wait', 'disown', 'suspend',
136
- 'pushd', 'popd', 'dirs',
137
- 'history', 'fc',
138
- 'pwd', 'hash', 'help', 'true', 'false',
139
- 'env', 'printenv', 'export', 'set', 'unset',
140
- 'alias', 'unalias', 'type', 'command', 'builtin',
141
- 'clear', 'reset', 'cls',
568
+ const SHELL_BUILTINS = /* @__PURE__ */ new Set([
569
+ "exit",
570
+ "logout",
571
+ "return",
572
+ "break",
573
+ "continue",
574
+ "jobs",
575
+ "fg",
576
+ "bg",
577
+ "wait",
578
+ "disown",
579
+ "suspend",
580
+ "pushd",
581
+ "popd",
582
+ "dirs",
583
+ "history",
584
+ "fc",
585
+ "pwd",
586
+ "hash",
587
+ "help",
588
+ "true",
589
+ "false",
590
+ "env",
591
+ "printenv",
592
+ "export",
593
+ "set",
594
+ "unset",
595
+ "alias",
596
+ "unalias",
597
+ "type",
598
+ "command",
599
+ "builtin",
600
+ "clear",
601
+ "reset",
602
+ "cls"
142
603
  ]);
143
- // Commands that can also be natural language words - need disambiguation
144
- const AMBIGUOUS_COMMANDS = new Set([
145
- 'which', 'make', 'find', 'head', 'tail',
146
- 'test', 'run', 'start', 'stop', 'top', 'man',
147
- 'date', 'time', 'source', 'tree', 'sort',
148
- 'diff', 'patch', 'split', 'join', 'cut', 'paste', 'fold', 'fmt',
149
- 'look', 'spell', 'read', 'print', 'say', 'write',
150
- 'mount', 'watch', 'locate', 'ping', 'host'
604
+ const AMBIGUOUS_COMMANDS = /* @__PURE__ */ new Set([
605
+ "which",
606
+ "make",
607
+ "find",
608
+ "head",
609
+ "tail",
610
+ "test",
611
+ "run",
612
+ "start",
613
+ "stop",
614
+ "top",
615
+ "man",
616
+ "date",
617
+ "time",
618
+ "source",
619
+ "tree",
620
+ "sort",
621
+ "diff",
622
+ "patch",
623
+ "split",
624
+ "join",
625
+ "cut",
626
+ "paste",
627
+ "fold",
628
+ "fmt",
629
+ "look",
630
+ "spell",
631
+ "read",
632
+ "print",
633
+ "say",
634
+ "write",
635
+ "mount",
636
+ "watch",
637
+ "locate",
638
+ "ping",
639
+ "host"
151
640
  ]);
152
- // Natural language keywords that strongly indicate AI intent
153
- const AI_KEYWORDS = new Set([
154
- // Question words
155
- 'how', 'what', 'why', 'when', 'where', 'who', 'whose', 'whom',
156
- // Action requests
157
- 'write', 'create', 'generate', 'implement', 'scaffold', 'design',
158
- 'explain', 'describe', 'clarify', 'analyze', 'review', 'audit',
159
- 'fix', 'debug', 'solve', 'correct', 'repair',
160
- 'optimize', 'improve', 'refactor', 'format',
161
- 'verify', 'validate',
162
- 'translate', 'convert', 'transform',
163
- 'summarize', 'document', 'comment',
164
- 'add', 'update', 'change', 'modify', 'remove', 'delete',
165
- // Modal verbs indicating requests
166
- 'can', 'could', 'would', 'should', 'shall', 'might', 'must',
167
- // Greetings and polite markers
168
- 'hey', 'hi', 'hello', 'help', 'please', 'thanks', 'thank',
169
- // Contextual
170
- 'show', 'tell', 'give', 'list', 'provide', 'suggest', 'recommend'
641
+ const AI_KEYWORDS = /* @__PURE__ */ new Set([
642
+ // Question words
643
+ "how",
644
+ "what",
645
+ "why",
646
+ "when",
647
+ "where",
648
+ "who",
649
+ "whose",
650
+ "whom",
651
+ // Action requests
652
+ "write",
653
+ "create",
654
+ "generate",
655
+ "implement",
656
+ "scaffold",
657
+ "design",
658
+ "explain",
659
+ "describe",
660
+ "clarify",
661
+ "analyze",
662
+ "review",
663
+ "audit",
664
+ "fix",
665
+ "debug",
666
+ "solve",
667
+ "correct",
668
+ "repair",
669
+ "optimize",
670
+ "improve",
671
+ "refactor",
672
+ "format",
673
+ "verify",
674
+ "validate",
675
+ "translate",
676
+ "convert",
677
+ "transform",
678
+ "summarize",
679
+ "document",
680
+ "comment",
681
+ "add",
682
+ "update",
683
+ "change",
684
+ "modify",
685
+ "remove",
686
+ "delete",
687
+ // Modal verbs indicating requests
688
+ "can",
689
+ "could",
690
+ "would",
691
+ "should",
692
+ "shall",
693
+ "might",
694
+ "must",
695
+ // Greetings and polite markers
696
+ "hey",
697
+ "hi",
698
+ "hello",
699
+ "help",
700
+ "please",
701
+ "thanks",
702
+ "thank",
703
+ // Contextual
704
+ "show",
705
+ "tell",
706
+ "give",
707
+ "list",
708
+ "provide",
709
+ "suggest",
710
+ "recommend"
171
711
  ]);
172
- // Words that indicate natural language sentence structure
173
- const NATURAL_LANGUAGE_MARKERS = new Set([
174
- // Articles
175
- 'a', 'an', 'the',
176
- // Pronouns
177
- 'i', 'me', 'my', 'mine', 'you', 'your', 'yours', 'he', 'she', 'it', 'we', 'they',
178
- 'this', 'that', 'these', 'those',
179
- // Prepositions commonly used in requests
180
- 'for', 'with', 'about', 'from', 'into', 'through', 'during', 'before', 'after',
181
- // Conjunctions
182
- 'and', 'but', 'or', 'so', 'because', 'if', 'then', 'while',
183
- // Common verbs in questions/requests
184
- 'is', 'are', 'was', 'were', 'be', 'been', 'being',
185
- 'do', 'does', 'did', 'doing', 'done',
186
- 'have', 'has', 'had', 'having',
187
- 'get', 'got', 'getting',
188
- // Adverbs
189
- 'here', 'there', 'now', 'just', 'also', 'only', 'even', 'still', 'already'
712
+ const NATURAL_LANGUAGE_MARKERS = /* @__PURE__ */ new Set([
713
+ // Articles
714
+ "a",
715
+ "an",
716
+ "the",
717
+ // Pronouns
718
+ "i",
719
+ "me",
720
+ "my",
721
+ "mine",
722
+ "you",
723
+ "your",
724
+ "yours",
725
+ "he",
726
+ "she",
727
+ "it",
728
+ "we",
729
+ "they",
730
+ "this",
731
+ "that",
732
+ "these",
733
+ "those",
734
+ // Prepositions commonly used in requests
735
+ "for",
736
+ "with",
737
+ "about",
738
+ "from",
739
+ "into",
740
+ "through",
741
+ "during",
742
+ "before",
743
+ "after",
744
+ // Conjunctions
745
+ "and",
746
+ "but",
747
+ "or",
748
+ "so",
749
+ "because",
750
+ "if",
751
+ "then",
752
+ "while",
753
+ // Common verbs in questions/requests
754
+ "is",
755
+ "are",
756
+ "was",
757
+ "were",
758
+ "be",
759
+ "been",
760
+ "being",
761
+ "do",
762
+ "does",
763
+ "did",
764
+ "doing",
765
+ "done",
766
+ "have",
767
+ "has",
768
+ "had",
769
+ "having",
770
+ "get",
771
+ "got",
772
+ "getting",
773
+ // Adverbs
774
+ "here",
775
+ "there",
776
+ "now",
777
+ "just",
778
+ "also",
779
+ "only",
780
+ "even",
781
+ "still",
782
+ "already"
190
783
  ]);
191
- // Known command + subcommand patterns (command followed by valid subcommand)
192
- const COMMAND_SUBCOMMANDS = new Map([
193
- ['git', new Set(['add', 'commit', 'push', 'pull', 'clone', 'checkout', 'branch', 'merge', 'rebase', 'reset', 'stash', 'log', 'diff', 'status', 'init', 'remote', 'fetch', 'tag', 'show', 'rm', 'mv', 'bisect', 'blame', 'cherry-pick', 'revert', 'clean', 'gc', 'reflog', 'worktree', 'submodule', 'config', 'help', 'version'])],
194
- ['npm', new Set(['install', 'i', 'uninstall', 'un', 'update', 'up', 'run', 'start', 'test', 'build', 'init', 'publish', 'pack', 'link', 'unlink', 'ls', 'list', 'outdated', 'audit', 'cache', 'config', 'help', 'version', 'ci', 'exec', 'create', 'set-script', 'pkg', 'dedupe', 'prune', 'shrinkwrap', 'adduser', 'login', 'logout', 'whoami', 'token', 'owner', 'access', 'team', 'deprecate', 'unpublish', 'dist-tag', 'view', 'search', 'doctor', 'explain', 'find-dupes', 'fund', 'hook', 'org', 'ping', 'prefix', 'profile', 'rebuild', 'repo', 'root', 'star', 'stars', 'unstar', 'bugs', 'docs', 'edit', 'explore'])],
195
- ['yarn', new Set(['add', 'remove', 'install', 'run', 'start', 'test', 'build', 'init', 'publish', 'link', 'unlink', 'list', 'outdated', 'audit', 'cache', 'config', 'help', 'version', 'upgrade', 'upgrade-interactive', 'why', 'workspaces', 'set', 'create', 'dlx', 'pack', 'dedupe', 'info'])],
196
- ['pnpm', new Set(['add', 'remove', 'install', 'i', 'run', 'start', 'test', 'build', 'init', 'publish', 'link', 'unlink', 'list', 'ls', 'outdated', 'audit', 'store', 'config', 'help', 'version', 'update', 'up', 'why', 'dlx', 'create', 'exec', 'fetch', 'dedupe', 'patch', 'prune', 'rebuild'])],
197
- ['docker', new Set(['run', 'exec', 'build', 'pull', 'push', 'images', 'ps', 'stop', 'start', 'restart', 'rm', 'rmi', 'logs', 'inspect', 'network', 'volume', 'compose', 'system', 'container', 'image', 'login', 'logout', 'tag', 'save', 'load', 'export', 'import', 'commit', 'cp', 'create', 'diff', 'events', 'history', 'info', 'kill', 'pause', 'unpause', 'port', 'rename', 'stats', 'top', 'update', 'wait', 'attach', 'builder', 'buildx', 'config', 'context', 'manifest', 'plugin', 'search', 'secret', 'service', 'stack', 'swarm', 'trust', 'version'])],
198
- ['kubectl', new Set(['get', 'describe', 'create', 'apply', 'delete', 'edit', 'logs', 'exec', 'port-forward', 'proxy', 'run', 'expose', 'scale', 'rollout', 'set', 'explain', 'cluster-info', 'top', 'cordon', 'uncordon', 'drain', 'taint', 'label', 'annotate', 'config', 'cp', 'attach', 'auth', 'autoscale', 'certificate', 'completion', 'debug', 'diff', 'kustomize', 'patch', 'plugin', 'replace', 'version', 'wait', 'api-resources', 'api-versions'])],
199
- ['go', new Set(['build', 'run', 'test', 'get', 'install', 'mod', 'fmt', 'vet', 'generate', 'clean', 'env', 'version', 'list', 'work', 'doc', 'fix', 'tool', 'bug'])],
200
- ['cargo', new Set(['build', 'run', 'test', 'new', 'init', 'add', 'remove', 'update', 'search', 'publish', 'install', 'uninstall', 'check', 'bench', 'doc', 'clean', 'fetch', 'fix', 'fmt', 'clippy', 'tree', 'vendor', 'verify-project', 'version', 'yank', 'help', 'login', 'logout', 'owner', 'package', 'generate-lockfile', 'locate-project', 'metadata', 'pkgid', 'read-manifest', 'report'])],
201
- ['pip', new Set(['install', 'uninstall', 'download', 'freeze', 'list', 'show', 'search', 'wheel', 'hash', 'check', 'config', 'cache', 'index', 'debug', 'help', 'completion'])],
202
- ['pip3', new Set(['install', 'uninstall', 'download', 'freeze', 'list', 'show', 'search', 'wheel', 'hash', 'check', 'config', 'cache', 'index', 'debug', 'help', 'completion'])],
203
- ['aws', new Set(['s3', 'ec2', 'lambda', 'iam', 'rds', 'dynamodb', 'cloudformation', 'ecs', 'eks', 'sns', 'sqs', 'cloudwatch', 'route53', 'apigateway', 'cognito', 'secretsmanager', 'ssm', 'sts', 'configure', 'help'])],
204
- ['az', new Set(['login', 'logout', 'account', 'group', 'vm', 'storage', 'network', 'webapp', 'functionapp', 'aks', 'acr', 'sql', 'cosmosdb', 'keyvault', 'monitor', 'resource', 'role', 'ad', 'configure', 'help', 'version'])],
205
- ['gcloud', new Set(['auth', 'config', 'compute', 'container', 'functions', 'run', 'app', 'sql', 'storage', 'pubsub', 'iam', 'projects', 'services', 'builds', 'deploy', 'components', 'help', 'version', 'init', 'info'])],
206
- ['terraform', new Set(['init', 'plan', 'apply', 'destroy', 'validate', 'fmt', 'show', 'output', 'refresh', 'import', 'state', 'workspace', 'providers', 'graph', 'taint', 'untaint', 'console', 'force-unlock', 'get', 'login', 'logout', 'version', 'help'])],
207
- ['make', new Set(['all', 'build', 'clean', 'install', 'uninstall', 'test', 'check', 'dist', 'distclean', 'help'])],
208
- ['find', new Set([])], // find uses expressions, not subcommands
209
- ['which', new Set([])], // which doesn't have subcommands
784
+ const COMMAND_SUBCOMMANDS = /* @__PURE__ */ new Map([
785
+ ["git", /* @__PURE__ */ new Set(["add", "commit", "push", "pull", "clone", "checkout", "branch", "merge", "rebase", "reset", "stash", "log", "diff", "status", "init", "remote", "fetch", "tag", "show", "rm", "mv", "bisect", "blame", "cherry-pick", "revert", "clean", "gc", "reflog", "worktree", "submodule", "config", "help", "version"])],
786
+ ["npm", /* @__PURE__ */ new Set(["install", "i", "uninstall", "un", "update", "up", "run", "start", "test", "build", "init", "publish", "pack", "link", "unlink", "ls", "list", "outdated", "audit", "cache", "config", "help", "version", "ci", "exec", "create", "set-script", "pkg", "dedupe", "prune", "shrinkwrap", "adduser", "login", "logout", "whoami", "token", "owner", "access", "team", "deprecate", "unpublish", "dist-tag", "view", "search", "doctor", "explain", "find-dupes", "fund", "hook", "org", "ping", "prefix", "profile", "rebuild", "repo", "root", "star", "stars", "unstar", "bugs", "docs", "edit", "explore"])],
787
+ ["yarn", /* @__PURE__ */ new Set(["add", "remove", "install", "run", "start", "test", "build", "init", "publish", "link", "unlink", "list", "outdated", "audit", "cache", "config", "help", "version", "upgrade", "upgrade-interactive", "why", "workspaces", "set", "create", "dlx", "pack", "dedupe", "info"])],
788
+ ["pnpm", /* @__PURE__ */ new Set(["add", "remove", "install", "i", "run", "start", "test", "build", "init", "publish", "link", "unlink", "list", "ls", "outdated", "audit", "store", "config", "help", "version", "update", "up", "why", "dlx", "create", "exec", "fetch", "dedupe", "patch", "prune", "rebuild"])],
789
+ ["docker", /* @__PURE__ */ new Set(["run", "exec", "build", "pull", "push", "images", "ps", "stop", "start", "restart", "rm", "rmi", "logs", "inspect", "network", "volume", "compose", "system", "container", "image", "login", "logout", "tag", "save", "load", "export", "import", "commit", "cp", "create", "diff", "events", "history", "info", "kill", "pause", "unpause", "port", "rename", "stats", "top", "update", "wait", "attach", "builder", "buildx", "config", "context", "manifest", "plugin", "search", "secret", "service", "stack", "swarm", "trust", "version"])],
790
+ ["kubectl", /* @__PURE__ */ new Set(["get", "describe", "create", "apply", "delete", "edit", "logs", "exec", "port-forward", "proxy", "run", "expose", "scale", "rollout", "set", "explain", "cluster-info", "top", "cordon", "uncordon", "drain", "taint", "label", "annotate", "config", "cp", "attach", "auth", "autoscale", "certificate", "completion", "debug", "diff", "kustomize", "patch", "plugin", "replace", "version", "wait", "api-resources", "api-versions"])],
791
+ ["go", /* @__PURE__ */ new Set(["build", "run", "test", "get", "install", "mod", "fmt", "vet", "generate", "clean", "env", "version", "list", "work", "doc", "fix", "tool", "bug"])],
792
+ ["cargo", /* @__PURE__ */ new Set(["build", "run", "test", "new", "init", "add", "remove", "update", "search", "publish", "install", "uninstall", "check", "bench", "doc", "clean", "fetch", "fix", "fmt", "clippy", "tree", "vendor", "verify-project", "version", "yank", "help", "login", "logout", "owner", "package", "generate-lockfile", "locate-project", "metadata", "pkgid", "read-manifest", "report"])],
793
+ ["pip", /* @__PURE__ */ new Set(["install", "uninstall", "download", "freeze", "list", "show", "search", "wheel", "hash", "check", "config", "cache", "index", "debug", "help", "completion"])],
794
+ ["pip3", /* @__PURE__ */ new Set(["install", "uninstall", "download", "freeze", "list", "show", "search", "wheel", "hash", "check", "config", "cache", "index", "debug", "help", "completion"])],
795
+ ["aws", /* @__PURE__ */ new Set(["s3", "ec2", "lambda", "iam", "rds", "dynamodb", "cloudformation", "ecs", "eks", "sns", "sqs", "cloudwatch", "route53", "apigateway", "cognito", "secretsmanager", "ssm", "sts", "configure", "help"])],
796
+ ["az", /* @__PURE__ */ new Set(["login", "logout", "account", "group", "vm", "storage", "network", "webapp", "functionapp", "aks", "acr", "sql", "cosmosdb", "keyvault", "monitor", "resource", "role", "ad", "configure", "help", "version"])],
797
+ ["gcloud", /* @__PURE__ */ new Set(["auth", "config", "compute", "container", "functions", "run", "app", "sql", "storage", "pubsub", "iam", "projects", "services", "builds", "deploy", "components", "help", "version", "init", "info"])],
798
+ ["terraform", /* @__PURE__ */ new Set(["init", "plan", "apply", "destroy", "validate", "fmt", "show", "output", "refresh", "import", "state", "workspace", "providers", "graph", "taint", "untaint", "console", "force-unlock", "get", "login", "logout", "version", "help"])],
799
+ ["make", /* @__PURE__ */ new Set(["all", "build", "clean", "install", "uninstall", "test", "check", "dist", "distclean", "help"])],
800
+ ["find", /* @__PURE__ */ new Set([])],
801
+ // find uses expressions, not subcommands
802
+ ["which", /* @__PURE__ */ new Set([])]
803
+ // which doesn't have subcommands
210
804
  ]);
211
- /**
212
- * Check if the input looks like a natural language sentence
213
- */
214
805
  function looksLikeNaturalLanguage(words) {
215
- if (words.length < 2)
216
- return false;
217
- const lowerWords = words.map(w => w.toLowerCase());
218
- // Count natural language markers
219
- let markerCount = 0;
220
- for (const word of lowerWords) {
221
- if (NATURAL_LANGUAGE_MARKERS.has(word)) {
222
- markerCount++;
223
- }
806
+ if (words.length < 2) return false;
807
+ const lowerWords = words.map((w) => w.toLowerCase());
808
+ let markerCount = 0;
809
+ for (const word of lowerWords) {
810
+ if (NATURAL_LANGUAGE_MARKERS.has(word)) {
811
+ markerCount++;
224
812
  }
225
- // If more than 30% of words are natural language markers, it's likely natural language
226
- if (markerCount >= Math.ceil(words.length * 0.3)) {
227
- return true;
228
- }
229
- // Check for common natural language patterns
230
- // Pattern: verb + article (e.g., "make a", "create the", "find the")
231
- if (lowerWords.length >= 2 && ['a', 'an', 'the', 'me', 'my', 'some', 'any'].includes(lowerWords[1])) {
232
- return true;
233
- }
234
- // Pattern: question word + verb/article (e.g., "which libraries have")
235
- if (lowerWords.length >= 3 &&
236
- AMBIGUOUS_COMMANDS.has(lowerWords[0]) &&
237
- NATURAL_LANGUAGE_MARKERS.has(lowerWords[1])) {
238
- return true;
239
- }
240
- // Pattern: contains "i" as a word (pronoun)
241
- if (lowerWords.includes('i') && lowerWords.indexOf('i') > 0) {
242
- return true;
243
- }
244
- // Pattern: long phrase with multiple natural language markers scattered
245
- if (words.length >= 4 && markerCount >= 2) {
246
- return true;
247
- }
248
- return false;
813
+ }
814
+ if (markerCount >= Math.ceil(words.length * 0.3)) {
815
+ return true;
816
+ }
817
+ if (lowerWords.length >= 2 && ["a", "an", "the", "me", "my", "some", "any"].includes(lowerWords[1])) {
818
+ return true;
819
+ }
820
+ if (lowerWords.length >= 3 && AMBIGUOUS_COMMANDS.has(lowerWords[0]) && NATURAL_LANGUAGE_MARKERS.has(lowerWords[1])) {
821
+ return true;
822
+ }
823
+ if (lowerWords.includes("i") && lowerWords.indexOf("i") > 0) {
824
+ return true;
825
+ }
826
+ if (words.length >= 4 && markerCount >= 2) {
827
+ return true;
828
+ }
829
+ return false;
249
830
  }
250
- /**
251
- * Check if input has strong command syntax indicators
252
- */
253
831
  function hasCommandSyntax(input, words) {
254
- const trimmed = input.trim();
255
- const firstWord = words[0]?.toLowerCase() || '';
256
- // Flags: -f, --flag (must be preceded by space or at position 2+)
257
- const hasFlags = /\s-[a-zA-Z]|\s--[a-zA-Z]/.test(input) ||
258
- (words.length >= 2 && /^-[a-zA-Z]/.test(words[1]));
259
- // Operators: |, >, >>, <, &&, ||, ;
260
- const hasOperators = /(\s\|\s)|(\s>\s)|(\s>>\s)|(\s<\s)|(\s&&\s)|(\s\|\|\s)|(;)/.test(input);
261
- // Variable assignment: VAR=val (at start or after space)
262
- const hasVarAssign = /^[a-zA-Z_][a-zA-Z0-9_]*=[^ ]/.test(input) || /\s[a-zA-Z_][a-zA-Z0-9_]*=[^ ]/.test(input);
263
- // Quoted arguments that look like command arguments (e.g., -m "message")
264
- const hasQuotedWithFlag = /\s-[a-zA-Z]+\s+["']/.test(input) || /\s--[a-zA-Z-]+[=\s]+["']/.test(input);
265
- // Path patterns (absolute paths or ./ or ../)
266
- const hasPathPattern = /^[.~]?\/|^\.\.\/|\s[.~]?\/|\s\.\.\//.test(input);
267
- // Windows path patterns (C:\, D:\, etc.)
268
- const hasWindowsPath = /^[a-zA-Z]:\\|\\s[a-zA-Z]:\\/.test(input);
269
- // Redirect to/from file
270
- const hasFileRedirect = /[<>]\s*[a-zA-Z0-9_./-]+/.test(input);
271
- // Environment variable usage
272
- const hasEnvVar = /\$[a-zA-Z_][a-zA-Z0-9_]*|\$\{[^}]+\}|%[a-zA-Z_][a-zA-Z0-9_]*%/.test(input);
273
- // Shell built-in patterns:
274
- // Exit/return with numeric code: exit 0, exit 1, return 0, return 1
275
- const hasExitCode = /^(exit|return|break|continue)\s+\d+$/.test(trimmed);
276
- // Background job: command &
277
- const hasBackgroundJob = /\s*&\s*$/.test(trimmed);
278
- // Command chaining: cmd1; cmd2
279
- const hasCommandChain = /;\s*[a-zA-Z]/.test(input);
280
- // Command substitution: $(cmd) or `cmd`
281
- const hasCommandSubstitution = /\$\([^)]+\)|`[^`]+`/.test(input);
282
- // Job control: %1, %2, etc.
283
- const hasJobReference = /^(fg|bg|jobs|kill|disown)\s+%?\d+$/.test(trimmed);
284
- // pushd/popd with path or +N/-N
285
- const hasDirStackOp = /^(pushd|popd)\s+([+\-]\d+|[\/~.])/.test(trimmed);
286
- // history with number: history 10, history -c, history -d 5
287
- const hasHistoryOp = /^history\s+(-[a-z]|\d+)/.test(trimmed);
288
- // alias definition: alias name='...' or alias name="..."
289
- const hasAliasDefinition = /^alias\s+[a-zA-Z_][a-zA-Z0-9_]*=/.test(trimmed);
290
- // export with assignment: export VAR=value
291
- const hasExportAssign = /^export\s+[A-Z_][A-Z0-9_]*=/.test(trimmed);
292
- // cd with path or special: cd -, cd ~, cd ..
293
- const hasCdPath = /^cd\s+[\/~.\-]/.test(trimmed);
294
- // Check for known command + subcommand pattern
295
- if (words.length >= 2) {
296
- const secondWord = words[1].toLowerCase();
297
- const subcommands = COMMAND_SUBCOMMANDS.get(firstWord);
298
- if (subcommands && subcommands.has(secondWord)) {
299
- return true;
300
- }
832
+ const trimmed = input.trim();
833
+ const firstWord = words[0]?.toLowerCase() || "";
834
+ const hasFlags = /\s-[a-zA-Z]|\s--[a-zA-Z]/.test(input) || words.length >= 2 && /^-[a-zA-Z]/.test(words[1]);
835
+ const hasOperators = /(\s\|\s)|(\s>\s)|(\s>>\s)|(\s<\s)|(\s&&\s)|(\s\|\|\s)|(;)/.test(input);
836
+ const hasVarAssign = /^[a-zA-Z_][a-zA-Z0-9_]*=[^ ]/.test(input) || /\s[a-zA-Z_][a-zA-Z0-9_]*=[^ ]/.test(input);
837
+ const hasQuotedWithFlag = /\s-[a-zA-Z]+\s+["']/.test(input) || /\s--[a-zA-Z-]+[=\s]+["']/.test(input);
838
+ const hasPathPattern = /^[.~]?\/|^\.\.\/|\s[.~]?\/|\s\.\.\//.test(input);
839
+ const hasWindowsPath = /^[a-zA-Z]:\\|\\s[a-zA-Z]:\\/.test(input);
840
+ const hasFileRedirect = /[<>]\s*[a-zA-Z0-9_./-]+/.test(input);
841
+ const hasEnvVar = /\$[a-zA-Z_][a-zA-Z0-9_]*|\$\{[^}]+\}|%[a-zA-Z_][a-zA-Z0-9_]*%/.test(input);
842
+ const hasExitCode = /^(exit|return|break|continue)\s+\d+$/.test(trimmed);
843
+ const hasBackgroundJob = /\s*&\s*$/.test(trimmed);
844
+ const hasCommandChain = /;\s*[a-zA-Z]/.test(input);
845
+ const hasCommandSubstitution = /\$\([^)]+\)|`[^`]+`/.test(input);
846
+ const hasJobReference = /^(fg|bg|jobs|kill|disown)\s+%?\d+$/.test(trimmed);
847
+ const hasDirStackOp = /^(pushd|popd)\s+([+\-]\d+|[\/~.])/.test(trimmed);
848
+ const hasHistoryOp = /^history\s+(-[a-z]|\d+)/.test(trimmed);
849
+ const hasAliasDefinition = /^alias\s+[a-zA-Z_][a-zA-Z0-9_]*=/.test(trimmed);
850
+ const hasExportAssign = /^export\s+[A-Z_][A-Z0-9_]*=/.test(trimmed);
851
+ const hasCdPath = /^cd\s+[\/~.\-]/.test(trimmed);
852
+ if (words.length >= 2) {
853
+ const secondWord = words[1].toLowerCase();
854
+ const subcommands = COMMAND_SUBCOMMANDS.get(firstWord);
855
+ if (subcommands && subcommands.has(secondWord)) {
856
+ return true;
301
857
  }
302
- // Shell built-in as single word is always a command
303
- if (words.length === 1 && SHELL_BUILTINS.has(firstWord)) {
304
- return true;
305
- }
306
- return hasFlags || hasOperators || hasVarAssign || hasQuotedWithFlag ||
307
- hasPathPattern || hasWindowsPath || hasFileRedirect || hasEnvVar ||
308
- hasExitCode || hasBackgroundJob || hasCommandChain || hasCommandSubstitution ||
309
- hasJobReference || hasDirStackOp || hasHistoryOp || hasAliasDefinition ||
310
- hasExportAssign || hasCdPath;
858
+ }
859
+ if (words.length === 1 && SHELL_BUILTINS.has(firstWord)) {
860
+ return true;
861
+ }
862
+ return hasFlags || hasOperators || hasVarAssign || hasQuotedWithFlag || hasPathPattern || hasWindowsPath || hasFileRedirect || hasEnvVar || hasExitCode || hasBackgroundJob || hasCommandChain || hasCommandSubstitution || hasJobReference || hasDirStackOp || hasHistoryOp || hasAliasDefinition || hasExportAssign || hasCdPath;
311
863
  }
312
- /**
313
- * Disambiguate ambiguous commands based on context
314
- */
315
864
  function disambiguateCommand(input, words) {
316
- const firstWord = words[0].toLowerCase();
317
- // If it has command syntax, it's definitely a command
318
- if (hasCommandSyntax(input, words)) {
319
- return 'command';
320
- }
321
- // If it looks like natural language, it's AI
322
- if (looksLikeNaturalLanguage(words)) {
323
- return 'ai';
865
+ const firstWord = words[0].toLowerCase();
866
+ if (hasCommandSyntax(input, words)) {
867
+ return "command";
868
+ }
869
+ if (looksLikeNaturalLanguage(words)) {
870
+ return "ai";
871
+ }
872
+ if (firstWord === "make") {
873
+ const makeSubcommands = COMMAND_SUBCOMMANDS.get("make");
874
+ if (words.length >= 2 && makeSubcommands?.has(words[1].toLowerCase())) {
875
+ return "command";
324
876
  }
325
- // Special case for 'make' - check for Makefile targets vs natural language
326
- if (firstWord === 'make') {
327
- // "make build", "make clean", "make all" - valid Makefile targets
328
- const makeSubcommands = COMMAND_SUBCOMMANDS.get('make');
329
- if (words.length >= 2 && makeSubcommands?.has(words[1].toLowerCase())) {
330
- return 'command';
331
- }
332
- // "make something" where something is a single word could be a target
333
- if (words.length === 2 && /^[a-z0-9_-]+$/i.test(words[1])) {
334
- return 'command';
335
- }
336
- // Otherwise, likely natural language ("make it work", "make a file")
337
- return 'ai';
877
+ if (words.length === 2 && /^[a-z0-9_-]+$/i.test(words[1])) {
878
+ return "command";
338
879
  }
339
- // Special case for 'which' - almost always a command when alone or with one arg
340
- if (firstWord === 'which') {
341
- // "which node" - valid command
342
- if (words.length === 2 && /^[a-z0-9_.-]+$/i.test(words[1])) {
343
- return 'command';
344
- }
345
- // "which libraries have I used" - natural language
346
- if (words.length > 2) {
347
- return 'ai';
348
- }
880
+ return "ai";
881
+ }
882
+ if (firstWord === "which") {
883
+ if (words.length === 2 && /^[a-z0-9_.-]+$/i.test(words[1])) {
884
+ return "command";
349
885
  }
350
- // Special case for 'find' - needs path or expression flags
351
- if (firstWord === 'find') {
352
- // "find . -name" or "find /path" - command
353
- if (words.length >= 2 && (words[1].startsWith('.') || words[1].startsWith('/') || words[1].startsWith('-'))) {
354
- return 'command';
355
- }
356
- // "find all bugs" - natural language
357
- if (words.length > 2) {
358
- return 'ai';
359
- }
886
+ if (words.length > 2) {
887
+ return "ai";
360
888
  }
361
- // Special case for 'export' - needs assignment
362
- if (firstWord === 'export') {
363
- // "export VAR=value" or "export PATH" - command
364
- if (words.length >= 2 && /^[A-Z_][A-Z0-9_]*/.test(words[1])) {
365
- return 'command';
366
- }
367
- // "export the data" - natural language
368
- return 'ai';
889
+ }
890
+ if (firstWord === "find") {
891
+ if (words.length >= 2 && (words[1].startsWith(".") || words[1].startsWith("/") || words[1].startsWith("-"))) {
892
+ return "command";
369
893
  }
370
- // Special case for 'run', 'start', 'stop', 'test'
371
- if (['run', 'start', 'stop', 'test'].includes(firstWord)) {
372
- // These are more often natural language unless they have specific patterns
373
- // "run npm install" - could be shorthand for script runner
374
- // "run this code" - natural language
375
- // "start the server" - ambiguous but likely natural language
376
- // "test the api" - natural language
377
- if (words.length >= 2) {
378
- // If followed by a known command, treat as command
379
- if (DEFINITE_COMMANDS.has(words[1].toLowerCase())) {
380
- return 'command';
381
- }
382
- // If followed by natural language markers, treat as AI
383
- if (NATURAL_LANGUAGE_MARKERS.has(words[1].toLowerCase())) {
384
- return 'ai';
385
- }
386
- }
387
- // Default to AI for these ambiguous words
388
- return 'ai';
894
+ if (words.length > 2) {
895
+ return "ai";
389
896
  }
390
- // For other ambiguous commands:
391
- // Single word - could be a command, but safer to default to command (can be overridden)
392
- if (words.length === 1) {
393
- return 'command';
897
+ }
898
+ if (firstWord === "export") {
899
+ if (words.length >= 2 && /^[A-Z_][A-Z0-9_]*/.test(words[1])) {
900
+ return "command";
394
901
  }
395
- // Two words where second is a simple identifier - likely command
396
- if (words.length === 2 && /^[a-z0-9_.-]+$/i.test(words[1]) && !NATURAL_LANGUAGE_MARKERS.has(words[1].toLowerCase())) {
397
- return 'command';
902
+ return "ai";
903
+ }
904
+ if (["run", "start", "stop", "test"].includes(firstWord)) {
905
+ if (words.length >= 2) {
906
+ if (DEFINITE_COMMANDS.has(words[1].toLowerCase())) {
907
+ return "command";
908
+ }
909
+ if (NATURAL_LANGUAGE_MARKERS.has(words[1].toLowerCase())) {
910
+ return "ai";
911
+ }
398
912
  }
399
- // Default to AI for multi-word ambiguous commands
400
- return 'ai';
913
+ return "ai";
914
+ }
915
+ if (words.length === 1) {
916
+ return "command";
917
+ }
918
+ if (words.length === 2 && /^[a-z0-9_.-]+$/i.test(words[1]) && !NATURAL_LANGUAGE_MARKERS.has(words[1].toLowerCase())) {
919
+ return "command";
920
+ }
921
+ return "ai";
401
922
  }
402
- /**
403
- * Detects the intent of the user input using intelligent heuristics.
404
- *
405
- * Logic Priority:
406
- * 1. Slash Commands: If starts with '/', check if valid command -> AI
407
- * 2. Prefixes: '?' -> AI, '.', '/', '$', '~' -> Command
408
- * 3. Strong AI Indicators: Question marks, AI keywords
409
- * 4. Strong Command Syntax: Flags, pipes, redirects, quotes, env vars
410
- * 5. Definite Commands: Known command binaries that aren't ambiguous
411
- * 6. Ambiguous Command Disambiguation: Context-aware analysis
412
- * 7. Natural Language Detection: Sentence structure analysis
413
- * 8. Fallback: Multi-word without command syntax -> AI
414
- *
415
- * @param input The user input string
416
- * @returns 'command' | 'ai'
417
- */
418
- export function detectIntent(input) {
419
- const trimmed = input.trim();
420
- if (!trimmed) {
421
- return 'ai'; // Default to AI for empty/whitespace
422
- }
423
- // Check 0 - Slash Commands (Highest Priority)
424
- if (trimmed.startsWith('/')) {
425
- // Extract command name (remove '/' and take first word)
426
- const commandName = trimmed.slice(1).split(/\s+/)[0].toLowerCase();
427
- if (SLASH_COMMANDS.has(commandName)) {
428
- return 'ai';
429
- }
430
- // If starts with '/' but not a valid slash command, assume it's a path -> Command
431
- return 'command';
432
- }
433
- // Check 1 - Explicit Prefixes
434
- if (trimmed.startsWith('?'))
435
- return 'ai';
436
- if (trimmed.startsWith('.') || trimmed.startsWith('$') || trimmed.startsWith('~'))
437
- return 'command';
438
- // Parse words for analysis
439
- const words = trimmed.split(/\s+/);
440
- const firstWord = words[0].toLowerCase();
441
- // Check 2 - Strong AI Indicators (check BEFORE command matching)
442
- const isQuestion = trimmed.endsWith('?');
443
- const startsWithAIKeyword = AI_KEYWORDS.has(firstWord);
444
- if (startsWithAIKeyword) {
445
- // If starts with AI keyword, it's almost always AI
446
- // Exception: if it has strong command syntax, it might still be a command
447
- if (!hasCommandSyntax(trimmed, words)) {
448
- return 'ai';
449
- }
450
- }
451
- if (isQuestion) {
452
- // Questions are almost always AI
453
- // Exception: rare case of command with ? (like "ls ?*.txt" - but this is uncommon)
454
- if (!hasCommandSyntax(trimmed, words)) {
455
- return 'ai';
456
- }
457
- }
458
- // Check 3 - Strong Command Syntax (before command name matching)
459
- if (hasCommandSyntax(trimmed, words)) {
460
- return 'command';
461
- }
462
- // Check 4 - Definite Commands (non-ambiguous command names)
463
- if (DEFINITE_COMMANDS.has(firstWord)) {
464
- // Special handling for shell built-ins that might be followed by natural language
465
- // e.g., "exit" is a command, but "exit the application" is AI
466
- if (SHELL_BUILTINS.has(firstWord) && words.length > 1) {
467
- // Check if followed by natural language markers
468
- const secondWord = words[1].toLowerCase();
469
- if (NATURAL_LANGUAGE_MARKERS.has(secondWord)) {
470
- return 'ai';
471
- }
472
- // Check for "exit/clear/history the ..." pattern
473
- if (['the', 'this', 'that', 'my', 'your', 'our', 'all'].includes(secondWord)) {
474
- return 'ai';
475
- }
476
- }
477
- return 'command';
478
- }
479
- // Check 4.5 - Custom Commands (user-defined terminal commands)
480
- // Load custom commands synchronously for fast detection
481
- const customCommandsManager = CustomCommandsManager.getInstance();
482
- customCommandsManager.loadSync();
483
- if (customCommandsManager.hasCommand(firstWord)) {
484
- return 'command';
485
- }
486
- // Check 5 - Ambiguous Commands (need disambiguation)
487
- if (AMBIGUOUS_COMMANDS.has(firstWord)) {
488
- return disambiguateCommand(trimmed, words);
923
+ function detectIntent(input) {
924
+ const trimmed = input.trim();
925
+ if (!trimmed) {
926
+ return "ai";
927
+ }
928
+ if (trimmed.startsWith("/")) {
929
+ const commandName = trimmed.slice(1).split(/\s+/)[0].toLowerCase();
930
+ if (SLASH_COMMANDS.has(commandName)) {
931
+ return "ai";
489
932
  }
490
- // Check 6 - Path-like strings
491
- // If it contains slashes and no spaces, it might be a path execution
492
- if ((trimmed.includes('/') || trimmed.includes('\\')) && !trimmed.includes(' ')) {
493
- return 'command';
933
+ return "command";
934
+ }
935
+ if (trimmed.startsWith("?")) return "ai";
936
+ if (trimmed.startsWith(".") || trimmed.startsWith("$") || trimmed.startsWith("~")) return "command";
937
+ const words = trimmed.split(/\s+/);
938
+ const firstWord = words[0].toLowerCase();
939
+ const isQuestion = trimmed.endsWith("?");
940
+ const startsWithAIKeyword = AI_KEYWORDS.has(firstWord);
941
+ if (startsWithAIKeyword) {
942
+ if (!hasCommandSyntax(trimmed, words)) {
943
+ return "ai";
494
944
  }
495
- // Check 7 - Natural Language Detection for unknown first words
496
- if (looksLikeNaturalLanguage(words)) {
497
- return 'ai';
945
+ }
946
+ if (isQuestion) {
947
+ if (!hasCommandSyntax(trimmed, words)) {
948
+ return "ai";
498
949
  }
499
- // Check 8 - Fallback Heuristics
500
- // If it's a single word and NOT a known command/keyword:
501
- if (words.length === 1) {
502
- if (trimmed.includes('.'))
503
- return 'command'; // script.sh, main.py
504
- // Unknown single word - default to AI (safer for chat)
505
- return 'ai';
950
+ }
951
+ if (hasCommandSyntax(trimmed, words)) {
952
+ return "command";
953
+ }
954
+ if (DEFINITE_COMMANDS.has(firstWord)) {
955
+ if (SHELL_BUILTINS.has(firstWord) && words.length > 1) {
956
+ const secondWord = words[1].toLowerCase();
957
+ if (NATURAL_LANGUAGE_MARKERS.has(secondWord)) {
958
+ return "ai";
959
+ }
960
+ if (["the", "this", "that", "my", "your", "our", "all"].includes(secondWord)) {
961
+ return "ai";
962
+ }
506
963
  }
507
- // Multiple words, no flags, no operators, no keywords, not natural language pattern
508
- // This is truly ambiguous - default to AI (safer for chat assistant)
509
- return 'ai';
964
+ return "command";
965
+ }
966
+ const customCommandsManager = CustomCommandsManager.getInstance();
967
+ customCommandsManager.loadSync();
968
+ if (customCommandsManager.hasCommand(firstWord)) {
969
+ return "command";
970
+ }
971
+ if (AMBIGUOUS_COMMANDS.has(firstWord)) {
972
+ return disambiguateCommand(trimmed, words);
973
+ }
974
+ if ((trimmed.includes("/") || trimmed.includes("\\")) && !trimmed.includes(" ")) {
975
+ return "command";
976
+ }
977
+ if (looksLikeNaturalLanguage(words)) {
978
+ return "ai";
979
+ }
980
+ if (words.length === 1) {
981
+ if (trimmed.includes(".")) return "command";
982
+ return "ai";
983
+ }
984
+ return "ai";
510
985
  }
986
+ export {
987
+ detectIntent
988
+ };
511
989
  //# sourceMappingURL=input-classifier.js.map