Guides
Auto Bundle
Automatically generate predefined bundles of files based on configuration
The m1f auto-bundle feature allows you to automatically generate predefined bundles of files based on configuration. This is especially useful for maintaining consistent documentation bundles, creating project snapshots, and managing multiple projects on a server.
Configuration File
Auto-bundle looks for a .m1f.config.yml
file in your project. The tool searches from the current directory upward to the root, allowing flexible project organization.
Basic Configuration Structure
# .m1f.config.yml
# Global settings that apply to all bundles
global:
global_excludes:
- "**/*.pyc"
- "**/*.log"
- "**/tmp/**"
# Bundle definitions
bundles:
docs:
description: "Project documentation"
output: "m1f/docs/manual.txt"
sources:
- path: "docs"
include_extensions: [".md", ".txt"]
code:
description: "Source code bundle"
output: "m1f/src/code.txt"
sources:
- path: "src"
include_extensions: [".py", ".js", ".ts"]
Command Usage
Create All Bundles
m1f auto-bundle
# Or use the convenient alias:
m1f-update
Create Specific Bundle
m1f auto-bundle docs
# Or use the convenient alias:
m1f-update docs
List Available Bundles
m1f auto-bundle --list
Create Bundles by Group
m1f auto-bundle --group documentation
# Or use the convenient alias:
m1f-update --group documentation
Note: The m1f-update
command is a convenient alias for m1f auto-bundle
that provides a simpler way to regenerate bundles.
Bundle Groups
You can organize bundles into groups for easier management:
bundles:
user-docs:
description: "User documentation"
group: "documentation"
output: "m1f/docs/user.txt"
sources:
- path: "docs/user"
api-docs:
description: "API documentation"
group: "documentation"
output: "m1f/docs/api.txt"
sources:
- path: "docs/api"
frontend-code:
description: "Frontend source code"
group: "source"
output: "m1f/src/frontend.txt"
sources:
- path: "frontend"
Then create all documentation bundles:
m1f auto-bundle --group documentation
Server-Wide Usage
Managing Multiple Projects
For server environments with multiple projects, you can create a management script:
#!/bin/bash
# update-all-bundles.sh
# Find all projects with .m1f.config.yml
for config in $(find /home/projects -name ".m1f.config.yml" -type f); do
project_dir=$(dirname "$config")
echo "Updating bundles in: $project_dir"
cd "$project_dir"
m1f-update --quiet
done
Project-Specific Bundles
Create project-specific configurations by using groups:
# Project A - .m1f.config.yml
bundles:
all:
description: "Complete project bundle"
group: "project-a"
output: "m1f/project-a-complete.txt"
sources:
- path: "."
Then update only specific projects:
cd /path/to/project-a
m1f-update --group project-a
Automated Bundle Updates
Set up a cron job for automatic updates:
# Update all project bundles daily at 2 AM
0 2 * * * /usr/local/bin/update-all-bundles.sh
Centralized Bundle Storage
Configure bundles to output to a central location:
bundles:
project-bundle:
description: "Project bundle for central storage"
output: "/var/m1f-bundles/myproject/latest.txt"
sources:
- path: "."
Advanced Features
Conditional Bundles
Enable bundles only when specific files exist:
bundles:
python-docs:
description: "Python documentation"
enabled_if_exists: "setup.py"
output: "m1f/python-docs.txt"
sources:
- path: "."
include_extensions: [".py"]
Multiple Source Configurations
Combine files from different locations with different settings:
bundles:
complete:
description: "Complete project documentation"
output: "m1f/complete.txt"
sources:
- path: "docs"
include_extensions: [".md"]
- path: "src"
include_extensions: [".py"]
excludes: ["**/test_*.py"]
- path: "."
include_files: ["README.md", "CHANGELOG.md"]
# Using includes patterns
tool-specific:
description: "Specific tool code only"
output: "m1f/tool-code.txt"
sources:
- path: "tools/"
include_extensions: [".py"]
includes: ["m1f/**", "s1f/**", "!**/test_*.py"]
Using Presets
Apply presets for advanced file processing:
bundles:
web-bundle:
description: "Web project bundle"
output: "m1f/web.txt"
preset: "presets/web-project.m1f-presets.yml"
preset_group: "production"
sources:
- path: "."
Automatic Bundle Generation with Git Hooks
m1f provides a Git pre-commit hook that automatically runs auto-bundle before each commit. This ensures your bundles are always in sync with your source code.
Installing the Git Hook
# Run from your project root (where .m1f.config.yml is located)
bash /path/to/m1f/scripts/install-git-hooks.sh
The hook will:
- Run
m1f-update
before each commit - Add generated bundles to the commit automatically
- Block commits if bundle generation fails
For detailed setup instructions, see the Git Hooks Setup Guide.
Best Practices
- Organize with Groups: Use groups to categorize bundles logically
- Version Control: Include
.m1f.config.yml
in version control - Include m1f/ Directory: Keep generated bundles in version control for AI tool access
- Use Descriptive Names: Make bundle names self-explanatory
- Regular Updates: Use Git hooks or schedule automatic updates for frequently changing projects
- Review Bundle Changes: Check generated bundle diffs before committing
Troubleshooting
Config Not Found
If you see “No .m1f.config.yml configuration found!”, the tool couldn’t find a config file searching from the current directory up to the root. Create a .m1f.config.yml
in your project root.
Bundle Not Created
Check the verbose output:
m1f-update --verbose
Common issues:
- Incorrect file paths
- Missing source directories
- Invalid YAML syntax
- Disabled bundles
Group Not Found
If using --group
and no bundles are found:
- Check that bundles have the
group
field - Verify the group name matches exactly
- Use
--list
to see available groups
Examples
Documentation Site Bundle
bundles:
docs-site:
description: "Documentation site content"
group: "documentation"
output: "m1f/docs-site.txt"
sources:
- path: "content"
include_extensions: [".md", ".mdx"]
- path: "src/components"
include_extensions: [".jsx", ".tsx"]
excludes:
- "**/node_modules/**"
- "**/.next/**"
Multi-Language Project
bundles:
python-code:
description: "Python backend code"
group: "backend"
output: "m1f/backend/python.txt"
sources:
- path: "backend"
include_extensions: [".py"]
javascript-code:
description: "JavaScript frontend code"
group: "frontend"
output: "m1f/frontend/javascript.txt"
sources:
- path: "frontend"
include_extensions: [".js", ".jsx", ".ts", ".tsx"]
all-code:
description: "All source code"
output: "m1f/all-code.txt"
sources:
- path: "."
include_extensions: [".py", ".js", ".jsx", ".ts", ".tsx"]
Combining Multiple Directories
When you need to combine files from completely different directories:
bundles:
# Combine documentation from multiple locations
all-docs:
description: "All project documentation"
output: "m1f/all-docs.txt"
sources:
- path: "docs"
- path: "src"
include_extensions: [".md"]
- path: "../shared-docs"
- path: "/absolute/path/to/external/docs"
includes: ["api/**", "guides/**"]
WordPress Plugin Bundle
bundles:
wp-plugin:
description: "WordPress plugin files"
group: "wordpress"
output: "m1f/wp-plugin.txt"
preset: "presets/wordpress.m1f-presets.yml"
sources:
- path: "."
include_extensions: [".php", ".js", ".css"]
excludes:
- "**/vendor/**"
- "**/node_modules/**"
CI/CD Integration
bundles:
# Bundle for deployment
deploy-bundle:
description: "Deployment bundle"
group: "deploy"
output: "dist/deploy.txt"
sources:
- path: "src"
include_extensions: [".py", ".js", ".ts"]
- path: "config"
include_extensions: [".yml", ".yaml", ".json"]
excludes:
- "**/test_*.py"
- "**/*.test.js"
- "**/node_modules/**"
# Bundle for code review
review-bundle:
description: "Code review bundle"
group: "review"
output: "m1f/review.txt"
sources:
- path: "src"
include_extensions: [".py", ".js", ".ts"]
max_file_size: "100KB"
security_check: "warn"
Configuration Reference
Global Settings
global:
global_excludes: # Apply to all bundles
- "**/*.pyc"
- "**/node_modules/**"
default_separator_style: "Detailed" # Default separator style
default_max_file_size: "1MB" # Default file size limit
security_check: "warn" # Default security check level
Bundle Settings
bundles:
my-bundle:
description: "Bundle description" # Required
output: "path/to/output.txt" # Required
group: "optional-group" # Optional grouping
enabled: true # Optional (default: true)
enabled_if_exists: "file.txt" # Optional conditional enabling
# Source configuration
sources:
- path: "src" # Required
include_extensions: [".py"] # Optional
exclude_extensions: [".pyc"] # Optional
includes: ["pattern/**"] # Optional
excludes: ["test_*.py"] # Optional
max_file_size: "500KB" # Optional
# Processing options
separator_style: "Markdown" # Optional
security_check: "abort" # Optional
preset: "presets/my.yml" # Optional
preset_group: "production" # Optional
# Output options
create_archive: true # Optional
archive_type: "zip" # Optional
minimal_output: false # Optional
Related Topics
- Presets - Advanced file processing configurations
- Security - Security scanning and best practices
- Claude Integration - AI-powered workflows
- Git Hooks - Automated bundle updates
Next Steps
- Set up your first configuration: Create a
.m1f.config.yml
in your project - Start simple: Begin with basic bundles and add complexity gradually
- Automate updates: Set up Git hooks for automatic bundle generation
- Explore presets: Use presets for advanced file processing
- Monitor security: Enable security scanning for sensitive projects
- Previous
- Installation
- Next
- CLI Reference