LLM cmd, an LLM plugin to prompt and edit a shell command (simonwillison.net)

🤖 AI Summary
Developer released llm-cmd, an alpha plugin for the llm CLI that asks a large model to generate a shell command from natural-language intent, pre-populates your terminal with that command so you can edit it, then runs it when you hit Enter (or cancels with Ctrl-C). It’s aimed at speeding up common shell tasks (e.g., “undo last git commit” → git reset --soft HEAD~1) and reducing cognitive friction for devs who prefer natural-language prompts. The author stresses it’s dangerous and intended only for users fluent with the terminal — generated commands are executed locally and can delete or modify data. Technically, llm-cmd uses the llm framework (installable via brew or pipx; you must configure API keys) and supports multiple models (gpt-3.5-turbo, GPT-4, Claude 3 variants). The system prompt forces the model to return only a raw command string — no markdown or commentary — because the plugin passes the result directly to subprocess.check_output(). The UX trick is readline.set_startup_hook(lambda: readline.insert_text(command)) to prefill the input buffer so users can edit before execution. Flags include -m to pick a model and -s/--system to change the system prompt. The release demonstrates how LLMs can be tightly integrated into developer tooling but also highlights security and correctness risks that merit caution and iteration.
Loading comments...
loading comments...