Skip to content

Taco makes it easy to get your source code ready for LLMs. With just one command, it collects all your text files and merges them into a single file, so you can quickly create a complete prompt with all your source code.

License

Notifications You must be signed in to change notification settings

lucianoayres/taco

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

54 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŒฎ Taco

Taco Banner

Transform Your Entire Codebase into a Single, Simple Text File!

What's Taco? ๐ŸŒฎ ยท In Action ๐ŸŒถ๏ธ ยท Why Taco? ๐Ÿค” ยท Features โœจ ยท Project Structure ๐Ÿ“ ยท Getting Started ๐Ÿš€ ยท Arguments ๐Ÿ“ ยท How to Use Taco ๐ŸŒฎ ยท Pro Tips ๐Ÿ’ก ยท Makefile Commands ๐Ÿ› ๏ธ ยท Examples ๐Ÿ“š ยท Limitations โš ๏ธ ยท Roadmap ๐Ÿ—บ๏ธ ยท Contributions ๐Ÿฝ๏ธ ยท License ๐Ÿ“„

What's Taco? ๐ŸŒฎ

Taco is a simple tool that gathers all text files from a directory and its subdirectories, combining them into one file. Ideal for preparing source code or text content for use as prompts with large language models (LLMs), Taco streamlines the process, saving time by automating file gathering.

In Action ๐ŸŒถ๏ธ

Taco Demo

Why Taco? ๐Ÿค”

  • ๐Ÿ—‚๏ธ Efficient Aggregation: Automatically collects large numbers of text files.
  • โฑ๏ธ Saves Time: Eliminates manual copying, enhancing workflow.
  • ๐Ÿ›ก๏ธ Reduces Errors: Minimizes inconsistencies and mistakes.
  • ๐Ÿค– LLM Integration: Ideal for creating data-rich prompts.
  • ๐Ÿ“š Simplifies Documentation: Compiles documentation and source code.
  • ๐Ÿš€ Boosts Productivity: Streamlines tasks to enhance efficiency.

Features โœจ

  • ๐ŸŒฎ Automatic Gathering: Collects text files from specified directories and subdirectories.
  • ๐Ÿ“‚ Recursive Processing: Seamlessly handles all nested directories.
  • ๐Ÿ“ Flexible Directory and File Selection: Customizable file and directory filters.
  • ๐Ÿšซ Skip Hidden and Binary Files: Keeps output clean.
  • ๐Ÿ“ Detailed Status Updates: Displays progress and skips details.
  • ๐Ÿ”„ Append Mode: Adds to existing files without overwriting.
  • โœจ Customizable Output: Set custom output names and locations.
  • ๐ŸŽฏ Include/Exclude Files by Pattern: Include or exclude files matching specific patterns or regular expressions.

Project Structure ๐Ÿ“

/taco
โ”œโ”€โ”€ go.mod            # Go module file
โ”œโ”€โ”€ Makefile          # Makefile to simplify commands
โ”œโ”€โ”€ src               # Directory containing the source code
โ”‚   โ””โ”€โ”€ main.go       # Main Go file
โ”‚   โ””โ”€โ”€ main_test.go  # Main Go Test file

Getting Started ๐Ÿš€

Installation Options

Option 1: Download Pre-built Binary (Linux Only)

  1. Navigate to the Releases Page.

  2. Download the Latest Release for Linux.

  3. Make the Binary Executable:

    chmod +x taco
  4. Move the Binary to /usr/local/bin/:

    sudo mv taco /usr/local/bin/

Option 2: Build from Source

  1. Clone the Repository:

    git clone https://github.com/lucianoayres/taco.git
    cd taco
  2. Initialize the Go Module:

    go mod tidy
  3. Build Taco:

    make build
  4. Install Taco:

    sudo make install

Running Taco

After setting up Taco, you can run it in one of the following ways:

Option 1: Running from the Binary (Preferred)

If you downloaded the binary or built it yourself, you can run Taco directly by simply typing:

taco

This will execute the binary from anywhere if itโ€™s located in your systemโ€™s PATH (e.g., /usr/local/bin/). Alternatively, if the binary is in your current directory, you can run:

./taco

Option 2: Running from the Source Code

To run Taco directly from the source without building, navigate to the projectโ€™s root directory and use:

go run ./src

This command will execute the Taco code in the src directory, bypassing the need to build the binary first.

Arguments ๐Ÿ“

Use these optional flags to customize how Taco processes your files:

  • -output

    • Specifies the output file name (default: taco.txt).
  • -include-ext

    • Specify file extensions to include (e.g., .go,.md).
  • -exclude-ext

    • Specify file extensions to exclude (e.g., .test,.spec.js).
  • -include-dir

    • Include specific directories for processing.
  • -exclude-dir

    • Exclude root-level directories from processing.
  • -include-file-pattern

    • Include files matching specific patterns or regular expressions (e.g., ^main\.go$).
  • -exclude-file-pattern

    • Exclude files matching specific patterns or regular expressions (e.g., .*_test\.go$,^LICENSE$).
  • -verbose

    • Enables verbose output for detailed status messages.

Notes

  • Precedence: When both -include-ext and -exclude-ext are used, Taco first filters files by -include-ext, then excludes any files that match -exclude-ext. The same applies to -include-dir and -exclude-dir.

  • Extension Format: Taco automatically prepends a dot if missing.

  • Pattern Matching: The -include-file-pattern and -exclude-file-pattern flags use regular expressions for pattern matching. Ensure patterns are valid and properly escaped.

