mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-04-07 09:18:41 +00:00
Refactor application path handling and data storage architecture
Replace simple directory-based path system with git-aware data management that uses global data directories and proper workspace detection. 🤖 Generated with opencode Co-Authored-By: opencode <noreply@opencode.ai>
This commit is contained in:
18
packages/opencode/src/util/filesystem.ts
Normal file
18
packages/opencode/src/util/filesystem.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { exists } from "fs/promises"
|
||||
import { dirname, join } from "path"
|
||||
|
||||
export namespace Filesystem {
|
||||
export async function findUp(target: string, start: string) {
|
||||
let currentDir = start
|
||||
while (true) {
|
||||
const targetPath = join(currentDir, target)
|
||||
if (await exists(targetPath)) return targetPath
|
||||
const parentDir = dirname(currentDir)
|
||||
if (parentDir === currentDir) {
|
||||
return
|
||||
}
|
||||
currentDir = parentDir
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user