Repo-Documenter is a PowerShell script that generates comprehensive documentation for a repository, including a tree view of the repository structure and the contents of specified files. The aggregated file is useful for code review, documentation, or use by an AI assistant.
- Generates a tree view of the repository structure
- Aggregates content from specified files
- Safely handles binary files by excluding their content
- Outputs a single Markdown file containing the repository documentation
- Configurable via a simple configuration file
- PowerShell 5.1 or later
- Clone this repository or download the
Repo-Documenter.ps1
script. - Ensure that PowerShell execution policy allows running scripts.
- Create a
repo_documenter.config
file in the root of the repository you want to document. - Add patterns to the
repo_documenter.config
file to specify which files and directories to include. - Run the script with the following command:
.\Repo-Documenter.ps1 -RepoPath <path_to_your_repository> [-OutputFile <output_file_name>]
If no output file is specified, the script will create a Markdown file named after the repository in the current directory.
Create a repo_documenter.config
file in the root of your repository. Each line in this file should contain a pattern for files or directories to include. For example:
*.md
src/*
docs/*.txt
This configuration will include all Markdown files, everything in the src
directory, and all text files in the docs
directory.
The script now safely handles binary files:
- Binary files (e.g., images, executables) are detected automatically.
- Content of binary files is not included in the output to prevent corruption.
- Binary files are listed in the repository structure but marked as binary in the file contents section.
The script generates a Markdown file containing:
- A tree view of the repository structure (based on the configuration)
- The contents of all included text files
- Placeholders for binary files