# GPT Commander
A simple command-line utility to interact with OpenAI's API and retrieve shell suggestions.
## Prerequisites
1. **Python 3**
2. **An OpenAI API Key**
## Install
```bash
pip install gptcommander
```
## Usage
By default, the system and user messages are set as:
- System: "You are a Linux based OS system administrator. Answer as briefly as possible."
- User: "Answer only with command without any background explanation and clarification. Provide the most comprehensive and accurate solution."
You can use the utility without specifying these defaults:
```bash
gpt "Your query here"
```
However, if you wish to customize the system or user messages:
```bash
gpt "Your query here" --system "Your custom system message" --user "Your custom user prefix"
```
Example:
```bash
gpt "How do I check disk space?" -s "You are a helpful assistant." -u "Tell me:"
```
## Configuration
On the first run, gptcommander will create a configuration file named `.openai_config` in your home directory. This file will store the OpenAI API key and model to facilitate future interactions without the need to repeatedly input those details.
It's recommended to check the file's permissions and ensure it's protected, as it contains sensitive information. Always be careful about where and how you store your API keys.
## Output Safety
To ensure that the output from gptcommander doesn't inadvertently get executed as part of a piped command or in any scripting environment, the returned shell command suggestions are quoted using the shlex.quote function. This guarantees that special characters in the output are safely escaped, making it suitable for direct use in a shell or scripting context without unintentional code execution.
If you like to live dangerously and you're chaining the output of gptcommander into another command or a script, make sure to appropriately parse or unquote the output based on your specific use case.
## License
[MIT](https://choosealicense.com/licenses/mit/)
Raw data
{
"_id": null,
"home_page": "https://github.com/michaelknap/gptcommander",
"name": "gptcommander",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "",
"keywords": "",
"author": "Michael Knap",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/58/9f/8bb09b6ad19eebb7404e48219a1f24de3ba8a225a8af91b35baed1112f98/gptcommander-0.0.1.tar.gz",
"platform": null,
"description": "# GPT Commander\n\nA simple command-line utility to interact with OpenAI's API and retrieve shell suggestions.\n\n## Prerequisites\n\n1. **Python 3**\n2. **An OpenAI API Key**\n\n## Install\n\n```bash\npip install gptcommander\n```\n\n## Usage\n\nBy default, the system and user messages are set as:\n- System: \"You are a Linux based OS system administrator. Answer as briefly as possible.\"\n- User: \"Answer only with command without any background explanation and clarification. Provide the most comprehensive and accurate solution.\"\n\nYou can use the utility without specifying these defaults:\n\n```bash\ngpt \"Your query here\"\n```\n\nHowever, if you wish to customize the system or user messages:\n\n```bash\ngpt \"Your query here\" --system \"Your custom system message\" --user \"Your custom user prefix\"\n```\n\nExample:\n\n```bash\ngpt \"How do I check disk space?\" -s \"You are a helpful assistant.\" -u \"Tell me:\"\n```\n## Configuration\n\nOn the first run, gptcommander will create a configuration file named `.openai_config` in your home directory. This file will store the OpenAI API key and model to facilitate future interactions without the need to repeatedly input those details.\n\nIt's recommended to check the file's permissions and ensure it's protected, as it contains sensitive information. Always be careful about where and how you store your API keys.\n\n## Output Safety\n\nTo ensure that the output from gptcommander doesn't inadvertently get executed as part of a piped command or in any scripting environment, the returned shell command suggestions are quoted using the shlex.quote function. This guarantees that special characters in the output are safely escaped, making it suitable for direct use in a shell or scripting context without unintentional code execution.\n\nIf you like to live dangerously and you're chaining the output of gptcommander into another command or a script, make sure to appropriately parse or unquote the output based on your specific use case.\n\n## License\n\n[MIT](https://choosealicense.com/licenses/mit/)\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A CLI utility for interacting with OpenAI GPT.",
"version": "0.0.1",
"project_urls": {
"Homepage": "https://github.com/michaelknap/gptcommander"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "657ee13f02c9da4130df65431b4603379c405a5efbbba8a148a1fda96e7d1acf",
"md5": "b95a283cdb5d3c4c807e691295cbae8b",
"sha256": "c1aeb200a88c36402402bf9deb04775655a7c80dbc1a222b72ef37ab8a6af19f"
},
"downloads": -1,
"filename": "gptcommander-0.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b95a283cdb5d3c4c807e691295cbae8b",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 5027,
"upload_time": "2023-09-19T12:54:52",
"upload_time_iso_8601": "2023-09-19T12:54:52.968823Z",
"url": "https://files.pythonhosted.org/packages/65/7e/e13f02c9da4130df65431b4603379c405a5efbbba8a148a1fda96e7d1acf/gptcommander-0.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "589f8bb09b6ad19eebb7404e48219a1f24de3ba8a225a8af91b35baed1112f98",
"md5": "073ca2bd612c8271335b29cdeb481a57",
"sha256": "25d2e3928e6e51b1a64f2cebc19765613260ca975455da0722ceae67cf63c825"
},
"downloads": -1,
"filename": "gptcommander-0.0.1.tar.gz",
"has_sig": false,
"md5_digest": "073ca2bd612c8271335b29cdeb481a57",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 4508,
"upload_time": "2023-09-19T12:54:54",
"upload_time_iso_8601": "2023-09-19T12:54:54.337629Z",
"url": "https://files.pythonhosted.org/packages/58/9f/8bb09b6ad19eebb7404e48219a1f24de3ba8a225a8af91b35baed1112f98/gptcommander-0.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-09-19 12:54:54",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "michaelknap",
"github_project": "gptcommander",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "gptcommander"
}