How to Use Taco ๐ŸŒฎ

Basic Usage

Run Taco without arguments to concatenate all text files in the current directory and its subdirectories (excluding hidden and binary files):

taco

Customizing File Selection

Specifying Directories to Include or Exclude

  • Include specific directories: Use -include-dir to process only specified directories. If omitted, Taco processes all subdirectories in the current directory.

    taco -include-dir=src,docs
  • Exclude specific directories: Use -exclude-dir to skip certain directories. For instance, to skip vendor and tests:

    taco -exclude-dir=vendor,tests

Note: The -exclude-dir flag applies only to root-level directories of the specified path.

Filtering Files by Extension

Choose files by extension using these flags:

  • Include specific file types: Use -include-ext to focus on particular file types, such as .go and .md.

    taco -include-ext=.go,.md
  • Exclude certain file types: Use -exclude-ext to omit specific extensions, like .log and .tmp.

    taco -exclude-ext=.log,.tmp

Tip: Taco first filters files by -include-ext, then removes those matching -exclude-ext, if both are specified.

Including or Excluding Files by Pattern

Use the -include-file-pattern and -exclude-file-pattern flags to include or exclude files matching specific patterns or regular expressions.

  • Include files matching patterns:

    taco -include-file-pattern="^main\.go$,^README\.md$"
  • Exclude files matching patterns:

    taco -exclude-file-pattern=".*_test\.go$,.*\.bak$"

Note: Patterns are regular expressions. Ensure they are properly quoted and escaped.

Combining Options

Combine flags to refine file selection. For example:

taco -output=my-taco.txt -include-dir=src,docs -exclude-dir=vendor,tests -include-ext=.go,.md -exclude-ext=.log,.tmp -include-file-pattern="^main\.go$,^README\.md$" -exclude-file-pattern=".*_test\.go$,^Makefile$,^LICENSE$"

This command combines .go and .md files from src and docs, excludes vendor and tests, includes files matching ^main\.go$ and ^README\.md$, excludes .log and .tmp files, and excludes files matching the specified patterns.

Pro Tips ๐Ÿ’ก

  • Recursive Processing: Taco traverses all subdirectories.
  • Only Text Files: Includes files based on content.
  • Custom Output: Set output file with -output.
  • Include/Exclude Specific Extensions: Use -include-ext or -exclude-ext.
  • Exclude Directories: Use -exclude-dir to omit directories.
  • Include/Exclude Files by Pattern: Use -include-file-pattern and -exclude-file-pattern for fine-grained file selection.
  • Append Mode: Appends new content to the existing output file if it already exists.
  • Detailed Status: Verbose mode for skip reasons.

Makefile Commands ๐Ÿ› ๏ธ

Simplify Taco usage with these Makefile commands:

  • Run Taco: make run
  • Build Taco: make build
  • Install Taco: sudo make install
  • Clean Build Files: make clean
  • Uninstall Taco: sudo make uninstall
  • Run Tests: make test
  • Run Tests with Coverage: make test-coverage
  • Generate HTML Coverage Report: make coverage-html

Examples ๐Ÿ“š

  • Concatenate Text Files in Current Directory:

    taco
  • Custom Output Filename:

    taco -output=my-files.txt
  • Specify Directories:

    taco -output=my-taco.txt -include-dir=src,docs
  • Include Only Go and Markdown Files:

    taco -include-ext=.go,.md
  • Exclude Specific Extensions:

    taco -exclude-ext=.test,.spec.js
  • Include Files Matching Patterns:

    taco -include-file-pattern="^main\.go$,^README\.md$"
  • Exclude Files Matching Patterns:

    taco -exclude-file-pattern=".*_test\.go$,^Makefile$,^LICENSE$"
  • Exclude Directories and Set Custom Output:

    taco -output=final.txt -exclude-dir=vendor,tests -include-dir=src,docs -include-ext=.py,.md -exclude-ext=.log,.tmp -include-file-pattern="^app\.py$" -exclude-file-pattern=".*_test\.py$"

Limitations โš ๏ธ

  • Binary Files Excluded: Binary files are automatically excluded.
  • Hidden Files Skipped: Files/directories starting with a dot are skipped.
  • File Extension Detection: Relies on extensions for inclusion/exclusion.
  • Pattern Matching: Inclusion and exclusion by pattern use regular expressions, which require valid syntax.
  • Conflict Handling: When using both inclusion and exclusion arguments, overlapping criteria may need careful management.

Roadmap ๐Ÿ—บ๏ธ

  • Launch v1.0
  • Implement -include-ext feature (Completed)
  • Implement -exclude-ext feature (Completed)
  • Implement -exclude-dir feature (Completed)
  • Implement -include-dir feature (Completed)
  • Add regex-based filename exclusion (-exclude-file-pattern) (Completed)
  • Add regex-based filename inclusion (-include-file-pattern) (Completed)
  • Support for .gitignore files
  • Enhanced error handling and logging

Contributions ๐Ÿฝ๏ธ

Found a bug or have a feature request? Open an issue or create a pull request on GitHub. Let's make Taco even better!

License ๐Ÿ“„

This project is licensed under the MIT License. Enjoy your tacos responsibly!

About

Taco makes it easy to get your source code ready for LLMs. With just one command, it collects all your text files and merges them into a single file, so you can quickly create a complete prompt with all your source code.

Topics

Resources

License

Stars

Watchers

Forks