Translate natural-language shell instructions into Linux commands using a local OLLAMA model.
Project description
bit - Bash Instruction Translator
bit is a Python CLI that translates natural-language shell instructions into Linux shell commands by calling a locally running OLLAMA model.
Quick Installation
pip install bit-wrangler
Example Usage
$ bit create folder new_folder
mkdir new_folder
By default, bit prints the generated command to stdout.
If you want bit to place the generated command into your current shell prompt for review, first enable the Bash or Zsh shell integration (this only has to be done once).
Activate shell integration:
# Bash
source <(bit --activate bash) # alternatively replace bash with zsh
Option 1 (using Ctrl-x Ctrl-b):
find large log files in current directory
# press Ctrl-x Ctrl-b to replace the prompt with the generated command
Option 2 (using bit function):
bit find large log files in current directory
# the generated command is staged into the prompt for review
Features
- Translates free-form instructions into one shell command.
- Stores configuration in
~/.bitusing TOML. - Supports interactive model selection with
bit --setup. - Exposes shell integration instructions for Bash and Zsh so generated commands can be inserted into the prompt buffer.
- Builds as a standard Python package with
python -m build.
Requirements
- Python 3.11 or newer.
- A local OLLAMA installation.
- An OLLAMA server available at
http://127.0.0.1:11434. - At least one installed OLLAMA model.
Installation
Build and install locally:
python -m build
python -m pip install dist/bit_wrangler-1.0.1-py3-none-any.whl
Or install in editable mode while developing:
python -m pip install -e .
After installation, the bit command is available directly on the command line.
Development Tools
Install the development dependencies:
python -m pip install -e ".[dev]"
Run the formatter:
black src tests
Run Ruff:
ruff check src tests
Run Flake8:
flake8 src tests
Run mypy:
mypy src
Initial Setup
Run:
bit --setup
This command:
- Queries the local OLLAMA instance for installed models.
- Displays them as a numbered list.
- Prompts you to select one.
- Saves the result in
~/.bit.
The config file is TOML and looks like this:
model = "llama3.1:8b"
host = "http://127.0.0.1:11434"
Usage
Translate an instruction:
bit create folder new_folder
bit find large log files in current directory
bit show disk usage for home directory
Print Bash integration helper:
bit --activate bash
Print Zsh integration helper:
bit --activate zsh
Print Bash deactivation helper:
bit --deactivate bash
Print Zsh deactivation helper:
bit --deactivate zsh
Show help:
bit --help
Shell Integration
The standalone bit executable only prints commands. If you want generated commands staged into your current shell prompt so you can review and edit them before execution, source the appropriate shell integration.
To enable that widget in Bash:
source <(bit --activate bash)
To enable that widget in Zsh:
source <(bit --activate zsh)
To unload the integration in Bash:
source <(bit --deactivate bash)
To unload the integration in Zsh:
source <(bit --deactivate zsh)
After sourcing the Zsh integration, you can also invoke bit directly as a shell function:
bit create folder new_folder
That direct Zsh function call does not execute the generated command immediately. Instead, it stages the translated shell command into the next prompt so you can review or edit it before pressing Enter.
Then type a natural-language instruction directly at the shell prompt and press Ctrl-x Ctrl-b. The widget will:
- Read the current command line buffer as the instruction.
- Call the installed
bitCLI. - Replace the current command line with the generated shell command.
Nothing is executed automatically. You can edit the generated command and then press Enter yourself.
To load this automatically, add the matching source <(bit --activate ...) line to your shell startup file.
In Zsh, sourcing the integration also defines a bit shell function that shadows the installed executable in that shell session. Administrative commands such as bit --setup, bit --help, bit --activate zsh, and bit --deactivate zsh still pass through to the real CLI.
Build
Create a source distribution and wheel:
python -m build
Limitations and Security Notes
- The tool asks the model for a single shell command, but model output is still untrusted text.
bitrejects obvious malformed multi-line and fenced responses, but it does not prove a generated command is safe.- Review generated commands before executing them.
- Prompt staging is available through sourced shell integration rather than the standalone executable.
- The default target is Linux shell syntax even if the tool is run elsewhere.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bit_wrangler-1.0.1.tar.gz.
File metadata
- Download URL: bit_wrangler-1.0.1.tar.gz
- Upload date:
- Size: 15.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5db27c1cf4d02e4b81818663570a4d618736772f8f6d23c978c063a2ddc93e8a
|
|
| MD5 |
393599149b4670d2622b4ade90cdda7d
|
|
| BLAKE2b-256 |
8edaad69718e868aa254bfff549279ebd6cc8ffa040c4e7d2f3078c6544f9e31
|
Provenance
The following attestation bundles were made for bit_wrangler-1.0.1.tar.gz:
Publisher:
publish.yml on gwr3n/bit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bit_wrangler-1.0.1.tar.gz -
Subject digest:
5db27c1cf4d02e4b81818663570a4d618736772f8f6d23c978c063a2ddc93e8a - Sigstore transparency entry: 1184541135
- Sigstore integration time:
-
Permalink:
gwr3n/bit@1addd58aa15268bf740541805abfc0bbe82c3060 -
Branch / Tag:
refs/tags/v1.0.1 - Owner: https://github.com/gwr3n
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@1addd58aa15268bf740541805abfc0bbe82c3060 -
Trigger Event:
release
-
Statement type:
File details
Details for the file bit_wrangler-1.0.1-py3-none-any.whl.
File metadata
- Download URL: bit_wrangler-1.0.1-py3-none-any.whl
- Upload date:
- Size: 10.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
41fd0532709c0927be1d929de4e2bb0ba711a1c9172f2a9b5ab4917a409a9ce1
|
|
| MD5 |
b7edefe2396a692339738ac10cd20ea4
|
|
| BLAKE2b-256 |
9b212533650ebc2e8e9e458ac60ba730f505bf5d853844b9f34ca584347d587b
|
Provenance
The following attestation bundles were made for bit_wrangler-1.0.1-py3-none-any.whl:
Publisher:
publish.yml on gwr3n/bit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bit_wrangler-1.0.1-py3-none-any.whl -
Subject digest:
41fd0532709c0927be1d929de4e2bb0ba711a1c9172f2a9b5ab4917a409a9ce1 - Sigstore transparency entry: 1184541137
- Sigstore integration time:
-
Permalink:
gwr3n/bit@1addd58aa15268bf740541805abfc0bbe82c3060 -
Branch / Tag:
refs/tags/v1.0.1 - Owner: https://github.com/gwr3n
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@1addd58aa15268bf740541805abfc0bbe82c3060 -
Trigger Event:
release
-
Statement type: