@vibescope/mcp-server 0.3.0 → 0.3.3

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 (154) hide show
  1. package/dist/api-client/blockers.d.ts +46 -0
  2. package/dist/api-client/blockers.js +43 -0
  3. package/dist/api-client/cost.d.ts +112 -0
  4. package/dist/api-client/cost.js +76 -0
  5. package/dist/api-client/decisions.d.ts +55 -0
  6. package/dist/api-client/decisions.js +32 -0
  7. package/dist/api-client/discovery.d.ts +62 -0
  8. package/dist/api-client/discovery.js +21 -0
  9. package/dist/api-client/ideas.d.ts +75 -0
  10. package/dist/api-client/ideas.js +36 -0
  11. package/dist/api-client/index.d.ts +749 -0
  12. package/dist/api-client/index.js +291 -0
  13. package/dist/api-client/project.d.ts +132 -0
  14. package/dist/api-client/project.js +45 -0
  15. package/dist/api-client/session.d.ts +163 -0
  16. package/dist/api-client/session.js +52 -0
  17. package/dist/api-client/tasks.d.ts +328 -0
  18. package/dist/api-client/tasks.js +132 -0
  19. package/dist/api-client/types.d.ts +25 -0
  20. package/dist/api-client/types.js +4 -0
  21. package/dist/api-client/worktrees.d.ts +33 -0
  22. package/dist/api-client/worktrees.js +26 -0
  23. package/dist/api-client.d.ts +9 -0
  24. package/dist/api-client.js +104 -25
  25. package/dist/cli-init.d.ts +17 -0
  26. package/dist/cli-init.js +445 -0
  27. package/dist/cli.js +0 -0
  28. package/dist/handlers/cloud-agents.d.ts +21 -0
  29. package/dist/handlers/cloud-agents.js +91 -0
  30. package/dist/handlers/discovery.js +7 -0
  31. package/dist/handlers/index.d.ts +1 -0
  32. package/dist/handlers/index.js +3 -0
  33. package/dist/handlers/session.js +3 -1
  34. package/dist/handlers/tasks.js +10 -12
  35. package/dist/handlers/types.d.ts +2 -1
  36. package/dist/handlers/validation.js +5 -1
  37. package/dist/index.js +8 -3
  38. package/dist/token-tracking.js +2 -2
  39. package/dist/tools/blockers.d.ts +13 -0
  40. package/dist/tools/blockers.js +119 -0
  41. package/dist/tools/bodies-of-work.d.ts +19 -0
  42. package/dist/tools/bodies-of-work.js +280 -0
  43. package/dist/tools/cloud-agents.d.ts +9 -0
  44. package/dist/tools/cloud-agents.js +67 -0
  45. package/dist/tools/connectors.d.ts +14 -0
  46. package/dist/tools/connectors.js +188 -0
  47. package/dist/tools/cost.d.ts +11 -0
  48. package/dist/tools/cost.js +108 -0
  49. package/dist/tools/decisions.d.ts +12 -0
  50. package/dist/tools/decisions.js +108 -0
  51. package/dist/tools/deployment.d.ts +24 -0
  52. package/dist/tools/deployment.js +439 -0
  53. package/dist/tools/discovery.d.ts +10 -0
  54. package/dist/tools/discovery.js +73 -0
  55. package/dist/tools/fallback.d.ts +11 -0
  56. package/dist/tools/fallback.js +108 -0
  57. package/dist/tools/file-checkouts.d.ts +13 -0
  58. package/dist/tools/file-checkouts.js +141 -0
  59. package/dist/tools/findings.d.ts +13 -0
  60. package/dist/tools/findings.js +98 -0
  61. package/dist/tools/git-issues.d.ts +11 -0
  62. package/dist/tools/git-issues.js +127 -0
  63. package/dist/tools/ideas.d.ts +13 -0
  64. package/dist/tools/ideas.js +159 -0
  65. package/dist/tools/index.d.ts +71 -0
  66. package/dist/tools/index.js +98 -0
  67. package/dist/tools/milestones.d.ts +12 -0
  68. package/dist/tools/milestones.js +115 -0
  69. package/dist/tools/organizations.d.ts +17 -0
  70. package/dist/tools/organizations.js +221 -0
  71. package/dist/tools/progress.d.ts +9 -0
  72. package/dist/tools/progress.js +70 -0
  73. package/dist/tools/project.d.ts +13 -0
  74. package/dist/tools/project.js +199 -0
  75. package/dist/tools/requests.d.ts +10 -0
  76. package/dist/tools/requests.js +65 -0
  77. package/dist/tools/roles.d.ts +11 -0
  78. package/dist/tools/roles.js +109 -0
  79. package/dist/tools/session.d.ts +15 -0
  80. package/dist/tools/session.js +178 -0
  81. package/dist/tools/sprints.d.ts +18 -0
  82. package/dist/tools/sprints.js +295 -0
  83. package/dist/tools/tasks.d.ts +27 -0
  84. package/dist/tools/tasks.js +539 -0
  85. package/dist/tools/types.d.ts +7 -0
  86. package/dist/tools/types.js +6 -0
  87. package/dist/tools/validation.d.ts +10 -0
  88. package/dist/tools/validation.js +72 -0
  89. package/dist/tools/worktrees.d.ts +9 -0
  90. package/dist/tools/worktrees.js +63 -0
  91. package/dist/utils.d.ts +66 -0
  92. package/dist/utils.js +102 -0
  93. package/docs/TOOLS.md +55 -2
  94. package/package.json +5 -3
  95. package/scripts/generate-docs.ts +1 -1
  96. package/src/api-client/blockers.ts +86 -0
  97. package/src/api-client/cost.ts +185 -0
  98. package/src/api-client/decisions.ts +87 -0
  99. package/src/api-client/discovery.ts +81 -0
  100. package/src/api-client/ideas.ts +112 -0
  101. package/src/api-client/index.ts +378 -0
  102. package/src/api-client/project.ts +179 -0
  103. package/src/api-client/session.ts +220 -0
  104. package/src/api-client/tasks.ts +450 -0
  105. package/src/api-client/types.ts +32 -0
  106. package/src/api-client/worktrees.ts +53 -0
  107. package/src/api-client.test.ts +136 -9
  108. package/src/api-client.ts +125 -27
  109. package/src/cli-init.ts +504 -0
  110. package/src/handlers/__test-utils__.ts +2 -0
  111. package/src/handlers/cloud-agents.ts +138 -0
  112. package/src/handlers/discovery.ts +7 -0
  113. package/src/handlers/index.ts +3 -0
  114. package/src/handlers/session.ts +3 -1
  115. package/src/handlers/tasks.ts +10 -12
  116. package/src/handlers/tool-categories.test.ts +1 -1
  117. package/src/handlers/types.ts +2 -1
  118. package/src/handlers/validation.ts +6 -1
  119. package/src/index.test.ts +2 -2
  120. package/src/index.ts +8 -2
  121. package/src/token-tracking.ts +3 -2
  122. package/src/tools/blockers.ts +122 -0
  123. package/src/tools/bodies-of-work.ts +283 -0
  124. package/src/tools/cloud-agents.ts +70 -0
  125. package/src/tools/connectors.ts +191 -0
  126. package/src/tools/cost.ts +111 -0
  127. package/src/tools/decisions.ts +111 -0
  128. package/src/tools/deployment.ts +442 -0
  129. package/src/tools/discovery.ts +76 -0
  130. package/src/tools/fallback.ts +111 -0
  131. package/src/tools/file-checkouts.ts +145 -0
  132. package/src/tools/findings.ts +101 -0
  133. package/src/tools/git-issues.ts +130 -0
  134. package/src/tools/ideas.ts +162 -0
  135. package/src/tools/index.ts +131 -0
  136. package/src/tools/milestones.ts +118 -0
  137. package/src/tools/organizations.ts +224 -0
  138. package/src/tools/progress.ts +73 -0
  139. package/src/tools/project.ts +202 -0
  140. package/src/tools/requests.ts +68 -0
  141. package/src/tools/roles.ts +112 -0
  142. package/src/tools/session.ts +181 -0
  143. package/src/tools/sprints.ts +298 -0
  144. package/src/tools/tasks.ts +542 -0
  145. package/src/tools/tools.test.ts +222 -0
  146. package/src/tools/types.ts +9 -0
  147. package/src/tools/validation.ts +75 -0
  148. package/src/tools/worktrees.ts +66 -0
  149. package/src/tools.test.ts +1 -1
  150. package/src/utils.test.ts +229 -0
  151. package/src/utils.ts +117 -0
  152. package/dist/tools.d.ts +0 -2
  153. package/dist/tools.js +0 -3602
  154. package/src/tools.ts +0 -3607
