@vibescope/mcp-server 0.0.1
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 +98 -0
- package/dist/cli.d.ts +34 -0
- package/dist/cli.js +356 -0
- package/dist/cli.test.d.ts +1 -0
- package/dist/cli.test.js +367 -0
- package/dist/handlers/__test-utils__.d.ts +72 -0
- package/dist/handlers/__test-utils__.js +176 -0
- package/dist/handlers/blockers.d.ts +18 -0
- package/dist/handlers/blockers.js +81 -0
- package/dist/handlers/bodies-of-work.d.ts +34 -0
- package/dist/handlers/bodies-of-work.js +614 -0
- package/dist/handlers/checkouts.d.ts +37 -0
- package/dist/handlers/checkouts.js +377 -0
- package/dist/handlers/cost.d.ts +39 -0
- package/dist/handlers/cost.js +247 -0
- package/dist/handlers/decisions.d.ts +16 -0
- package/dist/handlers/decisions.js +64 -0
- package/dist/handlers/deployment.d.ts +36 -0
- package/dist/handlers/deployment.js +1062 -0
- package/dist/handlers/discovery.d.ts +14 -0
- package/dist/handlers/discovery.js +870 -0
- package/dist/handlers/fallback.d.ts +18 -0
- package/dist/handlers/fallback.js +216 -0
- package/dist/handlers/findings.d.ts +18 -0
- package/dist/handlers/findings.js +110 -0
- package/dist/handlers/git-issues.d.ts +22 -0
- package/dist/handlers/git-issues.js +247 -0
- package/dist/handlers/ideas.d.ts +19 -0
- package/dist/handlers/ideas.js +188 -0
- package/dist/handlers/index.d.ts +29 -0
- package/dist/handlers/index.js +65 -0
- package/dist/handlers/knowledge-query.d.ts +22 -0
- package/dist/handlers/knowledge-query.js +253 -0
- package/dist/handlers/knowledge.d.ts +12 -0
- package/dist/handlers/knowledge.js +108 -0
- package/dist/handlers/milestones.d.ts +20 -0
- package/dist/handlers/milestones.js +179 -0
- package/dist/handlers/organizations.d.ts +36 -0
- package/dist/handlers/organizations.js +428 -0
- package/dist/handlers/progress.d.ts +14 -0
- package/dist/handlers/progress.js +149 -0
- package/dist/handlers/project.d.ts +20 -0
- package/dist/handlers/project.js +278 -0
- package/dist/handlers/requests.d.ts +16 -0
- package/dist/handlers/requests.js +131 -0
- package/dist/handlers/roles.d.ts +30 -0
- package/dist/handlers/roles.js +281 -0
- package/dist/handlers/session.d.ts +20 -0
- package/dist/handlers/session.js +791 -0
- package/dist/handlers/tasks.d.ts +52 -0
- package/dist/handlers/tasks.js +1111 -0
- package/dist/handlers/tasks.test.d.ts +1 -0
- package/dist/handlers/tasks.test.js +431 -0
- package/dist/handlers/types.d.ts +94 -0
- package/dist/handlers/types.js +1 -0
- package/dist/handlers/validation.d.ts +16 -0
- package/dist/handlers/validation.js +188 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2707 -0
- package/dist/knowledge.d.ts +6 -0
- package/dist/knowledge.js +121 -0
- package/dist/tools.d.ts +2 -0
- package/dist/tools.js +2498 -0
- package/dist/utils.d.ts +149 -0
- package/dist/utils.js +317 -0
- package/dist/utils.test.d.ts +1 -0
- package/dist/utils.test.js +532 -0
- package/dist/validators.d.ts +35 -0
- package/dist/validators.js +111 -0
- package/dist/validators.test.d.ts +1 -0
- package/dist/validators.test.js +176 -0
- package/package.json +44 -0
- package/src/cli.test.ts +442 -0
- package/src/cli.ts +439 -0
- package/src/handlers/__test-utils__.ts +217 -0
- package/src/handlers/blockers.test.ts +390 -0
- package/src/handlers/blockers.ts +110 -0
- package/src/handlers/bodies-of-work.test.ts +1276 -0
- package/src/handlers/bodies-of-work.ts +783 -0
- package/src/handlers/cost.test.ts +436 -0
- package/src/handlers/cost.ts +322 -0
- package/src/handlers/decisions.test.ts +401 -0
- package/src/handlers/decisions.ts +86 -0
- package/src/handlers/deployment.test.ts +516 -0
- package/src/handlers/deployment.ts +1289 -0
- package/src/handlers/discovery.test.ts +254 -0
- package/src/handlers/discovery.ts +969 -0
- package/src/handlers/fallback.test.ts +687 -0
- package/src/handlers/fallback.ts +260 -0
- package/src/handlers/findings.test.ts +565 -0
- package/src/handlers/findings.ts +153 -0
- package/src/handlers/ideas.test.ts +753 -0
- package/src/handlers/ideas.ts +247 -0
- package/src/handlers/index.ts +69 -0
- package/src/handlers/milestones.test.ts +584 -0
- package/src/handlers/milestones.ts +217 -0
- package/src/handlers/organizations.test.ts +997 -0
- package/src/handlers/organizations.ts +550 -0
- package/src/handlers/progress.test.ts +369 -0
- package/src/handlers/progress.ts +188 -0
- package/src/handlers/project.test.ts +562 -0
- package/src/handlers/project.ts +352 -0
- package/src/handlers/requests.test.ts +531 -0
- package/src/handlers/requests.ts +150 -0
- package/src/handlers/session.test.ts +459 -0
- package/src/handlers/session.ts +912 -0
- package/src/handlers/tasks.test.ts +602 -0
- package/src/handlers/tasks.ts +1393 -0
- package/src/handlers/types.ts +88 -0
- package/src/handlers/validation.test.ts +880 -0
- package/src/handlers/validation.ts +223 -0
- package/src/index.ts +3205 -0
- package/src/knowledge.ts +132 -0
- package/src/tmpclaude-0078-cwd +1 -0
- package/src/tmpclaude-0ee1-cwd +1 -0
- package/src/tmpclaude-2dd5-cwd +1 -0
- package/src/tmpclaude-344c-cwd +1 -0
- package/src/tmpclaude-3860-cwd +1 -0
- package/src/tmpclaude-4b63-cwd +1 -0
- package/src/tmpclaude-5c73-cwd +1 -0
- package/src/tmpclaude-5ee3-cwd +1 -0
- package/src/tmpclaude-6795-cwd +1 -0
- package/src/tmpclaude-709e-cwd +1 -0
- package/src/tmpclaude-9839-cwd +1 -0
- package/src/tmpclaude-d829-cwd +1 -0
- package/src/tmpclaude-e072-cwd +1 -0
- package/src/tmpclaude-f6ee-cwd +1 -0
- package/src/utils.test.ts +681 -0
- package/src/utils.ts +375 -0
- package/src/validators.test.ts +223 -0
- package/src/validators.ts +122 -0
- package/tmpclaude-0439-cwd +1 -0
- package/tmpclaude-132f-cwd +1 -0
- package/tmpclaude-15bb-cwd +1 -0
- package/tmpclaude-165a-cwd +1 -0
- package/tmpclaude-1ba9-cwd +1 -0
- package/tmpclaude-21a3-cwd +1 -0
- package/tmpclaude-2a38-cwd +1 -0
- package/tmpclaude-2adf-cwd +1 -0
- package/tmpclaude-2f56-cwd +1 -0
- package/tmpclaude-3626-cwd +1 -0
- package/tmpclaude-3727-cwd +1 -0
- package/tmpclaude-40bc-cwd +1 -0
- package/tmpclaude-436f-cwd +1 -0
- package/tmpclaude-4783-cwd +1 -0
- package/tmpclaude-4b6d-cwd +1 -0
- package/tmpclaude-4ba4-cwd +1 -0
- package/tmpclaude-51e6-cwd +1 -0
- package/tmpclaude-5ecf-cwd +1 -0
- package/tmpclaude-6f97-cwd +1 -0
- package/tmpclaude-7fb2-cwd +1 -0
- package/tmpclaude-825c-cwd +1 -0
- package/tmpclaude-8baf-cwd +1 -0
- package/tmpclaude-8d9f-cwd +1 -0
- package/tmpclaude-975c-cwd +1 -0
- package/tmpclaude-9983-cwd +1 -0
- package/tmpclaude-a045-cwd +1 -0
- package/tmpclaude-ac4a-cwd +1 -0
- package/tmpclaude-b593-cwd +1 -0
- package/tmpclaude-b891-cwd +1 -0
- package/tmpclaude-c032-cwd +1 -0
- package/tmpclaude-cf43-cwd +1 -0
- package/tmpclaude-d040-cwd +1 -0
- package/tmpclaude-dcdd-cwd +1 -0
- package/tmpclaude-dcee-cwd +1 -0
- package/tmpclaude-e16b-cwd +1 -0
- package/tmpclaude-ecd2-cwd +1 -0
- package/tmpclaude-f48d-cwd +1 -0
- package/tsconfig.json +16 -0
- package/vitest.config.ts +13 -0
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validation Handlers
|
|
3
|
+
*
|
|
4
|
+
* Handles cross-agent task validation:
|
|
5
|
+
* - get_tasks_awaiting_validation
|
|
6
|
+
* - claim_validation
|
|
7
|
+
* - validate_task
|
|
8
|
+
*/
|
|
9
|
+
import { validateRequired, validateUUID } from '../validators.js';
|
|
10
|
+
import { getProjectGitConfig, getValidationApprovedGitInstructions } from './tasks.js';
|
|
11
|
+
export const getTasksAwaitingValidation = async (args, ctx) => {
|
|
12
|
+
const { project_id } = args;
|
|
13
|
+
validateRequired(project_id, 'project_id');
|
|
14
|
+
validateUUID(project_id, 'project_id');
|
|
15
|
+
const { supabase } = ctx;
|
|
16
|
+
const { data: tasks, error } = await supabase
|
|
17
|
+
.from('tasks')
|
|
18
|
+
.select('id, title, completed_at, completed_by_session_id, reviewing_by_session_id, reviewing_started_at')
|
|
19
|
+
.eq('project_id', project_id)
|
|
20
|
+
.eq('status', 'completed')
|
|
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
|
+
};
|
|
42
|
+
};
|
|
43
|
+
export const claimValidation = async (args, ctx) => {
|
|
44
|
+
const { task_id } = args;
|
|
45
|
+
validateRequired(task_id, 'task_id');
|
|
46
|
+
validateUUID(task_id, 'task_id');
|
|
47
|
+
const { supabase, session } = ctx;
|
|
48
|
+
const currentSessionId = session.currentSessionId;
|
|
49
|
+
// Get the task first
|
|
50
|
+
const { data: task, error: fetchError } = await supabase
|
|
51
|
+
.from('tasks')
|
|
52
|
+
.select('id, title, status, validated_at, completed_by_session_id, reviewing_by_session_id')
|
|
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');
|
|
62
|
+
}
|
|
63
|
+
if (task.reviewing_by_session_id && task.reviewing_by_session_id !== currentSessionId) {
|
|
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
|
+
};
|
|
85
|
+
};
|
|
86
|
+
export const validateTask = async (args, ctx) => {
|
|
87
|
+
const { task_id, validation_notes, approved } = args;
|
|
88
|
+
validateRequired(task_id, 'task_id');
|
|
89
|
+
validateUUID(task_id, 'task_id');
|
|
90
|
+
const { supabase, session } = ctx;
|
|
91
|
+
const currentSessionId = session.currentSessionId;
|
|
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');
|
|
102
|
+
}
|
|
103
|
+
if (task.validated_at) {
|
|
104
|
+
throw new Error('Task has already been validated');
|
|
105
|
+
}
|
|
106
|
+
// Check if this is self-validation
|
|
107
|
+
const isSelfValidation = currentSessionId && task.completed_by_session_id === currentSessionId;
|
|
108
|
+
if (approved) {
|
|
109
|
+
// Mark as validated and clear reviewing status
|
|
110
|
+
const { error } = await supabase
|
|
111
|
+
.from('tasks')
|
|
112
|
+
.update({
|
|
113
|
+
validated_at: new Date().toISOString(),
|
|
114
|
+
validated_by_session_id: currentSessionId,
|
|
115
|
+
reviewing_by_session_id: null,
|
|
116
|
+
reviewing_started_at: null,
|
|
117
|
+
})
|
|
118
|
+
.eq('id', task_id);
|
|
119
|
+
if (error)
|
|
120
|
+
throw new Error(`Failed to validate task: ${error.message}`);
|
|
121
|
+
// Log the validation
|
|
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
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return { result };
|
|
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
|
+
};
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
/**
|
|
182
|
+
* Validation handlers registry
|
|
183
|
+
*/
|
|
184
|
+
export const validationHandlers = {
|
|
185
|
+
get_tasks_awaiting_validation: getTasksAwaitingValidation,
|
|
186
|
+
claim_validation: claimValidation,
|
|
187
|
+
validate_task: validateTask,
|
|
188
|
+
};
|
package/dist/index.d.ts
ADDED