Skip to content

Commit 6a320e9

Browse files
committed
update readme
1 parent 92edd3a commit 6a320e9

File tree

11 files changed

+272
-34
lines changed

11 files changed

+272
-34
lines changed

README.md

Lines changed: 46 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,90 @@
11
# SHAI
22

3+
shai is a coding agent, your pair programming buddy that lives in the terminal. Written in rust with love <3
4+
5+
![Shai CLI Screenshot](./docs/assets/shai.png)
6+
7+
## Install
8+
9+
Install the latest release with the following command:
10+
311
```
4-
███╗ ███████╗██╗ ██╗ █████╗ ██╗
5-
╚═███╗ ██╔════╝██║ ██║██╔══██╗██║
6-
╚═███ ███████╗███████║███████║██║
7-
███╔═╝ ╚════██║██╔══██║██╔══██║██║
8-
███╔═╝ ███████║██║ ██║██║ ██║██║
9-
╚══╝ ╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝
10-
version: 0.0.1
12+
curl -fsSL https://raw.githubusercontent.com/ovh/shai/main/install.sh | sh
1113
```
1214

13-
shai is a coding agent, your pair programming buddy that lives in the terminal. Written in rust with love <3
15+
the `shai` binary will be installed in `$HOME/.local/bin`
1416

15-
<img src="./.github/demo.gif" />
1617

18+
## Configure a provider and Run!
1719

18-
## Build
20+
By default `shai` uses OVHcloud as an anonymous user meaning you will be rate limited! If you want to sign in with your account or select another provider, run:
1921

20-
Simply build the project with `cargo`
22+
```
23+
shai auth
24+
```
25+
26+
![shai auth](./docs/assets/auth.gif)
27+
28+
Once you have a provider set up, you can run shai:
2129

2230
```
23-
$ cargo build --release
31+
shai
2432
```
2533

26-
## Login to an LLM provider
34+
![shai](./docs/assets/shai-hello-world.gif)
35+
36+
## Run Headless
2737

28-
By default it uses OVHcloud as an anonymous user meaning you will be rate limited!
29-
If you want to sign in with your account or select another provider, run `shai auth`:
38+
Shai can also run in headless mode without user interface. In that case simply pipe a prompt into shai, it will stream event in the stderr:
3039

3140
```
32-
$ shai auth
41+
echo "make me a hello world in main.py" | shai
3342
```
3443

35-
## Run TUI
44+
![shai headless](./docs/assets/shai-headless.gif)
45+
46+
you can also instruct shai to return the entire conversation as a trace once it is done:
3647

3748
```
38-
$ shai
49+
echo "make me a hello world in main.py" | shai 2>/dev/null --trace
3950
```
4051

52+
![shai headless](./docs/assets/shai-trace.gif)
4153

42-
## Run Headless
54+
this is handy because you can chain `shai` calls:
4355

4456
```
45-
$ echo "make me a hello world in main.py" | shai
57+
echo "make me a hello world in main.py" | shai --trace | shai "now run it!"
4658
```
4759

60+
![shai headless](./docs/assets/shai-chain.gif)
61+
4862
## shell assistant
4963

50-
shai can assist you when you miswrite commands and will propose you a fix. This works by injecting command hook while monitoring your terminal output. Your last terminal output along with the last command and error code will be sent for analysis to the llm provider.
51-
To start hooking your shell with shai simply type:
64+
shai can also act as a shell assistant in case a command failed and will propose you a fix. This works by injecting command hook while monitoring your terminal output. Your last terminal output along with the last command and error code will be sent for analysis to the llm provider. To start hooking your shell with shai simply type:
5265

5366
```
5467
$ shai on
5568
```
5669

5770
for instance:
5871

72+
![Shai CLI Screenshot](./docs/assets/shai-shell.png)
73+
74+
To stop shai from monitoring your shell you can type:
75+
76+
```
77+
$ shai off
5978
```
60-
❯ weather tomorrow for Paris
61-
zsh: command not found: weather
6279

63-
The 'weather' command is not installed. You can use 'curl' to fetch weather data from wttr.in.
80+
## Build The Project
6481

65-
❯ curl wttr.in/Paris?1
82+
Simply build the project with `cargo`
6683

