|
9 | 9 | [](https://pypi.org/project/shellrosetta/) |
10 | 10 | [](https://codecov.io/github/sdirishguy/shellrosetta) |
11 | 11 |
|
12 | | -## What is ShellRosetta? |
13 | | - |
14 | | -ShellRosetta is a cross-platform CLI tool for developers, sysadmins, and anyone switching between Windows and Linux. |
15 | | - |
16 | | -It instantly translates commands—including flags and arguments—between Linux/Bash and PowerShell. No more flipping between cheat sheets or Stack Overflow! |
| 12 | +# ShellRosetta v1.2.0 |
17 | 13 |
|
18 | | -## Features |
| 14 | +**Enterprise-grade Linux/Bash to PowerShell translator with AI, plugins, and web interface.** |
19 | 15 |
|
20 | | -- 🖥️ **Interactive Shell Mode!** Open ShellRosetta as a REPL and translate commands live, just like in a real shell. |
21 | | -- 🔄 **Bi-directional translation:** Linux ↔ PowerShell, with accurate mappings for real-world scenarios. |
22 | | -- 🏷️ **Flag and multi-flag aware:** Understands combos like `ls -alh`, `rm -rf`, etc. |
23 | | -- 🔗 **Pipeline support:** Handles piped commands (e.g. `ls -l | grep foo`). |
24 | | -- 🌐 **Networking and system commands:** Supports `ping`, `curl`, `Get-NetTCPConnection`, and many more. |
25 | | -- 📋 **Extensive mappings:** Permissions, archiving, users, process management, environment variables, I/O redirection, and more. |
26 | | -- 🚦 **Helpful notes:** Outputs usage tips or warnings if there's no direct translation or if a flag behaves differently. |
27 | | -- 🧩 **Easily extensible:** Add or edit mappings in `mappings.py`—grow as you learn! |
28 | | -- ⚡ **Ready for shell aliases & tab-completion:** Bash/Zsh completion script included. |
29 | | -- 🤖 **Machine Learning Integration:** Learns from your translations and provides smart suggestions. |
30 | | -- 🔌 **Plugin System:** Extensible architecture with built-in plugins for Docker, Kubernetes, AWS, and Git. |
31 | | -- 🌐 **Web API:** REST API and beautiful web interface for programmatic access. |
32 | | -- 📊 **Advanced Features:** AST parsing, configuration management, and comprehensive testing. |
| 16 | +[](LICENSE) |
| 17 | +[](https://pypi.org/project/shellrosetta/) |
| 18 | +[](https://www.python.org/downloads/) |
33 | 19 |
|
34 | | -## What's New in v1.1.0 |
| 20 | +## What is ShellRosetta? |
35 | 21 |
|
36 | | -- ✅ **Fixed all markdownlint formatting issues** in documentation |
37 | | -- ✅ **Enhanced CLI functionality** with better error handling and Windows compatibility |
38 | | -- ✅ **Improved documentation** with proper markdown formatting |
39 | | -- ✅ **Resolved import dependencies** (flask-cors installation) |
40 | | -- ✅ **Better cross-platform support** with readline handling for Windows |
| 22 | +ShellRosetta is a comprehensive command translation platform for developers, sysadmins, and anyone working across Windows and Linux environments. It provides intelligent, bidirectional translation between Linux/Bash and PowerShell commands with AI-powered pattern learning. |
41 | 23 |
|
42 | | -## Quickstart |
| 24 | +## Features |
43 | 25 |
|
44 | | -**Install from PyPI:** |
| 26 | +### Core Translation |
| 27 | +- **Bidirectional translation**: Linux ↔ PowerShell with 100+ command mappings |
| 28 | +- **Flag-aware translation**: Understands complex flag combinations (`ls -alh`, `rm -rf`, etc.) |
| 29 | +- **Pipeline support**: Handles piped commands (`ls -l | grep foo`) |
| 30 | +- **Intelligent mapping**: Contextual notes for platform differences |
| 31 | + |
| 32 | +### Advanced Features (NEW in v1.2.0) |
| 33 | +- **Web Interface**: Beautiful, responsive web UI at `http://localhost:5000` |
| 34 | +- **Plugin System**: Extensible architecture with Docker, Kubernetes, AWS, Git plugins |
| 35 | +- **ML Engine**: Learns from translations and provides smart suggestions |
| 36 | +- **Interactive CLI**: REPL-style interface with command history |
| 37 | +- **AST Parsing**: Advanced command analysis and structure understanding |
| 38 | +- **Security Validation**: Multi-level command safety checking |
| 39 | +- **Performance Monitoring**: Caching and performance metrics |
| 40 | + |
| 41 | +### Professional Features |
| 42 | +- **Cross-platform**: Windows, Linux, macOS compatibility |
| 43 | +- **Tab Completion**: Bash/Zsh autocomplete support |
| 44 | +- **Configuration Management**: Customizable settings and preferences |
| 45 | +- **Error Handling**: Robust error reporting and recovery |
| 46 | +- **API Endpoints**: RESTful API for programmatic access |
| 47 | + |
| 48 | +## Installation |
45 | 49 |
|
46 | 50 | ```bash |
47 | 51 | pip install shellrosetta |
48 | 52 | ``` |
49 | 53 |
|
50 | | -**Or clone and install locally:** |
| 54 | +## Quick Start |
51 | 55 |
|
| 56 | +### Command Line Usage |
52 | 57 | ```bash |
53 | | -git clone https://github.com/sdirishguy/shellrosetta.git |
54 | | -cd shellrosetta |
55 | | -pip install . |
| 58 | +# Linux to PowerShell |
| 59 | +shellrosetta lnx2ps "ls -alh | grep error" |
| 60 | +# Output: Get-ChildItem -Force | Format-List | Select-String error |
| 61 | + |
| 62 | +# PowerShell to Linux |
| 63 | +shellrosetta ps2lnx "Get-ChildItem -Force" |
| 64 | +# Output: ls -a |
| 65 | + |
| 66 | +# Interactive mode |
| 67 | +shellrosetta |
| 68 | + |
| 69 | +# Web interface |
| 70 | +shellrosetta api |
| 71 | +# Open http://localhost:5000 in browser |
| 72 | +``` |
| 73 | + |
| 74 | +### Python API |
| 75 | +```python |
| 76 | +from shellrosetta.core import lnx2ps, ps2lnx |
| 77 | + |
| 78 | +# Translate commands |
| 79 | +linux_cmd = "ls -la | grep .txt" |
| 80 | +powershell_cmd = lnx2ps(linux_cmd) |
| 81 | +print(powershell_cmd) |
| 82 | +# Output: Get-ChildItem -Force | Format-List | Select-String .txt |
56 | 83 | ``` |
57 | 84 |
|
58 | | -**Usage:** |
| 85 | +## Web Interface |
59 | 86 |
|
| 87 | +Start the web server: |
60 | 88 | ```bash |
61 | | -shellrosetta lnx2ps "ls -alh | grep error" |
62 | | -shellrosetta ps2lnx "Get-ChildItem -Force | Select-String error" |
| 89 | +shellrosetta api |
63 | 90 | ``` |
64 | 91 |
|
65 | | -**Or test before installing:** |
| 92 | +Open http://localhost:5000 for an intuitive web interface featuring: |
| 93 | +- Real-time command translation |
| 94 | +- Syntax highlighting |
| 95 | +- Usage examples |
| 96 | +- Translation history |
66 | 97 |
|
| 98 | +## Plugin System |
| 99 | + |
| 100 | +ShellRosetta includes plugins for: |
| 101 | +- **Docker**: Container management commands |
| 102 | +- **Kubernetes**: Cluster operations (`kubectl`) |
| 103 | +- **AWS CLI**: Cloud service commands |
| 104 | +- **Git**: Version control operations |
| 105 | + |
| 106 | +List available plugins: |
67 | 107 | ```bash |
68 | | -python -m shellrosetta.cli lnx2ps "ls -alh | grep error" |
69 | | -python -m shellrosetta.cli ps2lnx "Get-ChildItem -Force | Select-String error" |
| 108 | +shellrosetta plugins |
70 | 109 | ``` |
71 | 110 |
|
72 | | -**(Optional) Add aliases to your shell:** |
| 111 | +## Machine Learning |
73 | 112 |
|
| 113 | +The ML engine learns from your translations: |
74 | 114 | ```bash |
75 | | -echo "alias lnx2ps='shellrosetta lnx2ps'" >> ~/.bashrc |
76 | | -echo "alias ps2lnx='shellrosetta ps2lnx'" >> ~/.bashrc |
77 | | -source ~/.bashrc |
| 115 | +# View learning insights |
| 116 | +shellrosetta ml |
| 117 | + |
| 118 | +# The system automatically learns patterns and improves suggestions |
78 | 119 | ``` |
79 | 120 |
|
80 | | -**(Optional) Enable tab-completion:** |
81 | | -Copy `shellrosetta/autocomplete.sh` somewhere (or use directly from the repo), then add this to your `~/.bashrc` or `~/.zshrc`: |
| 121 | +## Configuration |
82 | 122 |
|
| 123 | +Customize behavior: |
83 | 124 | ```bash |
84 | | -source /path/to/shellrosetta/autocomplete.sh |
| 125 | +# View current settings |
| 126 | +shellrosetta config |
| 127 | + |
| 128 | +# Settings include color output, history size, security levels |
85 | 129 | ``` |
86 | 130 |
|
87 | | -Reload your shell: |
| 131 | +## Examples |
| 132 | + |
| 133 | +### File Operations |
| 134 | +```bash |
| 135 | +# Linux → PowerShell |
| 136 | +shellrosetta lnx2ps "rm -rf folder/" |
| 137 | +# Remove-Item -Recurse -Force folder/ |
| 138 | + |
| 139 | +shellrosetta lnx2ps "cp -r src/ dest/" |
| 140 | +# Copy-Item -Recurse src/ dest/ |
| 141 | +``` |
88 | 142 |
|
| 143 | +### System Information |
89 | 144 | ```bash |
90 | | -source ~/.bashrc |
91 | | -# or |
92 | | -source ~/.zshrc |
| 145 | +# Linux → PowerShell |
| 146 | +shellrosetta lnx2ps "ps aux | grep nginx" |
| 147 | +# Get-Process | Select-String nginx |
| 148 | + |
| 149 | +shellrosetta lnx2ps "df -h" |
| 150 | +# Get-PSDrive |
93 | 151 | ``` |
94 | 152 |
|
95 | | -Now you get tab completion for commands and flags! |
| 153 | +### Network Operations |
| 154 | +```bash |
| 155 | +# Linux → PowerShell |
| 156 | +shellrosetta lnx2ps "ping google.com" |
| 157 | +# Test-Connection google.com |
96 | 158 |
|
97 | | -## Interactive Shell Mode |
| 159 | +shellrosetta lnx2ps "curl -X POST https://api.example.com" |
| 160 | +# Invoke-WebRequest -Method POST https://api.example.com |
| 161 | +``` |
98 | 162 |
|
99 | | -Run with no arguments for a live translation shell! |
| 163 | +## Advanced Usage |
100 | 164 |
|
| 165 | +### Interactive Mode |
101 | 166 | ```bash |
102 | 167 | shellrosetta |
| 168 | +# Provides REPL interface with: |
| 169 | +# - Command history |
| 170 | +# - Mode switching (lnx2ps ↔ ps2lnx) |
| 171 | +# - Built-in help |
| 172 | +# - Tab completion |
| 173 | +``` |
| 174 | + |
| 175 | +### API Server |
| 176 | +```bash |
| 177 | +shellrosetta api --port 8080 |
| 178 | +# Starts Flask server with REST endpoints: |
| 179 | +# POST /api/translate - Translate commands |
| 180 | +# GET /api/stats - Usage statistics |
| 181 | +# GET /api/plugins - Plugin information |
| 182 | +``` |
| 183 | + |
| 184 | +## Development |
| 185 | + |
| 186 | +### Custom Plugins |
| 187 | +```python |
| 188 | +from shellrosetta.plugins import CommandPlugin |
| 189 | + |
| 190 | +class MyPlugin(CommandPlugin): |
| 191 | + def get_name(self): |
| 192 | + return "my_plugin" |
| 193 | + |
| 194 | + def translate(self, command, direction): |
| 195 | + # Custom translation logic |
| 196 | + return translated_command |
| 197 | +``` |
| 198 | + |
| 199 | +### Extending Mappings |
| 200 | +Add custom mappings in `shellrosetta/mappings.py`: |
| 201 | +```python |
| 202 | +CUSTOM_MAPPINGS = { |
| 203 | + "my_command": ("My-PowerShell-Equivalent", "Usage note") |
| 204 | +} |
103 | 205 | ``` |
104 | 206 |
|
105 | | -You'll be prompted for your translation mode (lnx2ps or ps2lnx). Enter commands and see translations instantly, switching modes at any time with `mode` or exit with `exit`. |
| 207 | +## Requirements |
| 208 | + |
| 209 | +- Python 3.7+ |
| 210 | +- Optional: Flask for web interface (`pip install flask flask-cors`) |
| 211 | + |
| 212 | +## Architecture |
| 213 | + |
| 214 | +ShellRosetta features a modular architecture: |
| 215 | +- **Core Engine**: Command parsing and translation |
| 216 | +- **ML Engine**: Pattern learning and suggestions |
| 217 | +- **Plugin System**: Extensible command handlers |
| 218 | +- **Web API**: Flask-based REST interface |
| 219 | +- **CLI Interface**: Professional command-line tool |
| 220 | + |
| 221 | +## Contributing |
| 222 | + |
| 223 | +1. Fork the repository |
| 224 | +2. Create a feature branch |
| 225 | +3. Add tests for new functionality |
| 226 | +4. Submit a pull request |
| 227 | + |
| 228 | +## License |
| 229 | + |
| 230 | +MIT License - see [LICENSE](LICENSE) file. |
106 | 231 |
|
107 | | -**Example session:** |
| 232 | +## Changelog |
108 | 233 |
|
109 | | -```shell |
110 | | -$ shellrosetta |
111 | | -================================================================= |
112 | | -ShellRosetta: Linux ↔ PowerShell CLI Command Translator |
113 | | -Author: David Donohue |
114 | | -Repo: github.com/sdirishguy/shellrosetta |
115 | | -================================================================= |
116 | | -Welcome to ShellRosetta Interactive Mode! |
117 | | -Type 'exit' to quit, or 'mode' to switch translation direction. |
118 | | -Mode [lnx2ps/ps2lnx] (or 'exit'): lnx2ps |
119 | | -Type your LNX2PS commands below. Type 'mode' to switch, 'exit' to quit. |
| 234 | +### v1.2.0 (Latest) |
| 235 | +- Added web interface with Flask API |
| 236 | +- Implemented plugin system with 4 built-in plugins |
| 237 | +- Added ML engine with pattern learning |
| 238 | +- Enhanced CLI with interactive mode |
| 239 | +- Added comprehensive test suite |
| 240 | +- Improved error handling and documentation |
120 | 241 |
|
121 | | -> ls -alh | grep foo |
| 242 | +### v1.1.x |
| 243 | +- Basic command translation |
| 244 | +- Core mapping system |
| 245 | +- CLI interface |
122 | 246 |
|
123 | | ---- Translation --- |
124 | | -PowerShell Equivalent: |
125 | | - Get-ChildItem -Force | Format-List # [Human-readable file sizes not natively available.] | Select-String foo |
126 | | -------------------- |
| 247 | +## Support |
127 | 248 |
|
128 | | -> rm -rf /tmp |
129 | | ---- Translation --- |
130 | | -PowerShell Equivalent: |
131 | | - Remove-Item -Recurse -Force /tmp |
132 | | -------------------- |
| 249 | +- GitHub Issues: Report bugs and feature requests |
| 250 | +- Documentation: Complete API docs in `/docs` |
| 251 | +- Examples: See `/examples` directory |
133 | 252 |
|
134 | | -> mode |
| 253 | +Transform your cross-platform command workflow with ShellRosetta! |
0 commit comments