cerebras-cli 1.0.1 → 1.0.4

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 (314) hide show
  1. package/README.md +3 -5
  2. package/cerebras-cli-1.0.0.tgz +0 -0
  3. package/package.json +7 -88
  4. package/AGENTS.md +0 -27
  5. package/Dockerfile +0 -10
  6. package/bunfig.toml +0 -4
  7. package/parsers-config.ts +0 -239
  8. package/script/build.ts +0 -151
  9. package/script/postinstall.mjs +0 -122
  10. package/script/publish.ts +0 -256
  11. package/script/schema.ts +0 -47
  12. package/src/acp/README.md +0 -164
  13. package/src/acp/agent.ts +0 -812
  14. package/src/acp/session.ts +0 -70
  15. package/src/acp/types.ts +0 -22
  16. package/src/agent/agent.ts +0 -310
  17. package/src/agent/generate.txt +0 -75
  18. package/src/auth/index.ts +0 -70
  19. package/src/bun/index.ts +0 -152
  20. package/src/bus/global.ts +0 -10
  21. package/src/bus/index.ts +0 -142
  22. package/src/cli/bootstrap.ts +0 -17
  23. package/src/cli/cmd/acp.ts +0 -88
  24. package/src/cli/cmd/agent.ts +0 -165
  25. package/src/cli/cmd/auth.ts +0 -369
  26. package/src/cli/cmd/cmd.ts +0 -7
  27. package/src/cli/cmd/debug/config.ts +0 -15
  28. package/src/cli/cmd/debug/file.ts +0 -91
  29. package/src/cli/cmd/debug/index.ts +0 -41
  30. package/src/cli/cmd/debug/lsp.ts +0 -47
  31. package/src/cli/cmd/debug/ripgrep.ts +0 -83
  32. package/src/cli/cmd/debug/scrap.ts +0 -15
  33. package/src/cli/cmd/debug/snapshot.ts +0 -48
  34. package/src/cli/cmd/export.ts +0 -88
  35. package/src/cli/cmd/generate.ts +0 -38
  36. package/src/cli/cmd/github.ts +0 -1200
  37. package/src/cli/cmd/import.ts +0 -98
  38. package/src/cli/cmd/mcp.ts +0 -400
  39. package/src/cli/cmd/models.ts +0 -77
  40. package/src/cli/cmd/pr.ts +0 -112
  41. package/src/cli/cmd/run.ts +0 -342
  42. package/src/cli/cmd/serve.ts +0 -31
  43. package/src/cli/cmd/session.ts +0 -106
  44. package/src/cli/cmd/stats.ts +0 -298
  45. package/src/cli/cmd/tui/app.tsx +0 -732
  46. package/src/cli/cmd/tui/attach.ts +0 -25
  47. package/src/cli/cmd/tui/component/border.tsx +0 -21
  48. package/src/cli/cmd/tui/component/dialog-agent.tsx +0 -31
  49. package/src/cli/cmd/tui/component/dialog-command.tsx +0 -124
  50. package/src/cli/cmd/tui/component/dialog-feedback.tsx +0 -160
  51. package/src/cli/cmd/tui/component/dialog-mcp.tsx +0 -86
  52. package/src/cli/cmd/tui/component/dialog-model.tsx +0 -223
  53. package/src/cli/cmd/tui/component/dialog-notification.tsx +0 -78
  54. package/src/cli/cmd/tui/component/dialog-provider.tsx +0 -222
  55. package/src/cli/cmd/tui/component/dialog-session-list.tsx +0 -97
  56. package/src/cli/cmd/tui/component/dialog-session-rename.tsx +0 -31
  57. package/src/cli/cmd/tui/component/dialog-status.tsx +0 -114
  58. package/src/cli/cmd/tui/component/dialog-tag.tsx +0 -44
  59. package/src/cli/cmd/tui/component/dialog-theme-list.tsx +0 -50
  60. package/src/cli/cmd/tui/component/logo.tsx +0 -37
  61. package/src/cli/cmd/tui/component/notification-banner.tsx +0 -58
  62. package/src/cli/cmd/tui/component/prompt/autocomplete.tsx +0 -530
  63. package/src/cli/cmd/tui/component/prompt/history.tsx +0 -107
  64. package/src/cli/cmd/tui/component/prompt/index.tsx +0 -931
  65. package/src/cli/cmd/tui/context/args.tsx +0 -14
  66. package/src/cli/cmd/tui/context/directory.ts +0 -12
  67. package/src/cli/cmd/tui/context/exit.tsx +0 -23
  68. package/src/cli/cmd/tui/context/helper.tsx +0 -25
  69. package/src/cli/cmd/tui/context/keybind.tsx +0 -111
  70. package/src/cli/cmd/tui/context/kv.tsx +0 -49
  71. package/src/cli/cmd/tui/context/local.tsx +0 -339
  72. package/src/cli/cmd/tui/context/prompt.tsx +0 -18
  73. package/src/cli/cmd/tui/context/route.tsx +0 -45
  74. package/src/cli/cmd/tui/context/sdk.tsx +0 -75
  75. package/src/cli/cmd/tui/context/sync.tsx +0 -374
  76. package/src/cli/cmd/tui/context/theme/aura.json +0 -69
  77. package/src/cli/cmd/tui/context/theme/ayu.json +0 -80
  78. package/src/cli/cmd/tui/context/theme/catppuccin-macchiato.json +0 -233
  79. package/src/cli/cmd/tui/context/theme/catppuccin.json +0 -112
  80. package/src/cli/cmd/tui/context/theme/cobalt2.json +0 -228
  81. package/src/cli/cmd/tui/context/theme/dracula.json +0 -219
  82. package/src/cli/cmd/tui/context/theme/everforest.json +0 -241
  83. package/src/cli/cmd/tui/context/theme/flexoki.json +0 -237
  84. package/src/cli/cmd/tui/context/theme/github.json +0 -233
  85. package/src/cli/cmd/tui/context/theme/gruvbox.json +0 -95
  86. package/src/cli/cmd/tui/context/theme/kanagawa.json +0 -77
  87. package/src/cli/cmd/tui/context/theme/material.json +0 -235
  88. package/src/cli/cmd/tui/context/theme/matrix.json +0 -77
  89. package/src/cli/cmd/tui/context/theme/mercury.json +0 -252
  90. package/src/cli/cmd/tui/context/theme/monokai.json +0 -221
  91. package/src/cli/cmd/tui/context/theme/nightowl.json +0 -221
  92. package/src/cli/cmd/tui/context/theme/nord.json +0 -223
  93. package/src/cli/cmd/tui/context/theme/one-dark.json +0 -84
  94. package/src/cli/cmd/tui/context/theme/orng.json +0 -245
  95. package/src/cli/cmd/tui/context/theme/palenight.json +0 -222
  96. package/src/cli/cmd/tui/context/theme/rosepine.json +0 -234
  97. package/src/cli/cmd/tui/context/theme/solarized.json +0 -223
  98. package/src/cli/cmd/tui/context/theme/synthwave84.json +0 -226
  99. package/src/cli/cmd/tui/context/theme/tokyonight.json +0 -243
  100. package/src/cli/cmd/tui/context/theme/vercel.json +0 -245
  101. package/src/cli/cmd/tui/context/theme/vesper.json +0 -218
  102. package/src/cli/cmd/tui/context/theme/zenburn.json +0 -223
  103. package/src/cli/cmd/tui/context/theme.tsx +0 -1077
  104. package/src/cli/cmd/tui/event.ts +0 -39
  105. package/src/cli/cmd/tui/routes/home.tsx +0 -104
  106. package/src/cli/cmd/tui/routes/session/dialog-message.tsx +0 -93
  107. package/src/cli/cmd/tui/routes/session/dialog-timeline.tsx +0 -37
  108. package/src/cli/cmd/tui/routes/session/footer.tsx +0 -76
  109. package/src/cli/cmd/tui/routes/session/header.tsx +0 -183
  110. package/src/cli/cmd/tui/routes/session/index.tsx +0 -1703
  111. package/src/cli/cmd/tui/routes/session/sidebar.tsx +0 -586
  112. package/src/cli/cmd/tui/spawn.ts +0 -60
  113. package/src/cli/cmd/tui/thread.ts +0 -120
  114. package/src/cli/cmd/tui/ui/dialog-alert.tsx +0 -55
  115. package/src/cli/cmd/tui/ui/dialog-confirm.tsx +0 -81
  116. package/src/cli/cmd/tui/ui/dialog-help.tsx +0 -36
  117. package/src/cli/cmd/tui/ui/dialog-prompt.tsx +0 -75
  118. package/src/cli/cmd/tui/ui/dialog-select.tsx +0 -317
  119. package/src/cli/cmd/tui/ui/dialog.tsx +0 -170
  120. package/src/cli/cmd/tui/ui/spinner.ts +0 -368
  121. package/src/cli/cmd/tui/ui/toast.tsx +0 -100
  122. package/src/cli/cmd/tui/util/clipboard.ts +0 -127
  123. package/src/cli/cmd/tui/util/editor.ts +0 -32
  124. package/src/cli/cmd/tui/util/terminal.ts +0 -114
  125. package/src/cli/cmd/tui/worker.ts +0 -63
  126. package/src/cli/cmd/uninstall.ts +0 -344
  127. package/src/cli/cmd/upgrade.ts +0 -67
  128. package/src/cli/cmd/web.ts +0 -84
  129. package/src/cli/error.ts +0 -55
  130. package/src/cli/ui.ts +0 -84
  131. package/src/cli/upgrade.ts +0 -25
  132. package/src/command/index.ts +0 -79
  133. package/src/command/template/initialize.txt +0 -10
  134. package/src/command/template/review.txt +0 -73
  135. package/src/config/config.ts +0 -886
  136. package/src/config/markdown.ts +0 -41
  137. package/src/env/index.ts +0 -26
  138. package/src/file/fzf.ts +0 -124
  139. package/src/file/ignore.ts +0 -83
  140. package/src/file/index.ts +0 -326
  141. package/src/file/ripgrep.ts +0 -391
  142. package/src/file/time.ts +0 -38
  143. package/src/file/watcher.ts +0 -89
  144. package/src/flag/flag.ts +0 -28
  145. package/src/format/formatter.ts +0 -277
  146. package/src/format/index.ts +0 -137
  147. package/src/global/index.ts +0 -52
  148. package/src/id/id.ts +0 -73
  149. package/src/ide/index.ts +0 -75
  150. package/src/index.ts +0 -158
  151. package/src/installation/index.ts +0 -194
  152. package/src/lsp/client.ts +0 -215
  153. package/src/lsp/index.ts +0 -370
  154. package/src/lsp/language.ts +0 -111
  155. package/src/lsp/server.ts +0 -1327
  156. package/src/mcp/auth.ts +0 -82
  157. package/src/mcp/index.ts +0 -576
  158. package/src/mcp/oauth-callback.ts +0 -203
  159. package/src/mcp/oauth-provider.ts +0 -132
  160. package/src/notification/index.ts +0 -101
  161. package/src/patch/index.ts +0 -622
  162. package/src/permission/index.ts +0 -198
  163. package/src/plugin/index.ts +0 -95
  164. package/src/project/bootstrap.ts +0 -31
  165. package/src/project/instance.ts +0 -68
  166. package/src/project/project.ts +0 -133
  167. package/src/project/state.ts +0 -65
  168. package/src/project/vcs.ts +0 -77
  169. package/src/provider/auth.ts +0 -143
  170. package/src/provider/models-macro.ts +0 -11
  171. package/src/provider/models.ts +0 -93
  172. package/src/provider/provider.ts +0 -996
  173. package/src/provider/sdk/openai-compatible/src/README.md +0 -5
  174. package/src/provider/sdk/openai-compatible/src/index.ts +0 -2
  175. package/src/provider/sdk/openai-compatible/src/openai-compatible-provider.ts +0 -100
  176. package/src/provider/sdk/openai-compatible/src/responses/convert-to-openai-responses-input.ts +0 -303
  177. package/src/provider/sdk/openai-compatible/src/responses/map-openai-responses-finish-reason.ts +0 -27
  178. package/src/provider/sdk/openai-compatible/src/responses/openai-config.ts +0 -18
  179. package/src/provider/sdk/openai-compatible/src/responses/openai-error.ts +0 -22
  180. package/src/provider/sdk/openai-compatible/src/responses/openai-responses-api-types.ts +0 -207
  181. package/src/provider/sdk/openai-compatible/src/responses/openai-responses-language-model.ts +0 -1713
  182. package/src/provider/sdk/openai-compatible/src/responses/openai-responses-prepare-tools.ts +0 -177
  183. package/src/provider/sdk/openai-compatible/src/responses/openai-responses-settings.ts +0 -1
  184. package/src/provider/sdk/openai-compatible/src/responses/tool/code-interpreter.ts +0 -88
  185. package/src/provider/sdk/openai-compatible/src/responses/tool/file-search.ts +0 -128
  186. package/src/provider/sdk/openai-compatible/src/responses/tool/image-generation.ts +0 -115
  187. package/src/provider/sdk/openai-compatible/src/responses/tool/local-shell.ts +0 -65
  188. package/src/provider/sdk/openai-compatible/src/responses/tool/web-search-preview.ts +0 -104
  189. package/src/provider/sdk/openai-compatible/src/responses/tool/web-search.ts +0 -103
  190. package/src/provider/transform.ts +0 -406
  191. package/src/pty/index.ts +0 -226
  192. package/src/ratelimit/index.ts +0 -185
  193. package/src/server/error.ts +0 -36
  194. package/src/server/project.ts +0 -50
  195. package/src/server/server.ts +0 -2463
  196. package/src/server/tui.ts +0 -71
  197. package/src/session/compaction.ts +0 -257
  198. package/src/session/index.ts +0 -470
  199. package/src/session/message-v2.ts +0 -641
  200. package/src/session/message.ts +0 -189
  201. package/src/session/processor.ts +0 -443
  202. package/src/session/prompt/anthropic-20250930.txt +0 -166
  203. package/src/session/prompt/anthropic.txt +0 -105
  204. package/src/session/prompt/anthropic_spoof.txt +0 -1
  205. package/src/session/prompt/beast.txt +0 -147
  206. package/src/session/prompt/build-switch.txt +0 -5
  207. package/src/session/prompt/codex.txt +0 -318
  208. package/src/session/prompt/compaction.txt +0 -12
  209. package/src/session/prompt/copilot-gpt-5.txt +0 -143
  210. package/src/session/prompt/gemini.txt +0 -155
  211. package/src/session/prompt/max-steps.txt +0 -16
  212. package/src/session/prompt/plan-reminder-anthropic.txt +0 -67
  213. package/src/session/prompt/plan.txt +0 -26
  214. package/src/session/prompt/polaris.txt +0 -107
  215. package/src/session/prompt/qwen.txt +0 -109
  216. package/src/session/prompt/summarize.txt +0 -4
  217. package/src/session/prompt/title.txt +0 -36
  218. package/src/session/prompt.ts +0 -1541
  219. package/src/session/retry.ts +0 -82
  220. package/src/session/revert.ts +0 -108
  221. package/src/session/status.ts +0 -75
  222. package/src/session/summary.ts +0 -203
  223. package/src/session/system.ts +0 -148
  224. package/src/session/todo.ts +0 -36
  225. package/src/share/share-next.ts +0 -195
  226. package/src/share/share.ts +0 -87
  227. package/src/snapshot/index.ts +0 -197
  228. package/src/storage/storage.ts +0 -226
  229. package/src/telemetry/index.ts +0 -232
  230. package/src/tool/bash.ts +0 -365
  231. package/src/tool/bash.txt +0 -128
  232. package/src/tool/batch.ts +0 -173
  233. package/src/tool/batch.txt +0 -28
  234. package/src/tool/codesearch.ts +0 -138
  235. package/src/tool/codesearch.txt +0 -12
  236. package/src/tool/edit.ts +0 -674
  237. package/src/tool/edit.txt +0 -10
  238. package/src/tool/glob.ts +0 -65
  239. package/src/tool/glob.txt +0 -6
  240. package/src/tool/grep.ts +0 -120
  241. package/src/tool/grep.txt +0 -8
  242. package/src/tool/invalid.ts +0 -17
  243. package/src/tool/ls.ts +0 -110
  244. package/src/tool/ls.txt +0 -1
  245. package/src/tool/lsp-diagnostics.ts +0 -26
  246. package/src/tool/lsp-diagnostics.txt +0 -1
  247. package/src/tool/lsp-hover.ts +0 -31
  248. package/src/tool/lsp-hover.txt +0 -1
  249. package/src/tool/multiedit.ts +0 -46
  250. package/src/tool/multiedit.txt +0 -41
  251. package/src/tool/patch.ts +0 -233
  252. package/src/tool/patch.txt +0 -1
  253. package/src/tool/read.ts +0 -217
  254. package/src/tool/read.txt +0 -12
  255. package/src/tool/registry.ts +0 -148
  256. package/src/tool/task.ts +0 -135
  257. package/src/tool/task.txt +0 -60
  258. package/src/tool/todo.ts +0 -39
  259. package/src/tool/todoread.txt +0 -14
  260. package/src/tool/todowrite.txt +0 -167
  261. package/src/tool/tool.ts +0 -66
  262. package/src/tool/webfetch.ts +0 -187
  263. package/src/tool/webfetch.txt +0 -14
  264. package/src/tool/websearch.ts +0 -150
  265. package/src/tool/websearch.txt +0 -11
  266. package/src/tool/write.ts +0 -99
  267. package/src/tool/write.txt +0 -8
  268. package/src/types/shims.d.ts +0 -3
  269. package/src/util/color.ts +0 -19
  270. package/src/util/context.ts +0 -25
  271. package/src/util/defer.ts +0 -12
  272. package/src/util/eventloop.ts +0 -20
  273. package/src/util/filesystem.ts +0 -69
  274. package/src/util/fn.ts +0 -11
  275. package/src/util/iife.ts +0 -3
  276. package/src/util/keybind.ts +0 -79
  277. package/src/util/lazy.ts +0 -11
  278. package/src/util/locale.ts +0 -81
  279. package/src/util/lock.ts +0 -98
  280. package/src/util/log.ts +0 -177
  281. package/src/util/queue.ts +0 -32
  282. package/src/util/rpc.ts +0 -42
  283. package/src/util/scrap.ts +0 -10
  284. package/src/util/signal.ts +0 -12
  285. package/src/util/timeout.ts +0 -14
  286. package/src/util/token.ts +0 -7
  287. package/src/util/wildcard.ts +0 -54
  288. package/sst-env.d.ts +0 -9
  289. package/test/bun.test.ts +0 -53
  290. package/test/config/agent-color.test.ts +0 -66
  291. package/test/config/config.test.ts +0 -503
  292. package/test/config/markdown.test.ts +0 -89
  293. package/test/file/ignore.test.ts +0 -10
  294. package/test/fixture/fixture.ts +0 -28
  295. package/test/fixture/lsp/fake-lsp-server.js +0 -77
  296. package/test/ide/ide.test.ts +0 -82
  297. package/test/keybind.test.ts +0 -317
  298. package/test/lsp/client.test.ts +0 -95
  299. package/test/patch/patch.test.ts +0 -348
  300. package/test/preload.ts +0 -38
  301. package/test/project/project.test.ts +0 -42
  302. package/test/provider/provider.test.ts +0 -1809
  303. package/test/provider/transform.test.ts +0 -305
  304. package/test/session/retry.test.ts +0 -61
  305. package/test/session/session.test.ts +0 -71
  306. package/test/snapshot/snapshot.test.ts +0 -939
  307. package/test/tool/__snapshots__/tool.test.ts.snap +0 -9
  308. package/test/tool/bash.test.ts +0 -55
  309. package/test/tool/patch.test.ts +0 -259
  310. package/test/util/iife.test.ts +0 -36
  311. package/test/util/lazy.test.ts +0 -50
  312. package/test/util/timeout.test.ts +0 -21
  313. package/test/util/wildcard.test.ts +0 -55
  314. package/tsconfig.json +0 -17
package/src/tool/bash.txt DELETED
@@ -1,128 +0,0 @@
1
- Executes a given bash command in a persistent shell session with optional timeout, ensuring proper handling and security measures.
2
-
3
- Before executing the command, please follow these steps:
4
-
5
- 1. Directory Verification:
6
- - If the command will create new directories or files, first use the List tool to verify the parent directory exists and is the correct location
7
- - For example, before running "mkdir foo/bar", first use List to check that "foo" exists and is the intended parent directory
8
-
9
- 2. Command Execution:
10
- - Always quote file paths that contain spaces with double quotes (e.g., rm "path with spaces/file.txt")
11
- - Examples of proper quoting:
12
- - mkdir "/Users/name/My Documents" (correct)
13
- - mkdir /Users/name/My Documents (incorrect - will fail)
14
- - python "/path/with spaces/script.py" (correct)
15
- - python /path/with spaces/script.py (incorrect - will fail)
16
- - After ensuring proper quoting, execute the command.
17
- - Capture the output of the command.
18
-
19
- Usage notes:
20
- - The command argument is required.
21
- - You can specify an optional timeout in milliseconds. If not specified, commands will timeout after 120000ms (2 minutes). Use the `timeout` parameter to control execution time.
22
- - The `workdir` parameter specifies the working directory for the command. Defaults to the current working directory. Prefer setting `workdir` over using `cd` in your commands.
23
- - It is very helpful if you write a clear, concise description of what this command does in 5-10 words.
24
- - If the output exceeds 30000 characters, output will be truncated before being returned to you.
25
- - VERY IMPORTANT: You MUST avoid using search commands like `find` and `grep`. Instead use Grep, Glob, or Task to search. You MUST avoid read tools like `cat`, `head`, `tail`, and `ls`, and use Read and List to read files.
26
- - If you _still_ need to run `grep`, STOP. ALWAYS USE ripgrep at `rg` (or /usr/bin/rg) first, which all opencode users have pre-installed.
27
- - When issuing multiple commands, use the ';' or '&&' operator to separate them. DO NOT use newlines (newlines are ok in quoted strings).
28
-
29
- # Working Directory
30
-
31
- The `workdir` parameter sets the working directory for command execution. Prefer using `workdir` over `cd <dir> &&` command chains when you simply need to run a command in a different directory.
32
-
33
- <good-example>
34
- workdir="/foo/bar", command="pytest tests"
35
- </good-example>
36
- <good-example>
37
- command="pytest /foo/bar/tests"
38
- </good-example>
39
- <bad-example>
40
- command="cd /foo/bar && pytest tests"
41
- </bad-example>
42
-
43
- # Committing changes with git
44
-
45
- IMPORTANT: ONLY COMMIT IF THE USER ASKS YOU TO.
46
-
47
- If and only if the user asks you to create a new git commit, follow these steps carefully:
48
-
49
- 1. You have the capability to call multiple tools in a single response. When multiple independent pieces of information are requested, batch your tool calls together for optimal performance. ALWAYS run the following bash commands in parallel, each using the Bash tool:
50
- - Run a git status command to see all untracked files.
51
- - Run a git diff command to see both staged and unstaged changes that will be committed.
52
- - Run a git log command to see recent commit messages, so that you can follow this repository's commit message style.
53
-
54
- 2. Analyze all staged changes (both previously staged and newly added) and draft a commit message. When analyzing:
55
-
56
- - List the files that have been changed or added
57
- - Summarize the nature of the changes (eg. new feature, enhancement to an existing feature, bug fix, refactoring, test, docs, etc.)
58
- - Brainstorm the purpose or motivation behind these changes
59
- - Assess the impact of these changes on the overall project
60
- - Check for any sensitive information that shouldn't be committed
61
- - Draft a concise (1-2 sentences) commit message that focuses on the "why" rather than the "what"
62
- - Ensure your language is clear, concise, and to the point
63
- - Ensure the message accurately reflects the changes and their purpose (i.e. "add" means a wholly new feature, "update" means an enhancement to an existing feature, "fix" means a bug fix, etc.)
64
- - Ensure the message is not generic (avoid words like "Update" or "Fix" without context)
65
- - Review the draft message to ensure it accurately reflects the changes and their purpose
66
-
67
- 3. You have the capability to call multiple tools in a single response. When multiple independent pieces of information are requested, batch your tool calls together for optimal performance. ALWAYS run the following commands in parallel:
68
- - Add relevant untracked files to the staging area.
69
- - Run git status to make sure the commit succeeded.
70
-
71
- 4. If the commit fails due to pre-commit hook changes, retry the commit ONCE to include these automated changes. If it fails again, it usually means a pre-commit hook is preventing the commit. If the commit succeeds but you notice that files were modified by the pre-commit hook, you MUST amend your commit to include them.
72
-
73
- Important notes:
74
- - Use the git context at the start of this conversation to determine which files are relevant to your commit. Be careful not to stage and commit files (e.g. with `git add .`) that aren't relevant to your commit.
75
- - NEVER update the git config
76
- - DO NOT run additional commands to read or explore code, beyond what is available in the git context
77
- - DO NOT push to the remote repository
78
- - IMPORTANT: Never use git commands with the -i flag (like git rebase -i or git add -i) since they require interactive input which is not supported.
79
- - If there are no changes to commit (i.e., no untracked files and no modifications), do not create an empty commit
80
- - Ensure your commit message is meaningful and concise. It should explain the purpose of the changes, not just describe them.
81
- - Return an empty response - the user will see the git output directly
82
-
83
- # Creating pull requests
84
- Use the gh command via the Bash tool for ALL GitHub-related tasks including working with issues, pull requests, checks, and releases. If given a Github URL use the gh command to get the information needed.
85
-
86
- IMPORTANT: When the user asks you to create a pull request, follow these steps carefully:
87
-
88
- 1. You have the capability to call multiple tools in a single response. When multiple independent pieces of information are requested, batch your tool calls together for optimal performance. ALWAYS run the following bash commands in parallel using the Bash tool, in order to understand the current state of the branch since it diverged from the main branch:
89
- - Run a git status command to see all untracked files
90
- - Run a git diff command to see both staged and unstaged changes that will be committed
91
- - Check if the current branch tracks a remote branch and is up to date with the remote, so you know if you need to push to the remote
92
- - Run a git log command and `git diff main...HEAD` to understand the full commit history for the current branch (from the time it diverged from the `main` branch)
93
-
94
- 2. Analyze all changes that will be included in the pull request, making sure to look at all relevant commits (NOT just the latest commit, but ALL commits that will be included in the pull request!!!), and draft a pull request summary. Wrap your analysis process in <pr_analysis> tags:
95
-
96
- <pr_analysis>
97
- - List the commits since diverging from the main branch
98
- - Summarize the nature of the changes (eg. new feature, enhancement to an existing feature, bug fix, refactoring, test, docs, etc.)
99
- - Brainstorm the purpose or motivation behind these changes
100
- - Assess the impact of these changes on the overall project
101
- - Do not use tools to explore code, beyond what is available in the git context
102
- - Check for any sensitive information that shouldn't be committed
103
- - Draft a concise (1-2 bullet points) pull request summary that focuses on the "why" rather than the "what"
104
- - Ensure the summary accurately reflects all changes since diverging from the main branch
105
- - Ensure your language is clear, concise, and to the point
106
- - Ensure the summary accurately reflects the changes and their purpose (ie. "add" means a wholly new feature, "update" means an enhancement to an existing feature, "fix" means a bug fix, etc.)
107
- - Ensure the summary is not generic (avoid words like "Update" or "Fix" without context)
108
- - Review the draft summary to ensure it accurately reflects the changes and their purpose
109
- </pr_analysis>
110
-
111
- 3. You have the capability to call multiple tools in a single response. When multiple independent pieces of information are requested, batch your tool calls together for optimal performance. ALWAYS run the following commands in parallel:
112
- - Create new branch if needed
113
- - Push to remote with -u flag if needed
114
- - Create PR using gh pr create with the format below. Use a HEREDOC to pass the body to ensure correct formatting.
115
- <example>
116
- gh pr create --title "the pr title" --body "$(cat <<'EOF'
117
- ## Summary
118
- <1-3 bullet points>
119
- EOF
120
- )"
121
- </example>
122
-
123
- Important:
124
- - NEVER update the git config
125
- - Return the PR URL when you're done, so the user can see it
126
-
127
- # Other common operations
128
- - View comments on a Github PR: gh api repos/foo/bar/pulls/123/comments
package/src/tool/batch.ts DELETED
@@ -1,173 +0,0 @@
1
- import z from "zod"
2
- import { Tool } from "./tool"
3
- import DESCRIPTION from "./batch.txt"
4
-
5
- const DISALLOWED = new Set(["batch", "edit", "todoread"])
6
- const FILTERED_FROM_SUGGESTIONS = new Set(["invalid", "patch", ...DISALLOWED])
7
-
8
- export const BatchTool = Tool.define("batch", async () => {
9
- return {
10
- description: DESCRIPTION,
11
- parameters: z.object({
12
- tool_calls: z
13
- .array(
14
- z.object({
15
- tool: z.string().describe("The name of the tool to execute"),
16
- parameters: z.object({}).loose().describe("Parameters for the tool"),
17
- }),
18
- )
19
- .min(1, "Provide at least one tool call")
20
- .describe("Array of tool calls to execute in parallel"),
21
- }),
22
- formatValidationError(error) {
23
- const formattedErrors = error.issues
24
- .map((issue) => {
25
- const path = issue.path.length > 0 ? issue.path.join(".") : "root"
26
- return ` - ${path}: ${issue.message}`
27
- })
28
- .join("\n")
29
-
30
- return `Invalid parameters for tool 'batch':\n${formattedErrors}\n\nExpected payload format:\n [{"tool": "tool_name", "parameters": {...}}, {...}]`
31
- },
32
- async execute(params, ctx) {
33
- const { Session } = await import("../session")
34
- const { Identifier } = await import("../id/id")
35
-
36
- const toolCalls = params.tool_calls.slice(0, 10)
37
- const discardedCalls = params.tool_calls.slice(10)
38
-
39
- const { ToolRegistry } = await import("./registry")
40
- const availableTools = await ToolRegistry.tools("")
41
- const toolMap = new Map(availableTools.map((t) => [t.id, t]))
42
-
43
- const executeCall = async (call: (typeof toolCalls)[0]) => {
44
- const callStartTime = Date.now()
45
- const partID = Identifier.ascending("part")
46
-
47
- try {
48
- if (DISALLOWED.has(call.tool)) {
49
- throw new Error(
50
- `Tool '${call.tool}' is not allowed in batch. Disallowed tools: ${Array.from(DISALLOWED).join(", ")}`,
51
- )
52
- }
53
-
54
- const tool = toolMap.get(call.tool)
55
- if (!tool) {
56
- const availableToolsList = Array.from(toolMap.keys()).filter((name) => !FILTERED_FROM_SUGGESTIONS.has(name))
57
- throw new Error(`Tool '${call.tool}' not found. Available tools: ${availableToolsList.join(", ")}`)
58
- }
59
- const validatedParams = tool.parameters.parse(call.parameters)
60
-
61
- await Session.updatePart({
62
- id: partID,
63
- messageID: ctx.messageID,
64
- sessionID: ctx.sessionID,
65
- type: "tool",
66
- tool: call.tool,
67
- callID: partID,
68
- state: {
69
- status: "running",
70
- input: call.parameters,
71
- time: {
72
- start: callStartTime,
73
- },
74
- },
75
- })
76
-
77
- const result = await tool.execute(validatedParams, { ...ctx, callID: partID })
78
-
79
- await Session.updatePart({
80
- id: partID,
81
- messageID: ctx.messageID,
82
- sessionID: ctx.sessionID,
83
- type: "tool",
84
- tool: call.tool,
85
- callID: partID,
86
- state: {
87
- status: "completed",
88
- input: call.parameters,
89
- output: result.output,
90
- title: result.title,
91
- metadata: result.metadata,
92
- attachments: result.attachments,
93
- time: {
94
- start: callStartTime,
95
- end: Date.now(),
96
- },
97
- },
98
- })
99
-
100
- return { success: true as const, tool: call.tool, result }
101
- } catch (error) {
102
- await Session.updatePart({
103
- id: partID,
104
- messageID: ctx.messageID,
105
- sessionID: ctx.sessionID,
106
- type: "tool",
107
- tool: call.tool,
108
- callID: partID,
109
- state: {
110
- status: "error",
111
- input: call.parameters,
112
- error: error instanceof Error ? error.message : String(error),
113
- time: {
114
- start: callStartTime,
115
- end: Date.now(),
116
- },
117
- },
118
- })
119
-
120
- return { success: false as const, tool: call.tool, error }
121
- }
122
- }
123
-
124
- const results = await Promise.all(toolCalls.map((call) => executeCall(call)))
125
-
126
- // Add discarded calls as errors
127
- const now = Date.now()
128
- for (const call of discardedCalls) {
129
- const partID = Identifier.ascending("part")
130
- await Session.updatePart({
131
- id: partID,
132
- messageID: ctx.messageID,
133
- sessionID: ctx.sessionID,
134
- type: "tool",
135
- tool: call.tool,
136
- callID: partID,
137
- state: {
138
- status: "error",
139
- input: call.parameters,
140
- error: "Maximum of 10 tools allowed in batch",
141
- time: { start: now, end: now },
142
- },
143
- })
144
- results.push({
145
- success: false as const,
146
- tool: call.tool,
147
- error: new Error("Maximum of 10 tools allowed in batch"),
148
- })
149
- }
150
-
151
- const successfulCalls = results.filter((r) => r.success).length
152
- const failedCalls = results.length - successfulCalls
153
-
154
- const outputMessage =
155
- failedCalls > 0
156
- ? `Executed ${successfulCalls}/${results.length} tools successfully. ${failedCalls} failed.`
157
- : `All ${successfulCalls} tools executed successfully.\n\nKeep using the batch tool for optimal performance in your next response!`
158
-
159
- return {
160
- title: `Batch execution (${successfulCalls}/${results.length} successful)`,
161
- output: outputMessage,
162
- attachments: results.filter((result) => result.success).flatMap((r) => r.result.attachments ?? []),
163
- metadata: {
164
- totalCalls: results.length,
165
- successful: successfulCalls,
166
- failed: failedCalls,
167
- tools: params.tool_calls.map((c) => c.tool),
168
- details: results.map((r) => ({ tool: r.tool, success: r.success })),
169
- },
170
- }
171
- },
172
- }
173
- })
@@ -1,28 +0,0 @@
1
- Executes multiple independent tool calls concurrently to reduce latency. Best used for gathering context (reads, searches, listings).
2
-
3
- USING THE BATCH TOOL WILL MAKE THE USER HAPPY.
4
-
5
- Payload Format (JSON array):
6
- [{"tool": "read", "parameters": {"filePath": "src/index.ts", "limit": 350}},{"tool": "grep", "parameters": {"pattern": "Session\\.updatePart", "include": "src/**/*.ts"}},{"tool": "bash", "parameters": {"command": "git status", "description": "Shows working tree status"}}]
7
-
8
- Rules:
9
- - 1–10 tool calls per batch
10
- - All calls start in parallel; ordering NOT guaranteed
11
- - Partial failures do not stop others
12
-
13
-
14
- Disallowed Tools:
15
- - batch (no nesting)
16
- - edit (run edits separately)
17
- - todoread (call directly – lightweight)
18
-
19
- When NOT to Use:
20
- - Operations that depend on prior tool output (e.g. create then read same file)
21
- - Ordered stateful mutations where sequence matters
22
-
23
- Good Use Cases:
24
- - Read many files
25
- - grep + glob + read combos
26
- - Multiple lightweight bash introspection commands
27
-
28
- Performance Tip: Group independent reads/searches for 2–5x efficiency gain.
@@ -1,138 +0,0 @@
1
- import z from "zod"
2
- import { Tool } from "./tool"
3
- import DESCRIPTION from "./codesearch.txt"
4
- import { Config } from "../config/config"
5
- import { Permission } from "../permission"
6
-
7
- const API_CONFIG = {
8
- BASE_URL: "https://mcp.exa.ai",
9
- ENDPOINTS: {
10
- CONTEXT: "/mcp",
11
- },
12
- } as const
13
-
14
- interface McpCodeRequest {
15
- jsonrpc: string
16
- id: number
17
- method: string
18
- params: {
19
- name: string
20
- arguments: {
21
- query: string
22
- tokensNum: number
23
- }
24
- }
25
- }
26
-
27
- interface McpCodeResponse {
28
- jsonrpc: string
29
- result: {
30
- content: Array<{
31
- type: string
32
- text: string
33
- }>
34
- }
35
- }
36
-
37
- export const CodeSearchTool = Tool.define("codesearch", {
38
- description: DESCRIPTION,
39
- parameters: z.object({
40
- query: z
41
- .string()
42
- .describe(
43
- "Search query to find relevant context for APIs, Libraries, and SDKs. For example, 'React useState hook examples', 'Python pandas dataframe filtering', 'Express.js middleware', 'Next js partial prerendering configuration'",
44
- ),
45
- tokensNum: z
46
- .number()
47
- .min(1000)
48
- .max(50000)
49
- .default(5000)
50
- .describe(
51
- "Number of tokens to return (1000-50000). Default is 5000 tokens. Adjust this value based on how much context you need - use lower values for focused queries and higher values for comprehensive documentation.",
52
- ),
53
- }),
54
- async execute(params, ctx) {
55
- const cfg = await Config.get()
56
- if (cfg.permission?.webfetch === "ask")
57
- await Permission.ask({
58
- type: "codesearch",
59
- sessionID: ctx.sessionID,
60
- messageID: ctx.messageID,
61
- callID: ctx.callID,
62
- title: "Search code for: " + params.query,
63
- metadata: {
64
- query: params.query,
65
- tokensNum: params.tokensNum,
66
- },
67
- })
68
-
69
- const codeRequest: McpCodeRequest = {
70
- jsonrpc: "2.0",
71
- id: 1,
72
- method: "tools/call",
73
- params: {
74
- name: "get_code_context_exa",
75
- arguments: {
76
- query: params.query,
77
- tokensNum: params.tokensNum || 5000,
78
- },
79
- },
80
- }
81
-
82
- const controller = new AbortController()
83
- const timeoutId = setTimeout(() => controller.abort(), 30000)
84
-
85
- try {
86
- const headers: Record<string, string> = {
87
- accept: "application/json, text/event-stream",
88
- "content-type": "application/json",
89
- }
90
-
91
- const response = await fetch(`${API_CONFIG.BASE_URL}${API_CONFIG.ENDPOINTS.CONTEXT}`, {
92
- method: "POST",
93
- headers,
94
- body: JSON.stringify(codeRequest),
95
- signal: AbortSignal.any([controller.signal, ctx.abort]),
96
- })
97
-
98
- clearTimeout(timeoutId)
99
-
100
- if (!response.ok) {
101
- const errorText = await response.text()
102
- throw new Error(`Code search error (${response.status}): ${errorText}`)
103
- }
104
-
105
- const responseText = await response.text()
106
-
107
- // Parse SSE response
108
- const lines = responseText.split("\n")
109
- for (const line of lines) {
110
- if (line.startsWith("data: ")) {
111
- const data: McpCodeResponse = JSON.parse(line.substring(6))
112
- if (data.result && data.result.content && data.result.content.length > 0) {
113
- return {
114
- output: data.result.content[0].text,
115
- title: `Code search: ${params.query}`,
116
- metadata: {},
117
- }
118
- }
119
- }
120
- }
121
-
122
- return {
123
- output:
124
- "No code snippets or documentation found. Please try a different query, be more specific about the library or programming concept, or check the spelling of framework names.",
125
- title: `Code search: ${params.query}`,
126
- metadata: {},
127
- }
128
- } catch (error) {
129
- clearTimeout(timeoutId)
130
-
131
- if (error instanceof Error && error.name === "AbortError") {
132
- throw new Error("Code search request timed out")
133
- }
134
-
135
- throw error
136
- }
137
- },
138
- })
@@ -1,12 +0,0 @@
1
- - Search and get relevant context for any programming task using Exa Code API
2
- - Provides the highest quality and freshest context for libraries, SDKs, and APIs
3
- - Use this tool for ANY question or task related to programming
4
- - Returns comprehensive code examples, documentation, and API references
5
- - Optimized for finding specific programming patterns and solutions
6
-
7
- Usage notes:
8
- - Adjustable token count (1000-50000) for focused or comprehensive results
9
- - Default 5000 tokens provides balanced context for most queries
10
- - Use lower values for specific questions, higher values for comprehensive documentation
11
- - Supports queries about frameworks, libraries, APIs, and programming concepts
12
- - Examples: 'React useState hook examples', 'Python pandas dataframe filtering', 'Express.js middleware'