#!/bin/bash # KirinCode CLI Installer for Testers set -e RED='\033[0;31m' GOLD='\033[0;33m' BOLD='\033[1m' NC='\033[0m' echo -e "${RED}${BOLD}" echo " █▀▀▄ █▀▀█ █▀▀▄ █▀▀█ █▀▀█ █▀▀█ █▀▀▄ █▀▀█" echo " █▄▄▀ █ █ █▄▄▀ █ █ █▄▄▀ █ █ █ █ █▀▀▀" echo " █ █ █▀▀▀ █ █ █▀▀▀ █ █ █▀▀▀ █▀▀▀ ▀▀▀▀ CLI" echo -e "${GOLD} 开邻Claw — AI 编码代理${NC}" echo "" if ! command -v bun &>/dev/null; then echo -e "${GOLD}Installing Bun...${NC}" curl -fsSL https://bun.sh/install | bash export PATH="$HOME/.bun/bin:$PATH" fi echo -e "${GOLD}Bun:${NC} $(bun --version)" TMPDIR=$(mktemp -d) cd "$TMPDIR" echo -e "${GOLD}Downloading KirinCode CLI...${NC}" curl -fsSL -o kirincode.tgz "https://github.com/kirincode/kirincode/releases/latest/download/kirincode-cli-$(uname -s | tr '[:upper:]' '[:lower:]')-$(uname -m | sed 's/x86_64/x64/;s/arm64/arm64/;s/aarch64/arm64/').tar.gz" 2>/dev/null && { tar xzf kirincode.tgz INSTALL_DIR="${KIRINCODE_INSTALL_DIR:-$HOME/.kirincode/bin}" mkdir -p "$INSTALL_DIR" cp kirincode "$INSTALL_DIR/" chmod +x "$INSTALL_DIR/kirincode" } || { echo -e "${GOLD}Binary not available. Installing from source via Bun...${NC}" bun install -g kirincode-ai 2>/dev/null || { echo "Direct install not available. Please clone the repo:" echo " git clone https://github.com/kirincode/kirincode" echo " cd kirincode && bun install" echo " alias kirincode='bun run packages/kirincode/src/index.ts'" exit 1 } INSTALL_DIR="$HOME/.bun/bin" } echo "" echo -e "${RED}${BOLD}KirinCode CLI installed!${NC}" echo "" echo " Add to your shell profile:" echo -e " ${GOLD}export PATH=\"$INSTALL_DIR:\$PATH\"${NC}" echo "" echo " Quick start:" echo " cd your-project" echo " kirincode" echo " /init # analyze project" echo " /memory # view auto-memory" echo " /skill # manage skills" echo " /workflow # manage workflows" rm -rf "$TMPDIR"