{"id":20550508,"url":"https://github.com/guywaldman/magic-cli","last_synced_at":"2025-04-04T06:07:07.421Z","repository":{"id":248757987,"uuid":"819344627","full_name":"guywaldman/magic-cli","owner":"guywaldman","description":"Command line utility to make you a magician in the terminal","archived":false,"fork":false,"pushed_at":"2024-07-27T23:44:04.000Z","size":427,"stargazers_count":745,"open_issues_count":8,"forks_count":19,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-03-28T05:08:11.869Z","etag":null,"topics":["ai","cli","llm","rust"],"latest_commit_sha":null,"homepage":"https://guywaldman.com/posts/introducing-magic-cli","language":"Rust","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/guywaldman.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-06-24T10:14:42.000Z","updated_at":"2025-03-17T10:11:20.000Z","dependencies_parsed_at":"2024-11-23T04:15:10.561Z","dependency_job_id":null,"html_url":"https://github.com/guywaldman/magic-cli","commit_stats":null,"previous_names":["guywaldman/magic-cli"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guywaldman%2Fmagic-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guywaldman%2Fmagic-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guywaldman%2Fmagic-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guywaldman%2Fmagic-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/guywaldman","download_url":"https://codeload.github.com/guywaldman/magic-cli/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247128736,"owners_count":20888234,"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":["ai","cli","llm","rust"],"created_at":"2024-11-16T02:25:19.316Z","updated_at":"2025-04-04T06:07:07.401Z","avatar_url":"https://github.com/guywaldman.png","language":"Rust","readme":"# Magic CLI\n\n![Magic CLI logo](/assets/logo_sm.png)\n\n![GitHub Actions CI](https://github.com/guywaldman/magic-cli/actions/workflows/ci.yml/badge.svg)\n\nMagic CLI is a command line utility which uses LLMs to help you use the command line more efficiently, inspired by projects such as [Amazon Q (prev. Fig terminal)](https://fig.io/) and [GitHub Copilot for CLI](https://docs.github.com/en/copilot/using-github-copilot/using-github-copilot-in-the-command-line).\n\n`magic-cli` relies on the [orch](https://github.com/guywaldman/orch) library for LLM interactions (execution, orchestration, model alignment, etc.).\n\n\u003e **Read the [announcement blog post](https://guywaldman.com/posts/introducing-magic-cli).**\n\n\u003e [!CAUTION]\n\u003e\n\u003e This project is still in early development.  \n\u003e Expect breaking changes and bugs, and please report any issues you encounter.  \n\u003e Thank you!\n\n---\n\n## Features\n\n- Suggest a command (see [section](#feature-suggest-a-command))\n- Ask to generate a command to perform a task (see [section](#feature-ask-to-generate-a-command))\n- Semantic search of commands across your shell history\n- Use a local or remote LLM (see [section](#use-different-llms))\n  - Supported LLM providers:\n    - [ollama](https://github.com/ollama/ollama)\n    - [OpenAI](https://openai.com/)\n    - [Anthropic](https://www.anthropic.com/)\n\n## Installation\n\n\u003e [!NOTE]\n\u003e\n\u003e For more options on how to install Magic CLI, see the [releases page](https://github.com/guywaldman/magic-cli/releases) for the version you wish to install.\n\n### Shell\n\n```shell\ncurl -LsSf https://github.com/guywaldman/magic-cli/releases/download/0.0.6/magic-cli-installer.sh | sh\n```\n\n### Homebrew\n\n```shell\nbrew install guywaldman/tap/magic-cli\n```\n\n### PowerShell\n\n```powershell\npowershell -c \"irm https://github.com/guywaldman/magic-cli/releases/download/0.0.6/magic-cli-installer.ps1 | iex\"\n```\n\n### Binaries\n\nSee the [releases page](https://github.com/guywaldman/magic-cli/releases) for binaries for your platform.\n\n## Usage Tip\n\nAdd functions to your `~/.bashrc` or `~/.zshrc` to make formatting the prompts in the terminal easier (not requiring quotes).\n\nFor example:\n\n```shell\nfunction mcs {\n  model_prompt=\"$*\"\n  magic-cli suggest \"$model_prompt\"\n}\n\nfunction mcf {\n  model_prompt=\"$*\"\n  magic-cli search \"$model_prompt\"\n}\n\nfunction mca {\n  model_prompt=\"$*\"\n  magic-cli ask \"$model_prompt\"\n}\n```\n\n### Suggest a command\n\nSupply a prompt to get a suggestion for the command to run.  \nThis is useful in scenarios where you know approximately what you want (and perhaps even the tool) but don't remember the exact arguments or their order.  \nThis is especially useful with CLI tools like `ffmpeg` or `kubectl`.\n\n![Suggest subcommand](/assets/suggest_screenshot.png)\n\n```shell\nmagic-cli suggest \"Resize test_image.png to 300x300 with ffmpeg\"\n```\n\n```\nUsage: magic-cli suggest \u003cPROMPT\u003e\n\nArguments:\n  \u003cPROMPT\u003e  The prompt to suggest a command for (e.g., \"Resize image to 300x300 with ffmpeg\")\n```\n\n### Search across your command history (experimental)\n\nSearch a command across your shell history, and get a list of the top results.\n\n![Search subcommand](/assets/search_screenshot.png)\n\n```shell\nmagic-cli search \"zellij attach\"\n```\n\n```\nUsage: magic-cli search [OPTIONS] \u003cPROMPT\u003e\n\nArguments:\n  \u003cPROMPT\u003e  The prompt to search for\n```\n\n\u003e [!IMPORTANT]\n\u003e\n\u003e Word to the wise: If you're using a non-local LLM, be wary about the cost of the embeddings, especially for long shell histories.\n\n### Ask to generate a command (experimental)\n\nSupply a prompt with a task you want the model to perform, and watch it try to suggest a command to run to achieve the goal.\nIt may prompt you along the way to run commands if it needs more context.\n\n```shell\nmagic-cli ask \"Set up the dev environment as described in the README\"\n```\n\n```\nUsage: magic-cli ask \u003cPROMPT\u003e\n\nArguments:\n  \u003cPROMPT\u003e  The prompt to ask for (e.g., \"Set up the development environment\")\n```\n\n### Use different LLMs\n\nMagic CLI supports two LLM providers:\n\n- `ollama`: [Ollama](https://github.com/ollama/ollama) is a local LLM provider. The command expects Ollama to be installed and running on your local machine.\n- `openai`: [OpenAI](https://openai.com/) is a cloud LLM provider. You configure an API token, and Magic CLI uses it with the OpenAI APIs.\n\n## Configuration\n\nMagic CLI stores configurations in `~/.config/magic_cli/config.json`.\n\nUse `magic-cli config` (to see the options, use `magic-cli config --help`) to set the configuration options:\n\n```\nUsage: magic-cli config \u003cCOMMAND\u003e\n\nCommands:\n  set    Set a value\n  get    Get a value\n  list   List the configurations\n  reset  Reset the configurations to the default values\n  path   Get the path to the configuration file\n```\n\nThe currently suppprted configuration options are:\n\n- `llm`: The LLM to use for generating responses. Supported values: \"ollama\", \"openai\"\n- `ollama.base_url`: The base URL of the Ollama API (default: \"http://localhost:11434\")\n- `ollama.embedding_model`: The model to use for generating embeddings (default: \"nomic-embed-text:latest\")\n- `ollama.model`: The model to use for generating responses (default: \"codestral:latest\")\n- `openai.api_key` (secret): The API key for the OpenAI API\n- `openai.embedding_model`: The model to use for generating embeddings (default: \"text-embedding-ada-002\")\n- `openai.model`: The model to use for generating responses (default: \"gpt-4o\")\n- `suggest.add_to_history`: Whether to add the suggested command to the shell history (default: false)\n- `suggest.mode`: The mode to use for suggesting commands. Supported values: \"clipboard\" (copying command to clipboard), \"unsafe-execution\" (executing in the current shell session) (default: \"unsafe-execution\")\n  \u003e Note: `unsafe-execution` is named as such to make it clear that the CLI executes the command in the current shell session. Please be extremely careful when using this mode - Magic CLI is not responsible for the execution of commands suggested.\n\n## Roadmap\n\n- [ ] Windows support (PowerShell is supported, but Windows has not been tested properly)\n- [ ] Support for more LLM providers (e.g., [Anthropic](https://www.anthropic.com/))\n- [ ] Improve local embedding index (currently stored naively as a JSON, looked into SQLLite with vector extensions)\n\n- [ ] More test coverage\n\n---\n\n## Security\n\nSecurity is taken seriously and all vulnerabilities will be handled with utmost care and priority.\n\nIn terms of data stored, the sensitive data that is currently handled by Magic CLI is:\n\n- OpenAI API key, which is stored in the configuration within the **user home directory** (`~/.config/magic_cli`).\n  \u003e There are plans to store this token in the system's secure key storage, but this is not yet implemented.\n- Embeddings of the shell history for the `magic-cli search` command, which are stored in the configuration within the **user home directory** (`~/.config/magic_cli`) and are generated using the LLM provider of choice.\n\nPlease see [SECURITY.md](SECURITY.md) for more information, and instructions on how to report potential vulnerabilities.\n\n## Contributing\n\nContributions are welcome!\n\nPlease see [CONTRIBUTING.md](CONTRIBUTING.md) for more information.\n\nMy only request is that pull requests follow an issue, such that we avoid situations of your hard work not being accepted due to a lack of context or necessity.\n","funding_links":[],"categories":["Rust"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguywaldman%2Fmagic-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fguywaldman%2Fmagic-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguywaldman%2Fmagic-cli/lists"}