docgen is a fast and intelligent documentation generator that produces a single text file containing your entire project structure and source code. It simplifies sharing project context with LLMs and integrates seamlessly into your workflow, making it a valuable tool for developers looking to enhance project clarity and efficiency.
docgen - A Comprehensive Project Documentation Generator
docgen is a powerful and efficient tool designed to streamline project documentation. It generates a single, detailed text file that encapsulates the entire structure and source code of a project, making it ideally suited for sharing contexts with Large Language Models (LLMs). Simply drop the generated file into an AI chat and gain insights or discuss the entirety of your project with ease.
Key Features
- š³ Visual Directory Tree: Displays the structure of your project in an easily understandable format.
- š Concatenated File Contents: Compiles all relevant file contents with clear separators for better readability.
- šÆ Smart Filtering: Automatically respects
.gitignorerules and allows for custom exclusions, ensuring that the output is tailored to your needs. - š« Automatic Binary Detection: Skips various binary files, including images, executables, PDFs, and more.
- āļø Configurable: Easily customize behavior with a
.docgen_ignorefile to include or exclude specific files. - š Git-Aware: Utilizes
git check-ignorefor precise rule application. - š Size Limits: By default, excludes files larger than 2MB to optimize the output size.
Usage Overview
Execute docgen from the project's root directory to generate the documentation:
# Generate documentation (creates project_doc.txt)
docgen
# Preview files that will be included
docgen --files-list
# Visualize the directory structure
docgen --graphic-tree # With symbols
docgen --plain-tree # Plain text
# Specify a custom output location
docgen --output docs/my_project.txt
Configuration Options
Utilize a .docgen_ignore file to set custom inclusions/exclusions using the standard .gitignore syntax.
Example of a .docgen_ignore file:
# Always include this file
!.gitignore
!some_important_non_binary_file.foo
# Exclusions
.git/
log/
scratch.txt
junk/
Default Behavior
In the absence of a .docgen_ignore, docgen follows these rules:
- Always Included:
.gitignore - Always Excluded:
.git/directory,.DS_Store, etc.
Output Format
The output file project_doc.txt features:
# DOCGEN-OUTPUT: This file is generated by docgen. Do not include in next generation.
>>>> PROJECT FILE TREE: >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
.
āāā main.go
āāā README.md
āāā go.mod
<<<< END OF FILE TREE: <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
>>>> FILE CONTENTS: main.go >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
package main
...
<<<< END OF FILE: main.go <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Practical Use Cases
- š¤ Sharing with LLMs: Provide AI tools with complete project context for enhanced collaboration.
- š Code Reviews: Simplify project snapshots for clear code review processes.
- š Documentation: Create auto-generated project overviews with minimal effort.
- š Audits: Quickly assess the entire codebase for audits and compliance.
- š Tracking Changes: Utilize git diffs to monitor project evolution through documentation.
Conclusion
Committing the generated project_doc.txt not only offers visibility into project changes over time but also enhances accessibility for others who clone the repository, providing historical documentation in tandem with code changes. For further development and contribution, please refer to FUTURE.md or submit issues and pull requests.
No comments yet.
Sign in to be the first to comment.