mcp support

This commit is contained in:
Dax Raad
2025-06-03 15:57:38 -04:00
parent 3a60ae98f3
commit 37c34fd39c
5 changed files with 150 additions and 31 deletions

View File

@@ -2,11 +2,12 @@ import { exists } from "fs/promises"
import { dirname, join } from "path"
export namespace Filesystem {
export async function findUp(target: string, start: string) {
export async function findUp(target: string, start: string, stop?: string) {
let currentDir = start
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
@@ -15,4 +16,3 @@ export namespace Filesystem {
}
}
}