{"id":15148931,"url":"https://github.com/egomobile/e-gpt","last_synced_at":"2025-09-29T18:31:28.777Z","repository":{"id":182095752,"uuid":"667947225","full_name":"egomobile/e-gpt","owner":"egomobile","description":"Command line tool that interacts with ChatGPT without additional software and an embedded UI.","archived":true,"fork":false,"pushed_at":"2023-09-14T11:02:29.000Z","size":10932,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-11-13T13:54:23.597Z","etag":null,"topics":["bash","chat-ui","chatgpt","cheat-sheet","cli","cmd","freebsd","golang-cli","gpt-3","linux","macos","openai","openbsd","powershell","productivity","shell","terminal","unix","windows","zsh"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/egomobile.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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-07-18T16:55:52.000Z","updated_at":"2024-05-22T17:48:16.000Z","dependencies_parsed_at":"2024-09-21T20:31:52.083Z","dependency_job_id":"fd419f34-d95c-40a6-9d43-c9aa3ef8f419","html_url":"https://github.com/egomobile/e-gpt","commit_stats":null,"previous_names":["egomobile/e-gpt"],"tags_count":38,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/egomobile%2Fe-gpt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/egomobile%2Fe-gpt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/egomobile%2Fe-gpt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/egomobile%2Fe-gpt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/egomobile","download_url":"https://codeload.github.com/egomobile/e-gpt/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234650361,"owners_count":18866193,"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","chat-ui","chatgpt","cheat-sheet","cli","cmd","freebsd","golang-cli","gpt-3","linux","macos","openai","openbsd","powershell","productivity","shell","terminal","unix","windows","zsh"],"created_at":"2024-09-26T13:40:31.946Z","updated_at":"2025-09-29T18:31:27.953Z","avatar_url":"https://github.com/egomobile.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Current version](https://img.shields.io/github/v/release/egomobile/e-gpt)](https://github.com/egomobile/e-gpt/releases)\n[![Latest build](https://img.shields.io/github/actions/workflow/status/egomobile/e-gpt/release.yaml)](https://github.com/egomobile/e-gpt/actions/workflows/release.yaml)\n[![Issues](https://img.shields.io/github/issues/egomobile/e-gpt?color=8A2BE2)](https://github.com/egomobile/e-gpt/issues)\n[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-darkgreen?color=pink)](https://github.com/egomobile/e-gpt/pulls)\n[![License](https://img.shields.io/github/license/egomobile/e-gpt)](./LICENSE)\n\n# e.GPT\n\n\u003e e.GPT is a command-line tool that interacts with the [ChatGPT API](https://platform.openai.com/docs/guides/gpt) directly or indirectly, without the need for an environment like [Node.js](https://nodejs.org/) or [Python](https://www.python.org/) to be installed.\n\n![Demo 1](./assets/egpt-demo1.gif)\n\n\u003ca name=\"toc\"\u003e\u003c/a\u003e\n\n## Table of contents\n\n- [Install](#install-)\n- [Execute](#execute-)\n- [Commands](#commands-)\n  - [ask - Chat with the bot](#ask-)\n  - [code - Convert human language to source code](#code-)\n  - [describe - Describe a shell command](#describe-)\n  - [environment - Show or edit environment settings](#environment-)\n  - [explain - Explain source code](#explain-)\n  - [fix - Fix text issues](#fix-)\n  - [optimize - Optimizes source code](#optimize-)\n  - [shell - Create shell command from human language](#shell-)\n  - [sql - Execute SQL from human language](#sql-)\n  - [summarize - Creates a short version of a long text](#summarize-)\n  - [translate - Translates a text](#translate-)\n  - [ui - Run local UI](#ui-)\n- [Inputs](#inputs-)\n- [Environment Variables](#environment-variables-)\n- [Examples](#examples-)\n- [Custom System Prompts](#custom-system-prompts-)\n- [Credits](#credits-)\n\n## Install [\u003ca href=\"#toc\"\u003e↑\u003c/a\u003e]\n\ne.GPT is available as a single binary which can be downloaded from [here](https://github.com/egomobile/e-gpt/releases).\n\nAfter downloading, you should extract and move it to a location that can be accessed from anywhere and is part of your `PATH` environment variable.\n\nYou can set up your system's environment variables or create an `.env` file inside the subfolder `.egpt`, which itself is inside the `$HOME` directory of the current user.\n\nThere are three ways to set up environment variables for the tool:\n\n1. The most common way is to set up the `OPENAI_API_KEY` environment variable, which should contain the [API key from OpenAI](https://help.openai.com/en/articles/4936850-where-do-i-find-my-secret-api-key). This will enable the CLI to connect to the [official API](https://platform.openai.com/docs/guides/gpt).\n2. Another way is to set up `CHAT_API_KEY`, which will connect to a simplified and more generic version of a chat REST API. This also requires `CHAT_API_CLIENT_ID` and `CHAT_API_URL` to be defined.\n3. Similar to way 2, you can set up `CHAT_API_CLIENT_ID`, `CHAT_API_CLIENT_SECRET`, `CHAT_API_URL`, and `OAUTH2_GET_TOKEN_URL` if you wish to use [OAuth 2](https://oauth.net/2/) instead.\n\n## Execute [\u003ca href=\"#toc\"\u003e↑\u003c/a\u003e]\n\n```bash\negpt ask \"How much is a PS5?\" --system=\"You are an Xbox customer support agent whose primary goal is to help users with issues they are experiencing with their Xbox devices. You are friendly and concise. You only provide factual answers to queries, and do not provide answers that are not related to Xbox.\"\n```\n\nRun `egpt help` to see all available commands and options.\n\nIf you want to run this code locally, make sure that the [bash script egpt](./egpt) is executable so that you can run it the same way.\n\n## Commands [\u003ca href=\"#toc\"\u003e↑\u003c/a\u003e]\n\n### ask [\u003ca href=\"#commands-\"\u003e↑\u003c/a\u003e]\n\n\u003e Sends a single conversation to a chat API, such as ChatGPT, depending on your environment variables.\n\n```bash\negpt ask \"Who is Bill Gates?\"\n```\n\nPossible response:\n\n\u003e Bill Gates is an American entrepreneur, software developer, investor, and philanthropist. He co-founded Microsoft Corporation in 1975 with Paul Allen and helped to revolutionize the personal computer industry with the development of the Windows operating system. As of 2021, he is considered one of the wealthiest people in the world, with a net worth of over $100 billion. In recent years, he has devoted much of his time and resources to philanthropic endeavors, primarily through the Bill and Melinda Gates Foundation, which works to improve global healthcare and reduce poverty.\n\nYou can use `--system` to set up a custom system prompt.\n\n### code [\u003ca href=\"#commands-\"\u003e↑\u003c/a\u003e]\n\n\u003e Generates code from human language.\n\n```bash\negpt code \"i need a Fibonacci function in go\"\n```\n\nPossible response:\n\n```go\n// Define the Fibonacci function\nfunc fibonacci(n int) int {\n    if n == 0 {\n        return 0\n    } else if n == 1 {\n        return 1\n    } else {\n        return fibonacci(n-1) + fibonacci(n-2)\n    }\n}\n\n// Call the Fibonacci function with an input of 10\nfmt.Println(fibonacci(10)) // Output: 55\n```\n\n### describe [\u003ca href=\"#commands-\"\u003e↑\u003c/a\u003e]\n\n\u003e Handles a user input as a shell command and attempts to provide a description of it.\n\n```bash\negpt describe \"curl -s https://api.github.com/repos/egomobile/e-gpt/releases/latest | jq -r '.assets[].browser_download_url | select(contains(\"darwin\") and contains(\"arm64\") and (. | tostring | contains(\"sha256\") | not))' | xargs curl -sL | tar xzOf - egpt | sudo tee /usr/local/bin/egpt \u003e /dev/null \u0026\u0026 sudo chmod +x /usr/local/bin/egpt\"\n```\n\nPossible response:\n\n```\nThis command downloads the latest release of the \"egpt\" tool from the \"egomobile/e-gpt\" GitHub repository for macOS devices with ARM64 architecture, extracts the binary from the downloaded archive, and saves it as an executable file in the \"/usr/local/bin\" directory.\n```\n\n### environment [\u003ca href=\"#commands-\"\u003e↑\u003c/a\u003e]\n\n\u003e Outputs or modifies the application's own files, such as `.env` or `.system`.\n\n```bash\negpt environment -e\n```\n\nThis will open the `.env` file in the editor and ensure that the `${HOME}/.egpt` folder exists.\n\nYou can also open `${HOME}/.egpt/.system`, which contains optional and custom system prompts for the [ask command](#ask-):\n\n```bash\negpt environment -e --system\n```\n\n### explain [\u003ca href=\"#commands-\"\u003e↑\u003c/a\u003e]\n\n\u003e Explains source code.\n\nIf, for example, you have this [BASIC spaghetti code](https://www.geeksforgeeks.org/spaghetti-code/) in a `spaghetti.bas` file:\n\n```basic\ni=0\ni=i+1\nPRINT i; \"squared=\";i*i\nIF i\u003e=100 THEN GOTO 6\nGOTO 2\nPRINT \"Program Completed.\"\nEND\n```\n\nYou can execute\n\n```bash\negpt explain \u003c ./spagetti.bas --language=\"basic\"\n```\n\nand may get an output like this:\n\n```\nThis is a simple program that calculates the square of numbers from 1 to 100 and prints them to the console.\n\nThe program starts by initializing a variable `i` with the value 0. It then enters a loop that increments `i` by 1, calculates the square of `i`, and prints the result to the console in the format \"i squared= result\".\n\nThe loop continues until `i` is greater than or equal to 100, at which point the program skips to line 6 and continues executing. If `i` is less than 100, the program jumps back to line 2 and continues the loop.\n\nOnce the loop completes, the program prints \"Program Completed.\" to the console and exits.\n```\n\n### fix [\u003ca href=\"#commands-\"\u003e↑\u003c/a\u003e]\n\n\u003e Checks a text for grammar issues and typos, and returns a corrected version of it.\n\n```bash\negpt fix \"Thiz iz a simpl program that calculats the sqaure of numbrs form 1 to 1000 and printz them to the consule.\"\n```\n\nPossible response:\n\n```\nThis is a simple program that calculates the square of numbers from 1 to 1000 and prints them to the console.\n```\n\n### optimize [\u003ca href=\"#commands-\"\u003e↑\u003c/a\u003e]\n\n\u003e Optimizes source code.\n\nIf you for example have this [BASIC spagetti code](https://www.geeksforgeeks.org/spaghetti-code/) in a `spagetti.bas` file:\n\n```basic\ni=0\ni=i+1\nPRINT i; \"squared=\";i*i\nIF i\u003e=100 THEN GOTO 6\nGOTO 2\nPRINT \"Program Completed.\"\nEND\n```\n\nYou can execute\n\n```bash\negpt optimize \u003c ./spagetti.bas\n```\n\nand may get an output like this:\n\n```basic\ni=0\nWHILE i\u003c100\n    i=i+1\n    PRINT i; \"squared=\";i*i\nEND WHILE\nPRINT \"Program Completed.\"\n```\n\n### shell [\u003ca href=\"#commands-\"\u003e↑\u003c/a\u003e]\n\n\u003e Converts human language into a shell command.\n\nLet's say you execute\n\n```bash\negpt shell -e\n```\n\nand submit the following text from your editor to `egpt`:\n\n```\nConsider the following bash script:\n\n1. Use curl to download the list of github releases from https://api.github.com/repos/egomobile/e-gpt/releases/latest, which is piped to\n2. jq that finds the first matching \"browser_download_url\" sub-property of \"assets\" property with \"darwin\" and \"arm64\" substrings, which is piped to\n3. and written to a variable.\n4. This variable is used as the download URL for a new curl instance that downloads the underlying .tar.gz file, which is then piped to\n5. tar, which extracts the single \"egpt\" file and pipes this extracted file as content\n6. so that it is saved to /usr/local/bin folder.\n7. Finally, make the file executable.\n```\n\nA possible output in a `zsh` shell could be:\n\n```\ncurl -s https://api.github.com/repos/egomobile/e-gpt/releases/latest | jq -r '.assets[].browser_download_url | select(contains(\"darwin\") and contains(\"arm64\") and (. | tostring | contains(\"sha256\") | not))' | xargs curl -sL | tar xzOf - egpt | sudo tee /usr/local/bin/egpt \u003e /dev/null \u0026\u0026 sudo chmod +x /usr/local/bin/egpt\n[E]xecute, [a]bort \u003e\n```\n\nKeep in mind that `E` is the default selection and will execute the given command.\n\n### sql [\u003ca href=\"#commands-\"\u003e↑\u003c/a\u003e]\n\n\u003e Executes SQL from human language.\n\n```bash\negpt sql --csv \"list all customers with last name Musk and select only name and address columns\"\n```\n\nPossible response:\n\n```\nThe following statements will be executed:\n- SELECT first_name, last_name, company_name, email_address, phone_number, street, city, post_code, country FROM public.customers WHERE lower(last_name) = 'musk'\n\n[E]xecute, [a]bort\n```\n\nKeep in mind that `E` is the default selection and will execute the given command.\n\nTo set up the database connection, you can:\n\n- Use the `connection` CLI flag with a connection string.\n- Set up the `DATABASE_URL` environment variable with a connection string.\n\nCurrently, the following are supported:\n\n- [PostgreSQL](https://github.com/lib/pq)\n\n### summarize [\u003ca href=\"#commands-\"\u003e↑\u003c/a\u003e]\n\n\u003e Summarizes a long text.\n\n```bash\negpt summarize --max-length=10000 --language=chinese \u003c ./long-article.txt\n```\n\nPossible response:\n\n```\n该文章批评了红帽公司在IBM收购后的做法，认为其背离了开源社区的原则，变得像一家普通的软件公司。文章指出，红帽公司最近的一系列举动，如解雇了开源社区网站的团队和收回了RHEL的代码，都是对开源社区的背叛。作者认为，像Rocky Linux和AlmaLinux这样的替代品是很重要的，因为很多企业需要一种免费的RHEL克隆版，而不想支付高昂的费用。文章认为，这种做法是对开源社区的不尊重，而且与其先前的言论相矛盾。\n```\n\n### translate [\u003ca href=\"#commands-\"\u003e↑\u003c/a\u003e]\n\n\u003e Translates a text.\n\n```bash\negpt translate --language=german \u003c ./chinese-article.txt\n```\n\nPossible response:\n\n```\nDer Text kritisiert das Verhalten von Red Hat nach der Übernahme durch IBM und wirft dem Unternehmen vor, sich von den Prinzipien der Open-Source-Community abzuwenden und zu einem gewöhnlichen Software-Unternehmen zu werden. Der Autor weist darauf hin, dass die jüngsten Maßnahmen von Red Hat, wie die Entlassung des Teams der Open-Source-Community-Website und die Rücknahme des RHEL-Codes, Verrat an der Open-Source-Community sind. Der Autor hält Alternativen wie Rocky Linux und AlmaLinux für wichtig, da viele Unternehmen eine kostenlose RHEL-Klon-Version benötigen, ohne hohe Kosten zu zahlen. Der Autor betrachtet dieses Verhalten als respektlos gegenüber der Open-Source-Community und widersprüchlich zu früheren Äußerungen von Red Hat.\n```\n\n### ui [\u003ca href=\"#ui-\"\u003e↑\u003c/a\u003e]\n\n\u003e Runs and serves a local web user interface.\n\n```bash\negpt ui\n```\n\n## Inputs [\u003ca href=\"#toc\"\u003e↑\u003c/a\u003e]\n\nYou have the following sources for input data:\n\n1. One or more non-flag command line arguments. All will be concatenated and separated by space to one string.\n   - Example: `egpt ask who is bill gates`\n2. The standard editor:\n   - Example: `egpt ask summarize the following text --editor`\n3. The [STDIN](https://en.wikipedia.org/wiki/Standard_streams):\n   - Example #1: `egpt ask \"please summarize\" \u003c ./long-text.txt`\n   - Example #2: `curl -sSL \"https://raw.githubusercontent.com/egomobile/e-gpt/main/LICENSE\" | ./egpt ask summarize the following text`\n\nYou can combine all kinds of inputs. All texts will be concatenated in the given order and separated by space to one string.\n\nKeep in mind: The final prompt will be trimmed (start + end).\n\n## Environment Variables [\u003ca href=\"#toc\"\u003e↑\u003c/a\u003e]\n\n| Name                      | Description                                                                                                                                     | Default value                            | Example                                                               |\n| ------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------- | --------------------------------------------------------------------- |\n| `CHAT_API_CLIENT_ID`      | Set up to use a proxy API.                                                                                                                      |                                          | `a816037f-cb72-4f67-8855-71be067637fc`                                |\n| `CHAT_API_CLIENT_SECRET`  | Set if using a proxy API via [OAuth 2](https://oauth.net/2/). Requires `OAUTH2_GET_TOKEN_URL` to be set.                                        |                                          | `a816037f-cb72-4f67-8855-71be067637fc`                                |\n| `CHAT_API_KEY`            | Set if using a proxy API with API key, submitted via `x-api-key` header.                                                                        |                                          | `ZIREUIcc`                                                            |\n| `CHAT_API_TEMPERATURE`    | Set default [sampling temperature](https://platform.openai.com/docs/api-reference/chat/create#chat/create-temperature) to use, between 0 and 2. | `0.7`                                    | `0.5`                                                                 |\n| `CHAT_API_URL`            | Sets up the base URL for a proxy API usage.                                                                                                     |                                          | `https://api.example.com/v1/chat/completions`                         |\n| `CHAT_ANSWER_NO_NEW_LINE` | Adds no new line at the end of each chat message automatically.                                                                                 | `false`                                  | `true`                                                                |\n| `DATABASE_URL`            | Required for [sql command](#sql-) execution.                                                                                                    |                                          | `postgres://pqgotest:password@localhost/pqgotest?sslmode=verify-full` |\n| `EGO_EDITOR`              | The custom text editor to use.                                                                                                                  | Windows: `notepad.exe`, Linux/Unix: `vi` | `nano`                                                                |\n| `OAUTH2_GET_TOKEN_URL`    | Base URL for [get OAuth 2 access token](https://oauth.net/2/access-tokens/).                                                                    |                                          | `https://api.example.com/auth/v1/oauth2/token`                        |\n| `OPENAI_API_KEY`          | Set up [the API key](https://help.openai.com/en/articles/4936850-where-do-i-find-my-secret-api-key) to use [OpenAI API]().                      |                                          |                                                                       |\n\n## Examples [\u003ca href=\"#toc\"\u003e↑\u003c/a\u003e]\n\nA list of useful examples can be found [here](./examples/README.md).\n\n## Custom System Prompts [\u003ca href=\"#toc\"\u003e↑\u003c/a\u003e]\n\nIn the `${HOME}/.egpt` folder, you can create or edit a `.system` file to customize the system prompt.\n\nIf the file contains data and exists, it will be used as the default for the [ask command](#ask-) if the `--system` flag is not defined.\n\nTo edit the file, execute the following command in your terminal:\n\n```bash\n./egpt env -s -e\n```\n\nKeep in mind that additional prompt information, such as time and timezone, will be added automatically. Use the `--no-sys-info` and/or `--no-time` CLI flags to prevent this.\n\nTo reset the prompt to the default, delete the file or fill it with whitespace only (make it \"empty\").\n\n## Credits [\u003ca href=\"#toc\"\u003e↑\u003c/a\u003e]\n\nThe module makes use of:\n\n- [Chatbot UI](https://github.com/mckaywrigley/chatbot-ui)\n- [Chroma](https://github.com/alecthomas/chroma)\n- [Cobra](https://github.com/spf13/cobra)\n- [go-pretty](https://github.com/jedib0t/go-pretty)\n- [GoDotEnv](https://github.com/joho/godotenv)\n- [PostgreSQL driver](https://github.com/lib/pq)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fegomobile%2Fe-gpt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fegomobile%2Fe-gpt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fegomobile%2Fe-gpt/lists"}