@vibescope/mcp-server 0.2.5 → 0.2.7

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 (82) hide show
  1. package/CHANGELOG.md +84 -84
  2. package/README.md +194 -194
  3. package/dist/cli.js +26 -26
  4. package/dist/handlers/tool-docs.js +828 -828
  5. package/dist/index.js +73 -73
  6. package/dist/templates/agent-guidelines.js +185 -185
  7. package/dist/token-tracking.js +4 -2
  8. package/dist/tools.js +65 -65
  9. package/dist/utils.js +11 -11
  10. package/docs/TOOLS.md +2053 -2053
  11. package/package.json +3 -2
  12. package/scripts/generate-docs.ts +212 -212
  13. package/scripts/version-bump.ts +203 -203
  14. package/src/api-client.test.ts +723 -723
  15. package/src/api-client.ts +2499 -2499
  16. package/src/cli.ts +212 -212
  17. package/src/handlers/__test-setup__.ts +236 -236
  18. package/src/handlers/__test-utils__.ts +87 -87
  19. package/src/handlers/blockers.test.ts +468 -468
  20. package/src/handlers/blockers.ts +163 -163
  21. package/src/handlers/bodies-of-work.test.ts +704 -704
  22. package/src/handlers/bodies-of-work.ts +526 -526
  23. package/src/handlers/connectors.test.ts +834 -834
  24. package/src/handlers/connectors.ts +229 -229
  25. package/src/handlers/cost.test.ts +462 -462
  26. package/src/handlers/cost.ts +285 -285
  27. package/src/handlers/decisions.test.ts +382 -382
  28. package/src/handlers/decisions.ts +153 -153
  29. package/src/handlers/deployment.test.ts +551 -551
  30. package/src/handlers/deployment.ts +541 -541
  31. package/src/handlers/discovery.test.ts +206 -206
  32. package/src/handlers/discovery.ts +390 -390
  33. package/src/handlers/fallback.test.ts +537 -537
  34. package/src/handlers/fallback.ts +194 -194
  35. package/src/handlers/file-checkouts.test.ts +750 -750
  36. package/src/handlers/file-checkouts.ts +185 -185
  37. package/src/handlers/findings.test.ts +633 -633
  38. package/src/handlers/findings.ts +239 -239
  39. package/src/handlers/git-issues.test.ts +631 -631
  40. package/src/handlers/git-issues.ts +136 -136
  41. package/src/handlers/ideas.test.ts +644 -644
  42. package/src/handlers/ideas.ts +207 -207
  43. package/src/handlers/index.ts +84 -84
  44. package/src/handlers/milestones.test.ts +475 -475
  45. package/src/handlers/milestones.ts +180 -180
  46. package/src/handlers/organizations.test.ts +826 -826
  47. package/src/handlers/organizations.ts +315 -315
  48. package/src/handlers/progress.test.ts +269 -269
  49. package/src/handlers/progress.ts +77 -77
  50. package/src/handlers/project.test.ts +546 -546
  51. package/src/handlers/project.ts +239 -239
  52. package/src/handlers/requests.test.ts +303 -303
  53. package/src/handlers/requests.ts +99 -99
  54. package/src/handlers/roles.test.ts +303 -303
  55. package/src/handlers/roles.ts +226 -226
  56. package/src/handlers/session.test.ts +875 -875
  57. package/src/handlers/session.ts +738 -738
  58. package/src/handlers/sprints.test.ts +732 -732
  59. package/src/handlers/sprints.ts +537 -537
  60. package/src/handlers/tasks.test.ts +907 -907
  61. package/src/handlers/tasks.ts +945 -945
  62. package/src/handlers/tool-categories.test.ts +66 -66
  63. package/src/handlers/tool-docs.ts +1096 -1096
  64. package/src/handlers/types.test.ts +259 -259
  65. package/src/handlers/types.ts +175 -175
  66. package/src/handlers/validation.test.ts +582 -582
  67. package/src/handlers/validation.ts +97 -97
  68. package/src/index.ts +792 -792
  69. package/src/setup.test.ts +233 -231
  70. package/src/setup.ts +370 -370
  71. package/src/templates/agent-guidelines.ts +210 -210
  72. package/src/token-tracking.test.ts +463 -453
  73. package/src/token-tracking.ts +166 -164
  74. package/src/tools.ts +3562 -3562
  75. package/src/utils.test.ts +683 -683
  76. package/src/utils.ts +436 -436
  77. package/src/validators.test.ts +223 -223
  78. package/src/validators.ts +249 -249
  79. package/tsconfig.json +16 -16
  80. package/vitest.config.ts +14 -14
  81. package/dist/knowledge.d.ts +0 -6
  82. package/dist/knowledge.js +0 -218
