vibe-cli-tool
Version:
VibeCLI v1.9 - 模板商店生态,智能部署生成,多语言支持,交互式学习系统,企业级Web全栈应用CLI工具
110 lines • 3.4 kB
TypeScript
/**
* 智能模板匹配引擎
*
* 功能:
* 1. 分析用户需求并提取特征
* 2. 计算模板匹配度和相似性
* 3. 提供智能降级和组合方案
* 4. 生成定制化实施指导
*/
import { PromptTemplate } from '../../core/types.js';
export interface RequirementFeature {
category: 'core' | 'auth' | 'data' | 'ui' | 'integration' | 'business';
name: string;
importance: 'high' | 'medium' | 'low';
keywords: string[];
techStack?: string[];
complexity: number;
}
export interface TemplateMatchResult {
template: PromptTemplate | null;
matchScore: number;
confidence: 'high' | 'medium' | 'low';
matchedFeatures: RequirementFeature[];
missingFeatures: RequirementFeature[];
suggestedApproach: MatchingStrategy;
customizations: TemplateCustomization[];
implementation: ImplementationPlan;
}
export interface MatchingStrategy {
type: 'exact' | 'feature_combination' | 'similarity_based' | 'dynamic_generation' | 'fallback';
reasoning: string;
alternatives: AlternativeOption[];
}
export interface TemplateCustomization {
type: 'add_feature' | 'modify_structure' | 'tech_stack_change' | 'custom_prompt';
description: string;
priority: 'high' | 'medium' | 'low';
effort: 'low' | 'medium' | 'high';
guidance: string;
}
export interface ImplementationPlan {
phases: ImplementationPhase[];
estimatedTime: string;
complexity: 'simple' | 'medium' | 'complex';
recommendations: string[];
}
export interface ImplementationPhase {
name: string;
description: string;
tools: string[];
timeEstimate: string;
dependencies: string[];
}
export interface AlternativeOption {
description: string;
pros: string[];
cons: string[];
matchScore: number;
}
export declare class IntelligentTemplateMatcher {
private predefinedFeatures;
private templateFeatures;
constructor();
/**
* 主要匹配入口:分析用户需求并找到最佳模板方案
*/
findBestMatch(userDescription: string, extractedFeatures: string[], techStack?: string[], constraints?: {
complexity?: string;
timeline?: string;
}): Promise<TemplateMatchResult>;
/**
* 从用户描述中提取需求特征
*/
private extractRequirementFeatures;
/**
* 计算所有模板的匹配分数
*/
private calculateTemplateScores;
/**
* 计算两个特征集合的相似度分数
*/
private calculateSimilarityScore;
/**
* 选择匹配策略
*/
private selectMatchingStrategy;
/**
* 生成最终匹配结果
*/
private generateMatchResult;
private getBusinessComplexity;
private getImportanceWeight;
private hasKeywordOverlap;
private getConfidenceLevel;
private generateAlternatives;
private generateCustomizations;
private generateImplementationPlan;
private initializePredefinedFeatures;
private initializeTemplateFeatures;
private createTemplateObject;
private getTemplatePros;
private getTemplateCons;
private getCustomizationType;
private getFeatureGuidance;
private createImplementationPhases;
private estimateTime;
private generateRecommendations;
}
export declare const intelligentTemplateMatcher: IntelligentTemplateMatcher;
//# sourceMappingURL=intelligent-template-matcher.d.ts.map