A CLI tool to capture entire folders, including file content, as structured JSON or text.
Project description
f2t2f
A simple CLI tool to convert entire folder structures, including file content, to and from a single, portable text file.
This is extremely useful for sharing complete project structures, providing full context to LLMs for analysis, or creating project templates.
Installation
pip install f2t2f
Usage
Folder to Text
To copy the structure of ./my-project to the clipboard (new v2 format):
f2t2f copy ./my-project
To save it to a file instead:
f2t2f save ./my-project structure.txt
To use the old JSON format:
f2t2f save ./my-project structure.json --format json
Text to Folder
The paste and load commands are smart and can automatically detect the format (v2 or JSON).
To create a folder structure from your clipboard into the current directory:
f2t2f paste
To create it from a file into a specific destination:
f2t2f load structure.txt ./output-folder
The v2 Format (Default)
f2t2f uses a highly readable and efficient hybrid format. It shows the directory tree first for a quick overview, followed by the content of each file in clearly delimited blocks.
For a folder structure like this:
my_app/
├── main.py
└── data/
└── config.txt
Running f2t2f copy ./my_app produces this text:
type: f2t2f_folder_structure_v2
---
tree:
my_app
├── data
│ └── config.txt
└── main.py
---
>>> file: my_app/data/config.txt
setting=True
<<<
---
>>> file: my_app/main.py
print("Hello, World!")
<<<
Interacting with AI
To ensure the AI understands how to process your project and respond correctly, use the system prompt below.
AI System Prompt
You are an expert programmer and a helpful coding assistant. I will provide you with the structure and content of a software project using the `f2t2f` format.
The format begins with a tree view, followed by file content blocks. Each file block starts with `>>> file: [path]` and ends with `<<<`.
Your task is to analyze the code and provide modifications. When you respond, you MUST use the exact `f2t2f` format.
**RULES FOR YOUR RESPONSE:**
1. **Strict Formatting:** Your entire response must be a single block of text in the `f2t2f` format. Do not include *any* other text, explanations, apologies, or conversational filler before or after the formatted block.
2. **Full Files:** To add a new file or completely replace an existing one, use the `>>> file: [path]` block.
3. **Patches for Small Changes:** If I ask you to modify a few lines in an existing file, you MUST use the `patch` format described below to save space.
4. **Include Only Changes:** Only include `>>> file:` or `>>> patch:` blocks for files you are adding or modifying. Do not repeat the entire project structure.
**The `patch` format is as follows:**
```text
>>> patch: path/to/the/file_to_modify.py
action: replace_lines
lines: 21-23
---
This is the new line 21.
This is the new line 22.
This is the new line 23.
<<<
```
- The `lines` field is inclusive.
- The content for the patch goes after a `---` separator.
By following these rules, your response can be directly used by my tools.
Example AI Interaction
User:
Using the project I provided, please modify lines 10-11 in
f2t2f/cli.pyto add a greeting.
Correct AI Response:
>>> patch: f2t2f/cli.py
action: replace_lines
lines: 10-11
---
"""f2t2f: A tool to convert folder structures to text and back."""
click.echo("Welcome to f2t2f!")
<<<
Configuration (Optional)
By default, f2t2f ignores common files like __pycache__ and .git. To customize this, you can create a configuration file.
-
Create the default config file:
f2t2f config init
-
Find its location and edit it:
f2t2f config path
You can then add or remove patterns from the
ignore_patternslist in that JSON file.
License
MIT License © Vova Auer
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file f2t2f-0.3.1.tar.gz.
File metadata
- Download URL: f2t2f-0.3.1.tar.gz
- Upload date:
- Size: 13.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e13315a87d77b739f0132018df18af64d82cad2d4ef9b0c5c951e2c512ae42fe
|
|
| MD5 |
f8f035e7d6d3b84bc8a5f4d008f40944
|
|
| BLAKE2b-256 |
e24e3a69338c5ba027342c64f9c7381fd7c518a43009a9b6c3bc4cf2b3e09341
|
Provenance
The following attestation bundles were made for f2t2f-0.3.1.tar.gz:
Publisher:
pypi-publish.yml on vovaauer/f2t2f
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
f2t2f-0.3.1.tar.gz -
Subject digest:
e13315a87d77b739f0132018df18af64d82cad2d4ef9b0c5c951e2c512ae42fe - Sigstore transparency entry: 310009021
- Sigstore integration time:
-
Permalink:
vovaauer/f2t2f@d562aaa8cc032339934609510a4c6f427c25f1c4 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/vovaauer
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@d562aaa8cc032339934609510a4c6f427c25f1c4 -
Trigger Event:
release
-
Statement type:
File details
Details for the file f2t2f-0.3.1-py3-none-any.whl.
File metadata
- Download URL: f2t2f-0.3.1-py3-none-any.whl
- Upload date:
- Size: 13.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
18d8593266ff1efeadadd38fa63847eed36075413b5f4794c55041336ca0bb81
|
|
| MD5 |
0b89664b963c45f51ce80835ac20ce91
|
|
| BLAKE2b-256 |
06c1b2744fa8ae2515076a6884fcf0f5cf3cc60749894fcc037c13787c500f6b
|
Provenance
The following attestation bundles were made for f2t2f-0.3.1-py3-none-any.whl:
Publisher:
pypi-publish.yml on vovaauer/f2t2f
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
f2t2f-0.3.1-py3-none-any.whl -
Subject digest:
18d8593266ff1efeadadd38fa63847eed36075413b5f4794c55041336ca0bb81 - Sigstore transparency entry: 310009046
- Sigstore integration time:
-
Permalink:
vovaauer/f2t2f@d562aaa8cc032339934609510a4c6f427c25f1c4 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/vovaauer
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@d562aaa8cc032339934609510a4c6f427c25f1c4 -
Trigger Event:
release
-
Statement type: