@vibescope/mcp-server 0.4.0 → 0.4.2

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 (70) hide show
  1. package/dist/api-client/fallback.d.ts +33 -0
  2. package/dist/api-client/fallback.js +21 -0
  3. package/dist/api-client/findings.d.ts +69 -0
  4. package/dist/api-client/findings.js +36 -0
  5. package/dist/api-client/index.d.ts +78 -1
  6. package/dist/api-client/index.js +74 -4
  7. package/dist/api-client/milestones.d.ts +59 -0
  8. package/dist/api-client/milestones.js +30 -0
  9. package/dist/api-client/validation.d.ts +35 -0
  10. package/dist/api-client/validation.js +23 -0
  11. package/dist/api-client.d.ts +4 -0
  12. package/dist/cli-init.d.ts +17 -0
  13. package/dist/cli-init.js +497 -0
  14. package/dist/handlers/cloud-agents.d.ts +4 -0
  15. package/dist/handlers/cloud-agents.js +26 -12
  16. package/dist/handlers/discovery.js +15 -0
  17. package/dist/handlers/findings.js +1 -1
  18. package/dist/handlers/ideas.js +1 -1
  19. package/dist/handlers/index.d.ts +1 -0
  20. package/dist/handlers/index.js +3 -0
  21. package/dist/handlers/session.js +115 -2
  22. package/dist/handlers/tasks.js +7 -5
  23. package/dist/handlers/tool-docs.js +344 -0
  24. package/dist/handlers/version.d.ts +5 -0
  25. package/dist/handlers/version.js +53 -0
  26. package/dist/index.js +7 -0
  27. package/dist/templates/agent-guidelines.d.ts +3 -1
  28. package/dist/templates/agent-guidelines.js +5 -1
  29. package/dist/templates/help-content.js +2 -2
  30. package/dist/tools/chat.d.ts +7 -0
  31. package/dist/tools/chat.js +43 -0
  32. package/dist/tools/cloud-agents.js +31 -0
  33. package/dist/tools/index.d.ts +3 -1
  34. package/dist/tools/index.js +6 -1
  35. package/dist/tools/project.js +1 -1
  36. package/dist/tools/tasks.js +8 -0
  37. package/dist/tools/version.d.ts +5 -0
  38. package/dist/tools/version.js +28 -0
  39. package/dist/version.d.ts +28 -0
  40. package/dist/version.js +91 -0
  41. package/docs/TOOLS.md +93 -3
  42. package/package.json +4 -2
  43. package/src/api-client/fallback.ts +52 -0
  44. package/src/api-client/findings.ts +100 -0
  45. package/src/api-client/index.ts +91 -9
  46. package/src/api-client/milestones.ts +83 -0
  47. package/src/api-client/validation.ts +60 -0
  48. package/src/api-client.ts +4 -0
  49. package/src/cli-init.ts +557 -0
  50. package/src/handlers/cloud-agents.test.ts +438 -0
  51. package/src/handlers/cloud-agents.ts +35 -17
  52. package/src/handlers/discovery.ts +15 -0
  53. package/src/handlers/findings.ts +1 -1
  54. package/src/handlers/ideas.ts +1 -1
  55. package/src/handlers/index.ts +3 -0
  56. package/src/handlers/session.ts +128 -2
  57. package/src/handlers/tasks.ts +7 -5
  58. package/src/handlers/tool-docs.test.ts +511 -0
  59. package/src/handlers/tool-docs.ts +382 -0
  60. package/src/handlers/version.ts +63 -0
  61. package/src/index.ts +9 -0
  62. package/src/templates/agent-guidelines.ts +6 -1
  63. package/src/templates/help-content.ts +2 -2
  64. package/src/tools/chat.ts +46 -0
  65. package/src/tools/cloud-agents.ts +31 -0
  66. package/src/tools/index.ts +6 -0
  67. package/src/tools/project.ts +1 -1
  68. package/src/tools/tasks.ts +8 -0
  69. package/src/tools/version.ts +34 -0
  70. package/src/version.ts +109 -0
@@ -17,6 +17,10 @@ import { createDiscoveryMethods, type DiscoveryMethods } from './discovery.js';
17
17
  import { createDecisionsMethods, type DecisionsMethods } from './decisions.js';
18
18
  import { createIdeasMethods, type IdeasMethods } from './ideas.js';
19
19
  import { createTasksMethods, type TasksMethods } from './tasks.js';
20
+ import { createFindingsMethods, type FindingsMethods } from './findings.js';
21
+ import { createMilestonesMethods, type MilestonesMethods } from './milestones.js';
22
+ import { createValidationMethods, type ValidationMethods } from './validation.js';
23
+ import { createFallbackMethods, type FallbackMethods } from './fallback.js';
20
24
 
21
25
  // Re-export types
