nle command - natural language execution

Express shell commands in natural language and optionally execute them

How it works

The nle command (natural language exec execution) permits you to:

  • describe a command specified in natural language
  • execute it eventually after confirmation
  • for bash shell, add the command to the history.

Example

bash
aitm nle "Show me the content of the file dist/aitm-0.1.0.tar.gz" # or any arguments to get completion on file path aitm nle Show me the content of the file dist/aitm-0.1.0.tar.gz # or with the bash script below just nle nle Show me the content of the file dist/aitm-0.1.0.tar.gz

How to make a nle bash command wrapper?

nle runs on pi and accepts any pi configuration and environments

  • add this bash script called nle to $HOME/.local/bin
bash
#!/usr/bin/env bash set -Eeuo pipefail # Inject any pi provider env # https://pi.dev/docs/latest/providers#use-an-api-key-from-the-environment export OPENROUTER_API_KEY=$(pass to/api-key) # Define the model to use # On openrouter, there are free models # that are way enough for bash command export AITM_AGENT_DEFAULT_MODEL="free-model" # Run nle if aitm nle "$@"; then # Reload the bash history file history -r fi
  • Make it executable
bash
chmod +x $HOME/.local/bin/nle

Configuration

Bash History

Bash: To see the command in your history, you need to update it.

You can do it with:

  • a bash wrapper
  • the PROMPT_COMMAND defined in your configuration file (.bashrc)
bash
export PROMPT_COMMAND="${PROMPT_COMMAND}history -n;" # -n will add appended new lines # -r will reload