improve AGENTS.md

This commit is contained in:
Dax Raad
2025-06-09 15:28:06 -04:00
parent d9af524676
commit 10219b14d4
6 changed files with 19 additions and 27 deletions
+4 -14
View File
@@ -1,5 +1,5 @@
import { App } from "../app/app"
import path from "path"
import { Filesystem } from "../util/filesystem"
export namespace SessionContext {
const FILES = [
@@ -9,20 +9,10 @@ export namespace SessionContext {
]
export async function find() {
const { cwd, root } = App.info().path
let current = cwd
const found = []
while (true) {
for (const item of FILES) {
const file = Bun.file(path.join(current, item))
if (await file.exists()) {
found.push(file.text())
}
}
if (current === root) break
const parent = path.dirname(current)
if (parent === current) break
current = parent
for (const item of FILES) {
const matches = await Filesystem.findUp(item, cwd, root)
found.push(...matches.map((x) => Bun.file(x).text()))
}
return Promise.all(found).then((parts) => parts.join("\n\n"))
}