@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.
- package/README.md +113 -98
- package/dist/api-client.d.ts +1169 -0
- package/dist/api-client.js +713 -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 +108 -477
- 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 +113 -828
- package/dist/handlers/discovery.d.ts +3 -0
- package/dist/handlers/discovery.js +26 -627
- package/dist/handlers/fallback.d.ts +2 -0
- package/dist/handlers/fallback.js +56 -142
- package/dist/handlers/findings.d.ts +8 -1
- package/dist/handlers/findings.js +65 -68
- 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 +119 -590
- package/dist/handlers/sprints.d.ts +32 -0
- package/dist/handlers/sprints.js +275 -0
- package/dist/handlers/tasks.d.ts +7 -10
- package/dist/handlers/tasks.js +245 -894
- package/dist/handlers/tool-docs.d.ts +9 -0
- package/dist/handlers/tool-docs.js +904 -0
- package/dist/handlers/types.d.ts +11 -3
- package/dist/handlers/validation.d.ts +1 -1
- package/dist/handlers/validation.js +38 -153
- package/dist/index.js +493 -162
- package/dist/knowledge.js +106 -9
- package/dist/tools.js +34 -4
- package/dist/validators.d.ts +21 -0
- package/dist/validators.js +91 -0
- package/package.json +2 -3
- package/src/api-client.ts +1822 -0
- package/src/cli.test.ts +128 -302
- package/src/cli.ts +41 -285
- package/src/handlers/__test-setup__.ts +215 -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 +210 -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 +143 -896
- package/src/handlers/discovery.test.ts +20 -67
- package/src/handlers/discovery.ts +29 -714
- package/src/handlers/fallback.test.ts +206 -361
- package/src/handlers/fallback.ts +81 -156
- package/src/handlers/findings.test.ts +229 -320
- package/src/handlers/findings.ts +76 -64
- 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 +276 -206
- package/src/handlers/session.ts +136 -662
- package/src/handlers/sprints.test.ts +711 -0
- package/src/handlers/sprints.ts +510 -0
- package/src/handlers/tasks.test.ts +669 -353
- package/src/handlers/tasks.ts +263 -1015
- package/src/handlers/tool-docs.ts +1024 -0
- package/src/handlers/types.ts +12 -4
- package/src/handlers/validation.test.ts +237 -568
- package/src/handlers/validation.ts +43 -167
- package/src/index.ts +493 -186
- package/src/tools.ts +2532 -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/knowledge.ts +0 -132
- 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
package/src/handlers/fallback.ts
CHANGED
|
@@ -6,11 +6,14 @@
|
|
|
6
6
|
* - stop_fallback_activity
|
|
7
7
|
* - get_activity_history
|
|
8
8
|
* - get_activity_schedules
|
|
9
|
+
*
|
|
10
|
+
* MIGRATED: Uses Vibescope API client instead of direct Supabase
|
|
9
11
|
*/
|
|
10
12
|
|
|
11
13
|
import type { Handler, HandlerRegistry } from './types.js';
|
|
12
14
|
import { validateRequired, validateUUID } from '../validators.js';
|
|
13
15
|
import { FALLBACK_ACTIVITIES } from '../utils.js';
|
|
16
|
+
import { getApiClient } from '../api-client.js';
|
|
14
17
|
|
|
15
18
|
const VALID_ACTIVITIES = [
|
|
16
19
|
'feature_ideation',
|
|
@@ -36,35 +39,39 @@ export const startFallbackActivity: Handler = async (args, ctx) => {
|
|
|
36
39
|
throw new Error(`Invalid activity. Must be one of: ${VALID_ACTIVITIES.join(', ')}`);
|
|
37
40
|
}
|
|
38
41
|
|
|
39
|
-
const {
|
|
40
|
-
const
|
|
42
|
+
const { session } = ctx;
|
|
43
|
+
const apiClient = getApiClient();
|
|
41
44
|
|
|
42
|
-
|
|
43
|
-
const { error: updateError } = await supabase
|
|
44
|
-
.from('agent_sessions')
|
|
45
|
-
.update({
|
|
46
|
-
current_fallback_activity: activity,
|
|
47
|
-
current_task_id: null, // Clear any task when starting fallback
|
|
48
|
-
status: 'active',
|
|
49
|
-
last_synced_at: new Date().toISOString(),
|
|
50
|
-
})
|
|
51
|
-
.eq('id', currentSessionId);
|
|
45
|
+
const response = await apiClient.startFallbackActivity(project_id, activity, session.currentSessionId || undefined);
|
|
52
46
|
|
|
53
|
-
if (
|
|
47
|
+
if (!response.ok) {
|
|
48
|
+
throw new Error(`Failed to start fallback activity: ${response.error}`);
|
|
49
|
+
}
|
|
54
50
|
|
|
55
51
|
// Get the activity details for the response
|
|
56
52
|
const activityInfo = FALLBACK_ACTIVITIES.find((a) => a.activity === activity);
|
|
57
53
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
message: `Started fallback activity: ${activityInfo?.title || activity}`,
|
|
66
|
-
},
|
|
54
|
+
const result: Record<string, unknown> = {
|
|
55
|
+
success: true,
|
|
56
|
+
activity,
|
|
57
|
+
title: activityInfo?.title || activity,
|
|
58
|
+
description: activityInfo?.description || '',
|
|
59
|
+
prompt: activityInfo?.prompt || '',
|
|
60
|
+
message: response.data?.message || `Started fallback activity: ${activityInfo?.title || activity}`,
|
|
67
61
|
};
|
|
62
|
+
|
|
63
|
+
// Pass through worktree guidance if provided
|
|
64
|
+
if (response.data?.git_workflow) {
|
|
65
|
+
result.git_workflow = response.data.git_workflow;
|
|
66
|
+
}
|
|
67
|
+
if (response.data?.worktree_setup) {
|
|
68
|
+
result.worktree_setup = response.data.worktree_setup;
|
|
69
|
+
}
|
|
70
|
+
if (response.data?.next_step) {
|
|
71
|
+
result.next_step = response.data.next_step;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return { result };
|
|
68
75
|
};
|
|
69
76
|
|
|
70
77
|
export const stopFallbackActivity: Handler = async (args, ctx) => {
|
|
@@ -73,91 +80,19 @@ export const stopFallbackActivity: Handler = async (args, ctx) => {
|
|
|
73
80
|
validateRequired(project_id, 'project_id');
|
|
74
81
|
validateUUID(project_id, 'project_id');
|
|
75
82
|
|
|
76
|
-
const {
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
// Get the current session's fallback activity before clearing it
|
|
80
|
-
const { data: sessionData, error: sessionError } = await supabase
|
|
81
|
-
.from('agent_sessions')
|
|
82
|
-
.select('current_fallback_activity')
|
|
83
|
-
.eq('id', currentSessionId)
|
|
84
|
-
.single();
|
|
85
|
-
|
|
86
|
-
if (sessionError) throw sessionError;
|
|
87
|
-
|
|
88
|
-
const activityType = sessionData?.current_fallback_activity;
|
|
89
|
-
|
|
90
|
-
// Log the activity completion to history if there was an active activity
|
|
91
|
-
if (activityType) {
|
|
92
|
-
const completedAt = new Date().toISOString();
|
|
83
|
+
const { session } = ctx;
|
|
84
|
+
const apiClient = getApiClient();
|
|
93
85
|
|
|
94
|
-
|
|
95
|
-
await supabase.from('background_activity_history').insert({
|
|
96
|
-
project_id,
|
|
97
|
-
activity_type: activityType,
|
|
98
|
-
completed_at: completedAt,
|
|
99
|
-
completed_by_session_id: currentSessionId,
|
|
100
|
-
summary: summary || null,
|
|
101
|
-
});
|
|
86
|
+
const response = await apiClient.stopFallbackActivity(project_id, summary, session.currentSessionId || undefined);
|
|
102
87
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
.from('background_activity_schedules')
|
|
106
|
-
.select('*')
|
|
107
|
-
.eq('project_id', project_id)
|
|
108
|
-
.eq('activity_type', activityType)
|
|
109
|
-
.eq('enabled', true)
|
|
110
|
-
.single();
|
|
111
|
-
|
|
112
|
-
if (schedule) {
|
|
113
|
-
let nextRunAt: string | null = null;
|
|
114
|
-
let enabled = true;
|
|
115
|
-
|
|
116
|
-
// Calculate next run time based on schedule type
|
|
117
|
-
const completedDate = new Date(completedAt);
|
|
118
|
-
switch (schedule.schedule_type) {
|
|
119
|
-
case 'once':
|
|
120
|
-
enabled = false;
|
|
121
|
-
break;
|
|
122
|
-
case 'daily':
|
|
123
|
-
completedDate.setDate(completedDate.getDate() + 1);
|
|
124
|
-
nextRunAt = completedDate.toISOString();
|
|
125
|
-
break;
|
|
126
|
-
case 'weekly':
|
|
127
|
-
completedDate.setDate(completedDate.getDate() + 7);
|
|
128
|
-
nextRunAt = completedDate.toISOString();
|
|
129
|
-
break;
|
|
130
|
-
case 'monthly':
|
|
131
|
-
completedDate.setDate(completedDate.getDate() + 30);
|
|
132
|
-
nextRunAt = completedDate.toISOString();
|
|
133
|
-
break;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
await supabase
|
|
137
|
-
.from('background_activity_schedules')
|
|
138
|
-
.update({ next_run_at: nextRunAt, enabled })
|
|
139
|
-
.eq('id', schedule.id);
|
|
140
|
-
}
|
|
88
|
+
if (!response.ok) {
|
|
89
|
+
throw new Error(`Failed to stop fallback activity: ${response.error}`);
|
|
141
90
|
}
|
|
142
91
|
|
|
143
|
-
// Clear the current session's fallback activity
|
|
144
|
-
const { error: updateError } = await supabase
|
|
145
|
-
.from('agent_sessions')
|
|
146
|
-
.update({
|
|
147
|
-
current_fallback_activity: null,
|
|
148
|
-
status: 'idle',
|
|
149
|
-
last_synced_at: new Date().toISOString(),
|
|
150
|
-
})
|
|
151
|
-
.eq('id', currentSessionId);
|
|
152
|
-
|
|
153
|
-
if (updateError) throw updateError;
|
|
154
|
-
|
|
155
92
|
return {
|
|
156
93
|
result: {
|
|
157
94
|
success: true,
|
|
158
|
-
message:
|
|
159
|
-
? `Fallback activity '${activityType}' completed and logged to history`
|
|
160
|
-
: 'Fallback activity stopped',
|
|
95
|
+
message: 'Fallback activity stopped',
|
|
161
96
|
},
|
|
162
97
|
};
|
|
163
98
|
};
|
|
@@ -172,48 +107,33 @@ export const getActivityHistory: Handler = async (args, ctx) => {
|
|
|
172
107
|
validateRequired(project_id, 'project_id');
|
|
173
108
|
validateUUID(project_id, 'project_id');
|
|
174
109
|
|
|
175
|
-
const
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
.
|
|
195
|
-
|
|
196
|
-
if (activity_type) {
|
|
197
|
-
query = query.eq('activity_type', activity_type);
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
const { data: history, error } = await query;
|
|
201
|
-
|
|
202
|
-
if (error) throw error;
|
|
203
|
-
|
|
204
|
-
// Also get the most recent completion for each activity type
|
|
205
|
-
const latestByType: Record<string, unknown> = {};
|
|
206
|
-
for (const entry of history || []) {
|
|
207
|
-
if (!latestByType[entry.activity_type]) {
|
|
208
|
-
latestByType[entry.activity_type] = entry;
|
|
209
|
-
}
|
|
110
|
+
const apiClient = getApiClient();
|
|
111
|
+
|
|
112
|
+
// Use proxy for get_activity_history operation
|
|
113
|
+
const response = await apiClient.proxy<{
|
|
114
|
+
history: Array<{
|
|
115
|
+
id: string;
|
|
116
|
+
activity_type: string;
|
|
117
|
+
completed_at: string;
|
|
118
|
+
summary?: string;
|
|
119
|
+
}>;
|
|
120
|
+
latest_by_type?: Record<string, unknown>;
|
|
121
|
+
count: number;
|
|
122
|
+
}>('get_activity_history', {
|
|
123
|
+
project_id,
|
|
124
|
+
activity_type,
|
|
125
|
+
limit
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
if (!response.ok) {
|
|
129
|
+
throw new Error(`Failed to get activity history: ${response.error}`);
|
|
210
130
|
}
|
|
211
131
|
|
|
212
132
|
return {
|
|
213
133
|
result: {
|
|
214
|
-
history: history || [],
|
|
215
|
-
latest_by_type:
|
|
216
|
-
count:
|
|
134
|
+
history: response.data?.history || [],
|
|
135
|
+
latest_by_type: response.data?.latest_by_type || {},
|
|
136
|
+
count: response.data?.count || 0,
|
|
217
137
|
},
|
|
218
138
|
};
|
|
219
139
|
};
|
|
@@ -224,27 +144,32 @@ export const getActivitySchedules: Handler = async (args, ctx) => {
|
|
|
224
144
|
validateRequired(project_id, 'project_id');
|
|
225
145
|
validateUUID(project_id, 'project_id');
|
|
226
146
|
|
|
227
|
-
const
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
147
|
+
const apiClient = getApiClient();
|
|
148
|
+
|
|
149
|
+
// Use proxy for get_activity_schedules operation
|
|
150
|
+
const response = await apiClient.proxy<{
|
|
151
|
+
schedules: Array<{
|
|
152
|
+
id: string;
|
|
153
|
+
activity_type: string;
|
|
154
|
+
schedule_type: string;
|
|
155
|
+
next_run_at?: string;
|
|
156
|
+
enabled: boolean;
|
|
157
|
+
}>;
|
|
158
|
+
due_activities: string[];
|
|
159
|
+
count: number;
|
|
160
|
+
}>('get_activity_schedules', {
|
|
161
|
+
project_id
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
if (!response.ok) {
|
|
165
|
+
throw new Error(`Failed to get activity schedules: ${response.error}`);
|
|
166
|
+
}
|
|
242
167
|
|
|
243
168
|
return {
|
|
244
169
|
result: {
|
|
245
|
-
schedules: schedules || [],
|
|
246
|
-
due_activities:
|
|
247
|
-
count:
|
|
170
|
+
schedules: response.data?.schedules || [],
|
|
171
|
+
due_activities: response.data?.due_activities || [],
|
|
172
|
+
count: response.data?.count || 0,
|
|
248
173
|
},
|
|
249
174
|
};
|
|
250
175
|
};
|