@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.
- package/dist/api-client/blockers.d.ts +46 -0
- package/dist/api-client/blockers.js +43 -0
- package/dist/api-client/cost.d.ts +112 -0
- package/dist/api-client/cost.js +76 -0
- package/dist/api-client/decisions.d.ts +55 -0
- package/dist/api-client/decisions.js +32 -0
- package/dist/api-client/discovery.d.ts +62 -0
- package/dist/api-client/discovery.js +21 -0
- package/dist/api-client/ideas.d.ts +75 -0
- package/dist/api-client/ideas.js +36 -0
- package/dist/api-client/index.d.ts +749 -0
- package/dist/api-client/index.js +291 -0
- package/dist/api-client/project.d.ts +132 -0
- package/dist/api-client/project.js +45 -0
- package/dist/api-client/session.d.ts +163 -0
- package/dist/api-client/session.js +52 -0
- package/dist/api-client/tasks.d.ts +328 -0
- package/dist/api-client/tasks.js +132 -0
- package/dist/api-client/types.d.ts +25 -0
- package/dist/api-client/types.js +4 -0
- package/dist/api-client/worktrees.d.ts +33 -0
- package/dist/api-client/worktrees.js +26 -0
- package/dist/api-client.d.ts +9 -0
- package/dist/api-client.js +104 -25
- package/dist/cli-init.d.ts +17 -0
- package/dist/cli-init.js +445 -0
- package/dist/cli.js +0 -0
- package/dist/handlers/cloud-agents.d.ts +21 -0
- package/dist/handlers/cloud-agents.js +91 -0
- package/dist/handlers/discovery.js +7 -0
- package/dist/handlers/index.d.ts +1 -0
- package/dist/handlers/index.js +3 -0
- package/dist/handlers/session.js +3 -1
- package/dist/handlers/tasks.js +10 -12
- package/dist/handlers/types.d.ts +2 -1
- package/dist/handlers/validation.js +5 -1
- package/dist/index.js +8 -3
- package/dist/token-tracking.js +2 -2
- package/dist/tools/blockers.d.ts +13 -0
- package/dist/tools/blockers.js +119 -0
- package/dist/tools/bodies-of-work.d.ts +19 -0
- package/dist/tools/bodies-of-work.js +280 -0
- package/dist/tools/cloud-agents.d.ts +9 -0
- package/dist/tools/cloud-agents.js +67 -0
- package/dist/tools/connectors.d.ts +14 -0
- package/dist/tools/connectors.js +188 -0
- package/dist/tools/cost.d.ts +11 -0
- package/dist/tools/cost.js +108 -0
- package/dist/tools/decisions.d.ts +12 -0
- package/dist/tools/decisions.js +108 -0
- package/dist/tools/deployment.d.ts +24 -0
- package/dist/tools/deployment.js +439 -0
- package/dist/tools/discovery.d.ts +10 -0
- package/dist/tools/discovery.js +73 -0
- package/dist/tools/fallback.d.ts +11 -0
- package/dist/tools/fallback.js +108 -0
- package/dist/tools/file-checkouts.d.ts +13 -0
- package/dist/tools/file-checkouts.js +141 -0
- package/dist/tools/findings.d.ts +13 -0
- package/dist/tools/findings.js +98 -0
- package/dist/tools/git-issues.d.ts +11 -0
- package/dist/tools/git-issues.js +127 -0
- package/dist/tools/ideas.d.ts +13 -0
- package/dist/tools/ideas.js +159 -0
- package/dist/tools/index.d.ts +71 -0
- package/dist/tools/index.js +98 -0
- package/dist/tools/milestones.d.ts +12 -0
- package/dist/tools/milestones.js +115 -0
- package/dist/tools/organizations.d.ts +17 -0
- package/dist/tools/organizations.js +221 -0
- package/dist/tools/progress.d.ts +9 -0
- package/dist/tools/progress.js +70 -0
- package/dist/tools/project.d.ts +13 -0
- package/dist/tools/project.js +199 -0
- package/dist/tools/requests.d.ts +10 -0
- package/dist/tools/requests.js +65 -0
- package/dist/tools/roles.d.ts +11 -0
- package/dist/tools/roles.js +109 -0
- package/dist/tools/session.d.ts +15 -0
- package/dist/tools/session.js +178 -0
- package/dist/tools/sprints.d.ts +18 -0
- package/dist/tools/sprints.js +295 -0
- package/dist/tools/tasks.d.ts +27 -0
- package/dist/tools/tasks.js +539 -0
- package/dist/tools/types.d.ts +7 -0
- package/dist/tools/types.js +6 -0
- package/dist/tools/validation.d.ts +10 -0
- package/dist/tools/validation.js +72 -0
- package/dist/tools/worktrees.d.ts +9 -0
- package/dist/tools/worktrees.js +63 -0
- package/dist/utils.d.ts +66 -0
- package/dist/utils.js +102 -0
- package/docs/TOOLS.md +55 -2
- package/package.json +5 -3
- package/scripts/generate-docs.ts +1 -1
- package/src/api-client/blockers.ts +86 -0
- package/src/api-client/cost.ts +185 -0
- package/src/api-client/decisions.ts +87 -0
- package/src/api-client/discovery.ts +81 -0
- package/src/api-client/ideas.ts +112 -0
- package/src/api-client/index.ts +378 -0
- package/src/api-client/project.ts +179 -0
- package/src/api-client/session.ts +220 -0
- package/src/api-client/tasks.ts +450 -0
- package/src/api-client/types.ts +32 -0
- package/src/api-client/worktrees.ts +53 -0
- package/src/api-client.test.ts +136 -9
- package/src/api-client.ts +125 -27
- package/src/cli-init.ts +504 -0
- package/src/handlers/__test-utils__.ts +2 -0
- package/src/handlers/cloud-agents.ts +138 -0
- package/src/handlers/discovery.ts +7 -0
- package/src/handlers/index.ts +3 -0
- package/src/handlers/session.ts +3 -1
- package/src/handlers/tasks.ts +10 -12
- package/src/handlers/tool-categories.test.ts +1 -1
- package/src/handlers/types.ts +2 -1
- package/src/handlers/validation.ts +6 -1
- package/src/index.test.ts +2 -2
- package/src/index.ts +8 -2
- package/src/token-tracking.ts +3 -2
- package/src/tools/blockers.ts +122 -0
- package/src/tools/bodies-of-work.ts +283 -0
- package/src/tools/cloud-agents.ts +70 -0
- package/src/tools/connectors.ts +191 -0
- package/src/tools/cost.ts +111 -0
- package/src/tools/decisions.ts +111 -0
- package/src/tools/deployment.ts +442 -0
- package/src/tools/discovery.ts +76 -0
- package/src/tools/fallback.ts +111 -0
- package/src/tools/file-checkouts.ts +145 -0
- package/src/tools/findings.ts +101 -0
- package/src/tools/git-issues.ts +130 -0
- package/src/tools/ideas.ts +162 -0
- package/src/tools/index.ts +131 -0
- package/src/tools/milestones.ts +118 -0
- package/src/tools/organizations.ts +224 -0
- package/src/tools/progress.ts +73 -0
- package/src/tools/project.ts +202 -0
- package/src/tools/requests.ts +68 -0
- package/src/tools/roles.ts +112 -0
- package/src/tools/session.ts +181 -0
- package/src/tools/sprints.ts +298 -0
- package/src/tools/tasks.ts +542 -0
- package/src/tools/tools.test.ts +222 -0
- package/src/tools/types.ts +9 -0
- package/src/tools/validation.ts +75 -0
- package/src/tools/worktrees.ts +66 -0
- package/src/tools.test.ts +1 -1
- package/src/utils.test.ts +229 -0
- package/src/utils.ts +117 -0
- package/dist/tools.d.ts +0 -2
- package/dist/tools.js +0 -3602
- 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