Audit and optimize for CapableMind development
Brewfile: stripped to essential tools (~600MB freed), removed boost, cmake, aerc, newsboat, fontforge, starship, and 24 auto-dependencies. Added caffeine, ollama, fastfetch, ocrmypdf, tea, sshpass, vitetris. Dropped 1password, iterm2, github-desktop, hazel, swiftbar, oversight. Shell: fixed all stale references (fzf, zoxide, starship, old paths, Homebrew node aliases). Updated project paths to ~/_Dev/. Added CapableMind aliases (cm, bmf, bmf-health, bmf-status, bmf-logs). Configs: removed iterm2, neofetch, swiftbar configs. Added capablemind (launchd plists, MCP example, bmf-start script). Updated SSH config with git.skemantix.com. Added CLAUDE.md to dotfiles. Scripts: consolidated 3 backup scripts into 1 (backup-all-secrets.sh), added pass store backup. Added setup-capablemind.sh for full environment reconstruction. Updated symlinks.sh for new config structure. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
e7bb361bd2
commit
066a47a26b
+130
-88
@@ -20,7 +20,7 @@ wttr() {
|
||||
}
|
||||
|
||||
## III. Updates (system, brew, etc) #######################
|
||||
## Description: Performs system updates, Homebrew cleanup, fzf refresh, moon phase logging, and dotfile sync ###########################
|
||||
## Description: Performs system updates, Homebrew cleanup, moon phase logging, and dotfile sync ###########################
|
||||
|
||||
function sysupdate() {
|
||||
local start_time=$(date +%s)
|
||||
@@ -58,10 +58,7 @@ function sysupdate() {
|
||||
echo "⚠️ mas not installed - install with: brew install mas"
|
||||
fi
|
||||
|
||||
echo "🔄 Refreshing fzf..."
|
||||
if [ -d ~/.fzf ]; then
|
||||
cd ~/.fzf && git pull && ./install --all && cd -
|
||||
fi
|
||||
# fzf removed — no longer installed
|
||||
|
||||
# Fix Zsh completion security warnings
|
||||
echo "🔒 Checking Zsh completion security..."
|
||||
@@ -101,11 +98,11 @@ function sysupdate() {
|
||||
echo "🌙 Moon phase tracking disabled (missing curl or jq)"
|
||||
fi
|
||||
|
||||
if [ -d "$HOME/.dotfiles" ]; then
|
||||
if [ -d "$HOME/dotfiles" ]; then
|
||||
echo "📝 Committing dotfile changes..."
|
||||
cd ~/.dotfiles || return
|
||||
cd ~/dotfiles || return
|
||||
git add . && git commit -m "🔧 Auto-commit from sysupdate on $(date '+%Y-%m-%d %H:%M')" && git push
|
||||
brew bundle dump --force --file="$HOME/.dotfiles/Brewfile"
|
||||
brew bundle dump --force --file="$HOME/dotfiles/Brewfile"
|
||||
cd - >/dev/null || return
|
||||
fi
|
||||
|
||||
@@ -129,96 +126,76 @@ function quietupdate() {
|
||||
sudo -vn 2>/dev/null || sudo -v
|
||||
sudo softwareupdate -i -a >/dev/null
|
||||
brew update >/dev/null && brew upgrade >/dev/null && brew cleanup >/dev/null && brew autoremove >/dev/null
|
||||
[ -d ~/.fzf ] && cd ~/.fzf && git pull >/dev/null && ./install --all >/dev/null && cd - >/dev/null
|
||||
[ -d "$HOME/.dotfiles" ] && cd ~/.dotfiles && git add . && git commit -m "auto sysupdate" && git push && brew bundle dump --force --file="$HOME/.dotfiles/Brewfile" && cd - >/dev/null
|
||||
[ -d "$HOME/dotfiles" ] && cd ~/dotfiles && git add . && git commit -m "auto sysupdate" && git push && brew bundle dump --force --file="$HOME/dotfiles/Brewfile" && cd - >/dev/null
|
||||
if [ -x "$HOME/.zsh/hooks/post-update" ]; then "$HOME/.zsh/hooks/post-update"; fi
|
||||
osascript -e 'display notification "Quiet update complete!" with title "System Maintenance"'
|
||||
}
|
||||
|
||||
# ═══════════════════════════════════════════════════════════════════════════════
|
||||
# Man Page side-by-side viewer
|
||||
# Modern, workspace-aware man page viewer
|
||||
# - Kitty/tmux/iTerm split panes, syntax highlighting via bat
|
||||
# - Optional qman integration for interactive TOC/search
|
||||
# - Order-flexible + apropos search
|
||||
# ═══════════════════════════════════════════════════════════════════════════════
|
||||
|
||||
# Detailed Kitty diagnostic
|
||||
debug_kitty_launch() {
|
||||
echo "=== Kitty Launch Debugging ==="
|
||||
|
||||
# Check basic remote control
|
||||
echo "1. Testing basic remote control:"
|
||||
kitty @ ls
|
||||
echo " Exit code: $?"
|
||||
|
||||
# Test simple launch
|
||||
echo -e "\n2. Testing simple window launch:"
|
||||
kitty @ launch --type=window echo "Hello from new window"
|
||||
echo " Exit code: $?"
|
||||
|
||||
# Test with bash -c
|
||||
echo -e "\n3. Testing bash -c launch:"
|
||||
kitty @ launch --type=window bash -c "echo 'Hello with bash -c'"
|
||||
echo " Exit code: $?"
|
||||
|
||||
# Test overlay
|
||||
echo -e "\n4. Testing overlay:"
|
||||
kitty @ launch --type=overlay bash -c "echo 'Overlay test'; read -p 'Press enter to close'"
|
||||
echo " Exit code: $?"
|
||||
|
||||
# Test with actual man command
|
||||
echo -e "\n5. Testing with man command:"
|
||||
kitty @ launch --type=window bash -c "man ls"
|
||||
echo " Exit code: $?"
|
||||
}
|
||||
|
||||
# Test the absolute simplest case
|
||||
test_basic_split() {
|
||||
echo "Testing basic split with sleep..."
|
||||
kitty @ launch --location=vsplit sleep 5
|
||||
echo "Exit code: $?"
|
||||
}
|
||||
|
||||
# Beautiful man pages in resizable split pane
|
||||
man() {
|
||||
if [[ $# -eq 0 ]]; then
|
||||
echo "Usage: man <command> [section]"
|
||||
echo "Opens man page in resizable split pane (kitty/tmux) or new tab (iTerm)"
|
||||
echo "Usage:"
|
||||
echo " man <command> [section]"
|
||||
echo " man [section] <command>"
|
||||
echo " man ? <search-term> # apropos search"
|
||||
return 1
|
||||
fi
|
||||
|
||||
local cmd="$1"
|
||||
local section="${2:-}"
|
||||
|
||||
# Verify man page exists
|
||||
if ! /usr/bin/man -w ${section:+$section} "$cmd" >/dev/null 2>&1; then
|
||||
echo "❌ No manual entry for '$cmd'${section:+ in section $section}"
|
||||
return 1
|
||||
|
||||
# Apropos mode
|
||||
if [[ "$1" == "?" ]]; then
|
||||
shift
|
||||
/usr/bin/man -k "$@"
|
||||
return
|
||||
fi
|
||||
|
||||
# Build the display command that stays open and adapts to terminal width
|
||||
local display_cmd
|
||||
local bat_path=$(which bat 2>/dev/null)
|
||||
if [[ -n "$bat_path" ]]; then
|
||||
# Use bat with terminal width detection and better wrapping
|
||||
display_cmd="export PATH=\"$PATH\"; export MANWIDTH=\$(tput cols); /usr/bin/man ${section:+$section} '$cmd' 2>/dev/null | col -bx | '$bat_path' --language=man --style=grid --theme=Nord --paging=always --terminal-width=\$(tput cols) --wrap=auto; echo; echo 'Press any key to close...'; read -k1"
|
||||
|
||||
# Support both orders: man 2 open OR man open 2
|
||||
local cmd section
|
||||
if [[ "$1" =~ ^[0-9]+$ && -n "$2" ]]; then
|
||||
section="$1"; cmd="$2"
|
||||
else
|
||||
# Fallback with responsive width
|
||||
display_cmd="export MANWIDTH=\$(tput cols); MANPAGER='less -R' /usr/bin/man ${section:+$section} '$cmd'; echo; echo 'Press any key to close...'; read -k1"
|
||||
cmd="$1"; section="${2:-}"
|
||||
fi
|
||||
|
||||
# Handle different terminals - always use split/resizable approach
|
||||
|
||||
# Verify page exists
|
||||
if ! /usr/bin/man -w ${section:+$section} -- "$cmd" >/dev/null 2>&1; then
|
||||
echo "❌ No manual entry for '$cmd'${section:+ in section $section}"
|
||||
echo "💡 Try: man ? $cmd"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Choose backend
|
||||
local display_cmd
|
||||
if command -v qman >/dev/null 2>&1; then
|
||||
display_cmd="qman ${section:+$section }-- '$cmd'"
|
||||
else
|
||||
local bat_path; bat_path=$(command -v bat 2>/dev/null || true)
|
||||
if [[ -n "$bat_path" ]]; then
|
||||
display_cmd="export MANWIDTH=\$(tput cols); /usr/bin/man ${section:+$section} '$cmd' 2>/dev/null \
|
||||
| col -bx \
|
||||
| '$bat_path' --language=man --style=grid --theme=\${BAT_THEME:-Nord} \
|
||||
--paging=always --terminal-width=\$(tput cols) --wrap=auto"
|
||||
else
|
||||
display_cmd="export MANWIDTH=\$(tput cols); MANPAGER='less -R' /usr/bin/man ${section:+$section} '$cmd'"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Handle different terminal environments
|
||||
if [[ -n "${KITTY_WINDOW_ID:-}" ]]; then
|
||||
# Kitty: Create optimally-sized vertical split
|
||||
# Left pane: ~100 chars for code, Right pane: ~64 chars for optimal reading
|
||||
kitty @ launch \
|
||||
--location=vsplit \
|
||||
--title="📖 $cmd${section:+ ($section)}" \
|
||||
--cwd=current \
|
||||
--bias=60 \
|
||||
zsh -c "$display_cmd" >/dev/null
|
||||
--bias=${KITTY_BIAS:-60} \
|
||||
zsh -lc "$display_cmd" >/dev/null
|
||||
elif [[ -n "${TMUX:-}" ]]; then
|
||||
# TMUX: Create resizable horizontal split (easier to read)
|
||||
tmux split-window -v -l 40% "$display_cmd"
|
||||
tmux split-window -v -l ${TMUX_HEIGHT:-40%} "$display_cmd"
|
||||
elif [[ "${TERM_PROGRAM}" == "iTerm.app" ]]; then
|
||||
# iTerm: Create new split pane
|
||||
osascript -e "
|
||||
tell application \"iTerm\"
|
||||
tell current window
|
||||
@@ -230,17 +207,13 @@ man() {
|
||||
end tell
|
||||
end tell
|
||||
end tell
|
||||
end tell
|
||||
" >/dev/null 2>&1
|
||||
end tell" >/dev/null 2>&1
|
||||
else
|
||||
# Fallback: run inline
|
||||
echo "📖 Displaying man page inline:"
|
||||
eval "$display_cmd"
|
||||
fi
|
||||
}
|
||||
|
||||
# batman is already aliased to man in aliases.zsh
|
||||
|
||||
# ═══════════════════════════════════════════════════════════════════════════════
|
||||
# DOTFILES MANAGEMENT FUNCTIONS
|
||||
# ═══════════════════════════════════════════════════════════════════════════════
|
||||
@@ -297,12 +270,81 @@ backup-configs() {
|
||||
echo " ✓ GPG configuration"
|
||||
fi
|
||||
|
||||
# AWS credentials (if they exist)
|
||||
if [[ -d ~/.aws ]]; then
|
||||
cp -R ~/.aws "$backup_dir/" 2>/dev/null || true
|
||||
echo " ✓ AWS configuration"
|
||||
fi
|
||||
|
||||
echo "✅ Configs backed up to: $backup_dir"
|
||||
}
|
||||
|
||||
# ═══════════════════════════════════════════════════════════════════════════════
|
||||
# LICENSE MANAGEMENT FUNCTIONS FOR PASS
|
||||
# ═══════════════════════════════════════════════════════════════════════════════
|
||||
|
||||
# License management: add a license entry with optional attached file
|
||||
license-add() {
|
||||
if [ $# -lt 1 ]; then
|
||||
echo "Usage: license-add <product-name> [license-file-path]"
|
||||
return 1
|
||||
fi
|
||||
|
||||
local product="$1"
|
||||
local entry="licenses/$product"
|
||||
local dir="$HOME/.password-store/${entry}.gpg.d"
|
||||
|
||||
echo "→ Paste activation code or license metadata for '$product', then press Ctrl+D:"
|
||||
pass insert -m "$entry" || return 1
|
||||
|
||||
if [ $# -eq 2 ]; then
|
||||
local filepath="$2"
|
||||
local filename="$(basename "$filepath")"
|
||||
mkdir -p "$dir"
|
||||
gpg -o "$dir/${filename}.gpg" -e -r "$(gpg --list-secret-keys --with-colons | awk -F: '/^uid:/ {print $10; exit}')" "$filepath"
|
||||
echo "✔️ Encrypted license file saved as: $dir/${filename}.gpg"
|
||||
else
|
||||
echo "✔️ Code-only license entry created for '$product'."
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# Edit a license entry in the pass store
|
||||
license-edit() {
|
||||
if [ $# -ne 1 ]; then
|
||||
echo "Usage: license-edit <product-name>"
|
||||
return 1
|
||||
fi
|
||||
|
||||
local product="$1"
|
||||
pass edit "licenses/$product"
|
||||
}
|
||||
|
||||
# List all stored licenses
|
||||
license-list() {
|
||||
pass ls licenses/ | sed 's/^licenses\///' | sort
|
||||
}
|
||||
|
||||
# Show license details and attached files for a product
|
||||
license-info() {
|
||||
if [ $# -ne 1 ]; then
|
||||
echo "Usage: license-info <product-name>"
|
||||
return 1
|
||||
fi
|
||||
|
||||
local product="$1"
|
||||
local entry="licenses/$product"
|
||||
local pass_file="$HOME/.password-store/${entry}.gpg"
|
||||
local attach_dir="$HOME/.password-store/${entry}.gpg.d"
|
||||
|
||||
if [ ! -f "$pass_file" ]; then
|
||||
echo "❌ No license entry found for '$product'"
|
||||
return 1
|
||||
fi
|
||||
|
||||
echo "🔐 License entry: $product"
|
||||
echo "----------------------------------------"
|
||||
pass show "$entry"
|
||||
echo
|
||||
|
||||
if [ -d "$attach_dir" ]; then
|
||||
echo "📎 Attached encrypted file(s):"
|
||||
find "$attach_dir" -type f -name '*.gpg' -exec basename {} \;
|
||||
else
|
||||
echo "📎 No attached files."
|
||||
fi
|
||||
}
|
||||
Reference in New Issue
Block a user