@denvermullets/jait 1.3.0 → 1.5.0

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.
@@ -0,0 +1,32 @@
1
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ export interface HierarchyNode {
3
+ id: number;
4
+ identifier: string;
5
+ title: string;
6
+ priority: string;
7
+ lane: {
8
+ id: number;
9
+ name: string;
10
+ category: string | null;
11
+ };
12
+ assignee: {
13
+ id: number;
14
+ name: string;
15
+ } | null;
16
+ closed: boolean;
17
+ sub_issue_count: number;
18
+ sub_issues: HierarchyNode[];
19
+ }
20
+ export interface Hierarchy {
21
+ issue_id: number;
22
+ root_id: number;
23
+ ancestor_ids: number[];
24
+ truncated: boolean;
25
+ tree: HierarchyNode;
26
+ blocks: {
27
+ blocking_issue_id: number;
28
+ blocked_issue_id: number;
29
+ }[];
30
+ }
31
+ export declare function formatHierarchy(h: Hierarchy): string;
32
+ export declare function registerSubIssueTools(server: McpServer): void;
@@ -0,0 +1,90 @@
1
+ import { z } from "zod";
2
+ import { apiRequest } from "../api-client.js";
3
+ import { formatIssue } from "./issues.js";
4
+ export function formatHierarchy(h) {
5
+ const byId = new Map();
6
+ const lines = [];
7
+ const walk = (node, depth) => {
8
+ byId.set(node.id, node);
9
+ const marker = node.id === h.issue_id ? " ← this issue" : "";
10
+ const assignee = node.assignee ? ` | ${node.assignee.name}` : "";
11
+ const check = node.closed ? "[x]" : "[ ]";
12
+ lines.push(`${" ".repeat(depth)}- ${check} ${node.identifier}: ${node.title} (${node.lane.name} | ${node.priority}${assignee} | ID: ${node.id})${marker}`);
13
+ for (const child of node.sub_issues)
14
+ walk(child, depth + 1);
15
+ };
16
+ walk(h.tree, 0);
17
+ if (h.truncated)
18
+ lines.push(" … deeper levels omitted (raise max_depth to see more)");
19
+ if (h.blocks.length > 0) {
20
+ const name = (id) => byId.get(id)?.identifier ?? `#${id}`;
21
+ lines.push("", "Blocking links within this tree:");
22
+ for (const b of h.blocks)
23
+ lines.push(` ${name(b.blocking_issue_id)} blocks ${name(b.blocked_issue_id)}`);
24
+ }
25
+ return lines.join("\n");
26
+ }
27
+ export function registerSubIssueTools(server) {
28
+ server.tool("get_issue_hierarchy", "Get the full sub-issue tree an issue belongs to, rooted at its top-level ancestor, with each issue's status and any blocking links between issues in the tree. For an issue's direct sub-issues only, get_issue is enough; to list them with filters, use list_issues with parent_issue_id.", {
29
+ team_id: z.number().describe("Team ID"),
30
+ issue_id: z.number().describe("Any issue in the tree"),
31
+ max_depth: z
32
+ .number()
33
+ .int()
34
+ .min(1)
35
+ .max(10)
36
+ .optional()
37
+ .describe("How many levels below the root to include (1-10, default 10)"),
38
+ }, async ({ team_id, issue_id, max_depth }) => {
39
+ const hierarchy = await apiRequest(`/api/v1/teams/${team_id}/issues/${issue_id}/hierarchy`, { params: { max_depth } });
40
+ return {
41
+ content: [{ type: "text", text: formatHierarchy(hierarchy) }],
42
+ };
43
+ });
44
+ server.tool("add_sub_issue", "Make an existing issue a sub-issue of another issue in the same team. If it already has a parent, it is moved under the new one. To create a brand-new sub-issue, use create_issue with parent_issue_id instead.", {
45
+ team_id: z.number().describe("Team ID"),
46
+ parent_issue_id: z.number().describe("The issue to nest under"),
47
+ issue_id: z.number().describe("The issue that becomes the sub-issue"),
48
+ }, async ({ team_id, parent_issue_id, issue_id }) => {
49
+ const issue = await apiRequest(`/api/v1/teams/${team_id}/issues/${issue_id}`, { method: "PATCH", body: { issue: { parent_issue_id } } });
50
+ return {
51
+ content: [
52
+ {
53
+ type: "text",
54
+ text: `Sub-issue added under issue ${parent_issue_id}:\n\n${formatIssue(issue)}`,
55
+ },
56
+ ],
57
+ };
58
+ });
59
+ server.tool("remove_sub_issue", "Detach a sub-issue from its parent, making it a top-level issue. The issue itself is kept.", {
60
+ team_id: z.number().describe("Team ID"),
61
+ parent_issue_id: z
62
+ .number()
63
+ .describe("The current parent; checked so the wrong link isn't removed"),
64
+ issue_id: z.number().describe("The sub-issue to detach"),
65
+ }, async ({ team_id, parent_issue_id, issue_id }) => {
66
+ const current = await apiRequest(`/api/v1/teams/${team_id}/issues/${issue_id}`);
67
+ if (current.parent_issue_id !== parent_issue_id) {
68
+ const actual = current.parent_issue
69
+ ? `${current.parent_issue.identifier} (ID: ${current.parent_issue.id})`
70
+ : "no parent";
71
+ return {
72
+ content: [
73
+ {
74
+ type: "text",
75
+ text: `Error: ${current.identifier} is not a sub-issue of issue ${parent_issue_id}; it has ${actual}. Nothing was changed.`,
76
+ },
77
+ ],
78
+ };
79
+ }
80
+ const issue = await apiRequest(`/api/v1/teams/${team_id}/issues/${issue_id}`, { method: "PATCH", body: { issue: { parent_issue_id: null } } });
81
+ return {
82
+ content: [
83
+ {
84
+ type: "text",
85
+ text: `Sub-issue detached; it is now top-level:\n\n${formatIssue(issue)}`,
86
+ },
87
+ ],
88
+ };
89
+ });
90
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@denvermullets/jait",
3
- "version": "1.3.0",
3
+ "version": "1.5.0",
4
4
  "description": "MCP server for Just Another Issue Tracker",
5
5
  "type": "module",
6
6
  "bin": {
@@ -18,12 +18,12 @@
18
18
  "prepublishOnly": "yarn build"
19
19
  },
20
20
  "dependencies": {
21
- "@modelcontextprotocol/sdk": "^1.29.0",
22
- "zod": "^4.4.3"
21
+ "@modelcontextprotocol/sdk": "^1.32.2",
22
+ "zod": "^4.6.7"
23
23
  },
24
24
  "devDependencies": {
25
- "@types/node": "^26.1.0",
26
- "typescript": "^6.0.3"
25
+ "@types/node": "^26.6.6",
26
+ "typescript": "^7.0.2"
27
27
  },
28
28
  "engines": {
29
29
  "node": ">=18.0.0"