@travisennis/acai 0.0.5 → 0.0.7

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 (421) hide show
  1. package/README.md +190 -19
  2. package/bin/acai-wrapper.js +26 -0
  3. package/dist/agent/index.d.ts +132 -0
  4. package/dist/agent/index.d.ts.map +1 -0
  5. package/dist/agent/index.js +434 -0
  6. package/dist/api/exa/index.js +1 -1
  7. package/dist/cli.d.ts +4 -1
  8. package/dist/cli.d.ts.map +1 -1
  9. package/dist/cli.js +67 -40
  10. package/dist/commands/add-directory-command.d.ts +3 -0
  11. package/dist/commands/add-directory-command.d.ts.map +1 -0
  12. package/dist/commands/add-directory-command.js +54 -0
  13. package/dist/commands/application-log-command.d.ts +1 -1
  14. package/dist/commands/application-log-command.d.ts.map +1 -1
  15. package/dist/commands/application-log-command.js +18 -20
  16. package/dist/commands/clear-command.d.ts +1 -1
  17. package/dist/commands/clear-command.d.ts.map +1 -1
  18. package/dist/commands/clear-command.js +7 -3
  19. package/dist/commands/compact-command.d.ts.map +1 -1
  20. package/dist/commands/compact-command.js +9 -5
  21. package/dist/commands/context-command.d.ts +3 -0
  22. package/dist/commands/context-command.d.ts.map +1 -0
  23. package/dist/commands/context-command.js +124 -0
  24. package/dist/commands/copy-command.d.ts.map +1 -1
  25. package/dist/commands/copy-command.js +14 -5
  26. package/dist/commands/edit-command.d.ts +1 -1
  27. package/dist/commands/edit-command.d.ts.map +1 -1
  28. package/dist/commands/edit-command.js +21 -34
  29. package/dist/commands/edit-prompt-command.d.ts +1 -1
  30. package/dist/commands/edit-prompt-command.d.ts.map +1 -1
  31. package/dist/commands/edit-prompt-command.js +18 -15
  32. package/dist/commands/exit-command.d.ts +1 -4
  33. package/dist/commands/exit-command.d.ts.map +1 -1
  34. package/dist/commands/exit-command.js +9 -5
  35. package/dist/commands/files-command.d.ts +1 -1
  36. package/dist/commands/files-command.d.ts.map +1 -1
  37. package/dist/commands/files-command.js +20 -16
  38. package/dist/commands/generate-rules-command.d.ts +1 -1
  39. package/dist/commands/generate-rules-command.d.ts.map +1 -1
  40. package/dist/commands/generate-rules-command.js +307 -39
  41. package/dist/commands/handoff-command.d.ts +3 -0
  42. package/dist/commands/handoff-command.d.ts.map +1 -0
  43. package/dist/commands/handoff-command.js +191 -0
  44. package/dist/commands/health-command.d.ts +1 -1
  45. package/dist/commands/health-command.d.ts.map +1 -1
  46. package/dist/commands/health-command.js +49 -27
  47. package/dist/commands/help-command.d.ts +1 -1
  48. package/dist/commands/help-command.d.ts.map +1 -1
  49. package/dist/commands/help-command.js +25 -5
  50. package/dist/commands/history-command.d.ts +3 -0
  51. package/dist/commands/history-command.d.ts.map +1 -0
  52. package/dist/commands/history-command.js +458 -0
  53. package/dist/commands/init-command.d.ts +1 -1
  54. package/dist/commands/init-command.d.ts.map +1 -1
  55. package/dist/commands/init-command.js +40 -22
  56. package/dist/commands/last-log-command.d.ts +1 -1
  57. package/dist/commands/last-log-command.d.ts.map +1 -1
  58. package/dist/commands/last-log-command.js +15 -15
  59. package/dist/commands/list-directories-command.d.ts +3 -0
  60. package/dist/commands/list-directories-command.d.ts.map +1 -0
  61. package/dist/commands/list-directories-command.js +35 -0
  62. package/dist/commands/list-tools-command.d.ts.map +1 -1
  63. package/dist/commands/list-tools-command.js +61 -21
  64. package/dist/commands/manager.d.ts +9 -4
  65. package/dist/commands/manager.d.ts.map +1 -1
  66. package/dist/commands/manager.js +64 -39
  67. package/dist/commands/model-command.d.ts.map +1 -1
  68. package/dist/commands/model-command.js +201 -66
  69. package/dist/commands/paste-command.d.ts +1 -1
  70. package/dist/commands/paste-command.d.ts.map +1 -1
  71. package/dist/commands/paste-command.js +23 -9
  72. package/dist/commands/pickup-command.d.ts +3 -0
  73. package/dist/commands/pickup-command.d.ts.map +1 -0
  74. package/dist/commands/pickup-command.js +109 -0
  75. package/dist/commands/prompt-command.d.ts +19 -1
  76. package/dist/commands/prompt-command.d.ts.map +1 -1
  77. package/dist/commands/prompt-command.js +191 -98
  78. package/dist/commands/remove-directory-command.d.ts +3 -0
  79. package/dist/commands/remove-directory-command.d.ts.map +1 -0
  80. package/dist/commands/remove-directory-command.js +55 -0
  81. package/dist/commands/reset-command.d.ts +1 -1
  82. package/dist/commands/reset-command.d.ts.map +1 -1
  83. package/dist/commands/reset-command.js +8 -5
  84. package/dist/commands/rules-command.d.ts +1 -1
  85. package/dist/commands/rules-command.d.ts.map +1 -1
  86. package/dist/commands/rules-command.js +25 -22
  87. package/dist/commands/save-command.d.ts +1 -1
  88. package/dist/commands/save-command.d.ts.map +1 -1
  89. package/dist/commands/save-command.js +8 -3
  90. package/dist/commands/shell-command.d.ts.map +1 -1
  91. package/dist/commands/shell-command.js +45 -24
  92. package/dist/commands/types.d.ts +9 -7
  93. package/dist/commands/types.d.ts.map +1 -1
  94. package/dist/commands/usage-command.d.ts +1 -1
  95. package/dist/commands/usage-command.d.ts.map +1 -1
  96. package/dist/commands/usage-command.js +18 -7
  97. package/dist/config.d.ts +21 -11
  98. package/dist/config.d.ts.map +1 -1
  99. package/dist/config.js +90 -63
  100. package/dist/execution/index.d.ts +17 -2
  101. package/dist/execution/index.d.ts.map +1 -1
  102. package/dist/execution/index.js +62 -20
  103. package/dist/formatting.d.ts +127 -0
  104. package/dist/formatting.d.ts.map +1 -1
  105. package/dist/formatting.js +201 -0
  106. package/dist/index.d.ts +7 -2
  107. package/dist/index.d.ts.map +1 -1
  108. package/dist/index.js +263 -102
  109. package/dist/logger.d.ts.map +1 -1
  110. package/dist/logger.js +47 -18
  111. package/dist/mentions.d.ts +2 -1
  112. package/dist/mentions.d.ts.map +1 -1
  113. package/dist/mentions.js +16 -1
  114. package/dist/messages.d.ts +11 -0
  115. package/dist/messages.d.ts.map +1 -1
  116. package/dist/messages.js +122 -21
  117. package/dist/middleware/cache.d.ts +3 -0
  118. package/dist/middleware/cache.d.ts.map +1 -0
  119. package/dist/middleware/cache.js +53 -0
  120. package/dist/middleware/index.d.ts +1 -0
  121. package/dist/middleware/index.d.ts.map +1 -1
  122. package/dist/middleware/index.js +1 -0
  123. package/dist/models/ai-config.d.ts +4 -2
  124. package/dist/models/ai-config.d.ts.map +1 -1
  125. package/dist/models/ai-config.js +12 -2
  126. package/dist/models/anthropic-provider.d.ts.map +1 -1
  127. package/dist/models/anthropic-provider.js +3 -67
  128. package/dist/models/deepseek-provider.d.ts.map +1 -1
  129. package/dist/models/deepseek-provider.js +0 -2
  130. package/dist/models/google-provider.d.ts.map +1 -1
  131. package/dist/models/google-provider.js +0 -3
  132. package/dist/models/groq-provider.d.ts.map +1 -1
  133. package/dist/models/groq-provider.js +0 -1
  134. package/dist/models/manager.d.ts +2 -1
  135. package/dist/models/manager.d.ts.map +1 -1
  136. package/dist/models/manager.js +26 -2
  137. package/dist/models/openai-provider.d.ts.map +1 -1
  138. package/dist/models/openai-provider.js +0 -4
  139. package/dist/models/openrouter-provider.d.ts +16 -22
  140. package/dist/models/openrouter-provider.d.ts.map +1 -1
  141. package/dist/models/openrouter-provider.js +175 -236
  142. package/dist/models/providers.d.ts +4 -14
  143. package/dist/models/providers.d.ts.map +1 -1
  144. package/dist/models/providers.js +1 -57
  145. package/dist/models/xai-provider.d.ts.map +1 -1
  146. package/dist/models/xai-provider.js +0 -2
  147. package/dist/prompts.d.ts +10 -4
  148. package/dist/prompts.d.ts.map +1 -1
  149. package/dist/prompts.js +447 -70
  150. package/dist/repl/project-status-line.d.ts +3 -0
  151. package/dist/repl/project-status-line.d.ts.map +1 -0
  152. package/dist/repl/project-status-line.js +61 -0
  153. package/dist/repl/tool-call-repair.d.ts.map +1 -1
  154. package/dist/repl/tool-call-repair.js +8 -4
  155. package/dist/repl-new.d.ts +51 -0
  156. package/dist/repl-new.d.ts.map +1 -0
  157. package/dist/repl-new.js +354 -0
  158. package/dist/skills.d.ts +20 -0
  159. package/dist/skills.d.ts.map +1 -0
  160. package/dist/skills.js +192 -0
  161. package/dist/terminal/control.d.ts +55 -0
  162. package/dist/terminal/control.d.ts.map +1 -0
  163. package/dist/terminal/control.js +109 -0
  164. package/dist/terminal/default-theme.d.ts +1 -1
  165. package/dist/terminal/default-theme.d.ts.map +1 -1
  166. package/dist/terminal/default-theme.js +24 -28
  167. package/dist/terminal/formatting.d.ts +23 -25
  168. package/dist/terminal/formatting.d.ts.map +1 -1
  169. package/dist/terminal/formatting.js +35 -52
  170. package/dist/terminal/highlight/index.d.ts.map +1 -1
  171. package/dist/terminal/highlight/index.js +3 -6
  172. package/dist/terminal/highlight/theme.d.ts.map +1 -1
  173. package/dist/terminal/highlight/theme.js +2 -6
  174. package/dist/terminal/index.d.ts +2 -94
  175. package/dist/terminal/index.d.ts.map +1 -1
  176. package/dist/terminal/index.js +2 -370
  177. package/dist/terminal/markdown.js +10 -5
  178. package/dist/terminal/select-prompt.d.ts +2 -2
  179. package/dist/terminal/select-prompt.d.ts.map +1 -1
  180. package/dist/terminal/select-prompt.js +47 -39
  181. package/dist/terminal/strip-ansi.js +4 -4
  182. package/dist/terminal/table/cell.d.ts +114 -0
  183. package/dist/terminal/table/cell.d.ts.map +1 -0
  184. package/dist/terminal/table/cell.js +407 -0
  185. package/dist/terminal/table/debug.d.ts +15 -0
  186. package/dist/terminal/table/debug.d.ts.map +1 -0
  187. package/dist/terminal/table/debug.js +32 -0
  188. package/dist/terminal/table/index.d.ts +3 -0
  189. package/dist/terminal/table/index.d.ts.map +1 -0
  190. package/dist/terminal/table/index.js +2 -0
  191. package/dist/terminal/table/layout-manager.d.ts +27 -0
  192. package/dist/terminal/table/layout-manager.d.ts.map +1 -0
  193. package/dist/terminal/table/layout-manager.js +257 -0
  194. package/dist/terminal/table/table.d.ts +9 -0
  195. package/dist/terminal/table/table.d.ts.map +1 -0
  196. package/dist/terminal/table/table.js +97 -0
  197. package/dist/terminal/table/utils.d.ts +63 -0
  198. package/dist/terminal/table/utils.d.ts.map +1 -0
  199. package/dist/terminal/table/utils.js +326 -0
  200. package/dist/tokens/threshold.d.ts +20 -0
  201. package/dist/tokens/threshold.d.ts.map +1 -0
  202. package/dist/tokens/threshold.js +67 -0
  203. package/dist/tools/advanced-edit-file.d.ts +69 -0
  204. package/dist/tools/advanced-edit-file.d.ts.map +1 -0
  205. package/dist/tools/advanced-edit-file.js +285 -0
  206. package/dist/tools/agent.d.ts +16 -5
  207. package/dist/tools/agent.d.ts.map +1 -1
  208. package/dist/tools/agent.js +86 -59
  209. package/dist/tools/bash.d.ts +23 -12
  210. package/dist/tools/bash.d.ts.map +1 -1
  211. package/dist/tools/bash.js +243 -128
  212. package/dist/tools/batch.d.ts +34 -0
  213. package/dist/tools/batch.d.ts.map +1 -0
  214. package/dist/tools/batch.js +174 -0
  215. package/dist/tools/code-interpreter.d.ts +21 -9
  216. package/dist/tools/code-interpreter.d.ts.map +1 -1
  217. package/dist/tools/code-interpreter.js +151 -134
  218. package/dist/tools/delete-file.d.ts +17 -10
  219. package/dist/tools/delete-file.d.ts.map +1 -1
  220. package/dist/tools/delete-file.js +60 -97
  221. package/dist/tools/directory-tree.d.ts +17 -12
  222. package/dist/tools/directory-tree.d.ts.map +1 -1
  223. package/dist/tools/directory-tree.js +57 -48
  224. package/dist/tools/dynamic-tool-loader.d.ts +16 -10
  225. package/dist/tools/dynamic-tool-loader.d.ts.map +1 -1
  226. package/dist/tools/dynamic-tool-loader.js +122 -130
  227. package/dist/tools/dynamic-tool-parser.d.ts +1 -0
  228. package/dist/tools/dynamic-tool-parser.d.ts.map +1 -1
  229. package/dist/tools/dynamic-tool-parser.js +1 -0
  230. package/dist/tools/edit-file.d.ts +35 -15
  231. package/dist/tools/edit-file.d.ts.map +1 -1
  232. package/dist/tools/edit-file.js +127 -114
  233. package/dist/tools/glob.d.ts +36 -0
  234. package/dist/tools/glob.d.ts.map +1 -0
  235. package/dist/tools/glob.js +154 -0
  236. package/dist/tools/grep.d.ts +73 -12
  237. package/dist/tools/grep.d.ts.map +1 -1
  238. package/dist/tools/grep.js +425 -165
  239. package/dist/tools/index.d.ts +220 -126
  240. package/dist/tools/index.d.ts.map +1 -1
  241. package/dist/tools/index.js +284 -135
  242. package/dist/tools/llm-edit-fixer.d.ts +24 -0
  243. package/dist/tools/llm-edit-fixer.d.ts.map +1 -0
  244. package/dist/tools/llm-edit-fixer.js +136 -0
  245. package/dist/tools/move-file.d.ts +19 -7
  246. package/dist/tools/move-file.d.ts.map +1 -1
  247. package/dist/tools/move-file.js +48 -34
  248. package/dist/tools/read-file.d.ts +47 -9
  249. package/dist/tools/read-file.d.ts.map +1 -1
  250. package/dist/tools/read-file.js +84 -70
  251. package/dist/tools/read-multiple-files.d.ts +17 -6
  252. package/dist/tools/read-multiple-files.d.ts.map +1 -1
  253. package/dist/tools/read-multiple-files.js +132 -72
  254. package/dist/tools/save-file.d.ts +45 -12
  255. package/dist/tools/save-file.d.ts.map +1 -1
  256. package/dist/tools/save-file.js +76 -101
  257. package/dist/tools/think.d.ts +15 -7
  258. package/dist/tools/think.d.ts.map +1 -1
  259. package/dist/tools/think.js +34 -20
  260. package/dist/tools/types.d.ts +8 -10
  261. package/dist/tools/types.d.ts.map +1 -1
  262. package/dist/tools/types.js +9 -0
  263. package/dist/tools/utils.d.ts +14 -0
  264. package/dist/tools/utils.d.ts.map +1 -0
  265. package/dist/tools/utils.js +16 -0
  266. package/dist/tools/web-fetch.d.ts +11 -4
  267. package/dist/tools/web-fetch.d.ts.map +1 -1
  268. package/dist/tools/web-fetch.js +39 -38
  269. package/dist/tools/web-search.d.ts +15 -6
  270. package/dist/tools/web-search.d.ts.map +1 -1
  271. package/dist/tools/web-search.js +64 -31
  272. package/dist/tui/autocomplete.d.ts +44 -0
  273. package/dist/tui/autocomplete.d.ts.map +1 -0
  274. package/dist/tui/autocomplete.js +466 -0
  275. package/dist/tui/components/assistant-message.d.ts +18 -0
  276. package/dist/tui/components/assistant-message.d.ts.map +1 -0
  277. package/dist/tui/components/assistant-message.js +29 -0
  278. package/dist/tui/components/box.d.ts +20 -0
  279. package/dist/tui/components/box.d.ts.map +1 -0
  280. package/dist/tui/components/box.js +81 -0
  281. package/dist/tui/components/editor.d.ts +106 -0
  282. package/dist/tui/components/editor.d.ts.map +1 -0
  283. package/dist/tui/components/editor.js +1220 -0
  284. package/dist/tui/components/footer.d.ts +12 -0
  285. package/dist/tui/components/footer.d.ts.map +1 -0
  286. package/dist/tui/components/footer.js +209 -0
  287. package/dist/tui/components/header.d.ts +21 -0
  288. package/dist/tui/components/header.d.ts.map +1 -0
  289. package/dist/tui/components/header.js +63 -0
  290. package/dist/tui/components/input.d.ts +14 -0
  291. package/dist/tui/components/input.d.ts.map +1 -0
  292. package/dist/tui/components/input.js +122 -0
  293. package/dist/tui/components/loader.d.ts +23 -0
  294. package/dist/tui/components/loader.d.ts.map +1 -0
  295. package/dist/tui/components/loader.js +45 -0
  296. package/dist/tui/components/markdown.d.ts +106 -0
  297. package/dist/tui/components/markdown.d.ts.map +1 -0
  298. package/dist/tui/components/markdown.js +586 -0
  299. package/dist/tui/components/modal.d.ts +29 -0
  300. package/dist/tui/components/modal.d.ts.map +1 -0
  301. package/dist/tui/components/modal.js +263 -0
  302. package/dist/tui/components/progress-bar.d.ts +19 -0
  303. package/dist/tui/components/progress-bar.d.ts.map +1 -0
  304. package/dist/tui/components/progress-bar.js +78 -0
  305. package/dist/tui/components/prompt-status.d.ts +17 -0
  306. package/dist/tui/components/prompt-status.d.ts.map +1 -0
  307. package/dist/tui/components/prompt-status.js +26 -0
  308. package/dist/tui/components/select-list.d.ts +48 -0
  309. package/dist/tui/components/select-list.d.ts.map +1 -0
  310. package/dist/tui/components/select-list.js +207 -0
  311. package/dist/tui/components/spacer.d.ts +16 -0
  312. package/dist/tui/components/spacer.d.ts.map +1 -0
  313. package/dist/tui/components/spacer.js +27 -0
  314. package/dist/tui/components/table.d.ts +27 -0
  315. package/dist/tui/components/table.d.ts.map +1 -0
  316. package/dist/tui/components/table.js +125 -0
  317. package/dist/tui/components/text.d.ts +26 -0
  318. package/dist/tui/components/text.d.ts.map +1 -0
  319. package/dist/tui/components/text.js +143 -0
  320. package/dist/tui/components/thinking-block.d.ts +14 -0
  321. package/dist/tui/components/thinking-block.d.ts.map +1 -0
  322. package/dist/tui/components/thinking-block.js +33 -0
  323. package/dist/tui/components/tool-execution.d.ts +21 -0
  324. package/dist/tui/components/tool-execution.d.ts.map +1 -0
  325. package/dist/tui/components/tool-execution.js +161 -0
  326. package/dist/tui/components/user-message.d.ts +9 -0
  327. package/dist/tui/components/user-message.d.ts.map +1 -0
  328. package/dist/tui/components/user-message.js +23 -0
  329. package/dist/tui/components/welcome.d.ts +6 -0
  330. package/dist/tui/components/welcome.d.ts.map +1 -0
  331. package/dist/tui/components/welcome.js +30 -0
  332. package/dist/tui/index.d.ts +18 -0
  333. package/dist/tui/index.d.ts.map +1 -0
  334. package/dist/tui/index.js +22 -0
  335. package/dist/tui/terminal.d.ts +38 -0
  336. package/dist/tui/terminal.d.ts.map +1 -0
  337. package/dist/tui/terminal.js +94 -0
  338. package/dist/tui/tui.d.ts +69 -0
  339. package/dist/tui/tui.d.ts.map +1 -0
  340. package/dist/tui/tui.js +204 -0
  341. package/dist/tui/utils.d.ts +24 -0
  342. package/dist/tui/utils.d.ts.map +1 -0
  343. package/dist/tui/utils.js +111 -0
  344. package/dist/utils/bash.d.ts +7 -0
  345. package/dist/utils/bash.d.ts.map +1 -0
  346. package/dist/{tools/bash-utils.js → utils/bash.js} +31 -12
  347. package/dist/utils/{filesystem.d.ts → filesystem/operations.d.ts} +1 -1
  348. package/dist/utils/filesystem/operations.d.ts.map +1 -0
  349. package/dist/utils/filesystem/security.d.ts +9 -0
  350. package/dist/utils/filesystem/security.d.ts.map +1 -0
  351. package/dist/{tools/filesystem-utils.js → utils/filesystem/security.js} +93 -21
  352. package/dist/utils/funcs.d.ts +6 -0
  353. package/dist/utils/funcs.d.ts.map +1 -0
  354. package/dist/utils/funcs.js +6 -0
  355. package/dist/utils/generators.d.ts +3 -0
  356. package/dist/utils/generators.d.ts.map +1 -0
  357. package/dist/utils/generators.js +25 -0
  358. package/dist/{tools/git-utils.d.ts → utils/git.d.ts} +1 -1
  359. package/dist/utils/git.d.ts.map +1 -0
  360. package/dist/{tools/git-utils.js → utils/git.js} +0 -6
  361. package/dist/utils/glob.js +1 -1
  362. package/dist/utils/iterables.d.ts +2 -0
  363. package/dist/utils/iterables.d.ts.map +1 -0
  364. package/dist/utils/iterables.js +6 -0
  365. package/dist/utils/{zod-utils.d.ts → zod.d.ts} +1 -1
  366. package/dist/utils/zod.d.ts.map +1 -0
  367. package/package.json +21 -21
  368. package/dist/conversation-analyzer.d.ts +0 -11
  369. package/dist/conversation-analyzer.d.ts.map +0 -1
  370. package/dist/conversation-analyzer.js +0 -88
  371. package/dist/repl/display-tool-messages.d.ts +0 -4
  372. package/dist/repl/display-tool-messages.d.ts.map +0 -1
  373. package/dist/repl/display-tool-messages.js +0 -55
  374. package/dist/repl/display-tool-use.d.ts +0 -14
  375. package/dist/repl/display-tool-use.d.ts.map +0 -1
  376. package/dist/repl/display-tool-use.js +0 -63
  377. package/dist/repl/get-prompt-header.d.ts +0 -8
  378. package/dist/repl/get-prompt-header.d.ts.map +0 -1
  379. package/dist/repl/get-prompt-header.js +0 -38
  380. package/dist/repl-prompt.d.ts +0 -15
  381. package/dist/repl-prompt.d.ts.map +0 -1
  382. package/dist/repl-prompt.js +0 -147
  383. package/dist/repl.d.ts +0 -31
  384. package/dist/repl.d.ts.map +0 -1
  385. package/dist/repl.js +0 -310
  386. package/dist/terminal/checkbox-prompt.d.ts +0 -36
  387. package/dist/terminal/checkbox-prompt.d.ts.map +0 -1
  388. package/dist/terminal/checkbox-prompt.js +0 -362
  389. package/dist/terminal/editor-prompt.d.ts +0 -10
  390. package/dist/terminal/editor-prompt.d.ts.map +0 -1
  391. package/dist/terminal/editor-prompt.js +0 -61
  392. package/dist/terminal/errors.d.ts +0 -19
  393. package/dist/terminal/errors.d.ts.map +0 -1
  394. package/dist/terminal/errors.js +0 -37
  395. package/dist/terminal/input-prompt.d.ts +0 -16
  396. package/dist/terminal/input-prompt.d.ts.map +0 -1
  397. package/dist/terminal/input-prompt.js +0 -181
  398. package/dist/terminal/search-prompt.d.ts +0 -20
  399. package/dist/terminal/search-prompt.d.ts.map +0 -1
  400. package/dist/terminal/search-prompt.js +0 -279
  401. package/dist/terminal/types.d.ts +0 -35
  402. package/dist/terminal/types.d.ts.map +0 -1
  403. package/dist/terminal/types.js +0 -1
  404. package/dist/tokens/manage-output.d.ts +0 -34
  405. package/dist/tokens/manage-output.d.ts.map +0 -1
  406. package/dist/tokens/manage-output.js +0 -44
  407. package/dist/tool-executor.d.ts +0 -28
  408. package/dist/tool-executor.d.ts.map +0 -1
  409. package/dist/tool-executor.js +0 -74
  410. package/dist/tools/bash-utils.d.ts +0 -7
  411. package/dist/tools/bash-utils.d.ts.map +0 -1
  412. package/dist/tools/file-editing-utils.d.ts +0 -2
  413. package/dist/tools/file-editing-utils.d.ts.map +0 -1
  414. package/dist/tools/file-editing-utils.js +0 -135
  415. package/dist/tools/filesystem-utils.d.ts +0 -7
  416. package/dist/tools/filesystem-utils.d.ts.map +0 -1
  417. package/dist/tools/git-utils.d.ts.map +0 -1
  418. package/dist/utils/filesystem.d.ts.map +0 -1
  419. package/dist/utils/zod-utils.d.ts.map +0 -1
  420. /package/dist/utils/{filesystem.js → filesystem/operations.js} +0 -0
  421. /package/dist/utils/{zod-utils.js → zod.js} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/terminal/highlight/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAyDxC;;GAEG;AACH,UAAU,gBAAgB;IACxB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAE1B;;;OAGG;IACH,KAAK,EAAE,KAAK,CAAC;CACd;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,GAAG,MAAM,CAWzE;AAED;;GAEG;AACH,wBAAgB,aAAa,IAAI,MAAM,EAAE,CAExC;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEtD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/terminal/highlight/index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAoDxC;;GAEG;AACH,UAAU,gBAAgB;IACxB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAE1B;;;OAGG;IACH,KAAK,EAAE,KAAK,CAAC;CACd;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,GAAG,MAAM,CAWzE;AAED;;GAEG;AACH,wBAAgB,aAAa,IAAI,MAAM,EAAE,CAExC;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEtD"}
@@ -1,16 +1,13 @@
1
1
  import hljs from "highlight.js";
2
2
  import * as parse5 from "parse5";
3
3
  import { adapter as htmlparser2Adapter } from "parse5-htmlparser2-tree-adapter";
4
- /**
5
- * Identity function for tokens that should not be styled (returns the input string as-is).
6
- */
7
- const plain = (codePart) => codePart;
4
+ import { id } from "../../utils/funcs.js";
8
5
  function colorizeNode(node, theme, context) {
9
6
  switch (node.type) {
10
7
  case "text": {
11
8
  const text = node.data;
12
9
  if (context === undefined) {
13
- return (theme.default || plain)(text);
10
+ return (theme.default || id)(text);
14
11
  }
15
12
  return text;
16
13
  }
@@ -24,7 +21,7 @@ function colorizeNode(node, theme, context) {
24
21
  ?.map((childNode) => colorizeNode(childNode, theme, token))
25
22
  .join("") || "";
26
23
  const themeToken = theme[token];
27
- const themeFn = themeToken || plain;
24
+ const themeFn = themeToken || id;
28
25
  return themeFn(nodeData);
29
26
  }
30
27
  }
@@ -1 +1 @@
1
- {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../source/terminal/highlight/theme.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,UAAU,MAAM,CAAC,CAAC;IAChB;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,CAAC;IAEZ;;OAEG;IAEH,QAAQ,CAAC,EAAE,CAAC,CAAC;IAEb;;OAEG;IACH,IAAI,CAAC,EAAE,CAAC,CAAC;IAET;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,CAAC;IAEZ;;OAEG;IACH,MAAM,CAAC,EAAE,CAAC,CAAC;IAEX;;OAEG;IACH,MAAM,CAAC,EAAE,CAAC,CAAC;IAEX;;OAEG;IACH,MAAM,CAAC,EAAE,CAAC,CAAC;IAEX;;OAEG;IACH,KAAK,CAAC,EAAE,CAAC,CAAC;IAEV;;OAEG;IACH,MAAM,CAAC,EAAE,CAAC,CAAC;IAEX;;OAEG;IACH,KAAK,CAAC,EAAE,CAAC,CAAC;IAEV;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,CAAC;IAEb;;OAEG;IACH,KAAK,CAAC,EAAE,CAAC,CAAC;IAEV;;OAEG;IACH,MAAM,CAAC,EAAE,CAAC,CAAC;IAEX;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,CAAC;IAEZ;;OAEG;IACH,MAAM,CAAC,EAAE,CAAC,CAAC;IAEX;;OAEG;IACH,IAAI,CAAC,EAAE,CAAC,CAAC;IAET;;OAEG;IACH,cAAc,CAAC,EAAE,CAAC,CAAC;IAEnB;;OAEG;IACH,aAAa,CAAC,EAAE,CAAC,CAAC;IAElB;;OAEG;IACH,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AAC,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAC;IACjE;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAC;CACxC;AA0CD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,CAE9C;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK,CAEzC"}
@@ -1,9 +1,5 @@
1
+ import { id } from "../../utils/funcs.js";
1
2
  import style from "../style.js";
2
- /**
3
- * Identity function for tokens that should not be styled (returns the input string as-is).
4
- * See [[Theme]] for an example.
5
- */
6
- const plain = (codePart) => codePart;
7
3
  /**
8
4
  * Converts a [[JsonTheme]] with string values to a [[Theme]] with formatter functions. Used by [[parse]].
9
5
  */
@@ -16,7 +12,7 @@ function fromJson(json) {
16
12
  // biome-ignore lint/suspicious/noExplicitAny: Dynamic theme access needed for highlight compatibility
17
13
  theme[key] = styleValue.reduce((previous, current) =>
18
14
  // biome-ignore lint/suspicious/noExplicitAny: Dynamic theme access needed for highlight compatibility
19
- current === "plain" ? plain : previous[current], style);
15
+ current === "plain" ? id : previous[current], style);
20
16
  }
21
17
  else {
22
18
  // biome-ignore lint/suspicious/noExplicitAny: Dynamic theme access needed for highlight compatibility
@@ -4,98 +4,6 @@
4
4
  * Provides a user interface for interacting with Claude Code in the terminal.
5
5
  * Handles input/output, formatting, and display.
6
6
  */
7
- import { type StyleInstance } from "./style.ts";
8
- import type { TerminalConfig } from "./types.ts";
9
- export declare function getShell(): string;
10
- /**
11
- * Initialize the terminal interface
12
- */
13
- export declare function initTerminal(config?: Partial<TerminalConfig>): Terminal;
14
- /**
15
- * Terminal class for handling user interaction
16
- */
17
- export declare class Terminal {
18
- private config;
19
- private terminalWidth;
20
- private terminalHeight;
21
- private isInteractive;
22
- constructor(config: TerminalConfig);
23
- /**
24
- * Detect terminal capabilities
25
- */
26
- detectCapabilities(): void;
27
- setTitle(title: string): void;
28
- getLogo(): string;
29
- /**
30
- * Display the welcome message
31
- */
32
- displayWelcome(): void;
33
- /**
34
- * Clear the terminal screen
35
- */
36
- clear(): void;
37
- /**
38
- * Start progress indicator in terminal
39
- * Sends terminal escape sequence to show progress animation
40
- */
41
- startProgress(): void;
42
- /**
43
- * Stop progress indicator in terminal
44
- * Sends terminal escape sequence to hide progress animation
45
- */
46
- stopProgress(): void;
47
- /**
48
- * Display formatted content
49
- */
50
- display(content: string, wrap?: boolean): void;
51
- /**
52
- * Display a message with emphasis
53
- */
54
- emphasize(message: string): void;
55
- /**
56
- * Display an informational message
57
- */
58
- info(message: string): void;
59
- /**
60
- * Display a success message
61
- */
62
- success(message: string): void;
63
- /**
64
- * Display a warning message
65
- */
66
- warn(message: string): void;
67
- /**
68
- * Display an error message
69
- */
70
- error(message: string): void;
71
- /**
72
- * Emits an alert.
73
- */
74
- alert(): void;
75
- write(input: string): void;
76
- writeln(input: string): void;
77
- lineBreak(): void;
78
- header(header: string, styleFn?: StyleInstance): void;
79
- box(header: string, content: string): Promise<void>;
80
- hr(styleFn?: StyleInstance): void;
81
- /**
82
- * Create a clickable link in the terminal if supported
83
- */
84
- link(text: string, url: string): string;
85
- /**
86
- * Display a table of data
87
- */
88
- table(data: (string | number)[][], options?: {
89
- header?: string[];
90
- colWidths?: number[];
91
- }): void;
92
- /**
93
- * Displays a horizontal progress bar in the console.
94
- * @param current The current value.
95
- * @param total The target value.
96
- */
97
- displayProgressBar(current: number, total: number): void;
98
- private formatMarkdown;
99
- }
100
- export * from "./types.ts";
7
+ export { alert, getShell, isInteractive } from "./control.ts";
8
+ export { emphasize, error, hr, info, success, warn } from "./formatting.ts";
101
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/terminal/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAaH,OAAc,EAA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GAAE,aAA0B,GAAG,IAAI;IAQ3D,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAoCzD,EAAE,CAAC,OAAO,GAAE,aAA0B,GAAG,IAAI;IAK7C;;OAEG;IACH,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM;IAIvC;;OAEG;IACH,KAAK,CACH,IAAI,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,EAAE,EAC3B,OAAO,GAAE;QAAE,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,EAAE,CAAA;KAAO,GACxD,IAAI;IAuEP;;;;OAIG;IACH,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAiDxD,OAAO,CAAC,cAAc;CASvB;AAGD,cAAc,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/terminal/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC"}
@@ -4,373 +4,5 @@
4
4
  * Provides a user interface for interacting with Claude Code in the terminal.
5
5
  * Handles input/output, formatting, and display.
6
6
  */
7
- import Table from "cli-table3";
8
- import { logger } from "../logger.js";
9
- import { getPackageVersion } from "../version.js";
10
- import { clearTerminal, getTerminalSize, setTerminalTitle, link as terminalLink, } from "./formatting.js";
11
- import { applyMarkdown } from "./markdown.js";
12
- import stripAnsi from "./strip-ansi.js";
13
- import style from "./style.js";
14
- import wrapAnsi from "./wrap-ansi.js";
15
- export function getShell() {
16
- return process.env["ZSH_VERSION"] ? "zsh" : process.env["SHELL"] || "bash";
17
- }
18
- /**
19
- * Initialize the terminal interface
20
- */
21
- export function initTerminal(config = {}) {
22
- logger.debug("Initializing terminal interface");
23
- const terminalConfig = {
24
- theme: config.theme || "system",
25
- useColors: config.useColors !== false,
26
- showProgressIndicators: config.showProgressIndicators !== false,
27
- codeHighlighting: config.codeHighlighting !== false,
28
- maxHeight: config.maxHeight,
29
- maxWidth: config.maxWidth,
30
- };
31
- const terminal = new Terminal(terminalConfig);
32
- try {
33
- // Detect terminal capabilities
34
- terminal.detectCapabilities();
35
- return terminal;
36
- }
37
- catch (error) {
38
- logger.warn(error, "Error initializing terminal interface:");
39
- // Return a basic terminal interface even if there was an error
40
- return terminal;
41
- }
42
- }
43
- /**
44
- * Terminal class for handling user interaction
45
- */
46
- export class Terminal {
47
- config;
48
- terminalWidth;
49
- terminalHeight;
50
- isInteractive;
51
- constructor(config) {
52
- this.config = config;
53
- // Get initial terminal size
54
- const { rows, columns } = getTerminalSize();
55
- this.terminalHeight = config.maxHeight || rows;
56
- this.terminalWidth = config.maxWidth || columns;
57
- // Assume interactive by default
58
- this.isInteractive = process.stdout.isTTY && process.stdin.isTTY;
59
- // Listen for terminal resize events
60
- process.stdout.on("resize", () => {
61
- const { rows, columns } = getTerminalSize();
62
- this.terminalHeight = config.maxHeight || rows;
63
- this.terminalWidth = config.maxWidth || columns;
64
- logger.debug(`Terminal resized to ${columns}x${rows}`);
65
- });
66
- }
67
- /**
68
- * Detect terminal capabilities
69
- */
70
- detectCapabilities() {
71
- // Check if the terminal is interactive
72
- this.isInteractive = Boolean(process.stdout.isTTY && process.stdin.isTTY);
73
- logger.debug({
74
- isInteractive: this.isInteractive,
75
- colorSupport: this.config.useColors ? "yes" : "no",
76
- size: `${this.terminalWidth}x${this.terminalHeight}`,
77
- }, "Terminal capabilities detected");
78
- }
79
- setTitle(title) {
80
- setTerminalTitle(title);
81
- }
82
- getLogo() {
83
- return `
84
- █████╗ ██████╗ █████╗ ██╗
85
- ██╔══██╗██╔════╝██╔══██╗██║
86
- ███████║██║ ███████║██║
87
- ██╔══██║██║ ██╔══██║██║
88
- ██║ ██║╚██████╗██║ ██║██║
89
- ╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝╚═╝
90
- `;
91
- }
92
- /**
93
- * Display the welcome message
94
- */
95
- displayWelcome() {
96
- this.clear();
97
- const version = getPackageVersion();
98
- this.writeln(style.magenta(this.getLogo()));
99
- this.lineBreak();
100
- this.writeln(style.magenta("Greetings! I am acai."));
101
- this.writeln(style.gray(` Version ${version}`));
102
- this.lineBreak();
103
- this.writeln(style.white(` Type ${style.cyan("/help")} to see available commands.`));
104
- this.writeln(style.white(" You can ask acai to explain code, fix issues, or perform tasks."));
105
- this.writeln(style.white(` Example: "${style.italic("Please analyze this codebase and explain its structure.")}"`));
106
- this.writeln(style.dim(" Use Ctrl+C to interrupt acai and exit."));
107
- this.lineBreak();
108
- this.writeln(style.yellow(`The current working directory is ${process.cwd()}`));
109
- this.lineBreak();
110
- }
111
- /**
112
- * Clear the terminal screen
113
- */
114
- clear() {
115
- if (this.isInteractive) {
116
- clearTerminal();
117
- }
118
- }
119
- /**
120
- * Start progress indicator in terminal
121
- * Sends terminal escape sequence to show progress animation
122
- */
123
- startProgress() {
124
- process.stdout.write("\u001b]9;4;3;0\u0007");
125
- }
126
- /**
127
- * Stop progress indicator in terminal
128
- * Sends terminal escape sequence to hide progress animation
129
- */
130
- stopProgress() {
131
- process.stdout.write("\u001b]9;4;0;0\u0007");
132
- }
133
- /**
134
- * Display formatted content
135
- */
136
- display(content, wrap = false) {
137
- this.writeln(this.formatMarkdown(content, wrap));
138
- }
139
- /**
140
- * Display a message with emphasis
141
- */
142
- emphasize(message) {
143
- if (this.config.useColors) {
144
- this.writeln(style.cyan.bold(message));
145
- }
146
- else {
147
- this.writeln(message.toUpperCase());
148
- }
149
- }
150
- /**
151
- * Display an informational message
152
- */
153
- info(message) {
154
- if (this.config.useColors) {
155
- this.writeln(style.blue(`ℹ ${message}`));
156
- }
157
- else {
158
- this.writeln(`INFO: ${message}`);
159
- }
160
- }
161
- /**
162
- * Display a success message
163
- */
164
- success(message) {
165
- if (this.config.useColors) {
166
- this.writeln(style.green(`✓ ${message}`));
167
- }
168
- else {
169
- this.writeln(`SUCCESS: ${message}`);
170
- }
171
- }
172
- /**
173
- * Display a warning message
174
- */
175
- warn(message) {
176
- if (this.config.useColors) {
177
- this.writeln(style.yellow(`⚠ ${message}`));
178
- }
179
- else {
180
- this.writeln(`WARNING: ${message}`);
181
- }
182
- }
183
- /**
184
- * Display an error message
185
- */
186
- error(message) {
187
- if (this.config.useColors) {
188
- this.writeln(style.red(`✗ ${message}`));
189
- }
190
- else {
191
- this.writeln(`ERROR: ${message}`);
192
- }
193
- }
194
- /**
195
- * Emits an alert.
196
- */
197
- alert() {
198
- if (!this.isInteractive) {
199
- return;
200
- }
201
- const t = "acai";
202
- const b = "";
203
- try {
204
- process.stdout.write("\x07");
205
- const esc = "\u001b";
206
- const bel = "\u0007";
207
- const safe = (s) => s.replaceAll("\u0007", "").replaceAll("\u001b", "");
208
- const payload = `${esc}]777;notify;${safe(t)};${safe(b)}${bel}`;
209
- process.stdout.write(payload);
210
- }
211
- catch (err) {
212
- logger.warn({ err }, "Failed to emit alert");
213
- }
214
- }
215
- write(input) {
216
- process.stdout.write(input);
217
- }
218
- writeln(input) {
219
- process.stdout.write(`${input}\n`);
220
- }
221
- lineBreak() {
222
- this.writeln("");
223
- }
224
- header(header, styleFn = style.cyan) {
225
- const cols = this.terminalWidth > 0 ? this.terminalWidth : 80;
226
- const width = Math.max(0, cols - header.length - 4);
227
- this.writeln(`${style.gray("\n── ")}${styleFn(header)} ${style.gray("─".repeat(width))}`);
228
- }
229
- async box(header, content) {
230
- const cols = this.terminalWidth > 0 ? this.terminalWidth : 80;
231
- const width = Math.max(4, cols - 4);
232
- // Helper to strip ANSI sequences for accurate visible-width calculation
233
- const paddedHeader = ` ${header} `;
234
- const headerVisibleLen = stripAnsi(paddedHeader).length;
235
- const headerStartPos = 1;
236
- // Top border with header (use visible header length)
237
- const leftDashes = headerStartPos;
238
- const rightDashes = Math.max(0, width - leftDashes - headerVisibleLen);
239
- const topBorder = `┌${"─".repeat(leftDashes)}${paddedHeader}${"─".repeat(rightDashes)}┐`;
240
- // Prepare inner content: format markdown first, then wrap to inner width
241
- const innerWidth = Math.max(1, width - 2);
242
- const formatted = applyMarkdown(content);
243
- const wrapped = wrapAnsi(formatted, innerWidth, { trim: false });
244
- const contentLines = wrapped
245
- .split("\n")
246
- .map((line) => {
247
- const visibleLen = stripAnsi(line).length;
248
- const padCount = Math.max(0, innerWidth - visibleLen);
249
- return `│ ${line}${" ".repeat(padCount)} │`;
250
- })
251
- .join("\n");
252
- // Bottom border
253
- const bottomBorder = `└${"─".repeat(width)}┘`;
254
- // Write the box
255
- this.writeln(`${topBorder}\n${contentLines}\n${bottomBorder}`);
256
- }
257
- hr(styleFn = style.gray) {
258
- const cols = this.terminalWidth > 0 ? this.terminalWidth : 80;
259
- this.writeln(styleFn(`${"─".repeat(Math.max(1, cols - 1))} `));
260
- }
261
- /**
262
- * Create a clickable link in the terminal if supported
263
- */
264
- link(text, url) {
265
- return style.underline.blue(terminalLink(text, url));
266
- }
267
- /**
268
- * Display a table of data
269
- */
270
- table(data, options = {}) {
271
- const { header, colWidths } = options;
272
- // Determine number of columns from data or header
273
- let colCount = header?.length;
274
- if (colCount === undefined) {
275
- colCount = data.length > 0 && data[0] ? data[0].length : 1;
276
- }
277
- // Calculate column widths based on terminal width
278
- const padding = 5; // Account for table borders and padding
279
- const availableWidth = Math.max(20, this.terminalWidth - padding);
280
- let computedColWidths;
281
- if (colWidths && colWidths.length === colCount) {
282
- // Use provided percentages
283
- computedColWidths = colWidths.map((percent) => Math.max(10, Math.floor((percent / 100) * availableWidth)));
284
- }
285
- else {
286
- // Distribute width evenly with minimum width per column
287
- const minColWidth = 15;
288
- const maxColsThatFit = Math.floor(availableWidth / minColWidth);
289
- const actualColCount = Math.min(colCount, maxColsThatFit);
290
- if (actualColCount === 1) {
291
- computedColWidths = [availableWidth];
292
- }
293
- else {
294
- // Calculate base width and distribute remaining pixels
295
- const baseWidth = Math.floor(availableWidth / actualColCount);
296
- const remainder = availableWidth % actualColCount;
297
- computedColWidths = Array(actualColCount).fill(baseWidth);
298
- // Distribute remainder pixels to first few columns
299
- for (let i = 0; i < remainder && i < actualColCount; i++) {
300
- computedColWidths[i] = (computedColWidths[i] || 0) + 1;
301
- }
302
- }
303
- // If we have fewer computed widths than columns, extend the array
304
- while (computedColWidths.length < colCount) {
305
- computedColWidths.push(minColWidth);
306
- }
307
- }
308
- const table = new Table({
309
- head: header,
310
- colWidths: computedColWidths,
311
- wordWrap: true,
312
- wrapOnWordBoundary: true,
313
- });
314
- // Ensure all data rows have the same number of columns
315
- const normalizedData = data.map((row) => {
316
- if (row.length < colCount) {
317
- // Pad with empty strings if row has fewer columns
318
- return [...row, ...Array(colCount - row.length).fill("")];
319
- }
320
- if (row.length > colCount) {
321
- // Truncate if row has more columns
322
- return row.slice(0, colCount);
323
- }
324
- return row;
325
- });
326
- table.push(...normalizedData);
327
- this.writeln(table.toString());
328
- }
329
- /**
330
- * Displays a horizontal progress bar in the console.
331
- * @param current The current value.
332
- * @param total The target value.
333
- */
334
- displayProgressBar(current, total) {
335
- const terminalWidth = this.terminalWidth > 0 ? this.terminalWidth : 80; // Default to 80 if columns not available
336
- // Function to format numbers concisely (e.g., 1.2K, 5M)
337
- const formatNumber = (num) => {
338
- if (num < 1000) {
339
- return num.toString();
340
- }
341
- if (num < 1_000_000) {
342
- return `${(num / 1000).toFixed(1)}K`;
343
- }
344
- if (num < 1_000_000_000) {
345
- return `${(num / 1_000_000).toFixed(1)}M`;
346
- }
347
- return `${(num / 1_000_000_000).toFixed(1)}G`;
348
- };
349
- const currentFormatted = formatNumber(current);
350
- const totalFormatted = formatNumber(total);
351
- const progressText = `${currentFormatted}/${totalFormatted}`;
352
- const progressTextLength = progressText.length + 1; // Add 1 for space
353
- const progressBarMaxWidth = Math.max(1, terminalWidth - progressTextLength - 1);
354
- const percentage = total === 0 ? 1 : current / total;
355
- const filledWidth = Math.max(0, Math.min(progressBarMaxWidth, Math.floor(percentage * progressBarMaxWidth)));
356
- const emptyWidth = Math.max(0, progressBarMaxWidth - filledWidth);
357
- const a = filledWidth / progressBarMaxWidth > 0.5
358
- ? style.red("─")
359
- : style.yellow("─"); //"█"
360
- const b = style.gray("─"); // "░"
361
- const filledBar = a.repeat(filledWidth);
362
- const emptyBar = b.repeat(emptyWidth);
363
- // Use \r to move cursor to the beginning of the line for updates
364
- this.writeln(`\r${filledBar}${emptyBar} ${progressText} `);
365
- }
366
- formatMarkdown(content, wrap = false) {
367
- const columns = this.terminalWidth;
368
- const formatted = applyMarkdown(content);
369
- if (wrap) {
370
- return wrapAnsi(formatted, columns - 6, { trim: false });
371
- }
372
- return formatted;
373
- }
374
- }
375
- // Re-export the types
376
- export * from "./types.js";
7
+ export { alert, getShell, isInteractive } from "./control.js";
8
+ export { emphasize, error, hr, info, success, warn } from "./formatting.js";
@@ -1,12 +1,12 @@
1
1
  import { EOL } from "node:os";
2
- import Table from "cli-table3";
3
2
  import { marked } from "marked";
4
3
  import { logger } from "../logger.js";
5
- import { DEFAULT_THEME } from "./default-theme.js";
4
+ import { DEFAULT_HIGHLIGHT_THEME } from "./default-theme.js";
6
5
  import { link as terminalLink } from "./formatting.js";
7
6
  import { highlight, supportsLanguage } from "./highlight/index.js";
8
7
  import { getListNumber } from "./markdown-utils.js";
9
8
  import style from "./style.js";
9
+ import { Table } from "./table/index.js";
10
10
  function logError(msg) {
11
11
  logger.error(msg);
12
12
  }
@@ -28,12 +28,14 @@ function format(token, listDepth = 0, orderedListNumber = null, parent = null) {
28
28
  if (token.lang && supportsLanguage(token.lang)) {
29
29
  return (highlight(token.text, {
30
30
  language: token.lang,
31
- theme: DEFAULT_THEME,
31
+ theme: DEFAULT_HIGHLIGHT_THEME,
32
32
  }) + EOL);
33
33
  }
34
34
  logError(`Language not supported while highlighting code, falling back to markdown: ${token.lang}`);
35
- return (highlight(token.text, { language: "markdown", theme: DEFAULT_THEME }) +
36
- EOL);
35
+ return (highlight(token.text, {
36
+ language: "markdown",
37
+ theme: DEFAULT_HIGHLIGHT_THEME,
38
+ }) + EOL);
37
39
  }
38
40
  case "codespan":
39
41
  // inline code
@@ -109,6 +111,9 @@ function format(token, listDepth = 0, orderedListNumber = null, parent = null) {
109
111
  case "del": {
110
112
  return style.strikethrough(token.text);
111
113
  }
114
+ case "html":
115
+ // Render HTML tags with dim styling and content as normal text
116
+ return style.dim(token.text);
112
117
  default:
113
118
  return "";
114
119
  }
@@ -8,12 +8,12 @@ interface ChoiceObject<T = unknown> {
8
8
  value: T;
9
9
  disabled?: boolean;
10
10
  }
11
- export type Choice<T = unknown> = string | ChoiceObject<T>;
11
+ type Choice<T = unknown> = string | ChoiceObject<T>;
12
12
  interface TerminalIo {
13
13
  stdin: NodeJS.ReadStream;
14
14
  stdout: NodeJS.WriteStream;
15
15
  }
16
- export interface SelectOptions<T = unknown> {
16
+ interface SelectOptions<T = unknown> {
17
17
  message?: string;
18
18
  choices: Choice<T>[];
19
19
  initial?: number;
@@ -1 +1 @@
1
- {"version":3,"file":"select-prompt.d.ts","sourceRoot":"","sources":["../../source/terminal/select-prompt.ts"],"names":[],"mappings":";AACA;;;GAGG;AA6BH,UAAU,YAAY,CAAC,CAAC,GAAG,OAAO;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,CAAC,CAAC;IACT,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AACD,MAAM,MAAM,MAAM,CAAC,CAAC,GAAG,OAAO,IAAI,MAAM,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;AAQ3D,UAAU,UAAU;IAClB,KAAK,EAAE,MAAM,CAAC,UAAU,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC,WAAW,CAAC;CAC5B;AAED,MAAM,WAAW,aAAa,CAAC,CAAC,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