@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.
Files changed (170) hide show
  1. package/README.md +113 -98
  2. package/dist/api-client.d.ts +1114 -0
  3. package/dist/api-client.js +698 -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 +106 -476
  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 +112 -828
  16. package/dist/handlers/discovery.js +31 -0
  17. package/dist/handlers/fallback.d.ts +2 -0
  18. package/dist/handlers/fallback.js +39 -134
  19. package/dist/handlers/findings.js +43 -67
  20. package/dist/handlers/git-issues.d.ts +9 -13
  21. package/dist/handlers/git-issues.js +80 -225
  22. package/dist/handlers/ideas.d.ts +3 -0
  23. package/dist/handlers/ideas.js +53 -134
  24. package/dist/handlers/index.d.ts +2 -0
  25. package/dist/handlers/index.js +6 -0
  26. package/dist/handlers/milestones.d.ts +2 -0
  27. package/dist/handlers/milestones.js +51 -98
  28. package/dist/handlers/organizations.js +79 -275
  29. package/dist/handlers/progress.d.ts +2 -0
  30. package/dist/handlers/progress.js +25 -123
  31. package/dist/handlers/project.js +42 -221
  32. package/dist/handlers/requests.d.ts +2 -0
  33. package/dist/handlers/requests.js +23 -83
  34. package/dist/handlers/session.js +99 -585
  35. package/dist/handlers/sprints.d.ts +32 -0
  36. package/dist/handlers/sprints.js +274 -0
  37. package/dist/handlers/tasks.d.ts +7 -10
  38. package/dist/handlers/tasks.js +230 -900
  39. package/dist/handlers/tool-docs.d.ts +8 -0
  40. package/dist/handlers/tool-docs.js +657 -0
  41. package/dist/handlers/types.d.ts +11 -3
  42. package/dist/handlers/validation.d.ts +1 -1
  43. package/dist/handlers/validation.js +26 -153
  44. package/dist/index.js +473 -160
  45. package/dist/knowledge.js +106 -9
  46. package/dist/tools.js +4 -0
  47. package/dist/validators.d.ts +21 -0
  48. package/dist/validators.js +91 -0
  49. package/package.json +2 -3
  50. package/src/api-client.ts +1752 -0
  51. package/src/cli.test.ts +128 -302
  52. package/src/cli.ts +41 -285
  53. package/src/handlers/__test-setup__.ts +210 -0
  54. package/src/handlers/__test-utils__.ts +4 -134
  55. package/src/handlers/blockers.test.ts +114 -124
  56. package/src/handlers/blockers.ts +68 -70
  57. package/src/handlers/bodies-of-work.test.ts +236 -831
  58. package/src/handlers/bodies-of-work.ts +194 -525
  59. package/src/handlers/cost.test.ts +149 -113
  60. package/src/handlers/cost.ts +44 -132
  61. package/src/handlers/decisions.test.ts +111 -209
  62. package/src/handlers/decisions.ts +35 -27
  63. package/src/handlers/deployment.test.ts +193 -239
  64. package/src/handlers/deployment.ts +140 -895
  65. package/src/handlers/discovery.test.ts +20 -67
  66. package/src/handlers/discovery.ts +32 -0
  67. package/src/handlers/fallback.test.ts +128 -361
  68. package/src/handlers/fallback.ts +62 -148
  69. package/src/handlers/findings.test.ts +127 -345
  70. package/src/handlers/findings.ts +49 -66
  71. package/src/handlers/git-issues.test.ts +623 -0
  72. package/src/handlers/git-issues.ts +174 -0
  73. package/src/handlers/ideas.test.ts +229 -343
  74. package/src/handlers/ideas.ts +69 -143
  75. package/src/handlers/index.ts +6 -0
  76. package/src/handlers/milestones.test.ts +167 -281
  77. package/src/handlers/milestones.ts +54 -93
  78. package/src/handlers/organizations.test.ts +275 -467
  79. package/src/handlers/organizations.ts +84 -294
  80. package/src/handlers/progress.test.ts +112 -218
  81. package/src/handlers/progress.ts +29 -142
  82. package/src/handlers/project.test.ts +203 -226
  83. package/src/handlers/project.ts +48 -238
  84. package/src/handlers/requests.test.ts +74 -342
  85. package/src/handlers/requests.ts +25 -83
  86. package/src/handlers/session.test.ts +241 -206
  87. package/src/handlers/session.ts +110 -657
  88. package/src/handlers/sprints.test.ts +711 -0
  89. package/src/handlers/sprints.ts +497 -0
  90. package/src/handlers/tasks.test.ts +608 -353
  91. package/src/handlers/tasks.ts +248 -1025
  92. package/src/handlers/types.ts +12 -4
  93. package/src/handlers/validation.test.ts +189 -572
  94. package/src/handlers/validation.ts +29 -166
  95. package/src/index.ts +473 -184
  96. package/src/knowledge.ts +107 -9
  97. package/src/tools.ts +2506 -0
  98. package/src/validators.test.ts +223 -223
  99. package/src/validators.ts +127 -0
  100. package/tsconfig.json +1 -1
  101. package/vitest.config.ts +14 -13
  102. package/dist/cli.test.d.ts +0 -1
  103. package/dist/cli.test.js +0 -367
  104. package/dist/handlers/__test-utils__.d.ts +0 -72
  105. package/dist/handlers/__test-utils__.js +0 -176
  106. package/dist/handlers/checkouts.d.ts +0 -37
  107. package/dist/handlers/checkouts.js +0 -377
  108. package/dist/handlers/knowledge-query.d.ts +0 -22
  109. package/dist/handlers/knowledge-query.js +0 -253
  110. package/dist/handlers/knowledge.d.ts +0 -12
  111. package/dist/handlers/knowledge.js +0 -108
  112. package/dist/handlers/roles.d.ts +0 -30
  113. package/dist/handlers/roles.js +0 -281
  114. package/dist/handlers/tasks.test.d.ts +0 -1
  115. package/dist/handlers/tasks.test.js +0 -431
  116. package/dist/utils.test.d.ts +0 -1
  117. package/dist/utils.test.js +0 -532
  118. package/dist/validators.test.d.ts +0 -1
  119. package/dist/validators.test.js +0 -176
  120. package/src/tmpclaude-0078-cwd +0 -1
  121. package/src/tmpclaude-0ee1-cwd +0 -1
  122. package/src/tmpclaude-2dd5-cwd +0 -1
  123. package/src/tmpclaude-344c-cwd +0 -1
  124. package/src/tmpclaude-3860-cwd +0 -1
  125. package/src/tmpclaude-4b63-cwd +0 -1
  126. package/src/tmpclaude-5c73-cwd +0 -1
  127. package/src/tmpclaude-5ee3-cwd +0 -1
  128. package/src/tmpclaude-6795-cwd +0 -1
  129. package/src/tmpclaude-709e-cwd +0 -1
  130. package/src/tmpclaude-9839-cwd +0 -1
  131. package/src/tmpclaude-d829-cwd +0 -1
  132. package/src/tmpclaude-e072-cwd +0 -1
  133. package/src/tmpclaude-f6ee-cwd +0 -1
  134. package/tmpclaude-0439-cwd +0 -1
  135. package/tmpclaude-132f-cwd +0 -1
  136. package/tmpclaude-15bb-cwd +0 -1
  137. package/tmpclaude-165a-cwd +0 -1
  138. package/tmpclaude-1ba9-cwd +0 -1
  139. package/tmpclaude-21a3-cwd +0 -1
  140. package/tmpclaude-2a38-cwd +0 -1
  141. package/tmpclaude-2adf-cwd +0 -1
  142. package/tmpclaude-2f56-cwd +0 -1
  143. package/tmpclaude-3626-cwd +0 -1
  144. package/tmpclaude-3727-cwd +0 -1
  145. package/tmpclaude-40bc-cwd +0 -1
  146. package/tmpclaude-436f-cwd +0 -1
  147. package/tmpclaude-4783-cwd +0 -1
  148. package/tmpclaude-4b6d-cwd +0 -1
  149. package/tmpclaude-4ba4-cwd +0 -1
  150. package/tmpclaude-51e6-cwd +0 -1
  151. package/tmpclaude-5ecf-cwd +0 -1
  152. package/tmpclaude-6f97-cwd +0 -1
  153. package/tmpclaude-7fb2-cwd +0 -1
  154. package/tmpclaude-825c-cwd +0 -1
  155. package/tmpclaude-8baf-cwd +0 -1
  156. package/tmpclaude-8d9f-cwd +0 -1
  157. package/tmpclaude-975c-cwd +0 -1
  158. package/tmpclaude-9983-cwd +0 -1
  159. package/tmpclaude-a045-cwd +0 -1
  160. package/tmpclaude-ac4a-cwd +0 -1
  161. package/tmpclaude-b593-cwd +0 -1
  162. package/tmpclaude-b891-cwd +0 -1
  163. package/tmpclaude-c032-cwd +0 -1
  164. package/tmpclaude-cf43-cwd +0 -1
  165. package/tmpclaude-d040-cwd +0 -1
  166. package/tmpclaude-dcdd-cwd +0 -1
  167. package/tmpclaude-dcee-cwd +0 -1
  168. package/tmpclaude-e16b-cwd +0 -1
  169. package/tmpclaude-ecd2-cwd +0 -1
  170. package/tmpclaude-f48d-cwd +0 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Validation Handlers
2
+ * Validation Handlers (Migrated to API Client)
3
3
  *
4
4
  * Handles cross-agent task validation:
5
5
  * - get_tasks_awaiting_validation
@@ -9,7 +9,7 @@
9
9
 
10
10
  import type { Handler, HandlerRegistry } from './types.js';
11
11
  import { validateRequired, validateUUID } from '../validators.js';
12
- import { getProjectGitConfig, getValidationApprovedGitInstructions } from './tasks.js';
12
+ import { getApiClient } from '../api-client.js';
13
13
 
14
14
  export const getTasksAwaitingValidation: Handler = async (args, ctx) => {
15
15
  const { project_id } = args as { project_id: string };
@@ -17,36 +17,14 @@ export const getTasksAwaitingValidation: Handler = async (args, ctx) => {
17
17
  validateRequired(project_id, 'project_id');
18
18
  validateUUID(project_id, 'project_id');
19
19
 
20
- const { supabase } = ctx;
21
-
22
- const { data: tasks, error } = await supabase
23
- .from('tasks')
24
- .select('id, title, completed_at, completed_by_session_id, reviewing_by_session_id, reviewing_started_at')
25
- .eq('project_id', project_id)
26
- .eq('status', 'completed')
27
- .is('validated_at', null)
28
- .order('completed_at', { ascending: true });
29
-
30
- if (error) throw new Error(`Failed to fetch tasks: ${error.message}`);
31
-
32
- // Add review status info
33
- const now = new Date();
34
- const tasksWithStatus = (tasks || []).map((t) => ({
35
- ...t,
36
- being_reviewed: !!t.reviewing_by_session_id,
37
- review_minutes: t.reviewing_started_at
38
- ? Math.floor((now.getTime() - new Date(t.reviewing_started_at).getTime()) / 60000)
39
- : null,
40
- }));
41
-
42
- return {
43
- result: {
44
- tasks: tasksWithStatus,
45
- hint: tasksWithStatus.length > 0
46
- ? 'Call claim_validation(task_id) before reviewing to show "being reviewed" on dashboard.'
47
- : undefined,
48
- },
49
- };
20
+ const apiClient = getApiClient();
21
+ const response = await apiClient.getTasksAwaitingValidation(project_id);
22
+
23
+ if (!response.ok) {
24
+ throw new Error(response.error || 'Failed to fetch tasks awaiting validation');
25
+ }
26
+
27
+ return { result: response.data };
50
28
  };
51
29
 
52
30
  export const claimValidation: Handler = async (args, ctx) => {
@@ -55,50 +33,17 @@ export const claimValidation: Handler = async (args, ctx) => {
55
33
  validateRequired(task_id, 'task_id');
56
34
  validateUUID(task_id, 'task_id');
57
35
 
58
- const { supabase, session } = ctx;
36
+ const { session } = ctx;
59
37
  const currentSessionId = session.currentSessionId;
60
38
 
61
- // Get the task first
62
- const { data: task, error: fetchError } = await supabase
63
- .from('tasks')
64
- .select('id, title, status, validated_at, completed_by_session_id, reviewing_by_session_id')
65
- .eq('id', task_id)
66
- .single();
67
-
68
- if (fetchError || !task) throw new Error('Task not found');
69
-
70
- if (task.status !== 'completed') {
71
- throw new Error('Can only claim completed tasks for review');
72
- }
73
-
74
- if (task.validated_at) {
75
- throw new Error('Task has already been validated');
76
- }
39
+ const apiClient = getApiClient();
40
+ const response = await apiClient.claimValidation(task_id, currentSessionId || undefined);
77
41
 
78
- if (task.reviewing_by_session_id && task.reviewing_by_session_id !== currentSessionId) {
79
- throw new Error('Task is already being reviewed by another agent');
42
+ if (!response.ok) {
43
+ throw new Error(response.error || 'Failed to claim task for validation');
80
44
  }
81
45
 
82
- // Claim the task for review
83
- const { error } = await supabase
84
- .from('tasks')
85
- .update({
86
- reviewing_by_session_id: currentSessionId,
87
- reviewing_started_at: new Date().toISOString(),
88
- })
89
- .eq('id', task_id);
90
-
91
- if (error) throw new Error(`Failed to claim task: ${error.message}`);
92
-
93
- return {
94
- result: {
95
- success: true,
96
- task_id,
97
- title: task.title,
98
- message: 'Task claimed for review. Dashboard now shows "being reviewed".',
99
- next_step: `Review the implementation, then call validate_task(task_id: "${task_id}", approved: true/false, validation_notes: "...")`,
100
- },
101
- };
46
+ return { result: response.data };
102
47
  };
103
48
 
104
49
  export const validateTask: Handler = async (args, ctx) => {
@@ -111,106 +56,24 @@ export const validateTask: Handler = async (args, ctx) => {
111
56
  validateRequired(task_id, 'task_id');
112
57
  validateUUID(task_id, 'task_id');
113
58
 
114
- const { supabase, session } = ctx;
115
- const currentSessionId = session.currentSessionId;
116
-
117
- // Get the task to validate (including git_branch for workflow instructions)
118
- const { data: task, error: fetchError } = await supabase
119
- .from('tasks')
120
- .select('id, title, status, validated_at, completed_by_session_id, project_id, git_branch')
121
- .eq('id', task_id)
122
- .single();
59
+ if (approved === undefined) {
60
+ throw new Error('approved is required');
61
+ }
123
62
 
124
- if (fetchError || !task) throw new Error('Task not found');
63
+ const { session } = ctx;
64
+ const currentSessionId = session.currentSessionId;
125
65
 
126
- if (task.status !== 'completed') {
127
- throw new Error('Can only validate completed tasks');
128
- }
66
+ const apiClient = getApiClient();
67
+ const response = await apiClient.validateTask(task_id, {
68
+ approved,
69
+ validation_notes,
70
+ }, currentSessionId || undefined);
129
71
 
130
- if (task.validated_at) {
131
- throw new Error('Task has already been validated');
72
+ if (!response.ok) {
73
+ throw new Error(response.error || 'Failed to validate task');
132
74
  }
133
75
 
134
- // Check if this is self-validation
135
- const isSelfValidation = currentSessionId && task.completed_by_session_id === currentSessionId;
136
-
137
- if (approved) {
138
- // Mark as validated and clear reviewing status
139
- const { error } = await supabase
140
- .from('tasks')
141
- .update({
142
- validated_at: new Date().toISOString(),
143
- validated_by_session_id: currentSessionId,
144
- reviewing_by_session_id: null,
145
- reviewing_started_at: null,
146
- })
147
- .eq('id', task_id);
148
-
149
- if (error) throw new Error(`Failed to validate task: ${error.message}`);
150
-
151
- // Log the validation
152
- await supabase.from('progress_logs').insert({
153
- project_id: task.project_id,
154
- task_id,
155
- summary: `Validated: ${task.title}${isSelfValidation ? ' (self)' : ''}`,
156
- details: validation_notes || null,
157
- created_by: 'agent',
158
- created_by_session_id: currentSessionId,
159
- });
160
-
161
- // Build result with optional git merge instructions
162
- const result: Record<string, unknown> = {
163
- success: true,
164
- validated_task_id: task_id,
165
- self_validated: isSelfValidation,
166
- };
167
-
168
- // Include git workflow instructions for merging
169
- const gitConfig = await getProjectGitConfig(supabase, task.project_id);
170
- if (gitConfig && gitConfig.git_workflow !== 'none') {
171
- const gitInstructions = getValidationApprovedGitInstructions(gitConfig, task.git_branch);
172
- if (gitInstructions) {
173
- result.git_workflow = {
174
- workflow: gitConfig.git_workflow,
175
- action: 'merge',
176
- ...gitInstructions,
177
- };
178
- }
179
- }
180
-
181
- return { result };
182
- } else {
183
- // Validation failed - reopen the task and clear reviewing status
184
- const { error } = await supabase
185
- .from('tasks')
186
- .update({
187
- status: 'in_progress',
188
- completed_at: null,
189
- progress_percentage: 80,
190
- reviewing_by_session_id: null,
191
- reviewing_started_at: null,
192
- })
193
- .eq('id', task_id);
194
-
195
- if (error) throw new Error(`Failed to reopen task: ${error.message}`);
196
-
197
- // Log the rejection
198
- await supabase.from('progress_logs').insert({
199
- project_id: task.project_id,
200
- task_id,
201
- summary: `Validation failed: ${task.title}`,
202
- details: validation_notes || 'Needs more work',
203
- created_by: 'agent',
204
- created_by_session_id: currentSessionId,
205
- });
206
-
207
- return {
208
- result: {
209
- success: true,
210
- reopened_task_id: task_id,
211
- },
212
- };
213
- }
76
+ return { result: response.data };
214
77
  };
215
78
 
216
79
  /**