#!/usr/bin/env bash # install.sh — Dotfiles installer for Kitty + Obsidian logging system # Repo: https://github.com/SamoilenkoVadym/obsidian_kitty_setup # # Usage: # ./install.sh # Full install (all modules) # ./install.sh --all # Same as above # ./install.sh --module fish claude # Install specific modules only # ./install.sh --no-packages # Skip package manager step # ./install.sh --dry-run # Preview without making changes # # Modules: packages, kitty, fish, nvim, btop, fastfetch, starship, git, claude set -euo pipefail REPO_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" # ── Load libraries ──────────────────────────────────────────────────────── source "$REPO_DIR/lib/helpers.sh" source "$REPO_DIR/lib/render.sh" source "$REPO_DIR/lib/stow.sh" source "$REPO_DIR/lib/packages.sh" # ── Argument parsing ────────────────────────────────────────────────────── DRY_RUN=false SKIP_PACKAGES=false MODULES=() ALL_MODULES=(packages kitty fish nvim btop fastfetch starship git claude) while [[ $# -gt 0 ]]; do case "$1" in --all) MODULES=("${ALL_MODULES[@]}"); shift ;; --module) shift; while [[ $# -gt 0 && "$1" != --* ]]; do MODULES+=("$1"); shift; done ;; --no-packages) SKIP_PACKAGES=true; shift ;; --dry-run) DRY_RUN=true; shift ;; -h|--help) echo "Usage: $0 [--all | --module MODULE...] [--no-packages] [--dry-run]" echo "Modules: ${ALL_MODULES[*]}" exit 0 ;; *) error "Unknown argument: $1"; exit 1 ;; esac done # Default: install all modules [[ ${#MODULES[@]} -eq 0 ]] && MODULES=("${ALL_MODULES[@]}") echo "" echo " ┌─────────────────────────────────────────────────────────────┐" echo " │ obsidian_kitty_setup — dotfiles installer │" echo " │ Platform: $(os_name) Modules: ${MODULES[*]}" echo " └─────────────────────────────────────────────────────────────┘" echo "" $DRY_RUN && warn "DRY RUN MODE — no changes will be made." && exit 0 # ── Step 1: Load ~/.dotfiles.env ────────────────────────────────────────── step "1/5 Loading ~/.dotfiles.env" load_env success "Loaded: OBSIDIAN_VAULT=${OBSIDIAN_VAULT}" # ── Step 2: Packages ────────────────────────────────────────────────────── if [[ " ${MODULES[*]} " == *" packages "* ]] && ! $SKIP_PACKAGES; then step "2/5 Installing packages" install_packages "$REPO_DIR" else info "2/5 Skipping packages." fi # ── Step 3: Render templates ────────────────────────────────────────────── step "3/5 Rendering templates" render_templates "$REPO_DIR" # ── Step 4: Stow packages ───────────────────────────────────────────────── step "4/5 Stowing config packages" ensure_stow STOW_MODULES=(kitty fish nvim btop fastfetch starship git claude) for mod in "${STOW_MODULES[@]}"; do if [[ " ${MODULES[*]} " == *" $mod "* ]]; then stow_package "$REPO_DIR" "$mod" fi done # ── Step 5: Post-install per module ────────────────────────────────────── step "5/5 Post-install steps" # Fish: seed fish_variables + install plugins if [[ " ${MODULES[*]} " == *" fish "* ]]; then FISH_VARS="$HOME/.config/fish/fish_variables" if [[ ! -f "$FISH_VARS" ]]; then info "Seeding fish_variables..." cp "$REPO_DIR/fish-seed/fish_variables" "$FISH_VARS" success "fish_variables seeded." else info "fish_variables already exists — skipping seed." fi if has_cmd fish; then info "Installing Fish plugins (fisher + tide)..." fish -c " if not functions -q fisher curl -sL https://raw.githubusercontent.com/jorgebucaran/fisher/main/functions/fisher.fish | source fisher install jorgebucaran/fisher end fisher install ilancosman/tide@v6 2>/dev/null || true " 2>/dev/null || warn "Fisher install had warnings (may already be installed)" success "Fish plugins ready." fi fi # Claude: memory-compiler setup if [[ " ${MODULES[*]} " == *" claude "* ]]; then MC_DIR="$HOME/.claude/memory-compiler" if [[ -d "$MC_DIR" ]]; then # knowledge/ symlink KNOWLEDGE_LINK="$MC_DIR/knowledge" VAULT_WIKI="${OBSIDIAN_VAULT}/wiki" if [[ ! -L "$KNOWLEDGE_LINK" ]]; then if [[ -d "$VAULT_WIKI" ]]; then ln -sf "$VAULT_WIKI" "$KNOWLEDGE_LINK" success "knowledge/ → $VAULT_WIKI" else warn "Vault wiki not found at $VAULT_WIKI — knowledge/ symlink skipped." warn "Clone SamoilenkoVadym/obsidian to $OBSIDIAN_VAULT and re-run." fi else info "knowledge/ symlink already exists." fi # uv sync if has_cmd uv; then info "Syncing memory-compiler Python env..." (cd "$MC_DIR" && uv sync --quiet) success "memory-compiler venv ready." else warn "uv not found — run: curl -LsSf https://astral.sh/uv/install.sh | sh" fi # Create required runtime directories mkdir -p "$MC_DIR/daily" "$MC_DIR/reports" fi fi echo "" echo " ┌──────────────────────────────────────────────────────────────┐" echo " │ Installation complete! │" echo " │ Run: bash scripts/doctor.sh to verify everything is OK │" echo " └──────────────────────────────────────────────────────────────┘" echo ""