Skip to content

Commit b77dd2f

Browse files
committed
refactor(tools): rename safe-grep to grep with override capability
1 parent 64b3564 commit b77dd2f

File tree

10 files changed

+14
-16
lines changed

10 files changed

+14
-16
lines changed

README.ko.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
- [Tools](#tools)
1414
- [내장 LSP Tools](#내장-lsp-tools)
1515
- [내장 AST-Grep Tools](#내장-ast-grep-tools)
16-
- [Safe Grep](#safe-grep)
16+
- [Grep](#grep)
1717
- [내장 MCPs](#내장-mcps)
1818
- [기타 편의 기능](#기타-편의-기능)
1919
- [설정](#설정)
@@ -185,11 +185,10 @@ OpenCode 는 아주 확장가능하고 아주 커스터마이저블합니다.
185185
- **ast_grep_search**: AST 인식 코드 패턴 검색 (25개 언어)
186186
- **ast_grep_replace**: AST 인식 코드 교체
187187

188-
#### Safe Grep
189-
- **safe_grep**: 안전 제한이 있는 콘텐츠 검색 (5분 타임아웃, 10MB 출력 제한).
188+
#### Grep
189+
- **grep**: 안전 제한이 있는 콘텐츠 검색 (5분 타임아웃, 10MB 출력 제한). OpenCode의 내장 `grep` 도구를 대체합니다.
190190
- 기본 grep 도구는 시간제한이 걸려있지 않습니다. 대형 코드베이스에서 광범위한 패턴을 검색하면 CPU가 폭발하고 무한히 멈출 수 있습니다.
191-
- safe_grep 은 timeout 과 더 엄격한 출력 제한을 적용합니다.
192-
- **주의**: 기본 grep 도구는 Agent 를 햇갈리게 하지 않기 위해 비활성화됩니다. 그러나 SafeGrep 은 Grep 이 제공하는 모든 기능을 제공합니다.
191+
- 이 도구는 엄격한 제한을 적용하며, 내장 `grep`을 완전히 대체합니다.
193192

194193
#### 내장 MCPs
195194

README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ English | [한국어](README.ko.md)
1313
- [Tools](#tools)
1414
- [Built-in LSP Tools](#built-in-lsp-tools)
1515
- [Built-in AST-Grep Tools](#built-in-ast-grep-tools)
16-
- [Safe Grep](#safe-grep)
16+
- [Grep](#grep)
1717
- [Built-in MCPs](#built-in-mcps)
1818
- [Other Features](#other-features)
1919
- [Configuration](#configuration)
@@ -181,12 +181,11 @@ The features you use in your editor—other agents cannot access them. Oh My Ope
181181
- **ast_grep_search**: AST-aware code pattern search (25 languages)
182182
- **ast_grep_replace**: AST-aware code replacement
183183

184-
#### Safe Grep
184+
#### Grep
185185

186-
- **safe_grep**: Content search with safety limits (5min timeout, 10MB output).
186+
- **grep**: Content search with safety limits (5min timeout, 10MB output). Overrides OpenCode's built-in `grep` tool.
187187
- The default `grep` lacks safeguards. On a large codebase, a broad pattern can cause CPU overload and indefinite hanging.
188-
- `safe_grep` enforces strict limits.
189-
- **Note**: Default `grep` is disabled to prevent Agent confusion. `safe_grep` delivers full `grep` functionality with safety assurance.
188+
- This tool enforces strict limits and completely replaces the built-in `grep`.
190189

191190
#### Built-in MCPs
192191

src/tools/grep/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { grep } from "./tools"
2+
3+
export { grep }
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { tool } from "@opencode-ai/plugin/tool"
22
import { runRg } from "./cli"
33
import { formatGrepResult } from "./utils"
44

5-
export const safe_grep = tool({
5+
export const grep = tool({
66
description:
77
"Fast content search tool with safety limits (60s timeout, 10MB output). " +
88
"Searches file contents using regular expressions. " +

src/tools/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {
1717
ast_grep_replace,
1818
} from "./ast-grep"
1919

20-
import { safe_grep } from "./safe-grep"
20+
import { grep } from "./grep"
2121

2222
export const builtinTools = {
2323
lsp_hover,
@@ -33,5 +33,5 @@ export const builtinTools = {
3333
lsp_code_action_resolve,
3434
ast_grep_search,
3535
ast_grep_replace,
36-
safe_grep,
36+
grep,
3737
}

src/tools/safe-grep/index.ts

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)