Skip to main content

🐚 Baish

Natural Language to Bash Commands using Ollama

Baish is a simple, elegant terminal application that converts natural language instructions into bash/linux commands using a local Ollama instance. Say goodbye to googling command syntax!

Demo License

✨ Features

  • 🎨 Beautiful Terminal UI - Rich, colorful interface with panels and prompts
  • 🔗 Ollama Integration - Works with any Ollama model locally
  • ⚡ Dual Modes - Interactive mode or single command execution
  • 🛡️ Safety First - Built-in checks for potentially dangerous commands
  • 🚀 Real-time Execution - Live command output streaming
  • 📝 Help System - Built-in help with -h and /help commands

🚀 Quick Start

Prerequisites

  1. Python 3.8+ with uv package manager
  2. Ollama installed and running locally
  3. A model downloaded in Ollama (e.g., ollama pull llama3.2)

Installation

pip install baish_assistant

Option 2: From Source

git clone https://github.com/tcsenpai/baish.git
cd baish
uv pip install -e .

Option 3: Direct Execution

git clone https://github.com/tcsenpai/baish.git
cd baish
uv pip install rich click python-dotenv requests
python main.py "show my ip address"

Configuration

Create a .env file in your project directory:

OLLAMA_URL=http://localhost:11434
OLLAMA_MODEL=llama3.2:latest

📖 Usage

Command Line Interface

# Single command mode
baish "show my ip address"
baish "list files in current directory"
baish "check disk usage"

# Interactive mode
baish -i

# Show help
baish -h

# Direct execution (without installation)
python main.py "find python files"
uv run python main.py -i

Interactive Mode

$ baish -i
┌─────────────────────────────────────────┐
│ 🐚 Baish - Natural Language to Bash    │
└─────────────────────────────────────────┘

What would you like to do? > show my ip address

🤔 Thinking...

┌─── Generated Command ───┐
│ ip addr show            │
└─────────────────────────┘

Execute this command? [Y/n]: y

────────────────────────────────────────────
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536...
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP>...
────────────────────────────────────────────
✓ Command completed successfully

🎯 Examples

Natural Language Generated Command
"show my ip address" ip addr show
"list files in current directory" ls -la
"check disk usage" df -h
"find python files" find . -name "*.py"
"stop nginx service" sudo systemctl stop nginx
"show running processes" ps aux
"check memory usage" free -h
"show network connections" netstat -tuln

🛡️ Safety Features

Baish includes built-in safety checks for potentially dangerous commands:

  • Pattern Detection: Identifies risky commands like rm -rf /, format, shutdown, curl | sh
  • User Confirmation: Always prompts before executing any command
  • Command Preview: Shows exactly what will be executed in a highlighted panel
  • Graceful Cancellation: Easy to cancel dangerous operations
  • Debug Mode: Optional detailed logging for troubleshooting

Dangerous patterns detected:

  • File system destruction (rm -rf /, format, mkfs)
  • System control (shutdown, reboot, init)
  • Privilege escalation risks (chmod 777, chown root)
  • Remote execution (curl | sh, wget | sh)
  • Fork bombs and system overload

⚙️ Configuration Options

Environment Variables

  • OLLAMA_URL - Ollama server URL (default: http://localhost:11434)
  • OLLAMA_MODEL - Model to use (default: llama3.2:latest)
  • BASH_DEBUG - Enable debug logging (optional)

Advanced Configuration

# Use remote Ollama instance
OLLAMA_URL=http://192.168.1.100:11434

# Use a specific model variant
OLLAMA_MODEL=codellama:7b-instruct

# Enable debug output
BASH_DEBUG=1

Model Recommendations

  • Fast & Efficient: llama3.2:latest, qwen2.5:7b, phi3:mini
  • More Capable: llama3.1:8b, codellama:7b, qwen2.5:14b
  • Lightweight: tinyllama:latest, phi3:mini
  • Code-Focused: codellama:7b, deepseek-coder:6.7b

Note: Ensure your chosen model is installed in Ollama:

ollama pull llama3.2:latest

🏗️ Development

Setup Development Environment

git clone https://github.com/tcsenpai/baish.git
cd baish

# Copy and configure environment
cp .env.example .env
# Edit .env with your Ollama settings

# Install dependencies
uv pip install -e ".[dev]"

# Run tests
pytest

# Format code
black .
ruff check .

Project Structure

baish/
├── baish/
│   ├── __init__.py
│   └── main.py          # Package entry point
├── main.py              # Direct execution entry point
├── pyproject.toml       # Project configuration
├── .env                 # Configuration file
└── README.md           # This file

Running Tests

pytest

Code Formatting

black .
ruff check .

🤝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgments

  • Ollama for the excellent local LLM platform
  • Rich for the beautiful terminal UI
  • Click for the CLI framework

📞 Support


Made with ❤️ by tcsenpai

Metadata

Release files for baish-assistant 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for baish-assistant 0.1.2
File Size Uploaded Provenance Actions
baish_assistant-0.1.2.tar.gz 53.6 kB Without provenance Details for baish_assistant-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for baish-assistant 0.1.2
File Interpreter ABI Platform Actions
baish_assistant-0.1.2-py3-none-any.whl Python 3 none any Details for baish_assistant-0.1.2-py3-none-any.whl

Total release size: 62.3 kB

Release files / baish_assistant-0.1.2.tar.gz

Download URL baish_assistant-0.1.2.tar.gz
Size 53.6 kB
Tags Source
SHA-256 checksum
How to use checksums
3d7c8271b46781a064b9e07a77b27a481b9c02a1a991497d1d7cb0235c7b4f3d
BLAKE2b-256 checksum
How to use checksums
ae76618cd47a7705a887e55b270d66d0481fdd37b261e4ac7c01e8dac88b4f52
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / baish_assistant-0.1.2-py3-none-any.whl

Download URL baish_assistant-0.1.2-py3-none-any.whl
Size 8.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
deff73704c713ac769f1141da651d11ace7fa28dd37bf3df2e1f7a3003d542a2
BLAKE2b-256 checksum
How to use checksums
34c9ca941c0c446e21fd4e3fae3d5b5fc4e4261c9672e091a9cfe929f16dd882
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Security for baish-assistant 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page