feat: wire story-promotion into update_task_status + filter done stories from get_claude_context
update_task_status now delegates to updateTaskStatusWithStoryPromotion
and surfaces story_status_change ('promoted' | 'demoted' | null) in the
response so Claude Code can act on story completion without a separate
read call.
get_claude_context adds an OR-filter on tasks so stories where every
task is DONE are skipped — only surfaces stories that still have work to
do (no tasks, or at least one non-DONE task).
This commit is contained in:
parent
7425584921
commit
e2c86eb4d9
2 changed files with 10 additions and 6 deletions
|
|
@ -58,6 +58,10 @@ export function registerGetClaudeContextTool(server: McpServer) {
|
||||||
where: {
|
where: {
|
||||||
sprint_id: activeSprint.id,
|
sprint_id: activeSprint.id,
|
||||||
status: { in: ['OPEN', 'IN_SPRINT'] },
|
status: { in: ['OPEN', 'IN_SPRINT'] },
|
||||||
|
OR: [
|
||||||
|
{ tasks: { none: {} } },
|
||||||
|
{ tasks: { some: { status: { not: 'DONE' } } } },
|
||||||
|
],
|
||||||
},
|
},
|
||||||
orderBy: [{ priority: 'asc' }, { sort_order: 'asc' }],
|
orderBy: [{ priority: 'asc' }, { sort_order: 'asc' }],
|
||||||
select: {
|
select: {
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
import { z } from 'zod'
|
import { z } from 'zod'
|
||||||
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'
|
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'
|
||||||
import { prisma } from '../prisma.js'
|
|
||||||
import { requireWriteAccess } from '../auth.js'
|
import { requireWriteAccess } from '../auth.js'
|
||||||
import { userCanAccessTask } from '../access.js'
|
import { userCanAccessTask } from '../access.js'
|
||||||
import { toolError, toolJson, withToolErrors } from '../errors.js'
|
import { toolError, toolJson, withToolErrors } from '../errors.js'
|
||||||
import { TASK_STATUS_API_VALUES, taskStatusFromApi, taskStatusToApi } from '../status.js'
|
import { TASK_STATUS_API_VALUES, taskStatusFromApi, taskStatusToApi } from '../status.js'
|
||||||
|
import { updateTaskStatusWithStoryPromotion } from '../lib/tasks-status-update.js'
|
||||||
|
|
||||||
const inputSchema = z.object({
|
const inputSchema = z.object({
|
||||||
task_id: z.string().min(1),
|
task_id: z.string().min(1),
|
||||||
|
|
@ -31,15 +31,15 @@ export function registerUpdateTaskStatusTool(server: McpServer) {
|
||||||
if (!(await userCanAccessTask(task_id, auth.userId))) {
|
if (!(await userCanAccessTask(task_id, auth.userId))) {
|
||||||
return toolError(`Task ${task_id} not found or not accessible`)
|
return toolError(`Task ${task_id} not found or not accessible`)
|
||||||
}
|
}
|
||||||
const task = await prisma.task.update({
|
const { task, storyStatusChange } = await updateTaskStatusWithStoryPromotion(
|
||||||
where: { id: task_id },
|
task_id,
|
||||||
data: { status: dbStatus },
|
dbStatus,
|
||||||
select: { id: true, status: true, implementation_plan: true },
|
)
|
||||||
})
|
|
||||||
return toolJson({
|
return toolJson({
|
||||||
id: task.id,
|
id: task.id,
|
||||||
status: taskStatusToApi(task.status),
|
status: taskStatusToApi(task.status),
|
||||||
implementation_plan: task.implementation_plan,
|
implementation_plan: task.implementation_plan,
|
||||||
|
story_status_change: storyStatusChange,
|
||||||
})
|
})
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue