@hkgdevx/logcoz 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +24 -24
- package/README.md +40 -20
- package/dist/cli.js +3 -1
- package/dist/cli.js.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/normalize.ts","../src/constants/signals.ts","../src/constants/defaults.ts","../src/core/extract.ts","../src/detectors/shared/rules.ts","../src/detectors/shared/evidence.ts","../src/detectors/shared/confidence.ts","../src/detectors/container/docker.ts","../src/detectors/shared/metadata.ts","../src/detectors/container/kubernetes.ts","../src/detectors/database/mongodb.ts","../src/detectors/database/mysql.ts","../src/detectors/database/redis.ts","../src/detectors/database/postgres.ts","../src/detectors/messaging/kafka.ts","../src/detectors/messaging/rabbitmq.ts","../src/detectors/network/dns.ts","../src/detectors/network/port.ts","../src/detectors/network/tls.ts","../src/detectors/network/timeout.ts","../src/detectors/proxy/nginx.ts","../src/detectors/runtime/file.ts","../src/detectors/runtime/oom.ts","../src/detectors/index.ts","../src/core/detect.ts","../src/core/context.ts","../src/utils/file.ts","../src/utils/platform.ts","../src/core/explain.ts","../package.json","../src/constants/meta.ts","../src/constants/exit.ts","../src/core/output.ts","../src/providers/llm.ts","../src/utils/redact.ts","../src/core/analyze.ts","../src/correlation/correlate.ts","../src/correlation/keys.ts"],"sourcesContent":["/**************************************************************************************************************************\n Copyright (c) 2026\n\n Name: normalize.ts\n Author: Harikrishnan Gangadharan\n Comments: \n\n/**************************************************************************************************************************\n IMPORTS\n***************************************************************************************************************************/\nimport stripAnsi from 'strip-ansi';\n\n/**************************************************************************************************************************\n IMPLEMENTATIONS\n***************************************************************************************************************************/\n\nexport function normalizeLog(input: string): string {\n return stripAnsi(input)\n .replace(/\\r\\n/g, '\\n')\n .replace(/\\t/g, ' ')\n .replace(/\\n{3,}/g, '\\n\\n')\n .trim();\n}\n","/**************************************************************************************************************************\n Copyright (c) 2026\n\n Name: signals.ts\n Author: Harikrishnan Gangadharan\n Comments: \n\n/**************************************************************************************************************************\n TYPES / GLOBAL DEFINITIONS\n***************************************************************************************************************************/\nexport const SIGNAL_PATTERNS: RegExp[] = [\n /error/i,\n /exception/i,\n /ECONNREFUSED/i,\n /EADDRINUSE/i,\n /ENOENT/i,\n /ENOTFOUND/i,\n /502 Bad Gateway/i,\n /connect\\(\\) failed/i,\n /password authentication failed/i,\n /WRONGPASS/i,\n /NOAUTH/i,\n /upstream prematurely closed connection/i,\n /address already in use/i,\n /timeout/i,\n /certificate/i,\n /TLS/i,\n /out of memory/i,\n /OOMKilled/i,\n /ImagePullBackOff/i,\n /CrashLoopBackOff/i,\n /mysql/i,\n /mongo/i,\n /kafka/i,\n /rabbitmq/i\n];\n","/**************************************************************************************************************************\n Copyright (c) 2026\n\n Name: defaults.ts\n Author: Harikrishnan Gangadharan\n Comments: \n\n/**************************************************************************************************************************\n TYPES / GLOBAL DEFINITIONS\n***************************************************************************************************************************/\nexport const DEFAULT_CONTEXT_LINES = 6;\nexport const MAX_EVIDENCE_LINES = 5;\nexport const MIN_DETECTION_SCORE = 40;\nexport const CORRELATION_TIME_WINDOW_MS = 5000;\n","/**************************************************************************************************************************\n Copyright (c) 2026\n\n Name: extract.ts\n Author: Harikrishnan Gangadharan\n Comments: \n\n/**************************************************************************************************************************\n IMPORTS\n***************************************************************************************************************************/\nimport { SIGNAL_PATTERNS } from '@/constants/signals';\nimport { DEFAULT_CONTEXT_LINES } from '@/constants/defaults';\n\n/**************************************************************************************************************************\n IMPLEMENTATIONS\n***************************************************************************************************************************/\nexport function extractRelevantBlock(input: string, contextLines = DEFAULT_CONTEXT_LINES): string {\n const lines = input.split('\\n');\n const hitIndexes = new Set<number>();\n\n lines.forEach((line, idx) => {\n if (SIGNAL_PATTERNS.some((pattern) => pattern.test(line))) {\n for (\n let i = Math.max(0, idx - contextLines);\n i <= Math.min(lines.length - 1, idx + contextLines);\n i++\n ) {\n hitIndexes.add(i);\n }\n }\n });\n\n if (hitIndexes.size === 0) {\n return lines.slice(-20).join('\\n');\n }\n\n return [...hitIndexes]\n .sort((a, b) => a - b)\n .map((index) => lines[index])\n .join('\\n');\n}\n","/**************************************************************************************************************************\n Copyright (c) 2026\n\n Name: rules.ts\n Author: Harikrishnan Gangadharan\n Comments: \n\n/**************************************************************************************************************************\n IMPLEMENTATIONS\n***************************************************************************************************************************/\nexport function runPatternRules(\n input: string,\n rules: PatternRule[]\n): { score: number; matchedPatterns: string[]; confidenceReasons: ConfidenceReason[] } {\n let score = 0;\n const matchedPatterns: string[] = [];\n const confidenceReasons: ConfidenceReason[] = [];\n\n for (const rule of rules) {\n if (rule.pattern.test(input)) {\n score += rule.weight;\n matchedPatterns.push(rule.label);\n confidenceReasons.push({\n label: rule.label,\n impact: rule.weight,\n source: 'pattern'\n });\n }\n }\n\n return { score, matchedPatterns, confidenceReasons };\n}\n","/**************************************************************************************************************************\n Copyright (c) 2026\n\n Name: evidence.ts\n Author: Harikrishnan Gangadharan\n Comments: \n\n/**************************************************************************************************************************\n IMPORTS\n***************************************************************************************************************************/\nimport { MAX_EVIDENCE_LINES } from '@/constants/defaults';\n\n/**************************************************************************************************************************\n IMPLEMENTATIONS\n***************************************************************************************************************************/\nexport function pickEvidence(input: string, patterns: RegExp[]): string[] {\n return input\n .split('\\n')\n .filter((line) => patterns.some((pattern) => pattern.test(line)))\n .slice(0, MAX_EVIDENCE_LINES);\n}\n","/**************************************************************************************************************************\n Copyright (c) 2026\n\n Name: confidence.ts\n Author: Harikrishnan Gangadharan\n Comments: \n\n/**************************************************************************************************************************\n IMPLEMENTATIONS\n***************************************************************************************************************************/\nexport function scoreToConfidence(score: number): number {\n if (score >= 90) return 0.97;\n if (score >= 75) return 0.93;\n if (score >= 60) return 0.88;\n if (score >= 50) return 0.82;\n if (score >= 40) return 0.72;\n return 0.5;\n}\n","/**************************************************************************************************************************\n Copyright (c) 2026\n\n Name: docker.ts\n Author: Harikrishnan Gangadharan\n Comments: \n\n/**************************************************************************************************************************\n IMPORTS\n***************************************************************************************************************************/\nimport { runPatternRules } from '@/detectors/shared/rules';\nimport { pickEvidence } from '@/detectors/shared/evidence';\nimport { scoreToConfidence } from '@/detectors/shared/confidence';\n\n/**************************************************************************************************************************\n IMPLEMENTATIONS\n***************************************************************************************************************************/\nexport const docker: IssueDetector = {\n name: 'docker-detector',\n\n detect(ctx): DetectionCandidate | null {\n const rules = [\n { pattern: /\\bhealthcheck\\b/i, weight: 20, label: 'healthcheck' },\n { pattern: /\\bunhealthy\\b/i, weight: 45, label: 'unhealthy' },\n { pattern: /\\brestarting\\b/i, weight: 40, label: 'restarting' },\n { pattern: /\\bexited with code\\b/i, weight: 35, label: 'exited with code' },\n { pattern: /\\bcontainer\\b/i, weight: 10, label: 'container' },\n { pattern: /\\bdocker\\b/i, weight: 10, label: 'docker' },\n {\n pattern: /\\bBack-off restarting failed container\\b/i,\n weight: 45,\n label: 'back-off restart'\n },\n { pattern: /\\bCrashLoopBackOff\\b/i, weight: 50, label: 'CrashLoopBackOff' }\n ];\n\n const { score, matchedPatterns, confidenceReasons } = runPatternRules(ctx.normalized, rules);\n\n if (score < 40) return null;\n\n const isHealthcheck =\n matchedPatterns.includes('unhealthy') || matchedPatterns.includes('healthcheck');\n const isRestartLoop =\n matchedPatterns.includes('restarting') ||\n matchedPatterns.includes('back-off restart') ||\n matchedPatterns.includes('CrashLoopBackOff');\n\n let type = 'docker_container_failure';\n let title = 'Docker container failure';\n let summary = 'The container encountered a runtime failure.';\n\n if (isHealthcheck) {\n type = 'docker_healthcheck_failed';\n title = 'Docker container health check failed';\n summary = 'The container is running or starting, but failed its health check.';\n } else if (isRestartLoop) {\n type = 'docker_restart_loop';\n title = 'Docker container restart loop';\n summary = 'The container is repeatedly crashing and restarting.';\n }\n\n return {\n detector: this.name,\n type,\n title,\n category: 'container',\n score,\n confidence: scoreToConfidence(score),\n specificity: 4,\n matchedPatterns,\n confidenceReasons,\n evidence: pickEvidence(ctx.normalized, [\n /\\bunhealthy\\b/i,\n /\\brestarting\\b/i,\n /\\bexited with code\\b/i,\n /\\bhealthcheck\\b/i,\n /\\bCrashLoopBackOff\\b/i,\n /\\bBack-off restarting failed container\\b/i\n ]),\n summary\n };\n }\n};\n","/**************************************************************************************************************************\n Copyright (c) 2026\n\n Name: metadata.ts\n Author: Harikrishnan Gangadharan\n Comments: \n\n/**************************************************************************************************************************\n IMPLEMENTATIONS\n***************************************************************************************************************************/\nexport function extractHostPort(input: string): Record<string, unknown> {\n const match = input.match(/([0-9a-zA-Z._-]+):(\\d{2,5})/);\n\n if (!match) return {};\n\n return {\n host: match[1],\n port: Number(match[2])\n };\n}\n\nexport function extractServiceName(input: string): string | undefined {\n const patterns = [\n /\\bservice[=: ]([a-zA-Z0-9._-]+)/i,\n /\\bcontainer[=: ]([a-zA-Z0-9._-]+)/i,\n /\\bpod[=: ]([a-zA-Z0-9._-]+)/i\n ];\n\n for (const pattern of patterns) {\n const match = input.match(pattern);\n if (match?.[1]) {\n return match[1];\n }\n }\n\n return undefined;\n}\n","/**************************************************************************************************************************\n Copyright (c) 2026\n\n Name: kubernetes.ts\n Author: Harikrishnan Gangadharan\n Comments:\n\n/**************************************************************************************************************************\n IMPORTS\n***************************************************************************************************************************/\nimport { runPatternRules } from '@/detectors/shared/rules';\nimport { pickEvidence } from '@/detectors/shared/evidence';\nimport { scoreToConfidence } from '@/detectors/shared/confidence';\nimport { extractServiceName } from '@/detectors/shared/metadata';\n\n/**************************************************************************************************************************\n IMPLEMENTATIONS\n***************************************************************************************************************************/\nexport const kubernetes: IssueDetector = {\n name: 'kubernetes-detector',\n\n detect(ctx): DetectionCandidate | null {\n const rules = [\n { pattern: /\\bImagePullBackOff\\b/i, weight: 55, label: 'ImagePullBackOff' },\n { pattern: /\\bErrImagePull\\b/i, weight: 50, label: 'ErrImagePull' },\n { pattern: /\\bCrashLoopBackOff\\b/i, weight: 45, label: 'CrashLoopBackOff' },\n { pattern: /\\bFailedScheduling\\b/i, weight: 45, label: 'FailedScheduling' },\n { pattern: /\\bBack-off pulling image\\b/i, weight: 45, label: 'Back-off pulling image' },\n { pattern: /\\bkubelet\\b|\\bpod\\b|\\bkubernetes\\b/i, weight: 20, label: 'kubernetes runtime' }\n ];\n\n const { score, matchedPatterns, confidenceReasons } = runPatternRules(ctx.normalized, rules);\n\n if (score < 40) return null;\n\n return {\n detector: this.name,\n type: 'kubernetes_workload_failure',\n title: 'Kubernetes workload failure',\n category: 'orchestration',\n score,\n confidence: scoreToConfidence(score),\n specificity: 4,\n matchedPatterns,\n confidenceReasons,\n evidence: pickEvidence(ctx.normalized, [\n /\\bImagePullBackOff\\b/i,\n /\\bErrImagePull\\b/i,\n /\\bCrashLoopBackOff\\b/i,\n /\\bFailedScheduling\\b/i,\n /\\bBack-off pulling image\\b/i\n ]),\n summary:\n 'A Kubernetes workload failed due to scheduling, image retrieval, or restart issues.',\n metadata: {\n service: extractServiceName(ctx.normalized)\n }\n };\n }\n};\n","/**************************************************************************************************************************\n Copyright (c) 2026\n\n Name: mongodb.ts\n Author: Harikrishnan Gangadharan\n Comments:\n\n/**************************************************************************************************************************\n IMPORTS\n***************************************************************************************************************************/\nimport { runPatternRules } from '@/detectors/shared/rules';\nimport { pickEvidence } from '@/detectors/shared/evidence';\nimport { scoreToConfidence } from '@/detectors/shared/confidence';\n\n/**************************************************************************************************************************\n IMPLEMENTATIONS\n***************************************************************************************************************************/\nexport const mongodb: IssueDetector = {\n name: 'mongodb-detector',\n\n detect(ctx): DetectionCandidate | null {\n const rules = [\n { pattern: /\\bMongoNetworkError\\b/i, weight: 45, label: 'MongoNetworkError' },\n { pattern: /\\bAuthentication failed\\b/i, weight: 40, label: 'Authentication failed' },\n { pattern: /\\bmongodb\\b|\\bmongo\\b/i, weight: 20, label: 'mongodb' },\n { pattern: /\\b27017\\b/, weight: 10, label: '27017' },\n {\n pattern: /\\bfailed to connect to server\\b/i,\n weight: 45,\n label: 'failed to connect to server'\n }\n ];\n\n const { score, matchedPatterns, confidenceReasons } = runPatternRules(ctx.normalized, rules);\n\n if (score < 40) return null;\n\n return {\n detector: this.name,\n type: 'mongodb_connection_error',\n title: 'MongoDB connection or authentication error',\n category: 'database',\n score,\n confidence: scoreToConfidence(score),\n specificity: 4,\n matchedPatterns,\n confidenceReasons,\n evidence: pickEvidence(ctx.normalized, [\n /\\bMongoNetworkError\\b/i,\n /\\bAuthentication failed\\b/i,\n /\\bfailed to connect to server\\b/i,\n /\\bmongodb\\b|\\bmongo\\b/i\n ]),\n summary: 'The application encountered a MongoDB connection or authentication failure.'\n };\n }\n};\n","/**************************************************************************************************************************\n Copyright (c) 2026\n\n Name: mysql.ts\n Author: Harikrishnan Gangadharan\n Comments:\n\n/**************************************************************************************************************************\n IMPORTS\n***************************************************************************************************************************/\nimport { runPatternRules } from '@/detectors/shared/rules';\nimport { pickEvidence } from '@/detectors/shared/evidence';\nimport { scoreToConfidence } from '@/detectors/shared/confidence';\n\n/**************************************************************************************************************************\n IMPLEMENTATIONS\n***************************************************************************************************************************/\nexport const mysql: IssueDetector = {\n name: 'mysql-detector',\n\n detect(ctx): DetectionCandidate | null {\n const rules = [\n { pattern: /\\bER_ACCESS_DENIED_ERROR\\b/i, weight: 50, label: 'ER_ACCESS_DENIED_ERROR' },\n { pattern: /\\bECONNREFUSED\\b/i, weight: 25, label: 'ECONNREFUSED' },\n { pattern: /\\bmysql\\b/i, weight: 20, label: 'mysql' },\n { pattern: /\\b3306\\b/, weight: 10, label: '3306' },\n { pattern: /\\bUnknown database\\b/i, weight: 45, label: 'Unknown database' }\n ];\n\n const { score, matchedPatterns, confidenceReasons } = runPatternRules(ctx.normalized, rules);\n\n if (score < 40) return null;\n\n return {\n detector: this.name,\n type: 'mysql_connection_error',\n title: 'MySQL connection or authentication error',\n category: 'database',\n score,\n confidence: scoreToConfidence(score),\n specificity: 4,\n matchedPatterns,\n confidenceReasons,\n evidence: pickEvidence(ctx.normalized, [\n /\\bER_ACCESS_DENIED_ERROR\\b/i,\n /\\bUnknown database\\b/i,\n /\\bmysql\\b/i,\n /\\bECONNREFUSED\\b/i\n ]),\n summary: 'The application encountered a MySQL connectivity or authentication problem.'\n };\n }\n};\n","/**************************************************************************************************************************\n Copyright (c) 2026\n\n Name: redis.ts\n Author: Harikrishnan Gangadharan\n Comments: \n\n/**************************************************************************************************************************\n IMPORTS\n***************************************************************************************************************************/\nimport { runPatternRules } from '@/detectors/shared/rules';\nimport { pickEvidence } from '@/detectors/shared/evidence';\nimport { scoreToConfidence } from '@/detectors/shared/confidence';\nimport { extractHostPort } from '@/detectors/shared/metadata';\n\n/**************************************************************************************************************************\n TYPES \\ GLOBAL DEFINITIONS\n***************************************************************************************************************************/\nfunction getRedisContextBoost(hints: { key: string; value: string }[]): number {\n let boost = 0;\n\n const hasRedisService = hints.some(\n (hint) => hint.key === 'docker_service' && hint.value === 'redis'\n );\n const hasLocalhostRedis = hints.some(\n (hint) => hint.key === 'REDIS_HOST' && hint.value === 'localhost'\n );\n\n if (hasRedisService) boost += 10;\n if (hasLocalhostRedis) boost += 15;\n\n return boost;\n}\n\nfunction getRedisContextReasons(hints: ContextHint[]): ConfidenceReason[] {\n const reasons: ConfidenceReason[] = [];\n\n if (hints.some((hint) => hint.key === 'docker_service' && hint.value === 'redis')) {\n reasons.push({\n label: 'docker_service=redis',\n impact: 10,\n source: 'context'\n });\n }\n\n if (hints.some((hint) => hint.key === 'REDIS_HOST' && hint.value === 'localhost')) {\n reasons.push({\n label: 'REDIS_HOST=localhost',\n impact: 15,\n source: 'context'\n });\n }\n\n return reasons;\n}\n\n/**************************************************************************************************************************\n IMPLEMENTATIONS\n***************************************************************************************************************************/\nexport const redis: IssueDetector = {\n name: 'redis-detector',\n\n detect(ctx): DetectionCandidate | null {\n const rules = [\n { pattern: /ECONNREFUSED/i, weight: 40, label: 'ECONNREFUSED' },\n { pattern: /\\bredis\\b/i, weight: 25, label: 'redis' },\n { pattern: /\\bioredis\\b/i, weight: 20, label: 'ioredis' },\n { pattern: /\\b6379\\b/, weight: 10, label: '6379' },\n { pattern: /\\bWRONGPASS\\b/i, weight: 40, label: 'WRONGPASS' },\n { pattern: /\\bNOAUTH\\b/i, weight: 40, label: 'NOAUTH' }\n ];\n\n const { score, matchedPatterns, confidenceReasons } = runPatternRules(ctx.normalized, rules);\n\n if (score < 40) return null;\n\n const isAuth = matchedPatterns.includes('WRONGPASS') || matchedPatterns.includes('NOAUTH');\n\n const contextBoost = getRedisContextBoost(ctx.contextHints);\n const finalScore = score + contextBoost;\n const contextReasons = getRedisContextReasons(ctx.contextHints);\n\n return {\n detector: this.name,\n type: isAuth ? 'redis_auth_error' : 'redis_connection_refused',\n title: isAuth ? 'Redis authentication error' : 'Redis connection refused',\n category: 'database',\n score: finalScore,\n confidence: scoreToConfidence(finalScore),\n specificity: 4,\n matchedPatterns,\n confidenceReasons: [...confidenceReasons, ...contextReasons],\n evidence: pickEvidence(ctx.normalized, [\n /redis/i,\n /ioredis/i,\n /ECONNREFUSED/i,\n /WRONGPASS/i,\n /NOAUTH/i\n ]),\n summary: isAuth\n ? 'The application reached Redis but authentication failed.'\n : 'The application failed to connect to Redis.',\n metadata: extractHostPort(ctx.normalized)\n };\n }\n};\n","/**************************************************************************************************************************\n Copyright (c) 2026\n\n Name: postgres.ts\n Author: Harikrishnan Gangadharan\n Comments: \n\n/**************************************************************************************************************************\n IMPORTS\n***************************************************************************************************************************/\nimport { runPatternRules } from '@/detectors/shared/rules';\nimport { pickEvidence } from '@/detectors/shared/evidence';\nimport { scoreToConfidence } from '@/detectors/shared/confidence';\n\n/**************************************************************************************************************************\n IMPLEMENTATIONS\n***************************************************************************************************************************/\nexport const postgres: IssueDetector = {\n name: 'postgres-detector',\n\n detect(ctx): DetectionCandidate | null {\n const rules = [\n {\n pattern: /password authentication failed/i,\n weight: 50,\n label: 'password authentication failed'\n },\n {\n pattern: /database .* does not exist/i,\n weight: 45,\n label: 'database does not exist'\n },\n {\n pattern: /Connection terminated unexpectedly/i,\n weight: 40,\n label: 'Connection terminated unexpectedly'\n },\n {\n pattern: /\\bpostgres\\b|\\bpostgresql\\b/i,\n weight: 20,\n label: 'postgres'\n },\n {\n pattern: /\\b5432\\b/,\n weight: 10,\n label: '5432'\n }\n ];\n\n const { score, matchedPatterns, confidenceReasons } = runPatternRules(ctx.normalized, rules);\n\n if (score < 40) return null;\n\n return {\n detector: this.name,\n type: 'postgres_connection_error',\n title: 'PostgreSQL connection or authentication error',\n category: 'database',\n score,\n confidence: scoreToConfidence(score),\n specificity: 4,\n matchedPatterns,\n confidenceReasons,\n evidence: pickEvidence(ctx.normalized, [\n /password authentication failed/i,\n /database .* does not exist/i,\n /Connection terminated unexpectedly/i,\n /postgres/i\n ]),\n summary: 'The application encountered a PostgreSQL connection problem.'\n };\n }\n};\n","/**************************************************************************************************************************\n Copyright (c) 2026\n\n Name: kafka.ts\n Author: Harikrishnan Gangadharan\n Comments:\n\n/**************************************************************************************************************************\n IMPORTS\n***************************************************************************************************************************/\nimport { runPatternRules } from '@/detectors/shared/rules';\nimport { pickEvidence } from '@/detectors/shared/evidence';\nimport { scoreToConfidence } from '@/detectors/shared/confidence';\n\n/**************************************************************************************************************************\n IMPLEMENTATIONS\n***************************************************************************************************************************/\nexport const kafka: IssueDetector = {\n name: 'kafka-detector',\n\n detect(ctx): DetectionCandidate | null {\n const rules = [\n { pattern: /\\bKafkaJSConnectionError\\b/i, weight: 50, label: 'KafkaJSConnectionError' },\n { pattern: /\\bLEADER_NOT_AVAILABLE\\b/i, weight: 45, label: 'LEADER_NOT_AVAILABLE' },\n { pattern: /\\bbroker.*not available\\b/i, weight: 45, label: 'broker not available' },\n { pattern: /\\bkafka\\b/i, weight: 20, label: 'kafka' },\n { pattern: /\\b9092\\b/, weight: 10, label: '9092' }\n ];\n\n const { score, matchedPatterns, confidenceReasons } = runPatternRules(ctx.normalized, rules);\n\n if (score < 40) return null;\n\n return {\n detector: this.name,\n type: 'kafka_broker_error',\n title: 'Kafka broker or connectivity error',\n category: 'messaging',\n score,\n confidence: scoreToConfidence(score),\n specificity: 4,\n matchedPatterns,\n confidenceReasons,\n evidence: pickEvidence(ctx.normalized, [\n /\\bKafkaJSConnectionError\\b/i,\n /\\bLEADER_NOT_AVAILABLE\\b/i,\n /\\bbroker.*not available\\b/i,\n /\\bkafka\\b/i\n ]),\n summary: 'The application could not reach a healthy Kafka broker or partition leader.'\n };\n }\n};\n","/**************************************************************************************************************************\n Copyright (c) 2026\n\n Name: rabbitmq.ts\n Author: Harikrishnan Gangadharan\n Comments:\n\n/**************************************************************************************************************************\n IMPORTS\n***************************************************************************************************************************/\nimport { runPatternRules } from '@/detectors/shared/rules';\nimport { pickEvidence } from '@/detectors/shared/evidence';\nimport { scoreToConfidence } from '@/detectors/shared/confidence';\n\n/**************************************************************************************************************************\n IMPLEMENTATIONS\n***************************************************************************************************************************/\nexport const rabbitmq: IssueDetector = {\n name: 'rabbitmq-detector',\n\n detect(ctx): DetectionCandidate | null {\n const rules = [\n { pattern: /\\bACCESS_REFUSED\\b/i, weight: 45, label: 'ACCESS_REFUSED' },\n { pattern: /\\bCONNECTION_FORCED\\b/i, weight: 45, label: 'CONNECTION_FORCED' },\n { pattern: /\\bamqp\\b|\\brabbitmq\\b/i, weight: 20, label: 'rabbitmq' },\n { pattern: /\\b5672\\b/, weight: 10, label: '5672' },\n {\n pattern: /\\bSocket closed abruptly during opening handshake\\b/i,\n weight: 45,\n label: 'opening handshake failed'\n }\n ];\n\n const { score, matchedPatterns, confidenceReasons } = runPatternRules(ctx.normalized, rules);\n\n if (score < 40) return null;\n\n return {\n detector: this.name,\n type: 'rabbitmq_connection_error',\n title: 'RabbitMQ connection or broker error',\n category: 'messaging',\n score,\n confidence: scoreToConfidence(score),\n specificity: 4,\n matchedPatterns,\n confidenceReasons,\n evidence: pickEvidence(ctx.normalized, [\n /\\bACCESS_REFUSED\\b/i,\n /\\bCONNECTION_FORCED\\b/i,\n /\\bSocket closed abruptly during opening handshake\\b/i,\n /\\bamqp\\b|\\brabbitmq\\b/i\n ]),\n summary: 'The application encountered an AMQP or RabbitMQ connection failure.'\n };\n }\n};\n","/**************************************************************************************************************************\n Copyright (c) 2026\n\n Name: dns.ts\n Author: Harikrishnan Gangadharan\n Comments: \n\n/**************************************************************************************************************************\n IMPORTS\n***************************************************************************************************************************/\nimport { runPatternRules } from '@/detectors/shared/rules';\nimport { pickEvidence } from '@/detectors/shared/evidence';\nimport { scoreToConfidence } from '@/detectors/shared/confidence';\n\n/**************************************************************************************************************************\n IMPLEMENTATIONS\n***************************************************************************************************************************/\nexport const dns: IssueDetector = {\n name: 'dns-detector',\n\n detect(ctx): DetectionCandidate | null {\n const rules = [\n { pattern: /ENOTFOUND/i, weight: 45, label: 'ENOTFOUND' },\n { pattern: /getaddrinfo/i, weight: 35, label: 'getaddrinfo' },\n {\n pattern: /Temporary failure in name resolution/i,\n weight: 45,\n label: 'Temporary failure in name resolution'\n }\n ];\n\n const { score, matchedPatterns, confidenceReasons } = runPatternRules(ctx.normalized, rules);\n\n if (score < 40) return null;\n\n return {\n detector: this.name,\n type: 'dns_resolution_error',\n title: 'Hostname or DNS resolution failure',\n category: 'network',\n score,\n confidence: scoreToConfidence(score),\n specificity: 3,\n matchedPatterns,\n confidenceReasons,\n evidence: pickEvidence(ctx.normalized, [/ENOTFOUND/i, /getaddrinfo/i, /name resolution/i]),\n summary: 'The application could not resolve the target hostname.'\n };\n }\n};\n","/**************************************************************************************************************************\n Copyright (c) 2026\n\n Name: port.ts\n Author: Harikrishnan Gangadharan\n Comments: \n\n/**************************************************************************************************************************\n IMPORTS\n***************************************************************************************************************************/\nimport { runPatternRules } from '@/detectors/shared/rules';\nimport { pickEvidence } from '@/detectors/shared/evidence';\nimport { scoreToConfidence } from '@/detectors/shared/confidence';\n\n/**************************************************************************************************************************\n IMPLEMENTATIONS\n***************************************************************************************************************************/\nexport const port: IssueDetector = {\n name: 'port-detector',\n\n detect(ctx): DetectionCandidate | null {\n const rules = [\n { pattern: /EADDRINUSE/i, weight: 50, label: 'EADDRINUSE' },\n { pattern: /address already in use/i, weight: 45, label: 'address already in use' },\n { pattern: /bind failed/i, weight: 35, label: 'bind failed' }\n ];\n\n const { score, matchedPatterns, confidenceReasons } = runPatternRules(ctx.normalized, rules);\n\n if (score < 40) return null;\n\n return {\n detector: this.name,\n type: 'port_in_use',\n title: 'Port already in use',\n category: 'network',\n score,\n confidence: scoreToConfidence(score),\n specificity: 3,\n matchedPatterns,\n confidenceReasons,\n evidence: pickEvidence(ctx.normalized, [\n /EADDRINUSE/i,\n /address already in use/i,\n /bind failed/i\n ]),\n summary: 'The process tried to bind to a port that is already occupied.'\n };\n }\n};\n","/**************************************************************************************************************************\n Copyright (c) 2026\n\n Name: tls.ts\n Author: Harikrishnan Gangadharan\n Comments:\n\n/**************************************************************************************************************************\n IMPORTS\n***************************************************************************************************************************/\nimport { runPatternRules } from '@/detectors/shared/rules';\nimport { pickEvidence } from '@/detectors/shared/evidence';\nimport { scoreToConfidence } from '@/detectors/shared/confidence';\n\n/**************************************************************************************************************************\n IMPLEMENTATIONS\n***************************************************************************************************************************/\nexport const tls: IssueDetector = {\n name: 'tls-detector',\n\n detect(ctx): DetectionCandidate | null {\n const rules = [\n { pattern: /\\bcertificate verify failed\\b/i, weight: 50, label: 'certificate verify failed' },\n { pattern: /\\bself signed certificate\\b/i, weight: 45, label: 'self signed certificate' },\n { pattern: /\\bSSL routines\\b/i, weight: 35, label: 'SSL routines' },\n {\n pattern: /\\bUNABLE_TO_VERIFY_LEAF_SIGNATURE\\b/i,\n weight: 45,\n label: 'UNABLE_TO_VERIFY_LEAF_SIGNATURE'\n },\n { pattern: /\\bCERT_HAS_EXPIRED\\b/i, weight: 45, label: 'CERT_HAS_EXPIRED' },\n { pattern: /\\bTLS\\b/i, weight: 15, label: 'TLS' }\n ];\n\n const { score, matchedPatterns, confidenceReasons } = runPatternRules(ctx.normalized, rules);\n\n if (score < 40) return null;\n\n return {\n detector: this.name,\n type: 'tls_certificate_error',\n title: 'TLS or certificate validation error',\n category: 'security',\n score,\n confidence: scoreToConfidence(score),\n specificity: 4,\n matchedPatterns,\n confidenceReasons,\n evidence: pickEvidence(ctx.normalized, [\n /\\bcertificate verify failed\\b/i,\n /\\bself signed certificate\\b/i,\n /\\bSSL routines\\b/i,\n /\\bUNABLE_TO_VERIFY_LEAF_SIGNATURE\\b/i,\n /\\bCERT_HAS_EXPIRED\\b/i\n ]),\n summary: 'The application failed a TLS handshake or certificate validation step.'\n };\n }\n};\n","/**************************************************************************************************************************\n Copyright (c) 2026\n\n Name: timeout.ts\n Author: Harikrishnan Gangadharan\n Comments: \n\n/**************************************************************************************************************************\n IMPORTS\n***************************************************************************************************************************/\nimport { runPatternRules } from '@/detectors/shared/rules';\nimport { pickEvidence } from '@/detectors/shared/evidence';\nimport { scoreToConfidence } from '@/detectors/shared/confidence';\n\n/**************************************************************************************************************************\n IMPLEMENTATIONS\n***************************************************************************************************************************/\nexport const timeout: IssueDetector = {\n name: 'timeout-detector',\n\n detect(ctx): DetectionCandidate | null {\n const rules = [\n { pattern: /\\bETIMEDOUT\\b/i, weight: 50, label: 'ETIMEDOUT' },\n { pattern: /\\btimeout\\b/i, weight: 35, label: 'timeout' },\n { pattern: /\\bConnection timed out\\b/i, weight: 45, label: 'Connection timed out' },\n { pattern: /\\boperation timed out\\b/i, weight: 40, label: 'operation timed out' },\n { pattern: /\\bnetwork is unreachable\\b/i, weight: 40, label: 'network is unreachable' },\n { pattern: /\\brequest timed out\\b/i, weight: 40, label: 'request timed out' }\n ];\n\n const { score, matchedPatterns, confidenceReasons } = runPatternRules(ctx.normalized, rules);\n\n if (score < 40) return null;\n\n return {\n detector: this.name,\n type: 'network_timeout',\n title: 'Network timeout or unreachable service',\n category: 'network',\n score,\n confidence: scoreToConfidence(score),\n specificity: 3,\n matchedPatterns,\n confidenceReasons,\n evidence: pickEvidence(ctx.normalized, [\n /\\bETIMEDOUT\\b/i,\n /\\btimeout\\b/i,\n /\\bConnection timed out\\b/i,\n /\\boperation timed out\\b/i,\n /\\bnetwork is unreachable\\b/i,\n /\\brequest timed out\\b/i\n ]),\n summary: 'The application could not reach the target service in time.'\n };\n }\n};\n","/**************************************************************************************************************************\n Copyright (c) 2026\n\n Name: nginx.ts\n Author: Harikrishnan Gangadharan\n Comments: \n\n/**************************************************************************************************************************\n IMPORTS\n***************************************************************************************************************************/\nimport { runPatternRules } from '@/detectors/shared/rules';\nimport { pickEvidence } from '@/detectors/shared/evidence';\nimport { scoreToConfidence } from '@/detectors/shared/confidence';\n\n/**************************************************************************************************************************\n IMPLEMENTATIONS\n***************************************************************************************************************************/\nexport const nginx: IssueDetector = {\n name: 'nginx-detector',\n\n detect(ctx): DetectionCandidate | null {\n const rules = [\n { pattern: /502 Bad Gateway/i, weight: 45, label: '502 Bad Gateway' },\n { pattern: /connect\\(\\) failed/i, weight: 40, label: 'connect() failed' },\n {\n pattern: /upstream prematurely closed connection/i,\n weight: 40,\n label: 'upstream prematurely closed connection'\n },\n { pattern: /\\bnginx\\b/i, weight: 15, label: 'nginx' }\n ];\n\n const { score, matchedPatterns, confidenceReasons } = runPatternRules(ctx.normalized, rules);\n\n if (score < 40) return null;\n\n return {\n detector: this.name,\n type: 'nginx_upstream_failure',\n title: 'Nginx upstream failure',\n category: 'proxy',\n score,\n confidence: scoreToConfidence(score),\n specificity: 4,\n matchedPatterns,\n confidenceReasons,\n evidence: pickEvidence(ctx.normalized, [\n /502 Bad Gateway/i,\n /connect\\(\\) failed/i,\n /upstream prematurely closed connection/i,\n /nginx/i\n ]),\n summary: 'Nginx could not successfully communicate with the upstream application.'\n };\n }\n};\n","/**************************************************************************************************************************\n Copyright (c) 2026\n\n Name: file.ts\n Author: Harikrishnan Gangadharan\n Comments: \n\n/**************************************************************************************************************************\n IMPORTS\n***************************************************************************************************************************/\nimport { runPatternRules } from '@/detectors/shared/rules';\nimport { pickEvidence } from '@/detectors/shared/evidence';\nimport { scoreToConfidence } from '@/detectors/shared/confidence';\n\n/**************************************************************************************************************************\n IMPLEMENTATIONS\n***************************************************************************************************************************/\nexport const file: IssueDetector = {\n name: 'file-detector',\n\n detect(ctx): DetectionCandidate | null {\n const rules = [\n { pattern: /ENOENT/i, weight: 45, label: 'ENOENT' },\n { pattern: /no such file or directory/i, weight: 40, label: 'no such file or directory' },\n { pattern: /Cannot find module/i, weight: 35, label: 'Cannot find module' }\n ];\n\n const { score, matchedPatterns, confidenceReasons } = runPatternRules(ctx.normalized, rules);\n\n if (score < 40) return null;\n\n return {\n detector: this.name,\n type: 'missing_file',\n title: 'Missing file or path',\n category: 'filesystem',\n score,\n confidence: scoreToConfidence(score),\n specificity: 3,\n matchedPatterns,\n confidenceReasons,\n evidence: pickEvidence(ctx.normalized, [\n /ENOENT/i,\n /no such file or directory/i,\n /Cannot find module/i\n ]),\n summary: 'The application tried to access a file, module, or path that does not exist.'\n };\n }\n};\n","/**************************************************************************************************************************\n Copyright (c) 2026\n\n Name: oom.ts\n Author: Harikrishnan Gangadharan\n Comments:\n\n/**************************************************************************************************************************\n IMPORTS\n***************************************************************************************************************************/\nimport { runPatternRules } from '@/detectors/shared/rules';\nimport { pickEvidence } from '@/detectors/shared/evidence';\nimport { scoreToConfidence } from '@/detectors/shared/confidence';\n\n/**************************************************************************************************************************\n IMPLEMENTATIONS\n***************************************************************************************************************************/\nexport const oom: IssueDetector = {\n name: 'oom-detector',\n\n detect(ctx): DetectionCandidate | null {\n const rules = [\n { pattern: /\\bout of memory\\b/i, weight: 45, label: 'out of memory' },\n {\n pattern: /\\bJavaScript heap out of memory\\b/i,\n weight: 55,\n label: 'JavaScript heap out of memory'\n },\n { pattern: /\\bOOMKilled\\b/i, weight: 55, label: 'OOMKilled' },\n { pattern: /\\bKilled process\\b/i, weight: 40, label: 'Killed process' },\n { pattern: /\\bCannot allocate memory\\b/i, weight: 45, label: 'Cannot allocate memory' }\n ];\n\n const { score, matchedPatterns, confidenceReasons } = runPatternRules(ctx.normalized, rules);\n\n if (score < 40) return null;\n\n return {\n detector: this.name,\n type: 'out_of_memory_error',\n title: 'Out-of-memory or memory pressure failure',\n category: 'runtime',\n score,\n confidence: scoreToConfidence(score),\n specificity: 4,\n matchedPatterns,\n confidenceReasons,\n evidence: pickEvidence(ctx.normalized, [\n /\\bout of memory\\b/i,\n /\\bJavaScript heap out of memory\\b/i,\n /\\bOOMKilled\\b/i,\n /\\bKilled process\\b/i,\n /\\bCannot allocate memory\\b/i\n ]),\n summary: 'The process or container exhausted available memory.'\n };\n }\n};\n","/**************************************************************************************************************************\n Copyright (c) 2026\n\n Name: index.ts\n Author: Harikrishnan Gangadharan\n Comments: \n\n/**************************************************************************************************************************\n IMPORTS\n***************************************************************************************************************************/\nimport { docker } from '@/detectors/container/docker';\nimport { kubernetes } from '@/detectors/container/kubernetes';\nimport { mongodb } from '@/detectors/database/mongodb';\nimport { mysql } from '@/detectors/database/mysql';\nimport { redis } from '@/detectors/database/redis';\nimport { postgres } from '@/detectors/database/postgres';\nimport { kafka } from '@/detectors/messaging/kafka';\nimport { rabbitmq } from '@/detectors/messaging/rabbitmq';\nimport { dns } from '@/detectors/network/dns';\nimport { port } from '@/detectors/network/port';\nimport { tls } from '@/detectors/network/tls';\nimport { timeout } from '@/detectors/network/timeout';\nimport { nginx } from '@/detectors/proxy/nginx';\nimport { file } from '@/detectors/runtime/file';\nimport { oom } from '@/detectors/runtime/oom';\n\n/**************************************************************************************************************************\n EXPORTS\n***************************************************************************************************************************/\nexport const detectors: IssueDetector[] = [\n docker,\n kubernetes,\n redis,\n postgres,\n mysql,\n mongodb,\n kafka,\n rabbitmq,\n nginx,\n port,\n timeout,\n tls,\n dns,\n file,\n oom\n];\n","/**************************************************************************************************************************\n Copyright (c) 2026\n\n Name: detect.ts\n Author: Harikrishnan Gangadharan\n Comments: \n\n/**************************************************************************************************************************\n IMPORTS\n***************************************************************************************************************************/\nimport { detectors } from '@/detectors';\n\n/**************************************************************************************************************************\n TYPES / GLOBAL DEFINITIONS\n***************************************************************************************************************************/\nconst getFallbackCandidate = (ctx: DetectionContext): DetectionCandidate => ({\n detector: 'unknown',\n type: 'unknown',\n title: 'Unknown issue',\n category: 'unknown',\n confidence: 0.3,\n score: 0,\n specificity: 0,\n evidence: ctx.lines.slice(0, 5),\n matchedPatterns: [],\n summary: 'No known issue pattern matched strongly enough.',\n confidenceReasons: []\n});\n\n/**************************************************************************************************************************\n IMPLEMENTATIONS\n***************************************************************************************************************************/\nexport function detectIssue(ctx: DetectionContext): DetectionCandidate {\n const matches = detectors\n .map((detector) => detector.detect(ctx))\n .filter((candidate): candidate is DetectionCandidate => candidate !== null);\n\n if (matches.length === 0) {\n return getFallbackCandidate(ctx);\n }\n\n const best = matches.sort((a, b) => {\n if (b.score !== a.score) return b.score - a.score;\n if (b.specificity !== a.specificity) return b.specificity - a.specificity;\n return b.confidence - a.confidence;\n })[0];\n\n if (!best) {\n return getFallbackCandidate(ctx);\n }\n\n return best;\n}\n","/**************************************************************************************************************************\n Copyright (c) 2026\n\n Name: context.ts\n Author: Harikrishnan Gangadharan\n Comments:\n\n/**************************************************************************************************************************\n IMPORTS\n***************************************************************************************************************************/\nimport path from 'node:path';\nimport { readOptionalTextFile } from '@/utils/file';\n\n/**************************************************************************************************************************\n TYPES / GLOBAL DEFINITIONS\n***************************************************************************************************************************/\nfunction pushHint(hints: ContextHint[], key: string, value: string, source: string): void {\n hints.push({ key, value, source });\n}\n\nfunction parseEnvContent(content: string, source: string, hints: ContextHint[]): void {\n const env = new Map<string, string>();\n\n for (const rawLine of content.split('\\n')) {\n const line = rawLine.trim();\n if (!line || line.startsWith('#')) continue;\n\n const separatorIndex = line.indexOf('=');\n if (separatorIndex === -1) continue;\n\n const key = line.slice(0, separatorIndex).trim();\n const value = line\n .slice(separatorIndex + 1)\n .trim()\n .replace(/^['\"]|['\"]$/g, '');\n if (!key) continue;\n env.set(key, value);\n }\n\n for (const trackedKey of [\n 'REDIS_HOST',\n 'REDIS_PORT',\n 'REDIS_URL',\n 'DB_HOST',\n 'DB_PORT',\n 'DB_NAME',\n 'MYSQL_HOST',\n 'MONGO_URL',\n 'KAFKA_BROKERS',\n 'RABBITMQ_URL'\n ]) {\n const value = env.get(trackedKey);\n if (value) {\n pushHint(hints, trackedKey, value, source);\n }\n }\n}\n\n// This Compose parser is intentionally shallow: it extracts enough structure to improve detection\n// without trying to fully implement YAML parsing inside the CLI runtime.\nfunction parseComposeContent(content: string, source: string, hints: ContextHint[]): void {\n const serviceMatches = [...content.matchAll(/^\\s{2}([a-zA-Z0-9_-]+):\\s*$/gm)];\n for (const match of serviceMatches) {\n const service = match[1];\n if (service) {\n pushHint(hints, 'docker_service', service, source);\n }\n }\n\n const portMatches = [...content.matchAll(/^\\s*-\\s*\"?(?<host>\\d+):(?<container>\\d+)\"?\\s*$/gm)];\n for (const match of portMatches) {\n const host = match.groups?.host;\n const container = match.groups?.container;\n if (host && container) {\n pushHint(hints, 'docker_port_mapping', `${host}:${container}`, source);\n }\n }\n}\n\nfunction parseKubernetesContent(content: string, source: string, hints: ContextHint[]): void {\n const kindMatch = content.match(/^\\s*kind:\\s*([A-Za-z]+)/m);\n if (kindMatch?.[1]) {\n pushHint(hints, 'k8s_kind', kindMatch[1], source);\n }\n\n const nameMatch = content.match(/^\\s*name:\\s*([a-zA-Z0-9._-]+)/m);\n if (nameMatch?.[1]) {\n pushHint(hints, 'k8s_name', nameMatch[1], source);\n }\n\n const imageMatches = [...content.matchAll(/^\\s*image:\\s*([^\\s]+)/gm)];\n for (const match of imageMatches) {\n if (match[1]) {\n pushHint(hints, 'k8s_image', match[1], source);\n }\n }\n}\n\nfunction parseJsonConfigContent(content: string, source: string, hints: ContextHint[]): void {\n try {\n const parsed = JSON.parse(content) as Record<string, unknown>;\n\n for (const [key, value] of Object.entries(parsed)) {\n if (typeof value !== 'string' && typeof value !== 'number') {\n continue;\n }\n\n if (/(redis|db|mysql|mongo|kafka|rabbit|tls|ssl)/i.test(key)) {\n pushHint(hints, `config_${key}`, String(value), source);\n }\n }\n } catch {\n // Ignore invalid JSON files so optional context never blocks analysis.\n }\n}\n\n/**************************************************************************************************************************\n IMPLEMENTATIONS\n***************************************************************************************************************************/\nexport async function loadContextHints(files: string[]): Promise<ContextHint[]> {\n const hints: ContextHint[] = [];\n\n for (const file of files) {\n const content = await readOptionalTextFile(file);\n if (!content) continue;\n\n const source = path.basename(file);\n const lowerSource = source.toLowerCase();\n\n parseEnvContent(content, source, hints);\n\n if (\n lowerSource.includes('compose') ||\n /^\\s*services:\\s*$/m.test(content) ||\n /^\\s{2}[a-zA-Z0-9_-]+:\\s*$/m.test(content)\n ) {\n parseComposeContent(content, source, hints);\n }\n\n if (/^\\s*apiVersion:\\s*/m.test(content) && /^\\s*kind:\\s*/m.test(content)) {\n parseKubernetesContent(content, source, hints);\n }\n\n if (lowerSource.endsWith('.json')) {\n parseJsonConfigContent(content, source, hints);\n }\n }\n\n return hints;\n}\n","/**************************************************************************************************************************\n Copyright (c) 2026\n\n Name: file.ts\n Author: Harikrishnan Gangadharan\n Comments: \n\n/**************************************************************************************************************************\n IMPORTS\n***************************************************************************************************************************/\nimport fs from 'node:fs/promises';\n\n/**************************************************************************************************************************\n IMPLEMENTATIONS\n***************************************************************************************************************************/\nexport async function readTextFile(path: string): Promise<string> {\n return fs.readFile(path, 'utf8');\n}\n\nexport async function readOptionalTextFile(path: string): Promise<string | null> {\n try {\n return await fs.readFile(path, 'utf8');\n } catch {\n return null;\n }\n}\n\nexport async function readFromStdin(): Promise<string> {\n const chunks: Buffer[] = [];\n\n return new Promise((resolve, reject) => {\n process.stdin.on('data', (chunk) => chunks.push(Buffer.from(chunk)));\n process.stdin.on('end', () => resolve(Buffer.concat(chunks).toString('utf8')));\n process.stdin.on('error', reject);\n });\n}\n","/**************************************************************************************************************************\n Copyright (c) 2026\n\n Name: platform.ts\n Author: Harikrishnan Gangadharan\n Comments:\n\n/**************************************************************************************************************************\n IMPLEMENTATIONS\n***************************************************************************************************************************/\nexport function isWindowsPlatform(platform = process.platform): boolean {\n return platform === 'win32';\n}\n\n// Keep user-facing debug commands practical on both Linux and Windows shells.\nexport function pickPlatformCommands(\n unixCommands: string[],\n windowsCommands: string[],\n platform = process.platform\n): string[] {\n return isWindowsPlatform(platform) ? windowsCommands : unixCommands;\n}\n","/**************************************************************************************************************************\n Copyright (c) 2026\n\n Name: explain.ts\n Author: Harikrishnan Gangadharan\n Comments:\n\n/**************************************************************************************************************************\n IMPORTS\n***************************************************************************************************************************/\nimport { pickPlatformCommands } from '@/utils/platform';\n\n/**************************************************************************************************************************\n TYPES / GLOBAL DEFINITIONS\n***************************************************************************************************************************/\nconst withOptionalMetadata = (\n issue: DetectionCandidate\n): Partial<Pick<ExplanationResult, 'metadata'>> => {\n return issue.metadata ? { metadata: issue.metadata } : {};\n};\n\nconst withConfidenceReasons = (\n issue: DetectionCandidate\n): Pick<ExplanationResult, 'confidenceReasons'> => ({\n confidenceReasons: issue.confidenceReasons ?? []\n});\n\nfunction platformDebugCommands(unixCommands: string[], windowsCommands: string[]): string[] {\n return pickPlatformCommands(unixCommands, windowsCommands);\n}\n\n/**************************************************************************************************************************\n IMPLEMENTATIONS\n***************************************************************************************************************************/\nexport function explainIssue(issue: DetectionCandidate): ExplanationResult {\n switch (issue.type) {\n case 'redis_connection_refused':\n return {\n issueType: issue.type,\n title: issue.title,\n category: issue.category,\n confidence: issue.confidence,\n explanation:\n 'Your application tried to connect to Redis, but no service accepted the connection on the target host and port.',\n evidence: issue.evidence,\n likelyCauses: [\n 'Redis service is not running',\n 'Wrong Redis host or port configuration',\n 'Application is running inside Docker and is incorrectly using localhost'\n ],\n suggestedFixes: [\n 'Verify Redis is running',\n 'Check REDIS_HOST, REDIS_PORT, or REDIS_URL',\n 'If using Docker Compose, use the service name instead of localhost'\n ],\n debugCommands: platformDebugCommands(\n ['docker ps', 'docker logs redis', 'printenv | grep REDIS'],\n ['docker ps', 'docker logs redis', 'Get-ChildItem Env:REDIS*']\n ),\n ...withOptionalMetadata(issue),\n ...withConfidenceReasons(issue)\n };\n\n case 'redis_auth_error':\n return {\n issueType: issue.type,\n title: issue.title,\n category: issue.category,\n confidence: issue.confidence,\n explanation:\n 'The application successfully reached Redis, but authentication failed due to wrong or missing credentials.',\n evidence: issue.evidence,\n likelyCauses: [\n 'Wrong Redis password',\n 'Missing password in application configuration',\n 'Redis ACL or user mismatch'\n ],\n suggestedFixes: [\n 'Verify Redis password in environment variables',\n 'Check Redis ACL settings',\n 'Confirm the app uses the expected Redis user and password'\n ],\n debugCommands: platformDebugCommands(\n ['printenv | grep REDIS', 'docker exec -it redis redis-cli', 'docker logs redis'],\n ['Get-ChildItem Env:REDIS*', 'docker exec -it redis redis-cli', 'docker logs redis']\n ),\n ...withOptionalMetadata(issue),\n ...withConfidenceReasons(issue)\n };\n\n case 'postgres_connection_error':\n return {\n issueType: issue.type,\n title: issue.title,\n category: issue.category,\n confidence: issue.confidence,\n explanation:\n 'The application encountered a PostgreSQL connection, authentication, or target database problem.',\n evidence: issue.evidence,\n likelyCauses: [\n 'Incorrect username or password',\n 'Target database does not exist',\n 'PostgreSQL service is unavailable'\n ],\n suggestedFixes: [\n 'Verify DB_HOST, DB_PORT, DB_USER, DB_PASSWORD, and DB_NAME',\n 'Confirm PostgreSQL is running',\n 'Check if the database exists and the user has access'\n ],\n debugCommands: platformDebugCommands(\n ['docker ps', 'docker logs postgres', 'printenv | grep DB_'],\n ['docker ps', 'docker logs postgres', 'Get-ChildItem Env:DB*']\n ),\n ...withConfidenceReasons(issue)\n };\n\n case 'mysql_connection_error':\n return {\n issueType: issue.type,\n title: issue.title,\n category: issue.category,\n confidence: issue.confidence,\n explanation:\n 'The application encountered a MySQL connection, authentication, or target database problem.',\n evidence: issue.evidence,\n likelyCauses: [\n 'Incorrect MySQL credentials',\n 'Target database does not exist',\n 'MySQL service is unavailable or unreachable'\n ],\n suggestedFixes: [\n 'Verify MySQL host, port, user, password, and database configuration',\n 'Confirm the MySQL service is reachable from the application runtime',\n 'Check broker or container logs for startup failures'\n ],\n debugCommands: platformDebugCommands(\n ['docker ps', 'docker logs mysql', 'printenv | grep MYSQL'],\n ['docker ps', 'docker logs mysql', 'Get-ChildItem Env:MYSQL*']\n ),\n ...withConfidenceReasons(issue)\n };\n\n case 'mongodb_connection_error':\n return {\n issueType: issue.type,\n title: issue.title,\n category: issue.category,\n confidence: issue.confidence,\n explanation:\n 'The application could not authenticate to MongoDB or establish a healthy connection to the target server.',\n evidence: issue.evidence,\n likelyCauses: [\n 'Wrong MongoDB credentials',\n 'MongoDB is unavailable or unreachable',\n 'Replica set or network configuration is incorrect'\n ],\n suggestedFixes: [\n 'Verify MongoDB URI, host, and credentials',\n 'Confirm MongoDB is listening on the expected interface and port',\n 'Check application and database logs for topology or auth failures'\n ],\n debugCommands: platformDebugCommands(\n ['docker ps', 'docker logs mongodb', 'printenv | grep MONGO'],\n ['docker ps', 'docker logs mongodb', 'Get-ChildItem Env:MONGO*']\n ),\n ...withConfidenceReasons(issue)\n };\n\n case 'dns_resolution_error':\n return {\n issueType: issue.type,\n title: issue.title,\n category: issue.category,\n confidence: issue.confidence,\n explanation: 'The application could not resolve the configured hostname to an IP address.',\n evidence: issue.evidence,\n likelyCauses: [\n 'Wrong hostname in environment variables',\n 'Container or service name mismatch',\n 'DNS or network issue'\n ],\n suggestedFixes: [\n 'Verify the hostname value',\n 'Check Docker Compose service names',\n 'Test DNS resolution from the running environment'\n ],\n debugCommands: platformDebugCommands(\n ['printenv', 'nslookup <hostname>', 'ping <hostname>'],\n ['Get-ChildItem Env:', 'Resolve-DnsName <hostname>', 'Test-NetConnection <hostname>']\n ),\n ...withConfidenceReasons(issue)\n };\n\n case 'network_timeout':\n return {\n issueType: issue.type,\n title: issue.title,\n category: issue.category,\n confidence: issue.confidence,\n explanation:\n 'The application could not reach the target service within the allowed time window, or the network path was unavailable.',\n evidence: issue.evidence,\n likelyCauses: [\n 'Target service is slow or down',\n 'Firewall or network routing issue',\n 'Wrong host or port causing connection attempts to hang'\n ],\n suggestedFixes: [\n 'Verify the target service is healthy',\n 'Check connectivity from the current runtime environment',\n 'Validate the configured host and port'\n ],\n debugCommands: platformDebugCommands(\n ['curl -v <target>', 'ping <hostname>', 'ss -ltnp'],\n ['curl.exe -v <target>', 'Test-NetConnection <hostname>', 'netstat -ano']\n ),\n ...withConfidenceReasons(issue)\n };\n\n case 'tls_certificate_error':\n return {\n issueType: issue.type,\n title: issue.title,\n category: issue.category,\n confidence: issue.confidence,\n explanation:\n 'The application reached the remote endpoint, but TLS negotiation or certificate validation failed.',\n evidence: issue.evidence,\n likelyCauses: [\n 'Certificate chain is incomplete or expired',\n 'Self-signed or untrusted certificate',\n 'Hostname mismatch between certificate and configured target'\n ],\n suggestedFixes: [\n 'Verify the target certificate chain and expiry',\n 'Confirm the configured hostname matches the certificate subject',\n 'Install or trust the correct CA bundle in the runtime environment'\n ],\n debugCommands: platformDebugCommands(\n ['openssl s_client -connect <host>:443 -servername <host>', 'curl -v https://<host>'],\n ['curl.exe -v https://<host>', 'Test-NetConnection <host> -Port 443']\n ),\n ...withOptionalMetadata(issue),\n ...withConfidenceReasons(issue)\n };\n\n case 'port_in_use':\n return {\n issueType: issue.type,\n title: issue.title,\n category: issue.category,\n confidence: issue.confidence,\n explanation:\n 'The process tried to bind to a port that is already being used by another process or service.',\n evidence: issue.evidence,\n likelyCauses: [\n 'Another app is already using the same port',\n 'A previous process did not exit cleanly',\n 'Multiple containers are mapped to the same host port'\n ],\n suggestedFixes: [\n 'Find and stop the process using the port',\n 'Change the application port',\n 'Check Docker port mappings'\n ],\n debugCommands: platformDebugCommands(\n ['lsof -i :3000', 'ss -ltnp', 'docker ps'],\n ['netstat -ano | findstr :3000', 'Get-Process -Id <pid>', 'docker ps']\n ),\n ...withConfidenceReasons(issue)\n };\n\n case 'nginx_upstream_failure':\n return {\n issueType: issue.type,\n title: issue.title,\n category: issue.category,\n confidence: issue.confidence,\n explanation:\n 'Nginx could not successfully communicate with the upstream service, so it returned a gateway error.',\n evidence: issue.evidence,\n likelyCauses: [\n 'Upstream container is down',\n 'Wrong upstream host or port',\n 'Application crashed or closed the connection'\n ],\n suggestedFixes: [\n 'Verify the upstream container is running',\n 'Check Nginx upstream configuration',\n 'Inspect application logs for crashes'\n ],\n debugCommands: platformDebugCommands(\n ['docker ps', 'docker logs nginx', 'docker logs <app-container>'],\n ['docker ps', 'docker logs nginx', 'docker logs <app-container>']\n ),\n ...withConfidenceReasons(issue)\n };\n\n case 'docker_healthcheck_failed':\n return {\n issueType: issue.type,\n title: issue.title,\n category: issue.category,\n confidence: issue.confidence,\n explanation:\n 'The container failed its health check, which usually means the process started but is not ready or not responding correctly.',\n evidence: issue.evidence,\n likelyCauses: [\n 'Application startup is failing internally',\n 'Health check command is incorrect',\n 'Dependency required by the app is unavailable'\n ],\n suggestedFixes: [\n 'Inspect container logs for startup failures',\n 'Verify the health check command and endpoint',\n 'Check dependencies like database or Redis availability'\n ],\n debugCommands: platformDebugCommands(\n ['docker ps', 'docker inspect <container>', 'docker logs <container>'],\n ['docker ps', 'docker inspect <container>', 'docker logs <container>']\n ),\n ...withConfidenceReasons(issue)\n };\n\n case 'docker_restart_loop':\n return {\n issueType: issue.type,\n title: issue.title,\n category: issue.category,\n confidence: issue.confidence,\n explanation:\n 'The container is repeatedly crashing and restarting, which indicates the main process exits shortly after startup.',\n evidence: issue.evidence,\n likelyCauses: [\n 'Application crash during startup',\n 'Missing environment variables or configuration',\n 'Invalid command, entrypoint, or mounted file'\n ],\n suggestedFixes: [\n 'Inspect container logs',\n 'Check required environment variables',\n 'Verify the image entrypoint and mounted configuration files'\n ],\n debugCommands: platformDebugCommands(\n ['docker ps -a', 'docker logs <container>', 'docker inspect <container>'],\n ['docker ps -a', 'docker logs <container>', 'docker inspect <container>']\n ),\n ...withConfidenceReasons(issue)\n };\n\n case 'docker_container_failure':\n return {\n issueType: issue.type,\n title: issue.title,\n category: issue.category,\n confidence: issue.confidence,\n explanation: 'A container-level runtime failure was detected in the logs.',\n evidence: issue.evidence,\n likelyCauses: [\n 'Containerized process exited unexpectedly',\n 'Dependency or configuration failure inside the container',\n 'Resource constraints or image/runtime issues'\n ],\n suggestedFixes: [\n 'Inspect container logs',\n 'Check image, command, and environment variables',\n 'Verify external dependencies used by the container'\n ],\n debugCommands: platformDebugCommands(\n ['docker ps -a', 'docker logs <container>', 'docker inspect <container>'],\n ['docker ps -a', 'docker logs <container>', 'docker inspect <container>']\n ),\n ...withConfidenceReasons(issue)\n };\n\n case 'kubernetes_workload_failure':\n return {\n issueType: issue.type,\n title: issue.title,\n category: issue.category,\n confidence: issue.confidence,\n explanation:\n 'A Kubernetes workload failed due to scheduling, image retrieval, or repeated restart problems.',\n evidence: issue.evidence,\n likelyCauses: [\n 'Image cannot be pulled from the configured registry',\n 'Cluster lacks resources or scheduling constraints are unsatisfied',\n 'The container starts and crashes repeatedly'\n ],\n suggestedFixes: [\n 'Inspect pod events and container state',\n 'Verify image name, registry credentials, and resource requests',\n 'Check workload logs for startup failures'\n ],\n debugCommands: platformDebugCommands(\n [\n 'kubectl describe pod <pod-name>',\n 'kubectl logs <pod-name> --previous',\n 'kubectl get events --sort-by=.metadata.creationTimestamp'\n ],\n [\n 'kubectl describe pod <pod-name>',\n 'kubectl logs <pod-name> --previous',\n 'kubectl get events --sort-by=.metadata.creationTimestamp'\n ]\n ),\n ...withOptionalMetadata(issue),\n ...withConfidenceReasons(issue)\n };\n\n case 'missing_file':\n return {\n issueType: issue.type,\n title: issue.title,\n category: issue.category,\n confidence: issue.confidence,\n explanation:\n 'The application tried to access a file, module, or directory that does not exist in the current environment.',\n evidence: issue.evidence,\n likelyCauses: [\n 'Wrong relative path',\n 'Missing configuration file',\n 'Build output path is incorrect'\n ],\n suggestedFixes: [\n 'Verify the file path',\n 'Check whether the file exists in the runtime environment',\n 'Confirm volume mounts or build output directories'\n ],\n debugCommands: platformDebugCommands(\n ['pwd', 'ls -la', 'find . -maxdepth 3 -type f'],\n [\n 'Get-Location',\n 'Get-ChildItem -Force',\n 'Get-ChildItem -Recurse -File | Select-Object -First 20'\n ]\n ),\n ...withConfidenceReasons(issue)\n };\n\n case 'out_of_memory_error':\n return {\n issueType: issue.type,\n title: issue.title,\n category: issue.category,\n confidence: issue.confidence,\n explanation:\n 'The process or container exhausted available memory and was terminated or became unstable.',\n evidence: issue.evidence,\n likelyCauses: [\n 'Memory leak or unexpectedly large workload',\n 'Container or host memory limits are too low',\n 'Heap limits are smaller than the workload requires'\n ],\n suggestedFixes: [\n 'Inspect memory usage and recent workload size changes',\n 'Increase memory limits or tune heap settings',\n 'Review application code for unbounded growth or caching'\n ],\n debugCommands: platformDebugCommands(\n ['docker stats', 'free -m', 'dmesg | tail'],\n [\n 'docker stats',\n 'Get-Counter \"\\\\Memory\\\\Available MBytes\"',\n 'Get-Process | Sort-Object WS -Descending | Select-Object -First 10'\n ]\n ),\n ...withConfidenceReasons(issue)\n };\n\n case 'kafka_broker_error':\n return {\n issueType: issue.type,\n title: issue.title,\n category: issue.category,\n confidence: issue.confidence,\n explanation:\n 'The application could not reach a healthy Kafka broker or partition leader in time.',\n evidence: issue.evidence,\n likelyCauses: [\n 'Kafka broker is unavailable',\n 'Wrong bootstrap server configuration',\n 'Cluster leadership or networking issues'\n ],\n suggestedFixes: [\n 'Verify the configured bootstrap servers',\n 'Check Kafka broker health and topic partition state',\n 'Review network connectivity between the app and brokers'\n ],\n debugCommands: platformDebugCommands(\n [\n 'docker logs kafka',\n 'kafka-topics.sh --bootstrap-server <broker> --list',\n 'printenv | grep KAFKA'\n ],\n [\n 'docker logs kafka',\n 'Get-ChildItem Env:KAFKA*',\n 'Test-NetConnection <broker> -Port 9092'\n ]\n ),\n ...withConfidenceReasons(issue)\n };\n\n case 'rabbitmq_connection_error':\n return {\n issueType: issue.type,\n title: issue.title,\n category: issue.category,\n confidence: issue.confidence,\n explanation:\n 'The application could not authenticate to RabbitMQ or establish a healthy AMQP connection.',\n evidence: issue.evidence,\n likelyCauses: [\n 'Wrong broker credentials or virtual host',\n 'RabbitMQ broker is unavailable',\n 'AMQP connectivity is interrupted by network or TLS issues'\n ],\n suggestedFixes: [\n 'Verify RabbitMQ connection URI, credentials, and virtual host',\n 'Check broker availability and queue health',\n 'Confirm the application can reach the broker port from its runtime'\n ],\n debugCommands: platformDebugCommands(\n ['docker logs rabbitmq', 'printenv | grep RABBIT', 'ss -ltnp | grep 5672'],\n [\n 'docker logs rabbitmq',\n 'Get-ChildItem Env:RABBIT*',\n 'Test-NetConnection <broker> -Port 5672'\n ]\n ),\n ...withConfidenceReasons(issue)\n };\n\n default:\n return {\n issueType: issue.type,\n title: issue.title,\n category: issue.category,\n confidence: issue.confidence,\n explanation:\n 'The log did not match any known detector strongly enough yet. More context or additional detectors may be needed.',\n evidence: issue.evidence,\n likelyCauses: ['Unknown'],\n suggestedFixes: [\n 'Inspect the extracted evidence lines',\n 'Pass related config files as context',\n 'Add a new detector for this error pattern'\n ],\n debugCommands: platformDebugCommands(['cat <log-file>'], ['Get-Content <log-file>']),\n ...withConfidenceReasons(issue)\n };\n }\n}\n","{\n \"name\": \"@hkgdevx/logcoz\",\n \"version\": \"0.1.0\",\n \"description\": \"LogCoz is an intelligent CLI for analyzing application and infrastructure logs. It extracts meaningful signals, detects common failure patterns, and provides root-cause explanations with actionable debugging steps — enhanced by optional context from your environment and configuration.\",\n \"license\": \"MIT\",\n \"author\": {\n \"name\": \"Harikrishnan Gangadharan\",\n \"email\": \"hkg1512@gmail.com\",\n \"url\": \"https://www.hkgdev.com\"\n },\n \"type\": \"module\",\n \"bin\": {\n \"logcozcli\": \"dist/cli.js\",\n \"logcoz\": \"dist/cli.js\"\n },\n \"main\": \"./dist/index.js\",\n \"module\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"files\": [\n \"dist\",\n \"README.md\",\n \"LICENSE\"\n ],\n \"engines\": {\n \"node\": \">=20\"\n },\n \"scripts\": {\n \"dev\": \"tsx src/cli.ts\",\n \"build\": \"tsup\",\n \"typecheck\": \"tsc --noEmit\",\n \"lint\": \"eslint .\",\n \"lint:fix\": \"eslint . --fix\",\n \"format\": \"prettier . --write\",\n \"format:check\": \"prettier . --check\",\n \"test\": \"vitest run\",\n \"test:watch\": \"vitest\",\n \"check\": \"pnpm typecheck && pnpm lint && pnpm format:check && pnpm test\",\n \"prepare\": \"husky\"\n },\n \"lint-staged\": {\n \"*.{ts,js,mjs,cjs,json,md,yml,yaml}\": [\n \"prettier --write\"\n ],\n \"*.{ts,js,mjs,cjs}\": [\n \"eslint --fix\"\n ]\n },\n \"publishConfig\": {\n \"access\": \"public\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/hkgdevx/LogCoz.git\"\n },\n \"devDependencies\": {\n \"@changesets/cli\": \"^2.30.0\",\n \"@commitlint/cli\": \"^20.5.0\",\n \"@commitlint/config-conventional\": \"^20.5.0\",\n \"@eslint/js\": \"^9.39.4\",\n \"@types/node\": \"^22.19.15\",\n \"eslint\": \"^9.39.4\",\n \"eslint-import-resolver-typescript\": \"^4.4.4\",\n \"eslint-plugin-import\": \"^2.32.0\",\n \"globals\": \"^17.4.0\",\n \"husky\": \"^9.1.7\",\n \"lint-staged\": \"^16.4.0\",\n \"tsup\": \"^8.5.1\",\n \"tsx\": \"^4.21.0\",\n \"typescript\": \"^5.9.3\",\n \"typescript-eslint\": \"^8.57.1\",\n \"vitest\": \"^4.1.0\"\n },\n \"dependencies\": {\n \"boxen\": \"^8.0.1\",\n \"chalk\": \"^5.6.2\",\n \"commander\": \"^14.0.3\",\n \"openai\": \"^4.104.0\",\n \"ora\": \"^9.3.0\",\n \"strip-ansi\": \"^7.2.0\"\n }\n}\n","/**************************************************************************************************************************\n Copyright (c) 2026\n\n Name: meta.ts\n Author: Harikrishnan Gangadharan\n Comments:\n\n/**************************************************************************************************************************\n IMPORTS\n***************************************************************************************************************************/\nimport packageJson from '../../package.json';\n\n/**************************************************************************************************************************\n EXPORTS\n***************************************************************************************************************************/\nexport const CLI_NAME = 'logcozcli';\nexport const CLI_ALIASES = ['logcoz'] as const;\nexport const CLI_VERSION = packageJson.version;\nexport const JSON_SCHEMA_VERSION = '1.0.0';\n","/**************************************************************************************************************************\n Copyright (c) 2026\n\n Name: exit.ts\n Author: Harikrishnan Gangadharan\n Comments:\n\n/**************************************************************************************************************************\n EXPORTS\n***************************************************************************************************************************/\nexport const EXIT_CODE_SUCCESS = 0;\nexport const EXIT_CODE_RUNTIME_ERROR = 1;\nexport const EXIT_CODE_UNKNOWN_ISSUE = 2;\n","/**************************************************************************************************************************\n Copyright (c) 2026\n\n Name: output.ts\n Author: Harikrishnan Gangadharan\n Comments:\n\n/**************************************************************************************************************************\n IMPORTS\n***************************************************************************************************************************/\nimport { CLI_NAME, CLI_VERSION, JSON_SCHEMA_VERSION } from '@/constants/meta';\nimport { EXIT_CODE_SUCCESS, EXIT_CODE_UNKNOWN_ISSUE } from '@/constants/exit';\n\n/**************************************************************************************************************************\n IMPLEMENTATIONS\n***************************************************************************************************************************/\nexport function createExplainOutputEnvelope(result: ExplanationResult): ExplainOutputEnvelope {\n const exitCode = result.issueType === 'unknown' ? EXIT_CODE_UNKNOWN_ISSUE : EXIT_CODE_SUCCESS;\n\n return {\n schemaVersion: JSON_SCHEMA_VERSION,\n cliName: CLI_NAME,\n cliVersion: CLI_VERSION,\n exitCode,\n status: result.issueType === 'unknown' ? 'unknown' : 'detected',\n result\n };\n}\n\nexport function createCorrelateOutputEnvelope(\n result: CorrelateOutputResult\n): CorrelateOutputEnvelope {\n return {\n schemaVersion: JSON_SCHEMA_VERSION,\n cliName: CLI_NAME,\n cliVersion: CLI_VERSION,\n exitCode: EXIT_CODE_SUCCESS,\n status: 'correlated',\n result\n };\n}\n","/**************************************************************************************************************************\n Copyright (c) 2026\n\n Name: llm.ts\n Author: Harikrishnan Gangadharan\n Comments:\n\n/**************************************************************************************************************************\n IMPORTS\n***************************************************************************************************************************/\nimport OpenAI from 'openai';\n\n/**************************************************************************************************************************\n TYPES / GLOBAL DEFINITIONS\n***************************************************************************************************************************/\ninterface HttpLlmResponse {\n explanation?: string;\n likelyCauses?: string[];\n suggestedFixes?: string[];\n debugCommands?: string[];\n warnings?: string[];\n}\n\ninterface LlmRefinementPayload {\n explanation?: unknown;\n likelyCauses?: unknown;\n suggestedFixes?: unknown;\n debugCommands?: unknown;\n warnings?: unknown;\n}\n\nfunction sanitizeStringArray(value: unknown): string[] | undefined {\n if (!Array.isArray(value)) return undefined;\n\n const sanitized = value\n .filter((item): item is string => typeof item === 'string')\n .map((item) => item.trim())\n .filter(Boolean);\n\n return sanitized.length > 0 ? sanitized : undefined;\n}\n\nfunction mergeRefinementPayload(\n base: ExplanationResult,\n payload: LlmRefinementPayload\n): ExplanationResult {\n return {\n ...base,\n explanation:\n typeof payload.explanation === 'string' && payload.explanation.trim()\n ? payload.explanation.trim()\n : base.explanation,\n likelyCauses: sanitizeStringArray(payload.likelyCauses) ?? base.likelyCauses,\n suggestedFixes: sanitizeStringArray(payload.suggestedFixes) ?? base.suggestedFixes,\n debugCommands: sanitizeStringArray(payload.debugCommands) ?? base.debugCommands,\n warnings: [...(base.warnings ?? []), ...(sanitizeStringArray(payload.warnings) ?? [])]\n };\n}\n\nfunction buildOpenAiPrompt(input: LlmExplainInput, base: ExplanationResult): string {\n return JSON.stringify(\n {\n task: 'Refine the existing diagnostic explanation for a CLI log analysis tool.',\n rules: [\n 'Return valid JSON only.',\n 'Do not change issueType, title, category, confidence, metadata, or confidenceReasons.',\n 'Only refine explanation, likelyCauses, suggestedFixes, debugCommands, and warnings.',\n 'If you are unsure, keep the base content semantically equivalent.',\n 'Use concise operator-focused language.'\n ],\n expectedShape: {\n explanation: 'string',\n likelyCauses: ['string'],\n suggestedFixes: ['string'],\n debugCommands: ['string'],\n warnings: ['string']\n },\n issue: input.issue,\n raw: input.raw,\n normalized: input.normalized,\n contextHints: input.contextHints,\n base\n },\n null,\n 2\n );\n}\n\n/**************************************************************************************************************************\n IMPLEMENTATIONS\n***************************************************************************************************************************/\nexport class NoopLlmProvider implements LlmProvider {\n isEnabled(): boolean {\n return false;\n }\n\n async enhanceExplanation(\n _input: LlmExplainInput,\n base: ExplanationResult\n ): Promise<ExplanationResult> {\n return base;\n }\n}\n\nexport class MockLlmProvider implements LlmProvider {\n isEnabled(): boolean {\n return true;\n }\n\n async enhanceExplanation(\n input: LlmExplainInput,\n base: ExplanationResult\n ): Promise<ExplanationResult> {\n const hintText =\n input.contextHints.length > 0\n ? ` Context hints: ${input.contextHints\n .map((hint) => `${hint.key}=${hint.value}`)\n .join(', ')}.`\n : '';\n\n return {\n ...base,\n explanation: `${base.explanation}${hintText}`,\n warnings: [\n ...(base.warnings ?? []),\n 'Using mock LLM provider. Replace with a real provider for production-quality enhancements.'\n ]\n };\n }\n}\n\nexport class HttpLlmProvider implements LlmProvider {\n constructor(private readonly config: LlmProviderConfig) {}\n\n isEnabled(): boolean {\n return Boolean(this.config.enabled && this.config.endpoint);\n }\n\n async enhanceExplanation(\n input: LlmExplainInput,\n base: ExplanationResult\n ): Promise<ExplanationResult> {\n if (!this.config.endpoint) {\n return {\n ...base,\n warnings: [...(base.warnings ?? []), 'LLM endpoint not configured. Using base explanation.']\n };\n }\n\n const response = await fetch(this.config.endpoint, {\n method: 'POST',\n headers: {\n 'content-type': 'application/json',\n ...(this.config.apiKey ? { authorization: `Bearer ${this.config.apiKey}` } : {})\n },\n body: JSON.stringify({\n model: this.config.model,\n issue: input.issue,\n raw: input.raw,\n normalized: input.normalized,\n contextHints: input.contextHints,\n base\n })\n });\n\n if (!response.ok) {\n return {\n ...base,\n warnings: [\n ...(base.warnings ?? []),\n `LLM provider request failed with status ${response.status}. Using base explanation.`\n ]\n };\n }\n\n const payload = (await response.json()) as HttpLlmResponse;\n\n return {\n ...base,\n explanation: payload.explanation ?? base.explanation,\n likelyCauses: payload.likelyCauses ?? base.likelyCauses,\n suggestedFixes: payload.suggestedFixes ?? base.suggestedFixes,\n debugCommands: payload.debugCommands ?? base.debugCommands,\n warnings: [...(base.warnings ?? []), ...(payload.warnings ?? [])]\n };\n }\n}\n\nexport class OpenAiLlmProvider implements LlmProvider {\n private readonly client: OpenAI | null;\n\n constructor(private readonly config: LlmProviderConfig) {\n this.client = config.apiKey\n ? new OpenAI({\n apiKey: config.apiKey,\n ...(config.baseUrl ? { baseURL: config.baseUrl } : {})\n })\n : null;\n }\n\n isEnabled(): boolean {\n return Boolean(this.config.enabled && this.client);\n }\n\n async enhanceExplanation(\n input: LlmExplainInput,\n base: ExplanationResult\n ): Promise<ExplanationResult> {\n if (!this.client) {\n return {\n ...base,\n warnings: [\n ...(base.warnings ?? []),\n 'OpenAI provider not configured. Using base explanation.'\n ]\n };\n }\n\n try {\n const response = await this.client.responses.create({\n model: this.config.model ?? 'gpt-5-mini',\n instructions:\n 'You refine root-cause explanations for a CLI log analysis tool. Return valid JSON only.',\n input: buildOpenAiPrompt(input, base)\n });\n\n const rawOutput = response.output_text?.trim();\n if (!rawOutput) {\n return {\n ...base,\n warnings: [\n ...(base.warnings ?? []),\n 'OpenAI provider returned no text. Using base explanation.'\n ]\n };\n }\n\n const parsed = JSON.parse(rawOutput) as LlmRefinementPayload;\n return mergeRefinementPayload(base, parsed);\n } catch (error) {\n const message = error instanceof Error ? error.message : 'unknown provider error';\n return {\n ...base,\n warnings: [\n ...(base.warnings ?? []),\n `OpenAI provider failed: ${message}. Using base explanation.`\n ]\n };\n }\n }\n}\n\nexport function resolveLlmConfig(\n options?: Partial<ExplainOptions & PasteOptions>\n): LlmProviderConfig {\n const provider =\n options?.llmProvider?.trim().toLowerCase() ??\n process.env.LOGCOZ_LLM_PROVIDER?.trim().toLowerCase() ??\n 'noop';\n\n const enabled = Boolean(options?.llm || process.env.LOGCOZ_LLM_ENABLED === 'true');\n const endpoint = options?.llmEndpoint ?? process.env.LOGCOZ_LLM_ENDPOINT;\n const model = options?.llmModel ?? process.env.LOGCOZ_LLM_MODEL;\n const apiKey = process.env.LOGCOZ_LLM_API_KEY ?? process.env.OPENAI_API_KEY;\n const baseUrl = process.env.LOGCOZ_OPENAI_BASE_URL ?? process.env.OPENAI_BASE_URL;\n\n return {\n enabled,\n provider,\n ...(endpoint ? { endpoint } : {}),\n ...(model ? { model } : {}),\n ...(apiKey ? { apiKey } : {}),\n ...(baseUrl ? { baseUrl } : {})\n };\n}\n\nexport function createLlmProvider(config = resolveLlmConfig()): LlmProvider {\n if (!config.enabled) {\n return new NoopLlmProvider();\n }\n\n if (config.provider === 'mock') {\n return new MockLlmProvider();\n }\n\n if (config.provider === 'http') {\n return new HttpLlmProvider(config);\n }\n\n if (config.provider === 'openai') {\n return new OpenAiLlmProvider(config);\n }\n\n return new NoopLlmProvider();\n}\n","/**************************************************************************************************************************\n Copyright (c) 2026\n\n Name: redact.ts\n Author: Harikrishnan Gangadharan\n Comments: \n\n/**************************************************************************************************************************\n IMPLEMENTATIONS\n***************************************************************************************************************************/\nexport function redactSecrets(input: string): string {\n return input\n .replace(/(password\\s*[=:]\\s*)(.+)/gi, '$1[REDACTED]')\n .replace(/(token\\s*[=:]\\s*)(.+)/gi, '$1[REDACTED]')\n .replace(/(secret\\s*[=:]\\s*)(.+)/gi, '$1[REDACTED]')\n .replace(/(Bearer\\s+)[A-Za-z0-9\\-._~+/]+=*/gi, '$1[REDACTED]')\n .replace(/(postgres(?:ql)?:\\/\\/[^:\\s]+:)([^@\\s]+)(@)/gi, '$1[REDACTED]$3')\n .replace(/(redis:\\/\\/[^:\\s]+:)([^@\\s]+)(@)/gi, '$1[REDACTED]$3');\n}\n","/**************************************************************************************************************************\n Copyright (c) 2026\n\n Name: analyze.ts\n Author: Harikrishnan Gangadharan\n Comments:\n\n/**************************************************************************************************************************\n IMPORTS\n***************************************************************************************************************************/\nimport { loadContextHints } from '@/core/context';\nimport { detectIssue } from '@/core/detect';\nimport { explainIssue } from '@/core/explain';\nimport { normalizeLog } from '@/core/normalize';\nimport { extractRelevantBlock } from '@/core/extract';\nimport { createExplainOutputEnvelope } from '@/core/output';\nimport { createLlmProvider, resolveLlmConfig } from '@/providers/llm';\nimport { redactSecrets } from '@/utils/redact';\n\n/**************************************************************************************************************************\n IMPLEMENTATIONS\n***************************************************************************************************************************/\nexport async function analyzeLogInput(\n raw: string,\n options: ExplainOptions | PasteOptions\n): Promise<ExplainOutputEnvelope> {\n const redacted = redactSecrets(raw);\n const normalized = normalizeLog(redacted);\n const extracted = extractRelevantBlock(normalized);\n\n const contextFiles = options.context\n ? options.context\n .split(',')\n .map((item) => item.trim())\n .filter(Boolean)\n : [];\n\n const contextHints = await loadContextHints(contextFiles);\n\n const ctx: DetectionContext = {\n raw,\n normalized: extracted,\n lines: extracted.split('\\n'),\n contextHints\n };\n\n const issue = detectIssue(ctx);\n let explanation = explainIssue(issue);\n\n const llmProvider = createLlmProvider(resolveLlmConfig(options));\n if (llmProvider.isEnabled()) {\n explanation = await llmProvider.enhanceExplanation(\n {\n issue,\n raw,\n normalized: extracted,\n contextHints\n },\n explanation\n );\n }\n\n if (!options.includeReasoning) {\n explanation = {\n ...explanation,\n confidenceReasons: []\n };\n }\n\n return createExplainOutputEnvelope(explanation);\n}\n","/**************************************************************************************************************************\n Copyright (c) 2026\n\n Name: correlate.ts\n Author: Harikrishnan Gangadharan\n Comments:\n\n/**************************************************************************************************************************\n IMPORTS\n***************************************************************************************************************************/\nimport crypto from 'node:crypto';\nimport { CORRELATION_TIME_WINDOW_MS } from '@/constants/defaults';\nimport { lineToEvent, pickPrimaryCorrelationKey } from './keys';\n\n/**************************************************************************************************************************\n TYPES / GLOBAL DEFINITIONS\n***************************************************************************************************************************/\nfunction parseEventTime(timestamp?: string): number | null {\n if (!timestamp) return null;\n const parsed = Date.parse(timestamp);\n return Number.isNaN(parsed) ? null : parsed;\n}\n\nfunction getEventSeverityScore(level?: string): number {\n switch (level?.toUpperCase()) {\n case 'FATAL':\n return 5;\n case 'ERROR':\n return 4;\n case 'WARN':\n return 3;\n case 'INFO':\n return 2;\n case 'DEBUG':\n case 'TRACE':\n return 1;\n default:\n return 0;\n }\n}\n\nfunction sortTimeline(events: LogEvent[]): LogEvent[] {\n return [...events].sort((a, b) => {\n const timeA = parseEventTime(a.timestamp);\n const timeB = parseEventTime(b.timestamp);\n\n if (timeA !== null && timeB !== null && timeA !== timeB) {\n return timeA - timeB;\n }\n\n return getEventSeverityScore(b.level) - getEventSeverityScore(a.level);\n });\n}\n\nfunction classifyIncidentHints(events: LogEvent[]): {\n rootCauseHints: string[];\n symptomHints: string[];\n} {\n const rootCauseHints = new Set<string>();\n const symptomHints = new Set<string>();\n\n for (const event of events) {\n if (\n /\\b(refused|timed out|failed|exception|crash|panic|oom|certificate)\\b/i.test(event.message)\n ) {\n rootCauseHints.add(event.message);\n } else if (/\\b(502|503|retry|unhealthy|restarting|degraded)\\b/i.test(event.message)) {\n symptomHints.add(event.message);\n }\n }\n\n return {\n rootCauseHints: [...rootCauseHints].slice(0, 3),\n symptomHints: [...symptomHints].slice(0, 3)\n };\n}\n\n// Correlation groups are intentionally deterministic: a stable key, a bounded time window, and\n// the strongest available identifier avoid surprising regrouping between runs.\nfunction groupByCorrelationKey(events: LogEvent[]): Array<[string, LogEvent[]]> {\n const groups = new Map<string, LogEvent[]>();\n\n for (const event of events) {\n const primaryKey = pickPrimaryCorrelationKey(event);\n if (!primaryKey) continue;\n\n const [key, value] = primaryKey;\n const groupKey = `${key}:${value}`;\n const existing = groups.get(groupKey) ?? [];\n existing.push(event);\n groups.set(groupKey, existing);\n }\n\n return [...groups.entries()].sort((a, b) => b[1].length - a[1].length);\n}\n\nfunction extractSharedKeys(events: LogEvent[]): Record<string, string> {\n if (events.length === 0) return {};\n\n const first = events[0];\n if (!first) return {};\n\n const result: Record<string, string> = {};\n\n for (const [key, value] of Object.entries(first.correlationKeys)) {\n const shared = events.every((event) => event.correlationKeys[key] === value);\n if (shared) result[key] = value;\n }\n\n return result;\n}\n\nfunction deriveIncidentConfidence(events: LogEvent[]): number {\n const base = 0.65;\n const severityBoost = Math.min(0.15, events.some((event) => event.level === 'ERROR') ? 0.1 : 0);\n const timestampBoost = events.some((event) => parseEventTime(event.timestamp) !== null)\n ? 0.05\n : 0;\n const serviceBoost = events.some((event) => event.service) ? 0.05 : 0;\n const densityBoost = Math.min(0.1, events.length * 0.02);\n\n return Math.min(0.97, base + severityBoost + timestampBoost + serviceBoost + densityBoost);\n}\n\n/**************************************************************************************************************************\n IMPLEMENTATIONS\n***************************************************************************************************************************/\nexport function correlateLogs(inputs: string[]): CorrelatedIncident[] {\n const events = inputs\n .flatMap((input) => input.split('\\n'))\n .map((line) => line.trim())\n .filter(Boolean)\n .map((line) => lineToEvent(line));\n\n const grouped = groupByCorrelationKey(events);\n\n return grouped.map(([groupKey, groupedEvents]) => {\n const timeline = sortTimeline(groupedEvents);\n const { rootCauseHints, symptomHints } = classifyIncidentHints(timeline);\n const start = parseEventTime(timeline[0]?.timestamp);\n const end = parseEventTime(timeline[timeline.length - 1]?.timestamp);\n\n return {\n id: crypto.createHash('sha1').update(groupKey).digest('hex').slice(0, 12),\n title: `Correlated incident: ${groupKey}`,\n confidence: deriveIncidentConfidence(timeline),\n sharedKeys: extractSharedKeys(timeline),\n timeline,\n rootCauseHints,\n symptomHints,\n metadata: {\n services: [...new Set(timeline.map((event) => event.service).filter(Boolean))],\n timeWindowMs:\n start !== null && end !== null ? Math.min(end - start, CORRELATION_TIME_WINDOW_MS) : null\n }\n };\n });\n}\n","/**************************************************************************************************************************\n Copyright (c) 2026\n\n Name: keys.ts\n Author: Harikrishnan Gangadharan\n Comments:\n\n/**************************************************************************************************************************\n TYPES / GLOBAL DEFINITIONS\n***************************************************************************************************************************/\nconst CORRELATION_PATTERNS = [\n { key: 'traceId', pattern: /\\btrace[ _-]?id[=: ]([A-Za-z0-9-]+)/i, weight: 4 },\n { key: 'correlationId', pattern: /\\bcorrelation[ _-]?id[=: ]([A-Za-z0-9-]+)/i, weight: 3 },\n { key: 'requestId', pattern: /\\brequest[ _-]?id[=: ]([A-Za-z0-9-]+)/i, weight: 2 },\n { key: 'jobId', pattern: /\\bjob[ _-]?id[=: ]([A-Za-z0-9-]+)/i, weight: 1 }\n] as const;\n\n/**************************************************************************************************************************\n IMPLEMENTATIONS\n***************************************************************************************************************************/\nexport function pickPrimaryCorrelationKey(event: LogEvent): [string, string] | null {\n const weightedEntries = CORRELATION_PATTERNS.flatMap((entry) => {\n const value = event.correlationKeys[entry.key];\n return value ? [[entry.key, value, entry.weight] as const] : [];\n }).sort((a, b) => b[2] - a[2]);\n\n const winner = weightedEntries[0];\n return winner ? [winner[0], winner[1]] : null;\n}\n\nexport function extractServiceFromLine(line: string): string | undefined {\n const patterns = [\n /\\bservice[=: ]([a-zA-Z0-9._-]+)/i,\n /\\bpod[=: ]([a-zA-Z0-9._-]+)/i,\n /\\bcontainer[=: ]([a-zA-Z0-9._-]+)/i,\n /^\\[([a-zA-Z0-9._-]+)\\]/\n ];\n\n for (const pattern of patterns) {\n const match = line.match(pattern);\n if (match?.[1]) {\n return match[1];\n }\n }\n\n return undefined;\n}\n\nfunction getEventMessage(line: string): string {\n return line.replace(/\\s+/g, ' ').trim();\n}\n\nexport function lineToEvent(line: string): LogEvent {\n const correlationKeys: Record<string, string> = {};\n\n for (const entry of CORRELATION_PATTERNS) {\n const match = line.match(entry.pattern);\n if (match?.[1]) {\n correlationKeys[entry.key] = match[1];\n }\n }\n\n const timestampMatch = line.match(/\\b(\\d{4}-\\d{2}-\\d{2}[T ][\\d:.+-Z]+|\\d{2}:\\d{2}:\\d{2})\\b/);\n const levelMatch = line.match(/\\b(INFO|WARN|ERROR|DEBUG|TRACE|FATAL)\\b/i);\n const service = extractServiceFromLine(line);\n\n return {\n raw: line,\n message: getEventMessage(line),\n ...(timestampMatch?.[1] ? { timestamp: timestampMatch[1] } : {}),\n ...(levelMatch?.[1] ? { level: levelMatch[1].toUpperCase() } : {}),\n ...(service ? { service } : {}),\n correlationKeys\n };\n}\n"],"mappings":";AAUA,OAAO,eAAe;AAMf,SAAS,aAAa,OAAuB;AAClD,SAAO,UAAU,KAAK,EACnB,Q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;AAAA,MACA;AAAA,MACA;AAAA,MACA,UAAU;AAAA,QACR,UAAU,CAAC,GAAG,IAAI,IAAI,SAAS,IAAI,CAAC,UAAU,MAAM,OAAO,EAAE,OAAO,OAAO,CAAC,CAAC;AAAA,QAC7E,cACE,UAAU,QAAQ,QAAQ,OAAO,KAAK,IAAI,MAAM,OAAO,0BAA0B,IAAI;AAAA,MACzF;AAAA,IACF;AAAA,EACF,CAAC;AACH;","names":["path","file"]}
|
|
1
|
+
{"version":3,"sources":["../src/core/normalize.ts","../src/constants/signals.ts","../src/constants/defaults.ts","../src/core/extract.ts","../src/detectors/shared/rules.ts","../src/detectors/shared/evidence.ts","../src/detectors/shared/confidence.ts","../src/detectors/container/docker.ts","../src/detectors/shared/metadata.ts","../src/detectors/container/kubernetes.ts","../src/detectors/database/mongodb.ts","../src/detectors/database/mysql.ts","../src/detectors/database/redis.ts","../src/detectors/database/postgres.ts","../src/detectors/messaging/kafka.ts","../src/detectors/messaging/rabbitmq.ts","../src/detectors/network/dns.ts","../src/detectors/network/port.ts","../src/detectors/network/tls.ts","../src/detectors/network/timeout.ts","../src/detectors/proxy/nginx.ts","../src/detectors/runtime/file.ts","../src/detectors/runtime/oom.ts","../src/detectors/index.ts","../src/core/detect.ts","../src/core/context.ts","../src/utils/file.ts","../src/utils/platform.ts","../src/core/explain.ts","../package.json","../src/constants/meta.ts","../src/constants/exit.ts","../src/core/output.ts","../src/providers/llm.ts","../src/utils/redact.ts","../src/core/analyze.ts","../src/correlation/correlate.ts","../src/correlation/keys.ts"],"sourcesContent":["/**************************************************************************************************************************\n Copyright (c) 2026\n\n Name: normalize.ts\n Author: Harikrishnan Gangadharan\n Comments: \n\n/**************************************************************************************************************************\n IMPORTS\n***************************************************************************************************************************/\nimport stripAnsi from 'strip-ansi';\n\n/**************************************************************************************************************************\n IMPLEMENTATIONS\n***************************************************************************************************************************/\n\nexport function normalizeLog(input: string): string {\n return stripAnsi(input)\n .replace(/\\r\\n/g, '\\n')\n .replace(/\\t/g, ' ')\n .replace(/\\n{3,}/g, '\\n\\n')\n .trim();\n}\n","/**************************************************************************************************************************\n Copyright (c) 2026\n\n Name: signals.ts\n Author: Harikrishnan Gangadharan\n Comments: \n\n/**************************************************************************************************************************\n TYPES / GLOBAL DEFINITIONS\n***************************************************************************************************************************/\nexport const SIGNAL_PATTERNS: RegExp[] = [\n /error/i,\n /exception/i,\n /ECONNREFUSED/i,\n /EADDRINUSE/i,\n /ENOENT/i,\n /ENOTFOUND/i,\n /502 Bad Gateway/i,\n /connect\\(\\) failed/i,\n /password authentication failed/i,\n /WRONGPASS/i,\n /NOAUTH/i,\n /upstream prematurely closed connection/i,\n /address already in use/i,\n /timeout/i,\n /certificate/i,\n /TLS/i,\n /out of memory/i,\n /OOMKilled/i,\n /ImagePullBackOff/i,\n /CrashLoopBackOff/i,\n /mysql/i,\n /mongo/i,\n /kafka/i,\n /rabbitmq/i\n];\n","/**************************************************************************************************************************\n Copyright (c) 2026\n\n Name: defaults.ts\n Author: Harikrishnan Gangadharan\n Comments: \n\n/**************************************************************************************************************************\n TYPES / GLOBAL DEFINITIONS\n***************************************************************************************************************************/\nexport const DEFAULT_CONTEXT_LINES = 6;\nexport const MAX_EVIDENCE_LINES = 5;\nexport const MIN_DETECTION_SCORE = 40;\nexport const CORRELATION_TIME_WINDOW_MS = 5000;\n","/**************************************************************************************************************************\n Copyright (c) 2026\n\n Name: extract.ts\n Author: Harikrishnan Gangadharan\n Comments: \n\n/**************************************************************************************************************************\n IMPORTS\n***************************************************************************************************************************/\nimport { SIGNAL_PATTERNS } from '@/constants/signals';\nimport { DEFAULT_CONTEXT_LINES } from '@/constants/defaults';\n\n/**************************************************************************************************************************\n IMPLEMENTATIONS\n***************************************************************************************************************************/\nexport function extractRelevantBlock(input: string, contextLines = DEFAULT_CONTEXT_LINES): string {\n const lines = input.split('\\n');\n const hitIndexes = new Set<number>();\n\n lines.forEach((line, idx) => {\n if (SIGNAL_PATTERNS.some((pattern) => pattern.test(line))) {\n for (\n let i = Math.max(0, idx - contextLines);\n i <= Math.min(lines.length - 1, idx + contextLines);\n i++\n ) {\n hitIndexes.add(i);\n }\n }\n });\n\n if (hitIndexes.size === 0) {\n return lines.slice(-20).join('\\n');\n }\n\n return [...hitIndexes]\n .sort((a, b) => a - b)\n .map((index) => lines[index])\n .join('\\n');\n}\n","/**************************************************************************************************************************\n Copyright (c) 2026\n\n Name: rules.ts\n Author: Harikrishnan Gangadharan\n Comments: \n\n/**************************************************************************************************************************\n IMPLEMENTATIONS\n***************************************************************************************************************************/\nexport function runPatternRules(\n input: string,\n rules: PatternRule[]\n): { score: number; matchedPatterns: string[]; confidenceReasons: ConfidenceReason[] } {\n let score = 0;\n const matchedPatterns: string[] = [];\n const confidenceReasons: ConfidenceReason[] = [];\n\n for (const rule of rules) {\n if (rule.pattern.test(input)) {\n score += rule.weight;\n matchedPatterns.push(rule.label);\n confidenceReasons.push({\n label: rule.label,\n impact: rule.weight,\n source: 'pattern'\n });\n }\n }\n\n return { score, matchedPatterns, confidenceReasons };\n}\n","/**************************************************************************************************************************\n Copyright (c) 2026\n\n Name: evidence.ts\n Author: Harikrishnan Gangadharan\n Comments: \n\n/**************************************************************************************************************************\n IMPORTS\n***************************************************************************************************************************/\nimport { MAX_EVIDENCE_LINES } from '@/constants/defaults';\n\n/**************************************************************************************************************************\n IMPLEMENTATIONS\n***************************************************************************************************************************/\nexport function pickEvidence(input: string, patterns: RegExp[]): string[] {\n return input\n .split('\\n')\n .filter((line) => patterns.some((pattern) => pattern.test(line)))\n .slice(0, MAX_EVIDENCE_LINES);\n}\n","/**************************************************************************************************************************\n Copyright (c) 2026\n\n Name: confidence.ts\n Author: Harikrishnan Gangadharan\n Comments: \n\n/**************************************************************************************************************************\n IMPLEMENTATIONS\n***************************************************************************************************************************/\nexport function scoreToConfidence(score: number): number {\n if (score >= 90) return 0.97;\n if (score >= 75) return 0.93;\n if (score >= 60) return 0.88;\n if (score >= 50) return 0.82;\n if (score >= 40) return 0.72;\n return 0.5;\n}\n","/**************************************************************************************************************************\n Copyright (c) 2026\n\n Name: docker.ts\n Author: Harikrishnan Gangadharan\n Comments: \n\n/**************************************************************************************************************************\n IMPORTS\n***************************************************************************************************************************/\nimport { runPatternRules } from '@/detectors/shared/rules';\nimport { pickEvidence } from '@/detectors/shared/evidence';\nimport { scoreToConfidence } from '@/detectors/shared/confidence';\n\n/**************************************************************************************************************************\n IMPLEMENTATIONS\n***************************************************************************************************************************/\nexport const docker: IssueDetector = {\n name: 'docker-detector',\n\n detect(ctx): DetectionCandidate | null {\n const rules = [\n { pattern: /\\bhealthcheck\\b/i, weight: 20, label: 'healthcheck' },\n { pattern: /\\bunhealthy\\b/i, weight: 45, label: 'unhealthy' },\n { pattern: /\\brestarting\\b/i, weight: 40, label: 'restarting' },\n { pattern: /\\bexited with code\\b/i, weight: 35, label: 'exited with code' },\n { pattern: /\\bcontainer\\b/i, weight: 10, label: 'container' },\n { pattern: /\\bdocker\\b/i, weight: 10, label: 'docker' },\n {\n pattern: /\\bBack-off restarting failed container\\b/i,\n weight: 45,\n label: 'back-off restart'\n },\n { pattern: /\\bCrashLoopBackOff\\b/i, weight: 50, label: 'CrashLoopBackOff' }\n ];\n\n const { score, matchedPatterns, confidenceReasons } = runPatternRules(ctx.normalized, rules);\n\n if (score < 40) return null;\n\n const isHealthcheck =\n matchedPatterns.includes('unhealthy') || matchedPatterns.includes('healthcheck');\n const isRestartLoop =\n matchedPatterns.includes('restarting') ||\n matchedPatterns.includes('back-off restart') ||\n matchedPatterns.includes('CrashLoopBackOff');\n\n let type = 'docker_container_failure';\n let title = 'Docker container failure';\n let summary = 'The container encountered a runtime failure.';\n\n if (isHealthcheck) {\n type = 'docker_healthcheck_failed';\n title = 'Docker container health check failed';\n summary = 'The container is running or starting, but failed its health check.';\n } else if (isRestartLoop) {\n type = 'docker_restart_loop';\n title = 'Docker container restart loop';\n summary = 'The container is repeatedly crashing and restarting.';\n }\n\n return {\n detector: this.name,\n type,\n title,\n category: 'container',\n score,\n confidence: scoreToConfidence(score),\n specificity: 4,\n matchedPatterns,\n confidenceReasons,\n evidence: pickEvidence(ctx.normalized, [\n /\\bunhealthy\\b/i,\n /\\brestarting\\b/i,\n /\\bexited with code\\b/i,\n /\\bhealthcheck\\b/i,\n /\\bCrashLoopBackOff\\b/i,\n /\\bBack-off restarting failed container\\b/i\n ]),\n summary\n };\n }\n};\n","/**************************************************************************************************************************\n Copyright (c) 2026\n\n Name: metadata.ts\n Author: Harikrishnan Gangadharan\n Comments: \n\n/**************************************************************************************************************************\n IMPLEMENTATIONS\n***************************************************************************************************************************/\nexport function extractHostPort(input: string): Record<string, unknown> {\n const match = input.match(/([0-9a-zA-Z._-]+):(\\d{2,5})/);\n\n if (!match) return {};\n\n return {\n host: match[1],\n port: Number(match[2])\n };\n}\n\nexport function extractServiceName(input: string): string | undefined {\n const patterns = [\n /\\bservice[=: ]([a-zA-Z0-9._-]+)/i,\n /\\bcontainer[=: ]([a-zA-Z0-9._-]+)/i,\n /\\bpod[=: ]([a-zA-Z0-9._-]+)/i\n ];\n\n for (const pattern of patterns) {\n const match = input.match(pattern);\n if (match?.[1]) {\n return match[1];\n }\n }\n\n return undefined;\n}\n","/**************************************************************************************************************************\n Copyright (c) 2026\n\n Name: kubernetes.ts\n Author: Harikrishnan Gangadharan\n Comments:\n\n/**************************************************************************************************************************\n IMPORTS\n***************************************************************************************************************************/\nimport { runPatternRules } from '@/detectors/shared/rules';\nimport { pickEvidence } from '@/detectors/shared/evidence';\nimport { scoreToConfidence } from '@/detectors/shared/confidence';\nimport { extractServiceName } from '@/detectors/shared/metadata';\n\n/**************************************************************************************************************************\n IMPLEMENTATIONS\n***************************************************************************************************************************/\nexport const kubernetes: IssueDetector = {\n name: 'kubernetes-detector',\n\n detect(ctx): DetectionCandidate | null {\n const rules = [\n { pattern: /\\bImagePullBackOff\\b/i, weight: 55, label: 'ImagePullBackOff' },\n { pattern: /\\bErrImagePull\\b/i, weight: 50, label: 'ErrImagePull' },\n { pattern: /\\bCrashLoopBackOff\\b/i, weight: 45, label: 'CrashLoopBackOff' },\n { pattern: /\\bFailedScheduling\\b/i, weight: 45, label: 'FailedScheduling' },\n { pattern: /\\bBack-off pulling image\\b/i, weight: 45, label: 'Back-off pulling image' },\n { pattern: /\\bkubelet\\b|\\bpod\\b|\\bkubernetes\\b/i, weight: 20, label: 'kubernetes runtime' }\n ];\n\n const { score, matchedPatterns, confidenceReasons } = runPatternRules(ctx.normalized, rules);\n\n if (score < 40) return null;\n\n return {\n detector: this.name,\n type: 'kubernetes_workload_failure',\n title: 'Kubernetes workload failure',\n category: 'orchestration',\n score,\n confidence: scoreToConfidence(score),\n specificity: 4,\n matchedPatterns,\n confidenceReasons,\n evidence: pickEvidence(ctx.normalized, [\n /\\bImagePullBackOff\\b/i,\n /\\bErrImagePull\\b/i,\n /\\bCrashLoopBackOff\\b/i,\n /\\bFailedScheduling\\b/i,\n /\\bBack-off pulling image\\b/i\n ]),\n summary:\n 'A Kubernetes workload failed due to scheduling, image retrieval, or restart issues.',\n metadata: {\n service: extractServiceName(ctx.normalized)\n }\n };\n }\n};\n","/**************************************************************************************************************************\n Copyright (c) 2026\n\n Name: mongodb.ts\n Author: Harikrishnan Gangadharan\n Comments:\n\n/**************************************************************************************************************************\n IMPORTS\n***************************************************************************************************************************/\nimport { runPatternRules } from '@/detectors/shared/rules';\nimport { pickEvidence } from '@/detectors/shared/evidence';\nimport { scoreToConfidence } from '@/detectors/shared/confidence';\n\n/**************************************************************************************************************************\n IMPLEMENTATIONS\n***************************************************************************************************************************/\nexport const mongodb: IssueDetector = {\n name: 'mongodb-detector',\n\n detect(ctx): DetectionCandidate | null {\n const rules = [\n { pattern: /\\bMongoNetworkError\\b/i, weight: 45, label: 'MongoNetworkError' },\n { pattern: /\\bAuthentication failed\\b/i, weight: 40, label: 'Authentication failed' },\n { pattern: /\\bmongodb\\b|\\bmongo\\b/i, weight: 20, label: 'mongodb' },\n { pattern: /\\b27017\\b/, weight: 10, label: '27017' },\n {\n pattern: /\\bfailed to connect to server\\b/i,\n weight: 45,\n label: 'failed to connect to server'\n }\n ];\n\n const { score, matchedPatterns, confidenceReasons } = runPatternRules(ctx.normalized, rules);\n\n if (score < 40) return null;\n\n return {\n detector: this.name,\n type: 'mongodb_connection_error',\n title: 'MongoDB connection or authentication error',\n category: 'database',\n score,\n confidence: scoreToConfidence(score),\n specificity: 4,\n matchedPatterns,\n confidenceReasons,\n evidence: pickEvidence(ctx.normalized, [\n /\\bMongoNetworkError\\b/i,\n /\\bAuthentication failed\\b/i,\n /\\bfailed to connect to server\\b/i,\n /\\bmongodb\\b|\\bmongo\\b/i\n ]),\n summary: 'The application encountered a MongoDB connection or authentication failure.'\n };\n }\n};\n","/**************************************************************************************************************************\n Copyright (c) 2026\n\n Name: mysql.ts\n Author: Harikrishnan Gangadharan\n Comments:\n\n/**************************************************************************************************************************\n IMPORTS\n***************************************************************************************************************************/\nimport { runPatternRules } from '@/detectors/shared/rules';\nimport { pickEvidence } from '@/detectors/shared/evidence';\nimport { scoreToConfidence } from '@/detectors/shared/confidence';\n\n/**************************************************************************************************************************\n IMPLEMENTATIONS\n***************************************************************************************************************************/\nexport const mysql: IssueDetector = {\n name: 'mysql-detector',\n\n detect(ctx): DetectionCandidate | null {\n const rules = [\n { pattern: /\\bER_ACCESS_DENIED_ERROR\\b/i, weight: 50, label: 'ER_ACCESS_DENIED_ERROR' },\n { pattern: /\\bECONNREFUSED\\b/i, weight: 25, label: 'ECONNREFUSED' },\n { pattern: /\\bmysql\\b/i, weight: 20, label: 'mysql' },\n { pattern: /\\b3306\\b/, weight: 10, label: '3306' },\n { pattern: /\\bUnknown database\\b/i, weight: 45, label: 'Unknown database' }\n ];\n\n const { score, matchedPatterns, confidenceReasons } = runPatternRules(ctx.normalized, rules);\n\n if (score < 40) return null;\n\n return {\n detector: this.name,\n type: 'mysql_connection_error',\n title: 'MySQL connection or authentication error',\n category: 'database',\n score,\n confidence: scoreToConfidence(score),\n specificity: 4,\n matchedPatterns,\n confidenceReasons,\n evidence: pickEvidence(ctx.normalized, [\n /\\bER_ACCESS_DENIED_ERROR\\b/i,\n /\\bUnknown database\\b/i,\n /\\bmysql\\b/i,\n /\\bECONNREFUSED\\b/i\n ]),\n summary: 'The application encountered a MySQL connectivity or authentication problem.'\n };\n }\n};\n","/**************************************************************************************************************************\n Copyright (c) 2026\n\n Name: redis.ts\n Author: Harikrishnan Gangadharan\n Comments: \n\n/**************************************************************************************************************************\n IMPORTS\n***************************************************************************************************************************/\nimport { runPatternRules } from '@/detectors/shared/rules';\nimport { pickEvidence } from '@/detectors/shared/evidence';\nimport { scoreToConfidence } from '@/detectors/shared/confidence';\nimport { extractHostPort } from '@/detectors/shared/metadata';\n\n/**************************************************************************************************************************\n TYPES \\ GLOBAL DEFINITIONS\n***************************************************************************************************************************/\nfunction getRedisContextBoost(hints: { key: string; value: string }[]): number {\n let boost = 0;\n\n const hasRedisService = hints.some(\n (hint) => hint.key === 'docker_service' && hint.value === 'redis'\n );\n const hasLocalhostRedis = hints.some(\n (hint) => hint.key === 'REDIS_HOST' && hint.value === 'localhost'\n );\n\n if (hasRedisService) boost += 10;\n if (hasLocalhostRedis) boost += 15;\n\n return boost;\n}\n\nfunction getRedisContextReasons(hints: ContextHint[]): ConfidenceReason[] {\n const reasons: ConfidenceReason[] = [];\n\n if (hints.some((hint) => hint.key === 'docker_service' && hint.value === 'redis')) {\n reasons.push({\n label: 'docker_service=redis',\n impact: 10,\n source: 'context'\n });\n }\n\n if (hints.some((hint) => hint.key === 'REDIS_HOST' && hint.value === 'localhost')) {\n reasons.push({\n label: 'REDIS_HOST=localhost',\n impact: 15,\n source: 'context'\n });\n }\n\n return reasons;\n}\n\n/**************************************************************************************************************************\n IMPLEMENTATIONS\n***************************************************************************************************************************/\nexport const redis: IssueDetector = {\n name: 'redis-detector',\n\n detect(ctx): DetectionCandidate | null {\n const rules = [\n { pattern: /ECONNREFUSED/i, weight: 40, label: 'ECONNREFUSED' },\n { pattern: /\\bredis\\b/i, weight: 25, label: 'redis' },\n { pattern: /\\bioredis\\b/i, weight: 20, label: 'ioredis' },\n { pattern: /\\b6379\\b/, weight: 10, label: '6379' },\n { pattern: /\\bWRONGPASS\\b/i, weight: 40, label: 'WRONGPASS' },\n { pattern: /\\bNOAUTH\\b/i, weight: 40, label: 'NOAUTH' }\n ];\n\n const { score, matchedPatterns, confidenceReasons } = runPatternRules(ctx.normalized, rules);\n\n if (score < 40) return null;\n\n const isAuth = matchedPatterns.includes('WRONGPASS') || matchedPatterns.includes('NOAUTH');\n\n const contextBoost = getRedisContextBoost(ctx.contextHints);\n const finalScore = score + contextBoost;\n const contextReasons = getRedisContextReasons(ctx.contextHints);\n\n return {\n detector: this.name,\n type: isAuth ? 'redis_auth_error' : 'redis_connection_refused',\n title: isAuth ? 'Redis authentication error' : 'Redis connection refused',\n category: 'database',\n score: finalScore,\n confidence: scoreToConfidence(finalScore),\n specificity: 4,\n matchedPatterns,\n confidenceReasons: [...confidenceReasons, ...contextReasons],\n evidence: pickEvidence(ctx.normalized, [\n /redis/i,\n /ioredis/i,\n /ECONNREFUSED/i,\n /WRONGPASS/i,\n /NOAUTH/i\n ]),\n summary: isAuth\n ? 'The application reached Redis but authentication failed.'\n : 'The application failed to connect to Redis.',\n metadata: extractHostPort(ctx.normalized)\n };\n }\n};\n","/**************************************************************************************************************************\n Copyright (c) 2026\n\n Name: postgres.ts\n Author: Harikrishnan Gangadharan\n Comments: \n\n/**************************************************************************************************************************\n IMPORTS\n***************************************************************************************************************************/\nimport { runPatternRules } from '@/detectors/shared/rules';\nimport { pickEvidence } from '@/detectors/shared/evidence';\nimport { scoreToConfidence } from '@/detectors/shared/confidence';\n\n/**************************************************************************************************************************\n IMPLEMENTATIONS\n***************************************************************************************************************************/\nexport const postgres: IssueDetector = {\n name: 'postgres-detector',\n\n detect(ctx): DetectionCandidate | null {\n const rules = [\n {\n pattern: /password authentication failed/i,\n weight: 50,\n label: 'password authentication failed'\n },\n {\n pattern: /database .* does not exist/i,\n weight: 45,\n label: 'database does not exist'\n },\n {\n pattern: /Connection terminated unexpectedly/i,\n weight: 40,\n label: 'Connection terminated unexpectedly'\n },\n {\n pattern: /\\bpostgres\\b|\\bpostgresql\\b/i,\n weight: 20,\n label: 'postgres'\n },\n {\n pattern: /\\b5432\\b/,\n weight: 10,\n label: '5432'\n }\n ];\n\n const { score, matchedPatterns, confidenceReasons } = runPatternRules(ctx.normalized, rules);\n\n if (score < 40) return null;\n\n return {\n detector: this.name,\n type: 'postgres_connection_error',\n title: 'PostgreSQL connection or authentication error',\n category: 'database',\n score,\n confidence: scoreToConfidence(score),\n specificity: 4,\n matchedPatterns,\n confidenceReasons,\n evidence: pickEvidence(ctx.normalized, [\n /password authentication failed/i,\n /database .* does not exist/i,\n /Connection terminated unexpectedly/i,\n /postgres/i\n ]),\n summary: 'The application encountered a PostgreSQL connection problem.'\n };\n }\n};\n","/**************************************************************************************************************************\n Copyright (c) 2026\n\n Name: kafka.ts\n Author: Harikrishnan Gangadharan\n Comments:\n\n/**************************************************************************************************************************\n IMPORTS\n***************************************************************************************************************************/\nimport { runPatternRules } from '@/detectors/shared/rules';\nimport { pickEvidence } from '@/detectors/shared/evidence';\nimport { scoreToConfidence } from '@/detectors/shared/confidence';\n\n/**************************************************************************************************************************\n IMPLEMENTATIONS\n***************************************************************************************************************************/\nexport const kafka: IssueDetector = {\n name: 'kafka-detector',\n\n detect(ctx): DetectionCandidate | null {\n const rules = [\n { pattern: /\\bKafkaJSConnectionError\\b/i, weight: 50, label: 'KafkaJSConnectionError' },\n { pattern: /\\bLEADER_NOT_AVAILABLE\\b/i, weight: 45, label: 'LEADER_NOT_AVAILABLE' },\n { pattern: /\\bbroker.*not available\\b/i, weight: 45, label: 'broker not available' },\n { pattern: /\\bkafka\\b/i, weight: 20, label: 'kafka' },\n { pattern: /\\b9092\\b/, weight: 10, label: '9092' }\n ];\n\n const { score, matchedPatterns, confidenceReasons } = runPatternRules(ctx.normalized, rules);\n\n if (score < 40) return null;\n\n return {\n detector: this.name,\n type: 'kafka_broker_error',\n title: 'Kafka broker or connectivity error',\n category: 'messaging',\n score,\n confidence: scoreToConfidence(score),\n specificity: 4,\n matchedPatterns,\n confidenceReasons,\n evidence: pickEvidence(ctx.normalized, [\n /\\bKafkaJSConnectionError\\b/i,\n /\\bLEADER_NOT_AVAILABLE\\b/i,\n /\\bbroker.*not available\\b/i,\n /\\bkafka\\b/i\n ]),\n summary: 'The application could not reach a healthy Kafka broker or partition leader.'\n };\n }\n};\n","/**************************************************************************************************************************\n Copyright (c) 2026\n\n Name: rabbitmq.ts\n Author: Harikrishnan Gangadharan\n Comments:\n\n/**************************************************************************************************************************\n IMPORTS\n***************************************************************************************************************************/\nimport { runPatternRules } from '@/detectors/shared/rules';\nimport { pickEvidence } from '@/detectors/shared/evidence';\nimport { scoreToConfidence } from '@/detectors/shared/confidence';\n\n/**************************************************************************************************************************\n IMPLEMENTATIONS\n***************************************************************************************************************************/\nexport const rabbitmq: IssueDetector = {\n name: 'rabbitmq-detector',\n\n detect(ctx): DetectionCandidate | null {\n const rules = [\n { pattern: /\\bACCESS_REFUSED\\b/i, weight: 45, label: 'ACCESS_REFUSED' },\n { pattern: /\\bCONNECTION_FORCED\\b/i, weight: 45, label: 'CONNECTION_FORCED' },\n { pattern: /\\bamqp\\b|\\brabbitmq\\b/i, weight: 20, label: 'rabbitmq' },\n { pattern: /\\b5672\\b/, weight: 10, label: '5672' },\n {\n pattern: /\\bSocket closed abruptly during opening handshake\\b/i,\n weight: 45,\n label: 'opening handshake failed'\n }\n ];\n\n const { score, matchedPatterns, confidenceReasons } = runPatternRules(ctx.normalized, rules);\n\n if (score < 40) return null;\n\n return {\n detector: this.name,\n type: 'rabbitmq_connection_error',\n title: 'RabbitMQ connection or broker error',\n category: 'messaging',\n score,\n confidence: scoreToConfidence(score),\n specificity: 4,\n matchedPatterns,\n confidenceReasons,\n evidence: pickEvidence(ctx.normalized, [\n /\\bACCESS_REFUSED\\b/i,\n /\\bCONNECTION_FORCED\\b/i,\n /\\bSocket closed abruptly during opening handshake\\b/i,\n /\\bamqp\\b|\\brabbitmq\\b/i\n ]),\n summary: 'The application encountered an AMQP or RabbitMQ connection failure.'\n };\n }\n};\n","/**************************************************************************************************************************\n Copyright (c) 2026\n\n Name: dns.ts\n Author: Harikrishnan Gangadharan\n Comments: \n\n/**************************************************************************************************************************\n IMPORTS\n***************************************************************************************************************************/\nimport { runPatternRules } from '@/detectors/shared/rules';\nimport { pickEvidence } from '@/detectors/shared/evidence';\nimport { scoreToConfidence } from '@/detectors/shared/confidence';\n\n/**************************************************************************************************************************\n IMPLEMENTATIONS\n***************************************************************************************************************************/\nexport const dns: IssueDetector = {\n name: 'dns-detector',\n\n detect(ctx): DetectionCandidate | null {\n const rules = [\n { pattern: /ENOTFOUND/i, weight: 45, label: 'ENOTFOUND' },\n { pattern: /getaddrinfo/i, weight: 35, label: 'getaddrinfo' },\n {\n pattern: /Temporary failure in name resolution/i,\n weight: 45,\n label: 'Temporary failure in name resolution'\n }\n ];\n\n const { score, matchedPatterns, confidenceReasons } = runPatternRules(ctx.normalized, rules);\n\n if (score < 40) return null;\n\n return {\n detector: this.name,\n type: 'dns_resolution_error',\n title: 'Hostname or DNS resolution failure',\n category: 'network',\n score,\n confidence: scoreToConfidence(score),\n specificity: 3,\n matchedPatterns,\n confidenceReasons,\n evidence: pickEvidence(ctx.normalized, [/ENOTFOUND/i, /getaddrinfo/i, /name resolution/i]),\n summary: 'The application could not resolve the target hostname.'\n };\n }\n};\n","/**************************************************************************************************************************\n Copyright (c) 2026\n\n Name: port.ts\n Author: Harikrishnan Gangadharan\n Comments: \n\n/**************************************************************************************************************************\n IMPORTS\n***************************************************************************************************************************/\nimport { runPatternRules } from '@/detectors/shared/rules';\nimport { pickEvidence } from '@/detectors/shared/evidence';\nimport { scoreToConfidence } from '@/detectors/shared/confidence';\n\n/**************************************************************************************************************************\n IMPLEMENTATIONS\n***************************************************************************************************************************/\nexport const port: IssueDetector = {\n name: 'port-detector',\n\n detect(ctx): DetectionCandidate | null {\n const rules = [\n { pattern: /EADDRINUSE/i, weight: 50, label: 'EADDRINUSE' },\n { pattern: /address already in use/i, weight: 45, label: 'address already in use' },\n { pattern: /bind failed/i, weight: 35, label: 'bind failed' }\n ];\n\n const { score, matchedPatterns, confidenceReasons } = runPatternRules(ctx.normalized, rules);\n\n if (score < 40) return null;\n\n return {\n detector: this.name,\n type: 'port_in_use',\n title: 'Port already in use',\n category: 'network',\n score,\n confidence: scoreToConfidence(score),\n specificity: 3,\n matchedPatterns,\n confidenceReasons,\n evidence: pickEvidence(ctx.normalized, [\n /EADDRINUSE/i,\n /address already in use/i,\n /bind failed/i\n ]),\n summary: 'The process tried to bind to a port that is already occupied.'\n };\n }\n};\n","/**************************************************************************************************************************\n Copyright (c) 2026\n\n Name: tls.ts\n Author: Harikrishnan Gangadharan\n Comments:\n\n/**************************************************************************************************************************\n IMPORTS\n***************************************************************************************************************************/\nimport { runPatternRules } from '@/detectors/shared/rules';\nimport { pickEvidence } from '@/detectors/shared/evidence';\nimport { scoreToConfidence } from '@/detectors/shared/confidence';\n\n/**************************************************************************************************************************\n IMPLEMENTATIONS\n***************************************************************************************************************************/\nexport const tls: IssueDetector = {\n name: 'tls-detector',\n\n detect(ctx): DetectionCandidate | null {\n const rules = [\n { pattern: /\\bcertificate verify failed\\b/i, weight: 50, label: 'certificate verify failed' },\n { pattern: /\\bself signed certificate\\b/i, weight: 45, label: 'self signed certificate' },\n { pattern: /\\bSSL routines\\b/i, weight: 35, label: 'SSL routines' },\n {\n pattern: /\\bUNABLE_TO_VERIFY_LEAF_SIGNATURE\\b/i,\n weight: 45,\n label: 'UNABLE_TO_VERIFY_LEAF_SIGNATURE'\n },\n { pattern: /\\bCERT_HAS_EXPIRED\\b/i, weight: 45, label: 'CERT_HAS_EXPIRED' },\n { pattern: /\\bTLS\\b/i, weight: 15, label: 'TLS' }\n ];\n\n const { score, matchedPatterns, confidenceReasons } = runPatternRules(ctx.normalized, rules);\n\n if (score < 40) return null;\n\n return {\n detector: this.name,\n type: 'tls_certificate_error',\n title: 'TLS or certificate validation error',\n category: 'security',\n score,\n confidence: scoreToConfidence(score),\n specificity: 4,\n matchedPatterns,\n confidenceReasons,\n evidence: pickEvidence(ctx.normalized, [\n /\\bcertificate verify failed\\b/i,\n /\\bself signed certificate\\b/i,\n /\\bSSL routines\\b/i,\n /\\bUNABLE_TO_VERIFY_LEAF_SIGNATURE\\b/i,\n /\\bCERT_HAS_EXPIRED\\b/i\n ]),\n summary: 'The application failed a TLS handshake or certificate validation step.'\n };\n }\n};\n","/**************************************************************************************************************************\n Copyright (c) 2026\n\n Name: timeout.ts\n Author: Harikrishnan Gangadharan\n Comments: \n\n/**************************************************************************************************************************\n IMPORTS\n***************************************************************************************************************************/\nimport { runPatternRules } from '@/detectors/shared/rules';\nimport { pickEvidence } from '@/detectors/shared/evidence';\nimport { scoreToConfidence } from '@/detectors/shared/confidence';\n\n/**************************************************************************************************************************\n IMPLEMENTATIONS\n***************************************************************************************************************************/\nexport const timeout: IssueDetector = {\n name: 'timeout-detector',\n\n detect(ctx): DetectionCandidate | null {\n const rules = [\n { pattern: /\\bETIMEDOUT\\b/i, weight: 50, label: 'ETIMEDOUT' },\n { pattern: /\\btimeout\\b/i, weight: 35, label: 'timeout' },\n { pattern: /\\bConnection timed out\\b/i, weight: 45, label: 'Connection timed out' },\n { pattern: /\\boperation timed out\\b/i, weight: 40, label: 'operation timed out' },\n { pattern: /\\bnetwork is unreachable\\b/i, weight: 40, label: 'network is unreachable' },\n { pattern: /\\brequest timed out\\b/i, weight: 40, label: 'request timed out' }\n ];\n\n const { score, matchedPatterns, confidenceReasons } = runPatternRules(ctx.normalized, rules);\n\n if (score < 40) return null;\n\n return {\n detector: this.name,\n type: 'network_timeout',\n title: 'Network timeout or unreachable service',\n category: 'network',\n score,\n confidence: scoreToConfidence(score),\n specificity: 3,\n matchedPatterns,\n confidenceReasons,\n evidence: pickEvidence(ctx.normalized, [\n /\\bETIMEDOUT\\b/i,\n /\\btimeout\\b/i,\n /\\bConnection timed out\\b/i,\n /\\boperation timed out\\b/i,\n /\\bnetwork is unreachable\\b/i,\n /\\brequest timed out\\b/i\n ]),\n summary: 'The application could not reach the target service in time.'\n };\n }\n};\n","/**************************************************************************************************************************\n Copyright (c) 2026\n\n Name: nginx.ts\n Author: Harikrishnan Gangadharan\n Comments: \n\n/**************************************************************************************************************************\n IMPORTS\n***************************************************************************************************************************/\nimport { runPatternRules } from '@/detectors/shared/rules';\nimport { pickEvidence } from '@/detectors/shared/evidence';\nimport { scoreToConfidence } from '@/detectors/shared/confidence';\n\n/**************************************************************************************************************************\n IMPLEMENTATIONS\n***************************************************************************************************************************/\nexport const nginx: IssueDetector = {\n name: 'nginx-detector',\n\n detect(ctx): DetectionCandidate | null {\n const rules = [\n { pattern: /502 Bad Gateway/i, weight: 45, label: '502 Bad Gateway' },\n { pattern: /connect\\(\\) failed/i, weight: 40, label: 'connect() failed' },\n {\n pattern: /upstream prematurely closed connection/i,\n weight: 40,\n label: 'upstream prematurely closed connection'\n },\n { pattern: /\\bnginx\\b/i, weight: 15, label: 'nginx' }\n ];\n\n const { score, matchedPatterns, confidenceReasons } = runPatternRules(ctx.normalized, rules);\n\n if (score < 40) return null;\n\n return {\n detector: this.name,\n type: 'nginx_upstream_failure',\n title: 'Nginx upstream failure',\n category: 'proxy',\n score,\n confidence: scoreToConfidence(score),\n specificity: 4,\n matchedPatterns,\n confidenceReasons,\n evidence: pickEvidence(ctx.normalized, [\n /502 Bad Gateway/i,\n /connect\\(\\) failed/i,\n /upstream prematurely closed connection/i,\n /nginx/i\n ]),\n summary: 'Nginx could not successfully communicate with the upstream application.'\n };\n }\n};\n","/**************************************************************************************************************************\n Copyright (c) 2026\n\n Name: file.ts\n Author: Harikrishnan Gangadharan\n Comments: \n\n/**************************************************************************************************************************\n IMPORTS\n***************************************************************************************************************************/\nimport { runPatternRules } from '@/detectors/shared/rules';\nimport { pickEvidence } from '@/detectors/shared/evidence';\nimport { scoreToConfidence } from '@/detectors/shared/confidence';\n\n/**************************************************************************************************************************\n IMPLEMENTATIONS\n***************************************************************************************************************************/\nexport const file: IssueDetector = {\n name: 'file-detector',\n\n detect(ctx): DetectionCandidate | null {\n const rules = [\n { pattern: /ENOENT/i, weight: 45, label: 'ENOENT' },\n { pattern: /no such file or directory/i, weight: 40, label: 'no such file or directory' },\n { pattern: /Cannot find module/i, weight: 35, label: 'Cannot find module' }\n ];\n\n const { score, matchedPatterns, confidenceReasons } = runPatternRules(ctx.normalized, rules);\n\n if (score < 40) return null;\n\n return {\n detector: this.name,\n type: 'missing_file',\n title: 'Missing file or path',\n category: 'filesystem',\n score,\n confidence: scoreToConfidence(score),\n specificity: 3,\n matchedPatterns,\n confidenceReasons,\n evidence: pickEvidence(ctx.normalized, [\n /ENOENT/i,\n /no such file or directory/i,\n /Cannot find module/i\n ]),\n summary: 'The application tried to access a file, module, or path that does not exist.'\n };\n }\n};\n","/**************************************************************************************************************************\n Copyright (c) 2026\n\n Name: oom.ts\n Author: Harikrishnan Gangadharan\n Comments:\n\n/**************************************************************************************************************************\n IMPORTS\n***************************************************************************************************************************/\nimport { runPatternRules } from '@/detectors/shared/rules';\nimport { pickEvidence } from '@/detectors/shared/evidence';\nimport { scoreToConfidence } from '@/detectors/shared/confidence';\n\n/**************************************************************************************************************************\n IMPLEMENTATIONS\n***************************************************************************************************************************/\nexport const oom: IssueDetector = {\n name: 'oom-detector',\n\n detect(ctx): DetectionCandidate | null {\n const rules = [\n { pattern: /\\bout of memory\\b/i, weight: 45, label: 'out of memory' },\n {\n pattern: /\\bJavaScript heap out of memory\\b/i,\n weight: 55,\n label: 'JavaScript heap out of memory'\n },\n { pattern: /\\bOOMKilled\\b/i, weight: 55, label: 'OOMKilled' },\n { pattern: /\\bKilled process\\b/i, weight: 40, label: 'Killed process' },\n { pattern: /\\bCannot allocate memory\\b/i, weight: 45, label: 'Cannot allocate memory' }\n ];\n\n const { score, matchedPatterns, confidenceReasons } = runPatternRules(ctx.normalized, rules);\n\n if (score < 40) return null;\n\n return {\n detector: this.name,\n type: 'out_of_memory_error',\n title: 'Out-of-memory or memory pressure failure',\n category: 'runtime',\n score,\n confidence: scoreToConfidence(score),\n specificity: 4,\n matchedPatterns,\n confidenceReasons,\n evidence: pickEvidence(ctx.normalized, [\n /\\bout of memory\\b/i,\n /\\bJavaScript heap out of memory\\b/i,\n /\\bOOMKilled\\b/i,\n /\\bKilled process\\b/i,\n /\\bCannot allocate memory\\b/i\n ]),\n summary: 'The process or container exhausted available memory.'\n };\n }\n};\n","/**************************************************************************************************************************\n Copyright (c) 2026\n\n Name: index.ts\n Author: Harikrishnan Gangadharan\n Comments: \n\n/**************************************************************************************************************************\n IMPORTS\n***************************************************************************************************************************/\nimport { docker } from '@/detectors/container/docker';\nimport { kubernetes } from '@/detectors/container/kubernetes';\nimport { mongodb } from '@/detectors/database/mongodb';\nimport { mysql } from '@/detectors/database/mysql';\nimport { redis } from '@/detectors/database/redis';\nimport { postgres } from '@/detectors/database/postgres';\nimport { kafka } from '@/detectors/messaging/kafka';\nimport { rabbitmq } from '@/detectors/messaging/rabbitmq';\nimport { dns } from '@/detectors/network/dns';\nimport { port } from '@/detectors/network/port';\nimport { tls } from '@/detectors/network/tls';\nimport { timeout } from '@/detectors/network/timeout';\nimport { nginx } from '@/detectors/proxy/nginx';\nimport { file } from '@/detectors/runtime/file';\nimport { oom } from '@/detectors/runtime/oom';\n\n/**************************************************************************************************************************\n EXPORTS\n***************************************************************************************************************************/\nexport const detectors: IssueDetector[] = [\n docker,\n kubernetes,\n redis,\n postgres,\n mysql,\n mongodb,\n kafka,\n rabbitmq,\n nginx,\n port,\n timeout,\n tls,\n dns,\n file,\n oom\n];\n","/**************************************************************************************************************************\n Copyright (c) 2026\n\n Name: detect.ts\n Author: Harikrishnan Gangadharan\n Comments: \n\n/**************************************************************************************************************************\n IMPORTS\n***************************************************************************************************************************/\nimport { detectors } from '@/detectors';\n\n/**************************************************************************************************************************\n TYPES / GLOBAL DEFINITIONS\n***************************************************************************************************************************/\nconst getFallbackCandidate = (ctx: DetectionContext): DetectionCandidate => ({\n detector: 'unknown',\n type: 'unknown',\n title: 'Unknown issue',\n category: 'unknown',\n confidence: 0.3,\n score: 0,\n specificity: 0,\n evidence: ctx.lines.slice(0, 5),\n matchedPatterns: [],\n summary: 'No known issue pattern matched strongly enough.',\n confidenceReasons: []\n});\n\n/**************************************************************************************************************************\n IMPLEMENTATIONS\n***************************************************************************************************************************/\nexport function detectIssue(ctx: DetectionContext): DetectionCandidate {\n const matches = detectors\n .map((detector) => detector.detect(ctx))\n .filter((candidate): candidate is DetectionCandidate => candidate !== null);\n\n if (matches.length === 0) {\n return getFallbackCandidate(ctx);\n }\n\n const best = matches.sort((a, b) => {\n if (b.score !== a.score) return b.score - a.score;\n if (b.specificity !== a.specificity) return b.specificity - a.specificity;\n return b.confidence - a.confidence;\n })[0];\n\n if (!best) {\n return getFallbackCandidate(ctx);\n }\n\n return best;\n}\n","/**************************************************************************************************************************\n Copyright (c) 2026\n\n Name: context.ts\n Author: Harikrishnan Gangadharan\n Comments:\n\n/**************************************************************************************************************************\n IMPORTS\n***************************************************************************************************************************/\nimport path from 'node:path';\nimport { readOptionalTextFile } from '@/utils/file';\n\n/**************************************************************************************************************************\n TYPES / GLOBAL DEFINITIONS\n***************************************************************************************************************************/\nfunction pushHint(hints: ContextHint[], key: string, value: string, source: string): void {\n hints.push({ key, value, source });\n}\n\nfunction parseEnvContent(content: string, source: string, hints: ContextHint[]): void {\n const env = new Map<string, string>();\n\n for (const rawLine of content.split('\\n')) {\n const line = rawLine.trim();\n if (!line || line.startsWith('#')) continue;\n\n const separatorIndex = line.indexOf('=');\n if (separatorIndex === -1) continue;\n\n const key = line.slice(0, separatorIndex).trim();\n const value = line\n .slice(separatorIndex + 1)\n .trim()\n .replace(/^['\"]|['\"]$/g, '');\n if (!key) continue;\n env.set(key, value);\n }\n\n for (const trackedKey of [\n 'REDIS_HOST',\n 'REDIS_PORT',\n 'REDIS_URL',\n 'DB_HOST',\n 'DB_PORT',\n 'DB_NAME',\n 'MYSQL_HOST',\n 'MONGO_URL',\n 'KAFKA_BROKERS',\n 'RABBITMQ_URL'\n ]) {\n const value = env.get(trackedKey);\n if (value) {\n pushHint(hints, trackedKey, value, source);\n }\n }\n}\n\n// This Compose parser is intentionally shallow: it extracts enough structure to improve detection\n// without trying to fully implement YAML parsing inside the CLI runtime.\nfunction parseComposeContent(content: string, source: string, hints: ContextHint[]): void {\n const serviceMatches = [...content.matchAll(/^\\s{2}([a-zA-Z0-9_-]+):\\s*$/gm)];\n for (const match of serviceMatches) {\n const service = match[1];\n if (service) {\n pushHint(hints, 'docker_service', service, source);\n }\n }\n\n const portMatches = [...content.matchAll(/^\\s*-\\s*\"?(?<host>\\d+):(?<container>\\d+)\"?\\s*$/gm)];\n for (const match of portMatches) {\n const host = match.groups?.host;\n const container = match.groups?.container;\n if (host && container) {\n pushHint(hints, 'docker_port_mapping', `${host}:${container}`, source);\n }\n }\n}\n\nfunction parseKubernetesContent(content: string, source: string, hints: ContextHint[]): void {\n const kindMatch = content.match(/^\\s*kind:\\s*([A-Za-z]+)/m);\n if (kindMatch?.[1]) {\n pushHint(hints, 'k8s_kind', kindMatch[1], source);\n }\n\n const nameMatch = content.match(/^\\s*name:\\s*([a-zA-Z0-9._-]+)/m);\n if (nameMatch?.[1]) {\n pushHint(hints, 'k8s_name', nameMatch[1], source);\n }\n\n const imageMatches = [...content.matchAll(/^\\s*image:\\s*([^\\s]+)/gm)];\n for (const match of imageMatches) {\n if (match[1]) {\n pushHint(hints, 'k8s_image', match[1], source);\n }\n }\n}\n\nfunction parseJsonConfigContent(content: string, source: string, hints: ContextHint[]): void {\n try {\n const parsed = JSON.parse(content) as Record<string, unknown>;\n\n for (const [key, value] of Object.entries(parsed)) {\n if (typeof value !== 'string' && typeof value !== 'number') {\n continue;\n }\n\n if (/(redis|db|mysql|mongo|kafka|rabbit|tls|ssl)/i.test(key)) {\n pushHint(hints, `config_${key}`, String(value), source);\n }\n }\n } catch {\n // Ignore invalid JSON files so optional context never blocks analysis.\n }\n}\n\n/**************************************************************************************************************************\n IMPLEMENTATIONS\n***************************************************************************************************************************/\nexport async function loadContextHints(files: string[]): Promise<ContextHint[]> {\n const hints: ContextHint[] = [];\n\n for (const file of files) {\n const content = await readOptionalTextFile(file);\n if (!content) continue;\n\n const source = path.basename(file);\n const lowerSource = source.toLowerCase();\n\n parseEnvContent(content, source, hints);\n\n if (\n lowerSource.includes('compose') ||\n /^\\s*services:\\s*$/m.test(content) ||\n /^\\s{2}[a-zA-Z0-9_-]+:\\s*$/m.test(content)\n ) {\n parseComposeContent(content, source, hints);\n }\n\n if (/^\\s*apiVersion:\\s*/m.test(content) && /^\\s*kind:\\s*/m.test(content)) {\n parseKubernetesContent(content, source, hints);\n }\n\n if (lowerSource.endsWith('.json')) {\n parseJsonConfigContent(content, source, hints);\n }\n }\n\n return hints;\n}\n","/**************************************************************************************************************************\n Copyright (c) 2026\n\n Name: file.ts\n Author: Harikrishnan Gangadharan\n Comments: \n\n/**************************************************************************************************************************\n IMPORTS\n***************************************************************************************************************************/\nimport fs from 'node:fs/promises';\n\n/**************************************************************************************************************************\n IMPLEMENTATIONS\n***************************************************************************************************************************/\nexport async function readTextFile(path: string): Promise<string> {\n return fs.readFile(path, 'utf8');\n}\n\nexport async function readOptionalTextFile(path: string): Promise<string | null> {\n try {\n return await fs.readFile(path, 'utf8');\n } catch {\n return null;\n }\n}\n\nexport async function readFromStdin(): Promise<string> {\n const chunks: Buffer[] = [];\n\n return new Promise((resolve, reject) => {\n process.stdin.on('data', (chunk) => chunks.push(Buffer.from(chunk)));\n process.stdin.on('end', () => resolve(Buffer.concat(chunks).toString('utf8')));\n process.stdin.on('error', reject);\n });\n}\n","/**************************************************************************************************************************\n Copyright (c) 2026\n\n Name: platform.ts\n Author: Harikrishnan Gangadharan\n Comments:\n\n/**************************************************************************************************************************\n IMPLEMENTATIONS\n***************************************************************************************************************************/\nexport function isWindowsPlatform(platform = process.platform): boolean {\n return platform === 'win32';\n}\n\n// Keep user-facing debug commands practical on both Linux and Windows shells.\nexport function pickPlatformCommands(\n unixCommands: string[],\n windowsCommands: string[],\n platform = process.platform\n): string[] {\n return isWindowsPlatform(platform) ? windowsCommands : unixCommands;\n}\n","/**************************************************************************************************************************\n Copyright (c) 2026\n\n Name: explain.ts\n Author: Harikrishnan Gangadharan\n Comments:\n\n/**************************************************************************************************************************\n IMPORTS\n***************************************************************************************************************************/\nimport { pickPlatformCommands } from '@/utils/platform';\n\n/**************************************************************************************************************************\n TYPES / GLOBAL DEFINITIONS\n***************************************************************************************************************************/\nconst withOptionalMetadata = (\n issue: DetectionCandidate\n): Partial<Pick<ExplanationResult, 'metadata'>> => {\n return issue.metadata ? { metadata: issue.metadata } : {};\n};\n\nconst withConfidenceReasons = (\n issue: DetectionCandidate\n): Pick<ExplanationResult, 'confidenceReasons'> => ({\n confidenceReasons: issue.confidenceReasons ?? []\n});\n\nfunction platformDebugCommands(unixCommands: string[], windowsCommands: string[]): string[] {\n return pickPlatformCommands(unixCommands, windowsCommands);\n}\n\n/**************************************************************************************************************************\n IMPLEMENTATIONS\n***************************************************************************************************************************/\nexport function explainIssue(issue: DetectionCandidate): ExplanationResult {\n switch (issue.type) {\n case 'redis_connection_refused':\n return {\n issueType: issue.type,\n title: issue.title,\n category: issue.category,\n confidence: issue.confidence,\n explanation:\n 'Your application tried to connect to Redis, but no service accepted the connection on the target host and port.',\n evidence: issue.evidence,\n likelyCauses: [\n 'Redis service is not running',\n 'Wrong Redis host or port configuration',\n 'Application is running inside Docker and is incorrectly using localhost'\n ],\n suggestedFixes: [\n 'Verify Redis is running',\n 'Check REDIS_HOST, REDIS_PORT, or REDIS_URL',\n 'If using Docker Compose, use the service name instead of localhost'\n ],\n debugCommands: platformDebugCommands(\n ['docker ps', 'docker logs redis', 'printenv | grep REDIS'],\n ['docker ps', 'docker logs redis', 'Get-ChildItem Env:REDIS*']\n ),\n ...withOptionalMetadata(issue),\n ...withConfidenceReasons(issue)\n };\n\n case 'redis_auth_error':\n return {\n issueType: issue.type,\n title: issue.title,\n category: issue.category,\n confidence: issue.confidence,\n explanation:\n 'The application successfully reached Redis, but authentication failed due to wrong or missing credentials.',\n evidence: issue.evidence,\n likelyCauses: [\n 'Wrong Redis password',\n 'Missing password in application configuration',\n 'Redis ACL or user mismatch'\n ],\n suggestedFixes: [\n 'Verify Redis password in environment variables',\n 'Check Redis ACL settings',\n 'Confirm the app uses the expected Redis user and password'\n ],\n debugCommands: platformDebugCommands(\n ['printenv | grep REDIS', 'docker exec -it redis redis-cli', 'docker logs redis'],\n ['Get-ChildItem Env:REDIS*', 'docker exec -it redis redis-cli', 'docker logs redis']\n ),\n ...withOptionalMetadata(issue),\n ...withConfidenceReasons(issue)\n };\n\n case 'postgres_connection_error':\n return {\n issueType: issue.type,\n title: issue.title,\n category: issue.category,\n confidence: issue.confidence,\n explanation:\n 'The application encountered a PostgreSQL connection, authentication, or target database problem.',\n evidence: issue.evidence,\n likelyCauses: [\n 'Incorrect username or password',\n 'Target database does not exist',\n 'PostgreSQL service is unavailable'\n ],\n suggestedFixes: [\n 'Verify DB_HOST, DB_PORT, DB_USER, DB_PASSWORD, and DB_NAME',\n 'Confirm PostgreSQL is running',\n 'Check if the database exists and the user has access'\n ],\n debugCommands: platformDebugCommands(\n ['docker ps', 'docker logs postgres', 'printenv | grep DB_'],\n ['docker ps', 'docker logs postgres', 'Get-ChildItem Env:DB*']\n ),\n ...withConfidenceReasons(issue)\n };\n\n case 'mysql_connection_error':\n return {\n issueType: issue.type,\n title: issue.title,\n category: issue.category,\n confidence: issue.confidence,\n explanation:\n 'The application encountered a MySQL connection, authentication, or target database problem.',\n evidence: issue.evidence,\n likelyCauses: [\n 'Incorrect MySQL credentials',\n 'Target database does not exist',\n 'MySQL service is unavailable or unreachable'\n ],\n suggestedFixes: [\n 'Verify MySQL host, port, user, password, and database configuration',\n 'Confirm the MySQL service is reachable from the application runtime',\n 'Check broker or container logs for startup failures'\n ],\n debugCommands: platformDebugCommands(\n ['docker ps', 'docker logs mysql', 'printenv | grep MYSQL'],\n ['docker ps', 'docker logs mysql', 'Get-ChildItem Env:MYSQL*']\n ),\n ...withConfidenceReasons(issue)\n };\n\n case 'mongodb_connection_error':\n return {\n issueType: issue.type,\n title: issue.title,\n category: issue.category,\n confidence: issue.confidence,\n explanation:\n 'The application could not authenticate to MongoDB or establish a healthy connection to the target server.',\n evidence: issue.evidence,\n likelyCauses: [\n 'Wrong MongoDB credentials',\n 'MongoDB is unavailable or unreachable',\n 'Replica set or network configuration is incorrect'\n ],\n suggestedFixes: [\n 'Verify MongoDB URI, host, and credentials',\n 'Confirm MongoDB is listening on the expected interface and port',\n 'Check application and database logs for topology or auth failures'\n ],\n debugCommands: platformDebugCommands(\n ['docker ps', 'docker logs mongodb', 'printenv | grep MONGO'],\n ['docker ps', 'docker logs mongodb', 'Get-ChildItem Env:MONGO*']\n ),\n ...withConfidenceReasons(issue)\n };\n\n case 'dns_resolution_error':\n return {\n issueType: issue.type,\n title: issue.title,\n category: issue.category,\n confidence: issue.confidence,\n explanation: 'The application could not resolve the configured hostname to an IP address.',\n evidence: issue.evidence,\n likelyCauses: [\n 'Wrong hostname in environment variables',\n 'Container or service name mismatch',\n 'DNS or network issue'\n ],\n suggestedFixes: [\n 'Verify the hostname value',\n 'Check Docker Compose service names',\n 'Test DNS resolution from the running environment'\n ],\n debugCommands: platformDebugCommands(\n ['printenv', 'nslookup <hostname>', 'ping <hostname>'],\n ['Get-ChildItem Env:', 'Resolve-DnsName <hostname>', 'Test-NetConnection <hostname>']\n ),\n ...withConfidenceReasons(issue)\n };\n\n case 'network_timeout':\n return {\n issueType: issue.type,\n title: issue.title,\n category: issue.category,\n confidence: issue.confidence,\n explanation:\n 'The application could not reach the target service within the allowed time window, or the network path was unavailable.',\n evidence: issue.evidence,\n likelyCauses: [\n 'Target service is slow or down',\n 'Firewall or network routing issue',\n 'Wrong host or port causing connection attempts to hang'\n ],\n suggestedFixes: [\n 'Verify the target service is healthy',\n 'Check connectivity from the current runtime environment',\n 'Validate the configured host and port'\n ],\n debugCommands: platformDebugCommands(\n ['curl -v <target>', 'ping <hostname>', 'ss -ltnp'],\n ['curl.exe -v <target>', 'Test-NetConnection <hostname>', 'netstat -ano']\n ),\n ...withConfidenceReasons(issue)\n };\n\n case 'tls_certificate_error':\n return {\n issueType: issue.type,\n title: issue.title,\n category: issue.category,\n confidence: issue.confidence,\n explanation:\n 'The application reached the remote endpoint, but TLS negotiation or certificate validation failed.',\n evidence: issue.evidence,\n likelyCauses: [\n 'Certificate chain is incomplete or expired',\n 'Self-signed or untrusted certificate',\n 'Hostname mismatch between certificate and configured target'\n ],\n suggestedFixes: [\n 'Verify the target certificate chain and expiry',\n 'Confirm the configured hostname matches the certificate subject',\n 'Install or trust the correct CA bundle in the runtime environment'\n ],\n debugCommands: platformDebugCommands(\n ['openssl s_client -connect <host>:443 -servername <host>', 'curl -v https://<host>'],\n ['curl.exe -v https://<host>', 'Test-NetConnection <host> -Port 443']\n ),\n ...withOptionalMetadata(issue),\n ...withConfidenceReasons(issue)\n };\n\n case 'port_in_use':\n return {\n issueType: issue.type,\n title: issue.title,\n category: issue.category,\n confidence: issue.confidence,\n explanation:\n 'The process tried to bind to a port that is already being used by another process or service.',\n evidence: issue.evidence,\n likelyCauses: [\n 'Another app is already using the same port',\n 'A previous process did not exit cleanly',\n 'Multiple containers are mapped to the same host port'\n ],\n suggestedFixes: [\n 'Find and stop the process using the port',\n 'Change the application port',\n 'Check Docker port mappings'\n ],\n debugCommands: platformDebugCommands(\n ['lsof -i :3000', 'ss -ltnp', 'docker ps'],\n ['netstat -ano | findstr :3000', 'Get-Process -Id <pid>', 'docker ps']\n ),\n ...withConfidenceReasons(issue)\n };\n\n case 'nginx_upstream_failure':\n return {\n issueType: issue.type,\n title: issue.title,\n category: issue.category,\n confidence: issue.confidence,\n explanation:\n 'Nginx could not successfully communicate with the upstream service, so it returned a gateway error.',\n evidence: issue.evidence,\n likelyCauses: [\n 'Upstream container is down',\n 'Wrong upstream host or port',\n 'Application crashed or closed the connection'\n ],\n suggestedFixes: [\n 'Verify the upstream container is running',\n 'Check Nginx upstream configuration',\n 'Inspect application logs for crashes'\n ],\n debugCommands: platformDebugCommands(\n ['docker ps', 'docker logs nginx', 'docker logs <app-container>'],\n ['docker ps', 'docker logs nginx', 'docker logs <app-container>']\n ),\n ...withConfidenceReasons(issue)\n };\n\n case 'docker_healthcheck_failed':\n return {\n issueType: issue.type,\n title: issue.title,\n category: issue.category,\n confidence: issue.confidence,\n explanation:\n 'The container failed its health check, which usually means the process started but is not ready or not responding correctly.',\n evidence: issue.evidence,\n likelyCauses: [\n 'Application startup is failing internally',\n 'Health check command is incorrect',\n 'Dependency required by the app is unavailable'\n ],\n suggestedFixes: [\n 'Inspect container logs for startup failures',\n 'Verify the health check command and endpoint',\n 'Check dependencies like database or Redis availability'\n ],\n debugCommands: platformDebugCommands(\n ['docker ps', 'docker inspect <container>', 'docker logs <container>'],\n ['docker ps', 'docker inspect <container>', 'docker logs <container>']\n ),\n ...withConfidenceReasons(issue)\n };\n\n case 'docker_restart_loop':\n return {\n issueType: issue.type,\n title: issue.title,\n category: issue.category,\n confidence: issue.confidence,\n explanation:\n 'The container is repeatedly crashing and restarting, which indicates the main process exits shortly after startup.',\n evidence: issue.evidence,\n likelyCauses: [\n 'Application crash during startup',\n 'Missing environment variables or configuration',\n 'Invalid command, entrypoint, or mounted file'\n ],\n suggestedFixes: [\n 'Inspect container logs',\n 'Check required environment variables',\n 'Verify the image entrypoint and mounted configuration files'\n ],\n debugCommands: platformDebugCommands(\n ['docker ps -a', 'docker logs <container>', 'docker inspect <container>'],\n ['docker ps -a', 'docker logs <container>', 'docker inspect <container>']\n ),\n ...withConfidenceReasons(issue)\n };\n\n case 'docker_container_failure':\n return {\n issueType: issue.type,\n title: issue.title,\n category: issue.category,\n confidence: issue.confidence,\n explanation: 'A container-level runtime failure was detected in the logs.',\n evidence: issue.evidence,\n likelyCauses: [\n 'Containerized process exited unexpectedly',\n 'Dependency or configuration failure inside the container',\n 'Resource constraints or image/runtime issues'\n ],\n suggestedFixes: [\n 'Inspect container logs',\n 'Check image, command, and environment variables',\n 'Verify external dependencies used by the container'\n ],\n debugCommands: platformDebugCommands(\n ['docker ps -a', 'docker logs <container>', 'docker inspect <container>'],\n ['docker ps -a', 'docker logs <container>', 'docker inspect <container>']\n ),\n ...withConfidenceReasons(issue)\n };\n\n case 'kubernetes_workload_failure':\n return {\n issueType: issue.type,\n title: issue.title,\n category: issue.category,\n confidence: issue.confidence,\n explanation:\n 'A Kubernetes workload failed due to scheduling, image retrieval, or repeated restart problems.',\n evidence: issue.evidence,\n likelyCauses: [\n 'Image cannot be pulled from the configured registry',\n 'Cluster lacks resources or scheduling constraints are unsatisfied',\n 'The container starts and crashes repeatedly'\n ],\n suggestedFixes: [\n 'Inspect pod events and container state',\n 'Verify image name, registry credentials, and resource requests',\n 'Check workload logs for startup failures'\n ],\n debugCommands: platformDebugCommands(\n [\n 'kubectl describe pod <pod-name>',\n 'kubectl logs <pod-name> --previous',\n 'kubectl get events --sort-by=.metadata.creationTimestamp'\n ],\n [\n 'kubectl describe pod <pod-name>',\n 'kubectl logs <pod-name> --previous',\n 'kubectl get events --sort-by=.metadata.creationTimestamp'\n ]\n ),\n ...withOptionalMetadata(issue),\n ...withConfidenceReasons(issue)\n };\n\n case 'missing_file':\n return {\n issueType: issue.type,\n title: issue.title,\n category: issue.category,\n confidence: issue.confidence,\n explanation:\n 'The application tried to access a file, module, or directory that does not exist in the current environment.',\n evidence: issue.evidence,\n likelyCauses: [\n 'Wrong relative path',\n 'Missing configuration file',\n 'Build output path is incorrect'\n ],\n suggestedFixes: [\n 'Verify the file path',\n 'Check whether the file exists in the runtime environment',\n 'Confirm volume mounts or build output directories'\n ],\n debugCommands: platformDebugCommands(\n ['pwd', 'ls -la', 'find . -maxdepth 3 -type f'],\n [\n 'Get-Location',\n 'Get-ChildItem -Force',\n 'Get-ChildItem -Recurse -File | Select-Object -First 20'\n ]\n ),\n ...withConfidenceReasons(issue)\n };\n\n case 'out_of_memory_error':\n return {\n issueType: issue.type,\n title: issue.title,\n category: issue.category,\n confidence: issue.confidence,\n explanation:\n 'The process or container exhausted available memory and was terminated or became unstable.',\n evidence: issue.evidence,\n likelyCauses: [\n 'Memory leak or unexpectedly large workload',\n 'Container or host memory limits are too low',\n 'Heap limits are smaller than the workload requires'\n ],\n suggestedFixes: [\n 'Inspect memory usage and recent workload size changes',\n 'Increase memory limits or tune heap settings',\n 'Review application code for unbounded growth or caching'\n ],\n debugCommands: platformDebugCommands(\n ['docker stats', 'free -m', 'dmesg | tail'],\n [\n 'docker stats',\n 'Get-Counter \"\\\\Memory\\\\Available MBytes\"',\n 'Get-Process | Sort-Object WS -Descending | Select-Object -First 10'\n ]\n ),\n ...withConfidenceReasons(issue)\n };\n\n case 'kafka_broker_error':\n return {\n issueType: issue.type,\n title: issue.title,\n category: issue.category,\n confidence: issue.confidence,\n explanation:\n 'The application could not reach a healthy Kafka broker or partition leader in time.',\n evidence: issue.evidence,\n likelyCauses: [\n 'Kafka broker is unavailable',\n 'Wrong bootstrap server configuration',\n 'Cluster leadership or networking issues'\n ],\n suggestedFixes: [\n 'Verify the configured bootstrap servers',\n 'Check Kafka broker health and topic partition state',\n 'Review network connectivity between the app and brokers'\n ],\n debugCommands: platformDebugCommands(\n [\n 'docker logs kafka',\n 'kafka-topics.sh --bootstrap-server <broker> --list',\n 'printenv | grep KAFKA'\n ],\n [\n 'docker logs kafka',\n 'Get-ChildItem Env:KAFKA*',\n 'Test-NetConnection <broker> -Port 9092'\n ]\n ),\n ...withConfidenceReasons(issue)\n };\n\n case 'rabbitmq_connection_error':\n return {\n issueType: issue.type,\n title: issue.title,\n category: issue.category,\n confidence: issue.confidence,\n explanation:\n 'The application could not authenticate to RabbitMQ or establish a healthy AMQP connection.',\n evidence: issue.evidence,\n likelyCauses: [\n 'Wrong broker credentials or virtual host',\n 'RabbitMQ broker is unavailable',\n 'AMQP connectivity is interrupted by network or TLS issues'\n ],\n suggestedFixes: [\n 'Verify RabbitMQ connection URI, credentials, and virtual host',\n 'Check broker availability and queue health',\n 'Confirm the application can reach the broker port from its runtime'\n ],\n debugCommands: platformDebugCommands(\n ['docker logs rabbitmq', 'printenv | grep RABBIT', 'ss -ltnp | grep 5672'],\n [\n 'docker logs rabbitmq',\n 'Get-ChildItem Env:RABBIT*',\n 'Test-NetConnection <broker> -Port 5672'\n ]\n ),\n ...withConfidenceReasons(issue)\n };\n\n default:\n return {\n issueType: issue.type,\n title: issue.title,\n category: issue.category,\n confidence: issue.confidence,\n explanation:\n 'The log did not match any known detector strongly enough yet. More context or additional detectors may be needed.',\n evidence: issue.evidence,\n likelyCauses: ['Unknown'],\n suggestedFixes: [\n 'Inspect the extracted evidence lines',\n 'Pass related config files as context',\n 'Add a new detector for this error pattern'\n ],\n debugCommands: platformDebugCommands(['cat <log-file>'], ['Get-Content <log-file>']),\n ...withConfidenceReasons(issue)\n };\n }\n}\n","{\n \"name\": \"@hkgdevx/logcoz\",\n \"version\": \"0.1.1\",\n \"description\": \"LogCoz is an intelligent CLI for analyzing application and infrastructure logs. It extracts meaningful signals, detects common failure patterns, and provides root-cause explanations with actionable debugging steps — enhanced by optional context from your environment and configuration.\",\n \"license\": \"MIT\",\n \"author\": {\n \"name\": \"Harikrishnan Gangadharan\",\n \"email\": \"hkg1512@gmail.com\",\n \"url\": \"https://www.hkgdev.com\"\n },\n \"type\": \"module\",\n \"bin\": {\n \"logcozcli\": \"dist/cli.js\",\n \"logcoz\": \"dist/cli.js\"\n },\n \"main\": \"./dist/index.js\",\n \"module\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"files\": [\n \"dist\",\n \"README.md\",\n \"LICENSE\"\n ],\n \"engines\": {\n \"node\": \">=20\"\n },\n \"scripts\": {\n \"dev\": \"tsx src/cli.ts\",\n \"build\": \"tsup\",\n \"prepack\": \"pnpm build\",\n \"release:publish\": \"node ./scripts/release-publish.mjs\",\n \"typecheck\": \"tsc --noEmit\",\n \"lint\": \"eslint .\",\n \"lint:fix\": \"eslint . --fix\",\n \"format\": \"prettier . --write\",\n \"format:check\": \"prettier . --check\",\n \"test\": \"vitest run\",\n \"test:watch\": \"vitest\",\n \"check\": \"pnpm typecheck && pnpm lint && pnpm format:check && pnpm test\",\n \"prepare\": \"husky\"\n },\n \"lint-staged\": {\n \"*.{ts,js,mjs,cjs,json,md,yml,yaml}\": [\n \"prettier --write\"\n ],\n \"*.{ts,js,mjs,cjs}\": [\n \"eslint --fix\"\n ]\n },\n \"publishConfig\": {\n \"access\": \"public\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/hkgdevx/LogCoz.git\"\n },\n \"devDependencies\": {\n \"@changesets/cli\": \"^2.30.0\",\n \"@commitlint/cli\": \"^20.5.0\",\n \"@commitlint/config-conventional\": \"^20.5.0\",\n \"@eslint/js\": \"^9.39.4\",\n \"@types/node\": \"^22.19.15\",\n \"eslint\": \"^9.39.4\",\n \"eslint-import-resolver-typescript\": \"^4.4.4\",\n \"eslint-plugin-import\": \"^2.32.0\",\n \"globals\": \"^17.4.0\",\n \"husky\": \"^9.1.7\",\n \"lint-staged\": \"^16.4.0\",\n \"tsup\": \"^8.5.1\",\n \"tsx\": \"^4.21.0\",\n \"typescript\": \"^5.9.3\",\n \"typescript-eslint\": \"^8.57.1\",\n \"vitest\": \"^4.1.0\"\n },\n \"dependencies\": {\n \"boxen\": \"^8.0.1\",\n \"chalk\": \"^5.6.2\",\n \"commander\": \"^14.0.3\",\n \"openai\": \"^4.104.0\",\n \"ora\": \"^9.3.0\",\n \"strip-ansi\": \"^7.2.0\"\n }\n}\n","/**************************************************************************************************************************\n Copyright (c) 2026\n\n Name: meta.ts\n Author: Harikrishnan Gangadharan\n Comments:\n\n/**************************************************************************************************************************\n IMPORTS\n***************************************************************************************************************************/\nimport packageJson from '../../package.json';\n\n/**************************************************************************************************************************\n EXPORTS\n***************************************************************************************************************************/\nexport const CLI_NAME = 'logcozcli';\nexport const CLI_ALIASES = ['logcoz'] as const;\nexport const CLI_VERSION = packageJson.version;\nexport const JSON_SCHEMA_VERSION = '1.0.0';\n","/**************************************************************************************************************************\n Copyright (c) 2026\n\n Name: exit.ts\n Author: Harikrishnan Gangadharan\n Comments:\n\n/**************************************************************************************************************************\n EXPORTS\n***************************************************************************************************************************/\nexport const EXIT_CODE_SUCCESS = 0;\nexport const EXIT_CODE_RUNTIME_ERROR = 1;\nexport const EXIT_CODE_UNKNOWN_ISSUE = 2;\n","/**************************************************************************************************************************\n Copyright (c) 2026\n\n Name: output.ts\n Author: Harikrishnan Gangadharan\n Comments:\n\n/**************************************************************************************************************************\n IMPORTS\n***************************************************************************************************************************/\nimport { CLI_NAME, CLI_VERSION, JSON_SCHEMA_VERSION } from '@/constants/meta';\nimport { EXIT_CODE_SUCCESS, EXIT_CODE_UNKNOWN_ISSUE } from '@/constants/exit';\n\n/**************************************************************************************************************************\n IMPLEMENTATIONS\n***************************************************************************************************************************/\nexport function createExplainOutputEnvelope(result: ExplanationResult): ExplainOutputEnvelope {\n const exitCode = result.issueType === 'unknown' ? EXIT_CODE_UNKNOWN_ISSUE : EXIT_CODE_SUCCESS;\n\n return {\n schemaVersion: JSON_SCHEMA_VERSION,\n cliName: CLI_NAME,\n cliVersion: CLI_VERSION,\n exitCode,\n status: result.issueType === 'unknown' ? 'unknown' : 'detected',\n result\n };\n}\n\nexport function createCorrelateOutputEnvelope(\n result: CorrelateOutputResult\n): CorrelateOutputEnvelope {\n return {\n schemaVersion: JSON_SCHEMA_VERSION,\n cliName: CLI_NAME,\n cliVersion: CLI_VERSION,\n exitCode: EXIT_CODE_SUCCESS,\n status: 'correlated',\n result\n };\n}\n","/**************************************************************************************************************************\n Copyright (c) 2026\n\n Name: llm.ts\n Author: Harikrishnan Gangadharan\n Comments:\n\n/**************************************************************************************************************************\n IMPORTS\n***************************************************************************************************************************/\nimport OpenAI from 'openai';\n\n/**************************************************************************************************************************\n TYPES / GLOBAL DEFINITIONS\n***************************************************************************************************************************/\ninterface HttpLlmResponse {\n explanation?: string;\n likelyCauses?: string[];\n suggestedFixes?: string[];\n debugCommands?: string[];\n warnings?: string[];\n}\n\ninterface LlmRefinementPayload {\n explanation?: unknown;\n likelyCauses?: unknown;\n suggestedFixes?: unknown;\n debugCommands?: unknown;\n warnings?: unknown;\n}\n\nfunction sanitizeStringArray(value: unknown): string[] | undefined {\n if (!Array.isArray(value)) return undefined;\n\n const sanitized = value\n .filter((item): item is string => typeof item === 'string')\n .map((item) => item.trim())\n .filter(Boolean);\n\n return sanitized.length > 0 ? sanitized : undefined;\n}\n\nfunction mergeRefinementPayload(\n base: ExplanationResult,\n payload: LlmRefinementPayload\n): ExplanationResult {\n return {\n ...base,\n explanation:\n typeof payload.explanation === 'string' && payload.explanation.trim()\n ? payload.explanation.trim()\n : base.explanation,\n likelyCauses: sanitizeStringArray(payload.likelyCauses) ?? base.likelyCauses,\n suggestedFixes: sanitizeStringArray(payload.suggestedFixes) ?? base.suggestedFixes,\n debugCommands: sanitizeStringArray(payload.debugCommands) ?? base.debugCommands,\n warnings: [...(base.warnings ?? []), ...(sanitizeStringArray(payload.warnings) ?? [])]\n };\n}\n\nfunction buildOpenAiPrompt(input: LlmExplainInput, base: ExplanationResult): string {\n return JSON.stringify(\n {\n task: 'Refine the existing diagnostic explanation for a CLI log analysis tool.',\n rules: [\n 'Return valid JSON only.',\n 'Do not change issueType, title, category, confidence, metadata, or confidenceReasons.',\n 'Only refine explanation, likelyCauses, suggestedFixes, debugCommands, and warnings.',\n 'If you are unsure, keep the base content semantically equivalent.',\n 'Use concise operator-focused language.'\n ],\n expectedShape: {\n explanation: 'string',\n likelyCauses: ['string'],\n suggestedFixes: ['string'],\n debugCommands: ['string'],\n warnings: ['string']\n },\n issue: input.issue,\n raw: input.raw,\n normalized: input.normalized,\n contextHints: input.contextHints,\n base\n },\n null,\n 2\n );\n}\n\n/**************************************************************************************************************************\n IMPLEMENTATIONS\n***************************************************************************************************************************/\nexport class NoopLlmProvider implements LlmProvider {\n isEnabled(): boolean {\n return false;\n }\n\n async enhanceExplanation(\n _input: LlmExplainInput,\n base: ExplanationResult\n ): Promise<ExplanationResult> {\n return base;\n }\n}\n\nexport class MockLlmProvider implements LlmProvider {\n isEnabled(): boolean {\n return true;\n }\n\n async enhanceExplanation(\n input: LlmExplainInput,\n base: ExplanationResult\n ): Promise<ExplanationResult> {\n const hintText =\n input.contextHints.length > 0\n ? ` Context hints: ${input.contextHints\n .map((hint) => `${hint.key}=${hint.value}`)\n .join(', ')}.`\n : '';\n\n return {\n ...base,\n explanation: `${base.explanation}${hintText}`,\n warnings: [\n ...(base.warnings ?? []),\n 'Using mock LLM provider. Replace with a real provider for production-quality enhancements.'\n ]\n };\n }\n}\n\nexport class HttpLlmProvider implements LlmProvider {\n constructor(private readonly config: LlmProviderConfig) {}\n\n isEnabled(): boolean {\n return Boolean(this.config.enabled && this.config.endpoint);\n }\n\n async enhanceExplanation(\n input: LlmExplainInput,\n base: ExplanationResult\n ): Promise<ExplanationResult> {\n if (!this.config.endpoint) {\n return {\n ...base,\n warnings: [...(base.warnings ?? []), 'LLM endpoint not configured. Using base explanation.']\n };\n }\n\n const response = await fetch(this.config.endpoint, {\n method: 'POST',\n headers: {\n 'content-type': 'application/json',\n ...(this.config.apiKey ? { authorization: `Bearer ${this.config.apiKey}` } : {})\n },\n body: JSON.stringify({\n model: this.config.model,\n issue: input.issue,\n raw: input.raw,\n normalized: input.normalized,\n contextHints: input.contextHints,\n base\n })\n });\n\n if (!response.ok) {\n return {\n ...base,\n warnings: [\n ...(base.warnings ?? []),\n `LLM provider request failed with status ${response.status}. Using base explanation.`\n ]\n };\n }\n\n const payload = (await response.json()) as HttpLlmResponse;\n\n return {\n ...base,\n explanation: payload.explanation ?? base.explanation,\n likelyCauses: payload.likelyCauses ?? base.likelyCauses,\n suggestedFixes: payload.suggestedFixes ?? base.suggestedFixes,\n debugCommands: payload.debugCommands ?? base.debugCommands,\n warnings: [...(base.warnings ?? []), ...(payload.warnings ?? [])]\n };\n }\n}\n\nexport class OpenAiLlmProvider implements LlmProvider {\n private readonly client: OpenAI | null;\n\n constructor(private readonly config: LlmProviderConfig) {\n this.client = config.apiKey\n ? new OpenAI({\n apiKey: config.apiKey,\n ...(config.baseUrl ? { baseURL: config.baseUrl } : {})\n })\n : null;\n }\n\n isEnabled(): boolean {\n return Boolean(this.config.enabled && this.client);\n }\n\n async enhanceExplanation(\n input: LlmExplainInput,\n base: ExplanationResult\n ): Promise<ExplanationResult> {\n if (!this.client) {\n return {\n ...base,\n warnings: [\n ...(base.warnings ?? []),\n 'OpenAI provider not configured. Using base explanation.'\n ]\n };\n }\n\n try {\n const response = await this.client.responses.create({\n model: this.config.model ?? 'gpt-5-mini',\n instructions:\n 'You refine root-cause explanations for a CLI log analysis tool. Return valid JSON only.',\n input: buildOpenAiPrompt(input, base)\n });\n\n const rawOutput = response.output_text?.trim();\n if (!rawOutput) {\n return {\n ...base,\n warnings: [\n ...(base.warnings ?? []),\n 'OpenAI provider returned no text. Using base explanation.'\n ]\n };\n }\n\n const parsed = JSON.parse(rawOutput) as LlmRefinementPayload;\n return mergeRefinementPayload(base, parsed);\n } catch (error) {\n const message = error instanceof Error ? error.message : 'unknown provider error';\n return {\n ...base,\n warnings: [\n ...(base.warnings ?? []),\n `OpenAI provider failed: ${message}. Using base explanation.`\n ]\n };\n }\n }\n}\n\nexport function resolveLlmConfig(\n options?: Partial<ExplainOptions & PasteOptions>\n): LlmProviderConfig {\n const provider =\n options?.llmProvider?.trim().toLowerCase() ??\n process.env.LOGCOZ_LLM_PROVIDER?.trim().toLowerCase() ??\n 'noop';\n\n const enabled = Boolean(options?.llm || process.env.LOGCOZ_LLM_ENABLED === 'true');\n const endpoint = options?.llmEndpoint ?? process.env.LOGCOZ_LLM_ENDPOINT;\n const model = options?.llmModel ?? process.env.LOGCOZ_LLM_MODEL;\n const apiKey = process.env.LOGCOZ_LLM_API_KEY ?? process.env.OPENAI_API_KEY;\n const baseUrl = process.env.LOGCOZ_OPENAI_BASE_URL ?? process.env.OPENAI_BASE_URL;\n\n return {\n enabled,\n provider,\n ...(endpoint ? { endpoint } : {}),\n ...(model ? { model } : {}),\n ...(apiKey ? { apiKey } : {}),\n ...(baseUrl ? { baseUrl } : {})\n };\n}\n\nexport function createLlmProvider(config = resolveLlmConfig()): LlmProvider {\n if (!config.enabled) {\n return new NoopLlmProvider();\n }\n\n if (config.provider === 'mock') {\n return new MockLlmProvider();\n }\n\n if (config.provider === 'http') {\n return new HttpLlmProvider(config);\n }\n\n if (config.provider === 'openai') {\n return new OpenAiLlmProvider(config);\n }\n\n return new NoopLlmProvider();\n}\n","/**************************************************************************************************************************\n Copyright (c) 2026\n\n Name: redact.ts\n Author: Harikrishnan Gangadharan\n Comments: \n\n/**************************************************************************************************************************\n IMPLEMENTATIONS\n***************************************************************************************************************************/\nexport function redactSecrets(input: string): string {\n return input\n .replace(/(password\\s*[=:]\\s*)(.+)/gi, '$1[REDACTED]')\n .replace(/(token\\s*[=:]\\s*)(.+)/gi, '$1[REDACTED]')\n .replace(/(secret\\s*[=:]\\s*)(.+)/gi, '$1[REDACTED]')\n .replace(/(Bearer\\s+)[A-Za-z0-9\\-._~+/]+=*/gi, '$1[REDACTED]')\n .replace(/(postgres(?:ql)?:\\/\\/[^:\\s]+:)([^@\\s]+)(@)/gi, '$1[REDACTED]$3')\n .replace(/(redis:\\/\\/[^:\\s]+:)([^@\\s]+)(@)/gi, '$1[REDACTED]$3');\n}\n","/**************************************************************************************************************************\n Copyright (c) 2026\n\n Name: analyze.ts\n Author: Harikrishnan Gangadharan\n Comments:\n\n/**************************************************************************************************************************\n IMPORTS\n***************************************************************************************************************************/\nimport { loadContextHints } from '@/core/context';\nimport { detectIssue } from '@/core/detect';\nimport { explainIssue } from '@/core/explain';\nimport { normalizeLog } from '@/core/normalize';\nimport { extractRelevantBlock } from '@/core/extract';\nimport { createExplainOutputEnvelope } from '@/core/output';\nimport { createLlmProvider, resolveLlmConfig } from '@/providers/llm';\nimport { redactSecrets } from '@/utils/redact';\n\n/**************************************************************************************************************************\n IMPLEMENTATIONS\n***************************************************************************************************************************/\nexport async function analyzeLogInput(\n raw: string,\n options: ExplainOptions | PasteOptions\n): Promise<ExplainOutputEnvelope> {\n const redacted = redactSecrets(raw);\n const normalized = normalizeLog(redacted);\n const extracted = extractRelevantBlock(normalized);\n\n const contextFiles = options.context\n ? options.context\n .split(',')\n .map((item) => item.trim())\n .filter(Boolean)\n : [];\n\n const contextHints = await loadContextHints(contextFiles);\n\n const ctx: DetectionContext = {\n raw,\n normalized: extracted,\n lines: extracted.split('\\n'),\n contextHints\n };\n\n const issue = detectIssue(ctx);\n let explanation = explainIssue(issue);\n\n const llmProvider = createLlmProvider(resolveLlmConfig(options));\n if (llmProvider.isEnabled()) {\n explanation = await llmProvider.enhanceExplanation(\n {\n issue,\n raw,\n normalized: extracted,\n contextHints\n },\n explanation\n );\n }\n\n if (!options.includeReasoning) {\n explanation = {\n ...explanation,\n confidenceReasons: []\n };\n }\n\n return createExplainOutputEnvelope(explanation);\n}\n","/**************************************************************************************************************************\n Copyright (c) 2026\n\n Name: correlate.ts\n Author: Harikrishnan Gangadharan\n Comments:\n\n/**************************************************************************************************************************\n IMPORTS\n***************************************************************************************************************************/\nimport crypto from 'node:crypto';\nimport { CORRELATION_TIME_WINDOW_MS } from '@/constants/defaults';\nimport { lineToEvent, pickPrimaryCorrelationKey } from './keys';\n\n/**************************************************************************************************************************\n TYPES / GLOBAL DEFINITIONS\n***************************************************************************************************************************/\nfunction parseEventTime(timestamp?: string): number | null {\n if (!timestamp) return null;\n const parsed = Date.parse(timestamp);\n return Number.isNaN(parsed) ? null : parsed;\n}\n\nfunction getEventSeverityScore(level?: string): number {\n switch (level?.toUpperCase()) {\n case 'FATAL':\n return 5;\n case 'ERROR':\n return 4;\n case 'WARN':\n return 3;\n case 'INFO':\n return 2;\n case 'DEBUG':\n case 'TRACE':\n return 1;\n default:\n return 0;\n }\n}\n\nfunction sortTimeline(events: LogEvent[]): LogEvent[] {\n return [...events].sort((a, b) => {\n const timeA = parseEventTime(a.timestamp);\n const timeB = parseEventTime(b.timestamp);\n\n if (timeA !== null && timeB !== null && timeA !== timeB) {\n return timeA - timeB;\n }\n\n return getEventSeverityScore(b.level) - getEventSeverityScore(a.level);\n });\n}\n\nfunction classifyIncidentHints(events: LogEvent[]): {\n rootCauseHints: string[];\n symptomHints: string[];\n} {\n const rootCauseHints = new Set<string>();\n const symptomHints = new Set<string>();\n\n for (const event of events) {\n if (\n /\\b(refused|timed out|failed|exception|crash|panic|oom|certificate)\\b/i.test(event.message)\n ) {\n rootCauseHints.add(event.message);\n } else if (/\\b(502|503|retry|unhealthy|restarting|degraded)\\b/i.test(event.message)) {\n symptomHints.add(event.message);\n }\n }\n\n return {\n rootCauseHints: [...rootCauseHints].slice(0, 3),\n symptomHints: [...symptomHints].slice(0, 3)\n };\n}\n\n// Correlation groups are intentionally deterministic: a stable key, a bounded time window, and\n// the strongest available identifier avoid surprising regrouping between runs.\nfunction groupByCorrelationKey(events: LogEvent[]): Array<[string, LogEvent[]]> {\n const groups = new Map<string, LogEvent[]>();\n\n for (const event of events) {\n const primaryKey = pickPrimaryCorrelationKey(event);\n if (!primaryKey) continue;\n\n const [key, value] = primaryKey;\n const groupKey = `${key}:${value}`;\n const existing = groups.get(groupKey) ?? [];\n existing.push(event);\n groups.set(groupKey, existing);\n }\n\n return [...groups.entries()].sort((a, b) => b[1].length - a[1].length);\n}\n\nfunction extractSharedKeys(events: LogEvent[]): Record<string, string> {\n if (events.length === 0) return {};\n\n const first = events[0];\n if (!first) return {};\n\n const result: Record<string, string> = {};\n\n for (const [key, value] of Object.entries(first.correlationKeys)) {\n const shared = events.every((event) => event.correlationKeys[key] === value);\n if (shared) result[key] = value;\n }\n\n return result;\n}\n\nfunction deriveIncidentConfidence(events: LogEvent[]): number {\n const base = 0.65;\n const severityBoost = Math.min(0.15, events.some((event) => event.level === 'ERROR') ? 0.1 : 0);\n const timestampBoost = events.some((event) => parseEventTime(event.timestamp) !== null)\n ? 0.05\n : 0;\n const serviceBoost = events.some((event) => event.service) ? 0.05 : 0;\n const densityBoost = Math.min(0.1, events.length * 0.02);\n\n return Math.min(0.97, base + severityBoost + timestampBoost + serviceBoost + densityBoost);\n}\n\n/**************************************************************************************************************************\n IMPLEMENTATIONS\n***************************************************************************************************************************/\nexport function correlateLogs(inputs: string[]): CorrelatedIncident[] {\n const events = inputs\n .flatMap((input) => input.split('\\n'))\n .map((line) => line.trim())\n .filter(Boolean)\n .map((line) => lineToEvent(line));\n\n const grouped = groupByCorrelationKey(events);\n\n return grouped.map(([groupKey, groupedEvents]) => {\n const timeline = sortTimeline(groupedEvents);\n const { rootCauseHints, symptomHints } = classifyIncidentHints(timeline);\n const start = parseEventTime(timeline[0]?.timestamp);\n const end = parseEventTime(timeline[timeline.length - 1]?.timestamp);\n\n return {\n id: crypto.createHash('sha1').update(groupKey).digest('hex').slice(0, 12),\n title: `Correlated incident: ${groupKey}`,\n confidence: deriveIncidentConfidence(timeline),\n sharedKeys: extractSharedKeys(timeline),\n timeline,\n rootCauseHints,\n symptomHints,\n metadata: {\n services: [...new Set(timeline.map((event) => event.service).filter(Boolean))],\n timeWindowMs:\n start !== null && end !== null ? Math.min(end - start, CORRELATION_TIME_WINDOW_MS) : null\n }\n };\n });\n}\n","/**************************************************************************************************************************\n Copyright (c) 2026\n\n Name: keys.ts\n Author: Harikrishnan Gangadharan\n Comments:\n\n/**************************************************************************************************************************\n TYPES / GLOBAL DEFINITIONS\n***************************************************************************************************************************/\nconst CORRELATION_PATTERNS = [\n { key: 'traceId', pattern: /\\btrace[ _-]?id[=: ]([A-Za-z0-9-]+)/i, weight: 4 },\n { key: 'correlationId', pattern: /\\bcorrelation[ _-]?id[=: ]([A-Za-z0-9-]+)/i, weight: 3 },\n { key: 'requestId', pattern: /\\brequest[ _-]?id[=: ]([A-Za-z0-9-]+)/i, weight: 2 },\n { key: 'jobId', pattern: /\\bjob[ _-]?id[=: ]([A-Za-z0-9-]+)/i, weight: 1 }\n] as const;\n\n/**************************************************************************************************************************\n IMPLEMENTATIONS\n***************************************************************************************************************************/\nexport function pickPrimaryCorrelationKey(event: LogEvent): [string, string] | null {\n const weightedEntries = CORRELATION_PATTERNS.flatMap((entry) => {\n const value = event.correlationKeys[entry.key];\n return value ? [[entry.key, value, entry.weight] as const] : [];\n }).sort((a, b) => b[2] - a[2]);\n\n const winner = weightedEntries[0];\n return winner ? [winner[0], winner[1]] : null;\n}\n\nexport function extractServiceFromLine(line: string): string | undefined {\n const patterns = [\n /\\bservice[=: ]([a-zA-Z0-9._-]+)/i,\n /\\bpod[=: ]([a-zA-Z0-9._-]+)/i,\n /\\bcontainer[=: ]([a-zA-Z0-9._-]+)/i,\n /^\\[([a-zA-Z0-9._-]+)\\]/\n ];\n\n for (const pattern of patterns) {\n const match = line.match(pattern);\n if (match?.[1]) {\n return match[1];\n }\n }\n\n return undefined;\n}\n\nfunction getEventMessage(line: string): string {\n return line.replace(/\\s+/g, ' ').trim();\n}\n\nexport function lineToEvent(line: string): LogEvent {\n const correlationKeys: Record<string, string> = {};\n\n for (const entry of CORRELATION_PATTERNS) {\n const match = line.match(entry.pattern);\n if (match?.[1]) {\n correlationKeys[entry.key] = match[1];\n }\n }\n\n const timestampMatch = line.match(/\\b(\\d{4}-\\d{2}-\\d{2}[T ][\\d:.+-Z]+|\\d{2}:\\d{2}:\\d{2})\\b/);\n const levelMatch = line.match(/\\b(INFO|WARN|ERROR|DEBUG|TRACE|FATAL)\\b/i);\n const service = extractServiceFromLine(line);\n\n return {\n raw: line,\n message: getEventMessage(line),\n ...(timestampMatch?.[1] ? { timestamp: timestampMatch[1] } : {}),\n ...(levelMatch?.[1] ? { level: levelMatch[1].toUpperCase() } : {}),\n ...(service ? { service } : {}),\n correlationKeys\n };\n}\n"],"mappings":";AAUA,OAAO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