Skip to main content

Use LLM to generate and execute commands in your shell

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llm-cmd-0.1a0.tar.gz (6.9 kB view hashes)

Uploaded Source

Built Distribution

llm_cmd-0.1a0-py3-none-any.whl (7.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page