A CLI tool to convert natural language to bash commands using OpenAI.
Project description
bgpt - Bash GPT CLI Tool
A command-line tool that translates natural language commands into bash commands using OpenAI's language models.
Installation
pip install bgpt
Usage
Before using bgpt, make sure you have the OPENAI_API_KEY environment variable set with your OpenAI API key. You can also set the OPENAI_BASE_URL environment variable if you are using a custom OpenAI endpoint, and the LLM_MODEL environment variable to change the model. The default model is GPT-4.1-mini.
Example:
export OPENAI_API_KEY="sk-..."
export OPENAI_BASE_URL="https://api.openai.com/v1"
export LLM_MODEL="GPT-4.1-mini"
bgpt <natural language command>
Examples:
bgpt create a folder named my-folder
bgpt list all files in the current directory
bgpt show me the contents of my_file.txt
The tool will then:
- Generate a bash command based on your input.
- Display the generated command and ask for confirmation.
- Execute the command if you confirm.
- Show the output of the command.
Configuration
- OPENAI_API_KEY: You must set this environment variable to your OpenAI API key.
- OPENAI_BASE_URL: (Optional) Set this environment variable if you are using a custom OpenAI endpoint.
- LLM_MODEL: (Optional) Set this environment variable to change the model.
Dependencies
- Python 3.8+
- openai Python library
License
Contributing
Contributions are welcome! Please submit a pull request with your changes.
Code of Conduct
Please note that this project is released with a Contributor Covenant Code of Conduct. By participating in this project you agree to abide by its terms.
Note: This tool uses the OpenAI API, so usage will incur costs based on your OpenAI API billing. Please use responsibly.
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 bgpt-0.2.0.tar.gz.
File metadata
- Download URL: bgpt-0.2.0.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
58db1e90d0901983eaa88557e9dfec05a714846cf35595d3e05331f0b1e0b045
|
|
| MD5 |
8bff4d55cf903fbf8c6d3c8a97d81717
|
|
| BLAKE2b-256 |
ffdec9aa7c2a0eaf614af92eb24e0559ce876e633991a62068e7fe15838794bf
|
Provenance
The following attestation bundles were made for bgpt-0.2.0.tar.gz:
Publisher:
pypi-publish.yml on jorado/bgpt
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bgpt-0.2.0.tar.gz -
Subject digest:
58db1e90d0901983eaa88557e9dfec05a714846cf35595d3e05331f0b1e0b045 - Sigstore transparency entry: 198925473
- Sigstore integration time:
-
Permalink:
jorado/bgpt@18a358eb7bd1023dd555c092f39498bec52df419 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/jorado
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@18a358eb7bd1023dd555c092f39498bec52df419 -
Trigger Event:
push
-
Statement type:
File details
Details for the file bgpt-0.2.0-py3-none-any.whl.
File metadata
- Download URL: bgpt-0.2.0-py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4161efd51a944c2be19814982b825f6bf393cfab7da6e43d9184f02d0ea33285
|
|
| MD5 |
310464494442a2e97a67ae90d78ac1bc
|
|
| BLAKE2b-256 |
a9a2f4367b4487787954e89740d3fa9e73bb1c4f251059984894225dc939d0d1
|
Provenance
The following attestation bundles were made for bgpt-0.2.0-py3-none-any.whl:
Publisher:
pypi-publish.yml on jorado/bgpt
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bgpt-0.2.0-py3-none-any.whl -
Subject digest:
4161efd51a944c2be19814982b825f6bf393cfab7da6e43d9184f02d0ea33285 - Sigstore transparency entry: 198925478
- Sigstore integration time:
-
Permalink:
jorado/bgpt@18a358eb7bd1023dd555c092f39498bec52df419 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/jorado
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@18a358eb7bd1023dd555c092f39498bec52df419 -
Trigger Event:
push
-
Statement type: