Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | 12x 24x 18x 18x 16x 15x 16x 16x 16x 2x 12x 16x 12x 12x 12x 15x 13x 12x 7x 6x 3x 3x 12x 6x 3x 12x 31x 27x 24x 24x 12x 7x 5x 5x 12x 4x 4x 4x 12x 5x 5x 5x 12x 4x 4x 4x 12x 7x | import { MCPResult, ProviderAPIResponse } from '../types/index.js'; export function isMCPResult(value: unknown): value is MCPResult { if (!value || typeof value !== 'object') return false; const obj = value as Record<string, unknown>; if ('content' in obj) { if (!Array.isArray(obj.content)) return false; return obj.content.every((item: unknown) => { Iif (!item || typeof item !== 'object') return false; const contentItem = item as Record<string, unknown>; return 'type' in contentItem && typeof contentItem.type === 'string'; }); } return true; } export function isProviderAPIResponse(value: unknown): value is ProviderAPIResponse { if (!value || typeof value !== 'object') return false; const obj = value as Record<string, unknown>; return ( ('id' in obj || 'number' in obj || 'iid' in obj) && ('title' in obj || 'name' in obj || 'summary' in obj) ); } export function hasTextContent(value: unknown): value is { content: Array<{ text: string }> } { if (!isMCPResult(value) || !value.content) return false; return ( value.content.length > 0 && value.content[0] && 'text' in value.content[0] && typeof value.content[0].text === 'string' ); } export function isStringOrHasProperty<T extends string>( value: unknown, property: T, ): value is string | Record<T, string> { if (typeof value === 'string') return true; if (!value || typeof value !== 'object') return false; const obj = value as Record<string, unknown>; return property in obj && typeof obj[property] === 'string'; } export function isArrayOfItems<T>( value: unknown, itemGuard: (item: unknown) => item is T, ): value is T[] { if (!Array.isArray(value)) return false; return value.every(itemGuard); } export function isLabelLike( value: unknown, ): value is string | { name: string } | { title: string } { if (typeof value === 'string') return true; if (!value || typeof value !== 'object') return false; const obj = value as Record<string, unknown>; return ( ('name' in obj && typeof obj.name === 'string') || ('title' in obj && typeof obj.title === 'string') ); } // Type guards for adapter APIs export function isGitLabIssue(value: unknown): value is { id: number; iid: number; title: string; description?: string; state: string; assignees?: unknown[]; labels?: unknown[]; } { if (!value || typeof value !== 'object') return false; const obj = value as Record<string, unknown>; return ( 'id' in obj && typeof obj.id === 'number' && 'iid' in obj && typeof obj.iid === 'number' && 'title' in obj && typeof obj.title === 'string' ); } export function isGitLabEpic(value: unknown): value is { id: number; title: string; description?: string; state: string; } { Iif (!value || typeof value !== 'object') return false; const obj = value as Record<string, unknown>; return ( 'id' in obj && typeof obj.id === 'number' && 'title' in obj && typeof obj.title === 'string' ); } export function isGitHubIssue(value: unknown): value is { id: number; number: number; title: string; body?: string; state: string; assignees?: unknown[]; labels?: unknown[]; } { Iif (!value || typeof value !== 'object') return false; const obj = value as Record<string, unknown>; return ( 'id' in obj && typeof obj.id === 'number' && 'number' in obj && typeof obj.number === 'number' && 'title' in obj && typeof obj.title === 'string' ); } export function isAzureWorkItem(value: unknown): value is { id: number; fields: Record<string, unknown>; } { Iif (!value || typeof value !== 'object') return false; const obj = value as Record<string, unknown>; return ( 'id' in obj && typeof obj.id === 'number' && 'fields' in obj && typeof obj.fields === 'object' ); } export function isAPIResponse(value: unknown): value is Record<string, unknown> { return value !== null && typeof value === 'object'; } |