{"id":13575996,"url":"https://github.com/Realiserad/fish-ai","last_synced_at":"2025-04-05T05:30:31.587Z","repository":{"id":215612322,"uuid":"739358043","full_name":"Realiserad/fish-ai","owner":"Realiserad","description":"Supercharge your command line with LLMs and get shell scripting assistance in Fish. 💪","archived":false,"fork":false,"pushed_at":"2025-04-03T04:19:00.000Z","size":447,"stargazers_count":227,"open_issues_count":0,"forks_count":16,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-03T05:23:40.897Z","etag":null,"topics":["fish-plugin","fisher"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"tom-doerr/codex.fish","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Realiserad.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":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-01-05T11:22:49.000Z","updated_at":"2025-04-03T04:19:04.000Z","dependencies_parsed_at":"2024-02-10T11:25:55.906Z","dependency_job_id":"054de279-4dae-4381-b461-1089d112ce8a","html_url":"https://github.com/Realiserad/fish-ai","commit_stats":{"total_commits":16,"total_committers":2,"mean_commits":8.0,"dds":0.0625,"last_synced_commit":"af603b1ee66db332cb9f0e6ac1ea520c6d3d411a"},"previous_names":["realiserad/codex.fish","realiserad/fish-ai"],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Realiserad%2Ffish-ai","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Realiserad%2Ffish-ai/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Realiserad%2Ffish-ai/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Realiserad%2Ffish-ai/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Realiserad","download_url":"https://codeload.github.com/Realiserad/fish-ai/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247294010,"owners_count":20915329,"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":["fish-plugin","fisher"],"created_at":"2024-08-01T15:01:06.133Z","updated_at":"2025-04-05T05:30:31.574Z","avatar_url":"https://github.com/Realiserad.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"![Badge with time spent](https://img.shields.io/endpoint?url=https%3A%2F%2Fgist.githubusercontent.com%2FRealiserad%2Fd3ec7fdeecc35aeeb315b4efba493326%2Fraw%2Ffish-ai-git-estimate.json)\n[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://github.com/Realiserad/fish-ai/codespaces)\n\n# About\n\n`fish-ai` adds AI functionality to [Fish](https://fishshell.com).\nIt's awesome! I built it to make my life easier, and I hope it will make\nyours easier too. Here is the complete sales pitch:\n\n- It can turn a comment into a shell command and vice versa, which means\nless time spent\nreading manpages, googling and copy-pasting from Stack Overflow. Great\nwhen working with `git`, `kubectl`, `curl` and other tools with loads\nof parameters and switches.\n- Did you make a typo? It can also fix a broken command (similarly to\n[`thefuck`](https://github.com/nvbn/thefuck)).\n- Not sure what to type next or just lazy? Let the LLM autocomplete\nyour commands with a built in fuzzy finder.\n- Everything is done using two keyboard shortcuts, no mouse needed!\n- It can be hooked up to the LLM of your choice (even a self-hosted one!).\n- Everything is open source, hopefully somewhat easy to read and\naround 2000 lines of code, which means that you can audit the code\nyourself in an afternoon.\n- Install and update with ease using [`fisher`](https://github.com/jorgebucaran/fisher).\n- Tested on both macOS and the most common Linux distributions.\n- Does not interfere with [`fzf.fish`](https://github.com/PatrickF1/fzf.fish),\n[`tide`](https://github.com/IlanCosman/tide) or any of the other plugins\nyou're already using!\n- Does not wrap your shell, install telemetry or force you to switch\nto a proprietary terminal emulator.\n\nThis plugin was originally based on [Tom Dörr's `fish.codex` repository](https://github.com/tom-doerr/codex.fish).\nWithout Tom, this repository would not exist!\n\nIf you like it, please add a ⭐. If you don't like it, create a PR. 😆\n\n## 🎥 Demo\n\n![Demo](https://github.com/user-attachments/assets/86b61223-e568-4152-9e5e-d572b2b1385b)\n\n## 👨‍🔧 How to install\n\n### Install `fish-ai`\n\nMake sure `git` and either [`uv`](https://github.com/astral-sh/uv), or\n[a supported version of Python](https://github.com/Realiserad/fish-ai/blob/main/.github/workflows/python-tests.yaml)\nalong with `pip` and `venv` is installed. Then grab the plugin using\n[`fisher`](https://github.com/jorgebucaran/fisher):\n\n```shell\nfisher install realiserad/fish-ai\n```\n\n### Create a configuration\n\nCreate a configuration file `~/.config/fish-ai.ini`.\n\nIf you use a self-hosted LLM (behind an OpenAI-compatible API):\n\n```ini\n[fish-ai]\nconfiguration = self-hosted\n\n[self-hosted]\nprovider = self-hosted\nserver = https://\u003cyour server\u003e:\u003cport\u003e/v1\nmodel = \u003cyour model\u003e\napi_key = \u003cyour API key\u003e\n```\n\nIf you are self-hosting, my recommendation is to use\n[Ollama](https://github.com/ollama/ollama) with\n[Llama 3.3 70B](https://ollama.com/library/llama3.3). An out of the box\nconfiguration  running on `localhost` could then look something\nlike this:\n\n```ini\n[fish-ai]\nconfiguration = local-llama\n\n[local-llama]\nprovider = self-hosted\nmodel = llama3.3\nserver = http://localhost:11434/v1\n```\n\nIf you use [OpenAI](https://platform.openai.com):\n\n```ini\n[fish-ai]\nconfiguration = openai\n\n[openai]\nprovider = openai\nmodel = gpt-4o\napi_key = \u003cyour API key\u003e\norganization = \u003cyour organization\u003e\n```\n\nIf you use [Azure OpenAI](https://azure.microsoft.com/en-us/products/ai-services/openai-service):\n\n```ini\n[fish-ai]\nconfiguration = azure\n\n[azure]\nprovider = azure\nserver = https://\u003cyour instance\u003e.openai.azure.com\nmodel = \u003cyour deployment name\u003e\napi_key = \u003cyour API key\u003e\n```\n\nIf you use [Hugging Face](https://huggingface.co):\n\n```ini\n[fish-ai]\nconfiguration = huggingface\n\n[huggingface]\nprovider = huggingface\nemail = \u003cyour email\u003e\napi_key = \u003cyour password\u003e\nmodel = meta-llama/Llama-3.3-70B-Instruct\n```\n\nAvailable models are listed [here](https://huggingface.co/chat/models).\nNote that 2FA must be disabled on the account.\n\nIf you use [Mistral](https://mistral.ai):\n\n```ini\n[fish-ai]\nconfiguration = mistral\n\n[mistral]\nprovider = mistral\napi_key = \u003cyour API key\u003e\n```\n\nIf you use [GitHub Models](https://github.com/marketplace/models):\n\n```ini\n[fish-ai]\nconfiguration = github\n\n[github]\nprovider = self-hosted\nserver = https://models.inference.ai.azure.com\napi_key = \u003cpaste GitHub PAT here\u003e\nmodel = gpt-4o-mini\n```\n\nYou can create a personal access token (PAT) [here](https://github.com/settings/tokens).\nThe PAT does not require any permissions.\n\nIf you use [Anthropic](https://www.anthropic.com):\n\n```ini\n[anthropic]\nprovider = anthropic\napi_key = \u003cyour API key\u003e\n```\n\nIf you use [Cohere](https://cohere.com):\n\n```ini\n[cohere]\nprovider = cohere\napi_key = \u003cyour API key\u003e\n```\n\nIf you use [DeepSeek](https://www.deepseek.com):\n\n```ini\n[deepseek]\nprovider = deepseek\napi_key = \u003cyour API key\u003e\nmodel = deepseek-chat\n```\n\nIf you use [Groq](https://groq.com):\n\n```ini\n[groq]\nprovider = groq\napi_key = \u003cyour API key\u003e\n```\n\n### Put the API key on your keyring\n\nInstead of putting the API key in the configuration file, you can let\n`fish-ai` load it from your keyring. To save a new API key or transfer\nan existing API key to your keyring, run `fish_ai put_api_key`.\n\n## 🙉 How to use\n\n### Transform comments into commands and vice versa\n\nType a comment (anything starting with `#`), and press **Ctrl + P** to turn it\ninto shell command! Note that if your comment is very brief or vague, the LLM\nmay decide to improve the comment instead of providing a shell command. You\nthen need to press **Ctrl + P** again.\n\nYou can also run it in reverse. Type a command and press **Ctrl + P** to turn it\ninto a comment explaining what the command does.\n\n### Autocomplete commands\n\nBegin typing your command or comment and press **Ctrl + Space** to display a list\nof completions in [`fzf`](https://github.com/junegunn/fzf) (it is bundled\nwith the plugin, no need to install it separately).\n\nTo refine the results, type some instructions and press **Ctrl + P**\ninside `fzf`.\n\n### Suggest fixes\n\nIf a command fails, you can immediately press **Ctrl + Space** at the command prompt\nto let `fish-ai` suggest a fix!\n\n## 🤸 Additional options\n\nYou can tweak the behaviour of `fish-ai` by putting additional options in your\n`fish-ai.ini` configuration file.\n\n### Explain in a different language\n\nTo explain shell commands in a different language, set the `language` option\nto the name of the language. For example:\n\n```ini\n[fish-ai]\nlanguage = Swedish\n```\n\nThis will only work well if the LLM you are using has been trained on a dataset\nwith the chosen language.\n\n### Change the temperature\n\nTemperature is a decimal number between 0 and 1 controlling the randomness of\nthe output. Higher values make the LLM more creative, but may impact accuracy.\nThe default value is `0.2`.\n\nHere is an example of how to increase the temperature to `0.5`.\n\n```ini\n[fish-ai]\ntemperature = 0.5\n```\n\nThis option is not supported when using the `huggingface` provider.\n\nSome reasoning models, such as OpenAI's o3, does not support the\ntemperature parameter, and you need to explicitly disable it by\nsetting `temperature = None`.\n\n### Number of completions\n\nTo change the number of completions suggested by the LLM when pressing\n**Ctrl + Space**, set the `completions` option. The default value is `5`.\n\nHere is an example of how you can increase the number of completions to `10`:\n\n```ini\n[fish-ai]\ncompletions = 10\n```\n\nTo change the number of refined completions suggested by the LLM when pressing\n**Ctrl + P** in `fzf`, set the `refined_completions` option. The default value\nis `3`.\n\n```ini\n[fish-ai]\nrefined_completions = 5\n```\n\n### Personalise completions using commandline history\n\nYou can personalise completions suggested by the LLM by sending\nan excerpt of your commandline history.\n\nTo enable it, specify the maximum number of commands from the history\nto send to the LLM using the `history_size` option. The default value\nis `0` (do not send any commandline history).\n\n```ini\n[fish-ai]\nhistory_size = 5\n```\n\nIf you enable this option, consider the use of [`sponge`](https://github.com/meaningful-ooo/sponge)\nto automatically remove broken commands from your commandline history.\n\n### Preview pipes\n\nTo send the output of a pipe to the LLM when completing a command, use the\n`preview_pipe` option.\n\n```ini\n[fish-ai]\npreview_pipe = True\n```\n\nThis will send the output of the longest consecutive pipe after the last\nunterminated parenthesis before the cursor. For example, if you autocomplete\n`az vm list | jq`, the output from `az vm list` will be sent to the LLM.\n\nThis behaviour is disabled by default, as it may slow down the completion\nprocess and lead to commands being executed twice.\n\n## 🎭 Switch between contexts\n\nYou can switch between different sections in the configuration using the\n`fish_ai_switch_context` command.\n\n## 🐾 Data privacy\n\nWhen using the plugin, `fish-ai` submits the name of your OS and the\ncommandline buffer to the LLM.\n\nWhen you codify or complete a command, it also sends the contents of any\nfiles you mention (as long as the file is readable), and when you explain\nor complete a command, the output from `\u003ccommand\u003e --help` is provided to\nthe LLM for reference.\n\n`fish-ai` can also send an excerpt of your commandline history\nwhen completing a command. This is disabled by default.\n\nFinally, to fix the previous command, the previous commandline buffer,\nalong with any terminal output and the corresponding exit code is sent\nto the LLM.\n\nIf you are concerned with data privacy, you should use a self-hosted\nLLM. When hosted locally, no data ever leaves your machine.\n\n### Redaction of sensitive information\n\nThe plugin attempts to redact sensitive information from the prompt\nbefore submitting it to the LLM. Sensitive information is replaced by\nthe `\u003cREDACTED\u003e` placeholder.\n\nThe following information is redacted:\n\n- Passwords and API keys supplied on the commandline.\n- PEM-encoded private keys.\n\n## 🔨 Development\n\nIf you want to contribute, I recommend to read [`ARCHITECTURE.md`](https://github.com/Realiserad/fish-ai/blob/main/ARCHITECTURE.md)\nfirst.\n\nThis repository ships with a `devcontainer.json` which can be used with\nGitHub Codespaces or Visual Studio Code with\n[the Dev Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers).\n\nTo install `fish-ai` from a local copy, use `fisher`:\n\n```shell\nfisher install .\n```\n\n### Enable debug logging\n\nEnable debug logging by putting `debug = True` in your `fish-ai.ini`.\nLogging is done to syslog by default (if available). You can also enable\nlogging to file using `log = \u003cpath to file\u003e`, for example:\n\n```ini\n[fish-ai]\ndebug = True\nlog = ~/.fish-ai/log.txt\n```\n\n### Run the tests\n\n[The installation tests](https://github.com/Realiserad/fish-ai/actions/workflows/installation-tests.yaml)\nare packaged into containers and can be executed locally with e.g. `docker`.\n\n```shell\ndocker build -f tests/ubuntu/Dockerfile .\ndocker build -f tests/fedora/Dockerfile .\ndocker build -f tests/archlinux/Dockerfile .\n```\n\nThe Python modules containing most of the business logic can be tested using\n`pytest`.\n\n### Create a release\n\nA release is created by GitHub Actions when a new tag is pushed.\n\n```shell\nset tag (grep '^version =' pyproject.toml | \\\n    cut -d '=' -f2- | \\\n    string replace -ra '[ \"]' '')\ngit tag -a \"v$tag\" -m \"🚀 v$tag\"\ngit push origin \"v$tag\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FRealiserad%2Ffish-ai","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FRealiserad%2Ffish-ai","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FRealiserad%2Ffish-ai/lists"}