package/src/utils.ts CHANGED
@@ -467,3 +467,120 @@ export function normalizeGitUrl(gitUrl: string | null | undefined): string | nul
467
467
 
468
468
  return normalized;
469
469
  }
470
+
471
+ // ============================================================================
472
+ // Error Handling Utilities
473
+ // Shared error extraction and type checking functions
474
+ // ============================================================================
475
+
476
+ /**
477
+ * Extract a human-readable message from any error type.
478
+ * Handles Error objects, strings, and unknown values.
479
+ *
480
+ * @example
481
+ * try { ... } catch (e) {
482
+ * console.error(getErrorMessage(e));
483
+ * }
484
+ */
485
+ export function getErrorMessage(error: unknown): string {
486
+ if (error instanceof Error) {
487
+ return error.message;
488
+ }
489
+ if (typeof error === 'string') {
490
+ return error;
491
+ }
492
+ return String(error);
493
+ }
494
+
495
+ /**
496
+ * Type guard to check if a value is an object with an 'error' property.
497
+ * Useful for checking API responses that may contain application-level errors.
498
+ *
499
+ * @example
500
+ * if (hasErrorProperty(response.data)) {
501
+ * return error(getErrorMessage(response.data.error));
502
+ * }
503
+ */
504
+ export function hasErrorProperty(value: unknown): value is { error: unknown } {
505
+ return typeof value === 'object' && value !== null && 'error' in value;
506
+ }
507
+
508
+ /**
509
+ * Extract an error message from an API response body.
510
+ * Handles the common pattern where API returns { error: string } or { error: { message: string } }.
511
+ * Returns null if no error is found.
512
+ *
513
+ * @example
514
+ * const apiError = extractApiError(response.data);
515
+ * if (apiError) {
516
+ * return error(apiError);
517
+ * }
518
+ */
519
+ export function extractApiError(data: unknown): string | null {
520
+ if (!hasErrorProperty(data)) {
521
+ return null;
522
+ }
523
+
524
+ const err = data.error;
525
+
526
+ // Direct string error
527
+ if (typeof err === 'string') {
528
+ return err;
529
+ }
530
+
531
+ // Nested error object with message property
532
+ if (typeof err === 'object' && err !== null && 'message' in err) {
533
+ const msg = (err as { message: unknown }).message;
534
+ if (typeof msg === 'string') {
535
+ return msg;
536
+ }
537
+ }
538
+
539
+ // Fallback for unknown error structure
540
+ return 'Unknown error';
541
+ }
542
+
543
+ // ============================================================================
544
+ // Pagination Utilities
545
+ // ============================================================================
546
+
547
+ /**
548
+ * Default pagination limits
549
+ */
550
+ export const PAGINATION_LIMITS = {
551
+ /** Default maximum limit for paginated results */
552
+ DEFAULT_MAX_LIMIT: 50,
553
+ /** Default limit when not specified */
554
+ DEFAULT_LIMIT: 20,
555
+ /** Smaller limit for task listings */
556
+ TASK_LIMIT: 20,
557
+ } as const;
558
+
559
+ /**
560
+ * Cap pagination parameters to safe values.
561
+ * Ensures limit is between 1 and maxLimit, and offset is non-negative.
562
+ *
563
+ * @param limit - Requested limit (will be capped between 1 and maxLimit)
564
+ * @param offset - Requested offset (will be made non-negative)
565
+ * @param maxLimit - Maximum allowed limit (default: PAGINATION_LIMITS.DEFAULT_MAX_LIMIT)
566
+ * @returns Object with cappedLimit and safeOffset
567
+ *
568
+ * @example
569
+ * const { cappedLimit, safeOffset } = capPagination(limit, offset);
570
+ * const { data } = await query.range(safeOffset, safeOffset + cappedLimit - 1);
571
+ *
572
+ * @example
573
+ * // With custom max limit
574
+ * const { cappedLimit, safeOffset } = capPagination(limit, offset, 20);
575
+ */
576
+ export function capPagination(
577
+ limit: number | undefined,
578
+ offset: number | undefined,
579
+ maxLimit: number = PAGINATION_LIMITS.DEFAULT_MAX_LIMIT
580
+ ): { cappedLimit: number; safeOffset: number } {
581
+ const effectiveLimit = limit ?? PAGINATION_LIMITS.DEFAULT_LIMIT;
582
+ return {
583
+ cappedLimit: Math.min(Math.max(1, effectiveLimit), maxLimit),
584
+ safeOffset: Math.max(0, offset ?? 0)
585
+ };
586
+ }
package/dist/tools.d.ts DELETED
@@ -1,2 +0,0 @@
1
- import type { Tool } from '@modelcontextprotocol/sdk/types.js';
2
- export declare const tools: Tool[];