mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-04-05 08:33:10 +00:00
core: extract external directory validation to shared utility to reduce code duplication across tools
This commit is contained in:
@@ -4,6 +4,7 @@ import * as path from "path"
|
||||
import DESCRIPTION from "./ls.txt"
|
||||
import { Instance } from "../project/instance"
|
||||
import { Ripgrep } from "../file/ripgrep"
|
||||
import { assertExternalDirectory } from "./external-directory"
|
||||
|
||||
export const IGNORE_PATTERNS = [
|
||||
"node_modules/",
|
||||
@@ -42,6 +43,7 @@ export const ListTool = Tool.define("list", {
|
||||
}),
|
||||
async execute(params, ctx) {
|
||||
const searchPath = path.resolve(Instance.directory, params.path || ".")
|
||||
await assertExternalDirectory(ctx, searchPath, { kind: "directory" })
|
||||
|
||||
await ctx.ask({
|
||||
permission: "list",
|
||||
|
||||
Reference in New Issue
Block a user