Cfold
Cfold
Cfold is a command-line tool designed to prepare codebases for interaction with Large Language Models (LLMs). It allows you to fold a directory of code into a single JSON file and unfold a modified version back into a directory structure, enabling controlled codebase changes via LLMs.
Key Features
- Fold files and instructions into JSON: Capture codebases, including prompts, into a structured JSON format.
- Unfold LLM-returned JSONs: Apply modifications from LLMs back to the directory.
- Controlled LLM interactions: Facilitate precise codebase updates in a managed manner.
Installation
Install cfold using the following command:
uv pip install https://github.com/wr1/cfold.gitUsage
CLI Help
Example Output
Fold File Format
The JSON structure includes:
instructions: A list of instruction objects, each withtype(‘system’, ‘user’, or ‘assistant’),content(string), and optionalnameandsynopsis.files: An array of file objects withpath(relative to CWD),content(full file content, optional if deleting), anddelete(bool, default false).
Operations include:
- Modifying files by updating
content. - Deleting files with
delete: true. - Adding new files with
pathandcontent. - Moving/renaming by deleting the old and adding the new.
License
MIT License.
For more details, visit the cfold GitHub repository.