UNPKG

mcp-context-engineering

Version:

The intelligent context optimization system for AI coding assistants. Built with Cole's PRP methodology, Context Portal knowledge graphs, and production-ready MongoDB architecture.

175 lines (174 loc) 5.79 kB
import { z } from 'zod'; export declare const ResearchRequestSchema: z.ZodObject<{ feature_description: z.ZodString; project_context: z.ZodObject<{ type: z.ZodString; tech_stack: z.ZodArray<z.ZodString, "many">; existing_patterns: z.ZodOptional<z.ZodArray<z.ZodString, "many">>; codebase_info: z.ZodOptional<z.ZodObject<{ languages: z.ZodArray<z.ZodString, "many">; frameworks: z.ZodArray<z.ZodString, "many">; architecture_patterns: z.ZodArray<z.ZodString, "many">; }, "strip", z.ZodTypeAny, { languages?: string[]; frameworks?: string[]; architecture_patterns?: string[]; }, { languages?: string[]; frameworks?: string[]; architecture_patterns?: string[]; }>>; }, "strip", z.ZodTypeAny, { type?: string; existing_patterns?: string[]; tech_stack?: string[]; codebase_info?: { languages?: string[]; frameworks?: string[]; architecture_patterns?: string[]; }; }, { type?: string; existing_patterns?: string[]; tech_stack?: string[]; codebase_info?: { languages?: string[]; frameworks?: string[]; architecture_patterns?: string[]; }; }>; research_depth: z.ZodDefault<z.ZodEnum<["basic", "comprehensive", "exhaustive"]>>; }, "strip", z.ZodTypeAny, { feature_description?: string; project_context?: { type?: string; existing_patterns?: string[]; tech_stack?: string[]; codebase_info?: { languages?: string[]; frameworks?: string[]; architecture_patterns?: string[]; }; }; research_depth?: "basic" | "comprehensive" | "exhaustive"; }, { feature_description?: string; project_context?: { type?: string; existing_patterns?: string[]; tech_stack?: string[]; codebase_info?: { languages?: string[]; frameworks?: string[]; architecture_patterns?: string[]; }; }; research_depth?: "basic" | "comprehensive" | "exhaustive"; }>; export declare const ResearchResultSchema: z.ZodObject<{ codebase_analysis: z.ZodArray<z.ZodString, "many">; external_research: z.ZodArray<z.ZodString, "many">; documentation_urls: z.ZodArray<z.ZodString, "many">; existing_patterns: z.ZodArray<z.ZodString, "many">; potential_challenges: z.ZodArray<z.ZodString, "many">; best_practices: z.ZodArray<z.ZodString, "many">; implementation_examples: z.ZodArray<z.ZodObject<{ source: z.ZodString; description: z.ZodString; code_snippet: z.ZodOptional<z.ZodString>; relevance_score: z.ZodNumber; }, "strip", z.ZodTypeAny, { description?: string; relevance_score?: number; source?: string; code_snippet?: string; }, { description?: string; relevance_score?: number; source?: string; code_snippet?: string; }>, "many">; confidence_score: z.ZodNumber; }, "strip", z.ZodTypeAny, { codebase_analysis?: string[]; external_research?: string[]; documentation_urls?: string[]; existing_patterns?: string[]; potential_challenges?: string[]; confidence_score?: number; best_practices?: string[]; implementation_examples?: { description?: string; relevance_score?: number; source?: string; code_snippet?: string; }[]; }, { codebase_analysis?: string[]; external_research?: string[]; documentation_urls?: string[]; existing_patterns?: string[]; potential_challenges?: string[]; confidence_score?: number; best_practices?: string[]; implementation_examples?: { description?: string; relevance_score?: number; source?: string; code_snippet?: string; }[]; }>; export type ResearchRequest = z.infer<typeof ResearchRequestSchema>; export type ResearchResult = z.infer<typeof ResearchResultSchema>; /** * Research Engine implementing Cole's systematic research methodology * * From Cole's verified approach: * 1. Analyze existing codebase for patterns * 2. Conduct external research * 3. Gather documentation and examples * 4. Identify potential challenges * 5. Extract implementation patterns */ export declare class ResearchEngine { /** * Conduct systematic research following Cole's methodology */ conductResearch(request: ResearchRequest): Promise<ResearchResult>; /** * Step 1: Analyze existing codebase for patterns * Cole's emphasis on understanding existing implementations */ private analyzeCodebasePatterns; /** * Step 2: Conduct external research * Cole's emphasis on comprehensive external knowledge */ private conductExternalResearch; /** * Step 3: Gather documentation and examples * Cole's focus on concrete, actionable references */ private gatherDocumentationAndExamples; /** * Step 4: Identify potential challenges * Cole's proactive error prevention approach */ private identifyPotentialChallenges; /** * Step 5: Extract best practices */ private extractBestPractices; /** * Calculate research confidence score (Cole's quality measurement) */ private calculateConfidenceScore; private getFrameworkPatterns; private analyzePatternCompatibility; private analyzeArchitecturalFit; private getTechnologyChallenges; private getProjectTypeChallenges; private getIntegrationChallenges; private getCommonPitfalls; private getTechnologyBestPractices; }