mirror of
https://github.com/anomalyco/opencode.git
synced 2026-07-25 20:55:42 -04:00
fix(opencode): preserve grep symlink paths (#38581)
Co-authored-by: Zach Bruggeman <zbruggeman@ramp.com>
This commit is contained in:
@@ -69,7 +69,10 @@ export const GrepTool = Tool.define(
|
||||
if (result.length === 0) return empty
|
||||
|
||||
const rows = result.map((item) => ({
|
||||
path: path.resolve(cwd, item.entry.path),
|
||||
path: path.resolve(
|
||||
requestedInfo?.type === "Directory" ? requested : path.dirname(requested),
|
||||
item.entry.path,
|
||||
),
|
||||
line: item.line,
|
||||
text: item.text,
|
||||
}))
|
||||
|
||||
@@ -215,6 +215,8 @@ describe("tool.grep", () => {
|
||||
)
|
||||
|
||||
expect(result.metadata.matches).toBe(1)
|
||||
expect(result.output).toContain(path.join(alias, "test.txt"))
|
||||
expect(result.output).not.toContain(path.join(real, "test.txt"))
|
||||
expect(requests.find((req) => req.permission === "external_directory")).toBeUndefined()
|
||||
}),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user