diff options
Diffstat (limited to 'packages/opencode/test/tool/bash.test.ts')
| -rw-r--r-- | packages/opencode/test/tool/bash.test.ts | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/packages/opencode/test/tool/bash.test.ts b/packages/opencode/test/tool/bash.test.ts index ee82813fb..2eb17a9fc 100644 --- a/packages/opencode/test/tool/bash.test.ts +++ b/packages/opencode/test/tool/bash.test.ts @@ -147,6 +147,36 @@ describe("tool.bash permissions", () => { }) }) + test("does not ask for external_directory permission when rm inside project", async () => { + await using tmp = await tmpdir({ git: true }) + await Instance.provide({ + directory: tmp.path, + fn: async () => { + const bash = await BashTool.init() + const requests: Array<Omit<PermissionNext.Request, "id" | "sessionID" | "tool">> = [] + const testCtx = { + ...ctx, + ask: async (req: Omit<PermissionNext.Request, "id" | "sessionID" | "tool">) => { + requests.push(req) + }, + } + + await Bun.write(path.join(tmp.path, "tmpfile"), "x") + + await bash.execute( + { + command: "rm tmpfile", + description: "Remove tmpfile", + }, + testCtx, + ) + + const extDirReq = requests.find((r) => r.permission === "external_directory") + expect(extDirReq).toBeUndefined() + }, + }) + }) + test("includes always patterns for auto-approval", async () => { await using tmp = await tmpdir({ git: true }) await Instance.provide({ |
