- Fold files and instructions into json
- Unfold LLM return jsons in same format
- Intended to let LLMs produce codebase changes in a controlled manner
uv pip install https://github.com/wr1/cfold.git| Command | Description |
|---|---|
fold |
Fold a codebase into a JSON file |
unfold |
Apply changes from a modified JSON file |
add |
Add files to an existing fold file |
view |
View the contents of a fold file |
sum |
Summarize Python codebases via AST |
rc |
Create or update a .foldrc config |
- JSON structure with keys:
instructions(list of objects),files. - Each instruction object:
{type: 'system'|'user'|'assistant', content: string, name: string (optional)}. files: Array of objects withpath(relative to CWD),content(full file content, optional if deleting), anddelete(bool, default false).- Modify files by updating
content(withdelete: false). - Delete files with
delete: true(content optional). - Add new files by adding new objects with
pathandcontent. - Move/rename: Delete old (
delete: true) and add new with updated path and content.
The sum command summarizes the structure of Python codebases using AST parsing. It generates an LLM-readable summary of classes, functions, and other code elements.
cfold sum codebase/ codebase2/ -o summary.txtMIT