- Added requestReview method to facilitate task review requests, integrating with kanban and messaging systems. - Updated taskStore to manage review states, ensuring compatibility with kanban columns. - Enhanced message handling by introducing appendSentMessage for better tracking of sent messages. - Improved task management by normalizing review states and integrating them into task creation and retrieval processes. - Updated tests to cover new review and messaging features, ensuring robust functionality across components.
68 lines
2.1 KiB
TypeScript
68 lines
2.1 KiB
TypeScript
import type { FastMCP } from 'fastmcp';
|
|
import { z } from 'zod';
|
|
|
|
import { getController } from '../controller';
|
|
import { jsonTextContent } from '../utils/format';
|
|
|
|
const toolContextSchema = {
|
|
teamName: z.string().min(1),
|
|
claudeDir: z.string().min(1).optional(),
|
|
};
|
|
|
|
export function registerReviewTools(server: Pick<FastMCP, 'addTool'>) {
|
|
server.addTool({
|
|
name: 'review_request',
|
|
description: 'Move a completed task into review and notify reviewer',
|
|
parameters: z.object({
|
|
...toolContextSchema,
|
|
taskId: z.string().min(1),
|
|
from: z.string().optional(),
|
|
reviewer: z.string().optional(),
|
|
}),
|
|
execute: async ({ teamName, claudeDir, taskId, from, reviewer }) =>
|
|
jsonTextContent(
|
|
getController(teamName, claudeDir).review.requestReview(taskId, {
|
|
...(from ? { from } : {}),
|
|
...(reviewer ? { reviewer } : {}),
|
|
})
|
|
),
|
|
});
|
|
|
|
server.addTool({
|
|
name: 'review_approve',
|
|
description: 'Approve task review and move kanban state accordingly',
|
|
parameters: z.object({
|
|
...toolContextSchema,
|
|
taskId: z.string().min(1),
|
|
from: z.string().optional(),
|
|
note: z.string().optional(),
|
|
notifyOwner: z.boolean().optional(),
|
|
}),
|
|
execute: async ({ teamName, claudeDir, taskId, from, note, notifyOwner }) =>
|
|
jsonTextContent(
|
|
getController(teamName, claudeDir).review.approveReview(taskId, {
|
|
...(from ? { from } : {}),
|
|
...(note ? { note } : {}),
|
|
...(notifyOwner !== false ? { 'notify-owner': true } : {}),
|
|
})
|
|
),
|
|
});
|
|
|
|
server.addTool({
|
|
name: 'review_request_changes',
|
|
description: 'Request changes on a task under review',
|
|
parameters: z.object({
|
|
...toolContextSchema,
|
|
taskId: z.string().min(1),
|
|
from: z.string().optional(),
|
|
comment: z.string().optional(),
|
|
}),
|
|
execute: async ({ teamName, claudeDir, taskId, from, comment }) =>
|
|
jsonTextContent(
|
|
getController(teamName, claudeDir).review.requestChanges(taskId, {
|
|
...(from ? { from } : {}),
|
|
...(comment ? { comment } : {}),
|
|
})
|
|
),
|
|
});
|
|
}
|