# GitHub Repository Analyzer (`akash9078/github-repository-analyzer`) Actor

AI-powered codebase analyst that analyzes any GitHub repository. Get intelligent insights, Q\&A pairs, documentation, dependency analysis, and structured data about any codebase. Perfect for code review, onboarding, RAG pipelines, and AI agents.

- **URL**: https://apify.com/akash9078/github-repository-analyzer.md
- **Developed by:** [Akash Kumar Naik](https://apify.com/akash9078) (community)
- **Categories:** AI, Developer tools, Agents
- **Stats:** 3 total users, 0 monthly users, 100.0% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.00005 / actor start

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## AI Codebase Analyst - GitHub Repository Intelligence 🔍

Analyze any GitHub repository with AI. Get intelligent Q&A pairs, dependency analysis, README extraction, and structured data output in under 60 seconds. Perfect for developers, AI agents, and RAG pipelines.

### 🎯 Problem Solved

Understanding a new codebase takes hours of reading documentation, exploring files, and asking questions. AI Codebase Analyst transforms any GitHub repository into actionable intelligence instantly, saving developers time and enabling AI applications to understand codebases deeply.

**Target Users**:

- Developers evaluating libraries before integration
- AI engineers building RAG pipelines
- Security teams auditing dependencies
- Technical leads conducting due diligence

### ✨ Key Features

- **📖 README Extraction**: Automatically fetches README files (README.md, README.rst, README.txt) with full content
- **❓ AI-Powered Q&A**: Generates 15+ intelligent questions and answers about project purpose, installation, usage, and more
- **📦 Dependency Analysis**: Extracts dependencies from package.json, requirements.txt, pyproject.toml, setup.py
- **🗂️ File Structure Mapping**: Discovers repository structure up to 3 levels deep
- **🔑 Key File Extraction**: Retrieves LICENSE, Dockerfile, config files, and other important documents
- **🌐 Multi-Language Support**: Works with Python, JavaScript, TypeScript, Go, Rust, and 50+ languages
- **⚡ Fast Processing**: Complete analysis in under 60 seconds
- **📊 Structured Output**: JSON format ready for RAG pipelines and AI agents

### 💡 Typical Use Cases

#### For Developers

- **Quick Onboarding**: Understand new projects in seconds instead of hours
- **Dependency Research**: Evaluate libraries before adding to your project
- **Code Review**: Get context about unfamiliar codebases
- **Due Diligence**: Analyze open-source dependencies for security and licensing

#### For AI Applications

- **RAG Pipelines**: Feed structured repository data into vector stores
- **AI Agents**: Provide agents with deep repository understanding
- **Documentation Generation**: Auto-generate docs from code analysis
- **Semantic Code Search**: Enable natural language search across repositories

#### For Teams

- **Knowledge Transfer**: Bridge gaps between team members on different projects
- **Security Audits**: Identify dependencies and potential risks
- **Technical Debt Analysis**: Understand codebase complexity before adoption

### ⚙️ Input Parameters

| Parameter    | Type   | Required | Default | Description                                                          |
| ------------ | ------ | -------- | ------- | -------------------------------------------------------------------- |
| `githubRepo` | string | ✅ Yes   | -       | GitHub repository in `owner/repo` format (e.g., `QwenLM/Qwen-Agent`) |
| `maxFiles`   | number | ❌ No    | 50      | Maximum files to analyze (range: 10-200)                             |

#### Input Examples

```json
{
    "githubRepo": "QwenLM/Qwen-Agent",
    "maxFiles": 50
}
````

```json
{
    "githubRepo": "microsoft/vscode",
    "maxFiles": 100
}
```

### 📊 Output Format

The Actor produces structured JSON in the default dataset.

#### Sample Output Item

```json
{
    "repository": {
        "name": "QwenLM/Qwen-Agent",
        "description": "Agent framework for Qwen models",
        "stars": 15000,
        "language": "Python",
        "license": "Apache-2.0",
        "url": "https://github.com/QwenLM/Qwen-Agent"
    },
    "readme": {
        "content": "Full README content...",
        "length": 15121
    },
    "structure": ["LICENSE", "README.md", "setup.py", "qwen_agent/agent.py"],
    "dependencies": ["dashscope", "json5", "openai", "pydantic"],
    "pythonDependencies": ["dashscope", "json5", "openai", "pydantic", "tiktoken"],
    "qna": [
        {
            "question": "What is this project?",
            "answer": "Qwen-Agent is a framework for developing LLM applications..."
        },
        {
            "question": "How do I install it?",
            "answer": "pip install -U qwen-agent[gui,rag,code_interpreter]"
        }
    ]
}
```

#### Output Storage

- **Dataset**: Full analysis results accessible via Apify Console or API
- **Key-Value Store**: `REPO_INFO` key contains complete analysis as JSON

#### Edge Cases

- **Empty README**: `readme.content` will be `null` if no README found
- **No Dependencies**: Dependency arrays will be empty `[]`
- **Private Repos**: Requires valid `githubToken` with appropriate permissions

### 🚀 Quick Start

#### Run via Apify Console

1. Visit [AI Codebase Analyst on Apify](https://console.apify.com/actors/akash9078/ai-codebase-analyst)
2. Enter repository in `owner/repo` format (e.g., `QwenLM/Qwen-Agent`)
3. Click **Run** - results available in under 60 seconds

#### Run via API

```javascript
const { ApifyClient } = require('apify-client');
const client = new ApifyClient({ token: 'YOUR_API_TOKEN' });
const result = await client.actor('akash9078/ai-codebase-analyst').call({
    githubRepo: 'QwenLM/Qwen-Agent',
    maxFiles: 50,
});
console.log(result.data);
```

#### Run via cURL

```bash
curl -X POST \
  https://api.apify.com/v2/acts/akash9078~ai-codebase-analyst/runs?token=YOUR_API_TOKEN \
  -H 'Content-Type: application/json' \
  -d '{"githubRepo": "QwenLM/Qwen-Agent", "maxFiles": 50}'
```

#### Run via cURL

```bash
curl -X POST \
  https://api.apify.com/v2/acts/username~ai-codebase-analyst/runs?token=YOUR_API_TOKEN \
  -H 'Content-Type: application/json' \
  -d '{"githubRepo": "QwenLM/Qwen-Agent", "maxFiles": 50}'
```

### 💰 Pricing

This Actor uses pay-per-event pricing on the Apify platform:

- **REPO\_PROCESSED**: One-time charge per repository analyzed
- **QNA\_GENERATED**: Charge per Q\&A pair generated (typically 15-20 pairs per run)

Check the [Actor pricing page](https://console.apify.com/actors/ai-codebase-analyst/pricing) for current rates.

### ❓ FAQ

#### Q: Do you support private repositories?

A: Currently, this Actor works with public repositories only. Private repository support requires a GitHub token configured as an environment variable.

#### Q: What languages are supported?

A: The Actor works with any language. It has special support for Python (requirements.txt, pyproject.toml), JavaScript/TypeScript (package.json), Rust (Cargo.toml), and Go (go.mod).

#### Q: How many files can be analyzed?

A: Default is 50 files, configurable from 10-200 via the `maxFiles` parameter.

#### Q: What if the README is very large?

A: README content is truncated to 8000 characters for Q\&A generation but the full content is stored in the output.

#### Q: Can I use my own LLM instead of Mistral?

A: Currently only Mistral AI is supported. Custom LLM integration is on the roadmap.

#### Q: How often is the data updated?

A: Data is fetched fresh from GitHub on each run. There is no caching.

#### Q: What happens if the repository doesn't exist?

A: The Actor will return an error with message "Resource not found by GitHub API".

### 🔗 Integration Examples

#### RAG Pipeline with LangChain

```python
from apify_client import ApifyClient
from langchain.vectorstores import FAISS
from langchain.embeddings import OpenAIEmbeddings

## Analyze repository
client = ApifyClient("YOUR_TOKEN")
result = client.actor("akash9078/ai-codebase-analyst").call(
    githubRepo="langchain-ai/langchain"
)

## Create vector store from README
embeddings = OpenAIEmbeddings()
docsearch = FAISS.from_texts(
    [result.data['readme']['content']], embeddings
)

## Query the knowledge base
docs = docsearch.similarity_search("How do I install LangChain?")
```

#### AI Agent Context

```javascript
const context = `
  Repository: ${data.repository.name}
  Description: ${data.repository.description}
  Stars: ${data.repository.stars}
  README Summary: ${data.readme.content.substring(0, 5000)}
  Key Q&A: ${JSON.stringify(data.qna.slice(0, 5))}
`;

const response = await mistral.chat.complete({
    model: 'mistral-large-2512',
    messages: [{ role: 'user', content: context + userQuestion }],
});
```

### 🏆 Why Choose AI Codebase Analyst?

| Feature             | AI Codebase Analyst | Manual Research | Other Tools      |
| ------------------- | ------------------- | --------------- | ---------------- |
| README Extraction   | ✅ Automatic        | ❌ Manual       | ⚠️ Partial       |
| Q\&A Generation      | ✅ 15+ pairs        | ❌ Hours        | ⚠️ Limited       |
| Dependency Analysis | ✅ Multi-format     | ❌ Manual       | ⚠️ Single format |
| File Structure      | ✅ Complete         | ❌ Manual       | ⚠️ Shallow       |
| Output Format       | ✅ Structured JSON  | ❌ Unstructured | ⚠️ Varies        |
| Processing Time     | ⚡ Fast             | 🐌 Hours        | ⚡ Varies        |

### 🔑 Keywords

AI codebase analysis, GitHub repository intelligence, code analysis tool, AI Q\&A generation, repository documentation, dependency analysis, RAG pipeline, AI agent context, codebase chat, GitHub API, Mistral AI, Apify actor, open source analysis, technical due diligence, code review assistant

# Actor input Schema

## `githubRepo` (type: `string`):

GitHub repository URL or 'owner/repo' format. Accepts: 'owner/repo', 'https://github.com/owner/repo', or 'https://github.com/owner/repo.git'. Required.

## `maxFiles` (type: `integer`):

Maximum number of files to fetch and analyze from the repository. Higher values provide more context but increase processing time.

## Actor input object example

```json
{
  "githubRepo": "QwenLM/Qwen-Agent",
  "maxFiles": 50
}
```

# Actor output Schema

## `dataset` (type: `string`):

No description

## `repositoryInfo` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "githubRepo": "QwenLM/Qwen-Agent",
    "maxFiles": 50
};

// Run the Actor and wait for it to finish
const run = await client.actor("akash9078/github-repository-analyzer").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "githubRepo": "QwenLM/Qwen-Agent",
    "maxFiles": 50,
}

# Run the Actor and wait for it to finish
run = client.actor("akash9078/github-repository-analyzer").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "githubRepo": "QwenLM/Qwen-Agent",
  "maxFiles": 50
}' |
apify call akash9078/github-repository-analyzer --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=akash9078/github-repository-analyzer",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "GitHub Repository Analyzer",
        "description": "AI-powered codebase analyst that analyzes any GitHub repository. Get intelligent insights, Q&A pairs, documentation, dependency analysis, and structured data about any codebase. Perfect for code review, onboarding, RAG pipelines, and AI agents.",
        "version": "1.1",
        "x-build-id": "LoOLvtXiAwHPMrPvV"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/akash9078~github-repository-analyzer/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-akash9078-github-repository-analyzer",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/akash9078~github-repository-analyzer/runs": {
            "post": {
                "operationId": "runs-sync-akash9078-github-repository-analyzer",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/akash9078~github-repository-analyzer/run-sync": {
            "post": {
                "operationId": "run-sync-akash9078-github-repository-analyzer",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "githubRepo"
                ],
                "properties": {
                    "githubRepo": {
                        "title": "GitHub Repository",
                        "type": "string",
                        "description": "GitHub repository URL or 'owner/repo' format. Accepts: 'owner/repo', 'https://github.com/owner/repo', or 'https://github.com/owner/repo.git'. Required.",
                        "default": "QwenLM/Qwen-Agent"
                    },
                    "maxFiles": {
                        "title": "Maximum Files to Analyze",
                        "minimum": 10,
                        "maximum": 200,
                        "type": "integer",
                        "description": "Maximum number of files to fetch and analyze from the repository. Higher values provide more context but increase processing time.",
                        "default": 50
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
