improve AGENTS.md

This commit is contained in:
Dax Raad
2025-06-09 15:28:06 -04:00
parent 60faa26a15
commit a2884b08cc
6 changed files with 19 additions and 27 deletions

View File

@@ -3,16 +3,16 @@ import { dirname, join } from "path"
export namespace Filesystem {
export async function findUp(target: string, start: string, stop?: string) {
let currentDir = start
let current = start
const result = []
while (true) {
const targetPath = join(currentDir, target)
if (await exists(targetPath)) return targetPath
if (stop === currentDir) return
const parentDir = dirname(currentDir)
if (parentDir === currentDir) {
return
}
currentDir = parentDir
const search = join(current, target)
if (await exists(search)) result.push(search)
if (stop === current) break
const parent = dirname(current)
if (parent === current) break
current = parent
}
return result
}
}