Skip to main content

Simple Python CLI tool for turning directories into a single text file for input to LLMs.

Project description

grabit

grabit is a command-line tool for recursively scanning a directory, extracting file contents, and saving or copying them to the clipboard while respecting .grabit ignore rules. The tool helps turn complex projects into LLM input for big context questions.

Features

  • Recursively extracts file contents from a directory.
  • Respects .grabit ignore files (similar to .gitignore).
  • Saves extracted content to a file or copies it to the clipboard.
  • Works on Windows, macOS, and Linux.

Installation

Install grabit using pip:

pip install grabit

Usage

Basic Usage

grabit /path/to/directory

Save Output to a File

grabit /path/to/directory -o output.txt

Copy Output to Clipboard

grabit /path/to/directory -c

Ignore Files

To ignore specific files or patterns, create a .grabit file in the root of your project. This works similarly to .gitignore.

Example .grabit:

*.log
__pycache__/
secrets.txt

Example Output

When run, grabit will generate a structured output:

## `src/main.py`:
``
print("Hello, World!")
``

## `README.md`:
``
# Project Readme
``

Future Features

  • include and exclude sections in .grabit.
  • different titled configurations in the .grabit file. i.e. you could have a configuration for getting section A of your app, and another for section B of your app to make it easier to set the configs once and not worry afterwards.
  • include a directory tree in the output as well as the code.
  • tell the user the rough number of tokens that have been found across all the files.
  • if the number of tokens is high, intelligently group files by suffix and prefix and ask the user if they'd like to include or exclude them.
  • ask the user if they'd like to include only a snippet of parts of long files, i.e. first 50 lines or so. Allow them to set this on a per file basis.
  • predict the number of tokens in a file based on the number of characters in each file.
  • automatically generate or update the .grabit file to reflect the user's choices.
  • ask the user if they want to include large directories as well, not just by prefix.
  • add an option for setting up a query on the cli that helps grabit decide how simliar files are to that query and suggest including or discluding based on that.
  • store the query inside of the .grabit file for faster query re-runs.
  • if the files have git history, find the git history of every collected file and add when it was last changed.
  • taking the above further, optionally add the entire git log of commits for each file, or the last N commits or what have you. This could add extra context for an LLM.
  • add tests to the package to avoid changes causing failure.
  • decide on versioning strategy and add to README.md

License

MIT License

Connor Skelland

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

grabit-0.1.3.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

grabit-0.1.3-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file grabit-0.1.3.tar.gz.

File metadata

  • Download URL: grabit-0.1.3.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.1 CPython/3.12.2 Darwin/24.2.0

File hashes

Hashes for grabit-0.1.3.tar.gz
Algorithm Hash digest
SHA256 13cd425177c198b50bd03b5e1a2ba784be69f05504ef2cf67ff1ff8d45e3c9d3
MD5 0383ecba890ad40d63891b685bdeb886
BLAKE2b-256 d75131754b3cd83c8a05fe69a9c08213cb8f24bdab3e4ff40abc71a7e0f1b968

See more details on using hashes here.

File details

Details for the file grabit-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: grabit-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.1 CPython/3.12.2 Darwin/24.2.0

File hashes

Hashes for grabit-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 cc0fc110a841538ddf6c98d055f6765054e07c82a355397a5f97031614f9945e
MD5 2463f4b33324674656347afb7ccb2efc
BLAKE2b-256 89969b5bf0f427f7031b0a1ff8623cebdedcd8f613f0e7bd1cb25f02b1a91605

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page