Workspace - Command-Line Tool Suite

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).

View on GitHub

Workspace

A unified tool suite for developers and system administrators that provides file operations, line analysis, version management, and development workflow automation. All tools accessible through a single ws binary with intuitive subcommands.

Current Version: 0.38.31859
Build Status: Clean compilation with zero warnings
Test Status: 249 tests passing across 8 test suites

Tools Overview

Refac - Code Refactoring Engine

Recursive string replacement with automatic encoding detection and safety features.

# Refactor always previews changes and asks for confirmation
ws refactor ./src "OldClassName" "NewClassName" --verbose

# Refactor with backups and specific file types
ws refactor ./src "OldApi" "NewApi" --backup --include "*.rs" --include "*.toml"

# Include hidden files like .ws configurations  
ws refactor . "old_name" "new_name" --include-hidden

Key Features: Encoding detection (UTF-8, UTF-16, Windows-1252), pre-validation, collision detection, multi-threaded processing
Developer Focus: API migrations, bulk renames, safe refactoring, configuration updates
Complete Guide

Ldiff - Log Analysis Engine

Real-time pattern recognition for logs and command output with ANSI color preservation.

# Monitor logs in real-time
tail -f /var/log/system.log | ws ldiff

# Analyze different log sources with distinct markers
journalctl -f | ws ldiff "■"
systemctl status | ws ldiff "●"
cargo test --verbose | ws ldiff "█"

Key Features: Real-time streaming, ANSI preservation, customizable visualization, pattern recognition
Developer Focus: Debug analysis, monitoring, test output parsing, system administration
Complete Guide

Scrap - Local Trash System

Safe file disposal with metadata tracking, search capabilities, and git integration.

# Move files to local trash instead of deleting
ws scrap experimental_feature/ temp_logs/ *.bak old_tests/

# Search and browse stored files
ws scrap find "*.rs" --content
ws scrap list --sort date

# Archive and clean up old items
ws scrap archive --output backup-$(date +%Y%m%d).tar.gz --remove
ws scrap clean --days 14

Key Features: Metadata tracking, conflict resolution, content search, git integration, archive support
Developer Focus: Experimental code cleanup, safe file disposal, temporary file management
Complete Guide

Unscrap - File Recovery System

Restore files from scrap with automatic path reconstruction and conflict resolution.

# Quick restore operations
ws unscrap                                    # Restore last scrapped item
ws unscrap experimental_feature/              # Restore specific directory
ws unscrap important.rs --to ~/backup/       # Custom destination with conflict handling

Key Features: Automatic recovery, custom destinations, conflict handling, batch restoration
Developer Focus: Accident recovery, experiment rollback, selective file restoration
Complete Guide

Git Integration & Template System

Git-integrated versioning with template engine for automated file generation.

# Set up automatic versioning
ws git install

# Add templates that auto-update with version changes
ws template add version-header \
  --template "#define VERSION \"\"
#define BUILD_DATE \"\"" \
  --output "src/version.h"

# Manual version update and template rendering
ws update --git-add

# Templates render automatically on commits
git add . && git commit -m "New feature"  # Auto-increments version and renders templates

Key Features: Git integration, Tera template engine, automatic rendering, multi-format support
Developer Focus: Release automation, version consistency, file generation, CI/CD integration
Complete Guide

Template System Examples

The template system supports Tera templating with these variables:

C/C++ Version Header Template

ws template add version-header \
  --template \
"#ifndef VERSION_H
#define VERSION_H
#define PROJECT_VERSION \"\"
#define BUILD_DATE \"\"
#endif" \
  --output "include/version.h"

JavaScript Version Module Template

ws template add version-js \
  --template \
"export const VERSION = {
  full: '',
  major: ,
  buildDate: ''
};" \
  --output "src/version.js"

Docker Compose Template

ws template add docker-compose \
  --template \
"version: '3.8'
services:
  app:
    image: :
    environment:
      - VERSION=" \
  --output "docker-compose.prod.yml"

Quality Assurance & Testing

Test Suite Coverage

Safety Features

Test Categories

| Test Suite | Tests | Focus Area | |————|——-|————| | integration_tests | 18 | Cross-tool integration | | refac_concurrency_tests | 9 | Multi-threading safety | | refac_edge_cases_tests | 14 | Complex scenarios | | refac_encoding_tests | 7 | Encoding safety | | scrap_advanced_integration_tests | 21 | Workflows | | st8_template_tests | 15 | Template system |

Installation

Quick Install

git clone https://github.com/jowharshamshiri/workspace.git
cd workspace
./install.sh

Verification

# Check installation and version
ws --version       # Should show: ws 0.34.20950

# Test basic functionality
echo "hello world" | ws ldiff
ws git status
ws refactor --help

Installation Guide

Usage Workflows

Development Refactoring Workflow

# 1. Review changes (refactor shows changes before applying)
ws refactor ./src "OldApi" "NewApi" --verbose

# 2. Apply refactoring with backups
ws refactor ./src "OldApi" "NewApi" --backup

# 3. Update configuration files
ws refactor ./config "old.endpoint" "new.endpoint" --content-only --include "*.toml"

# 4. Clean up old test files
ws scrap legacy_tests/ old_benchmarks/

# 5. Update version and render templates
ws update --git-add  # Templates auto-render with new version

Log Analysis Workflow

# 1. Monitor application logs in real-time
tail -f /var/log/app.log | ldiff

# 2. Analyze historical patterns
cat /var/log/app.log.1 | ldiff > patterns-yesterday.txt

# 3. Compare different deployments
cat deployment-v1.log | ldiff "v1:" > patterns-v1.txt
cat deployment-v2.log | ldiff "v2:" > patterns-v2.txt
diff patterns-v1.txt patterns-v2.txt

File Management Workflow

# 1. Move questionable files to safe storage
scrap experimental_code/ temp_data/ *.backup

# 2. Review and search stored files
scrap list --sort date
scrap find "important" --content

# 3. Archive old items or restore needed files
scrap archive --output archive-$(date +%Y%m%d).tar.gz
unscrap important_config.toml --to ./config/

Key Features

Getting Help

Each tool provides help documentation:

ws refactor --help   # Refac documentation
ws ldiff --help      # Log analysis usage guide
ws scrap --help      # File management operations
ws unscrap --help    # Recovery system guide
ws git --help        # Git integration and version management
ws template --help   # Template system commands
ws update --help     # Version update commands

Documentation

Tool-Specific Guides

Support & Community

License

MIT License - see the LICENSE file for details.