Package: repo2txt
repo2txtOverviewrepo2txtis a Python tool I assembled to help streamline the process of preparing code base training data for GPT-style Models (LLMs). It's especially helpful in passing a codebase to a GPT. This script automates the task of compiling assets from a project or repository into a single, comprehensive text file or Word document. The resulting file includes a hierarchical tree of the directory structure and the contents of each file.FeaturesDirectory/File Tree: Generates a detailed overview of the repository's directory and file structure.File Contents: Includes the content of each file, offering a comprehensive view into the code or text within the repository.Output Formats: Supports output in both.txtand.docxformats.Customizable Ignoring Mechanism: Provides options to ignore specific file types, individual files, and directories, allowing for a tailored documentation process.Command-Line Flexibility: Various command-line arguments are available to customize the script's output according to the user's needs.Suggested InstallationFor ease of use,repo2txtcan be installed via pip:pipinstallrepo2txtAlternatively, you can directly run therepo2txt.pyscript. Ensure to installpython-docxif using this method.UsageIf installed with pip simply invoke withrepo2txtand any arguments you want.IMPORTANT: Remember that if you run repo2txt without any arguments it will create a txt document which will include ALL the files and their contents in the directory its inovked in and all of its subdirectories. This can be a massive ammount of data. I strongly suggest to exclude directories such as node_modules, .angular and similar. You can do this by simply adding the --exclude-dir argument followed by the directory or directories you wish to ignore.For example:repo2txt-r[path_to_repo]-o[output_file_name]Replace [path_to_repo] with the path to your repository and [output_file_name] with your desired output file name (including the .txt or .docx extension).By default, if no path is specified, the script operates in the current directory. Similarly, if no output file name is provided, it defaults tooutput.txt.Optional Command-Line Arguments:-r,--repo_path: Specify the path to the repository. Defaults to the current directory if not specified.-o,--output_file: Name for the output file. Defaults to "output.txt".--ignore-files: List of file names to ignore (e.g.,--ignore-files file1.txt file2.txt). Specify 'none' to ignore no files.--ignore-types: List of file extensions to ignore (e.g.,--ignore-types .log .tmp). Defaults to a predefined list inconfig.json. Specify 'none' to ignore no types.--ignore-settings: Flag to ignore common settings files.--exclude-dir: List of directory names to exclude (e.g.,--exclude-dir dir1 dir2). Specify 'none' to exclude no directories.--include-dir: Include only a specific directory and its contents (e.g.,--include-dir src).ExamplesDocumenting a Repository to a Text File:repo2txt-r/path/to/repository-ooutput.txtDocumenting with Exclusions:repo2txt-r/path/to/repository-ooutput.docx--ignore-types.log.tmp--exclude-dirtestsContributingContributions to enhancerepo2txtare always welcome. Feel free to fork the repository, make your improvements, and submit a pull request.