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.0.tar.gz (16.2 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.0-py3-none-any.whl (17.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: bashly_cli-0.1.0.tar.gz
  • Upload date:
  • Size: 16.2 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.0.tar.gz
Algorithm Hash digest
SHA256 c022cbba5b43986bd26b3c7a8bb44c7196ad04b42c9aea7c172c8935f5b99ea7
MD5 fbe8f6fb89c05ae02bd50811e5f4d9ae
BLAKE2b-256 8318cc9a51cd664828b907660f6468d4dc4e6a2be40ee5a8d3f4551bef971e25

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bashly_cli-0.1.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ee4d41a81d446a6495376f9f7e470cfc3f89fa555d33cce367b9945d89431107
MD5 a4311ee8177322201dbc1cb031ae49ab
BLAKE2b-256 062cb2facf01b03f5767674f0f6b6b98e196bf1d463cc27a2887e1dbd07b6315

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