#documentation #llm #cli #ai #command-line-arguments #command-line-tool

bin+lib dumpfiles

A CLI and library for generating structured YAML representations of directory contents, optimized for efficiently sharing codebases with LLMs

2 unstable releases

Uses old Rust 2015

new 0.2.0 Mar 16, 2025
0.1.0 Aug 27, 2024

#515 in Filesystem

Download history 4/week @ 2024-12-09 3/week @ 2025-02-03

79 downloads per month

MIT license

11KB
148 lines

dumpfiles

dumpfiles is a Rust command-line tool to generate a structured YAML representation of a directory's contents, including metadata and the contents of text files. It's designed to make it easy to share an entire code repository or any set of text files to an LLM (GPT-4o, Claude, etc.) for analysis or documentation.

Features

  • YAML Output: Generates a structured YAML file with file paths, sizes, token counts and contents.
  • Integrates with .gitignore files, ie. it will ignore files specified in .gitignore
  • Supports custom additional ignore patterns using the same syntax as .gitignore files, in a .dumpignore file

Installation

To install dumpfiles, you need to have Rust and Cargo installed on your system. Then, you can build the project from source:

cargo install dumpfiles

Usage

dumpfiles [OPTIONS] <DIRECTORY>

This will scan <directory> and output a output.yaml file.

Arguments

  • <DIRECTORY>: Path to the directory to process

Options

  • -o, --output <FILE>: Path to the output file (default: "output.yaml")
  • -g, --gitignore <FILE>: Path to the .gitignore file (default: ".gitignore")
  • --no-gitignore: Ignore the .gitignore file
  • -d, --dumpignore <FILE>: Path to the .dumpignore file (default: ".dumpignore")

Example

dumpfiles src/ -o project_dump.yaml -d ../.dumpignore

This command will process the src directory, ignore all files specified in the ../.dumpignore file, and save the output to project_dump.yaml.

Output Format

A generated output.yaml might look like this:

Example:

project: my_project
files:
  - path: Cargo.toml
    size: "1.5 KB"
    lines: 20
    tokens: 50
    content: |
      [package]
      name = "my_project"
      version = "0.1.0"
  
  - path: src/main.rs
    size: "3.2 KB"
    lines: 120
    tokens: 500
    content: |
      fn main() {
          println!("Hello, world!");
      }

Contributing

Contributions are welcome! Please feel free to submit a PR or open an issue.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Dependencies

~15–24MB
~182K SLoC