Skip to main content

A versatile tool to transform a project repository into a single, scroll-like text file.

Project description

Repo to Scroll (repo2scroll)

A command-line tool and Python library that transforms an entire project repository into a single, scroll-like text file. It intelligently filters files based on .gitignore rules, custom patterns, and file extensions, making it perfect for creating context files for LLMs, project snapshots, or code submissions.

Features

  • Single Scroll Output: Combines multiple source files into one continuous text file, like an ancient scroll.
  • Directory Tree: Automatically includes a tree-like layout of the project structure at the top of the output file.
  • Smart Filtering:
    • Respects .gitignore rules by default.
    • Option to disable .gitignore parsing (--no-gitignore).
    • Supports custom ignore files (e.g., .dockerignore) with the --ignore-file option.
    • Allows for on-the-fly exclusion patterns (--exclude).
  • Binary File Exclusion: Automatically skips common binary files (images, archives, executables, etc.) to keep the output clean.
  • Cross-Platform: Normalizes path separators to / for consistent output across Windows, macOS, and Linux.
  • Usable as a Library: Import bundle_project to get the bundled content as a string for use in your Python scripts.
  • Rich CLI: A user-friendly command-line interface with detailed help and examples.

Installation

You can install repo2scroll via pip. If you are installing from a local clone:

pip install .

Once published on PyPI, it will be:

pip install repo2scroll

Usage

As a Command-Line Tool

Once installed, you can use the repo2scroll command to generate a file directly.

Basic Usage

# Turn the current directory into a scroll named 'combined_output.txt'
repo2scroll .

# Specify a project directory and an output file name
repo2scroll ./path/to/my-project -o project_snapshot.txt

Excluding Files

# Exclude all .log files and the 'dist/' directory
repo2scroll . --exclude "*.log" "dist/"

# Use a custom ignore file (like .dockerignore)
repo2scroll . --ignore-file .dockerignore

Getting Help

repo2scroll --help

As a Python Library

You can also use repo2scroll within your own Python projects to get the bundled content as a string.

from repo2scroll import bundle_project
from pathlib import Path

project_directory = "./my-awesome-project"

if not Path(project_directory).is_dir():
    print(f"Error: Project directory '{project_directory}' not found.")
else:
    try:
        # Define extra patterns to ignore
        ignore_patterns = ["*.tmp", "credentials.json"]

        # Call the bundler function to get the content as a string
        scroll_content = bundle_project(
            project_dir=project_directory,
            extra_ignore_patterns=ignore_patterns,
            use_gitignore=True  # This is the default
        )

        # Now you can use the string as needed
        print("--- Generated Scroll Content (first 500 chars) ---")
        print(scroll_content[:500] + "...")
        print("-------------------------------------------------")

        # Or write it to a file yourself
        with open("my_bundle.txt", "w", encoding="utf-8") as f:
            f.write(scroll_content)
        print("Content also saved to 'my_bundle.txt'")

    except FileNotFoundError as e:
        print(f"Error: {e}")
    except Exception as e:
        print(f"An unexpected error occurred: {e}")

Output Format

The generated content (string or file) has a simple and clean structure:

<layout>
my-project/
├── src/
│   ├── main.py
│   └── utils.py
├── tests/
│   └── test_main.py
└── README.md
</layout>

<file path="src/main.py">
# Contents of src/main.py
...
</file>

<file path="src/utils.py">
# Contents of src/utils.py
...
</file>

...

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

repo2scroll-0.1.0.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

repo2scroll-0.1.0-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file repo2scroll-0.1.0.tar.gz.

File metadata

  • Download URL: repo2scroll-0.1.0.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.16

File hashes

Hashes for repo2scroll-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4e02e042dfe82a0925c1eb386fd900886d9a6cc49429ceb9f6ee0272137ee6f3
MD5 6351a6245cc252f68c224baeb0293532
BLAKE2b-256 22f25f4339f89db18e4854101f35d48bed5ba8f6fe7bc9993e3dda6a81ac6683

See more details on using hashes here.

File details

Details for the file repo2scroll-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for repo2scroll-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8c7ee499d9d95c5ed5dbe54d5bbe6a55cc0db6c4b72e902f7e06936b1517ecee
MD5 b2b19495dada8fcc50883485a1f8d048
BLAKE2b-256 edf94bd22980574f1c992d8c4a83fc0ca02c9cf3bdc3a62219ed039f7e47613b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page