Skip to content

0x4007/plz-cli

 
 

Repository files navigation

Copilot, for your terminal

A CLI tool that generates shell scripts from a human readable description.

This is a modded version of plz-cli that now uses Claude 3.7 Sonnet via OpenRouter instead of GPT-3.5 Turbo Instruct.

Installation

cargo build --release
cp ./target/release/plz ~/.bin/plz

You may need to close and reopen your terminal after installation. Alternatively, you can download the binary corresponding to your OS from the latest release.

Usage

plz uses Claude 3.7 Sonnet via OpenRouter by default. To use it, you'll need to grab an API key from OpenRouter, and save it to OPENROUTER_API_KEY as follows (you can also save it in your bash/zsh profile for persistence between sessions).

export OPENROUTER_API_KEY='sk-XXXXXXXX'

Configuration Options

You can customize the LLM model and behavior using these optional environment variables:

# Use a different model (default: anthropic/claude-opus-4)
export OPENROUTER_MODEL='openai/gpt-4'  # or any model available on OpenRouter

# Use a custom API endpoint (default: https://openrouter.ai/api/v1/chat/completions)
export OPENROUTER_API_BASE='https://custom-endpoint.com/v1/chat/completions'

# Use a custom system prompt (default: generates bash scripts)
export OPENROUTER_SYSTEM_PROMPT='You are a PowerShell expert. Generate PowerShell scripts.'

Examples

# Basic usage with default Claude model
plz list all files in current directory

# Use GPT-4 instead
export OPENROUTER_MODEL='openai/gpt-4'
plz find all large files over 100MB

# Use Claude Opus with custom prompt for PowerShell
export OPENROUTER_MODEL='anthropic/claude-3-opus'
export OPENROUTER_SYSTEM_PROMPT='You are a PowerShell expert. Generate PowerShell scripts.'
plz get system information

Once you have configured your environment, run plz followed by whatever it is that you want to do (plz show me all options for the plz cli).

To get a full overview of all available options, run plz --help

$ plz --help
Generates bash scripts from the command line

Usage: plz [OPTIONS] <PROMPT>

Arguments:
  <PROMPT>  Description of the command to execute

Options:
  -y, --force     Run the generated program without asking for confirmation
      --extended  Remove token limit for complex scripts (may increase API costs)
  -h, --help      Print help information
  -V, --version   Print version information

Develop

Make sure you have the latest version of rust installed (use rustup). Then, you can build the project by running cargo build, and run it with cargo run.

Releasing

Releases are automated with v prefixed tags. To create a new release, run something similar to the following:

SEMVER=0.0.0
RELEASE_COMMENT="Default Message. Release 0.0.0"

git tag -s $SEMVER -m "$RELEASE_COMMENT"
git push origin $SEMVER

License

This project is open-sourced under the MIT license. See the License file for more information.

About

Copilot for your terminal

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • Rust 66.1%
  • Shell 33.9%