Thanks to visit codestin.com
Credit goes to github.com

Skip to content

πŸ₯ AI-Powered GitHub Repository Health Analyzer using LangChain.js and Gemini 2.5 Flash

License

ludovic/RepoHealth

Repository files navigation

πŸ” Repo## ✨ Features

  • πŸ€– ReAct AI Agent: Uses the ReAct pattern (Reasoning + Acting) to methodically analyze repositories
  • πŸ“Š Complete Analysis: Popularity, active maintenance, contributors, project health
  • πŸ› οΈ 4 GitHub Tools: Direct access to GitHub API through custom tools
  • 🎨 Modern Interface: Responsive UI with Tailwind CSS and dark mode
  • πŸ“ˆ Health Score: Repository health score (0-100) with detailed breakdown
  • πŸ’¬ Real-Time Streaming: Live visualization of the agent's thinking process
  • ⚑ Next.js 14: App Router, TypeScript, and modern optimizations

πŸ“Έ Screenshots

Main Interface

RepoHealth Main Interface Clean and modern interface with real-time analysis progress

Real-Time Agent Thinking

Agent Thinking Process Watch the AI agent's reasoning process in real-time with the ReAct pattern

Health Score Analysis

Health Score Dashboard Comprehensive health score with detailed breakdown across multiple metrics

Complete Analysis Results

Analysis Results Detailed insights including popularity, maintenance, community, and recommendations

Note: To add your own screenshots, create a screenshots folder in the project root and add your images there.

🎯 Overview

The AI agent automatically analyzes:

  • ⭐ Popularity (stars, forks)
  • πŸ”§ Maintenance (recent activity, latest commits)
  • πŸ‘₯ Community (contributors, diversity)
  • πŸ“š Documentation (README, license)

πŸš€ Quick Start (2 minutes)t GitHub Repository Analyzer

πŸ₯ RepoHealth - AI-Powered GitHub Repository Health Analyzer

An intelligent web application that uses AI agents (LangChain.js + Gemini) to automatically analyze GitHub repositories and provide detailed health insights in real-time.

Next.js TypeScript LangChain License: MIT

✨ Features

  • πŸ€– ReAct AI Agent: Uses the ReAct pattern (Reasoning + Acting) to methodically analyze repositories
  • πŸ“Š Complete Analysis: Popularity, active maintenance, contributors, project health
  • πŸ› οΈ 4 GitHub Tools: Direct access to GitHub API through custom tools
  • 🎨 Modern Interface: Responsive UI with Tailwind CSS and dark mode
  • πŸ“ˆ Health Score: Repository health score (0-100) with detailed breakdown
  • οΏ½οΏ½ Real-Time Streaming: Live visualization of the agent's thinking process
  • ⚑ Next.js 14: App Router, TypeScript, and modern optimizations

πŸ“Έ Overview

The AI agent automatically analyzes:

  • ⭐ Popularity (stars, forks)
  • πŸ”§ Maintenance (recent activity, latest commits)
  • πŸ‘₯ Community (contributors, diversity)
  • πŸ“š Documentation (README, license)

πŸš€ Quick Start (2 minutes)

Prerequisites

Express Installation

