( fn: (projectDir: string) => Promise<void>, )
| 39 | } |
| 40 | |
| 41 | async function withProjectDir( |
| 42 | fn: (projectDir: string) => Promise<void>, |
| 43 | ): Promise<void> { |
| 44 | const projectDir = await mkdtemp(join(tmpdir(), 'agentsmd-project-')) |
| 45 | const originalCwd = process.cwd() |
| 46 | await mkdir(join(projectDir, '.git'), { recursive: true }) |
| 47 | process.chdir(projectDir) |
| 48 | setOriginalCwd(projectDir) |
| 49 | clearAgentsMemoryFilesCache() |
| 50 | try { |
| 51 | await fn(projectDir) |
| 52 | } finally { |
| 53 | clearAgentsMemoryFilesCache() |
| 54 | process.chdir(originalCwd) |
| 55 | setOriginalCwd(originalCwd) |
| 56 | await rm(projectDir, { recursive: true, force: true }) |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | describe('agentsmd project memory discovery', () => { |
| 61 | it('discovers AGENTS.md in the project root', async () => { |
no test coverage detected