Skip to main content

A CLI tool to parse files and create LLM prompts

Project description

F2LLM - Folder to LLM CLI Tool

A simple command-line tool for converting folder structures to JSON format for LLM processing and applying LLM-generated changes back to your project.

Installation

Requires Python 3.6+ and the pathspec library:

pip install pathspec

Usage

F2LLM has two main modes:

1. Parse Mode (Default)

Convert a folder structure into JSON format:

python f2llm.py <folder_path> <output.json>

Example:

python f2llm.py my_project project_files.json

This creates a JSON file containing all files in the folder with their content wrapped in code fences.

2. Apply Mode

Apply LLM-generated changes from JSON back to your project:

python f2llm.py --apply <changes.json> <target_folder>

Example:

python f2llm.py --apply llm_response.json my_project

JSON Schema

The tool expects/produces JSON files with this structure:

{
  "modified_files": [
    {
      "file_path": "src/main.py",
      "notes": "Updated function logic",
      "content": "```python\n# file content here\n```"
    }
  ],
  "added_files": [
    {
      "file_path": "src/new_file.py", 
      "notes": "New utility module",
      "content": "```python\n# new file content\n```"
    }
  ],
  "moved_files": [
    {
      "old_path": "old/location.py",
      "new_path": "new/location.py",
      "notes": "Reorganized project structure"
    }
  ],
  "unchanged_files": [
    "README.md",
    "package.json"
  ],
  "deleted_files": [
    {
      "file_path": "obsolete_file.py",
      "notes": "No longer needed"
    }
  ]
}

Features

  • Gitignore Support: Automatically respects .gitignore files during parsing
  • File Operations: Handles create, modify, move, and delete operations
  • Code Fences: Automatically wraps file content with appropriate language syntax highlighting
  • Safe Paths: Creates necessary directories when applying changes
  • Error Handling: Graceful handling of file read/write errors

Common Workflow

  1. Extract your project for LLM analysis:

    python f2llm.py my_project prompt.json
    
  2. Send prompt.json to your LLM with instructions

  3. Apply the LLM's response back to your project:

    python f2llm.py --apply llm_response.json my_project
    

Notes

  • The tool preserves file permissions and creates directories as needed
  • Binary files or files that can't be read as UTF-8 will show an error message in their content
  • When moving files, the tool creates necessary parent directories automatically

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

f2llm-0.1.6.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

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

f2llm-0.1.6-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file f2llm-0.1.6.tar.gz.

File metadata

  • Download URL: f2llm-0.1.6.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for f2llm-0.1.6.tar.gz
Algorithm Hash digest
SHA256 6db54f5ee37d2ed6ab2b3cfdf8ea8928cfb7c683f148687c1cddfa0a09e9561f
MD5 d2dcf38353871a48d78e5fc0ff02a42f
BLAKE2b-256 7b76558157d5b0e4022aa16e8738da17774aa41dd245bd9c07cd6951a2f9f3ca

See more details on using hashes here.

Provenance

The following attestation bundles were made for f2llm-0.1.6.tar.gz:

Publisher: release.yml on mattdravucz/f2llm

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file f2llm-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: f2llm-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for f2llm-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 d1f48502c003308ce9edf95651eb912f78f726734d9f327ce5ae84b922ccb743
MD5 ef0cac812490643db5d72ceea4f5b1d8
BLAKE2b-256 c0982984d5de84deea2c17e5d7f8cc5542ef0f7b31d5f3b2c8fdbca2e1da6fe2

See more details on using hashes here.

Provenance

The following attestation bundles were made for f2llm-0.1.6-py3-none-any.whl:

Publisher: release.yml on mattdravucz/f2llm

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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