src.core.code_analyzer module#
Code Analyzer for GitHub Integration.
This module analyzes code changes, PRs, and repository state to provide context-aware information to workers about implemented features.
- class src.core.code_analyzer.CodeAnalyzer[source]#
Bases:
objectAnalyzes code changes and provides insights for task coordination.
This class provides functionality to analyze GitHub repositories, PRs, and code changes to help coordinate tasks between workers by understanding what features have been implemented.
- mcp_caller#
Function to call GitHub MCP tools for API interactions
- Type:
Optional[callable]
Examples
>>> analyzer = CodeAnalyzer(mcp_caller=github_client) >>> details = await analyzer.get_implementation_details( ... "owner", "repo", "endpoints" ... )
- async analyze_task_completion(task, worker, owner, repo)[source]#
Analyze what was accomplished when a task is completed.
Examines commits, PRs, and code changes to understand what was implemented and generate recommendations for subsequent workers.
- Parameters:
task (
Task) – The completed task to analyzeworker (
WorkerStatus) – The worker who completed the taskowner (
str) – GitHub repository owner username or organizationrepo (
str) – GitHub repository name
- Returns:
Analysis containing: - task_id: ID of the analyzed task - task_name: Name of the task - worker_id: ID of the worker - findings: Dict with commits, PRs, and implementations - recommendations: List of recommendations for next workers
- Return type:
Examples
>>> analysis = await analyzer.analyze_task_completion( ... task, worker, "myorg", "myrepo" ... ) >>> print(analysis["recommendations"])
- async get_implementation_details(owner, repo, feature_type)[source]#
Get details about existing implementations in the repository.
Searches for and analyzes specific types of implementations to help workers understand the current codebase state.
- Parameters:
- Returns:
Dictionary containing: - feature_type: The requested feature type - implementations: List of found implementations
- Return type:
Examples
>>> details = await analyzer.get_implementation_details( ... "owner", "repo", "endpoints" ... ) >>> for endpoint in details["implementations"]: ... print(f"{endpoint['method']} {endpoint['path']}")