Refactor external tools organization and add file search API endpoint

🤖 Generated with [OpenCode](https://opencode.ai)

Co-Authored-By: OpenCode <noreply@opencode.ai>
This commit is contained in:
Dax Raad
2025-06-11 23:59:51 -04:00
parent 83991bee88
commit f6ed59bf45
6 changed files with 48 additions and 5 deletions

View File

@@ -12,6 +12,7 @@ import { App } from "../app/app"
import { Global } from "../global"
import { mapValues } from "remeda"
import { NamedError } from "../util/error"
import { Fzf } from "../external/fzf"
const ERRORS = {
400: {
@@ -427,6 +428,34 @@ export namespace Server {
})
},
)
.post(
"/file_search",
describeRoute({
description: "Search for files",
responses: {
200: {
description: "Search for files",
content: {
"application/json": {
schema: resolver(z.string().array()),
},
},
},
},
}),
zValidator(
"json",
z.object({
query: z.string(),
}),
),
async (c) => {
const body = c.req.valid("json")
const app = App.info()
const result = await Fzf.search(app.path.cwd, body.query)
return c.json(result)
},
)
return result
}