{"id":20315215,"url":"https://github.com/sysread/bash-gpt","last_synced_at":"2025-04-11T17:25:20.518Z","repository":{"id":194859320,"uuid":"691734409","full_name":"sysread/bash-gpt","owner":"sysread","description":"Shell utilities to talk to the OpenAI API","archived":false,"fork":false,"pushed_at":"2024-11-01T19:46:34.000Z","size":166,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-10T09:19:43.194Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sysread.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-09-14T19:21:23.000Z","updated_at":"2024-12-10T14:05:46.000Z","dependencies_parsed_at":"2024-01-10T17:23:03.740Z","dependency_job_id":"6d25560f-4882-4ea7-9997-008e3e8f2188","html_url":"https://github.com/sysread/bash-gpt","commit_stats":null,"previous_names":["sysread/bash-gpt"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sysread%2Fbash-gpt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sysread%2Fbash-gpt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sysread%2Fbash-gpt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sysread%2Fbash-gpt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sysread","download_url":"https://codeload.github.com/sysread/bash-gpt/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248448622,"owners_count":21105334,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-14T18:18:20.099Z","updated_at":"2025-04-11T17:25:20.493Z","avatar_url":"https://github.com/sysread.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Command line GPT utils\n\n# Utilities provided\n\n## `openai`\n\nProvides direct access to OpenAI API endpoints for the assistants and threads\nAPIs.\n\n## `gpt`\n\nSends a prompt or series of prompts to the OpenAI discussions API and outputs\nthe response as it arrives. This uses the (now possibly legacy?) `chat` API\nendpoint.\n\n```bash\ngpt -s 'You are a helpful assistant' \\\n    -p 'Rewrite the second act of Much Ado About Nothing in modern English'\n```\n\n## `chat`\n\nProvides a command line interface to have conversational interactions similar\nto ChatGPT from the command line, with a searchable conversation history.\nSimply execute `chat` and follow the menu prompts to start a conversation.\n\n## `cmd`\n\nGenerates a command that can be directly executed in your `$SHELL`.\n\n```bash\ncmd 'list files in the current directory with time stamps'\n```\n\nIf you want commands you execute with `cmd` to be added to your shell's history,\nadd something like this to your `bashrc`:\n\n```bash\nalias cmd=\"source $(which cmd)\"\n```\n\n## `code`\n\nA little wrapper around `gpt` focused on producing code without texty\nexplanations.\n\n```bash\nstack_class=$(code -l python -p 'stack class')\nunit_test=$(code -l python -c \"$stack_class\" -p 'unit test for this class')\n```\n\n## `tester`\n\nRuns your unit tests. If they fail, sends the error messages and relevant file\ncontents to `gpt` to come up with suggested fixes. Then it will offer to rerun\nyour tests to verify the fix.\n\n## `utils`\n\nLibrary of small utility functions and aliases:\n\n  - `image \u003cprompt\u003e [\u003csize\u003e] \u003e image.png` - generate an image\n  - `re-image \u003csource-file\u003e \u003cprompt\u003e \u003e new-image.png` - modify an image\n\n# Dependencies\n\n- [`curl`](https://curl.se/)\n- [`jq`](https://github.com/jqlang/jq)\n- [`gum`](https://github.com/charmbracelet/gum)\n\n# Environment variables\n\n- `OPENAI_API_KEY` - your OpenAI API key (required; create one at https://platform.openai.com/account/api-keys)\n- `OPENAI_MODEL` - the [model](https://platform.openai.com/docs/models) to use; defaults to gpt-3.5-turbo-16k\n- `BASHGPT_CACHE_DIR` - `gpt` memoizes responses to prompts here; defaults to `$HOME/.bashgpt_cache`\n- `BASHGPT_CHAT_HOME` - `chat` stores its index of conversations here; defaults to `$HOME/.bashgpt/chat/chat-history`\n\n# Installation\n\n## Directly\n\n1. Ensure that `/usr/local/bin` is in your `PATH`\n2. Ensure that you have write permissions to `/usr/local/bin`\n3. Download to `/usr/local/bin`\n```bash\n\nfor tool in gpt chat code cmd tester; do\n  curl -sSL \"https://raw.githubusercontent.com/sysread/bash-gpt/main/$tool\" -o \"/usr/local/bin/$tool\" \\\n    \u0026\u0026 chmod +x \"/usr/local/bin/$tool\"\ndone\n```\n\n## From repo\n\n1. Check out repository:\n```bash\ngit clone https://github.com/sysread/bash-gpt\n```\n2. Add to your PATH\n```bash\nexport PATH=\"$PATH:/path/to/bash-gpt\"\n```\n\n## With [Nix](https://nixos.org/)\n_Want an easy way to install nix? Checkout the [Determinite Systems Installer](https://github.com/DeterminateSystems/nix-installer)_\n\n1. Check out repository:\n```bash\ngit clone https://github.com/sysread/bash-gpt\n```\n2. Add Env Vars to your shell environment\n- create a `.env` file with the following keys:\n```bash\nOPENAI_API_KEY=\"\"\nOPENAI_API_MODEL=\"gpt-3.5-turbo-16k\"\n```\n- `OPENAI_API_KEY` - your OpenAI API key (required; create one at https://platform.openai.com/account/api-keys)\n- `OPENAI_MODEL` - the [model](https://platform.openai.com/docs/models) to use; defaults to gpt-3.5-turbo-16k\n3. Run the nix shell\n```bash\nnix develop\n```\n\n\n## Utils\n\nTo use the utilities in `utils`, first download it:\n\n```bash\ncurl -sSL https://raw.githubusercontent.com/sysread/bash-gpt/main/utils -o /usr/local/lib/bash-gpt-utils\n```\n\nThen add it to your `.bashrc` or `.bash_profile`:\n```bash\necho 'source /usr/local/lib/bash-gpt-utils' \u003e\u003e ~/.bashrc\n```\n\n# Support and compatibility\n\nTested on macOS. Ought to work on linux as well. Please file a ticket if you\nfind an issue on mac or linux. Better yet, send me a pull request :)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsysread%2Fbash-gpt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsysread%2Fbash-gpt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsysread%2Fbash-gpt/lists"}