@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/dist/handlers/types.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { SupabaseClient } from '@supabase/supabase-js';
|
|
2
1
|
/**
|
|
3
2
|
* Authentication context from API key validation
|
|
4
3
|
*/
|
|
@@ -28,6 +27,15 @@ export interface TokenUsage {
|
|
|
28
27
|
byModel: Record<string, ModelTokens>;
|
|
29
28
|
currentModel: string | null;
|
|
30
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* Agent role for specialized work routing
|
|
32
|
+
* - developer: General development work, picks up any available task (default)
|
|
33
|
+
* - validator: Focuses on validating completed tasks
|
|
34
|
+
* - deployer: Handles deployment coordination and monitoring
|
|
35
|
+
* - reviewer: Code review and quality checks
|
|
36
|
+
* - maintainer: Task management, git orchestration, housekeeping
|
|
37
|
+
*/
|
|
38
|
+
export type AgentRole = 'developer' | 'validator' | 'deployer' | 'reviewer' | 'maintainer';
|
|
31
39
|
/**
|
|
32
40
|
* Session state that persists across tool calls
|
|
33
41
|
*/
|
|
@@ -35,6 +43,7 @@ export interface SessionState {
|
|
|
35
43
|
instanceId: string;
|
|
36
44
|
currentSessionId: string | null;
|
|
37
45
|
currentPersona: string | null;
|
|
46
|
+
currentRole: AgentRole | null;
|
|
38
47
|
tokenUsage: TokenUsage;
|
|
39
48
|
}
|
|
40
49
|
/**
|
|
@@ -61,11 +70,10 @@ export interface UserUpdates {
|
|
|
61
70
|
* Context passed to all handlers
|
|
62
71
|
*/
|
|
63
72
|
export interface HandlerContext {
|
|
64
|
-
supabase: SupabaseClient;
|
|
65
73
|
auth: AuthContext;
|
|
66
74
|
session: SessionState;
|
|
67
75
|
/** Update session state (for handlers that modify session) */
|
|
68
|
-
updateSession: (updates: Partial<Pick<SessionState, 'currentSessionId' | 'currentPersona' | 'tokenUsage'>>) => void;
|
|
76
|
+
updateSession: (updates: Partial<Pick<SessionState, 'currentSessionId' | 'currentPersona' | 'currentRole' | 'tokenUsage'>>) => void;
|
|
69
77
|
/** Get user updates since last sync (for session handlers) */
|
|
70
78
|
getUserUpdates?: (projectId: string) => Promise<UserUpdates | undefined>;
|
|
71
79
|
/** Select an available persona for the agent */
|
|
@@ -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
|
|
@@ -7,176 +7,61 @@
|
|
|
7
7
|
* - validate_task
|
|
8
8
|
*/
|
|
9
9
|
import { validateRequired, validateUUID } from '../validators.js';
|
|
10
|
-
import {
|
|
10
|
+
import { getApiClient } from '../api-client.js';
|
|
11
11
|
export const getTasksAwaitingValidation = async (args, ctx) => {
|
|
12
12
|
const { project_id } = args;
|
|
13
13
|
validateRequired(project_id, 'project_id');
|
|
14
14
|
validateUUID(project_id, 'project_id');
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
.
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
.is('validated_at', null)
|
|
22
|
-
.order('completed_at', { ascending: true });
|
|
23
|
-
if (error)
|
|
24
|
-
throw new Error(`Failed to fetch tasks: ${error.message}`);
|
|
25
|
-
// Add review status info
|
|
26
|
-
const now = new Date();
|
|
27
|
-
const tasksWithStatus = (tasks || []).map((t) => ({
|
|
28
|
-
...t,
|
|
29
|
-
being_reviewed: !!t.reviewing_by_session_id,
|
|
30
|
-
review_minutes: t.reviewing_started_at
|
|
31
|
-
? Math.floor((now.getTime() - new Date(t.reviewing_started_at).getTime()) / 60000)
|
|
32
|
-
: null,
|
|
33
|
-
}));
|
|
34
|
-
return {
|
|
35
|
-
result: {
|
|
36
|
-
tasks: tasksWithStatus,
|
|
37
|
-
hint: tasksWithStatus.length > 0
|
|
38
|
-
? 'Call claim_validation(task_id) before reviewing to show "being reviewed" on dashboard.'
|
|
39
|
-
: undefined,
|
|
40
|
-
},
|
|
41
|
-
};
|
|
15
|
+
const apiClient = getApiClient();
|
|
16
|
+
const response = await apiClient.getTasksAwaitingValidation(project_id);
|
|
17
|
+
if (!response.ok) {
|
|
18
|
+
throw new Error(response.error || 'Failed to fetch tasks awaiting validation');
|
|
19
|
+
}
|
|
20
|
+
return { result: response.data };
|
|
42
21
|
};
|
|
43
22
|
export const claimValidation = async (args, ctx) => {
|
|
44
23
|
const { task_id } = args;
|
|
45
24
|
validateRequired(task_id, 'task_id');
|
|
46
25
|
validateUUID(task_id, 'task_id');
|
|
47
|
-
const {
|
|
26
|
+
const { session } = ctx;
|
|
48
27
|
const currentSessionId = session.currentSessionId;
|
|
49
|
-
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
.
|
|
53
|
-
.eq('id', task_id)
|
|
54
|
-
.single();
|
|
55
|
-
if (fetchError || !task)
|
|
56
|
-
throw new Error('Task not found');
|
|
57
|
-
if (task.status !== 'completed') {
|
|
58
|
-
throw new Error('Can only claim completed tasks for review');
|
|
59
|
-
}
|
|
60
|
-
if (task.validated_at) {
|
|
61
|
-
throw new Error('Task has already been validated');
|
|
28
|
+
const apiClient = getApiClient();
|
|
29
|
+
const response = await apiClient.claimValidation(task_id, currentSessionId || undefined);
|
|
30
|
+
if (!response.ok) {
|
|
31
|
+
throw new Error(response.error || 'Failed to claim task for validation');
|
|
62
32
|
}
|
|
63
|
-
|
|
64
|
-
throw new Error('Task is already being reviewed by another agent');
|
|
65
|
-
}
|
|
66
|
-
// Claim the task for review
|
|
67
|
-
const { error } = await supabase
|
|
68
|
-
.from('tasks')
|
|
69
|
-
.update({
|
|
70
|
-
reviewing_by_session_id: currentSessionId,
|
|
71
|
-
reviewing_started_at: new Date().toISOString(),
|
|
72
|
-
})
|
|
73
|
-
.eq('id', task_id);
|
|
74
|
-
if (error)
|
|
75
|
-
throw new Error(`Failed to claim task: ${error.message}`);
|
|
76
|
-
return {
|
|
77
|
-
result: {
|
|
78
|
-
success: true,
|
|
79
|
-
task_id,
|
|
80
|
-
title: task.title,
|
|
81
|
-
message: 'Task claimed for review. Dashboard now shows "being reviewed".',
|
|
82
|
-
next_step: `Review the implementation, then call validate_task(task_id: "${task_id}", approved: true/false, validation_notes: "...")`,
|
|
83
|
-
},
|
|
84
|
-
};
|
|
33
|
+
return { result: response.data };
|
|
85
34
|
};
|
|
86
35
|
export const validateTask = async (args, ctx) => {
|
|
87
|
-
const { task_id, validation_notes, approved } = args;
|
|
36
|
+
const { task_id, validation_notes, approved, skip_pr_check } = args;
|
|
88
37
|
validateRequired(task_id, 'task_id');
|
|
89
38
|
validateUUID(task_id, 'task_id');
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
// Get the task to validate (including git_branch for workflow instructions)
|
|
93
|
-
const { data: task, error: fetchError } = await supabase
|
|
94
|
-
.from('tasks')
|
|
95
|
-
.select('id, title, status, validated_at, completed_by_session_id, project_id, git_branch')
|
|
96
|
-
.eq('id', task_id)
|
|
97
|
-
.single();
|
|
98
|
-
if (fetchError || !task)
|
|
99
|
-
throw new Error('Task not found');
|
|
100
|
-
if (task.status !== 'completed') {
|
|
101
|
-
throw new Error('Can only validate completed tasks');
|
|
39
|
+
if (approved === undefined) {
|
|
40
|
+
throw new Error('approved is required');
|
|
102
41
|
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
await supabase.from('progress_logs').insert({
|
|
123
|
-
project_id: task.project_id,
|
|
124
|
-
task_id,
|
|
125
|
-
summary: `Validated: ${task.title}${isSelfValidation ? ' (self)' : ''}`,
|
|
126
|
-
details: validation_notes || null,
|
|
127
|
-
created_by: 'agent',
|
|
128
|
-
created_by_session_id: currentSessionId,
|
|
129
|
-
});
|
|
130
|
-
// Build result with optional git merge instructions
|
|
131
|
-
const result = {
|
|
132
|
-
success: true,
|
|
133
|
-
validated_task_id: task_id,
|
|
134
|
-
self_validated: isSelfValidation,
|
|
135
|
-
};
|
|
136
|
-
// Include git workflow instructions for merging
|
|
137
|
-
const gitConfig = await getProjectGitConfig(supabase, task.project_id);
|
|
138
|
-
if (gitConfig && gitConfig.git_workflow !== 'none') {
|
|
139
|
-
const gitInstructions = getValidationApprovedGitInstructions(gitConfig, task.git_branch);
|
|
140
|
-
if (gitInstructions) {
|
|
141
|
-
result.git_workflow = {
|
|
142
|
-
workflow: gitConfig.git_workflow,
|
|
143
|
-
action: 'merge',
|
|
144
|
-
...gitInstructions,
|
|
145
|
-
};
|
|
146
|
-
}
|
|
42
|
+
const { session } = ctx;
|
|
43
|
+
const currentSessionId = session.currentSessionId;
|
|
44
|
+
const apiClient = getApiClient();
|
|
45
|
+
const response = await apiClient.validateTask(task_id, {
|
|
46
|
+
approved,
|
|
47
|
+
validation_notes,
|
|
48
|
+
skip_pr_check,
|
|
49
|
+
}, currentSessionId || undefined);
|
|
50
|
+
if (!response.ok) {
|
|
51
|
+
// Handle PR required error specially
|
|
52
|
+
if (response.error === 'pr_required') {
|
|
53
|
+
return {
|
|
54
|
+
result: {
|
|
55
|
+
error: 'pr_required',
|
|
56
|
+
message: response.data?.message || 'A Pull Request is required before validation approval. Create a PR and add it via add_task_reference.',
|
|
57
|
+
workflow: response.data?.workflow,
|
|
58
|
+
action_required: 'Create a PR for this task and add it via add_task_reference(task_id, pr_url, label: "Pull Request")',
|
|
59
|
+
},
|
|
60
|
+
};
|
|
147
61
|
}
|
|
148
|
-
|
|
149
|
-
}
|
|
150
|
-
else {
|
|
151
|
-
// Validation failed - reopen the task and clear reviewing status
|
|
152
|
-
const { error } = await supabase
|
|
153
|
-
.from('tasks')
|
|
154
|
-
.update({
|
|
155
|
-
status: 'in_progress',
|
|
156
|
-
completed_at: null,
|
|
157
|
-
progress_percentage: 80,
|
|
158
|
-
reviewing_by_session_id: null,
|
|
159
|
-
reviewing_started_at: null,
|
|
160
|
-
})
|
|
161
|
-
.eq('id', task_id);
|
|
162
|
-
if (error)
|
|
163
|
-
throw new Error(`Failed to reopen task: ${error.message}`);
|
|
164
|
-
// Log the rejection
|
|
165
|
-
await supabase.from('progress_logs').insert({
|
|
166
|
-
project_id: task.project_id,
|
|
167
|
-
task_id,
|
|
168
|
-
summary: `Validation failed: ${task.title}`,
|
|
169
|
-
details: validation_notes || 'Needs more work',
|
|
170
|
-
created_by: 'agent',
|
|
171
|
-
created_by_session_id: currentSessionId,
|
|
172
|
-
});
|
|
173
|
-
return {
|
|
174
|
-
result: {
|
|
175
|
-
success: true,
|
|
176
|
-
reopened_task_id: task_id,
|
|
177
|
-
},
|
|
178
|
-
};
|
|
62
|
+
throw new Error(response.error || 'Failed to validate task');
|
|
179
63
|
}
|
|
64
|
+
return { result: response.data };
|
|
180
65
|
};
|
|
181
66
|
/**
|
|
182
67
|
* Validation handlers registry
|