Skip to content

Commit 7e8031b

Browse files
committed
code_search: include line numbers. fix tests
1 parent 04737b7 commit 7e8031b

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

npm-app/src/tool-handlers.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,8 @@ export const handleCodeSearch: ToolHandler<'code_search'> = async (
281281
}
282282
searchCwd = requestedPath
283283
}
284-
const args = [...flags, pattern, '.']
284+
// Always include -n flag to ensure line numbers are in output for parsing
285+
const args = ['-n', ...flags, pattern, '.']
285286

286287
console.log()
287288
console.log(

sdk/src/tools/code-search.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ export function codeSearch({
4646
searchCwd = requestedPath
4747
}
4848

49-
const args = [...flagsArray, pattern, '.']
49+
// Always include -n flag to ensure line numbers are in output for parsing
50+
const args = ['-n', ...flagsArray, pattern, '.']
5051

5152
const rgPath = getBundledRgPath(import.meta.url)
5253
const childProcess = spawn(rgPath, args, {

0 commit comments

Comments
 (0)