Files
task-stream/apps/mcp/src/app/tools/summaries.ts
Josep Piguillem f7e850068b feat: custom fields per project
Text, number, date or option-list fields defined in the project settings
(archived, never removed; their type is fixed once saved). Tickets hold
them, edited in the side panel, listed under the title and filtered by
option in the list view; also over GraphQL, REST (?field=ID:value) and MCP.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 09:31:12 +02:00

82 lines
2.1 KiB
TypeScript

import type { Schemas } from '../api/taskstream-api';
/*
* Compact views for listings: what the model needs to reason, without ids
* and nested objects it rarely uses (full detail through the get_* tools).
*/
type Issue = Schemas['IssueDto'];
type Project = Schemas['ProjectDto'];
type Release = Schemas['ReleaseDto'];
type Sprint = Schemas['SprintDto'];
export const issueLine = (issue: Issue) => ({
key: issue.key,
title: issue.title,
type: issue.type,
status: issue.status,
statusCategory: issue.statusCategory,
priority: issue.priority,
area: issue.area,
assignee: issue.assignee?.name ?? null,
release: issue.release?.name ?? null,
sprint: issue.sprint?.name ?? null,
parent: issue.parent?.key ?? null,
/** Open tickets it waits for. */
blockedBy: issue.blockedBy.map((b) => b.key),
votes: issue.votes,
storyPoints: issue.storyPoints,
dueDate: issue.dueDate,
customFields: issue.customFields,
labels: issue.labels,
updatedAt: issue.updatedAt,
});
export const projectLine = (project: Project) => ({
key: project.key,
name: project.name,
description: project.description,
isPublic: project.isPublic,
owner: project.owner.name,
members: project.members.length,
updatedAt: project.updatedAt,
});
/** Statuses, types and areas by id: what create/update/move tools accept. */
export const projectSettings = (project: Project) => ({
statuses: project.settings.statuses.map((s) => ({
id: s.id,
name: s.name,
category: s.category,
requiresReason: s.requiresReason,
archived: s.archived,
})),
issueTypes: project.settings.issueTypes.map((t) => ({
id: t.id,
name: t.name,
archived: t.archived,
})),
areas: project.settings.areas.map((a) => ({
id: a.id,
name: a.name,
archived: a.archived,
})),
});
export const releaseLine = (release: Release) => ({
id: release.id,
name: release.name,
status: release.status,
targetDate: release.targetDate,
releasedAt: release.releasedAt,
});
export const sprintLine = (sprint: Sprint) => ({
id: sprint.id,
name: sprint.name,
goal: sprint.goal,
status: sprint.status,
startDate: sprint.startDate,
endDate: sprint.endDate,
});