-
Notifications
You must be signed in to change notification settings - Fork 2.6k
fix: resolve newTaskRequireTodos setting not working correctly #7363
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
ba3b9f3
d9894e1
c1bd86c
0776893
c9da981
371b3e6
7ffe015
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -3,52 +3,51 @@ import { ToolArgs } from "./types" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| export function getNewTaskDescription(args: ToolArgs): string { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const todosRequired = args.settings?.newTaskRequireTodos === true | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // When setting is disabled, don't show todos parameter at all | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (!todosRequired) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return `## new_task | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Description: This will let you create a new task instance in the chosen mode using your provided message. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Parameters: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - mode: (required) The slug of the mode to start the new task in (e.g., "code", "debug", "architect"). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - message: (required) The initial user message or instructions for this new task. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Usage: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <new_task> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <mode>your-mode-slug-here</mode> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <message>Your initial instructions here</message> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </new_task> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Example: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <new_task> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <mode>code</mode> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <message>Implement a new feature for the application.</message> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </new_task> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // When setting is enabled, show todos as required | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Always show the todos parameter, but mark it as optional or required based on setting | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return `## new_task | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Description: This will let you create a new task instance in the chosen mode using your provided message and initial todo list. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Description: This will let you create a new task instance in the chosen mode using your provided message${todosRequired ? " and initial todo list" : ""}. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Parameters: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - mode: (required) The slug of the mode to start the new task in (e.g., "code", "debug", "architect"). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - message: (required) The initial user message or instructions for this new task. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - todos: (required) The initial todo list in markdown checklist format for the new task. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - todos: (${todosRequired ? "required" : "optional"}) The initial todo list in markdown checklist format for the new task. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Usage: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <new_task> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <mode>your-mode-slug-here</mode> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <message>Your initial instructions here</message> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <message>Your initial instructions here</message>${ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| todosRequired | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ? ` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <todos> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| [ ] First task to complete | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| [ ] Second task to complete | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| [ ] Third task to complete | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </todos> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </todos>` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| : "" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </new_task> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Example: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <new_task> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <mode>code</mode> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <message>${todosRequired ? "Implement user authentication" : "Implement a new feature for the application"}</message>${ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| todosRequired | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ? ` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <todos> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| [ ] Set up auth middleware | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| [ ] Create login endpoint | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| [ ] Add session management | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| [ ] Write tests | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </todos>` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| : "" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </new_task> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ${ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| !todosRequired | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ? `Example with optional todos: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <new_task> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <mode>code</mode> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <message>Implement user authentication</message> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <todos> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| [ ] Set up auth middleware | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -58,4 +57,6 @@ Example: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </todos> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </new_task> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| : "" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| : "" | |
| }` | |
| } | |
| const description = [ | |
| "## new_task", | |
| `Description: This will let you create a new task instance in the chosen mode using your provided message${todosRequired ? " and initial todo list" : ""}.`, | |
| "", | |
| "Parameters:", | |
| "- mode: (required) The slug of the mode to start the new task in (e.g., \"code\", \"debug\", \"architect\").", | |
| "- message: (required) The initial user message or instructions for this new task.", | |
| getTodosParamDescription(todosRequired), | |
| "", | |
| "Usage:", | |
| "<new_task>", | |
| "<mode>your-mode-slug-here</mode>", | |
| "<message>Your initial instructions here</message>" + getTodosUsageBlock(todosRequired), | |
| "</new_task>", | |
| "", | |
| "Example:", | |
| "<new_task>", | |
| "<mode>code</mode>", | |
| `<message>${todosRequired ? "Implement user authentication" : "Implement a new feature for the application"}</message>` + getTodosExampleBlock(todosRequired), | |
| "</new_task>", | |
| "", | |
| getOptionalTodosExampleBlock(todosRequired) | |
| ].join("\n"); | |
| return description; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The conditional logic for the example message and todos section creates complex template literal nesting that's difficult to read and maintain. Consider extracting the example generation into separate helper functions or variables to improve readability.