intertools
Version:
๐ Professional console log analysis & IDE integration with AI-powered insights. Completely FREE with all features: terminal monitoring, AI chat orchestrator, production analytics, localhost analysis, and Google Analytics integration. No limits, no subscr
402 lines โข 15.4 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.InterTools = void 0;
exports.createInterTools = createInterTools;
exports.quickStart = quickStart;
// InterTools - Professional Console Log Analysis and IDE Integration
// Completely FREE - All features available to everyone
const terminal_monitor_1 = require("./terminal-monitor");
const localhost_monitor_1 = require("./localhost-monitor");
const production_monitor_1 = require("./production-monitor");
const chat_orchestrator_1 = require("./chat-orchestrator");
const analytics_integration_1 = require("./analytics-integration");
class InterTools {
config;
// Component instances
terminalMonitor;
localhostMonitor;
productionMonitor;
chatOrchestrator = null;
analyticsIntegration = null;
constructor(config = {}) {
this.config = {
debug: false,
autoStart: true,
features: {
terminal: true,
localhost: true,
production: true,
chat: true,
analytics: true
},
...config
};
// Initialize components
this.terminalMonitor = new terminal_monitor_1.TerminalMonitor();
this.localhostMonitor = new localhost_monitor_1.LocalhostMonitor();
this.productionMonitor = new production_monitor_1.ProductionMonitor();
// Show welcome message
if (this.config.autoStart) {
this.showWelcomeMessage();
}
if (this.config.debug) {
console.log('๐ง InterTools Debug Mode Enabled');
console.log('โจ All features available - completely FREE!');
}
}
// ===========================================
// CORE FEATURES (Always Available)
// ===========================================
/**
* Format logs for Cursor IDE integration
*/
formatForCursor(logs) {
const errors = logs.filter(log => log.type === 'error');
const warnings = logs.filter(log => log.type === 'warn');
const output = logs.map(log => {
const timestamp = log.timestamp.toLocaleTimeString();
const source = log.source ? ` [${log.source.toUpperCase()}]` : '';
return `- **${timestamp}**${source} [${log.type.toUpperCase()}] ${log.message}`;
}).join('\n');
const insights = this.generateBasicInsights(logs);
const recommendations = this.generateBasicRecommendations(errors, warnings);
return {
output: `# ๐ ๏ธ InterTools Console Log Report\n\n${output}`,
summary: `Found ${errors.length} errors and ${warnings.length} warnings from ${logs.length} total logs`,
errors,
warnings,
insights,
recommendations
};
}
/**
* Filter logs by type
*/
filterErrors(logs) {
return logs.filter(log => log.type === 'error');
}
/**
* Filter logs by source
*/
filterBySource(logs, source) {
return logs.filter(log => log.source === source);
}
/**
* Create timeline analysis
*/
createTimeline(logs) {
const timeline = new Map();
logs.forEach(log => {
const key = log.timestamp.toISOString().slice(0, 16); // Group by minute
const existing = timeline.get(key) || { count: 0, types: {} };
existing.count++;
existing.types[log.type] = (existing.types[log.type] || 0) + 1;
timeline.set(key, existing);
});
return Array.from(timeline.entries()).map(([timestamp, data]) => ({
timestamp: new Date(timestamp),
count: data.count,
types: data.types
}));
}
/**
* Basic IDE sync (always available)
*/
async syncToIde(data, options = {}) {
const ide = options.ide || 'cursor';
const format = options.format || 'markdown';
console.log(`๐ Syncing to ${ide} (${format} format)`);
if (this.config.debug) {
console.log('๐ค Sync Data:', data);
}
// Basic sync functionality always available
}
// ===========================================
// ALL FEATURES (Completely FREE)
// ===========================================
/**
* Capture terminal logs in real-time
*/
async captureTerminalLogs() {
if (!this.config.features?.terminal) {
throw new Error('Terminal monitoring is disabled in configuration');
}
return await this.terminalMonitor.captureTerminalLogs();
}
/**
* Start terminal monitoring
*/
async startTerminalMonitoring() {
await this.terminalMonitor.startMonitoring();
}
/**
* Monitor localhost development server
*/
async monitorLocalhost(url) {
if (!this.config.features?.localhost) {
throw new Error('Localhost monitoring is disabled in configuration');
}
return await this.localhostMonitor.monitorLocalhost(url);
}
/**
* Start localhost monitoring
*/
async startLocalhostMonitoring(url) {
await this.localhostMonitor.startMonitoring(url);
}
/**
* Analyze build processes
*/
async analyzeBuildProcess() {
return await this.terminalMonitor.analyzeBuildProcess();
}
/**
* Start AI Chat Orchestrator
*/
async startChatOrchestrator() {
if (!this.config.features?.chat) {
throw new Error('Chat orchestrator is disabled in configuration');
}
if (!this.chatOrchestrator) {
this.chatOrchestrator = new chat_orchestrator_1.ChatOrchestrator();
}
return await this.chatOrchestrator.start();
}
/**
* Ask AI chat a question
*/
async askAI(question, context) {
if (!this.chatOrchestrator) {
await this.startChatOrchestrator();
}
return await this.chatOrchestrator.ask(question, context);
}
/**
* Monitor production site
*/
async monitorProductionSite(url) {
if (!this.config.features?.production) {
throw new Error('Production monitoring is disabled in configuration');
}
return await this.productionMonitor.monitorProductionSite(url);
}
/**
* Start production monitoring
*/
async startProductionMonitoring(url, interval) {
await this.productionMonitor.startMonitoring(url, interval);
}
/**
* Integrate with Google Analytics
*/
async integrateGoogleAnalytics(config) {
if (!this.config.features?.analytics) {
throw new Error('Analytics integration is disabled in configuration');
}
this.analyticsIntegration = new analytics_integration_1.GoogleAnalyticsIntegration(config);
await this.analyticsIntegration.initialize();
return this.analyticsIntegration;
}
/**
* Get Google Analytics data
*/
async getAnalyticsData(startDate, endDate) {
if (!this.analyticsIntegration) {
throw new Error('Google Analytics not initialized. Call integrateGoogleAnalytics() first.');
}
return await this.analyticsIntegration.generateReport(startDate, endDate);
}
/**
* Start comprehensive development monitoring
*/
async startDevelopmentMonitoring(options) {
console.log('๐ Starting comprehensive InterTools monitoring...');
const promises = [];
if (options.terminal && this.config.features?.terminal) {
console.log('๐ Terminal monitoring: STARTING');
promises.push(this.startTerminalMonitoring());
}
if (options.localhost && this.config.features?.localhost) {
console.log(`๐ Localhost monitoring: ${options.localhost}`);
promises.push(this.startLocalhostMonitoring(options.localhost));
}
if (options.production && this.config.features?.production) {
console.log(`๐ Production monitoring: ${options.production}`);
promises.push(this.startProductionMonitoring(options.production));
}
if (options.analytics && this.config.features?.analytics) {
console.log(`๐ Analytics integration: ${options.analytics}`);
promises.push(this.integrateGoogleAnalytics({ trackingId: options.analytics }).then(() => { }));
}
if (this.config.features?.chat) {
console.log('๐ค AI Chat Orchestrator: STARTING');
promises.push(this.startChatOrchestrator().then(() => { }));
}
await Promise.all(promises);
console.log('โ
InterTools comprehensive monitoring active!');
console.log('');
console.log('๐ฏ Available commands:');
console.log(' ๐ View dashboard: npx intertools dashboard');
console.log(' ๐ฌ Chat with AI: intertools.askAI("your question")');
console.log(' ๐ Get insights: intertools.generateInsights()');
}
/**
* Generate comprehensive insights
*/
async generateInsights() {
const insights = {
terminal: this.terminalMonitor.getStats(),
localhost: this.localhostMonitor.getStats(),
production: this.productionMonitor.getStats(),
analytics: this.analyticsIntegration?.getStatus() || null,
recommendations: await this.generateRecommendations()
};
return insights;
}
/**
* Get InterTools features (all free)
*/
getFeatures() {
return {
available: [
'Terminal monitoring',
'Localhost analysis',
'AI chat orchestrator',
'Production monitoring',
'Google Analytics integration',
'Advanced insights',
'Build process analysis',
'Performance monitoring',
'Error tracking',
'Real-time sync'
],
enabled: this.config.features || {}
};
}
/**
* Get InterTools status
*/
getStatus() {
return {
version: '1.0.16',
license: 'FREE - All features available',
features: this.config.features || {},
components: {
terminalMonitor: this.terminalMonitor ? 'initialized' : 'not_initialized',
localhostMonitor: this.localhostMonitor ? 'initialized' : 'not_initialized',
productionMonitor: this.productionMonitor ? 'initialized' : 'not_initialized',
chatOrchestrator: this.chatOrchestrator ? 'active' : 'inactive',
analyticsIntegration: this.analyticsIntegration ? 'connected' : 'disconnected'
}
};
}
// ===========================================
// PRIVATE HELPER METHODS
// ===========================================
/**
* Show welcome message
*/
showWelcomeMessage() {
console.log('๐ Welcome to InterTools!');
console.log('โจ All features are FREE - no limits, no subscriptions!');
console.log('๐ Professional console log analysis & IDE integration');
console.log('๐ค AI-powered insights, monitoring, and orchestration');
console.log('');
console.log('๐ Get started: https://github.com/luvs2spluj/intertools');
}
/**
* Generate basic insights from logs
*/
generateBasicInsights(logs) {
const insights = [];
const errorCount = logs.filter(l => l.type === 'error').length;
const warningCount = logs.filter(l => l.type === 'warn').length;
if (errorCount > 0) {
insights.push(`๐ด Found ${errorCount} error${errorCount > 1 ? 's' : ''} requiring attention`);
}
if (warningCount > 0) {
insights.push(`๐ก Found ${warningCount} warning${warningCount > 1 ? 's' : ''} to review`);
}
if (errorCount === 0 && warningCount === 0) {
insights.push('โ
No errors or warnings detected');
}
// Source analysis
const sources = [...new Set(logs.map(l => l.source).filter(Boolean))];
if (sources.length > 1) {
insights.push(`๐ Logs from ${sources.length} sources: ${sources.join(', ')}`);
}
return insights;
}
/**
* Generate basic recommendations
*/
generateBasicRecommendations(errors, warnings) {
const recommendations = [];
if (errors.length > 0) {
recommendations.push('๐ง Fix critical errors first to improve stability');
recommendations.push('๐ Add error handling and user-friendly messages');
}
if (warnings.length > 0) {
recommendations.push('โ ๏ธ Review warnings to prevent future issues');
}
if (errors.length === 0 && warnings.length === 0) {
recommendations.push('๐ฏ Consider adding more comprehensive logging');
recommendations.push('๐งช Implement automated testing to catch issues early');
}
recommendations.push('๐ค Use AI chat for personalized insights and recommendations');
return recommendations;
}
/**
* Generate advanced recommendations (PRO feature)
*/
async generateRecommendations() {
const recommendations = [];
// Terminal recommendations
const terminalStats = this.terminalMonitor.getStats();
if (terminalStats.errorsFound > 0) {
recommendations.push('๐ง Address terminal errors to improve development workflow');
}
// Localhost recommendations
const localhostStats = this.localhostMonitor.getStats();
if (localhostStats.averageLoadTime > 2000) {
recommendations.push('โก Optimize localhost performance - load time exceeds 2 seconds');
}
// Production recommendations
const productionStats = this.productionMonitor.getStats();
if (productionStats.criticalIssues > 0) {
recommendations.push('๐จ Address critical production issues immediately');
}
if (productionStats.performanceScore < 70) {
recommendations.push('๐ Improve production performance score');
}
// General recommendations
recommendations.push('๐ Set up monitoring dashboards for continuous insights');
recommendations.push('๐ค Use AI chat for specific debugging assistance');
recommendations.push('๐ Review analytics data for user experience improvements');
return recommendations;
}
}
exports.InterTools = InterTools;
// Default export
exports.default = InterTools;
// Convenience functions
async function createInterTools(config) {
return new InterTools(config);
}
/**
* Quick start function for immediate use
*/
async function quickStart(options) {
const intertools = new InterTools({ autoStart: true });
if (options) {
await intertools.startDevelopmentMonitoring({
terminal: true,
localhost: options.localhost,
production: options.production,
analytics: options.analytics,
ide: 'cursor'
});
}
return intertools;
}
//# sourceMappingURL=index.js.map
;