Skip to main content

A human-readable tar format for text files, based on grep . -r output

Project description

human-tar

@readwithai - X - blog - machine-aided reading - 📖⚡️🖋️

A human-readable tar format for text files. Easy for AIs to write and read.

This includes AI generated code. The interface is liable to change -- so do not use this in programs.

Motivation

I've been doing a little vibe-coding with online LLMs and found myself occasionally producing a number of files to share. While some online LLMs can produce tar files, this process is often buggy and slow compared to producing output like this (using prompts)

Alternatives and prior Work

This format is based on the output of grep . -r . - which can be used to produce output to give to an LLM (with the appropriate ignore flags)

You could use claude code cursor/windsurf or another AI tool to circumvent the need for this sort of tool. There are various tools to wrap up a codebase ready to be sent into an AI, but not necessarily the other way.

Installation

Install human-tar from PyPI using pipx

pipx install human-tar

Usage

human-tar will give you the output for the current git repo in this format. human-tar bytes tells you how many bytes each file is taking up. human-tar exclude '*.json' excludes all json iles human-tar exclude files excludes a files. human-untar unpacks the output in the form of grep . -r into the original file structure. It reads input from a file or stdin and writes files to the current directory by default.

Compression

While very-readable, and the output of a grep a standard tool, the default output is longer than it needs to be causing claude to hit up against limits.

Examples

As a demonstraction, this command produces human-tar input using grep and feeds this into human-tar.

grep . -r /path/to/dir | human-untar

You can also provide a path on the current directory or from the clipboard using xclip on linux or pblaste on mac

human-untar file.txt
human-untar <(xclip -o -selection CLIPBOARD)

For testing purposes, you might want to output into a different directory using the -o option

human-tar file.text -o file

Input Format

The input should be in the format of grep . -r output, e.g.:

src/main.c:int main() {
src/main.c:    printf("Hello, world!\n");
src/utils/helper.c:void help() {

This will create (in the current directory by default):

./
├── src/
│   ├── main.c
│   └── utils/
│       └── helper.c

Options

  • -o, --output-dir: Specify the output directory (default: current directory).
  • Example: human-tar -o my_output_dir grep_output.txt

About me

I am @readwithai. I create tools for reading, research and agency sometimes using the markdown editor Obsidian.

I also create a stream of tools like this that are related to carrying out my work. As users of tool are likely interesting in AI you might like to read my blog about tools for reading with ai.

I write about lots of things - including tools like this - on X. My blog is more about reading and research and agency.

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

human_tar-3.0.2.tar.gz (8.3 kB view details)

Uploaded Source

Built Distribution

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

human_tar-3.0.2-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file human_tar-3.0.2.tar.gz.

File metadata

  • Download URL: human_tar-3.0.2.tar.gz
  • Upload date:
  • Size: 8.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for human_tar-3.0.2.tar.gz
Algorithm Hash digest
SHA256 e129556090c55748d14b1b8186f91a799103d2d6a14b01f759b9935443ee7dbf
MD5 b38cb81ee1f8af3238c8cd84fbbe9b3a
BLAKE2b-256 80c36bfd274a09b83cc18b7ffc1ebcd60097a7d6f2a5c57441bc9b09bbdc99d5

See more details on using hashes here.

File details

Details for the file human_tar-3.0.2-py3-none-any.whl.

File metadata

  • Download URL: human_tar-3.0.2-py3-none-any.whl
  • Upload date:
  • Size: 9.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for human_tar-3.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 57e52bcec8efd55621f560b0c940c1eddbf90a46b31ebe55d98e1e754a42c020
MD5 c4f4ba824531900f82aa42aa76027c9a
BLAKE2b-256 6b492a3f5e62a9249cdc8d520808d577a47d6602650cbae0186562430dd3209a

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