CodeWeaver is a command-line tool designed to weave your codebase into a single, easy-to-navigate Markdown document. It recursively scans a directory, generating a structured representation of your project's file hierarchy and embedding the content of each file within code blocks. This tool simplifies codebase sharing, documentation, and integration with AI/ML code analysis tools by providing a consolidated and readable Markdown output. The output for the current repository can be found here.
- Comprehensive Codebase Documentation: Generates a Markdown file that meticulously outlines your project's directory and file structure in a clear, tree-like format.
- Code Content Inclusion: Embeds the complete content of each file directly within the Markdown document, enclosed in syntax-highlighted code blocks based on file extensions.
- Flexible Path Filtering: Utilize regular expressions to define ignore patterns, allowing you to exclude specific files and directories from the generated documentation (e.g.,
.git, build artifacts, specific file types). - Optional Path Logging: Choose to save lists of included and excluded file paths to separate files for detailed tracking and debugging of your ignore rules.
- Simple Command-Line Interface: Offers an intuitive command-line interface with straightforward options for customization.
If you have Go installed, run go install github.com/tesserato/CodeWeaver@latestto install the latest version of CodeWeaver or go install github.com/tesserato/CodeWeaver@vX.Y.Z to install a specific version.
Alternatively, download the appropriate pre built executable from the releases page.
If necessary, make the codeweaver executable by using the chmod command:
chmod +x codeweavercodeweaver -hcodeweaver [options]Options:
| Option | Description | Default Value |
|---|---|---|
-dir <directory> |
The root directory to scan and document. | Current directory (.) |
-output <filename> |
The name of the output Markdown file. | codebase.md |
-ignore "<regex patterns>" |
Comma-separated list of regular expression patterns for paths to exclude. | \.git.* |
-included-paths-file <filename> |
File to save the list of paths that were included in the documentation. | None |
-excluded-paths-file <filename> |
File to save the list of paths that were excluded from the documentation. | None |
-help |
Display this help message and exit. |
./codeweaverThis will create a file named codebase.md in the current directory, documenting the structure and content of the current directory and its subdirectories (excluding paths matching the default ignore pattern \.git.*).
./codeweaver -dir=my_project -output=project_docs.mdThis command will process the my_project directory and save the documentation to project_docs.md.
./codeweaver -ignore="\.log,temp,build" -output=detailed_docs.mdThis example will generate detailed_docs.md, excluding any files or directories with names containing .log, temp, or build. Regular expression patterns are comma-separated.
./codeweaver -ignore="node_modules" -included-paths-file=included.txt -excluded-paths-file=excluded.txt -output=code_overview.mdThis command will create code_overview.md while also saving the list of included paths to included.txt and the list of excluded paths (due to the node_modules ignore pattern) to excluded.txt.
Contributions are welcome! If you encounter any issues, have suggestions for new features, or want to improve CodeWeaver, please feel free to open an issue or submit a pull request on the project's GitHub repository.
CodeWeaver is released under the MIT License. See the LICENSE file for complete license details.