From 8697620c169360b537198059ee72e3ca5ce68dee Mon Sep 17 00:00:00 2001 From: panariga Date: Mon, 27 Oct 2025 12:01:26 +0200 Subject: [PATCH] Add readme.md --- readme.md | 104 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 readme.md diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..4d6a3de --- /dev/null +++ b/readme.md @@ -0,0 +1,104 @@ +# LLM Dumper for PrestaShop Modules + +A simple, zero-dependency PHP script to aggregate all meaningful source code from a PrestaShop module into a single text file. This tool is designed to make it easy to copy-paste an entire module's codebase into the context window of a Large Language Model (LLM) like GPT-4, Claude, or Llama. + +## The Problem It Solves + +When working with LLMs for code analysis, debugging, or documentation, you often need to provide the full source code of a project as context. For a typical PrestaShop module, this involves opening dozens of files (`.php`, `.tpl`, `.js`, `.css`, etc.) and pasting them one by one. This is tedious, error-prone, and inefficient. + +This script automates that process, creating a single, well-structured text file containing all relevant code, ready to be fed to an LLM. + +## Features + +- **Recursive Scanning**: Scans the entire module directory, including all subdirectories. +- **Intelligent Exclusions**: Automatically ignores: + - The `vendor` directory (Composer dependencies). + - Common image file types (`.png`, `.jpg`, `.svg`, etc.). + - The script itself (`llmdumper.php`). + - The generated output file (`.llmdump`). +- **Clear Context**: Prepends each file's content with a header containing its relative path (e.g., `myawesomemodule/controllers/front/main.php`). +- **Single File Output**: Creates one easy-to-manage `.llmdump` file. +- **Command-Line Friendly**: Provides progress feedback as it runs. + +## How to Use + +1. **Download**: Place the `llmdumper.php` script into the root directory of the PrestaShop module you want to dump. + ``` + /prestashop + └── /modules + └── /myawesomemodule <-- Place the script here + ├── llmdumper.php + ├── myawesomemodule.php + ├── config.xml + └── /views + └── ... + ``` + +2. **Navigate**: Open your terminal or command prompt and navigate to the module's directory. + ```bash + cd /path/to/prestashop/modules/myawesomemodule + ``` + +3. **Execute**: Run the script using PHP. + ```bash + php llmdumper.php + ``` + You will see a list of files being appended to the dump. + +4. **Find the Output**: A hidden file named `.llmdump` will be created in the module's root directory. + +5. **Use the Content**: Open `.llmdump` in a text editor, select all (Ctrl+A / Cmd+A), copy the contents, and paste it into your LLM prompt. + +6. **CLEAN UP**: **This is the most important step.** After you are done, delete both files from your server. + ```bash + rm llmdumper.php .llmdump + ``` + +--- + +## ⚠️ Security Warning ⚠️ + +- This script is intended for use in a **local development environment only**. +- The generated `.llmdump` file contains your module's **entire source code**. +- If you run this script on a live, public-facing web server, the `.llmdump` file could potentially be downloaded by anyone if your server is not configured to block access to dotfiles. +- **Always delete `llmdumper.php` and `.llmdump` immediately after use.** + +--- + +## Example Output + +The generated `.llmdump` file will look like this: + +```text +//- - - - - - - - - - START: myawesomemodule/myawesomemodule.php - - - - - - - - - -// + +

{l s='This is an awesome module!' mod='myawesomemodule'}

+ +//- - - - - - - - - - END: myawesomemodule/views/templates/hook/displayHome.tpl - - - - - - - - - -// +``` + +## Configuration + +The script has a few constants at the top that you can modify if needed: + +- `OUTPUT_FILE`: Change the name of the output file (default: `.llmdump`). +- `VENDOR_DIR`: Change the name of the vendor directory to exclude (default: `vendor`). +- `IMAGE_EXTENSIONS`: Add or remove file extensions to be treated as non-text/image files. + +## License + +This project is licensed under the MIT License. \ No newline at end of file