@vibescope/mcp-server 0.2.3 → 0.2.5

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 (117) hide show
  1. package/CHANGELOG.md +84 -0
  2. package/README.md +194 -138
  3. package/dist/api-client.d.ts +276 -8
  4. package/dist/api-client.js +123 -8
  5. package/dist/cli.d.ts +6 -3
  6. package/dist/cli.js +28 -10
  7. package/dist/handlers/blockers.d.ts +11 -0
  8. package/dist/handlers/blockers.js +37 -2
  9. package/dist/handlers/bodies-of-work.d.ts +2 -0
  10. package/dist/handlers/bodies-of-work.js +30 -1
  11. package/dist/handlers/connectors.js +2 -2
  12. package/dist/handlers/decisions.d.ts +11 -0
  13. package/dist/handlers/decisions.js +37 -2
  14. package/dist/handlers/deployment.d.ts +6 -0
  15. package/dist/handlers/deployment.js +33 -5
  16. package/dist/handlers/discovery.js +27 -11
  17. package/dist/handlers/fallback.js +12 -6
  18. package/dist/handlers/file-checkouts.d.ts +1 -0
  19. package/dist/handlers/file-checkouts.js +17 -2
  20. package/dist/handlers/findings.d.ts +5 -0
  21. package/dist/handlers/findings.js +19 -2
  22. package/dist/handlers/git-issues.js +4 -2
  23. package/dist/handlers/ideas.d.ts +5 -0
  24. package/dist/handlers/ideas.js +19 -2
  25. package/dist/handlers/progress.js +2 -2
  26. package/dist/handlers/project.d.ts +1 -0
  27. package/dist/handlers/project.js +35 -2
  28. package/dist/handlers/requests.js +6 -3
  29. package/dist/handlers/roles.js +13 -2
  30. package/dist/handlers/session.d.ts +12 -0
  31. package/dist/handlers/session.js +288 -25
  32. package/dist/handlers/sprints.d.ts +2 -0
  33. package/dist/handlers/sprints.js +30 -1
  34. package/dist/handlers/tasks.d.ts +25 -2
  35. package/dist/handlers/tasks.js +228 -35
  36. package/dist/handlers/tool-docs.js +834 -767
  37. package/dist/index.js +73 -73
  38. package/dist/knowledge.d.ts +6 -0
  39. package/dist/knowledge.js +218 -0
  40. package/dist/setup.d.ts +22 -0
  41. package/dist/setup.js +313 -0
  42. package/dist/templates/agent-guidelines.d.ts +18 -0
  43. package/dist/templates/agent-guidelines.js +207 -0
  44. package/dist/tools.js +527 -174
  45. package/dist/utils.d.ts +5 -2
  46. package/dist/utils.js +101 -62
  47. package/docs/TOOLS.md +2053 -2053
  48. package/package.json +51 -46
  49. package/scripts/generate-docs.ts +212 -212
  50. package/scripts/version-bump.ts +203 -0
  51. package/src/api-client.test.ts +723 -723
  52. package/src/api-client.ts +2499 -2140
  53. package/src/cli.ts +27 -10
  54. package/src/handlers/__test-setup__.ts +236 -231
  55. package/src/handlers/__test-utils__.ts +87 -87
  56. package/src/handlers/blockers.test.ts +468 -392
  57. package/src/handlers/blockers.ts +163 -109
  58. package/src/handlers/bodies-of-work.test.ts +704 -704
  59. package/src/handlers/bodies-of-work.ts +526 -468
  60. package/src/handlers/connectors.test.ts +834 -834
  61. package/src/handlers/connectors.ts +229 -229
  62. package/src/handlers/cost.test.ts +462 -462
  63. package/src/handlers/cost.ts +285 -285
  64. package/src/handlers/decisions.test.ts +382 -313
  65. package/src/handlers/decisions.ts +153 -99
  66. package/src/handlers/deployment.test.ts +551 -470
  67. package/src/handlers/deployment.ts +541 -508
  68. package/src/handlers/discovery.test.ts +206 -206
  69. package/src/handlers/discovery.ts +390 -374
  70. package/src/handlers/fallback.test.ts +537 -536
  71. package/src/handlers/fallback.ts +194 -188
  72. package/src/handlers/file-checkouts.test.ts +750 -670
  73. package/src/handlers/file-checkouts.ts +185 -165
  74. package/src/handlers/findings.test.ts +633 -633
  75. package/src/handlers/findings.ts +239 -203
  76. package/src/handlers/git-issues.test.ts +631 -631
  77. package/src/handlers/git-issues.ts +136 -134
  78. package/src/handlers/ideas.test.ts +644 -644
  79. package/src/handlers/ideas.ts +207 -175
  80. package/src/handlers/index.ts +84 -84
  81. package/src/handlers/milestones.test.ts +475 -475
  82. package/src/handlers/milestones.ts +180 -180
  83. package/src/handlers/organizations.test.ts +826 -826
  84. package/src/handlers/organizations.ts +315 -315
  85. package/src/handlers/progress.test.ts +269 -269
  86. package/src/handlers/progress.ts +77 -77
  87. package/src/handlers/project.test.ts +546 -546
  88. package/src/handlers/project.ts +239 -194
  89. package/src/handlers/requests.test.ts +303 -272
  90. package/src/handlers/requests.ts +99 -96
  91. package/src/handlers/roles.test.ts +303 -303
  92. package/src/handlers/roles.ts +226 -208
  93. package/src/handlers/session.test.ts +875 -576
  94. package/src/handlers/session.ts +738 -425
  95. package/src/handlers/sprints.test.ts +732 -732
  96. package/src/handlers/sprints.ts +537 -477
  97. package/src/handlers/tasks.test.ts +907 -980
  98. package/src/handlers/tasks.ts +945 -716
  99. package/src/handlers/tool-categories.test.ts +66 -66
  100. package/src/handlers/tool-docs.ts +1096 -1024
  101. package/src/handlers/types.test.ts +259 -0
  102. package/src/handlers/types.ts +175 -175
  103. package/src/handlers/validation.test.ts +582 -582
  104. package/src/handlers/validation.ts +97 -97
  105. package/src/index.ts +792 -792
  106. package/src/setup.test.ts +231 -0
  107. package/src/setup.ts +370 -0
  108. package/src/templates/agent-guidelines.ts +210 -0
  109. package/src/token-tracking.test.ts +453 -453
  110. package/src/token-tracking.ts +164 -164
  111. package/src/tools.ts +3562 -3208
  112. package/src/utils.test.ts +683 -681
  113. package/src/utils.ts +436 -392
  114. package/src/validators.test.ts +223 -223
  115. package/src/validators.ts +249 -249
  116. package/tsconfig.json +16 -16
  117. package/vitest.config.ts +14 -14
