Skip to main content

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:

  1. Generate a bash command based on your input.
  2. Display the generated command and ask for confirmation.
  3. Execute the command if you confirm.
  4. 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

MIT 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


Download files

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

Source Distribution

bgpt-0.1.1.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

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

bgpt-0.1.1-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file bgpt-0.1.1.tar.gz.

File metadata

  • Download URL: bgpt-0.1.1.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for bgpt-0.1.1.tar.gz
Algorithm Hash digest
SHA256 6459eb8dcdb0ca0939e88649e0c9ef6c4de2add2ddebbf5c5a25352a89f68d5a
MD5 2151caeabc0e7d13aef796a5a4d5979f
BLAKE2b-256 2e4816a23cff31df49c692a3178f56b299886439bacba8f1c1595b9de2f9d35e

See more details on using hashes here.

Provenance

The following attestation bundles were made for bgpt-0.1.1.tar.gz:

Publisher: pypi-publish.yml on jorado/bgpt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bgpt-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: bgpt-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for bgpt-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 00b8919afd5ed3770cd1ba44e63d02c937b04e7e0a93181e766b79ab3c41bcd9
MD5 45e17f7d40350c176bf3f229d62f5646
BLAKE2b-256 8363f15cf0d55c916522d0f7cabc64c5e4bdae5510ed82a72b478ffdecf00a51

See more details on using hashes here.

Provenance

The following attestation bundles were made for bgpt-0.1.1-py3-none-any.whl:

Publisher: pypi-publish.yml on jorado/bgpt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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