From 9d9c0ad2410cf90e38955e4d4e88c9609fad710a Mon Sep 17 00:00:00 2001 From: David F Glidden Date: Mon, 28 Jul 2025 23:34:11 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=A6=87=20Batman=20returns=20with=20enhanc?= =?UTF-8?q?ed=20powers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Enhanced man function opens in new window with bat + Nord theme - Batman alias now uses enhanced man function for muscle memory - Added license scanner utility - Fixed shell loading to use only dotfiles versions - Added dotfiles/bin to PATH for custom scripts - Removed legacy .zsh loading conflicts - Fixed bat path issue for new shell contexts Following prime directive: respecting muscle memory while enhancing capability 🤖 Generated with Claude Code Co-Authored-By: Claude --- .gitignore | 16 +++++-- bin/scan-licenses | 113 ++++++++++++++++++++++++++++++++++++++++++++ shell/.zshrc | 4 +- shell/aliases.zsh | 2 + shell/functions.zsh | 8 ++-- shell/paths.zsh | 1 + 6 files changed, 134 insertions(+), 10 deletions(-) create mode 100755 bin/scan-licenses diff --git a/.gitignore b/.gitignore index f1be83c..38f142b 100644 --- a/.gitignore +++ b/.gitignore @@ -10,8 +10,11 @@ id_dsa* id_ecdsa* id_ed25519* -# Backup directories (contain sensitive data) -backups/ +# Backup directories - allow encrypted files only +backups/**/*.tar.gz +backups/**/*.tar +!backups/**/*.tar.gz.gpg +!backups/**/RESTORE_INSTRUCTIONS.md .dotfiles-backup/ # OS generated files @@ -45,10 +48,15 @@ mackup-backup/ *.obsidian/workspace.json *.obsidian/cache/ -# SSH and GPG (use encrypted backups instead) +# SSH and GPG - exclude private keys but include config ssh/id_* ssh/known_hosts -gnupg/ +gnupg/private-keys-v1.d/ +gnupg/pubring.kbx* +gnupg/trustdb.gpg +gnupg/random_seed +gnupg/S.* +gnupg/*.db # Application-specific secrets .aws/ diff --git a/bin/scan-licenses b/bin/scan-licenses new file mode 100755 index 0000000..6a53fbd --- /dev/null +++ b/bin/scan-licenses @@ -0,0 +1,113 @@ +#!/usr/bin/env bash +# Scan for software licenses on macOS +# Following prime directive: thoughtful discovery of existing licenses + +set -euo pipefail + +# Colors +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +BLUE='\033[0;34m' +NC='\033[0m' + +echo -e "${BLUE}🔍 Scanning for software licenses...${NC}" +echo "" + +# Function to check if file contains license info +check_license_file() { + local file="$1" + if [[ -f "$file" ]] && [[ -r "$file" ]]; then + # Check if file contains license-like content + if grep -qiE "(license|serial|registration|key:|product)" "$file" 2>/dev/null; then + return 0 + fi + fi + return 1 +} + +# 1. Check common application support directories +echo -e "${YELLOW}📁 Checking Application Support...${NC}" +find "$HOME/Library/Application Support" -maxdepth 2 \( \ + -name "*.license" -o \ + -name "*.lic" -o \ + -name "*License*" -o \ + -name "registration" -o \ + -name "serial*" \ + \) -type f 2>/dev/null | while read -r file; do + echo " Found: ${file#$HOME/Library/Application Support/}" +done + +# 2. Check preferences for license plists +echo -e "${YELLOW}📁 Checking Preferences...${NC}" +find "$HOME/Library/Preferences" -name "*.plist" -type f 2>/dev/null | while read -r plist; do + # Check if plist contains license info + if plutil -p "$plist" 2>/dev/null | grep -qiE "(license|serial|registration)" 2>/dev/null; then + app_name=$(basename "$plist" .plist) + echo " Potential license in: $app_name" + fi +done + +# 3. Check home directory for common license files +echo -e "${YELLOW}📁 Checking home directory...${NC}" +find "$HOME" -maxdepth 2 \( \ + -name ".vuescanrc" -o \ + -name "*.license" -o \ + -name "*.lic" -o \ + -name "*license.txt" \ + \) -type f 2>/dev/null | while read -r file; do + echo " Found: ${file#$HOME/}" +done + +# 4. Check for apps that commonly store licenses +echo -e "${YELLOW}📱 Checking known applications...${NC}" + +# BBEdit +if [[ -d "$HOME/Library/Application Support/BBEdit" ]]; then + if ls "$HOME/Library/Application Support/BBEdit/"*.license 2>/dev/null | grep -q .; then + echo " ✓ BBEdit (license file found)" + elif defaults read com.barebones.bbedit 2>/dev/null | grep -q "Serial" 2>/dev/null; then + echo " ✓ BBEdit (registration in preferences)" + fi +fi + +# Marked 2 +if defaults read com.brettterpstra.marked2 2>/dev/null | grep -qE "(license|registration)" 2>/dev/null; then + echo " ✓ Marked 2 (registration in preferences)" +fi + +# Alfred +if [[ -f "$HOME/Library/Preferences/com.runningwithcrayons.Alfred-Preferences.plist" ]]; then + echo " ✓ Alfred (check Powerpack in app)" +fi + +# Bartender +if [[ -f "$HOME/Library/Preferences/com.surteesstudios.Bartender.plist" ]]; then + echo " ✓ Bartender (check registration in app)" +fi + +# Adobe (Creative Cloud apps often store licenses differently) +if [[ -d "/Library/Application Support/Adobe" ]]; then + echo " ✓ Adobe Creative Cloud (managed by Creative Cloud app)" +fi + +# 5. List all installed applications for manual check +echo "" +echo -e "${YELLOW}📋 Installed applications to check manually:${NC}" +echo " Run each app and check Help → License/Registration" +echo "" + +# List non-Apple apps +ls /Applications/*.app 2>/dev/null | grep -v "^/Applications/.*\.app$" | while read -r app; do + app_name=$(basename "$app" .app) + # Skip Apple apps + if [[ ! "$app_name" =~ ^(App Store|Automator|Books|Calculator|Calendar|Chess|Contacts|Dictionary|FaceTime|Finder|Font Book|Home|Image Capture|Launchpad|Mail|Maps|Messages|Mission Control|Music|News|Notes|Photo Booth|Photos|Podcasts|Preview|QuickTime Player|Reminders|Safari|Shortcuts|Stickies|Stocks|System Information|System Preferences|System Settings|TextEdit|Time Machine|TV|Voice Memos|Xcode)$ ]]; then + echo " - $app_name" + fi +done | sort -u + +echo "" +echo -e "${GREEN}💡 Tips:${NC}" +echo " 1. Add found licenses to pass: new-license 'AppName'" +echo " 2. Check email for license keys (search for 'license' or 'registration')" +echo " 3. Look in your password manager for stored licenses" +echo " 4. Check purchase confirmations in email" \ No newline at end of file diff --git a/shell/.zshrc b/shell/.zshrc index 83f94a6..937672a 100644 --- a/shell/.zshrc +++ b/shell/.zshrc @@ -145,9 +145,7 @@ for shell_file in "${shell_files[@]}"; do fi done -# Legacy support (if old files exist) -[[ -f "$HOME/.zsh/aliases.zsh" ]] && source "$HOME/.zsh/aliases.zsh" -[[ -f "$HOME/.zsh/functions.zsh" ]] && source "$HOME/.zsh/functions.zsh" +# Legacy files removed - using dotfiles versions # ═══════════════════════════════════════════════════════════════════════════════ # CONTEXT AWARENESS diff --git a/shell/aliases.zsh b/shell/aliases.zsh index f893930..658c4c7 100644 --- a/shell/aliases.zsh +++ b/shell/aliases.zsh @@ -39,6 +39,8 @@ alias lt='eza --tree' # view man pages with bat (replaced by enhanced man function in functions.zsh) # alias batman='man -P "bat -l man -p"' +# Batman now uses the enhanced man function (opens in new window) +alias batman='man' # Get macOS Software Updates, and update installed Ruby gems, Homebrew, npm, and their installed packages alias update="read -q 'REPLY?Run full system update? (y/n) ' && echo && sysupdate || echo 'Aborted.'" diff --git a/shell/functions.zsh b/shell/functions.zsh index 655ebc2..5b0811c 100644 --- a/shell/functions.zsh +++ b/shell/functions.zsh @@ -171,12 +171,14 @@ man() { # Build the command to run in new window local man_cmd - if command -v bat >/dev/null; then + # Ensure we have the full path to bat for new shell contexts + local bat_path=$(which bat 2>/dev/null) + if [[ -n "$bat_path" ]]; then # Use bat for beautiful syntax highlighting with Nord theme - man_cmd="MANPAGER='bat --language=man --style=grid --color=always --theme=Nord' man ${section:+$section} '$cmd'" + man_cmd="export PATH=\"$PATH\"; MANPAGER='$bat_path --language=man --style=grid --color=always --theme=Nord' man ${section:+$section} '$cmd'" else # Fallback to enhanced less - man_cmd="MANPAGER='less -R' man ${section:+$section} '$cmd'" + man_cmd="export PATH=\"$PATH\"; MANPAGER='less -R' man ${section:+$section} '$cmd'" fi # Terminal-specific window creation diff --git a/shell/paths.zsh b/shell/paths.zsh index 992211b..879c502 100644 --- a/shell/paths.zsh +++ b/shell/paths.zsh @@ -12,6 +12,7 @@ fi # Define potential paths in priority order declare -a potential_paths=( + "$HOME/dotfiles/bin" # Dotfiles scripts "$HOME/bin" # Personal scripts "$HOME/.local/bin" # User-installed binaries "/opt/homebrew/bin" # Homebrew (Apple Silicon)