@@ -1,208 +1,226 @@
1
- /**
2
- * Role Management Handlers
3
- *
4
- * Handles agent role configuration and assignment:
5
- * - get_role_settings: Get role configuration for a project
6
- * - update_role_settings: Update role settings for a project
7
- * - set_session_role: Set the role for the current session
8
- * - get_agents_by_role: Get active agents grouped by their assigned roles
9
- */
10
-
11
- import type { Handler, HandlerRegistry, AgentRole } from './types.js';
12
- import { getApiClient } from '../api-client.js';
13
-
14
- export const getRoleSettings: Handler = async (args, _ctx) => {
15
- const { project_id } = args as { project_id: string };
16
-
17
- if (!project_id) {
18
- return {
19
- result: { error: 'project_id is required' },
20
- };
21
- }
22
-
23
- const apiClient = getApiClient();
24
- const response = await apiClient.proxy<{
25
- roles: Array<{
26
- role: AgentRole;
27
- enabled: boolean;
28
- display_name: string | null;
29
- description: string | null;
30
- priority_filter: number[] | null;
31
- fallback_activities: string[] | null;
32
- auto_assign_validation: boolean;
33
- auto_assign_deployment: boolean;
34
- }>;
35
- }>('get_role_settings', { project_id });
36
-
37
- if (!response.ok) {
38
- return {
39
- result: { error: response.error || 'Failed to get role settings' },
40
- };
41
- }
42
-
43
- return { result: response.data };
44
- };
45
-
46
- export const updateRoleSettings: Handler = async (args, _ctx) => {
47
- const {
48
- project_id,
49
- role,
50
- enabled,
51
- display_name,
52
- description,
53
- priority_filter,
54
- fallback_activities,
55
- auto_assign_validation,
56
- auto_assign_deployment,
57
- } = args as {
58
- project_id: string;
59
- role: AgentRole;
60
- enabled?: boolean;
61
- display_name?: string;
62
- description?: string;
63
- priority_filter?: number[];
64
- fallback_activities?: string[];
65
- auto_assign_validation?: boolean;
66
- auto_assign_deployment?: boolean;
67
- };
68
-
69
- if (!project_id) {
70
- return {
71
- result: { error: 'project_id is required' },
72
- };
73
- }
74
-
75
- if (!role) {
76
- return {
77
- result: { error: 'role is required' },
78
- };
79
- }
80
-
81
- const apiClient = getApiClient();
82
- const response = await apiClient.proxy<{
83
- success: boolean;
84
- role: AgentRole;
85
- }>('update_role_settings', {
86
- project_id,
87
- role,
88
- enabled,
89
- display_name,
90
- description,
91
- priority_filter,
92
- fallback_activities,
93
- auto_assign_validation,
94
- auto_assign_deployment,
95
- });
96
-
97
- if (!response.ok) {
98
- return {
99
- result: { error: response.error || 'Failed to update role settings' },
100
- };
101
- }
102
-
103
- return { result: response.data };
104
- };
105
-
106
- export const setSessionRole: Handler = async (args, ctx) => {
107
- const { role, role_config } = args as {
108
- role: AgentRole;
109
- role_config?: Record<string, unknown>;
110
- };
111
- const { session, updateSession } = ctx;
112
-
113
- if (!role) {
114
- return {
115
- result: { error: 'role is required' },
116
- };
117
- }
118
-
119
- const validRoles: AgentRole[] = ['developer', 'validator', 'deployer', 'reviewer', 'maintainer'];
120
- if (!validRoles.includes(role)) {
121
- return {
122
- result: {
123
- error: `Invalid role: ${role}. Must be one of: ${validRoles.join(', ')}`,
124
- },
125
- };
126
- }
127
-
128
- // Update local session state
129
- updateSession({ currentRole: role });
130
-
131
- // If there's an active session, update it on the server too
132
- if (session.currentSessionId) {
133
- const apiClient = getApiClient();
134
- const response = await apiClient.proxy<{
135
- success: boolean;
136
- session_id: string;
137
- role: AgentRole;
138
- }>('set_session_role', {
139
- session_id: session.currentSessionId,
140
- role,
141
- role_config,
142
- });
143
-
144
- if (!response.ok) {
145
- return {
146
- result: { error: response.error || 'Failed to update session role' },
147
- };
148
- }
149
-
150
- return {
151
- result: {
152
- success: true,
153
- session_id: session.currentSessionId,
154
- role,
155
- message: `Session role updated to ${role}. Task filtering and fallback suggestions will now be optimized for this role.`,
156
- },
157
- };
158
- }
159
-
160
- return {
161
- result: {
162
- success: true,
163
- role,
164
- message: `Local role set to ${role}. Start a session to persist this role.`,
165
- },
166
- };
167
- };
168
-
169
- export const getAgentsByRole: Handler = async (args, _ctx) => {
170
- const { project_id } = args as { project_id: string };
171
-
172
- if (!project_id) {
173
- return {
174
- result: { error: 'project_id is required' },
175
- };
176
- }
177
-
178
- const apiClient = getApiClient();
179
- const response = await apiClient.proxy<{
180
- agents_by_role: Record<AgentRole, Array<{
181
- session_id: string;
182
- agent_name: string;
183
- status: string;
184
- current_task_id: string | null;
185
- current_task_title: string | null;
186
- last_synced_at: string;
187
- }>>;
188
- total_active: number;
189
- }>('get_agents_by_role', { project_id });
190
-
191
- if (!response.ok) {
192
- return {
193
- result: { error: response.error || 'Failed to get agents by role' },
194
- };
195
- }
196
-
197
- return { result: response.data };
198
- };
199
-
200
- /**
201
- * Role handlers registry
202
- */
203
- export const roleHandlers: HandlerRegistry = {
204
- get_role_settings: getRoleSettings,
205
- update_role_settings: updateRoleSettings,
206
- set_session_role: setSessionRole,
207
- get_agents_by_role: getAgentsByRole,
208
- };
1
+ /**
2
+ * Role Management Handlers
3
+ *
4
+ * Handles agent role configuration and assignment:
5
+ * - get_role_settings: Get role configuration for a project
6
+ * - update_role_settings: Update role settings for a project
7
+ * - set_session_role: Set the role for the current session
8
+ * - get_agents_by_role: Get active agents grouped by their assigned roles
9
+ */
10
+
11
+ import type { Handler, HandlerRegistry, AgentRole } from './types.js';
12
+ import { getApiClient } from '../api-client.js';
13
+
14
+ export const getRoleSettings: Handler = async (args, _ctx) => {
15
+ const { project_id } = args as { project_id: string };
16
+
17
+ if (!project_id) {
18
+ return {
19
+ result: { error: 'project_id is required' },
20
+ };
21
+ }
22
+
23
+ const apiClient = getApiClient();
24
+ const response = await apiClient.proxy<{
25
+ roles: Array<{
26
+ role: AgentRole;
27
+ enabled: boolean;
28
+ display_name: string | null;
29
+ description: string | null;
30
+ priority_filter: number[] | null;
31
+ fallback_activities: string[] | null;
32
+ auto_assign_validation: boolean;
33
+ auto_assign_deployment: boolean;
34
+ }>;
35
+ }>('get_role_settings', { project_id });
36
+
37
+ if (!response.ok) {
38
+ return {
39
+ result: { error: response.error || 'Failed to get role settings' },
40
+ };
41
+ }
42
+
43
+ return { result: response.data };
44
+ };
45
+
46
+ export const updateRoleSettings: Handler = async (args, _ctx) => {
47
+ const {
48
+ project_id,
49
+ role,
50
+ enabled,
51
+ display_name,
52
+ description,
53
+ priority_filter,
54
+ fallback_activities,
55
+ auto_assign_validation,
56
+ auto_assign_deployment,
57
+ } = args as {
58
+ project_id: string;
59
+ role: AgentRole;
60
+ enabled?: boolean;
61
+ display_name?: string;
62
+ description?: string;
63
+ priority_filter?: number[];
64
+ fallback_activities?: string[];
65
+ auto_assign_validation?: boolean;
66
+ auto_assign_deployment?: boolean;
67
+ };
68
+
69
+ if (!project_id) {
70
+ return {
71
+ result: { error: 'project_id is required' },
72
+ };
73
+ }
74
+
75
+ if (!role) {
76
+ return {
77
+ result: { error: 'role is required' },
78
+ };
79
+ }
80
+
81
+ const apiClient = getApiClient();
82
+ const response = await apiClient.proxy<{
83
+ success: boolean;
84
+ role: AgentRole;
85
+ }>('update_role_settings', {
86
+ project_id,
87
+ role,
88
+ enabled,
89
+ display_name,
90
+ description,
91
+ priority_filter,
92
+ fallback_activities,
93
+ auto_assign_validation,
94
+ auto_assign_deployment,
95
+ });
96
+
97
+ if (!response.ok) {
98
+ return {
99
+ result: { error: response.error || 'Failed to update role settings' },
100
+ };
101
+ }
102
+
103
+ return { result: response.data };
104
+ };
105
+
106
+ export const setSessionRole: Handler = async (args, ctx) => {
107
+ const { role, role_config } = args as {
108
+ role: AgentRole;
109
+ role_config?: Record<string, unknown>;
110
+ };
111
+ const { session, updateSession } = ctx;
112
+
113
+ if (!role) {
114
+ return {
115
+ result: { error: 'role is required' },
116
+ };
117
+ }
118
+
119
+ const validRoles: AgentRole[] = ['developer', 'validator', 'deployer', 'reviewer', 'maintainer'];
120
+ if (!validRoles.includes(role)) {
121
+ return {
122
+ result: {
123
+ error: `Invalid role: ${role}. Must be one of: ${validRoles.join(', ')}`,
124
+ },
125
+ };
126
+ }
127
+
128
+ // Update local session state
129
+ updateSession({ currentRole: role });
130
+
131
+ // If there's an active session, update it on the server too
132
+ if (session.currentSessionId) {
133
+ const apiClient = getApiClient();
134
+ const response = await apiClient.proxy<{
135
+ success: boolean;
136
+ session_id: string;
137
+ role: AgentRole;
138
+ }>('set_session_role', {
139
+ session_id: session.currentSessionId,
140
+ role,
141
+ role_config,
142
+ });
143
+
144
+ if (!response.ok) {
145
+ return {
146
+ result: { error: response.error || 'Failed to update session role' },
147
+ };
148
+ }
149
+
150
+ return {
151
+ result: {
152
+ success: true,
153
+ session_id: session.currentSessionId,
154
+ role,
155
+ message: `Session role updated to ${role}. Task filtering and fallback suggestions will now be optimized for this role.`,
156
+ },
157
+ };
158
+ }
159
+
160
+ return {
161
+ result: {
162
+ success: true,
163
+ role,
164
+ message: `Local role set to ${role}. Start a session to persist this role.`,
165
+ },
166
+ };
167
+ };
168
+
169
+ export const getAgentsByRole: Handler = async (args, _ctx) => {
170
+ const { project_id, counts_only = true } = args as { project_id: string; counts_only?: boolean };
171
+
172
+ if (!project_id) {
173
+ return {
174
+ result: { error: 'project_id is required' },
175
+ };
176
+ }
177
+
178
+ const apiClient = getApiClient();
179
+
180
+ // Type varies based on counts_only
181
+ if (counts_only) {
182
+ const response = await apiClient.proxy<{
183
+ agents_by_role: Record<AgentRole, number>;
184
+ total_active: number;
185
+ }>('get_agents_by_role', { project_id, counts_only: true });
186
+
187
+ if (!response.ok) {
188
+ return {
189
+ result: { error: response.error || 'Failed to get agents by role' },
190
+ };
191
+ }
192
+
193
+ return { result: response.data };
194
+ }
195
+
196
+ // Full details mode
197
+ const response = await apiClient.proxy<{
198
+ agents_by_role: Record<AgentRole, Array<{
199
+ session_id: string;
200
+ agent_name: string;
201
+ status: string;
202
+ current_task_id: string | null;
203
+ current_task_title: string | null;
204
+ last_synced_at: string;
205
+ }>>;
206
+ total_active: number;
207
+ }>('get_agents_by_role', { project_id, counts_only: false });
208
+
209
+ if (!response.ok) {
210
+ return {
211
+ result: { error: response.error || 'Failed to get agents by role' },
212
+ };
213
+ }
214
+
215
+ return { result: response.data };
216
+ };
217
+
218
+ /**
219
+ * Role handlers registry
220
+ */
221
+ export const roleHandlers: HandlerRegistry = {
222
+ get_role_settings: getRoleSettings,
223
+ update_role_settings: updateRoleSettings,
224
+ set_session_role: setSessionRole,
225
+ get_agents_by_role: getAgentsByRole,
226
+ };