@k-system/tickr-mcp 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/formatters.js +6 -0
- package/dist/index.js +4 -0
- package/dist/tools/add-comment.js +3 -3
- package/dist/tools/add-relation.d.ts +4 -0
- package/dist/tools/add-relation.js +30 -0
- package/dist/tools/create-ticket.js +5 -3
- package/dist/tools/get-ticket.js +8 -0
- package/dist/tools/remove-relation.d.ts +4 -0
- package/dist/tools/remove-relation.js +26 -0
- package/dist/tools/update-ticket.js +3 -0
- package/dist/types.d.ts +11 -0
- package/package.json +1 -1
package/dist/formatters.js
CHANGED
|
@@ -37,6 +37,12 @@ export function formatTicketMarkdown(t) {
|
|
|
37
37
|
lines.push(`| ${i} | ${item.area} | ${item.fileOrDetail} | ${item.status} | ${item.note || "-"} |`);
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
|
+
if (t.relations && t.relations.length > 0) {
|
|
41
|
+
lines.push("", "## Relations", "", "| Type | Direction | Ticket | Title | Status |", "|------|-----------|--------|-------|--------|");
|
|
42
|
+
for (const r of t.relations) {
|
|
43
|
+
lines.push(`| ${r.type} | ${r.direction} | ${r.displayNumber} | ${r.title} | ${r.status} |`);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
40
46
|
if (t.comments?.length > 0) {
|
|
41
47
|
lines.push("", "## Comments", "");
|
|
42
48
|
for (const c of t.comments) {
|
package/dist/index.js
CHANGED
|
@@ -24,6 +24,8 @@ import { registerAssignEpic } from "./tools/assign-epic.js";
|
|
|
24
24
|
import { registerPollDevQueue } from "./tools/poll-dev-queue.js";
|
|
25
25
|
import { registerCompleteDevTask } from "./tools/complete-dev-task.js";
|
|
26
26
|
import { registerWhoami } from "./tools/whoami.js";
|
|
27
|
+
import { registerAddRelation } from "./tools/add-relation.js";
|
|
28
|
+
import { registerRemoveRelation } from "./tools/remove-relation.js";
|
|
27
29
|
// Resources
|
|
28
30
|
import { registerTicketResource } from "./resources/ticket-resource.js";
|
|
29
31
|
import { registerProjectResource } from "./resources/project-resource.js";
|
|
@@ -55,6 +57,8 @@ async function main() {
|
|
|
55
57
|
registerPollDevQueue(server, api);
|
|
56
58
|
registerCompleteDevTask(server, api);
|
|
57
59
|
registerWhoami(server, api);
|
|
60
|
+
registerAddRelation(server, api);
|
|
61
|
+
registerRemoveRelation(server, api);
|
|
58
62
|
// Registrace resources
|
|
59
63
|
registerTicketResource(server, api);
|
|
60
64
|
registerProjectResource(server, api);
|
|
@@ -5,9 +5,9 @@ export function registerAddComment(server, api) {
|
|
|
5
5
|
text: z.string().describe("Comment text (markdown)"),
|
|
6
6
|
}, async (params) => {
|
|
7
7
|
try {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
});
|
|
8
|
+
// Unescapovat double-escaped newlines z MCP tool parametrů
|
|
9
|
+
const text = params.text.replace(/\\n/g, "\n");
|
|
10
|
+
await api.post(`/api/tickets/${params.number}/comments`, { text });
|
|
11
11
|
return {
|
|
12
12
|
content: [
|
|
13
13
|
{ type: "text", text: `Comment added to ${params.number}` },
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export function registerAddRelation(server, api) {
|
|
3
|
+
server.tool("add_relation", "Create a relation between two tickets (blocks, relates_to, duplicates)", {
|
|
4
|
+
source_number: z.string().describe("Source ticket display number, e.g. 'TKR-42' or 'TKR-BUG-0042'"),
|
|
5
|
+
target_number: z.string().describe("Target ticket display number"),
|
|
6
|
+
type: z.enum(["blocks", "relates_to", "duplicates"]).describe("Relation type: 'blocks' means source blocks target"),
|
|
7
|
+
}, async (params) => {
|
|
8
|
+
try {
|
|
9
|
+
const result = await api.post(`/api/tickets/${params.source_number}/relations`, {
|
|
10
|
+
targetDisplayNumber: params.target_number,
|
|
11
|
+
type: params.type,
|
|
12
|
+
});
|
|
13
|
+
return {
|
|
14
|
+
content: [
|
|
15
|
+
{
|
|
16
|
+
type: "text",
|
|
17
|
+
text: `Relation created: ${params.source_number} --${params.type}--> ${params.target_number}`,
|
|
18
|
+
},
|
|
19
|
+
],
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
catch (err) {
|
|
23
|
+
return {
|
|
24
|
+
content: [{ type: "text", text: `Error: ${err instanceof Error ? err.message : String(err)}` }],
|
|
25
|
+
isError: true,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=add-relation.js.map
|
|
@@ -10,19 +10,21 @@ export function registerCreateTicket(server, api) {
|
|
|
10
10
|
affected_parts: z.array(z.string()).optional(),
|
|
11
11
|
}, async (params) => {
|
|
12
12
|
try {
|
|
13
|
-
|
|
13
|
+
// Unescapovat double-escaped newlines z MCP tool parametrů
|
|
14
|
+
const content = params.content?.replace(/\\n/g, "\n");
|
|
15
|
+
const result = await api.post(`/api/projects/${params.project}/tickets`, {
|
|
14
16
|
type: params.type,
|
|
15
17
|
title: params.title,
|
|
16
18
|
scope: params.scope,
|
|
17
19
|
priority: params.priority,
|
|
18
|
-
content
|
|
20
|
+
content,
|
|
19
21
|
affectedParts: params.affected_parts,
|
|
20
22
|
});
|
|
21
23
|
return {
|
|
22
24
|
content: [
|
|
23
25
|
{
|
|
24
26
|
type: "text",
|
|
25
|
-
text: `Created ${
|
|
27
|
+
text: `Created ${result.number}: ${params.title}`,
|
|
26
28
|
},
|
|
27
29
|
],
|
|
28
30
|
};
|
package/dist/tools/get-ticket.js
CHANGED
|
@@ -6,6 +6,14 @@ export function registerGetTicket(server, api) {
|
|
|
6
6
|
}, async (params) => {
|
|
7
7
|
try {
|
|
8
8
|
const ticket = await api.get(`/api/tickets/${params.number}`);
|
|
9
|
+
// Načti relace zvlášť — API vrací relace na samostatném endpointu
|
|
10
|
+
try {
|
|
11
|
+
const relations = await api.get(`/api/tickets/${params.number}/relations`);
|
|
12
|
+
ticket.relations = relations;
|
|
13
|
+
}
|
|
14
|
+
catch {
|
|
15
|
+
// Relace nejsou kritické — pokud selžou, pokračuj bez nich
|
|
16
|
+
}
|
|
9
17
|
const md = formatTicketMarkdown(ticket);
|
|
10
18
|
return { content: [{ type: "text", text: md }] };
|
|
11
19
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export function registerRemoveRelation(server, api) {
|
|
3
|
+
server.tool("remove_relation", "Remove a relation from a ticket by relation ID", {
|
|
4
|
+
source_number: z.string().describe("Ticket display number that owns the relation, e.g. 'TKR-42'"),
|
|
5
|
+
relation_id: z.string().describe("Relation UUID to remove (from get_ticket relations list)"),
|
|
6
|
+
}, async (params) => {
|
|
7
|
+
try {
|
|
8
|
+
await api.delete(`/api/tickets/${params.source_number}/relations/${params.relation_id}`);
|
|
9
|
+
return {
|
|
10
|
+
content: [
|
|
11
|
+
{
|
|
12
|
+
type: "text",
|
|
13
|
+
text: `Relation ${params.relation_id} removed from ${params.source_number}`,
|
|
14
|
+
},
|
|
15
|
+
],
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
catch (err) {
|
|
19
|
+
return {
|
|
20
|
+
content: [{ type: "text", text: `Error: ${err instanceof Error ? err.message : String(err)}` }],
|
|
21
|
+
isError: true,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=remove-relation.js.map
|
|
@@ -11,6 +11,9 @@ export function registerUpdateTicket(server, api) {
|
|
|
11
11
|
}, async (params) => {
|
|
12
12
|
try {
|
|
13
13
|
const { number, ...updates } = params;
|
|
14
|
+
// Unescapovat double-escaped newlines z MCP tool parametrů
|
|
15
|
+
if (updates.content)
|
|
16
|
+
updates.content = updates.content.replace(/\\n/g, "\n");
|
|
14
17
|
const ticket = await api.put(`/api/tickets/${number}`, updates);
|
|
15
18
|
return {
|
|
16
19
|
content: [
|
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
/** Sdílené typy pro MCP server */
|
|
2
|
+
export interface TicketRelation {
|
|
3
|
+
id: string;
|
|
4
|
+
type: string;
|
|
5
|
+
direction: string;
|
|
6
|
+
displayNumber: string;
|
|
7
|
+
title: string;
|
|
8
|
+
status: string;
|
|
9
|
+
statusColor: string | null;
|
|
10
|
+
createdAt: string;
|
|
11
|
+
}
|
|
2
12
|
export interface Ticket {
|
|
3
13
|
id: string;
|
|
4
14
|
projectId: string;
|
|
@@ -16,6 +26,7 @@ export interface Ticket {
|
|
|
16
26
|
affectedParts: string[] | string | null;
|
|
17
27
|
implementationItems: ImplementationItem[];
|
|
18
28
|
comments: Comment[];
|
|
29
|
+
relations?: TicketRelation[];
|
|
19
30
|
createdAt: string;
|
|
20
31
|
updatedAt: string;
|
|
21
32
|
}
|
package/package.json
CHANGED