Skip to content

Commit 55a6429

Browse files
autoApprove is false by default, and model will now tell user the CLI command to approve tasks
1 parent 94b788c commit 55a6429

File tree

11 files changed

+79
-12
lines changed

11 files changed

+79
-12
lines changed

.cursor/rules/general.mdc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@ description:
33
globs:
44
alwaysApply: true
55
---
6-
Work step-by-step. If presented with an implementation plan, implement the plan exactly. If the plan presents more than one implementation option, consult with the human user to decide between options. If you are tempted to embellish or imporve upon the plan, consult with the human user. Always complete the current task and wait for human review before proceeding to the next task.
6+
Work step-by-step. If presented with an implementation plan, implement the plan exactly. If the plan presents more than one implementation option, consult with the human user to decide between options. If you are tempted to embellish or imporve upon the plan, consult with the human user. Always complete the current task and wait for human review before proceeding to the next task.
7+
8+
In developing this codebase, we are doing test-driven development with an integration testing (as opposed to a unit testing) verification strategy. Before writing any code (except perhaps for empty function or class signatures), we will write tests and run them to make sure they fail. The red phase is not complete until the tests are failing correctly.

.cursor/rules/tests.mdc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ description: Writing unit tests with `jest`
33
globs: tests/**/*
44
alwaysApply: false
55
---
6-
Make use of the helpers in tests/mcp/test-helpers.ts.
6+
Make use of the helpers in tests/mcp/test-helpers.ts for writing tests.

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "taskqueue-mcp",
3-
"version": "1.4.0",
3+
"version": "1.4.1",
44
"description": "Task Queue MCP Server",
55
"author": "Christopher C. Smith ([email protected])",
66
"main": "dist/src/server/index.js",

src/client/cli.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const program = new Command();
1414
program
1515
.name("taskqueue")
1616
.description("CLI for the Task Manager MCP Server")
17-
.version("1.4.0")
17+
.version("1.4.1")
1818
.option(
1919
'-f, --file-path <path>',
2020
'Specify the path to the tasks JSON file. Overrides TASK_MANAGER_FILE_PATH env var.'

src/server/TaskManager.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import {
1515
AddTasksSuccessData,
1616
DeleteTaskSuccessData,
1717
ReadProjectSuccessData,
18+
UpdateTaskSuccessData
1819
} from "../types/response.js";
1920
import { AppError, AppErrorCode } from "../types/errors.js";
2021
import { FileSystemService } from "./FileSystemService.js";
@@ -519,7 +520,7 @@ export class TaskManager {
519520
status?: "not started" | "in progress" | "done";
520521
completedDetails?: string;
521522
}
522-
): Promise<Task> {
523+
): Promise<UpdateTaskSuccessData> {
523524
await this.ensureInitialized();
524525
await this.reloadFromDisk();
525526

@@ -544,8 +545,14 @@ export class TaskManager {
544545
// Apply updates
545546
Object.assign(task, updates);
546547

548+
// Generate message if needed
549+
let message: string | undefined = undefined;
550+
if (updates.status === 'done' && proj.autoApprove === false) {
551+
message = `Task marked as done but requires approval.\nTo approve, run: npx taskqueue approve-task -- ${projectId} ${taskId}`;
552+
}
553+
547554
await this.saveTasks();
548-
return task;
555+
return { task, message };
549556
}
550557

551558
public async deleteTask(projectId: string, taskId: string): Promise<DeleteTaskSuccessData> {

src/server/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { ListToolsRequestSchema, CallToolRequestSchema } from "@modelcontextprot
1010
const server = new Server(
1111
{
1212
name: "task-manager-server",
13-
version: "1.4.0"
13+
version: "1.4.1"
1414
},
1515
{
1616
capabilities: {

src/server/tools.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { TaskManager } from "./TaskManager.js";
33
import { toolExecutorMap } from "./toolExecutors.js";
44
import { AppError, AppErrorCode } from "../types/errors.js";
55
import { McpError, CallToolResult, ErrorCode } from "@modelcontextprotocol/sdk/types.js";
6+
import { UpdateTaskSuccessData } from '../types/response.js';
67

78
// ---------------------- PROJECT TOOLS ----------------------
89

@@ -468,9 +469,11 @@ export async function executeToolAndHandleErrors(
468469
// 2. Execute the tool - Validation errors (protocol) or TaskManager errors (execution) might be thrown
469470
const resultData = await executor.execute(taskManager, args);
470471

471-
// 3. Format successful execution result
472+
// 3. Format successful execution result using standard stringify
473+
const responseText = JSON.stringify(resultData, null, 2);
474+
472475
return {
473-
content: [{ type: "text", text: JSON.stringify(resultData, null, 2) }]
476+
content: [{ type: "text", text: responseText }]
474477
};
475478

476479
} catch (error: AppError | unknown) {

src/types/response.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export interface ProjectCreationSuccessData {
5555
export interface DeleteTaskSuccessData {
5656
message: string;
5757
}
58-
58+
5959
export interface ReadProjectSuccessData {
6060
projectId: string;
6161
initialPrompt: string;
@@ -64,4 +64,10 @@ export interface ProjectCreationSuccessData {
6464
autoApprove?: boolean;
6565
tasks: Task[];
6666
}
67+
68+
// Add the new interface for update_task success
69+
export interface UpdateTaskSuccessData {
70+
task: Task; // The updated task object
71+
message?: string; // Optional message (e.g., approval reminder)
72+
}
6773

tests/mcp/tools/create-project.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ describe('create_project Tool', () => {
111111
"Task 2",
112112
"Task 3"
113113
]);
114+
expect(project).toHaveProperty('autoApprove', false);
114115
});
115116

116117
it('should create a project with auto-approve enabled', async () => {

0 commit comments

Comments
 (0)