package/src/cli.ts CHANGED
@@ -1,212 +1,212 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * Vibescope CLI - Setup wizard and enforcement verification tool
5
- *
6
- * Commands:
7
- * setup - Interactive wizard to configure Vibescope for your IDE
8
- * verify - Check agent compliance with Vibescope tracking (used by hooks)
9
- *
10
- * Exit codes (for verify command):
11
- * 0 = Compliant (allow exit)
12
- * 1 = Non-compliant (block exit, loop back)
13
- * 2 = Error (allow exit with warning)
14
- */
15
-
16
- import { execSync } from 'child_process';
17
- import { runSetup } from './setup.js';
18
-
19
- // ============================================================================
20
- // Types
21
- // ============================================================================
22
-
23
- export interface VerificationResult {
24
- status: 'compliant' | 'non_compliant' | 'no_session' | 'error';
25
- reason: string;
26
- continuation_prompt?: string;
27
- details?: {
28
- session_started: boolean;
29
- project_id: string | null;
30
- project_name: string | null;
31
- git_url: string | null;
32
- in_progress_tasks: number;
33
- tasks_completed_this_session: number;
34
- progress_logs_this_session: number;
35
- blockers_logged_this_session: number;
36
- session_duration_minutes: number | null;
37
- };
38
- }
39
-
40
- // ============================================================================
41
- // Configuration (read at runtime for testability)
42
- // ============================================================================
43
-
44
- function getApiKey(): string | undefined {
45
- return process.env.VIBESCOPE_API_KEY;
46
- }
47
-
48
- function getApiUrl(): string {
49
- return process.env.VIBESCOPE_API_URL || 'https://vibescope.dev';
50
- }
51
-
52
- // ============================================================================
53
- // Git URL Detection
54
- // ============================================================================
55
-
56
- export function normalizeGitUrl(url: string): string {
57
- // Remove .git suffix
58
- let normalized = url.replace(/\.git$/, '');
59
- // Convert SSH to HTTPS format
60
- if (normalized.startsWith('git@')) {
61
- normalized = normalized
62
- .replace(/^git@/, 'https://')
63
- .replace(/:([^/])/, '/$1');
64
- }
65
- return normalized;
66
- }
67
-
68
- export function detectGitUrl(): string | null {
69
- try {
70
- const url = execSync('git config --get remote.origin.url', {
71
- encoding: 'utf8',
72
- timeout: 5000,
73
- stdio: ['pipe', 'pipe', 'pipe'],
74
- }).trim();
75
-
76
- return normalizeGitUrl(url);
77
- } catch {
78
- return null;
79
- }
80
- }
81
-
82
- // ============================================================================
83
- // Verification Logic
84
- // ============================================================================
85
-
86
- export async function verify(
87
- gitUrl?: string,
88
- projectId?: string
89
- ): Promise<VerificationResult> {
90
- // Check environment (read at runtime for testability)
91
- const apiKey = getApiKey();
92
- if (!apiKey) {
93
- return {
94
- status: 'error',
95
- reason: 'VIBESCOPE_API_KEY environment variable not set',
96
- };
97
- }
98
-
99
- // Auto-detect git URL if not provided
100
- if (!gitUrl && !projectId) {
101
- gitUrl = detectGitUrl() || undefined;
102
- }
103
-
104
- try {
105
- const response = await fetch(`${getApiUrl()}/api/mcp/verify`, {
106
- method: 'POST',
107
- headers: {
108
- 'Content-Type': 'application/json',
109
- },
110
- body: JSON.stringify({
111
- api_key: apiKey,
112
- git_url: gitUrl,
113
- project_id: projectId,
114
- }),
115
- });
116
-
117
- const result = await response.json() as VerificationResult;
118
- return result;
119
- } catch (err) {
120
- return {
121
- status: 'error',
122
- reason: err instanceof Error ? err.message : 'Network error',
123
- };
124
- }
125
- }
126
-
127
- // ============================================================================
128
- // CLI Entry Point
129
- // ============================================================================
130
-
131
- async function main() {
132
- const args = process.argv.slice(2);
133
- const command = args[0];
134
-
135
- if (command === 'setup') {
136
- // Run interactive setup wizard
137
- await runSetup();
138
- process.exit(0);
139
- } else if (command === 'verify') {
140
- // Parse --git-url and --project-id flags
141
- let gitUrl: string | undefined;
142
- let projectId: string | undefined;
143
-
144
- for (let i = 1; i < args.length; i++) {
145
- if (args[i] === '--git-url' && args[i + 1]) {
146
- gitUrl = args[++i];
147
- } else if (args[i] === '--project-id' && args[i + 1]) {
148
- projectId = args[++i];
149
- }
150
- }
151
-
152
- const result = await verify(gitUrl, projectId);
153
- console.log(JSON.stringify(result, null, 2));
154
-
155
- // Exit codes: 0=compliant, 1=non-compliant, 2=error
156
- if (result.status === 'compliant') {
157
- process.exit(0);
158
- } else if (result.status === 'error') {
159
- process.exit(2);
160
- } else {
161
- process.exit(1);
162
- }
163
- } else if (command === 'help' || command === '--help' || command === '-h') {
164
- console.log(`
165
- Vibescope CLI - Setup wizard and enforcement verification tool
166
-
167
- Usage:
168
- vibescope-cli setup Interactive setup wizard for your IDE
169
- vibescope-cli verify [options] Check Vibescope compliance before exit
170
-
171
- Setup:
172
- Configures Vibescope MCP integration for:
173
- - Claude Code (CLI)
174
- - Claude Desktop
175
- - Cursor
176
- - Gemini CLI
177
-
178
- Verify Options:
179
- --git-url <url> Git repository URL (auto-detected if not provided)
180
- --project-id <id> Vibescope project UUID
181
-
182
- Exit Codes (verify):
183
- 0 Compliant - agent can exit
184
- 1 Non-compliant - agent should continue work
185
- 2 Error - allow exit with warning
186
-
187
- Environment Variables:
188
- VIBESCOPE_API_KEY Required for verify - Your Vibescope API key
189
- VIBESCOPE_API_URL Optional - API URL (default: https://vibescope.dev)
190
- `);
191
- process.exit(0);
192
- } else {
193
- console.error('Usage: vibescope-cli setup');
194
- console.error(' vibescope-cli verify [--git-url <url>] [--project-id <id>]');
195
- console.error(' vibescope-cli --help');
196
- process.exit(2);
197
- }
198
- }
199
-
200
- // Only run main when executed directly (not when imported for testing)
201
- const isMainModule = import.meta.url === `file://${process.argv[1]?.replace(/\\/g, '/')}`;
202
- if (isMainModule || process.argv[1]?.endsWith('cli.js')) {
203
- main().catch((err) => {
204
- console.error(
205
- JSON.stringify({
206
- status: 'error',
207
- reason: err instanceof Error ? err.message : 'Unknown error',
208
- })
209
- );
210
- process.exit(2);
211
- });
212
- }
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Vibescope CLI - Setup wizard and enforcement verification tool
5
+ *
6
+ * Commands:
7
+ * setup - Interactive wizard to configure Vibescope for your IDE
8
+ * verify - Check agent compliance with Vibescope tracking (used by hooks)
9
+ *
10
+ * Exit codes (for verify command):
11
+ * 0 = Compliant (allow exit)
12
+ * 1 = Non-compliant (block exit, loop back)
13
+ * 2 = Error (allow exit with warning)
14
+ */
15
+
16
+ import { execSync } from 'child_process';
17
+ import { runSetup } from './setup.js';
18
+
19
+ // ============================================================================
20
+ // Types
21
+ // ============================================================================
22
+
23
+ export interface VerificationResult {
24
+ status: 'compliant' | 'non_compliant' | 'no_session' | 'error';
25
+ reason: string;
26
+ continuation_prompt?: string;
27
+ details?: {
28
+ session_started: boolean;
29
+ project_id: string | null;
30
+ project_name: string | null;
31
+ git_url: string | null;
32
+ in_progress_tasks: number;
33
+ tasks_completed_this_session: number;
34
+ progress_logs_this_session: number;
35
+ blockers_logged_this_session: number;
36
+ session_duration_minutes: number | null;
37
+ };
38
+ }
39
+
40
+ // ============================================================================
41
+ // Configuration (read at runtime for testability)
42
+ // ============================================================================
43
+
44
+ function getApiKey(): string | undefined {
45
+ return process.env.VIBESCOPE_API_KEY;
46
+ }
47
+
48
+ function getApiUrl(): string {
49
+ return process.env.VIBESCOPE_API_URL || 'https://vibescope.dev';
50
+ }
51
+
52
+ // ============================================================================
53
+ // Git URL Detection
54
+ // ============================================================================
55
+
56
+ export function normalizeGitUrl(url: string): string {
57
+ // Remove .git suffix
58
+ let normalized = url.replace(/\.git$/, '');
59
+ // Convert SSH to HTTPS format
60
+ if (normalized.startsWith('git@')) {
61
+ normalized = normalized
62
+ .replace(/^git@/, 'https://')
63
+ .replace(/:([^/])/, '/$1');
64
+ }
65
+ return normalized;
66
+ }
67
+
68
+ export function detectGitUrl(): string | null {
69
+ try {
70
+ const url = execSync('git config --get remote.origin.url', {
71
+ encoding: 'utf8',
72
+ timeout: 5000,
73
+ stdio: ['pipe', 'pipe', 'pipe'],
74
+ }).trim();
75
+
76
+ return normalizeGitUrl(url);
77
+ } catch {
78
+ return null;
79
+ }
80
+ }
81
+
82
+ // ============================================================================
83
+ // Verification Logic
84
+ // ============================================================================
85
+
86
+ export async function verify(
87
+ gitUrl?: string,
88
+ projectId?: string
89
+ ): Promise<VerificationResult> {
90
+ // Check environment (read at runtime for testability)
91
+ const apiKey = getApiKey();
92
+ if (!apiKey) {
93
+ return {
94
+ status: 'error',
95
+ reason: 'VIBESCOPE_API_KEY environment variable not set',
96
+ };
97
+ }
98
+
99
+ // Auto-detect git URL if not provided
100
+ if (!gitUrl && !projectId) {
101
+ gitUrl = detectGitUrl() || undefined;
102
+ }
103
+
104
+ try {
105
+ const response = await fetch(`${getApiUrl()}/api/mcp/verify`, {
106
+ method: 'POST',
107
+ headers: {
108
+ 'Content-Type': 'application/json',
109
+ },
110
+ body: JSON.stringify({
111
+ api_key: apiKey,
112
+ git_url: gitUrl,
113
+ project_id: projectId,
114
+ }),
115
+ });
116
+
117
+ const result = await response.json() as VerificationResult;
118
+ return result;
119
+ } catch (err) {
120
+ return {
121
+ status: 'error',
122
+ reason: err instanceof Error ? err.message : 'Network error',
123
+ };
124
+ }
125
+ }
126
+
127
+ // ============================================================================
128
+ // CLI Entry Point
129
+ // ============================================================================
130
+
131
+ async function main() {
132
+ const args = process.argv.slice(2);
133
+ const command = args[0];
134
+
135
+ if (command === 'setup') {
136
+ // Run interactive setup wizard
137
+ await runSetup();
138
+ process.exit(0);
139
+ } else if (command === 'verify') {
140
+ // Parse --git-url and --project-id flags
141
+ let gitUrl: string | undefined;
142
+ let projectId: string | undefined;
143
+
144
+ for (let i = 1; i < args.length; i++) {
145
+ if (args[i] === '--git-url' && args[i + 1]) {
146
+ gitUrl = args[++i];
147
+ } else if (args[i] === '--project-id' && args[i + 1]) {
148
+ projectId = args[++i];
149
+ }
150
+ }
151
+
152
+ const result = await verify(gitUrl, projectId);
153
+ console.log(JSON.stringify(result, null, 2));
154
+
155
+ // Exit codes: 0=compliant, 1=non-compliant, 2=error
156
+ if (result.status === 'compliant') {
157
+ process.exit(0);
158
+ } else if (result.status === 'error') {
159
+ process.exit(2);
160
+ } else {
161
+ process.exit(1);
162
+ }
163
+ } else if (command === 'help' || command === '--help' || command === '-h') {
164
+ console.log(`
165
+ Vibescope CLI - Setup wizard and enforcement verification tool
166
+
167
+ Usage:
168
+ vibescope-cli setup Interactive setup wizard for your IDE
169
+ vibescope-cli verify [options] Check Vibescope compliance before exit
170
+
171
+ Setup:
172
+ Configures Vibescope MCP integration for:
173
+ - Claude Code (CLI)
174
+ - Claude Desktop
175
+ - Cursor
176
+ - Gemini CLI
177
+
178
+ Verify Options:
179
+ --git-url <url> Git repository URL (auto-detected if not provided)
180
+ --project-id <id> Vibescope project UUID
181
+
182
+ Exit Codes (verify):
183
+ 0 Compliant - agent can exit
184
+ 1 Non-compliant - agent should continue work
185
+ 2 Error - allow exit with warning
186
+
187
+ Environment Variables:
188
+ VIBESCOPE_API_KEY Required for verify - Your Vibescope API key
189
+ VIBESCOPE_API_URL Optional - API URL (default: https://vibescope.dev)
190
+ `);
191
+ process.exit(0);
192
+ } else {
193
+ console.error('Usage: vibescope-cli setup');
194
+ console.error(' vibescope-cli verify [--git-url <url>] [--project-id <id>]');
195
+ console.error(' vibescope-cli --help');
196
+ process.exit(2);
197
+ }
198
+ }
199
+
200
+ // Only run main when executed directly (not when imported for testing)
201
+ const isMainModule = import.meta.url === `file://${process.argv[1]?.replace(/\\/g, '/')}`;
202
+ if (isMainModule || process.argv[1]?.endsWith('cli.js')) {
203
+ main().catch((err) => {
204
+ console.error(
205
+ JSON.stringify({
206
+ status: 'error',
207
+ reason: err instanceof Error ? err.message : 'Unknown error',
208
+ })
209
+ );
210
+ process.exit(2);
211
+ });
212
+ }