@vibescope/mcp-server 0.2.8 → 0.3.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.
Files changed (97) hide show
  1. package/CHANGELOG.md +84 -84
  2. package/README.md +194 -194
  3. package/dist/api-client.d.ts +41 -5
  4. package/dist/api-client.js +34 -0
  5. package/dist/cli.d.ts +1 -1
  6. package/dist/cli.js +30 -38
  7. package/dist/handlers/discovery.js +2 -0
  8. package/dist/handlers/roles.js +1 -8
  9. package/dist/handlers/session.d.ts +11 -0
  10. package/dist/handlers/session.js +124 -32
  11. package/dist/handlers/tasks.d.ts +8 -0
  12. package/dist/handlers/tasks.js +163 -3
  13. package/dist/handlers/tool-docs.js +840 -828
  14. package/dist/handlers/validation.js +71 -15
  15. package/dist/index.js +73 -73
  16. package/dist/setup.js +6 -6
  17. package/dist/templates/agent-guidelines.js +185 -185
  18. package/dist/templates/help-content.d.ts +24 -0
  19. package/dist/templates/help-content.js +1728 -0
  20. package/dist/tools.js +132 -87
  21. package/dist/utils.d.ts +15 -11
  22. package/dist/utils.js +53 -28
  23. package/docs/TOOLS.md +2406 -2053
  24. package/package.json +1 -1
  25. package/scripts/generate-docs.ts +212 -212
  26. package/scripts/version-bump.ts +203 -203
  27. package/src/api-client.test.ts +723 -723
  28. package/src/api-client.ts +2561 -2499
  29. package/src/cli.test.ts +24 -8
  30. package/src/cli.ts +204 -212
  31. package/src/handlers/__test-setup__.ts +236 -236
  32. package/src/handlers/__test-utils__.ts +87 -87
  33. package/src/handlers/blockers.test.ts +468 -468
  34. package/src/handlers/blockers.ts +163 -163
  35. package/src/handlers/bodies-of-work.test.ts +704 -704
  36. package/src/handlers/bodies-of-work.ts +526 -526
  37. package/src/handlers/connectors.test.ts +834 -834
  38. package/src/handlers/connectors.ts +229 -229
  39. package/src/handlers/cost.test.ts +462 -462
  40. package/src/handlers/cost.ts +285 -285
  41. package/src/handlers/decisions.test.ts +382 -382
  42. package/src/handlers/decisions.ts +153 -153
  43. package/src/handlers/deployment.test.ts +551 -551
  44. package/src/handlers/deployment.ts +541 -541
  45. package/src/handlers/discovery.test.ts +206 -206
  46. package/src/handlers/discovery.ts +392 -390
  47. package/src/handlers/fallback.test.ts +537 -537
  48. package/src/handlers/fallback.ts +194 -194
  49. package/src/handlers/file-checkouts.test.ts +750 -750
  50. package/src/handlers/file-checkouts.ts +185 -185
  51. package/src/handlers/findings.test.ts +633 -633
  52. package/src/handlers/findings.ts +239 -239
  53. package/src/handlers/git-issues.test.ts +631 -631
  54. package/src/handlers/git-issues.ts +136 -136
  55. package/src/handlers/ideas.test.ts +644 -644
  56. package/src/handlers/ideas.ts +207 -207
  57. package/src/handlers/index.ts +84 -84
  58. package/src/handlers/milestones.test.ts +475 -475
  59. package/src/handlers/milestones.ts +180 -180
  60. package/src/handlers/organizations.test.ts +826 -826
  61. package/src/handlers/organizations.ts +315 -315
  62. package/src/handlers/progress.test.ts +269 -269
  63. package/src/handlers/progress.ts +77 -77
  64. package/src/handlers/project.test.ts +546 -546
  65. package/src/handlers/project.ts +239 -239
  66. package/src/handlers/requests.test.ts +303 -303
  67. package/src/handlers/requests.ts +99 -99
  68. package/src/handlers/roles.test.ts +305 -303
  69. package/src/handlers/roles.ts +219 -226
  70. package/src/handlers/session.test.ts +998 -875
  71. package/src/handlers/session.ts +839 -738
  72. package/src/handlers/sprints.test.ts +732 -732
  73. package/src/handlers/sprints.ts +537 -537
  74. package/src/handlers/tasks.test.ts +931 -907
  75. package/src/handlers/tasks.ts +1121 -945
  76. package/src/handlers/tool-categories.test.ts +66 -66
  77. package/src/handlers/tool-docs.ts +1109 -1096
  78. package/src/handlers/types.test.ts +259 -259
  79. package/src/handlers/types.ts +175 -175
  80. package/src/handlers/validation.test.ts +582 -582
  81. package/src/handlers/validation.ts +159 -97
  82. package/src/index.test.ts +674 -0
  83. package/src/index.ts +792 -792
  84. package/src/setup.test.ts +233 -233
  85. package/src/setup.ts +404 -403
  86. package/src/templates/agent-guidelines.ts +210 -210
  87. package/src/templates/help-content.ts +1751 -0
  88. package/src/token-tracking.test.ts +463 -463
  89. package/src/token-tracking.ts +166 -166
  90. package/src/tools.test.ts +416 -0
  91. package/src/tools.ts +3607 -3562
  92. package/src/utils.test.ts +785 -683
  93. package/src/utils.ts +469 -436
  94. package/src/validators.test.ts +223 -223
  95. package/src/validators.ts +249 -249
  96. package/tsconfig.json +16 -16
  97. package/vitest.config.ts +14 -14
