From 2e7399608a7b30024381b392abc10d4f5addf6de Mon Sep 17 00:00:00 2001 From: Jonathan Vuillemin Date: Tue, 25 Apr 2023 09:51:01 +0200 Subject: [PATCH 1/2] feat: rename in yai --- CHANGELOG.md | 6 ++++++ README.md | 27 ++++++++++++++------------- ai/engine.go | 18 +++++++++--------- config/config.go | 2 +- config/config_test.go | 5 ++--- docs/_config.yml | 6 +++--- docs/_data/navigation.yml | 2 +- docs/_pages/404.md | 4 ++-- docs/_pages/examples.md | 22 ++++++++++++---------- docs/_pages/getting-started.md | 18 +++++++++--------- docs/_pages/usage.md | 12 ++++++------ docs/index.md | 10 +++++----- go.mod | 2 +- install.sh | 12 ++++++------ main.go | 2 +- system/analyzer.go | 4 ++-- ui/renderer.go | 2 +- ui/ui.go | 8 ++++---- 18 files changed, 85 insertions(+), 77 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b8ce123..0e042e0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ All notable changes to this project will be documented in this file. +## 0.6.0 + +### Changed + +- Changed project name from Yo to Yai, thanks to [@K-arch27](https://github.com/K-arch27) for the suggestion. + ## 0.5.0 ### Added diff --git a/README.md b/README.md index 8e3ee94..79a84cd 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,18 @@ -# 🚀 Yo 💬 - AI powered terminal assistant +# 🚀 Yai 💬 - AI powered terminal assistant -[![build](https://github.com/ekkinox/yo/actions/workflows/build.yml/badge.svg)](https://github.com/ekkinox/yo/actions/workflows/build.yml) -[![release](https://github.com/ekkinox/yo/actions/workflows/release.yml/badge.svg)](https://github.com/ekkinox/yo/actions/workflows/release.yml) -[![doc](https://github.com/ekkinox/yo/actions/workflows/doc.yml/badge.svg)](https://github.com/ekkinox/yo/actions/workflows/doc.yml) +[![build](https://github.com/ekkinox/yai/actions/workflows/build.yml/badge.svg)](https://github.com/ekkinox/yai/actions/workflows/build.yml) +[![release](https://github.com/ekkinox/yai/actions/workflows/release.yml/badge.svg)](https://github.com/ekkinox/yai/actions/workflows/release.yml) +[![doc](https://github.com/ekkinox/yai/actions/workflows/doc.yml/badge.svg)](https://github.com/ekkinox/yai/actions/workflows/doc.yml) > Unleash the power of artificial intelligence to streamline your command line experience. ![Intro](docs/_assets/intro.gif) -## What is Yo ? +## What is Yai ? -`Yo` is an assistant for your terminal, using [OpenAI ChatGPT](https://chat.openai.com/) to build and run commands for you. You just need to describe them in your everyday language, it will take care or the rest. +`Yai` (your AI) is an assistant for your terminal, using [OpenAI ChatGPT](https://chat.openai.com/) to build and run commands for you. You just need to describe them in your everyday language, it will take care or the rest. -You have any questions on random topics in mind? You can also ask `Yo`, and get the power of AI without leaving `/home`. +You have any questions on random topics in mind? You can also ask `Yai`, and get the power of AI without leaving `/home`. It is already aware of your: - operating system & distribution @@ -23,19 +23,20 @@ And you can also give any supplementary preferences to fine tune your experience ## Documentation -A complete documentation is available at [https://ekkinox.github.io/yo/](https://ekkinox.github.io/yo/). +A complete documentation is available at [https://ekkinox.github.io/yai/](https://ekkinox.github.io/yai/). ## Quick start -To install `Yo`, simply run: +To install `Yai`, simply run: ```shell -curl -sS https://raw.githubusercontent.com/ekkinox/yo/main/install.sh | bash +curl -sS https://raw.githubusercontent.com/ekkinox/yai/main/install.sh | bash ``` -At first run, it will ask you for an [OpenAI API key](https://platform.openai.com/account/api-keys), and use it to create the configuration file in `~/.config/yo.json`. - -See [documentation](https://ekkinox.github.io/yo/getting-started/#configuration) for more information. +At first run, it will ask you for an [OpenAI API key](https://platform.openai.com/account/api-keys), and use it to create the configuration file in `~/.config/yai.json`. +See [documentation](https://ekkinox.github.io/yai/getting-started/#configuration) for more information. +## Thanks +Thanks to [@K-arch27](https://github.com/K-arch27) for the `yai` name idea! \ No newline at end of file diff --git a/ai/engine.go b/ai/engine.go index 276b006..dde4ebe 100644 --- a/ai/engine.go +++ b/ai/engine.go @@ -11,8 +11,8 @@ import ( "regexp" "strings" - "github.com/ekkinox/yo/config" - "github.com/ekkinox/yo/system" + "github.com/ekkinox/yai/config" + "github.com/ekkinox/yai/system" "github.com/sashabaranov/go-openai" ) @@ -304,7 +304,7 @@ func (e *Engine) prepareSystemPrompt() string { } func (e *Engine) prepareSystemPromptExecPart() string { - return "Your are Yo, a powerful terminal assistant generating a JSON containing a command line for my input.\n" + + return "Your are Yai, a powerful terminal assistant generating a JSON containing a command line for my input.\n" + "You will always reply using the following json structure: {\"cmd\":\"the command\", \"exp\": \"some explanation\", \"exec\": true}.\n" + "Your answer will always only contain the json structure, never add any advice or supplementary detail or information, even if I asked the same question before.\n" + "The field cmd will contain a single line command (don't use new lines, use separators like && and ; instead).\n" + @@ -313,22 +313,22 @@ func (e *Engine) prepareSystemPromptExecPart() string { "\n" + "Examples:\n" + "Me: list all files in my home dir\n" + - "Yo: {\"cmd\":\"ls ~\", \"exp\": \"list all files in your home dir\", \"exec\\: true}\n" + + "Yai: {\"cmd\":\"ls ~\", \"exp\": \"list all files in your home dir\", \"exec\\: true}\n" + "Me: list all pods of all namespaces\n" + - "Yo: {\"cmd\":\"kubectl get pods --all-namespaces\", \"exp\": \"list pods form all k8s namespaces\", \"exec\": true}\n" + + "Yai: {\"cmd\":\"kubectl get pods --all-namespaces\", \"exp\": \"list pods form all k8s namespaces\", \"exec\": true}\n" + "Me: how are you ?\n" + - "Yo: {\"cmd\":\"\", \"exp\": \"I'm good thanks but I cannot generate a command for this. Use the chat mode to discuss.\", \"exec\": false}" + "Yai: {\"cmd\":\"\", \"exp\": \"I'm good thanks but I cannot generate a command for this. Use the chat mode to discuss.\", \"exec\": false}" } func (e *Engine) prepareSystemPromptChatPart() string { - return "You are Yo a powerful terminal assistant created by github.com/ekkinox.\n" + + return "You are Yai a powerful terminal assistant created by github.com/ekkinox.\n" + "You will answer in the most helpful possible way.\n" + "Always format your answer in markdown format.\n\n" + "For example:\n" + "Me: What is 2+2 ?\n" + - "Yo: The answer for `2+2` is `4`\n" + + "Yai: The answer for `2+2` is `4`\n" + "Me: +2 again ?\n" + - "Yo: The answer is `6`\n" + "Yai: The answer is `6`\n" } func (e *Engine) prepareSystemPromptContextPart() string { diff --git a/config/config.go b/config/config.go index 9a01122..00e8460 100644 --- a/config/config.go +++ b/config/config.go @@ -6,7 +6,7 @@ import ( "github.com/sashabaranov/go-openai" - "github.com/ekkinox/yo/system" + "github.com/ekkinox/yai/system" "github.com/spf13/viper" ) diff --git a/config/config_test.go b/config/config_test.go index aab0a04..21a3325 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -5,10 +5,9 @@ import ( "strings" "testing" - "github.com/sashabaranov/go-openai" - - "github.com/ekkinox/yo/system" + "github.com/ekkinox/yai/system" + "github.com/sashabaranov/go-openai" "github.com/spf13/viper" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/docs/_config.yml b/docs/_config.yml index e8f614c..f50cb88 100644 --- a/docs/_config.yml +++ b/docs/_config.yml @@ -1,9 +1,9 @@ -title: 🚀 Yo 💬 +title: 🚀 Yai 💬 title_separator: "|" email: ekkinox@gmail.com -repository: "ekkinox/yo" +repository: "ekkinox/yai" description: >- - Yo is an AI (artificial intelligence) powered terminal assistant. + Yai (your AI) is an artificial intelligence powered terminal assistant. Use it to prepare and execute any command lines from requests expressed in your natural language. You can also engage in conversation with it about any topics you may think about. Unleash the power of AI with the comfort of staying at /home ! diff --git a/docs/_data/navigation.yml b/docs/_data/navigation.yml index cf3d337..fdcdaf5 100644 --- a/docs/_data/navigation.yml +++ b/docs/_data/navigation.yml @@ -7,4 +7,4 @@ main: url: /examples/ - title: "GitHub" icon: "fab fa-fw fa-github" - url: https://github.com/ekkinox/yo \ No newline at end of file + url: https://github.com/ekkinox/yai \ No newline at end of file diff --git a/docs/_pages/404.md b/docs/_pages/404.md index de7467f..1799d87 100644 --- a/docs/_pages/404.md +++ b/docs/_pages/404.md @@ -1,8 +1,8 @@ --- title: "Page Not Found" -excerpt: "Yo, page not found. Your pixels are in another canvas." +excerpt: "Page not found. Your pixels are in another canvas." sitemap: false permalink: /404.html --- -Yo, the page you were trying to view does not exist. \ No newline at end of file +The page you were trying to view does not exist. \ No newline at end of file diff --git a/docs/_pages/examples.md b/docs/_pages/examples.md index 685e738..35dedec 100644 --- a/docs/_pages/examples.md +++ b/docs/_pages/examples.md @@ -4,42 +4,44 @@ classes: wide permalink: /examples/ --- +> The examples below use `yo` as command name, but it has been renamed meanwhile in `yai`. + ## CLI mode -`Yo` can be used in `CLI` mode to streamline your terminal workflow. +`Yai` can be used in `CLI` mode to streamline your terminal workflow. For example, this is how it can assist you while developing an application: -![](https://raw.githubusercontent.com/ekkinox/yo/main/docs/_assets/dev.gif) +![](https://raw.githubusercontent.com/ekkinox/yai/main/docs/_assets/dev.gif) You can also pipe any input and make it work with it: -![](https://raw.githubusercontent.com/ekkinox/yo/main/docs/_assets/pipe.gif) +![](https://raw.githubusercontent.com/ekkinox/yai/main/docs/_assets/pipe.gif) ## REPL mode -`Yo` can be used in `REPL` mode to offer interactive prompts and chain instructions. +`Yai` can be used in `REPL` mode to offer interactive prompts and chain instructions. ### Command lines An example on how it can help you to manage your system: -![](https://raw.githubusercontent.com/ekkinox/yo/main/docs/_assets/system.gif) +![](https://raw.githubusercontent.com/ekkinox/yai/main/docs/_assets/system.gif) Or help you to manage your packages: -![](https://raw.githubusercontent.com/ekkinox/yo/main/docs/_assets/pkg.gif) +![](https://raw.githubusercontent.com/ekkinox/yai/main/docs/_assets/pkg.gif) It can also go way further, for example help you to manage docker resources: -![](https://raw.githubusercontent.com/ekkinox/yo/main/docs/_assets/docker.gif) +![](https://raw.githubusercontent.com/ekkinox/yai/main/docs/_assets/docker.gif) Or even help you while using a k8s cluster: -![](https://raw.githubusercontent.com/ekkinox/yo/main/docs/_assets/k8s.gif) +![](https://raw.githubusercontent.com/ekkinox/yai/main/docs/_assets/k8s.gif) ### Chat -`Yo` is not made to just generate command lines. You can also engage in a discussion with it about any topics. +`Yai` is not made to just generate command lines. You can also engage in a discussion with it about any topics. -![](https://raw.githubusercontent.com/ekkinox/yo/main/docs/_assets/chat.gif) \ No newline at end of file +![](https://raw.githubusercontent.com/ekkinox/yai/main/docs/_assets/chat.gif) \ No newline at end of file diff --git a/docs/_pages/getting-started.md b/docs/_pages/getting-started.md index 972b298..d42fbe7 100644 --- a/docs/_pages/getting-started.md +++ b/docs/_pages/getting-started.md @@ -4,9 +4,9 @@ classes: wide permalink: /getting-started/ --- -## What is `Yo` ? +## What is `Yai` ? -`Yo` is an assistant for your terminal, unleashing the power of artificial intelligence to streamline your command line experience. +`Yai` (your AI) is an assistant for your terminal, unleashing the power of artificial intelligence to streamline your command line experience. It is already aware of your: - operating system & distribution @@ -17,23 +17,23 @@ And you can also give any supplementary preferences to fine tune your experience ## Installation -To install `Yo`, simply run: +To install `Yai`, simply run: ```shell -curl -sS https://raw.githubusercontent.com/ekkinox/yo/main/install.sh | bash +curl -sS https://raw.githubusercontent.com/ekkinox/yai/main/install.sh | bash ``` - this will detect the proper binary to install for your machine - and upgrade to the latest stable version if already installed -You can also install it from the [available releases](https://github.com/ekkinox/yo/releases) from the GitHub repository. +You can also install it from the [available releases](https://github.com/ekkinox/yai/releases) from the GitHub repository. ## Configuration -At first run, `Yo` will ask you to provide an [OpenAI API key](https://platform.openai.com/account/api-keys) (required to interact with **ChatGPT AI**). +At first run, `Yai` will ask you to provide an [OpenAI API key](https://platform.openai.com/account/api-keys) (required to interact with **ChatGPT AI**). -It will then generate your configuration in the file `~/.config/yo.json`, with the following structure: +It will then generate your configuration in the file `~/.config/yai.json`, with the following structure: ```json { @@ -49,7 +49,7 @@ It will then generate your configuration in the file `~/.config/yo.json`, with t ## Fine tuning -You can fine tune `Yo` by editing the settings in the `~/.config/yo.json` configuration file. +You can fine tune `Yai` by editing the settings in the `~/.config/yai.json` configuration file. Note that in `REPL` mode, you can press anytime `ctrl+s` to edit settings: - it will open your editor on the configuration file @@ -77,4 +77,4 @@ You can use the `user_preferences` to express any preferences in your natural la } ``` -`Yo` will take them into account. \ No newline at end of file +`Yai` will take them into account. \ No newline at end of file diff --git a/docs/_pages/usage.md b/docs/_pages/usage.md index 4cd981f..060e14f 100644 --- a/docs/_pages/usage.md +++ b/docs/_pages/usage.md @@ -11,31 +11,31 @@ permalink: /usage/ You can perform a single run: ```shell -yo list all processes listening on port 8080 +yai list all processes listening on port 8080 ``` You can ask for a command line generation, enforcing `🚀 exec` prompt mode usage with `-e`: ```shell -yo -e show the disk usage of my docker resources +yai -e show the disk usage of my docker resources ``` You can ask any question, enforcing `💬 chat` prompt mode usage with `-c`: ```shell -yo -c generate me a go application example using fiber +yai -c generate me a go application example using fiber ``` You can also `pipe` input that will be taken into account in your request: ```shell -cat some_script.go | yo -c generate unit tests +cat some_script.go | yai -c generate unit tests ``` Or even: ```shell -cat error.log | yo -c explain what is wrong here +cat error.log | yai -c explain what is wrong here ``` ## REPL mode @@ -45,7 +45,7 @@ cat error.log | yo -c explain what is wrong here Just run: ```shell -yo +yai ``` This will open a [REPL](https://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop) interface, with 2 types of prompts (use `tab` to switch) diff --git a/docs/index.md b/docs/index.md index 9f56bfe..b323035 100644 --- a/docs/index.md +++ b/docs/index.md @@ -3,15 +3,15 @@ layout: splash classes: wide --- -## `Yo` - AI powered terminal assistant +## `Yai` - AI powered terminal assistant -> Unleash the power of artificial intelligence to streamline your command line experience. +> With `Yai` (your AI), unleash the power of artificial intelligence to streamline your command line experience. -![](https://raw.githubusercontent.com/ekkinox/yo/main/docs/_assets/intro.gif) +![](https://raw.githubusercontent.com/ekkinox/yai/main/docs/_assets/intro.gif) Just type your request in everyday language, and it will determine the appropriate command line action to take, or engage in conversation on any topics you have in mind. -With `Yo`, you get the power of [OpenAI ChatGPT](https://chat.openai.com/) with the comfort of staying at `/home`! +With `Yai`, you get the power of [OpenAI ChatGPT](https://chat.openai.com/) with the comfort of staying at `/home`! -See the project on [GitHub](https://github.com/ekkinox/yo). +See the project on [GitHub](https://github.com/ekkinox/yai). diff --git a/go.mod b/go.mod index f545ef2..1018673 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/ekkinox/yo +module github.com/ekkinox/yai go 1.19 diff --git a/install.sh b/install.sh index d50d53e..82d1994 100644 --- a/install.sh +++ b/install.sh @@ -1,7 +1,7 @@ #!/bin/bash REPOOWNER="ekkinox" -REPONAME="yo" +REPONAME="yai" RELEASETAG=$(curl -s "https://api.github.com/repos/$REPOOWNER/$REPONAME/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/') KERNEL=$(uname -s 2>/dev/null || /usr/bin/uname -s) @@ -42,18 +42,18 @@ case ${MACHINE} in ;; esac -BINNAME="${BINNAME:-yo}" +BINNAME="${BINNAME:-yai}" BINDIR="${BINDIR:-/usr/local/bin}" -URL="https://github.com/$REPOOWNER/$REPONAME/releases/download/${RELEASETAG}/yo_${RELEASETAG}_${KERNEL}_${MACHINE}.tar.gz" +URL="https://github.com/$REPOOWNER/$REPONAME/releases/download/${RELEASETAG}/yai_${RELEASETAG}_${KERNEL}_${MACHINE}.tar.gz" echo "Downloading version $RELEASETAG from $URL" echo -curl -q --fail --location --progress-bar --output "yo_${RELEASETAG}_${KERNEL}_${MACHINE}.tar.gz" "$URL" -tar xzf "yo_${RELEASETAG}_${KERNEL}_${MACHINE}.tar.gz" +curl -q --fail --location --progress-bar --output "yai_${RELEASETAG}_${KERNEL}_${MACHINE}.tar.gz" "$URL" +tar xzf "yai_${RELEASETAG}_${KERNEL}_${MACHINE}.tar.gz" chmod +x $BINNAME sudo mv $BINNAME $BINDIR/$BINNAME -rm "yo_${RELEASETAG}_${KERNEL}_${MACHINE}.tar.gz" +rm "yai_${RELEASETAG}_${KERNEL}_${MACHINE}.tar.gz" echo echo "Installation of version $RELEASETAG complete!" \ No newline at end of file diff --git a/main.go b/main.go index ffc24d5..1383f41 100644 --- a/main.go +++ b/main.go @@ -5,7 +5,7 @@ import ( "math/rand" "time" - "github.com/ekkinox/yo/ui" + "github.com/ekkinox/yai/ui" tea "github.com/charmbracelet/bubbletea" ) diff --git a/system/analyzer.go b/system/analyzer.go index 3a78432..1e00cd9 100644 --- a/system/analyzer.go +++ b/system/analyzer.go @@ -6,12 +6,12 @@ import ( "runtime" "strings" - "github.com/ekkinox/yo/run" + "github.com/ekkinox/yai/run" "github.com/mitchellh/go-homedir" ) -const APPLICATION_NAME = "Yo" +const APPLICATION_NAME = "Yai" type Analysis struct { operatingSystem OperatingSystem diff --git a/ui/renderer.go b/ui/renderer.go index 2eb5e07..2004bd8 100644 --- a/ui/renderer.go +++ b/ui/renderer.go @@ -66,7 +66,7 @@ func (r *Renderer) RenderHelp(in string) string { } func (r *Renderer) RenderConfigMessage() string { - welcome := "Yo, welcome! 👋 \n\n" + welcome := "Welcome! 👋 \n\n" welcome += "I cannot find a configuration file, please enter an `OpenAI API key` " welcome += "from https://platform.openai.com/account/api-keys so I can generate it for you." diff --git a/ui/ui.go b/ui/ui.go index 428fb47..48bb1bd 100644 --- a/ui/ui.go +++ b/ui/ui.go @@ -4,10 +4,10 @@ import ( "fmt" "strings" - "github.com/ekkinox/yo/ai" - "github.com/ekkinox/yo/config" - "github.com/ekkinox/yo/history" - "github.com/ekkinox/yo/run" + "github.com/ekkinox/yai/ai" + "github.com/ekkinox/yai/config" + "github.com/ekkinox/yai/history" + "github.com/ekkinox/yai/run" "github.com/charmbracelet/bubbles/spinner" "github.com/charmbracelet/bubbles/textinput" From c7c7e20a896622c90f00b717a6151465d579f19f Mon Sep 17 00:00:00 2001 From: Jonathan Vuillemin Date: Tue, 25 Apr 2023 09:56:14 +0200 Subject: [PATCH 2/2] feat: rename in yai --- config/config_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/config_test.go b/config/config_test.go index 21a3325..0154a52 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -32,12 +32,12 @@ func setupViper(t *testing.T) { viper.Set(user_default_prompt_mode, "exec") viper.Set(user_preferences, "test_preferences") - require.NoError(t, viper.SafeWriteConfigAs("/tmp/yo.json")) + require.NoError(t, viper.SafeWriteConfigAs("/tmp/yai.json")) } func cleanup(t *testing.T) { t.Helper() - require.NoError(t, os.Remove("/tmp/yo.json")) + require.NoError(t, os.Remove("/tmp/yai.json")) } func testNewConfig(t *testing.T) {