task-engine-ai-core
Version:
Revolutionary AI-driven task management system with complete transformation trilogy: Frontend v0.1.0, Backend v0.2.0, CLI v0.3.0 - Enterprise-grade performance with 95% improvements
68 lines (53 loc) ⢠2.32 kB
JavaScript
/**
* Post-install script for task-engine-ai-core
*
* This script runs automatically after npm install and sets up MCP configuration.
* It detects the environment and configures MCP appropriately.
*
* @version 0.3.4
* @author Task Engine AI Team
*/
import { existsSync } from 'fs';
import { resolve, dirname } from 'path';
import { fileURLToPath } from 'url';
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
async function postInstall() {
console.log('\nš Task Engine AI Core - Post-Install Setup');
console.log('==========================================');
try {
// Check if we're in a CI environment or automated install
const isCI = process.env.CI || process.env.CONTINUOUS_INTEGRATION || process.env.GITHUB_ACTIONS;
const isNpmScript = process.env.npm_lifecycle_event;
if (isCI) {
console.log('š¦ CI environment detected - skipping interactive setup');
return;
}
// Check if auto-setup should run
const shouldAutoSetup = !process.env.TASK_ENGINE_SKIP_AUTO_SETUP;
if (!shouldAutoSetup) {
console.log('āļø Auto-setup skipped (TASK_ENGINE_SKIP_AUTO_SETUP is set)');
console.log('š” Run manually: npx task-engine-ai-core setup-mcp');
return;
}
// Import and run auto-setup
const AutoMCPSetup = (await import('./auto-setup-mcp.js')).default;
const autoSetup = new AutoMCPSetup();
console.log('š§ Running automatic MCP configuration...\n');
await autoSetup.autoSetup();
} catch (error) {
console.error('\nā ļø Post-install setup encountered an issue:', error.message);
console.log('\nš Manual setup options:');
console.log('1. Run: npx task-engine-ai-core setup-mcp');
console.log('2. See documentation: https://github.com/cracked99/Task-engine');
console.log('3. Check troubleshooting guide in docs/MCP_TROUBLESHOOTING_GUIDE.md');
// Don't fail the installation, just warn
process.exit(0);
}
}
// Only run if this is the main module
if (import.meta.url === `file://${process.argv[1]}`) {
postInstall();
}
export default postInstall;