@vibescope/mcp-server 0.0.1 → 0.2.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.
Files changed (173) hide show
  1. package/README.md +113 -98
  2. package/dist/api-client.d.ts +1169 -0
  3. package/dist/api-client.js +713 -0
  4. package/dist/cli.d.ts +1 -6
  5. package/dist/cli.js +39 -240
  6. package/dist/config/tool-categories.d.ts +31 -0
  7. package/dist/config/tool-categories.js +253 -0
  8. package/dist/handlers/blockers.js +57 -58
  9. package/dist/handlers/bodies-of-work.d.ts +2 -0
  10. package/dist/handlers/bodies-of-work.js +108 -477
  11. package/dist/handlers/cost.d.ts +1 -0
  12. package/dist/handlers/cost.js +35 -113
  13. package/dist/handlers/decisions.d.ts +2 -0
  14. package/dist/handlers/decisions.js +28 -27
  15. package/dist/handlers/deployment.js +113 -828
  16. package/dist/handlers/discovery.d.ts +3 -0
  17. package/dist/handlers/discovery.js +26 -627
  18. package/dist/handlers/fallback.d.ts +2 -0
  19. package/dist/handlers/fallback.js +56 -142
  20. package/dist/handlers/findings.d.ts +8 -1
  21. package/dist/handlers/findings.js +65 -68
  22. package/dist/handlers/git-issues.d.ts +9 -13
  23. package/dist/handlers/git-issues.js +80 -225
  24. package/dist/handlers/ideas.d.ts +3 -0
  25. package/dist/handlers/ideas.js +53 -134
  26. package/dist/handlers/index.d.ts +2 -0
  27. package/dist/handlers/index.js +6 -0
  28. package/dist/handlers/milestones.d.ts +2 -0
  29. package/dist/handlers/milestones.js +51 -98
  30. package/dist/handlers/organizations.js +79 -275
  31. package/dist/handlers/progress.d.ts +2 -0
  32. package/dist/handlers/progress.js +25 -123
  33. package/dist/handlers/project.js +42 -221
  34. package/dist/handlers/requests.d.ts +2 -0
  35. package/dist/handlers/requests.js +23 -83
  36. package/dist/handlers/session.js +119 -590
  37. package/dist/handlers/sprints.d.ts +32 -0
  38. package/dist/handlers/sprints.js +275 -0
  39. package/dist/handlers/tasks.d.ts +7 -10
  40. package/dist/handlers/tasks.js +245 -894
  41. package/dist/handlers/tool-docs.d.ts +9 -0
  42. package/dist/handlers/tool-docs.js +904 -0
  43. package/dist/handlers/types.d.ts +11 -3
  44. package/dist/handlers/validation.d.ts +1 -1
  45. package/dist/handlers/validation.js +38 -153
  46. package/dist/index.js +493 -162
  47. package/dist/knowledge.js +106 -9
  48. package/dist/tools.js +34 -4
  49. package/dist/validators.d.ts +21 -0
  50. package/dist/validators.js +91 -0
  51. package/package.json +2 -3
  52. package/src/api-client.ts +1822 -0
  53. package/src/cli.test.ts +128 -302
  54. package/src/cli.ts +41 -285
  55. package/src/handlers/__test-setup__.ts +215 -0
  56. package/src/handlers/__test-utils__.ts +4 -134
  57. package/src/handlers/blockers.test.ts +114 -124
  58. package/src/handlers/blockers.ts +68 -70
  59. package/src/handlers/bodies-of-work.test.ts +236 -831
  60. package/src/handlers/bodies-of-work.ts +210 -525
  61. package/src/handlers/cost.test.ts +149 -113
  62. package/src/handlers/cost.ts +44 -132
  63. package/src/handlers/decisions.test.ts +111 -209
  64. package/src/handlers/decisions.ts +35 -27
  65. package/src/handlers/deployment.test.ts +193 -239
  66. package/src/handlers/deployment.ts +143 -896
  67. package/src/handlers/discovery.test.ts +20 -67
  68. package/src/handlers/discovery.ts +29 -714
  69. package/src/handlers/fallback.test.ts +206 -361
  70. package/src/handlers/fallback.ts +81 -156
  71. package/src/handlers/findings.test.ts +229 -320
  72. package/src/handlers/findings.ts +76 -64
  73. package/src/handlers/git-issues.test.ts +623 -0
  74. package/src/handlers/git-issues.ts +174 -0
  75. package/src/handlers/ideas.test.ts +229 -343
  76. package/src/handlers/ideas.ts +69 -143
  77. package/src/handlers/index.ts +6 -0
  78. package/src/handlers/milestones.test.ts +167 -281
  79. package/src/handlers/milestones.ts +54 -93
  80. package/src/handlers/organizations.test.ts +275 -467
  81. package/src/handlers/organizations.ts +84 -294
  82. package/src/handlers/progress.test.ts +112 -218
  83. package/src/handlers/progress.ts +29 -142
  84. package/src/handlers/project.test.ts +203 -226
  85. package/src/handlers/project.ts +48 -238
  86. package/src/handlers/requests.test.ts +74 -342
  87. package/src/handlers/requests.ts +25 -83
  88. package/src/handlers/session.test.ts +276 -206
  89. package/src/handlers/session.ts +136 -662
  90. package/src/handlers/sprints.test.ts +711 -0
  91. package/src/handlers/sprints.ts +510 -0
  92. package/src/handlers/tasks.test.ts +669 -353
  93. package/src/handlers/tasks.ts +263 -1015
  94. package/src/handlers/tool-docs.ts +1024 -0
  95. package/src/handlers/types.ts +12 -4
  96. package/src/handlers/validation.test.ts +237 -568
  97. package/src/handlers/validation.ts +43 -167
  98. package/src/index.ts +493 -186
  99. package/src/tools.ts +2532 -0
  100. package/src/validators.test.ts +223 -223
  101. package/src/validators.ts +127 -0
  102. package/tsconfig.json +1 -1
  103. package/vitest.config.ts +14 -13
  104. package/dist/cli.test.d.ts +0 -1
  105. package/dist/cli.test.js +0 -367
  106. package/dist/handlers/__test-utils__.d.ts +0 -72
  107. package/dist/handlers/__test-utils__.js +0 -176
  108. package/dist/handlers/checkouts.d.ts +0 -37
  109. package/dist/handlers/checkouts.js +0 -377
  110. package/dist/handlers/knowledge-query.d.ts +0 -22
  111. package/dist/handlers/knowledge-query.js +0 -253
  112. package/dist/handlers/knowledge.d.ts +0 -12
  113. package/dist/handlers/knowledge.js +0 -108
  114. package/dist/handlers/roles.d.ts +0 -30
  115. package/dist/handlers/roles.js +0 -281
  116. package/dist/handlers/tasks.test.d.ts +0 -1
  117. package/dist/handlers/tasks.test.js +0 -431
  118. package/dist/utils.test.d.ts +0 -1
  119. package/dist/utils.test.js +0 -532
  120. package/dist/validators.test.d.ts +0 -1
  121. package/dist/validators.test.js +0 -176
  122. package/src/knowledge.ts +0 -132
  123. package/src/tmpclaude-0078-cwd +0 -1
  124. package/src/tmpclaude-0ee1-cwd +0 -1
  125. package/src/tmpclaude-2dd5-cwd +0 -1
  126. package/src/tmpclaude-344c-cwd +0 -1
  127. package/src/tmpclaude-3860-cwd +0 -1
  128. package/src/tmpclaude-4b63-cwd +0 -1
  129. package/src/tmpclaude-5c73-cwd +0 -1
  130. package/src/tmpclaude-5ee3-cwd +0 -1
  131. package/src/tmpclaude-6795-cwd +0 -1
  132. package/src/tmpclaude-709e-cwd +0 -1
  133. package/src/tmpclaude-9839-cwd +0 -1
  134. package/src/tmpclaude-d829-cwd +0 -1
  135. package/src/tmpclaude-e072-cwd +0 -1
  136. package/src/tmpclaude-f6ee-cwd +0 -1
  137. package/tmpclaude-0439-cwd +0 -1
  138. package/tmpclaude-132f-cwd +0 -1
  139. package/tmpclaude-15bb-cwd +0 -1
  140. package/tmpclaude-165a-cwd +0 -1
  141. package/tmpclaude-1ba9-cwd +0 -1
  142. package/tmpclaude-21a3-cwd +0 -1
  143. package/tmpclaude-2a38-cwd +0 -1
  144. package/tmpclaude-2adf-cwd +0 -1
  145. package/tmpclaude-2f56-cwd +0 -1
  146. package/tmpclaude-3626-cwd +0 -1
  147. package/tmpclaude-3727-cwd +0 -1
  148. package/tmpclaude-40bc-cwd +0 -1
  149. package/tmpclaude-436f-cwd +0 -1
  150. package/tmpclaude-4783-cwd +0 -1
  151. package/tmpclaude-4b6d-cwd +0 -1
  152. package/tmpclaude-4ba4-cwd +0 -1
  153. package/tmpclaude-51e6-cwd +0 -1
  154. package/tmpclaude-5ecf-cwd +0 -1
  155. package/tmpclaude-6f97-cwd +0 -1
  156. package/tmpclaude-7fb2-cwd +0 -1
  157. package/tmpclaude-825c-cwd +0 -1
  158. package/tmpclaude-8baf-cwd +0 -1
  159. package/tmpclaude-8d9f-cwd +0 -1
  160. package/tmpclaude-975c-cwd +0 -1
  161. package/tmpclaude-9983-cwd +0 -1
  162. package/tmpclaude-a045-cwd +0 -1
  163. package/tmpclaude-ac4a-cwd +0 -1
  164. package/tmpclaude-b593-cwd +0 -1
  165. package/tmpclaude-b891-cwd +0 -1
  166. package/tmpclaude-c032-cwd +0 -1
  167. package/tmpclaude-cf43-cwd +0 -1
  168. package/tmpclaude-d040-cwd +0 -1
  169. package/tmpclaude-dcdd-cwd +0 -1
  170. package/tmpclaude-dcee-cwd +0 -1
  171. package/tmpclaude-e16b-cwd +0 -1
  172. package/tmpclaude-ecd2-cwd +0 -1
  173. package/tmpclaude-f48d-cwd +0 -1
@@ -0,0 +1,510 @@
1
+ /**
2
+ * Sprint Handlers
3
+ *
4
+ * Handles sprint-specific operations, leveraging bodies of work infrastructure:
5
+ * - create_sprint
6
+ * - update_sprint
7
+ * - get_sprint
8
+ * - get_sprints
9
+ * - delete_sprint
10
+ * - start_sprint
11
+ * - complete_sprint
12
+ * - add_task_to_sprint
13
+ * - remove_task_from_sprint
14
+ * - get_sprint_backlog
15
+ * - get_sprint_velocity
16
+ */
17
+
18
+ import type { Handler, HandlerRegistry } from './types.js';
19
+ import { validateRequired, validateUUID, validateEnum } from '../validators.js';
20
+ import { getApiClient } from '../api-client.js';
21
+
22
+ type SprintStatus = 'planning' | 'active' | 'in_review' | 'retrospective' | 'completed' | 'cancelled';
23
+ type TaskPhase = 'pre' | 'core' | 'post';
24
+ type DeployEnvironment = 'development' | 'staging' | 'production';
25
+ type VersionBump = 'patch' | 'minor' | 'major';
26
+
27
+ const SPRINT_STATUSES: SprintStatus[] = ['planning', 'active', 'in_review', 'retrospective', 'completed', 'cancelled'];
28
+ const TASK_PHASES: TaskPhase[] = ['pre', 'core', 'post'];
29
+ const DEPLOY_ENVIRONMENTS: DeployEnvironment[] = ['development', 'staging', 'production'];
30
+ const VERSION_BUMPS: VersionBump[] = ['patch', 'minor', 'major'];
31
+
32
+ export const createSprint: Handler = async (args, ctx) => {
33
+ const {
34
+ project_id,
35
+ title,
36
+ goal,
37
+ start_date,
38
+ end_date,
39
+ auto_deploy_on_completion,
40
+ deploy_environment,
41
+ deploy_version_bump,
42
+ } = args as {
43
+ project_id: string;
44
+ title: string;
45
+ goal?: string;
46
+ start_date: string;
47
+ end_date: string;
48
+ auto_deploy_on_completion?: boolean;
49
+ deploy_environment?: DeployEnvironment;
50
+ deploy_version_bump?: VersionBump;
51
+ };
52
+
53
+ validateRequired(project_id, 'project_id');
54
+ validateUUID(project_id, 'project_id');
55
+ validateRequired(title, 'title');
56
+ validateRequired(start_date, 'start_date');
57
+ validateRequired(end_date, 'end_date');
58
+
59
+ if (deploy_environment) {
60
+ validateEnum(deploy_environment, DEPLOY_ENVIRONMENTS, 'deploy_environment');
61
+ }
62
+ if (deploy_version_bump) {
63
+ validateEnum(deploy_version_bump, VERSION_BUMPS, 'deploy_version_bump');
64
+ }
65
+
66
+ // Validate date format and order
67
+ const startDateObj = new Date(start_date);
68
+ const endDateObj = new Date(end_date);
69
+ if (isNaN(startDateObj.getTime())) {
70
+ throw new Error('Invalid start_date format. Use YYYY-MM-DD');
71
+ }
72
+ if (isNaN(endDateObj.getTime())) {
73
+ throw new Error('Invalid end_date format. Use YYYY-MM-DD');
74
+ }
75
+ if (endDateObj < startDateObj) {
76
+ throw new Error('end_date must be on or after start_date');
77
+ }
78
+
79
+ const { session } = ctx;
80
+ const apiClient = getApiClient();
81
+
82
+ const response = await apiClient.proxy<{
83
+ success: boolean;
84
+ sprint_id: string;
85
+ sprint_number: number;
86
+ }>('create_sprint', {
87
+ project_id,
88
+ title,
89
+ goal,
90
+ start_date,
91
+ end_date,
92
+ auto_deploy_on_completion,
93
+ deploy_environment,
94
+ deploy_version_bump,
95
+ }, {
96
+ session_id: session.currentSessionId,
97
+ persona: session.currentPersona,
98
+ instance_id: session.instanceId
99
+ });
100
+
101
+ if (!response.ok) {
102
+ throw new Error(`Failed to create sprint: ${response.error}`);
103
+ }
104
+
105
+ return {
106
+ result: {
107
+ success: true,
108
+ sprint_id: response.data?.sprint_id,
109
+ sprint_number: response.data?.sprint_number,
110
+ title,
111
+ status: 'planning',
112
+ start_date,
113
+ end_date,
114
+ message: 'Sprint created in planning status. Add tasks with add_task_to_sprint, then call start_sprint when ready.',
115
+ },
116
+ };
117
+ };
118
+
119
+ export const updateSprint: Handler = async (args, ctx) => {
120
+ const {
121
+ sprint_id,
122
+ title,
123
+ goal,
124
+ start_date,
125
+ end_date,
126
+ auto_deploy_on_completion,
127
+ deploy_environment,
128
+ deploy_version_bump,
129
+ } = args as {
130
+ sprint_id: string;
131
+ title?: string;
132
+ goal?: string;
133
+ start_date?: string;
134
+ end_date?: string;
135
+ auto_deploy_on_completion?: boolean;
136
+ deploy_environment?: DeployEnvironment;
137
+ deploy_version_bump?: VersionBump;
138
+ };
139
+
140
+ validateRequired(sprint_id, 'sprint_id');
141
+ validateUUID(sprint_id, 'sprint_id');
142
+
143
+ if (deploy_environment) {
144
+ validateEnum(deploy_environment, DEPLOY_ENVIRONMENTS, 'deploy_environment');
145
+ }
146
+ if (deploy_version_bump) {
147
+ validateEnum(deploy_version_bump, VERSION_BUMPS, 'deploy_version_bump');
148
+ }
149
+
150
+ // Validate dates if provided
151
+ if (start_date) {
152
+ const startDateObj = new Date(start_date);
153
+ if (isNaN(startDateObj.getTime())) {
154
+ throw new Error('Invalid start_date format. Use YYYY-MM-DD');
155
+ }
156
+ }
157
+ if (end_date) {
158
+ const endDateObj = new Date(end_date);
159
+ if (isNaN(endDateObj.getTime())) {
160
+ throw new Error('Invalid end_date format. Use YYYY-MM-DD');
161
+ }
162
+ }
163
+
164
+ const apiClient = getApiClient();
165
+
166
+ const response = await apiClient.proxy<{ success: boolean }>('update_sprint', {
167
+ sprint_id,
168
+ title,
169
+ goal,
170
+ start_date,
171
+ end_date,
172
+ auto_deploy_on_completion,
173
+ deploy_environment,
174
+ deploy_version_bump,
175
+ });
176
+
177
+ if (!response.ok) {
178
+ throw new Error(`Failed to update sprint: ${response.error}`);
179
+ }
180
+
181
+ return { result: { success: true, sprint_id } };
182
+ };
183
+
184
+ export const getSprint: Handler = async (args, ctx) => {
185
+ const { sprint_id, summary_only = false } = args as { sprint_id: string; summary_only?: boolean };
186
+
187
+ validateRequired(sprint_id, 'sprint_id');
188
+ validateUUID(sprint_id, 'sprint_id');
189
+
190
+ const apiClient = getApiClient();
191
+
192
+ // Response type varies based on summary_only
193
+ const response = await apiClient.proxy<{
194
+ id: string;
195
+ title: string;
196
+ goal?: string;
197
+ sprint_number: number;
198
+ sprint_status: SprintStatus;
199
+ start_date: string;
200
+ end_date: string;
201
+ progress_percentage: number;
202
+ velocity_points: number;
203
+ committed_points: number;
204
+ // Full response includes task arrays
205
+ pre_tasks?: unknown[];
206
+ core_tasks?: unknown[];
207
+ post_tasks?: unknown[];
208
+ total_tasks?: number;
209
+ // Summary response includes counts and next task
210
+ task_counts?: {
211
+ pre: { total: number; completed: number };
212
+ core: { total: number; completed: number };
213
+ post: { total: number; completed: number };
214
+ total: number;
215
+ completed: number;
216
+ in_progress: number;
217
+ };
218
+ current_task?: { id: string; title: string } | null;
219
+ next_task?: { id: string; title: string; priority: number } | null;
220
+ }>('get_sprint', { sprint_id, summary_only });
221
+
222
+ if (!response.ok) {
223
+ throw new Error(`Failed to get sprint: ${response.error}`);
224
+ }
225
+
226
+ return { result: response.data };
227
+ };
228
+
229
+ export const getSprints: Handler = async (args, ctx) => {
230
+ const { project_id, status, limit = 20, offset = 0 } = args as {
231
+ project_id: string;
232
+ status?: SprintStatus;
233
+ limit?: number;
234
+ offset?: number;
235
+ };
236
+
237
+ validateRequired(project_id, 'project_id');
238
+ validateUUID(project_id, 'project_id');
239
+
240
+ if (status) {
241
+ validateEnum(status, SPRINT_STATUSES, 'status');
242
+ }
243
+
244
+ const apiClient = getApiClient();
245
+
246
+ const response = await apiClient.proxy<{
247
+ sprints: Array<{
248
+ id: string;
249
+ title: string;
250
+ goal?: string;
251
+ sprint_number: number;
252
+ sprint_status: SprintStatus;
253
+ start_date: string;
254
+ end_date: string;
255
+ progress_percentage: number;
256
+ velocity_points: number;
257
+ committed_points: number;
258
+ }>;
259
+ total_count: number;
260
+ has_more: boolean;
261
+ }>('get_sprints', {
262
+ project_id,
263
+ status,
264
+ limit: Math.min(limit, 100),
265
+ offset,
266
+ });
267
+
268
+ if (!response.ok) {
269
+ throw new Error(`Failed to fetch sprints: ${response.error}`);
270
+ }
271
+
272
+ return { result: response.data };
273
+ };
274
+
275
+ export const deleteSprint: Handler = async (args, ctx) => {
276
+ const { sprint_id } = args as { sprint_id: string };
277
+
278
+ validateRequired(sprint_id, 'sprint_id');
279
+ validateUUID(sprint_id, 'sprint_id');
280
+
281
+ const apiClient = getApiClient();
282
+
283
+ const response = await apiClient.proxy<{ success: boolean }>('delete_sprint', {
284
+ sprint_id
285
+ });
286
+
287
+ if (!response.ok) {
288
+ throw new Error(`Failed to delete sprint: ${response.error}`);
289
+ }
290
+
291
+ return { result: { success: true, message: 'Sprint deleted. Tasks are preserved.' } };
292
+ };
293
+
294
+ export const startSprint: Handler = async (args, ctx) => {
295
+ const { sprint_id } = args as { sprint_id: string };
296
+
297
+ validateRequired(sprint_id, 'sprint_id');
298
+ validateUUID(sprint_id, 'sprint_id');
299
+
300
+ const apiClient = getApiClient();
301
+
302
+ const response = await apiClient.proxy<{
303
+ success: boolean;
304
+ sprint_id: string;
305
+ sprint_status: SprintStatus;
306
+ committed_points: number;
307
+ message: string;
308
+ }>('start_sprint', { sprint_id });
309
+
310
+ if (!response.ok) {
311
+ throw new Error(`Failed to start sprint: ${response.error}`);
312
+ }
313
+
314
+ return { result: response.data };
315
+ };
316
+
317
+ export const completeSprint: Handler = async (args, ctx) => {
318
+ const { sprint_id, retrospective_notes, skip_retrospective } = args as {
319
+ sprint_id: string;
320
+ retrospective_notes?: string;
321
+ skip_retrospective?: boolean;
322
+ };
323
+
324
+ validateRequired(sprint_id, 'sprint_id');
325
+ validateUUID(sprint_id, 'sprint_id');
326
+
327
+ const apiClient = getApiClient();
328
+
329
+ const response = await apiClient.proxy<{
330
+ success: boolean;
331
+ sprint_id: string;
332
+ sprint_status: SprintStatus;
333
+ velocity_points: number;
334
+ committed_points: number;
335
+ deployment_triggered?: boolean;
336
+ message: string;
337
+ }>('complete_sprint', {
338
+ sprint_id,
339
+ retrospective_notes,
340
+ skip_retrospective,
341
+ });
342
+
343
+ if (!response.ok) {
344
+ throw new Error(`Failed to complete sprint: ${response.error}`);
345
+ }
346
+
347
+ return { result: response.data };
348
+ };
349
+
350
+ export const addTaskToSprint: Handler = async (args, ctx) => {
351
+ const { sprint_id, task_id, story_points, phase } = args as {
352
+ sprint_id: string;
353
+ task_id: string;
354
+ story_points?: number;
355
+ phase?: TaskPhase;
356
+ };
357
+
358
+ validateRequired(sprint_id, 'sprint_id');
359
+ validateUUID(sprint_id, 'sprint_id');
360
+ validateRequired(task_id, 'task_id');
361
+ validateUUID(task_id, 'task_id');
362
+
363
+ if (phase) {
364
+ validateEnum(phase, TASK_PHASES, 'phase');
365
+ }
366
+
367
+ if (story_points !== undefined && (story_points < 0 || !Number.isInteger(story_points))) {
368
+ throw new Error('story_points must be a non-negative integer');
369
+ }
370
+
371
+ const apiClient = getApiClient();
372
+
373
+ const response = await apiClient.proxy<{
374
+ success: boolean;
375
+ sprint_id: string;
376
+ task_id: string;
377
+ story_points?: number;
378
+ phase: TaskPhase;
379
+ committed_points: number;
380
+ }>('add_task_to_sprint', {
381
+ sprint_id,
382
+ task_id,
383
+ story_points,
384
+ phase: phase || 'core',
385
+ });
386
+
387
+ if (!response.ok) {
388
+ throw new Error(`Failed to add task to sprint: ${response.error}`);
389
+ }
390
+
391
+ return { result: response.data };
392
+ };
393
+
394
+ export const removeTaskFromSprint: Handler = async (args, ctx) => {
395
+ const { sprint_id, task_id } = args as {
396
+ sprint_id: string;
397
+ task_id: string;
398
+ };
399
+
400
+ validateRequired(sprint_id, 'sprint_id');
401
+ validateUUID(sprint_id, 'sprint_id');
402
+ validateRequired(task_id, 'task_id');
403
+ validateUUID(task_id, 'task_id');
404
+
405
+ const apiClient = getApiClient();
406
+
407
+ const response = await apiClient.proxy<{
408
+ success: boolean;
409
+ sprint_id: string;
410
+ task_id: string;
411
+ committed_points: number;
412
+ message: string;
413
+ }>('remove_task_from_sprint', {
414
+ sprint_id,
415
+ task_id,
416
+ });
417
+
418
+ if (!response.ok) {
419
+ throw new Error(`Failed to remove task from sprint: ${response.error}`);
420
+ }
421
+
422
+ return { result: response.data };
423
+ };
424
+
425
+ export const getSprintBacklog: Handler = async (args, ctx) => {
426
+ const { project_id, sprint_id } = args as {
427
+ project_id: string;
428
+ sprint_id?: string;
429
+ };
430
+
431
+ validateRequired(project_id, 'project_id');
432
+ validateUUID(project_id, 'project_id');
433
+
434
+ if (sprint_id) {
435
+ validateUUID(sprint_id, 'sprint_id');
436
+ }
437
+
438
+ const apiClient = getApiClient();
439
+
440
+ const response = await apiClient.proxy<{
441
+ tasks: Array<{
442
+ id: string;
443
+ title: string;
444
+ priority: number;
445
+ status: string;
446
+ story_points?: number;
447
+ estimated_minutes?: number;
448
+ }>;
449
+ total_count: number;
450
+ }>('get_sprint_backlog', {
451
+ project_id,
452
+ sprint_id,
453
+ });
454
+
455
+ if (!response.ok) {
456
+ throw new Error(`Failed to get sprint backlog: ${response.error}`);
457
+ }
458
+
459
+ return { result: response.data };
460
+ };
461
+
462
+ export const getSprintVelocity: Handler = async (args, ctx) => {
463
+ const { project_id, limit = 10 } = args as {
464
+ project_id: string;
465
+ limit?: number;
466
+ };
467
+
468
+ validateRequired(project_id, 'project_id');
469
+ validateUUID(project_id, 'project_id');
470
+
471
+ const apiClient = getApiClient();
472
+
473
+ const response = await apiClient.proxy<{
474
+ sprints: Array<{
475
+ sprint_number: number;
476
+ title: string;
477
+ committed_points: number;
478
+ velocity_points: number;
479
+ completion_rate: number;
480
+ }>;
481
+ average_velocity: number;
482
+ total_sprints: number;
483
+ }>('get_sprint_velocity', {
484
+ project_id,
485
+ limit: Math.min(limit, 50),
486
+ });
487
+
488
+ if (!response.ok) {
489
+ throw new Error(`Failed to get sprint velocity: ${response.error}`);
490
+ }
491
+
492
+ return { result: response.data };
493
+ };
494
+
495
+ /**
496
+ * Sprint handlers registry
497
+ */
498
+ export const sprintHandlers: HandlerRegistry = {
499
+ create_sprint: createSprint,
500
+ update_sprint: updateSprint,
501
+ get_sprint: getSprint,
502
+ get_sprints: getSprints,
503
+ delete_sprint: deleteSprint,
504
+ start_sprint: startSprint,
505
+ complete_sprint: completeSprint,
506
+ add_task_to_sprint: addTaskToSprint,
507
+ remove_task_from_sprint: removeTaskFromSprint,
508
+ get_sprint_backlog: getSprintBacklog,
509
+ get_sprint_velocity: getSprintVelocity,
510
+ };