{"id":13479153,"url":"https://github.com/mattvr/ShellGPT","last_synced_at":"2025-03-27T09:30:53.147Z","repository":{"id":152786598,"uuid":"625289463","full_name":"mattvr/ShellGPT","owner":"mattvr","description":"Upgrade your terminal with GPT-4. Ask questions, automate commands, pipe I/O, etc. Made with Deno.","archived":false,"fork":false,"pushed_at":"2025-02-25T06:46:06.000Z","size":164,"stargazers_count":233,"open_issues_count":5,"forks_count":11,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-03-26T20:53:18.724Z","etag":null,"topics":["chatgpt","cli","deno","gpt-3","gpt-4","terminal"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/mattvr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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-04-08T16:45:43.000Z","updated_at":"2025-03-13T22:59:45.000Z","dependencies_parsed_at":null,"dependency_job_id":"4dc5764c-7369-453d-b8af-1541506ae478","html_url":"https://github.com/mattvr/ShellGPT","commit_stats":null,"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattvr%2FShellGPT","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattvr%2FShellGPT/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattvr%2FShellGPT/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattvr%2FShellGPT/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mattvr","download_url":"https://codeload.github.com/mattvr/ShellGPT/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245817359,"owners_count":20677276,"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":["chatgpt","cli","deno","gpt-3","gpt-4","terminal"],"created_at":"2024-07-31T16:02:10.468Z","updated_at":"2025-03-27T09:30:53.141Z","avatar_url":"https://github.com/mattvr.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# ShellGPT\n\n#### [[ \u003cimg src=\"https://github.com/mattvr/ShellGPT/assets/4052466/9ba871c8-451c-4178-9035-645142b617d9\" /\u003e Discord ]](https://orgsoft.org/discord)\n\nA command-line tool that allows you to interact with GPT-4 directly from your\nterminal, including long form conversations via chat\n\nhttps://github.com/mattvr/ShellGPT/assets/4052466/4a72a1b2-2d60-44ff-b491-8057146d71ae\n\n## Basic Usage\n\nTo use ShellGPT, simply run the command with your input message:\n\n```sh\ngpt \"What is the meaning of life, the universe, and everything?\"\n# ... often humorously said to be the number 42 ...\n```\n\nYou can also run shell commands with `-x`:\n\n```sh\ngpt -x \"Undo my last git commit\"\n# git reset HEAD~1\n# Are you SURE you wish to run the above command? (y/N): y\n\ngpt -x \"Download the wikipedia page for Capybaras with all images\"\n# wget -r -l 1 -H -t 1 -nd -N -np -A jpg,jpeg,gif,png -erobots=off https://en.wikipedia.org/wiki/Capybara\n```\n\nAnd pipe input and output, transforming files and commands (pass `-` to accept\nstdin):\n\n```sh\ncat mod.ts | gpt \"Generate a helpful README file for this project\" - \u003e README.md\n\ncat crash.log | gpt \"Why is this crash occurring?\" -\n\ngpt \"Output a CSV of 10 notable cities in Japan with their name in English \u0026 Japanese plus a fun fact enclosed in quotes\" \u003e japan.csv\n```\n\nChat with gpt from the terminal\n\n```sh\ngpt --repl\n\n\u003e hello there\nHello! How can I assist you today?\n\n\u003e\n```\n\n\n## Installation\n\n1. Install the\n   [Deno runtime](https://deno.land/manual/getting_started/installation).\n\n2. Run the following command to install ShellGPT:\n\n```sh\ndeno run -rA https://deno.land/x/shellgpt/install.ts\n```\n\n3. Ensure `$HOME/.deno/bin` is in your PATH.\n\n```sh\nexport PATH=\"$HOME/.deno/bin:$PATH\"\n```\n\nYou can now use `gpt [my request]` - or whatever you named the script during installation\n\nThat's it!\n\nNote: If you add that export line to your `.bashrc` or `.zshrc` (or equivalent), remember restarting your shell to get the updated `PATH`\n\n### Configuration\n\nYou must set the `OPENAI_API_KEY` environment variable in your current shell,\nusing a key obtained from https://platform.openai.com/account/api-keys:\n\n```sh\nexport OPENAI_API_KEY=...\n```\n\nYou can also set `OPENAI_CHAT_URL` if you'd like to target a different OpenAI-compatible API endpoint (e.g. Local Llama, Anthropic, etc.).\n\nTo configure the specific ChatGPT model, system prompt used, and more, you can type `gpt --config`\n\n## Commands and Arguments\n\n### Global Commands\n\nThese commands are used for general ShellGPT-wide operations.\n\n| Argument  | Alias | Description                           |\n| --------- | ----- | ------------------------------------- |\n| --help    |       | Show help                             |\n| --config  | --cfg | Configure the model and system prompt |\n| --update  |       | Update ShellGPT to the latest version |\n| --history | -h    | List all past conversations           |\n\n### Chat Commands\n\nThese commands are for specific chats, either new or existing.\n\n| Argument      | Alias      | Description                                          |\n| ------------- | ---------- | ---------------------------------------------------- |\n| -             |            | Read from stdin                                      |\n| --continue    | --cont, -c | Continue the last conversation                       |\n| --exec        | -x         | Run the output as a shell command                    |\n| --code        |            | Returns code as the response                         |\n| --name        | -n         | Name of chat from history to operate the command on  |\n| --desc        |            | Sort the history entries in descending order         |\n| --repl        |            | Enters a REPL mode with continuous chat              |\n| --retry       | -r         | Regenerate the last assistant message                |\n| --rewrite     | --rw, -w   | Rewrite the last user message \u0026 regenerate response  |\n| --print       | -p         | Print the last message in the conversation           |\n| --pop         |            | Remove the last message in the conversation          |\n| --slice       | -s         | Remove the first message in the conversation         |\n| --dump        | -d         | Dump the entire chat history                         |\n| --fast        | -f         | Use the GPT-3.5-turbo model                          |\n| --system      | --sys      | Set a system prompt or context                       |\n| --temperature | --temp, -t | Control the model's creativity                       |\n| --wpm         |            | Words per minute, control the speed of typing output |\n| --max_tokens  | --max      | Maximum number of tokens to generate                 |\n| --model       | -m         | Manually use a different OpenAI model                |\n| --debug       |            | Print OpenAI API information                         |\n| --lang        |            | Sets written or programming language of output       |\n| --dims        |            | Sets the dimensions of the embedding (--embed only)  |\n\n### Other Commands\n\nThese commands perform non-textual tasks.\n\n| Argument      | Alias      | Description                                          |\n| ------------- | ---------- | ---------------------------------------------------- |\n| --img         | -i         | Respond with a generated image URL instead of text   |\n| --embed       |            | Respond with a vector embedding of the input string  |\n\n## Features\n\nShell-GPT has some useful and unique features:\n\n- Execute shell commands with a confirmation step (just pass `-x`).\n- Supports input/output piping for simple file creation and transformation (see\n  [Basic Usage](#basic-usage)).\n- Utility commands for convenient chat history viewing and editing.\n- Smooth, streaming output, resembling human typing rather than delayed or\n  choppy responses.\n- Supports generating images, embeddings, and configurable languages.\n- Built in Deno for better performance, granular permissions, and easier script\n  modification.\n\n## Examples\n\nContinuing the conversation:\n\n```sh\ngpt \"Give me 5 examples of auto-antonyms\"\n# Sanction, Bolt, Peruse, Trim, Overlook\n\ngpt -c \"Give 5 more\"\n# Cleave, Dust, Weather, Consult, Off\n```\n\nRegenerating the last assistant message:\n\n```sh\ngpt \"Generate a tweet from the perspective of a cat\"\n# \"Just spent 5 hours napping and now I can't decide if I should eat, stare out the window, or nap some more. #CatLife 🐾😽💤\" ...\n\ngpt -r\n# Just knocked my hooman's coffee off the counter again... you'd think they'd learn by now nothing is safe at paw level 😹 #LivingLifeOnTheEdge #NineLives\n```\n\nViewing and resuming past conversation history:\n\n```sh\ngpt --history\n# shellgpt-demo-chat\n# cat-tweets\n# ...\n\ngpt --history --desc\n# ...\n# cat-tweets\n# shellgpt-demo-chat\n# ...\n\ngpt --name \"cat-tweets\" \"Generate more, please\"\n\ngpt --dump # Dumps latest entry in the history\n```\n\nViewing a specific history entry:\n\n```sh\ngpt --dump --name \"2024-04-11_09-52-56\"\n\n---\n\ntell me a joke\n\n---\n\nWhy couldn't the bicycle stand up by itself? Because it was two-tired!\n\n```\n\nSetting a system prompt and custom temperature:\n\n```sh\ngpt --temp 0.85 --max 250 --sys \"An AI personal trainer\" \"What exercises should I do for leg day?\"\n```\n\nIncreasing the speed of the output using GPT-3.5-turbo and custom WPM:\n\n```sh\ngpt --fast --wpm 1500 \"How can I improve my programming skills?\"\n```\n\nOutput an image:\n\n```sh\ngpt --img \"a corgi wearing cashmere pants hacking into myspace.com\"\n```\n\nOutput a vector embedding:\n```sh\ngpt --embed \"The quick brown fox jumped over the lazy dog.\" --dims=1024 --model=text-embedding-3-large\n```\n\nInteractive coding session:\n\n```sh\ngpt --code --repl \"Write a typescript function that prints the first 100 primes\"\n```\n\n## Development\n\nTo develop `gpt`, first clone the repo, make sure you have the Deno runtime installed (see [Installation instructions](#installation)), and then you can run the code with:\n\n```sh\ndeno run -A mod.ts\n```\n\nFor example, if you want to run an interactive chat session, you can do:\n\n```sh\ndeno run -A mod.ts --repl \"Write outline for ShellGPT's README.md file\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmattvr%2FShellGPT","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmattvr%2FShellGPT","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmattvr%2FShellGPT/lists"}