From aebab346aa9b905d5cc9c68f2117abcd18157499 Mon Sep 17 00:00:00 2001 From: Team Goon Date: Thu, 6 Nov 2025 19:06:31 -0500 Subject: [PATCH] v0.3.5: unified Fish CLI integration (stable) --- VERSION | 2 +- src/utils/setup_fish_goondex.fish | 195 ++++++++++++++++++++++++++++++ 2 files changed, 196 insertions(+), 1 deletion(-) create mode 100644 src/utils/setup_fish_goondex.fish diff --git a/VERSION b/VERSION index 1c09c74..03f2afa 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.3.3 +v0.3.5 diff --git a/src/utils/setup_fish_goondex.fish b/src/utils/setup_fish_goondex.fish new file mode 100644 index 0000000..449b0df --- /dev/null +++ b/src/utils/setup_fish_goondex.fish @@ -0,0 +1,195 @@ +#!/usr/bin/env fish +# ============================================================ +# Goondex CLI Fish Setup Script +# Leak Technologies — v0.3.5 (2025) +# ============================================================ +# Ensures the Goondex CLI is properly installed, removes old +# aliases, installs the canonical function, reloads Fish, +# and verifies environment consistency. +# ============================================================ + +set project_root /home/stu/Projects/PD/Goondex +set fish_func_dir ~/.config/fish/functions +set goondex_func $fish_func_dir/goondex.fish + +# ------------------------------------------------------------ +# 1. Ensure Fish functions directory exists +# ------------------------------------------------------------ +if not test -d $fish_func_dir + echo "[+] Creating Fish functions directory: $fish_func_dir" + mkdir -p $fish_func_dir +end + +# ------------------------------------------------------------ +# 2. Remove legacy aliases or duplicate definitions +# ------------------------------------------------------------ +echo "[*] Cleaning up old Goondex aliases and inline definitions..." +functions -e goondex 2>/dev/null +functions -e gx 2>/dev/null + +if test -f ~/.config/fish/config.fish + set tmpfile (mktemp) + grep -vE 'alias[[:space:]]+goondex|alias[[:space:]]+gx|function[[:space:]]+goondex' ~/.config/fish/config.fish > $tmpfile + mv $tmpfile ~/.config/fish/config.fish + echo "[+] Removed any old inline goondex/gx definitions from config.fish" +end + +# ------------------------------------------------------------ +# 3. Install canonical Goondex function +# ------------------------------------------------------------ +echo "[*] Installing canonical goondex.fish function..." + +# Use Fish-compatible redirection +begin + echo '#!/usr/bin/env fish' + echo '# ============================================================' + echo '# Goondex CLI — Unified Function (Fish)' + echo '# ============================================================' + echo '# Supports:' + echo '# Importer / Tagging: goondex import, refresh-all, etc.' + echo '# ML Facecrop Tools: goondex trainer, goondex verify' + echo '# Performer Database: goondex search-performer, tpdb-enrich' + echo '# ============================================================' + echo '' + echo 'function goondex' + echo ' set cmd $argv[1]' + echo ' set args $argv[2..-1]' + echo ' set project_root /home/stu/Projects/PD/Goondex' + echo ' set venv_path $project_root/.venv/bin/python' + echo ' set -x PYTHONPATH $project_root/src' + echo '' + echo ' # Determine version dynamically' + echo ' if test -f "$project_root/VERSION"' + echo ' set goondex_version (cat "$project_root/VERSION" | string trim)' + echo ' else if test -d "$project_root/.git"' + echo ' set goondex_version (git -C $project_root describe --tags --abbrev=0 ^/dev/null)' + echo ' if test -z "$goondex_version"' + echo ' set goondex_version "v0.0.0-dev"' + echo ' end' + echo ' else' + echo ' set goondex_version "v0.0.0-unknown"' + echo ' end' + echo '' + echo ' switch $cmd' + echo ' case "" -h --help help' + echo ' echo ""' + echo ' echo "Goondex CLI — Unified Interface"' + echo ' echo "────────────────────────────────────────────"' + echo ' echo ""' + echo ' echo "Usage: goondex [args]"' + echo ' echo ""' + echo ' echo "Core Importer Commands:"' + echo ' echo " import Import a new gallery from PornPics"' + echo ' echo " refresh-all Refresh tags for all galleries"' + echo ' echo " refresh-one Refresh tags for a single gallery"' + echo ' echo " validate-tags Validate YAML tag dictionaries"' + echo ' echo " tag-stats Generate tag frequency report"' + echo ' echo " list List all available galleries"' + echo ' echo " list-tags Show tags for one gallery"' + echo ' echo " add Add a tag manually"' + echo ' echo " remove Remove a tag manually"' + echo ' echo " add-multi \"A,B\" Add multiple tags at once"' + echo ' echo " show-metadata Show metadata.json contents"' + echo ' echo " source set Set gallery source"' + echo ' echo ""' + echo ' echo "Machine Learning (Face Recognition):"' + echo ' echo " trainer Train face embeddings from ML/faces_cache/"' + echo ' echo " verify [tags] Verify performer face image similarity"' + echo ' echo ""' + echo ' echo "Performers & Metadata:"' + echo ' echo " search-performer Search local performer records"' + echo ' echo " tpdb-enrich Sync or mirror metadata from ThePornDB"' + echo ' echo ""' + echo ' echo "Utilities:"' + echo ' echo " --help / -h / help Show this help menu"' + echo ' echo " --version / -v / version Show current Goondex version"' + echo ' echo ""' + echo ' echo "Examples:"' + echo ' echo " goondex import \"https://www.pornpics.com/galleries/example/\""' + echo ' echo " goondex refresh-one \"20251106_2041_Madison_Young_ATK_Archives\""' + echo ' echo " goondex trainer"' + echo ' echo " goondex verify ./ML/faces_cache/face_001.jpg \"Riley Reid,Eva Lovia\""' + echo ' echo ""' + echo ' echo "────────────────────────────────────────────"' + echo ' echo "Goondex $goondex_version — Leak Technologies (2025)"' + echo ' echo ""' + echo ' return' + echo '' + echo ' case import refresh-all refresh-one validate-tags tag-stats list list-tags add remove add-multi show-metadata source' + echo ' $venv_path -m src.importer.cli $cmd $args' + echo ' return' + echo '' + echo ' case trainer' + echo ' $venv_path -m src.ml.facecrop.trainer $args' + echo ' return' + echo ' case verify' + echo ' $venv_path -m src.ml.facecrop.verifier $args' + echo ' return' + echo '' + echo ' case search-performer' + echo ' $venv_path -m src.performers.search $args' + echo ' return' + echo ' case tpdb-enrich' + echo ' $venv_path -m src.performers.tpdb_bridge $args' + echo ' return' + echo '' + echo ' case -v --version version' + echo ' echo "Goondex $goondex_version — Leak Technologies"' + echo ' return' + echo '' + echo ' case "*"' + echo ' echo "[!] Unknown command: $cmd"' + echo ' echo "Use '\''goondex --help'\'' for full command list."' + echo ' return' + echo ' end' + echo 'end' +end > $goondex_func + +chmod +x $goondex_func +echo "[+] Installed goondex.fish function at: $goondex_func" + +# ------------------------------------------------------------ +# 4. Add alias gx and persistent PYTHONPATH +# ------------------------------------------------------------ +if not grep -q "alias gx=" ~/.config/fish/config.fish + echo 'alias gx="goondex"' >> ~/.config/fish/config.fish + echo "[+] Added alias gx -> goondex" +else + echo "[=] Alias gx already exists" +end + +if not contains -- "$project_root/src" $PYTHONPATH + set -Ux PYTHONPATH "$project_root/src" + echo "[+] Set universal PYTHONPATH for Goondex" +else + echo "[=] PYTHONPATH already correct" +end + +# ------------------------------------------------------------ +# 5. Reload environment cleanly +# ------------------------------------------------------------ +echo "[*] Reloading Fish environment..." +source ~/.config/fish/config.fish + +# ------------------------------------------------------------ +# 6. Verify installation +# ------------------------------------------------------------ +echo "" +echo "[✓] Verifying Goondex CLI setup..." +if functions -q goondex + echo "✅ Function 'goondex' loaded successfully." +else + echo "❌ Failed to load goondex function." +end + +if alias | grep -q "alias gx=" + echo "✅ Alias 'gx' is active." +else + echo "❌ Alias 'gx' not found." +end + +echo "" +echo "🔍 Preview:" +goondex --help | head -n 15 +echo "" +echo "[✔] Setup complete — Goondex CLI now stable across versions."