22
26
  export type { ApiClientConfig, ApiResponse, RetryConfig, RequestFn, ProxyFn } from './types.js';
@@ -29,6 +33,10 @@ export type { DiscoveryMethods } from './discovery.js';
29
33
  export type { DecisionsMethods } from './decisions.js';
30
34
  export type { IdeasMethods } from './ideas.js';
31
35
  export type { TasksMethods } from './tasks.js';
36
+ export type { FindingsMethods } from './findings.js';
37
+ export type { MilestonesMethods } from './milestones.js';
38
+ export type { ValidationMethods } from './validation.js';
39
+ export type { FallbackMethods } from './fallback.js';
32
40
 
33
41
  const DEFAULT_API_URL = 'https://vibescope.dev';
34
42
 
@@ -74,7 +82,11 @@ export interface VibescopeApiClientMethods
74
82
  DiscoveryMethods,
75
83
  DecisionsMethods,
76
84
  IdeasMethods,
77
- TasksMethods {}
85
+ TasksMethods,
86
+ FindingsMethods,
87
+ MilestonesMethods,
88
+ ValidationMethods,
89
+ FallbackMethods {}
78
90
 
79
91
  export class VibescopeApiClient implements VibescopeApiClientMethods {
80
92
  private apiKey: string;
@@ -91,6 +103,10 @@ export class VibescopeApiClient implements VibescopeApiClientMethods {
91
103
  private decisionsMethods: DecisionsMethods;
92
104
  private ideasMethods: IdeasMethods;
93
105
  private tasksMethods: TasksMethods;
106
+ private findingsMethods: FindingsMethods;
107
+ private milestonesMethods: MilestonesMethods;
108
+ private validationMethods: ValidationMethods;
109
+ private fallbackMethods: FallbackMethods;
94
110
 
95
111
  constructor(config: ApiClientConfig) {
96
112
  this.apiKey = config.apiKey;
@@ -117,6 +133,10 @@ export class VibescopeApiClient implements VibescopeApiClientMethods {
117
133
  this.decisionsMethods = createDecisionsMethods(proxy);
118
134
  this.ideasMethods = createIdeasMethods(proxy);
119
135
  this.tasksMethods = createTasksMethods(request, proxy);
136
+ this.findingsMethods = createFindingsMethods(proxy);
137
+ this.milestonesMethods = createMilestonesMethods(proxy);
138
+ this.validationMethods = createValidationMethods(proxy);
139
+ this.fallbackMethods = createFallbackMethods(proxy);
120
140
  }
121
141
 
122
142
  private async request<T>(method: string, path: string, body?: unknown): Promise<ApiResponse<T>> {
@@ -304,14 +324,42 @@ export class VibescopeApiClient implements VibescopeApiClientMethods {
304
324
  batchUpdateTasks = (updates: Parameters<TasksMethods['batchUpdateTasks']>[0]) => this.tasksMethods.batchUpdateTasks(updates);
305
325
  batchCompleteTasks = (completions: Parameters<TasksMethods['batchCompleteTasks']>[0]) => this.tasksMethods.batchCompleteTasks(completions);
306
326
 
327
+ // ============================================================================
328
+ // Findings methods (delegated)
329
+ // ============================================================================
330
+ getFindings = (projectId: string, params?: Parameters<FindingsMethods['getFindings']>[1]) => this.findingsMethods.getFindings(projectId, params);
331
+ getFinding = (findingId: string) => this.findingsMethods.getFinding(findingId);
332
+ getFindingsStats = (projectId: string) => this.findingsMethods.getFindingsStats(projectId);
333
+ addFinding = (projectId: string, params: Parameters<FindingsMethods['addFinding']>[1], sessionId?: string) => this.findingsMethods.addFinding(projectId, params, sessionId);
334
+ updateFinding = (findingId: string, updates: Parameters<FindingsMethods['updateFinding']>[1]) => this.findingsMethods.updateFinding(findingId, updates);
335
+ deleteFinding = (findingId: string) => this.findingsMethods.deleteFinding(findingId);
336
+
337
+ // ============================================================================
338
+ // Milestones methods (delegated)
339
+ // ============================================================================
340
+ getMilestones = (taskId: string) => this.milestonesMethods.getMilestones(taskId);
341
+ addMilestone = (taskId: string, params: Parameters<MilestonesMethods['addMilestone']>[1], sessionId?: string) => this.milestonesMethods.addMilestone(taskId, params, sessionId);
342
+ updateMilestone = (milestoneId: string, updates: Parameters<MilestonesMethods['updateMilestone']>[1]) => this.milestonesMethods.updateMilestone(milestoneId, updates);
343
+ completeMilestone = (milestoneId: string) => this.milestonesMethods.completeMilestone(milestoneId);
344
+ deleteMilestone = (milestoneId: string) => this.milestonesMethods.deleteMilestone(milestoneId);
345
+
346
+ // ============================================================================
347
+ // Validation methods (delegated)
348
+ // ============================================================================
349
+ getTasksAwaitingValidation = (projectId: string) => this.validationMethods.getTasksAwaitingValidation(projectId);
350
+ claimValidation = (taskId: string, sessionId?: string) => this.validationMethods.claimValidation(taskId, sessionId);
351
+ validateTask = (taskId: string, params: Parameters<ValidationMethods['validateTask']>[1], sessionId?: string) => this.validationMethods.validateTask(taskId, params, sessionId);
352
+
353
+ // ============================================================================
354
+ // Fallback activity methods (delegated)
355
+ // ============================================================================
356
+ startFallbackActivity = (projectId: string, activity: string, sessionId?: string) => this.fallbackMethods.startFallbackActivity(projectId, activity, sessionId);
357
+ stopFallbackActivity = (projectId: string, summary?: string, sessionId?: string) => this.fallbackMethods.stopFallbackActivity(projectId, summary, sessionId);
358
+
307
359
  // ============================================================================
308
360
  // TODO: Additional methods to be migrated from original api-client.ts
309
361
  // The following domains need to be split into separate files:
310
- // - findings.ts (getFindings, addFinding, etc.)
311
- // - milestones.ts (getMilestones, addMilestone, etc.)
312
362
  // - requests.ts (getPendingRequests, answerQuestion, etc.)
313
- // - validation.ts (getTasksAwaitingValidation, validateTask, etc.)
314
- // - fallback.ts (startFallbackActivity, stopFallbackActivity)
315
363
  // - deployment.ts (requestDeployment, startDeployment, etc.)
316
364
  // - organizations.ts (listOrganizations, etc.)
317
365
  // - bodies-of-work.ts (createBodyOfWork, etc.)
@@ -329,15 +377,49 @@ let apiClient: VibescopeApiClient | null = null;
329
377
 
330
378
  export function getApiClient(): VibescopeApiClient {
331
379
  if (!apiClient) {
332
- const apiKey = process.env.VIBESCOPE_API_KEY;
333
- if (!apiKey) {
334
- throw new Error('VIBESCOPE_API_KEY environment variable is required');
335
- }
380
+ const apiKey = resolveApiKeyFromSources();
336
381
  apiClient = new VibescopeApiClient({ apiKey });
337
382
  }
338
383
  return apiClient;
339
384
  }
340
385
 
386
+ /**
387
+ * Resolve API key from multiple sources in priority order:
388
+ * 1. VIBESCOPE_API_KEY env var (CI/cloud agents)
389
+ * 2. ~/.vibescope/credentials.json (local dev)
390
+ * 3. Error with helpful message
391
+ */
392
+ function resolveApiKeyFromSources(): string {
393
+ // 1. Environment variable
394
+ if (process.env.VIBESCOPE_API_KEY) {
395
+ return process.env.VIBESCOPE_API_KEY;
396
+ }
397
+
398
+ // 2. Credentials file
399
+ try {
400
+ const { existsSync, readFileSync } = require('node:fs');
401
+ const { homedir } = require('node:os');
402
+ const { join } = require('node:path');
403
+ const credPath = join(homedir(), '.vibescope', 'credentials.json');
404
+ if (existsSync(credPath)) {
405
+ const data = JSON.parse(readFileSync(credPath, 'utf-8'));
406
+ if (data.apiKey) {
407
+ return data.apiKey;
408
+ }
409
+ }
410
+ } catch {
411
+ // ignore read errors
412
+ }
413
+
414
+ // 3. Not found
415
+ throw new Error(
416
+ 'Vibescope API key not found.\n\n' +
417
+ 'Set it up with:\n' +
418
+ ' npx vibescope init\n\n' +
419
+ 'Or set the VIBESCOPE_API_KEY environment variable.'
420
+ );
421
+ }
422
+
341
423
  export function initApiClient(config: ApiClientConfig): VibescopeApiClient {
342
424
  apiClient = new VibescopeApiClient(config);
343
425
  return apiClient;
@@ -0,0 +1,83 @@
1
+ /**
2
+ * Milestones API Methods
3
+ *
4
+ * Handles task milestones for tracking granular progress within tasks.
5
+ */
6
+
7
+ import type { ApiResponse, ProxyFn } from './types.js';
8
+
9
+ export interface Milestone {
10
+ id: string;
11
+ title: string;
12
+ description?: string;
13
+ status: string;
14
+ order_index: number;
15
+ created_at: string;
16
+ completed_at?: string;
17
+ }
18
+
19
+ export interface MilestoneStats {
20
+ total: number;
21
+ completed: number;
22
+ progress_percentage: number;
23
+ }
24
+
25
+ export interface MilestonesMethods {
26
+ getMilestones(taskId: string): Promise<ApiResponse<{
27
+ milestones: Milestone[];
28
+ stats: MilestoneStats;
29
+ }>>;
30
+
31
+ addMilestone(taskId: string, params: {
32
+ title: string;
33
+ description?: string;
34
+ order_index?: number;
35
+ }, sessionId?: string): Promise<ApiResponse<{ success: boolean; milestone_id: string }>>;
36
+
37
+ updateMilestone(milestoneId: string, updates: {
38
+ title?: string;
39
+ description?: string;
40
+ status?: string;
41
+ order_index?: number;
42
+ }): Promise<ApiResponse<{
43
+ success: boolean;
44
+ milestone: { id: string; title: string; status: string };
45
+ }>>;
46
+
47
+ completeMilestone(milestoneId: string): Promise<ApiResponse<{
48
+ success: boolean;
49
+ milestone: { id: string; title: string; status: string };
50
+ }>>;
51
+
52
+ deleteMilestone(milestoneId: string): Promise<ApiResponse<{ success: boolean }>>;
53
+ }
54
+
55
+ export function createMilestonesMethods(proxy: ProxyFn): MilestonesMethods {
56
+ return {
57
+ async getMilestones(taskId) {
58
+ return proxy('get_milestones', { task_id: taskId });
59
+ },
60
+
61
+ async addMilestone(taskId, params, sessionId) {
62
+ return proxy('add_milestone', {
63
+ task_id: taskId,
64
+ ...params
65
+ }, sessionId ? { session_id: sessionId } : undefined);
66
+ },
67
+
68
+ async updateMilestone(milestoneId, updates) {
69
+ return proxy('update_milestone', {
70
+ milestone_id: milestoneId,
71
+ ...updates
72
+ });
73
+ },
74
+
75
+ async completeMilestone(milestoneId) {
76
+ return proxy('complete_milestone', { milestone_id: milestoneId });
77
+ },
78
+
79
+ async deleteMilestone(milestoneId) {
80
+ return proxy('delete_milestone', { milestone_id: milestoneId });
81
+ }
82
+ };
83
+ }
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Validation API Methods
3
+ *
4
+ * Handles task validation workflow for code review and approval.
5
+ */
6
+
7
+ import type { ApiResponse, ProxyFn } from './types.js';
8
+
9
+ export interface TaskAwaitingValidation {
10
+ id: string;
11
+ title: string;
12
+ completed_at?: string;
13
+ completed_by_session_id?: string;
14
+ }
15
+
16
+ export interface ValidationMethods {
17
+ getTasksAwaitingValidation(projectId: string): Promise<ApiResponse<{
18
+ tasks: TaskAwaitingValidation[];
19
+ }>>;
20
+
21
+ claimValidation(taskId: string, sessionId?: string): Promise<ApiResponse<{
22
+ success: boolean;
23
+ task_id: string;
24
+ }>>;
25
+
26
+ validateTask(taskId: string, params: {
27
+ approved: boolean;
28
+ validation_notes?: string;
29
+ skip_pr_check?: boolean;
30
+ pr_checks_passing?: boolean;
31
+ create_fix_task?: boolean;
32
+ }, sessionId?: string): Promise<ApiResponse<{
33
+ success: boolean;
34
+ approved: boolean;
35
+ task_id: string;
36
+ message?: string;
37
+ workflow?: string;
38
+ }>>;
39
+ }
40
+
41
+ export function createValidationMethods(proxy: ProxyFn): ValidationMethods {
42
+ return {
43
+ async getTasksAwaitingValidation(projectId) {
44
+ return proxy('get_tasks_awaiting_validation', { project_id: projectId });
45
+ },
46
+
47
+ async claimValidation(taskId, sessionId) {
48
+ return proxy('claim_validation', { task_id: taskId }, sessionId ? {
49
+ session_id: sessionId
50
+ } : undefined);
51
+ },
52
+
53
+ async validateTask(taskId, params, sessionId) {
54
+ return proxy('validate_task', {
55
+ task_id: taskId,
56
+ ...params
57
+ }, sessionId ? { session_id: sessionId } : undefined);
58
+ }
59
+ };
60
+ }
package/src/api-client.ts CHANGED
@@ -203,6 +203,10 @@ export class VibescopeApiClient {
203
203
  git_main_branch?: string;
204
204
  git_develop_branch?: string;
205
205
  git_auto_branch?: boolean;
206
+ validation_required?: boolean;
207
+ auto_merge_on_approval?: boolean;
208
+ fallback_activities_enabled?: boolean;
209
+ require_pr_for_validation?: boolean;
206
210
  };
207
211
  active_tasks?: Array<{
208
212
  id: string;