A powerful CLI tool for weaving files together with advanced pattern matching capabilities, featuring visual progress and tree view of processed files. Optimized for sharing code with Large Language Models (LLMs).
- 🔍 Regex Pattern Matching: Filter files using regular expressions
- 🚫 Exclusion Patterns: Ignore files that match specific patterns
- 📂 Directory Support: Process files from any directory
- 📑 File Headers: Option to include original filenames in the output
- 🎯 Flexible Output: Specify custom output location and filename
- 🌳 Tree View: Visual representation of processed files with optional inclusion in output
- 📊 Progress Bar: Real-time processing visualization
- 🎨 Colored Output: Enhanced readability with color-coded messages
- 📝 Custom Prompts: Add custom prompts to the output file
- 🗂️ Directory Tree: Include directory structure in the output file
- 📏 Token Estimation: Get approximate token counts for LLM context management
- 📊 Size Limiting: Control output size to fit LLM context windows
- 🧹 Comment Removal: Strip comments to reduce size and focus on core code
- 📄 Markdown Format: Generate output in Markdown with proper code formatting
- 📋 Project Summary: Auto-generate project overviews from README and package.json
- ⭐ File Prioritization: Ensure important files appear first in the output
- 🔍 Language Detection: Automatically identify and tag programming languages
npm install -g fileweaver
fileweaver [options]
Option | Description | Default |
---|---|---|
-r, --regex <pattern> |
Regex pattern to match files | - |
-ir, --ignoreregex <pattern> |
Regex pattern to ignore files | - |
-d, --directory <path> |
Directory path | Current directory |
-h, --headers |
Add file headers to content | false |
-o, --output <file> |
Output file name | output.txt |
-t, --tree |
Include directory tree in output file | false |
-p, --prompt <text> |
Add custom prompt to output file | - |
-m, --markdown |
Format output as markdown with code blocks | false |
-tok, --tokens |
Show token estimation for LLMs | false |
-nc, --no-comments |
Strip comments from code files | false |
-s, --summary |
Include auto-generated project summary | false |
-i, --important <files> |
Comma-separated file patterns to prioritize | - |
-m, --max-size <size> |
Maximum output size in KB | Infinity |
--version |
Show version number | - |
--help |
Show help | - |
fileweaver -d . -r "\.js$" -t true -o combined.js
This will include a tree view in the output file:
==================================================
Directory Tree:
==================================================
├── src
│ ├── index.js
│ └── utils
│ ├── helper.js
│ └── validator.js
└── index.js
fileweaver -r "\.md$" -p "Process these markdown files for documentation" -o docs.md
Output will include:
==================================================
Prompt:
==================================================
Process these markdown files for documentation
fileweaver -r "\.(js|jsx)$" -markdown -tokens -o for-llm.md
This will:
- Format all JavaScript files with Markdown code blocks
- Add language tags to each code block
- Include token count estimation for LLM context management
fileweaver -s -i "index.js,main.jsx,README.md" -markdown -o project-overview.md
This will:
- Generate a project summary from README and package.json
- Prioritize the specified important files
- Format everything as Markdown
fileweaver -r "src/" -max-size 100 -tokens -nc -o llm-input.txt
This will:
- Process all files in the src directory
- Limit output to 100KB to fit LLM context windows
- Remove comments to save space
- Show token estimation
- Save to llm-input.txt
fileweaver -d ./src -r "\.(js|ts)$" -markdown -tokens -nc -s -i "index.js,App.tsx" -max-size 150 -o llm-ready.md
This will:
- Process all JS and TS files
- Format with Markdown
- Remove comments
- Include project summary
- Prioritize important files
- Limit size to 150KB
- Estimate tokens
- Save as llm-ready.md
Generate a comprehensive project overview optimized for code review by LLMs:
fileweaver -d ./project -s -markdown -tokens -i "index.js,package.json,src/App.js" -t true -p "Please review this React project codebase and suggest improvements" -o llm-review.md
This will:
- Process all files in the project
- Generate a project summary
- Format with Markdown code blocks
- Prioritize key files at the beginning
- Include directory tree
- Add token estimations
- Add the specified prompt for the LLM
fileweaver -r "\.jsx?$" -ir "test|mock" -markdown -nc -max-size 50 -o explore.md
This will:
- Process all JavaScript files (excluding test and mock files)
- Format with Markdown
- Remove comments
- Limit output to 50KB
- Save to explore.md
Contributions are welcome! Feel free to:
- Fork the repository
- Create your feature branch:
git checkout -b feature/amazing-feature
- Commit your changes:
git commit -m 'Add amazing feature'
- Push to the branch:
git push origin feature/amazing-feature
- Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
For support and questions, please open an issue on GitHub.
Made with ❤️ by C2Developers