{"id":28901213,"url":"https://github.com/bes-dev/repo_to_prompt","last_synced_at":"2026-02-11T16:02:27.271Z","repository":{"id":277333925,"uuid":"915671422","full_name":"bes-dev/repo_to_prompt","owner":"bes-dev","description":"Convert repository to prompt","archived":false,"fork":false,"pushed_at":"2025-02-13T11:40:01.000Z","size":21,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-23T12:56:15.553Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bes-dev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-12T13:56:03.000Z","updated_at":"2025-02-13T11:40:05.000Z","dependencies_parsed_at":"2025-02-13T11:52:47.047Z","dependency_job_id":"baea0ed2-cbe4-4e89-ac6e-bd44e22c892a","html_url":"https://github.com/bes-dev/repo_to_prompt","commit_stats":null,"previous_names":["bes-dev/repo_to_prompt"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bes-dev/repo_to_prompt","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bes-dev%2Frepo_to_prompt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bes-dev%2Frepo_to_prompt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bes-dev%2Frepo_to_prompt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bes-dev%2Frepo_to_prompt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bes-dev","download_url":"https://codeload.github.com/bes-dev/repo_to_prompt/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bes-dev%2Frepo_to_prompt/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261103450,"owners_count":23109932,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-21T10:08:42.553Z","updated_at":"2026-02-11T16:02:27.254Z","avatar_url":"https://github.com/bes-dev.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# repo_to_prompt\n\n## Overview\n\n`repo_to_prompt` is a Python package that provides utilities for parsing a repository's file structure and source code into a formatted prompt. It can extract full file contents or only interface definitions from Python files. This tool is useful for generating structured representations of codebases, assisting in AI-powered code understanding, documentation, and summarization.\n\n## Features\n\n- Parse a repository (local directory or remote Git repository) into a structured prompt.\n- Extract and format folder tree structures.\n- Process multiple file types, identifying their language based on extensions.\n- Extract only interface definitions (classes, functions, and type annotations) from Python source files.\n- Support `.gitignore` and `.dixieignore` files to exclude specific files and directories.\n- Command-line interface (CLI) for easy usage.\n\n## Installation\n\nTo install the package, clone the repository and install dependencies:\n\n```sh\n# Clone the repository\n$ git clone https://github.com/your-repo/repo_to_prompt.git\n\n# Navigate to the directory\n$ cd repo_to_prompt\n\n# Install dependencies\n$ pip install -r requirements.txt\n```\n\nAlternatively, you can install it as a package:\n\n```sh\n$ pip install repo_to_prompt\n```\n\n## Usage\n\n### Command-Line Interface\n\nYou can use the `repo_to_prompt` CLI to generate a structured prompt from a local directory or a Git repository.\n\n#### Basic Usage\n\n```sh\n$ python -m repo_to_prompt.cli --path \u003cpath-to-repo\u003e\n```\n\n#### Extract Only Interfaces\n\nTo extract only class and function signatures from Python files:\n\n```sh\n$ python -m repo_to_prompt.cli --path \u003cpath-to-repo\u003e --interfaces-only\n```\n\n#### Parsing a Git Repository\n\nIf the provided path is a Git repository URL, it will be cloned into a temporary directory before processing:\n\n```sh\n$ python -m repo_to_prompt.cli --path https://github.com/user/repo.git\n```\n\n## Module Descriptions\n\n### `repo_to_prompt/cli.py`\n\n- Provides a command-line interface.\n- Accepts a repository path (local or remote Git repository).\n- Calls `FolderParser` to generate a structured prompt.\n\n### `repo_to_prompt/folder_parser.py`\n\n- Parses a folder structure, extracting file content and metadata.\n- Uses `IgnoreSpec` to respect `.gitignore` and `.dixieignore` rules.\n- Builds a formatted tree representation of the repository.\n- Calls `extract_interfaces.py` if the `--interfaces-only` flag is enabled.\n\n### `repo_to_prompt/extract_interfaces.py`\n\n- Parses Python source files using the AST (Abstract Syntax Tree).\n- Extracts class and function signatures, along with docstrings.\n- Removes implementation details to create an interface-only representation.\n\n### `repo_to_prompt/__init__.py`\n\n- Initializes the `repo_to_prompt` package.\n\n## Example Output\n\nWhen running `repo_to_prompt` on a sample project, the output follows this structure:\n\n```text\n* Folder tree *\n\nrepo/\n|-- main.py\n|-- utils.py\n|-- config/\n|   |-- settings.py\n`-- README.md\n\n* Sources *\n\n** FILE: repo/main.py **\n```python\nimport os\n\ndef hello():\n    \"\"\"Prints a greeting message.\"\"\"\n    print(\"Hello, world!\")\n```\n```\n\nIf `--interfaces-only` is specified:\n\n```text\n** FILE: repo/main.py **\n```python\ndef hello():\n    \"\"\"Prints a greeting message.\"\"\"\n```\n```\n\n## License\n\nThis project is licensed under the Apache License 2.0. See the `LICENSE` file for details.\n\n## Author\n\nCreated by **Sergei Belousov**.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbes-dev%2Frepo_to_prompt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbes-dev%2Frepo_to_prompt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbes-dev%2Frepo_to_prompt/lists"}