mirror of
https://github.com/anomalyco/opencode.git
synced 2026-05-18 10:07:58 +00:00
wip
This commit is contained in:
@@ -90,6 +90,11 @@ export const BashTool = Tool.define("bash", async () => {
|
||||
parameters: z.object({
|
||||
command: z.string().describe("The command to execute"),
|
||||
timeout: z.number().describe("Optional timeout in milliseconds").optional(),
|
||||
workdir: z
|
||||
.string()
|
||||
.default(Instance.directory)
|
||||
.describe("The working directory to execute the command in")
|
||||
.optional(),
|
||||
description: z
|
||||
.string()
|
||||
.describe(
|
||||
@@ -215,7 +220,7 @@ export const BashTool = Tool.define("bash", async () => {
|
||||
|
||||
const proc = spawn(params.command, {
|
||||
shell,
|
||||
cwd: Instance.directory,
|
||||
cwd: params.workdir || Instance.directory,
|
||||
env: {
|
||||
...process.env,
|
||||
},
|
||||
|
||||
@@ -7,10 +7,10 @@ Before executing the command, please follow these steps:
|
||||
- For example, before running "mkdir foo/bar", first use List to check that "foo" exists and is the intended parent directory
|
||||
|
||||
2. Command Execution:
|
||||
- Always quote file paths that contain spaces with double quotes (e.g., cd "path with spaces/file.txt")
|
||||
- Always quote file paths that contain spaces with double quotes (e.g., rm "path with spaces/file.txt")
|
||||
- Examples of proper quoting:
|
||||
- cd "/Users/name/My Documents" (correct)
|
||||
- cd /Users/name/My Documents (incorrect - will fail)
|
||||
- mkdir "/Users/name/My Documents" (correct)
|
||||
- mkdir /Users/name/My Documents (incorrect - will fail)
|
||||
- python "/path/with spaces/script.py" (correct)
|
||||
- python /path/with spaces/script.py (incorrect - will fail)
|
||||
- After ensuring proper quoting, execute the command.
|
||||
|
||||
Reference in New Issue
Block a user