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).
This guide covers all aspects of using the Workspace tool suite for string replacement, line analysis, project cleanup, version management, and cross-project version stamping.
wsb refactor <ROOT_DIR> <OLD_STRING> <NEW_STRING> [OPTIONS]
wsb ldiff [SUBSTITUTE_CHAR]
wsb scrap [PATH...] [SUBCOMMAND] [OPTIONS]
wsb unscrap [NAME] [OPTIONS]
wsb git <SUBCOMMAND> [OPTIONS]
wsb version <SUBCOMMAND> [OPTIONS]
wsb wstemplate <SUBCOMMAND> [OPTIONS]
wsb refactor <ROOT_DIR> <OLD_STRING> <NEW_STRING> [OPTIONS]
ROOT_DIR: Directory to search in (use . for current directory)OLD_STRING: String to find and replaceNEW_STRING: Replacement stringwsb refactor . "oldname" "newname"
wsb refactor ./src "OldClass" "NewClass"
wsb refactor . "oldname" "newname" --verbose
Refactor operates on two levels by default:
wsb refactor . "oldname" "newname" --names-only # Only rename files/directories
wsb refactor . "oldname" "newname" --content-only # Only replace content
wsb refactor . "oldname" "newname" --files-only # Only process files
wsb refactor . "oldname" "newname" --dirs-only # Only process directories
wsb refactor . "oldname" "newname" --verbose
wsb refactor . "oldname" "newname" --verbose --verbose
wsb refactor . "oldname" "newname" --backup
wsb refactor . "oldname" "newname" --force
wsb refactor . "oldname" "newname" --include "*.rs"
wsb refactor . "oldname" "newname" --include "*.rs" --include "*.toml"
wsb refactor . "oldname" "newname" --exclude "*.log"
wsb refactor . "oldname" "newname" --exclude "target/*" --exclude "*.log"
wsb refactor ./src "oldname" "newname" \
--include "*.rs" \
--include "*.toml" \
--exclude "*test*"
wsb refactor . "oldname" "newname" --max-depth 1
wsb refactor . "oldname" "newname" --max-depth 3
wsb refactor . "oldname" "newname" --threads 8
wsb refactor . "oldname" "newname" --threads 0 # Auto-detect
wsb refactor . "oldname" "newname" --ignore-case
wsb refactor . "old_\\w+" "new_name" --regex
wsb refactor . "old.*name" "newname" --regex --ignore-case
wsb refactor . "oldname" "newname" # Human-readable (default)
wsb refactor . "oldname" "newname" --format json # Machine-readable
wsb refactor . "oldname" "newname" --format plain # No colors
The ldiff tool processes input lines, replacing repeated tokens with a substitute character to highlight patterns and differences.
echo -e "hello world\nhello universe" | wsb ldiff
# Output:
# hello world
# ░░░░░ universe
echo -e "test line\ntest another" | wsb ldiff "*"
# Output:
# test line
# **** another
tail -f /var/log/syslog | wsb ldiff
cat /var/log/nginx/access.log | wsb ldiff
journalctl -u myapp | wsb ldiff
tail -f /var/log/app1.log /var/log/app2.log | wsb ldiff
dmesg -w | wsb ldiff
The scrap tool provides a local trash can using a .scrap folder.
wsb scrap temp_file.txt old_directory/
wsb scrap list
wsb scrap find "*.log"
wsb scrap clean --days 30
wsb scrap archive --remove
For detailed information, see the Scrap Tool Guide.
wsb unscrap # Restore last item
wsb unscrap filename.txt # Restore specific file
wsb unscrap file.txt --to /new/location/ # Custom destination
wsb unscrap file.txt --force # Overwrite existing
For detailed information, see the Unscrap Tool Guide.
wsb git install # Install pre-commit hook
wsb git show # Show current version
wsb git status # Check configuration
wsb git uninstall # Remove hook
wsb update # Update version and render templates
wsb update --git-add # Also stage changed files
wsb update --no-git # Skip git integration
wsb version show # Display current version breakdown
wsb version major 2 # Set major version to 2
wsb version tag # Create git tag
wsb version info # Show calculation details
{major}.{minor}.{patch} where:
wsb version major (stored in database)Create .state.json in your repository root:
{
"version": 1,
"enabled": true,
"version_file": "version.txt"
}
.wstemplate files are Tera templates that render to the file with the .wstemplate suffix stripped (e.g., Cargo.toml.wstemplate renders to Cargo.toml). They’re rendered automatically during wsb update.
Each project needs a single wstemplate entry: its alias and a scan root.
wsb wstemplate add /path/to/workspace # Set scan root for this project
wsb wstemplate list-entries # Verify entry
The alias is auto-derived from the project directory name (e.g., my-project becomes my_project). Override with --alias:
wsb wstemplate add /path/to/workspace --alias mylib
Templates use Tera syntax. Available variables:
# This project's version
# This project's name
# Another project's version
# Current date (YYYY-MM-DD)
When rendering, the engine scans the root for all .wsb/state.json files to discover peer projects. No explicit cross-project entries are needed. If a template references ``, the engine finds tagged_urn_js’s project root and reads its version.txt.
version.txt: Hard error — run wsb update in the dependency firstwsb wstemplate add /path/to/root # Set scan root
wsb wstemplate add /path/to/root --alias lib # With custom alias
wsb wstemplate list-entries # Show entry
wsb wstemplate list # List relevant templates
wsb wstemplate render # Render all relevant
wsb wstemplate remove my_alias # Remove entry
# Development workflow
wsb git install # Set up versioning
wsb scrap temp_* *.log build/ # Clear workspace
wsb refactor . "OldClass" "NewClass" --verbose # Preview changes
wsb refactor . "OldClass" "NewClass" # Apply changes
git add . && git commit -m "Refactor class" # Auto-version bump
# Cross-project version update
wsb wstemplate add /path/to/workspace # Set scan root
wsb update --git-add # Update + render + stage