How simonw/files-to-prompt works
files-to-prompt is a small CLI utility that combines file contents into LLM-ready prompt text. Users provide file or directory paths on the command line or through stdin; the CLI discovers and filters files, reads their contents, formats each file, and writes the result to stdout or a chosen output file. The sampled CLI shows these runtime stages and output modes; the README documents the supported options.
Main entry points: cli.py Command handler · __main__.py CLI entry
Components 9
Invocation and input
- CLI entry
files_to_prompt/__main__.py - Command handler
files_to_prompt/cli.py - Stdin paths
files_to_prompt/cli.py
File processing
- Path traversal
files_to_prompt/cli.py - File filtering
files_to_prompt/cli.py - Content reading
files_to_prompt/cli.py
Formatting and output
- Output formatting
files_to_prompt/cli.py - Output destination
files_to_prompt/cli.py
Other components
- User
Connections 11
- User → CLI entry: runs command
README.md - CLI entry → Command handler: invokes
files_to_prompt/__main__.py - User → Command handler: provides paths
README.md - Command handler → Stdin paths: reads paths
files_to_prompt/cli.py - Command handler → Path traversal: processes paths
files_to_prompt/cli.py - Path traversal → File filtering: filters entries
files_to_prompt/cli.py - Path traversal → Content reading: reads files
files_to_prompt/cli.py - Command handler → Content reading: reads file
files_to_prompt/cli.py - Content reading → Output formatting: formats content
files_to_prompt/cli.py - Output formatting → Output destination: writes output
files_to_prompt/cli.py - User → Output destination: selects file
README.md