@travisennis/acai 0.0.9 → 0.0.11

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 (403) hide show
  1. package/README.md +51 -760
  2. package/bin/acai +52 -0
  3. package/dist/agent/index.d.ts +12 -2
  4. package/dist/agent/index.d.ts.map +1 -1
  5. package/dist/agent/index.js +380 -199
  6. package/dist/agent/sub-agent.d.ts +23 -0
  7. package/dist/agent/sub-agent.d.ts.map +1 -0
  8. package/dist/agent/sub-agent.js +109 -0
  9. package/dist/cli/index.d.ts +26 -0
  10. package/dist/cli/index.d.ts.map +1 -0
  11. package/dist/{cli.js → cli/index.js} +84 -77
  12. package/dist/{stdin.d.ts → cli/stdin.d.ts} +2 -1
  13. package/dist/cli/stdin.d.ts.map +1 -0
  14. package/dist/{stdin.js → cli/stdin.js} +11 -0
  15. package/dist/commands/copy/index.js +2 -2
  16. package/dist/commands/copy/utils.d.ts.map +1 -1
  17. package/dist/commands/copy/utils.js +15 -13
  18. package/dist/commands/generate-rules/index.d.ts +1 -1
  19. package/dist/commands/generate-rules/index.d.ts.map +1 -1
  20. package/dist/commands/generate-rules/index.js +16 -101
  21. package/dist/commands/generate-rules/service.d.ts +22 -0
  22. package/dist/commands/generate-rules/service.d.ts.map +1 -0
  23. package/dist/commands/generate-rules/service.js +103 -0
  24. package/dist/commands/handoff/index.js +2 -2
  25. package/dist/commands/health/index.js +1 -1
  26. package/dist/commands/health/utils.d.ts +3 -2
  27. package/dist/commands/health/utils.d.ts.map +1 -1
  28. package/dist/commands/health/utils.js +6 -0
  29. package/dist/commands/history/index.d.ts +1 -1
  30. package/dist/commands/history/index.d.ts.map +1 -1
  31. package/dist/commands/history/index.js +17 -18
  32. package/dist/commands/history/types.d.ts +38 -0
  33. package/dist/commands/history/types.d.ts.map +1 -1
  34. package/dist/commands/history/utils.d.ts.map +1 -1
  35. package/dist/commands/history/utils.js +63 -58
  36. package/dist/commands/init/index.d.ts.map +1 -1
  37. package/dist/commands/init/index.js +3 -8
  38. package/dist/commands/init-project/index.d.ts.map +1 -1
  39. package/dist/commands/init-project/index.js +3 -3
  40. package/dist/commands/init-project/utils.d.ts +2 -1
  41. package/dist/commands/init-project/utils.d.ts.map +1 -1
  42. package/dist/commands/init-project/utils.js +10 -2
  43. package/dist/commands/list-tools/index.d.ts.map +1 -1
  44. package/dist/commands/list-tools/index.js +7 -31
  45. package/dist/commands/manager.d.ts +2 -2
  46. package/dist/commands/manager.d.ts.map +1 -1
  47. package/dist/commands/manager.js +55 -33
  48. package/dist/commands/model/index.d.ts.map +1 -1
  49. package/dist/commands/model/index.js +20 -151
  50. package/dist/commands/model/model-panel.d.ts +4 -0
  51. package/dist/commands/model/model-panel.d.ts.map +1 -0
  52. package/dist/commands/model/model-panel.js +144 -0
  53. package/dist/commands/paste/index.d.ts.map +1 -1
  54. package/dist/commands/paste/index.js +59 -62
  55. package/dist/commands/paste/utils.d.ts.map +1 -1
  56. package/dist/commands/paste/utils.js +88 -58
  57. package/dist/commands/pickup/index.d.ts.map +1 -1
  58. package/dist/commands/pickup/index.js +6 -3
  59. package/dist/commands/pickup/utils.js +3 -3
  60. package/dist/commands/resources/index.d.ts.map +1 -1
  61. package/dist/commands/resources/index.js +33 -50
  62. package/dist/commands/review/index.d.ts.map +1 -1
  63. package/dist/commands/review/index.js +3 -117
  64. package/dist/commands/review/review-panel.d.ts +3 -0
  65. package/dist/commands/review/review-panel.d.ts.map +1 -0
  66. package/dist/commands/review/review-panel.js +186 -0
  67. package/dist/commands/review/utils.d.ts +15 -1
  68. package/dist/commands/review/utils.d.ts.map +1 -1
  69. package/dist/commands/review/utils.js +127 -68
  70. package/dist/commands/session/index.d.ts +1 -1
  71. package/dist/commands/session/index.d.ts.map +1 -1
  72. package/dist/commands/session/index.js +124 -135
  73. package/dist/commands/shell/index.d.ts.map +1 -1
  74. package/dist/commands/shell/index.js +16 -1
  75. package/dist/commands/types.d.ts +2 -2
  76. package/dist/commands/types.d.ts.map +1 -1
  77. package/dist/{config.d.ts → config/index.d.ts} +20 -9
  78. package/dist/config/index.d.ts.map +1 -0
  79. package/dist/{config.js → config/index.js} +43 -42
  80. package/dist/execution/index.d.ts.map +1 -1
  81. package/dist/execution/index.js +75 -55
  82. package/dist/index.d.ts +1 -0
  83. package/dist/index.d.ts.map +1 -1
  84. package/dist/index.js +148 -141
  85. package/dist/middleware/cache.d.ts.map +1 -1
  86. package/dist/middleware/cache.js +18 -36
  87. package/dist/models/ai-config.d.ts +1 -0
  88. package/dist/models/ai-config.d.ts.map +1 -1
  89. package/dist/models/ai-config.js +4 -3
  90. package/dist/models/anthropic-provider.d.ts +2 -5
  91. package/dist/models/anthropic-provider.d.ts.map +1 -1
  92. package/dist/models/anthropic-provider.js +3 -70
  93. package/dist/models/deepseek-provider.d.ts +1 -0
  94. package/dist/models/deepseek-provider.d.ts.map +1 -1
  95. package/dist/models/google-provider.d.ts +2 -3
  96. package/dist/models/google-provider.d.ts.map +1 -1
  97. package/dist/models/google-provider.js +0 -26
  98. package/dist/models/groq-provider.d.ts +1 -0
  99. package/dist/models/groq-provider.d.ts.map +1 -1
  100. package/dist/models/manager.d.ts +13 -2
  101. package/dist/models/manager.d.ts.map +1 -1
  102. package/dist/models/manager.js +20 -8
  103. package/dist/models/openai-provider.d.ts +2 -5
  104. package/dist/models/openai-provider.d.ts.map +1 -1
  105. package/dist/models/openai-provider.js +0 -52
  106. package/dist/models/opencode-go-provider.d.ts +25 -0
  107. package/dist/models/opencode-go-provider.d.ts.map +1 -0
  108. package/dist/models/opencode-go-provider.js +78 -0
  109. package/dist/models/opencode-zen-provider.d.ts +7 -3
  110. package/dist/models/opencode-zen-provider.d.ts.map +1 -1
  111. package/dist/models/opencode-zen-provider.js +49 -10
  112. package/dist/models/openrouter-provider.d.ts +27 -31
  113. package/dist/models/openrouter-provider.d.ts.map +1 -1
  114. package/dist/models/openrouter-provider.js +121 -180
  115. package/dist/models/providers.d.ts +3 -3
  116. package/dist/models/providers.d.ts.map +1 -1
  117. package/dist/models/providers.js +6 -0
  118. package/dist/models/xai-provider.d.ts +4 -3
  119. package/dist/models/xai-provider.d.ts.map +1 -1
  120. package/dist/models/xai-provider.js +18 -18
  121. package/dist/modes/manager.d.ts +24 -0
  122. package/dist/modes/manager.d.ts.map +1 -0
  123. package/dist/modes/manager.js +77 -0
  124. package/dist/modes/prompts.d.ts +2 -0
  125. package/dist/modes/prompts.d.ts.map +1 -0
  126. package/dist/modes/prompts.js +142 -0
  127. package/dist/prompts/mentions.d.ts +11 -0
  128. package/dist/prompts/mentions.d.ts.map +1 -0
  129. package/dist/{mentions.js → prompts/mentions.js} +55 -85
  130. package/dist/{prompts.d.ts → prompts/system-prompt.d.ts} +7 -2
  131. package/dist/prompts/system-prompt.d.ts.map +1 -0
  132. package/dist/{prompts.js → prompts/system-prompt.js} +31 -16
  133. package/dist/repl/index.d.ts +174 -0
  134. package/dist/repl/index.d.ts.map +1 -0
  135. package/dist/{repl-new.js → repl/index.js} +397 -76
  136. package/dist/repl/project-status.d.ts +1 -0
  137. package/dist/repl/project-status.d.ts.map +1 -1
  138. package/dist/repl/project-status.js +4 -1
  139. package/dist/sessions/manager.d.ts +92 -0
  140. package/dist/sessions/manager.d.ts.map +1 -1
  141. package/dist/sessions/manager.js +262 -9
  142. package/dist/sessions/summary.d.ts +4 -0
  143. package/dist/sessions/summary.d.ts.map +1 -0
  144. package/dist/sessions/summary.js +30 -0
  145. package/dist/skills/index.d.ts +29 -0
  146. package/dist/skills/index.d.ts.map +1 -0
  147. package/dist/skills/index.js +294 -0
  148. package/dist/subagents/index.d.ts +16 -0
  149. package/dist/subagents/index.d.ts.map +1 -0
  150. package/dist/subagents/index.js +231 -0
  151. package/dist/terminal/control.d.ts +1 -1
  152. package/dist/terminal/control.d.ts.map +1 -1
  153. package/dist/terminal/control.js +3 -3
  154. package/dist/terminal/east-asian-width.d.ts.map +1 -1
  155. package/dist/terminal/east-asian-width.js +404 -351
  156. package/dist/terminal/keys.d.ts +17 -0
  157. package/dist/terminal/keys.d.ts.map +1 -1
  158. package/dist/terminal/keys.js +37 -0
  159. package/dist/terminal/select-prompt.d.ts.map +1 -1
  160. package/dist/terminal/select-prompt.js +24 -12
  161. package/dist/terminal/string-width.d.ts.map +1 -1
  162. package/dist/terminal/string-width.js +25 -27
  163. package/dist/terminal/style.d.ts.map +1 -1
  164. package/dist/terminal/style.js +4 -7
  165. package/dist/terminal/supports-color.d.ts.map +1 -1
  166. package/dist/terminal/supports-color.js +41 -27
  167. package/dist/terminal/table/cell.d.ts +12 -0
  168. package/dist/terminal/table/cell.d.ts.map +1 -1
  169. package/dist/terminal/table/cell.js +40 -25
  170. package/dist/terminal/table/layout-manager.d.ts.map +1 -1
  171. package/dist/terminal/table/layout-manager.js +100 -68
  172. package/dist/terminal/table/utils.d.ts +1 -1
  173. package/dist/terminal/table/utils.d.ts.map +1 -1
  174. package/dist/terminal/table/utils.js +17 -10
  175. package/dist/terminal/wrap-ansi.d.ts.map +1 -1
  176. package/dist/terminal/wrap-ansi.js +174 -105
  177. package/dist/tokens/tracker.d.ts +1 -0
  178. package/dist/tokens/tracker.d.ts.map +1 -1
  179. package/dist/tokens/tracker.js +3 -0
  180. package/dist/tools/agent.d.ts +27 -0
  181. package/dist/tools/agent.d.ts.map +1 -0
  182. package/dist/tools/agent.js +81 -0
  183. package/dist/tools/apply-patch.d.ts +62 -0
  184. package/dist/tools/apply-patch.d.ts.map +1 -0
  185. package/dist/tools/apply-patch.js +377 -0
  186. package/dist/tools/bash.d.ts +4 -3
  187. package/dist/tools/bash.d.ts.map +1 -1
  188. package/dist/tools/bash.js +349 -141
  189. package/dist/tools/directory-tree.d.ts +3 -3
  190. package/dist/tools/directory-tree.d.ts.map +1 -1
  191. package/dist/tools/directory-tree.js +8 -5
  192. package/dist/tools/dynamic-tool-loader.d.ts +3 -6
  193. package/dist/tools/dynamic-tool-loader.d.ts.map +1 -1
  194. package/dist/tools/dynamic-tool-loader.js +20 -4
  195. package/dist/tools/edit-file.d.ts +7 -7
  196. package/dist/tools/edit-file.d.ts.map +1 -1
  197. package/dist/tools/edit-file.js +292 -85
  198. package/dist/tools/glob.d.ts +6 -6
  199. package/dist/tools/glob.d.ts.map +1 -1
  200. package/dist/tools/glob.js +110 -63
  201. package/dist/tools/grep.d.ts +15 -12
  202. package/dist/tools/grep.d.ts.map +1 -1
  203. package/dist/tools/grep.js +315 -193
  204. package/dist/tools/index.d.ts +114 -9
  205. package/dist/tools/index.d.ts.map +1 -1
  206. package/dist/tools/index.js +39 -24
  207. package/dist/tools/ls.d.ts +2 -2
  208. package/dist/tools/ls.d.ts.map +1 -1
  209. package/dist/tools/ls.js +7 -5
  210. package/dist/tools/read-file.d.ts +4 -6
  211. package/dist/tools/read-file.d.ts.map +1 -1
  212. package/dist/tools/read-file.js +84 -39
  213. package/dist/tools/save-file.d.ts +3 -3
  214. package/dist/tools/save-file.d.ts.map +1 -1
  215. package/dist/tools/save-file.js +36 -31
  216. package/dist/tools/skill.d.ts +23 -0
  217. package/dist/tools/skill.d.ts.map +1 -0
  218. package/dist/tools/skill.js +65 -0
  219. package/dist/tools/think.d.ts.map +1 -1
  220. package/dist/tools/think.js +2 -9
  221. package/dist/tools/utils.d.ts +2 -0
  222. package/dist/tools/utils.d.ts.map +1 -1
  223. package/dist/tools/utils.js +12 -0
  224. package/dist/tools/web-fetch.d.ts +50 -0
  225. package/dist/tools/web-fetch.d.ts.map +1 -0
  226. package/dist/tools/web-fetch.js +446 -0
  227. package/dist/tools/web-search.d.ts +44 -0
  228. package/dist/tools/web-search.d.ts.map +1 -0
  229. package/dist/tools/web-search.js +226 -0
  230. package/dist/tui/autocomplete/attachment-provider.d.ts +3 -6
  231. package/dist/tui/autocomplete/attachment-provider.d.ts.map +1 -1
  232. package/dist/tui/autocomplete/attachment-provider.js +25 -78
  233. package/dist/tui/autocomplete/base-provider.d.ts +1 -0
  234. package/dist/tui/autocomplete/base-provider.d.ts.map +1 -1
  235. package/dist/tui/autocomplete/combined-provider.d.ts +1 -4
  236. package/dist/tui/autocomplete/combined-provider.d.ts.map +1 -1
  237. package/dist/tui/autocomplete/combined-provider.js +3 -17
  238. package/dist/tui/autocomplete/command-provider.d.ts +1 -0
  239. package/dist/tui/autocomplete/command-provider.d.ts.map +1 -1
  240. package/dist/tui/autocomplete/command-provider.js +3 -0
  241. package/dist/tui/autocomplete/file-search-provider.d.ts +2 -1
  242. package/dist/tui/autocomplete/file-search-provider.d.ts.map +1 -1
  243. package/dist/tui/autocomplete/file-search-provider.js +37 -17
  244. package/dist/tui/autocomplete/skill-provider.d.ts +17 -0
  245. package/dist/tui/autocomplete/skill-provider.d.ts.map +1 -0
  246. package/dist/tui/autocomplete/skill-provider.js +49 -0
  247. package/dist/tui/autocomplete/utils.d.ts +2 -1
  248. package/dist/tui/autocomplete/utils.d.ts.map +1 -1
  249. package/dist/tui/autocomplete/utils.js +25 -23
  250. package/dist/tui/autocomplete.d.ts +2 -2
  251. package/dist/tui/autocomplete.d.ts.map +1 -1
  252. package/dist/tui/autocomplete.js +3 -5
  253. package/dist/tui/components/assistant-message.d.ts.map +1 -1
  254. package/dist/tui/components/assistant-message.js +0 -4
  255. package/dist/tui/components/editor.d.ts +18 -3
  256. package/dist/tui/components/editor.d.ts.map +1 -1
  257. package/dist/tui/components/editor.js +211 -237
  258. package/dist/tui/components/footer.d.ts +6 -4
  259. package/dist/tui/components/footer.d.ts.map +1 -1
  260. package/dist/tui/components/footer.js +49 -25
  261. package/dist/tui/components/markdown.d.ts +10 -7
  262. package/dist/tui/components/markdown.d.ts.map +1 -1
  263. package/dist/tui/components/markdown.js +57 -39
  264. package/dist/tui/components/modal.d.ts.map +1 -1
  265. package/dist/tui/components/modal.js +35 -33
  266. package/dist/tui/components/notification.d.ts +13 -2
  267. package/dist/tui/components/notification.d.ts.map +1 -1
  268. package/dist/tui/components/notification.js +36 -2
  269. package/dist/tui/components/progress-bar.js +1 -1
  270. package/dist/tui/components/select-list.d.ts +1 -0
  271. package/dist/tui/components/select-list.d.ts.map +1 -1
  272. package/dist/tui/components/select-list.js +14 -11
  273. package/dist/tui/components/text.d.ts +16 -0
  274. package/dist/tui/components/text.d.ts.map +1 -1
  275. package/dist/tui/components/text.js +72 -57
  276. package/dist/tui/components/thinking-block.d.ts +9 -0
  277. package/dist/tui/components/thinking-block.d.ts.map +1 -1
  278. package/dist/tui/components/thinking-block.js +43 -11
  279. package/dist/tui/components/tool-execution.d.ts +5 -1
  280. package/dist/tui/components/tool-execution.d.ts.map +1 -1
  281. package/dist/tui/components/tool-execution.js +19 -10
  282. package/dist/tui/components/user-message.d.ts.map +1 -1
  283. package/dist/tui/components/user-message.js +0 -3
  284. package/dist/tui/components/welcome.d.ts +2 -1
  285. package/dist/tui/components/welcome.d.ts.map +1 -1
  286. package/dist/tui/components/welcome.js +2 -2
  287. package/dist/tui/editor-launcher.d.ts +3 -2
  288. package/dist/tui/editor-launcher.d.ts.map +1 -1
  289. package/dist/tui/index.d.ts +0 -1
  290. package/dist/tui/index.d.ts.map +1 -1
  291. package/dist/tui/terminal.d.ts.map +1 -1
  292. package/dist/tui/terminal.js +10 -2
  293. package/dist/tui/tui.d.ts +43 -0
  294. package/dist/tui/tui.d.ts.map +1 -1
  295. package/dist/tui/tui.js +166 -41
  296. package/dist/tui/utils.d.ts +1 -5
  297. package/dist/tui/utils.d.ts.map +1 -1
  298. package/dist/tui/utils.js +271 -44
  299. package/dist/utils/bash/parse.d.ts +19 -0
  300. package/dist/utils/bash/parse.d.ts.map +1 -0
  301. package/dist/utils/bash/parse.js +223 -0
  302. package/dist/utils/bash/quote.d.ts +6 -0
  303. package/dist/utils/bash/quote.d.ts.map +1 -0
  304. package/dist/utils/bash/quote.js +23 -0
  305. package/dist/utils/bash.d.ts.map +1 -1
  306. package/dist/utils/bash.js +211 -126
  307. package/dist/utils/command-protection.d.ts +28 -0
  308. package/dist/utils/command-protection.d.ts.map +1 -0
  309. package/dist/utils/command-protection.js +324 -0
  310. package/dist/utils/dedent.d.ts.map +1 -0
  311. package/dist/utils/env-expand.d.ts +2 -0
  312. package/dist/utils/env-expand.d.ts.map +1 -0
  313. package/dist/utils/env-expand.js +8 -0
  314. package/dist/utils/filesystem/path-display.d.ts +11 -0
  315. package/dist/utils/filesystem/path-display.d.ts.map +1 -0
  316. package/dist/utils/filesystem/path-display.js +32 -0
  317. package/dist/utils/filesystem/security.d.ts +2 -2
  318. package/dist/utils/filesystem/security.d.ts.map +1 -1
  319. package/dist/utils/filesystem/security.js +28 -30
  320. package/dist/utils/formatting.d.ts.map +1 -0
  321. package/dist/{formatting.js → utils/formatting.js} +1 -1
  322. package/dist/utils/git.d.ts +4 -0
  323. package/dist/utils/git.d.ts.map +1 -1
  324. package/dist/utils/git.js +30 -0
  325. package/dist/utils/glob.d.ts +1 -1
  326. package/dist/utils/glob.d.ts.map +1 -1
  327. package/dist/utils/logger.d.ts.map +1 -0
  328. package/dist/{logger.js → utils/logger.js} +1 -1
  329. package/dist/utils/parsing.d.ts.map +1 -0
  330. package/dist/utils/process.d.ts.map +1 -1
  331. package/dist/utils/process.js +90 -37
  332. package/dist/utils/templates.d.ts +2 -0
  333. package/dist/utils/templates.d.ts.map +1 -0
  334. package/dist/utils/templates.js +24 -0
  335. package/dist/utils/version.d.ts.map +1 -0
  336. package/dist/{version.js → utils/version.js} +1 -1
  337. package/package.json +35 -26
  338. package/dist/cli.d.ts +0 -23
  339. package/dist/cli.d.ts.map +0 -1
  340. package/dist/commands/add-directory/types.d.ts +0 -6
  341. package/dist/commands/add-directory/types.d.ts.map +0 -1
  342. package/dist/commands/add-directory/types.js +0 -1
  343. package/dist/commands/copy/types.d.ts +0 -3
  344. package/dist/commands/copy/types.d.ts.map +0 -1
  345. package/dist/commands/copy/types.js +0 -1
  346. package/dist/commands/exit/index.d.ts +0 -10
  347. package/dist/commands/exit/index.d.ts.map +0 -1
  348. package/dist/commands/exit/index.js +0 -21
  349. package/dist/commands/exit/types.d.ts +0 -8
  350. package/dist/commands/exit/types.d.ts.map +0 -1
  351. package/dist/commands/exit/types.js +0 -1
  352. package/dist/commands/exit/utils.d.ts +0 -2
  353. package/dist/commands/exit/utils.d.ts.map +0 -1
  354. package/dist/commands/exit/utils.js +0 -13
  355. package/dist/commands/prompt/index.d.ts +0 -5
  356. package/dist/commands/prompt/index.d.ts.map +0 -1
  357. package/dist/commands/prompt/index.js +0 -122
  358. package/dist/commands/prompt/types.d.ts +0 -15
  359. package/dist/commands/prompt/types.d.ts.map +0 -1
  360. package/dist/commands/prompt/types.js +0 -1
  361. package/dist/commands/prompt/utils.d.ts +0 -12
  362. package/dist/commands/prompt/utils.d.ts.map +0 -1
  363. package/dist/commands/prompt/utils.js +0 -107
  364. package/dist/commands/reset/index.d.ts +0 -3
  365. package/dist/commands/reset/index.d.ts.map +0 -1
  366. package/dist/commands/reset/index.js +0 -25
  367. package/dist/commands/reset/types.d.ts +0 -1
  368. package/dist/commands/reset/types.d.ts.map +0 -1
  369. package/dist/commands/reset/types.js +0 -3
  370. package/dist/commands/review/types.d.ts +0 -12
  371. package/dist/commands/review/types.d.ts.map +0 -1
  372. package/dist/commands/review/types.js +0 -1
  373. package/dist/commands/save/index.d.ts +0 -3
  374. package/dist/commands/save/index.d.ts.map +0 -1
  375. package/dist/commands/save/index.js +0 -19
  376. package/dist/config.d.ts.map +0 -1
  377. package/dist/dedent.d.ts.map +0 -1
  378. package/dist/formatting.d.ts.map +0 -1
  379. package/dist/logger.d.ts.map +0 -1
  380. package/dist/mentions.d.ts +0 -14
  381. package/dist/mentions.d.ts.map +0 -1
  382. package/dist/parsing.d.ts.map +0 -1
  383. package/dist/prompts.d.ts.map +0 -1
  384. package/dist/repl-new.d.ts +0 -65
  385. package/dist/repl-new.d.ts.map +0 -1
  386. package/dist/skills.d.ts +0 -16
  387. package/dist/skills.d.ts.map +0 -1
  388. package/dist/skills.js +0 -233
  389. package/dist/stdin.d.ts.map +0 -1
  390. package/dist/tui/autocomplete/path-provider.d.ts +0 -21
  391. package/dist/tui/autocomplete/path-provider.d.ts.map +0 -1
  392. package/dist/tui/autocomplete/path-provider.js +0 -164
  393. package/dist/utils/iterables.d.ts +0 -2
  394. package/dist/utils/iterables.d.ts.map +0 -1
  395. package/dist/utils/iterables.js +0 -6
  396. package/dist/version.d.ts.map +0 -1
  397. /package/dist/{dedent.d.ts → utils/dedent.d.ts} +0 -0
  398. /package/dist/{dedent.js → utils/dedent.js} +0 -0
  399. /package/dist/{formatting.d.ts → utils/formatting.d.ts} +0 -0
  400. /package/dist/{logger.d.ts → utils/logger.d.ts} +0 -0
  401. /package/dist/{parsing.d.ts → utils/parsing.d.ts} +0 -0
  402. /package/dist/{parsing.js → utils/parsing.js} +0 -0
  403. /package/dist/{version.d.ts → utils/version.d.ts} +0 -0
