Skip to content
/ llm-cmd Public

Use LLM to generate and execute commands in your shell

License

Notifications You must be signed in to change notification settings

simonw/llm-cmd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

llm-cmd

PyPI Changelog Tests License

Use LLM to generate and execute commands in your shell

Installation

Install this plugin in the same environment as LLM.

llm install llm-cmd

Usage

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.

The system prompt

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

Development

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

About

Use LLM to generate and execute commands in your shell

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages