An AI-prompt-optimized directory tree generator written in native PHP.
frompt is a lightweight CLI utility designed specifically for developers feeding codebase structures into Large Language Models (LLMs) like ChatGPT, Claude, or local tools. It generates formatted Markdown folder trees. Folders are indicated with '📁' emoji while the files use '📙' emoji regardless of its extension.
- AI-Prompt Ready: Automatically wraps the directory tree output inside a Markdown
txt ...code block, making it ready for instant paste into an AI prompt. - Interactive Filtering: Exclude heavy or sensitive directories (e.g.,
.git,node_modules,vendor) easily with the--ignoreoption. - Depth Management: Control context window usage by restricting recursion depth with
--depth. - Zero Dependencies: Pure PHP implementation. No extra composer packages or system tools required.
- Clone or download
frompt.phpto your machine or project. - Make it globally executable (Linux/macOS):
chmod +x frompt.php- (Optional) Move it to your local binaries folder to run it anywhere:
mv frompt.php /usr/local/bin/fromptGenerate a standard tree view of your current directory:
php frompt.php .Perfect for scanning the surface layer of a project while stripping away vendor folders and deep dependency trees to save prompt tokens:
php frompt.php . --ignore=node_modules,vendor,.git,*.txt --depth=2Append the --copy flag to save the output straight to your host system clipboard. Perfect for a rapid frompt -> Alt+Tab -> Ctrl+V workflow:
php frompt.php . --ignore=classes,config --depth=1Append the --folderonly flag to display folder structures, ignoring all files.:
php frompt.php . --folderonlyUsage: frompt.php [directory] [--depth=N] [--ignore=dir1,*.ext] [--folderonly] [--copy]C:\wamp64\www\burauenbiblio-analytics>php frompt.php . --ignore=*.php,classes
burauenbiblio-analytics/
├── 📙 README.md
├── 📁 api
├── 📁 assets
│ ├── 📁 css
│ │ └── 📙 style.css
│ └── 📁 js
│ ├── 📙 chart.js
│ ├── 📙 dashboard.js
│ ├── 📙 highcharts.js
│ ├── 📙 jquery-3.6.0.min.js
│ └── 📙 jquery.highchartTable.js
└── 📁 configC:\wamp64\www\burauenbiblio-analytics>php frompt.php . --ignore=*.js,config
burauenbiblio-analytics/
├── 📙 README.md
├── 📁 api
│ ├── 📙 attendance_api.php
│ ├── 📙 circulation_api.php
│ ├── 📙 collection_api.php
│ └── 📙 ddc_api.php
├── 📁 assets
│ ├── 📁 css
│ │ └── 📙 style.css
│ └── 📁 js
├── 📙 autoload.php
├── 📁 classes
│ ├── 📁 Circ_Analytics
│ │ └── 📙 Circ_Analytics.php
│ ├── 📙 ConnectDB.php
│ ├── 📁 DDC
│ │ └── 📙 DDCAnalytics.php
│ ├── 📁 LibraryAttendance
│ │ └── 📙 Attendance.php
│ └── 📁 LibraryCollection
│ ├── 📙 CollectionAnalytics.php
│ └── 📙 index.html
├── 📙 frompt.php
└── 📙 index.phpThe argument parser is completely order-agnostic, meaning you can place the folder path at the beginning, middle, or end of your flags.
| Option | Syntax Example | Description |
|---|---|---|
| Target Directory | . or path/to/folder |
The root folder you want to map. Defaults to . if left out. |
--depth |
--depth=2 or --depth 2 |
Maximum folder depth recursion level. |
--ignore |
--ignore=dir1,file2,*.ext |
Comma-separated list (no spaces) of items to hide from the output tree. Supports (*) wildcard for chosen extension i.e. *.jpg, *.md |
--copy |
--copy |
Triggers the multi-platform clipboard mechanism. |
--help, -h |
--help |
Displays usage instructions. |
--folderonly |
--folderonly |
Displays the structural backbone of the path. |
Unlike standard scripts that rely purely on localized binary tools like xclip or the Windows clip utility (which notoriously break Unicode symbols and emojis), frompt actively sniffs the environment:
-
Windows Host: Seamlessly handles UTF-8 formatting using an internal PowerShell engine.
-
Linux/macOS Host: Utilizes native pipes securely.
-
Headless/Docker: (works fine except for the --copy command, i just copy the generated tree view manually).
This project is licensed under the MIT License — see the LICENSE file for details.
This project was created to help developers improve their AI related workflows.
frompt (Folder Prompt Tree)
Copyright (c) 2026 Ferdinand Tumulak
License: MIT