From a95bc4a11caf3469e2f43196b691d40e965d445c Mon Sep 17 00:00:00 2001 From: rootiest Date: Wed, 20 May 2026 20:30:17 -0400 Subject: [PATCH 1/4] feat(function): add scrub function to recursively purge environment garbage Adds a robust `scrub` utility function to safely and recursively clean up common OS metadata, development caches, editor artifacts, and slicer cruft using `fd`. Features: - Hierarchical deletion fallback system: checks for a custom `rm` function, falls back to `trashy` (trash put), then `trash-cli`, and drops to standard `rm -rf` as a final measure. - Safe `-d/--dry-run` modes to preview matched targets. - An advanced `-a/--aggressive` mode for wiping heavy project caches (node_modules), local logs, and custom AI runtime config histories. - Full flag validation and colorized help menus. --- functions/scrub.fish | 188 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 188 insertions(+) create mode 100644 functions/scrub.fish diff --git a/functions/scrub.fish b/functions/scrub.fish new file mode 100644 index 0000000..d2e7c76 --- /dev/null +++ b/functions/scrub.fish @@ -0,0 +1,188 @@ +# Copyright (C) 2026 Rootiest +# SPDX-License-Identifier: AGPL-3.0-or-later + +function scrub --description 'Recursively purge OS, editor, and compiler garbage files/folders from the current directory' + # Define the base garbage patterns (matches files and directory names) + set -l garbage_patterns \ + '^\.DS_Store$' \ + '^\._.*' \ + '^Thumbs\.db$' \ + '^\.directory$' \ + '.*\.swp$' \ + '.*\.swo$' \ + '^\.netrwhist$' \ + '^\.pytest_cache$' \ + '^__pycache__$' \ + '.*-debug\.log$' \ + '^\.turbo$' \ + '.*\.gcode\.(tmp|bak)$' \ + '^\.bambu_bak$' \ + '^core\.[0-9]+$' + + # Define deep-cleaning aggressive patterns + set -l aggressive_patterns \ + '.*\.class$' \ + '^\.git-crypt$' \ + '.*\.log$' \ + '.*\.log\.[0-9]+$' \ + '^node_modules$' \ + '^\.vagrant$' \ + '^\.clwb$' \ + '^\.idea$' \ + '^Thumbs\.db:encryptable$' + '^\.gemini.*' \ + '^\.claude.*' \ + '^\.antigravity.*' \ + '^\.remember.*' + + # Helper function for help menu text + function _scrub_help + echo (set_color --bold cyan)"Usage:"(set_color normal) "scrub [options]" + echo + echo (set_color --bold cyan)"Options:"(set_color normal) + echo " -a, --aggressive Purge advanced development artifacts, logs, and heavyweight caches" + echo " -d, --dry-run Show files/folders that would be targeted without removing them" + echo " -h, --help Display this help menu" + echo + echo (set_color --bold cyan)"Standard Targets:"(set_color normal) + echo " • OS Metadata: .DS_Store, ._* (AppleDouble), Thumbs.db, .directory (KDE)" + echo " • Editors: *.swp, *.swo (Vim/Nvim), .netrwhist" + echo " • Dev Caches: __pycache__, .pytest_cache, .turbo, *-debug.log" + echo " • Compiles: core.[0-9]+ (Linux core dumps)" + echo " • Slicers: *.gcode.tmp, *.gcode.bak, .bambu_bak" + echo + echo (set_color --bold yellow)"Aggressive Targets:"(set_color normal) + echo " • Heavy Caches: node_modules, .vagrant" + echo " • Extra Cruft: *.class, *.log, *.log.[0-9]+, Thumbs.db:encryptable" + echo " • IDE/Git Junk: .idea, .clwb, .git-crypt" + echo " • AI/LLM Local: .gemini*, .claude*, .antigravity*, .remember*" + end + + # Parse arguments safely + set -l dry_run 0 + set -l aggressive 0 + + for arg in $argv + switch $arg + case -h --help + _scrub_help + return 0 + case -d --dry-run + set dry_run 1 + case -a --aggressive + set aggressive 1 + case '*' + echo (set_color red)"Error: Unknown argument '$arg'"(set_color normal) + _scrub_help + return 1 + end + end + + # If aggressive mode is flagged, merge the array targets seamlessly + if test $aggressive -eq 1 + set garbage_patterns $garbage_patterns $aggressive_patterns + end + + # Core dependency verification + if not command -s fd >/dev/null + echo (set_color --bold red)"Error:"(set_color normal) "Required tool "(set_color --underline)"fd"(set_color normal)" is missing." + return 1 + end + + # Determine deletion method strategy hierarchy + set -l delete_mode "" + + if functions -q rm + set delete_mode custom_rm + else if command -s trash >/dev/null + set delete_mode trashy + else if command -s trash-put >/dev/null + set delete_mode trash_cli + else + set delete_mode fallback_rm + end + + # --- Dry Run Mode --- + if test $dry_run -eq 1 + if test $aggressive -eq 1 + echo (set_color --bold red)"⚡ Aggressive Dry Run Mode: Scanning deep tree..."(set_color normal) + else + echo (set_color --bold yellow)"⚡ Dry Run Mode: Scanning standard tree..."(set_color normal) + end + + switch $delete_mode + case custom_rm + echo (set_color --dim normal)"[Strategy: Custom rm function]"(set_color normal) + case trashy + echo (set_color --dim normal)"[Strategy: trashy (trash put)]"(set_color normal) + case trash_cli + echo (set_color --dim normal)"[Strategy: trash-cli (trash-put)]"(set_color normal) + case fallback_rm + echo (set_color --dim normal)"[Strategy: System rm -rf (fallback)]"(set_color normal) + end + echo + + set -l found_any 0 + for pattern in $garbage_patterns + set -l matches (fd --hidden --no-ignore $pattern) + if count $matches >/dev/null + set found_any 1 + for item in $matches + echo (set_color red)" 🗙 $item"(set_color normal) + end + end + end + + if test $found_any -eq 0 + echo (set_color green)"✨ No garbage targets found. Everything looks clean."(set_color normal) + end + return 0 + end + + # --- Purge Mode --- + if test $aggressive -eq 1 + echo (set_color --bold red)"🔥 Initiating AGGRESSIVE sweep..."(set_color normal) + else + echo (set_color --bold cyan)"🧹 Initiating sweep..."(set_color normal) + end + set -l count 0 + + for pattern in $garbage_patterns + set -l items (fd --hidden --no-ignore $pattern) + + if count $items >/dev/null + for item in $items + # Execute based on the resolved deletion strategy + switch $delete_mode + case custom_rm + rm $item + case trashy + trash put $item + case trash_cli + trash-put $item + case fallback_rm + command rm -rf $item + end + + echo (set_color --dim white)" [purged] $item"(set_color normal) + set count (math $count + 1) + end + end + end + + echo + if test $count -gt 0 + switch $delete_mode + case custom_rm + echo (set_color --bold green)"✔ Clean Sweep:"(set_color normal) "Safely processed" (set_color --bold yellow)$count(set_color normal) "target(s) using smart-rm." + case trashy + echo (set_color --bold green)"✔ Clean Sweep:"(set_color normal) "Safely moved" (set_color --bold yellow)$count(set_color normal) "target(s) to the system trash via trashy." + case trash_cli + echo (set_color --bold green)"✔ Clean Sweep:"(set_color normal) "Safely moved" (set_color --bold yellow)$count(set_color normal) "target(s) to the system trash via trash-put." + case fallback_rm + echo (set_color --bold red)"⚠ Hard Purge:"(set_color normal) "Permanently deleted" (set_color --bold yellow)$count(set_color normal) "target(s) via native rm -rf." + end + else + echo (set_color --bold green)"✨ Clean Sweep:"(set_color normal) "No garbage targets found. Environment is pristine." + end +end From b643c9195bff75c9ae4b6c20fb81e16ac6e76091 Mon Sep 17 00:00:00 2001 From: rootiest Date: Wed, 20 May 2026 20:31:12 -0400 Subject: [PATCH 2/4] chore(ignore): ignore all ai/llm session files --- .gitignore | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index be064e2..2d63e97 100644 --- a/.gitignore +++ b/.gitignore @@ -29,13 +29,13 @@ OLD/ *_old # AI Session IDs -.claude_session -.gemini_session -.remember/ +.claud* +.gemin* +.antigrav* +.remember # Auto-managed by fish; contains machine-local state and universal vars fish_variables -.claude # Personal testing/temporary files [Tt][Mm][Pp]/ From e075c40c9d040f87b84a33db8e49eabcef49cd4a Mon Sep 17 00:00:00 2001 From: rootiest Date: Wed, 20 May 2026 20:41:04 -0400 Subject: [PATCH 3/4] feat(ai): migrate gemini-cli references to antigravity-cli (agy) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rename gemini-resume → antigravity-resume and save_gemini_session → save_antigravity_session; update all session files from .gemini_session to .antigravity_session and LAST_GEMINI_SESSION → LAST_ANTIGRAVITY_SESSION. Replace gemini/gemini-cli binary calls with agy throughout superpowers, code-resume, and the resume function. Add antigravity-ide wrapper for the renamed IDE binary; update abbr v → antigravity-ide (VSCode-equivalent) and update README/requirements to reflect the new tool names. --- README.md | 11 +++++---- conf.d/abbr.fish | 2 +- functions/antigravity-ide.fish | 8 +++++++ functions/antigravity-resume.fish | 23 ++++++++++++++++++ functions/antigravity.fish | 6 ++--- functions/code-resume.fish | 8 +++---- functions/save_antigravity_session.fish | 32 +++++++++++++++++++++++++ functions/superpowers.fish | 18 +++++++------- requirements.md | 3 ++- 9 files changed, 88 insertions(+), 23 deletions(-) create mode 100644 functions/antigravity-ide.fish create mode 100644 functions/antigravity-resume.fish create mode 100755 functions/save_antigravity_session.fish diff --git a/README.md b/README.md index bad8ea0..3f8f74c 100644 --- a/README.md +++ b/README.md @@ -329,9 +329,9 @@ Install method priority: **git+cargo source build** (fish) → **cargo** (other | Function | Description | |---|---| | `claude-resume` | Resume Claude Code session from `.claude_session` in CWD | -| `gemini-resume` | Resume Gemini CLI session from `.gemini_session` in CWD | -| `code-resume` | Smart resume — tries Claude then Gemini, falls back to picker | -| `superpowers [on\|off]` | Enable/disable the Superpowers extension for Claude and Gemini | +| `antigravity-resume` | Resume antigravity-cli session from `.antigravity_session` in CWD | +| `code-resume` | Smart resume — tries Claude then antigravity-cli, falls back to picker | +| `superpowers [on\|off]` | Enable/disable the Superpowers extension for Claude and antigravity-cli | | `claude-docs` | Ask Claude to sync `README.md` with recent session changes | | `claude-pr` | Create a branch, commit, push, and open a PR via Claude | @@ -350,7 +350,8 @@ Install method priority: **git+cargo source build** (fish) → **cargo** (other |---|---| | `upgrade` | System upgrade via paru | | `zellij` | Zellij with `--theme catppuccin-mocha` | -| `antigravity` | Wrapper that suppresses a noisy deprecation warning | +| `antigravity` | Wrapper for `agy` (antigravity-cli) that suppresses a noisy warning | +| `antigravity-ide` | Wrapper for `antigravity-ide` binary that suppresses a noisy warning | | `bash` | Drop into bash (raw Fish session via `rawfish`) | --- @@ -379,7 +380,7 @@ These abbreviations replicate Bash's bang-style history expansions. They expand | `n`, `nv` | `nvim` | | `e` | `edit` | | `se` | `sudoedit` | -| `v` | `antigravity` (VSCode-equivalent) | +| `v` | `antigravity-ide` (VSCode-equivalent) | | `k` | `kate` | ### Listing diff --git a/conf.d/abbr.fish b/conf.d/abbr.fish index a9e89db..5ba8278 100644 --- a/conf.d/abbr.fish +++ b/conf.d/abbr.fish @@ -15,7 +15,7 @@ abbr -a neovim nvim abbr -a cdnv 'cd ~/.config/nvim # Neovim Config' abbr -a cdnvn 'cd ~/.config/nvim;nvim' # VSCode -abbr -a v antigravity +abbr -a v antigravity-ide # Kate abbr -a k kate # WezTerm SSH diff --git a/functions/antigravity-ide.fish b/functions/antigravity-ide.fish new file mode 100644 index 0000000..a94b368 --- /dev/null +++ b/functions/antigravity-ide.fish @@ -0,0 +1,8 @@ +# Copyright (C) 2026 Rootiest +# SPDX-License-Identifier: AGPL-3.0-or-later + +# alias antigravity-ide=antigravity +function antigravity-ide --wraps='antigravity-ide' --description 'alias antigravity-ide=antigravity-ide' + # In fish, we pipe stderr using '2>|' to another command + command antigravity-ide $argv 2>| grep -v "'app' is not in the list of known options" >&2 +end diff --git a/functions/antigravity-resume.fish b/functions/antigravity-resume.fish new file mode 100644 index 0000000..5b33b14 --- /dev/null +++ b/functions/antigravity-resume.fish @@ -0,0 +1,23 @@ +# Copyright (C) 2026 Rootiest +# SPDX-License-Identifier: AGPL-3.0-or-later + +# Execute antigravity-resume +function antigravity-resume --description 'Execute antigravity-resume' + if not type -q agy + echo "Error: The 'agy' command is not installed or not in PATH." >&2 + return 1 + end + if not type -q save_antigravity_session + echo "Error: The companion function 'save_antigravity_session' is missing." >&2 + return 1 + end + + if test -f .antigravity_session + set -l sid (cat .antigravity_session) + # Use --resume (or -r) to jump back in + agy --resume $sid + else + # Fallback to the interactive session browser + agy --resume + end +end diff --git a/functions/antigravity.fish b/functions/antigravity.fish index a7a3a78..4d0e701 100644 --- a/functions/antigravity.fish +++ b/functions/antigravity.fish @@ -1,8 +1,8 @@ # Copyright (C) 2026 Rootiest # SPDX-License-Identifier: AGPL-3.0-or-later -# alias antigravity=antigravity -function antigravity --wraps='antigravity' --description 'alias antigravity=antigravity' +# alias antigravity=agy +function antigravity --wraps='agy' --description 'alias antigravity=agy' # In fish, we pipe stderr using '2>|' to another command - command antigravity $argv 2>| grep -v "'app' is not in the list of known options" >&2 + command agy $argv 2>| grep -v "'app' is not in the list of known options" >&2 end diff --git a/functions/code-resume.fish b/functions/code-resume.fish index ed00f0b..5efbff8 100644 --- a/functions/code-resume.fish +++ b/functions/code-resume.fish @@ -7,10 +7,10 @@ function code-resume --description 'Execute code-resume' set -l sid (cat .claude_session) echo "Resuming Claude session: $sid" claude --resume $sid - else if test -f .gemini_session - set -l sid (cat .gemini_session) - echo "Resuming Gemini session: $sid" - gemini --resume $sid + else if test -f .antigravity_session + set -l sid (cat .antigravity_session) + echo "Resuming antigravity-cli session: $sid" + agy --resume $sid else echo "No local AI session found. Opening picker..." claude --resume # Default to Claude picker diff --git a/functions/save_antigravity_session.fish b/functions/save_antigravity_session.fish new file mode 100755 index 0000000..6344fa6 --- /dev/null +++ b/functions/save_antigravity_session.fish @@ -0,0 +1,32 @@ +#!/usr/bin/env fish + +# Copyright (C) 2026 Rootiest +# SPDX-License-Identifier: AGPL-3.0-or-later + +# 1. Read the JSON from stdin +set -l input (cat) + +# 2. Extract session_id using Python +set -l sid (echo $input | python3 -c "import sys,json; print(json.load(sys.stdin).get('session_id', ''))") +set -l session_file ".antigravity_session" + +if test -n "$sid" + # 3. Save the session ID locally + echo "$sid" >$session_file + + # 4. Smart .gitignore check + # We only attempt this if we are inside a Git repository + if git rev-parse --is-inside-work-tree >/dev/null 2>&1 + # If 'git check-ignore' fails, it means the file is NOT currently ignored + if not git check-ignore -q $session_file + # Append a labeled entry to .gitignore + echo -e "\n# AI Session IDs\n$session_file" >>.gitignore + end + end + + # 5. Update universal variable for cross-terminal access + set -U LAST_ANTIGRAVITY_SESSION "$sid" +end + +# MANDATORY: Every hook must output valid JSON or an empty object +echo '{}' diff --git a/functions/superpowers.fish b/functions/superpowers.fish index d5c69b4..86d9388 100644 --- a/functions/superpowers.fish +++ b/functions/superpowers.fish @@ -1,17 +1,17 @@ # Copyright (C) 2026 Rootiest # SPDX-License-Identifier: AGPL-3.0-or-later -# Toggle superpowers extension for Gemini and Claude -function superpowers --description 'Toggle superpowers extension for Gemini and Claude' - set -l scope_gemini workspace +# Toggle superpowers extension for antigravity-cli and Claude +function superpowers --description 'Toggle superpowers extension for antigravity-cli and Claude' + set -l scope_agy workspace set -l scope_claude project set -l mode "" set -l help_text " Usage: superpowers [on|off] [options] Commands: - on Enable superpowers for Gemini and Claude - off Disable superpowers for Gemini and Claude + on Enable superpowers for antigravity-cli and Claude + off Disable superpowers for antigravity-cli and Claude Options: -g, --global Apply settings to the user/global scope @@ -26,7 +26,7 @@ Options: case off set mode disable case -g --global - set scope_gemini user + set scope_agy user set scope_claude user case -h --help echo $help_text @@ -40,10 +40,10 @@ Options: return 1 end - echo "Setting superpowers to: $mode (Scope: Gemini=$scope_gemini, Claude=$scope_claude)..." + echo "Setting superpowers to: $mode (Scope: antigravity-cli=$scope_agy, Claude=$scope_claude)..." - # Execute Gemini command - gemini extensions $mode superpowers --scope $scope_gemini + # Execute antigravity-cli command + agy extensions $mode superpowers --scope $scope_agy # Execute Claude command claude plugins $mode superpowers --scope $scope_claude diff --git a/requirements.md b/requirements.md index ed9eb40..44b432a 100644 --- a/requirements.md +++ b/requirements.md @@ -87,7 +87,8 @@ Non-standard applications required by this fish shell configuration. | `wakatime` | Developer time tracking | Initialized in `wakatime.fish` | | `bd` / `beads` | Lightweight issue tracker | `bd-pull.fish`, abbreviations | | `lazybeads` | Terminal UI for beads | Abbreviation target | -| `antigravity` | Custom launcher tool | `antigravity.fish`, abbreviations | +| `agy` | antigravity-cli AI assistant | `antigravity.fish` wrapper, abbreviations | +| `antigravity-ide` | antigravity-ide editor | `antigravity-ide.fish` wrapper, abbreviations | ## Container Tools From 1d71323cc81fc8bebc411b91326f7a84993a737b Mon Sep 17 00:00:00 2001 From: rootiest Date: Wed, 20 May 2026 20:43:17 -0400 Subject: [PATCH 4/4] chore(ai): remove old gemini-resume and save_gemini_session files Completes the rename started in the previous commit; these files were superseded by antigravity-resume and save_antigravity_session. --- functions/gemini-resume.fish | 23 --------------------- functions/save_gemini_session.fish | 32 ------------------------------ 2 files changed, 55 deletions(-) delete mode 100644 functions/gemini-resume.fish delete mode 100755 functions/save_gemini_session.fish diff --git a/functions/gemini-resume.fish b/functions/gemini-resume.fish deleted file mode 100644 index d30f967..0000000 --- a/functions/gemini-resume.fish +++ /dev/null @@ -1,23 +0,0 @@ -# Copyright (C) 2026 Rootiest -# SPDX-License-Identifier: AGPL-3.0-or-later - -# Execute gemini-resume -function gemini-resume --description 'Execute gemini-resume' - if not type -q gemini-cli - echo "Error: The 'gemini-cli' command is not installed or not in PATH." >&2 - return 1 - end - if not type -q save_gemini_session - echo "Error: The companion function 'save_gemini_session' is missing." >&2 - return 1 - end - - if test -f .gemini_session - set -l sid (cat .gemini_session) - # Use --resume (or -r) to jump back in - gemini --resume $sid - else - # Fallback to the interactive session browser - gemini --resume - end -end diff --git a/functions/save_gemini_session.fish b/functions/save_gemini_session.fish deleted file mode 100755 index 638b3a1..0000000 --- a/functions/save_gemini_session.fish +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env fish - -# Copyright (C) 2026 Rootiest -# SPDX-License-Identifier: AGPL-3.0-or-later - -# 1. Read the JSON from stdin -set -l input (cat) - -# 2. Extract session_id using Python -set -l sid (echo $input | python3 -c "import sys,json; print(json.load(sys.stdin).get('session_id', ''))") -set -l session_file ".gemini_session" - -if test -n "$sid" - # 3. Save the session ID locally - echo "$sid" >$session_file - - # 4. Smart .gitignore check - # We only attempt this if we are inside a Git repository - if git rev-parse --is-inside-work-tree >/dev/null 2>&1 - # If 'git check-ignore' fails, it means the file is NOT currently ignored - if not git check-ignore -q $session_file - # Append a labeled entry to .gitignore - echo -e "\n# AI Session IDs\n$session_file" >>.gitignore - end - end - - # 5. Update universal variable for cross-terminal access - set -U LAST_GEMINI_SESSION "$sid" -end - -# MANDATORY: Every hook must output valid JSON or an empty object -echo '{}'