repo-to-text-ai


Namerepo-to-text-ai JSON
Version 0.2.1 PyPI version JSON
download
home_pageNone
SummaryA tool to turn an entire Git repository into a single organized text file for AI context.
upload_time2025-07-19 13:16:09
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseNone
keywords git repository context ai llm
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Repo-to-Text-AI

**Turn an entire Git repository into a single, organized text file designed for providing context to Large Language Models (LLMs).**

`repo-to-text-ai` is a command-line tool that intelligently traverses a local repository, respecting `.gitignore` rules, and consolidates the code into a clean text file. This is perfect for pasting complete project contexts into AI prompts for analysis, documentation, or feature development.

---

## Features

-   **Single File Output:** Combines all relevant source files into one `.txt` file.
-   **Project Tree Summary:** Automatically generates a directory tree at the beginning of the output for a high-level overview.
-   **Smart Exclusion:**
    -   Excludes the `.git` directory by default.
    -   Automatically respects rules in `.gitignore`.
    -   Allows for a user-defined `.context_ignore` file for additional, AI-specific exclusions.
    -   Skips binary files to keep the output clean.
-   **Progress Bar:** Shows a progress bar for large repositories so you know it's working.
-   **Easy to Use:** A simple and intuitive command-line interface.

## Installation

You can install `repo-to-text-ai` directly from PyPI:

```bash
pip install repo-to-text-ai
```

## Usage

Navigate to the root directory of the Git repository you want to process and run the command:

```bash
repo-to-text-ai .
```

This will create a `context_output.txt` file in the current directory.

### Options

-   **Specify Output File:** Use the `--output` or `-o` flag to specify a different name or location for the output file.

    ```bash
    repo-to-text-ai . -o my_project_context.txt
    ```

-   **Specify Repository Path:** You can run the command from anywhere by providing the path to the repository.

    ```bash
    repo-to-text-ai /path/to/your/project
    ```

### Excluding Additional Files (`.context_ignore`)

Sometimes you want to exclude more files from the AI's context than you have in your standard `.gitignore` (e.g., test files, examples).

You can create a `.context_ignore` file in the root of your repository. It uses the exact same syntax as a `.gitignore` file.

**Example `.context_ignore`:**

```
# Exclude all test files from the AI context
tests/

# Exclude specific large data files
data/large_dataset.csv```

---

## Development

Interested in contributing? We use `pytest` for testing and `ruff`/`black` for formatting.

### Prerequisites

