mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-09-24 16:02:55 +08:00
Merge pull request #266 from Kilo-Org/feat/install-kilo-script
feat: apply Kilo branding to install script
This commit is contained in:
@@ -1,17 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
APP=opencode
|
||||
APP=kilo # kilocode_change
|
||||
|
||||
MUTED='\033[0;2m'
|
||||
RED='\033[0;31m'
|
||||
ORANGE='\033[38;5;214m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
# kilocode_change start - usage text
|
||||
usage() {
|
||||
cat <<EOF
|
||||
OpenCode Installer
|
||||
Kilo Code Installer
|
||||
|
||||
Usage: install.sh [options]
|
||||
Usage: install [options]
|
||||
|
||||
Options:
|
||||
-h, --help Display this help message
|
||||
@@ -20,11 +21,12 @@ Options:
|
||||
--no-modify-path Don't modify shell config files (.zshrc, .bashrc, etc.)
|
||||
|
||||
Examples:
|
||||
curl -fsSL https://opencode.ai/install | bash
|
||||
curl -fsSL https://opencode.ai/install | bash -s -- --version 1.0.180
|
||||
./install --binary /path/to/opencode
|
||||
curl -fsSL https://kilo.ai/cli/install | bash
|
||||
curl -fsSL https://kilo.ai/cli/install | bash -s -- --version 1.0.180
|
||||
./install --binary /path/to/kilo
|
||||
EOF
|
||||
}
|
||||
# kilocode_change end
|
||||
|
||||
requested_version=${VERSION:-}
|
||||
no_modify_path=false
|
||||
@@ -65,7 +67,7 @@ while [[ $# -gt 0 ]]; do
|
||||
esac
|
||||
done
|
||||
|
||||
INSTALL_DIR=$HOME/.opencode/bin
|
||||
INSTALL_DIR=$HOME/.kilo/bin # kilocode_change
|
||||
mkdir -p "$INSTALL_DIR"
|
||||
|
||||
# If --binary is provided, skip all download/detection logic
|
||||
@@ -204,12 +206,13 @@ print_message() {
|
||||
echo -e "${color}${message}${NC}"
|
||||
}
|
||||
|
||||
# kilocode_change start
|
||||
check_version() {
|
||||
if command -v opencode >/dev/null 2>&1; then
|
||||
opencode_path=$(which opencode)
|
||||
if command -v kilo >/dev/null 2>&1; then
|
||||
kilo_path=$(which kilo)
|
||||
|
||||
## Check the installed version
|
||||
installed_version=$(opencode --version 2>/dev/null || echo "")
|
||||
installed_version=$(kilo --version 2>/dev/null || echo "")
|
||||
|
||||
if [[ "$installed_version" != "$specific_version" ]]; then
|
||||
print_message info "${MUTED}Installed version: ${NC}$installed_version."
|
||||
@@ -219,6 +222,7 @@ check_version() {
|
||||
fi
|
||||
fi
|
||||
}
|
||||
# kilocode_change end
|
||||
|
||||
unbuffered_sed() {
|
||||
if echo | sed -u -e "" >/dev/null 2>&1; then
|
||||
@@ -261,7 +265,7 @@ download_with_progress() {
|
||||
fi
|
||||
|
||||
local tmp_dir=${TMPDIR:-/tmp}
|
||||
local basename="${tmp_dir}/opencode_install_$$"
|
||||
local basename="${tmp_dir}/kilo_install_$$" # kilocode_change
|
||||
local tracefile="${basename}.trace"
|
||||
|
||||
rm -f "$tracefile"
|
||||
@@ -273,7 +277,7 @@ download_with_progress() {
|
||||
trap "trap - RETURN; rm -f \"$tracefile\"; printf '\033[?25h' >&4; exec 4>&-" RETURN
|
||||
|
||||
(
|
||||
curl --trace-ascii "$tracefile" -s -L -o "$output" "$url"
|
||||
curl --trace-ascii "$tracefile" -fsL -o "$output" "$url" # kilocode_change
|
||||
) &
|
||||
local curl_pid=$!
|
||||
|
||||
@@ -311,13 +315,15 @@ download_with_progress() {
|
||||
}
|
||||
|
||||
download_and_install() {
|
||||
print_message info "\n${MUTED}Installing ${NC}opencode ${MUTED}version: ${NC}$specific_version"
|
||||
local tmp_dir="${TMPDIR:-/tmp}/opencode_install_$$"
|
||||
# kilocode_change start
|
||||
print_message info "\n${MUTED}Installing ${NC}Kilo Code ${MUTED}version: ${NC}$specific_version"
|
||||
local tmp_dir="${TMPDIR:-/tmp}/kilo_install_$$"
|
||||
# kilocode_change end
|
||||
mkdir -p "$tmp_dir"
|
||||
|
||||
if [[ "$os" == "windows" ]] || ! [ -t 2 ] || ! download_with_progress "$url" "$tmp_dir/$filename"; then
|
||||
# Fallback to standard curl on Windows, non-TTY environments, or if custom progress fails
|
||||
curl -# -L -o "$tmp_dir/$filename" "$url"
|
||||
curl -f# -L -o "$tmp_dir/$filename" "$url" # kilocode_change
|
||||
fi
|
||||
|
||||
if [ "$os" = "linux" ]; then
|
||||
@@ -326,15 +332,19 @@ download_and_install() {
|
||||
unzip -q "$tmp_dir/$filename" -d "$tmp_dir"
|
||||
fi
|
||||
|
||||
mv "$tmp_dir/opencode" "$INSTALL_DIR"
|
||||
chmod 755 "${INSTALL_DIR}/opencode"
|
||||
# kilocode_change start
|
||||
mv "$tmp_dir/kilo" "$INSTALL_DIR"
|
||||
chmod 755 "${INSTALL_DIR}/kilo"
|
||||
# kilocode_change end
|
||||
rm -rf "$tmp_dir"
|
||||
}
|
||||
|
||||
install_from_binary() {
|
||||
print_message info "\n${MUTED}Installing ${NC}opencode ${MUTED}from: ${NC}$binary_path"
|
||||
cp "$binary_path" "${INSTALL_DIR}/opencode"
|
||||
chmod 755 "${INSTALL_DIR}/opencode"
|
||||
# kilocode_change start
|
||||
print_message info "\n${MUTED}Installing ${NC}Kilo Code ${MUTED}from: ${NC}$binary_path"
|
||||
cp "$binary_path" "${INSTALL_DIR}/kilo"
|
||||
chmod 755 "${INSTALL_DIR}/kilo"
|
||||
# kilocode_change end
|
||||
}
|
||||
|
||||
if [ -n "$binary_path" ]; then
|
||||
@@ -352,9 +362,9 @@ add_to_path() {
|
||||
if grep -Fxq "$command" "$config_file"; then
|
||||
print_message info "Command already exists in $config_file, skipping write."
|
||||
elif [[ -w $config_file ]]; then
|
||||
echo -e "\n# opencode" >> "$config_file"
|
||||
echo -e "\n# kilo" >> "$config_file" # kilocode_change
|
||||
echo "$command" >> "$config_file"
|
||||
print_message info "${MUTED}Successfully added ${NC}opencode ${MUTED}to \$PATH in ${NC}$config_file"
|
||||
print_message info "${MUTED}Successfully added ${NC}kilo ${MUTED}to \$PATH in ${NC}$config_file" # kilocode_change
|
||||
else
|
||||
print_message warning "Manually add the directory to $config_file (or similar):"
|
||||
print_message info " $command"
|
||||
@@ -429,18 +439,19 @@ if [ -n "${GITHUB_ACTIONS-}" ] && [ "${GITHUB_ACTIONS}" == "true" ]; then
|
||||
print_message info "Added $INSTALL_DIR to \$GITHUB_PATH"
|
||||
fi
|
||||
|
||||
# kilocode_change start
|
||||
echo -e ""
|
||||
echo -e "${MUTED} ${NC} ▄ "
|
||||
echo -e "${MUTED}█▀▀█ █▀▀█ █▀▀█ █▀▀▄ ${NC}█▀▀▀ █▀▀█ █▀▀█ █▀▀█"
|
||||
echo -e "${MUTED}█░░█ █░░█ █▀▀▀ █░░█ ${NC}█░░░ █░░█ █░░█ █▀▀▀"
|
||||
echo -e "${MUTED}▀▀▀▀ █▀▀▀ ▀▀▀▀ ▀ ▀ ${NC}▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀"
|
||||
echo -e "██ ▄█▀ ██ ██ ▄████▄ ▄█████ ██ ██ "
|
||||
echo -e "████ ██ ██ ██ ██ ██ ██ ██ "
|
||||
echo -e "██ ▀█▄ ██ ██████ ▀████▀ ▀█████ ██████ ██ "
|
||||
echo -e ""
|
||||
echo -e ""
|
||||
echo -e "${MUTED}OpenCode includes free models, to start:${NC}"
|
||||
echo -e "${MUTED}Kilo includes free models so you can start immediately:${NC}"
|
||||
echo -e ""
|
||||
echo -e "cd <project> ${MUTED}# Open directory${NC}"
|
||||
echo -e "opencode ${MUTED}# Run command${NC}"
|
||||
echo -e "kilo ${MUTED}# Run Kilo${NC}"
|
||||
echo -e ""
|
||||
echo -e "${MUTED}For more information visit ${NC}https://opencode.ai/docs"
|
||||
echo -e "${MUTED}For more information visit ${NC}https://kilo.ai/docs"
|
||||
echo -e ""
|
||||
echo -e ""
|
||||
# kilocode_change end
|
||||
|
||||
Reference in New Issue
Block a user