GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - clevercli/clevercli: ChatGPT powered CLI utilities. Easily add new prompt types in ~/.clevercli/

This repository was archived by the owner on Mar 5, 2026. It is now read-only.
BranchesTags
Open more actions menu

Latest commit

 

History

75 Commits
75 Commits

Folders and files

NameName
Last commit message
Last commit date
images
images
 
 
src
src
 
 
.gitignore
.gitignore
 
 
.node-version
.node-version
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
package-lock.json
package-lock.json
 
 
package.json
package.json
 
 
tsconfig.json
tsconfig.json
 
 
vitest.config.js
vitest.config.js
 
 

Repository files navigation

!!! ARCHIVED !!!

I recommend aichat as an alternative.

clevercli

clevercli is a CLI that queries OpenAI models (e.g. ChatGPT). New prompt types can easily be added and there is a growing list of community maintained prompts.

Some examples:

$ $(clevercli unix-command "undo the last commit")
$ clevercli unix-command "add a collaborator to a npm package"
$ clevercli eli5 "why is the sky blue?"
$ man du | clevercli summarize
$ clevercli convert-to-rust < index.ts > main.rs
$ clevercli ask "in node.js, how to check if stdin is open?"

Install

$ npm install -g @clevercli/cli

Requires Node v16+.

Usage

$ clevercli <prompt_type> <prompt_input>

Or using stdin:

$ echo "<prompt_input>" | clevercli <prompt_type>

List available prompt types:

$ clevercli --list

Requires an OpenAI API key. Add export OPENAI_API_KEY="<your OpenAI api key>" to your shell script (e.g. ~/.bashrc).

Examples

$ clevercli joke "banana"
Why did the banana go to the doctor? Because it wasn't peeling well!
$ echo "what is stdin?" | clevercli eli5
...
$ man du | clevercli summarize
...
$ clevercli convert-to-rust < index.ts > main.rs

Tip: since many answers use markdown, you can pipe to glow to get a nicer rendering:

$ clevercli ask "in node.js, how to check if stdin is open?" | glow

glow-example

Built-in prompts

  • ask Just passes through the input directly to ChatGPT.

Example: clevercli ask "in node.js, how to check if stdin is open?"

  • eli5: Explain Me Like I'm 5.

Example: clevercli eli5 "why is the sky blue?"

  • joke: Tells a joke about the topic.

Example: clevercli joke "git being difficult to learn"

  • refactor: Asks ChatGPT to refactor code in a file.

Example: clevercli refactor < index.ts

  • poem: Asks ChatGPT to write a small poem on the topic.

Example: clevercli poem "hacker news"

  • recipe: Outputs recipe suggestions given a list of available ingredients.

Example: clevercli recipe "ham, cheese, bread"

  • summarize Outputs a short summary of the text.

Example: clevercli summarize < README.md

  • synonyms: List synonyms for the input words.

Example: clevercli synonyms "cat"

  • convert-to-rust: Converts file to Rust

Example: clevercli convert-to-rust < index.ts > main.rs

  • convert-to-typescript: Converts file to TypeScript

Example: clevercli convert-to-typescript < index.js > main.ts

  • unix-command: Outputs a UNIX command based on the input description.

Example: bash -c $(clevercli unix-command "list all .md files")

  • regex: Outputs a JavaScript-compatible RegEx that matches the input examples.

Example clevercli regex "http://google.com https://news.ycombinator.com/some/path"

  • jsdoc: Adds JSDoc comments to exported functions.

Example clevercli jsdoc < index.js

See ./src/prompts/ for the list of available prompts.

See Adding a built-in prompt for adding an official prompt.

Adding a prompt

Create a file ~/.clevercli/<prompt name>.mjs which returns an object that follows the PromptConfiguration interface.

export interface PromptConfiguration {
  createPrompt(input: string): string;
  model?: string;
  description?: string;
}

For example:

// eli5.mjs
export default {
  createPrompt(input) {
    return `Provide a very detailed explanation but like I am 5 years old (ELI5) on this topic: ${input}.\n###\n`;
  },
};

Adding a built-in prompt

  1. Fork the repository.

  2. Create a new prompt configuration in ./src/prompts/. You can use the eli5 prompt configuration as a base.

  3. Send a pull request!

Here's a sample prompt configuration:

import { ParsedResponse, PromptConfiguration } from "../types.js";

const promptConfiguration: PromptConfiguration = {
  createPrompt(input: string) {
    return `Provide a very detailed explanation but like I am 5 years old (ELI5) on this topic: ${input}.\n###\n`;
  },
  parseResponse(response: string): ParsedResponse {
    return { message: response };
  },
};

export default promptConfiguration;

Cache

Query results are cached on your filesystem's cache directory.

Debugging

DEBUG="clevercli:*" clevercli eli5 "friendship"

TODO

  • Streaming API.
  • Proper CLI arg parsing and options
  • GH workflow + tests
  • Support older Node.js versions?
  • Interactively prompt OpenAI API key and save to filesystem (when OPENAPI_KEY is not set)
  • Distributed cache (not just local)

About

ChatGPT powered CLI utilities. Easily add new prompt types in ~/.clevercli/

Topics

chatgptcligptgpt-3openai

Resources

Readme
MIT license
Activity
Custom properties

Stars

166 stars

Watchers

4 watching

Forks

6 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.