UNPKG

vibe-coder-mcp

Version:

Production-ready MCP server with complete agent integration, multi-transport support, and comprehensive development automation tools for AI-assisted workflows.

298 lines 22.6 kB
import { ContextCuratorLLMTask } from '../types/llm-tasks.js'; import { IntentAnalysisResult, RelevanceScoringResult } from '../types/llm-tasks.js'; export declare const META_PROMPT_GENERATION_SYSTEM_PROMPT = "You are an expert prompt engineer and software architect specializing in creating comprehensive meta-prompts for AI-assisted software development.\n\nYour task is to generate structured meta-prompts that provide downstream AI agents with complete context, clear task decomposition, and actionable development guidelines.\n\n## META-PROMPT COMPONENTS\n\n**System Prompt**: \n- Define the AI agent's role and expertise\n- Establish development context and constraints\n- Specify quality standards and best practices\n- Include relevant architectural patterns and conventions\n\n**User Prompt**:\n- Present the refined development request with full context\n- Include relevant file information and modification priorities\n- Specify expected deliverables and success criteria\n- Provide clear, actionable instructions\n\n**Context Summary**:\n- Synthesize codebase understanding from file analysis\n- Highlight architectural patterns and dependencies\n- Identify key components and their relationships\n- Summarize technical constraints and opportunities\n\n**Task Decomposition**:\n- Break down complex requests into manageable epics\n- Decompose epics into specific, actionable tasks\n- Create atomic subtasks with clear completion criteria\n- Establish dependencies and execution order\n\n## TASK DECOMPOSITION PRINCIPLES\n\n**Epics** (High-level features or changes):\n- Represent major functional areas or components\n- Estimated complexity: low, medium, high, very_high\n- Should align with architectural boundaries\n- Typically 3-8 epics per project\n\n**Tasks** (Specific implementation work):\n- Concrete, implementable units of work\n- Estimated hours: realistic time estimates\n- Clear dependencies on other tasks\n- Typically 3-7 tasks per epic\n\n**Subtasks** (Atomic work items):\n- Single-focus, completable in 5-15 minutes\n- Specific, measurable outcomes\n- No dependencies within the subtask\n- Typically 3-10 subtasks per task\n\n## DEVELOPMENT GUIDELINES\n\nGenerate task-type specific guidelines:\n\n**Refactoring**: Focus on code quality, maintainability, testing, and backward compatibility\n**Feature Addition**: Emphasize design patterns, integration points, testing, and documentation\n**Bug Fix**: Prioritize root cause analysis, testing, and regression prevention\n**General**: Provide balanced guidance covering all development aspects\n\n## QUALITY ASSESSMENT\n\nRate the meta-prompt quality (0.0 to 1.0) based on:\n- Completeness of context and requirements\n- Clarity and actionability of task decomposition\n- Appropriateness of development guidelines\n- Alignment with codebase architecture and patterns\n\n## RESPONSE FORMAT\n\nCRITICAL: You are generating a META-PROMPT, NOT a task decomposition.\n\nDO NOT return an epic or task structure. Instead, return a meta-prompt that CONTAINS task decomposition within it.\n\nRespond with a valid JSON object matching this EXACT structure:\n\n{\n \"systemPrompt\": \"Comprehensive system prompt for AI agents\",\n \"userPrompt\": \"Detailed user prompt with context and requirements\",\n \"contextSummary\": \"Synthesized codebase and architectural understanding\",\n \"taskDecomposition\": {\n \"epics\": [\n {\n \"id\": \"epic-1\",\n \"title\": \"Epic Title\",\n \"description\": \"Detailed epic description\",\n \"estimatedComplexity\": \"low|medium|high|very_high\",\n \"tasks\": [\n {\n \"id\": \"task-1-1\",\n \"title\": \"Task Title\",\n \"description\": \"Detailed task description\",\n \"estimatedHours\": number,\n \"dependencies\": [\"task-id-1\", \"task-id-2\"],\n \"subtasks\": [\n {\n \"id\": \"subtask-1-1-1\",\n \"title\": \"Subtask Title\",\n \"description\": \"Specific subtask description\",\n \"estimatedMinutes\": number\n }\n ]\n }\n ]\n }\n ]\n },\n \"guidelines\": [\"guideline1\", \"guideline2\", \"guideline3\"],\n \"estimatedComplexity\": \"low|medium|high|very_high\",\n \"qualityScore\": 0.0-1.0,\n \"aiAgentResponseFormat\": {\n \"description\": \"Structured response format for AI agents consuming this context package\",\n \"format\": \"EPIC_ID: [Unique identifier]\nEPIC_DESCRIPTION: [High-level feature or change description]\n\nTASK_ID: [Unique identifier within epic]\nTASK_DESCRIPTION: [Specific task description]\n\nSUBTASK_ID: [Unique identifier within task]\nSUBTASK_DESCRIPTION: [Single, atomic action description]\nIMPACTED_FILE: [Exactly one file path]\nOPERATION: [create file, edit file, delete file, merge file, etc.]\nREASONING: [Why this change is needed]\nEXPECTED_CHANGE: [Specific modification expected]\nACCEPTANCE_CRITERIA: [Single, testable criterion]\n\n[Repeat SUBTASK blocks as needed]\n[Repeat TASK blocks as needed]\",\n \"rules\": [\n \"Each epic contains multiple tasks\",\n \"Each task contains multiple subtasks\",\n \"Each subtask impacts exactly one file\",\n \"Each subtask has exactly one acceptance criterion\",\n \"If multiple files or criteria are needed, break into additional subtasks\",\n \"Subtasks must be atomic (smallest possible unit of work)\",\n \"Operations must be one of: create file, edit file, delete file, merge file, rename file, move file\",\n \"All file paths must be relative to project root\",\n \"Acceptance criteria must be testable and unambiguous\"\n ]\n }\n}\n\nIMPORTANT: The root object must have systemPrompt, userPrompt, contextSummary, taskDecomposition, guidelines, estimatedComplexity, qualityScore, and aiAgentResponseFormat fields. Do NOT return a single epic object.\n\nEXAMPLE OF CORRECT STRUCTURE:\n{\n \"systemPrompt\": \"You are an expert developer...\",\n \"userPrompt\": \"Implement the CLI enhancement...\",\n \"contextSummary\": \"The codebase contains...\",\n \"taskDecomposition\": {\n \"epics\": [\n {\n \"id\": \"epic-1\",\n \"title\": \"CLI Framework Enhancement\",\n \"description\": \"...\",\n \"estimatedComplexity\": \"medium\",\n \"tasks\": [...]\n }\n ]\n },\n \"guidelines\": [\"Follow atomic task principles\", \"...\"],\n \"estimatedComplexity\": \"medium\",\n \"qualityScore\": 0.9,\n \"aiAgentResponseFormat\": {\n \"description\": \"...\",\n \"format\": \"...\",\n \"rules\": [...]\n }\n}\n\n## META-PROMPT GUIDELINES\n\n1. **Be Comprehensive**: Include all necessary context and requirements\n2. **Be Specific**: Provide clear, actionable instructions and criteria\n3. **Be Structured**: Organize information logically and hierarchically\n4. **Be Realistic**: Provide accurate estimates and achievable goals\n5. **Be Contextual**: Leverage codebase understanding and architectural patterns\n6. **Be Quality-Focused**: Emphasize best practices and maintainable solutions\n\nGenerate a complete meta-prompt that enables downstream AI agents to successfully complete the development task with full context and clear guidance."; export declare function buildMetaPromptGenerationPrompt(originalPrompt: string, intentAnalysis: IntentAnalysisResult, refinedPrompt: string, relevanceScoringResult: RelevanceScoringResult, additionalContext?: { codemapContent?: string; architecturalPatterns?: string[]; patternConfidence?: { [pattern: string]: number; }; patternEvidence?: { [pattern: string]: string[]; }; technicalConstraints?: string[]; qualityRequirements?: string[]; teamExpertise?: string[]; timelineConstraints?: string; existingGuidelines?: string[]; }): string; export declare const META_PROMPT_GENERATION_RESPONSE_SCHEMA: { readonly type: "object"; readonly properties: { readonly systemPrompt: { readonly type: "string"; readonly minLength: 1; readonly description: "Comprehensive system prompt for AI agents"; }; readonly userPrompt: { readonly type: "string"; readonly minLength: 1; readonly description: "Detailed user prompt with context and requirements"; }; readonly contextSummary: { readonly type: "string"; readonly minLength: 1; readonly description: "Synthesized codebase and architectural understanding"; }; readonly taskDecomposition: { readonly type: "object"; readonly properties: { readonly epics: { readonly type: "array"; readonly items: { readonly type: "object"; readonly properties: { readonly id: { readonly type: "string"; readonly minLength: 1; readonly description: "Unique identifier for the epic"; }; readonly title: { readonly type: "string"; readonly minLength: 1; readonly description: "Epic title"; }; readonly description: { readonly type: "string"; readonly minLength: 1; readonly description: "Detailed epic description"; }; readonly estimatedComplexity: { readonly type: "string"; readonly enum: readonly ["low", "medium", "high", "very_high"]; readonly description: "Estimated complexity level"; }; readonly tasks: { readonly type: "array"; readonly items: { readonly type: "object"; readonly properties: { readonly id: { readonly type: "string"; readonly minLength: 1; readonly description: "Unique identifier for the task"; }; readonly title: { readonly type: "string"; readonly minLength: 1; readonly description: "Task title"; }; readonly description: { readonly type: "string"; readonly minLength: 1; readonly description: "Detailed task description"; }; readonly estimatedHours: { readonly type: "number"; readonly minimum: 0; readonly description: "Estimated hours to complete"; }; readonly dependencies: { readonly type: "array"; readonly items: { readonly type: "string"; }; readonly description: "List of task dependencies"; }; readonly subtasks: { readonly type: "array"; readonly items: { readonly type: "object"; readonly properties: { readonly id: { readonly type: "string"; readonly minLength: 1; readonly description: "Unique identifier for the subtask"; }; readonly title: { readonly type: "string"; readonly minLength: 1; readonly description: "Subtask title"; }; readonly description: { readonly type: "string"; readonly minLength: 1; readonly description: "Specific subtask description"; }; readonly estimatedMinutes: { readonly type: "number"; readonly minimum: 0; readonly description: "Estimated minutes to complete"; }; }; readonly required: readonly ["id", "title", "description", "estimatedMinutes"]; readonly additionalProperties: false; }; readonly description: "List of atomic subtasks"; }; }; readonly required: readonly ["id", "title", "description", "estimatedHours", "dependencies", "subtasks"]; readonly additionalProperties: false; }; readonly description: "List of tasks within the epic"; }; }; readonly required: readonly ["id", "title", "description", "estimatedComplexity", "tasks"]; readonly additionalProperties: false; }; readonly description: "List of epics for the project"; }; }; readonly required: readonly ["epics"]; readonly additionalProperties: false; readonly description: "Structured task decomposition"; }; readonly guidelines: { readonly type: "array"; readonly items: { readonly type: "string"; }; readonly description: "Development guidelines for the task"; }; readonly estimatedComplexity: { readonly type: "string"; readonly enum: readonly ["low", "medium", "high", "very_high"]; readonly description: "Overall estimated complexity"; }; readonly qualityScore: { readonly type: "number"; readonly minimum: 0; readonly maximum: 1; readonly description: "Quality score of the generated meta-prompt"; }; readonly aiAgentResponseFormat: { readonly type: "object"; readonly properties: { readonly description: { readonly type: "string"; readonly minLength: 1; readonly description: "Description of the response format"; }; readonly format: { readonly type: "string"; readonly minLength: 1; readonly description: "Structured format template with EPIC_ID, TASK_ID, SUBTASK_ID elements"; }; readonly rules: { readonly type: "array"; readonly items: { readonly type: "string"; readonly minLength: 1; }; readonly description: "Rules for AI agents to follow"; }; }; readonly required: readonly ["description", "format", "rules"]; readonly additionalProperties: false; readonly description: "AI Agent response format specification"; }; }; readonly required: readonly ["systemPrompt", "userPrompt", "contextSummary", "taskDecomposition", "guidelines", "estimatedComplexity", "qualityScore"]; readonly additionalProperties: false; }; export declare const META_PROMPT_GENERATION_EXAMPLES: { readonly refactoring_authentication: { readonly originalPrompt: "Refactor the authentication module to use JWT tokens"; readonly taskType: "refactoring"; readonly intentAnalysis: { readonly taskType: "refactoring"; readonly confidence: 0.9; readonly reasoning: readonly ["Request explicitly mentions refactoring existing authentication"]; readonly architecturalComponents: readonly ["authentication", "security", "token-management"]; readonly scopeAssessment: { readonly complexity: "moderate"; readonly estimatedFiles: 8; readonly riskLevel: "medium"; }; readonly suggestedFocusAreas: readonly ["security-patterns", "token-validation"]; readonly estimatedEffort: "medium"; }; readonly relevanceScoringResult: { readonly fileScores: readonly [{ readonly filePath: "src/auth/authentication.ts"; readonly relevanceScore: 0.95; readonly confidence: 0.9; readonly reasoning: "Core authentication module that needs JWT implementation"; readonly categories: readonly ["core", "authentication"]; readonly modificationLikelihood: "very_high"; }]; readonly overallMetrics: { readonly averageRelevance: 0.95; readonly totalFilesScored: 1; readonly highRelevanceCount: 1; readonly processingTimeMs: 1800; }; readonly scoringStrategy: "semantic_similarity"; }; readonly expectedResponse: { readonly systemPrompt: "You are an expert software engineer specializing in authentication systems and security refactoring."; readonly userPrompt: "Refactor the authentication module to use JWT tokens while maintaining security best practices."; readonly contextSummary: "The codebase contains a traditional authentication system that requires JWT token implementation."; readonly taskDecomposition: { readonly epics: readonly [{ readonly id: "epic-1"; readonly title: "JWT Token Implementation"; readonly description: "Implement JWT token generation, validation, and management"; readonly estimatedComplexity: "medium"; readonly tasks: readonly [{ readonly id: "task-1-1"; readonly title: "Implement JWT token generation"; readonly description: "Create secure JWT token generation with proper claims"; readonly estimatedHours: 4; readonly dependencies: readonly []; readonly subtasks: readonly [{ readonly id: "subtask-1-1-1"; readonly title: "Set up JWT library"; readonly description: "Install and configure JWT library"; readonly estimatedMinutes: 15; }]; }]; }]; }; readonly guidelines: readonly ["Maintain backward compatibility during refactoring", "Implement comprehensive security measures for JWT tokens"]; readonly estimatedComplexity: "medium"; readonly qualityScore: 0.92; }; }; }; export declare function getMetaPromptGenerationTaskId(): ContextCuratorLLMTask; export declare function attemptResponseRecovery(response: unknown): unknown; export declare function validateMetaPromptGenerationResponse(response: unknown): boolean; export declare function calculateTaskDecompositionMetrics(taskDecomposition: { epics: Array<{ tasks: Array<{ estimatedHours: number; subtasks: Array<{ estimatedMinutes: number; }>; }>; }>; }): { totalEpics: number; totalTasks: number; totalSubtasks: number; totalEstimatedHours: number; totalEstimatedMinutes: number; averageTasksPerEpic: number; averageSubtasksPerTask: number; }; export declare function generateTaskTypeGuidelines(taskType: string): string[]; export declare function estimateOverallComplexity(taskDecomposition: { epics: Array<{ estimatedComplexity: 'low' | 'medium' | 'high' | 'very_high'; tasks: Array<{ estimatedHours: number; }>; }>; }): 'low' | 'medium' | 'high' | 'very_high'; export declare function calculateQualityScore(systemPrompt: string, userPrompt: string, contextSummary: string, taskDecomposition: { epics: Array<{ tasks: Array<{ estimatedHours?: number; subtasks: Array<{ estimatedMinutes?: number; }>; }>; }>; }, guidelines: string[]): number; //# sourceMappingURL=meta-prompt-generation.d.ts.map