@@ -0,0 +1,186 @@
1
+ import { join } from "node:path";
2
+ import { initExecutionEnvironment } from "../../execution/index.js";
3
+ import { getTerminalSize } from "../../terminal/control.js";
4
+ import style from "../../terminal/style.js";
5
+ import { Markdown } from "../../tui/components/markdown.js";
6
+ import { Spacer } from "../../tui/components/spacer.js";
7
+ import { Container, SelectList, Text, } from "../../tui/index.js";
8
+ import { formatFileDiffForDisplay, getUntrackedFiles, openFileInEditor, parseGitDiffFiles, } from "./utils.js";
9
+ export async function showReviewPanel(tui, container, inputContainer, editor) {
10
+ try {
11
+ const execEnv = await initExecutionEnvironment();
12
+ const stagedResult = await execEnv.executeCommand("git diff --cached", {
13
+ cwd: process.cwd(),
14
+ timeout: 5000,
15
+ preserveOutputOnError: true,
16
+ captureStderr: true,
17
+ throwOnError: false,
18
+ });
19
+ const unstagedResult = await execEnv.executeCommand("git diff", {
20
+ cwd: process.cwd(),
21
+ timeout: 5000,
22
+ preserveOutputOnError: true,
23
+ captureStderr: true,
24
+ throwOnError: false,
25
+ });
26
+ const untrackedResult = await execEnv.executeCommand("git ls-files --others --exclude-standard", {
27
+ cwd: process.cwd(),
28
+ timeout: 5000,
29
+ preserveOutputOnError: true,
30
+ captureStderr: true,
31
+ throwOnError: false,
32
+ });
33
+ const stagedOutput = stagedResult.exitCode === 0 ? stagedResult.output : "";
34
+ const unstagedOutput = unstagedResult.exitCode === 0 ? unstagedResult.output : "";
35
+ const untrackedOutput = untrackedResult.exitCode === 0 ? untrackedResult.output : "";
36
+ const combinedOutput = stagedOutput +
37
+ (stagedOutput && unstagedOutput ? "\n" : "") +
38
+ unstagedOutput;
39
+ if (!combinedOutput.trim()) {
40
+ container.addChild(new Spacer(1));
41
+ container.addChild(new Markdown("No changes detected in the current directory.", {
42
+ customBgRgb: {
43
+ r: 52,
44
+ g: 53,
45
+ b: 65,
46
+ },
47
+ paddingX: 1,
48
+ paddingY: 1,
49
+ }));
50
+ tui.requestRender();
51
+ return;
52
+ }
53
+ const fileChanges = parseGitDiffFiles(combinedOutput);
54
+ const untrackedFiles = await getUntrackedFiles(untrackedOutput, process.cwd());
55
+ fileChanges.push(...untrackedFiles);
56
+ if (fileChanges.length === 0) {
57
+ container.addChild(new Spacer(1));
58
+ container.addChild(new Markdown("No file changes could be parsed.", {
59
+ customBgRgb: {
60
+ r: 52,
61
+ g: 53,
62
+ b: 65,
63
+ },
64
+ paddingX: 1,
65
+ paddingY: 1,
66
+ }));
67
+ tui.requestRender();
68
+ return;
69
+ }
70
+ const selectItems = fileChanges.map((file) => ({
71
+ value: file.fileName,
72
+ label: file.fileName,
73
+ description: file.stats,
74
+ }));
75
+ const selectList = new SelectList(selectItems, 10);
76
+ const selectContainer = new Container();
77
+ const { columns } = getTerminalSize();
78
+ selectContainer.addChild(new Text(style.blue("─".repeat(columns)), 0, 0));
79
+ selectContainer.addChild(new Spacer(1));
80
+ selectContainer.addChild(selectList);
81
+ selectContainer.addChild(new Spacer(1));
82
+ selectContainer.addChild(new Text(style.blue("─".repeat(columns)), 0, 0));
83
+ const originalEditor = editor;
84
+ inputContainer.clear();
85
+ inputContainer.addChild(selectContainer);
86
+ tui.setFocus(selectList);
87
+ selectList.onSelect = (selectedItem) => {
88
+ const selectedFile = fileChanges.find((file) => file.fileName === selectedItem.value);
89
+ if (!selectedFile) {
90
+ container.addChild(new Spacer(1));
91
+ container.addChild(new Markdown(style.red("Error: Selected file not found."), {
92
+ customBgRgb: {
93
+ r: 52,
94
+ g: 53,
95
+ b: 65,
96
+ },
97
+ paddingX: 1,
98
+ paddingY: 1,
99
+ }));
100
+ tui.requestRender();
101
+ return;
102
+ }
103
+ const actionItems = [
104
+ { value: "diff", label: "View diff", description: "Show changes" },
105
+ {
106
+ value: "edit",
107
+ label: "Open in editor",
108
+ description: `Open in ${process.env["EDITOR"] || process.env["VISUAL"] || "vi"}`,
109
+ },
110
+ ];
111
+ const actionSelectList = new SelectList(actionItems, 5);
112
+ const actionContainer = new Container();
113
+ actionContainer.addChild(new Spacer(1));
114
+ actionContainer.addChild(new Text(style.blue(`Selected: ${selectedFile.fileName}`), 0, 0));
115
+ actionContainer.addChild(new Spacer(1));
116
+ actionContainer.addChild(actionSelectList);
117
+ actionContainer.addChild(new Spacer(1));
118
+ actionContainer.addChild(new Text(style.blue("─".repeat(columns)), 0, 0));
119
+ inputContainer.clear();
120
+ inputContainer.addChild(actionContainer);
121
+ tui.setFocus(actionSelectList);
122
+ tui.requestRender();
123
+ actionSelectList.onSelect = (actionItem) => {
124
+ if (actionItem.value === "diff") {
125
+ container.addChild(new Spacer(1));
126
+ container.addChild(new Markdown(formatFileDiffForDisplay(selectedFile.fileName, selectedFile.diff), {
127
+ customBgRgb: {
128
+ r: 52,
129
+ g: 53,
130
+ b: 65,
131
+ },
132
+ paddingX: 1,
133
+ paddingY: 1,
134
+ }));
135
+ }
136
+ else if (actionItem.value === "edit") {
137
+ const filePath = join(process.cwd(), selectedFile.fileName);
138
+ const result = openFileInEditor(filePath, tui.getTerminal());
139
+ if (!result.success) {
140
+ container.addChild(new Spacer(1));
141
+ container.addChild(new Markdown(`Failed to open file in editor: ${result.error || "Unknown error"}`, {
142
+ customBgRgb: {
143
+ r: 52,
144
+ g: 53,
145
+ b: 65,
146
+ },
147
+ paddingX: 1,
148
+ paddingY: 1,
149
+ }));
150
+ }
151
+ }
152
+ inputContainer.clear();
153
+ inputContainer.addChild(originalEditor);
154
+ tui.setFocus(originalEditor);
155
+ tui.requestRender();
156
+ };
157
+ actionSelectList.onCancel = () => {
158
+ inputContainer.clear();
159
+ inputContainer.addChild(selectContainer);
160
+ tui.setFocus(selectList);
161
+ tui.requestRender();
162
+ };
163
+ };
164
+ selectList.onCancel = () => {
165
+ inputContainer.clear();
166
+ inputContainer.addChild(originalEditor);
167
+ tui.setFocus(originalEditor);
168
+ tui.requestRender();
169
+ };
170
+ tui.requestRender();
171
+ }
172
+ catch (error) {
173
+ console.error("Error executing git diff:", error);
174
+ container.addChild(new Spacer(1));
175
+ container.addChild(new Markdown("Failed to retrieve git changes. Ensure git is installed and initialized.", {
176
+ customBgRgb: {
177
+ r: 52,
178
+ g: 53,
179
+ b: 65,
180
+ },
181
+ paddingX: 1,
182
+ paddingY: 1,
183
+ }));
184
+ tui.requestRender();
185
+ }
186
+ }
@@ -1,4 +1,18 @@
1
- import type { FileChange } from "./types.ts";
1
+ import type { Terminal } from "../../tui/terminal.ts";
2
+ interface FileChange {
3
+ fileName: string;
4
+ diff: string;
5
+ stats: string;
6
+ }
2
7
  export declare function parseGitDiffFiles(diffOutput: string): FileChange[];
3
8
  export declare function formatFileDiffForDisplay(fileName: string, diff: string): string;
9
+ export declare function getUntrackedFiles(untrackedOutput: string, cwd: string): Promise<FileChange[]>;
10
+ /**
11
+ * Open a file in the user's preferred editor ($EDITOR or $VISUAL)
12
+ */
13
+ export declare function openFileInEditor(filePath: string, terminal: Terminal): {
14
+ success: boolean;
15
+ error?: string;
16
+ };
17
+ export {};
4
18
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../source/commands/review/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,UAAU,EAAE,CAuDlE;AAED,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,GACX,MAAM,CAgCR"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../source/commands/review/utils.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEtD,UAAU,UAAU;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AA6CD,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,UAAU,EAAE,CAwBlE;AAgBD,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,GACX,MAAM,CAaR;AAED,wBAAsB,iBAAiB,CACrC,eAAe,EAAE,MAAM,EACvB,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,UAAU,EAAE,CAAC,CAsCvB;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,QAAQ,GACjB;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAyBtC"}
@@ -1,87 +1,146 @@
1
+ import { spawnSync } from "node:child_process";
2
+ import fs from "node:fs";
3
+ import { join } from "node:path";
4
+ function isDiffContentLine(line) {
5
+ return ((line.startsWith("+") && !line.startsWith("+++")) ||
6
+ (line.startsWith("-") && !line.startsWith("---")) ||
7
+ line.startsWith(" ") ||
8
+ line.startsWith("index") ||
9
+ line.startsWith("old mode") ||
10
+ line.startsWith("new mode") ||
11
+ line.startsWith("deleted file") ||
12
+ line.startsWith("new file"));
13
+ }
14
+ function parseHunkStats(line, isNewFile) {
15
+ const statsMatch = line.match(/@@ -(\d+),(\d+) \+(\d+),(\d+) @@/);
16
+ if (!statsMatch) {
17
+ return "Additions: 1, Deletions: 0";
18
+ }
19
+ const deletions = isNewFile ? 0 : Number.parseInt(statsMatch[2], 10);
20
+ const additions = Number.parseInt(statsMatch[4], 10);
21
+ return `Additions: ${additions}, Deletions: ${deletions}`;
22
+ }
23
+ function startNewFile(state, line) {
24
+ if (state.currentFile) {
25
+ state.fileChanges.push(state.currentFile);
26
+ }
27
+ const fileMatch = line.match(/diff --git a\/(.*) b\/(.*)/);
28
+ if (!fileMatch)
29
+ return;
30
+ state.currentFile = { fileName: fileMatch[1], diff: "", stats: "" };
31
+ state.inDiff = true;
32
+ state.isNewFile =
33
+ fileMatch[1] === "/dev/null" || fileMatch[2] === "/dev/null";
34
+ }
1
35
  export function parseGitDiffFiles(diffOutput) {
2
36
  const lines = diffOutput.split("\n");
3
- const fileChanges = [];
4
- let currentFile = null;
5
- let inDiff = false;
6
- let isNewFile = false;
37
+ const state = {
38
+ fileChanges: [],
39
+ currentFile: null,
40
+ inDiff: false,
41
+ isNewFile: false,
42
+ };
7
43
  for (const line of lines) {
8
44
  if (line.startsWith("diff --git")) {
9
- if (currentFile) {
10
- fileChanges.push(currentFile);
11
- }
12
- const fileMatch = line.match(/diff --git a\/(.*) b\/(.*)/);
13
- if (fileMatch) {
14
- currentFile = {
15
- fileName: fileMatch[1],
16
- diff: "",
17
- stats: "",
18
- };
19
- inDiff = true;
20
- isNewFile =
21
- fileMatch[1] === "/dev/null" || fileMatch[2] === "/dev/null";
22
- }
45
+ startNewFile(state, line);
23
46
  }
24
- else if (line.startsWith("@@")) {
25
- const statsMatch = line.match(/@@ -(\d+),(\d+) \+(\d+),(\d+) @@/);
26
- if (statsMatch && currentFile) {
27
- const deletions = Number.parseInt(statsMatch[2], 10);
28
- const additions = Number.parseInt(statsMatch[4], 10);
29
- const actualDeletions = isNewFile ? 0 : deletions;
30
- currentFile.stats = `Additions: ${additions}, Deletions: ${actualDeletions}`;
31
- }
32
- else if (currentFile) {
33
- currentFile.stats = "Additions: 1, Deletions: 0";
34
- }
47
+ else if (line.startsWith("@@") && state.currentFile) {
48
+ state.currentFile.stats = parseHunkStats(line, state.isNewFile);
35
49
  }
36
- else if (inDiff && currentFile) {
37
- if ((line.startsWith("+") && !line.startsWith("+++")) ||
38
- (line.startsWith("-") && !line.startsWith("---")) ||
39
- line.startsWith(" ") ||
40
- line.startsWith("index") ||
41
- line.startsWith("old mode") ||
42
- line.startsWith("new mode") ||
43
- line.startsWith("deleted file") ||
44
- line.startsWith("new file")) {
45
- currentFile.diff += `${line}\n`;
46
- }
50
+ else if (state.inDiff && state.currentFile && isDiffContentLine(line)) {
51
+ state.currentFile.diff += `${line}\n`;
47
52
  }
48
53
  }
49
- if (currentFile) {
50
- fileChanges.push(currentFile);
54
+ if (state.currentFile) {
55
+ state.fileChanges.push(state.currentFile);
51
56
  }
52
- return fileChanges;
57
+ return state.fileChanges;
58
+ }
59
+ function formatDiffLine(line) {
60
+ if (line.trim() === "")
61
+ return null;
62
+ if (line.startsWith("+") && !line.startsWith("+++")) {
63
+ return `+${line.substring(1)}`;
64
+ }
65
+ if (line.startsWith("-") && !line.startsWith("---")) {
66
+ return `-${line.substring(1)}`;
67
+ }
68
+ if (line.startsWith(" ")) {
69
+ return ` ${line.substring(1)}`;
70
+ }
71
+ return line;
53
72
  }
54
73
  export function formatFileDiffForDisplay(fileName, diff) {
55
- // Note: Cannot use style here as it's a UI concern - this is a display utility
56
74
  const lines = diff.split("\n");
57
- const formattedLines = [];
58
- formattedLines.push(`### ${fileName}`);
59
- formattedLines.push("");
75
+ const formattedLines = [`### ${fileName}`, "", "```diff"];
60
76
  for (const line of lines) {
61
- if (line.startsWith("+") && !line.startsWith("+++")) {
62
- formattedLines.push(`+${line.substring(1)}`);
63
- }
64
- else if (line.startsWith("-") && !line.startsWith("---")) {
65
- formattedLines.push(`-${line.substring(1)}`);
77
+ const formatted = formatDiffLine(line);
78
+ if (formatted !== null) {
79
+ formattedLines.push(formatted);
66
80
  }
67
- else if (line.startsWith(" ")) {
68
- formattedLines.push(` ${line.substring(1)}`);
69
- }
70
- else if (line.startsWith("@@")) {
71
- formattedLines.push(line);
72
- }
73
- else if (line.startsWith("index") ||
74
- line.startsWith("old mode") ||
75
- line.startsWith("new mode") ||
76
- line.startsWith("deleted file") ||
77
- line.startsWith("new file")) {
78
- formattedLines.push(line);
81
+ }
82
+ formattedLines.push("```");
83
+ return formattedLines.join("\n");
84
+ }
85
+ export async function getUntrackedFiles(untrackedOutput, cwd) {
86
+ const fileChanges = [];
87
+ const untrackedFiles = untrackedOutput
88
+ .trim()
89
+ .split("\n")
90
+ .filter((file) => file.length > 0);
91
+ for (const fileName of untrackedFiles) {
92
+ try {
93
+ const filePath = join(cwd, fileName);
94
+ const fileContent = await fs.promises.readFile(filePath, "utf-8");
95
+ const lines = fileContent.split("\n").length;
96
+ // Create a diff-like representation for the untracked file
97
+ const diff = `diff --git a/${fileName} b/${fileName}
98
+ new file mode 100644
99
+ index 0000000..0000000
100
+ --- /dev/null
101
+ +++ b/${fileName}
102
+ @@ -0,0 +1,${lines} @@
103
+ ${fileContent
104
+ .split("\n")
105
+ .map((line) => `+${line}`)
106
+ .join("\n")}
107
+ `;
108
+ fileChanges.push({
109
+ fileName,
110
+ diff,
111
+ stats: `Additions: ${lines}, Deletions: 0`,
112
+ });
79
113
  }
80
- else if (line.trim() === "") {
114
+ catch (error) {
115
+ // Skip files that can't be read (e.g., directories, binary files)
116
+ console.error(`Failed to read untracked file: ${fileName}`, error);
81
117
  }
82
- else {
83
- formattedLines.push(line);
118
+ }
119
+ return fileChanges;
120
+ }
121
+ /**
122
+ * Open a file in the user's preferred editor ($EDITOR or $VISUAL)
123
+ */
124
+ export function openFileInEditor(filePath, terminal) {
125
+ const editor = process.env["EDITOR"] || process.env["VISUAL"] || "vi";
126
+ terminal.enterExternalMode();
127
+ try {
128
+ const result = spawnSync(editor, [filePath], {
129
+ stdio: "inherit",
130
+ });
131
+ if (result.error) {
132
+ return { success: false, error: result.error.message };
84
133
  }
134
+ // Note: Editors often exit with non-zero codes (e.g., :cq in vim, or when
135
+ // quitting without saving). We only treat spawn errors as failures, not
136
+ // exit codes, since the user may intentionally exit with an error code.
137
+ return { success: true };
138
+ }
139
+ catch (error) {
140
+ const errorMessage = error instanceof Error ? error.message : "Unknown error";
141
+ return { success: false, error: errorMessage };
142
+ }
143
+ finally {
144
+ terminal.exitExternalMode();
85
145
  }
86
- return formattedLines.join("\n");
87
146
  }
@@ -1,3 +1,3 @@
1
1
  import type { CommandOptions, ReplCommand } from "../types.ts";
2
- export declare function sessionCommand({ config, tokenCounter, modelManager, sessionManager: messageHistory, workspace, tokenTracker, }: CommandOptions): ReplCommand;
2
+ export declare function sessionCommand({ config, tokenCounter, modelManager, sessionManager, workspace, tokenTracker, }: CommandOptions): ReplCommand;
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/commands/session/index.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAI/D,wBAAgB,cAAc,CAAC,EAC7B,MAAM,EACN,YAAY,EACZ,YAAY,EACZ,cAAc,EAAE,cAAc,EAC9B,SAAS,EACT,YAAY,GACb,EAAE,cAAc,GAAG,WAAW,CAkR9B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/commands/session/index.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAoH/D,wBAAgB,cAAc,CAAC,EAC7B,MAAM,EACN,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,SAAS,EACT,YAAY,GACb,EAAE,cAAc,GAAG,WAAW,CAgK9B"}