-   Python 3.8+
-   [Docker](https://www.docker.com/get-started') (Optional, for isolated environment)

### Local Setup

1.  **Clone the repository:**
    ```bash
    git clone https://github.com/zhu-weijie/repo-to-text-ai.git
    cd repo-to-text-ai
    ```

2.  **Create and activate a virtual environment:**
    ```bash
    python3 -m venv .venv
    source .venv/bin/activate
    ```

3.  **Install in editable mode with test dependencies:**
    ```bash
    pip install -e ".[test]"
    ```

4.  **Run the tests:**
    ```bash
    pytest
    ```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "repo-to-text-ai",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "git, repository, context, ai, llm",
    "author": null,
    "author_email": "zhu-weijie <byzhubaiyuan@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/fa/52/143bdf1b67a6a046ef07da21b7f2edd4dbd756a3b58d9e6f166bc9b51e55/repo_to_text_ai-0.2.1.tar.gz",
    "platform": null,
    "description": "# Repo-to-Text-AI\n\n**Turn an entire Git repository into a single, organized text file designed for providing context to Large Language Models (LLMs).**\n\n`repo-to-text-ai` is a command-line tool that intelligently traverses a local repository, respecting `.gitignore` rules, and consolidates the code into a clean text file. This is perfect for pasting complete project contexts into AI prompts for analysis, documentation, or feature development.\n\n---\n\n## Features\n\n-   **Single File Output:** Combines all relevant source files into one `.txt` file.\n-   **Project Tree Summary:** Automatically generates a directory tree at the beginning of the output for a high-level overview.\n-   **Smart Exclusion:**\n    -   Excludes the `.git` directory by default.\n    -   Automatically respects rules in `.gitignore`.\n    -   Allows for a user-defined `.context_ignore` file for additional, AI-specific exclusions.\n    -   Skips binary files to keep the output clean.\n-   **Progress Bar:** Shows a progress bar for large repositories so you know it's working.\n-   **Easy to Use:** A simple and intuitive command-line interface.\n\n## Installation\n\nYou can install `repo-to-text-ai` directly from PyPI:\n\n```bash\npip install repo-to-text-ai\n```\n\n## Usage\n\nNavigate to the root directory of the Git repository you want to process and run the command:\n\n```bash\nrepo-to-text-ai .\n```\n\nThis will create a `context_output.txt` file in the current directory.\n\n### Options\n\n-   **Specify Output File:** Use the `--output` or `-o` flag to specify a different name or location for the output file.\n\n    ```bash\n    repo-to-text-ai . -o my_project_context.txt\n    ```\n\n-   **Specify Repository Path:** You can run the command from anywhere by providing the path to the repository.\n\n    ```bash\n    repo-to-text-ai /path/to/your/project\n    ```\n\n### Excluding Additional Files (`.context_ignore`)\n\nSometimes you want to exclude more files from the AI's context than you have in your standard `.gitignore` (e.g., test files, examples).\n\nYou can create a `.context_ignore` file in the root of your repository. It uses the exact same syntax as a `.gitignore` file.\n\n**Example `.context_ignore`:**\n\n```\n# Exclude all test files from the AI context\ntests/\n\n# Exclude specific large data files\ndata/large_dataset.csv```\n\n---\n\n## Development\n\nInterested in contributing? We use `pytest` for testing and `ruff`/`black` for formatting.\n\n### Prerequisites\n\n-   Python 3.8+\n-   [Docker](https://www.docker.com/get-started') (Optional, for isolated environment)\n\n### Local Setup\n\n1.  **Clone the repository:**\n    ```bash\n    git clone https://github.com/zhu-weijie/repo-to-text-ai.git\n    cd repo-to-text-ai\n    ```\n\n2.  **Create and activate a virtual environment:**\n    ```bash\n    python3 -m venv .venv\n    source .venv/bin/activate\n    ```\n\n3.  **Install in editable mode with test dependencies:**\n    ```bash\n    pip install -e \".[test]\"\n    ```\n\n4.  **Run the tests:**\n    ```bash\n    pytest\n    ```\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A tool to turn an entire Git repository into a single organized text file for AI context.",
    "version": "0.2.1",
    "project_urls": {
        "Bug Tracker": "https://github.com/zhu-weijie/repo-to-text-ai/issues",
        "Homepage": "https://github.com/zhu-weijie/repo-to-text-ai"
    },
    "split_keywords": [
        "git",
        " repository",
        " context",
        " ai",
        " llm"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "b7961f3d8166d320fd07388faa7b83f8a48b72e9a87294d491083d4ccb40afc1",
                "md5": "af10f8bdce95aa14685a34c551ba8521",
                "sha256": "f9e831be770a78267e11c8706ee317869c0129cfc0a328768a92ba81b527edf3"
            },
            "downloads": -1,
            "filename": "repo_to_text_ai-0.2.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "af10f8bdce95aa14685a34c551ba8521",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 6685,
            "upload_time": "2025-07-19T13:16:06",
            "upload_time_iso_8601": "2025-07-19T13:16:06.968866Z",
            "url": "https://files.pythonhosted.org/packages/b7/96/1f3d8166d320fd07388faa7b83f8a48b72e9a87294d491083d4ccb40afc1/repo_to_text_ai-0.2.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "fa52143bdf1b67a6a046ef07da21b7f2edd4dbd756a3b58d9e6f166bc9b51e55",
                "md5": "987fcd7e7aa072d955bd4389cc8024af",
                "sha256": "beb7a09409ec83354f422b568b1f054c44f8c7574296225d0836aed1514038ed"
            },
            "downloads": -1,
            "filename": "repo_to_text_ai-0.2.1.tar.gz",
            "has_sig": false,
            "md5_digest": "987fcd7e7aa072d955bd4389cc8024af",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 6676,
            "upload_time": "2025-07-19T13:16:09",
            "upload_time_iso_8601": "2025-07-19T13:16:09.713108Z",
            "url": "https://files.pythonhosted.org/packages/fa/52/143bdf1b67a6a046ef07da21b7f2edd4dbd756a3b58d9e6f166bc9b51e55/repo_to_text_ai-0.2.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-19 13:16:09",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "zhu-weijie",
    "github_project": "repo-to-text-ai",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "repo-to-text-ai"
}
        
Elapsed time: 0.56821s