```bash

# 1. Clone the repository
git clone https://github.com/your-username/repohealth.git
cd repohealth

# 2. Install dependencies
npm install

# 3. Configure API keys
cp .env.local.template .env.local
# Edit .env.local and add your Gemini key

# 4. Launch the application
npm run dev

# 5. Open http://localhost:3000
\`\`\`

### API Keys Configuration

Create a \`.env.local\` file at the project root:

\`\`\`env
# REQUIRED - Get it for free at https://makersuite.google.com/app/apikey
GEMINI_API_KEY=your_gemini_api_key

# OPTIONAL - Increases limit from 60 to 5000 requests/hour
# Create at https://github.com/settings/tokens (scope: public_repo)
GITHUB_TOKEN=your_github_token
\`\`\`

### Installation Verification

To verify everything is working:

\`\`\`bash
# Test configuration
./test-project.sh

# If OK, start the server
npm run dev
\`\`\`

## 🎯 Usage

### Simple Interface

1. **Enter the URL** of a GitHub repository in the input field
   \`\`\`
   https://github.com/owner/repository
   \`\`\`

2. **Click "πŸš€ Analyze"** or use the example buttons

3. **Watch the agent work** in real-time:
   - πŸ’­ **Thoughts**: Agent's reasoning process
   - 🎬 **Actions**: Tools being called (get_repository_info, etc.)
   - πŸ‘€ **Observations**: Tool results
   - πŸ“ **Steps**: Analysis progress

4. **Receive complete analysis** with:
   - πŸ“Š Health Score (0-100) with breakdown
   - ⭐ Popularity and adoption
   - πŸ”§ Maintenance status
   - πŸ‘₯ Community activity
   - πŸ“š Documentation quality
   - πŸ’‘ Recommendations

### Example Repositories to Test

| URL | Description |
|-----|-------------|
| \`https://github.com/langchain-ai/langchainjs\` | πŸ€– Modern AI framework |
| \`https://github.com/vercel/next.js\` | ⚑ Popular React framework |
| \`https://github.com/facebook/react\` | βš›οΈ Reference UI library |
| \`https://github.com/microsoft/vscode\` | πŸ’» Open source code editor |

## πŸ—οΈ Architecture

### Tech Stack

| Category | Technology | Usage |
|----------|------------|-------|
| **Framework** | Next.js 14 | App Router, SSR, API Routes |
| **Language** | TypeScript | Type safety, autocomplete |
| **AI** | LangChain.js + Gemini 2.0 Flash | ReAct agent, custom tools |
| **API** | Octokit | GitHub REST API v3 |
| **Styling** | Tailwind CSS | Modern and responsive design |
| **Validation** | Zod | Tool schema validation |

### Project Structure

\`\`\`
repohealth/
β”œβ”€β”€ 🎨 INTERFACE (app/)
β”‚   β”œβ”€β”€ page.tsx                    # Main page with form
β”‚   β”œβ”€β”€ layout.tsx                  # Layout with SEO metadata
β”‚   β”œβ”€β”€ globals.css                 # Global Tailwind styles
β”‚   β”œβ”€β”€ components/
β”‚   β”‚   └── HealthScore.tsx         # Health Score component
β”‚   └── api/
β”‚       └── analyze/
β”‚           └── route.ts            # API endpoint with streaming
β”‚
β”œβ”€β”€ πŸ€– AI LOGIC (lib/)
β”‚   β”œβ”€β”€ agent.ts                    # LangChain Agent + Gemini
β”‚   β”œβ”€β”€ github-tools.ts             # 4 custom GitHub tools
β”‚   β”œβ”€β”€ health-score.ts             # Health score calculation
β”‚   └── utils.ts                    # Utility functions
β”‚
β”œβ”€β”€ 🎣 HOOKS (hooks/)
β”‚   └── useStreamingAnalysis.ts     # React hook for streaming
β”‚
β”œβ”€β”€ πŸ“ TYPES (types/)
β”‚   └── index.ts                    # TypeScript definitions
β”‚
β”œβ”€β”€ βš™οΈ CONFIGURATION
β”‚   β”œβ”€β”€ package.json                # 455+ dependencies
β”‚   β”œβ”€β”€ tsconfig.json               # Strict TypeScript config
β”‚   β”œβ”€β”€ tailwind.config.ts          # Custom Tailwind config
β”‚   β”œβ”€β”€ next.config.js              # Optimized Next.js config
β”‚   β”œβ”€β”€ .eslintrc.json              # Linting rules
β”‚   └── .env.local.template         # Environment variables template
β”‚
└── πŸ“š DOCUMENTATION
    β”œβ”€β”€ README.md                   # This file
    └── LICENSE                     # MIT License
\`\`\`

### The 4 AI Agent Tools

The agent has a complete "toolbox":

#### 1. **\`get_repository_info\`** - Repository Metadata
\`\`\`typescript
// Retrieves essential information
{
  name: string,
  stars: number,              // ⭐ Popularity
  forks: number,              // οΏ½οΏ½ Engagement
  open_issues: number,        // πŸ› Open issues
  language: string,           // πŸ’» Main language
  created_at: string,         // πŸ“… Creation date
  updated_at: string,         // πŸ”„ Last update
  topics: string[],           // 🏷️ Project tags
  license: string,            // πŸ“œ License
}
\`\`\`

#### 2. **\`get_readme_content\`** - README Content
\`\`\`typescript
// Extracts and decodes README.md
// - Automatically decoded from base64
// - Truncated to 3000 characters if too long
// - Best source for understanding the project
\`\`\`

#### 3. **\`get_recent_activity\`** - Recent Activity
\`\`\`typescript
// Checks for active maintenance
{
  last_commit_date: string,      // πŸ“… Last commit date
  last_commit_message: string,   // πŸ’¬ Commit message
  last_commit_author: string,    // πŸ‘€ Author
  recent_commits: CommitInfo[]   // πŸ“Š Last 5 commits
}
\`\`\`

#### 4. **\`get_top_contributors\`** - Top Contributors
\`\`\`typescript
// Lists main contributors
{
  total_contributors: number,     // πŸ‘₯ Total count
  top_contributors: [             // πŸ† Top 10
    {
      username: string,
      contributions: number
    }
  ]
}
\`\`\`

### The ReAct Pattern in Action

The agent follows a **Thought β†’ Action β†’ Observation** cycle:

\`\`\`
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ 1. πŸ’­ THOUGHT                                    β”‚
β”‚    "I need to analyze the repo's popularity"   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                      ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ 2. 🎬 ACTION                                     β”‚
β”‚    Calls: get_repository_info(owner, repo)     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                      ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ 3. πŸ‘€ OBSERVATION                                β”‚
β”‚    Receives: { stars: 10500, forks: 2000, ... }β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                      ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ 4. πŸ’­ THOUGHT                                    β”‚
β”‚    "10500 stars = very popular!                 β”‚
β”‚     Let's check maintenance now..."             β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                      ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ 5. 🎬 ACTION                                     β”‚
β”‚    Calls: get_recent_activity(owner, repo)     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                      ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ 6. πŸ‘€ OBSERVATION                                β”‚
β”‚    Receives: { last_commit_date: "2025-10-05" }β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                      ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ 7. βœ… FINAL ANSWER                               β”‚
β”‚    Generates complete structured analysis       β”‚
β”‚    with Health Score and recommendations        β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
\`\`\`

This cycle is **visible in real-time** in the interface thanks to streaming!

## πŸ› οΈ Development

### Available Scripts

\`\`\`bash
# Development
npm run dev          # Start development server (port 3000)
npm run build        # Create optimized production build
npm run start        # Start production server
npm run lint         # Check code with ESLint

# Tests and Debugging
./test-project.sh    # Configuration test script
./init-git.sh        # Git initialization script
\`\`\`

## 🀝 Contributing

Contributions are welcome! Feel free to:

1. Fork the project
2. Create a branch (\`git checkout -b feature/AmazingFeature\`)
3. Commit your changes (\`git commit -m 'Add some AmazingFeature'\`)
4. Push to the branch (\`git push origin feature/AmazingFeature\`)
5. Open a Pull Request

## πŸ“„ License

This project is licensed under the MIT License. See the [LICENSE](./LICENSE) file for more details.

## πŸ™ Acknowledgments

- [LangChain.js](https://github.com/langchain-ai/langchainjs) - Powerful framework for AI agents
- [Google Gemini](https://deepmind.google/technologies/gemini/) - Performant and free language model
- [Octokit](https://github.com/octokit/octokit.js) - Official GitHub API client
- [Next.js](https://nextjs.org/) - The best React framework
- [Tailwind CSS](https://tailwindcss.com/) - Modern utility-first CSS
- The open source community πŸ’™

---

<div align="center">

**Made with πŸ’œ by the community**

[⭐ Star this project](../../stargazers) β€’ [πŸ› Report a bug](../../issues) β€’ [πŸ’‘ Suggest a feature](../../issues/new)

</div>

---

**Last updated**: October 2025 | **Version**: 1.0.0

About

πŸ₯ AI-Powered GitHub Repository Health Analyzer using LangChain.js and Gemini 2.5 Flash

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages