@triedotdev/mcp 1.0.32 → 1.0.34

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.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/agents/security.ts","../src/agents/privacy.ts","../src/agents/typecheck.ts","../src/agents/comprehension.ts","../src/agents/accessibility.ts","../src/agents/design-engineer.ts","../src/agents/legal.ts","../src/agents/test.ts","../src/agents/software-architect.ts","../src/agents/devops.ts","../src/agents/bug-finding.ts","../src/agents/user-testing.ts","../src/agents/trie-clean.ts","../src/agents/soc2.ts","../src/agents/super-reviewer.ts","../src/agents/performance.ts","../src/agents/e2e.ts","../src/agents/visual-qa.ts","../src/agents/data-flow.ts","../src/agents/custom-agent.ts","../src/agents/registry.ts"],"sourcesContent":["import { BaseAgent, FileRelevance } from './base-agent.js';\nimport type { Issue, ScanContext, CodeContext } from '../types/index.js';\n\n/**\n * Files to ALWAYS skip - never generate issues for these\n */\nconst ALWAYS_SKIP_FILES = [\n /vulnerability-signatures\\.[jt]s$/,\n /vibe-code-signatures\\.[jt]s$/,\n /node_modules\\//,\n /\\.d\\.ts$/,\n /\\.min\\.[jt]s$/,\n /dist\\//,\n /build\\//,\n /package-lock\\.json$/,\n /yarn\\.lock$/,\n];\n\n/**\n * Test files - skip most checks except real exposed secrets\n */\nconst TEST_FILE_PATTERNS = [\n /\\.test\\.[jt]sx?$/,\n /\\.spec\\.[jt]sx?$/,\n /__tests__\\//,\n /\\/test\\//,\n /\\/tests\\//,\n /fixture/i,\n /mock/i,\n];\n\n/**\n * Security-relevant indicators - files that need deeper analysis\n */\nconst SECURITY_INDICATORS = {\n // High priority - definitely needs security review\n high: [\n { pattern: /auth|login|session|jwt|token|oauth/i, reason: 'authentication code' },\n { pattern: /password|credential|secret|apikey|api[_-]?key/i, reason: 'credential handling' },\n { pattern: /sql|query|database|prisma|sequelize|knex|mongodb/i, reason: 'database operations' },\n { pattern: /exec|spawn|child_process|shell/i, reason: 'command execution' },\n { pattern: /eval\\s*\\(|new\\s+Function/i, reason: 'dynamic code execution' },\n { pattern: /crypto|encrypt|decrypt|hash/i, reason: 'cryptographic operations' },\n { pattern: /payment|stripe|paypal|billing|credit/i, reason: 'payment processing' },\n ],\n // Medium priority - worth reviewing\n medium: [\n { pattern: /req\\.body|req\\.params|req\\.query/i, reason: 'user input handling' },\n { pattern: /innerHTML|outerHTML|document\\.write/i, reason: 'DOM manipulation' },\n { pattern: /dangerouslySetInnerHTML/i, reason: 'React raw HTML' },\n { pattern: /fetch\\(|axios|http\\.|https\\./i, reason: 'HTTP requests' },\n { pattern: /cookie|localStorage|sessionStorage/i, reason: 'client storage' },\n { pattern: /cors|origin|header/i, reason: 'CORS/header handling' },\n { pattern: /redirect|location\\.href/i, reason: 'redirects' },\n ],\n // Low priority - might have security implications\n low: [\n { pattern: /upload|file|multer|formdata/i, reason: 'file handling' },\n { pattern: /url|path|route/i, reason: 'URL/path handling' },\n { pattern: /validate|sanitize|escape/i, reason: 'validation code' },\n ]\n};\n\n/**\n * Critical patterns that should be caught immediately (pre-AI filter)\n * These are high-confidence patterns that don't need AI to confirm\n */\nconst CRITICAL_PATTERNS = [\n // Real secrets (not placeholders)\n { pattern: /AKIA[A-Z0-9]{16}/, severity: 'critical' as const, issue: 'AWS Access Key exposed', fix: 'Remove AWS key and rotate immediately. Use environment variables.' },\n { pattern: /-----BEGIN (RSA |EC |DSA )?PRIVATE KEY-----/, severity: 'critical' as const, issue: 'Private key exposed in code', fix: 'Remove private key immediately. Store in secure vault.' },\n { pattern: /ghp_[A-Za-z0-9]{36}/, severity: 'critical' as const, issue: 'GitHub personal access token exposed', fix: 'Revoke token and use environment variables.' },\n { pattern: /sk_live_[A-Za-z0-9]{24,}/, severity: 'critical' as const, issue: 'Stripe live API key exposed', fix: 'Rotate Stripe key immediately. Use environment variables.' },\n { pattern: /xox[baprs]-[A-Za-z0-9-]{10,}/, severity: 'critical' as const, issue: 'Slack token exposed', fix: 'Revoke Slack token and use environment variables.' },\n];\n\nexport class SecurityAgent extends BaseAgent {\n name = 'security';\n description = 'AI-powered security analysis: vulnerabilities, injection risks, authentication issues';\n version = '2.0.0';\n\n shouldActivate(context: CodeContext): boolean {\n return (\n context.touchesAuth ||\n context.touchesDatabase ||\n context.touchesAPI ||\n context.touchesUserData ||\n context.touchesPayments ||\n context.touchesSecurityConfig\n );\n }\n\n /**\n * Check if file should always be skipped\n */\n private shouldAlwaysSkip(filePath: string): boolean {\n return ALWAYS_SKIP_FILES.some(pattern => pattern.test(filePath));\n }\n\n /**\n * Check if file is a test file\n */\n private isTestFile(filePath: string): boolean {\n return TEST_FILE_PATTERNS.some(pattern => pattern.test(filePath));\n }\n\n /**\n * AI-First: Check file relevance for security analysis\n */\n protected override checkFileRelevance(file: string, content: string): FileRelevance {\n if (this.shouldAlwaysSkip(file)) {\n return { isRelevant: false, reason: 'Skip file', priority: 'low', indicators: [] };\n }\n\n const indicators: string[] = [];\n let priority: 'high' | 'medium' | 'low' = 'low';\n \n // Check for security-relevant patterns\n for (const { pattern, reason } of SECURITY_INDICATORS.high) {\n if (pattern.test(content) || pattern.test(file)) {\n indicators.push(reason);\n priority = 'high';\n }\n }\n \n if (priority !== 'high') {\n for (const { pattern, reason } of SECURITY_INDICATORS.medium) {\n if (pattern.test(content)) {\n indicators.push(reason);\n if (priority === 'low') priority = 'medium';\n }\n }\n }\n \n // Even low-priority files might have issues\n if (indicators.length === 0) {\n for (const { pattern, reason } of SECURITY_INDICATORS.low) {\n if (pattern.test(content)) {\n indicators.push(reason);\n }\n }\n }\n\n return {\n isRelevant: indicators.length > 0 || content.length > 100,\n reason: indicators.length > 0 ? `Contains: ${indicators.slice(0, 3).join(', ')}` : 'General review',\n priority,\n indicators\n };\n }\n\n /**\n * Get the security-focused system prompt\n */\n protected getSystemPrompt(): string {\n return `You are a senior security engineer performing a thorough security audit.\nYour goal is to find REAL vulnerabilities, not theoretical issues.\n\nFOCUS ON:\n1. **Injection Attacks**: SQL injection, command injection, XSS, template injection\n2. **Authentication Flaws**: Weak passwords, missing auth, session issues, JWT problems\n3. **Authorization Bypass**: Missing access controls, IDOR, privilege escalation\n4. **Secrets Exposure**: Hardcoded credentials, API keys, tokens in code\n5. **Data Exposure**: PII leaks, sensitive data in logs, insecure storage\n6. **Cryptographic Issues**: Weak algorithms, hardcoded keys, insecure random\n\nBE PRECISE:\n- Only report issues you're confident about (avoid false positives)\n- Provide exact line numbers\n- Explain WHY it's a vulnerability (attack scenario)\n- Give specific, actionable fixes with code examples\n\nSEVERITY GUIDELINES:\n- CRITICAL: Directly exploitable, leads to data breach or RCE\n- SERIOUS: Exploitable with some conditions, significant impact\n- MODERATE: Real issue but limited impact or harder to exploit\n- LOW: Best practice violation, theoretical risk`;\n }\n\n /**\n * Build security-specific analysis prompt\n */\n protected buildUserPrompt(filePath: string, content: string, relevance: FileRelevance): string {\n const isTest = this.isTestFile(filePath);\n \n let prompt = `## Security Audit Request\n\n**File:** \\`${filePath}\\`\n**Security indicators detected:** ${relevance.indicators.join(', ') || 'general review'}\n${isTest ? '**Note:** This is a test file - only flag REAL exposed secrets, not test fixtures.' : ''}\n\n\\`\\`\\`\n${content}\n\\`\\`\\`\n\n## Analysis Instructions\n\nAnalyze this code for security vulnerabilities. For each issue found:\n\n1. **Severity**: critical / serious / moderate / low\n2. **Line number**: Exact line where the issue occurs\n3. **Vulnerability type**: (e.g., SQL Injection, XSS, Hardcoded Secret)\n4. **Description**: What's wrong and why it's dangerous\n5. **Attack scenario**: How an attacker could exploit this\n6. **Fix**: Specific code fix or remediation steps\n\n### Specific checks for this file:`;\n\n // Add context-specific checks based on indicators\n if (relevance.indicators.includes('authentication code')) {\n prompt += `\n- Check for password comparison without hashing\n- Verify JWT validation is complete (signature, expiration, issuer)\n- Look for session fixation vulnerabilities\n- Check for timing attacks in auth comparisons`;\n }\n \n if (relevance.indicators.includes('database operations')) {\n prompt += `\n- Check for SQL injection via string concatenation or template literals\n- Verify parameterized queries are used\n- Look for ORM misuse that could lead to injection`;\n }\n \n if (relevance.indicators.includes('user input handling')) {\n prompt += `\n- Trace user input to dangerous sinks\n- Check for input validation before use\n- Look for reflected XSS opportunities`;\n }\n \n if (relevance.indicators.includes('command execution')) {\n prompt += `\n- Check for command injection via user input\n- Verify shell commands are properly escaped\n- Look for path traversal in file operations`;\n }\n\n prompt += `\n\nIf no significant vulnerabilities are found, respond with:\n\"No significant security issues found in this file.\"`;\n\n return prompt;\n }\n\n /**\n * Override AI enhancement system prompt for security-specific analysis\n */\n protected override getAIEnhancementSystemPrompt(): string {\n return `You are a senior security engineer performing a code audit.\n\nAnalyze the detected issues and code snippets for security vulnerabilities:\n\n1. VALIDATE: Confirm if pattern-detected issues are real vulnerabilities\n2. EXPAND: Find deeper issues - SQL injection, XSS, auth bypass, IDOR, secrets\n3. PRIORITIZE: Rate by exploitability (0-100, where 100 = trivially exploitable)\n4. FIX: Provide secure code fixes\n\nSeverity guide:\n- CRITICAL: Directly exploitable, leads to RCE, data breach, or total auth bypass\n- SERIOUS: Exploitable with conditions, significant impact\n- MODERATE: Real issue but limited impact\n- LOW: Best practice violation\n\nOutput STRICT JSON:\n{\n \"validated\": [{\n \"original_issue\": \"...\",\n \"verdict\": \"TRUE_POSITIVE\" | \"FALSE_POSITIVE\",\n \"confidence\": 0-100,\n \"file\": \"path\",\n \"line\": 123,\n \"severity\": \"critical\",\n \"vulnerability_type\": \"SQL Injection\",\n \"attack_scenario\": \"How to exploit\",\n \"fix\": \"Secure code example\"\n }],\n \"additional\": [{\n \"issue\": \"Vulnerability description\",\n \"file\": \"path\",\n \"line\": 123,\n \"severity\": \"serious\",\n \"vulnerability_type\": \"XSS\",\n \"attack_scenario\": \"How to exploit\",\n \"fix\": \"Secure code\"\n }],\n \"summary\": \"Overall security assessment\"\n}`;\n }\n\n /**\n * Pattern-based analysis for fast detection\n * AI enhancement happens via base class if API key is available\n */\n protected override async analyzeFiles(files: string[], _context: ScanContext): Promise<Issue[]> {\n const issues: Issue[] = [];\n \n for (const file of files) {\n if (this.shouldAlwaysSkip(file)) continue;\n \n try {\n const content = await this.readFile(file);\n const lines = content.split('\\n');\n \n // Check for critical patterns that don't need AI\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i] || '';\n \n for (const { pattern, severity, issue, fix } of CRITICAL_PATTERNS) {\n if (pattern.test(line)) {\n this.progress?.found(severity, `${issue} at line ${i + 1}`);\n issues.push(this.createIssue(\n this.generateIssueId(),\n severity,\n issue,\n fix,\n file,\n i + 1,\n 0.98,\n undefined,\n true\n ));\n }\n }\n }\n } catch {\n // Skip unreadable files\n }\n }\n \n return issues;\n }\n}\n","import { BaseAgent, FileRelevance } from './base-agent.js';\nimport type { Issue, ScanContext, CodeContext } from '../types/index.js';\n\n/**\n * Privacy relevance indicators\n */\nconst PRIVACY_INDICATORS = {\n high: [\n { pattern: /email|phone|ssn|social.*security|passport|driver.*license/i, reason: 'PII fields' },\n { pattern: /credit.*card|card.*number|cvv|expiry/i, reason: 'payment data' },\n { pattern: /password|credential|secret|token/i, reason: 'credentials' },\n { pattern: /gdpr|ccpa|coppa|consent/i, reason: 'compliance mentions' },\n ],\n medium: [\n { pattern: /user.*data|personal.*info|profile/i, reason: 'user data' },\n { pattern: /birth.*date|age|dob/i, reason: 'age data (COPPA)' },\n { pattern: /address|location|geo/i, reason: 'location data' },\n { pattern: /cookie|localStorage|sessionStorage/i, reason: 'client storage' },\n { pattern: /analytics|tracking|pixel/i, reason: 'tracking' },\n ],\n low: [\n { pattern: /name|firstName|lastName/i, reason: 'names' },\n { pattern: /log|console\\.(log|error|warn)/i, reason: 'logging' },\n { pattern: /share|transfer|send.*data/i, reason: 'data transfer' },\n ]\n};\n\n/**\n * Critical privacy patterns that need immediate attention\n */\nconst CRITICAL_PRIVACY_PATTERNS = [\n { \n pattern: /console\\.log\\s*\\([^)]*password/i, \n severity: 'critical' as const, \n issue: 'Password potentially logged',\n fix: 'Remove password from log statements',\n regulation: 'GDPR Article 25'\n },\n { \n pattern: /console\\.log\\s*\\([^)]*ssn/i, \n severity: 'critical' as const, \n issue: 'SSN potentially logged',\n fix: 'Remove SSN from log statements',\n regulation: 'GDPR Article 25'\n },\n { \n pattern: /console\\.log\\s*\\([^)]*credit.*card/i, \n severity: 'critical' as const, \n issue: 'Credit card data potentially logged',\n fix: 'Remove payment data from log statements',\n regulation: 'PCI DSS'\n },\n];\n\nexport class PrivacyAgent extends BaseAgent {\n name = 'privacy';\n description = 'AI-powered privacy analysis: GDPR, CCPA, PCI-DSS compliance';\n version = '2.0.0';\n\n shouldActivate(context: CodeContext): boolean {\n // Focus on user data handling, not healthcare-specific signals\n const hasUserDataSignals = context.touchesUserData && (\n context.touchesDatabase ||\n context.touchesAuth ||\n context.patterns?.hasFormHandling ||\n context.patterns?.hasEmailHandling ||\n context.touchesThirdPartyAPI\n );\n\n const fileNameSignals = context.filePatterns.some(pattern =>\n ['profile', 'account', 'customer', 'member', 'identity'].some(keyword =>\n pattern.includes(keyword)\n )\n );\n\n return hasUserDataSignals || (fileNameSignals && context.touchesDatabase);\n }\n\n /**\n * Check file relevance for privacy analysis\n */\n protected override checkFileRelevance(file: string, content: string): FileRelevance {\n // Skip non-code files\n if (/node_modules|\\.d\\.ts$|\\.min\\.|dist\\/|build\\/|\\.test\\.|\\.spec\\./i.test(file)) {\n return { isRelevant: false, reason: 'Skip file', priority: 'low', indicators: [] };\n }\n\n const indicators: string[] = [];\n let priority: 'high' | 'medium' | 'low' = 'low';\n\n // Check for high-priority indicators\n for (const { pattern, reason } of PRIVACY_INDICATORS.high) {\n if (pattern.test(content) || pattern.test(file)) {\n indicators.push(reason);\n priority = 'high';\n }\n }\n\n // Check medium if not already high\n if (priority !== 'high') {\n for (const { pattern, reason } of PRIVACY_INDICATORS.medium) {\n if (pattern.test(content)) {\n indicators.push(reason);\n if (priority === 'low') priority = 'medium';\n }\n }\n }\n\n // Check if it's a persistence/API file (more relevant for privacy)\n const isPersistenceFile = /(model|schema|entity|migration|prisma|mongoose|db|database)/i.test(file);\n const isApiFile = /(api|route|controller|handler|server)/i.test(file);\n \n if (isPersistenceFile || isApiFile) {\n indicators.push(isPersistenceFile ? 'data storage' : 'API endpoint');\n if (priority === 'low') priority = 'medium';\n }\n\n return {\n isRelevant: indicators.length > 0,\n reason: indicators.length > 0 ? `Contains: ${indicators.slice(0, 3).join(', ')}` : 'General review',\n priority,\n indicators\n };\n }\n\n /**\n * Get privacy-focused system prompt (legacy - kept for reference)\n */\n protected getSystemPrompt(): string {\n return `You are a data privacy officer and compliance expert.\nAnalyze code for privacy violations and data protection issues.\n\nKEY REGULATIONS:\n- **GDPR**: EU data protection (consent, data minimization, right to erasure)\n- **CCPA**: California privacy (disclosure, opt-out, data access)\n- **PCI DSS**: Payment card data security\n\nFOCUS ON:\n1. **PII Handling**: Is personal data encrypted? Properly stored?\n2. **Consent**: Is consent obtained before data collection?\n3. **Data Minimization**: Is only necessary data collected?\n4. **Logging**: Is PII being logged inappropriately?\n5. **Third-Party Sharing**: Is data shared without disclosure?\n6. **Retention**: Are there data deletion mechanisms?\n7. **Access Controls**: Who can access sensitive data?\n\nBE PRECISE:\n- Cite specific regulations when relevant\n- Explain the compliance risk\n- Provide actionable fixes\n\nSEVERITY GUIDELINES:\n- CRITICAL: Clear violation, immediate fix required, fine risk\n- SERIOUS: Likely violation, should fix before audit\n- MODERATE: Best practice violation, recommended fix\n- LOW: Minor concern, nice to have`;\n }\n\n /**\n * Build privacy-specific analysis prompt (legacy - kept for reference)\n */\n protected buildUserPrompt(filePath: string, content: string, relevance: FileRelevance): string {\n const isPersistenceFile = /(model|schema|entity|migration|prisma|mongoose|db|database)/i.test(filePath);\n const isApiFile = /(api|route|controller|handler|server)/i.test(filePath);\n \n let prompt = `## Privacy Compliance Audit\n\n**File:** \\`${filePath}\\`\n**Privacy indicators:** ${relevance.indicators.join(', ') || 'general review'}\n**File type:** ${isPersistenceFile ? 'Data model/storage' : isApiFile ? 'API endpoint' : 'General code'}\n\n\\`\\`\\`\n${content}\n\\`\\`\\`\n\n## Compliance Checks`;\n\n if (relevance.indicators.includes('PII fields')) {\n prompt += `\n\n### PII Data Handling\n- Is PII encrypted at rest?\n- Is PII encrypted in transit?\n- Is there data minimization (only collecting what's needed)?\n- Are there proper access controls?`;\n }\n\n if (relevance.indicators.includes('payment data')) {\n prompt += `\n\n### PCI DSS Compliance (Payment Data)\n- Is card data encrypted?\n- Is CVV NOT being stored?\n- Are there access controls?\n- Is data properly tokenized?`;\n }\n\n if (relevance.indicators.includes('tracking') || relevance.indicators.includes('client storage')) {\n prompt += `\n\n### Cookie/Tracking Consent\n- Is consent obtained before tracking?\n- Is there a cookie consent banner?\n- Are analytics loaded conditionally on consent?`;\n }\n\n prompt += `\n\nFor each issue found, provide:\n1. **Severity** (critical/serious/moderate/low)\n2. **Line number** (if applicable)\n3. **Regulation** violated (GDPR Article X, HIPAA §X, etc.)\n4. **Description** of the privacy risk\n5. **Fix** with specific code or process changes\n\nIf no privacy issues found, respond with:\n\"No significant privacy compliance issues found in this file.\"`;\n\n return prompt;\n }\n\n /**\n * Pattern-based privacy analysis\n */\n protected override async analyzeFiles(files: string[], _context: ScanContext): Promise<Issue[]> {\n const issues: Issue[] = [];\n \n for (const file of files) {\n try {\n const content = await this.readFile(file);\n const lines = content.split('\\n');\n \n // Check for critical privacy patterns\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i] || '';\n \n for (const { pattern, severity, issue, fix, regulation } of CRITICAL_PRIVACY_PATTERNS) {\n if (pattern.test(line)) {\n this.progress?.found(severity, `${issue} at line ${i + 1}`);\n issues.push(this.createIssue(\n this.generateIssueId(),\n severity,\n issue,\n fix,\n file,\n i + 1,\n 0.95,\n regulation,\n true\n ));\n }\n }\n \n // Additional privacy patterns\n // PII in localStorage\n if (/localStorage\\.setItem\\s*\\([^)]*(?:email|ssn|password|phone)/i.test(line)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'serious',\n 'PII stored in localStorage (unencrypted, persists)',\n 'Use encrypted storage or server-side sessions for PII',\n file,\n i + 1,\n 0.90,\n 'GDPR Article 25',\n false\n ));\n }\n \n // Consent not checked before analytics\n if (/gtag|ga\\(|analytics|fbq\\(|pixel/i.test(line) && !/consent|cookie.*accepted/i.test(content)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'moderate',\n 'Analytics/tracking loaded without checking consent',\n 'Only load analytics after user consents (GDPR, CCPA requirement)',\n file,\n i + 1,\n 0.75,\n 'GDPR Article 7',\n false\n ));\n }\n \n // Data retention issues\n if (/delete.*user|remove.*account/i.test(line) && !/backup|archive/i.test(line)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'low',\n 'User deletion - verify data is fully removed from all systems',\n 'Ensure GDPR right to erasure compliance - remove from backups, logs, third parties',\n file,\n i + 1,\n 0.60,\n 'GDPR Article 17',\n false\n ));\n }\n }\n } catch {\n // Skip unreadable files\n }\n }\n \n return issues;\n }\n\n /**\n * AI Enhancement for privacy compliance\n */\n protected override getAIEnhancementSystemPrompt(): string {\n return `You are a privacy compliance expert specializing in GDPR, CCPA, and PCI-DSS.\n\nAnalyze detected issues and code for:\n1. PII handling (encryption, minimization, access controls)\n2. Consent management (cookie banners, tracking consent)\n3. Data retention and right to erasure\n4. Cross-border data transfers\n5. Third-party data sharing\n6. Security measures for personal data\n\nOutput STRICT JSON:\n{\n \"validated\": [{\n \"original_issue\": \"...\",\n \"verdict\": \"TRUE_POSITIVE\" | \"FALSE_POSITIVE\",\n \"confidence\": 0-100,\n \"file\": \"path\",\n \"line\": 123,\n \"severity\": \"critical\",\n \"regulation\": \"GDPR Article X / CCPA / PCI-DSS\",\n \"risk\": \"What could happen if not fixed\",\n \"fix\": \"Compliant implementation\"\n }],\n \"additional\": [{\n \"issue\": \"Privacy issue found\",\n \"file\": \"path\",\n \"line\": 123,\n \"severity\": \"serious\",\n \"regulation\": \"Regulation reference\",\n \"risk\": \"Compliance risk\",\n \"fix\": \"How to fix\"\n }],\n \"summary\": \"Overall privacy compliance assessment\"\n}`;\n }\n}\n","import { BaseAgent } from './base-agent.js';\nimport type { Issue, ScanContext, CodeContext } from '../types/index.js';\nimport { extname } from 'path';\n\n/**\n * Files to always skip type checking\n */\nconst SKIP_FILES = [\n /node_modules\\//,\n /\\.d\\.ts$/,\n /\\.min\\.[jt]s$/,\n /dist\\//,\n /build\\//,\n /\\.test\\.[jt]sx?$/,\n /\\.spec\\.[jt]sx?$/,\n];\n\nexport class TypeCheckAgent extends BaseAgent {\n name = 'typecheck';\n description = 'Catches type errors and ensures type safety';\n version = '1.0.0';\n\n shouldActivate(_context: CodeContext): boolean {\n // TypeCheck runs for all TypeScript/JavaScript files\n return true;\n }\n\n protected async analyzeFiles(files: string[], _context: ScanContext): Promise<Issue[]> {\n const issues: Issue[] = [];\n\n for (const file of files) {\n // Skip files that shouldn't be type-checked\n if (SKIP_FILES.some(pattern => pattern.test(file))) {\n continue;\n }\n \n try {\n const ext = extname(file);\n if (['.ts', '.tsx', '.js', '.jsx'].includes(ext)) {\n const content = await this.readFile(file);\n // DISABLED: TypeScript programmatic checking produces too many false positives\n // because we don't have access to the project's tsconfig.json, node_modules, etc.\n // Instead, rely on pattern-based checks only\n // issues.push(...await this.analyzeTypeScript(content, file));\n issues.push(...await this.analyzeCommonPatterns(content, file));\n }\n } catch (error) {\n console.error(`TypeCheck Agent: Error reading file ${file}:`, error);\n }\n }\n\n return issues;\n }\n\n private async analyzeCommonPatterns(content: string, filePath: string): Promise<Issue[]> {\n const issues: Issue[] = [];\n const lines = content.split('\\n');\n\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i]!;\n const lineNumber = i + 1;\n const trimmedLine = line.trim();\n \n // Skip comments\n if (trimmedLine.startsWith('//') || trimmedLine.startsWith('*') || trimmedLine.startsWith('/*')) {\n continue;\n }\n\n // Only check for the most important, low-noise patterns\n issues.push(...this.checkDangerousAnyTypes(line, filePath, lineNumber));\n }\n\n return issues;\n }\n\n /**\n * Only flag 'any' in dangerous contexts - not every usage\n */\n private checkDangerousAnyTypes(line: string, file: string, lineNumber: number): Issue[] {\n const issues: Issue[] = [];\n \n // Skip if there's an eslint-disable comment\n if (/eslint-disable|@ts-ignore|@ts-expect-error/.test(line)) {\n return issues;\n }\n\n // Only flag 'any' in security-sensitive contexts\n const dangerousAnyPatterns = [\n { pattern: /password.*:\\s*any/i, reason: 'password with any type' },\n { pattern: /token.*:\\s*any/i, reason: 'token with any type' },\n { pattern: /credential.*:\\s*any/i, reason: 'credential with any type' },\n { pattern: /auth.*:\\s*any/i, reason: 'auth data with any type' },\n { pattern: /user.*:\\s*any.*=.*req\\./i, reason: 'user input with any type' },\n ];\n \n for (const { pattern, reason } of dangerousAnyPatterns) {\n if (pattern.test(line)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'serious',\n `Security-sensitive data typed as \"any\": ${reason}`,\n 'Add proper type annotation to ensure type safety for sensitive data',\n file,\n lineNumber,\n 0.85,\n undefined,\n false\n ));\n break;\n }\n }\n\n return issues;\n }\n\n}","import { BaseAgent } from './base-agent.js';\nimport type { Issue, ScanContext, CodeContext } from '../types/index.js';\n\nexport class ComprehensionAgent extends BaseAgent {\n name = 'comprehension';\n description = 'Explains what code does in plain language for non-technical builders';\n version = '1.0.0';\n\n shouldActivate(_context: CodeContext): boolean {\n // Comprehension always runs to help non-technical users understand code\n return true;\n }\n\n protected async analyzeFiles(files: string[], _context: ScanContext): Promise<Issue[]> {\n // Comprehension agent doesn't generate \"issues\" per se,\n // but rather explanations. For now, we'll create explanatory \"issues\"\n const issues: Issue[] = [];\n\n try {\n const summary = await this.generateCodeSummary(files);\n\n // Create a special \"issue\" that's actually an explanation\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'low', // Low severity since it's not really an issue\n 'Code Explanation Available',\n summary,\n files.join(', '),\n undefined,\n 1.0,\n undefined,\n false\n ));\n\n } catch (error) {\n console.error('Comprehension Agent: Error generating explanation:', error);\n }\n\n return issues;\n }\n\n private async generateCodeSummary(files: string[]): Promise<string> {\n let summary = '📖 **WHAT THIS CODE DOES**\\n\\n';\n\n // Analyze what the code appears to be doing based on files and patterns\n const features = this.identifyFeatures(files);\n\n if (features.length > 0) {\n summary += `**Features Detected:**\\n`;\n features.forEach(feature => {\n summary += `- ${feature}\\n`;\n });\n summary += '\\n';\n }\n\n // Identify potential user flows\n const flows = this.identifyUserFlows(files);\n if (flows.length > 0) {\n summary += `**User Flows:**\\n`;\n flows.forEach((flow, index) => {\n summary += `${index + 1}. ${flow}\\n`;\n });\n summary += '\\n';\n }\n\n // Identify potential risks or things to be aware of\n const risks = this.identifyRisks(files);\n if (risks.length > 0) {\n summary += `**What Could Go Wrong:**\\n`;\n risks.forEach(risk => {\n summary += `- ${risk}\\n`;\n });\n summary += '\\n';\n }\n\n // Add technical context for developers\n summary += this.generateTechnicalContext(files);\n\n return summary;\n }\n\n private identifyFeatures(files: string[]): string[] {\n const features: string[] = [];\n const filePatterns = files.map(f => f.toLowerCase()).join(' ');\n\n // Authentication features\n if (/(auth|login|signup|register|session)/.test(filePatterns)) {\n features.push('User Authentication (login/signup system)');\n }\n\n // Payment features\n if (/(payment|stripe|billing|checkout|subscription)/.test(filePatterns)) {\n features.push('Payment Processing (handles money transactions)');\n }\n\n // Database features\n if (/(model|schema|database|migration)/.test(filePatterns)) {\n features.push('Data Storage (saves information to database)');\n }\n\n // API features\n if (/(api|route|endpoint|controller)/.test(filePatterns)) {\n features.push('API Endpoints (handles requests from frontend)');\n }\n\n // UI features\n if (/(component|page|ui|frontend)/.test(filePatterns)) {\n features.push('User Interface (what users see and interact with)');\n }\n\n // Email features\n if (/(email|mail|notification|smtp)/.test(filePatterns)) {\n features.push('Email System (sends emails to users)');\n }\n\n // File upload features\n if (/(upload|file|storage|s3|blob)/.test(filePatterns)) {\n features.push('File Upload (lets users upload documents/images)');\n }\n\n return features;\n }\n\n private identifyUserFlows(files: string[]): string[] {\n const flows: string[] = [];\n const filePatterns = files.map(f => f.toLowerCase()).join(' ');\n\n // Common user flows based on file patterns\n if (/(signup|register)/.test(filePatterns)) {\n flows.push('User signs up → Creates account → Gets welcome email');\n }\n\n if (/(login|auth)/.test(filePatterns)) {\n flows.push('User logs in → System verifies credentials → Creates session');\n }\n\n if (/(checkout|payment)/.test(filePatterns)) {\n flows.push('User adds payment info → System processes payment → Sends receipt');\n }\n\n if (/(profile|settings)/.test(filePatterns)) {\n flows.push('User updates profile → System saves changes → Shows confirmation');\n }\n\n if (/(forgot|reset.*password)/.test(filePatterns)) {\n flows.push('User forgets password → Gets reset email → Sets new password');\n }\n\n if (/(contact|support)/.test(filePatterns)) {\n flows.push('User submits contact form → System sends email → Support team responds');\n }\n\n return flows;\n }\n\n private identifyRisks(files: string[]): string[] {\n const risks: string[] = [];\n const filePatterns = files.map(f => f.toLowerCase()).join(' ');\n\n if (/(auth|login|password)/.test(filePatterns)) {\n risks.push('If password security is weak → Account takeovers possible');\n risks.push('If session management is poor → Users stay logged in forever');\n }\n\n if (/(payment|stripe|billing)/.test(filePatterns)) {\n risks.push('If payment fails → User charged but no product delivered');\n risks.push('If validation is missing → Fraudulent transactions possible');\n }\n\n if (/(database|query|sql)/.test(filePatterns)) {\n risks.push('If SQL injection exists → Hackers can access all data');\n risks.push('If backups fail → Data loss if server crashes');\n }\n\n if (/(api|endpoint|route)/.test(filePatterns)) {\n risks.push('If rate limiting missing → Server overload from spam');\n risks.push('If authentication skipped → Unauthorized data access');\n }\n\n if (/(email|mail|smtp)/.test(filePatterns)) {\n risks.push('If email service down → Users don\\'t get important notifications');\n risks.push('If templates broken → Emails look unprofessional');\n }\n\n return risks;\n }\n\n private generateTechnicalContext(files: string[]): string {\n let context = '**Technical Details:**\\n';\n\n const frameworks = this.detectFrameworks(files);\n if (frameworks.length > 0) {\n context += `- Built with: ${frameworks.join(', ')}\\n`;\n }\n\n const languages = this.detectLanguages(files);\n if (languages.length > 0) {\n context += `- Programming languages: ${languages.join(', ')}\\n`;\n }\n\n const databases = this.detectDatabases(files);\n if (databases.length > 0) {\n context += `- Database: ${databases.join(', ')}\\n`;\n }\n\n context += `- Files analyzed: ${files.length}\\n`;\n\n return context;\n }\n\n private detectFrameworks(files: string[]): string[] {\n const frameworks: string[] = [];\n const patterns = files.join(' ').toLowerCase();\n\n if (/(react|jsx|tsx)/.test(patterns)) frameworks.push('React');\n if (/(vue|\\.vue)/.test(patterns)) frameworks.push('Vue.js');\n if (/(angular|ng)/.test(patterns)) frameworks.push('Angular');\n if (/(express|app\\.js)/.test(patterns)) frameworks.push('Express.js');\n if (/(next|nextjs)/.test(patterns)) frameworks.push('Next.js');\n if (/(nuxt)/.test(patterns)) frameworks.push('Nuxt.js');\n if (/(svelte)/.test(patterns)) frameworks.push('Svelte');\n\n return frameworks;\n }\n\n private detectLanguages(files: string[]): string[] {\n const languages = new Set<string>();\n\n files.forEach(file => {\n const ext = file.split('.').pop()?.toLowerCase();\n switch (ext) {\n case 'ts':\n case 'tsx':\n languages.add('TypeScript');\n break;\n case 'js':\n case 'jsx':\n languages.add('JavaScript');\n break;\n case 'py':\n languages.add('Python');\n break;\n case 'java':\n languages.add('Java');\n break;\n case 'go':\n languages.add('Go');\n break;\n case 'rs':\n languages.add('Rust');\n break;\n case 'php':\n languages.add('PHP');\n break;\n }\n });\n\n return Array.from(languages);\n }\n\n private detectDatabases(files: string[]): string[] {\n const databases: string[] = [];\n const patterns = files.join(' ').toLowerCase();\n\n if (/(postgres|pg|postgresql)/.test(patterns)) databases.push('PostgreSQL');\n if (/(mysql)/.test(patterns)) databases.push('MySQL');\n if (/(mongo|mongodb)/.test(patterns)) databases.push('MongoDB');\n if (/(redis)/.test(patterns)) databases.push('Redis');\n if (/(sqlite)/.test(patterns)) databases.push('SQLite');\n if (/(prisma)/.test(patterns)) databases.push('Prisma ORM');\n if (/(sequelize)/.test(patterns)) databases.push('Sequelize ORM');\n\n return databases;\n }\n}","import { BaseAgent } from './base-agent.js';\nimport type { Issue, ScanContext, CodeContext } from '../types/index.js';\n\nexport class AccessibilityAgent extends BaseAgent {\n name = 'accessibility';\n description = 'WCAG 2.1 accessibility compliance, keyboard nav, screen readers, color contrast';\n version = '1.0.0';\n\n shouldActivate(context: CodeContext): boolean {\n return context.touchesUI;\n }\n\n protected async analyzeFiles(files: string[], _context: ScanContext): Promise<Issue[]> {\n const issues: Issue[] = [];\n\n for (const file of files) {\n try {\n const content = await this.readFile(file);\n issues.push(...this.analyzeAccessibility(content, file));\n issues.push(...this.analyzeUXPatterns(content, file));\n } catch (error) {\n console.error(`Accessibility Agent: Error reading file ${file}:`, error);\n }\n }\n\n return issues;\n }\n\n private analyzeAccessibility(content: string, file: string): Issue[] {\n const issues: Issue[] = [];\n const lines = content.split('\\n');\n\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i]!;\n const lineNumber = i + 1;\n\n // Check for images without alt text\n if (/<img[^>]*(?!alt=)[^>]*>/i.test(line) && !line.includes('alt=')) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'serious',\n 'Image missing alt attribute',\n 'Add descriptive alt text for screen readers: alt=\"description\"',\n file,\n lineNumber,\n 0.95,\n 'WCAG 2.1 - 1.1.1 Non-text Content',\n true\n ));\n }\n\n // Check for click handlers without keyboard support\n if (/onClick.*(?!onKeyDown|onKeyPress|onKeyUp)/i.test(line) && !/button|Button|<a /i.test(line)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'moderate',\n 'Click handler without keyboard equivalent',\n 'Add onKeyDown handler for keyboard accessibility',\n file,\n lineNumber,\n 0.80,\n 'WCAG 2.1 - 2.1.1 Keyboard',\n true\n ));\n }\n\n // Check for missing form labels\n if (/<input[^>]*(?!aria-label|id.*label)/i.test(line) && !/<label/i.test(lines.slice(Math.max(0, i-2), i+2).join(''))) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'moderate',\n 'Form input may be missing accessible label',\n 'Associate input with <label> element or use aria-label',\n file,\n lineNumber,\n 0.70,\n 'WCAG 2.1 - 1.3.1 Info and Relationships',\n true\n ));\n }\n\n // Check for hardcoded colors (accessibility concern)\n if (/color:\\s*['\"]?#[0-9a-fA-F]{3,6}/i.test(line) || /color:\\s*['\"]?rgb\\(/i.test(line)) {\n // Only flag if it looks like low contrast (simplified check)\n if (/#fff|#FFF|white|#000|#333|gray/i.test(line)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'low',\n 'Potential color contrast issue',\n 'Ensure color contrast ratio meets WCAG AA (4.5:1 for normal text)',\n file,\n lineNumber,\n 0.60,\n 'WCAG 2.1 - 1.4.3 Contrast',\n false\n ));\n }\n }\n\n // Check for focus outline removal\n if (/outline:\\s*none|outline:\\s*0/i.test(line)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'serious',\n 'Focus outline removed - breaks keyboard navigation',\n 'Provide alternative focus indicator instead of removing outline',\n file,\n lineNumber,\n 0.90,\n 'WCAG 2.1 - 2.4.7 Focus Visible',\n true\n ));\n }\n }\n\n return issues;\n }\n\n private analyzeUXPatterns(content: string, file: string): Issue[] {\n const issues: Issue[] = [];\n const lines = content.split('\\n');\n\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i]!;\n const lineNumber = i + 1;\n\n // Check for disabled buttons without explanation\n if (/disabled(?!=\\{false\\})/i.test(line) && !/title=|aria-describedby/i.test(line)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'low',\n 'Disabled element without explanation',\n 'Add tooltip or text explaining why the action is unavailable',\n file,\n lineNumber,\n 0.70,\n undefined,\n true\n ));\n }\n\n // Check for placeholder-only inputs\n if (/placeholder=/i.test(line) && !/<label|aria-label/i.test(lines.slice(Math.max(0, i-2), i+2).join(''))) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'moderate',\n 'Input uses placeholder as only label',\n 'Add visible label - placeholder disappears when user types',\n file,\n lineNumber,\n 0.75,\n undefined,\n true\n ));\n }\n\n // Check for empty links\n if (/<a[^>]*>\\s*<\\/a>/i.test(line) || /href=['\"]#['\"]/i.test(line)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'moderate',\n 'Empty or placeholder link',\n 'Add meaningful href and link text',\n file,\n lineNumber,\n 0.85,\n 'WCAG 2.1 - 2.4.4 Link Purpose',\n true\n ));\n }\n }\n\n return issues;\n }\n\n /**\n * AI Enhancement for accessibility review\n */\n protected override getAIEnhancementSystemPrompt(): string {\n return `You are a WCAG 2.1 accessibility expert. Review code for inclusive design.\n\nAnalyze detected issues and code for:\n1. Screen reader compatibility (ARIA labels, roles, live regions)\n2. Keyboard navigation (focus management, tab order, focus trapping)\n3. Color contrast (4.5:1 for text, 3:1 for large text)\n4. Form accessibility (labels, error messages, required fields)\n5. Dynamic content (loading states, announcements, focus management)\n6. Reduced motion support (prefers-reduced-motion)\n7. Touch target sizes (44x44px minimum)\n\nOutput STRICT JSON:\n{\n \"validated\": [{\n \"original_issue\": \"...\",\n \"verdict\": \"TRUE_POSITIVE\" | \"FALSE_POSITIVE\",\n \"confidence\": 0-100,\n \"file\": \"path\",\n \"line\": 123,\n \"severity\": \"serious\",\n \"wcag_criterion\": \"WCAG 2.1 - X.X.X Name\",\n \"impact\": \"How this affects users with disabilities\",\n \"fix\": \"Accessible code fix\"\n }],\n \"additional\": [{\n \"issue\": \"Accessibility issue found\",\n \"file\": \"path\",\n \"line\": 123,\n \"severity\": \"moderate\",\n \"wcag_criterion\": \"WCAG criterion\",\n \"impact\": \"User impact\",\n \"fix\": \"Accessible implementation\"\n }],\n \"summary\": \"Overall accessibility assessment\"\n}`;\n }\n}\n","import { BaseAgent } from './base-agent.js';\nimport type { Issue, ScanContext, CodeContext } from '../types/index.js';\n\n/**\n * AI Slop Colors — Common AI-generated color anti-patterns\n * These are the garish, oversaturated colors that scream \"AI made this\"\n */\nconst AI_SLOP_COLORS = [\n // Neon/toxic greens (AI loves these for \"success\")\n { pattern: /#[0-4][eEfF][0-5][0-4][0-2][0-4]/i, name: 'toxic neon green', suggestion: 'emerald-500 (#10b981) or green-600 (#16a34a)' },\n { pattern: /#00[fF][fF]00/i, name: 'pure lime green', suggestion: 'emerald-400 (#34d399) for a modern SaaS look' },\n { pattern: /#[0-3][fF][fF][0-3][fF][0-3]/i, name: 'cyan-green neon', suggestion: 'teal-500 (#14b8a6) for sophistication' },\n \n // Garish purples/magentas\n { pattern: /#[fF][0-3][0-5][fF][0-3][fF]/i, name: 'hot magenta', suggestion: 'fuchsia-500 (#d946ef) or violet-500 (#8b5cf6)' },\n { pattern: /#[8-9aA][0-3][0-3][fF][fF][fF]/i, name: 'electric purple', suggestion: 'indigo-500 (#6366f1) for a Stripe-like feel' },\n \n // Oversaturated blues\n { pattern: /#00[0-5][0-5][fF][fF]/i, name: 'electric blue', suggestion: 'blue-600 (#2563eb) or sky-500 (#0ea5e9)' },\n { pattern: /#0{4}[fF]{2}/i, name: 'pure blue', suggestion: 'blue-500 (#3b82f6) for modern SaaS' },\n \n // Harsh reds\n { pattern: /#[fF][fF]0{4}/i, name: 'pure red', suggestion: 'rose-500 (#f43f5e) or red-500 (#ef4444)' },\n { pattern: /#[fF][0-3][0-3][0-3][0-3][0-3]/i, name: 'harsh red', suggestion: 'rose-600 (#e11d48) for errors, or softer coral (#fb7185)' },\n \n // Dated yellows/oranges\n { pattern: /#[fF][fF][fF][fF]00/i, name: 'pure yellow', suggestion: 'amber-400 (#fbbf24) or yellow-500 (#eab308)' },\n { pattern: /#[fF][fF][aA-fF]000/i, name: 'orange-yellow', suggestion: 'amber-500 (#f59e0b) for warnings' },\n \n // Gray issues\n { pattern: /#[8-9][8-9][8-9][8-9][8-9][8-9]/i, name: 'flat mid-gray', suggestion: 'slate-400 (#94a3b8) or zinc-500 (#71717a) for depth' },\n { pattern: /#[cC][cC][cC][cC][cC][cC]/i, name: 'washed-out gray', suggestion: 'slate-300 (#cbd5e1) or neutral-300 (#d4d4d4)' },\n];\n\n/**\n * Modern SaaS Color Palettes — Inspired by top sites on saaslandingpage.com and Awwwards\n * These are the color schemes that define premium SaaS design in 2024-2025\n */\nconst MODERN_PALETTES = {\n // Dark mode palettes (most popular on Awwwards)\n vercel: {\n name: 'Vercel/Next.js',\n bg: '#000000',\n surface: '#111111',\n border: '#333333',\n text: '#ededed',\n muted: '#888888',\n accent: '#0070f3',\n },\n linear: {\n name: 'Linear',\n bg: '#000212',\n surface: '#0a0a1a',\n border: '#1a1a2e',\n text: '#f7f8f8',\n muted: '#8f9ba8',\n accent: '#5e6ad2',\n },\n stripe: {\n name: 'Stripe',\n bg: '#0a2540',\n surface: '#0d3358',\n border: '#1a4a70',\n text: '#ffffff',\n muted: '#adbdcc',\n accent: '#635bff',\n },\n \n // Light mode palettes\n notion: {\n name: 'Notion',\n bg: '#ffffff',\n surface: '#f7f6f3',\n border: '#e3e2de',\n text: '#37352f',\n muted: '#9b9a97',\n accent: '#2eaadc',\n },\n figma: {\n name: 'Figma',\n bg: '#ffffff',\n surface: '#f5f5f5',\n border: '#e5e5e5',\n text: '#1e1e1e',\n muted: '#8c8c8c',\n accent: '#0d99ff',\n },\n framer: {\n name: 'Framer',\n bg: '#ffffff',\n surface: '#fafafa',\n border: '#ebebeb',\n text: '#171717',\n muted: '#666666',\n accent: '#0055ff',\n },\n};\n\n/**\n * Motion Libraries & Creative Effects — Codrops/Awwwards-level\n * Suggests based on project context\n */\nconst MOTION_LIBRARIES = {\n react: [\n { name: 'framer-motion', desc: 'Production-ready motion library for React', use: 'Complex animations, gestures, layout animations, shared element transitions' },\n { name: '@react-spring/web', desc: 'Spring-physics based animations', use: 'Natural-feeling animations, physics-based motion' },\n { name: '@formkit/auto-animate', desc: 'Zero-config animations', use: 'Quick wins: list reordering, enter/exit animations' },\n { name: 'motion', desc: 'Motion One for React', use: 'Lightweight, performant micro-interactions' },\n ],\n threejs: [\n { name: '@react-three/fiber', desc: 'React renderer for Three.js', use: '3D scenes, product showcases, immersive experiences' },\n { name: '@react-three/drei', desc: 'Useful helpers for R3F', use: 'Camera controls, loaders, abstractions' },\n { name: '@react-three/postprocessing', desc: 'Post-processing effects', use: 'Bloom, depth of field, glitch effects' },\n ],\n scroll: [\n { name: '@studio-freight/lenis', desc: 'Smooth scroll library', use: 'Butter-smooth scrolling, parallax foundations' },\n { name: 'locomotive-scroll', desc: 'Smooth scroll + parallax', use: 'Scroll-triggered animations, parallax sections' },\n { name: 'gsap/ScrollTrigger', desc: 'GSAP scroll animations', use: 'Scroll-linked animations, pinning, scrubbing' },\n ],\n gsap: [\n { name: 'gsap', desc: 'Professional animation library', use: 'Complex timelines, morphing, text animations' },\n { name: 'gsap/ScrollTrigger', desc: 'Scroll-based animations', use: 'Reveal on scroll, parallax, pinned sections' },\n { name: 'gsap/SplitText', desc: 'Text animation plugin', use: 'Character/word/line animations (Club GreenSock)' },\n { name: 'gsap/MorphSVGPlugin', desc: 'SVG morphing', use: 'Shape morphing, path animations (Club GreenSock)' },\n ],\n creative: [\n { name: 'splitting', desc: 'Text/element splitting', use: 'Character-by-character animations, free alternative to SplitText' },\n { name: 'rellax', desc: 'Lightweight parallax', use: 'Simple parallax effects without heavy libraries' },\n { name: 'atropos', desc: '3D parallax hover effects', use: 'Card tilt effects, depth on hover' },\n { name: 'typed.js', desc: 'Typing animations', use: 'Typewriter effects for hero sections' },\n ],\n};\n\n/**\n * Project context detection for appropriate effect recommendations\n */\nconst PROJECT_CONTEXTS = {\n marketing: {\n patterns: [/landing|hero|pricing|features|testimonial|cta|homepage/i, /marketing|campaign|launch/i],\n effects: ['3D product showcases', 'scroll-triggered reveals', 'parallax sections', 'text animations', 'gradient meshes'],\n },\n dashboard: {\n patterns: [/dashboard|admin|analytics|settings|sidebar|table|chart/i],\n effects: ['subtle micro-interactions', 'skeleton loaders', 'toast animations', 'chart transitions'],\n },\n ecommerce: {\n patterns: [/product|cart|checkout|shop|store|catalog/i],\n effects: ['image zoom', 'add-to-cart animations', 'filter transitions', 'product card hovers'],\n },\n portfolio: {\n patterns: [/portfolio|gallery|showcase|project|work|case-study/i],\n effects: ['image reveals', 'cursor effects', 'page transitions', 'scroll-linked galleries'],\n },\n};\n\n/**\n * Design Engineer Agent — Award-Winning Frontend Craft\n * \n * This agent thinks like a design engineer at a top creative agency.\n * It reviews code for the kind of polish that wins Awwwards and gets featured on Codrops.\n * \n * Focus areas:\n * - Color systems (detecting AI slop, suggesting modern palettes)\n * - Motion libraries (Framer Motion, GSAP, Three.js, Lenis)\n * - Design systems & tokens (spacing, typography, color scales)\n * - Motion design & micro-interactions\n * - Visual hierarchy & layout systems\n * - Creative CSS techniques (gradients, blend modes, masks, clip-paths)\n * - Performance-conscious animations (GPU layers, will-change, FLIP)\n * - Responsive & fluid design (clamp, container queries, aspect-ratio)\n * - Modern CSS features (cascade layers, :has(), subgrid, anchor positioning)\n * \n * Inspiration sources:\n * - saaslandingpage.com (890+ landing page examples)\n * - awwwards.com (award-winning web design)\n * - codrops.com (creative frontend tutorials)\n * - Linear, Vercel, Stripe, Notion, Figma, Framer\n */\nexport class DesignEngineerAgent extends BaseAgent {\n name = 'design-engineer';\n description = 'Award-winning frontend craft: design systems, motion design, creative CSS, modern color palettes, Awwwards-level polish';\n version = '2.0.0';\n\n shouldActivate(context: CodeContext): boolean {\n return context.touchesUI;\n }\n\n protected async analyzeFiles(files: string[], _context: ScanContext): Promise<Issue[]> {\n const issues: Issue[] = [];\n\n // Detect project context from all files\n const allContent = await this.getAllContent(files);\n const projectContext = this.detectProjectContext(allContent);\n const hasMotionLibrary = this.detectMotionLibraries(allContent);\n\n for (const file of files) {\n try {\n const content = await this.readFile(file);\n \n // Only analyze frontend files\n if (this.isFrontendFile(file)) {\n issues.push(...this.analyzeColorPalette(content, file));\n issues.push(...this.analyzeMotionLibraries(content, file, hasMotionLibrary, projectContext));\n issues.push(...this.analyzeDesignSystem(content, file));\n issues.push(...this.analyzeMotionDesign(content, file));\n issues.push(...this.analyzeVisualCraft(content, file));\n issues.push(...this.analyzeModernCSS(content, file));\n issues.push(...this.analyzePerformance(content, file));\n }\n } catch (error) {\n console.error(`Design Engineer Agent: Error reading file ${file}:`, error);\n }\n }\n\n return issues;\n }\n\n /**\n * Get all content from files for context detection\n */\n private async getAllContent(files: string[]): Promise<string> {\n const contents: string[] = [];\n for (const file of files.slice(0, 20)) { // Limit to first 20 files\n try {\n const content = await this.readFile(file);\n contents.push(content);\n } catch {\n // Skip files that can't be read\n }\n }\n return contents.join('\\n');\n }\n\n /**\n * Detect project context (marketing, dashboard, ecommerce, portfolio)\n */\n private detectProjectContext(content: string): string {\n for (const [context, config] of Object.entries(PROJECT_CONTEXTS)) {\n for (const pattern of config.patterns) {\n if (pattern.test(content)) {\n return context;\n }\n }\n }\n return 'general';\n }\n\n /**\n * Detect which motion libraries are already installed\n */\n private detectMotionLibraries(content: string): Set<string> {\n const detected = new Set<string>();\n \n if (/framer-motion|from ['\"]framer-motion['\"]/.test(content)) detected.add('framer-motion');\n if (/gsap|from ['\"]gsap['\"]/.test(content)) detected.add('gsap');\n if (/@react-three\\/fiber|from ['\"]@react-three\\/fiber['\"]/.test(content)) detected.add('three');\n if (/lenis|locomotive-scroll/.test(content)) detected.add('scroll');\n if (/react-spring|@react-spring/.test(content)) detected.add('react-spring');\n if (/auto-animate|@formkit\\/auto-animate/.test(content)) detected.add('auto-animate');\n \n return detected;\n }\n\n private isFrontendFile(file: string): boolean {\n return /\\.(tsx|jsx|vue|svelte|astro|css|scss|sass|less|styled\\.(ts|js))$/.test(file);\n }\n\n /**\n * Analyze color palette for AI slop and suggest modern alternatives\n * Inspired by top SaaS sites: Linear, Vercel, Stripe, Notion, Figma, Framer\n */\n private analyzeColorPalette(content: string, file: string): Issue[] {\n const issues: Issue[] = [];\n const lines = content.split('\\n');\n\n // Track all colors found for overall palette analysis\n const colorsFound: { hex: string; line: number }[] = [];\n\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i]!;\n const lineNumber = i + 1;\n\n // Extract hex colors\n const hexMatches = line.matchAll(/#[0-9a-fA-F]{3,8}\\b/g);\n for (const match of hexMatches) {\n const hex = match[0].toLowerCase();\n colorsFound.push({ hex, line: lineNumber });\n\n // Check against AI slop patterns\n for (const slop of AI_SLOP_COLORS) {\n if (slop.pattern.test(hex)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'moderate',\n `AI slop color detected: ${slop.name} (${hex})`,\n `Replace with modern SaaS palette: ${slop.suggestion}. See Linear, Vercel, Stripe for inspiration.`,\n file,\n lineNumber,\n 0.85,\n undefined,\n true\n ));\n break;\n }\n }\n\n // Check for fully saturated primary colors (pure RGB)\n if (/^#(ff0000|00ff00|0000ff|ffff00|ff00ff|00ffff)$/i.test(hex)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'serious',\n `Pure saturated color ${hex} — looks amateur, not SaaS-ready`,\n 'Use desaturated alternatives. Modern SaaS uses muted, sophisticated colors. Try Tailwind\\'s color palette or Linear\\'s scheme.',\n file,\n lineNumber,\n 0.95,\n undefined,\n true\n ));\n }\n }\n\n // Check for dated gradient patterns\n if (/linear-gradient|radial-gradient/i.test(line)) {\n // Check for rainbow gradients (multiple saturated colors)\n const gradientColors = line.match(/#[0-9a-fA-F]{3,8}/g) || [];\n if (gradientColors.length >= 3) {\n const hasSaturated = gradientColors.some(c => \n /^#(ff|00)[0-9a-f]{4}$/i.test(c) || /^#[0-9a-f]{2}(ff|00)[0-9a-f]{2}$/i.test(c)\n );\n if (hasSaturated) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'moderate',\n 'Multi-color gradient with saturated colors — can look dated or garish',\n 'Modern SaaS uses subtle gradients: 2 colors max, low saturation, or monochromatic. See Stripe\\'s gradient mesh.',\n file,\n lineNumber,\n 0.75,\n undefined,\n false\n ));\n }\n }\n }\n\n // Check for black text on white (suggest slightly off-white/black for sophistication)\n if (/#000000|#ffffff/i.test(line) && /color:|background:/i.test(line)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'low',\n 'Pure black/white detected — consider off-black/off-white for sophistication',\n 'Modern SaaS uses near-black (#171717, #0a0a0a) and near-white (#fafafa, #f5f5f5). Pure #000/#fff can feel harsh.',\n file,\n lineNumber,\n 0.65,\n undefined,\n false\n ));\n }\n }\n\n // Analyze overall palette coherence\n if (colorsFound.length > 5) {\n const uniqueColors = new Set(colorsFound.map(c => c.hex));\n if (uniqueColors.size > 15) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'moderate',\n `${uniqueColors.size} unique colors detected — palette lacks cohesion`,\n `Modern SaaS uses 5-8 core colors max. Establish a design system with tokens: --color-primary, --color-surface, --color-text, --color-muted, --color-accent. Reference: ${this.getRandomPaletteRecommendation()}`,\n file,\n undefined,\n 0.80,\n undefined,\n false\n ));\n }\n\n // Detect over-reliance on violet/purple tones (common AI-slop overuse)\n let violetCount = 0;\n for (const { hex } of colorsFound) {\n const rgb = this.hexToRgb(hex);\n if (!rgb) continue;\n const hue = this.rgbToHue(rgb.r, rgb.g, rgb.b);\n if (hue >= 250 && hue <= 310) violetCount++;\n }\n if (violetCount >= 3 && violetCount / colorsFound.length > 0.35) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'moderate',\n 'Palette leans heavily on violet/purple — looks templated/AI-generated',\n 'Use Josef Albers “Interaction of Color” approach: constrain to 1-2 hue families, anchor with neutrals, and build contrast via value/temperature shifts rather than piling on violet gradients.',\n file,\n undefined,\n 0.78,\n undefined,\n false\n ));\n }\n }\n\n return issues;\n }\n\n /**\n * Convert hex color to RGB\n */\n private hexToRgb(hex: string): { r: number; g: number; b: number } | null {\n const normalized = hex.replace('#', '');\n if (normalized.length === 3) {\n const r = parseInt(normalized[0] + normalized[0], 16);\n const g = parseInt(normalized[1] + normalized[1], 16);\n const b = parseInt(normalized[2] + normalized[2], 16);\n return { r, g, b };\n }\n if (normalized.length === 6) {\n const r = parseInt(normalized.slice(0, 2), 16);\n const g = parseInt(normalized.slice(2, 4), 16);\n const b = parseInt(normalized.slice(4, 6), 16);\n return { r, g, b };\n }\n return null;\n }\n\n /**\n * Calculate hue in degrees from RGB\n */\n private rgbToHue(r: number, g: number, b: number): number {\n const rNorm = r / 255;\n const gNorm = g / 255;\n const bNorm = b / 255;\n const max = Math.max(rNorm, gNorm, bNorm);\n const min = Math.min(rNorm, gNorm, bNorm);\n const delta = max - min;\n\n if (delta === 0) return 0;\n\n let hue: number;\n switch (max) {\n case rNorm:\n hue = ((gNorm - bNorm) / delta) % 6;\n break;\n case gNorm:\n hue = (bNorm - rNorm) / delta + 2;\n break;\n default:\n hue = (rNorm - gNorm) / delta + 4;\n break;\n }\n\n hue *= 60;\n if (hue < 0) hue += 360;\n return hue;\n }\n\n /**\n * Get a random modern palette recommendation\n */\n private getRandomPaletteRecommendation(): string {\n const palettes = Object.values(MODERN_PALETTES);\n const palette = palettes[Math.floor(Math.random() * palettes.length)]!;\n return `${palette.name} palette: bg ${palette.bg}, text ${palette.text}, accent ${palette.accent}`;\n }\n\n /**\n * Analyze motion library usage and suggest Awwwards-level effects\n */\n private analyzeMotionLibraries(content: string, file: string, hasLibraries: Set<string>, projectContext: string): Issue[] {\n const issues: Issue[] = [];\n const isReact = /from ['\"]react['\"]|import React/.test(content);\n const hasAnimations = /animation|transition|@keyframes|animate/i.test(content);\n const purposefulMotionSignals =\n hasAnimations ||\n /hero|landing|modal|dialog|drawer|toast|tooltip|hover|scroll|parallax|reveal|transition|carousel|slider|gallery/i.test(content);\n\n // Avoid pushing motion where it isn't needed; default to stillness unless the UI already implies motion affordances.\n if (!purposefulMotionSignals) {\n return issues;\n }\n \n // Check for CSS-only animations in React that could use Framer Motion\n if (isReact && !hasLibraries.has('framer-motion') && !hasLibraries.has('react-spring')) {\n // Detect complex animation patterns that would benefit from a motion library\n if (/useState.*animation|setAnimation|isAnimating|animationState/i.test(content)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'moderate',\n 'Manual animation state management — use Framer Motion instead',\n `Install framer-motion for declarative animations: \\`npm i framer-motion\\`. Replace useState + CSS with <motion.div animate={{ ... }} />. See: https://www.framer.com/motion/`,\n file,\n undefined,\n 0.80,\n undefined,\n false\n ));\n }\n\n // Detect list animations that could use AnimatePresence\n if (/\\.map\\s*\\(.*\\).*\\.(filter|sort)|filter\\(.*\\)\\.map/.test(content) && hasAnimations) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'low',\n 'List filtering without exit animations — use AnimatePresence',\n 'Framer Motion\\'s AnimatePresence handles enter/exit animations for lists: <AnimatePresence>{items.map(...)}</AnimatePresence>',\n file,\n undefined,\n 0.70,\n undefined,\n false\n ));\n }\n\n // Detect layout shifts that could use layout animations\n if (/grid|flex.*gap|justify|align/i.test(content) && /setState|dispatch|set[A-Z]/.test(content)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'low',\n 'Layout changes without animation — consider layout prop',\n 'Framer Motion\\'s layout prop auto-animates position/size changes: <motion.div layout>. Creates smooth reflow animations.',\n file,\n undefined,\n 0.60,\n undefined,\n false\n ));\n }\n }\n\n // Check for scroll-based content without scroll library\n if (!hasLibraries.has('scroll') && !hasLibraries.has('gsap')) {\n if (/scroll|parallax|reveal|fade.*in|slide.*in/i.test(content)) {\n const contextConfig = PROJECT_CONTEXTS[projectContext as keyof typeof PROJECT_CONTEXTS];\n const effects = contextConfig?.effects?.join(', ') || 'scroll-triggered animations';\n \n issues.push(this.createIssue(\n this.generateIssueId(),\n 'low',\n 'Scroll-based effects without a scroll library',\n `For ${projectContext} sites, consider: Lenis for smooth scrolling (\\`npm i @studio-freight/lenis\\`), GSAP ScrollTrigger for ${effects}. See Codrops for inspiration.`,\n file,\n undefined,\n 0.65,\n undefined,\n false\n ));\n }\n }\n\n // Check for hero/landing sections that could use 3D\n if (projectContext === 'marketing' || projectContext === 'portfolio') {\n if (/hero|landing|showcase|featured/i.test(file) || /Hero|Landing|Showcase/.test(content)) {\n if (!hasLibraries.has('three')) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'low',\n 'Hero section opportunity — consider 3D/WebGL elements',\n 'For Awwwards-level impact, add 3D with React Three Fiber: `npm i @react-three/fiber @react-three/drei`. Start with a simple floating object or gradient orb. See: https://codrops.com/tag/threejs/',\n file,\n undefined,\n 0.50,\n undefined,\n false\n ));\n }\n }\n }\n\n // Check for text that could have character animations\n if (/heading|title|h1|h2|hero.*text/i.test(content) && !hasLibraries.has('gsap')) {\n if (!/split|char|letter/i.test(content)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'low',\n 'Headings without text animation — add character reveals',\n 'Use Splitting.js (free) or GSAP SplitText for character-by-character animations. Classic Awwwards effect: staggered character reveals on scroll.',\n file,\n undefined,\n 0.55,\n undefined,\n false\n ));\n }\n }\n\n // Suggest specific effects based on project context\n if (projectContext !== 'general' && !hasLibraries.has('framer-motion') && !hasLibraries.has('gsap')) {\n const contextConfig = PROJECT_CONTEXTS[projectContext as keyof typeof PROJECT_CONTEXTS];\n if (contextConfig) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'low',\n `${projectContext.charAt(0).toUpperCase() + projectContext.slice(1)} site detected — add motion polish`,\n `Recommended effects for ${projectContext}: ${contextConfig.effects.join(', ')}. Start with Framer Motion for React or GSAP for vanilla JS.`,\n file,\n undefined,\n 0.60,\n undefined,\n false\n ));\n }\n }\n\n return issues;\n }\n\n /**\n * Analyze design system patterns\n */\n private analyzeDesignSystem(content: string, file: string): Issue[] {\n const issues: Issue[] = [];\n const lines = content.split('\\n');\n\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i]!;\n const lineNumber = i + 1;\n\n // Check for magic numbers in spacing\n if (/margin|padding|gap|top|left|right|bottom/i.test(line)) {\n const magicPx = line.match(/:\\s*(\\d+)px/);\n if (magicPx && !['0', '1', '2'].includes(magicPx[1]!)) {\n const value = parseInt(magicPx[1]!);\n // Check if it's not on a standard scale (4, 8, 12, 16, 20, 24, 32, 40, 48, 64, 80, 96)\n const scale = [4, 8, 12, 16, 20, 24, 32, 40, 48, 64, 80, 96, 128];\n if (!scale.includes(value)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'low',\n `Magic number ${value}px — consider using a spacing token`,\n `Use a design token like --space-${Math.round(value / 4)} or spacing scale (4, 8, 12, 16, 24, 32...)`,\n file,\n lineNumber,\n 0.60,\n undefined,\n false\n ));\n }\n }\n }\n\n // Check for hardcoded colors outside of design tokens\n if (/color|background|border|fill|stroke/i.test(line)) {\n const hardcodedHex = line.match(/#[0-9a-fA-F]{3,8}(?![0-9a-fA-F])/);\n const hardcodedRgb = line.match(/rgba?\\s*\\(\\s*\\d+/);\n if ((hardcodedHex || hardcodedRgb) && !line.includes('var(--')) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'low',\n 'Hardcoded color value — use a design token',\n 'Define colors in CSS custom properties: var(--color-primary), var(--color-surface), etc.',\n file,\n lineNumber,\n 0.70,\n undefined,\n false\n ));\n }\n }\n\n // Check for inconsistent font sizes\n if (/font-size/i.test(line)) {\n const pxSize = line.match(/font-size:\\s*(\\d+)px/);\n if (pxSize) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'low',\n 'Fixed font-size in px — consider fluid typography',\n 'Use clamp() for responsive text: font-size: clamp(1rem, 2vw + 0.5rem, 1.5rem)',\n file,\n lineNumber,\n 0.65,\n undefined,\n false\n ));\n }\n }\n\n // Check for z-index chaos\n if (/z-index:\\s*(\\d+)/.test(line)) {\n const zValue = parseInt(line.match(/z-index:\\s*(\\d+)/)?.[1] || '0');\n if (zValue > 100 && zValue !== 9999) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'moderate',\n `High z-index (${zValue}) — establish a z-index scale`,\n 'Create z-index tokens: --z-dropdown: 100, --z-modal: 200, --z-toast: 300, --z-tooltip: 400',\n file,\n lineNumber,\n 0.75,\n undefined,\n false\n ));\n }\n }\n }\n\n return issues;\n }\n\n /**\n * Analyze motion design patterns\n */\n private analyzeMotionDesign(content: string, file: string): Issue[] {\n const issues: Issue[] = [];\n const lines = content.split('\\n');\n\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i]!;\n const lineNumber = i + 1;\n\n // Check for transition without easing or with linear\n if (/transition/i.test(line) && !line.includes('cubic-bezier') && !line.includes('ease')) {\n if (line.includes('linear') || !/ease|cubic|spring/.test(line)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'low',\n 'Transition using linear timing — add easing for polish',\n 'Use custom easing: cubic-bezier(0.22, 1, 0.36, 1) for smooth deceleration, or ease-out for exits',\n file,\n lineNumber,\n 0.70,\n undefined,\n false\n ));\n }\n }\n\n // Check for very short transitions (< 100ms)\n if (/transition.*(\\d+)ms/.test(line)) {\n const duration = parseInt(line.match(/(\\d+)ms/)?.[1] || '0');\n if (duration > 0 && duration < 100) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'low',\n `Very short transition (${duration}ms) — may feel jarring`,\n 'Micro-interactions work best at 150-300ms. Use 100ms minimum for perceivable motion.',\n file,\n lineNumber,\n 0.60,\n undefined,\n false\n ));\n }\n }\n\n // Check for animation without reduced-motion handling\n if (/@keyframes|animation:/i.test(line)) {\n // Look for prefers-reduced-motion in the file\n if (!content.includes('prefers-reduced-motion')) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'moderate',\n 'Animation without reduced-motion fallback',\n 'Add @media (prefers-reduced-motion: reduce) { animation: none } for motion-sensitive users',\n file,\n lineNumber,\n 0.80,\n undefined,\n false\n ));\n }\n }\n\n // Suggest staggered animations for lists\n if (/\\.map\\s*\\(|v-for|ngFor|\\*ngFor|{#each/.test(line)) {\n const nextLines = lines.slice(i, i + 10).join('\\n');\n if (nextLines.includes('animation') && !nextLines.includes('delay') && !nextLines.includes('stagger')) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'low',\n 'List items animate without stagger — add animation delay',\n 'Stagger reveals with animation-delay: calc(var(--index) * 50ms) for Awwwards-level polish',\n file,\n lineNumber,\n 0.65,\n undefined,\n false\n ));\n }\n }\n }\n\n return issues;\n }\n\n /**\n * Analyze visual craft and creative techniques\n */\n private analyzeVisualCraft(content: string, file: string): Issue[] {\n const issues: Issue[] = [];\n const lines = content.split('\\n');\n\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i]!;\n const lineNumber = i + 1;\n\n // Check for box-shadow without layering\n if (/box-shadow:/i.test(line) && !line.includes(',')) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'low',\n 'Single-layer box-shadow — layer shadows for depth',\n 'Use layered shadows: box-shadow: 0 1px 2px rgba(0,0,0,.1), 0 4px 12px rgba(0,0,0,.1)',\n file,\n lineNumber,\n 0.55,\n undefined,\n false\n ));\n }\n\n // Check for border-radius without consistency\n if (/border-radius:\\s*(\\d+)px/.test(line)) {\n const radius = parseInt(line.match(/border-radius:\\s*(\\d+)px/)?.[1] || '0');\n if (radius > 0 && ![2, 4, 6, 8, 12, 16, 24, 9999].includes(radius)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'low',\n `Border-radius ${radius}px — use a radius scale`,\n 'Establish a radius scale: --radius-sm: 4px, --radius-md: 8px, --radius-lg: 16px, --radius-full: 9999px',\n file,\n lineNumber,\n 0.50,\n undefined,\n false\n ));\n }\n }\n\n // Suggest gradient for solid backgrounds in hero sections\n if (/hero|banner|header|jumbotron/i.test(file) || /Hero|Banner|Header/i.test(content.slice(0, 500))) {\n if (/background:\\s*#|background-color:/i.test(line) && !line.includes('gradient')) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'low',\n 'Solid background in hero section — consider a subtle gradient',\n 'Add depth with gradients: background: linear-gradient(135deg, var(--color-bg) 0%, var(--color-surface) 100%)',\n file,\n lineNumber,\n 0.50,\n undefined,\n false\n ));\n }\n }\n\n // Check for lack of backdrop-blur on overlays\n if (/overlay|modal|dialog|drawer/i.test(line) || /position:\\s*fixed/.test(line)) {\n const context = lines.slice(Math.max(0, i - 5), i + 10).join('\\n');\n if (!context.includes('backdrop') && context.includes('background')) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'low',\n 'Overlay without backdrop blur — add glassmorphism effect',\n 'Use backdrop-filter: blur(12px) with semi-transparent background for modern glass effect',\n file,\n lineNumber,\n 0.55,\n undefined,\n false\n ));\n }\n }\n }\n\n return issues;\n }\n\n /**\n * Analyze modern CSS feature usage\n */\n private analyzeModernCSS(content: string, file: string): Issue[] {\n const issues: Issue[] = [];\n\n // Check for opportunities to use container queries\n if (/@media.*width/.test(content) && !content.includes('container-type')) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'low',\n 'Using media queries — consider container queries for component isolation',\n 'Use container queries for truly reusable components: container-type: inline-size; @container (min-width: 400px) {...}',\n file,\n undefined,\n 0.50,\n undefined,\n false\n ));\n }\n\n // Check for calc() opportunities\n if (content.includes('padding') && content.includes('max-width') && !content.includes('clamp(')) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'low',\n 'Consider fluid spacing with clamp()',\n 'Use clamp() for responsive spacing: padding: clamp(1rem, 5vw, 3rem)',\n file,\n undefined,\n 0.45,\n undefined,\n false\n ));\n }\n\n // Check for :has() opportunities in React/Vue\n if (/\\.parent.*\\.child|parentElement|closest\\(/i.test(content)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'low',\n 'JavaScript parent selection — consider CSS :has()',\n 'Use CSS :has() for parent styling: .card:has(.featured) { border: 2px solid gold }',\n file,\n undefined,\n 0.55,\n undefined,\n false\n ));\n }\n\n // Check for grid with fixed columns\n if (/grid-template-columns:\\s*repeat\\(\\d+,/.test(content) && !content.includes('auto-fit') && !content.includes('auto-fill')) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'low',\n 'Fixed grid columns — use auto-fit for responsive grids',\n 'Use intrinsic sizing: grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr))',\n file,\n undefined,\n 0.60,\n undefined,\n false\n ));\n }\n\n // Check for aspect-ratio opportunities\n if (/padding-top:\\s*\\d+%|padding-bottom:\\s*\\d+%/.test(content) && !content.includes('aspect-ratio')) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'moderate',\n 'Padding-based aspect ratio hack — use aspect-ratio property',\n 'Use native aspect-ratio: aspect-ratio: 16 / 9 instead of padding hacks',\n file,\n undefined,\n 0.80,\n undefined,\n true\n ));\n }\n\n return issues;\n }\n\n /**\n * Analyze animation performance\n */\n private analyzePerformance(content: string, file: string): Issue[] {\n const issues: Issue[] = [];\n const lines = content.split('\\n');\n\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i]!;\n const lineNumber = i + 1;\n\n // Check for animating expensive properties\n if (/transition|animation/i.test(line)) {\n if (/width|height|top|left|right|bottom|margin|padding/i.test(line) && \n !line.includes('transform') && !line.includes('opacity')) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'moderate',\n 'Animating layout properties — use transform instead',\n 'Animate transform/opacity for 60fps. Replace top/left with translate, width/height with scale',\n file,\n lineNumber,\n 0.85,\n undefined,\n false\n ));\n }\n }\n\n // Check for will-change abuse\n if (/will-change:\\s*transform|will-change:\\s*opacity/.test(line)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'low',\n 'Static will-change — apply dynamically',\n 'Add will-change on hover/focus, remove after animation. Permanent will-change wastes GPU memory.',\n file,\n lineNumber,\n 0.70,\n undefined,\n false\n ));\n }\n\n // Check for filter animations\n if (/transition.*filter|animation.*filter|filter.*transition/i.test(line)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'moderate',\n 'Animating filter is expensive — use sparingly',\n 'Filter animations trigger repaint. Consider opacity/transform alternatives or accept lower framerates.',\n file,\n lineNumber,\n 0.75,\n undefined,\n false\n ));\n }\n\n // Check for large box-shadows in animations\n if (/transition.*box-shadow|animation.*box-shadow|box-shadow.*transition/i.test(line)) {\n const context = lines.slice(Math.max(0, i - 3), i + 3).join('\\n');\n if (/blur\\s*\\(\\s*(\\d+)/.test(context)) {\n const blur = parseInt(context.match(/blur\\s*\\(\\s*(\\d+)/)?.[1] || '0');\n if (blur > 20) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'moderate',\n `Large shadow blur (${blur}px) in animation — may drop frames`,\n 'Use pseudo-element for shadow animation: animate opacity of ::after with the shadow instead',\n file,\n lineNumber,\n 0.70,\n undefined,\n false\n ));\n }\n }\n }\n }\n\n return issues;\n }\n\n /**\n * AI Enhancement for design review\n */\n protected override getAIEnhancementSystemPrompt(): string {\n return `You are an award-winning design engineer from a top creative agency (Linear, Vercel, Stripe caliber). You review code for Awwwards-level polish and Codrops-worthy effects.\n\n## Guardrails: Design & Engineering Principles\n- Lead with user-centricity, clarity, and accessibility; animation is optional.\n- KISS and DRY: reduce complexity, prefer design tokens and reusable patterns.\n- Reliability and feedback: motion only when it improves understanding or state change.\n- Efficiency and sustainability: bias to stillness, avoid unnecessary paints/GPU work, honor prefers-reduced-motion.\n- Ethics and integrity: honest communication about capabilities, avoid dark patterns.\n\n## Color Analysis Priority\nDetect \"AI slop\" colors — the garish, oversaturated colors that AI tools generate:\n- Neon greens (#00ff00, #0f0)\n- Electric blues (#0000ff, #00f) \n- Hot magentas (#ff00ff, #f0f)\n- Pure saturated primaries\n\nApply Josef Albers' \"Interaction of Color\":\n- Constrain to 1-2 hue families; anchor with neutrals (slate/zinc/stone).\n- Build contrast through value (light/dark) and temperature shifts, not saturation.\n- Test adjacency: colors must work in pairs/triads against neutral backgrounds.\n- Avoid overusing violet/purple gradients (common AI tell); explore original complements/analogous schemes.\n\nReplace with modern SaaS palettes from top sites (saaslandingpage.com, awwwards.com), customized via Albers adjacency tests:\n- **Dark mode**: Vercel (#000, #0070f3), Linear (#000212, #5e6ad2), Stripe (#0a2540, #635bff)\n- **Light mode**: Notion (#fff, #f7f6f3, #2eaadc), Figma (#fff, #f5f5f5, #0d99ff), Framer (#fff, #0055ff)\n- **Neutral grays**: Use slate, zinc, or neutral scales, not flat grays\n\n## Inspiration Sources (structured lookups)\n- Codrops Creative Hub (https://tympanus.net/codrops/hub/):\n - Tags to scan: scroll, hover, typography, cursor, WebGL, WebGPU, GSAP, Framer Motion, Three.js, grid, parallax, page transition, slider/carousel.\n - Use as inspiration for interaction patterns; keep accessibility, performance, reduced-motion.\n- Awwwards Directory (https://www.awwwards.com/directory/):\n - Benchmarks: Locomotive, Immersive Garden, Active Theory, Hello Monday, Resn, Obys, Build in Amsterdam.\n - Categories to map: animated websites, scrolling, one-page, interaction design, WebGL sites, 3D, GSAP, React, Framer.\n - Extract patterns (structure, choreography, feedback), not pixels; keep clarity, responsiveness, and performance.\n\n## Motion & Creative Effects\nRecommend motion only when it improves comprehension or feedback; keep durations 150-300ms, ease-out preferred, and provide reduced-motion fallbacks. Prefer micro-interactions over showy effects.\n- Default to static if motion adds no clarity.\n- Ensure @media (prefers-reduced-motion) disables non-essential motion.\n- Prioritize transform/opacity over layout-changing properties.\nWhen warranted by context, suggest libraries:\n- **React projects**: Framer Motion (gestures, layout), React Spring (physics), Auto-Animate (quick wins)\n- **Complex timelines**: GSAP + ScrollTrigger, SplitText for character animations\n- **3D/WebGL**: React Three Fiber + Drei for hero sections, product showcases\n- **Smooth scroll**: Lenis or Locomotive Scroll for butter-smooth scrolling\n- **Text effects**: Splitting.js for character animations, Typed.js for typewriter\n- **Hover effects**: Atropos for 3D tilt, custom cursor effects\n\n## Project Context Effects\n- **Marketing/Landing**: Scroll reveals, parallax, text animations, gradient meshes, 3D elements\n- **Dashboard**: Subtle micro-interactions, skeleton loaders, chart transitions\n- **E-commerce**: Image zoom, add-to-cart animations, filter transitions\n- **Portfolio**: Page transitions, cursor effects, image reveals\n\nAnalyze detected issues and code for:\n1. **Color coherence** — Is this a cohesive palette or random AI-generated colors?\n2. **Motion library usage** — Is the project using appropriate animation tools?\n3. **Design system consistency** — Tokens, spacing scales, color systems\n4. **Motion design quality** — Easing curves, choreography, performance\n5. **Visual hierarchy** — Typography systems, contrast, visual flow\n6. **Creative CSS techniques** — Gradients, masks, blend modes, clip-paths\n7. **Modern CSS features** — Container queries, :has(), subgrid\n\nOutput STRICT JSON:\n{\n \"validated\": [{\n \"original_issue\": \"...\",\n \"verdict\": \"TRUE_POSITIVE\" | \"FALSE_POSITIVE\",\n \"confidence\": 0-100,\n \"file\": \"path\",\n \"line\": 123,\n \"severity\": \"moderate\",\n \"design_impact\": \"Why this hurts the user experience\",\n \"fix\": \"Creative CSS fix with specific color values from modern palettes\"\n }],\n \"additional\": [{\n \"issue\": \"Design opportunity found\",\n \"file\": \"path\",\n \"line\": 123,\n \"severity\": \"low\",\n \"enhancement\": \"How to elevate this to Awwwards quality\",\n \"fix\": \"Modern CSS/animation code with npm install command if needed\"\n }],\n \"motion_recommendations\": [{\n \"library\": \"framer-motion\",\n \"install\": \"npm i framer-motion\",\n \"use_case\": \"What specific effect to implement\",\n \"example_code\": \"Brief code snippet\"\n }],\n \"palette_recommendation\": {\n \"primary\": \"#hex\",\n \"secondary\": \"#hex\",\n \"background\": \"#hex\",\n \"surface\": \"#hex\",\n \"text\": \"#hex\",\n \"muted\": \"#hex\",\n \"accent\": \"#hex\",\n \"inspiration\": \"Which top SaaS this is inspired by\"\n },\n \"project_context\": \"marketing | dashboard | ecommerce | portfolio | general\",\n \"summary\": \"Overall design craft assessment with specific recommendations\"\n}`;\n }\n}\n","import { BaseAgent } from './base-agent.js';\nimport type { Issue, ScanContext, CodeContext } from '../types/index.js';\n\nexport class LegalAgent extends BaseAgent {\n name = 'legal';\n description = 'Compliance with GDPR, CCPA, data protection laws, and legal requirements';\n version = '1.0.0';\n\n shouldActivate(context: CodeContext): boolean {\n return (\n context.touchesUserData ||\n context.touchesPayments ||\n context.touchesAuth\n );\n }\n\n protected async analyzeFiles(files: string[], _context: ScanContext): Promise<Issue[]> {\n const issues: Issue[] = [];\n\n for (const file of files) {\n try {\n const content = await this.readFile(file);\n issues.push(...this.checkGDPRCompliance(content, file));\n issues.push(...this.checkDataRetention(content, file));\n issues.push(...this.checkConsentPatterns(content, file));\n } catch (error) {\n console.error(`Legal Agent: Error reading file ${file}:`, error);\n }\n }\n\n return issues;\n }\n\n private checkGDPRCompliance(content: string, file: string): Issue[] {\n const issues: Issue[] = [];\n const lines = content.split('\\n');\n\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i]!;\n const lineNumber = i + 1;\n\n // Check for data collection without consent flag\n if (/email|phone|address|name|birthdate|ssn/i.test(line) && \n /save|store|insert|create|post/i.test(line) &&\n !/consent|gdpr|terms/i.test(content)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'serious',\n 'Personal data collection without consent verification',\n 'Implement consent collection before storing PII (GDPR Article 6)',\n file,\n lineNumber,\n 0.75,\n 'GDPR Article 6 - Lawfulness of processing',\n false\n ));\n }\n\n // Check for analytics/tracking without consent\n if (/analytics|gtag|fbq|pixel|tracking/i.test(line) && !/consent|optIn|cookie/i.test(content)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'serious',\n 'Analytics/tracking without consent management',\n 'Implement cookie consent banner before loading tracking scripts',\n file,\n lineNumber,\n 0.80,\n 'GDPR Article 7 / ePrivacy Directive',\n false\n ));\n }\n\n // Check for data export capability\n if (/userData|userProfile|account/i.test(line) && /get|fetch|query/i.test(line)) {\n // This is informational - checking if export exists\n const hasExport = /export|download|portability/i.test(content);\n if (!hasExport) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'moderate',\n 'Consider implementing data portability',\n 'Users have right to export their data (GDPR Article 20)',\n file,\n undefined,\n 0.60,\n 'GDPR Article 20 - Right to data portability',\n false\n ));\n }\n }\n }\n\n return issues;\n }\n\n private checkDataRetention(content: string, file: string): Issue[] {\n const issues: Issue[] = [];\n\n // Check for indefinite data storage\n if (/store|save|persist|database|collection/i.test(content) &&\n !/delete|expire|retention|ttl|expiresAt|deletedAt/i.test(content)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'moderate',\n 'No data retention/deletion policy detected',\n 'Implement data retention limits and deletion procedures',\n file,\n undefined,\n 0.70,\n 'GDPR Article 5(1)(e) - Storage limitation',\n false\n ));\n }\n\n // Check for soft delete without actual deletion\n if (/deletedAt|isDeleted|softDelete/i.test(content) && !/hardDelete|permanentDelete|purge/i.test(content)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'low',\n 'Soft delete without hard delete option',\n 'Consider implementing permanent deletion for GDPR right to erasure',\n file,\n undefined,\n 0.65,\n 'GDPR Article 17 - Right to erasure',\n false\n ));\n }\n\n return issues;\n }\n\n private checkConsentPatterns(content: string, file: string): Issue[] {\n const issues: Issue[] = [];\n const lines = content.split('\\n');\n\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i]!;\n const lineNumber = i + 1;\n\n // Check for pre-checked consent\n if (/checked|defaultChecked|defaultValue.*true/i.test(line) && \n /consent|newsletter|marketing|terms/i.test(line)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'serious',\n 'Pre-checked consent box detected',\n 'Consent must be freely given - remove default checked state',\n file,\n lineNumber,\n 0.85,\n 'GDPR Recital 32 - Consent should not be pre-ticked',\n true\n ));\n }\n\n // Check for bundled consent\n if (/&&.*&&/i.test(line) && /consent|agree|accept/i.test(line)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'moderate',\n 'Potentially bundled consent conditions',\n 'Separate consents for different purposes (GDPR granular consent)',\n file,\n lineNumber,\n 0.60,\n 'GDPR Article 7 - Conditions for consent',\n false\n ));\n }\n }\n\n return issues;\n }\n}\n\n","import { BaseAgent } from './base-agent.js';\nimport type { Issue, ScanContext, CodeContext } from '../types/index.js';\nimport { basename, dirname } from 'path';\nimport { existsSync } from 'fs';\n\nexport class TestAgent extends BaseAgent {\n name = 'test';\n description = 'Test coverage analysis, test quality, and testing best practices';\n version = '1.0.0';\n\n shouldActivate(context: CodeContext): boolean {\n return (\n context.isNewFeature ||\n context.touchesAuth ||\n context.touchesPayments ||\n context.touchesAPI\n );\n }\n\n protected async analyzeFiles(files: string[], context: ScanContext): Promise<Issue[]> {\n const issues: Issue[] = [];\n\n for (const file of files) {\n // Skip test files themselves\n if (/\\.(test|spec)\\.(ts|js|tsx|jsx)$/.test(file)) {\n continue;\n }\n\n try {\n const content = await this.readFile(file);\n issues.push(...this.checkTestCoverage(file, content, context));\n issues.push(...this.checkTestablePatterns(content, file));\n } catch (error) {\n console.error(`Test Agent: Error reading file ${file}:`, error);\n }\n }\n\n return issues;\n }\n\n private checkTestCoverage(file: string, content: string, _context: ScanContext): Issue[] {\n const issues: Issue[] = [];\n const fileName = basename(file);\n const fileDir = dirname(file);\n\n // Check if corresponding test file exists\n const testPatterns = [\n file.replace(/\\.(ts|js|tsx|jsx)$/, '.test.$1'),\n file.replace(/\\.(ts|js|tsx|jsx)$/, '.spec.$1'),\n `${fileDir}/__tests__/${fileName}`,\n `${fileDir}/../__tests__/${fileName}`,\n ];\n\n const hasTestFile = testPatterns.some(pattern => existsSync(pattern));\n\n if (!hasTestFile) {\n // Determine severity based on what the file does\n const severity = this.determineTestSeverity(content);\n \n issues.push(this.createIssue(\n this.generateIssueId(),\n severity,\n `No test file found for ${fileName}`,\n `Create test file: ${fileName.replace(/\\.(ts|js|tsx|jsx)$/, '.test.$1')}`,\n file,\n undefined,\n 0.85,\n undefined,\n false\n ));\n }\n\n return issues;\n }\n\n private determineTestSeverity(content: string): Issue['severity'] {\n // Critical code needs tests\n if (/password|auth|payment|stripe|billing|credit/i.test(content)) {\n return 'serious';\n }\n if (/api|endpoint|route|handler/i.test(content)) {\n return 'moderate';\n }\n return 'low';\n }\n\n private checkTestablePatterns(content: string, file: string): Issue[] {\n const issues: Issue[] = [];\n const lines = content.split('\\n');\n\n // Count exported functions/classes\n const exports = content.match(/export\\s+(function|class|const|async function)/g);\n const exportCount = exports?.length || 0;\n\n // Check for complex functions that should be tested\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i]!;\n const lineNumber = i + 1;\n\n // Check for complex conditionals\n if ((line.match(/if|else|switch|\\?.*:/g) || []).length >= 3) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'low',\n 'Complex conditional logic should have unit tests',\n 'Write tests covering different branches of this logic',\n file,\n lineNumber,\n 0.70,\n undefined,\n false\n ));\n }\n\n // Check for error handling that should be tested\n if (/catch\\s*\\(|\\.catch\\(/.test(line)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'low',\n 'Error handling path should be tested',\n 'Write tests that trigger and verify error handling behavior',\n file,\n lineNumber,\n 0.65,\n undefined,\n false\n ));\n }\n\n // Check for async operations\n if (/async\\s+function|await\\s+/.test(line) && /fetch|axios|database|query/i.test(line)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'moderate',\n 'Async operation should have integration tests',\n 'Mock external dependencies and test async behavior',\n file,\n lineNumber,\n 0.75,\n undefined,\n false\n ));\n }\n }\n\n // Warn about high export count without tests\n if (exportCount > 5) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'moderate',\n `${exportCount} exports detected - high test coverage recommended`,\n 'Create comprehensive test suite for all exported functions',\n file,\n undefined,\n 0.80,\n undefined,\n false\n ));\n }\n\n return issues;\n }\n}\n\n","import { BaseAgent } from './base-agent.js';\nimport type { Issue, ScanContext, CodeContext } from '../types/index.js';\n\nexport class SoftwareArchitectAgent extends BaseAgent {\n name = 'software-architect';\n description = 'Architecture patterns, code organization, SOLID principles, and scalability';\n version = '1.0.0';\n\n shouldActivate(context: CodeContext): boolean {\n return (\n context.isNewFeature ||\n context.touchesDatabase ||\n context.touchesAPI ||\n context.linesChanged > 200\n );\n }\n\n protected async analyzeFiles(files: string[], _context: ScanContext): Promise<Issue[]> {\n const issues: Issue[] = [];\n\n for (const file of files) {\n try {\n const content = await this.readFile(file);\n issues.push(...this.checkArchitecturePatterns(content, file));\n issues.push(...this.checkCodeOrganization(content, file));\n issues.push(...this.checkScalabilityIssues(content, file));\n } catch (error) {\n console.error(`Software Architect Agent: Error reading file ${file}:`, error);\n }\n }\n\n return issues;\n }\n\n private checkArchitecturePatterns(content: string, file: string): Issue[] {\n const issues: Issue[] = [];\n const lines = content.split('\\n');\n\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i]!;\n const lineNumber = i + 1;\n\n // Check for direct database access in UI components\n if (/\\.(tsx|jsx)$/.test(file) && /prisma|mongoose|sequelize|typeorm|query|SELECT/i.test(line)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'serious',\n 'Direct database access in UI component',\n 'Move database logic to API layer or server action',\n file,\n lineNumber,\n 0.90,\n undefined,\n false\n ));\n }\n\n // Check for business logic in controllers/handlers\n if (/controller|handler|route/i.test(file) && lines.slice(i, i + 20).join('\\n').split('if').length > 5) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'moderate',\n 'Complex business logic in controller',\n 'Extract business logic to a service layer',\n file,\n lineNumber,\n 0.70,\n undefined,\n false\n ));\n }\n\n // Check for god classes/files\n if (lines.length > 500 && i === 0) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'moderate',\n `Large file detected (${lines.length} lines)`,\n 'Consider splitting into smaller, focused modules',\n file,\n undefined,\n 0.80,\n undefined,\n false\n ));\n }\n\n // Check for circular dependency patterns\n if (/import.*from\\s*['\"]\\.\\..*['\"]/g.test(line)) {\n const importPath = line.match(/from\\s*['\"]([^'\"]+)['\"]/)?.[1];\n if (importPath && importPath.includes('../../')) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'low',\n 'Deep relative import detected',\n 'Consider using path aliases or restructuring modules',\n file,\n lineNumber,\n 0.60,\n undefined,\n true\n ));\n }\n }\n }\n\n return issues;\n }\n\n private checkCodeOrganization(content: string, file: string): Issue[] {\n const issues: Issue[] = [];\n\n // Check for mixed concerns\n const hasUI = /jsx|tsx|render|component|React|useState/i.test(content);\n const hasAPI = /fetch|axios|api|endpoint|route/i.test(content);\n const hasDB = /prisma|mongoose|query|INSERT|SELECT/i.test(content);\n \n const concernCount = [hasUI, hasAPI, hasDB].filter(Boolean).length;\n\n if (concernCount >= 2) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'moderate',\n 'Multiple concerns mixed in single file',\n 'Separate UI, API, and data access layers',\n file,\n undefined,\n 0.75,\n undefined,\n false\n ));\n }\n\n // Check for missing error boundaries in React\n if (/React|useState|useEffect/i.test(content) && !/ErrorBoundary|error.*boundary/i.test(content)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'low',\n 'Consider adding error boundary for React components',\n 'Wrap components in ErrorBoundary to handle render errors gracefully',\n file,\n undefined,\n 0.60,\n undefined,\n false\n ));\n }\n\n return issues;\n }\n\n private checkScalabilityIssues(content: string, file: string): Issue[] {\n const issues: Issue[] = [];\n const lines = content.split('\\n');\n\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i]!;\n const lineNumber = i + 1;\n\n // Check for N+1 query patterns\n if (/for\\s*\\(|\\.forEach|\\.map/.test(line) && /await.*find|await.*query|await.*get/i.test(lines.slice(i, i + 5).join('\\n'))) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'serious',\n 'Potential N+1 query pattern',\n 'Use batch fetching or include/join to avoid multiple queries in loop',\n file,\n lineNumber,\n 0.80,\n undefined,\n false\n ));\n }\n\n // Check for unbounded queries\n if (/find\\(\\)|findMany\\(\\)|SELECT.*FROM.*(?!LIMIT|WHERE)/i.test(line) && !/limit|take|LIMIT/i.test(line)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'moderate',\n 'Unbounded database query',\n 'Add pagination/limit to prevent memory issues with large datasets',\n file,\n lineNumber,\n 0.75,\n undefined,\n true\n ));\n }\n\n // Check for synchronous file operations\n if (/readFileSync|writeFileSync|readdirSync/i.test(line)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'moderate',\n 'Synchronous file operation blocks event loop',\n 'Use async alternatives: readFile, writeFile, readdir',\n file,\n lineNumber,\n 0.85,\n undefined,\n true\n ));\n }\n\n // Check for missing caching opportunities\n if (/fetch|axios\\.get|database.*find/i.test(line) && !/cache|redis|memo/i.test(content)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'low',\n 'Consider caching for repeated data fetches',\n 'Implement caching strategy for frequently accessed data',\n file,\n lineNumber,\n 0.55,\n undefined,\n false\n ));\n }\n }\n\n return issues;\n }\n\n /**\n * AI Enhancement for architecture review\n */\n protected override getAIEnhancementSystemPrompt(): string {\n return `You are a senior software architect reviewing code for scalability, maintainability, and best practices.\n\nAnalyze detected issues and code for:\n1. SOLID principles violations\n2. Separation of concerns (UI, API, data layers)\n3. N+1 queries and database optimization\n4. Dependency injection and testability\n5. Error handling and resilience patterns\n6. Caching and performance considerations\n7. Circular dependencies and coupling\n\nOutput STRICT JSON:\n{\n \"validated\": [{\n \"original_issue\": \"...\",\n \"verdict\": \"TRUE_POSITIVE\" | \"FALSE_POSITIVE\",\n \"confidence\": 0-100,\n \"file\": \"path\",\n \"line\": 123,\n \"severity\": \"serious\",\n \"principle\": \"SOLID / DRY / YAGNI / etc\",\n \"impact\": \"How this affects scalability/maintainability\",\n \"fix\": \"Architectural fix with code example\"\n }],\n \"additional\": [{\n \"issue\": \"Architecture issue found\",\n \"file\": \"path\",\n \"line\": 123,\n \"severity\": \"moderate\",\n \"principle\": \"Violated principle\",\n \"impact\": \"Technical debt impact\",\n \"fix\": \"Refactoring approach\"\n }],\n \"summary\": \"Overall architecture assessment\"\n}`;\n }\n}\n","import { BaseAgent } from './base-agent.js';\nimport type { Issue, ScanContext, CodeContext } from '../types/index.js';\n\nexport class DevOpsAgent extends BaseAgent {\n name = 'devops';\n description = 'Infrastructure, deployment, configuration, and operational concerns';\n version = '1.0.0';\n\n shouldActivate(context: CodeContext): boolean {\n return (\n context.touchesSecurityConfig ||\n context.touchesDatabase ||\n context.touchesPayments ||\n context.touchesHealthData\n );\n }\n\n protected async analyzeFiles(files: string[], _context: ScanContext): Promise<Issue[]> {\n const issues: Issue[] = [];\n\n for (const file of files) {\n try {\n const content = await this.readFile(file);\n issues.push(...this.checkEnvironmentConfig(content, file));\n issues.push(...this.checkLogging(content, file));\n issues.push(...this.checkDeploymentPatterns(content, file));\n } catch (error) {\n console.error(`DevOps Agent: Error reading file ${file}:`, error);\n }\n }\n\n return issues;\n }\n\n private checkEnvironmentConfig(content: string, file: string): Issue[] {\n const issues: Issue[] = [];\n const lines = content.split('\\n');\n\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i]!;\n const lineNumber = i + 1;\n\n // Check for hardcoded environment-specific values\n if (/localhost|127\\.0\\.0\\.1|0\\.0\\.0\\.0/i.test(line) && !/process\\.env|import\\.meta\\.env|\\.env/i.test(line)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'moderate',\n 'Hardcoded localhost/IP address',\n 'Use environment variables for host configuration',\n file,\n lineNumber,\n 0.80,\n undefined,\n true\n ));\n }\n\n // Check for missing environment variable validation\n if (/process\\.env\\./i.test(line) && !/\\|\\||:\\s|[?]{2}/i.test(line) && !/throw|required|assert/i.test(lines.slice(Math.max(0, i-2), i+2).join(''))) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'moderate',\n 'Environment variable used without fallback/validation',\n 'Add validation or fallback: process.env.VAR || \"default\"',\n file,\n lineNumber,\n 0.70,\n undefined,\n true\n ));\n }\n\n // Check for production checks\n if (/NODE_ENV.*production|isProduction/i.test(line)) {\n // This is good - just informational\n } else if (/console\\.log|console\\.debug|debugger/i.test(line)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'low',\n 'Debug statement should be removed or wrapped in development check',\n 'Use proper logging library or wrap in if (process.env.NODE_ENV !== \"production\")',\n file,\n lineNumber,\n 0.75,\n undefined,\n true\n ));\n }\n }\n\n return issues;\n }\n\n private checkLogging(content: string, file: string): Issue[] {\n const issues: Issue[] = [];\n const lines = content.split('\\n');\n\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i]!;\n const lineNumber = i + 1;\n\n // Check for logging sensitive data\n if (/console\\.(log|info|warn|error)|logger\\./i.test(line) && \n /password|secret|token|key|credential|ssn|credit/i.test(line)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'critical',\n 'Potentially logging sensitive data',\n 'Remove sensitive data from logs or mask it',\n file,\n lineNumber,\n 0.85,\n undefined,\n false\n ));\n }\n\n // Check for missing error logging in catch blocks\n if (/catch\\s*\\(.*\\)\\s*\\{/.test(line)) {\n const catchBlock = lines.slice(i, Math.min(lines.length, i + 10)).join('\\n');\n if (!/console\\.|logger\\.|log\\(|error\\(/i.test(catchBlock) && !/throw/i.test(catchBlock)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'moderate',\n 'Catch block without error logging',\n 'Log errors for debugging and monitoring',\n file,\n lineNumber,\n 0.75,\n undefined,\n true\n ));\n }\n }\n }\n\n // Check for structured logging\n if (/console\\.(log|info|warn|error)/i.test(content) && content.split('console.').length > 5) {\n if (!/winston|pino|bunyan|log4js/i.test(content)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'low',\n 'Consider using structured logging library',\n 'Use winston, pino, or similar for production logging with levels and formatting',\n file,\n undefined,\n 0.60,\n undefined,\n false\n ));\n }\n }\n\n return issues;\n }\n\n private checkDeploymentPatterns(content: string, file: string): Issue[] {\n const issues: Issue[] = [];\n const lines = content.split('\\n');\n\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i]!;\n const lineNumber = i + 1;\n\n // Check for health check endpoints\n if (/app\\.(get|use)|router\\.(get|use)/i.test(line) && /health|ready|live/i.test(line)) {\n // Good pattern - has health checks\n }\n\n // Check for graceful shutdown handling\n if (/SIGTERM|SIGINT|process\\.on/i.test(line)) {\n // Good pattern - handles signals\n }\n\n // Check for connection pool configuration\n if (/createPool|connectionLimit|pool/i.test(line) && !/max|limit|size/i.test(line)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'moderate',\n 'Database connection pool without explicit limits',\n 'Configure max connections to prevent resource exhaustion',\n file,\n lineNumber,\n 0.70,\n undefined,\n true\n ));\n }\n\n // Check for timeout configuration\n if (/fetch|axios|http\\.request/i.test(line) && !/timeout/i.test(lines.slice(i, i + 3).join(''))) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'moderate',\n 'HTTP request without timeout configuration',\n 'Add timeout to prevent hanging requests',\n file,\n lineNumber,\n 0.75,\n undefined,\n true\n ));\n }\n }\n\n return issues;\n }\n\n /**\n * AI Enhancement for DevOps review\n */\n protected override getAIEnhancementSystemPrompt(): string {\n return `You are a DevOps engineer reviewing code for production readiness.\n\nAnalyze detected issues and code for:\n1. Environment configuration (dev/staging/prod)\n2. Logging and observability (structured logs, metrics)\n3. Error handling and graceful degradation\n4. Resource management (connections, memory, timeouts)\n5. Deployment patterns (health checks, graceful shutdown)\n6. CI/CD concerns (test coverage, build optimization)\n7. Secrets management\n\nOutput STRICT JSON:\n{\n \"validated\": [{\n \"original_issue\": \"...\",\n \"verdict\": \"TRUE_POSITIVE\" | \"FALSE_POSITIVE\",\n \"confidence\": 0-100,\n \"file\": \"path\",\n \"line\": 123,\n \"severity\": \"serious\",\n \"category\": \"logging | config | deployment | etc\",\n \"production_risk\": \"What could go wrong in prod\",\n \"fix\": \"DevOps best practice fix\"\n }],\n \"additional\": [{\n \"issue\": \"DevOps issue found\",\n \"file\": \"path\",\n \"line\": 123,\n \"severity\": \"moderate\",\n \"category\": \"Issue category\",\n \"production_risk\": \"Risk description\",\n \"fix\": \"Implementation\"\n }],\n \"summary\": \"Production readiness assessment\"\n}`;\n }\n}\n","import { BaseAgent, FileRelevance } from './base-agent.js';\nimport type { Issue, ScanContext, CodeContext } from '../types/index.js';\n\n/**\n * Bug relevance indicators - files that need bug analysis\n */\nconst BUG_INDICATORS = {\n high: [\n { pattern: /async|await|promise/i, reason: 'async code' },\n { pattern: /try|catch|throw|error/i, reason: 'error handling' },\n { pattern: /\\.forEach|\\.map|\\.filter|\\.reduce/i, reason: 'array operations' },\n { pattern: /JSON\\.parse|JSON\\.stringify/i, reason: 'JSON operations' },\n { pattern: /null|undefined/i, reason: 'nullability' },\n ],\n medium: [\n { pattern: /parseInt|parseFloat|Number\\(/i, reason: 'number parsing' },\n { pattern: /split|slice|substring|substr/i, reason: 'string operations' },\n { pattern: /Date|new Date|moment|dayjs/i, reason: 'date handling' },\n { pattern: /setTimeout|setInterval|clearTimeout/i, reason: 'timing' },\n { pattern: /Math\\./i, reason: 'math operations' },\n ],\n low: [\n { pattern: /\\.length|\\.size/i, reason: 'collection access' },\n { pattern: /switch|case|default/i, reason: 'switch statements' },\n { pattern: /for\\s*\\(|while\\s*\\(/i, reason: 'loops' },\n ]\n};\n\n/**\n * Critical bug patterns that can be caught without AI\n */\nconst CRITICAL_BUG_PATTERNS = [\n { \n pattern: /\\.forEach\\s*\\(\\s*async/i, \n severity: 'serious' as const, \n issue: 'async callback in forEach - await will not work as expected',\n fix: 'Use for...of loop or Promise.all with map instead'\n },\n { \n pattern: /if\\s*\\(\\s*\\w+\\s*=[^=]/, \n severity: 'serious' as const, \n issue: 'Assignment in condition - likely meant to compare',\n fix: 'Use === for comparison instead of ='\n },\n];\n\nexport class BugFindingAgent extends BaseAgent {\n name = 'bug-finding';\n description = 'AI-powered bug detection: null safety, edge cases, async issues, runtime errors';\n version = '2.0.0';\n\n shouldActivate(context: CodeContext): boolean {\n return (\n context.touchesPayments ||\n context.isNewFeature ||\n context.touchesDatabase ||\n context.touchesAPI\n );\n }\n\n /**\n * Check file relevance for bug analysis\n */\n protected override checkFileRelevance(file: string, content: string): FileRelevance {\n // Skip test files, node_modules, etc.\n if (/node_modules|\\.d\\.ts$|\\.min\\.|dist\\/|build\\//.test(file)) {\n return { isRelevant: false, reason: 'Skip file', priority: 'low', indicators: [] };\n }\n\n const indicators: string[] = [];\n let priority: 'high' | 'medium' | 'low' = 'low';\n\n // Check for high-priority indicators\n for (const { pattern, reason } of BUG_INDICATORS.high) {\n if (pattern.test(content)) {\n indicators.push(reason);\n priority = 'high';\n }\n }\n\n // Check medium if not already high\n if (priority !== 'high') {\n for (const { pattern, reason } of BUG_INDICATORS.medium) {\n if (pattern.test(content)) {\n indicators.push(reason);\n if (priority === 'low') priority = 'medium';\n }\n }\n }\n\n return {\n isRelevant: content.length > 50, // Skip empty/tiny files\n reason: indicators.length > 0 ? `Contains: ${indicators.slice(0, 3).join(', ')}` : 'General review',\n priority,\n indicators\n };\n }\n\n /**\n * Get bug-hunting system prompt\n */\n protected getSystemPrompt(): string {\n return `You are a senior developer hunting for bugs with the mindset of QA trying to break the code.\n\nFOCUS ON:\n1. **Null/Undefined Errors**: Accessing properties on potentially null values\n2. **Async/Await Bugs**: Missing awaits, async forEach, unhandled promise rejections\n3. **Edge Cases**: Empty arrays, zero values, boundary conditions\n4. **Type Coercion**: Loose equality, implicit type conversions\n5. **Resource Leaks**: Unclosed connections, timers not cleared\n6. **Race Conditions**: State changes between checks and uses\n7. **Error Handling**: Missing try-catch, swallowed errors\n\nBE PRECISE:\n- Only report bugs you're confident about\n- Provide exact line numbers\n- Explain the trigger condition (when this bug would occur)\n- Give specific fixes\n\nSEVERITY GUIDELINES:\n- CRITICAL: Will crash in production or corrupt data\n- SERIOUS: Will cause incorrect behavior under common conditions\n- MODERATE: Will cause issues in edge cases\n- LOW: Code smell that could become a bug`;\n }\n\n /**\n * Build bug-focused analysis prompt\n */\n protected buildUserPrompt(filePath: string, content: string, relevance: FileRelevance): string {\n const isTestFile = /\\.(test|spec)\\.[jt]sx?$/.test(filePath);\n \n return `## Bug Hunt Analysis\n\n**File:** \\`${filePath}\\`\n**Code patterns:** ${relevance.indicators.join(', ') || 'general analysis'}\n${isTestFile ? '**Note:** This is a test file - focus on test correctness.' : ''}\n\n\\`\\`\\`\n${content}\n\\`\\`\\`\n\n## Find These Bug Types\n\n${relevance.indicators.includes('async code') ? `\n### Async/Await Issues\n- Missing await keywords\n- async forEach (won't await properly)\n- Unhandled promise rejections\n- Race conditions in async code\n` : ''}\n\n${relevance.indicators.includes('error handling') ? `\n### Error Handling Bugs\n- Swallowed errors (empty catch blocks)\n- Missing try-catch around throwing code\n- Error handling that doesn't re-throw or handle properly\n` : ''}\n\n${relevance.indicators.includes('JSON operations') ? `\n### JSON Bugs\n- JSON.parse without try-catch\n- Circular reference issues\n- Invalid JSON handling\n` : ''}\n\n${relevance.indicators.includes('nullability') ? `\n### Null Safety Issues\n- Optional chaining needed\n- Null checks before property access\n- Default value handling\n` : ''}\n\nFor each bug, provide:\n1. **Line number**\n2. **Severity** (critical/serious/moderate/low)\n3. **Bug description**\n4. **Trigger condition** (when would this crash?)\n5. **Fix**\n\nIf no significant bugs found, respond with:\n\"No significant bugs found in this file.\"`;\n }\n\n /**\n * Override AI enhancement system prompt for bug-finding\n */\n protected override getAIEnhancementSystemPrompt(): string {\n return `You are a QA engineer trying to break code. Find bugs that will cause crashes or incorrect behavior.\n\nAnalyze detected issues and code for:\n1. Null/undefined errors\n2. Async/await bugs (missing await, async forEach)\n3. Race conditions\n4. Edge cases (empty arrays, zero values, boundaries)\n5. Type coercion issues\n6. Resource leaks\n\nOutput STRICT JSON:\n{\n \"validated\": [{\n \"original_issue\": \"...\",\n \"verdict\": \"TRUE_POSITIVE\" | \"FALSE_POSITIVE\",\n \"confidence\": 0-100,\n \"file\": \"path\",\n \"line\": 123,\n \"severity\": \"critical\",\n \"trigger_condition\": \"When would this crash?\",\n \"fix\": \"Code fix\"\n }],\n \"additional\": [{\n \"issue\": \"Bug description\",\n \"file\": \"path\",\n \"line\": 123,\n \"severity\": \"serious\",\n \"trigger_condition\": \"When would this fail?\",\n \"fix\": \"Code fix\"\n }],\n \"summary\": \"Bug hunt assessment\"\n}`;\n }\n\n /**\n * Pattern-based bug detection\n */\n protected override async analyzeFiles(files: string[], _context: ScanContext): Promise<Issue[]> {\n const issues: Issue[] = [];\n \n for (const file of files) {\n // Skip non-relevant files\n if (/node_modules|\\.d\\.ts$|\\.min\\.|dist\\/|build\\//.test(file)) continue;\n \n try {\n const content = await this.readFile(file);\n const lines = content.split('\\n');\n \n // Check for critical bug patterns\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i] || '';\n \n for (const { pattern, severity, issue, fix } of CRITICAL_BUG_PATTERNS) {\n if (pattern.test(line)) {\n this.progress?.found(severity, `${issue} at line ${i + 1}`);\n issues.push(this.createIssue(\n this.generateIssueId(),\n severity,\n issue,\n fix,\n file,\n i + 1,\n 0.95,\n undefined,\n true\n ));\n }\n }\n }\n } catch {\n // Skip unreadable files\n }\n }\n \n return issues;\n }\n}\n","import { BaseAgent } from './base-agent.js';\nimport type { Issue, ScanContext, CodeContext, AgentPriority } from '../types/index.js';\n\n/**\n * User Testing Agent\n * \n * Simulates different user personas to find vulnerabilities and UX issues:\n * 1. Happy Path User - Normal usage, expects things to work\n * 2. Security Tester - Tries to break things, malicious inputs\n * 3. Confused User - Makes mistakes, misunderstands UI, accessibility needs\n * 4. Impatient User - Rapid clicks, doesn't wait, closes mid-action\n * 5. Edge Case User - Empty inputs, max lengths, special characters\n */\nexport class UserTestingAgent extends BaseAgent {\n name = 'user-testing';\n description = 'Simulates user personas (happy path, security tester, confused user) to find vulnerabilities';\n version = '2.0.0';\n\n override get priority(): AgentPriority {\n return {\n name: this.name,\n tier: 2,\n estimatedTimeMs: 150,\n dependencies: ['accessibility'] // accessibility before UX\n };\n }\n\n shouldActivate(context: CodeContext): boolean {\n return context.touchesUI || context.isNewFeature;\n }\n\n override getActivationConfidence(context: CodeContext): number {\n let confidence = 0;\n if (context.touchesUI) confidence += 0.5;\n if (context.isNewFeature) confidence += 0.3;\n if (context.patterns?.hasFormHandling) confidence += 0.25;\n if (context.touchesAuth) confidence += 0.2;\n if (context.touchesPayments) confidence += 0.3;\n return Math.min(1.0, confidence);\n }\n\n protected async analyzeFiles(files: string[], _context: ScanContext): Promise<Issue[]> {\n const issues: Issue[] = [];\n\n for (const file of files) {\n try {\n const content = await this.readFile(file);\n \n // Simulate each user persona\n issues.push(...this.simulateHappyPathUser(content, file));\n issues.push(...this.simulateSecurityTester(content, file));\n issues.push(...this.simulateConfusedUser(content, file));\n issues.push(...this.simulateImpatientUser(content, file));\n issues.push(...this.simulateEdgeCaseUser(content, file));\n \n } catch (error) {\n console.error(`User Testing Agent: Error reading file ${file}:`, error);\n }\n }\n\n return issues;\n }\n\n /**\n * HAPPY PATH USER\n * \"I'm a normal user, I expect things to just work\"\n * Finds: Missing success feedback, broken flows, dead ends\n */\n private simulateHappyPathUser(content: string, file: string): Issue[] {\n const issues: Issue[] = [];\n const lines = content.split('\\n');\n\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i]!;\n const lineNumber = i + 1;\n const nearbyCode = lines.slice(Math.max(0, i - 5), i + 10).join('\\n');\n\n // \"I submitted a form but nothing happened?\"\n if (/onSubmit|handleSubmit/i.test(line)) {\n if (!/toast|alert|notification|message|success|redirect|navigate|push/i.test(nearbyCode)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'moderate',\n '[Happy Path] Form submission has no success feedback',\n 'Show success message or redirect after form submission',\n file,\n lineNumber,\n 0.80,\n undefined,\n false,\n { category: 'user-testing:happy-path' }\n ));\n }\n }\n\n // \"I clicked a button but it didn't do anything\"\n if (/onClick|onPress/i.test(line) && !/disabled/i.test(line)) {\n if (!/loading|isLoading|pending|submitting/i.test(nearbyCode)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'low',\n '[Happy Path] Button click has no loading indicator',\n 'Add loading state to show action is in progress',\n file,\n lineNumber,\n 0.65,\n undefined,\n false,\n { category: 'user-testing:happy-path' }\n ));\n }\n }\n\n // \"I signed up but where do I go now?\"\n if (/signup|register|createAccount/i.test(line)) {\n if (!/onboard|welcome|dashboard|next.*step|redirect/i.test(nearbyCode)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'moderate',\n '[Happy Path] Sign-up flow may have no onboarding',\n 'Guide new users to next step after registration',\n file,\n lineNumber,\n 0.70,\n undefined,\n false,\n { category: 'user-testing:happy-path' }\n ));\n }\n }\n }\n\n return issues;\n }\n\n /**\n * SECURITY TESTER\n * \"Let me try to break this thing\"\n * Finds: XSS vulnerabilities, injection points, auth bypasses\n */\n private simulateSecurityTester(content: string, file: string): Issue[] {\n const issues: Issue[] = [];\n const lines = content.split('\\n');\n\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i]!;\n const lineNumber = i + 1;\n\n // \"What if I put <script> in this input?\"\n if (/<input|<textarea|contentEditable/i.test(line)) {\n if (!/sanitize|escape|DOMPurify|xss/i.test(content)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'serious',\n '[Security Tester] Input field may be vulnerable to XSS',\n 'Sanitize user input before rendering - use DOMPurify or similar',\n file,\n lineNumber,\n 0.75,\n undefined,\n false,\n { category: 'user-testing:security', owasp: 'A7:2017-XSS' }\n ));\n }\n }\n\n // \"What if I modify the hidden field?\"\n if (/type=[\"']hidden[\"']|hidden.*input/i.test(line)) {\n if (/userId|price|amount|role|admin|permission/i.test(line)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'critical',\n '[Security Tester] Sensitive data in hidden field can be tampered',\n 'Never trust hidden fields - validate on server side',\n file,\n lineNumber,\n 0.90,\n undefined,\n false,\n { category: 'user-testing:security', cwe: 'CWE-472' }\n ));\n }\n }\n\n // \"What if I replay this request?\"\n if (/fetch|axios|api.*call/i.test(line) && /delete|remove|transfer|payment/i.test(line)) {\n if (!/idempotency|token|nonce|csrf/i.test(content)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'serious',\n '[Security Tester] Destructive action may be replayable',\n 'Add idempotency key or CSRF token to prevent replay attacks',\n file,\n lineNumber,\n 0.80,\n undefined,\n false,\n { category: 'user-testing:security', cwe: 'CWE-352' }\n ));\n }\n }\n\n // \"What if I access this without logging in?\"\n if (/useEffect|componentDidMount/i.test(line) && /fetch|load|get/i.test(lines.slice(i, i + 10).join(''))) {\n if (!/auth|session|token|isAuthenticated|user/i.test(lines.slice(Math.max(0, i - 5), i + 5).join(''))) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'moderate',\n '[Security Tester] Data fetch may not check authentication',\n 'Verify user is authenticated before loading sensitive data',\n file,\n lineNumber,\n 0.65,\n undefined,\n false,\n { category: 'user-testing:security' }\n ));\n }\n }\n\n // \"What if I change the URL to access another user's data?\"\n if (/params\\.|useParams|router\\.query/i.test(line) && /userId|id|accountId/i.test(line)) {\n if (!/authorize|permission|own|current.*user/i.test(content)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'critical',\n '[Security Tester] URL parameter may allow IDOR attack',\n 'Verify user has permission to access requested resource',\n file,\n lineNumber,\n 0.85,\n undefined,\n false,\n { category: 'user-testing:security', cwe: 'CWE-639', owasp: 'A5:2017-Broken Access Control' }\n ));\n }\n }\n }\n\n return issues;\n }\n\n /**\n * CONFUSED USER\n * \"I don't understand what to do here\"\n * Finds: Missing labels, unclear errors, accessibility issues\n */\n private simulateConfusedUser(content: string, file: string): Issue[] {\n const issues: Issue[] = [];\n const lines = content.split('\\n');\n\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i]!;\n const lineNumber = i + 1;\n const nearbyCode = lines.slice(Math.max(0, i - 3), i + 5).join('\\n');\n\n // \"This error message doesn't help me\"\n if (/error|Error|err\\b/i.test(line) && /message|text|display/i.test(line)) {\n if (/generic|something.*wrong|error.*occurred|try.*again/i.test(line)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'moderate',\n '[Confused User] Error message is too generic',\n 'Provide specific, actionable error messages',\n file,\n lineNumber,\n 0.75,\n undefined,\n false,\n { category: 'user-testing:confused' }\n ));\n }\n }\n\n // \"What format should I use for this field?\"\n if (/<input/i.test(line) && /date|phone|email|zip|ssn|credit/i.test(line)) {\n if (!/placeholder.*example|format|pattern|hint/i.test(nearbyCode)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'low',\n '[Confused User] Input field has no format hint',\n 'Add placeholder or hint showing expected format (e.g., \"MM/DD/YYYY\")',\n file,\n lineNumber,\n 0.70,\n undefined,\n false,\n { category: 'user-testing:confused' }\n ));\n }\n }\n\n // \"I can't tell if this checkbox is required\"\n if (/checkbox|radio/i.test(line) && /terms|consent|agree|subscribe/i.test(nearbyCode)) {\n if (!/required|must|necessary|\\*/i.test(nearbyCode)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'low',\n '[Confused User] Consent checkbox requirement unclear',\n 'Clearly indicate if checkbox is required to proceed',\n file,\n lineNumber,\n 0.65,\n undefined,\n false,\n { category: 'user-testing:confused' }\n ));\n }\n }\n\n // \"I don't know what this button does\"\n if (/<button|Button/i.test(line)) {\n if (/\\.\\.\\.|icon.*only|aria-label/i.test(line) && !/tooltip|title=/i.test(nearbyCode)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'moderate',\n '[Confused User] Icon-only button has no tooltip',\n 'Add tooltip or visible text to explain button action',\n file,\n lineNumber,\n 0.70,\n undefined,\n false,\n { category: 'user-testing:confused' }\n ));\n }\n }\n\n // \"I made a mistake but can't undo it\"\n if (/delete|remove|cancel|clear/i.test(line) && /onClick|onPress/i.test(line)) {\n if (!/undo|restore|confirm|modal|dialog/i.test(content)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'serious',\n '[Confused User] Destructive action has no undo option',\n 'Add confirmation dialog or undo functionality',\n file,\n lineNumber,\n 0.80,\n undefined,\n false,\n { category: 'user-testing:confused' }\n ));\n }\n }\n }\n\n return issues;\n }\n\n /**\n * IMPATIENT USER\n * \"I'm clicking everything rapidly, not waiting for anything\"\n * Finds: Double-submit bugs, race conditions, missing debounce\n */\n private simulateImpatientUser(content: string, file: string): Issue[] {\n const issues: Issue[] = [];\n const lines = content.split('\\n');\n\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i]!;\n const lineNumber = i + 1;\n const nearbyCode = lines.slice(Math.max(0, i - 5), i + 10).join('\\n');\n\n // \"I clicked submit 5 times because nothing happened\"\n if (/onSubmit|handleSubmit/i.test(line)) {\n if (!/disabled|loading|isSubmitting|submitting|pending/i.test(nearbyCode)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'serious',\n '[Impatient User] Form can be double-submitted',\n 'Disable submit button while processing to prevent duplicates',\n file,\n lineNumber,\n 0.85,\n undefined,\n true,\n { category: 'user-testing:impatient' }\n ));\n }\n }\n\n // \"I'm typing really fast in this search box\"\n if (/onChange|onInput/i.test(line) && /search|query|filter/i.test(nearbyCode)) {\n if (!/debounce|throttle|timeout|delay/i.test(content)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'moderate',\n '[Impatient User] Search input may fire too many requests',\n 'Add debounce to prevent excessive API calls while typing',\n file,\n lineNumber,\n 0.75,\n undefined,\n true,\n { category: 'user-testing:impatient' }\n ));\n }\n }\n\n // \"I closed the modal before it finished loading\"\n if (/modal|dialog|popup/i.test(line) && /open|show|visible/i.test(line)) {\n if (/fetch|api|load/i.test(nearbyCode) && !/abort|cancel|cleanup|unmount/i.test(nearbyCode)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'moderate',\n '[Impatient User] Modal may have memory leak if closed during fetch',\n 'Add AbortController or cleanup function to cancel pending requests',\n file,\n lineNumber,\n 0.70,\n undefined,\n false,\n { category: 'user-testing:impatient' }\n ));\n }\n }\n\n // \"I navigated away before the action completed\"\n if (/navigate|push|replace|router/i.test(line) && /async|await|then/i.test(nearbyCode)) {\n if (!/beforeunload|prompt|warn|unsaved/i.test(content)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'low',\n '[Impatient User] Navigation during async action may lose data',\n 'Warn user or prevent navigation while action is in progress',\n file,\n lineNumber,\n 0.60,\n undefined,\n false,\n { category: 'user-testing:impatient' }\n ));\n }\n }\n }\n\n return issues;\n }\n\n /**\n * EDGE CASE USER\n * \"What if I enter nothing? What if I enter 10,000 characters?\"\n * Finds: Missing validation, boundary issues, special character handling\n */\n private simulateEdgeCaseUser(content: string, file: string): Issue[] {\n const issues: Issue[] = [];\n const lines = content.split('\\n');\n\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i]!;\n const lineNumber = i + 1;\n const nearbyCode = lines.slice(Math.max(0, i - 3), i + 5).join('\\n');\n\n // \"What if I submit an empty form?\"\n if (/<input|<textarea/i.test(line) && !/required/i.test(line)) {\n if (/name|email|password|title/i.test(line)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'moderate',\n '[Edge Case] Required-looking field has no validation',\n 'Add required attribute or validation for essential fields',\n file,\n lineNumber,\n 0.70,\n undefined,\n true,\n { category: 'user-testing:edge-case' }\n ));\n }\n }\n\n // \"What if I paste a novel into this text field?\"\n if (/<input|<textarea/i.test(line) && !/maxLength|max/i.test(line)) {\n if (/bio|description|comment|message|note/i.test(nearbyCode)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'low',\n '[Edge Case] Text field has no max length limit',\n 'Add maxLength to prevent excessive input',\n file,\n lineNumber,\n 0.65,\n undefined,\n true,\n { category: 'user-testing:edge-case' }\n ));\n }\n }\n\n // \"What if I enter emoji or special characters? 🚀<script>\"\n if (/<input/i.test(line) && /name|title|username/i.test(nearbyCode)) {\n if (!/pattern|regex|validate|sanitize/i.test(nearbyCode)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'moderate',\n '[Edge Case] Input may not handle special characters safely',\n 'Validate/sanitize input for special characters and emoji',\n file,\n lineNumber,\n 0.65,\n undefined,\n false,\n { category: 'user-testing:edge-case' }\n ));\n }\n }\n\n // \"What if the list is empty?\"\n if (/\\.map\\(|\\.forEach\\(/i.test(line) && /render|display|show/i.test(nearbyCode)) {\n if (!/empty|no.*items|nothing|length.*===?\\s*0/i.test(content)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'low',\n '[Edge Case] List may not handle empty state gracefully',\n 'Add empty state message when list has no items',\n file,\n lineNumber,\n 0.60,\n undefined,\n false,\n { category: 'user-testing:edge-case' }\n ));\n }\n }\n\n // \"What if I enter a negative number?\"\n if (/type=[\"']number[\"']/i.test(line)) {\n if (!/min=[\"']?0|positive|unsigned/i.test(nearbyCode) && /quantity|amount|count|age/i.test(nearbyCode)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'moderate',\n '[Edge Case] Number field may accept negative values',\n 'Add min=\"0\" to prevent negative input where inappropriate',\n file,\n lineNumber,\n 0.75,\n undefined,\n true,\n { category: 'user-testing:edge-case' }\n ));\n }\n }\n }\n\n return issues;\n }\n}\n","import { BaseAgent } from './base-agent.js';\nimport type { Issue, ScanContext, CodeContext, AgentPriority } from '../types/index.js';\nimport { \n scanForVibeCodeIssues, \n checkFileLevelIssues, \n getVibeCodeTrie,\n type VibeCodeMatch,\n type FileLevelIssue \n} from '../trie/vibe-code-signatures.js';\n\n/**\n * Trie Clean Agent\n * \n * Specialized agent for reviewing AI-generated and \"vibe coded\" projects.\n * Helps non-technical users avoid common pitfalls when using AI tools.\n * \n * Based on patterns seen in:\n * - r/cursor, r/webdev, r/reactjs, r/nextjs\n * - Twitter/X discussions about AI coding\n * - Discord communities (Cursor, v0, Lovable, Bolt)\n * \n * Philosophy: Be helpful and educational, not condescending.\n * Many users are learning to code with AI assistance.\n */\nexport class TrieCleanAgent extends BaseAgent {\n name = 'trie_clean';\n description = 'Reviews AI-generated code for common mistakes and best practices (for non-technical users)';\n version = '1.0.0';\n\n override get priority(): AgentPriority {\n return {\n name: this.name,\n tier: 1, // Always run - this is the main value prop for new coders\n estimatedTimeMs: 100,\n dependencies: []\n };\n }\n\n shouldActivate(_context: CodeContext): boolean {\n // Always activate - every project can benefit from this review\n return true;\n }\n\n protected async analyzeFiles(files: string[], _context: ScanContext): Promise<Issue[]> {\n const issues: Issue[] = [];\n \n // Initialize the trie\n getVibeCodeTrie();\n\n for (const file of files) {\n try {\n const content = await this.readFile(file);\n \n // Pattern-based checks (fast, trie-powered)\n const patternIssues = scanForVibeCodeIssues(content, file);\n issues.push(...this.convertPatternIssues(patternIssues, file));\n \n // File-level checks (size, structure)\n const fileIssues = checkFileLevelIssues(file, content);\n issues.push(...this.convertFileLevelIssues(fileIssues));\n \n } catch (error) {\n console.error(`Trie Clean Agent: Error reading file ${file}:`, error);\n }\n }\n\n // Deduplicate similar issues\n return this.deduplicateIssues(issues);\n }\n\n private convertPatternIssues(matches: VibeCodeMatch[], file: string): Issue[] {\n return matches.map(match => ({\n id: this.generateIssueId(),\n agent: this.name,\n severity: match.severity,\n issue: `${match.description}: ${match.commonMistake}`,\n fix: match.fix,\n file,\n line: match.line,\n confidence: this.getConfidence(match.severity),\n category: match.category,\n autoFixable: false, // These usually require understanding context\n }));\n }\n\n private convertFileLevelIssues(fileIssues: FileLevelIssue[]): Issue[] {\n return fileIssues.map(issue => ({\n id: this.generateIssueId(),\n agent: this.name,\n severity: issue.severity,\n issue: `${issue.issue}: ${issue.commonMistake}`,\n fix: issue.fix,\n file: issue.file,\n confidence: 0.9,\n category: issue.category,\n autoFixable: false,\n }));\n }\n\n private getConfidence(severity: string): number {\n switch (severity) {\n case 'critical': return 0.95;\n case 'serious': return 0.85;\n case 'moderate': return 0.75;\n default: return 0.65;\n }\n }\n\n private deduplicateIssues(issues: Issue[]): Issue[] {\n const seen = new Set<string>();\n return issues.filter(issue => {\n // Don't report same category multiple times for same file\n const key = `${issue.file}:${issue.category}:${issue.severity}`;\n if (seen.has(key)) return false;\n seen.add(key);\n return true;\n });\n }\n}\n\n/**\n * Format trie clean results in a friendly, educational way\n */\nexport function formatTrieCleanResults(issues: Issue[]): string {\n if (issues.length === 0) {\n return `\n## ✅ Your Code Looks Good!\n\nNo common AI-generated code issues found. Nice work!\n\n**Tips to keep it clean:**\n- Keep files under 300 lines\n- Group related state together\n- Always handle errors from API calls\n- Never put secrets in frontend code\n`;\n }\n\n let output = `\n## 🎯 Vibe Check Results\n\nFound ${issues.length} things to improve. Don't worry - these are super common with AI-generated code!\n\n`;\n\n // Group by severity\n const critical = issues.filter(i => i.severity === 'critical');\n const serious = issues.filter(i => i.severity === 'serious');\n const moderate = issues.filter(i => i.severity === 'moderate');\n const low = issues.filter(i => i.severity === 'low');\n\n if (critical.length > 0) {\n output += `### 🚨 Fix These First! (${critical.length})\\n\\n`;\n output += `These could break your app or expose sensitive data:\\n\\n`;\n for (const issue of critical) {\n output += `**${issue.file}:${issue.line || '?'}**\\n`;\n output += `- ❌ ${issue.issue}\\n`;\n output += `- ✅ ${issue.fix}\\n\\n`;\n }\n }\n\n if (serious.length > 0) {\n output += `### ⚠️ Should Fix (${serious.length})\\n\\n`;\n output += `These will cause problems eventually:\\n\\n`;\n for (const issue of serious) {\n output += `- **${issue.file}:${issue.line || '?'}** - ${issue.issue}\\n`;\n output += ` → ${issue.fix}\\n`;\n }\n output += '\\n';\n }\n\n if (moderate.length > 0) {\n output += `### 💡 Good to Know (${moderate.length})\\n\\n`;\n for (const issue of moderate.slice(0, 5)) {\n output += `- ${issue.issue}\\n`;\n output += ` → ${issue.fix}\\n`;\n }\n if (moderate.length > 5) {\n output += `- *...and ${moderate.length - 5} more suggestions*\\n`;\n }\n output += '\\n';\n }\n\n if (low.length > 0) {\n output += `### 📝 Minor Suggestions (${low.length})\\n\\n`;\n output += `These are minor but good to know:\\n`;\n for (const issue of low.slice(0, 3)) {\n output += `- ${issue.issue}\\n`;\n }\n if (low.length > 3) {\n output += `- *...and ${low.length - 3} more*\\n`;\n }\n }\n\n output += `\n---\n\n### 💬 Need Help?\n\nAsk your AI assistant:\n- \"Can you fix the [issue name] problem?\"\n- \"Refactor this file to be smaller\"\n- \"Add error handling to my API calls\"\n- \"Create proper TypeScript types for my data\"\n\n`;\n\n return output;\n}\n\n// Note: TrieCleanAgent AI enhancement uses base class defaults\n// which provides good general cleanup suggestions","import { BaseAgent } from './base-agent.js';\nimport type { Issue, ScanContext, CodeContext } from '../types/index.js';\n\n/**\n * SOC 2 Trust Service Criteria focused on code-level controls\n * \n * Key areas:\n * - CC6: Logical Access Controls (secrets, RBAC, MFA references)\n * - CC7: System Operations (logging, monitoring, error handling)\n * - CC8: Change Management (version control patterns)\n * - Security: Encryption, input validation, secure coding\n */\n\nconst SOC2_PATTERNS = {\n // CC6 - Logical Access Controls\n hardcodedSecrets: [\n { pattern: /['\"]sk_live_[A-Za-z0-9]{20,}['\"]/, issue: 'Hardcoded Stripe live key', regulation: 'CC6.1' },\n { pattern: /['\"]AKIA[A-Z0-9]{16}['\"]/, issue: 'Hardcoded AWS access key', regulation: 'CC6.1' },\n { pattern: /['\"]ghp_[A-Za-z0-9]{36}['\"]/, issue: 'Hardcoded GitHub token', regulation: 'CC6.1' },\n { pattern: /password\\s*[:=]\\s*['\"][^'\"]{8,}['\"](?!.*example|test|placeholder)/i, issue: 'Hardcoded password', regulation: 'CC6.1' },\n { pattern: /api[_-]?key\\s*[:=]\\s*['\"][A-Za-z0-9]{20,}['\"]/i, issue: 'Hardcoded API key', regulation: 'CC6.1' },\n { pattern: /secret\\s*[:=]\\s*['\"][^'\"]{16,}['\"]/i, issue: 'Hardcoded secret value', regulation: 'CC6.1' },\n ],\n \n // Missing access control\n accessControl: [\n { pattern: /\\/\\/\\s*TODO:?\\s*(add|implement)?\\s*(auth|access|permission)/i, issue: 'Missing access control (TODO)', regulation: 'CC6.2' },\n { pattern: /isAdmin\\s*[:=]\\s*true|role\\s*[:=]\\s*['\"]admin['\"]/i, issue: 'Hardcoded admin privilege', regulation: 'CC6.3' },\n ],\n\n // CC7 - System Operations (Logging & Monitoring)\n logging: [\n { pattern: /console\\.(log|error|warn)\\s*\\([^)]*password/i, issue: 'Password logged to console', regulation: 'CC7.2' },\n { pattern: /console\\.(log|error|warn)\\s*\\([^)]*token/i, issue: 'Token logged to console', regulation: 'CC7.2' },\n { pattern: /console\\.(log|error|warn)\\s*\\([^)]*secret/i, issue: 'Secret logged to console', regulation: 'CC7.2' },\n { pattern: /console\\.(log|error|warn)\\s*\\([^)]*apiKey/i, issue: 'API key logged to console', regulation: 'CC7.2' },\n ],\n\n // Error handling\n errorHandling: [\n { pattern: /catch\\s*\\([^)]*\\)\\s*\\{\\s*\\}/, issue: 'Empty catch block - errors silently swallowed', regulation: 'CC7.3' },\n { pattern: /catch\\s*\\([^)]*\\)\\s*\\{\\s*\\/\\//, issue: 'Catch block only has comments', regulation: 'CC7.3' },\n { pattern: /\\.catch\\s*\\(\\s*\\(\\s*\\)\\s*=>\\s*\\{\\s*\\}\\s*\\)/, issue: 'Empty .catch() handler', regulation: 'CC7.3' },\n ],\n\n // CC8 - Change Management (implicit through code patterns)\n changeManagement: [\n { pattern: /\\/\\/\\s*HACK|\\/\\/\\s*FIXME.*security|\\/\\/\\s*XXX/i, issue: 'Security-related HACK/FIXME comment', regulation: 'CC8.1' },\n { pattern: /\\/\\/\\s*temporary|\\/\\/\\s*remove\\s*(before|in)\\s*prod/i, issue: 'Temporary code flagged for removal', regulation: 'CC8.1' },\n ],\n\n // Security - Encryption\n encryption: [\n { pattern: /md5\\s*\\(|crypto\\.createHash\\s*\\(\\s*['\"]md5['\"]\\s*\\)/i, issue: 'MD5 is cryptographically broken', regulation: 'CC6.7' },\n { pattern: /sha1\\s*\\(|crypto\\.createHash\\s*\\(\\s*['\"]sha1['\"]\\s*\\)/i, issue: 'SHA1 is deprecated for security use', regulation: 'CC6.7' },\n { pattern: /DES|3DES|RC4|Blowfish/i, issue: 'Weak/deprecated encryption algorithm', regulation: 'CC6.7' },\n { pattern: /Math\\.random\\s*\\(\\s*\\).*(?:token|key|secret|password|id)/i, issue: 'Math.random() used for security-sensitive value', regulation: 'CC6.7' },\n ],\n\n // Security - Input validation\n inputValidation: [\n { pattern: /eval\\s*\\(\\s*(?:req\\.|request\\.|params\\.|query\\.)/i, issue: 'eval() with user input - code injection risk', regulation: 'CC6.6' },\n { pattern: /innerHTML\\s*=\\s*(?:req\\.|request\\.|params\\.|data\\.)/i, issue: 'innerHTML with unescaped user input - XSS risk', regulation: 'CC6.6' },\n { pattern: /exec\\s*\\(\\s*(?:req\\.|request\\.|params\\.|`)/i, issue: 'Command execution with user input', regulation: 'CC6.6' },\n { pattern: /\\$\\{.*\\}.*(?:SELECT|INSERT|UPDATE|DELETE)/i, issue: 'SQL query with string interpolation', regulation: 'CC6.6' },\n ],\n\n // Security - Authentication\n authentication: [\n { pattern: /jwt\\.sign\\s*\\([^)]*expiresIn:\\s*['\"]?\\d{6,}['\"]?/i, issue: 'JWT with very long expiration', regulation: 'CC6.1' },\n { pattern: /verify\\s*[:=]\\s*false|rejectUnauthorized\\s*[:=]\\s*false/i, issue: 'TLS/SSL verification disabled', regulation: 'CC6.7' },\n { pattern: /sameSite\\s*[:=]\\s*['\"]none['\"]/i, issue: 'Cookie SameSite=None may enable CSRF', regulation: 'CC6.1' },\n { pattern: /httpOnly\\s*[:=]\\s*false/i, issue: 'Cookie httpOnly disabled - XSS risk', regulation: 'CC6.1' },\n { pattern: /secure\\s*[:=]\\s*false.*cookie/i, issue: 'Cookie secure flag disabled', regulation: 'CC6.1' },\n ],\n};\n\n// Map regulations to descriptions\nconst REGULATION_DESCRIPTIONS: Record<string, string> = {\n 'CC6.1': 'Logical Access Security - Access controls and authentication',\n 'CC6.2': 'Role-Based Access Control - Segregation of duties',\n 'CC6.3': 'Least Privilege - Minimal necessary access rights',\n 'CC6.6': 'Protection Against Threats - Input validation and injection prevention',\n 'CC6.7': 'Data Protection - Encryption and secure transmission',\n 'CC7.2': 'Monitoring - Security event logging without sensitive data exposure',\n 'CC7.3': 'Incident Detection - Proper error handling and alerting',\n 'CC8.1': 'Change Management - Controlled changes with proper review',\n};\n\nexport class SOC2Agent extends BaseAgent {\n name = 'soc2';\n description = 'SOC 2 Type II compliance: access controls, encryption, logging, change management';\n version = '1.0.0';\n\n shouldActivate(context: CodeContext): boolean {\n // SOC 2 is relevant for most production code\n return (\n context.touchesAuth ||\n context.touchesAPI ||\n context.touchesDatabase ||\n context.touchesUserData ||\n context.touchesSecurityConfig ||\n context.touchesLogging\n );\n }\n\n protected async analyzeFiles(files: string[], _context: ScanContext): Promise<Issue[]> {\n const issues: Issue[] = [];\n\n for (const file of files) {\n // Skip non-code files\n if (/node_modules|\\.d\\.ts$|\\.min\\.|dist\\/|build\\/|\\.test\\.|\\.spec\\./i.test(file)) {\n continue;\n }\n\n try {\n const content = await this.readFile(file);\n const lines = content.split('\\n');\n\n // Check all SOC 2 pattern categories\n for (const [category, patterns] of Object.entries(SOC2_PATTERNS)) {\n for (const { pattern, issue, regulation } of patterns) {\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i] || '';\n \n if (pattern.test(line)) {\n // Skip if it's clearly in a test/example context\n if (this.isTestOrExample(line, content)) {\n continue;\n }\n\n const severity = this.getSeverity(category, regulation);\n const regulationDesc = REGULATION_DESCRIPTIONS[regulation] || regulation;\n\n issues.push(this.createIssue(\n this.generateIssueId(),\n severity,\n `[SOC 2 ${regulation}] ${issue}`,\n this.getFix(category, issue),\n file,\n i + 1,\n this.getConfidence(category),\n `SOC 2 ${regulation}: ${regulationDesc}`,\n this.isAutoFixable(category)\n ));\n \n // Only report first instance per pattern per file\n break;\n }\n }\n }\n }\n } catch (error) {\n console.error(`SOC2 Agent: Error reading file ${file}:`, error);\n }\n }\n\n return issues;\n }\n\n private isTestOrExample(line: string, content: string): boolean {\n // Check if line contains test/example indicators\n if (/example|test|mock|fake|dummy|placeholder|sample/i.test(line)) {\n return true;\n }\n // Check if we're in a test file context\n if (/describe\\s*\\(|it\\s*\\(|test\\s*\\(|jest|mocha|vitest/i.test(content.slice(0, 500))) {\n return true;\n }\n return false;\n }\n\n private getSeverity(category: string, regulation: string): 'critical' | 'serious' | 'moderate' | 'low' {\n // Critical: hardcoded secrets, code injection\n if (category === 'hardcodedSecrets' || regulation === 'CC6.6') {\n return 'critical';\n }\n // Serious: weak encryption, logging sensitive data, auth issues\n if (category === 'encryption' || category === 'logging' || category === 'authentication') {\n return 'serious';\n }\n // Moderate: access control, error handling\n if (category === 'accessControl' || category === 'errorHandling') {\n return 'moderate';\n }\n // Low: change management todos\n return 'low';\n }\n\n private getConfidence(category: string): number {\n switch (category) {\n case 'hardcodedSecrets': return 0.95;\n case 'logging': return 0.90;\n case 'encryption': return 0.85;\n case 'inputValidation': return 0.85;\n case 'authentication': return 0.80;\n case 'errorHandling': return 0.75;\n case 'accessControl': return 0.70;\n case 'changeManagement': return 0.60;\n default: return 0.70;\n }\n }\n\n private isAutoFixable(category: string): boolean {\n // Most SOC 2 issues require careful review\n return category === 'errorHandling';\n }\n\n private getFix(category: string, _issue: string): string {\n const fixes: Record<string, string> = {\n hardcodedSecrets: 'Move secrets to environment variables or a secrets manager (e.g., HashiCorp Vault, AWS Secrets Manager)',\n accessControl: 'Implement proper RBAC with dynamic role checking. Never hardcode admin privileges.',\n logging: 'Remove sensitive data from logs. Use structured logging with PII filtering.',\n errorHandling: 'Add proper error handling: log the error, notify monitoring, and return safe error messages.',\n encryption: 'Use strong algorithms: AES-256-GCM for encryption, SHA-256+ for hashing, crypto.randomBytes() for random values.',\n inputValidation: 'Validate and sanitize all user input. Use parameterized queries for SQL. Escape HTML output.',\n authentication: 'Use secure cookie settings (httpOnly, secure, sameSite). Set reasonable JWT expiration (15min-24h).',\n changeManagement: 'Address security-related TODOs before deployment. Document in issue tracker if deferring.',\n };\n return fixes[category] || 'Review and fix according to SOC 2 requirements.';\n }\n\n /**\n * AI Enhancement for SOC 2 compliance\n */\n protected override getAIEnhancementSystemPrompt(): string {\n return `You are a SOC 2 compliance auditor reviewing code for Trust Services Criteria violations.\n\nAnalyze detected issues for SOC 2 compliance:\n1. Security (CC6): Access controls, encryption, vulnerability management\n2. Availability (CC7): System operations, incident response\n3. Processing Integrity (CC8): Data accuracy, completeness\n4. Confidentiality (CC9): Data classification, access restrictions\n5. Privacy (P1-P8): GDPR-aligned privacy controls\n\nOutput STRICT JSON:\n{\n \"validated\": [{\n \"original_issue\": \"...\",\n \"verdict\": \"TRUE_POSITIVE\" | \"FALSE_POSITIVE\",\n \"confidence\": 0-100,\n \"file\": \"path\",\n \"line\": 123,\n \"severity\": \"critical\",\n \"soc2_criteria\": \"CC6.1 / CC7.2 / etc\",\n \"audit_risk\": \"What an auditor would flag\",\n \"fix\": \"Compliant implementation\"\n }],\n \"additional\": [{\n \"issue\": \"Compliance gap found\",\n \"file\": \"path\",\n \"line\": 123,\n \"severity\": \"serious\",\n \"soc2_criteria\": \"SOC 2 criteria\",\n \"audit_risk\": \"Audit finding risk\",\n \"fix\": \"Remediation steps\"\n }],\n \"summary\": \"SOC 2 audit readiness assessment\"\n}`;\n }\n}\n","import { BaseAgent } from './base-agent.js';\nimport type { Issue, ScanContext, CodeContext } from '../types/index.js';\n\n/**\n * Super Reviewer Agent — Interactive AI-Guided Code Review\n * \n * Code reviews are the new bottleneck in AI coding. This agent scales them.\n * \n * Instead of AI replacing human judgment, it shepherds the human through the review:\n * - Walks through each file, chunk by chunk\n * - Explains changes, connects dots across files\n * - Correlates with design docs and context\n * - Pauses for cross-examination before moving on\n * - Sequences files for understandability\n * \n * The goal: Make reviewing a large PR a delight, not a chore.\n */\nexport class SuperReviewerAgent extends BaseAgent {\n name = 'super-reviewer';\n description = 'Interactive PR review: walks through changes file-by-file, explains each chunk, waits for cross-examination';\n version = '1.0.0';\n\n shouldActivate(context: CodeContext): boolean {\n // Activate when reviewing PRs or when there are significant changes\n return (\n context.linesChanged > 50 ||\n context.isNewFeature ||\n context.touchesAuth ||\n context.touchesPayments ||\n context.touchesDatabase ||\n context.touchesAPI\n );\n }\n\n /**\n * The Super Reviewer doesn't do static pattern matching like other agents.\n * Instead, it generates a structured review workflow for the AI to execute.\n */\n protected async analyzeFiles(_files: string[], _context: ScanContext): Promise<Issue[]> {\n // Super Reviewer doesn't produce issues in the traditional sense.\n // It produces a review workflow that Claude will execute interactively.\n return [];\n }\n\n /**\n * Get the structured review workflow for a set of files/changes\n */\n async buildReviewWorkflow(\n changedFiles: Array<{ path: string; diff: string; additions: number; deletions: number }>,\n options: {\n prNumber?: string | undefined;\n prTitle?: string | undefined;\n prAuthor?: string | undefined;\n baseBranch?: string | undefined;\n headBranch?: string | undefined;\n mode?: 'own' | 'others'; // 1 = your own PR, 2 = someone else's\n designDocs?: string[];\n }\n ): Promise<ReviewWorkflow> {\n // Order files for understanding (not alphabetically)\n const orderedFiles = this.orderFilesForReview(changedFiles);\n \n return {\n metadata: {\n prNumber: options.prNumber,\n prTitle: options.prTitle,\n prAuthor: options.prAuthor,\n baseBranch: options.baseBranch,\n headBranch: options.headBranch,\n mode: options.mode || 'own',\n totalFiles: changedFiles.length,\n totalAdditions: changedFiles.reduce((sum, f) => sum + f.additions, 0),\n totalDeletions: changedFiles.reduce((sum, f) => sum + f.deletions, 0),\n },\n fileOrder: orderedFiles.map((f, idx) => ({\n index: idx + 1,\n path: f.path,\n reason: f.orderReason,\n additions: f.additions,\n deletions: f.deletions,\n })),\n designDocs: options.designDocs || [],\n reviewInstructions: this.getReviewInstructions(options.mode || 'own'),\n };\n }\n\n /**\n * Order files for understanding, not alphabetically\n * \n * Strategy:\n * 1. Protos/schemas first — define data structures\n * 2. Constants/configs early — context for magic values\n * 3. Core logic before utilities — understand main change before helpers\n * 4. Implementation before tests — know what's being tested\n * 5. Docs/comments last — reference during review\n */\n private orderFilesForReview(\n files: Array<{ path: string; diff: string; additions: number; deletions: number }>\n ): Array<{ path: string; diff: string; additions: number; deletions: number; orderReason: string; priority: number }> {\n \n const scored = files.map(file => {\n let priority = 50; // Default middle priority\n let reason = 'General implementation';\n \n const path = file.path.toLowerCase();\n \n // Tier 1: Schemas, protos, types (defines data structures)\n if (/\\.(proto|graphql|prisma)$/.test(path) || \n /schema\\.(ts|js|json)$/.test(path) ||\n /types?\\.(ts|d\\.ts)$/.test(path) ||\n path.includes('/types/') ||\n path.includes('/schema/')) {\n priority = 10;\n reason = 'Defines data structures everything else uses';\n }\n // Tier 2: Constants, configs (context for magic values)\n else if (/constants?\\.(ts|js)$/.test(path) ||\n /config\\.(ts|js|json)$/.test(path) ||\n path.includes('/config/') ||\n /\\.env/.test(path)) {\n priority = 20;\n reason = 'Gives context for values used throughout';\n }\n // Tier 3: Core business logic\n else if (path.includes('/core/') ||\n path.includes('/services/') ||\n path.includes('/domain/') ||\n path.includes('/lib/')) {\n priority = 30;\n reason = 'Core logic — understand this first';\n }\n // Tier 4: API/routes\n else if (path.includes('/api/') ||\n path.includes('/routes/') ||\n path.includes('/handlers/') ||\n path.includes('/controllers/')) {\n priority = 40;\n reason = 'API layer — connects core logic to consumers';\n }\n // Tier 5: UI components (after understanding data flow)\n else if (path.includes('/components/') ||\n path.includes('/pages/') ||\n path.includes('/views/') ||\n /\\.(tsx|jsx|vue|svelte)$/.test(path)) {\n priority = 50;\n reason = 'UI layer — uses core logic and types';\n }\n // Tier 6: Utilities/helpers\n else if (path.includes('/utils/') ||\n path.includes('/helpers/') ||\n /utils?\\.(ts|js)$/.test(path)) {\n priority = 60;\n reason = 'Helper utilities';\n }\n // Tier 7: Tests (after understanding what they test)\n else if (/\\.(test|spec)\\.(ts|js|tsx|jsx)$/.test(path) ||\n path.includes('__tests__') ||\n path.includes('/test/')) {\n priority = 70;\n reason = 'Tests — review after understanding the implementation';\n }\n // Tier 8: Docs, comments, README\n else if (/\\.(md|mdx|txt)$/.test(path) ||\n /readme/i.test(path) ||\n path.includes('/docs/')) {\n priority = 80;\n reason = 'Documentation — reference during review as needed';\n }\n // Tier 9: Config files (package.json, etc.)\n else if (/package\\.json$/.test(path) ||\n /tsconfig/.test(path) ||\n /\\.config\\.(ts|js|json)$/.test(path)) {\n priority = 90;\n reason = 'Project config — review last';\n }\n \n return { ...file, priority, orderReason: reason };\n });\n \n // Sort by priority (lower = earlier in review)\n return scored.sort((a, b) => a.priority - b.priority);\n }\n\n /**\n * Get the review mode instructions\n */\n private getReviewInstructions(mode: 'own' | 'others'): ReviewInstructions {\n if (mode === 'own') {\n return {\n mode: 'own',\n description: 'Your own PR — I explain, you learn/verify/fix',\n approach: [\n 'Walk through each file explaining what changed and why',\n 'Help you understand your own code better',\n 'Identify potential issues before reviewers do',\n 'Suggest improvements you can make before requesting review',\n ],\n afterEachFile: [\n 'Pause for your questions',\n 'Discuss any concerns you have',\n 'Note any self-review fixes to make',\n ],\n };\n } else {\n return {\n mode: 'others',\n description: \"Someone else's PR — I flag issues, you add comments\",\n approach: [\n 'Analyze each file for correctness and completeness',\n 'Flag potential issues with suggested comment text',\n 'Look for missing pieces (cleanup handlers, tests, edge cases)',\n 'Check state/lifecycle consistency',\n ],\n afterEachFile: [\n 'Present draft comments for your approval',\n 'Let you modify or skip each comment',\n 'Post approved comments to PR',\n ],\n };\n }\n }\n}\n\n// Type definitions for the review workflow\nexport interface ReviewWorkflow {\n metadata: {\n prNumber?: string | undefined;\n prTitle?: string | undefined;\n prAuthor?: string | undefined;\n baseBranch?: string | undefined;\n headBranch?: string | undefined;\n mode: 'own' | 'others';\n totalFiles: number;\n totalAdditions: number;\n totalDeletions: number;\n };\n fileOrder: Array<{\n index: number;\n path: string;\n reason: string;\n additions: number;\n deletions: number;\n }>;\n designDocs: string[];\n reviewInstructions: ReviewInstructions;\n}\n\nexport interface ReviewInstructions {\n mode: 'own' | 'others';\n description: string;\n approach: string[];\n afterEachFile: string[];\n}\n\n/**\n * Critical Review Mindset Checklist\n * \n * These are the questions to ask during review:\n */\nexport const CRITICAL_REVIEW_CHECKLIST = {\n stateAndLifecycle: [\n 'Cleanup symmetry: If state is set, is it reset? Check cleanup paths.',\n 'Lifecycle consistency: Does state survive scenarios it shouldn\\'t?',\n 'Guard completeness: Are there missing guards (already active, re-entrancy)?',\n ],\n edgeCasesAndRaces: [\n 'Concurrent calls: What if called twice rapidly? Orphaned promises?',\n 'Ordering assumptions: Does code assume events arrive in order?',\n 'Partial failures: If step 3 of 5 fails, is state left consistent?',\n ],\n missingPieces: [\n 'What\\'s NOT in the diff that should be? (cleanup handlers, tests)',\n 'Defensive gaps: Missing timeouts, size limits, null checks?',\n ],\n designQuestions: [\n 'Is this the right approach? Is there a simpler/more robust design?',\n 'Hidden assumptions: What does this assume about its environment?',\n ],\n};\n","import { BaseAgent } from './base-agent.js';\nimport type { Issue, ScanContext, CodeContext } from '../types/index.js';\n\n/**\n * Performance Agent\n * \n * Surfaces performance concerns for human review. Does NOT auto-score or claim\n * to measure \"real\" performance - that requires runtime profiling.\n * \n * What it does:\n * - Identifies patterns commonly associated with performance issues\n * - Flags potential memory leaks, unnecessary re-renders, large bundles\n * - Highlights N+1 query patterns and unoptimized loops\n * - Suggests areas for human investigation with profiling tools\n * \n * What it doesn't do:\n * - Claim to measure actual performance\n * - Auto-fix without human review (many \"fixes\" trade off other concerns)\n * - Replace real profiling, load testing, or production monitoring\n */\nexport class PerformanceAgent extends BaseAgent {\n name = 'performance';\n description = 'Surfaces performance patterns for human review: memory, renders, bundles, queries';\n version = '1.0.0';\n\n shouldActivate(context: CodeContext): boolean {\n return (\n context.touchesUI ||\n context.touchesDatabase ||\n context.touchesAPI ||\n context.patterns.hasAsyncCode ||\n context.linesChanged > 100\n );\n }\n\n protected async analyzeFiles(files: string[], _context: ScanContext): Promise<Issue[]> {\n const issues: Issue[] = [];\n\n for (const file of files) {\n try {\n const content = await this.readFile(file);\n issues.push(...this.checkMemoryPatterns(content, file));\n issues.push(...this.checkRenderPatterns(content, file));\n issues.push(...this.checkQueryPatterns(content, file));\n issues.push(...this.checkBundlePatterns(content, file));\n issues.push(...this.checkLoopPatterns(content, file));\n } catch {\n // Skip unreadable files\n }\n }\n\n return issues;\n }\n\n private checkMemoryPatterns(content: string, file: string): Issue[] {\n const issues: Issue[] = [];\n const lines = content.split('\\n');\n\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i] || '';\n const lineNumber = i + 1;\n\n // Event listeners without cleanup\n if (/addEventListener\\s*\\(/.test(line) && !content.includes('removeEventListener')) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'moderate',\n 'Event listener may not be cleaned up',\n 'Ensure removeEventListener is called on cleanup (useEffect return, componentWillUnmount)',\n file,\n lineNumber,\n 0.75,\n undefined,\n false,\n { category: 'memory-leak', effort: 'easy' }\n ));\n }\n\n // setInterval without cleanup\n if (/setInterval\\s*\\(/.test(line) && !content.includes('clearInterval')) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'serious',\n 'setInterval without clearInterval - likely memory leak',\n 'Store interval ID and call clearInterval on cleanup',\n file,\n lineNumber,\n 0.90,\n undefined,\n false,\n { category: 'memory-leak', effort: 'easy' }\n ));\n }\n\n // Large arrays stored in state without cleanup\n if (/useState.*\\[\\]/.test(line) && /\\.push|\\.concat|\\.unshift/.test(content)) {\n // Check if there's any cleanup or limit\n if (!/\\.slice\\(|\\.splice\\(|length\\s*[<>]/.test(content)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'low',\n 'Array state may grow unbounded - review if intentional',\n 'Consider limiting array size or implementing pagination',\n file,\n lineNumber,\n 0.60,\n undefined,\n false,\n { category: 'memory-growth', effort: 'medium' }\n ));\n }\n }\n\n // Closures capturing large objects\n if (/useCallback|useMemo/.test(line)) {\n const deps = line.match(/\\[([^\\]]*)\\]/);\n if (deps && deps[1] && deps[1].split(',').length > 5) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'low',\n 'Hook with many dependencies may indicate stale closure risk',\n 'Review dependencies - consider restructuring to reduce coupling',\n file,\n lineNumber,\n 0.50,\n undefined,\n false,\n { category: 'closure', effort: 'medium' }\n ));\n }\n }\n }\n\n return issues;\n }\n\n private checkRenderPatterns(content: string, file: string): Issue[] {\n const issues: Issue[] = [];\n const lines = content.split('\\n');\n\n // Only check React/UI files\n if (!/\\.(tsx|jsx)$/.test(file)) return issues;\n\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i] || '';\n const lineNumber = i + 1;\n\n // Inline object/array creation in JSX props\n if (/style=\\{\\{/.test(line) || /=\\{\\[.*\\]\\}/.test(line)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'low',\n 'Inline object/array in JSX creates new reference each render',\n 'Extract to useMemo or constant outside component if values are static',\n file,\n lineNumber,\n 0.65,\n undefined,\n false,\n { category: 'unnecessary-render', effort: 'easy' }\n ));\n }\n\n // Anonymous functions in JSX\n if (/onClick=\\{\\s*\\(\\)\\s*=>/.test(line) || /onChange=\\{\\s*\\(e\\)\\s*=>/.test(line)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'low',\n 'Anonymous function in JSX may cause child re-renders',\n 'Consider useCallback if passing to memoized children',\n file,\n lineNumber,\n 0.50,\n undefined,\n false,\n { category: 'unnecessary-render', effort: 'easy' }\n ));\n }\n\n // Missing key in map\n if (/\\.map\\s*\\(/.test(line) && !content.slice(i * 50, (i + 5) * 50).includes('key=')) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'moderate',\n 'Array rendering may be missing key prop',\n 'Add unique key prop to prevent unnecessary DOM reconciliation',\n file,\n lineNumber,\n 0.80,\n undefined,\n false,\n { category: 'reconciliation', effort: 'trivial' }\n ));\n }\n\n // useEffect with no dependencies (runs every render)\n if (/useEffect\\s*\\(\\s*\\(\\)\\s*=>/.test(line)) {\n const effectEnd = content.indexOf(')', content.indexOf('useEffect', i * 50) + 50);\n const effectContent = content.slice(i * 50, effectEnd);\n if (!/\\],?\\s*\\)/.test(effectContent)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'moderate',\n 'useEffect appears to run on every render (missing dependency array)',\n 'Add dependency array [] for mount-only or [deps] for specific triggers',\n file,\n lineNumber,\n 0.85,\n undefined,\n false,\n { category: 'effect-loop', effort: 'easy' }\n ));\n }\n }\n }\n\n return issues;\n }\n\n private checkQueryPatterns(content: string, file: string): Issue[] {\n const issues: Issue[] = [];\n const lines = content.split('\\n');\n\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i] || '';\n const lineNumber = i + 1;\n\n // N+1 query pattern: query in a loop\n if (/for\\s*\\(|\\.forEach|\\.map/.test(line)) {\n const loopContent = lines.slice(i, Math.min(i + 15, lines.length)).join('\\n');\n if (/await.*find|query|fetch|SELECT|prisma\\.|mongoose\\./i.test(loopContent)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'serious',\n 'Potential N+1 query: database/API call inside loop',\n 'Batch queries outside loop or use eager loading (include/populate/join)',\n file,\n lineNumber,\n 0.90,\n undefined,\n false,\n { category: 'n-plus-one', effort: 'medium' }\n ));\n }\n }\n\n // SELECT * patterns\n if (/SELECT\\s+\\*\\s+FROM/i.test(line)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'moderate',\n 'SELECT * fetches all columns - may transfer unnecessary data',\n 'Select only needed columns for better performance',\n file,\n lineNumber,\n 0.75,\n undefined,\n false,\n { category: 'over-fetching', effort: 'easy' }\n ));\n }\n\n // Missing pagination\n if (/findMany|find\\(\\)|SELECT.*FROM/i.test(line) && \n !/limit|take|skip|offset|LIMIT|TOP/i.test(content)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'moderate',\n 'Query may return unbounded results - no pagination detected',\n 'Add LIMIT/take/pagination to prevent loading entire tables',\n file,\n lineNumber,\n 0.70,\n undefined,\n false,\n { category: 'unbounded-query', effort: 'easy' }\n ));\n }\n }\n\n return issues;\n }\n\n private checkBundlePatterns(content: string, file: string): Issue[] {\n const issues: Issue[] = [];\n const lines = content.split('\\n');\n\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i] || '';\n const lineNumber = i + 1;\n\n // Large library imports without tree-shaking\n const heavyLibs = ['lodash', 'moment', 'antd', 'material-ui', '@mui/material'];\n for (const lib of heavyLibs) {\n if (new RegExp(`import\\\\s+\\\\w+\\\\s+from\\\\s+['\"]${lib}['\"]`).test(line)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'moderate',\n `Full ${lib} import may bloat bundle - use named imports`,\n `Change to: import { specificFunc } from '${lib}/specificFunc'`,\n file,\n lineNumber,\n 0.85,\n undefined,\n false,\n { category: 'bundle-size', effort: 'easy' }\n ));\n }\n }\n\n // Dynamic imports could help\n if (/import\\s+.*\\s+from/.test(line) && /Modal|Dialog|Chart|Editor|PDF/i.test(line)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'low',\n 'Heavy component could benefit from dynamic import',\n 'Consider: const Component = dynamic(() => import(\"...\"))',\n file,\n lineNumber,\n 0.60,\n undefined,\n false,\n { category: 'code-splitting', effort: 'easy' }\n ));\n }\n }\n\n return issues;\n }\n\n private checkLoopPatterns(content: string, file: string): Issue[] {\n const issues: Issue[] = [];\n const lines = content.split('\\n');\n\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i] || '';\n const lineNumber = i + 1;\n\n // Nested loops\n if (/for\\s*\\(/.test(line)) {\n const innerContent = lines.slice(i + 1, Math.min(i + 20, lines.length)).join('\\n');\n if (/for\\s*\\(|\\.forEach|\\.map.*\\.map|\\.filter.*\\.map/.test(innerContent)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'moderate',\n 'Nested iteration detected - O(n²) or worse complexity',\n 'Consider: Map/Set for lookups, single-pass algorithms, or indexing',\n file,\n lineNumber,\n 0.75,\n undefined,\n false,\n { category: 'algorithmic', effort: 'medium' }\n ));\n }\n }\n\n // Array methods that could be combined\n if (/\\.filter\\(.*\\)\\.map\\(/.test(line) || /\\.map\\(.*\\)\\.filter\\(/.test(line)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'low',\n 'Chained filter/map creates intermediate arrays',\n 'Consider combining into single reduce for large arrays',\n file,\n lineNumber,\n 0.50,\n undefined,\n false,\n { category: 'array-allocation', effort: 'easy' }\n ));\n }\n }\n\n return issues;\n }\n}\n","import { BaseAgent } from './base-agent.js';\nimport type { Issue, ScanContext, CodeContext } from '../types/index.js';\n\n/**\n * E2E Agent\n * \n * Identifies gaps in end-to-end test coverage and common testing anti-patterns.\n * Does NOT generate tests automatically - that requires human understanding of\n * user flows and acceptance criteria.\n * \n * What it does:\n * - Identifies pages/routes without corresponding E2E tests\n * - Flags flaky test patterns (timing issues, race conditions)\n * - Surfaces missing critical path coverage\n * - Checks for testing anti-patterns\n * \n * What it doesn't do:\n * - Auto-generate meaningful E2E tests (requires domain knowledge)\n * - Replace human QA thinking about user journeys\n * - Validate that existing tests actually test the right things\n */\nexport class E2EAgent extends BaseAgent {\n name = 'e2e';\n description = 'Identifies E2E test gaps and flaky test patterns for human review';\n version = '1.0.0';\n\n shouldActivate(context: CodeContext): boolean {\n return (\n context.touchesUI ||\n context.isNewFeature ||\n context.patterns.hasFormHandling\n );\n }\n\n protected async analyzeFiles(files: string[], _context: ScanContext): Promise<Issue[]> {\n const issues: Issue[] = [];\n\n // Separate test files from source files\n const testFiles = files.filter(f => this.isTestFile(f));\n const sourceFiles = files.filter(f => !this.isTestFile(f));\n const e2eFiles = testFiles.filter(f => /e2e|playwright|cypress|spec\\.(ts|js)$/i.test(f));\n\n // Check for missing E2E coverage\n issues.push(...this.checkMissingCoverage(sourceFiles, e2eFiles));\n\n // Check E2E test files for anti-patterns\n for (const file of e2eFiles) {\n try {\n const content = await this.readFile(file);\n issues.push(...this.checkFlakyPatterns(content, file));\n issues.push(...this.checkTestAntiPatterns(content, file));\n } catch {\n // Skip unreadable files\n }\n }\n\n // Check source files for untestable patterns\n for (const file of sourceFiles) {\n try {\n const content = await this.readFile(file);\n issues.push(...this.checkUntestablePatterns(content, file));\n } catch {\n // Skip\n }\n }\n\n return issues;\n }\n\n private isTestFile(file: string): boolean {\n return /\\.(test|spec|e2e)\\.[jt]sx?$/.test(file) ||\n /__tests__|e2e|playwright|cypress/.test(file);\n }\n\n private checkMissingCoverage(sourceFiles: string[], e2eFiles: string[]): Issue[] {\n const issues: Issue[] = [];\n\n // Find pages/routes without E2E tests\n const pageFiles = sourceFiles.filter(f => \n /pages?\\/|routes?\\/|views?\\/|screens?\\//.test(f) &&\n /\\.(tsx|jsx|vue|svelte)$/.test(f) &&\n !/layout|_app|_document|index\\.(tsx|jsx)$/.test(f)\n );\n\n const e2eContent = e2eFiles.join(' '); // Rough check\n\n for (const page of pageFiles) {\n const pageName = page.split('/').pop()?.replace(/\\.[^.]+$/, '') || '';\n // Very rough heuristic - real analysis would need to parse test files\n if (pageName && pageName.length > 2 && !e2eContent.toLowerCase().includes(pageName.toLowerCase())) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'low',\n `Page \"${pageName}\" may lack E2E test coverage`,\n 'Consider adding E2E tests for critical user flows on this page',\n page,\n 1,\n 0.50,\n undefined,\n false,\n { category: 'coverage-gap', effort: 'hard' }\n ));\n }\n }\n\n // Check for forms without E2E tests\n const formFiles = sourceFiles.filter(f => /form/i.test(f));\n for (const form of formFiles) {\n if (!e2eContent.toLowerCase().includes('form')) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'moderate',\n 'Form components may lack E2E validation testing',\n 'Forms are high-value E2E targets - test submit, validation, error states',\n form,\n 1,\n 0.60,\n undefined,\n false,\n { category: 'form-testing', effort: 'medium' }\n ));\n break; // Only warn once\n }\n }\n\n return issues;\n }\n\n private checkFlakyPatterns(content: string, file: string): Issue[] {\n const issues: Issue[] = [];\n const lines = content.split('\\n');\n\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i] || '';\n const lineNumber = i + 1;\n\n // Hardcoded waits\n if (/waitForTimeout|sleep|wait\\s*\\(\\s*\\d+\\s*\\)|setTimeout/.test(line)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'serious',\n 'Hardcoded wait is flaky - use explicit conditions instead',\n 'Replace with: waitForSelector, waitForResponse, or expect().toBeVisible()',\n file,\n lineNumber,\n 0.95,\n undefined,\n false,\n { category: 'flaky-test', effort: 'easy' }\n ));\n }\n\n // Time-sensitive assertions\n if (/expect.*Date\\.now|expect.*new Date/.test(line)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'moderate',\n 'Time-based assertion may be flaky across timezones/speeds',\n 'Mock time in tests or use relative comparisons',\n file,\n lineNumber,\n 0.75,\n undefined,\n false,\n { category: 'flaky-test', effort: 'medium' }\n ));\n }\n\n // Non-deterministic selectors\n if (/getBy(TestId|Role|Text|Label)/.test(line)) {\n // Good - skip\n } else if (/querySelector|css=|xpath=|nth-child|:nth-of-type/.test(line)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'moderate',\n 'Positional/CSS selector may break if DOM structure changes',\n 'Prefer data-testid, role, or text-based selectors for stability',\n file,\n lineNumber,\n 0.70,\n undefined,\n false,\n { category: 'brittle-selector', effort: 'easy' }\n ));\n }\n\n // Race conditions\n if (/click.*click|fill.*fill/.test(lines.slice(i, i + 3).join(''))) {\n const context = lines.slice(i, i + 3).join('');\n if (!/await.*await|waitFor/.test(context)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'moderate',\n 'Rapid sequential actions without awaiting may cause race conditions',\n 'Ensure each action is awaited or add explicit waits between actions',\n file,\n lineNumber,\n 0.65,\n undefined,\n false,\n { category: 'race-condition', effort: 'easy' }\n ));\n }\n }\n }\n\n return issues;\n }\n\n private checkTestAntiPatterns(content: string, file: string): Issue[] {\n const issues: Issue[] = [];\n const lines = content.split('\\n');\n\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i] || '';\n const lineNumber = i + 1;\n\n // Tests without assertions\n if (/it\\s*\\(|test\\s*\\(/.test(line)) {\n const testBlock = lines.slice(i, Math.min(i + 30, lines.length)).join('\\n');\n const nextTestIndex = testBlock.slice(10).search(/it\\s*\\(|test\\s*\\(|describe\\s*\\(/);\n const testContent = nextTestIndex > 0 ? testBlock.slice(0, nextTestIndex + 10) : testBlock;\n \n if (!/expect|assert|should|toBe|toHave|toEqual|toMatch/.test(testContent)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'serious',\n 'Test appears to have no assertions',\n 'Add expect() calls to verify expected behavior',\n file,\n lineNumber,\n 0.80,\n undefined,\n false,\n { category: 'missing-assertion', effort: 'easy' }\n ));\n }\n }\n\n // Commented out tests\n if (/\\/\\/\\s*(it|test|describe)\\s*\\(|\\/\\*.*\\b(it|test)\\b/.test(line)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'low',\n 'Commented out test - remove or fix',\n 'Either fix the test or delete it - commented code is tech debt',\n file,\n lineNumber,\n 0.90,\n undefined,\n false,\n { category: 'dead-test', effort: 'trivial' }\n ));\n }\n\n // Skip/only left in\n if (/\\.(only|skip)\\s*\\(/.test(line)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'serious',\n '.only() or .skip() should not be committed',\n 'Remove .only()/.skip() before merging',\n file,\n lineNumber,\n 0.95,\n undefined,\n true, // Auto-fixable\n { category: 'test-hygiene', effort: 'trivial' }\n ));\n }\n }\n\n return issues;\n }\n\n private checkUntestablePatterns(content: string, file: string): Issue[] {\n const issues: Issue[] = [];\n const lines = content.split('\\n');\n\n // Only check UI files\n if (!/\\.(tsx|jsx|vue|svelte)$/.test(file)) return issues;\n\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i] || '';\n const lineNumber = i + 1;\n\n // Missing data-testid on interactive elements\n if (/<(button|input|form|select|a)\\s/.test(line) && !/data-testid/.test(line)) {\n // Only flag if it's a significant element (has handlers or important attributes)\n if (/onClick|onSubmit|href=|type=[\"']submit/.test(line)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'low',\n 'Interactive element lacks data-testid for E2E targeting',\n 'Add data-testid=\"descriptive-name\" for stable test selectors',\n file,\n lineNumber,\n 0.55,\n undefined,\n true, // Could auto-add\n { category: 'testability', effort: 'trivial' }\n ));\n }\n }\n }\n\n return issues;\n }\n}\n","import { BaseAgent } from './base-agent.js';\nimport type { Issue, ScanContext, CodeContext } from '../types/index.js';\n\n/**\n * Visual QA Agent\n * \n * Identifies potential visual/layout issues in CSS and components.\n * Does NOT actually render or screenshot - that requires a browser.\n * \n * What it does:\n * - Flags CSS patterns known to cause layout shifts\n * - Identifies missing responsive handling\n * - Surfaces z-index conflicts and overflow issues\n * - Highlights accessibility contrast concerns\n * \n * What it doesn't do:\n * - Actually see the rendered output (would need Playwright + vision)\n * - Replace human visual review of designs\n * - Guarantee pixel-perfect layouts\n */\nexport class VisualQAAgent extends BaseAgent {\n name = 'visual-qa';\n description = 'Surfaces potential visual/layout issues in CSS for human review';\n version = '1.0.0';\n\n shouldActivate(context: CodeContext): boolean {\n return (\n context.touchesUI ||\n context.filePatterns.some(f => /\\.(css|scss|sass|less|styled)/.test(f))\n );\n }\n\n protected async analyzeFiles(files: string[], _context: ScanContext): Promise<Issue[]> {\n const issues: Issue[] = [];\n\n const styleFiles = files.filter(f => /\\.(css|scss|sass|less)$/.test(f));\n const componentFiles = files.filter(f => /\\.(tsx|jsx|vue|svelte)$/.test(f));\n\n for (const file of [...styleFiles, ...componentFiles]) {\n try {\n const content = await this.readFile(file);\n issues.push(...this.checkLayoutShifts(content, file));\n issues.push(...this.checkResponsive(content, file));\n issues.push(...this.checkZIndex(content, file));\n issues.push(...this.checkOverflow(content, file));\n issues.push(...this.checkAccessibility(content, file));\n issues.push(...this.checkAnimations(content, file));\n } catch {\n // Skip unreadable files\n }\n }\n\n return issues;\n }\n\n private checkLayoutShifts(content: string, file: string): Issue[] {\n const issues: Issue[] = [];\n const lines = content.split('\\n');\n\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i] || '';\n const lineNumber = i + 1;\n\n // Images without dimensions\n if (/<img\\s/.test(line) && !/width|height|aspect-ratio|fill/.test(line)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'moderate',\n 'Image without explicit dimensions may cause layout shift (CLS)',\n 'Add width/height attributes or use aspect-ratio container',\n file,\n lineNumber,\n 0.85,\n undefined,\n false,\n { category: 'cls', effort: 'easy' }\n ));\n }\n\n // Dynamic content without min-height\n if (/{.*loading|isLoading|skeleton/i.test(line)) {\n const context = lines.slice(Math.max(0, i - 5), i + 5).join('\\n');\n if (!/min-height|min-h-|skeleton|placeholder/.test(context)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'low',\n 'Loading state may cause layout shift if content height varies',\n 'Consider min-height or skeleton with matching dimensions',\n file,\n lineNumber,\n 0.60,\n undefined,\n false,\n { category: 'cls', effort: 'easy' }\n ));\n }\n }\n\n // Font loading without fallback sizing\n if (/font-family/.test(line) && /url\\(|@import|@font-face/.test(content)) {\n if (!/font-display:\\s*swap|font-display:\\s*optional|size-adjust/.test(content)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'low',\n 'Custom font without font-display may cause FOIT/FOUT',\n 'Add font-display: swap to @font-face or use size-adjust fallback',\n file,\n lineNumber,\n 0.70,\n undefined,\n false,\n { category: 'font-loading', effort: 'easy' }\n ));\n }\n }\n }\n\n return issues;\n }\n\n private checkResponsive(content: string, file: string): Issue[] {\n const issues: Issue[] = [];\n const lines = content.split('\\n');\n\n // Check for fixed widths without responsive handling\n let hasMediaQuery = /@media|breakpoint|sm:|md:|lg:|xl:/.test(content);\n let hasFixedWidth = /width:\\s*\\d+px/.test(content);\n\n if (hasFixedWidth && !hasMediaQuery && /\\.(css|scss|sass|less)$/.test(file)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'moderate',\n 'Fixed pixel widths without responsive breakpoints',\n 'Consider using relative units (%, rem, vw) or add media queries',\n file,\n 1,\n 0.65,\n undefined,\n false,\n { category: 'responsive', effort: 'medium' }\n ));\n }\n\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i] || '';\n const lineNumber = i + 1;\n\n // Viewport units without fallback\n if (/100vh/.test(line) && !/dvh|svh|lvh/.test(content)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'low',\n '100vh can cause issues on mobile (address bar)',\n 'Consider 100dvh (dynamic viewport) or JS-based solution',\n file,\n lineNumber,\n 0.60,\n undefined,\n false,\n { category: 'mobile', effort: 'easy' }\n ));\n }\n\n // Text that might overflow\n if (/text-overflow:\\s*ellipsis/.test(line)) {\n const context = lines.slice(Math.max(0, i - 3), i + 3).join('\\n');\n if (!/white-space:\\s*nowrap/.test(context) || !/overflow:\\s*(hidden|clip)/.test(context)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'low',\n 'text-overflow: ellipsis requires white-space: nowrap and overflow: hidden',\n 'Add missing properties for ellipsis to work',\n file,\n lineNumber,\n 0.90,\n undefined,\n false,\n { category: 'text-overflow', effort: 'trivial' }\n ));\n }\n }\n }\n\n return issues;\n }\n\n private checkZIndex(content: string, file: string): Issue[] {\n const issues: Issue[] = [];\n const lines = content.split('\\n');\n\n const zIndexValues: number[] = [];\n\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i] || '';\n const lineNumber = i + 1;\n\n const match = line.match(/z-index:\\s*(\\d+)/);\n if (match) {\n const value = parseInt(match[1] || '0', 10);\n zIndexValues.push(value);\n\n // Extremely high z-index\n if (value > 1000) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'moderate',\n `z-index: ${value} is very high - may indicate z-index wars`,\n 'Use a z-index scale (1-10) and stacking contexts instead',\n file,\n lineNumber,\n 0.70,\n undefined,\n false,\n { category: 'z-index', effort: 'medium' }\n ));\n }\n\n // Magic number z-index\n if (value > 10 && value !== 50 && value !== 100 && value !== 999 && value !== 9999) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'low',\n `z-index: ${value} appears arbitrary - consider named tokens`,\n 'Define z-index scale: --z-dropdown: 10, --z-modal: 20, etc.',\n file,\n lineNumber,\n 0.50,\n undefined,\n false,\n { category: 'z-index', effort: 'easy' }\n ));\n }\n }\n }\n\n return issues;\n }\n\n private checkOverflow(content: string, file: string): Issue[] {\n const issues: Issue[] = [];\n const lines = content.split('\\n');\n\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i] || '';\n const lineNumber = i + 1;\n\n // Horizontal scrolling risks\n if (/width:\\s*(100vw|\\d{4,}px)/.test(line)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'moderate',\n '100vw or large fixed width may cause horizontal scroll on mobile',\n 'Use 100% or max-width: 100vw with overflow-x: hidden on body',\n file,\n lineNumber,\n 0.75,\n undefined,\n false,\n { category: 'overflow', effort: 'easy' }\n ));\n }\n\n // Missing overflow handling on flex/grid containers\n if (/display:\\s*(flex|grid)/.test(line)) {\n const context = lines.slice(i, Math.min(i + 10, lines.length)).join('\\n');\n if (/flex-shrink:\\s*0|flex:\\s*0\\s+0|min-width:\\s*0/.test(context)) {\n // Good - they're handling shrinking\n } else if (/width|min-width/.test(context) && !/overflow|text-overflow|min-width:\\s*0/.test(context)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'low',\n 'Flex/grid items may overflow container without min-width: 0',\n 'Add min-width: 0 to allow proper shrinking of flex children',\n file,\n lineNumber,\n 0.55,\n undefined,\n false,\n { category: 'flex-overflow', effort: 'trivial' }\n ));\n }\n }\n }\n\n return issues;\n }\n\n private checkAccessibility(content: string, file: string): Issue[] {\n const issues: Issue[] = [];\n const lines = content.split('\\n');\n\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i] || '';\n const lineNumber = i + 1;\n\n // Tiny text\n if (/font-size:\\s*(\\d+)px/.test(line)) {\n const size = parseInt(line.match(/font-size:\\s*(\\d+)px/)?.[1] || '16', 10);\n if (size < 12) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'moderate',\n `Font size ${size}px is below minimum readable size`,\n 'Use at least 12px (preferably 14-16px) for body text',\n file,\n lineNumber,\n 0.85,\n undefined,\n false,\n { category: 'accessibility', effort: 'trivial' }\n ));\n }\n }\n\n // Low contrast colors (rough heuristic)\n if (/color:\\s*#([a-fA-F0-9]{6})/.test(line)) {\n const context = lines.slice(Math.max(0, i - 5), i + 5).join('\\n');\n const colorMatch = line.match(/color:\\s*#([a-fA-F0-9]{6})/);\n const bgMatch = context.match(/background(-color)?:\\s*#([a-fA-F0-9]{6})/);\n \n if (colorMatch && bgMatch) {\n // Very rough contrast check - just flag light-on-light or dark-on-dark\n const textLightness = this.getHexLightness(colorMatch[1] || 'ffffff');\n const bgLightness = this.getHexLightness(bgMatch[2] || '000000');\n \n if (Math.abs(textLightness - bgLightness) < 30) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'moderate',\n 'Text and background colors may have insufficient contrast',\n 'Check with a contrast checker - WCAG requires 4.5:1 for normal text',\n file,\n lineNumber,\n 0.60,\n undefined,\n false,\n { category: 'contrast', effort: 'easy' }\n ));\n }\n }\n }\n\n // Focus outline removal\n if (/outline:\\s*none|outline:\\s*0/.test(line) && !/focus-visible|:focus.*outline/.test(content)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'serious',\n 'Removing focus outline breaks keyboard navigation',\n 'If removing default outline, add custom :focus-visible styles',\n file,\n lineNumber,\n 0.95,\n undefined,\n false,\n { category: 'focus', effort: 'easy' }\n ));\n }\n }\n\n return issues;\n }\n\n private checkAnimations(content: string, file: string): Issue[] {\n const issues: Issue[] = [];\n const lines = content.split('\\n');\n\n // Check for prefers-reduced-motion support\n const hasAnimations = /animation|transition|@keyframes/.test(content);\n const hasReducedMotion = /prefers-reduced-motion/.test(content);\n\n if (hasAnimations && !hasReducedMotion) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'moderate',\n 'Animations without prefers-reduced-motion support',\n 'Add @media (prefers-reduced-motion: reduce) to disable/reduce animations',\n file,\n 1,\n 0.75,\n undefined,\n false,\n { category: 'motion', effort: 'easy' }\n ));\n }\n\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i] || '';\n const lineNumber = i + 1;\n\n // Long animations that might feel slow\n if (/animation.*(\\d+)s/.test(line) || /transition.*(\\d+)s/.test(line)) {\n const duration = parseFloat(line.match(/(\\d+\\.?\\d*)s/)?.[1] || '0');\n if (duration > 1) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'low',\n `${duration}s animation may feel slow - typical max is 300-500ms`,\n 'Consider shorter duration or ensure long animation is intentional',\n file,\n lineNumber,\n 0.50,\n undefined,\n false,\n { category: 'animation-timing', effort: 'trivial' }\n ));\n }\n }\n }\n\n return issues;\n }\n\n private getHexLightness(hex: string): number {\n const r = parseInt(hex.slice(0, 2), 16);\n const g = parseInt(hex.slice(2, 4), 16);\n const b = parseInt(hex.slice(4, 6), 16);\n return (r * 0.299 + g * 0.587 + b * 0.114); // Perceived brightness\n }\n}\n","import { BaseAgent } from './base-agent.js';\nimport type { Issue, ScanContext, CodeContext } from '../types/index.js';\n\n/**\n * Data Flow Agent\n * \n * Identifies schema mismatches, placeholder data, and data integrity issues.\n * This is one of the most valuable agents for catching real bugs that AI\n * code generation commonly introduces.\n * \n * What it does:\n * - Detects placeholder/mock data left in production code\n * - Identifies schema mismatches between frontend and backend\n * - Flags hardcoded IDs, emails, URLs that should be dynamic\n * - Surfaces potential data transformation bugs\n * \n * What it doesn't do:\n * - Validate actual runtime data (needs real execution)\n * - Replace integration testing\n * - Understand your domain model (needs human context)\n */\nexport class DataFlowAgent extends BaseAgent {\n name = 'data-flow';\n description = 'Detects schema mismatches, placeholder data, and data integrity issues';\n version = '1.0.0';\n\n shouldActivate(context: CodeContext): boolean {\n return (\n context.touchesAPI ||\n context.touchesDatabase ||\n context.isNewFeature ||\n context.patterns.hasFormHandling\n );\n }\n\n protected async analyzeFiles(files: string[], _context: ScanContext): Promise<Issue[]> {\n const issues: Issue[] = [];\n\n for (const file of files) {\n try {\n const content = await this.readFile(file);\n \n // Skip test files for placeholder detection\n const isTest = this.isTestFile(file);\n \n if (!isTest) {\n issues.push(...this.checkPlaceholders(content, file));\n issues.push(...this.checkHardcodedData(content, file));\n }\n \n issues.push(...this.checkSchemaMismatches(content, file));\n issues.push(...this.checkDataTransformations(content, file));\n issues.push(...this.checkTypeCoercion(content, file));\n } catch {\n // Skip unreadable files\n }\n }\n\n return issues;\n }\n\n private isTestFile(file: string): boolean {\n return /\\.(test|spec)\\.[jt]sx?$/.test(file) ||\n /__tests__|__mocks__|fixtures|mock/.test(file);\n }\n\n private checkPlaceholders(content: string, file: string): Issue[] {\n const issues: Issue[] = [];\n const lines = content.split('\\n');\n\n // Common placeholder patterns\n const placeholderPatterns = [\n { pattern: /[\"']lorem ipsum/i, desc: 'Lorem ipsum placeholder text' },\n { pattern: /[\"']test@(test|example)\\.com[\"']/i, desc: 'Test email address' },\n { pattern: /[\"']TODO[\"']|[\"']FIXME[\"']|[\"']PLACEHOLDER[\"']/i, desc: 'TODO/PLACEHOLDER string value' },\n { pattern: /[\"']xxx[\"']|[\"']yyy[\"']|[\"']zzz[\"']/i, desc: 'Placeholder string (xxx/yyy/zzz)' },\n { pattern: /[\"']foo[\"']|[\"']bar[\"']|[\"']baz[\"']/, desc: 'Common placeholder names' },\n { pattern: /[\"']asdf[\"']|[\"']qwerty[\"']/i, desc: 'Keyboard mash placeholder' },\n { pattern: /[\"']changeme[\"']|[\"']replace[-_]?me[\"']/i, desc: 'Replace-me placeholder' },\n { pattern: /[\"']your[-_]?.*[-_]?here[\"']/i, desc: 'Your-X-here placeholder' },\n { pattern: /price:\\s*0[,\\s]|amount:\\s*0[,\\s]|total:\\s*0[,\\s]/i, desc: 'Zero price/amount (placeholder?)' },\n ];\n\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i] || '';\n const lineNumber = i + 1;\n\n for (const { pattern, desc } of placeholderPatterns) {\n if (pattern.test(line)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'serious',\n `Placeholder data in production code: ${desc}`,\n 'Replace with real data or remove before shipping',\n file,\n lineNumber,\n 0.90,\n undefined,\n false,\n { category: 'placeholder', effort: 'easy' }\n ));\n break; // One issue per line\n }\n }\n\n // Sample/demo data arrays\n if (/const\\s+\\w+\\s*=\\s*\\[/.test(line)) {\n const arrayContent = lines.slice(i, Math.min(i + 20, lines.length)).join('\\n');\n if (/Sample|Demo|Fake|Mock|Dummy|Test\\s*(User|Item|Product)/i.test(arrayContent) &&\n !/mock|test|spec|fixture|story/.test(file.toLowerCase())) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'moderate',\n 'Hardcoded sample/demo data found - should this be fetched?',\n 'Replace with API call or move to fixtures if for testing',\n file,\n lineNumber,\n 0.75,\n undefined,\n false,\n { category: 'mock-data', effort: 'medium' }\n ));\n }\n }\n }\n\n return issues;\n }\n\n private checkHardcodedData(content: string, file: string): Issue[] {\n const issues: Issue[] = [];\n const lines = content.split('\\n');\n\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i] || '';\n const lineNumber = i + 1;\n\n // Hardcoded UUIDs (not in config/constants)\n if (/[\"'][0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}[\"']/i.test(line)) {\n if (!/const|config|env|fixture|mock|test/i.test(line)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'moderate',\n 'Hardcoded UUID - should this be dynamic?',\n 'If this is a real ID, it should come from API/config. If test data, move to fixtures.',\n file,\n lineNumber,\n 0.70,\n undefined,\n false,\n { category: 'hardcoded-id', effort: 'easy' }\n ));\n }\n }\n\n // Hardcoded dates that might go stale\n if (/[\"']20[2-3][0-9]-[0-1][0-9]-[0-3][0-9]/.test(line)) {\n if (!/birthday|created|founded|copyright|version/i.test(line)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'low',\n 'Hardcoded date - will this become stale?',\n 'Consider using relative dates or Date.now() if dynamic needed',\n file,\n lineNumber,\n 0.55,\n undefined,\n false,\n { category: 'hardcoded-date', effort: 'easy' }\n ));\n }\n }\n\n // Hardcoded API endpoints\n if (/[\"'](https?:\\/\\/[^\"']+api[^\"']+)[\"']/.test(line)) {\n if (!/config|env|\\.env|constant/i.test(file)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'moderate',\n 'Hardcoded API URL - should use environment config',\n 'Move to environment variable or config file',\n file,\n lineNumber,\n 0.80,\n undefined,\n false,\n { category: 'hardcoded-url', effort: 'easy' }\n ));\n }\n }\n }\n\n return issues;\n }\n\n private checkSchemaMismatches(content: string, file: string): Issue[] {\n const issues: Issue[] = [];\n const lines = content.split('\\n');\n\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i] || '';\n const lineNumber = i + 1;\n\n // Optional chaining on required fields (might indicate schema uncertainty)\n const optionalChainCount = (line.match(/\\?\\./g) || []).length;\n if (optionalChainCount >= 3) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'low',\n 'Heavy optional chaining may indicate schema uncertainty',\n 'Review: if data structure is well-defined, some ?. may be unnecessary',\n file,\n lineNumber,\n 0.50,\n undefined,\n false,\n { category: 'schema', effort: 'medium' }\n ));\n }\n\n // Type assertions that might hide mismatches\n if (/as\\s+\\w+(\\[\\])?[,;\\s)]/.test(line) && !/as\\s+const/.test(line)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'low',\n 'Type assertion may hide actual type mismatch',\n 'Prefer type guards or validation for runtime safety',\n file,\n lineNumber,\n 0.45,\n undefined,\n false,\n { category: 'type-assertion', effort: 'medium' }\n ));\n }\n\n // Accessing properties that might not exist\n if (/response\\.(data|body)\\.(\\w+)\\.(\\w+)\\.(\\w+)/.test(line)) {\n if (!/\\?\\./.test(line)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'moderate',\n 'Deep property access on API response without null checks',\n 'Add optional chaining or validate response structure',\n file,\n lineNumber,\n 0.75,\n undefined,\n false,\n { category: 'null-access', effort: 'easy' }\n ));\n }\n }\n }\n\n return issues;\n }\n\n private checkDataTransformations(content: string, file: string): Issue[] {\n const issues: Issue[] = [];\n const lines = content.split('\\n');\n\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i] || '';\n const lineNumber = i + 1;\n\n // JSON.parse without error handling\n if (/JSON\\.parse\\(/.test(line)) {\n const context = lines.slice(Math.max(0, i - 3), Math.min(i + 5, lines.length)).join('\\n');\n if (!/try|catch|\\.catch/.test(context)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'moderate',\n 'JSON.parse without error handling - will throw on invalid JSON',\n 'Wrap in try/catch or use a safe parse utility',\n file,\n lineNumber,\n 0.85,\n undefined,\n false,\n { category: 'parse-error', effort: 'easy' }\n ));\n }\n }\n\n // parseInt/parseFloat without radix or NaN check\n if (/parseInt\\s*\\([^,)]+\\)/.test(line)) {\n if (!/,\\s*10/.test(line)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'low',\n 'parseInt without radix parameter',\n 'Add radix: parseInt(value, 10) to avoid octal issues',\n file,\n lineNumber,\n 0.70,\n undefined,\n true,\n { category: 'parse', effort: 'trivial' }\n ));\n }\n }\n\n // String to number without validation\n if (/Number\\(|parseFloat\\(|\\+\\s*\\w+/.test(line)) {\n const context = lines.slice(i, Math.min(i + 3, lines.length)).join('\\n');\n if (!/isNaN|Number\\.isFinite|isFinite|\\|\\|\\s*0/.test(context)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'low',\n 'Number conversion without NaN check',\n 'Check for NaN: isNaN(result) or provide fallback: value || 0',\n file,\n lineNumber,\n 0.55,\n undefined,\n false,\n { category: 'nan', effort: 'easy' }\n ));\n }\n }\n }\n\n return issues;\n }\n\n private checkTypeCoercion(content: string, file: string): Issue[] {\n const issues: Issue[] = [];\n const lines = content.split('\\n');\n\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i] || '';\n const lineNumber = i + 1;\n\n // Loose equality with type coercion risks\n if (/[^!=]==[^=]/.test(line) && !/===/.test(line)) {\n // Check if comparing potentially different types\n if (/null|undefined|\"\"|\\d+|true|false/.test(line)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'moderate',\n 'Loose equality (==) may cause unexpected type coercion',\n 'Use strict equality (===) for predictable comparisons',\n file,\n lineNumber,\n 0.80,\n undefined,\n true,\n { category: 'equality', effort: 'trivial' }\n ));\n }\n }\n\n // Boolean coercion that might be unintentional\n if (/if\\s*\\(\\s*\\w+\\s*\\)/.test(line)) {\n // Check if it's a number or string that might be 0 or \"\"\n const varName = line.match(/if\\s*\\(\\s*(\\w+)\\s*\\)/)?.[1];\n if (varName && /count|total|length|index|num|amount|price/i.test(varName)) {\n issues.push(this.createIssue(\n this.generateIssueId(),\n 'low',\n 'Truthy check on number variable - 0 is falsy but might be valid',\n 'Consider explicit: if (count !== undefined) or if (count > 0)',\n file,\n lineNumber,\n 0.60,\n undefined,\n false,\n { category: 'falsy', effort: 'easy' }\n ));\n }\n }\n }\n\n return issues;\n }\n}\n","/**\n * Custom Agent - Runtime class for document-generated agents\n */\n\nimport { BaseAgent } from './base-agent.js';\nimport type { Issue, ScanContext, CodeContext, AgentPriority } from '../types/index.js';\nimport type { GeneratedAgentConfig, DetectionRule } from '../types/custom-agent.js';\n\nexport class CustomAgent extends BaseAgent {\n override name: string;\n override description: string;\n override version: string;\n \n private config: GeneratedAgentConfig;\n \n constructor(config: GeneratedAgentConfig) {\n super();\n this.config = config;\n this.name = config.name;\n this.description = config.description;\n this.version = config.version;\n }\n \n override get priority(): AgentPriority {\n return {\n name: this.name,\n tier: this.config.activationRules.priority,\n estimatedTimeMs: 200,\n dependencies: [],\n };\n }\n \n /**\n * Check if agent should activate based on code context\n */\n override shouldActivate(context: CodeContext): boolean {\n const rules = this.config.activationRules;\n \n // Check context signals\n for (const signal of rules.contextSignals) {\n if (this.checkContextSignal(context, signal)) {\n return true;\n }\n }\n \n // Check file patterns (would need file info from context)\n // For now, return true if no specific signals required\n return rules.contextSignals.length === 0;\n }\n \n /**\n * Get activation confidence based on content patterns\n */\n override getActivationConfidence(context: CodeContext): number {\n if (!this.shouldActivate(context)) return 0;\n \n const rules = this.config.activationRules;\n let confidence = rules.minConfidence;\n \n // Boost confidence for matching context signals\n for (const signal of rules.contextSignals) {\n if (this.checkContextSignal(context, signal)) {\n confidence += 0.15;\n }\n }\n \n return Math.min(1.0, confidence);\n }\n \n /**\n * Check a context signal\n */\n private checkContextSignal(context: CodeContext, signal: string): boolean {\n // Handle direct boolean properties\n const booleanSignals: Record<string, keyof CodeContext> = {\n 'touchesAuth': 'touchesAuth',\n 'touchesPayments': 'touchesPayments',\n 'touchesDatabase': 'touchesDatabase',\n 'touchesAPI': 'touchesAPI',\n 'touchesUI': 'touchesUI',\n 'touchesUserData': 'touchesUserData',\n 'touchesHealthData': 'touchesHealthData',\n 'touchesSecurityConfig': 'touchesSecurityConfig',\n 'touchesCrypto': 'touchesCrypto',\n 'touchesFileSystem': 'touchesFileSystem',\n 'touchesThirdPartyAPI': 'touchesThirdPartyAPI',\n 'touchesLogging': 'touchesLogging',\n 'touchesErrorHandling': 'touchesErrorHandling',\n 'isNewFeature': 'isNewFeature',\n 'hasTests': 'hasTests',\n };\n \n const signalKey = booleanSignals[signal];\n if (signalKey) {\n return Boolean(context[signalKey]);\n }\n \n // Handle framework:xxx pattern\n if (signal.startsWith('framework:')) {\n const framework = signal.split(':')[1];\n return context.framework === framework;\n }\n \n // Handle changeType:xxx pattern\n if (signal.startsWith('changeType:')) {\n const changeType = signal.split(':')[1];\n return context.changeType === changeType;\n }\n \n return false;\n }\n \n /**\n * Analyze files using detection rules from the config\n */\n protected override async analyzeFiles(files: string[], _context: ScanContext): Promise<Issue[]> {\n const issues: Issue[] = [];\n \n for (const file of files) {\n try {\n const content = await this.readFile(file);\n const fileIssues = await this.analyzeFileContent(content, file);\n issues.push(...fileIssues);\n } catch (error) {\n console.error(`${this.name}: Error reading file ${file}:`, error);\n }\n }\n \n return issues;\n }\n \n /**\n * Analyze file content against detection rules\n */\n private async analyzeFileContent(content: string, filePath: string): Promise<Issue[]> {\n const issues: Issue[] = [];\n const lines = content.split('\\n');\n \n for (const rule of this.config.patterns) {\n const ruleIssues = this.checkRule(rule, content, lines, filePath);\n issues.push(...ruleIssues);\n }\n \n return issues;\n }\n \n /**\n * Check a single detection rule against content\n */\n private checkRule(\n rule: DetectionRule,\n content: string,\n lines: string[],\n filePath: string\n ): Issue[] {\n const issues: Issue[] = [];\n \n // Map 'info' severity to 'low' for Issue compatibility\n const mapSeverity = (s: DetectionRule['severity']): Issue['severity'] => \n s === 'info' ? 'low' : s;\n \n // Check regex patterns\n if (rule.patterns.regex && rule.patterns.regex.length > 0) {\n for (const pattern of rule.patterns.regex) {\n try {\n const regex = new RegExp(pattern, 'gi');\n let match: RegExpExecArray | null;\n \n while ((match = regex.exec(content)) !== null) {\n // Find line number\n const lineNumber = this.getLineNumber(content, match.index);\n \n // Avoid duplicate issues on same line\n if (!issues.some(i => i.line === lineNumber && i.id.includes(rule.id))) {\n issues.push(this.createIssue(\n `${this.generateIssueId()}-${rule.id}`,\n mapSeverity(rule.severity),\n rule.description,\n rule.fix.description,\n filePath,\n lineNumber,\n 0.85,\n rule.regulation,\n rule.fix.autoFixable,\n rule.category ? { category: rule.category } : undefined\n ));\n }\n }\n } catch (e) {\n // Invalid regex, skip\n console.error(`Invalid regex pattern in rule ${rule.id}: ${pattern}`);\n }\n }\n }\n \n // Check keyword patterns\n if (rule.patterns.keywords && rule.patterns.keywords.length > 0) {\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i]?.toLowerCase() ?? '';\n const matchedKeywords = rule.patterns.keywords.filter(kw => \n line.includes(kw?.toLowerCase() ?? '')\n );\n \n if (matchedKeywords.length >= 2) {\n // Multiple keyword matches suggest relevance\n const lineNumber = i + 1;\n \n if (!issues.some(issue => issue.line === lineNumber && issue.id.includes(rule.id))) {\n issues.push(this.createIssue(\n `${this.generateIssueId()}-${rule.id}`,\n mapSeverity(rule.severity),\n rule.description,\n rule.fix.description,\n filePath,\n lineNumber,\n 0.70,\n rule.regulation,\n rule.fix.autoFixable,\n rule.category ? { category: rule.category } : undefined\n ));\n }\n }\n }\n }\n \n return issues;\n }\n \n /**\n * Get line number from character index\n */\n private getLineNumber(content: string, index: number): number {\n return content.slice(0, index).split('\\n').length;\n }\n \n /**\n * Get the system prompt for AI-powered analysis\n */\n getSystemPrompt(): string {\n return this.config.systemPrompt;\n }\n \n /**\n * Get the analysis prompt template\n */\n getAnalysisPrompt(): string {\n return this.config.analysisPrompt;\n }\n \n /**\n * Get the fix prompt template\n */\n getFixPrompt(): string {\n return this.config.fixPrompt;\n }\n \n /**\n * Get agent metadata\n */\n getMetadata(): {\n category: string;\n source: GeneratedAgentConfig['source'];\n patternCount: number;\n conceptCount: number;\n } {\n return {\n category: this.config.category,\n source: this.config.source,\n patternCount: this.config.patterns.length,\n conceptCount: this.config.knowledge.coreConcepts.length,\n };\n }\n}\n\n","import type { Agent } from '../types/index.js';\nimport { SecurityAgent } from './security.js';\nimport { PrivacyAgent } from './privacy.js';\nimport { TypeCheckAgent } from './typecheck.js';\nimport { ComprehensionAgent } from './comprehension.js';\nimport { AccessibilityAgent } from './accessibility.js';\nimport { DesignEngineerAgent } from './design-engineer.js';\nimport { LegalAgent } from './legal.js';\nimport { TestAgent } from './test.js';\nimport { SoftwareArchitectAgent } from './software-architect.js';\nimport { DevOpsAgent } from './devops.js';\nimport { BugFindingAgent } from './bug-finding.js';\nimport { UserTestingAgent } from './user-testing.js';\nimport { TrieCleanAgent } from './trie-clean.js';\nimport { SOC2Agent } from './soc2.js';\nimport { SuperReviewerAgent } from './super-reviewer.js';\nimport { AgentSmithAgent } from './agent-smith.js';\nimport { PerformanceAgent } from './performance.js';\nimport { E2EAgent } from './e2e.js';\nimport { VisualQAAgent } from './visual-qa.js';\nimport { DataFlowAgent } from './data-flow.js';\nimport { CustomAgent } from './custom-agent.js';\nimport { readdir, readFile } from 'fs/promises';\nimport { join } from 'path';\nimport type { GeneratedAgentConfig } from '../types/custom-agent.js';\nimport { getWorkingDirectory } from '../utils/workspace.js';\n\nclass AgentRegistryImpl {\n private agents: Map<string, Agent> = new Map();\n private customAgentsLoaded: boolean = false;\n private initialized: boolean = false;\n\n constructor() {\n this.registerBuiltinAgents();\n }\n\n private registerBuiltinAgents() {\n if (this.initialized) return;\n this.initialized = true;\n\n const builtinAgents: Agent[] = [\n // Core agents (always available)\n new SecurityAgent(),\n new PrivacyAgent(),\n new TypeCheckAgent(),\n new ComprehensionAgent(),\n \n // Specialized agents\n new AccessibilityAgent(),\n new DesignEngineerAgent(),\n new LegalAgent(),\n new TestAgent(),\n new SoftwareArchitectAgent(),\n new DevOpsAgent(),\n new BugFindingAgent(),\n new UserTestingAgent(),\n new TrieCleanAgent(),\n new SOC2Agent(),\n new SuperReviewerAgent(),\n new AgentSmithAgent(),\n \n // New agents (inspired by Turkey Build)\n new PerformanceAgent(),\n new E2EAgent(),\n new VisualQAAgent(),\n new DataFlowAgent(),\n ];\n\n console.error(`Loaded config for ${builtinAgents.length} built-in agents`);\n\n for (const agent of builtinAgents) {\n this.agents.set(agent.name, agent);\n }\n }\n\n /**\n * Load custom agents from .trie/agents/ directory\n */\n async loadCustomAgents(): Promise<void> {\n if (this.customAgentsLoaded) return;\n \n try {\n const agentsDir = join(getWorkingDirectory(undefined, true), '.trie', 'agents');\n const files = await readdir(agentsDir);\n const jsonFiles = files.filter(f => f.endsWith('.json'));\n \n let loadedCount = 0;\n \n for (const file of jsonFiles) {\n try {\n const configPath = join(agentsDir, file);\n const content = await readFile(configPath, 'utf-8');\n const config: GeneratedAgentConfig = JSON.parse(content);\n \n // Create and register the custom agent\n const agent = new CustomAgent(config);\n this.agents.set(agent.name, agent);\n loadedCount++;\n \n } catch (error) {\n console.error(`Failed to load custom agent from ${file}:`, error);\n }\n }\n \n if (loadedCount > 0) {\n console.error(`Loaded ${loadedCount} custom agent(s) from .trie/agents/`);\n }\n \n this.customAgentsLoaded = true;\n } catch (error) {\n // Directory doesn't exist or other error - that's okay\n this.customAgentsLoaded = true;\n }\n }\n\n /**\n * Reload custom agents (useful after creating new ones)\n */\n async reloadCustomAgents(): Promise<void> {\n // Remove existing custom agents\n for (const [name, agent] of this.agents.entries()) {\n if (agent instanceof CustomAgent) {\n this.agents.delete(name);\n }\n }\n \n this.customAgentsLoaded = false;\n await this.loadCustomAgents();\n }\n\n getAgent(name: string): Agent | undefined {\n return this.agents.get(name);\n }\n\n getAgentsByNames(names: string[]): Agent[] {\n return names\n .map(name => this.getAgent(name))\n .filter((agent): agent is Agent => agent !== undefined);\n }\n\n getAllAgents(): Agent[] {\n return Array.from(this.agents.values());\n }\n\n /**\n * Get only built-in agents\n */\n getBuiltinAgents(): Agent[] {\n return Array.from(this.agents.values()).filter(\n agent => !(agent instanceof CustomAgent)\n );\n }\n\n /**\n * Get only custom agents\n */\n getCustomAgents(): CustomAgent[] {\n return Array.from(this.agents.values()).filter(\n (agent): agent is CustomAgent => agent instanceof CustomAgent\n );\n }\n\n registerAgent(agent: Agent): void {\n this.agents.set(agent.name, agent);\n console.error(`Registered custom agent: ${agent.name}`);\n }\n\n /**\n * Unregister an agent by name\n */\n unregisterAgent(name: string): boolean {\n return this.agents.delete(name);\n }\n\n getAgentNames(): string[] {\n return Array.from(this.agents.keys());\n }\n\n getAgentDescriptions(): { name: string; description: string; isCustom: boolean }[] {\n return Array.from(this.agents.values()).map(agent => ({\n name: agent.name,\n description: agent.description,\n isCustom: agent instanceof CustomAgent,\n }));\n }\n\n /**\n * Check if an agent is a custom agent\n */\n isCustomAgent(name: string): boolean {\n const agent = this.agents.get(name);\n return agent instanceof CustomAgent;\n }\n\n /**\n * Get custom agent metadata\n */\n getCustomAgentMetadata(name: string): ReturnType<CustomAgent['getMetadata']> | null {\n const agent = this.agents.get(name);\n if (agent instanceof CustomAgent) {\n return agent.getMetadata();\n }\n return null;\n }\n}\n\n// Singleton instance using globalThis to work across bundled chunks\nconst SINGLETON_KEY = '__TRIE_AGENT_REGISTRY__';\n\n/**\n * Get the singleton AgentRegistry instance\n */\nexport function getAgentRegistry(): AgentRegistryImpl {\n const global = globalThis as unknown as Record<string, AgentRegistryImpl | undefined>;\n if (!global[SINGLETON_KEY]) {\n global[SINGLETON_KEY] = new AgentRegistryImpl();\n }\n return global[SINGLETON_KEY]!;\n}\n\n/**\n * AgentRegistry class - use getAgentRegistry() for singleton access\n * @deprecated Use getAgentRegistry() instead to ensure singleton behavior\n */\nexport class AgentRegistry extends AgentRegistryImpl {\n constructor() {\n // If we already have an instance, we can't return it from constructor\n // but we can at least skip re-initializing\n super();\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAMA,IAAM,oBAAoB;AAAA,EACxB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAKA,IAAM,qBAAqB;AAAA,EACzB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAKA,IAAM,sBAAsB;AAAA;AAAA,EAE1B,MAAM;AAAA,IACJ,EAAE,SAAS,uCAAuC,QAAQ,sBAAsB;AAAA,IAChF,EAAE,SAAS,kDAAkD,QAAQ,sBAAsB;AAAA,IAC3F,EAAE,SAAS,qDAAqD,QAAQ,sBAAsB;AAAA,IAC9F,EAAE,SAAS,mCAAmC,QAAQ,oBAAoB;AAAA,IAC1E,EAAE,SAAS,6BAA6B,QAAQ,yBAAyB;AAAA,IACzE,EAAE,SAAS,gCAAgC,QAAQ,2BAA2B;AAAA,IAC9E,EAAE,SAAS,yCAAyC,QAAQ,qBAAqB;AAAA,EACnF;AAAA;AAAA,EAEA,QAAQ;AAAA,IACN,EAAE,SAAS,qCAAqC,QAAQ,sBAAsB;AAAA,IAC9E,EAAE,SAAS,wCAAwC,QAAQ,mBAAmB;AAAA,IAC9E,EAAE,SAAS,4BAA4B,QAAQ,iBAAiB;AAAA,IAChE,EAAE,SAAS,iCAAiC,QAAQ,gBAAgB;AAAA,IACpE,EAAE,SAAS,uCAAuC,QAAQ,iBAAiB;AAAA,IAC3E,EAAE,SAAS,uBAAuB,QAAQ,uBAAuB;AAAA,IACjE,EAAE,SAAS,4BAA4B,QAAQ,YAAY;AAAA,EAC7D;AAAA;AAAA,EAEA,KAAK;AAAA,IACH,EAAE,SAAS,gCAAg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