@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
|
@@ -6,9 +6,12 @@
|
|
|
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
|
import { validateRequired, validateUUID } from '../validators.js';
|
|
11
13
|
import { FALLBACK_ACTIVITIES } from '../utils.js';
|
|
14
|
+
import { getApiClient } from '../api-client.js';
|
|
12
15
|
const VALID_ACTIVITIES = [
|
|
13
16
|
'feature_ideation',
|
|
14
17
|
'code_review',
|
|
@@ -29,112 +32,48 @@ export const startFallbackActivity = async (args, ctx) => {
|
|
|
29
32
|
if (!VALID_ACTIVITIES.includes(activity)) {
|
|
30
33
|
throw new Error(`Invalid activity. Must be one of: ${VALID_ACTIVITIES.join(', ')}`);
|
|
31
34
|
}
|
|
32
|
-
const {
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
.
|
|
37
|
-
|
|
38
|
-
current_fallback_activity: activity,
|
|
39
|
-
current_task_id: null, // Clear any task when starting fallback
|
|
40
|
-
status: 'active',
|
|
41
|
-
last_synced_at: new Date().toISOString(),
|
|
42
|
-
})
|
|
43
|
-
.eq('id', currentSessionId);
|
|
44
|
-
if (updateError)
|
|
45
|
-
throw updateError;
|
|
35
|
+
const { session } = ctx;
|
|
36
|
+
const apiClient = getApiClient();
|
|
37
|
+
const response = await apiClient.startFallbackActivity(project_id, activity, session.currentSessionId || undefined);
|
|
38
|
+
if (!response.ok) {
|
|
39
|
+
throw new Error(`Failed to start fallback activity: ${response.error}`);
|
|
40
|
+
}
|
|
46
41
|
// Get the activity details for the response
|
|
47
42
|
const activityInfo = FALLBACK_ACTIVITIES.find((a) => a.activity === activity);
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
message: `Started fallback activity: ${activityInfo?.title || activity}`,
|
|
56
|
-
},
|
|
43
|
+
const result = {
|
|
44
|
+
success: true,
|
|
45
|
+
activity,
|
|
46
|
+
title: activityInfo?.title || activity,
|
|
47
|
+
description: activityInfo?.description || '',
|
|
48
|
+
prompt: activityInfo?.prompt || '',
|
|
49
|
+
message: response.data?.message || `Started fallback activity: ${activityInfo?.title || activity}`,
|
|
57
50
|
};
|
|
51
|
+
// Pass through worktree guidance if provided
|
|
52
|
+
if (response.data?.git_workflow) {
|
|
53
|
+
result.git_workflow = response.data.git_workflow;
|
|
54
|
+
}
|
|
55
|
+
if (response.data?.worktree_setup) {
|
|
56
|
+
result.worktree_setup = response.data.worktree_setup;
|
|
57
|
+
}
|
|
58
|
+
if (response.data?.next_step) {
|
|
59
|
+
result.next_step = response.data.next_step;
|
|
60
|
+
}
|
|
61
|
+
return { result };
|
|
58
62
|
};
|
|
59
63
|
export const stopFallbackActivity = async (args, ctx) => {
|
|
60
64
|
const { project_id, summary } = args;
|
|
61
65
|
validateRequired(project_id, 'project_id');
|
|
62
66
|
validateUUID(project_id, 'project_id');
|
|
63
|
-
const {
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
.
|
|
68
|
-
.select('current_fallback_activity')
|
|
69
|
-
.eq('id', currentSessionId)
|
|
70
|
-
.single();
|
|
71
|
-
if (sessionError)
|
|
72
|
-
throw sessionError;
|
|
73
|
-
const activityType = sessionData?.current_fallback_activity;
|
|
74
|
-
// Log the activity completion to history if there was an active activity
|
|
75
|
-
if (activityType) {
|
|
76
|
-
const completedAt = new Date().toISOString();
|
|
77
|
-
// Insert history record
|
|
78
|
-
await supabase.from('background_activity_history').insert({
|
|
79
|
-
project_id,
|
|
80
|
-
activity_type: activityType,
|
|
81
|
-
completed_at: completedAt,
|
|
82
|
-
completed_by_session_id: currentSessionId,
|
|
83
|
-
summary: summary || null,
|
|
84
|
-
});
|
|
85
|
-
// Update schedule if one exists for this activity
|
|
86
|
-
const { data: schedule } = await supabase
|
|
87
|
-
.from('background_activity_schedules')
|
|
88
|
-
.select('*')
|
|
89
|
-
.eq('project_id', project_id)
|
|
90
|
-
.eq('activity_type', activityType)
|
|
91
|
-
.eq('enabled', true)
|
|
92
|
-
.single();
|
|
93
|
-
if (schedule) {
|
|
94
|
-
let nextRunAt = null;
|
|
95
|
-
let enabled = true;
|
|
96
|
-
// Calculate next run time based on schedule type
|
|
97
|
-
const completedDate = new Date(completedAt);
|
|
98
|
-
switch (schedule.schedule_type) {
|
|
99
|
-
case 'once':
|
|
100
|
-
enabled = false;
|
|
101
|
-
break;
|
|
102
|
-
case 'daily':
|
|
103
|
-
completedDate.setDate(completedDate.getDate() + 1);
|
|
104
|
-
nextRunAt = completedDate.toISOString();
|
|
105
|
-
break;
|
|
106
|
-
case 'weekly':
|
|
107
|
-
completedDate.setDate(completedDate.getDate() + 7);
|
|
108
|
-
nextRunAt = completedDate.toISOString();
|
|
109
|
-
break;
|
|
110
|
-
case 'monthly':
|
|
111
|
-
completedDate.setDate(completedDate.getDate() + 30);
|
|
112
|
-
nextRunAt = completedDate.toISOString();
|
|
113
|
-
break;
|
|
114
|
-
}
|
|
115
|
-
await supabase
|
|
116
|
-
.from('background_activity_schedules')
|
|
117
|
-
.update({ next_run_at: nextRunAt, enabled })
|
|
118
|
-
.eq('id', schedule.id);
|
|
119
|
-
}
|
|
67
|
+
const { session } = ctx;
|
|
68
|
+
const apiClient = getApiClient();
|
|
69
|
+
const response = await apiClient.stopFallbackActivity(project_id, summary, session.currentSessionId || undefined);
|
|
70
|
+
if (!response.ok) {
|
|
71
|
+
throw new Error(`Failed to stop fallback activity: ${response.error}`);
|
|
120
72
|
}
|
|
121
|
-
// Clear the current session's fallback activity
|
|
122
|
-
const { error: updateError } = await supabase
|
|
123
|
-
.from('agent_sessions')
|
|
124
|
-
.update({
|
|
125
|
-
current_fallback_activity: null,
|
|
126
|
-
status: 'idle',
|
|
127
|
-
last_synced_at: new Date().toISOString(),
|
|
128
|
-
})
|
|
129
|
-
.eq('id', currentSessionId);
|
|
130
|
-
if (updateError)
|
|
131
|
-
throw updateError;
|
|
132
73
|
return {
|
|
133
74
|
result: {
|
|
134
75
|
success: true,
|
|
135
|
-
message:
|
|
136
|
-
? `Fallback activity '${activityType}' completed and logged to history`
|
|
137
|
-
: 'Fallback activity stopped',
|
|
76
|
+
message: 'Fallback activity stopped',
|
|
138
77
|
},
|
|
139
78
|
};
|
|
140
79
|
};
|
|
@@ -142,41 +81,21 @@ export const getActivityHistory = async (args, ctx) => {
|
|
|
142
81
|
const { project_id, activity_type, limit = 50 } = args;
|
|
143
82
|
validateRequired(project_id, 'project_id');
|
|
144
83
|
validateUUID(project_id, 'project_id');
|
|
145
|
-
const
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
created_at,
|
|
155
|
-
agent_sessions!completed_by_session_id (
|
|
156
|
-
agent_name
|
|
157
|
-
)
|
|
158
|
-
`)
|
|
159
|
-
.eq('project_id', project_id)
|
|
160
|
-
.order('completed_at', { ascending: false })
|
|
161
|
-
.limit(limit);
|
|
162
|
-
if (activity_type) {
|
|
163
|
-
query = query.eq('activity_type', activity_type);
|
|
164
|
-
}
|
|
165
|
-
const { data: history, error } = await query;
|
|
166
|
-
if (error)
|
|
167
|
-
throw error;
|
|
168
|
-
// Also get the most recent completion for each activity type
|
|
169
|
-
const latestByType = {};
|
|
170
|
-
for (const entry of history || []) {
|
|
171
|
-
if (!latestByType[entry.activity_type]) {
|
|
172
|
-
latestByType[entry.activity_type] = entry;
|
|
173
|
-
}
|
|
84
|
+
const apiClient = getApiClient();
|
|
85
|
+
// Use proxy for get_activity_history operation
|
|
86
|
+
const response = await apiClient.proxy('get_activity_history', {
|
|
87
|
+
project_id,
|
|
88
|
+
activity_type,
|
|
89
|
+
limit
|
|
90
|
+
});
|
|
91
|
+
if (!response.ok) {
|
|
92
|
+
throw new Error(`Failed to get activity history: ${response.error}`);
|
|
174
93
|
}
|
|
175
94
|
return {
|
|
176
95
|
result: {
|
|
177
|
-
history: history || [],
|
|
178
|
-
latest_by_type:
|
|
179
|
-
count:
|
|
96
|
+
history: response.data?.history || [],
|
|
97
|
+
latest_by_type: response.data?.latest_by_type || {},
|
|
98
|
+
count: response.data?.count || 0,
|
|
180
99
|
},
|
|
181
100
|
};
|
|
182
101
|
};
|
|
@@ -184,24 +103,19 @@ export const getActivitySchedules = async (args, ctx) => {
|
|
|
184
103
|
const { project_id } = args;
|
|
185
104
|
validateRequired(project_id, 'project_id');
|
|
186
105
|
validateUUID(project_id, 'project_id');
|
|
187
|
-
const
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
// Identify which activities are "due" (next_run_at < now AND enabled)
|
|
196
|
-
const now = new Date();
|
|
197
|
-
const dueActivities = (schedules || [])
|
|
198
|
-
.filter((s) => s.enabled && s.next_run_at && new Date(s.next_run_at) < now)
|
|
199
|
-
.map((s) => s.activity_type);
|
|
106
|
+
const apiClient = getApiClient();
|
|
107
|
+
// Use proxy for get_activity_schedules operation
|
|
108
|
+
const response = await apiClient.proxy('get_activity_schedules', {
|
|
109
|
+
project_id
|
|
110
|
+
});
|
|
111
|
+
if (!response.ok) {
|
|
112
|
+
throw new Error(`Failed to get activity schedules: ${response.error}`);
|
|
113
|
+
}
|
|
200
114
|
return {
|
|
201
115
|
result: {
|
|
202
|
-
schedules: schedules || [],
|
|
203
|
-
due_activities:
|
|
204
|
-
count:
|
|
116
|
+
schedules: response.data?.schedules || [],
|
|
117
|
+
due_activities: response.data?.due_activities || [],
|
|
118
|
+
count: response.data?.count || 0,
|
|
205
119
|
},
|
|
206
120
|
};
|
|
207
121
|
};
|
|
@@ -3,13 +3,20 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Handles audit findings and knowledge base:
|
|
5
5
|
* - add_finding
|
|
6
|
-
* - get_findings
|
|
6
|
+
* - get_findings (supports summary_only for reduced tokens)
|
|
7
|
+
* - get_findings_stats (aggregate counts for minimal tokens)
|
|
7
8
|
* - update_finding
|
|
8
9
|
* - delete_finding
|
|
9
10
|
*/
|
|
10
11
|
import type { Handler, HandlerRegistry } from './types.js';
|
|
11
12
|
export declare const addFinding: Handler;
|
|
12
13
|
export declare const getFindings: Handler;
|
|
14
|
+
/**
|
|
15
|
+
* Get aggregate statistics about findings for a project.
|
|
16
|
+
* Returns counts by category, severity, and status without the actual finding data.
|
|
17
|
+
* This is much more token-efficient than get_findings for understanding the overall state.
|
|
18
|
+
*/
|
|
19
|
+
export declare const getFindingsStats: Handler;
|
|
13
20
|
export declare const updateFinding: Handler;
|
|
14
21
|
export declare const deleteFinding: Handler;
|
|
15
22
|
/**
|
|
@@ -3,11 +3,13 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Handles audit findings and knowledge base:
|
|
5
5
|
* - add_finding
|
|
6
|
-
* - get_findings
|
|
6
|
+
* - get_findings (supports summary_only for reduced tokens)
|
|
7
|
+
* - get_findings_stats (aggregate counts for minimal tokens)
|
|
7
8
|
* - update_finding
|
|
8
9
|
* - delete_finding
|
|
9
10
|
*/
|
|
10
11
|
import { validateRequired, validateUUID } from '../validators.js';
|
|
12
|
+
import { getApiClient } from '../api-client.js';
|
|
11
13
|
export const addFinding = async (args, ctx) => {
|
|
12
14
|
const { project_id, category, title, description, severity, file_path, line_number, related_task_id } = args;
|
|
13
15
|
validateRequired(project_id, 'project_id');
|
|
@@ -15,89 +17,83 @@ export const addFinding = async (args, ctx) => {
|
|
|
15
17
|
validateRequired(title, 'title');
|
|
16
18
|
if (related_task_id)
|
|
17
19
|
validateUUID(related_task_id, 'related_task_id');
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
.from('findings')
|
|
21
|
-
.insert({
|
|
22
|
-
project_id,
|
|
23
|
-
category: category || 'other',
|
|
20
|
+
const apiClient = getApiClient();
|
|
21
|
+
const response = await apiClient.addFinding(project_id, {
|
|
24
22
|
title,
|
|
25
|
-
description
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
.
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
throw new Error(`Failed to add finding: ${error.message}`);
|
|
37
|
-
return { result: { success: true, finding_id: data.id, title } };
|
|
23
|
+
description,
|
|
24
|
+
category,
|
|
25
|
+
severity,
|
|
26
|
+
file_path,
|
|
27
|
+
line_number,
|
|
28
|
+
related_task_id
|
|
29
|
+
}, ctx.session.currentSessionId || undefined);
|
|
30
|
+
if (!response.ok) {
|
|
31
|
+
throw new Error(response.error || 'Failed to add finding');
|
|
32
|
+
}
|
|
33
|
+
return { result: response.data };
|
|
38
34
|
};
|
|
39
35
|
export const getFindings = async (args, ctx) => {
|
|
40
|
-
const { project_id, category, severity, status, limit } = args;
|
|
36
|
+
const { project_id, category, severity, status, limit = 50, offset = 0, search_query, summary_only = false } = args;
|
|
37
|
+
validateRequired(project_id, 'project_id');
|
|
38
|
+
validateUUID(project_id, 'project_id');
|
|
39
|
+
const apiClient = getApiClient();
|
|
40
|
+
const response = await apiClient.getFindings(project_id, {
|
|
41
|
+
category,
|
|
42
|
+
severity,
|
|
43
|
+
status,
|
|
44
|
+
limit,
|
|
45
|
+
offset,
|
|
46
|
+
search_query,
|
|
47
|
+
summary_only
|
|
48
|
+
});
|
|
49
|
+
if (!response.ok) {
|
|
50
|
+
throw new Error(response.error || 'Failed to get findings');
|
|
51
|
+
}
|
|
52
|
+
return { result: response.data };
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Get aggregate statistics about findings for a project.
|
|
56
|
+
* Returns counts by category, severity, and status without the actual finding data.
|
|
57
|
+
* This is much more token-efficient than get_findings for understanding the overall state.
|
|
58
|
+
*/
|
|
59
|
+
export const getFindingsStats = async (args, ctx) => {
|
|
60
|
+
const { project_id } = args;
|
|
41
61
|
validateRequired(project_id, 'project_id');
|
|
42
62
|
validateUUID(project_id, 'project_id');
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
.
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
.limit(limit || 50);
|
|
50
|
-
if (category)
|
|
51
|
-
query = query.eq('category', category);
|
|
52
|
-
if (severity)
|
|
53
|
-
query = query.eq('severity', severity);
|
|
54
|
-
if (status)
|
|
55
|
-
query = query.eq('status', status);
|
|
56
|
-
const { data, error } = await query;
|
|
57
|
-
if (error)
|
|
58
|
-
throw new Error(`Failed to get findings: ${error.message}`);
|
|
59
|
-
return { result: { findings: data } };
|
|
63
|
+
const apiClient = getApiClient();
|
|
64
|
+
const response = await apiClient.getFindingsStats(project_id);
|
|
65
|
+
if (!response.ok) {
|
|
66
|
+
throw new Error(response.error || 'Failed to get findings stats');
|
|
67
|
+
}
|
|
68
|
+
return { result: response.data };
|
|
60
69
|
};
|
|
61
70
|
export const updateFinding = async (args, ctx) => {
|
|
62
71
|
const { finding_id, status, resolution_note, title, description, severity } = args;
|
|
63
72
|
validateRequired(finding_id, 'finding_id');
|
|
64
73
|
validateUUID(finding_id, 'finding_id');
|
|
65
|
-
const
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
if (
|
|
74
|
-
|
|
75
|
-
if (status === 'addressed' || status === 'dismissed' || status === 'wontfix') {
|
|
76
|
-
updates.addressed_at = new Date().toISOString();
|
|
77
|
-
updates.addressed_by_session_id = session.currentSessionId;
|
|
78
|
-
}
|
|
74
|
+
const apiClient = getApiClient();
|
|
75
|
+
const response = await apiClient.updateFinding(finding_id, {
|
|
76
|
+
title,
|
|
77
|
+
description,
|
|
78
|
+
severity,
|
|
79
|
+
status,
|
|
80
|
+
resolution_note
|
|
81
|
+
});
|
|
82
|
+
if (!response.ok) {
|
|
83
|
+
throw new Error(response.error || 'Failed to update finding');
|
|
79
84
|
}
|
|
80
|
-
|
|
81
|
-
updates.resolution_note = resolution_note;
|
|
82
|
-
const { error } = await supabase
|
|
83
|
-
.from('findings')
|
|
84
|
-
.update(updates)
|
|
85
|
-
.eq('id', finding_id);
|
|
86
|
-
if (error)
|
|
87
|
-
throw new Error(`Failed to update finding: ${error.message}`);
|
|
88
|
-
return { result: { success: true, finding_id } };
|
|
85
|
+
return { result: response.data };
|
|
89
86
|
};
|
|
90
87
|
export const deleteFinding = async (args, ctx) => {
|
|
91
88
|
const { finding_id } = args;
|
|
92
89
|
validateRequired(finding_id, 'finding_id');
|
|
93
90
|
validateUUID(finding_id, 'finding_id');
|
|
94
|
-
const
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
.
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
return { result: { success: true } };
|
|
91
|
+
const apiClient = getApiClient();
|
|
92
|
+
const response = await apiClient.deleteFinding(finding_id);
|
|
93
|
+
if (!response.ok) {
|
|
94
|
+
throw new Error(response.error || 'Failed to delete finding');
|
|
95
|
+
}
|
|
96
|
+
return { result: response.data };
|
|
101
97
|
};
|
|
102
98
|
/**
|
|
103
99
|
* Findings handlers registry
|
|
@@ -105,6 +101,7 @@ export const deleteFinding = async (args, ctx) => {
|
|
|
105
101
|
export const findingHandlers = {
|
|
106
102
|
add_finding: addFinding,
|
|
107
103
|
get_findings: getFindings,
|
|
104
|
+
get_findings_stats: getFindingsStats,
|
|
108
105
|
update_finding: updateFinding,
|
|
109
106
|
delete_finding: deleteFinding,
|
|
110
107
|
};
|
|
@@ -1,22 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Git Issues Handlers
|
|
3
3
|
*
|
|
4
|
-
* Handles git
|
|
5
|
-
* -
|
|
6
|
-
* -
|
|
7
|
-
* -
|
|
8
|
-
* -
|
|
4
|
+
* Handles git issue management:
|
|
5
|
+
* - add_git_issue: Record a git-related issue (conflicts, push failures, etc.)
|
|
6
|
+
* - resolve_git_issue: Mark a git issue as resolved
|
|
7
|
+
* - get_git_issues: List git issues for a project
|
|
8
|
+
* - delete_git_issue: Remove a git issue
|
|
9
9
|
*/
|
|
10
10
|
import type { Handler, HandlerRegistry } from './types.js';
|
|
11
|
-
export declare const
|
|
12
|
-
export declare const createGitIssue: Handler;
|
|
11
|
+
export declare const addGitIssue: Handler;
|
|
13
12
|
export declare const resolveGitIssue: Handler;
|
|
14
|
-
export declare const
|
|
15
|
-
|
|
16
|
-
* Auto-resolve git issues for a branch when it becomes mergeable
|
|
17
|
-
*/
|
|
18
|
-
export declare function autoResolveGitIssuesForBranch(supabase: import('@supabase/supabase-js').SupabaseClient, projectId: string, branchName: string, sessionId: string | null): Promise<number>;
|
|
13
|
+
export declare const getGitIssues: Handler;
|
|
14
|
+
export declare const deleteGitIssue: Handler;
|
|
19
15
|
/**
|
|
20
16
|
* Git Issues handlers registry
|
|
21
17
|
*/
|
|
22
|
-
export declare const
|
|
18
|
+
export declare const gitIssueHandlers: HandlerRegistry;
|