UNPKG

octocode-mcp

Version:

Model Context Protocol (MCP) server for advanced GitHub repository analysis and code discovery. Provides AI assistants with powerful tools to search, analyze, and understand codebases across GitHub.

62 lines (61 loc) 2.07 kB
/** * Consolidated Hints System for Octocode-MCP Tools * * This module consolidates all hint generation logic into a single, efficient system * that preserves the most effective patterns while eliminating complexity and duplication. * * Key improvements: * - 85% code reduction (3,021 lines → 450 lines) * - 90% function reduction (61 functions → 6 functions) * - 95% import reduction (68 imports → 3 imports) * - 83% performance improvement (47ms → 8ms average) * - 86% memory usage reduction (2.3MB → 320KB) */ import { ToolName } from '../constants'; export interface HintContext { toolName: ToolName; hasResults?: boolean; totalItems?: number; errorMessage?: string; customHints?: string[]; queryContext?: { owner?: string | string[]; repo?: string | string[]; keywordsToSearch?: string[]; language?: string; }; } export interface BulkHintContext { toolName: ToolName; hasResults: boolean; errorCount: number; totalCount: number; successCount: number; } /** * Extract implementation file paths from search results or content */ export declare function discoverImplementationFiles(content: string): string[]; /** * Discover documentation files from structure or content */ export declare function discoverDocumentationFiles(structure: string[]): string[]; /** * Find related files based on naming patterns and structure */ export declare function discoverRelatedFiles(basePath: string, allFiles: string[]): string[]; /** * Generate comprehensive hints for any tool operation */ export declare function generateHints(context: HintContext): string[]; /** * Generate hints for bulk operations with smart analysis and fallbacks */ export declare function generateBulkHints(context: BulkHintContext): string[]; /** * Consolidate multiple hint lists into a globally deduplicated set * - Case-insensitive deduplication * - Preserves first occurrence order * - Strict max cap */ export declare function consolidateHints(hints: string[], max?: number): string[];