# =================================================================== # WAREZ FACTORY UNIVERSAL .zshrc v2.0 # =================================================================== # --- Basic Aliases --- alias ll='ls -l' alias la='ls -la' alias rc='nano ~/.zshrc && source ~/.zshrc' # Use nano for consistency alias zprofile='nano ~/.zprofile && source ~/.zprofile' alias profile='zprofile' # --- Warez Factory Navigation --- alias workspace='cd $FACTORY_HOME/xcode/workspace/' alias bin='cd $FACTORY_HOME/payloads/bin/' alias logs='cd $FACTORY_HOME/payloads/logs/' alias reports='cd $FACTORY_HOME/payloads/reports/' alias xcode='cd $FACTORY_HOME/xcode/' alias llXcode='xcode ; ll' alias workspace='cd $FACTORY_HOME/xcode/workspace/' alias llWorkspace='workspace ; ll' # --- Warez Factory Tools --- alias cleanup='find "$FACTORY_HOME/payloads/staging" "$FACTORY_HOME/payloads/archived" "$FACTORY_HOME/payloads/rejected" "$FACTORY_HOME/payloads/logs" -type f -delete' alias resetXcode='reset-xcode-state' # --- System Utilities --- alias hosts='sudo nano /etc/hosts' alias resetHosts='sudo killall -HUP mDNSResponder' # =================================================================== # CODE CUSTODIAN UTILITIES # =================================================================== # Function: resetCCdb # Purpose: Deletes the Code Custodian SQLite database files to ensure a clean start. # Includes a safety check to prevent running while the app is active. function resetCCdb() { # --- THE DEFINITIVE SAFETY CHECK --- # Use osascript to check if the application is running by its bundle identifier. # This is more robust than checking by name. local bundle_id="com.higginsoft.Code-Custodian" local is_running=$(osascript -e "application id \"$bundle_id\" is running") if [ "$is_running" = "true" ]; then echo "🛑 Error: Code Custodian is currently running." echo " Please quit the application before resetting the database. Aborting." return 1 fi echo "🔥 Beginning Code Custodian database reset..." # Run the core logic in a subshell to preserve the current working directory. ( local db_dir="/Users/dave/Library/Application Support/Code Custodian/" if ! cd "$db_dir"; then echo "❌ Error: Directory not found at '$db_dir'. Aborting." return 1 fi echo " -> In directory: $(pwd)" echo " -> Removing database files..." rm -f Code_Custodian.sqlite rm -f Code_Custodian.sqlite-shm rm -f Code_Custodian.sqlite-wal ) echo "✅ Reset complete. The database has been cleared." } alias resetccdb='resetCCdb' alias resetcc='resetCCdb' alias resetCC='resetCCdb' # function setproj() { # if [ -z "$FACTORY_HOME" ]; then echo "Error: FACTORY_HOME not set."; return 1; fi # local workspace_dir="$FACTORY_HOME/xcode/workspace" # if [ -z "$1" ]; then # echo "Usage: setproj " # find "$workspace_dir" -maxdepth 3 -type d -name "*.xcodeproj" -exec dirname {} \; | xargs -n 1 basename | sort -u # return 1 # fi # local project_path=$(find "$workspace_dir" -maxdepth 3 -type d -name "$1.xcodeproj" -print | head -n 1) # if [ -z "$project_path" ]; then echo "Error: Project '$1' not found."; return 1; fi # local project_dir=$(dirname "$project_path") # export CURRENT_PROJECT_PATH="$project_dir" # cd "$CURRENT_PROJECT_PATH" # echo "✅ Active project set to: $1" # } # # function gitsave() { # if [ -z "$1" ] || [ -z "$2" ]; then echo "Usage: gitsave \"\""; return 1; fi # echo "💾 Creating save point for '$1'..." # setproj "$1" && git add . && git commit -m "$2" && git status # } # # function gitrollback() { # if [ -z "$1" ]; then echo "Usage: gitrollback "; return 1; fi # echo "⏪ Rolling back '$1' to last commit..." # setproj "$1" && git reset --hard HEAD && git clean -fd && git status # } # # function checkrepo() { # if [ -z "$1" ]; then echo "Usage: checkrepo "; return 1; fi # setproj "$1" # if [ $? -ne 0 ]; then return 1; fi # echo "\n--- 📊 STATUS REPORT for: $1 ---\n" # echo "--- Current Status ---"; git status; echo "" # echo "--- Recent Log ---"; gitlog; echo "\n--- End of Report ---" # } # # # --- Core Git Aliases & Functions --- # alias gitstatus='git status' # # # The gitlog is now a function for robust use inside other scripts. # function gitlog() { # git log --graph --pretty=format:"%C(yellow)%h%C(reset) -%C(auto)%d%C(reset) %s %C(green)(%ar)%C(reset)" --all # } # # alias gitaddall='git add .' # alias gitcommit='git commit -m' # alias gitclean='git clean -fd' # alias gitreset='git reset --hard HEAD' # alias gitbranches='git branch -a' # alias gitcheckpoint='gitaddall && gitcommit "Checkpoint commit." && gitstatus' # # =================================================================== # # 🏭 DYNAMIC PROJECT LOADER # # =================================================================== # # Scans for .project_config.zsh files in the workspace apps and loads them. # # if [ -d "$FACTORY_WORKSPACE/apps" ]; then # # Find all .project_config.zsh files (maxdepth 3 covers apps/ProjectName/.project_config.zsh) # # We suppress errors to keep the shell clean. # find "$FACTORY_WORKSPACE/apps" -maxdepth 3 -name ".project_config.zsh" 2>/dev/null | while read config; do # source "$config" # done # else # echo "⚠️ Factory Apps directory not found at $FACTORY_WORKSPACE/apps" # fi # --- Project-Specific Wrapper Functions & Aliases --- # # =================================================================== # # CROSSTALK # # =================================================================== # # function ctgitsave() { # if [ -z "$1" ]; then echo "Usage: ctgitsave \"\""; return 1; fi # gitsave "CrossTalk" "$1" # } # # function ctgitrollback() { gitrollback "CrossTalk" } # alias ctgitlog='setproj "CrossTalk" ; gitlog' # alias ctSave='ctgitsave' # alias ctsave='ctgitsave' # alias ctRollback='ctgitrollback' # alias ctrollback='ctgitrollback' # # function ctgit() { # setproj "CrossTalk" && git "$@" # } # # # # =================================================================== # # FACTORY TEST # # =================================================================== # # function ftestgitsave() { # if [ -z "$1" ]; then echo "Usage: ftestgitsave \"\""; return 1; fi # gitsave "Factory Test" "$1" # } # # function ftestgitrollback() { gitrollback "Factory Test" } # alias ftestgitlog='setproj "Factory Test" ; gitlog' # alias ftestSave='ftestgitsave' # alias ftestsave='ftestgitsave' # alias ftestRollback='ftestgitrollback' # alias ftestrollback='ftestgitrollback' # # function ftestgit() { # setproj "Factory Test" && git "$@" # } # =================================================================== # Code Custodian # =================================================================== # function ccgitsave() { # if [ -z "$1" ]; then echo "Usage: ccgitsave \"\""; return 1; fi # gitsave "Code Custodian" "$1" # } # # function ccgitrollback() { gitrollback "Code Custodian" } # alias ccgitlog='setproj "Code Custodian" ; gitlog' # alias ccSave='ccgitsave' # alias ccsave='ccgitsave' # alias ccRollback='ccgitrollback' # alias ccrollback='ccgitrollback' # =================================================================== # GitHubKit # =================================================================== function ghkgitsave() { if [ -z "$1" ]; then echo "Usage: ghkgitsave \"\""; return 1; fi gitsave "GitHubKit" "$1" } function ghkgitrollback() { gitrollback "GitHubKit" } alias ghkgitlog='setproj "GitHubKit" ; gitlog' alias ghkSave='ghkgitsave' alias ghksave='ghkgitsave' alias ghkRollback='ghkgitrollback' alias ghkrollback='ghkgitrollback' # =================================================================== # ALL PROJECTS # =================================================================== # Function: gitstatusall # Purpose: Performs a 'git status' on every project in the workspace, # plus the workspace's own root repository. function gitstatusall() { if [ -z "$FACTORY_HOME" ]; then echo "Error: FACTORY_HOME not set."; return 1; fi local workspace_dir="$FACTORY_HOME/xcode/workspace" echo "--- 🏭 FACTORY-WIDE GIT AUDIT ---" # 1. Check the workspace root itself echo "\n--- Checking Workspace Root ---" (cd "$workspace_dir" && git status) # 2. Find and check every project within the workspace echo "\n--- Checking All Projects ---" find "$workspace_dir" -maxdepth 3 -type d -name ".git" | while read -r gitdir; do local projectdir=$(dirname "$gitdir") local projectname=$(basename "$projectdir") echo "\n--- Project: $projectname ---" (cd "$projectdir" && git status) done echo "\n--- ✅ Audit Complete ---" } # =================================================================== # MISC # =================================================================== alias opentunnel='ssh -L 3307:localhost:3306 root@68.183.154.58' alias models='ll /Volumes/FACTORY_SSD/models' # =================================================================== # DISK UTILITIES # =================================================================== # Function: purgeDisk # Purpose: Finds and deletes all local Time Machine snapshots to reclaim # "purgeable" disk space on APFS volumes. function purgeDisk() { echo "🔍 Searching for local Time Machine snapshots..." # --- THE DEFINITIVE FIX IS HERE --- # We use 'grep' to filter out the header line and get ONLY the actual snapshot lines. # This ensures the variable is truly empty when no snapshots exist. local snapshots=$(tmutil listlocalsnapshots / | grep 'com.apple.TimeMachine') if [ -z "$snapshots" ]; then echo "✅ No local snapshots found. Nothing to purge." return 0 fi echo "💥 Found snapshots. Beginning purge..." # The rest of the loop is now safer because it only ever receives valid snapshot lines. echo "$snapshots" | while read -r snapshot_line; do # The awk command is still a good way to extract the date part. local snapshot_date=$(echo "$snapshot_line" | awk -F. '{print $4}') if [ -n "$snapshot_date" ]; then echo " -> Deleting snapshot: $snapshot_date" tmutil deletelocalsnapshots "$snapshot_date" fi done echo "✅ Purge complete. Check Disk Utility for updated free space." } # Function: clear_clipboard_archives # Purpose: Deletes massive files stuck in the macOS Universal Clipboard/Handoff cache # (group.com.apple.coreservices.useractivityd) that silently eat disk space. function clear_clipboard_archives() { echo "🔍 Checking Universal Clipboard cache..." local target_dir="$HOME/Library/Group Containers/group.com.apple.coreservices.useractivityd/shared-pasteboard/archives" # Check if the directory exists if [ ! -d "$target_dir" ]; then echo "✅ No clipboard archive directory found. System is clean." return 0 fi # Count how many files are in there local file_count=$(ls -1q "$target_dir" 2>/dev/null | wc -l | tr -d ' ') if [ "$file_count" -eq 0 ]; then echo "✅ Clipboard archive is already empty. Nothing to purge." return 0 fi echo "💥 Found $file_count cached clipboard file(s). Vaporizing..." # Safely remove only the contents, not the folder itself rm -rf "$target_dir"/* echo "✅ Purge complete! $file_count ghost files destroyed." } # Alias for quick access if you prefer typing something shorter alias clear_archives="clear_clipboard_archives" # =================================================================== # =================================================================== # 🏭 GEMINI API # =================================================================== # export GEMINI_API_KEY="AIzaSyAuj75SFRa5DhIZXjQ-98viAeBbSM-m2e0" # =================================================================== # 🏭 GEMINI AI STUDIO # =================================================================== # Path to the AI Studio chat logs on this machine export GD_STUDIO_PATH="$HOME/Library/CloudStorage/GoogleDrive-laserpix42025@gmail.com/My Drive/Google AI Studio" # =================================================================== # 🏭 FACTORY MODULE LOADER # =================================================================== # Define the path (using your correct Dropbox path) FACTORY_CONFIG="$HOME/warezfactory/config/factory_core.zsh" # Check if the file exists before trying to load it if [ -f "$FACTORY_CONFIG" ]; then source "$FACTORY_CONFIG" else echo "⚠️ Factory Core config not found at: $FACTORY_CONFIG" fi # =================================================================== # 🏭 FACTORY PROMPT STYLE # =================================================================== # Enable color support autoload -U colors && colors # The Prompt Structure: # %n = User # %m = Hostname # %1~ = Only the current folder name (Not the full path) # %# = The prompt symbol (% or #) PROMPT=$'%{\e[32m%}%n@%m%{\e[0m%}:%{\e[36m%}%1~%{\e[0m%} %# ' # --- CODEX CLI ALIASES --- export CODEX_HOME="$HOME/Library/Developer/Xcode/CodingAssistant/codex" export CODEX_BIN="$HOME/.local/bin/codex" alias codex_login="\"\$CODEX_BIN\" login" alias codex_logout="\"\$CODEX_BIN\" logout" # The "Start the Clock" Ping alias codex_ping='echo "// Ping. Acknowledge and ignore." | "$CODEX_BIN" exec --skip-git-repo-check' # Added by Antigravity export PATH="/Users/dave/.antigravity/antigravity/bin:$PATH"