67-
↵ Run • Esc / Ctrl+C Cancel
6884
```
85+
git clone [email protected]:ovh/shai.git
6986
70-
To stop shai from monitoring your shell you can type:
87+
cd shai
7188
89+
cargo build --release
7290
```
73-
$ shai off
74-
```

docs/assets/auth.gif

534 KB
Loading

docs/assets/shai-chain.gif

1.03 MB
Loading

docs/assets/shai-headless.gif

234 KB
Loading

docs/assets/shai-hello-world.gif

488 KB
Loading

docs/assets/shai-shell.png

182 KB
Loading

docs/assets/shai-trace.gif

735 KB
Loading

docs/assets/shai.png

171 KB
Loading

install.sh

Lines changed: 222 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,222 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
# Configuration
6+
REPO="ovh/shai"
7+
BINARY_NAME="shai"
8+
INSTALL_DIR="$HOME/.local/bin"
9+
10+
# Colors for output
11+
RED='\033[0;31m'
12+
GREEN='\033[0;32m'
13+
YELLOW='\033[1;33m'
14+
BLUE='\033[0;34m'
15+
NC='\033[0m' # No Color
16+
17+
# Helper functions
18+
log_info() {
19+
echo -e "${BLUE}[INFO]${NC} $1"
20+
}
21+
22+
log_success() {
23+
echo -e "${GREEN}[SUCCESS]${NC} $1"
24+
}
25+
26+
log_warn() {
27+
echo -e "${YELLOW}[WARN]${NC} $1"
28+
}
29+
30+
log_error() {
31+
echo -e "${RED}[ERROR]${NC} $1"
32+
}
33+
34+
# Detect OS and architecture
35+
detect_platform() {
36+
local os arch platform
37+
38+
# Detect OS
39+
case "$(uname -s)" in
40+
Linux*) os="linux" ;;
41+
Darwin*) os="macos" ;;
42+
CYGWIN*|MINGW*|MSYS*) os="windows" ;;
43+
*)
44+
log_error "Unsupported OS: $(uname -s)"
45+
exit 1
46+
;;
47+
esac
48+
49+
# Detect architecture
50+
case "$(uname -m)" in
51+
x86_64|amd64) arch="x86_64" ;;
52+
arm64|aarch64) arch="aarch64" ;;
53+
*)
54+
log_error "Unsupported architecture: $(uname -m)"
55+
exit 1
56+
;;
57+
esac
58+
59+
# Special handling for macOS (only x86_64 and aarch64 available)
60+
if [ "$os" = "macos" ]; then
61+
if [ "$arch" = "x86_64" ]; then
62+
platform="${BINARY_NAME}-macos-x86_64"
63+
elif [ "$arch" = "aarch64" ]; then
64+
platform="${BINARY_NAME}-macos-aarch64"
65+
fi
66+
elif [ "$os" = "linux" ]; then
67+
platform="${BINARY_NAME}-linux-x86_64"
68+
elif [ "$os" = "windows" ]; then
69+
platform="${BINARY_NAME}-windows-x86_64.exe"
70+
BINARY_NAME="${BINARY_NAME}.exe"
71+
fi
72+
73+
echo "$platform"
74+
}
75+
76+
# Get latest release info from GitHub API
77+
get_latest_release() {
78+
local api_url="https://api.github.com/repos/$REPO/releases/latest"
79+
80+
log_info "Fetching latest release information..."
81+
82+
# Try with curl first, then wget
83+
if command -v curl >/dev/null 2>&1; then
84+
curl -s "$api_url"
85+
elif command -v wget >/dev/null 2>&1; then
86+
wget -qO- "$api_url"
87+
else
88+
log_error "Neither curl nor wget is available. Please install one of them."
89+
exit 1
90+
fi
91+
}
92+
93+
# Download binary
94+
download_binary() {
95+
local download_url="$1"
96+
local output_file="$2"
97+
98+
log_info "Downloading $BINARY_NAME from $download_url"
99+
100+
if command -v curl >/dev/null 2>&1; then
101+
curl -L -o "$output_file" "$download_url"
102+
elif command -v wget >/dev/null 2>&1; then
103+
wget -O "$output_file" "$download_url"
104+
else
105+
log_error "Neither curl nor wget is available"
106+
exit 1
107+
fi
108+
}
109+
110+
# Create install directory
111+
create_install_dir() {
112+
if [ ! -d "$INSTALL_DIR" ]; then
113+
log_info "Creating install directory: $INSTALL_DIR"
114+
mkdir -p "$INSTALL_DIR"
115+
fi
116+
}
117+
118+
# Add to PATH if not already there
119+
update_path() {
120+
local shell_profile=""
121+
122+
# Detect shell profile
123+
if [ -n "$ZSH_VERSION" ]; then
124+
shell_profile="$HOME/.zshrc"
125+
elif [ -n "$BASH_VERSION" ]; then
126+
if [ -f "$HOME/.bash_profile" ]; then
127+
shell_profile="$HOME/.bash_profile"
128+
else
129+
shell_profile="$HOME/.bashrc"
130+
fi
131+
fi
132+
133+
# Check if directory is already in PATH
134+
if [[ ":$PATH:" != *":$INSTALL_DIR:"* ]]; then
135+
if [ -n "$shell_profile" ] && [ -f "$shell_profile" ]; then
136+
echo "export PATH=\"\$PATH:$INSTALL_DIR\"" >> "$shell_profile"
137+
log_success "Added $INSTALL_DIR to PATH in $shell_profile"
138+
log_warn "Please run 'source $shell_profile' or restart your terminal"
139+
else
140+
log_warn "Could not automatically add to PATH. Please add $INSTALL_DIR to your PATH manually"
141+
fi
142+
fi
143+
}
144+
145+
# Main installation function
146+
main() {
147+
log_info "Installing $BINARY_NAME..."
148+
149+
# Detect platform
150+
local platform
151+
platform=$(detect_platform)
152+
log_info "Detected platform: $platform"
153+
154+
# Get latest release
155+
local release_json
156+
release_json=$(get_latest_release)
157+
158+
if [ -z "$release_json" ]; then
159+
log_error "Failed to fetch release information"
160+
exit 1
161+
fi
162+
163+
# Extract download URL
164+
local download_url
165+
download_url=$(echo "$release_json" | grep -o "\"browser_download_url\":[[:space:]]*\"[^\"]*$platform[^\"]*\"" | cut -d'"' -f4)
166+
167+
if [ -z "$download_url" ]; then
168+
log_error "Could not find download URL for platform: $platform"
169+
log_error "Available assets:"
170+
echo "$release_json" | grep -o "\"name\":[[:space:]]*\"[^\"]*\"" | cut -d'"' -f4
171+
exit 1
172+
fi
173+
174+
# Create install directory
175+
create_install_dir
176+
177+
# Download binary
178+
local temp_file="/tmp/$platform"
179+
download_binary "$download_url" "$temp_file"
180+
181+
# Install binary
182+
local install_path="$INSTALL_DIR/$BINARY_NAME"
183+
mv "$temp_file" "$install_path"
184+
chmod +x "$install_path"
185+
186+
log_success "$BINARY_NAME installed to $install_path"
187+
188+
# Update PATH
189+
update_path
190+
191+
# Verify installation
192+
if command -v "$BINARY_NAME" >/dev/null 2>&1; then
193+
log_success "Installation completed! You can now run '$BINARY_NAME'"
194+
else
195+
log_success "Installation completed! You can run '$install_path' or add $INSTALL_DIR to your PATH"
196+
fi
197+
}
198+
199+
# Parse command line arguments
200+
while [[ $# -gt 0 ]]; do
201+
case $1 in
202+
--install-dir)
203+
INSTALL_DIR="$2"
204+
shift 2
205+
;;
206+
--help)
207+
echo "Usage: $0 [--install-dir DIR] [--help]"
208+
echo ""
209+
echo "Options:"
210+
echo " --install-dir DIR Install to DIR (default: $HOME/.local/bin)"
211+
echo " --help Show this help message"
212+
exit 0
213+
;;
214+
*)
215+
log_error "Unknown option: $1"
216+
exit 1
217+
;;
218+
esac
219+
done
220+
221+
# Run main function
222+
main

shai-cli/src/tui/theme.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ pub static SHAI_LOGO: &str = r#"
77
███╔═╝ ╚════██║██╔══██║██╔══██║██║
88
███╔═╝ ███████║██║ ██║██║ ██║██║
99
╚══╝ ╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝
10-
version: 0.0.1
10+
version: 0.1.0
1111
"#;
1212

1313
pub static SHAI_YELLOW: (u8, u8, u8) = (249,188,81);

0 commit comments

Comments
 (0)