Skip to content

Generate a text-based dump of source files or a directory tree structure, suitable for AI processing.

License

jschwind/phpcli-ai

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHPCLI-AI

A CLI tool that generates a text-based dump of source files or a directory tree structure — ideal for processing by AI systems.

🔧 Installation

git clone https://github.com/jschwind/phpcli-ai.git
cd phpcli-ai
chmod +x runAIProject.sh

Optionally, add runAIProject.sh to your system’s PATH. For example, on Arch/Manjaro:

sudo ln -s $(pwd)/runAIProject.sh /usr/local/bin/runAIProject

🚀 Usage

runAIProject [OUTPUT_FILENAME] [--tree] [--config=PATH_TO_CONFIG]

By default, this command generates a text dump of the current directory’s source files and saves it to ai.txt.

Options

  • OUTPUT_FILENAME (optional): Custom name for the output file (default: ai.txt)
  • --tree (optional): Outputs a directory tree instead of dumping file contents
  • --config=... (optional): Use a specific ai.json configuration file

🧠 ai.json Configuration

You can control which files and folders are included or excluded by providing an ai.json file in your project’s root directory. This will override the default rules.

Structure of ai.json

{
  "exclude": {
    "extensions": ["log", "png", "jpg"],
    "folders": ["vendor", "node_modules", "tests"],
    "filenames": ["README.md", ".env"]
  },
  "include": {
    "extensions": [],
    "folders": [],
    "filenames": []
  }
}

Priority

If ai.json is present and readable, its values will override the default ignore lists.

📦 Examples

runAIProject

Generates a file dump and writes it to ai.txt.

runAIProject ai2.txt

Same as above, but writes to ai2.txt.

runAIProject --tree

Outputs a directory tree structure to ai.txt.

runAIProject ai2.txt --tree

Outputs a directory tree structure to ai2.txt.

runAIProject --config=./config/ai-custom.json

Uses a custom configuration to control what is included or excluded.

About

Generate a text-based dump of source files or a directory tree structure, suitable for AI processing.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published