Metadata-Version: 2.1
Name: repo2docs
Version: 0.1.0
Summary: Documentation from your codebase using LLMs
License: MIT
Author: Joe Petrantoni
Author-email: 79169021+jpetrantoni@users.noreply.github.com
Requires-Python: >=3.10,<4.0
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Dist: anthropic (>=0.25.7,<0.26.0)
Requires-Dist: instructor (>=1.2.5,<2.0.0)
Requires-Dist: openai (>=1.25.1,<2.0.0)
Requires-Dist: python-dotenv (>=1.0.1,<2.0.0)
Description-Content-Type: text/markdown

# Repo2Docs: Convert GitHub Repositories to Documentation

Inspired by [github2file](https://github.com/cognitivecomputations/github2file)

Repo2Docs is a Python-based tool designed to convert the contents of a GitHub repository into comprehensive documentation or diagrams. This tool leverages language model APIs such as OpenAI or Anthropic to process and generate documentation, making it easier for developers to create documentation for their projects.

## How It Works

```mermaid
sequenceDiagram
    participant U as User
    participant Main as Main Script
    participant RP as RepoProcessor
    participant TD as TextToDocs
    participant LLM as LLMClient
    U->>Main: Execute with parameters
    Main->>RP: Process repository
    RP->>Main: Return processed text
    Main->>TD: Request documentation type
    TD->>LLM: Request LLM generation
    LLM->>TD: Return generated content
    TD->>Main: Return documentation
    Main->>U: Save documentation to file
```
*Caption: This sequence diagram illustrates the flow of interactions from the user executing the script to the generation and saving of documentation.*


## Running Repo2Docs Locally

To run Repo2Docs on your local machine, follow these steps:

1. **Clone the Repository**:
   ```
   git clone https://github.com/earlybird-labs/repo2docs.git
   cd repo2docs
   ```

2. **Create and Activate Virtual Environment**:

   First, ensure you have Python installed on your system. Then, create a virtual environment and activate it:
   
   For macOS/Linux:
   ```
   python3 -m venv venv
   source venv/bin/activate
   ```
   
   For Windows:
   ```
   python -m venv venv
   .\venv\Scripts\activate
   ```

   **Install Dependencies**:
   
   After activating the virtual environment, install the required dependencies by running:
   ```
   pip install -r requirements.txt
   ```

3. **Set Up Environment Variables**:
   Create a `.env` file in the root directory and add your language model API keys:
   ```
   OPENAI_API_KEY=your_openai_api_key_here
   ANTHROPIC_API_KEY=your_anthropic_api_key_here
   ```

4. **Run the Tool**:
   Use the following command to convert a repository to documentation. Replace `path_to_repo.zip` and `output_file.md` with your repository's `.zip` file path and your desired output file path, respectively.
   ```
   cd src
   python repo2docs.py input/path_to_repo.zip output/output_file.md --type documentation --llm openai
   ```

   To generate mobile documentation, use `--type mobile`.
   To generate diagrams instead of documentation, use `--type diagram`.
   To generate database erd diagrams, use `--type database`.

## Supported File Types

Repo2Docs currently supports processing files with the following extensions: `.py`, `.js`, `.jsx`, `.ts`, `.tsx`, `.c`, `.cpp`, `.h`, `.hpp`. It filters out files from directories like `docs`, `examples`, `tests`, and others that are unlikely to contain useful information for documentation.

## Contributing

Contributions to Repo2Docs are welcome! Whether it's adding new features, improving documentation, or reporting issues, feel free to open an issue or submit a pull request.

## License

Repo2Docs is released under the MIT License. See the LICENSE file for more details.




