@vibescope/mcp-server 0.0.1 → 0.1.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.
- package/README.md +113 -98
- package/dist/api-client.d.ts +1114 -0
- package/dist/api-client.js +698 -0
- package/dist/cli.d.ts +1 -6
- package/dist/cli.js +39 -240
- package/dist/config/tool-categories.d.ts +31 -0
- package/dist/config/tool-categories.js +253 -0
- package/dist/handlers/blockers.js +57 -58
- package/dist/handlers/bodies-of-work.d.ts +2 -0
- package/dist/handlers/bodies-of-work.js +106 -476
- package/dist/handlers/cost.d.ts +1 -0
- package/dist/handlers/cost.js +35 -113
- package/dist/handlers/decisions.d.ts +2 -0
- package/dist/handlers/decisions.js +28 -27
- package/dist/handlers/deployment.js +112 -828
- package/dist/handlers/discovery.js +31 -0
- package/dist/handlers/fallback.d.ts +2 -0
- package/dist/handlers/fallback.js +39 -134
- package/dist/handlers/findings.js +43 -67
- package/dist/handlers/git-issues.d.ts +9 -13
- package/dist/handlers/git-issues.js +80 -225
- package/dist/handlers/ideas.d.ts +3 -0
- package/dist/handlers/ideas.js +53 -134
- package/dist/handlers/index.d.ts +2 -0
- package/dist/handlers/index.js +6 -0
- package/dist/handlers/milestones.d.ts +2 -0
- package/dist/handlers/milestones.js +51 -98
- package/dist/handlers/organizations.js +79 -275
- package/dist/handlers/progress.d.ts +2 -0
- package/dist/handlers/progress.js +25 -123
- package/dist/handlers/project.js +42 -221
- package/dist/handlers/requests.d.ts +2 -0
- package/dist/handlers/requests.js +23 -83
- package/dist/handlers/session.js +99 -585
- package/dist/handlers/sprints.d.ts +32 -0
- package/dist/handlers/sprints.js +274 -0
- package/dist/handlers/tasks.d.ts +7 -10
- package/dist/handlers/tasks.js +230 -900
- package/dist/handlers/tool-docs.d.ts +8 -0
- package/dist/handlers/tool-docs.js +657 -0
- package/dist/handlers/types.d.ts +11 -3
- package/dist/handlers/validation.d.ts +1 -1
- package/dist/handlers/validation.js +26 -153
- package/dist/index.js +473 -160
- package/dist/knowledge.js +106 -9
- package/dist/tools.js +4 -0
- package/dist/validators.d.ts +21 -0
- package/dist/validators.js +91 -0
- package/package.json +2 -3
- package/src/api-client.ts +1752 -0
- package/src/cli.test.ts +128 -302
- package/src/cli.ts +41 -285
- package/src/handlers/__test-setup__.ts +210 -0
- package/src/handlers/__test-utils__.ts +4 -134
- package/src/handlers/blockers.test.ts +114 -124
- package/src/handlers/blockers.ts +68 -70
- package/src/handlers/bodies-of-work.test.ts +236 -831
- package/src/handlers/bodies-of-work.ts +194 -525
- package/src/handlers/cost.test.ts +149 -113
- package/src/handlers/cost.ts +44 -132
- package/src/handlers/decisions.test.ts +111 -209
- package/src/handlers/decisions.ts +35 -27
- package/src/handlers/deployment.test.ts +193 -239
- package/src/handlers/deployment.ts +140 -895
- package/src/handlers/discovery.test.ts +20 -67
- package/src/handlers/discovery.ts +32 -0
- package/src/handlers/fallback.test.ts +128 -361
- package/src/handlers/fallback.ts +62 -148
- package/src/handlers/findings.test.ts +127 -345
- package/src/handlers/findings.ts +49 -66
- package/src/handlers/git-issues.test.ts +623 -0
- package/src/handlers/git-issues.ts +174 -0
- package/src/handlers/ideas.test.ts +229 -343
- package/src/handlers/ideas.ts +69 -143
- package/src/handlers/index.ts +6 -0
- package/src/handlers/milestones.test.ts +167 -281
- package/src/handlers/milestones.ts +54 -93
- package/src/handlers/organizations.test.ts +275 -467
- package/src/handlers/organizations.ts +84 -294
- package/src/handlers/progress.test.ts +112 -218
- package/src/handlers/progress.ts +29 -142
- package/src/handlers/project.test.ts +203 -226
- package/src/handlers/project.ts +48 -238
- package/src/handlers/requests.test.ts +74 -342
- package/src/handlers/requests.ts +25 -83
- package/src/handlers/session.test.ts +241 -206
- package/src/handlers/session.ts +110 -657
- package/src/handlers/sprints.test.ts +711 -0
- package/src/handlers/sprints.ts +497 -0
- package/src/handlers/tasks.test.ts +608 -353
- package/src/handlers/tasks.ts +248 -1025
- package/src/handlers/types.ts +12 -4
- package/src/handlers/validation.test.ts +189 -572
- package/src/handlers/validation.ts +29 -166
- package/src/index.ts +473 -184
- package/src/knowledge.ts +107 -9
- package/src/tools.ts +2506 -0
- package/src/validators.test.ts +223 -223
- package/src/validators.ts +127 -0
- package/tsconfig.json +1 -1
- package/vitest.config.ts +14 -13
- package/dist/cli.test.d.ts +0 -1
- package/dist/cli.test.js +0 -367
- package/dist/handlers/__test-utils__.d.ts +0 -72
- package/dist/handlers/__test-utils__.js +0 -176
- package/dist/handlers/checkouts.d.ts +0 -37
- package/dist/handlers/checkouts.js +0 -377
- package/dist/handlers/knowledge-query.d.ts +0 -22
- package/dist/handlers/knowledge-query.js +0 -253
- package/dist/handlers/knowledge.d.ts +0 -12
- package/dist/handlers/knowledge.js +0 -108
- package/dist/handlers/roles.d.ts +0 -30
- package/dist/handlers/roles.js +0 -281
- package/dist/handlers/tasks.test.d.ts +0 -1
- package/dist/handlers/tasks.test.js +0 -431
- package/dist/utils.test.d.ts +0 -1
- package/dist/utils.test.js +0 -532
- package/dist/validators.test.d.ts +0 -1
- package/dist/validators.test.js +0 -176
- package/src/tmpclaude-0078-cwd +0 -1
- package/src/tmpclaude-0ee1-cwd +0 -1
- package/src/tmpclaude-2dd5-cwd +0 -1
- package/src/tmpclaude-344c-cwd +0 -1
- package/src/tmpclaude-3860-cwd +0 -1
- package/src/tmpclaude-4b63-cwd +0 -1
- package/src/tmpclaude-5c73-cwd +0 -1
- package/src/tmpclaude-5ee3-cwd +0 -1
- package/src/tmpclaude-6795-cwd +0 -1
- package/src/tmpclaude-709e-cwd +0 -1
- package/src/tmpclaude-9839-cwd +0 -1
- package/src/tmpclaude-d829-cwd +0 -1
- package/src/tmpclaude-e072-cwd +0 -1
- package/src/tmpclaude-f6ee-cwd +0 -1
- package/tmpclaude-0439-cwd +0 -1
- package/tmpclaude-132f-cwd +0 -1
- package/tmpclaude-15bb-cwd +0 -1
- package/tmpclaude-165a-cwd +0 -1
- package/tmpclaude-1ba9-cwd +0 -1
- package/tmpclaude-21a3-cwd +0 -1
- package/tmpclaude-2a38-cwd +0 -1
- package/tmpclaude-2adf-cwd +0 -1
- package/tmpclaude-2f56-cwd +0 -1
- package/tmpclaude-3626-cwd +0 -1
- package/tmpclaude-3727-cwd +0 -1
- package/tmpclaude-40bc-cwd +0 -1
- package/tmpclaude-436f-cwd +0 -1
- package/tmpclaude-4783-cwd +0 -1
- package/tmpclaude-4b6d-cwd +0 -1
- package/tmpclaude-4ba4-cwd +0 -1
- package/tmpclaude-51e6-cwd +0 -1
- package/tmpclaude-5ecf-cwd +0 -1
- package/tmpclaude-6f97-cwd +0 -1
- package/tmpclaude-7fb2-cwd +0 -1
- package/tmpclaude-825c-cwd +0 -1
- package/tmpclaude-8baf-cwd +0 -1
- package/tmpclaude-8d9f-cwd +0 -1
- package/tmpclaude-975c-cwd +0 -1
- package/tmpclaude-9983-cwd +0 -1
- package/tmpclaude-a045-cwd +0 -1
- package/tmpclaude-ac4a-cwd +0 -1
- package/tmpclaude-b593-cwd +0 -1
- package/tmpclaude-b891-cwd +0 -1
- package/tmpclaude-c032-cwd +0 -1
- package/tmpclaude-cf43-cwd +0 -1
- package/tmpclaude-d040-cwd +0 -1
- package/tmpclaude-dcdd-cwd +0 -1
- package/tmpclaude-dcee-cwd +0 -1
- package/tmpclaude-e16b-cwd +0 -1
- package/tmpclaude-ecd2-cwd +0 -1
- package/tmpclaude-f48d-cwd +0 -1
|
@@ -0,0 +1,497 @@
|
|
|
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 } = args as { sprint_id: string };
|
|
186
|
+
|
|
187
|
+
validateRequired(sprint_id, 'sprint_id');
|
|
188
|
+
validateUUID(sprint_id, 'sprint_id');
|
|
189
|
+
|
|
190
|
+
const apiClient = getApiClient();
|
|
191
|
+
|
|
192
|
+
const response = await apiClient.proxy<{
|
|
193
|
+
id: string;
|
|
194
|
+
title: string;
|
|
195
|
+
goal?: string;
|
|
196
|
+
sprint_number: number;
|
|
197
|
+
sprint_status: SprintStatus;
|
|
198
|
+
start_date: string;
|
|
199
|
+
end_date: string;
|
|
200
|
+
progress_percentage: number;
|
|
201
|
+
velocity_points: number;
|
|
202
|
+
committed_points: number;
|
|
203
|
+
pre_tasks: unknown[];
|
|
204
|
+
core_tasks: unknown[];
|
|
205
|
+
post_tasks: unknown[];
|
|
206
|
+
total_tasks: number;
|
|
207
|
+
}>('get_sprint', { sprint_id });
|
|
208
|
+
|
|
209
|
+
if (!response.ok) {
|
|
210
|
+
throw new Error(`Failed to get sprint: ${response.error}`);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
return { result: response.data };
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
export const getSprints: Handler = async (args, ctx) => {
|
|
217
|
+
const { project_id, status, limit = 20, offset = 0 } = args as {
|
|
218
|
+
project_id: string;
|
|
219
|
+
status?: SprintStatus;
|
|
220
|
+
limit?: number;
|
|
221
|
+
offset?: number;
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
validateRequired(project_id, 'project_id');
|
|
225
|
+
validateUUID(project_id, 'project_id');
|
|
226
|
+
|
|
227
|
+
if (status) {
|
|
228
|
+
validateEnum(status, SPRINT_STATUSES, 'status');
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
const apiClient = getApiClient();
|
|
232
|
+
|
|
233
|
+
const response = await apiClient.proxy<{
|
|
234
|
+
sprints: Array<{
|
|
235
|
+
id: string;
|
|
236
|
+
title: string;
|
|
237
|
+
goal?: string;
|
|
238
|
+
sprint_number: number;
|
|
239
|
+
sprint_status: SprintStatus;
|
|
240
|
+
start_date: string;
|
|
241
|
+
end_date: string;
|
|
242
|
+
progress_percentage: number;
|
|
243
|
+
velocity_points: number;
|
|
244
|
+
committed_points: number;
|
|
245
|
+
}>;
|
|
246
|
+
total_count: number;
|
|
247
|
+
has_more: boolean;
|
|
248
|
+
}>('get_sprints', {
|
|
249
|
+
project_id,
|
|
250
|
+
status,
|
|
251
|
+
limit: Math.min(limit, 100),
|
|
252
|
+
offset,
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
if (!response.ok) {
|
|
256
|
+
throw new Error(`Failed to fetch sprints: ${response.error}`);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
return { result: response.data };
|
|
260
|
+
};
|
|
261
|
+
|
|
262
|
+
export const deleteSprint: Handler = async (args, ctx) => {
|
|
263
|
+
const { sprint_id } = args as { sprint_id: string };
|
|
264
|
+
|
|
265
|
+
validateRequired(sprint_id, 'sprint_id');
|
|
266
|
+
validateUUID(sprint_id, 'sprint_id');
|
|
267
|
+
|
|
268
|
+
const apiClient = getApiClient();
|
|
269
|
+
|
|
270
|
+
const response = await apiClient.proxy<{ success: boolean }>('delete_sprint', {
|
|
271
|
+
sprint_id
|
|
272
|
+
});
|
|
273
|
+
|
|
274
|
+
if (!response.ok) {
|
|
275
|
+
throw new Error(`Failed to delete sprint: ${response.error}`);
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
return { result: { success: true, message: 'Sprint deleted. Tasks are preserved.' } };
|
|
279
|
+
};
|
|
280
|
+
|
|
281
|
+
export const startSprint: Handler = async (args, ctx) => {
|
|
282
|
+
const { sprint_id } = args as { sprint_id: string };
|
|
283
|
+
|
|
284
|
+
validateRequired(sprint_id, 'sprint_id');
|
|
285
|
+
validateUUID(sprint_id, 'sprint_id');
|
|
286
|
+
|
|
287
|
+
const apiClient = getApiClient();
|
|
288
|
+
|
|
289
|
+
const response = await apiClient.proxy<{
|
|
290
|
+
success: boolean;
|
|
291
|
+
sprint_id: string;
|
|
292
|
+
sprint_status: SprintStatus;
|
|
293
|
+
committed_points: number;
|
|
294
|
+
message: string;
|
|
295
|
+
}>('start_sprint', { sprint_id });
|
|
296
|
+
|
|
297
|
+
if (!response.ok) {
|
|
298
|
+
throw new Error(`Failed to start sprint: ${response.error}`);
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
return { result: response.data };
|
|
302
|
+
};
|
|
303
|
+
|
|
304
|
+
export const completeSprint: Handler = async (args, ctx) => {
|
|
305
|
+
const { sprint_id, retrospective_notes, skip_retrospective } = args as {
|
|
306
|
+
sprint_id: string;
|
|
307
|
+
retrospective_notes?: string;
|
|
308
|
+
skip_retrospective?: boolean;
|
|
309
|
+
};
|
|
310
|
+
|
|
311
|
+
validateRequired(sprint_id, 'sprint_id');
|
|
312
|
+
validateUUID(sprint_id, 'sprint_id');
|
|
313
|
+
|
|
314
|
+
const apiClient = getApiClient();
|
|
315
|
+
|
|
316
|
+
const response = await apiClient.proxy<{
|
|
317
|
+
success: boolean;
|
|
318
|
+
sprint_id: string;
|
|
319
|
+
sprint_status: SprintStatus;
|
|
320
|
+
velocity_points: number;
|
|
321
|
+
committed_points: number;
|
|
322
|
+
deployment_triggered?: boolean;
|
|
323
|
+
message: string;
|
|
324
|
+
}>('complete_sprint', {
|
|
325
|
+
sprint_id,
|
|
326
|
+
retrospective_notes,
|
|
327
|
+
skip_retrospective,
|
|
328
|
+
});
|
|
329
|
+
|
|
330
|
+
if (!response.ok) {
|
|
331
|
+
throw new Error(`Failed to complete sprint: ${response.error}`);
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
return { result: response.data };
|
|
335
|
+
};
|
|
336
|
+
|
|
337
|
+
export const addTaskToSprint: Handler = async (args, ctx) => {
|
|
338
|
+
const { sprint_id, task_id, story_points, phase } = args as {
|
|
339
|
+
sprint_id: string;
|
|
340
|
+
task_id: string;
|
|
341
|
+
story_points?: number;
|
|
342
|
+
phase?: TaskPhase;
|
|
343
|
+
};
|
|
344
|
+
|
|
345
|
+
validateRequired(sprint_id, 'sprint_id');
|
|
346
|
+
validateUUID(sprint_id, 'sprint_id');
|
|
347
|
+
validateRequired(task_id, 'task_id');
|
|
348
|
+
validateUUID(task_id, 'task_id');
|
|
349
|
+
|
|
350
|
+
if (phase) {
|
|
351
|
+
validateEnum(phase, TASK_PHASES, 'phase');
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
if (story_points !== undefined && (story_points < 0 || !Number.isInteger(story_points))) {
|
|
355
|
+
throw new Error('story_points must be a non-negative integer');
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
const apiClient = getApiClient();
|
|
359
|
+
|
|
360
|
+
const response = await apiClient.proxy<{
|
|
361
|
+
success: boolean;
|
|
362
|
+
sprint_id: string;
|
|
363
|
+
task_id: string;
|
|
364
|
+
story_points?: number;
|
|
365
|
+
phase: TaskPhase;
|
|
366
|
+
committed_points: number;
|
|
367
|
+
}>('add_task_to_sprint', {
|
|
368
|
+
sprint_id,
|
|
369
|
+
task_id,
|
|
370
|
+
story_points,
|
|
371
|
+
phase: phase || 'core',
|
|
372
|
+
});
|
|
373
|
+
|
|
374
|
+
if (!response.ok) {
|
|
375
|
+
throw new Error(`Failed to add task to sprint: ${response.error}`);
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
return { result: response.data };
|
|
379
|
+
};
|
|
380
|
+
|
|
381
|
+
export const removeTaskFromSprint: Handler = async (args, ctx) => {
|
|
382
|
+
const { sprint_id, task_id } = args as {
|
|
383
|
+
sprint_id: string;
|
|
384
|
+
task_id: string;
|
|
385
|
+
};
|
|
386
|
+
|
|
387
|
+
validateRequired(sprint_id, 'sprint_id');
|
|
388
|
+
validateUUID(sprint_id, 'sprint_id');
|
|
389
|
+
validateRequired(task_id, 'task_id');
|
|
390
|
+
validateUUID(task_id, 'task_id');
|
|
391
|
+
|
|
392
|
+
const apiClient = getApiClient();
|
|
393
|
+
|
|
394
|
+
const response = await apiClient.proxy<{
|
|
395
|
+
success: boolean;
|
|
396
|
+
sprint_id: string;
|
|
397
|
+
task_id: string;
|
|
398
|
+
committed_points: number;
|
|
399
|
+
message: string;
|
|
400
|
+
}>('remove_task_from_sprint', {
|
|
401
|
+
sprint_id,
|
|
402
|
+
task_id,
|
|
403
|
+
});
|
|
404
|
+
|
|
405
|
+
if (!response.ok) {
|
|
406
|
+
throw new Error(`Failed to remove task from sprint: ${response.error}`);
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
return { result: response.data };
|
|
410
|
+
};
|
|
411
|
+
|
|
412
|
+
export const getSprintBacklog: Handler = async (args, ctx) => {
|
|
413
|
+
const { project_id, sprint_id } = args as {
|
|
414
|
+
project_id: string;
|
|
415
|
+
sprint_id?: string;
|
|
416
|
+
};
|
|
417
|
+
|
|
418
|
+
validateRequired(project_id, 'project_id');
|
|
419
|
+
validateUUID(project_id, 'project_id');
|
|
420
|
+
|
|
421
|
+
if (sprint_id) {
|
|
422
|
+
validateUUID(sprint_id, 'sprint_id');
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
const apiClient = getApiClient();
|
|
426
|
+
|
|
427
|
+
const response = await apiClient.proxy<{
|
|
428
|
+
tasks: Array<{
|
|
429
|
+
id: string;
|
|
430
|
+
title: string;
|
|
431
|
+
priority: number;
|
|
432
|
+
status: string;
|
|
433
|
+
story_points?: number;
|
|
434
|
+
estimated_minutes?: number;
|
|
435
|
+
}>;
|
|
436
|
+
total_count: number;
|
|
437
|
+
}>('get_sprint_backlog', {
|
|
438
|
+
project_id,
|
|
439
|
+
sprint_id,
|
|
440
|
+
});
|
|
441
|
+
|
|
442
|
+
if (!response.ok) {
|
|
443
|
+
throw new Error(`Failed to get sprint backlog: ${response.error}`);
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
return { result: response.data };
|
|
447
|
+
};
|
|
448
|
+
|
|
449
|
+
export const getSprintVelocity: Handler = async (args, ctx) => {
|
|
450
|
+
const { project_id, limit = 10 } = args as {
|
|
451
|
+
project_id: string;
|
|
452
|
+
limit?: number;
|
|
453
|
+
};
|
|
454
|
+
|
|
455
|
+
validateRequired(project_id, 'project_id');
|
|
456
|
+
validateUUID(project_id, 'project_id');
|
|
457
|
+
|
|
458
|
+
const apiClient = getApiClient();
|
|
459
|
+
|
|
460
|
+
const response = await apiClient.proxy<{
|
|
461
|
+
sprints: Array<{
|
|
462
|
+
sprint_number: number;
|
|
463
|
+
title: string;
|
|
464
|
+
committed_points: number;
|
|
465
|
+
velocity_points: number;
|
|
466
|
+
completion_rate: number;
|
|
467
|
+
}>;
|
|
468
|
+
average_velocity: number;
|
|
469
|
+
total_sprints: number;
|
|
470
|
+
}>('get_sprint_velocity', {
|
|
471
|
+
project_id,
|
|
472
|
+
limit: Math.min(limit, 50),
|
|
473
|
+
});
|
|
474
|
+
|
|
475
|
+
if (!response.ok) {
|
|
476
|
+
throw new Error(`Failed to get sprint velocity: ${response.error}`);
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
return { result: response.data };
|
|
480
|
+
};
|
|
481
|
+
|
|
482
|
+
/**
|
|
483
|
+
* Sprint handlers registry
|
|
484
|
+
*/
|
|
485
|
+
export const sprintHandlers: HandlerRegistry = {
|
|
486
|
+
create_sprint: createSprint,
|
|
487
|
+
update_sprint: updateSprint,
|
|
488
|
+
get_sprint: getSprint,
|
|
489
|
+
get_sprints: getSprints,
|
|
490
|
+
delete_sprint: deleteSprint,
|
|
491
|
+
start_sprint: startSprint,
|
|
492
|
+
complete_sprint: completeSprint,
|
|
493
|
+
add_task_to_sprint: addTaskToSprint,
|
|
494
|
+
remove_task_from_sprint: removeTaskFromSprint,
|
|
495
|
+
get_sprint_backlog: getSprintBacklog,
|
|
496
|
+
get_sprint_velocity: getSprintVelocity,
|
|
497
|
+
};
|