@@ -1,223 +1,223 @@
1
- import { describe, it, expect } from 'vitest';
2
- import {
3
- ValidationError,
4
- validateRequired,
5
- validateUUID,
6
- validateTaskStatus,
7
- validateProjectStatus,
8
- validatePriority,
9
- validateProgressPercentage,
10
- validateEstimatedMinutes,
11
- validateEnvironment,
12
- VALID_TASK_STATUSES,
13
- VALID_PROJECT_STATUSES,
14
- VALID_ENVIRONMENTS,
15
- } from './validators.js';
16
-
17
- describe('ValidationError', () => {
18
- it('should create error with message', () => {
19
- const error = new ValidationError('Test error');
20
- expect(error.message).toBe('Test error');
21
- expect(error.name).toBe('ValidationError');
22
- });
23
-
24
- it('should include optional fields', () => {
25
- const error = new ValidationError('Test error', {
26
- field: 'test_field',
27
- hint: 'Test hint',
28
- validValues: ['a', 'b'],
29
- });
30
- expect(error.field).toBe('test_field');
31
- expect(error.hint).toBe('Test hint');
32
- expect(error.validValues).toEqual(['a', 'b']);
33
- });
34
-
35
- it('should serialize to JSON correctly', () => {
36
- const error = new ValidationError('Test error', {
37
- field: 'test_field',
38
- hint: 'Test hint',
39
- validValues: ['a', 'b'],
40
- });
41
- const json = error.toJSON();
42
- expect(json.error).toBe('validation_error');
43
- expect(json.message).toBe('Test error');
44
- expect(json.field).toBe('test_field');
45
- expect(json.hint).toBe('Test hint');
46
- expect(json.valid_values).toEqual(['a', 'b']);
47
- });
48
- });
49
-
50
- describe('validateRequired', () => {
51
- it('should pass for valid values', () => {
52
- expect(() => validateRequired('value', 'field')).not.toThrow();
53
- expect(() => validateRequired(0, 'field')).not.toThrow();
54
- expect(() => validateRequired(false, 'field')).not.toThrow();
55
- expect(() => validateRequired({}, 'field')).not.toThrow();
56
- });
57
-
58
- it('should throw for undefined', () => {
59
- expect(() => validateRequired(undefined, 'test_field')).toThrow(ValidationError);
60
- expect(() => validateRequired(undefined, 'test_field')).toThrow('Missing required field: test_field');
61
- });
62
-
63
- it('should throw for null', () => {
64
- expect(() => validateRequired(null, 'test_field')).toThrow(ValidationError);
65
- });
66
-
67
- it('should throw for empty string', () => {
68
- expect(() => validateRequired('', 'test_field')).toThrow(ValidationError);
69
- });
70
- });
71
-
72
- describe('validateUUID', () => {
73
- it('should pass for valid UUIDs', () => {
74
- expect(() => validateUUID('123e4567-e89b-12d3-a456-426614174000', 'id')).not.toThrow();
75
- expect(() => validateUUID('00000000-0000-0000-0000-000000000000', 'id')).not.toThrow();
76
- expect(() => validateUUID('FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF', 'id')).not.toThrow();
77
- });
78
-
79
- it('should pass for undefined (optional)', () => {
80
- expect(() => validateUUID(undefined, 'id')).not.toThrow();
81
- });
82
-
83
- it('should pass for empty string (treated as optional)', () => {
84
- expect(() => validateUUID('', 'id')).not.toThrow();
85
- });
86
-
87
- it('should throw for invalid UUIDs', () => {
88
- expect(() => validateUUID('not-a-uuid', 'id')).toThrow(ValidationError);
89
- expect(() => validateUUID('123', 'id')).toThrow(ValidationError);
90
- expect(() => validateUUID('123e4567-e89b-12d3-a456', 'id')).toThrow(ValidationError);
91
- expect(() => validateUUID('123e4567-e89b-12d3-a456-426614174000-extra', 'id')).toThrow(ValidationError);
92
- });
93
- });
94
-
95
- describe('validateTaskStatus', () => {
96
- it('should pass for valid task statuses', () => {
97
- for (const status of VALID_TASK_STATUSES) {
98
- expect(() => validateTaskStatus(status)).not.toThrow();
99
- }
100
- });
101
-
102
- it('should pass for undefined (optional)', () => {
103
- expect(() => validateTaskStatus(undefined)).not.toThrow();
104
- });
105
-
106
- it('should throw for invalid status', () => {
107
- expect(() => validateTaskStatus('invalid')).toThrow(ValidationError);
108
- expect(() => validateTaskStatus('PENDING')).toThrow(ValidationError);
109
- expect(() => validateTaskStatus('done')).toThrow(ValidationError);
110
- });
111
- });
112
-
113
- describe('validateProjectStatus', () => {
114
- it('should pass for valid project statuses', () => {
115
- for (const status of VALID_PROJECT_STATUSES) {
116
- expect(() => validateProjectStatus(status)).not.toThrow();
117
- }
118
- });
119
-
120
- it('should pass for undefined (optional)', () => {
121
- expect(() => validateProjectStatus(undefined)).not.toThrow();
122
- });
123
-
124
- it('should throw for invalid status', () => {
125
- expect(() => validateProjectStatus('invalid')).toThrow(ValidationError);
126
- expect(() => validateProjectStatus('ACTIVE')).toThrow(ValidationError);
127
- });
128
- });
129
-
130
- describe('validatePriority', () => {
131
- it('should pass for valid priorities 1-5', () => {
132
- for (let i = 1; i <= 5; i++) {
133
- expect(() => validatePriority(i)).not.toThrow();
134
- }
135
- });
136
-
137
- it('should pass for undefined (optional)', () => {
138
- expect(() => validatePriority(undefined)).not.toThrow();
139
- });
140
-
141
- it('should throw for out of range values', () => {
142
- expect(() => validatePriority(0)).toThrow(ValidationError);
143
- expect(() => validatePriority(6)).toThrow(ValidationError);
144
- expect(() => validatePriority(-1)).toThrow(ValidationError);
145
- });
146
-
147
- it('should throw for non-integers', () => {
148
- expect(() => validatePriority(1.5)).toThrow(ValidationError);
149
- expect(() => validatePriority(2.7)).toThrow(ValidationError);
150
- });
151
- });
152
-
153
- describe('validateProgressPercentage', () => {
154
- it('should pass for valid percentages 0-100', () => {
155
- expect(() => validateProgressPercentage(0)).not.toThrow();
156
- expect(() => validateProgressPercentage(50)).not.toThrow();
157
- expect(() => validateProgressPercentage(100)).not.toThrow();
158
- expect(() => validateProgressPercentage(33.33)).not.toThrow();
159
- });
160
-
161
- it('should pass for undefined (optional)', () => {
162
- expect(() => validateProgressPercentage(undefined)).not.toThrow();
163
- });
164
-
165
- it('should throw for out of range values', () => {
166
- expect(() => validateProgressPercentage(-1)).toThrow(ValidationError);
167
- expect(() => validateProgressPercentage(101)).toThrow(ValidationError);
168
- expect(() => validateProgressPercentage(150)).toThrow(ValidationError);
169
- });
170
-
171
- it('should throw for non-finite values', () => {
172
- expect(() => validateProgressPercentage(Infinity)).toThrow(ValidationError);
173
- expect(() => validateProgressPercentage(NaN)).toThrow(ValidationError);
174
- });
175
- });
176
-
177
- describe('validateEstimatedMinutes', () => {
178
- it('should pass for valid positive integers', () => {
179
- expect(() => validateEstimatedMinutes(1)).not.toThrow();
180
- expect(() => validateEstimatedMinutes(30)).not.toThrow();
181
- expect(() => validateEstimatedMinutes(120)).not.toThrow();
182
- });
183
-
184
- it('should pass for undefined (optional)', () => {
185
- expect(() => validateEstimatedMinutes(undefined)).not.toThrow();
186
- });
187
-
188
- it('should throw for zero', () => {
189
- expect(() => validateEstimatedMinutes(0)).toThrow(ValidationError);
190
- });
191
-
192
- it('should throw for negative values', () => {
193
- expect(() => validateEstimatedMinutes(-1)).toThrow(ValidationError);
194
- expect(() => validateEstimatedMinutes(-30)).toThrow(ValidationError);
195
- });
196
-
197
- it('should throw for non-integers', () => {
198
- expect(() => validateEstimatedMinutes(1.5)).toThrow(ValidationError);
199
- expect(() => validateEstimatedMinutes(30.5)).toThrow(ValidationError);
200
- });
201
- });
202
-
203
- describe('validateEnvironment', () => {
204
- it('should pass for valid environments', () => {
205
- for (const env of VALID_ENVIRONMENTS) {
206
- expect(() => validateEnvironment(env)).not.toThrow();
207
- }
208
- });
209
-
210
- it('should pass for undefined (optional)', () => {
211
- expect(() => validateEnvironment(undefined)).not.toThrow();
212
- });
213
-
214
- it('should pass for empty string (treated as optional)', () => {
215
- expect(() => validateEnvironment('')).not.toThrow();
216
- });
217
-
218
- it('should throw for invalid environment', () => {
219
- expect(() => validateEnvironment('invalid')).toThrow(ValidationError);
220
- expect(() => validateEnvironment('PRODUCTION')).toThrow(ValidationError);
221
- expect(() => validateEnvironment('prod')).toThrow(ValidationError);
222
- });
223
- });
1
+ import { describe, it, expect } from 'vitest';
2
+ import {
3
+ ValidationError,
4
+ validateRequired,
5
+ validateUUID,
6
+ validateTaskStatus,
7
+ validateProjectStatus,
8
+ validatePriority,
9
+ validateProgressPercentage,
10
+ validateEstimatedMinutes,
11
+ validateEnvironment,
12
+ VALID_TASK_STATUSES,
13
+ VALID_PROJECT_STATUSES,
14
+ VALID_ENVIRONMENTS,
15
+ } from './validators.js';
16
+
17
+ describe('ValidationError', () => {
18
+ it('should create error with message', () => {
19
+ const error = new ValidationError('Test error');
20
+ expect(error.message).toBe('Test error');
21
+ expect(error.name).toBe('ValidationError');
22
+ });
23
+
24
+ it('should include optional fields', () => {
25
+ const error = new ValidationError('Test error', {
26
+ field: 'test_field',
27
+ hint: 'Test hint',
28
+ validValues: ['a', 'b'],
29
+ });
30
+ expect(error.field).toBe('test_field');
31
+ expect(error.hint).toBe('Test hint');
32
+ expect(error.validValues).toEqual(['a', 'b']);
33
+ });
34
+
35
+ it('should serialize to JSON correctly', () => {
36
+ const error = new ValidationError('Test error', {
37
+ field: 'test_field',
38
+ hint: 'Test hint',
39
+ validValues: ['a', 'b'],
40
+ });
41
+ const json = error.toJSON();
42
+ expect(json.error).toBe('validation_error');
43
+ expect(json.message).toBe('Test error');
44
+ expect(json.field).toBe('test_field');
45
+ expect(json.hint).toBe('Test hint');
46
+ expect(json.valid_values).toEqual(['a', 'b']);
47
+ });
48
+ });
49
+
50
+ describe('validateRequired', () => {
51
+ it('should pass for valid values', () => {
52
+ expect(() => validateRequired('value', 'field')).not.toThrow();
53
+ expect(() => validateRequired(0, 'field')).not.toThrow();
54
+ expect(() => validateRequired(false, 'field')).not.toThrow();
55
+ expect(() => validateRequired({}, 'field')).not.toThrow();
56
+ });
57
+
58
+ it('should throw for undefined', () => {
59
+ expect(() => validateRequired(undefined, 'test_field')).toThrow(ValidationError);
60
+ expect(() => validateRequired(undefined, 'test_field')).toThrow('Missing required field: test_field');
61
+ });
62
+
63
+ it('should throw for null', () => {
64
+ expect(() => validateRequired(null, 'test_field')).toThrow(ValidationError);
65
+ });
66
+
67
+ it('should throw for empty string', () => {
68
+ expect(() => validateRequired('', 'test_field')).toThrow(ValidationError);
69
+ });
70
+ });
71
+
72
+ describe('validateUUID', () => {
73
+ it('should pass for valid UUIDs', () => {
74
+ expect(() => validateUUID('123e4567-e89b-12d3-a456-426614174000', 'id')).not.toThrow();
75
+ expect(() => validateUUID('00000000-0000-0000-0000-000000000000', 'id')).not.toThrow();
76
+ expect(() => validateUUID('FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF', 'id')).not.toThrow();
77
+ });
78
+
79
+ it('should pass for undefined (optional)', () => {
80
+ expect(() => validateUUID(undefined, 'id')).not.toThrow();
81
+ });
82
+
83
+ it('should pass for empty string (treated as optional)', () => {
84
+ expect(() => validateUUID('', 'id')).not.toThrow();
85
+ });
86
+
87
+ it('should throw for invalid UUIDs', () => {
88
+ expect(() => validateUUID('not-a-uuid', 'id')).toThrow(ValidationError);
89
+ expect(() => validateUUID('123', 'id')).toThrow(ValidationError);
90
+ expect(() => validateUUID('123e4567-e89b-12d3-a456', 'id')).toThrow(ValidationError);
91
+ expect(() => validateUUID('123e4567-e89b-12d3-a456-426614174000-extra', 'id')).toThrow(ValidationError);
92
+ });
93
+ });
94
+
95
+ describe('validateTaskStatus', () => {
96
+ it('should pass for valid task statuses', () => {
97
+ for (const status of VALID_TASK_STATUSES) {
98
+ expect(() => validateTaskStatus(status)).not.toThrow();
99
+ }
100
+ });
101
+
102
+ it('should pass for undefined (optional)', () => {
103
+ expect(() => validateTaskStatus(undefined)).not.toThrow();
104
+ });
105
+
106
+ it('should throw for invalid status', () => {
107
+ expect(() => validateTaskStatus('invalid')).toThrow(ValidationError);
108
+ expect(() => validateTaskStatus('PENDING')).toThrow(ValidationError);
109
+ expect(() => validateTaskStatus('done')).toThrow(ValidationError);
110
+ });
111
+ });
112
+
113
+ describe('validateProjectStatus', () => {
114
+ it('should pass for valid project statuses', () => {
115
+ for (const status of VALID_PROJECT_STATUSES) {
116
+ expect(() => validateProjectStatus(status)).not.toThrow();
117
+ }
118
+ });
119
+
120
+ it('should pass for undefined (optional)', () => {
121
+ expect(() => validateProjectStatus(undefined)).not.toThrow();
122
+ });
123
+
124
+ it('should throw for invalid status', () => {
125
+ expect(() => validateProjectStatus('invalid')).toThrow(ValidationError);
126
+ expect(() => validateProjectStatus('ACTIVE')).toThrow(ValidationError);
127
+ });
128
+ });
129
+
130
+ describe('validatePriority', () => {
131
+ it('should pass for valid priorities 1-5', () => {
132
+ for (let i = 1; i <= 5; i++) {
133
+ expect(() => validatePriority(i)).not.toThrow();
134
+ }
135
+ });
136
+
137
+ it('should pass for undefined (optional)', () => {
138
+ expect(() => validatePriority(undefined)).not.toThrow();
139
+ });
140
+
141
+ it('should throw for out of range values', () => {
142
+ expect(() => validatePriority(0)).toThrow(ValidationError);
143
+ expect(() => validatePriority(6)).toThrow(ValidationError);
144
+ expect(() => validatePriority(-1)).toThrow(ValidationError);
145
+ });
146
+
147
+ it('should throw for non-integers', () => {
148
+ expect(() => validatePriority(1.5)).toThrow(ValidationError);
149
+ expect(() => validatePriority(2.7)).toThrow(ValidationError);
150
+ });
151
+ });
152
+
153
+ describe('validateProgressPercentage', () => {
154
+ it('should pass for valid percentages 0-100', () => {
155
+ expect(() => validateProgressPercentage(0)).not.toThrow();
156
+ expect(() => validateProgressPercentage(50)).not.toThrow();
157
+ expect(() => validateProgressPercentage(100)).not.toThrow();
158
+ expect(() => validateProgressPercentage(33.33)).not.toThrow();
159
+ });
160
+
161
+ it('should pass for undefined (optional)', () => {
162
+ expect(() => validateProgressPercentage(undefined)).not.toThrow();
163
+ });
164
+
165
+ it('should throw for out of range values', () => {
166
+ expect(() => validateProgressPercentage(-1)).toThrow(ValidationError);
167
+ expect(() => validateProgressPercentage(101)).toThrow(ValidationError);
168
+ expect(() => validateProgressPercentage(150)).toThrow(ValidationError);
169
+ });
170
+
171
+ it('should throw for non-finite values', () => {
172
+ expect(() => validateProgressPercentage(Infinity)).toThrow(ValidationError);
173
+ expect(() => validateProgressPercentage(NaN)).toThrow(ValidationError);
174
+ });
175
+ });
176
+
177
+ describe('validateEstimatedMinutes', () => {
178
+ it('should pass for valid positive integers', () => {
179
+ expect(() => validateEstimatedMinutes(1)).not.toThrow();
180
+ expect(() => validateEstimatedMinutes(30)).not.toThrow();
181
+ expect(() => validateEstimatedMinutes(120)).not.toThrow();
182
+ });
183
+
184
+ it('should pass for undefined (optional)', () => {
185
+ expect(() => validateEstimatedMinutes(undefined)).not.toThrow();
186
+ });
187
+
188
+ it('should throw for zero', () => {
189
+ expect(() => validateEstimatedMinutes(0)).toThrow(ValidationError);
190
+ });
191
+
192
+ it('should throw for negative values', () => {
193
+ expect(() => validateEstimatedMinutes(-1)).toThrow(ValidationError);
194
+ expect(() => validateEstimatedMinutes(-30)).toThrow(ValidationError);
195
+ });
196
+
197
+ it('should throw for non-integers', () => {
198
+ expect(() => validateEstimatedMinutes(1.5)).toThrow(ValidationError);
199
+ expect(() => validateEstimatedMinutes(30.5)).toThrow(ValidationError);
200
+ });
201
+ });
202
+
203
+ describe('validateEnvironment', () => {
204
+ it('should pass for valid environments', () => {
205
+ for (const env of VALID_ENVIRONMENTS) {
206
+ expect(() => validateEnvironment(env)).not.toThrow();
207
+ }
208
+ });
209
+
210
+ it('should pass for undefined (optional)', () => {
211
+ expect(() => validateEnvironment(undefined)).not.toThrow();
212
+ });
213
+
214
+ it('should pass for empty string (treated as optional)', () => {
215
+ expect(() => validateEnvironment('')).not.toThrow();
216
+ });
217
+
218
+ it('should throw for invalid environment', () => {
219
+ expect(() => validateEnvironment('invalid')).toThrow(ValidationError);
220
+ expect(() => validateEnvironment('PRODUCTION')).toThrow(ValidationError);
221
+ expect(() => validateEnvironment('prod')).toThrow(ValidationError);
222
+ });
223
+ });