Workspace is a tool suite for file operations, version management, and development workflow automation. Includes refac (string replacement), scrap (local trash folder), unscrap (file restoration), and state (automatic versioning).
The scrap tool provides a local trash can using a .scrap folder for files you want to delete. Itโs designed to safely handle files you want to remove from your workspace by moving them to a trash folder, with the ability to easily restore them later.
.gitignore if it exists# Move a single file
wsb scrap temp.log
# Move multiple files (run multiple commands)
wsb scrap file1.txt file2.txt old_directory/
# Move with absolute paths
wsb scrap /path/to/file.txt
# Automatic conflict resolution
wsb scrap file.txt # Creates .scrap/file.txt
wsb scrap file.txt # Creates .scrap/file_1.txt (automatic rename)
# List all items (default behavior)
wsb scrap
# Explicit list command
wsb scrap list
# Sort by different criteria
wsb scrap list --sort name # Alphabetical
wsb scrap list --sort date # Most recent first
wsb scrap list --sort size # Largest first
Example output:
Contents of .scrap folder:
--------------------------------------------------------------------------------
๐ temp.log 1.2 KB 2 hours ago from: /home/user/project/temp.log
๐ old_code 15.3 MB 1 day ago from: /home/user/project/old_code
๐ debug.txt 524 B 3 hours ago from: /home/user/debug.txt
# Search by filename (supports regex)
wsb scrap find ".*\.log" # Find all .log files
wsb scrap find "test.*" # Find files starting with "test"
wsb scrap find "backup" # Simple string search
# Search in file contents too
wsb scrap find "TODO" --content # Search for "TODO" in filenames and content
wsb scrap find "bug.*fix" --content # Regex search in content
# Remove items older than 30 days (default)
wsb scrap clean
# Remove items older than specific number of days
wsb scrap clean --days 7 # Remove items older than 1 week
wsb scrap clean --days 1 # Remove items older than 1 day
# Preview what would be removed (dry run)
wsb scrap clean --days 30 --verbose
# Remove ALL items from .scrap folder
wsb scrap purge
# Skip confirmation prompt
wsb scrap purge --force
# Archive .scrap contents to compressed file
wsb scrap archive
# Archive with custom filename
wsb scrap archive --output backup-2024.tar.gz
wsb scrap archive --output "backup-$(date +%Y%m%d).tar.gz"
# Archive and remove original files from .scrap
wsb scrap archive --remove
# Archive with custom name and remove
wsb scrap archive --output monthly-backup.tar.gz --remove
# Move temporary files to .scrap
wsb scrap *.tmp *.log debug_output/
# List what's in .scrap
wsb scrap
# Clean items older than a week
wsb scrap clean --days 7
# Archive old items monthly
wsb scrap archive --output "archive-$(date +%Y-%m).tar.gz" --remove
# Scrap old experimental code
wsb scrap experimental_feature/ old_tests/
# Search for specific files later
wsb scrap find "experimental.*"
# Restore if needed (using wsb unscrap)
wsb unscrap experimental_feature/
# Or clean up completely
wsb scrap purge --force
# Before major refactoring, scrap old implementations
wsb scrap old_implementation.rs legacy_tests/
# Check what you've scrapped
wsb scrap list --sort date
# If refactoring fails, restore old code
wsb unscrap old_implementation.rs
# If successful, clean up
wsb scrap clean --days 0 # Remove everything
.scrap, itโs automatically renamed (e.g., file_1.txt, file_2.txt)wsb scrap purge asks for confirmation unless --force is usedwsb scrap clean --verbose shows what would be removed.scrap/ to .gitignore if the file existsThe scrap tool maintains detailed metadata about all operations:
.scrap/.metadata.jsonwsb unscrap for restoration# Use consistent naming for temporary files
wsb scrap temp_* debug_* test_*
# Regular cleanup schedule
wsb scrap clean --days 14 # Weekly cleanup of old items
# Monthly archives
wsb scrap archive --output "archive-$(date +%Y-%m).tar.gz" --remove
# Project-specific backups
wsb scrap archive --output "project-backup-v1.0.tar.gz"
.scrap folder is excluded from most file operations# Combine with find
find . -name "*.tmp" -exec wsb scrap {} \;
# Use in scripts
if [ -f "old_config.conf" ]; then
wsb scrap old_config.conf
fi
.scrap folder becomes very large.scrap if needed