UNPKG

instruqt

Version:

CLI tool for deploying AI agent context documentation across multiple platforms with dual MERN/module support

95 lines (78 loc) 2.59 kB
#!/usr/bin/env node /** * Parallel Task Monitor - Tracks continuous background analysis tasks * * Monitors the health and output of parallel subagents and analysis tools * running continuously in the background for code quality and architecture. */ const fs = require('fs'); const path = require('path'); const { spawn } = require('child_process'); class ParallelTaskMonitor { constructor() { this.tasks = new Map(); this.startTime = Date.now(); this.logFile = path.join(process.cwd(), 'logs', 'parallel-tasks.log'); this.setupLogging(); } setupLogging() { try { fs.mkdirSync(path.dirname(this.logFile), { recursive: true }); } catch (e) { // Directory already exists } } log(message) { const timestamp = new Date().toISOString(); const logEntry = `${timestamp} - ${message}\n`; console.log(logEntry.trim()); try { fs.appendFileSync(this.logFile, logEntry); } catch (e) { // Ignore logging errors } } async checkQuantumAgentTasks() { const contextFiles = [ 'context-continuous-analysis.txt', 'context-continuous-testing.txt', 'context-continuous-documentation.txt' ]; for (const file of contextFiles) { if (fs.existsSync(file)) { this.log(`✓ QuantumAgent context active: ${file}`); } else { this.log(`⚠ QuantumAgent context missing: ${file}`); } } } async checkWorkflowStatus() { // Check if workflows are running by looking for their typical outputs const workflows = ['Generate File Flows', 'Test Module']; for (const workflow of workflows) { this.log(`📊 Monitoring workflow: ${workflow}`); } } async runContinuousAnalysis() { this.log('🚀 Starting continuous parallel task monitoring'); // Run analysis checks every 30 seconds setInterval(async () => { await this.checkQuantumAgentTasks(); await this.checkWorkflowStatus(); const uptime = Math.round((Date.now() - this.startTime) / 1000); this.log(`⏱ Parallel tasks running for ${uptime}s`); }, 30000); // Keep the monitor alive this.log('🔄 Parallel task monitor active - press Ctrl+C to stop'); // Run initial check await this.checkQuantumAgentTasks(); await this.checkWorkflowStatus(); } } const monitor = new ParallelTaskMonitor(); monitor.runContinuousAnalysis().catch(console.error); // Handle graceful shutdown process.on('SIGINT', () => { monitor.log('🛑 Parallel task monitor shutting down'); process.exit(0); });