Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -517,747 +517,3 @@ if __name__ == "__main__":
|
|
| 517 |
|
| 518 |
|
| 519 |
|
| 520 |
-
# import gradio as gr
|
| 521 |
-
# import google.generativeai as genai
|
| 522 |
-
# import os
|
| 523 |
-
# from dotenv import load_dotenv
|
| 524 |
-
# from github import Github
|
| 525 |
-
# import json
|
| 526 |
-
# from pathlib import Path
|
| 527 |
-
# from datetime import datetime
|
| 528 |
-
# from collections import defaultdict
|
| 529 |
-
# import base64
|
| 530 |
-
# from typing import Dict, List, Any, Optional, Tuple
|
| 531 |
-
# import tempfile
|
| 532 |
-
# from tenacity import retry, stop_after_attempt, wait_exponential, retry_if_exception_type
|
| 533 |
-
# import time
|
| 534 |
-
# import os
|
| 535 |
-
# import re
|
| 536 |
-
# from fpdf import FPDF
|
| 537 |
-
# import requests
|
| 538 |
-
|
| 539 |
-
|
| 540 |
-
|
| 541 |
-
# # Load environment variables
|
| 542 |
-
# load_dotenv()
|
| 543 |
-
|
| 544 |
-
# # Configure API keys
|
| 545 |
-
# GITHUB_TOKEN = os.getenv("github_api")
|
| 546 |
-
# GEMINI_API_KEY = os.getenv("gemini_api")
|
| 547 |
-
|
| 548 |
-
# if not GITHUB_TOKEN or not GEMINI_API_KEY:
|
| 549 |
-
# raise ValueError("Both GITHUB_TOKEN and GEMINI_API_KEY must be set in environment")
|
| 550 |
-
|
| 551 |
-
# # Initialize APIs
|
| 552 |
-
# gh = Github(GITHUB_TOKEN)
|
| 553 |
-
# genai.configure(api_key=GEMINI_API_KEY)
|
| 554 |
-
# model = genai.GenerativeModel(
|
| 555 |
-
# model_name="gemini-1.5-pro-latest",
|
| 556 |
-
# generation_config = {
|
| 557 |
-
# "temperature": 1,
|
| 558 |
-
# "top_p": 0.95,
|
| 559 |
-
# "top_k": 40,
|
| 560 |
-
# "max_output_tokens": 8192,
|
| 561 |
-
# "response_mime_type": "text/plain",
|
| 562 |
-
# },
|
| 563 |
-
|
| 564 |
-
# safety_settings=[
|
| 565 |
-
# {
|
| 566 |
-
# "category": "HARM_CATEGORY_HARASSMENT",
|
| 567 |
-
# "threshold": "BLOCK_MEDIUM_AND_ABOVE"
|
| 568 |
-
# },
|
| 569 |
-
# {
|
| 570 |
-
# "category": "HARM_CATEGORY_HATE_SPEECH",
|
| 571 |
-
# "threshold": "BLOCK_MEDIUM_AND_ABOVE"
|
| 572 |
-
# },
|
| 573 |
-
# {
|
| 574 |
-
# "category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",
|
| 575 |
-
# "threshold": "BLOCK_MEDIUM_AND_ABOVE"
|
| 576 |
-
# },
|
| 577 |
-
# {
|
| 578 |
-
# "category": "HARM_CATEGORY_DANGEROUS_CONTENT",
|
| 579 |
-
# "threshold": "BLOCK_MEDIUM_AND_ABOVE"
|
| 580 |
-
# },
|
| 581 |
-
# ]
|
| 582 |
-
# )
|
| 583 |
-
|
| 584 |
-
# RELEVANT_EXTENSIONS = {
|
| 585 |
-
# ".py", ".js", ".ts", ".jsx", ".tsx", ".java", ".cpp", ".c", ".h",
|
| 586 |
-
# ".hpp", ".rb", ".php", ".go", ".rs", ".swift", ".kt"
|
| 587 |
-
# }
|
| 588 |
-
|
| 589 |
-
# class RepositoryAnalyzer:
|
| 590 |
-
# """Handles GitHub repository analysis"""
|
| 591 |
-
|
| 592 |
-
# def __init__(self, repo_url: str):
|
| 593 |
-
# # Extract owner and repo name from URL
|
| 594 |
-
# parts = repo_url.rstrip('/').split('/')
|
| 595 |
-
# if len(parts) < 2:
|
| 596 |
-
# raise ValueError("Invalid repository URL format")
|
| 597 |
-
|
| 598 |
-
# self.repo_name = parts[-1]
|
| 599 |
-
# self.owner = parts[-2]
|
| 600 |
-
# self.repo = gh.get_repo(f"{self.owner}/{self.repo_name}")
|
| 601 |
-
# self.analysis_data: Dict[str, Any] = {}
|
| 602 |
-
|
| 603 |
-
# def analyze(self) -> Dict[str, Any]:
|
| 604 |
-
# """Perform complete repository analysis"""
|
| 605 |
-
# try:
|
| 606 |
-
# # Basic repository information
|
| 607 |
-
# self.analysis_data["basic_info"] = {
|
| 608 |
-
# "name": self.repo.name,
|
| 609 |
-
# "owner": self.repo.owner.login,
|
| 610 |
-
# "description": self.repo.description or "No description available",
|
| 611 |
-
# "stars": self.repo.stargazers_count,
|
| 612 |
-
# "forks": self.repo.forks_count,
|
| 613 |
-
# "created_at": self.repo.created_at.isoformat(),
|
| 614 |
-
# "last_updated": self.repo.updated_at.isoformat(),
|
| 615 |
-
# "primary_language": self.repo.language or "Not specified",
|
| 616 |
-
# }
|
| 617 |
-
|
| 618 |
-
# # Analyze repository structure
|
| 619 |
-
# self.analysis_data["structure"] = self._analyze_structure()
|
| 620 |
-
|
| 621 |
-
# # Analyze code patterns
|
| 622 |
-
# self.analysis_data["code_patterns"] = self._analyze_code_patterns()
|
| 623 |
-
|
| 624 |
-
# # Analyze commit history
|
| 625 |
-
# self.analysis_data["commit_history"] = self._analyze_commits()
|
| 626 |
-
|
| 627 |
-
# # Get contributor statistics
|
| 628 |
-
# self.analysis_data["contributors"] = self._analyze_contributors()
|
| 629 |
-
|
| 630 |
-
# return self.analysis_data
|
| 631 |
-
|
| 632 |
-
# except Exception as e:
|
| 633 |
-
# raise Exception(f"Error analyzing repository: {str(e)}")
|
| 634 |
-
|
| 635 |
-
# def _analyze_structure(self) -> Dict[str, Any]:
|
| 636 |
-
# """Analyze repository structure and organization"""
|
| 637 |
-
# structure = {
|
| 638 |
-
# "files": defaultdict(int),
|
| 639 |
-
# "directories": set(),
|
| 640 |
-
# "total_size": 0,
|
| 641 |
-
# }
|
| 642 |
-
|
| 643 |
-
# try:
|
| 644 |
-
# contents = self.repo.get_contents("")
|
| 645 |
-
# while contents:
|
| 646 |
-
# content = contents.pop(0)
|
| 647 |
-
# if content.type == "dir":
|
| 648 |
-
# structure["directories"].add(content.path)
|
| 649 |
-
# contents.extend(self.repo.get_contents(content.path))
|
| 650 |
-
# else:
|
| 651 |
-
# ext = Path(content.path).suffix.lower()
|
| 652 |
-
# if ext in RELEVANT_EXTENSIONS:
|
| 653 |
-
# structure["files"][ext] += 1
|
| 654 |
-
# structure["total_size"] += content.size
|
| 655 |
-
# except Exception as e:
|
| 656 |
-
# print(f"Error analyzing structure: {str(e)}")
|
| 657 |
-
|
| 658 |
-
# return {
|
| 659 |
-
# "file_types": dict(structure["files"]),
|
| 660 |
-
# "directory_count": len(structure["directories"]),
|
| 661 |
-
# "total_size": structure["total_size"],
|
| 662 |
-
# "file_count": sum(structure["files"].values())
|
| 663 |
-
# }
|
| 664 |
-
|
| 665 |
-
# def _analyze_code_patterns(self) -> Dict[str, Any]:
|
| 666 |
-
# """Analyze code patterns and style"""
|
| 667 |
-
# patterns = {
|
| 668 |
-
# "samples": [],
|
| 669 |
-
# "languages": defaultdict(int),
|
| 670 |
-
# "complexity_metrics": defaultdict(list)
|
| 671 |
-
# }
|
| 672 |
-
|
| 673 |
-
# try:
|
| 674 |
-
# files = self.repo.get_contents("")
|
| 675 |
-
# analyzed = 0
|
| 676 |
-
|
| 677 |
-
# while files and analyzed < 5:
|
| 678 |
-
# file = files.pop(0)
|
| 679 |
-
# if file.type == "dir":
|
| 680 |
-
# files.extend(self.repo.get_contents(file.path))
|
| 681 |
-
# elif Path(file.path).suffix.lower() in RELEVANT_EXTENSIONS:
|
| 682 |
-
# try:
|
| 683 |
-
# content = base64.b64decode(file.content).decode('utf-8')
|
| 684 |
-
# lines = content.splitlines()
|
| 685 |
-
|
| 686 |
-
# if not lines:
|
| 687 |
-
# continue
|
| 688 |
-
|
| 689 |
-
# loc = len([line for line in lines if line.strip()])
|
| 690 |
-
# avg_line_length = sum(len(line) for line in lines) / len(lines)
|
| 691 |
-
|
| 692 |
-
# patterns["samples"].append({
|
| 693 |
-
# "path": file.path,
|
| 694 |
-
# "language": Path(file.path).suffix[1:],
|
| 695 |
-
# "loc": loc,
|
| 696 |
-
# "avg_line_length": round(avg_line_length, 2)
|
| 697 |
-
# })
|
| 698 |
-
|
| 699 |
-
# patterns["languages"][Path(file.path).suffix[1:]] += loc
|
| 700 |
-
# patterns["complexity_metrics"]["loc"].append(loc)
|
| 701 |
-
# patterns["complexity_metrics"]["avg_line_length"].append(avg_line_length)
|
| 702 |
-
|
| 703 |
-
# analyzed += 1
|
| 704 |
-
|
| 705 |
-
# except Exception as e:
|
| 706 |
-
# print(f"Error analyzing file {file.path}: {str(e)}")
|
| 707 |
-
# continue
|
| 708 |
-
|
| 709 |
-
# except Exception as e:
|
| 710 |
-
# print(f"Error in code pattern analysis: {str(e)}")
|
| 711 |
-
|
| 712 |
-
# return patterns
|
| 713 |
-
|
| 714 |
-
# def _analyze_commits(self) -> Dict[str, Any]:
|
| 715 |
-
# """Analyze commit history and patterns"""
|
| 716 |
-
# commit_data = []
|
| 717 |
-
# commit_times = []
|
| 718 |
-
|
| 719 |
-
# try:
|
| 720 |
-
# commits = list(self.repo.get_commits()[:100]) # Get last 100 commits
|
| 721 |
-
|
| 722 |
-
# for commit in commits:
|
| 723 |
-
# try:
|
| 724 |
-
# commit_info = {
|
| 725 |
-
# "sha": commit.sha,
|
| 726 |
-
# "author": commit.author.login if commit.author else "Unknown",
|
| 727 |
-
# "date": commit.commit.author.date.isoformat(),
|
| 728 |
-
# "message": commit.commit.message,
|
| 729 |
-
# "changes": {
|
| 730 |
-
# "additions": commit.stats.additions,
|
| 731 |
-
# "deletions": commit.stats.deletions,
|
| 732 |
-
# }
|
| 733 |
-
# }
|
| 734 |
-
# commit_data.append(commit_info)
|
| 735 |
-
# commit_times.append(commit.commit.author.date.hour)
|
| 736 |
-
# except Exception as e:
|
| 737 |
-
# print(f"Error processing commit {commit.sha}: {str(e)}")
|
| 738 |
-
# continue
|
| 739 |
-
|
| 740 |
-
# # Analyze commit patterns
|
| 741 |
-
# commit_hours = defaultdict(int)
|
| 742 |
-
# for hour in commit_times:
|
| 743 |
-
# commit_hours[hour] += 1
|
| 744 |
-
|
| 745 |
-
# total_commits = len(commit_data)
|
| 746 |
-
# return {
|
| 747 |
-
# "commits": commit_data,
|
| 748 |
-
# "total_commits": total_commits,
|
| 749 |
-
# "commit_hours": dict(commit_hours),
|
| 750 |
-
# "avg_additions": sum(c["changes"]["additions"] for c in commit_data) / total_commits if total_commits else 0,
|
| 751 |
-
# "avg_deletions": sum(c["changes"]["deletions"] for c in commit_data) / total_commits if total_commits else 0,
|
| 752 |
-
# }
|
| 753 |
-
|
| 754 |
-
# except Exception as e:
|
| 755 |
-
# print(f"Error in commit analysis: {str(e)}")
|
| 756 |
-
# return {
|
| 757 |
-
# "commits": [],
|
| 758 |
-
# "total_commits": 0,
|
| 759 |
-
# "commit_hours": {},
|
| 760 |
-
# "avg_additions": 0,
|
| 761 |
-
# "avg_deletions": 0
|
| 762 |
-
# }
|
| 763 |
-
|
| 764 |
-
# def _analyze_contributors(self) -> Dict[str, Any]:
|
| 765 |
-
# """Analyze contributor statistics"""
|
| 766 |
-
# contributor_data = []
|
| 767 |
-
|
| 768 |
-
# try:
|
| 769 |
-
# contributors = list(self.repo.get_contributors())
|
| 770 |
-
# for contributor in contributors:
|
| 771 |
-
# contributor_data.append({
|
| 772 |
-
# "login": contributor.login,
|
| 773 |
-
# "contributions": contributor.contributions,
|
| 774 |
-
# "type": contributor.type,
|
| 775 |
-
# })
|
| 776 |
-
# except Exception as e:
|
| 777 |
-
# print(f"Error analyzing contributors: {str(e)}")
|
| 778 |
-
|
| 779 |
-
# return {
|
| 780 |
-
# "total_contributors": len(contributor_data),
|
| 781 |
-
# "contributors": contributor_data
|
| 782 |
-
# }
|
| 783 |
-
# def create_pdf_from_markdown(markdown_text: str, filename: str) -> str:
|
| 784 |
-
# """Convert markdown text to PDF"""
|
| 785 |
-
# class PDF(FPDF):
|
| 786 |
-
# def header(self):
|
| 787 |
-
# self.set_font('Arial', 'B', 12)
|
| 788 |
-
# self.cell(0, 10, 'Repository Analysis Report', 0, 1, 'C')
|
| 789 |
-
# self.ln(10)
|
| 790 |
-
|
| 791 |
-
# def footer(self):
|
| 792 |
-
# self.set_y(-15)
|
| 793 |
-
# self.set_font('Arial', 'I', 8)
|
| 794 |
-
# self.cell(0, 10, f'Page {self.page_no()}', 0, 0, 'C')
|
| 795 |
-
|
| 796 |
-
# pdf = PDF()
|
| 797 |
-
# pdf.add_page()
|
| 798 |
-
# pdf.set_auto_page_break(auto=True, margin=15)
|
| 799 |
-
|
| 800 |
-
# # Process markdown sections
|
| 801 |
-
# sections = markdown_text.split('\n## ')
|
| 802 |
-
|
| 803 |
-
# # Handle main title
|
| 804 |
-
# if sections[0].startswith('# '):
|
| 805 |
-
# title = sections[0].split('\n')[0].replace('# ', '')
|
| 806 |
-
# pdf.set_font('Arial', 'B', 16)
|
| 807 |
-
# pdf.cell(0, 10, title, 0, 1, 'C')
|
| 808 |
-
# pdf.ln(5)
|
| 809 |
-
# content = '\n'.join(sections[0].split('\n')[1:])
|
| 810 |
-
# sections[0] = content
|
| 811 |
-
|
| 812 |
-
# for section in sections:
|
| 813 |
-
# if section:
|
| 814 |
-
# # Extract section title and content
|
| 815 |
-
# lines = section.split('\n')
|
| 816 |
-
# if section == sections[0]: # First section (after main title)
|
| 817 |
-
# section_title = ''
|
| 818 |
-
# content = lines
|
| 819 |
-
# else:
|
| 820 |
-
# section_title = lines[0]
|
| 821 |
-
# content = lines[1:]
|
| 822 |
-
|
| 823 |
-
# # Add section title
|
| 824 |
-
# if section_title:
|
| 825 |
-
# pdf.set_font('Arial', 'B', 14)
|
| 826 |
-
# # Remove emojis from section titles
|
| 827 |
-
# clean_title = re.sub(r'[^\x00-\x7F]+', '', section_title)
|
| 828 |
-
# pdf.cell(0, 10, clean_title.strip(), 0, 1, 'L')
|
| 829 |
-
# pdf.ln(5)
|
| 830 |
-
|
| 831 |
-
# # Add content
|
| 832 |
-
# pdf.set_font('Arial', '', 11)
|
| 833 |
-
# for line in content:
|
| 834 |
-
# if line.strip():
|
| 835 |
-
# # Remove markdown formatting and emojis
|
| 836 |
-
# clean_line = re.sub(r'[\*\[\]]', '', line)
|
| 837 |
-
# clean_line = re.sub(r'[^\x00-\x7F]+', '', clean_line)
|
| 838 |
-
|
| 839 |
-
# if line.startswith('- '):
|
| 840 |
-
# pdf.cell(10, 5, '', 0, 0)
|
| 841 |
-
# pdf.multi_cell(0, 5, clean_line[2:])
|
| 842 |
-
# else:
|
| 843 |
-
# pdf.multi_cell(0, 5, clean_line)
|
| 844 |
-
# pdf.ln(5)
|
| 845 |
-
|
| 846 |
-
# # Save PDF
|
| 847 |
-
# pdf_path = f"{filename}.pdf"
|
| 848 |
-
# pdf.output(pdf_path)
|
| 849 |
-
# return pdf_path
|
| 850 |
-
|
| 851 |
-
# def download_noto_font():
|
| 852 |
-
# """Download Google's Noto Color Emoji font if not already present"""
|
| 853 |
-
# font_path = "NotoColorEmoji.ttf"
|
| 854 |
-
# if not os.path.exists(font_path):
|
| 855 |
-
# url = "https://github.com/googlefonts/noto-emoji/raw/main/fonts/NotoColorEmoji.ttf"
|
| 856 |
-
# response = requests.get(url)
|
| 857 |
-
# with open(font_path, "wb") as f:
|
| 858 |
-
# f.write(response.content)
|
| 859 |
-
# return font_path
|
| 860 |
-
|
| 861 |
-
# class PDFWithEmoji(FPDF):
|
| 862 |
-
# def __init__(self):
|
| 863 |
-
# super().__init__()
|
| 864 |
-
# self.add_font('DejaVu', '', 'DejaVuSansCondensed.ttf', uni=True)
|
| 865 |
-
# self.add_font('Noto', '', 'NotoColorEmoji.ttf', uni=True)
|
| 866 |
-
|
| 867 |
-
# def header(self):
|
| 868 |
-
# self.set_font('DejaVu', '', 12)
|
| 869 |
-
# self.cell(0, 10, '📊 Repository Analysis Report', 0, 1, 'C')
|
| 870 |
-
# self.ln(10)
|
| 871 |
-
|
| 872 |
-
# def footer(self):
|
| 873 |
-
# self.set_y(-15)
|
| 874 |
-
# self.set_font('DejaVu', '', 8)
|
| 875 |
-
# self.cell(0, 10, f'Page {self.page_no()}', 0, 0, 'C')
|
| 876 |
-
|
| 877 |
-
# def write_with_emoji(self, text):
|
| 878 |
-
# """Write text with proper emoji support"""
|
| 879 |
-
# self.set_font('DejaVu', '', 11)
|
| 880 |
-
# self.multi_cell(0, 5, text)
|
| 881 |
-
|
| 882 |
-
# def create_pdf_report(markdown_text: str) -> str:
|
| 883 |
-
# """Create a PDF report with full emoji and Unicode support"""
|
| 884 |
-
# # Ensure required fonts are available
|
| 885 |
-
# if not os.path.exists("DejaVuSansCondensed.ttf"):
|
| 886 |
-
# url = "https://github.com/dejavu-fonts/dejavu-fonts/raw/master/ttf/DejaVuSansCondensed.ttf"
|
| 887 |
-
# response = requests.get(url)
|
| 888 |
-
# with open("DejaVuSansCondensed.ttf", "wb") as f:
|
| 889 |
-
# f.write(response.content)
|
| 890 |
-
|
| 891 |
-
# download_noto_font()
|
| 892 |
-
|
| 893 |
-
# # Create PDF
|
| 894 |
-
# pdf = PDFWithEmoji()
|
| 895 |
-
# pdf.add_page()
|
| 896 |
-
# pdf.set_auto_page_break(auto=True, margin=15)
|
| 897 |
-
|
| 898 |
-
# # Process markdown text
|
| 899 |
-
# sections = markdown_text.split('\n## ')
|
| 900 |
-
|
| 901 |
-
# # Handle main title
|
| 902 |
-
# if sections[0].startswith('# '):
|
| 903 |
-
# title = sections[0].split('\n')[0].replace('# ', '')
|
| 904 |
-
# pdf.set_font('DejaVu', '', 16)
|
| 905 |
-
# pdf.cell(0, 10, title, 0, 1, 'C')
|
| 906 |
-
# pdf.ln(5)
|
| 907 |
-
# content = '\n'.join(sections[0].split('\n')[1:])
|
| 908 |
-
# sections[0] = content
|
| 909 |
-
|
| 910 |
-
# # Process each section
|
| 911 |
-
# for section in sections:
|
| 912 |
-
# if section:
|
| 913 |
-
# lines = section.split('\n')
|
| 914 |
-
# if section == sections[0]: # First section
|
| 915 |
-
# section_title = ''
|
| 916 |
-
# content = lines
|
| 917 |
-
# else:
|
| 918 |
-
# section_title = lines[0]
|
| 919 |
-
# content = lines[1:]
|
| 920 |
-
|
| 921 |
-
# # Add section title
|
| 922 |
-
# if section_title:
|
| 923 |
-
# pdf.set_font('DejaVu', '', 14)
|
| 924 |
-
# pdf.cell(0, 10, section_title, 0, 1, 'L')
|
| 925 |
-
# pdf.ln(5)
|
| 926 |
-
|
| 927 |
-
# # Add content
|
| 928 |
-
# pdf.set_font('DejaVu', '', 11)
|
| 929 |
-
# for line in content:
|
| 930 |
-
# if line.strip():
|
| 931 |
-
# if line.strip().startswith('- '):
|
| 932 |
-
# pdf.cell(10, 5, '•', 0, 0)
|
| 933 |
-
# pdf.write_with_emoji(line.strip()[2:])
|
| 934 |
-
# pdf.ln()
|
| 935 |
-
# else:
|
| 936 |
-
# pdf.write_with_emoji(line.strip())
|
| 937 |
-
# pdf.ln()
|
| 938 |
-
|
| 939 |
-
# # Save PDF
|
| 940 |
-
# timestamp = datetime.now().strftime('%Y%m%d_%H%M%S')
|
| 941 |
-
# pdf_path = f"repo_analysis_{timestamp}.pdf"
|
| 942 |
-
# pdf.output(pdf_path)
|
| 943 |
-
# return pdf_path
|
| 944 |
-
|
| 945 |
-
# @retry(
|
| 946 |
-
# retry=retry_if_exception_type(Exception),
|
| 947 |
-
# stop=stop_after_attempt(3),
|
| 948 |
-
# wait=wait_exponential(multiplier=1, min=4, max=10)
|
| 949 |
-
# )
|
| 950 |
-
|
| 951 |
-
|
| 952 |
-
# def analyze_repository(repo_url: str, progress=gr.Progress()) -> Tuple[str, str, str]:
|
| 953 |
-
# """Analyze repository and generate LLM summary with rate limit handling"""
|
| 954 |
-
# try:
|
| 955 |
-
# # Initialize analyzer
|
| 956 |
-
# progress(0, desc="Initializing repository analysis...")
|
| 957 |
-
# analyzer = RepositoryAnalyzer(repo_url)
|
| 958 |
-
|
| 959 |
-
# # Perform analysis
|
| 960 |
-
# progress(0.3, desc="Analyzing repository structure and patterns...")
|
| 961 |
-
# analysis_data = analyzer.analyze()
|
| 962 |
-
|
| 963 |
-
# # Generate LLM summary
|
| 964 |
-
# progress(0.7, desc="Generating analysis summary...")
|
| 965 |
-
|
| 966 |
-
# system_prompt = """You are an expert code analyst with deep experience in software architecture, development practices, and team dynamics. Analyze the provided repository data and create a detailed, insightful analysis using the following markdown template:
|
| 967 |
-
|
| 968 |
-
# # Repository Analysis
|
| 969 |
-
|
| 970 |
-
# ## 📊 Project Overview
|
| 971 |
-
# [Provide a comprehensive overview including:
|
| 972 |
-
# - Project purpose and scope
|
| 973 |
-
# - Age and maturity of the project
|
| 974 |
-
# - Current activity level and maintenance status
|
| 975 |
-
# - Key metrics (stars, forks, etc.)
|
| 976 |
-
# - Primary technologies and languages used]
|
| 977 |
-
|
| 978 |
-
# ## 🏗️ Architecture and Code Organization
|
| 979 |
-
# [Analyze in detail:
|
| 980 |
-
# - Repository structure and organization
|
| 981 |
-
# - Code distribution across different technologies
|
| 982 |
-
# - File and directory organization patterns
|
| 983 |
-
# - Project size and complexity metrics
|
| 984 |
-
# - Code modularity and component structure
|
| 985 |
-
# - Presence of key architectural patterns]
|
| 986 |
-
|
| 987 |
-
# ## 💻 Development Practices & Code Quality
|
| 988 |
-
# [Evaluate:
|
| 989 |
-
# - Coding standards and consistency
|
| 990 |
-
# - Code complexity and maintainability metrics
|
| 991 |
-
# - Documentation practices
|
| 992 |
-
# - Testing approach and coverage (if visible)
|
| 993 |
-
# - Error handling and logging practices
|
| 994 |
-
# - Use of design patterns and best practices]
|
| 995 |
-
|
| 996 |
-
# ## 📈 Development Workflow & History
|
| 997 |
-
# [Analyze:
|
| 998 |
-
# - Commit patterns and frequency
|
| 999 |
-
# - Release cycles and versioning
|
| 1000 |
-
# - Branch management strategy
|
| 1001 |
-
# - Code review practices
|
| 1002 |
-
# - Continuous integration/deployment indicators
|
| 1003 |
-
# - Peak development periods and cycles]
|
| 1004 |
-
|
| 1005 |
-
# ## 👥 Team Dynamics & Collaboration
|
| 1006 |
-
# [Examine:
|
| 1007 |
-
# - Team size and composition
|
| 1008 |
-
# - Contribution patterns
|
| 1009 |
-
# - Core maintainer identification
|
| 1010 |
-
# - Community engagement level
|
| 1011 |
-
# - Communication patterns
|
| 1012 |
-
# - Collaboration efficiency]
|
| 1013 |
-
|
| 1014 |
-
# ## 🔧 Technical Depth & Innovation
|
| 1015 |
-
# [Assess:
|
| 1016 |
-
# - Technical sophistication level
|
| 1017 |
-
# - Innovative approaches or solutions
|
| 1018 |
-
# - Complex problem-solving examples
|
| 1019 |
-
# - Performance optimization efforts
|
| 1020 |
-
# - Security considerations
|
| 1021 |
-
# - Scalability approach]
|
| 1022 |
-
|
| 1023 |
-
# ## 🚀 Project Health & Sustainability
|
| 1024 |
-
# [Evaluate:
|
| 1025 |
-
# - Project momentum and growth trends
|
| 1026 |
-
# - Maintenance patterns
|
| 1027 |
-
# - Community health indicators
|
| 1028 |
-
# - Documentation completeness
|
| 1029 |
-
# - Onboarding friendliness
|
| 1030 |
-
# - Long-term viability indicators]
|
| 1031 |
-
|
| 1032 |
-
# ## 💡 Key Insights & Recommendations
|
| 1033 |
-
# [Provide:
|
| 1034 |
-
# - 3-5 key strengths identified
|
| 1035 |
-
# - 3-5 potential improvement areas
|
| 1036 |
-
# - Notable patterns or practices
|
| 1037 |
-
# - Unique characteristics
|
| 1038 |
-
# - Strategic recommendations]
|
| 1039 |
-
|
| 1040 |
-
# Please provide detailed analysis for each section while maintaining the formatting and emojis. Support insights with specific metrics and examples from the repository data where possible."""
|
| 1041 |
-
|
| 1042 |
-
# chat = model.start_chat(history=[])
|
| 1043 |
-
# response = chat.send_message(f"{system_prompt}\n\nRepository Analysis Data:\n{json.dumps(analysis_data, indent=2)}")
|
| 1044 |
-
|
| 1045 |
-
# # Save analysis data
|
| 1046 |
-
# progress(0.9, desc="Saving analysis results...")
|
| 1047 |
-
# with tempfile.NamedTemporaryFile(mode='w', delete=False, suffix='.json') as f:
|
| 1048 |
-
# json.dump(analysis_data, f, indent=2)
|
| 1049 |
-
# analysis_file = f.name
|
| 1050 |
-
|
| 1051 |
-
# progress(0.9, desc="Generating PDF report...")
|
| 1052 |
-
# try:
|
| 1053 |
-
# pdf_path = create_pdf_report(response.text)
|
| 1054 |
-
# except Exception as pdf_error:
|
| 1055 |
-
# print(f"PDF generation error: {str(pdf_error)}")
|
| 1056 |
-
# pdf_path = ""
|
| 1057 |
-
|
| 1058 |
-
|
| 1059 |
-
|
| 1060 |
-
# # Generate PDF
|
| 1061 |
-
# pdf_path = create_pdf_from_markdown(response.text, f"analysis_{datetime.now().strftime('%Y%m%d_%H%M%S')}")
|
| 1062 |
-
|
| 1063 |
-
# with tempfile.NamedTemporaryFile(mode='w', delete=False, suffix='.json') as f:
|
| 1064 |
-
# json.dump(analysis_data, f, indent=2)
|
| 1065 |
-
# analysis_file = f.name
|
| 1066 |
-
|
| 1067 |
-
|
| 1068 |
-
|
| 1069 |
-
|
| 1070 |
-
# progress(1.0, desc="✨ Analysis complete!")
|
| 1071 |
-
# return response.text, analysis_file, pdf_path, "✅ Analysis completed successfully!"
|
| 1072 |
-
|
| 1073 |
-
# except Exception as e:
|
| 1074 |
-
# error_message = f"❌ Error analyzing repository: {str(e)}"
|
| 1075 |
-
# return "", "", "", error_message # Return 4 empty values when there's an error
|
| 1076 |
-
|
| 1077 |
-
# def create_chat_session() -> Any:
|
| 1078 |
-
# """Create a new chat session for follow-up questions"""
|
| 1079 |
-
# return genai.GenerativeModel(
|
| 1080 |
-
# model_name="gemini-pro",
|
| 1081 |
-
# generation_config={
|
| 1082 |
-
# 'temperature': 0.7,
|
| 1083 |
-
# 'top_p': 0.8,
|
| 1084 |
-
# 'top_k': 40,
|
| 1085 |
-
# 'max_output_tokens': 2048,
|
| 1086 |
-
# }
|
| 1087 |
-
# )
|
| 1088 |
-
|
| 1089 |
-
# @retry(
|
| 1090 |
-
# retry=retry_if_exception_type(Exception),
|
| 1091 |
-
# stop=stop_after_attempt(3),
|
| 1092 |
-
# wait=wait_exponential(multiplier=1, min=4, max=10)
|
| 1093 |
-
# )
|
| 1094 |
-
# def ask_question(question: str, analysis_file: str, chat_history: List[Tuple[str, str]]) -> List[Tuple[str, str]]:
|
| 1095 |
-
# """Process a follow-up question about the analysis"""
|
| 1096 |
-
# if not analysis_file:
|
| 1097 |
-
# return chat_history + [(question, "Please analyze a repository first before asking questions.")]
|
| 1098 |
-
|
| 1099 |
-
# try:
|
| 1100 |
-
# # Load analysis data
|
| 1101 |
-
# with open(analysis_file, 'r') as f:
|
| 1102 |
-
# analysis_data = json.load(f)
|
| 1103 |
-
|
| 1104 |
-
# # Initialize chat model
|
| 1105 |
-
# model = create_chat_session()
|
| 1106 |
-
|
| 1107 |
-
# # Build context from chat history and current question
|
| 1108 |
-
# context = "You are an expert code analyst helping users understand repository analysis results.\n\n"
|
| 1109 |
-
# context += f"Repository Analysis Data:\n{json.dumps(analysis_data, indent=2)}\n\n"
|
| 1110 |
-
|
| 1111 |
-
# # Add chat history context
|
| 1112 |
-
# if chat_history:
|
| 1113 |
-
# context += "Previous conversation:\n"
|
| 1114 |
-
# for user_msg, assistant_msg in chat_history:
|
| 1115 |
-
# context += f"User: {user_msg}\nAssistant: {assistant_msg}\n"
|
| 1116 |
-
|
| 1117 |
-
# # Add current question
|
| 1118 |
-
# prompt = context + f"\nUser: {question}\nPlease provide your analysis:"
|
| 1119 |
-
|
| 1120 |
-
# # Get response
|
| 1121 |
-
# response = model.generate_content(prompt)
|
| 1122 |
-
|
| 1123 |
-
# # Return in the correct tuple format for Gradio chatbot
|
| 1124 |
-
# return chat_history + [(question, response.text)]
|
| 1125 |
-
|
| 1126 |
-
# except Exception as e:
|
| 1127 |
-
# error_message = f"Error processing question: {str(e)}"
|
| 1128 |
-
# return chat_history + [(question, error_message)]
|
| 1129 |
-
|
| 1130 |
-
|
| 1131 |
-
|
| 1132 |
-
|
| 1133 |
-
# # Create Gradio interface
|
| 1134 |
-
# # Create Gradio interface
|
| 1135 |
-
# with gr.Blocks(theme=gr.themes.Soft()) as app:
|
| 1136 |
-
# gr.Markdown("""
|
| 1137 |
-
# # 🔍 GitHub Repository Analyzer
|
| 1138 |
-
|
| 1139 |
-
# Analyze any public GitHub repository using AI. The tool will:
|
| 1140 |
-
# 1. 📊 Analyze repository structure and patterns
|
| 1141 |
-
# 2. 💡 Generate insights about development practices
|
| 1142 |
-
# 3. 💭 Allow you to ask follow-up questions about the analysis
|
| 1143 |
-
# 4. 📑 Generate a downloadable PDF report
|
| 1144 |
-
# """)
|
| 1145 |
-
|
| 1146 |
-
# with gr.Row():
|
| 1147 |
-
# repo_url = gr.Textbox(
|
| 1148 |
-
# label="GitHub Repository URL",
|
| 1149 |
-
# placeholder="https://github.com/owner/repo",
|
| 1150 |
-
# scale=4
|
| 1151 |
-
# )
|
| 1152 |
-
|
| 1153 |
-
# with gr.Row():
|
| 1154 |
-
# with gr.Column(scale=1):
|
| 1155 |
-
# analyze_btn = gr.Button("🔍 Analyze", variant="primary")
|
| 1156 |
-
# download_pdf_btn = gr.Button("📄 Download PDF", variant="secondary")
|
| 1157 |
-
|
| 1158 |
-
# # Status message
|
| 1159 |
-
# status_msg = gr.Markdown("", elem_id="status_message")
|
| 1160 |
-
|
| 1161 |
-
# # File output for PDF
|
| 1162 |
-
# pdf_output = gr.File(
|
| 1163 |
-
# label="Analysis Report",
|
| 1164 |
-
# visible=False,
|
| 1165 |
-
# interactive=True
|
| 1166 |
-
# )
|
| 1167 |
-
|
| 1168 |
-
# with gr.Row():
|
| 1169 |
-
# summary = gr.Markdown(label="Analysis Summary")
|
| 1170 |
-
|
| 1171 |
-
# with gr.Row():
|
| 1172 |
-
# chatbot = gr.Chatbot(
|
| 1173 |
-
# label="Ask Questions",
|
| 1174 |
-
# height=400,
|
| 1175 |
-
# show_label=True
|
| 1176 |
-
# )
|
| 1177 |
-
|
| 1178 |
-
# with gr.Row():
|
| 1179 |
-
# question = gr.Textbox(
|
| 1180 |
-
# label="Your Question",
|
| 1181 |
-
# placeholder="Ask about the analysis...",
|
| 1182 |
-
# scale=4
|
| 1183 |
-
# )
|
| 1184 |
-
# ask_btn = gr.Button("💭 Ask", variant="primary", scale=1)
|
| 1185 |
-
# clear_btn = gr.Button("🗑️ Clear Chat", variant="secondary", scale=1)
|
| 1186 |
-
|
| 1187 |
-
# # Hidden states
|
| 1188 |
-
# analysis_file = gr.State("")
|
| 1189 |
-
# current_pdf_path = gr.State("")
|
| 1190 |
-
|
| 1191 |
-
# def handle_pdf_download(pdf_path):
|
| 1192 |
-
# """Handle PDF download when button is clicked"""
|
| 1193 |
-
# if pdf_path and os.path.exists(pdf_path):
|
| 1194 |
-
# return {
|
| 1195 |
-
# pdf_output: pdf_path
|
| 1196 |
-
# }
|
| 1197 |
-
# return {
|
| 1198 |
-
# pdf_output: None
|
| 1199 |
-
# }
|
| 1200 |
-
|
| 1201 |
-
# def clear_outputs():
|
| 1202 |
-
# """Clear all outputs"""
|
| 1203 |
-
# return {
|
| 1204 |
-
# summary: "",
|
| 1205 |
-
# chatbot: [],
|
| 1206 |
-
# question: "",
|
| 1207 |
-
# status_msg: "",
|
| 1208 |
-
# pdf_output: None,
|
| 1209 |
-
# current_pdf_path: ""
|
| 1210 |
-
# }
|
| 1211 |
-
|
| 1212 |
-
# # Event handlers
|
| 1213 |
-
# analyze_btn.click(
|
| 1214 |
-
# fn=lambda: "⏳ Analysis in progress...",
|
| 1215 |
-
# inputs=None,
|
| 1216 |
-
# outputs=status_msg,
|
| 1217 |
-
# queue=False
|
| 1218 |
-
# ).then(
|
| 1219 |
-
# analyze_repository,
|
| 1220 |
-
# inputs=[repo_url],
|
| 1221 |
-
# outputs=[summary, analysis_file, current_pdf_path, status_msg]
|
| 1222 |
-
# ).then(
|
| 1223 |
-
# lambda: gr.update(visible=True),
|
| 1224 |
-
# None,
|
| 1225 |
-
# download_pdf_btn
|
| 1226 |
-
# )
|
| 1227 |
-
|
| 1228 |
-
# # PDF download handler
|
| 1229 |
-
# download_pdf_btn.click(
|
| 1230 |
-
# handle_pdf_download,
|
| 1231 |
-
# inputs=[current_pdf_path],
|
| 1232 |
-
# outputs=pdf_output
|
| 1233 |
-
# ).then(
|
| 1234 |
-
# lambda: gr.update(visible=True),
|
| 1235 |
-
# None,
|
| 1236 |
-
# pdf_output
|
| 1237 |
-
# )
|
| 1238 |
-
|
| 1239 |
-
# ask_btn.click(
|
| 1240 |
-
# ask_question,
|
| 1241 |
-
# inputs=[question, analysis_file, chatbot],
|
| 1242 |
-
# outputs=[chatbot]
|
| 1243 |
-
# ).then(
|
| 1244 |
-
# lambda: "",
|
| 1245 |
-
# None,
|
| 1246 |
-
# question,
|
| 1247 |
-
# queue=False
|
| 1248 |
-
# )
|
| 1249 |
-
|
| 1250 |
-
# clear_btn.click(
|
| 1251 |
-
# clear_outputs,
|
| 1252 |
-
# inputs=None,
|
| 1253 |
-
# outputs=[summary, chatbot, question, status_msg, pdf_output, current_pdf_path]
|
| 1254 |
-
# )
|
| 1255 |
-
|
| 1256 |
-
|
| 1257 |
-
|
| 1258 |
-
# # Launch the app
|
| 1259 |
-
# if __name__ == "__main__":
|
| 1260 |
-
# app.launch(
|
| 1261 |
-
# share=True,
|
| 1262 |
-
# debug=True
|
| 1263 |
-
# )
|
|
|
|
| 517 |
|
| 518 |
|
| 519 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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