fix: prevent duplicate AGENTS.md injection when reading instruction files (#11581)
Co-authored-by: Aiden Cline <aidenpcline@gmail.com>
This commit is contained in:
@@ -47,4 +47,24 @@ describe("InstructionPrompt.resolve", () => {
|
||||
},
|
||||
})
|
||||
})
|
||||
|
||||
test("doesn't reload AGENTS.md when reading it directly", async () => {
|
||||
await using tmp = await tmpdir({
|
||||
init: async (dir) => {
|
||||
await Bun.write(path.join(dir, "subdir", "AGENTS.md"), "# Subdir Instructions")
|
||||
await Bun.write(path.join(dir, "subdir", "nested", "file.ts"), "const x = 1")
|
||||
},
|
||||
})
|
||||
await Instance.provide({
|
||||
directory: tmp.path,
|
||||
fn: async () => {
|
||||
const filepath = path.join(tmp.path, "subdir", "AGENTS.md")
|
||||
const system = await InstructionPrompt.systemPaths()
|
||||
expect(system.has(filepath)).toBe(false)
|
||||
|
||||
const results = await InstructionPrompt.resolve([], filepath, "test-message-2")
|
||||
expect(results).toEqual([])
|
||||
},
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user