@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
@@ -7,10 +7,13 @@
7
7
  * - complete_milestone
8
8
  * - delete_milestone
9
9
  * - get_milestones
10
+ *
11
+ * MIGRATED: Uses Vibescope API client instead of direct Supabase
10
12
  */
11
13
 
12
14
  import type { Handler, HandlerRegistry } from './types.js';
13
15
  import { ValidationError, validateRequired, validateUUID } from '../validators.js';
16
+ import { getApiClient } from '../api-client.js';
14
17
 
15
18
  export const addMilestone: Handler = async (args, ctx) => {
16
19
  const { task_id, title, description, order_index } = args as {
@@ -24,52 +27,23 @@ export const addMilestone: Handler = async (args, ctx) => {
24
27
  validateUUID(task_id, 'task_id');
25
28
  validateRequired(title, 'title');
26
29
 
27
- const { supabase, session } = ctx;
28
-
29
- // Verify task exists
30
- const { data: task, error: taskError } = await supabase
31
- .from('tasks')
32
- .select('id, project_id')
33
- .eq('id', task_id)
34
- .single();
30
+ const { session } = ctx;
31
+ const apiClient = getApiClient();
35
32
 
36
- if (taskError || !task) {
37
- throw new Error('Task not found');
38
- }
33
+ const response = await apiClient.addMilestone(task_id, {
34
+ title,
35
+ description,
36
+ order_index
37
+ }, session.currentSessionId || undefined);
39
38
 
40
- // Get the next order_index if not provided
41
- let orderIdx = order_index;
42
- if (orderIdx === undefined) {
43
- const { data: maxOrder } = await supabase
44
- .from('task_milestones')
45
- .select('order_index')
46
- .eq('task_id', task_id)
47
- .order('order_index', { ascending: false })
48
- .limit(1)
49
- .single();
50
-
51
- orderIdx = maxOrder ? maxOrder.order_index + 1 : 0;
39
+ if (!response.ok) {
40
+ throw new Error(`Failed to add milestone: ${response.error}`);
52
41
  }
53
42
 
54
- const { data: milestone, error } = await supabase
55
- .from('task_milestones')
56
- .insert({
57
- task_id,
58
- title,
59
- description: description || null,
60
- order_index: orderIdx,
61
- created_by: 'agent',
62
- created_by_session_id: session.currentSessionId,
63
- })
64
- .select()
65
- .single();
66
-
67
- if (error) throw error;
68
-
69
43
  return {
70
44
  result: {
71
45
  success: true,
72
- milestone,
46
+ milestone_id: response.data?.milestone_id,
73
47
  },
74
48
  };
75
49
  };
@@ -86,39 +60,35 @@ export const updateMilestone: Handler = async (args, ctx) => {
86
60
  validateRequired(milestone_id, 'milestone_id');
87
61
  validateUUID(milestone_id, 'milestone_id');
88
62
 
89
- const updates: Record<string, unknown> = {};
90
- if (title !== undefined) updates.title = title;
91
- if (description !== undefined) updates.description = description;
92
- if (order_index !== undefined) updates.order_index = order_index;
63
+ // Validate status if provided
93
64
  if (status !== undefined) {
94
65
  if (!['pending', 'in_progress', 'completed'].includes(status)) {
95
66
  throw new ValidationError('status must be pending, in_progress, or completed');
96
67
  }
97
- updates.status = status;
98
- if (status === 'completed') {
99
- updates.completed_at = new Date().toISOString();
100
- } else {
101
- updates.completed_at = null;
102
- }
103
68
  }
104
69
 
105
- if (Object.keys(updates).length === 0) {
70
+ // Check that at least one field is provided
71
+ if (title === undefined && description === undefined && status === undefined && order_index === undefined) {
106
72
  throw new ValidationError('At least one field to update is required');
107
73
  }
108
74
 
109
- const { data: milestone, error } = await ctx.supabase
110
- .from('task_milestones')
111
- .update(updates)
112
- .eq('id', milestone_id)
113
- .select()
114
- .single();
75
+ const apiClient = getApiClient();
76
+
77
+ const response = await apiClient.updateMilestone(milestone_id, {
78
+ title,
79
+ description,
80
+ status: status as 'pending' | 'in_progress' | 'completed' | undefined,
81
+ order_index
82
+ });
115
83
 
116
- if (error) throw error;
84
+ if (!response.ok) {
85
+ throw new Error(`Failed to update milestone: ${response.error}`);
86
+ }
117
87
 
118
88
  return {
119
89
  result: {
120
90
  success: true,
121
- milestone,
91
+ milestone: response.data?.milestone,
122
92
  },
123
93
  };
124
94
  };
@@ -129,22 +99,18 @@ export const completeMilestone: Handler = async (args, ctx) => {
129
99
  validateRequired(milestone_id, 'milestone_id');
130
100
  validateUUID(milestone_id, 'milestone_id');
131
101
 
132
- const { data: milestone, error } = await ctx.supabase
133
- .from('task_milestones')
134
- .update({
135
- status: 'completed',
136
- completed_at: new Date().toISOString(),
137
- })
138
- .eq('id', milestone_id)
139
- .select()
140
- .single();
102
+ const apiClient = getApiClient();
103
+
104
+ const response = await apiClient.completeMilestone(milestone_id);
141
105
 
142
- if (error) throw error;
106
+ if (!response.ok) {
107
+ throw new Error(`Failed to complete milestone: ${response.error}`);
108
+ }
143
109
 
144
110
  return {
145
111
  result: {
146
112
  success: true,
147
- milestone,
113
+ milestone: response.data?.milestone,
148
114
  },
149
115
  };
150
116
  };
@@ -155,12 +121,13 @@ export const deleteMilestone: Handler = async (args, ctx) => {
155
121
  validateRequired(milestone_id, 'milestone_id');
156
122
  validateUUID(milestone_id, 'milestone_id');
157
123
 
158
- const { error } = await ctx.supabase
159
- .from('task_milestones')
160
- .delete()
161
- .eq('id', milestone_id);
124
+ const apiClient = getApiClient();
162
125
 
163
- if (error) throw error;
126
+ const response = await apiClient.deleteMilestone(milestone_id);
127
+
128
+ if (!response.ok) {
129
+ throw new Error(`Failed to delete milestone: ${response.error}`);
130
+ }
164
131
 
165
132
  return {
166
133
  result: {
@@ -176,30 +143,24 @@ export const getMilestones: Handler = async (args, ctx) => {
176
143
  validateRequired(task_id, 'task_id');
177
144
  validateUUID(task_id, 'task_id');
178
145
 
179
- const { data: milestones, error } = await ctx.supabase
180
- .from('task_milestones')
181
- .select('*')
182
- .eq('task_id', task_id)
183
- .order('order_index', { ascending: true });
146
+ const apiClient = getApiClient();
184
147
 
185
- if (error) throw error;
148
+ const response = await apiClient.getMilestones(task_id);
186
149
 
187
- // Calculate progress stats
188
- const total = milestones?.length || 0;
189
- const completed = milestones?.filter(m => m.status === 'completed').length || 0;
190
- const in_progress = milestones?.filter(m => m.status === 'in_progress').length || 0;
191
- const pending = total - completed - in_progress;
192
- const progress_percentage = total > 0 ? Math.round((completed / total) * 100) : 0;
150
+ if (!response.ok) {
151
+ throw new Error(`Failed to get milestones: ${response.error}`);
152
+ }
193
153
 
154
+ // Stats are calculated server-side now
194
155
  return {
195
156
  result: {
196
- milestones: milestones || [],
197
- stats: {
198
- total,
199
- completed,
200
- in_progress,
201
- pending,
202
- progress_percentage,
157
+ milestones: response.data?.milestones || [],
158
+ stats: response.data?.stats || {
159
+ total: 0,
160
+ completed: 0,
161
+ in_progress: 0,
162
+ pending: 0,
163
+ progress_percentage: 0,
203
164
  },
204
165
  },
205
166
  };