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 st8 (automatic versioning).
reference for all Workspace command-line options and usage patterns.
The Workspace tool suite includes four command-line utilities:
refac <ROOT_DIR> <OLD_STRING> <NEW_STRING> [OPTIONS]
scrap [PATH...] [SUBCOMMAND] [OPTIONS]
unscrap [NAME] [OPTIONS]
st8 [SUBCOMMAND] [OPTIONS]
Argument | Description |
---|---|
ROOT_DIR |
Root directory to search in (use . for current directory) |
OLD_STRING |
String to find and replace |
NEW_STRING |
Replacement string |
ROOT_DIR
must exist and be a directoryOLD_STRING
cannot be emptyNEW_STRING
cannot be emptyNEW_STRING
cannot contain path separators (/
or \
)Option | Short | Description | Default |
---|---|---|---|
--assume-yes |
-y |
Skip confirmation prompts (non-interactive mode) | false |
--force |
-f |
Skip confirmation prompt | false |
--verbose |
-v |
Show detailed output | false |
--help |
-h |
Show help information | |
--version |
-V |
Show version information |
Option | Description | Default | |
---|---|---|---|
--backup |
-b |
Create backup files before modifying content | false |
--follow-symlinks |
Follow symbolic links | false |
Option | Description | Default |
---|---|---|
--files-only |
Only process files (skip directories) | false |
--dirs-only |
Only process directories (skip files) | false |
--names-only |
Skip content replacement, only rename files/directories | false |
--content-only |
Skip file/directory renaming, only replace content | false |
Note: Only one mode flag can be specified at a time.
Option | Description | Default |
---|---|---|
--include <PATTERN> |
Include only files matching pattern (glob) | Include all |
--exclude <PATTERN> |
Exclude files matching pattern (glob) | Exclude none |
--max-depth <N> |
Maximum depth to search (0 = unlimited) | 0 |
Note: Multiple --include
and --exclude
patterns can be specified.
Option | Short | Description | Default |
---|---|---|---|
--threads <N> |
-j |
Number of threads to use (0 = auto) | 0 |
Option | Short | Description | Default |
---|---|---|---|
--ignore-case |
-i |
Ignore case when matching patterns | false |
--regex |
-r |
Use regex patterns instead of literal strings | false |
Option | Description | Values | Default |
---|---|---|---|
--format <FORMAT> |
Output format | human , json , plain |
human |
--progress <MODE> |
Progress display mode | auto , always , never |
auto |
Processes both file/directory names and file contents.
refac . "oldname" "newname"
Process only files, skip directories.
refac . "oldname" "newname" --files-only
Process only directories, skip files.
refac . "oldname" "newname" --dirs-only
Only rename files and directories, skip content replacement.
refac . "oldname" "newname" --names-only
Only replace content in files, skip renaming.
refac . "oldname" "newname" --content-only
Use glob patterns for include/exclude filters:
# Include specific file types
refac . "old" "new" --include "*.rs" --include "*.toml"
# Exclude directories
refac . "old" "new" --exclude "target/*" --exclude "node_modules/*"
# Include hidden files
refac . "old" "new" --include ".*"
Pattern | Matches |
---|---|
* |
Any sequence of characters |
? |
Any single character |
[abc] |
Any character in brackets |
[a-z] |
Any character in range |
** |
Recursive directory match |
Use regex patterns with the --regex
flag:
# Match word boundaries
refac . "\\bold\\b" "new" --regex
# Case-insensitive regex
refac . "old.*name" "newname" --regex --ignore-case
# Match numbers
refac . "version_\\d+" "version_2" --regex
Colored, interactive output with progress bars:
refac . "old" "new"
Example output:
=== REFAC TOOL ===
Root directory: /project
Old string: 'old'
New string: 'new'
Mode: Full
Phase 1: Discovering files and directories...
Phase 2: Checking for naming collisions...
=== CHANGE SUMMARY ===
Content modifications: 15 file(s)
File renames: 8 file(s)
Directory renames: 3 directory(ies)
Total changes: 26
Do you want to proceed? (y/N) y
Replacing content in files...
Renaming files and directories...
=== OPERATION COMPLETE ===
Operation completed successfully!
Total changes applied: 26
Machine-readable output for scripting:
refac . "old" "new" --format json
Example output:
{
"summary": {
"content_changes": 15,
"file_renames": 8,
"directory_renames": 3,
"total_changes": 26
},
"result": "success",
"dry_run": false
}
Simple text output without colors:
refac . "old" "new" --format plain
Code | Meaning |
---|---|
0 |
Success |
1 |
General error |
2 |
Invalid arguments |
3 |
Permission denied |
4 |
File not found |
5 |
Naming collision detected |
# Simple replacement
refac . "oldname" "newname"
# Refac always shows changes before applying
refac . "oldname" "newname"
# Force without confirmation
refac . "oldname" "newname" --force
# Only Rust files
refac . "old_function" "new_function" --include "*.rs"
# Multiple file types
refac . "oldname" "newname" --include "*.js" --include "*.ts" --include "*.json"
# Exclude build artifacts
refac . "oldname" "newname" --exclude "target/*" --exclude "*.log"
# Only rename files, don't change content
refac ./docs "draft" "final" --names-only
# Only change content, don't rename files
refac ./config "old.server.com" "new.server.com" --content-only
# Only process files, skip directories
refac . "oldname" "newname" --files-only
# Limit search depth
refac . "oldname" "newname" --max-depth 3
# Use more threads
refac . "oldname" "newname" --threads 8
# Case-insensitive matching
refac . "oldname" "newname" --ignore-case
# Regex patterns
refac . "old_\\w+" "new_name" --regex
# Create backups
refac . "oldname" "newname" --backup
# Verbose output for debugging
refac . "oldname" "newname" --verbose
# JSON output for scripts
refac . "oldname" "newname" --format json
# Plain text output
refac . "oldname" "newname" --format plain
# Disable progress bars
refac . "oldname" "newname" --progress never
/
or \
)--follow-symlinks
is specified“Root directory does not exist”
“Cannot specify more than one mode flag”
--files-only
, --dirs-only
, --names-only
, --content-only
“New string cannot contain path separators”
/
or \
characters from the new string“Naming collision detected”
Use verbose mode to see detailed operation information:
refac . "oldname" "newname" --verbose
This will show:
scrap [PATH...] [SUBCOMMAND] [OPTIONS]
# Move unwanted files to local trash can
scrap file.txt directory/
# List .scrap contents (default when no args)
scrap
scrap list [--sort name|date|size]
Subcommand | Description | Options |
---|---|---|
list |
List .scrap contents | --sort name\|date\|size |
clean |
Remove old items | --days N |
purge |
Remove all items | --force |
find |
Search for patterns | --content |
archive |
Create archive | --output FILE , --remove |
scrap temp.txt logs/ # Move to local trash can
scrap list --sort size # List trash contents
scrap find "*.log" # Find log files in trash
scrap clean --days 30 # Permanently remove old items
scrap archive backup.tar.gz --remove # Archive and remove
scrap purge --force # Empty trash completely
unscrap [NAME] [OPTIONS]
Command | Description |
---|---|
unscrap |
Restore last scrapped item |
unscrap NAME |
Restore specific item |
unscrap NAME --to PATH |
Restore to custom location |
unscrap NAME --force |
Overwrite existing files |
Option | Description |
---|---|
--to PATH |
Custom restoration path |
--force |
Overwrite existing files |
--help |
Show help |
--version |
Show version |
unscrap # Restore last item
unscrap important_file.txt # Restore specific file
unscrap config.json --to backup/ # Restore to directory
unscrap data.txt --force # Overwrite existing
st8 [SUBCOMMAND] [OPTIONS]
Subcommand | Description | Options |
---|---|---|
install |
Install git pre-commit hook | --force |
uninstall |
Remove git hook | |
show |
Display version information | |
update |
Manually update version | --no-git , --git-add |
status |
Show configuration status |
Create .st8.json
in repository root:
{
"version": 1,
"enabled": true,
"version_file": "version.txt"
}
{major}.{minor}.{patch}
v1.2
→ 1.2
)st8 install # Install git hook
st8 install --force # Force reinstall
st8 show # Show version info
st8 update # Manual update
st8 status # Check status
st8 uninstall # Remove hook
# Show help for each tool
refac --help
scrap --help
unscrap --help
st8 --help
# Show versions
refac --version
scrap --version
unscrap --version
st8 --version
For more information: