@makeitvisible/cli 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/analyzers/git/index.ts","../src/analyzers/context/index.ts","../src/generators/index.ts","../src/agent/tools/definitions.ts","../src/agent/tools/implementations.ts","../src/agent/detective.ts"],"names":["range","result","listDir","execSync"],"mappings":";;;;;;;;;;;;AAwCA,SAAS,IAAI,OAAA,EAAyB;AACpC,EAAA,IAAI;AACF,IAAA,OAAO,QAAA,CAAS,CAAA,IAAA,EAAO,OAAO,CAAA,CAAA,EAAI;AAAA,MAChC,QAAA,EAAU,OAAA;AAAA,MACV,SAAA,EAAW,KAAK,IAAA,GAAO;AAAA;AAAA,KACxB,EAAE,IAAA,EAAK;AAAA,EACV,SAAS,KAAA,EAAO;AACd,IAAA,MAAM,IAAI,KAAA,CAAM,CAAA,wBAAA,EAA2B,OAAO,CAAA,CAAE,CAAA;AAAA,EACtD;AACF;AAKA,SAAS,eAAe,QAAA,EAA2B;AACjD,EAAA,IAAI;AACF,IAAA,GAAA,CAAI,CAAA,mBAAA,EAAsB,QAAQ,CAAA,CAAE,CAAA;AACpC,IAAA,OAAO,IAAA;AAAA,EACT,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,KAAA;AAAA,EACT;AACF;AAKA,SAAS,eAAA,GAA0B;AAEjC,EAAA,IAAI,cAAA,CAAe,QAAQ,CAAA,EAAG;AAC5B,IAAA,OAAO,cAAA;AAAA,EACT;AAGA,EAAA,IAAI,cAAA,CAAe,MAAM,CAAA,EAAG;AAE1B,IAAA,MAAM,SAAA,GAAY,0CAAA;AAClB,IAAA,OAAO,GAAG,SAAS,CAAA,MAAA,CAAA;AAAA,EACrB;AAEA,EAAA,MAAM,IAAI,MAAM,gCAAgC,CAAA;AAClD;AAKA,SAAS,gBAAgB,KAAA,EAA2B;AAClD,EAAA,MAAM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C,EAAA,IAAI;AACF,IAAA,MAAM,EAAE,QAAA,EAAAC,SAAAA,EAAS,GAAI,UAAQ,eAAe,CAAA;AAC5C,IAAA,OAAOA,UAAS,+BAAA,EAAiC,EAAE,UAAU,OAAA,EAAS,EAAE,IAAA,EAAK;AAAA,EAC/E,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,QAAQ,GAAA,EAAI;AAAA,EACrB;AACF","file":"index.js","sourcesContent":["/**\n * Git Analyzer\n *\n * Analyzes Git repositories, commits, branches, and pull requests.\n *\n * Features:\n * - Parse commit history\n * - Analyze PR changes\n * - Extract diff information\n * - Identify changed files and their context\n */\n\nimport { execSync } from \"child_process\";\nimport type { ArtifactSource, ArtifactContext } from \"../../shared/types.js\";\n\nexport interface AnalysisResult {\n title: string;\n description: string;\n source: ArtifactSource;\n context: ArtifactContext;\n guidelines: string[];\n}\n\ninterface DiffFile {\n path: string;\n additions: number;\n deletions: number;\n status: \"added\" | \"modified\" | \"deleted\" | \"renamed\";\n}\n\ninterface CommitInfo {\n hash: string;\n author: string;\n date: string;\n message: string;\n}\n\n/**\n * Execute a git command and return the output\n */\nfunction git(command: string): string {\n try {\n return execSync(`git ${command}`, {\n encoding: \"utf-8\",\n maxBuffer: 10 * 1024 * 1024, // 10MB buffer for large diffs\n }).trim();\n } catch (error) {\n throw new Error(`Git command failed: git ${command}`);\n }\n}\n\n/**\n * Check if a git revision exists\n */\nfunction revisionExists(revision: string): boolean {\n try {\n git(`rev-parse --verify ${revision}`);\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Get the default diff range based on available commits\n */\nfunction getDefaultRange(): string {\n // Check if HEAD~1 exists (more than one commit)\n if (revisionExists(\"HEAD~1\")) {\n return \"HEAD~1..HEAD\";\n }\n\n // Check if HEAD exists (at least one commit)\n if (revisionExists(\"HEAD\")) {\n // Compare against empty tree (shows all files in first commit)\n const emptyTree = \"4b825dc642cb6eb9a060e54bf8d69288fbee4904\";\n return `${emptyTree}..HEAD`;\n }\n\n throw new Error(\"No commits found in repository\");\n}\n\n/**\n * Get the list of changed files in a diff range\n */\nfunction getChangedFiles(range: string): DiffFile[] {\n const output = git(`diff --numstat ${range}`);\n if (!output) return [];\n\n return output.split(\"\\n\").map((line) => {\n const [additions, deletions, path] = line.split(\"\\t\");\n return {\n path,\n additions: parseInt(additions, 10) || 0,\n deletions: parseInt(deletions, 10) || 0,\n status: \"modified\" as const,\n };\n });\n}\n\n/**\n * Get commit information for a range\n */\nfunction getCommits(range: string): CommitInfo[] {\n const output = git(`log --format=\"%H|%an|%ai|%s\" ${range}`);\n if (!output) return [];\n\n return output.split(\"\\n\").map((line) => {\n const [hash, author, date, message] = line.split(\"|\");\n return { hash, author, date, message };\n });\n}\n\n/**\n * Get the actual diff content\n */\nfunction getDiffContent(range: string): string {\n return git(`diff ${range}`);\n}\n\n/**\n * Detect if there are breaking changes based on diff content and commit messages\n */\nfunction detectBreakingChanges(commits: CommitInfo[], diffContent: string): boolean {\n // Check commit messages for breaking change indicators\n const breakingPatterns = [\n /BREAKING CHANGE/i,\n /\\bbreaking\\b/i,\n /\\!:/,\n /removed/i,\n /deprecated/i,\n ];\n\n for (const commit of commits) {\n if (breakingPatterns.some((pattern) => pattern.test(commit.message))) {\n return true;\n }\n }\n\n // Check diff for removal of exports or major structural changes\n const lines = diffContent.split(\"\\n\");\n const removedExports = lines.filter(\n (line) => line.startsWith(\"-\") && /export\\s+(default\\s+)?(function|class|const|interface|type)/.test(line)\n );\n\n return removedExports.length > 0;\n}\n\n/**\n * Extract keywords from file paths and diff content\n */\nfunction extractKeywords(files: DiffFile[], diffContent: string): string[] {\n const keywords = new Set<string>();\n\n // Extract from file paths\n for (const file of files) {\n const parts = file.path.split(\"/\");\n for (const part of parts) {\n // Skip common non-meaningful names\n if (![\"src\", \"lib\", \"dist\", \"index\", \"node_modules\"].includes(part)) {\n // Extract meaningful words\n const words = part\n .replace(/\\.(ts|tsx|js|jsx|json|md|css|scss)$/, \"\")\n .split(/[-_.]/)\n .filter((w) => w.length > 2);\n words.forEach((w) => keywords.add(w.toLowerCase()));\n }\n }\n }\n\n // Extract from diff content (function names, class names, etc.)\n const codePatterns = [\n /(?:function|class|interface|type|const|let|var)\\s+([A-Za-z_][A-Za-z0-9_]*)/g,\n /export\\s+(?:default\\s+)?(?:function|class|const)\\s+([A-Za-z_][A-Za-z0-9_]*)/g,\n ];\n\n for (const pattern of codePatterns) {\n let match;\n while ((match = pattern.exec(diffContent)) !== null) {\n if (match[1] && match[1].length > 2) {\n keywords.add(match[1].toLowerCase());\n }\n }\n }\n\n return Array.from(keywords).slice(0, 20);\n}\n\n/**\n * Generate a summary title from commits and file changes\n */\nfunction generateTitle(commits: CommitInfo[], files: DiffFile[]): string {\n if (commits.length === 1) {\n return commits[0].message;\n }\n\n if (commits.length > 1) {\n // Find common theme in commit messages or use generic title\n const messages = commits.map((c) => c.message);\n const firstWords = messages.map((m) => m.split(\" \").slice(0, 3).join(\" \"));\n return `Changes across ${commits.length} commits: ${firstWords[0]}...`;\n }\n\n // Fallback to file-based title\n const extensions = [...new Set(files.map((f) => f.path.split(\".\").pop()))];\n return `Code changes in ${files.length} files (${extensions.join(\", \")})`;\n}\n\n/**\n * Generate a description from the analysis\n */\nfunction generateDescription(\n commits: CommitInfo[],\n files: DiffFile[],\n breakingChanges: boolean\n): string {\n const parts: string[] = [];\n\n if (commits.length > 0) {\n parts.push(`This change includes ${commits.length} commit(s).`);\n }\n\n const totalAdditions = files.reduce((sum, f) => sum + f.additions, 0);\n const totalDeletions = files.reduce((sum, f) => sum + f.deletions, 0);\n parts.push(`Modified ${files.length} file(s) with +${totalAdditions}/-${totalDeletions} lines.`);\n\n if (breakingChanges) {\n parts.push(\"⚠️ This change may contain breaking changes.\");\n }\n\n return parts.join(\" \");\n}\n\n/**\n * Generate guidelines for artifact messaging\n */\nfunction generateGuidelines(\n commits: CommitInfo[],\n files: DiffFile[],\n breakingChanges: boolean\n): string[] {\n const guidelines: string[] = [];\n\n // Feature vs fix detection\n const hasFeature = commits.some((c) => /feat|feature|add|new/i.test(c.message));\n const hasFix = commits.some((c) => /fix|bug|patch|issue/i.test(c.message));\n const hasRefactor = commits.some((c) => /refactor|clean|improve/i.test(c.message));\n\n if (hasFeature) {\n guidelines.push(\"Highlight the new capability and its user-facing benefits.\");\n }\n if (hasFix) {\n guidelines.push(\"Explain what was broken and how it's now fixed.\");\n }\n if (hasRefactor) {\n guidelines.push(\"Note the improvements without exposing internal complexity.\");\n }\n\n if (breakingChanges) {\n guidelines.push(\"Clearly communicate the breaking change and migration steps.\");\n guidelines.push(\"Provide a timeline for deprecation if applicable.\");\n }\n\n // File type specific guidelines\n const hasAPI = files.some((f) => /api|route|endpoint/i.test(f.path));\n const hasUI = files.some((f) => /component|page|view|ui/i.test(f.path));\n const hasConfig = files.some((f) => /config|env|setting/i.test(f.path));\n\n if (hasAPI) {\n guidelines.push(\"Document any API changes with request/response examples.\");\n }\n if (hasUI) {\n guidelines.push(\"Consider including screenshots or visual demos.\");\n }\n if (hasConfig) {\n guidelines.push(\"List any new configuration options or environment variables.\");\n }\n\n return guidelines.length > 0\n ? guidelines\n : [\"Focus on the value delivered to users.\", \"Keep technical details accessible.\"];\n}\n\n/**\n * Analyze a git diff range and produce an artifact\n */\nexport async function analyzeDiff(range: string): Promise<AnalysisResult> {\n // Validate we're in a git repository\n try {\n git(\"rev-parse --git-dir\");\n } catch {\n throw new Error(\"Not in a git repository\");\n }\n\n // Handle default range or validate provided range\n let effectiveRange = range;\n if (range === \"HEAD~1..HEAD\") {\n // This is the default, check if it exists\n try {\n effectiveRange = getDefaultRange();\n } catch (error) {\n throw new Error(\n `Could not determine diff range: ${error instanceof Error ? error.message : error}`\n );\n }\n } else {\n // Validate the provided range\n const [start] = range.split(\"..\");\n if (!revisionExists(start)) {\n throw new Error(`Invalid revision: ${start}`);\n }\n }\n\n const files = getChangedFiles(effectiveRange);\n if (files.length === 0) {\n throw new Error(`No changes found in range: ${effectiveRange}`);\n }\n\n const commits = getCommits(effectiveRange);\n const diffContent = getDiffContent(effectiveRange);\n const breakingChanges = detectBreakingChanges(commits, diffContent);\n const keywords = extractKeywords(files, diffContent);\n\n const title = generateTitle(commits, files);\n const description = generateDescription(commits, files, breakingChanges);\n const guidelines = generateGuidelines(commits, files, breakingChanges);\n\n // Get repository info for source reference\n let repoUrl = \"\";\n try {\n repoUrl = git(\"config --get remote.origin.url\").replace(/\\.git$/, \"\");\n } catch {\n // No remote configured\n }\n\n const source: ArtifactSource = {\n type: \"commit\",\n reference: effectiveRange,\n url: repoUrl ? `${repoUrl}/compare/${effectiveRange.replace(\"..\", \"...\")}` : undefined,\n };\n\n const context: ArtifactContext = {\n summary: description,\n technicalDetails: commits.map((c) => `${c.hash.slice(0, 7)}: ${c.message}`),\n affectedComponents: files.map((f) => f.path),\n breakingChanges,\n keywords,\n };\n\n return {\n title,\n description,\n source,\n context,\n guidelines,\n };\n}\n\nexport interface PROptions {\n url?: string;\n number?: number;\n}\n\n/**\n * Analyze a pull request and produce an artifact\n */\nexport async function analyzePR(options: PROptions): Promise<AnalysisResult> {\n // Validate we're in a git repository\n try {\n git(\"rev-parse --git-dir\");\n } catch {\n throw new Error(\"Not in a git repository\");\n }\n\n let prTitle = \"\";\n let prBody = \"\";\n let prNumber = options.number;\n let prUrl = options.url;\n\n // If URL provided, parse it\n if (prUrl) {\n const match = prUrl.match(/github\\.com\\/([^/]+)\\/([^/]+)\\/pull\\/(\\d+)/);\n if (match) {\n prNumber = parseInt(match[3], 10);\n }\n }\n\n // Try to get PR info from GitHub CLI if available\n if (prNumber) {\n try {\n const prInfo = git(`gh pr view ${prNumber} --json title,body,headRefName,baseRefName`);\n const parsed = JSON.parse(prInfo);\n prTitle = parsed.title || \"\";\n prBody = parsed.body || \"\";\n\n // Get diff between base and head\n const baseRef = parsed.baseRefName || \"main\";\n const headRef = parsed.headRefName || \"HEAD\";\n\n // Fetch the base branch to ensure we have it\n try {\n git(`fetch origin ${baseRef}`);\n } catch {\n // Branch might already exist locally\n }\n\n const range = `origin/${baseRef}...${headRef}`;\n const result = await analyzeDiff(range);\n\n // Override with PR-specific info\n result.title = prTitle || result.title;\n result.description = prBody\n ? `${prBody.slice(0, 200)}${prBody.length > 200 ? \"...\" : \"\"}`\n : result.description;\n result.source = {\n type: \"pr\",\n reference: `#${prNumber}`,\n url: prUrl || `${git(\"config --get remote.origin.url\").replace(/\\.git$/, \"\")}/pull/${prNumber}`,\n };\n\n return result;\n } catch {\n // GitHub CLI not available or PR not found, fall back to current branch diff\n }\n }\n\n // Fallback: analyze current branch against main/master\n const currentBranch = git(\"rev-parse --abbrev-ref HEAD\");\n let baseBranch = \"main\";\n\n try {\n git(\"rev-parse --verify main\");\n } catch {\n try {\n git(\"rev-parse --verify master\");\n baseBranch = \"master\";\n } catch {\n throw new Error(\"Could not find base branch (main or master)\");\n }\n }\n\n const range = `${baseBranch}...${currentBranch}`;\n const result = await analyzeDiff(range);\n\n result.source = {\n type: \"pr\",\n reference: prNumber ? `#${prNumber}` : currentBranch,\n url: prUrl,\n };\n\n return result;\n}\n","/**\n * Context Extractor\n *\n * Extracts meaningful context from code and technical artifacts.\n *\n * Features:\n * - Build context from multiple sources\n * - Identify key concepts and terminology\n * - Extract technical requirements\n * - Generate structured context for artifact generation\n */\n\nimport type { ArtifactContext } from \"../../shared/types.js\";\n\nexport interface ContextInput {\n files: string[];\n diff?: string;\n commits?: string[];\n prompt?: string;\n}\n\n/**\n * Merge multiple context objects into one\n */\nexport function mergeContexts(...contexts: Partial<ArtifactContext>[]): ArtifactContext {\n const merged: ArtifactContext = {\n summary: \"\",\n technicalDetails: [],\n affectedComponents: [],\n breakingChanges: false,\n keywords: [],\n };\n\n for (const ctx of contexts) {\n if (ctx.summary) {\n merged.summary = merged.summary\n ? `${merged.summary} ${ctx.summary}`\n : ctx.summary;\n }\n if (ctx.technicalDetails) {\n merged.technicalDetails.push(...ctx.technicalDetails);\n }\n if (ctx.affectedComponents) {\n merged.affectedComponents.push(...ctx.affectedComponents);\n }\n if (ctx.breakingChanges) {\n merged.breakingChanges = true;\n }\n if (ctx.keywords) {\n merged.keywords.push(...ctx.keywords);\n }\n }\n\n // Deduplicate arrays\n merged.technicalDetails = [...new Set(merged.technicalDetails)];\n merged.affectedComponents = [...new Set(merged.affectedComponents)];\n merged.keywords = [...new Set(merged.keywords)];\n\n return merged;\n}\n\n/**\n * Extract context from file paths\n */\nexport function extractContextFromPaths(paths: string[]): Partial<ArtifactContext> {\n const keywords = new Set<string>();\n const components = new Set<string>();\n\n for (const path of paths) {\n // Add the path as an affected component\n components.add(path);\n\n // Extract keywords from path segments\n const segments = path.split(\"/\").filter((s) => s && ![\"src\", \"lib\", \"dist\", \"index\"].includes(s));\n for (const segment of segments) {\n const words = segment\n .replace(/\\.(ts|tsx|js|jsx|vue|svelte|py|go|rs|java|rb)$/, \"\")\n .split(/[-_.]/)\n .filter((w) => w.length > 2);\n words.forEach((w) => keywords.add(w.toLowerCase()));\n }\n }\n\n return {\n affectedComponents: Array.from(components),\n keywords: Array.from(keywords),\n };\n}\n\n/**\n * Detect breaking changes from diff content\n */\nexport function detectBreakingChangesFromDiff(diff: string): boolean {\n const breakingPatterns = [\n /^-export\\s+/m, // Removed exports\n /^-\\s*public\\s+/m, // Removed public methods\n /BREAKING CHANGE/i,\n /\\bremoved\\b.*\\bapi\\b/i,\n /\\bdeprecated\\b/i,\n ];\n\n return breakingPatterns.some((pattern) => pattern.test(diff));\n}\n\n/**\n * Generate a technical summary from context\n */\nexport function generateTechnicalSummary(context: ArtifactContext): string {\n const parts: string[] = [];\n\n if (context.affectedComponents.length > 0) {\n parts.push(`Affects ${context.affectedComponents.length} component(s)`);\n }\n\n if (context.breakingChanges) {\n parts.push(\"includes breaking changes\");\n }\n\n if (context.keywords.length > 0) {\n parts.push(`related to: ${context.keywords.slice(0, 5).join(\", \")}`);\n }\n\n return parts.join(\"; \");\n}\n","/**\n * Artifact Generators\n *\n * Generates artifacts from analyzed code context.\n * Artifacts are high-level descriptions and guidelines that serve\n * as input for the final material generation.\n */\n\n// TODO: Implement artifact generators\nexport const artifactGenerator = {};\n","/**\n * Tool Definitions for the Detective Agent\n *\n * These are the OpenAI function calling definitions that describe\n * what tools the agent can use to explore a codebase.\n */\n\nimport type { ChatCompletionTool } from \"openai/resources/chat/completions\";\n\nexport const AGENT_TOOLS: ChatCompletionTool[] = [\n {\n type: \"function\",\n function: {\n name: \"search_files\",\n description:\n \"Search for files by name pattern or content. Use this to find files related to a feature, component, or concept. Returns file paths that match.\",\n parameters: {\n type: \"object\",\n properties: {\n query: {\n type: \"string\",\n description:\n \"Search query - can be a filename pattern (e.g., '*expense*', '*.schema.ts') or keywords to search in file content\",\n },\n searchIn: {\n type: \"string\",\n enum: [\"filename\", \"content\", \"both\"],\n description: \"Where to search: filename only, file content only, or both\",\n },\n fileTypes: {\n type: \"array\",\n items: { type: \"string\" },\n description:\n \"Optional file extensions to filter (e.g., ['.ts', '.tsx']). If not provided, searches all code files.\",\n },\n directory: {\n type: \"string\",\n description:\n \"Optional subdirectory to search in (relative to project root). If not provided, searches entire project.\",\n },\n },\n required: [\"query\", \"searchIn\"],\n },\n },\n },\n {\n type: \"function\",\n function: {\n name: \"read_file\",\n description:\n \"Read the contents of a specific file. Use this after finding a relevant file to understand its implementation, imports, exports, and logic.\",\n parameters: {\n type: \"object\",\n properties: {\n path: {\n type: \"string\",\n description: \"Path to the file (relative to project root)\",\n },\n startLine: {\n type: \"number\",\n description: \"Optional start line number (1-indexed) to read from\",\n },\n endLine: {\n type: \"number\",\n description: \"Optional end line number (1-indexed) to read to\",\n },\n },\n required: [\"path\"],\n },\n },\n },\n {\n type: \"function\",\n function: {\n name: \"find_references\",\n description:\n \"Find where a symbol (function, component, class, type, constant) is used/imported across the codebase. Critical for understanding how something is triggered or consumed.\",\n parameters: {\n type: \"object\",\n properties: {\n symbol: {\n type: \"string\",\n description:\n \"The symbol name to find references for (e.g., 'CreateExpenseModal', 'useAuth', 'ExpenseSchema')\",\n },\n type: {\n type: \"string\",\n enum: [\"import\", \"usage\", \"all\"],\n description:\n \"Type of references: 'import' finds import statements, 'usage' finds actual usage, 'all' finds both\",\n },\n },\n required: [\"symbol\", \"type\"],\n },\n },\n },\n {\n type: \"function\",\n function: {\n name: \"find_definition\",\n description:\n \"Find where a symbol is defined/exported. Use this to find the source definition of a type, function, or component.\",\n parameters: {\n type: \"object\",\n properties: {\n symbol: {\n type: \"string\",\n description: \"The symbol name to find the definition of\",\n },\n },\n required: [\"symbol\"],\n },\n },\n },\n {\n type: \"function\",\n function: {\n name: \"list_directory\",\n description:\n \"List files and subdirectories in a directory. Use this to explore the project structure and understand how code is organized.\",\n parameters: {\n type: \"object\",\n properties: {\n path: {\n type: \"string\",\n description:\n \"Directory path relative to project root. Use '.' or empty string for root.\",\n },\n recursive: {\n type: \"boolean\",\n description:\n \"If true, lists all files recursively (up to 3 levels deep). If false, only immediate children.\",\n },\n },\n required: [\"path\"],\n },\n },\n },\n {\n type: \"function\",\n function: {\n name: \"get_file_structure\",\n description:\n \"Analyze a file and extract its structure: imports, exports, functions, classes, types, and their relationships. Use this to quickly understand what a file provides and depends on.\",\n parameters: {\n type: \"object\",\n properties: {\n path: {\n type: \"string\",\n description: \"Path to the file to analyze\",\n },\n },\n required: [\"path\"],\n },\n },\n },\n {\n type: \"function\",\n function: {\n name: \"search_types\",\n description:\n \"Search for TypeScript/JavaScript type definitions, interfaces, schemas (Zod, Yup), or prop types. Useful for understanding data structures.\",\n parameters: {\n type: \"object\",\n properties: {\n query: {\n type: \"string\",\n description:\n \"Search query for types (e.g., 'Expense', 'CreditCard', 'FormData')\",\n },\n kind: {\n type: \"string\",\n enum: [\"interface\", \"type\", \"schema\", \"all\"],\n description:\n \"What kind of type definition to search for\",\n },\n },\n required: [\"query\", \"kind\"],\n },\n },\n },\n {\n type: \"function\",\n function: {\n name: \"complete_investigation\",\n description:\n \"Call this when you have gathered enough information to create a comprehensive artifact. Provide your findings structured for documentation generation.\",\n parameters: {\n type: \"object\",\n properties: {\n title: {\n type: \"string\",\n description: \"A clear, descriptive title for the feature/topic\",\n },\n summary: {\n type: \"string\",\n description:\n \"A 2-3 sentence summary explaining what this feature does from a user perspective\",\n },\n entryPoints: {\n type: \"array\",\n items: {\n type: \"object\",\n properties: {\n file: { type: \"string\" },\n component: { type: \"string\" },\n description: { type: \"string\" },\n },\n },\n description:\n \"The main entry points/components for this feature (e.g., the modal, page, or button that triggers it)\",\n },\n dataFlow: {\n type: \"array\",\n items: {\n type: \"object\",\n properties: {\n step: { type: \"number\" },\n description: { type: \"string\" },\n files: { type: \"array\", items: { type: \"string\" } },\n },\n },\n description:\n \"Step-by-step data flow explaining how the feature works\",\n },\n keyFiles: {\n type: \"array\",\n items: {\n type: \"object\",\n properties: {\n path: { type: \"string\" },\n purpose: { type: \"string\" },\n keyExports: { type: \"array\", items: { type: \"string\" } },\n },\n },\n description: \"The most important files for this feature\",\n },\n dataStructures: {\n type: \"array\",\n items: {\n type: \"object\",\n properties: {\n name: { type: \"string\" },\n file: { type: \"string\" },\n fields: { type: \"array\", items: { type: \"string\" } },\n description: { type: \"string\" },\n },\n },\n description:\n \"Key data structures (types, interfaces, schemas) used\",\n },\n usageExamples: {\n type: \"array\",\n items: {\n type: \"object\",\n properties: {\n description: { type: \"string\" },\n file: { type: \"string\" },\n codeSnippet: { type: \"string\" },\n },\n },\n description:\n \"Examples of how this feature is used in the codebase\",\n },\n relatedFeatures: {\n type: \"array\",\n items: { type: \"string\" },\n description:\n \"Other features or components that relate to this one\",\n },\n technicalNotes: {\n type: \"array\",\n items: { type: \"string\" },\n description:\n \"Important technical details, edge cases, or implementation notes\",\n },\n },\n required: [\n \"title\",\n \"summary\",\n \"entryPoints\",\n \"dataFlow\",\n \"keyFiles\",\n \"dataStructures\",\n ],\n },\n },\n },\n];\n\nexport type ToolName =\n | \"search_files\"\n | \"read_file\"\n | \"find_references\"\n | \"find_definition\"\n | \"list_directory\"\n | \"get_file_structure\"\n | \"search_types\"\n | \"complete_investigation\";\n","/**\n * Tool Implementations for the Detective Agent\n *\n * These are the actual implementations of the tools that the agent uses\n * to explore and understand a codebase.\n */\n\nimport { readFileSync, readdirSync, statSync, existsSync } from \"fs\";\nimport { join, relative, basename } from \"path\";\nimport { glob } from \"glob\";\nimport type { ToolName } from \"./definitions.js\";\n\nconst CODE_EXTENSIONS = [\n \".ts\",\n \".tsx\",\n \".js\",\n \".jsx\",\n \".vue\",\n \".svelte\",\n \".py\",\n \".go\",\n \".rs\",\n \".java\",\n \".rb\",\n \".json\",\n \".yaml\",\n \".yml\",\n];\n\nconst IGNORED_DIRS = [\n \"node_modules\",\n \".git\",\n \"dist\",\n \"build\",\n \".next\",\n \".nuxt\",\n \"coverage\",\n \".turbo\",\n \".cache\",\n \"__pycache__\",\n \".venv\",\n \"venv\",\n];\n\nexport interface ToolContext {\n projectRoot: string;\n}\n\nexport interface ToolResult {\n success: boolean;\n data?: unknown;\n error?: string;\n}\n\n/**\n * Search for files by name pattern or content\n */\nexport async function searchFiles(\n ctx: ToolContext,\n args: {\n query: string;\n searchIn: \"filename\" | \"content\" | \"both\";\n fileTypes?: string[];\n directory?: string;\n }\n): Promise<ToolResult> {\n const { query, searchIn, fileTypes, directory } = args;\n const searchRoot = directory ? join(ctx.projectRoot, directory) : ctx.projectRoot;\n\n if (!existsSync(searchRoot)) {\n return { success: false, error: `Directory not found: ${directory}` };\n }\n\n const results: Array<{ path: string; matches?: string[] }> = [];\n const lowerQuery = query.toLowerCase();\n\n // Build glob pattern for file types\n const extensions = fileTypes?.length ? fileTypes : CODE_EXTENSIONS;\n const patterns = extensions.map((ext) => `**/*${ext}`);\n\n try {\n for (const pattern of patterns) {\n const files = await glob(pattern, {\n cwd: searchRoot,\n ignore: IGNORED_DIRS.map((d) => `**/${d}/**`),\n nodir: true,\n absolute: false,\n });\n\n for (const file of files) {\n const fullPath = join(searchRoot, file);\n const relativePath = relative(ctx.projectRoot, fullPath);\n\n // Check filename match\n if (searchIn === \"filename\" || searchIn === \"both\") {\n const fileName = basename(file).toLowerCase();\n if (fileName.includes(lowerQuery) || matchGlob(fileName, query)) {\n if (!results.find((r) => r.path === relativePath)) {\n results.push({ path: relativePath });\n }\n continue;\n }\n }\n\n // Check content match\n if (searchIn === \"content\" || searchIn === \"both\") {\n try {\n const content = readFileSync(fullPath, \"utf-8\");\n const lines = content.split(\"\\n\");\n const matches: string[] = [];\n\n for (let i = 0; i < lines.length; i++) {\n if (lines[i].toLowerCase().includes(lowerQuery)) {\n matches.push(`L${i + 1}: ${lines[i].trim().slice(0, 100)}`);\n if (matches.length >= 5) break;\n }\n }\n\n if (matches.length > 0) {\n results.push({ path: relativePath, matches });\n }\n } catch {\n // Skip unreadable files\n }\n }\n }\n }\n\n // Sort by relevance (filename matches first, then by number of content matches)\n results.sort((a, b) => {\n if (!a.matches && b.matches) return -1;\n if (a.matches && !b.matches) return 1;\n if (a.matches && b.matches) return b.matches.length - a.matches.length;\n return 0;\n });\n\n return {\n success: true,\n data: {\n query,\n totalResults: results.length,\n results: results.slice(0, 20), // Limit results\n },\n };\n } catch (error) {\n return {\n success: false,\n error: `Search failed: ${error instanceof Error ? error.message : error}`,\n };\n }\n}\n\n/**\n * Simple glob matching for filename patterns\n */\nfunction matchGlob(filename: string, pattern: string): boolean {\n const regex = pattern\n .replace(/\\./g, \"\\\\.\")\n .replace(/\\*/g, \".*\")\n .replace(/\\?/g, \".\");\n return new RegExp(regex, \"i\").test(filename);\n}\n\n/**\n * Read a file's contents\n */\nexport async function readFile(\n ctx: ToolContext,\n args: { path: string; startLine?: number; endLine?: number }\n): Promise<ToolResult> {\n const { path: filePath, startLine, endLine } = args;\n const fullPath = join(ctx.projectRoot, filePath);\n\n if (!existsSync(fullPath)) {\n return { success: false, error: `File not found: ${filePath}` };\n }\n\n try {\n const content = readFileSync(fullPath, \"utf-8\");\n const lines = content.split(\"\\n\");\n\n const start = startLine ? Math.max(0, startLine - 1) : 0;\n const end = endLine ? Math.min(lines.length, endLine) : lines.length;\n\n const selectedLines = lines.slice(start, end);\n const numberedContent = selectedLines\n .map((line, i) => `${start + i + 1}| ${line}`)\n .join(\"\\n\");\n\n return {\n success: true,\n data: {\n path: filePath,\n totalLines: lines.length,\n linesShown: `${start + 1}-${end}`,\n content: numberedContent,\n },\n };\n } catch (error) {\n return {\n success: false,\n error: `Failed to read file: ${error instanceof Error ? error.message : error}`,\n };\n }\n}\n\n/**\n * Find references to a symbol across the codebase\n */\nexport async function findReferences(\n ctx: ToolContext,\n args: { symbol: string; type: \"import\" | \"usage\" | \"all\" }\n): Promise<ToolResult> {\n const { symbol, type } = args;\n const results: Array<{\n file: string;\n line: number;\n type: \"import\" | \"usage\";\n context: string;\n }> = [];\n\n // Build search patterns based on type\n const patterns: Array<{ regex: RegExp; type: \"import\" | \"usage\" }> = [];\n\n if (type === \"import\" || type === \"all\") {\n // Import patterns\n patterns.push(\n { regex: new RegExp(`import\\\\s+.*\\\\b${symbol}\\\\b.*from`, \"g\"), type: \"import\" },\n { regex: new RegExp(`import\\\\s+${symbol}\\\\s+from`, \"g\"), type: \"import\" },\n { regex: new RegExp(`from\\\\s+['\"][^'\"]+['\"].*\\\\b${symbol}\\\\b`, \"g\"), type: \"import\" },\n { regex: new RegExp(`require\\\\([^)]*${symbol}[^)]*\\\\)`, \"g\"), type: \"import\" }\n );\n }\n\n if (type === \"usage\" || type === \"all\") {\n // Usage patterns (component usage, function calls, type references)\n patterns.push(\n { regex: new RegExp(`<${symbol}[\\\\s/>]`, \"g\"), type: \"usage\" }, // JSX component\n { regex: new RegExp(`\\\\b${symbol}\\\\s*\\\\(`, \"g\"), type: \"usage\" }, // Function call\n { regex: new RegExp(`:\\\\s*${symbol}[\\\\s,;>]`, \"g\"), type: \"usage\" }, // Type annotation\n { regex: new RegExp(`extends\\\\s+${symbol}\\\\b`, \"g\"), type: \"usage\" }, // Class extends\n { regex: new RegExp(`implements\\\\s+${symbol}\\\\b`, \"g\"), type: \"usage\" } // Interface implements\n );\n }\n\n try {\n const files = await glob(\"**/*.{ts,tsx,js,jsx,vue,svelte}\", {\n cwd: ctx.projectRoot,\n ignore: IGNORED_DIRS.map((d) => `**/${d}/**`),\n nodir: true,\n });\n\n for (const file of files) {\n const fullPath = join(ctx.projectRoot, file);\n try {\n const content = readFileSync(fullPath, \"utf-8\");\n const lines = content.split(\"\\n\");\n\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i];\n for (const pattern of patterns) {\n if (pattern.regex.test(line)) {\n // Reset regex state\n pattern.regex.lastIndex = 0;\n results.push({\n file,\n line: i + 1,\n type: pattern.type,\n context: line.trim().slice(0, 150),\n });\n break; // Only count each line once\n }\n }\n }\n } catch {\n // Skip unreadable files\n }\n }\n\n // Group by file for cleaner output\n const groupedByFile = results.reduce(\n (acc, ref) => {\n if (!acc[ref.file]) acc[ref.file] = [];\n acc[ref.file].push(ref);\n return acc;\n },\n {} as Record<string, typeof results>\n );\n\n return {\n success: true,\n data: {\n symbol,\n totalReferences: results.length,\n fileCount: Object.keys(groupedByFile).length,\n references: groupedByFile,\n },\n };\n } catch (error) {\n return {\n success: false,\n error: `Failed to find references: ${error instanceof Error ? error.message : error}`,\n };\n }\n}\n\n/**\n * Find where a symbol is defined/exported\n */\nexport async function findDefinition(\n ctx: ToolContext,\n args: { symbol: string }\n): Promise<ToolResult> {\n const { symbol } = args;\n\n // Patterns that indicate a definition\n const definitionPatterns = [\n new RegExp(`export\\\\s+(?:default\\\\s+)?(?:async\\\\s+)?function\\\\s+${symbol}\\\\b`),\n new RegExp(`export\\\\s+(?:default\\\\s+)?class\\\\s+${symbol}\\\\b`),\n new RegExp(`export\\\\s+(?:const|let|var)\\\\s+${symbol}\\\\s*=`),\n new RegExp(`export\\\\s+(?:interface|type)\\\\s+${symbol}\\\\b`),\n new RegExp(`(?:const|let|var)\\\\s+${symbol}\\\\s*=.*(?:function|=>|class)`),\n new RegExp(`function\\\\s+${symbol}\\\\s*\\\\(`),\n new RegExp(`class\\\\s+${symbol}\\\\s*(?:extends|implements|\\\\{)`),\n new RegExp(`interface\\\\s+${symbol}\\\\s*(?:extends|\\\\{)`),\n new RegExp(`type\\\\s+${symbol}\\\\s*=`),\n new RegExp(`export\\\\s*\\\\{[^}]*\\\\b${symbol}\\\\b[^}]*\\\\}`), // Named export\n ];\n\n const results: Array<{\n file: string;\n line: number;\n definitionType: string;\n context: string;\n }> = [];\n\n try {\n const files = await glob(\"**/*.{ts,tsx,js,jsx}\", {\n cwd: ctx.projectRoot,\n ignore: IGNORED_DIRS.map((d) => `**/${d}/**`),\n nodir: true,\n });\n\n for (const file of files) {\n const fullPath = join(ctx.projectRoot, file);\n try {\n const content = readFileSync(fullPath, \"utf-8\");\n const lines = content.split(\"\\n\");\n\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i];\n for (const pattern of definitionPatterns) {\n if (pattern.test(line)) {\n // Determine definition type\n let defType = \"unknown\";\n if (/function/.test(line)) defType = \"function\";\n else if (/class/.test(line)) defType = \"class\";\n else if (/interface/.test(line)) defType = \"interface\";\n else if (/type\\s+\\w+\\s*=/.test(line)) defType = \"type\";\n else if (/const|let|var/.test(line)) defType = \"variable\";\n else if (/export\\s*\\{/.test(line)) defType = \"re-export\";\n\n results.push({\n file,\n line: i + 1,\n definitionType: defType,\n context: lines.slice(i, Math.min(i + 5, lines.length)).join(\"\\n\").slice(0, 300),\n });\n break;\n }\n }\n }\n } catch {\n // Skip unreadable files\n }\n }\n\n return {\n success: true,\n data: {\n symbol,\n definitionsFound: results.length,\n definitions: results,\n },\n };\n } catch (error) {\n return {\n success: false,\n error: `Failed to find definition: ${error instanceof Error ? error.message : error}`,\n };\n }\n}\n\n/**\n * List directory contents\n */\nexport async function listDirectory(\n ctx: ToolContext,\n args: { path: string; recursive?: boolean }\n): Promise<ToolResult> {\n const { path: dirPath, recursive } = args;\n const fullPath = dirPath ? join(ctx.projectRoot, dirPath) : ctx.projectRoot;\n\n if (!existsSync(fullPath)) {\n return { success: false, error: `Directory not found: ${dirPath}` };\n }\n\n try {\n const stat = statSync(fullPath);\n if (!stat.isDirectory()) {\n return { success: false, error: `Not a directory: ${dirPath}` };\n }\n\n const items: Array<{ path: string; type: \"file\" | \"directory\"; size?: number }> = [];\n\n function listDir(dir: string, depth: number) {\n if (depth > 3) return; // Max depth\n\n const entries = readdirSync(dir);\n for (const entry of entries) {\n if (IGNORED_DIRS.includes(entry) || entry.startsWith(\".\")) continue;\n\n const entryPath = join(dir, entry);\n const relativePath = relative(ctx.projectRoot, entryPath);\n\n try {\n const entryStat = statSync(entryPath);\n if (entryStat.isDirectory()) {\n items.push({ path: relativePath, type: \"directory\" });\n if (recursive) {\n listDir(entryPath, depth + 1);\n }\n } else if (entryStat.isFile()) {\n items.push({ path: relativePath, type: \"file\", size: entryStat.size });\n }\n } catch {\n // Skip inaccessible entries\n }\n }\n }\n\n listDir(fullPath, 0);\n\n // Sort: directories first, then files\n items.sort((a, b) => {\n if (a.type !== b.type) return a.type === \"directory\" ? -1 : 1;\n return a.path.localeCompare(b.path);\n });\n\n return {\n success: true,\n data: {\n path: dirPath || \".\",\n totalItems: items.length,\n items: items.slice(0, 100), // Limit results\n },\n };\n } catch (error) {\n return {\n success: false,\n error: `Failed to list directory: ${error instanceof Error ? error.message : error}`,\n };\n }\n}\n\n/**\n * Get structured analysis of a file\n */\nexport async function getFileStructure(\n ctx: ToolContext,\n args: { path: string }\n): Promise<ToolResult> {\n const { path: filePath } = args;\n const fullPath = join(ctx.projectRoot, filePath);\n\n if (!existsSync(fullPath)) {\n return { success: false, error: `File not found: ${filePath}` };\n }\n\n try {\n const content = readFileSync(fullPath, \"utf-8\");\n\n const structure = {\n imports: [] as Array<{ from: string; imports: string[] }>,\n exports: [] as Array<{ name: string; type: string; line: number }>,\n functions: [] as Array<{ name: string; line: number; async: boolean }>,\n classes: [] as Array<{ name: string; line: number; extends?: string }>,\n types: [] as Array<{ name: string; line: number; kind: \"type\" | \"interface\" }>,\n components: [] as Array<{ name: string; line: number; props?: string }>,\n };\n\n const lines = content.split(\"\\n\");\n\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i];\n const lineNum = i + 1;\n\n // Parse imports\n const importMatch = line.match(\n /import\\s+(?:type\\s+)?(?:\\{([^}]+)\\}|(\\w+))\\s+from\\s+['\"]([^'\"]+)['\"]/\n );\n if (importMatch) {\n const imports = importMatch[1]\n ? importMatch[1].split(\",\").map((s) => s.trim().split(\" as \")[0])\n : [importMatch[2]];\n structure.imports.push({ from: importMatch[3], imports: imports.filter(Boolean) });\n }\n\n // Parse exports\n const exportMatch = line.match(\n /export\\s+(?:default\\s+)?(?:async\\s+)?(function|class|const|let|var|interface|type)\\s+(\\w+)/\n );\n if (exportMatch) {\n structure.exports.push({ name: exportMatch[2], type: exportMatch[1], line: lineNum });\n }\n\n // Parse functions\n const funcMatch = line.match(\n /(?:export\\s+)?(?:default\\s+)?(async\\s+)?function\\s+(\\w+)/\n );\n if (funcMatch) {\n structure.functions.push({\n name: funcMatch[2],\n line: lineNum,\n async: !!funcMatch[1],\n });\n }\n\n // Parse arrow functions assigned to const\n const arrowMatch = line.match(\n /(?:export\\s+)?const\\s+(\\w+)\\s*=\\s*(async\\s+)?(?:\\([^)]*\\)|[^=])\\s*=>/\n );\n if (arrowMatch) {\n structure.functions.push({\n name: arrowMatch[1],\n line: lineNum,\n async: !!arrowMatch[2],\n });\n }\n\n // Parse classes\n const classMatch = line.match(\n /(?:export\\s+)?(?:default\\s+)?class\\s+(\\w+)(?:\\s+extends\\s+(\\w+))?/\n );\n if (classMatch) {\n structure.classes.push({\n name: classMatch[1],\n line: lineNum,\n extends: classMatch[2],\n });\n }\n\n // Parse types/interfaces\n const typeMatch = line.match(\n /(?:export\\s+)?(interface|type)\\s+(\\w+)/\n );\n if (typeMatch) {\n structure.types.push({\n name: typeMatch[2],\n line: lineNum,\n kind: typeMatch[1] as \"type\" | \"interface\",\n });\n }\n\n // Parse React components (function components)\n if (\n line.match(/(?:export\\s+)?(?:default\\s+)?(?:const|function)\\s+([A-Z]\\w+)/) &&\n (content.includes(\"React\") || content.includes(\"jsx\") || filePath.endsWith(\".tsx\"))\n ) {\n const compMatch = line.match(/(?:const|function)\\s+([A-Z]\\w+)/);\n if (compMatch) {\n // Check for props type\n const propsMatch = line.match(/:\\s*(?:React\\.)?FC<(\\w+)>|props:\\s*(\\w+)/);\n structure.components.push({\n name: compMatch[1],\n line: lineNum,\n props: propsMatch ? propsMatch[1] || propsMatch[2] : undefined,\n });\n }\n }\n }\n\n return {\n success: true,\n data: {\n path: filePath,\n structure,\n },\n };\n } catch (error) {\n return {\n success: false,\n error: `Failed to analyze file: ${error instanceof Error ? error.message : error}`,\n };\n }\n}\n\n/**\n * Search for type definitions\n */\nexport async function searchTypes(\n ctx: ToolContext,\n args: { query: string; kind: \"interface\" | \"type\" | \"schema\" | \"all\" }\n): Promise<ToolResult> {\n const { query, kind } = args;\n\n const results: Array<{\n name: string;\n file: string;\n line: number;\n kind: string;\n preview: string;\n }> = [];\n\n // Patterns based on kind\n const patterns: RegExp[] = [];\n if (kind === \"interface\" || kind === \"all\") {\n patterns.push(new RegExp(`interface\\\\s+(\\\\w*${query}\\\\w*)`, \"gi\"));\n }\n if (kind === \"type\" || kind === \"all\") {\n patterns.push(new RegExp(`type\\\\s+(\\\\w*${query}\\\\w*)\\\\s*=`, \"gi\"));\n }\n if (kind === \"schema\" || kind === \"all\") {\n // Zod, Yup, and other schema patterns\n patterns.push(new RegExp(`(?:const|export\\\\s+const)\\\\s+(\\\\w*${query}\\\\w*Schema)\\\\s*=`, \"gi\"));\n patterns.push(new RegExp(`z\\\\.object.*${query}`, \"gi\"));\n }\n\n try {\n const files = await glob(\"**/*.{ts,tsx,js,jsx}\", {\n cwd: ctx.projectRoot,\n ignore: IGNORED_DIRS.map((d) => `**/${d}/**`),\n nodir: true,\n });\n\n for (const file of files) {\n const fullPath = join(ctx.projectRoot, file);\n try {\n const content = readFileSync(fullPath, \"utf-8\");\n const lines = content.split(\"\\n\");\n\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i];\n\n for (const pattern of patterns) {\n const match = pattern.exec(line);\n if (match) {\n pattern.lastIndex = 0; // Reset\n\n // Get more context (the full type definition if small)\n const preview = lines.slice(i, Math.min(i + 10, lines.length)).join(\"\\n\").slice(0, 400);\n\n let detectedKind = \"type\";\n if (/interface/.test(line)) detectedKind = \"interface\";\n else if (/Schema/.test(line) || /z\\./.test(line)) detectedKind = \"schema\";\n\n results.push({\n name: match[1] || query,\n file,\n line: i + 1,\n kind: detectedKind,\n preview,\n });\n break;\n }\n }\n }\n } catch {\n // Skip unreadable files\n }\n }\n\n return {\n success: true,\n data: {\n query,\n kind,\n totalResults: results.length,\n results: results.slice(0, 15),\n },\n };\n } catch (error) {\n return {\n success: false,\n error: `Failed to search types: ${error instanceof Error ? error.message : error}`,\n };\n }\n}\n\n/**\n * Execute a tool by name\n */\nexport async function executeTool(\n toolName: ToolName,\n args: Record<string, unknown>,\n ctx: ToolContext\n): Promise<ToolResult> {\n switch (toolName) {\n case \"search_files\":\n return searchFiles(ctx, args as Parameters<typeof searchFiles>[1]);\n case \"read_file\":\n return readFile(ctx, args as Parameters<typeof readFile>[1]);\n case \"find_references\":\n return findReferences(ctx, args as Parameters<typeof findReferences>[1]);\n case \"find_definition\":\n return findDefinition(ctx, args as Parameters<typeof findDefinition>[1]);\n case \"list_directory\":\n return listDirectory(ctx, args as Parameters<typeof listDirectory>[1]);\n case \"get_file_structure\":\n return getFileStructure(ctx, args as Parameters<typeof getFileStructure>[1]);\n case \"search_types\":\n return searchTypes(ctx, args as Parameters<typeof searchTypes>[1]);\n case \"complete_investigation\":\n // This is handled specially by the agent\n return { success: true, data: args };\n default:\n return { success: false, error: `Unknown tool: ${toolName}` };\n }\n}\n","/**\n * The Detective Agent\n *\n * An AI agent that explores codebases to understand features, flows, and implementations.\n * Uses tools to navigate code rather than trying to read everything at once.\n */\n\nimport OpenAI from \"openai\";\nimport type {\n ChatCompletionMessageParam,\n ChatCompletionToolMessageParam,\n} from \"openai/resources/chat/completions\";\nimport { AGENT_TOOLS, type ToolName } from \"./tools/definitions.js\";\nimport { executeTool, type ToolContext, type ToolResult } from \"./tools/implementations.js\";\n\nconst SYSTEM_PROMPT = `You are \"The Detective\" - an expert code analyst who explores codebases methodically to understand features and implementations.\n\nYour mission is to investigate a codebase based on a user's query and produce a comprehensive understanding of how a feature works.\n\n## Investigation Strategy\n\n1. **Start Broad**: Begin by searching for files related to the query keywords. Look for obvious matches first.\n\n2. **Follow the Trail**: When you find a relevant file:\n - Read it to understand what it does\n - Look at its imports to find dependencies\n - Find where it's exported/used to understand how it fits in\n\n3. **Find Entry Points**: Always identify HOW a feature is triggered:\n - Is it a page/route?\n - Is it a component triggered by user action?\n - Is it an API endpoint?\n - Find the \"beginning\" of the user journey\n\n4. **Trace Data Flow**: Understand:\n - What data does the feature work with? (types, schemas)\n - Where does data come from? (API, props, state)\n - Where does data go? (mutations, API calls, state updates)\n\n5. **Find Usage Examples**: Search for where components/functions are actually used. This shows real-world integration.\n\n6. **Document Technical Details**: Note any important patterns, validations, error handling, or edge cases.\n\n## Tool Usage Tips\n\n- Use \\`search_files\\` with searchIn=\"filename\" first for broad discovery\n- Use \\`search_files\\` with searchIn=\"content\" when looking for specific patterns\n- Use \\`get_file_structure\\` to quickly understand a file's purpose without reading everything\n- Use \\`find_references\\` to understand how something is used/triggered\n- Use \\`find_definition\\` when you see an import and need to find the source\n- Use \\`search_types\\` to find data structures and schemas\n- Use \\`read_file\\` to examine specific implementation details\n\n## Investigation Rules\n\n1. Be thorough but efficient - don't read every file, use structure analysis first\n2. Always find at least ONE usage example of the main component/function\n3. Always identify the data types/schemas involved\n4. Focus on answering: \"If I were a new developer, what would I need to know to work on this?\"\n5. When you have enough information, call \\`complete_investigation\\` with your structured findings\n\n## Output Quality\n\nYour final investigation should enable someone to:\n- Understand what the feature does (user perspective)\n- Know which files to look at\n- Understand the data flow\n- See real usage examples\n- Know about edge cases or important details`;\n\nexport interface DetectiveOptions {\n projectRoot: string;\n verbose?: boolean;\n maxIterations?: number;\n onToolCall?: (toolName: string, args: unknown) => void;\n onToolResult?: (toolName: string, result: ToolResult) => void;\n onThinking?: (thought: string) => void;\n}\n\nexport interface InvestigationResult {\n success: boolean;\n title?: string;\n summary?: string;\n entryPoints?: Array<{ file: string; component: string; description: string }>;\n dataFlow?: Array<{ step: number; description: string; files: string[] }>;\n keyFiles?: Array<{ path: string; purpose: string; keyExports: string[] }>;\n dataStructures?: Array<{\n name: string;\n file: string;\n fields: string[];\n description: string;\n }>;\n usageExamples?: Array<{ description: string; file: string; codeSnippet: string }>;\n relatedFeatures?: string[];\n technicalNotes?: string[];\n error?: string;\n toolCalls?: number;\n}\n\n/**\n * The Detective Agent - explores a codebase to understand a feature\n */\nexport class DetectiveAgent {\n private openai: OpenAI;\n private context: ToolContext;\n private options: DetectiveOptions;\n private messages: ChatCompletionMessageParam[];\n private toolCallCount: number = 0;\n\n constructor(options: DetectiveOptions) {\n const apiKey = process.env.OPENAI_API_KEY;\n if (!apiKey) {\n throw new Error(\n \"Missing OPENAI_API_KEY environment variable.\\n\" +\n \"Set it to use the Detective agent for code exploration.\"\n );\n }\n\n this.openai = new OpenAI({ apiKey });\n this.context = { projectRoot: options.projectRoot };\n this.options = {\n maxIterations: 25,\n ...options,\n };\n this.messages = [{ role: \"system\", content: SYSTEM_PROMPT }];\n }\n\n /**\n * Run an investigation based on a user query\n */\n async investigate(query: string): Promise<InvestigationResult> {\n // Add the user's query\n this.messages.push({\n role: \"user\",\n content: `Investigate the following topic in the codebase:\\n\\n\"${query}\"\\n\\nUse the available tools to explore the codebase, understand the feature, and then call complete_investigation with your findings.`,\n });\n\n let iterations = 0;\n const maxIterations = this.options.maxIterations!;\n\n while (iterations < maxIterations) {\n iterations++;\n\n try {\n const response = await this.openai.chat.completions.create({\n model: \"gpt-4o\",\n messages: this.messages,\n tools: AGENT_TOOLS,\n tool_choice: \"auto\",\n temperature: 0.1,\n });\n\n const message = response.choices[0].message;\n\n // Add assistant message to history\n this.messages.push(message);\n\n // If there's thinking/content, log it\n if (message.content && this.options.onThinking) {\n this.options.onThinking(message.content);\n }\n\n // Check if we're done (no tool calls)\n if (!message.tool_calls || message.tool_calls.length === 0) {\n // No more tool calls - check if we got a complete_investigation\n return {\n success: false,\n error: \"Agent finished without completing investigation\",\n toolCalls: this.toolCallCount,\n };\n }\n\n // Process tool calls\n const toolResults: ChatCompletionToolMessageParam[] = [];\n\n for (const toolCall of message.tool_calls) {\n const toolName = toolCall.function.name as ToolName;\n let args: Record<string, unknown>;\n\n try {\n args = JSON.parse(toolCall.function.arguments);\n } catch {\n args = {};\n }\n\n this.toolCallCount++;\n\n // Notify about tool call\n if (this.options.onToolCall) {\n this.options.onToolCall(toolName, args);\n }\n\n // Check if this is the completion tool\n if (toolName === \"complete_investigation\") {\n if (this.options.onToolResult) {\n this.options.onToolResult(toolName, { success: true, data: args });\n }\n\n return {\n success: true,\n title: args.title as string,\n summary: args.summary as string,\n entryPoints: args.entryPoints as InvestigationResult[\"entryPoints\"],\n dataFlow: args.dataFlow as InvestigationResult[\"dataFlow\"],\n keyFiles: args.keyFiles as InvestigationResult[\"keyFiles\"],\n dataStructures: args.dataStructures as InvestigationResult[\"dataStructures\"],\n usageExamples: args.usageExamples as InvestigationResult[\"usageExamples\"],\n relatedFeatures: args.relatedFeatures as string[],\n technicalNotes: args.technicalNotes as string[],\n toolCalls: this.toolCallCount,\n };\n }\n\n // Execute the tool\n const result = await executeTool(toolName, args, this.context);\n\n // Notify about result\n if (this.options.onToolResult) {\n this.options.onToolResult(toolName, result);\n }\n\n toolResults.push({\n role: \"tool\",\n tool_call_id: toolCall.id,\n content: JSON.stringify(result),\n });\n }\n\n // Add all tool results to messages\n this.messages.push(...toolResults);\n } catch (error) {\n return {\n success: false,\n error: `Agent error: ${error instanceof Error ? error.message : error}`,\n toolCalls: this.toolCallCount,\n };\n }\n }\n\n return {\n success: false,\n error: `Investigation exceeded maximum iterations (${maxIterations})`,\n toolCalls: this.toolCallCount,\n };\n }\n}\n\n/**\n * Create and run a detective investigation\n */\nexport async function investigateFeature(\n query: string,\n options: Omit<DetectiveOptions, \"projectRoot\"> & { projectRoot?: string }\n): Promise<InvestigationResult> {\n const projectRoot = options.projectRoot || getProjectRoot();\n\n const agent = new DetectiveAgent({\n ...options,\n projectRoot,\n });\n\n return agent.investigate(query);\n}\n\n/**\n * Get the project root directory\n */\nfunction getProjectRoot(): string {\n try {\n const { execSync } = require(\"child_process\");\n return execSync(\"git rev-parse --show-toplevel\", { encoding: \"utf-8\" }).trim();\n } catch {\n return process.cwd();\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/analyzers/git/index.ts","../src/analyzers/context/index.ts","../src/generators/index.ts","../src/agent/tools/definitions.ts","../src/agent/tools/implementations.ts","../src/agent/detective.ts"],"names":["range","result","listDir","execSync"],"mappings":";;;;;;;;;;;;AAsDA,SAAS,IAAI,OAAA,EAAyB;AACpC,EAAA,IAAI;AACF,IAAA,OAAO,QAAA,CAAS,CAAA,IAAA,EAAO,OAAO,CAAA,CAAA,EAAI;AAAA,MAChC,QAAA,EAAU,OAAA;AAAA,MACV,SAAA,EAAW,KAAK,IAAA,GAAO;AAAA;AAAA,KACxB,EAAE,IAAA,EAAK;AAAA,EACV,SAAS,KAAA,EAAO;AACd,IAAA,MAAM,IAAI,KAAA,CAAM,CAAA,wBAAA,EAA2B,OAAO,CAAA,CAAE,CAAA;AAAA,EACtD;AACF;AAKA,SAAS,eAAe,QAAA,EAA2B;AACjD,EAAA,IAAI;AACF,IAAA,GAAA,CAAI,CAAA,mBAAA,EAAsB,QAAQ,CAAA,CAAE,CAAA;AACpC,IAAA,OAAO,IAAA;AAAA,EACT,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,KAAA;AAAA,EACT;AACF;AAKA,SAAS,eAAA,GAA0B;AAEjC,EAAA,IAAI,cAAA,CAAe,QAAQ,CAAA,EAAG;AAC5B,IAAA,OAAO,cAAA;AAAA,EACT;AAGA,EAAA,IAAI,cAAA,CAAe,MAAM,CAAA,EAAG;AAE1B,IAAA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A,EAAS,KAAA;AAAA,MACT,KAAA,EAAO,8CAA8C,aAAa,CAAA,CAAA,CAAA;AAAA,MAClE,WAAW,IAAA,CAAK;AAAA,KAClB;AAAA,EACF;AACF;AAKA,eAAsB,kBAAA,CACpB,OACA,OAAA,EAC8B;AAC9B,EAAA,MAAM,WAAA,GAAc,OAAA,CAAQ,WAAA,IAAe,cAAA,EAAe;AAE1D,EAAA,MAAM,KAAA,GAAQ,IAAI,cAAA,CAAe;AAAA,IAC/B,GAAG,OAAA;AAAA,IACH;AAAA,GACD,CAAA;AAED,EAAA,OAAO,KAAA,CAAM,YAAY,KAAK,CAAA;AAChC;AAKA,SAAS,cAAA,GAAyB;AAChC,EAAA,IAAI;AACF,IAAA,MAAM,EAAE,QAAA,EAAAC,SAAAA,EAAS,GAAI,UAAQ,eAAe,CAAA;AAC5C,IAAA,OAAOA,UAAS,+BAAA,EAAiC,EAAE,UAAU,OAAA,EAAS,EAAE,IAAA,EAAK;AAAA,EAC/E,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,QAAQ,GAAA,EAAI;AAAA,EACrB;AACF","file":"index.js","sourcesContent":["/**\n * Git Analyzer\n *\n * Analyzes Git repositories, commits, branches, and pull requests.\n *\n * Features:\n * - Parse commit history\n * - Analyze PR changes\n * - Extract diff information\n * - Identify changed files and their context\n */\n\nimport { execSync } from \"child_process\";\nimport type { ArtifactSource, ArtifactContext } from \"../../shared/types.js\";\n\n/**\n * Code snippet extracted from diff\n */\nexport interface DiffCodeSnippet {\n file: string;\n code: string;\n startLine?: number;\n language?: string;\n description?: string;\n changeType: \"added\" | \"deleted\" | \"modified\" | \"context\";\n}\n\nexport interface AnalysisResult {\n title: string;\n description: string;\n source: ArtifactSource;\n context: ArtifactContext;\n guidelines: string[];\n /** Code snippets extracted from the diff */\n codeSnippets?: DiffCodeSnippet[];\n}\n\ninterface DiffFile {\n path: string;\n additions: number;\n deletions: number;\n status: \"added\" | \"modified\" | \"deleted\" | \"renamed\";\n}\n\ninterface CommitInfo {\n hash: string;\n author: string;\n date: string;\n message: string;\n}\n\n/**\n * Execute a git command and return the output\n */\nfunction git(command: string): string {\n try {\n return execSync(`git ${command}`, {\n encoding: \"utf-8\",\n maxBuffer: 10 * 1024 * 1024, // 10MB buffer for large diffs\n }).trim();\n } catch (error) {\n throw new Error(`Git command failed: git ${command}`);\n }\n}\n\n/**\n * Check if a git revision exists\n */\nfunction revisionExists(revision: string): boolean {\n try {\n git(`rev-parse --verify ${revision}`);\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Get the default diff range based on available commits\n */\nfunction getDefaultRange(): string {\n // Check if HEAD~1 exists (more than one commit)\n if (revisionExists(\"HEAD~1\")) {\n return \"HEAD~1..HEAD\";\n }\n\n // Check if HEAD exists (at least one commit)\n if (revisionExists(\"HEAD\")) {\n // Compare against empty tree (shows all files in first commit)\n const emptyTree = \"4b825dc642cb6eb9a060e54bf8d69288fbee4904\";\n return `${emptyTree}..HEAD`;\n }\n\n throw new Error(\"No commits found in repository\");\n}\n\n/**\n * Get the list of changed files in a diff range\n */\nfunction getChangedFiles(range: string): DiffFile[] {\n const output = git(`diff --numstat ${range}`);\n if (!output) return [];\n\n return output.split(\"\\n\").map((line) => {\n const [additions, deletions, path] = line.split(\"\\t\");\n return {\n path,\n additions: parseInt(additions, 10) || 0,\n deletions: parseInt(deletions, 10) || 0,\n status: \"modified\" as const,\n };\n });\n}\n\n/**\n * Get commit information for a range\n */\nfunction getCommits(range: string): CommitInfo[] {\n const output = git(`log --format=\"%H|%an|%ai|%s\" ${range}`);\n if (!output) return [];\n\n return output.split(\"\\n\").map((line) => {\n const [hash, author, date, message] = line.split(\"|\");\n return { hash, author, date, message };\n });\n}\n\n/**\n * Get the actual diff content\n */\nfunction getDiffContent(range: string): string {\n return git(`diff ${range}`);\n}\n\n/**\n * Extract code snippets from diff content\n */\nfunction extractCodeSnippets(diffContent: string, maxSnippets: number = 6): DiffCodeSnippet[] {\n const snippets: DiffCodeSnippet[] = [];\n const lines = diffContent.split(\"\\n\");\n \n let currentFile = \"\";\n let currentHunk: string[] = [];\n let currentStartLine = 0;\n let inHunk = false;\n\n for (const line of lines) {\n // Detect file header\n if (line.startsWith(\"diff --git\")) {\n // Save previous hunk if exists\n if (currentHunk.length > 0 && currentFile) {\n snippets.push(createSnippetFromHunk(currentFile, currentHunk, currentStartLine));\n if (snippets.length >= maxSnippets) break;\n }\n currentHunk = [];\n inHunk = false;\n continue;\n }\n\n // Get filename\n if (line.startsWith(\"+++ b/\")) {\n currentFile = line.slice(6);\n continue;\n }\n\n // Detect hunk header\n if (line.startsWith(\"@@\")) {\n // Save previous hunk\n if (currentHunk.length > 0 && currentFile) {\n snippets.push(createSnippetFromHunk(currentFile, currentHunk, currentStartLine));\n if (snippets.length >= maxSnippets) break;\n }\n \n // Parse line number from @@ -start,count +start,count @@\n const match = line.match(/@@ -\\d+(?:,\\d+)? \\+(\\d+)/);\n currentStartLine = match ? parseInt(match[1], 10) : 1;\n currentHunk = [];\n inHunk = true;\n continue;\n }\n\n // Collect hunk content (limit size)\n if (inHunk && currentHunk.length < 15) {\n currentHunk.push(line);\n }\n }\n\n // Save last hunk\n if (currentHunk.length > 0 && currentFile && snippets.length < maxSnippets) {\n snippets.push(createSnippetFromHunk(currentFile, currentHunk, currentStartLine));\n }\n\n return snippets;\n}\n\n/**\n * Create a code snippet from a diff hunk\n */\nfunction createSnippetFromHunk(\n file: string,\n hunkLines: string[],\n startLine: number\n): DiffCodeSnippet {\n // Determine change type based on content\n const hasAdditions = hunkLines.some(l => l.startsWith(\"+\"));\n const hasDeletions = hunkLines.some(l => l.startsWith(\"-\"));\n \n let changeType: \"added\" | \"deleted\" | \"modified\" | \"context\";\n if (hasAdditions && hasDeletions) {\n changeType = \"modified\";\n } else if (hasAdditions) {\n changeType = \"added\";\n } else if (hasDeletions) {\n changeType = \"deleted\";\n } else {\n changeType = \"context\";\n }\n\n // Clean up the code (remove diff markers for display)\n const code = hunkLines\n .map(line => {\n if (line.startsWith(\"+\") || line.startsWith(\"-\") || line.startsWith(\" \")) {\n return line.slice(1);\n }\n return line;\n })\n .join(\"\\n\");\n\n // Detect language from extension\n const ext = file.split(\".\").pop()?.toLowerCase() || \"\";\n const langMap: Record<string, string> = {\n ts: \"typescript\",\n tsx: \"typescript\",\n js: \"javascript\",\n jsx: \"javascript\",\n vue: \"vue\",\n py: \"python\",\n rb: \"ruby\",\n go: \"go\",\n rs: \"rust\",\n java: \"java\",\n css: \"css\",\n scss: \"scss\",\n html: \"html\",\n json: \"json\",\n };\n\n return {\n file,\n code,\n startLine,\n language: langMap[ext] || \"text\",\n description: `${changeType === \"added\" ? \"Added\" : changeType === \"deleted\" ? \"Removed\" : \"Changed\"} in ${file}`,\n changeType,\n };\n}\n\n/**\n * Detect if there are breaking changes based on diff content and commit messages\n */\nfunction detectBreakingChanges(commits: CommitInfo[], diffContent: string): boolean {\n // Check commit messages for breaking change indicators\n const breakingPatterns = [\n /BREAKING CHANGE/i,\n /\\bbreaking\\b/i,\n /\\!:/,\n /removed/i,\n /deprecated/i,\n ];\n\n for (const commit of commits) {\n if (breakingPatterns.some((pattern) => pattern.test(commit.message))) {\n return true;\n }\n }\n\n // Check diff for removal of exports or major structural changes\n const lines = diffContent.split(\"\\n\");\n const removedExports = lines.filter(\n (line) => line.startsWith(\"-\") && /export\\s+(default\\s+)?(function|class|const|interface|type)/.test(line)\n );\n\n return removedExports.length > 0;\n}\n\n/**\n * Extract keywords from file paths and diff content\n */\nfunction extractKeywords(files: DiffFile[], diffContent: string): string[] {\n const keywords = new Set<string>();\n\n // Extract from file paths\n for (const file of files) {\n const parts = file.path.split(\"/\");\n for (const part of parts) {\n // Skip common non-meaningful names\n if (![\"src\", \"lib\", \"dist\", \"index\", \"node_modules\"].includes(part)) {\n // Extract meaningful words\n const words = part\n .replace(/\\.(ts|tsx|js|jsx|json|md|css|scss)$/, \"\")\n .split(/[-_.]/)\n .filter((w) => w.length > 2);\n words.forEach((w) => keywords.add(w.toLowerCase()));\n }\n }\n }\n\n // Extract from diff content (function names, class names, etc.)\n const codePatterns = [\n /(?:function|class|interface|type|const|let|var)\\s+([A-Za-z_][A-Za-z0-9_]*)/g,\n /export\\s+(?:default\\s+)?(?:function|class|const)\\s+([A-Za-z_][A-Za-z0-9_]*)/g,\n ];\n\n for (const pattern of codePatterns) {\n let match;\n while ((match = pattern.exec(diffContent)) !== null) {\n if (match[1] && match[1].length > 2) {\n keywords.add(match[1].toLowerCase());\n }\n }\n }\n\n return Array.from(keywords).slice(0, 20);\n}\n\n/**\n * Generate a summary title from commits and file changes\n */\nfunction generateTitle(commits: CommitInfo[], files: DiffFile[]): string {\n if (commits.length === 1) {\n return commits[0].message;\n }\n\n if (commits.length > 1) {\n // Find common theme in commit messages or use generic title\n const messages = commits.map((c) => c.message);\n const firstWords = messages.map((m) => m.split(\" \").slice(0, 3).join(\" \"));\n return `Changes across ${commits.length} commits: ${firstWords[0]}...`;\n }\n\n // Fallback to file-based title\n const extensions = [...new Set(files.map((f) => f.path.split(\".\").pop()))];\n return `Code changes in ${files.length} files (${extensions.join(\", \")})`;\n}\n\n/**\n * Generate a description from the analysis\n */\nfunction generateDescription(\n commits: CommitInfo[],\n files: DiffFile[],\n breakingChanges: boolean\n): string {\n const parts: string[] = [];\n\n if (commits.length > 0) {\n parts.push(`This change includes ${commits.length} commit(s).`);\n }\n\n const totalAdditions = files.reduce((sum, f) => sum + f.additions, 0);\n const totalDeletions = files.reduce((sum, f) => sum + f.deletions, 0);\n parts.push(`Modified ${files.length} file(s) with +${totalAdditions}/-${totalDeletions} lines.`);\n\n if (breakingChanges) {\n parts.push(\"⚠️ This change may contain breaking changes.\");\n }\n\n return parts.join(\" \");\n}\n\n/**\n * Generate guidelines for artifact messaging\n */\nfunction generateGuidelines(\n commits: CommitInfo[],\n files: DiffFile[],\n breakingChanges: boolean\n): string[] {\n const guidelines: string[] = [];\n\n // Feature vs fix detection\n const hasFeature = commits.some((c) => /feat|feature|add|new/i.test(c.message));\n const hasFix = commits.some((c) => /fix|bug|patch|issue/i.test(c.message));\n const hasRefactor = commits.some((c) => /refactor|clean|improve/i.test(c.message));\n\n if (hasFeature) {\n guidelines.push(\"Highlight the new capability and its user-facing benefits.\");\n }\n if (hasFix) {\n guidelines.push(\"Explain what was broken and how it's now fixed.\");\n }\n if (hasRefactor) {\n guidelines.push(\"Note the improvements without exposing internal complexity.\");\n }\n\n if (breakingChanges) {\n guidelines.push(\"Clearly communicate the breaking change and migration steps.\");\n guidelines.push(\"Provide a timeline for deprecation if applicable.\");\n }\n\n // File type specific guidelines\n const hasAPI = files.some((f) => /api|route|endpoint/i.test(f.path));\n const hasUI = files.some((f) => /component|page|view|ui/i.test(f.path));\n const hasConfig = files.some((f) => /config|env|setting/i.test(f.path));\n\n if (hasAPI) {\n guidelines.push(\"Document any API changes with request/response examples.\");\n }\n if (hasUI) {\n guidelines.push(\"Consider including screenshots or visual demos.\");\n }\n if (hasConfig) {\n guidelines.push(\"List any new configuration options or environment variables.\");\n }\n\n return guidelines.length > 0\n ? guidelines\n : [\"Focus on the value delivered to users.\", \"Keep technical details accessible.\"];\n}\n\n/**\n * Analyze a git diff range and produce an artifact\n */\nexport async function analyzeDiff(range: string): Promise<AnalysisResult> {\n // Validate we're in a git repository\n try {\n git(\"rev-parse --git-dir\");\n } catch {\n throw new Error(\"Not in a git repository\");\n }\n\n // Handle default range or validate provided range\n let effectiveRange = range;\n if (range === \"HEAD~1..HEAD\") {\n // This is the default, check if it exists\n try {\n effectiveRange = getDefaultRange();\n } catch (error) {\n throw new Error(\n `Could not determine diff range: ${error instanceof Error ? error.message : error}`\n );\n }\n } else {\n // Validate the provided range\n const [start] = range.split(\"..\");\n if (!revisionExists(start)) {\n throw new Error(`Invalid revision: ${start}`);\n }\n }\n\n const files = getChangedFiles(effectiveRange);\n if (files.length === 0) {\n throw new Error(`No changes found in range: ${effectiveRange}`);\n }\n\n const commits = getCommits(effectiveRange);\n const diffContent = getDiffContent(effectiveRange);\n const breakingChanges = detectBreakingChanges(commits, diffContent);\n const keywords = extractKeywords(files, diffContent);\n\n const title = generateTitle(commits, files);\n const description = generateDescription(commits, files, breakingChanges);\n const guidelines = generateGuidelines(commits, files, breakingChanges);\n\n // Get repository info for source reference\n let repoUrl = \"\";\n try {\n repoUrl = git(\"config --get remote.origin.url\").replace(/\\.git$/, \"\");\n } catch {\n // No remote configured\n }\n\n const source: ArtifactSource = {\n type: \"commit\",\n reference: effectiveRange,\n url: repoUrl ? `${repoUrl}/compare/${effectiveRange.replace(\"..\", \"...\")}` : undefined,\n };\n\n const context: ArtifactContext = {\n summary: description,\n technicalDetails: commits.map((c) => `${c.hash.slice(0, 7)}: ${c.message}`),\n affectedComponents: files.map((f) => f.path),\n breakingChanges,\n keywords,\n };\n\n // Extract code snippets from the diff\n const codeSnippets = extractCodeSnippets(diffContent);\n\n return {\n title,\n description,\n source,\n context,\n guidelines,\n codeSnippets,\n };\n}\n\nexport interface PROptions {\n url?: string;\n number?: number;\n}\n\n/**\n * Analyze a pull request and produce an artifact\n */\nexport async function analyzePR(options: PROptions): Promise<AnalysisResult> {\n // Validate we're in a git repository\n try {\n git(\"rev-parse --git-dir\");\n } catch {\n throw new Error(\"Not in a git repository\");\n }\n\n let prTitle = \"\";\n let prBody = \"\";\n let prNumber = options.number;\n let prUrl = options.url;\n\n // If URL provided, parse it\n if (prUrl) {\n const match = prUrl.match(/github\\.com\\/([^/]+)\\/([^/]+)\\/pull\\/(\\d+)/);\n if (match) {\n prNumber = parseInt(match[3], 10);\n }\n }\n\n // Try to get PR info from GitHub CLI if available\n if (prNumber) {\n try {\n const prInfo = git(`gh pr view ${prNumber} --json title,body,headRefName,baseRefName`);\n const parsed = JSON.parse(prInfo);\n prTitle = parsed.title || \"\";\n prBody = parsed.body || \"\";\n\n // Get diff between base and head\n const baseRef = parsed.baseRefName || \"main\";\n const headRef = parsed.headRefName || \"HEAD\";\n\n // Fetch the base branch to ensure we have it\n try {\n git(`fetch origin ${baseRef}`);\n } catch {\n // Branch might already exist locally\n }\n\n const range = `origin/${baseRef}...${headRef}`;\n const result = await analyzeDiff(range);\n\n // Override with PR-specific info\n result.title = prTitle || result.title;\n result.description = prBody\n ? `${prBody.slice(0, 200)}${prBody.length > 200 ? \"...\" : \"\"}`\n : result.description;\n result.source = {\n type: \"pr\",\n reference: `#${prNumber}`,\n url: prUrl || `${git(\"config --get remote.origin.url\").replace(/\\.git$/, \"\")}/pull/${prNumber}`,\n };\n\n return result;\n } catch {\n // GitHub CLI not available or PR not found, fall back to current branch diff\n }\n }\n\n // Fallback: analyze current branch against main/master\n const currentBranch = git(\"rev-parse --abbrev-ref HEAD\");\n let baseBranch = \"main\";\n\n try {\n git(\"rev-parse --verify main\");\n } catch {\n try {\n git(\"rev-parse --verify master\");\n baseBranch = \"master\";\n } catch {\n throw new Error(\"Could not find base branch (main or master)\");\n }\n }\n\n const range = `${baseBranch}...${currentBranch}`;\n const result = await analyzeDiff(range);\n\n result.source = {\n type: \"pr\",\n reference: prNumber ? `#${prNumber}` : currentBranch,\n url: prUrl,\n };\n\n return result;\n}\n","/**\n * Context Extractor\n *\n * Extracts meaningful context from code and technical artifacts.\n *\n * Features:\n * - Build context from multiple sources\n * - Identify key concepts and terminology\n * - Extract technical requirements\n * - Generate structured context for artifact generation\n */\n\nimport type { ArtifactContext } from \"../../shared/types.js\";\n\nexport interface ContextInput {\n files: string[];\n diff?: string;\n commits?: string[];\n prompt?: string;\n}\n\n/**\n * Merge multiple context objects into one\n */\nexport function mergeContexts(...contexts: Partial<ArtifactContext>[]): ArtifactContext {\n const merged: ArtifactContext = {\n summary: \"\",\n technicalDetails: [],\n affectedComponents: [],\n breakingChanges: false,\n keywords: [],\n };\n\n for (const ctx of contexts) {\n if (ctx.summary) {\n merged.summary = merged.summary\n ? `${merged.summary} ${ctx.summary}`\n : ctx.summary;\n }\n if (ctx.technicalDetails) {\n merged.technicalDetails.push(...ctx.technicalDetails);\n }\n if (ctx.affectedComponents) {\n merged.affectedComponents.push(...ctx.affectedComponents);\n }\n if (ctx.breakingChanges) {\n merged.breakingChanges = true;\n }\n if (ctx.keywords) {\n merged.keywords.push(...ctx.keywords);\n }\n }\n\n // Deduplicate arrays\n merged.technicalDetails = [...new Set(merged.technicalDetails)];\n merged.affectedComponents = [...new Set(merged.affectedComponents)];\n merged.keywords = [...new Set(merged.keywords)];\n\n return merged;\n}\n\n/**\n * Extract context from file paths\n */\nexport function extractContextFromPaths(paths: string[]): Partial<ArtifactContext> {\n const keywords = new Set<string>();\n const components = new Set<string>();\n\n for (const path of paths) {\n // Add the path as an affected component\n components.add(path);\n\n // Extract keywords from path segments\n const segments = path.split(\"/\").filter((s) => s && ![\"src\", \"lib\", \"dist\", \"index\"].includes(s));\n for (const segment of segments) {\n const words = segment\n .replace(/\\.(ts|tsx|js|jsx|vue|svelte|py|go|rs|java|rb)$/, \"\")\n .split(/[-_.]/)\n .filter((w) => w.length > 2);\n words.forEach((w) => keywords.add(w.toLowerCase()));\n }\n }\n\n return {\n affectedComponents: Array.from(components),\n keywords: Array.from(keywords),\n };\n}\n\n/**\n * Detect breaking changes from diff content\n */\nexport function detectBreakingChangesFromDiff(diff: string): boolean {\n const breakingPatterns = [\n /^-export\\s+/m, // Removed exports\n /^-\\s*public\\s+/m, // Removed public methods\n /BREAKING CHANGE/i,\n /\\bremoved\\b.*\\bapi\\b/i,\n /\\bdeprecated\\b/i,\n ];\n\n return breakingPatterns.some((pattern) => pattern.test(diff));\n}\n\n/**\n * Generate a technical summary from context\n */\nexport function generateTechnicalSummary(context: ArtifactContext): string {\n const parts: string[] = [];\n\n if (context.affectedComponents.length > 0) {\n parts.push(`Affects ${context.affectedComponents.length} component(s)`);\n }\n\n if (context.breakingChanges) {\n parts.push(\"includes breaking changes\");\n }\n\n if (context.keywords.length > 0) {\n parts.push(`related to: ${context.keywords.slice(0, 5).join(\", \")}`);\n }\n\n return parts.join(\"; \");\n}\n","/**\n * Artifact Generators\n *\n * Generates artifacts from analyzed code context.\n * Artifacts are high-level descriptions and guidelines that serve\n * as input for the final material generation.\n */\n\n// TODO: Implement artifact generators\nexport const artifactGenerator = {};\n","/**\n * Tool Definitions for the Detective Agent\n *\n * These are the OpenAI function calling definitions that describe\n * what tools the agent can use to explore a codebase.\n */\n\nimport type { ChatCompletionTool } from \"openai/resources/chat/completions\";\n\nexport const AGENT_TOOLS: ChatCompletionTool[] = [\n {\n type: \"function\",\n function: {\n name: \"search_files\",\n description:\n \"Search for files by name pattern or content. Use this to find files related to a feature, component, or concept. Returns file paths that match.\",\n parameters: {\n type: \"object\",\n properties: {\n query: {\n type: \"string\",\n description:\n \"Search query - can be a filename pattern (e.g., '*expense*', '*.schema.ts') or keywords to search in file content\",\n },\n searchIn: {\n type: \"string\",\n enum: [\"filename\", \"content\", \"both\"],\n description: \"Where to search: filename only, file content only, or both\",\n },\n fileTypes: {\n type: \"array\",\n items: { type: \"string\" },\n description:\n \"Optional file extensions to filter (e.g., ['.ts', '.tsx']). If not provided, searches all code files.\",\n },\n directory: {\n type: \"string\",\n description:\n \"Optional subdirectory to search in (relative to project root). If not provided, searches entire project.\",\n },\n },\n required: [\"query\", \"searchIn\"],\n },\n },\n },\n {\n type: \"function\",\n function: {\n name: \"read_file\",\n description:\n \"Read the contents of a specific file. Use this after finding a relevant file to understand its implementation, imports, exports, and logic.\",\n parameters: {\n type: \"object\",\n properties: {\n path: {\n type: \"string\",\n description: \"Path to the file (relative to project root)\",\n },\n startLine: {\n type: \"number\",\n description: \"Optional start line number (1-indexed) to read from\",\n },\n endLine: {\n type: \"number\",\n description: \"Optional end line number (1-indexed) to read to\",\n },\n },\n required: [\"path\"],\n },\n },\n },\n {\n type: \"function\",\n function: {\n name: \"find_references\",\n description:\n \"Find where a symbol (function, component, class, type, constant) is used/imported across the codebase. Critical for understanding how something is triggered or consumed.\",\n parameters: {\n type: \"object\",\n properties: {\n symbol: {\n type: \"string\",\n description:\n \"The symbol name to find references for (e.g., 'CreateExpenseModal', 'useAuth', 'ExpenseSchema')\",\n },\n type: {\n type: \"string\",\n enum: [\"import\", \"usage\", \"all\"],\n description:\n \"Type of references: 'import' finds import statements, 'usage' finds actual usage, 'all' finds both\",\n },\n },\n required: [\"symbol\", \"type\"],\n },\n },\n },\n {\n type: \"function\",\n function: {\n name: \"find_definition\",\n description:\n \"Find where a symbol is defined/exported. Use this to find the source definition of a type, function, or component.\",\n parameters: {\n type: \"object\",\n properties: {\n symbol: {\n type: \"string\",\n description: \"The symbol name to find the definition of\",\n },\n },\n required: [\"symbol\"],\n },\n },\n },\n {\n type: \"function\",\n function: {\n name: \"list_directory\",\n description:\n \"List files and subdirectories in a directory. Use this to explore the project structure and understand how code is organized.\",\n parameters: {\n type: \"object\",\n properties: {\n path: {\n type: \"string\",\n description:\n \"Directory path relative to project root. Use '.' or empty string for root.\",\n },\n recursive: {\n type: \"boolean\",\n description:\n \"If true, lists all files recursively (up to 3 levels deep). If false, only immediate children.\",\n },\n },\n required: [\"path\"],\n },\n },\n },\n {\n type: \"function\",\n function: {\n name: \"get_file_structure\",\n description:\n \"Analyze a file and extract its structure: imports, exports, functions, classes, types, and their relationships. Use this to quickly understand what a file provides and depends on.\",\n parameters: {\n type: \"object\",\n properties: {\n path: {\n type: \"string\",\n description: \"Path to the file to analyze\",\n },\n },\n required: [\"path\"],\n },\n },\n },\n {\n type: \"function\",\n function: {\n name: \"search_types\",\n description:\n \"Search for TypeScript/JavaScript type definitions, interfaces, schemas (Zod, Yup), or prop types. Useful for understanding data structures.\",\n parameters: {\n type: \"object\",\n properties: {\n query: {\n type: \"string\",\n description:\n \"Search query for types (e.g., 'Expense', 'CreditCard', 'FormData')\",\n },\n kind: {\n type: \"string\",\n enum: [\"interface\", \"type\", \"schema\", \"all\"],\n description:\n \"What kind of type definition to search for\",\n },\n },\n required: [\"query\", \"kind\"],\n },\n },\n },\n {\n type: \"function\",\n function: {\n name: \"complete_investigation\",\n description:\n \"Call this when you have gathered enough information to create a comprehensive artifact. Provide your findings structured for documentation generation.\",\n parameters: {\n type: \"object\",\n properties: {\n title: {\n type: \"string\",\n description: \"A clear, descriptive title for the feature/topic\",\n },\n summary: {\n type: \"string\",\n description:\n \"A 2-3 sentence summary explaining what this feature does from a user perspective\",\n },\n entryPoints: {\n type: \"array\",\n items: {\n type: \"object\",\n properties: {\n file: { type: \"string\" },\n component: { type: \"string\" },\n description: { type: \"string\" },\n },\n },\n description:\n \"The main entry points/components for this feature (e.g., the modal, page, or button that triggers it)\",\n },\n dataFlow: {\n type: \"array\",\n items: {\n type: \"object\",\n properties: {\n step: { type: \"number\" },\n description: { type: \"string\" },\n files: { type: \"array\", items: { type: \"string\" } },\n },\n },\n description:\n \"Step-by-step data flow explaining how the feature works\",\n },\n keyFiles: {\n type: \"array\",\n items: {\n type: \"object\",\n properties: {\n path: { type: \"string\" },\n purpose: { type: \"string\" },\n keyExports: { type: \"array\", items: { type: \"string\" } },\n },\n },\n description: \"The most important files for this feature\",\n },\n dataStructures: {\n type: \"array\",\n items: {\n type: \"object\",\n properties: {\n name: { type: \"string\" },\n file: { type: \"string\" },\n fields: { type: \"array\", items: { type: \"string\" } },\n description: { type: \"string\" },\n },\n },\n description:\n \"Key data structures (types, interfaces, schemas) used\",\n },\n usageExamples: {\n type: \"array\",\n items: {\n type: \"object\",\n properties: {\n description: { type: \"string\" },\n file: { type: \"string\" },\n codeSnippet: { type: \"string\" },\n },\n },\n description:\n \"Examples of how this feature is used in the codebase\",\n },\n relatedFeatures: {\n type: \"array\",\n items: { type: \"string\" },\n description:\n \"Other features or components that relate to this one\",\n },\n technicalNotes: {\n type: \"array\",\n items: { type: \"string\" },\n description:\n \"Important technical details, edge cases, or implementation notes\",\n },\n },\n required: [\n \"title\",\n \"summary\",\n \"entryPoints\",\n \"dataFlow\",\n \"keyFiles\",\n \"dataStructures\",\n ],\n },\n },\n },\n];\n\nexport type ToolName =\n | \"search_files\"\n | \"read_file\"\n | \"find_references\"\n | \"find_definition\"\n | \"list_directory\"\n | \"get_file_structure\"\n | \"search_types\"\n | \"complete_investigation\";\n","/**\n * Tool Implementations for the Detective Agent\n *\n * These are the actual implementations of the tools that the agent uses\n * to explore and understand a codebase.\n */\n\nimport { readFileSync, readdirSync, statSync, existsSync } from \"fs\";\nimport { join, relative, basename } from \"path\";\nimport { glob } from \"glob\";\nimport type { ToolName } from \"./definitions.js\";\n\nconst CODE_EXTENSIONS = [\n \".ts\",\n \".tsx\",\n \".js\",\n \".jsx\",\n \".vue\",\n \".svelte\",\n \".py\",\n \".go\",\n \".rs\",\n \".java\",\n \".rb\",\n \".json\",\n \".yaml\",\n \".yml\",\n];\n\nconst IGNORED_DIRS = [\n \"node_modules\",\n \".git\",\n \"dist\",\n \"build\",\n \".next\",\n \".nuxt\",\n \"coverage\",\n \".turbo\",\n \".cache\",\n \"__pycache__\",\n \".venv\",\n \"venv\",\n];\n\nexport interface ToolContext {\n projectRoot: string;\n}\n\nexport interface ToolResult {\n success: boolean;\n data?: unknown;\n error?: string;\n}\n\n/**\n * Search for files by name pattern or content\n */\nexport async function searchFiles(\n ctx: ToolContext,\n args: {\n query: string;\n searchIn: \"filename\" | \"content\" | \"both\";\n fileTypes?: string[];\n directory?: string;\n }\n): Promise<ToolResult> {\n const { query, searchIn, fileTypes, directory } = args;\n const searchRoot = directory ? join(ctx.projectRoot, directory) : ctx.projectRoot;\n\n if (!existsSync(searchRoot)) {\n return { success: false, error: `Directory not found: ${directory}` };\n }\n\n const results: Array<{ path: string; matches?: string[] }> = [];\n const lowerQuery = query.toLowerCase();\n\n // Build glob pattern for file types\n const extensions = fileTypes?.length ? fileTypes : CODE_EXTENSIONS;\n const patterns = extensions.map((ext) => `**/*${ext}`);\n\n try {\n for (const pattern of patterns) {\n const files = await glob(pattern, {\n cwd: searchRoot,\n ignore: IGNORED_DIRS.map((d) => `**/${d}/**`),\n nodir: true,\n absolute: false,\n });\n\n for (const file of files) {\n const fullPath = join(searchRoot, file);\n const relativePath = relative(ctx.projectRoot, fullPath);\n\n // Check filename match\n if (searchIn === \"filename\" || searchIn === \"both\") {\n const fileName = basename(file).toLowerCase();\n if (fileName.includes(lowerQuery) || matchGlob(fileName, query)) {\n if (!results.find((r) => r.path === relativePath)) {\n results.push({ path: relativePath });\n }\n continue;\n }\n }\n\n // Check content match\n if (searchIn === \"content\" || searchIn === \"both\") {\n try {\n const content = readFileSync(fullPath, \"utf-8\");\n const lines = content.split(\"\\n\");\n const matches: string[] = [];\n\n for (let i = 0; i < lines.length; i++) {\n if (lines[i].toLowerCase().includes(lowerQuery)) {\n matches.push(`L${i + 1}: ${lines[i].trim().slice(0, 100)}`);\n if (matches.length >= 5) break;\n }\n }\n\n if (matches.length > 0) {\n results.push({ path: relativePath, matches });\n }\n } catch {\n // Skip unreadable files\n }\n }\n }\n }\n\n // Sort by relevance (filename matches first, then by number of content matches)\n results.sort((a, b) => {\n if (!a.matches && b.matches) return -1;\n if (a.matches && !b.matches) return 1;\n if (a.matches && b.matches) return b.matches.length - a.matches.length;\n return 0;\n });\n\n return {\n success: true,\n data: {\n query,\n totalResults: results.length,\n results: results.slice(0, 20), // Limit results\n },\n };\n } catch (error) {\n return {\n success: false,\n error: `Search failed: ${error instanceof Error ? error.message : error}`,\n };\n }\n}\n\n/**\n * Simple glob matching for filename patterns\n */\nfunction matchGlob(filename: string, pattern: string): boolean {\n const regex = pattern\n .replace(/\\./g, \"\\\\.\")\n .replace(/\\*/g, \".*\")\n .replace(/\\?/g, \".\");\n return new RegExp(regex, \"i\").test(filename);\n}\n\n/**\n * Read a file's contents\n */\nexport async function readFile(\n ctx: ToolContext,\n args: { path: string; startLine?: number; endLine?: number }\n): Promise<ToolResult> {\n const { path: filePath, startLine, endLine } = args;\n const fullPath = join(ctx.projectRoot, filePath);\n\n if (!existsSync(fullPath)) {\n return { success: false, error: `File not found: ${filePath}` };\n }\n\n try {\n const content = readFileSync(fullPath, \"utf-8\");\n const lines = content.split(\"\\n\");\n\n const start = startLine ? Math.max(0, startLine - 1) : 0;\n const end = endLine ? Math.min(lines.length, endLine) : lines.length;\n\n const selectedLines = lines.slice(start, end);\n const numberedContent = selectedLines\n .map((line, i) => `${start + i + 1}| ${line}`)\n .join(\"\\n\");\n\n return {\n success: true,\n data: {\n path: filePath,\n totalLines: lines.length,\n linesShown: `${start + 1}-${end}`,\n content: numberedContent,\n },\n };\n } catch (error) {\n return {\n success: false,\n error: `Failed to read file: ${error instanceof Error ? error.message : error}`,\n };\n }\n}\n\n/**\n * Find references to a symbol across the codebase\n */\nexport async function findReferences(\n ctx: ToolContext,\n args: { symbol: string; type: \"import\" | \"usage\" | \"all\" }\n): Promise<ToolResult> {\n const { symbol, type } = args;\n const results: Array<{\n file: string;\n line: number;\n type: \"import\" | \"usage\";\n context: string;\n }> = [];\n\n // Build search patterns based on type\n const patterns: Array<{ regex: RegExp; type: \"import\" | \"usage\" }> = [];\n\n if (type === \"import\" || type === \"all\") {\n // Import patterns\n patterns.push(\n { regex: new RegExp(`import\\\\s+.*\\\\b${symbol}\\\\b.*from`, \"g\"), type: \"import\" },\n { regex: new RegExp(`import\\\\s+${symbol}\\\\s+from`, \"g\"), type: \"import\" },\n { regex: new RegExp(`from\\\\s+['\"][^'\"]+['\"].*\\\\b${symbol}\\\\b`, \"g\"), type: \"import\" },\n { regex: new RegExp(`require\\\\([^)]*${symbol}[^)]*\\\\)`, \"g\"), type: \"import\" }\n );\n }\n\n if (type === \"usage\" || type === \"all\") {\n // Usage patterns (component usage, function calls, type references)\n patterns.push(\n { regex: new RegExp(`<${symbol}[\\\\s/>]`, \"g\"), type: \"usage\" }, // JSX component\n { regex: new RegExp(`\\\\b${symbol}\\\\s*\\\\(`, \"g\"), type: \"usage\" }, // Function call\n { regex: new RegExp(`:\\\\s*${symbol}[\\\\s,;>]`, \"g\"), type: \"usage\" }, // Type annotation\n { regex: new RegExp(`extends\\\\s+${symbol}\\\\b`, \"g\"), type: \"usage\" }, // Class extends\n { regex: new RegExp(`implements\\\\s+${symbol}\\\\b`, \"g\"), type: \"usage\" } // Interface implements\n );\n }\n\n try {\n const files = await glob(\"**/*.{ts,tsx,js,jsx,vue,svelte}\", {\n cwd: ctx.projectRoot,\n ignore: IGNORED_DIRS.map((d) => `**/${d}/**`),\n nodir: true,\n });\n\n for (const file of files) {\n const fullPath = join(ctx.projectRoot, file);\n try {\n const content = readFileSync(fullPath, \"utf-8\");\n const lines = content.split(\"\\n\");\n\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i];\n for (const pattern of patterns) {\n if (pattern.regex.test(line)) {\n // Reset regex state\n pattern.regex.lastIndex = 0;\n results.push({\n file,\n line: i + 1,\n type: pattern.type,\n context: line.trim().slice(0, 150),\n });\n break; // Only count each line once\n }\n }\n }\n } catch {\n // Skip unreadable files\n }\n }\n\n // Group by file for cleaner output\n const groupedByFile = results.reduce(\n (acc, ref) => {\n if (!acc[ref.file]) acc[ref.file] = [];\n acc[ref.file].push(ref);\n return acc;\n },\n {} as Record<string, typeof results>\n );\n\n return {\n success: true,\n data: {\n symbol,\n totalReferences: results.length,\n fileCount: Object.keys(groupedByFile).length,\n references: groupedByFile,\n },\n };\n } catch (error) {\n return {\n success: false,\n error: `Failed to find references: ${error instanceof Error ? error.message : error}`,\n };\n }\n}\n\n/**\n * Find where a symbol is defined/exported\n */\nexport async function findDefinition(\n ctx: ToolContext,\n args: { symbol: string }\n): Promise<ToolResult> {\n const { symbol } = args;\n\n // Patterns that indicate a definition\n const definitionPatterns = [\n new RegExp(`export\\\\s+(?:default\\\\s+)?(?:async\\\\s+)?function\\\\s+${symbol}\\\\b`),\n new RegExp(`export\\\\s+(?:default\\\\s+)?class\\\\s+${symbol}\\\\b`),\n new RegExp(`export\\\\s+(?:const|let|var)\\\\s+${symbol}\\\\s*=`),\n new RegExp(`export\\\\s+(?:interface|type)\\\\s+${symbol}\\\\b`),\n new RegExp(`(?:const|let|var)\\\\s+${symbol}\\\\s*=.*(?:function|=>|class)`),\n new RegExp(`function\\\\s+${symbol}\\\\s*\\\\(`),\n new RegExp(`class\\\\s+${symbol}\\\\s*(?:extends|implements|\\\\{)`),\n new RegExp(`interface\\\\s+${symbol}\\\\s*(?:extends|\\\\{)`),\n new RegExp(`type\\\\s+${symbol}\\\\s*=`),\n new RegExp(`export\\\\s*\\\\{[^}]*\\\\b${symbol}\\\\b[^}]*\\\\}`), // Named export\n ];\n\n const results: Array<{\n file: string;\n line: number;\n definitionType: string;\n context: string;\n }> = [];\n\n try {\n const files = await glob(\"**/*.{ts,tsx,js,jsx}\", {\n cwd: ctx.projectRoot,\n ignore: IGNORED_DIRS.map((d) => `**/${d}/**`),\n nodir: true,\n });\n\n for (const file of files) {\n const fullPath = join(ctx.projectRoot, file);\n try {\n const content = readFileSync(fullPath, \"utf-8\");\n const lines = content.split(\"\\n\");\n\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i];\n for (const pattern of definitionPatterns) {\n if (pattern.test(line)) {\n // Determine definition type\n let defType = \"unknown\";\n if (/function/.test(line)) defType = \"function\";\n else if (/class/.test(line)) defType = \"class\";\n else if (/interface/.test(line)) defType = \"interface\";\n else if (/type\\s+\\w+\\s*=/.test(line)) defType = \"type\";\n else if (/const|let|var/.test(line)) defType = \"variable\";\n else if (/export\\s*\\{/.test(line)) defType = \"re-export\";\n\n results.push({\n file,\n line: i + 1,\n definitionType: defType,\n context: lines.slice(i, Math.min(i + 5, lines.length)).join(\"\\n\").slice(0, 300),\n });\n break;\n }\n }\n }\n } catch {\n // Skip unreadable files\n }\n }\n\n return {\n success: true,\n data: {\n symbol,\n definitionsFound: results.length,\n definitions: results,\n },\n };\n } catch (error) {\n return {\n success: false,\n error: `Failed to find definition: ${error instanceof Error ? error.message : error}`,\n };\n }\n}\n\n/**\n * List directory contents\n */\nexport async function listDirectory(\n ctx: ToolContext,\n args: { path: string; recursive?: boolean }\n): Promise<ToolResult> {\n const { path: dirPath, recursive } = args;\n const fullPath = dirPath ? join(ctx.projectRoot, dirPath) : ctx.projectRoot;\n\n if (!existsSync(fullPath)) {\n return { success: false, error: `Directory not found: ${dirPath}` };\n }\n\n try {\n const stat = statSync(fullPath);\n if (!stat.isDirectory()) {\n return { success: false, error: `Not a directory: ${dirPath}` };\n }\n\n const items: Array<{ path: string; type: \"file\" | \"directory\"; size?: number }> = [];\n\n function listDir(dir: string, depth: number) {\n if (depth > 3) return; // Max depth\n\n const entries = readdirSync(dir);\n for (const entry of entries) {\n if (IGNORED_DIRS.includes(entry) || entry.startsWith(\".\")) continue;\n\n const entryPath = join(dir, entry);\n const relativePath = relative(ctx.projectRoot, entryPath);\n\n try {\n const entryStat = statSync(entryPath);\n if (entryStat.isDirectory()) {\n items.push({ path: relativePath, type: \"directory\" });\n if (recursive) {\n listDir(entryPath, depth + 1);\n }\n } else if (entryStat.isFile()) {\n items.push({ path: relativePath, type: \"file\", size: entryStat.size });\n }\n } catch {\n // Skip inaccessible entries\n }\n }\n }\n\n listDir(fullPath, 0);\n\n // Sort: directories first, then files\n items.sort((a, b) => {\n if (a.type !== b.type) return a.type === \"directory\" ? -1 : 1;\n return a.path.localeCompare(b.path);\n });\n\n return {\n success: true,\n data: {\n path: dirPath || \".\",\n totalItems: items.length,\n items: items.slice(0, 100), // Limit results\n },\n };\n } catch (error) {\n return {\n success: false,\n error: `Failed to list directory: ${error instanceof Error ? error.message : error}`,\n };\n }\n}\n\n/**\n * Get structured analysis of a file\n */\nexport async function getFileStructure(\n ctx: ToolContext,\n args: { path: string }\n): Promise<ToolResult> {\n const { path: filePath } = args;\n const fullPath = join(ctx.projectRoot, filePath);\n\n if (!existsSync(fullPath)) {\n return { success: false, error: `File not found: ${filePath}` };\n }\n\n try {\n const content = readFileSync(fullPath, \"utf-8\");\n\n const structure = {\n imports: [] as Array<{ from: string; imports: string[] }>,\n exports: [] as Array<{ name: string; type: string; line: number }>,\n functions: [] as Array<{ name: string; line: number; async: boolean }>,\n classes: [] as Array<{ name: string; line: number; extends?: string }>,\n types: [] as Array<{ name: string; line: number; kind: \"type\" | \"interface\" }>,\n components: [] as Array<{ name: string; line: number; props?: string }>,\n };\n\n const lines = content.split(\"\\n\");\n\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i];\n const lineNum = i + 1;\n\n // Parse imports\n const importMatch = line.match(\n /import\\s+(?:type\\s+)?(?:\\{([^}]+)\\}|(\\w+))\\s+from\\s+['\"]([^'\"]+)['\"]/\n );\n if (importMatch) {\n const imports = importMatch[1]\n ? importMatch[1].split(\",\").map((s) => s.trim().split(\" as \")[0])\n : [importMatch[2]];\n structure.imports.push({ from: importMatch[3], imports: imports.filter(Boolean) });\n }\n\n // Parse exports\n const exportMatch = line.match(\n /export\\s+(?:default\\s+)?(?:async\\s+)?(function|class|const|let|var|interface|type)\\s+(\\w+)/\n );\n if (exportMatch) {\n structure.exports.push({ name: exportMatch[2], type: exportMatch[1], line: lineNum });\n }\n\n // Parse functions\n const funcMatch = line.match(\n /(?:export\\s+)?(?:default\\s+)?(async\\s+)?function\\s+(\\w+)/\n );\n if (funcMatch) {\n structure.functions.push({\n name: funcMatch[2],\n line: lineNum,\n async: !!funcMatch[1],\n });\n }\n\n // Parse arrow functions assigned to const\n const arrowMatch = line.match(\n /(?:export\\s+)?const\\s+(\\w+)\\s*=\\s*(async\\s+)?(?:\\([^)]*\\)|[^=])\\s*=>/\n );\n if (arrowMatch) {\n structure.functions.push({\n name: arrowMatch[1],\n line: lineNum,\n async: !!arrowMatch[2],\n });\n }\n\n // Parse classes\n const classMatch = line.match(\n /(?:export\\s+)?(?:default\\s+)?class\\s+(\\w+)(?:\\s+extends\\s+(\\w+))?/\n );\n if (classMatch) {\n structure.classes.push({\n name: classMatch[1],\n line: lineNum,\n extends: classMatch[2],\n });\n }\n\n // Parse types/interfaces\n const typeMatch = line.match(\n /(?:export\\s+)?(interface|type)\\s+(\\w+)/\n );\n if (typeMatch) {\n structure.types.push({\n name: typeMatch[2],\n line: lineNum,\n kind: typeMatch[1] as \"type\" | \"interface\",\n });\n }\n\n // Parse React components (function components)\n if (\n line.match(/(?:export\\s+)?(?:default\\s+)?(?:const|function)\\s+([A-Z]\\w+)/) &&\n (content.includes(\"React\") || content.includes(\"jsx\") || filePath.endsWith(\".tsx\"))\n ) {\n const compMatch = line.match(/(?:const|function)\\s+([A-Z]\\w+)/);\n if (compMatch) {\n // Check for props type\n const propsMatch = line.match(/:\\s*(?:React\\.)?FC<(\\w+)>|props:\\s*(\\w+)/);\n structure.components.push({\n name: compMatch[1],\n line: lineNum,\n props: propsMatch ? propsMatch[1] || propsMatch[2] : undefined,\n });\n }\n }\n }\n\n return {\n success: true,\n data: {\n path: filePath,\n structure,\n },\n };\n } catch (error) {\n return {\n success: false,\n error: `Failed to analyze file: ${error instanceof Error ? error.message : error}`,\n };\n }\n}\n\n/**\n * Search for type definitions\n */\nexport async function searchTypes(\n ctx: ToolContext,\n args: { query: string; kind: \"interface\" | \"type\" | \"schema\" | \"all\" }\n): Promise<ToolResult> {\n const { query, kind } = args;\n\n const results: Array<{\n name: string;\n file: string;\n line: number;\n kind: string;\n preview: string;\n }> = [];\n\n // Patterns based on kind\n const patterns: RegExp[] = [];\n if (kind === \"interface\" || kind === \"all\") {\n patterns.push(new RegExp(`interface\\\\s+(\\\\w*${query}\\\\w*)`, \"gi\"));\n }\n if (kind === \"type\" || kind === \"all\") {\n patterns.push(new RegExp(`type\\\\s+(\\\\w*${query}\\\\w*)\\\\s*=`, \"gi\"));\n }\n if (kind === \"schema\" || kind === \"all\") {\n // Zod, Yup, and other schema patterns\n patterns.push(new RegExp(`(?:const|export\\\\s+const)\\\\s+(\\\\w*${query}\\\\w*Schema)\\\\s*=`, \"gi\"));\n patterns.push(new RegExp(`z\\\\.object.*${query}`, \"gi\"));\n }\n\n try {\n const files = await glob(\"**/*.{ts,tsx,js,jsx}\", {\n cwd: ctx.projectRoot,\n ignore: IGNORED_DIRS.map((d) => `**/${d}/**`),\n nodir: true,\n });\n\n for (const file of files) {\n const fullPath = join(ctx.projectRoot, file);\n try {\n const content = readFileSync(fullPath, \"utf-8\");\n const lines = content.split(\"\\n\");\n\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i];\n\n for (const pattern of patterns) {\n const match = pattern.exec(line);\n if (match) {\n pattern.lastIndex = 0; // Reset\n\n // Get more context (the full type definition if small)\n const preview = lines.slice(i, Math.min(i + 10, lines.length)).join(\"\\n\").slice(0, 400);\n\n let detectedKind = \"type\";\n if (/interface/.test(line)) detectedKind = \"interface\";\n else if (/Schema/.test(line) || /z\\./.test(line)) detectedKind = \"schema\";\n\n results.push({\n name: match[1] || query,\n file,\n line: i + 1,\n kind: detectedKind,\n preview,\n });\n break;\n }\n }\n }\n } catch {\n // Skip unreadable files\n }\n }\n\n return {\n success: true,\n data: {\n query,\n kind,\n totalResults: results.length,\n results: results.slice(0, 15),\n },\n };\n } catch (error) {\n return {\n success: false,\n error: `Failed to search types: ${error instanceof Error ? error.message : error}`,\n };\n }\n}\n\n/**\n * Execute a tool by name\n */\nexport async function executeTool(\n toolName: ToolName,\n args: Record<string, unknown>,\n ctx: ToolContext\n): Promise<ToolResult> {\n switch (toolName) {\n case \"search_files\":\n return searchFiles(ctx, args as Parameters<typeof searchFiles>[1]);\n case \"read_file\":\n return readFile(ctx, args as Parameters<typeof readFile>[1]);\n case \"find_references\":\n return findReferences(ctx, args as Parameters<typeof findReferences>[1]);\n case \"find_definition\":\n return findDefinition(ctx, args as Parameters<typeof findDefinition>[1]);\n case \"list_directory\":\n return listDirectory(ctx, args as Parameters<typeof listDirectory>[1]);\n case \"get_file_structure\":\n return getFileStructure(ctx, args as Parameters<typeof getFileStructure>[1]);\n case \"search_types\":\n return searchTypes(ctx, args as Parameters<typeof searchTypes>[1]);\n case \"complete_investigation\":\n // This is handled specially by the agent\n return { success: true, data: args };\n default:\n return { success: false, error: `Unknown tool: ${toolName}` };\n }\n}\n","/**\n * The Detective Agent\n *\n * An AI agent that explores codebases to understand features, flows, and implementations.\n * Uses tools to navigate code rather than trying to read everything at once.\n */\n\nimport OpenAI from \"openai\";\nimport type {\n ChatCompletionMessageParam,\n ChatCompletionToolMessageParam,\n} from \"openai/resources/chat/completions\";\nimport { AGENT_TOOLS, type ToolName } from \"./tools/definitions.js\";\nimport { executeTool, type ToolContext, type ToolResult } from \"./tools/implementations.js\";\n\nconst SYSTEM_PROMPT = `You are \"The Detective\" - an expert code analyst who explores codebases methodically to understand features and implementations.\n\nYour mission is to investigate a codebase based on a user's query and produce a comprehensive understanding of how a feature works.\n\n## Investigation Strategy\n\n1. **Start Broad**: Begin by searching for files related to the query keywords. Look for obvious matches first.\n\n2. **Follow the Trail**: When you find a relevant file:\n - Read it to understand what it does\n - Look at its imports to find dependencies\n - Find where it's exported/used to understand how it fits in\n\n3. **Find Entry Points**: Always identify HOW a feature is triggered:\n - Is it a page/route?\n - Is it a component triggered by user action?\n - Is it an API endpoint?\n - Find the \"beginning\" of the user journey\n\n4. **Trace Data Flow**: Understand:\n - What data does the feature work with? (types, schemas)\n - Where does data come from? (API, props, state)\n - Where does data go? (mutations, API calls, state updates)\n\n5. **Find Usage Examples**: Search for where components/functions are actually used. This shows real-world integration.\n\n6. **Document Technical Details**: Note any important patterns, validations, error handling, or edge cases.\n\n## Efficiency Rules (Important)\n\n- Be efficient: use as few tools as possible (aim for 8-12 tool calls).\n- Prefer targeted \\`search_files\\` in content or filename over broad directory listing.\n- Read only the most relevant files; avoid reading the same file multiple times.\n- If you have enough information to explain the feature, **complete the investigation** even if some sections are partial.\n- Use empty arrays for unknown sections rather than continuing to search.\n\n## Tool Usage Tips\n\n- Use \\`search_files\\` with searchIn=\"filename\" first for broad discovery\n- Use \\`search_files\\` with searchIn=\"content\" when looking for specific patterns\n- Use \\`get_file_structure\\` to quickly understand a file's purpose without reading everything\n- Use \\`find_references\\` to understand how something is used/triggered\n- Use \\`find_definition\\` when you see an import and need to find the source\n- Use \\`search_types\\` to find data structures and schemas\n- Use \\`read_file\\` to examine specific implementation details\n\n## Investigation Rules\n\n1. Be thorough but efficient - don't read every file, use structure analysis first\n2. Always find at least ONE usage example of the main component/function\n3. Always identify the data types/schemas involved\n4. Focus on answering: \"If I were a new developer, what would I need to know to work on this?\"\n5. When you have enough information, call \\`complete_investigation\\` with your structured findings\n\n## Output Quality\n\nYour final investigation should enable someone to:\n- Understand what the feature does (user perspective)\n- Know which files to look at\n- Understand the data flow\n- See real usage examples\n- Know about edge cases or important details`;\n\nexport interface DetectiveOptions {\n projectRoot: string;\n verbose?: boolean;\n maxIterations?: number;\n maxToolCalls?: number;\n onToolCall?: (toolName: string, args: unknown) => void;\n onToolResult?: (toolName: string, result: ToolResult) => void;\n onThinking?: (thought: string) => void;\n}\n\nexport interface InvestigationResult {\n success: boolean;\n title?: string;\n summary?: string;\n entryPoints?: Array<{ file: string; component: string; description: string }>;\n dataFlow?: Array<{ step: number; description: string; files: string[] }>;\n keyFiles?: Array<{ path: string; purpose: string; keyExports: string[] }>;\n dataStructures?: Array<{\n name: string;\n file: string;\n fields: string[];\n description: string;\n }>;\n usageExamples?: Array<{ description: string; file: string; codeSnippet: string }>;\n relatedFeatures?: string[];\n technicalNotes?: string[];\n error?: string;\n toolCalls?: number;\n}\n\n/**\n * The Detective Agent - explores a codebase to understand a feature\n */\nexport class DetectiveAgent {\n private openai: OpenAI;\n private context: ToolContext;\n private options: DetectiveOptions;\n private messages: ChatCompletionMessageParam[];\n private toolCallCount: number = 0;\n\n constructor(options: DetectiveOptions) {\n const apiKey = process.env.OPENAI_API_KEY;\n if (!apiKey) {\n throw new Error(\n \"Missing OPENAI_API_KEY environment variable.\\n\" +\n \"Set it to use the Detective agent for code exploration.\"\n );\n }\n\n this.openai = new OpenAI({ apiKey });\n this.context = { projectRoot: options.projectRoot };\n this.options = {\n maxIterations: 25,\n maxToolCalls: 18,\n ...options,\n };\n this.messages = [{ role: \"system\", content: SYSTEM_PROMPT }];\n }\n\n /**\n * Run an investigation based on a user query\n */\n async investigate(query: string): Promise<InvestigationResult> {\n // Add the user's query\n this.messages.push({\n role: \"user\",\n content: `Investigate the following topic in the codebase:\\n\\n\"${query}\"\\n\\nUse the available tools to explore the codebase, understand the feature, and then call complete_investigation with your findings.`,\n });\n\n let iterations = 0;\n const maxIterations = this.options.maxIterations!;\n const maxToolCalls = this.options.maxToolCalls!;\n\n while (iterations < maxIterations) {\n iterations++;\n\n try {\n const shouldForceCompletion =\n this.toolCallCount >= maxToolCalls || iterations === maxIterations;\n\n if (shouldForceCompletion) {\n this.messages.push({\n role: \"user\",\n content:\n \"Finalize the investigation now using ONLY the information already gathered. \" +\n \"Do not call any tools except complete_investigation. \" +\n \"Use empty arrays for any section you could not verify.\",\n });\n }\n\n const tools = shouldForceCompletion\n ? AGENT_TOOLS.filter((tool) => tool.function.name === \"complete_investigation\")\n : AGENT_TOOLS;\n\n const response = await this.openai.chat.completions.create({\n model: \"gpt-5.2\",\n messages: this.messages,\n tools,\n tool_choice: shouldForceCompletion ? \"required\" : \"auto\",\n temperature: 0.1,\n });\n\n const message = response.choices[0].message;\n\n // Add assistant message to history\n this.messages.push(message);\n\n // If there's thinking/content, log it\n if (message.content && this.options.onThinking) {\n this.options.onThinking(message.content);\n }\n\n let toolCalls = message.tool_calls;\n\n // Check if we're done (no tool calls)\n if (!toolCalls || toolCalls.length === 0) {\n if (!shouldForceCompletion) {\n // Try one last time to force a completion with existing context\n this.messages.push({\n role: \"user\",\n content:\n \"Complete the investigation now using the current context. \" +\n \"Call complete_investigation with best-effort details and empty arrays where needed.\",\n });\n\n const forced = await this.openai.chat.completions.create({\n model: \"gpt-5.2\",\n messages: this.messages,\n tools: AGENT_TOOLS.filter((tool) => tool.function.name === \"complete_investigation\"),\n tool_choice: \"required\",\n temperature: 0.1,\n });\n\n const forcedMessage = forced.choices[0].message;\n this.messages.push(forcedMessage);\n\n if (forcedMessage.tool_calls && forcedMessage.tool_calls.length > 0) {\n // Handle forced completion tool calls below\n toolCalls = forcedMessage.tool_calls;\n } else {\n return {\n success: false,\n error: forcedMessage.content\n ? `Agent finished without tool calls: ${forcedMessage.content}`\n : \"Agent finished without completing investigation\",\n toolCalls: this.toolCallCount,\n };\n }\n } else {\n return {\n success: false,\n error: message.content\n ? `Agent finished without tool calls: ${message.content}`\n : \"Agent finished without completing investigation\",\n toolCalls: this.toolCallCount,\n };\n }\n }\n\n // Process tool calls\n const toolResults: ChatCompletionToolMessageParam[] = [];\n\n for (const toolCall of toolCalls ?? []) {\n const toolName = toolCall.function.name as ToolName;\n let args: Record<string, unknown>;\n\n try {\n args = JSON.parse(toolCall.function.arguments);\n } catch {\n args = {};\n }\n\n this.toolCallCount++;\n\n // Notify about tool call\n if (this.options.onToolCall) {\n this.options.onToolCall(toolName, args);\n }\n\n // Check if this is the completion tool\n if (toolName === \"complete_investigation\") {\n if (this.options.onToolResult) {\n this.options.onToolResult(toolName, { success: true, data: args });\n }\n\n return {\n success: true,\n title: args.title as string,\n summary: args.summary as string,\n entryPoints: args.entryPoints as InvestigationResult[\"entryPoints\"],\n dataFlow: args.dataFlow as InvestigationResult[\"dataFlow\"],\n keyFiles: args.keyFiles as InvestigationResult[\"keyFiles\"],\n dataStructures: args.dataStructures as InvestigationResult[\"dataStructures\"],\n usageExamples: args.usageExamples as InvestigationResult[\"usageExamples\"],\n relatedFeatures: args.relatedFeatures as string[],\n technicalNotes: args.technicalNotes as string[],\n toolCalls: this.toolCallCount,\n };\n }\n\n // Execute the tool\n const result = await executeTool(toolName, args, this.context);\n\n // Notify about result\n if (this.options.onToolResult) {\n this.options.onToolResult(toolName, result);\n }\n\n toolResults.push({\n role: \"tool\",\n tool_call_id: toolCall.id,\n content: JSON.stringify(result),\n });\n }\n\n // Add all tool results to messages\n this.messages.push(...toolResults);\n } catch (error) {\n return {\n success: false,\n error: `Agent error: ${error instanceof Error ? error.message : error}`,\n toolCalls: this.toolCallCount,\n };\n }\n }\n\n return {\n success: false,\n error: `Investigation exceeded maximum iterations (${maxIterations})`,\n toolCalls: this.toolCallCount,\n };\n }\n}\n\n/**\n * Create and run a detective investigation\n */\nexport async function investigateFeature(\n query: string,\n options: Omit<DetectiveOptions, \"projectRoot\"> & { projectRoot?: string }\n): Promise<InvestigationResult> {\n const projectRoot = options.projectRoot || getProjectRoot();\n\n const agent = new DetectiveAgent({\n ...options,\n projectRoot,\n });\n\n return agent.investigate(query);\n}\n\n/**\n * Get the project root directory\n */\nfunction getProjectRoot(): string {\n try {\n const { execSync } = require(\"child_process\");\n return execSync(\"git rev-parse --show-toplevel\", { encoding: \"utf-8\" }).trim();\n } catch {\n return process.cwd();\n }\n}\n"]}
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Shared Types for Visible CLI
3
+ *
4
+ * Types related to artifacts generated from code analysis.
5
+ * (Vendored from @visible/shared for standalone package)
6
+ */
7
+ /**
8
+ * Represents an artifact generated from code analysis.
9
+ * An artifact contains high-level descriptions and guidelines
10
+ * that serve as input for final material generation.
11
+ */
12
+ interface Artifact {
13
+ id: string;
14
+ title: string;
15
+ description: string;
16
+ source: ArtifactSource;
17
+ context: ArtifactContext;
18
+ guidelines: string[];
19
+ createdAt: Date;
20
+ updatedAt: Date;
21
+ }
22
+ /**
23
+ * The source of the artifact (PR, commit, code section, etc.)
24
+ */
25
+ interface ArtifactSource {
26
+ type: "pr" | "commit" | "code-section" | "repository";
27
+ reference: string;
28
+ url?: string;
29
+ }
30
+ /**
31
+ * Context extracted from the code analysis
32
+ */
33
+ interface ArtifactContext {
34
+ summary: string;
35
+ technicalDetails: string[];
36
+ affectedComponents: string[];
37
+ breakingChanges: boolean;
38
+ keywords: string[];
39
+ }
40
+ /**
41
+ * Status of an artifact
42
+ */
43
+ type ArtifactStatus = "draft" | "ready" | "generating" | "completed";
44
+ /**
45
+ * Input for creating a new artifact (from CLI)
46
+ */
47
+ interface CreateArtifactInput {
48
+ title: string;
49
+ description: string;
50
+ source: ArtifactSource;
51
+ context: ArtifactContext;
52
+ guidelines: string[];
53
+ }
54
+ /**
55
+ * Response after creating an artifact
56
+ */
57
+ interface CreateArtifactResponse {
58
+ id: string;
59
+ url: string;
60
+ }
61
+
62
+ export type { ArtifactSource as A, CreateArtifactInput as C, ArtifactContext as a, Artifact as b, ArtifactStatus as c, CreateArtifactResponse as d };
@@ -0,0 +1,2 @@
1
+
2
+ export { }