feat: sync .config dotfiles, transition Node to mise, integrate 1Password CLI/SSH Agent, and add optional AI CLI tools
This commit is contained in:
+196
-6
@@ -143,11 +143,48 @@ backup_configs() {
|
||||
[ -d ~/.config/btop ] && cp -r ~/.config/btop "$BACKUP_DIR/"
|
||||
[ -d ~/.config/htop ] && cp -r ~/.config/htop "$BACKUP_DIR/"
|
||||
[ -d ~/.config/yabai ] && cp -r ~/.config/yabai "$BACKUP_DIR/"
|
||||
[ -d ~/.config/mise ] && cp -r ~/.config/mise "$BACKUP_DIR/"
|
||||
[ -f ~/.config/starship.toml ] && cp ~/.config/starship.toml "$BACKUP_DIR/"
|
||||
[ -f ~/.tmux.conf ] && cp ~/.tmux.conf "$BACKUP_DIR/"
|
||||
[ -d ~/.config/tmux ] && cp -r ~/.config/tmux "$BACKUP_DIR/"
|
||||
|
||||
log "Backup created: $BACKUP_DIR"
|
||||
}
|
||||
|
||||
install_1password_cli() {
|
||||
log "Installing 1Password CLI..."
|
||||
|
||||
if command -v op &> /dev/null; then
|
||||
log "1Password CLI is already installed."
|
||||
return
|
||||
fi
|
||||
|
||||
case $OS in
|
||||
"macos")
|
||||
install_cask 1password-cli
|
||||
;;
|
||||
"arch")
|
||||
if command -v yay &> /dev/null; then
|
||||
yay -S --noconfirm 1password-cli
|
||||
else
|
||||
sudo pacman -S --noconfirm 1password-cli
|
||||
fi
|
||||
;;
|
||||
"debian")
|
||||
log "Configuring APT repository for 1Password..."
|
||||
curl -sS https://downloads.1password.com/linux/keys/1password.asc | sudo gpg --dearmor --output /usr/share/keyrings/1password-archive-keyring.gpg
|
||||
echo 'deb [arch=amd64 signed-by=/usr/share/keyrings/1password-archive-keyring.gpg] https://downloads.1password.com/linux/debian/amd64 stable main' | sudo tee /etc/apt/sources.list.d/1password.list
|
||||
sudo apt update && sudo apt install -y 1password-cli
|
||||
;;
|
||||
"fedora")
|
||||
log "Configuring DNF repository for 1Password..."
|
||||
sudo rpm --import https://downloads.1password.com/linux/keys/1password.asc
|
||||
sudo sh -c 'echo -e "[1password]\nname=1Password Stable Channel\nbaseurl=https://downloads.1password.com/linux/rpm/stable/\$basearch\nenabled=1\ngpgcheck=1\ngpgkey=https://downloads.1password.com/linux/keys/1password.asc" > /etc/yum.repos.d/1password.repo'
|
||||
sudo dnf install -y 1password-cli
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
install_core_tools() {
|
||||
log "Installing core development tools..."
|
||||
|
||||
@@ -164,11 +201,12 @@ install_core_tools() {
|
||||
install_package bat
|
||||
install_package btop
|
||||
install_package neofetch
|
||||
install_package tmux
|
||||
|
||||
# Development
|
||||
install_package go
|
||||
install_package python3
|
||||
install_package node
|
||||
install_package mise
|
||||
|
||||
# Terminal
|
||||
install_cask ghostty
|
||||
@@ -176,6 +214,11 @@ install_core_tools() {
|
||||
# Optional tools
|
||||
install_package direnv
|
||||
install_package lazygit
|
||||
|
||||
# Window manager
|
||||
log "Tapping koekeishiya/formulae for yabai..."
|
||||
brew tap koekeishiya/formulae
|
||||
install_package yabai
|
||||
;;
|
||||
"arch")
|
||||
# Check if yay is installed
|
||||
@@ -189,8 +232,8 @@ install_core_tools() {
|
||||
|
||||
# Install via yay
|
||||
yay -S --noconfirm \
|
||||
git neovim fish starship fzf ripgrep fd bat btop neofetch \
|
||||
go python nodejs npm \
|
||||
git neovim fish starship fzf ripgrep fd bat btop neofetch tmux \
|
||||
go python mise \
|
||||
ghostty direnv lazygit
|
||||
;;
|
||||
"debian"|"fedora")
|
||||
@@ -202,6 +245,7 @@ install_core_tools() {
|
||||
install_package fd-find
|
||||
install_package bat
|
||||
install_package neofetch
|
||||
install_package tmux
|
||||
|
||||
# Neovim (from source if needed)
|
||||
if ! command -v nvim &> /dev/null; then
|
||||
@@ -215,12 +259,19 @@ install_core_tools() {
|
||||
# Development
|
||||
install_package golang
|
||||
install_package python3
|
||||
install_package nodejs
|
||||
|
||||
# Install mise
|
||||
if ! command -v mise &> /dev/null; then
|
||||
log "Installing mise version manager..."
|
||||
curl https://mise.run | sh
|
||||
fi
|
||||
|
||||
warn "Ghostty needs manual installation on $OS"
|
||||
;;
|
||||
esac
|
||||
|
||||
install_1password_cli
|
||||
|
||||
log "Core tools installed!"
|
||||
}
|
||||
|
||||
@@ -338,18 +389,145 @@ setup_other_configs() {
|
||||
ln -sf "$DOTFILES_DIR/.config/yabai" ~/.config/yabai
|
||||
fi
|
||||
|
||||
# Mise
|
||||
if [ -d "$DOTFILES_DIR/.config/mise" ]; then
|
||||
rm -rf ~/.config/mise
|
||||
ln -sf "$DOTFILES_DIR/.config/mise" ~/.config/mise
|
||||
fi
|
||||
|
||||
# Tmux
|
||||
if [ -d "$DOTFILES_DIR/.config/tmux" ]; then
|
||||
rm -rf ~/.config/tmux
|
||||
ln -sf "$DOTFILES_DIR/.config/tmux" ~/.config/tmux
|
||||
# Symlink tmux.conf to home directory for backward compatibility
|
||||
rm -f ~/.tmux.conf
|
||||
ln -sf "$DOTFILES_DIR/.config/tmux/tmux.conf" ~/.tmux.conf
|
||||
fi
|
||||
|
||||
log "Configurations symlinked!"
|
||||
}
|
||||
|
||||
install_playwright() {
|
||||
log "Installing Playwright..."
|
||||
|
||||
if command -v npm &> /dev/null; then
|
||||
local MISE_CMD="mise"
|
||||
if [ -f "$HOME/.local/bin/mise" ]; then
|
||||
MISE_CMD="$HOME/.local/bin/mise"
|
||||
fi
|
||||
|
||||
if command -v "$MISE_CMD" &> /dev/null; then
|
||||
log "Using mise node runtime for global packages..."
|
||||
"$MISE_CMD" exec -- npm install -g @playwright/test
|
||||
"$MISE_CMD" exec -- npx playwright install
|
||||
log "Playwright installed!"
|
||||
elif command -v npm &> /dev/null; then
|
||||
log "Using system npm..."
|
||||
npm install -g @playwright/test
|
||||
npx playwright install
|
||||
log "Playwright installed!"
|
||||
else
|
||||
warn "npm not found, skipping Playwright"
|
||||
warn "npm / mise not found, skipping Playwright"
|
||||
fi
|
||||
}
|
||||
|
||||
install_optional_ai_tools() {
|
||||
# Check if stdin is a terminal (tty) to avoid hanging in automated setups
|
||||
if [ ! -t 0 ]; then
|
||||
log "Non-interactive shell detected, skipping optional AI tools installation."
|
||||
return 0
|
||||
fi
|
||||
|
||||
log "Checking Google Antigravity CLI status..."
|
||||
if ! command -v agy &> /dev/null; then
|
||||
warn "Google Antigravity CLI (agy) is not installed in the PATH."
|
||||
log "To install it, run the official installer: curl -sS https://antigravity.google/install.sh | bash"
|
||||
else
|
||||
log "Google Antigravity CLI (agy) is already installed."
|
||||
fi
|
||||
|
||||
echo -e "\n${YELLOW}=== Optional AI CLI Tools ===${NC}"
|
||||
|
||||
# Prompt helper
|
||||
prompt_yes_no() {
|
||||
local prompt_msg=$1
|
||||
local response
|
||||
read -p "$prompt_msg [y/N]: " response
|
||||
case "$response" in
|
||||
[yY][eE][sS]|[yY])
|
||||
return 0
|
||||
;;
|
||||
*)
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# 1. Claude Code
|
||||
if prompt_yes_no "Do you want to install Claude Code (@anthropic-ai/claude-code)?"; then
|
||||
log "Installing Claude Code..."
|
||||
local MISE_CMD="mise"
|
||||
[ -f "$HOME/.local/bin/mise" ] && MISE_CMD="$HOME/.local/bin/mise"
|
||||
if command -v "$MISE_CMD" &> /dev/null; then
|
||||
"$MISE_CMD" exec -- npm install -g @anthropic-ai/claude-code
|
||||
elif command -v npm &> /dev/null; then
|
||||
npm install -g @anthropic-ai/claude-code
|
||||
else
|
||||
warn "npm / mise not found, cannot install Claude Code."
|
||||
fi
|
||||
fi
|
||||
|
||||
# 2. Simon Willison's LLM CLI (supports OpenAI, Claude, DeepSeek via plugins)
|
||||
if prompt_yes_no "Do you want to install Simon Willison's LLM CLI (supports ChatGPT, Claude, DeepSeek)?"; then
|
||||
log "Installing LLM CLI..."
|
||||
case $PACKAGE_MANAGER in
|
||||
"brew")
|
||||
brew install llm
|
||||
;;
|
||||
*)
|
||||
if command -v pip3 &> /dev/null; then
|
||||
pip3 install llm
|
||||
elif command -v pip &> /dev/null; then
|
||||
pip install llm
|
||||
else
|
||||
warn "pip not found, cannot install llm cli."
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
# Install plugins if llm is installed
|
||||
if command -v llm &> /dev/null; then
|
||||
log "Installing plugins for llm (llm-claude, llm-gpt3, llm-deepseek)..."
|
||||
llm install llm-claude
|
||||
llm install llm-gpt3
|
||||
llm install llm-deepseek || true
|
||||
fi
|
||||
fi
|
||||
|
||||
# 3. tgpt (Zero-config terminal GPT chat client)
|
||||
if prompt_yes_no "Do you want to install tgpt (Zero-config Terminal ChatGPT)?"; then
|
||||
log "Installing tgpt..."
|
||||
case $PACKAGE_MANAGER in
|
||||
"brew")
|
||||
brew install tgpt
|
||||
;;
|
||||
*)
|
||||
curl -sSL https://raw.githubusercontent.com/aandrew-me/tgpt/main/install.sh | bash -s -- -y
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# 4. Ollama (for running DeepSeek locally offline)
|
||||
if prompt_yes_no "Do you want to install Ollama (to run DeepSeek and other models locally)?"; then
|
||||
log "Installing Ollama..."
|
||||
case $OS in
|
||||
"macos")
|
||||
install_cask ollama
|
||||
;;
|
||||
*)
|
||||
curl -fsSL https://ollama.com/install.sh | sh
|
||||
;;
|
||||
esac
|
||||
log "To run DeepSeek locally after Ollama is running, execute: ollama run deepseek-coder"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -361,7 +539,19 @@ main() {
|
||||
setup_fish
|
||||
setup_neovim
|
||||
setup_other_configs
|
||||
|
||||
# Install runtimes via mise
|
||||
local MISE_CMD="mise"
|
||||
if [ -f "$HOME/.local/bin/mise" ]; then
|
||||
MISE_CMD="$HOME/.local/bin/mise"
|
||||
fi
|
||||
if command -v "$MISE_CMD" &> /dev/null; then
|
||||
log "Installing language runtimes configured in mise..."
|
||||
"$MISE_CMD" install
|
||||
fi
|
||||
|
||||
install_playwright
|
||||
install_optional_ai_tools
|
||||
|
||||
echo -e "${GREEN}
|
||||
╔══════════════════════════════════════════════════════════╗
|
||||
|
||||
Reference in New Issue
Block a user