feat(backup): add .gitignore-like exclude patterns support#1
Open
verncake wants to merge 10 commits into
Open
Conversation
added 10 commits
March 9, 2026 16:56
- Add --exclude <pattern> option to exclude specific patterns - Add --exclude-file <path> option to read patterns from file - Support basic glob patterns (* and ?) - Filter assets before creating tar archive - Show excluded files in skipped list - Include excludePatterns in manifest for verification Closes openclaw#40786
- Automatically find and load .gitignore and .openclawignore files - Load patterns from each workspace directory - Patterns are applied to backup archive
…lude-file - Escape regex special characters before pattern compilation - Add required parameter to loadExcludePatternsFromFile - Throw error when user-specified exclude file cannot be loaded Fixes review comments
- Test basic --exclude pattern matching - Test regex special character escaping - Test --exclude-file loading - Test error when exclude file doesn't exist - Test auto-loading .gitignore from workspace - Test multiple --exclude patterns
- Fix ? wildcard to work independently without * - Fix substring matching to use exact/basename match - Normalize workspace ignore patterns - Add tar filter to exclude individual entries within archived dirs Fixes review comments
- Add negation patterns (! prefix) - Add character classes [abc] - Add character ranges [a-z] - Add double wildcard ** for recursive matching - Handle negation in filter logic Closes openclaw#40786
- Import collectOption from helpers.ts - Use collectOption for --exclude option - Fix TypeScript type error
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
node_modules,.env, logs, or other unnecessary files from backups--excludeand--exclude-fileoptions, plus auto-loading of.gitignoreand.openclawignorefrom workspace directoriesChange Type
Scope
Linked Issue/PR
User-visible / Behavior Changes
--exclude <pattern>,--exclude-file <path>.gitignoreand.openclawignorein workspace directoriesSecurity Impact
Risk is low - excludes files from backup only, no new permissions
Repro + Verification
Environment
Steps
openclaw backup create --exclude "node_modules"node_modulesis excluded from backupEvidence
Human Verification
--exclude "node_modules", confirmed pattern matching worksCompatibility / Migration
Risks and Mitigations
*,?)