Skip to content

Commit 4273714

Browse files
committed
fix issue with some bash commands asking for permission
1 parent a21e237 commit 4273714

3 files changed

Lines changed: 12 additions & 3 deletions

File tree

bun.lock

Lines changed: 8 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/opencode/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,12 @@
4646
"hono-openapi": "0.4.8",
4747
"isomorphic-git": "1.32.1",
4848
"jsonc-parser": "3.3.1",
49+
"minimatch": "10.0.3",
4950
"open": "10.1.2",
5051
"remeda": "catalog:",
51-
"turndown": "7.2.0",
5252
"tree-sitter": "0.22.4",
5353
"tree-sitter-bash": "0.23.3",
54+
"turndown": "7.2.0",
5455
"vscode-jsonrpc": "8.2.1",
5556
"xdg-basedir": "5.1.0",
5657
"yargs": "18.0.0",

packages/opencode/src/tool/bash.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { Config } from "../config/config"
77
import { Filesystem } from "../util/filesystem"
88
import path from "path"
99
import { lazy } from "../util/lazy"
10+
import { minimatch } from "minimatch"
1011

1112
const MAX_OUTPUT_LENGTH = 30000
1213
const DEFAULT_TIMEOUT = 1 * 60 * 1000
@@ -84,7 +85,7 @@ export const BashTool = Tool.define("bash", {
8485
if (!needsAsk && command[0] !== "cd") {
8586
const ask = (() => {
8687
for (const [pattern, value] of Object.entries(permissions)) {
87-
if (new Bun.Glob(pattern).match(node.text)) {
88+
if (minimatch(node.text, pattern)) {
8889
return value
8990
}
9091
}

0 commit comments

Comments
 (0)