Skip to main content

Generate Unix commands in the terminal

Project description

Cliff

Cliff (Command Line InterFace Friend) is an AI assistant that helps you come up with Unix commands. Given an objective (for example, "kill the process running on port 8080"), Cliff will generate a command that does the objective and add it to your paste buffer for you to easily paste into your terminal.

MacBookPro:~ $ cliff list my files and their sizes in KB, descending by size
ls -lS | awk '$5 > 0 {printf "%-20s %8.2f KB\n", $9, $5/1024}'
MacBookPro:~ $ ls -lS | awk '$5 > 0 {printf "%-20s %8.2f KB\n", $9, $5/1024}'
foo.txt                 10.29 KB
bar.txt                  5.28 KB
baz.txt                  2.61 KB

Cliff is compatible with LLMs from OpenAI, Anthropic, etc. as well as local models running with Ollama.

Why?

It's annoying having to open the browser when I forget how to do something in the terminal.

Requirements

Installation

You can install Cliff with homebrew:

brew tap pkelaita/cliff
brew install cliff

Or with pip:

pip install cliff-cli

Configuration

If you'd like to use models from an API-based provider, add its credentials as follows:

cliff --config add [provider] [api key]

The provider can be any of openai, anthropic, google, cohere, groq, replicate, mistral, or cerebras.

Otherwise if you want to use a local model, add it like this:

cliff --config add ollama [model]

Configuration tips

  • In order to use local models, make sure you have Ollama installed and running and have the model loaded (their docs).
  • If you add multiple models, you can set your default model with: cliff --config default-model [model].
  • If you want to edit your config file directly, it's located at ~/.cliff/config.json.

For a full overview of the configuration system, run cliff --config help, and for a full list of supported models for each provider, see L2M2's docs.

Usage

Get started by running cliff with an objective.

cliff kill the process running on port 8080

Cliff will automatically add the command to your paste buffer, so no need to copy-paste it.

If needed (i.e., to avoid escaping special characters), you can use quotes.

cliff "kill the process that's running on port 8080"

If you want to specify which model to use, you can do so with the --model flag.

cliff --model gpt-4o kill the process running on port 8080

To view the man page, run cliff with no arguments.


Chat Memory

By default, Cliff has chat memory enabled with a sliding window size of 10 turns. You can view your memory with cliff --memory show and clear it with cliff --memory clear.

If you'd like to change the window size, run cliff --config memory-window [new size]. If you want to disable memory, just set the window size to 0.


Storing Command Outputs

Cliff's chat memory does not have access to command outputs, but you can optionally share them with Cliff to help it debug and improve its responses.

  • To run a command and store its output for Cliff, run cliff -r [command] or cliff --recall [command].
  • To view all recalled commands and their outputs, run cliff --show-recall or cliff -sr.
  • To clear Cliff's recall storage, run cliff --clear-recall or cliff -cr.

Tip: You'll usually have to put quotes around your command if it contains special characters – e.g., cliff -r "ps ax | head -n 10" – for Cliff to properly capture and execute it.


That's it! It's pretty simple which is the point.

Planned Features

  • Regular updates with new models, etc.
  • Not sure what else this thing really needs, but open to suggestions!

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

cliff_cli-0.1.1.tar.gz (25.9 kB view details)

Uploaded Source

Built Distribution

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

cliff_cli-0.1.1-py3-none-any.whl (20.0 kB view details)

Uploaded Python 3

File details

Details for the file cliff_cli-0.1.1.tar.gz.

File metadata

  • Download URL: cliff_cli-0.1.1.tar.gz
  • Upload date:
  • Size: 25.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.13.1

File hashes

Hashes for cliff_cli-0.1.1.tar.gz
Algorithm Hash digest
SHA256 1292b625308ab2159bce2a19496cb0225ef3109d52ac6c660fb0dea5b060d055
MD5 4bcb74028c0bb731bad1918aad6c60be
BLAKE2b-256 3605f901d98fcd99c0feeb2e72b017eb058cfca6be1dbc0de9b5bcf141e18ac1

See more details on using hashes here.

File details

Details for the file cliff_cli-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: cliff_cli-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 20.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.13.1

File hashes

Hashes for cliff_cli-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4c5aaf477d072fd0589731d01def1ddcdab5928c6f968da043385074244eb914
MD5 7c5aa315e4882e6aebfd74de2ad18555
BLAKE2b-256 098e9fd62c3226bccf2e0ce4f4a3f260c37fd1b9d7edf90e598d65fde819d8f8

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