{"id":15042446,"url":"https://github.com/rigwild/shell-gpt-rs","last_synced_at":"2025-04-14T20:46:15.476Z","repository":{"id":153256520,"uuid":"625690642","full_name":"rigwild/shell-gpt-rs","owner":"rigwild","description":"Ask ChatGPT for a shell script, code, or anything, directly from your terminal 🤖🧠👨‍💻","archived":false,"fork":false,"pushed_at":"2023-08-15T14:18:30.000Z","size":518,"stargazers_count":14,"open_issues_count":0,"forks_count":5,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-28T09:03:43.077Z","etag":null,"topics":["bash","bash-script","chatgpt","chatgpt-api","openai"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rigwild.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-04-09T22:02:11.000Z","updated_at":"2024-10-18T06:13:44.000Z","dependencies_parsed_at":"2023-05-27T12:15:07.784Z","dependency_job_id":null,"html_url":"https://github.com/rigwild/shell-gpt-rs","commit_stats":{"total_commits":14,"total_committers":3,"mean_commits":4.666666666666667,"dds":0.2857142857142857,"last_synced_commit":"b5cec36dbef7e6b1e3073231147652080227ac40"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rigwild%2Fshell-gpt-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rigwild%2Fshell-gpt-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rigwild%2Fshell-gpt-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rigwild%2Fshell-gpt-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rigwild","download_url":"https://codeload.github.com/rigwild/shell-gpt-rs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248960730,"owners_count":21189987,"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":["bash","bash-script","chatgpt","chatgpt-api","openai"],"created_at":"2024-09-24T20:47:19.746Z","updated_at":"2025-04-14T20:46:15.458Z","avatar_url":"https://github.com/rigwild.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\t\u003cbr\u003e\n\t\u003cbr\u003e\n\t\u003ch1\u003eShellGPT\u003c/h1\u003e\n\t\u003cbr\u003e\n\nAsk ChatGPT for a shell script, code, or anything, directly from your terminal 🤖🧠👨‍💻\n\n[![Cargo Build and Test](https://github.com/rigwild/shell-gpt-rs/actions/workflows/cargo.yml/badge.svg)](https://github.com/rigwild/shell-gpt-rs/actions/workflows/cargo.yml)\n[![Downloads](https://img.shields.io/crates/v/shell-gpt)](https://crates.io/crates/shell-gpt)\n[![Downloads](https://img.shields.io/crates/d/shell-gpt)](https://crates.io/crates/shell-gpt)\n\n\u003c/div\u003e\n\n## Demo\n\n![Demo video](./demo.gif)\n\n## Install\n\nThe binary is named `gpt` when installed, not `shell-gpt`.\n\n### Cargo\n\n```bash\ncargo install shell-gpt\ngpt --help\n```\n\n### From source\n\n```bash\ngit clone git@github.com:rigwild/shell-gpt-rs.git\ncd shell-gpt-rs\ncargo install --path .\n```\n\n## Usage\n\nOn first usage, ShellGPT will prompt you to enter your [OpenAI API key](https://platform.openai.com/account/api-keys).\n\nThis key will then be saved to `~/.config/shell-gpt-rs`, encrypted with `ChaCha20-Poly1305`, to be reused later.\n\n### Any question\n\nAsk any question to ChatGPT.\n\n```bash\ngpt \u003cany question\u003e\n```\n\n### `--script`\n\nAsk ChatGPT to create a script, then run it if you want to. A [pre-prompt](./src/openai.rs#L9) will be included with your request.\n\n```bash\ngpt --shell show me the 10 biggest files in the current tree\nAsking ChatGPT...\n\n#!/bin/bash\ndu -ah | sort -rh | head -n 10\n\nDo you want to run this script? (y/N) y\n\nExecuting script...\n\n--------------\n\n\n4.1G    ./target\n4.1G    .\n3.5G    ./target/debug\n2.9G    ./target/debug/deps\n588M    ./target/release\n488M    ./target/release/deps\n387M    ./target/debug/build\n241M    ./target/debug/incremental\n98M     ./target/release/build\n86M     ./target/debug/deps/gpt-54b56efa1b0d0573\n```\n\n### `--raw`\n\nAsk ChatGPT to create a script, but do not show a loading spinner or interactive prompt, does not run the script.\n\nThis can be used to pipe the script to another command.\n\n```bash\ngpt --shell --raw show me the 10 biggest files in the current tree\ndu -ah | sort -rh | head -n 10\n```\n\n### `--clear-config`\n\nRemove local config, including the OpenAI API key at `~/.config/shell-gpt-rs`.\n\n```bash\ngpt --clear-config\n```\n\n### Help message\n\n```bash\ngpt --help\n```\n\n```\nAsk ChatGPT for a shell script, code, or anything, directly from your terminal 🤖🧠👨‍💻\n\nUsage: gpt \u003cyour_question\u003e\n\nOptions:\n  -s  --shell           Ask ChatGPT for a shell script                                                  [boolean=false]\n      --raw             Only output the script, no spinner or interactive prompt                        [boolean=false]\n      --clear-config    Remove local config, including the OpenAI API key at `~/.config/shell-gpt-rs`   [boolean]\n  -h, --help            Show help                                                                       [boolean]\n\nExamples:\n  gpt is the earth flat?\n  gpt --shell show the list of files in the current directory with human-readable file size\n  gpt -s find the top 10 biggest files in the current directory\n  gpt -s find the top 10 biggest files in the current tree recursive\n  gpt --raw --shell find the top 10 biggest files in the current tree recursive\n  gpt --raw --shell find the top 10 biggest files in the current tree recursive \u003e 10_biggest_files.sh\n  gpt --raw tell me a good joke | curl -X POST -d @- https://example.com/api/jokes\n\nshell-gpt-rs - https://github.com/rigwild/shell-gpt-rs\n```\n\n## Examples\n\n```bash\ngpt How to install a package in Arch Linux?\ngpt How to create a Rust crate?\ngpt --shell show the list of files in the current directory with human-readable file size\ngpt -s find the top 10 biggest files in the current tree recursive\n\n# Save the script to a file\ngpt --raw --shell find the top 10 biggest files in the current tree recursive \u003e 10_biggest_files.sh\n\n# Generate a joke then post it with curl\ngpt --raw tell me a good joke | curl -X POST -d @- https://example.com/api/jokes\n```\n\n## License\n\nThe MIT license\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frigwild%2Fshell-gpt-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frigwild%2Fshell-gpt-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frigwild%2Fshell-gpt-rs/lists"}