Use LLM to generate and execute commands in your shell
Install this plugin in the same environment as LLM.
llm install llm-cmd
This command could be very dangerous. Do not use this unless you are confident you understand what it does and are sure you could spot if it is likely to do something dangerous.
Run llm cmd
like this:
llm cmd undo last git commit
It will use your default model to generate the corresponding shell command.
This will then be displayed in your terminal ready for you to edit it, or hit <enter>
to execute the prompt.
If the command doesnt't look right, hit Ctrl+C
to cancel.
This is the prompt used by this tool:
Return only the command to be executed as a raw string, no string delimiters wrapping it, no yapping, no markdown, no fenced code blocks, what you return will be passed to subprocess.check_output() directly.
For example, if the user asks: undo last git commit
You return only: git reset --soft HEAD~1
To set up this plugin locally, first checkout the code. Then create a new virtual environment:
cd llm-cmd
python3 -m venv venv
source venv/bin/activate
Now install the dependencies and test dependencies:
llm install -e '.[test]'
To run the tests:
pytest