Skip to content

A Python script that generates a text representation of a repository's structure and content for AI

Notifications You must be signed in to change notification settings

KirnoNTX/Repo2Text

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

Repo2Text

A Python script that generates a text representation of a repository's structure and content.

Features

  • Creates a tree-like visualization of directories and files
  • Dumps file contents into a single output file
  • Excludes common unwanted directories (.git, node_modules, etc.)
  • Optional filtering of media files and directories
  • Configurable recursion depth

Usage

git clone https://github.com/KirnoNTX/Repo2Text.git
chmod +x repo2text
./repo2text

or

./repo2text [-s] [-r DEPTH]

Options:
  -s, --small      Exclude media files (images, videos, etc.)
  -r, --recursive  Set maximum depth for directory exploration

Output

Creates repo2text.txt containing:

  1. Tree structure of the repository
  2. Content of all readable files

Excluded by Default

  • Directories: .git, node_modules, dist, test, etc.
  • Files: package-lock.json, log files, temporary files
  • Binary and media files (when using -s flag)

Error Handling

  • UTF-8 encoding errors are logged but don't stop execution
  • Missing permissions or invalid paths are reported with error messages

License

MIT | @Kirno

About

A Python script that generates a text representation of a repository's structure and content for AI

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages