llm-cmd


Namellm-cmd JSON
Version 0.2a0 PyPI version JSON
download
home_pageNone
SummaryUse LLM to generate and execute commands in your shell
upload_time2024-09-09 23:33:25
maintainerNone
docs_urlNone
authorSimon Willison
requires_pythonNone
licenseApache-2.0
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # llm-cmd

[![PyPI](https://img.shields.io/pypi/v/llm-cmd.svg)](https://pypi.org/project/llm-cmd/)
[![Changelog](https://img.shields.io/github/v/release/simonw/llm-cmd?include_prereleases&label=changelog)](https://github.com/simonw/llm-cmd/releases)
[![Tests](https://github.com/simonw/llm-cmd/actions/workflows/test.yml/badge.svg)](https://github.com/simonw/llm-cmd/actions/workflows/test.yml)
[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/simonw/llm-cmd/blob/main/LICENSE)

Use LLM to generate and execute commands in your shell

## Installation

Install this plugin in the same environment as [LLM](https://llm.datasette.io/).
```bash
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:

```bash
llm cmd undo last git commit
```
It will use your [default model](https://llm.datasette.io/en/stable/setup.html#setting-a-custom-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:
```bash
cd llm-cmd
python3 -m venv venv
source venv/bin/activate
```
Now install the dependencies and test dependencies:
```bash
llm install -e '.[test]'
```
To run the tests:
```bash
pytest
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "llm-cmd",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": null,
    "author": "Simon Willison",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/dd/c8/d6e5ce855ecf16c0eb6066bf4624e348850b6aebbf70a36227ffb2b7265f/llm_cmd-0.2a0.tar.gz",
    "platform": null,
    "description": "# llm-cmd\n\n[![PyPI](https://img.shields.io/pypi/v/llm-cmd.svg)](https://pypi.org/project/llm-cmd/)\n[![Changelog](https://img.shields.io/github/v/release/simonw/llm-cmd?include_prereleases&label=changelog)](https://github.com/simonw/llm-cmd/releases)\n[![Tests](https://github.com/simonw/llm-cmd/actions/workflows/test.yml/badge.svg)](https://github.com/simonw/llm-cmd/actions/workflows/test.yml)\n[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/simonw/llm-cmd/blob/main/LICENSE)\n\nUse LLM to generate and execute commands in your shell\n\n## Installation\n\nInstall this plugin in the same environment as [LLM](https://llm.datasette.io/).\n```bash\nllm install llm-cmd\n```\n## Usage\n\nThis 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.\n\nRun `llm cmd` like this:\n\n```bash\nllm cmd undo last git commit\n```\nIt will use your [default model](https://llm.datasette.io/en/stable/setup.html#setting-a-custom-default-model) to generate the corresponding shell command.\n\nThis will then be displayed in your terminal ready for you to edit it, or hit `<enter>` to execute the prompt.\n\nIf the command doesnt't look right, hit `Ctrl+C` to cancel.\n\n## The system prompt\n\nThis is the prompt used by this tool:\n\n> Return only the command to be executed as a raw string, no string delimiters\nwrapping it, no yapping, no markdown, no fenced code blocks, what you return\nwill be passed to subprocess.check_output() directly.\n>\n> For example, if the user asks: undo last git commit\n>\n> You return only: git reset --soft HEAD~1\n\n## Development\n\nTo set up this plugin locally, first checkout the code. Then create a new virtual environment:\n```bash\ncd llm-cmd\npython3 -m venv venv\nsource venv/bin/activate\n```\nNow install the dependencies and test dependencies:\n```bash\nllm install -e '.[test]'\n```\nTo run the tests:\n```bash\npytest\n```\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "Use LLM to generate and execute commands in your shell",
    "version": "0.2a0",
    "project_urls": {
        "CI": "https://github.com/simonw/llm-cmd/actions",
        "Changelog": "https://github.com/simonw/llm-cmd/releases",
        "Homepage": "https://github.com/simonw/llm-cmd",
        "Issues": "https://github.com/simonw/llm-cmd/issues"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c66f47f53d22873d0915fdd12a34a94f142554981d128820ea1b9aaa6b2db46e",
                "md5": "a4f3bfc1bbd1226fc98282f673fa19a7",
                "sha256": "4e0e21e43d49e73b931b09663db96fef935adbe46f8c233b1ce52872668117cf"
            },
            "downloads": -1,
            "filename": "llm_cmd-0.2a0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a4f3bfc1bbd1226fc98282f673fa19a7",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 7499,
            "upload_time": "2024-09-09T23:33:23",
            "upload_time_iso_8601": "2024-09-09T23:33:23.741933Z",
            "url": "https://files.pythonhosted.org/packages/c6/6f/47f53d22873d0915fdd12a34a94f142554981d128820ea1b9aaa6b2db46e/llm_cmd-0.2a0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ddc8d6e5ce855ecf16c0eb6066bf4624e348850b6aebbf70a36227ffb2b7265f",
                "md5": "c39bd61ee6143373b616bfffcac0f00b",
                "sha256": "ef43690d3b4a9a37efb7aa1c998d4ca1807de075a707c0ad696ce55c614ba8a2"
            },
            "downloads": -1,
            "filename": "llm_cmd-0.2a0.tar.gz",
            "has_sig": false,
            "md5_digest": "c39bd61ee6143373b616bfffcac0f00b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 7055,
            "upload_time": "2024-09-09T23:33:25",
            "upload_time_iso_8601": "2024-09-09T23:33:25.865101Z",
            "url": "https://files.pythonhosted.org/packages/dd/c8/d6e5ce855ecf16c0eb6066bf4624e348850b6aebbf70a36227ffb2b7265f/llm_cmd-0.2a0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-09 23:33:25",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "simonw",
    "github_project": "llm-cmd",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "llm-cmd"
}
        
Elapsed time: 0.58419s