1.1.1 ⢠Published 4 months ago
fileweaver v1.1.1
š FileWeaver
A powerful CLI tool for weaving files together with advanced pattern matching capabilities, featuring visual progress and tree view of processed files.
Installation ⢠Usage ⢠Examples ⢠Contributing
⨠Features
- š 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
š Installation
npm install -g fileweaver
š§ Usage
fileweaver [options]
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 | - |
--version | Show version number | - |
--help | Show help | - |
š Examples
Basic File Concatenation with Tree
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
Add Custom Prompt
fileweaver -r "\.md$" -p "Process these markdown files for documentation" -o docs.md
Output will include:
==================================================
Prompt:
==================================================
Process these markdown files for documentation
Combine Multiple Features
fileweaver -d ./src -r "\.(js|ts)$" -h true -t true -p "Review this code" -o bundle.js
This will:
- Process all .js and .ts files
- Add headers for each file
- Include the directory tree
- Add the specified prompt
- Save everything to bundle.js
Process Multiple File Types
fileweaver -d ./src -r "\.(js|ts)$" -h true -o bundle.js
Output tree:
Files to be processed:
āāā src
āāā components
ā āāā Button.ts
ā āāā Input.js
āāā utils
āāā helpers.js
āāā types.ts
Exclude Multiple Patterns
fileweaver -d . -r "\.js$" -ir "node_modules|dist|test" -o prod.js
Tree view:
Files to be processed:
āāā src
ā āāā main.js
ā āāā config.js
āāā index.js
With Headers in Output
The -h
flag adds file headers to the output:
==================================================
File: src/main.js
==================================================
// Main file content here...
==================================================
File: src/config.js
==================================================
// Config file content here...
š Advanced Usage
Nested Directories with Tree and Prompt
Process files in nested directories, include tree structure, and add a processing prompt:
fileweaver -d ./project -r "\.css$" -ir "vendor|temp" -t true -p "Combine all CSS files" -o styles.css
Complex Pattern Matching with Custom Output
fileweaver -r "\.(html|ejs)$" -ir "temp_|draft_" -h true -t true -o templates.html
š¤ Contributing
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
š License
This project is licensed under the MIT License - see the LICENSE file for details.
š Support
For support and questions, please open an issue on GitHub.