Skip to main content

Use LLM to generate commands for your shell: specialized for qwen3

Project description

Shell completion using LLM (Qwen3)

This is a fork of llm-cmd-comp that adds direct support for Qwen3 and its thinking tokens when hosted by providers like llama.cpp. The main advantage of this fork is that it can handle Qwen3's explicit thinking process tokens and execute commands directly.

Use LLM to generate and execute commands in your shell.

https://github.com/user-attachments/assets/c10d7a0f-48c3-4904-bb1b-4a1ce9f9ff8d

Installation

Install this plugin in the same environment as LLM.

llm install llm-cmd-comp-qwen

Then install the shell integration for your preferred shell.

  • Fish: place share/llm-cmd-comp.fish in ~/.config/fish/conf.d/.
  • Zsh: source share/llm-cmd-comp.zsh in your ~/.zshrc.
  • Bash: source share/llm-cmd-comp.bash in your ~/.bashrc.

Usage

There are two ways to use this plugin:

1. Direct Command Generation and Execution

Simply use the llm term command followed by your natural language description:

llm term "list all files larger than 100MB"

The command will be generated and executed automatically.

You can also use the --no-think (or -nt) flag to disable thinking tokens in the response:

llm term --no-think "list all files larger than 100MB"

This will give you a more direct response without the model's thinking process.

2. Interactive Shell Integration

  1. Start typing a command.
  2. Activate the key binding (Ctrl+k by default).
  3. Wait for the LLM to complete the command.
  4. Press enter if you are happy. Otherwise give feedback on the command and repeat from step 3.
  5. The LLM's command replaces the previous command you were writing.

Examples

Here are some ways you can use this feature:

  • Type a command in English, convert it to bash.
    llm term "find all files larger than 100MB"
    🪄 find . -type f -size +100M
  • Give extra instructions as comments.
    llm term "replace 'foo' with 'bar' in all Python files recursively"
    🪄 find . -name '*.py' -exec sed -i 's/foo/bar/g' {} +

Features

  • Direct command execution with llm term
  • Support for Qwen3's thinking process tokens
  • Compatible with llama.cpp and other LLM providers
  • Interactive shell completion with customizable keybindings
  • Works with bash, zsh, and fish shells

Development

To set up this plugin locally, first checkout the code. Then create a new virtual environment:

cd llm-cmd-comp-qwen
python3 -m venv venv
source venv/bin/activate

Now install the dependencies and test dependencies:

pip install llm
llm install -e .

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_comp_qwen-0.0.1.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

llm_cmd_comp_qwen-0.0.1-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file llm_cmd_comp_qwen-0.0.1.tar.gz.

File metadata

  • Download URL: llm_cmd_comp_qwen-0.0.1.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for llm_cmd_comp_qwen-0.0.1.tar.gz
Algorithm Hash digest
SHA256 2ad1abd7d38d1199bb1305fe5ea01809fa5187d631c948e90e23fb22aeb5bc2a
MD5 e7edd2b67a4a5afaf642834352d85a95
BLAKE2b-256 c1617294f1189a7a4b2dd04040e2275812bf3cc92e0dcbf1cc0152816076ee47

See more details on using hashes here.

File details

Details for the file llm_cmd_comp_qwen-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for llm_cmd_comp_qwen-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1d702ebaee857763c755e63573d9074549b6e41f3729ddc26fdad07d463d362f
MD5 5df1d7c5959af783219f17ffaf8d3962
BLAKE2b-256 e1c63df529e503c71a40e4a3bed557f84014ceb6fdf49a514d9f70a88bf274d7

See more details on using hashes here.

Supported by

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