nlc - natural language command (and execution)

Describe shell commands in natural language and optionally execute them

How it works

The nlc command (natural language command) permits you to:

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

Example

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

How to make a nlc bash command wrapper?

nlc runs on pi and accepts any pi configuration and environments

  • add this bash script called nlc 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 nlc if aitm nlc "$@"; then # Reload the bash history file history -r fi
  • Make it executable
bash
chmod +x $HOME/.local/bin/nlc

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