{"id":26817243,"url":"https://github.com/maclovin/gcmd","last_synced_at":"2025-07-24T01:40:02.032Z","repository":{"id":285009920,"uuid":"956782815","full_name":"maclovin/gcmd","owner":"maclovin","description":"Quick generation of terminal commands using ZSH with ChatGPT or Ollama","archived":false,"fork":false,"pushed_at":"2025-03-28T22:08:17.000Z","size":463,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-05T21:42:02.521Z","etag":null,"topics":["ai","cli","zsh"],"latest_commit_sha":null,"homepage":"","language":"Shell","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/maclovin.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-28T21:17:50.000Z","updated_at":"2025-05-01T00:54:32.000Z","dependencies_parsed_at":"2025-03-28T22:42:54.926Z","dependency_job_id":null,"html_url":"https://github.com/maclovin/gcmd","commit_stats":null,"previous_names":["maclovin/gcmd"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/maclovin/gcmd","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maclovin%2Fgcmd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maclovin%2Fgcmd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maclovin%2Fgcmd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maclovin%2Fgcmd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maclovin","download_url":"https://codeload.github.com/maclovin/gcmd/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maclovin%2Fgcmd/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266780459,"owners_count":23983044,"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","status":"online","status_checked_at":"2025-07-23T02:00:09.312Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["ai","cli","zsh"],"created_at":"2025-03-30T04:15:31.719Z","updated_at":"2025-07-24T01:40:02.000Z","avatar_url":"https://github.com/maclovin.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gcmd\nQuick generation of terminal commands using ZSH with ChatGPT and Ollama\n\n![Demo](https://raw.githubusercontent.com/maclovin/gcmd/refs/heads/main/demo.gif)\n\n\n## Overview\n\nWhen you type a request into your terminal and hit the shortcut (default: `Ctrl+X`), **gcmd** sends your prompt to a generative AI model. The AI figures out the exact command you need and returns it directly into your terminal, ready for execution.\n\n##  Features\n\n- Uses OpenAI GPT-4 by default (requires API key)\n- Supports local models via Ollama (no API key required)\n- Automatically evaluates embedded shell commands (like `$(cat file.txt)`)\n\n## Installation\n\n**Prerequisites:**\n\n- Zsh shell\n- `jq` and `curl` installed (`brew install jq curl`)\n\n**1. Clone the repo or download**:\n\n```sh\ngit clone \u003cyour-repo-url\u003e ~/.zsh/gcmd\n```\n\n**2. Source the script in your** `.zshrc`\n\n```sh\necho 'source ~/.zsh/gcmd/gcmd.zsh' \u003e\u003e ~/.zshrc\n```\n\n**3. Set your API key (for OpenAI)**\n\nAdd your OpenAI API key to your `.zshrc`:\n\n```sh\nexport OPENAI_API_KEY=\"your-key-here\"\n```\n\nOr use Ollama instead (optional):\n\n```sh\nexport USE_OLLAMA=1\nexport OLLAMA_MODEL=\"llama2\" # or your favorite local model\n```\n\n**4. Restart your terminal or reload your** `.zshrc`\n\n```sh\nsource ~/.zshrc\n```\n\n## Usage\n\nSimply type your request directly in your terminal, for example:\n\n```sh\nlist all the my s3 buckets with insecure policy allowing public access \n```\n\nThen hit `Ctrl+X` (or your customized key-binding), and **gcmd** will insert the command into your terminal prompt:\n\n```sh\naws s3api list-buckets --query 'Buckets[].Name' | xargs -I {} aws s3api get-bucket-acl --bucket {} | grep -B 1 -A 2 AllUsers\n```\n\n### Example using embedded shell command\n\nYou can use embedded shell commands, and GCMD will evaluate them first:\n\n```sh\nextract emails from $(cat contacts.txt)\n```\n\nHit your shortcut and that's it!\n\n## Customizing shortcut\n\nTo customize the default shortcut, add this to your `.zshrc` before sourcing the script:\n\n```sh\nexport GCMD_BIND='^G' # Ctrl+G\n```\n\n## Keep hacking\n\nWhile **gcmd** is a fantastic shortcut to speed things up, remember to not fully rely on GenAI. Building a solid understanding of commands and scripts is crucial. Curiosity and experimentation are what make a great hacker, **don’t let comfort kill the creativity!**\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaclovin%2Fgcmd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaclovin%2Fgcmd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaclovin%2Fgcmd/lists"}