Skip to content

versaagonon/auto-generate-readme.md

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

Auto-Generate README.md File

This project automates the generation of a README.md file for a GitHub repository using the Gemini API. It analyzes the repository's file structure and content, then leverages the Gemini API to create a comprehensive and informative README file.

Key Features

  • Automated README Generation: Automatically creates a README.md file from a GitHub repository URL.
  • GitHub API Integration: Fetches file lists and code snippets directly from the GitHub API.
  • Gemini API Integration: Utilizes the Gemini API to generate descriptive and informative README content.
  • Customizable Prompt: Builds a structured prompt for the Gemini API, including file snippets and instructions.
  • File Content Extraction: Extracts relevant code and documentation snippets from the repository.
  • Environment Variable Configuration: Uses environment variables for API keys and model selection.
  • Error Handling: Includes robust error handling for API requests and data processing.
  • Snippet Size Limiting: Limits the size of file snippets to stay within API limits.
  • Command-Line Interface: Provides a command-line interface for easy usage.

Installation

  1. Clone the repository:

    git clone https://github.com/versaagonon/auto-generate-readme.md-file-.git
    cd auto-generate-readme.md-file-
  2. Install dependencies:

    pip install requests python-dotenv
  3. Set up environment variables:

    • Create a .env file in the project root.

    • Add your GitHub token (optional, but recommended for higher API rate limits) and Google API key:

      GITHUB_TOKEN=your_github_token
      GOOGLE_API_KEY=your_google_api_key
      

      You can also optionally specify the Gemini model to use:

      GEMINI_MODEL=gemini-2.0-flash
      

      If GEMINI_MODEL is not set, the default model gemini-2.0-flash will be used.

Usage

Run the automakereadme.py script with the GitHub repository URL as an argument:

python automakereadme.py https://github.com/owner/repo

You can also specify an output file path using the --out argument:

python automakereadme.py https://github.com/owner/repo --out my_readme.md

This will generate a README.md (or the specified output file) in the project directory.

Tech Stack and Dependencies

  • Python 3: The script is written in Python 3.
  • requests: Used for making HTTP requests to the GitHub and Gemini APIs.
  • python-dotenv: Used for loading environment variables from a .env file.
  • GitHub API: Used to fetch repository file structure and content.
  • Gemini API: Used to generate the README content.

Suggestions for Improvements

  1. More sophisticated file selection: Implement more advanced logic for selecting relevant files based on file type, size, and content. Consider using heuristics to identify important files that might be missed by the current selection criteria.
  2. Customizable prompt templates: Allow users to customize the prompt sent to the Gemini API to tailor the README generation process to their specific needs. This could involve providing different templates or allowing users to specify keywords or topics to include in the README.
  3. Automated deployment: Integrate the script into a CI/CD pipeline to

About

This project automatically generates a README.md file using the Gemini API and updates the repository with a GitHub Token.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages