Просмотр исходного кода

tweak: bash tool, try to prevent the cd spam

Aiden Cline 2 месяцев назад
Родитель
Сommit
4e92f54415
2 измененных файлов с 3 добавлено и 1 удалено
  1. 1 1
      packages/opencode/src/tool/bash.ts
  2. 2 0
      packages/opencode/src/tool/bash.txt

+ 1 - 1
packages/opencode/src/tool/bash.ts

@@ -82,7 +82,7 @@ export const BashTool = Tool.define("bash", async () => {
   log.info("bash tool using shell", { shell })
   log.info("bash tool using shell", { shell })
 
 
   return {
   return {
-    description: DESCRIPTION,
+    description: DESCRIPTION.replaceAll("${directory}", Instance.directory),
     parameters: z.object({
     parameters: z.object({
       command: z.string().describe("The command to execute"),
       command: z.string().describe("The command to execute"),
       timeout: z.number().describe("Optional timeout in milliseconds").optional(),
       timeout: z.number().describe("Optional timeout in milliseconds").optional(),

+ 2 - 0
packages/opencode/src/tool/bash.txt

@@ -1,5 +1,7 @@
 Executes a given bash command in a persistent shell session with optional timeout, ensuring proper handling and security measures.
 Executes a given bash command in a persistent shell session with optional timeout, ensuring proper handling and security measures.
 
 
+All commands run in ${directory} by default. Use the `workdir` parameter if you need to run a command in a different directory.
+
 Before executing the command, please follow these steps:
 Before executing the command, please follow these steps:
 
 
 1. Directory Verification:
 1. Directory Verification: