Refactor app context system to use Zod schemas and sync access pattern

🤖 Generated with opencode
Co-Authored-By: opencode <noreply@opencode.ai>
This commit is contained in:
Dax Raad
2025-06-03 11:59:03 -04:00
parent 8487346d3f
commit bfb36a8566
12 changed files with 114 additions and 36 deletions

View File

@@ -50,7 +50,7 @@ export const GlobTool = Tool.define({
.optional(),
}),
async execute(params) {
const app = await App.use()
const app = App.info()
const search = params.path || app.path.cwd
const limit = 100
const glob = new Bun.Glob(params.pattern)

View File

@@ -286,7 +286,7 @@ export const GrepTool = Tool.define({
throw new Error("pattern is required")
}
const app = await App.use()
const app = App.info()
const searchPath = params.path || app.path.cwd
// If literalText is true, escape the pattern

View File

@@ -25,7 +25,7 @@ export const ListTool = Tool.define({
ignore: z.array(z.string()).optional(),
}),
async execute(params) {
const app = await App.use()
const app = App.info()
const searchPath = path.resolve(app.path.cwd, params.path || ".")
const glob = new Bun.Glob("**/*")

View File

@@ -34,7 +34,7 @@ TIPS:
path: z.string().describe("The path to the file to get diagnostics."),
}),
execute: async (args) => {
const app = await App.use()
const app = App.info()
const normalized = path.isAbsolute(args.path)
? args.path
: path.join(app.path.cwd, args.path)

View File

@@ -17,8 +17,7 @@ export const LspHoverTool = Tool.define({
character: z.number().describe("The character number to get diagnostics."),
}),
execute: async (args) => {
console.log(args)
const app = await App.use()
const app = App.info()
const file = path.isAbsolute(args.file)
? args.file
: path.join(app.path.cwd, args.file)