Giter VIP home page Giter VIP logo

clio's Introduction

Clio - Your friendly and safe CLI Copilot

Clio is an AI-powered copilot designed to help you with DevOps-related tasks using CLI programs. It leverages OpenAI's capabilities to provide intelligent assistance directly from your command line.

Note: Clio is designed to safely perform actions. It won't do anything without your confirmation first.

asciicast

Features

  • Kubernetes Management: Interact with your Kubernetes clusters using kubectl, helm, and other CLIs.
  • AWS Integration: Manage your AWS resources using the aws CLI.
  • Azure Integration: Manage your Azure resources using the az CLI.
  • Google Cloud Platform Integration: Manage your GCP resources using the gcloud CLI.
  • DigitalOcean Integration: Manage your DigitalOcean resources using the doctl CLI.
  • EKS Management: Manage your EKS clusters in AWS using eksctl and aws CLI.
  • GitHub Integration: Interact with your GitHub repositories using the gh CLI.
  • Easily Customizable: Add new capabilities with no code.

Installation

To install Clio, you can use Homebrew:

brew install gptscript-ai/tap/clio

Alternatively, you can clone the repository and build the project manually:

git clone https://github.com/gptscript-ai/clio.git
cd clio
make build

Usage

To start Clio, simply run:

clio

Authentication

Clio will prompt you to authenticate with GitHub to allow access to the AI model powering Clio. You can also set a custom personal OpenAI API key and base URL using environment variables, refer to clio --help for specific environment variable names.

Extending

Agents

Clio is composed of multiple internal agents. There are several built-in agents that provide functionality for interacting with Kubernetes, AWS, GCP, GitHub, etc., but you can easily add your own agents to extend the functionality of Clio. The built-in agents are located in the agents directory, with each file being a separate agent. To create a custom agent, you must write a new GPTScript and place it in the $XDG_CONFIG_HOME/clio/agents directory.

Operating System Custom Agent Path
macOS ~/Library/Application Support/clio/agents
Linux ~/.config/clio/agents

Custom Agent

A custom agent is any GPTScript with the requirement that it minimally must contain the following lines

chat: true
context: github.com/gptscript-ai/clio/context

You can refer to the GPTScript documentation for all the capabilities of GPTScripts, but for now the below example is typically all you need to know.

Example Custom Agent - GoReleaser

For this example, we will add a custom agent that is specialized for GoReleaser 2. We will create a file called goreleaser.gpt. The finished example is available in the examples directory.

The GPTScript starts with a metadata block that defines the name of the agent, a description, and the required context and chat fields. It is then followed by the prompt that will tell Clio how to behave when this agent is invoked.

Name: GoReleaser
Description: Agent for GoReleaser 2 using the goreleaser CLI
Chat: true
Context: github.com/gptscript-ai/clio/context

You are an expert at goreleaser. You can run the goreleaser CLI and help manage the goreleaser config file.

Rules:
1. Before changing the config, always show goreleaser config to the user for confirmation. After they agree, then write to disk.
2. Make sure "version: 2" line is always in the goreleaser config.
3. If the user asks to build, do a snapshot build.
4. Always search the internet for relevant information when asked a question or to do a task.

First ask the user what would they like to do with regards to GoReleaser.

To test this agent out you can run clio goreleaser.gpt. After testing the agent, you can modify the text if you don't like the exhibited behavior. There is no defined format for the prompt. The fact that the example has the structure with "Rules" in it is just a convention but not technically required.

To make the agent even more useful, you can extend the agent to have dynamic contextual information. To do this, we are going to add another "context tool" to the agent. Context tools add capabilities to the agent by prepending the output of the tool to the prompt.

In the below example, we add a new line for context: additional-environment to the metadata block. We then define the additional-environment context tool. This tool will show the user the current goreleaser version, the JSONSchema for the goreleaser config file, and the help output for the goreleaser CLI and the build subcommand. It will also show the user the current goreleaser config file if it exists.

Name: GoReleaser
Description: Agent for GoReleaser 2 using the goreleaser CLI
Chat: true
Context: github.com/gptscript-ai/clio/context
Context: additional-environment

You are an expert at goreleaser. You can run the goreleaser CLI and help manage the goreleaser config file.

Rules:
1. Before changing the config, always show goreleaser config to the user for confirmation. After they agree, then write to disk.
2. Make sure "version: 2" line is always in the goreleaser config.
3. If the user asks to build, do a snapshot build.
4. Always search the internet for relevant information when asked a question or to do a task.

First ask the user what would they like to do with regards to GoReleaser.

---
Name: additional-environment

#!/bin/bash

if ! command -v goreleaser; then
    echo 'Inform the user goreleaser is not installed or available on the path'
else
    goreleaser --version || true

    echo 'The JSONSchema for .goreleaser.yaml is as follows:'
    goreleaser jsonschema || true

    echo Additional CLI help
    echo
    goreleaser --help || true
    goreleaser build --help || true

    for i in .goreleaser.yaml .goreleaser.yml; do
        if [ -e $i ]; then
            echo
            echo "The current goreleaser config in ./$i:"
            echo
            echo '```yaml'
            cat $i
            echo '```'
        fi
    done
fi

That is now our finished agent. You can place the goreleaser.gpt file in the $XDG_CONFIG_HOME/clio/agents directory and then the next time you run clio you will see your agent in the list of agents, and it can be referenced by doing @goreleaser <your question>.

License

This project is licensed under the Apache License 2.0. See the LICENSE file for details.

clio's People

Contributors

ibuildthecloud avatar cloudnautique avatar thedadams avatar drpebcak avatar sheng-liang avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.