mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-03-31 14:22:27 +00:00
mcp support
This commit is contained in:
@@ -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 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user