From 8d6f5e63208e841dc4e3e78191a35f787afba23c Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Thu, 22 Jan 2026 00:47:57 -0600 Subject: [PATCH] Fix hardcoded projectsPath in todo tools --- src/components/Shakespeare/ChatPane.tsx | 4 ++-- src/lib/tools/TodoReadTool.ts | 6 ++++-- src/lib/tools/TodoWriteTool.ts | 8 +++++--- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/components/Shakespeare/ChatPane.tsx b/src/components/Shakespeare/ChatPane.tsx index 1f056555..81ed8867 100644 --- a/src/components/Shakespeare/ChatPane.tsx +++ b/src/components/Shakespeare/ChatPane.tsx @@ -205,8 +205,8 @@ export const ChatPane = forwardRef(({ skill: new SkillTool(fs, pluginsPath, cwd), webfetch: new WebFetchTool({ corsProxy: config.corsProxy }), websearch: new WebSearchTool(), - todowrite: new TodoWriteTool(fs, projectId), - todoread: new TodoReadTool(fs, projectId), + todowrite: new TodoWriteTool(fs, projectId, { projectsPath }), + todoread: new TodoReadTool(fs, projectId, { projectsPath }), }; // Add generate_image tool if imageModel is configured diff --git a/src/lib/tools/TodoReadTool.ts b/src/lib/tools/TodoReadTool.ts index c00cea99..b5a1255c 100644 --- a/src/lib/tools/TodoReadTool.ts +++ b/src/lib/tools/TodoReadTool.ts @@ -9,20 +9,22 @@ type TodoReadParams = Record; export class TodoReadTool implements Tool { private fs: JSRuntimeFS; private projectId: string; + private projectsPath: string; readonly description = "Use this tool to read your todo list"; readonly inputSchema = z.object({}); - constructor(fs: JSRuntimeFS, projectId: string) { + constructor(fs: JSRuntimeFS, projectId: string, options?: { projectsPath?: string }) { this.fs = fs; this.projectId = projectId; + this.projectsPath = options?.projectsPath || '/projects'; } async execute(_args: TodoReadParams): Promise { try { // Read todos from .git/ai/TODO file - const todoPath = join("/projects", this.projectId, ".git", "ai", "TODO"); + const todoPath = join(this.projectsPath, this.projectId, ".git", "ai", "TODO"); let todos: TodoInfo[] = []; diff --git a/src/lib/tools/TodoWriteTool.ts b/src/lib/tools/TodoWriteTool.ts index 09ed548b..a8a9f2a2 100644 --- a/src/lib/tools/TodoWriteTool.ts +++ b/src/lib/tools/TodoWriteTool.ts @@ -24,6 +24,7 @@ interface TodoWriteParams { export class TodoWriteTool implements Tool { private fs: JSRuntimeFS; private projectId: string; + private projectsPath: string; readonly description = `Use this tool to create and manage a structured task list for your current coding session. This helps you track progress, organize complex tasks, and demonstrate thoroughness to the user. It also helps the user understand the progress of the task and overall progress of their requests. @@ -197,9 +198,10 @@ When in doubt, use this tool. Being proactive with task management demonstrates todos: z.array(TodoSchema).describe("The updated todo list"), }); - constructor(fs: JSRuntimeFS, projectId: string) { + constructor(fs: JSRuntimeFS, projectId: string, options?: { projectsPath?: string }) { this.fs = fs; this.projectId = projectId; + this.projectsPath = options?.projectsPath || '/projects'; } async execute(args: TodoWriteParams): Promise { @@ -207,8 +209,8 @@ When in doubt, use this tool. Being proactive with task management demonstrates try { // Write todos to .git/ai/TODO file - const todoPath = join("/projects", this.projectId, ".git", "ai", "TODO"); - const aiDir = join("/projects", this.projectId, ".git", "ai"); + const todoPath = join(this.projectsPath, this.projectId, ".git", "ai", "TODO"); + const aiDir = join(this.projectsPath, this.projectId, ".git", "ai"); // Ensure .git/ai directory exists try {