UNPKG

pilot-agent-cli

Version:

GitHub Copilot automation tool with configuration-driven file management

124 lines (102 loc) โ€ข 4.46 kB
class FeatureAnalyzer { constructor(verbose = false) { this.verbose = verbose; this.featureFlags = null; this.preconditions = null; } analyzeFeatureFlags(flags) { this.featureFlags = flags; const analysis = { enabled: [], disabled: [], experimental: [], summary: this.generateSummary(flags) }; this.categorizeFeatures(flags, analysis); this.displayAnalysis(analysis); return analysis; } categorizeFeatures(flags, analysis) { const featureMap = { rt: { name: 'Real-time Features', description: 'Advanced real-time code suggestions and live collaboration' }, sn: { name: 'Snippet Suggestions', description: 'Code snippet and template suggestions' }, chat: { name: 'Chat Integration', description: 'Copilot Chat for conversational coding assistance' }, ic: { name: 'Inline Completions', description: 'Standard inline code completion suggestions' }, pc: { name: 'Path Completion', description: 'File path and import statement completions' }, ae: { name: 'Advanced Extensions', description: 'Advanced/experimental features' } }; Object.entries(flags).forEach(([key, value]) => { const feature = featureMap[key] || { name: key, description: 'Unknown feature' }; if (value === true || value === 'true' || value === 1) { analysis.enabled.push({ key, ...feature }); } else if (value === false || value === 'false' || value === 0) { analysis.disabled.push({ key, ...feature }); } else { analysis.experimental.push({ key, value, ...feature }); } }); } displayAnalysis(analysis) { if (this.verbose) { console.log('\n๐Ÿ” Feature Flags Analysis:'); console.log('โ•'.repeat(50)); if (analysis.enabled.length > 0) { console.log('\nโœ… Enabled Features:'); analysis.enabled.forEach(feature => { console.log(` ${feature.key}: ${feature.name}`); console.log(` ${feature.description}`); }); } if (analysis.disabled.length > 0) { console.log('\nโŒ Disabled Features:'); analysis.disabled.forEach(feature => { console.log(` ${feature.key}: ${feature.name}`); }); } if (analysis.experimental.length > 0) { console.log('\n๐Ÿงช Experimental Features:'); analysis.experimental.forEach(feature => { console.log(` ${feature.key}: ${feature.value} (${feature.name})`); }); } console.log('\n๐Ÿ“Š Summary:', analysis.summary); console.log('โ•'.repeat(50)); } } generateSummary(flags) { const total = Object.keys(flags).length; const enabled = Object.values(flags).filter(v => v === true || v === 'true' || v === 1).length; return `${enabled}/${total} features enabled`; } handlePreconditions(preconditions) { this.preconditions = preconditions; if (this.verbose) { console.log('\n๐Ÿ”ง Preconditions Processing:'); console.log(' Received precondition notification'); console.log(' Data:', JSON.stringify(preconditions, null, 2)); } return { status: 'processed', preconditions: this.preconditions }; } getImplementationSuggestions() { const suggestions = []; if (this.featureFlags) { if (this.featureFlags.chat) { suggestions.push({ feature: 'chat', suggestion: 'Implement chat integration for conversational coding assistance' }); } if (this.featureFlags.rt) { suggestions.push({ feature: 'rt', suggestion: 'Enable real-time collaboration features' }); } } return suggestions; } } module.exports = FeatureAnalyzer;