Skip to main content

AI-powered cross-environment terminal assistant

Project description

Bashly

AI-powered cross-environment terminal assistant. Type your request in plain English — Bashly generates the right command for your target environment, lets you approve or deny it, and optionally runs it.

Supported environments

Environment Can run locally?
Windows (PowerShell) Yes
Windows (CMD) Yes
Linux (bash) Yes
macOS (zsh) Yes
Android (Termux) Copy only
MicroPython (ESP32 / Pi Pico) Copy only
Arduino CLI Copy only
Raspberry Pi (bash + GPIO) Copy only

Setup

1. Get an OpenRouter API key

Go to openrouter.ai, sign in, and create an API key.

2. Clone or download this project

git clone https://github.com/yourusername/bashly
cd bashly

3. Add your API key

Open .env and replace the placeholder:

OPENROUTER_API_KEY=your_actual_key_here

4. Install dependencies with uv

uv init
uv add openai rich python-dotenv pyperclip

Or with pip:

pip install -r requirements.txt

5. Run Bashly

uv run bashly.py

Or with Python directly:

python bashly.py

Usage

On startup, Bashly asks you to pick a target environment. After that, just type naturally:

Bashly (Linux) > find all log files older than 7 days
Bashly (MicroPy) > blink the onboard LED every 500ms
Bashly (Win/PS) > list all running processes sorted by memory

Commands

Type this Does this
history Show last 10 commands
clear history Delete all saved history
switch env Change target environment without restarting
exit Quit Bashly

Approve / deny options

For executable environments (Windows, Linux, macOS):

  • y — run the command
  • n — skip it
  • c — copy to clipboard without running
  • ? — explain what the command does, then decide

For copy-only environments (MicroPython, Arduino, Termux, RPi):

  • y — copy to clipboard
  • n — skip it
  • ? — explain, then decide

Project structure

bashly/
├── bashly.py         Main loop and UI
├── llm.py            LLM API calls (OpenRouter)
├── executor.py       Danger check and subprocess execution
├── history.py        Save and load command history
├── environments.py   All supported environments and their prompts
├── .env              Your API key (never commit this)
└── requirements.txt  Dependencies

Safety

Bashly checks every command for dangerous patterns before showing it to you:

  • Red / DANGEROUS — contains destructive patterns like rm -rf, format c:, dd if=, fork bombs
  • Yellow / Caution — contains elevated-privilege patterns like sudo, chmod, kill
  • Green / Safe — no known dangerous patterns detected

You always have to explicitly approve before anything runs. Bashly never auto-executes.

History

All approved, denied, and copied commands are saved to ~/.bashly_history.json. This file persists across sessions and is stored in your home directory.

Notes

  • Danger detection is not a security guarantee — always read the command before approving
  • For MicroPython and Arduino targets, Bashly generates code snippets, not terminal commands
  • The switch env command lets you generate commands for multiple environments in one session

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bashly_cli-0.1.2.tar.gz (16.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bashly_cli-0.1.2-py3-none-any.whl (17.5 kB view details)

Uploaded Python 3

File details

Details for the file bashly_cli-0.1.2.tar.gz.

File metadata

  • Download URL: bashly_cli-0.1.2.tar.gz
  • Upload date:
  • Size: 16.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for bashly_cli-0.1.2.tar.gz
Algorithm Hash digest
SHA256 24b99cfa4c2ad67704de0928377082ef7cd3f462884c00cc41f216a4ceafb164
MD5 c84fe7eeca9894a6f8dbbbc9cdb1491c
BLAKE2b-256 45db2f4571dd98e9ab5bb1271fc8cbc849544c7f60982f50f31ce7727093672e

See more details on using hashes here.

File details

Details for the file bashly_cli-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: bashly_cli-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 17.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for bashly_cli-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 52dc4f664bcae64982f18a8aa91bbc8f847ba3d5ec2bdccfad134e0b9f2ac027
MD5 17a661f21018dc96c9ff34f7dfbf2e00
BLAKE2b-256 20ac39bcb3195341fabdad1b54397b60f9d23f1cac8c22efaf556f60b0ac0c74

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page