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.2a0.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

llm_cmd-0.2a0-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file llm_cmd-0.2a0.tar.gz.

File metadata

  • Download URL: llm_cmd-0.2a0.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for llm_cmd-0.2a0.tar.gz
Algorithm Hash digest
SHA256 ef43690d3b4a9a37efb7aa1c998d4ca1807de075a707c0ad696ce55c614ba8a2
MD5 c39bd61ee6143373b616bfffcac0f00b
BLAKE2b-256 ddc8d6e5ce855ecf16c0eb6066bf4624e348850b6aebbf70a36227ffb2b7265f

See more details on using hashes here.

File details

Details for the file llm_cmd-0.2a0-py3-none-any.whl.

File metadata

  • Download URL: llm_cmd-0.2a0-py3-none-any.whl
  • Upload date:
  • Size: 7.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for llm_cmd-0.2a0-py3-none-any.whl
Algorithm Hash digest
SHA256 4e0e21e43d49e73b931b09663db96fef935adbe46f8c233b1ce52872668117cf
MD5 a4f3bfc1bbd1226fc98282f673fa19a7
BLAKE2b-256 c66f47f53d22873d0915fdd12a34a94f142554981d128820ea1b9aaa6b2db46e

See more details on using hashes here.

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