Launching CodeWeaver

Continuing to open-source internal tools, I'm releasing CodeWeaver, a CLI to generate a single markdown file from a directory of source files. The idea is to facilitate sharing and feeding the codebase information to AI tools. Check out https://github.com/tesserato/CodeWeaver for more.

from https://github.com/tesserato/CodeWeaver/edit/main/README.md:

CodeWeaver: Generate a Markdown Document of Your Codebase Structure and Content

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.

Key Features

Installation

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 codeweaver

Usage

For help, run

codeweaver -h

For actual usage, run

codeweaver [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.

Examples

Generate documentation for the current directory:

./codeweaver

This 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.*).

Specify a different input directory and output file:

./codeweaver -dir=my_project -output=project_docs.md

This command will process the my_project directory and save the documentation to project_docs.md.

Ignore specific file types and directories:

./codeweaver -ignore="\.log,temp,build" -output=detailed_docs.md

This example will generate detailed_docs.md, excluding any files or directories with names containing .log, temp, or build. Regular expression patterns are comma-separated.

Save lists of included and excluded paths:

./codeweaver -ignore="node_modules" -included-paths-file=included.txt -excluded-paths-file=excluded.txt -output=code_overview.md

This 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.

Contributing

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.

License

CodeWeaver is released under the MIT License. See the LICENSE file for complete license details.