mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-03 07:57:22 +00:00
Fix hardcoded projectsPath in todo tools
This commit is contained in:
3 files changed
+11
-7
No files matched your search
@@ -205,8 +205,8 @@ export const ChatPane = forwardRef<ChatPaneRef, ChatPaneProps>(({
|
||||
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
|
||||
|
||||
@@ -9,20 +9,22 @@ type TodoReadParams = Record<string, never>;
|
||||
export class TodoReadTool implements Tool<TodoReadParams> {
|
||||
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<ToolResult> {
|
||||
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[] = [];
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ interface TodoWriteParams {
|
||||
export class TodoWriteTool implements Tool<TodoWriteParams> {
|
||||
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<ToolResult> {
|
||||
@@ -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 {
|
||||
|
||||
Reference in new issue
Block a user