From 8a17f1edb383656bf8cccd642e95464a0e0c2594 Mon Sep 17 00:00:00 2001 From: fr3on Date: Sun, 12 Jul 2026 17:11:24 +0300 Subject: [PATCH] refactor: fix icon registry, installer bugs, and versioning; disable exec time by default - Route plugin icons through the shared AP_ICONS registry. All first-party plugins referenced nonexistent _AP_ICO_* shortcut vars or hardcoded nerd-font glyphs, so they never respected the ASCII/Unicode/Font Awesome/Nerd Font tier switching the core segments already honored. Added the missing icon keys (CPANEL, GH, TARGET, VPN_ON/OFF, TAILSCALE, CPU, RAM) to all four tiers, and replaced 12 icons that were pulled from Material Design Icons (a visibly larger/bolder glyph set) with same-family Font Awesome/Devicons equivalents for consistent sizing. - Consolidate the git segment into a single `git status --porcelain=v2 --branch` call, replacing the rev-parse + symbolic-ref + status + rev-list combo (4-5 forks per prompt refresh). - Fix icon-tier and installer quoting bugs: - AP_USE_NERD_FONT/AP_ASCII_FALLBACK had no default, so fresh installs silently fell back to the Unicode tier instead of Nerd Font. - install.sh wrote \" (literal backslash-quote) into ~/.zshrc's HISTFILE line and into the bash->zsh bridge condition in ~/.bashrc, permanently breaking the bridge's -z check. - The bridge only patched ~/.bashrc; added the same bridge to ~/.profile since fresh login shells often don't chain into .bashrc. - Introduce a single-source-of-truth VERSION file. Add scripts/bump-version.sh to sync APORIA_VERSION across aporia.zsh-theme and install.sh, plus CI/release checks that fail if any copy drifts from the tagged version. `aporia upgrade` now reports the actual before/after version instead of upgrading silently. - Disable the exec-time segment by default (AP_SHOW_EXEC_TIME=0). --- .github/workflows/ci.yml | 19 ++++ .github/workflows/release.yml | 26 +++++ VERSION | 1 + aporia.zsh-theme | 142 ++++++++++++++++++---------- install.sh | 18 +++- plugins/aws-profile/aws-profile.zsh | 2 +- plugins/azure-ctx/azure-ctx.zsh | 4 +- plugins/cpanel/cpanel.zsh | 4 +- plugins/docker-ctx/docker-ctx.zsh | 2 +- plugins/gcp-ctx/gcp-ctx.zsh | 4 +- plugins/gh-context/gh-context.zsh | 4 +- plugins/kube-ctx/kube-ctx.zsh | 2 +- plugins/nix-shell/nix-shell.zsh | 2 +- plugins/proxmox/proxmox.zsh | 2 +- plugins/target/target.zsh | 5 +- plugins/telemetry/telemetry.zsh | 6 +- plugins/vpn-status/vpn-status.zsh | 7 +- scripts/bump-version.sh | 36 +++++++ tests/test_plugins.zsh | 2 +- uninstall.sh | 23 ++--- 20 files changed, 223 insertions(+), 88 deletions(-) create mode 100644 VERSION create mode 100755 scripts/bump-version.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5a091ff..585e459 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,6 +1,25 @@ name: CI on: [push, pull_request] jobs: + version-consistency: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Check VERSION matches all embedded copies + run: | + VERSION=$(cat VERSION) + THEME_VERSION=$(grep -oP '(?<=^export APORIA_VERSION=")[^"]*' aporia.zsh-theme) + INSTALL_VERSION=$(grep -oP '(?<=^APORIA_VERSION=")[^"]*' install.sh) + + fail=0 + [ "$VERSION" = "$THEME_VERSION" ] || { echo "::error file=aporia.zsh-theme::APORIA_VERSION ($THEME_VERSION) does not match VERSION ($VERSION)"; fail=1; } + [ "$VERSION" = "$INSTALL_VERSION" ] || { echo "::error file=install.sh::APORIA_VERSION ($INSTALL_VERSION) does not match VERSION ($VERSION)"; fail=1; } + + if [ "$fail" -eq 1 ]; then + echo "Run: scripts/bump-version.sh (to re-sync from ./VERSION)" + exit 1 + fi + echo "All version strings match: $VERSION" lint: runs-on: ubuntu-latest steps: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 88e81e8..0b5215c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,8 +9,34 @@ permissions: contents: write jobs: + verify-version: + name: Verify tag matches VERSION + runs-on: ubuntu-latest + steps: + - name: Checkout Code + uses: actions/checkout@v4 + + - name: Check tag matches VERSION and embedded copies + run: | + TAG="${GITHUB_REF_NAME}" + VERSION=$(cat VERSION) + THEME_VERSION=$(grep -oP '(?<=^export APORIA_VERSION=")[^"]*' aporia.zsh-theme) + INSTALL_VERSION=$(grep -oP '(?<=^APORIA_VERSION=")[^"]*' install.sh) + + fail=0 + [ "$TAG" = "$VERSION" ] || { echo "::error::Tag ($TAG) does not match VERSION file ($VERSION)"; fail=1; } + [ "$TAG" = "$THEME_VERSION" ] || { echo "::error::Tag ($TAG) does not match aporia.zsh-theme APORIA_VERSION ($THEME_VERSION)"; fail=1; } + [ "$TAG" = "$INSTALL_VERSION" ] || { echo "::error::Tag ($TAG) does not match install.sh APORIA_VERSION ($INSTALL_VERSION)"; fail=1; } + + if [ "$fail" -eq 1 ]; then + echo "Run scripts/bump-version.sh $TAG, commit, then re-tag." + exit 1 + fi + echo "Tag $TAG matches VERSION and all embedded copies." + release: name: Create GitHub Release + needs: verify-version runs-on: ubuntu-latest steps: - name: Checkout Code diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..65087b4 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +1.1.4 diff --git a/aporia.zsh-theme b/aporia.zsh-theme index e0ecccd..2e0b62a 100644 --- a/aporia.zsh-theme +++ b/aporia.zsh-theme @@ -234,12 +234,18 @@ _ap_is_utf8() { AP_SHOW_SSH=${AP_SHOW_SSH:-1} # user@host (SSH sessions only) AP_SHOW_GIT=${AP_SHOW_GIT:-1} # git branch + dirty/ahead/behind AP_SHOW_LANGS=${AP_SHOW_LANGS:-1} # python / node / rust versions -AP_SHOW_EXEC_TIME=${AP_SHOW_EXEC_TIME:-1} # execution time (> threshold) +AP_SHOW_EXEC_TIME=${AP_SHOW_EXEC_TIME:-0} # execution time (> threshold) AP_EXEC_TIME_THRESHOLD=${AP_EXEC_TIME_THRESHOLD:-0} # seconds (0 = show for all commands) AP_SHOW_EXIT_CODE=${AP_SHOW_EXIT_CODE:-1} # non-zero exit codes AP_SHOW_TIME=${AP_SHOW_TIME:-1} # clock on right AP_DIR_DEPTH=${AP_DIR_DEPTH:-3} # how many path segments to show +# Icon-tier defaults. Without these, unset vars evaluate to 0 in the -eq +# checks below and silently downgrade fresh installs from Nerd Font to +# the Unicode tier. +AP_USE_NERD_FONT=${AP_USE_NERD_FONT:-1} +AP_ASCII_FALLBACK=${AP_ASCII_FALLBACK:-0} + # ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ # ─── ICONOGRAPHY ───────────────────────────────────────────────────────────── typeset -gA AP_ICONS @@ -265,7 +271,11 @@ if [[ $AP_ASCII_FALLBACK -eq 1 ]] || ! _ap_is_utf8; then KUBE "k8s" AWS "aws" GCP "gcp" AZURE "az" VPN "vpn" NIX "nix" - PVE "pve" + PVE "pve" CPANEL "cp" + GH "gh" TARGET "tgt" + VPN_ON "vpn+" VPN_OFF "vpn-" + TAILSCALE "ts" CPU "cpu" + RAM "ram" ) elif [[ $AP_USE_NERD_FONT -eq 0 ]]; then # Tier 2: Standard Unicode (Compatibility Mode) @@ -287,21 +297,25 @@ elif [[ $AP_USE_NERD_FONT -eq 0 ]]; then KUBE "⎈" AWS "aws" GCP "gcp" AZURE "az" VPN "vpn" NIX "nix" - PVE "pve" + PVE "pve" CPANEL "▤" + GH "gh" TARGET "◎" + VPN_ON "⇄" VPN_OFF "⊘" + TAILSCALE "ts" CPU "▤" + RAM "▥" ) elif [[ $AP_ICON_STYLE == "font_awesome" ]]; then # Tier 1.5: Font Awesome AP_ICONS=( SEP_L "" SEP_R "" - GIT "" SSH "" + GIT "" SSH "" DIR "" OK "" ERR "" TIME "" EXEC "" PROMPT "" PY "" NODE "" - RUST "" GO "" - RUBY "" PHP "" + RUST "" GO "" + RUBY "" PHP "" JAVA "" CPP "" - DENO "" DIRTY "" + DENO "" DIRTY "" STAGED "" MODIFIED "" UNTRACKED "" AHEAD "" BEHIND "" STASH "" @@ -309,6 +323,10 @@ elif [[ $AP_ICON_STYLE == "font_awesome" ]]; then AWS "" GCP "" AZURE "" VPN "" NIX "" PVE "" + CPANEL "" GH "" + TARGET "" VPN_ON "" + VPN_OFF "" TAILSCALE "" + CPU "" RAM "" ) # OS Logic if _ap_is_macos; then AP_ICONS[OS]=""; elif [[ -n $WSL_DISTRO_NAME ]]; then AP_ICONS[OS]=""; else AP_ICONS[OS]=""; fi @@ -316,15 +334,15 @@ else # Tier 1: Nerd Font (Classic Elegant Mono Mode) AP_ICONS=( SEP_L "" SEP_R "" - GIT "" SSH "󰭎" + GIT "" SSH "" DIR "" OK "" ERR "" TIME "" EXEC "" PROMPT "❯" PY "" NODE "" - RUST "" GO "󰟓" - RUBY "" PHP "󰌟" + RUST "" GO "" + RUBY "" PHP "" JAVA "" CPP "" - DENO "󰄙" DIRTY "" + DENO "" DIRTY "" STAGED "" MODIFIED "" UNTRACKED "" AHEAD "" BEHIND "" STASH "" @@ -332,6 +350,10 @@ else AWS "" GCP "" AZURE "" VPN "" NIX "" PVE "" + CPANEL "" GH "" + TARGET "" VPN_ON "" + VPN_OFF "" TAILSCALE "" + CPU "" RAM "" OS "$(_ap_get_os_icon)" ) # Override OS icon for classic look @@ -477,35 +499,44 @@ fi # GIT STATUS # ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ _ap_segment_git() { - command git rev-parse --is-inside-work-tree &>/dev/null || { echo "NONE"; return 1; } - - local branch dirty ahead=0 behind=0 + # Single fork covers: work-tree check, branch/SHA, ahead/behind, and all + # file states — replaces the old rev-parse + symbolic-ref + status + + # rev-list combo (4-5 forks) with one `git status` call. + local raw + raw=$(command git status --porcelain=v2 --branch 2>/dev/null) + (( $? )) && { echo "NONE"; return 1; } + + local branch="" oid="" dirty ahead=0 behind=0 local staged=0 modified=0 untracked=0 + local line + + while IFS= read -r line; do + case $line in + "# branch.head "*) branch=${line#\# branch.head } ;; + "# branch.oid "*) oid=${line#\# branch.oid } ;; + "# branch.ab "*) + local ab=${line#\# branch.ab } + ahead=${ab%% *}; ahead=${ahead#+} + behind=${ab##* }; behind=${behind#-} + ;; + "1 "*|"2 "*) + local -a f=(${(s: :)line}) + local xy=${f[2]} + [[ ${xy[1]} != "." ]] && (( staged++ )) + [[ ${xy[2]} == "M" || ${xy[2]} == "D" ]] && (( modified++ )) + ;; + "u "*) (( staged++ )); (( modified++ )) ;; + "? "*) (( untracked++ )) ;; + esac + done <<< "$raw" - # Branch name or short SHA (detached HEAD) - branch=$(command git symbolic-ref --short HEAD 2>/dev/null) - [[ -z $branch ]] && branch=$(command git rev-parse --short HEAD 2>/dev/null) + # Detached HEAD or unborn branch: fall back to short SHA + [[ -z $branch || $branch == "(detached)" ]] && branch=${oid:0:7} [[ -z $branch ]] && { echo "NONE"; return 1; } - # Parse porcelain status for counts - local git_status - git_status=$(command git status --porcelain 2>/dev/null) - if [[ -n $git_status ]]; then - dirty=1 - staged=$(echo "$git_status" | grep -c "^[MADRC]") - modified=$(echo "$git_status" | grep -c "^.[MD]") - untracked=$(echo "$git_status" | grep -c "??") - fi - - # Ahead / behind upstream - local ab - ab=$(command git rev-list --count --left-right "@{upstream}...HEAD" 2>/dev/null) - if [[ -n $ab ]]; then - behind=${ab%%$'\t'*} - ahead=${ab##*$'\t'} - fi + (( staged + modified + untracked > 0 )) && dirty=1 - # Stash count + # Stash count (not reported by `git status`, needs its own call) local stash=0 stash=$(command git stash list 2>/dev/null | wc -l | tr -d ' ') @@ -1380,7 +1411,7 @@ _aporia_help() { } _aporia_dashboard() { - print -P "\n %F{$AP_C_ORANGE}APORIA%f %F{$AP_C_GRAY}— %f%B%F{$AP_C_BLUE}v${APORIA_VERSION:-1.1.4}%f%b" + print -P "\n %F{$AP_C_ORANGE}APORIA%f %F{$AP_C_GRAY}— %f%B%F{$AP_C_BLUE}v${APORIA_VERSION}%f%b" print -P " %F{$AP_C_GRAY}──────────────────────────────────────────────────%f" print -P " %F{$AP_C_BLUE}System Info%f" @@ -1405,7 +1436,7 @@ _aporia_dashboard() { _ap_print_flag "SSH Segment" ${AP_SHOW_SSH:-1} _ap_print_flag "Git Segment" ${AP_SHOW_GIT:-1} _ap_print_flag "Lang Stats" ${AP_SHOW_LANGS:-1} - _ap_print_flag "Exec Time" ${AP_SHOW_EXEC_TIME:-1} + _ap_print_flag "Exec Time" ${AP_SHOW_EXEC_TIME:-0} _ap_print_flag "Exit Code" ${AP_SHOW_EXIT_CODE:-1} _ap_print_flag "Clock" ${AP_SHOW_TIME:-1} @@ -1593,22 +1624,37 @@ _aporia_doctor() { } _aporia_upgrade() { - print -P "\n %F{$AP_C_BLUE}Upgrading Aporia...%f" + local before_version=${APORIA_VERSION:-unknown} + print -P "\n %F{$AP_C_BLUE}Upgrading Aporia...%f %F{$AP_C_GRAY}(currently v$before_version)%f" + if command -v brew >/dev/null && brew list aporia >/dev/null 2>&1; then print -P " %F{$AP_C_GRAY}Homebrew installation detected.%f" brew upgrade aporia + return + fi + + local theme_dir=${${(%):-%x}:h} + if [[ -d "$theme_dir/.git" ]]; then + print -P " %F{$AP_C_GRAY}Git installation detected.%f" + git -C "$theme_dir" pull origin main else - local theme_dir=${${(%):-%x}:h} - if [[ -d "$theme_dir/.git" ]]; then - print -P " %F{$AP_C_GRAY}Git installation detected.%f" - git -C "$theme_dir" pull origin main - else - print -P " %F{$AP_C_GRAY}Manual installation detected. Fetching latest from GitHub...%f" - curl -fsSL https://raw.githubusercontent.com/fr3on/aporia/main/aporia.zsh-theme -o "$HOME/.aporia.zsh-theme" - curl -fsSL https://raw.githubusercontent.com/fr3on/aporia/main/aporia.plugin.zsh -o "$HOME/.aporia.plugin.zsh" - print -P " %F{$AP_C_GREEN}✓ Successfully downloaded latest version to $HOME%f" - fi + print -P " %F{$AP_C_GRAY}Manual installation detected. Fetching latest from GitHub...%f" + curl -fsSL https://raw.githubusercontent.com/fr3on/aporia/main/aporia.zsh-theme -o "$HOME/.aporia.zsh-theme" + curl -fsSL https://raw.githubusercontent.com/fr3on/aporia/main/aporia.plugin.zsh -o "$HOME/.aporia.plugin.zsh" + fi + + local new_theme_file="$theme_dir/aporia.zsh-theme" + [[ -f $new_theme_file ]] || new_theme_file="$HOME/.aporia.zsh-theme" + local after_version + after_version=$(grep -oE '^export APORIA_VERSION="[^"]*"' "$new_theme_file" 2>/dev/null | cut -d'"' -f2) + after_version=${after_version:-unknown} + + if [[ $after_version == $before_version ]]; then + print -P " %F{$AP_C_GREEN}✓ Already up to date (v$before_version).%f" + else + print -P " %F{$AP_C_GREEN}✓ Upgraded v$before_version → v$after_version.%f" fi + print -P " %F{$AP_C_GRAY}Restart your shell to load the new version.%f" } _aporia_benchmark() { diff --git a/install.sh b/install.sh index 17e8e00..9426c7d 100644 --- a/install.sh +++ b/install.sh @@ -314,7 +314,7 @@ patch_zshrc() { info "Already sourced — no change" else if ! grep -q "HISTFILE=" "$ZSHRC"; then - printf '\n# Aporia: History\nexport HISTFILE=\"$HOME/.zsh_history\"\nexport HISTSIZE=10000\nexport SAVEHIST=10000\n' >> "$ZSHRC" + printf '\n# Aporia: History\nexport HISTFILE="$HOME/.zsh_history"\nexport HISTSIZE=10000\nexport SAVEHIST=10000\n' >> "$ZSHRC" ok "History defaults added" fi printf '\n# aporia.zsh-theme\n%s\n' "$SOURCE_LINE" >> "$ZSHRC" @@ -329,8 +329,20 @@ patch_bashrc() { local MARK="# aporia-bash-bridge" [ -f "$BASHRC" ] || touch "$BASHRC" if ! grep -qF "$MARK" "$BASHRC" 2>/dev/null; then - printf '\n%s\nif [[ -z \"$ZSH_VERSION\" ]] && [[ $- == *i* ]] && command -v zsh >/dev/null 2>&1; then\n exec zsh\nfi\n' "$MARK" >> "$BASHRC" - ok "Bash → Zsh bridge added" + printf '\n%s\nif [[ -z "$ZSH_VERSION" ]] && [[ $- == *i* ]] && command -v zsh >/dev/null 2>&1; then\n exec zsh\nfi\n' "$MARK" >> "$BASHRC" + ok "Bash → Zsh bridge added (~/.bashrc)" + fi + + # A fresh SSH/console login is a *login* shell: bash reads ~/.bash_profile + # or ~/.profile there, not ~/.bashrc — and on many minimal distros neither + # of those chains into .bashrc. Without this, the bridge above never runs + # on a brand-new login, only in shells spawned after one is already active. + # POSIX `[ ]`/`case` here since ~/.profile may be read by a plain sh/dash. + local PROFILE="$HOME/.profile" + [ -f "$PROFILE" ] || touch "$PROFILE" + if ! grep -qF "$MARK" "$PROFILE" 2>/dev/null; then + printf '\n%s\nif [ -z "$ZSH_VERSION" ] && [ -n "$BASH_VERSION" ] && command -v zsh >/dev/null 2>&1; then\n case $- in *i*) exec zsh -l ;; esac\nfi\n' "$MARK" >> "$PROFILE" + ok "Bash → Zsh bridge added (~/.profile)" fi } diff --git a/plugins/aws-profile/aws-profile.zsh b/plugins/aws-profile/aws-profile.zsh index 0292087..cbe4678 100644 --- a/plugins/aws-profile/aws-profile.zsh +++ b/plugins/aws-profile/aws-profile.zsh @@ -16,7 +16,7 @@ _ap_aws_segment() { [[ -n $profile ]] && label+="$profile" [[ -n $region ]] && label+=" ${region}" - local _ico="${_AP_ICO_AWS:-aws}" + local _ico="${AP_ICONS[AWS]:-aws}" echo "%F{$color}${_ico} $label%f" } diff --git a/plugins/azure-ctx/azure-ctx.zsh b/plugins/azure-ctx/azure-ctx.zsh index 4efece9..9560e37 100644 --- a/plugins/azure-ctx/azure-ctx.zsh +++ b/plugins/azure-ctx/azure-ctx.zsh @@ -2,7 +2,6 @@ # Cloud Intelligence: Azure Subscription Context AP_C_AZURE=${AP_C_AZURE:-33} # Azure Blue -_AP_ICO_AZURE="󰠅" # Azure Icon _ap_azure_segment() { # [1] Detection: check for az binary and config @@ -20,7 +19,8 @@ _ap_azure_segment() { [[ -z $sub_name ]] && return - echo "%F{$AP_C_AZURE}${_AP_ICO_AZURE} ${sub_name}%f" + local _ico="${AP_ICONS[AZURE]:-az}" + echo "%F{$AP_C_AZURE}${_ico} ${sub_name}%f" } _ap_azure_precmd() { diff --git a/plugins/cpanel/cpanel.zsh b/plugins/cpanel/cpanel.zsh index 0288fba..dac93bb 100644 --- a/plugins/cpanel/cpanel.zsh +++ b/plugins/cpanel/cpanel.zsh @@ -2,7 +2,6 @@ # Contextual Intelligence for cPanel Environments AP_C_CPANEL=${AP_C_CPANEL:-208} # cPanel Orange (Standard) -_AP_ICO_CPANEL="󰨿" # Server/Panel Icon _ap_cpanel_segment() { # [1] Detection: Check for cPanel markers @@ -27,7 +26,8 @@ _ap_cpanel_segment() { fi # [3] Output: Format the segment - local out="%F{$AP_C_CPANEL}${_AP_ICO_CPANEL} ${cp_user}" + local _ico="${AP_ICONS[CPANEL]:-cp}" + local out="%F{$AP_C_CPANEL}${_ico} ${cp_user}" [[ -n $cp_domain && $cp_domain != "unknown" ]] && out+="@${cp_domain}" echo "${out}%f" diff --git a/plugins/docker-ctx/docker-ctx.zsh b/plugins/docker-ctx/docker-ctx.zsh index 4956401..9980750 100644 --- a/plugins/docker-ctx/docker-ctx.zsh +++ b/plugins/docker-ctx/docker-ctx.zsh @@ -17,7 +17,7 @@ _ap_docker_ctx_segment() { [[ -z $ctx ]] && ctx="default" fi - local _ico="${_AP_ICO_DOCKER:-dkr}" + local _ico="${AP_ICONS[DOCKER]:-dkr}" echo "%F{$AP_C_DOCKER}${_ico} $ctx%f" } diff --git a/plugins/gcp-ctx/gcp-ctx.zsh b/plugins/gcp-ctx/gcp-ctx.zsh index 4176652..e9dabb7 100644 --- a/plugins/gcp-ctx/gcp-ctx.zsh +++ b/plugins/gcp-ctx/gcp-ctx.zsh @@ -2,7 +2,6 @@ # Cloud Intelligence: Google Cloud Project Context AP_C_GCP=${AP_C_GCP:-69} # GCP Blue/Google Colors -_AP_ICO_GCP="󱇶" # Google Cloud Icon _ap_gcp_segment() { # [1] Detection: check for gcloud binary and config @@ -25,7 +24,8 @@ _ap_gcp_segment() { [[ -z $project ]] && return - echo "%F{$AP_C_GCP}${_AP_ICO_GCP} ${project}%f" + local _ico="${AP_ICONS[GCP]:-gcp}" + echo "%F{$AP_C_GCP}${_ico} ${project}%f" } _ap_gcp_precmd() { diff --git a/plugins/gh-context/gh-context.zsh b/plugins/gh-context/gh-context.zsh index f281811..cd89755 100644 --- a/plugins/gh-context/gh-context.zsh +++ b/plugins/gh-context/gh-context.zsh @@ -2,7 +2,6 @@ # Source Intelligence: GitHub CLI Identity AP_C_GH=${AP_C_GH:-255} # White (Matching GitHub Logo) -_AP_ICO_GH="󰊤" # GitHub Icon _ap_gh_segment() { # [1] Detection: check for gh binary @@ -31,7 +30,8 @@ _ap_gh_segment() { [[ -z $gh_user ]] && return - echo "%F{$AP_C_GH}${_AP_ICO_GH} ${gh_user}%f" + local _ico="${AP_ICONS[GH]:-gh}" + echo "%F{$AP_C_GH}${_ico} ${gh_user}%f" } # Register with Aporia's async engine diff --git a/plugins/kube-ctx/kube-ctx.zsh b/plugins/kube-ctx/kube-ctx.zsh index 8552740..ada17be 100644 --- a/plugins/kube-ctx/kube-ctx.zsh +++ b/plugins/kube-ctx/kube-ctx.zsh @@ -22,7 +22,7 @@ _ap_kube_ctx_segment() { " "$kubeconfig") [[ -z $ns ]] && ns="default" - local _ico="${_AP_ICO_KUBE:-k8s}" + local _ico="${AP_ICONS[KUBE]:-k8s}" echo "%F{$AP_C_KUBE}${_ico} ${ctx}:${ns}%f" } diff --git a/plugins/nix-shell/nix-shell.zsh b/plugins/nix-shell/nix-shell.zsh index 63686ea..5a41086 100644 --- a/plugins/nix-shell/nix-shell.zsh +++ b/plugins/nix-shell/nix-shell.zsh @@ -14,7 +14,7 @@ _ap_nix_segment() { return fi - local _ico="${_AP_ICO_NIX:-nix}" + local _ico="${AP_ICONS[NIX]:-nix}" echo "%F{$AP_C_NIX}${_ico} $label%f" } diff --git a/plugins/proxmox/proxmox.zsh b/plugins/proxmox/proxmox.zsh index 55087b1..39ac3d4 100644 --- a/plugins/proxmox/proxmox.zsh +++ b/plugins/proxmox/proxmox.zsh @@ -21,7 +21,7 @@ _ap_proxmox_segment() { # Use the Manjaro-like stylized P icon (󱘊) or a generic server icon (󰒄) # Aporia preference: 󱘊 for PVE matches the branding silhouette - local _ico="${_AP_ICO_PVE:-pve}" + local _ico="${AP_ICONS[PVE]:-pve}" echo "%F{$AP_C_PROXMOX}${_ico} $label%f" } diff --git a/plugins/target/target.zsh b/plugins/target/target.zsh index dc2832a..b7eba1e 100644 --- a/plugins/target/target.zsh +++ b/plugins/target/target.zsh @@ -2,14 +2,13 @@ # Operational Security: Target Focus Tracking AP_C_TARGET=${AP_C_TARGET:-161} # Deep Crimson/Red (High visibility) -_AP_ICO_TARGET="󰓾" # Target/Bullseye Icon # [1] Controller: Management command aporia-target() { local val=$1 if [[ -z $val ]]; then if [[ -n $APORIA_TARGET ]]; then - print -P "%F{$AP_C_TARGET}${_AP_ICO_TARGET} Current Target:%f %B$APORIA_TARGET%b" + print -P "%F{$AP_C_TARGET}${AP_ICONS[TARGET]:-tgt} Current Target:%f %B$APORIA_TARGET%b" print -P "%F{$AP_C_GRAY}Use 'aporia-target --clear' to reset.%f" else print -P "%F{$AP_C_GRAY}No target set. Usage: aporia-target %f" @@ -31,7 +30,7 @@ aporia-target() { _ap_target_segment() { [[ -z $APORIA_TARGET ]] && return - echo "%F{$AP_C_TARGET}${_AP_ICO_TARGET} ${APORIA_TARGET}%f" + echo "%F{$AP_C_TARGET}${AP_ICONS[TARGET]:-tgt} ${APORIA_TARGET}%f" } _ap_target_precmd() { diff --git a/plugins/telemetry/telemetry.zsh b/plugins/telemetry/telemetry.zsh index eef1111..d51a520 100644 --- a/plugins/telemetry/telemetry.zsh +++ b/plugins/telemetry/telemetry.zsh @@ -4,8 +4,6 @@ AP_C_LOAD_LOW=${AP_C_LOAD_LOW:-242} # Subtle Gray AP_C_LOAD_MED=${AP_C_LOAD_MED:-214} # Orange AP_C_LOAD_HIGH=${AP_C_LOAD_HIGH:-161} # Crimson -_AP_ICO_CPU="󰍛" -_AP_ICO_RAM="󰘚" # Thresholds AP_TELEMETRY_CPU_THRESHOLD=${AP_TELEMETRY_CPU_THRESHOLD:-50} @@ -53,14 +51,14 @@ _ap_telemetry_segment() { local color=$AP_C_LOAD_LOW (( cpu_load >= AP_TELEMETRY_CPU_THRESHOLD )) && color=$AP_C_LOAD_MED (( cpu_load > 80 )) && color=$AP_C_LOAD_HIGH - out+="%F{$color}${_AP_ICO_CPU} ${cpu_load}%%%f " + out+="%F{$color}${AP_ICONS[CPU]:-cpu} ${cpu_load}%%%f " fi if [[ $mode == "raw" ]] || (( ram_load >= AP_TELEMETRY_RAM_THRESHOLD )); then local color=$AP_C_LOAD_LOW (( ram_load >= AP_TELEMETRY_RAM_THRESHOLD )) && color=$AP_C_LOAD_MED (( ram_load > 90 )) && color=$AP_C_LOAD_HIGH - out+="%F{$color}${_AP_ICO_RAM} ${ram_load}%%%f " + out+="%F{$color}${AP_ICONS[RAM]:-ram} ${ram_load}%%%f " fi echo "${out#" "}" diff --git a/plugins/vpn-status/vpn-status.zsh b/plugins/vpn-status/vpn-status.zsh index 8e6aa61..483ecf9 100644 --- a/plugins/vpn-status/vpn-status.zsh +++ b/plugins/vpn-status/vpn-status.zsh @@ -2,9 +2,6 @@ # Network Intelligence: VPN & Tunnel Monitoring AP_C_VPN=${AP_C_VPN:-39} # Deep Blue/Cyan -_AP_ICO_VPN_ON="󰖂" # Connected Icon -_AP_ICO_VPN_OFF="󰖀" # Disconnected Icon -_AP_ICO_TAILSCALE="󰆟" # Tailscale Icon _ap_vpn_segment() { local vpn_type="" @@ -51,8 +48,8 @@ _ap_vpn_segment() { # [4] Output if [[ $vpn_active == "on" ]]; then - local icon=$_AP_ICO_VPN_ON - [[ $vpn_type == "tailscale" ]] && icon=$_AP_ICO_TAILSCALE + local icon="${AP_ICONS[VPN_ON]:-vpn+}" + [[ $vpn_type == "tailscale" ]] && icon="${AP_ICONS[TAILSCALE]:-ts}" echo "%F{$AP_C_VPN}${icon} ${vpn_name}%f" fi } diff --git a/scripts/bump-version.sh b/scripts/bump-version.sh new file mode 100755 index 0000000..000e1d7 --- /dev/null +++ b/scripts/bump-version.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env zsh +# aporia/scripts/bump-version.sh +# +# Single source of truth for the Aporia version number is ./VERSION. +# This script propagates it into every file that must carry its own +# embedded copy (they can't just `source` VERSION at runtime — the theme +# and installer are both distributed as standalone files, curl'd directly +# from raw.githubusercontent.com without the rest of the repo). +# +# Usage: +# scripts/bump-version.sh 1.2.0 # set VERSION and sync everywhere +# scripts/bump-version.sh # re-sync from the existing VERSION file +set -euo pipefail + +cd "$(dirname "$0")/.." + +SEMVER_RE='^[0-9]+\.[0-9]+\.[0-9]+$' + +if [[ -n "${1:-}" ]]; then + [[ "$1" =~ $SEMVER_RE ]] || { echo "Error: '$1' is not a valid semver (X.Y.Z)" >&2; exit 1; } + echo "$1" > VERSION +fi + +VERSION=$(&2; exit 1; } + +echo "Syncing embedded version strings to $VERSION..." + +perl -pi -e "s/^export APORIA_VERSION=\"[^\"]*\"/export APORIA_VERSION=\"$VERSION\"/" aporia.zsh-theme +perl -pi -e "s/^APORIA_VERSION=\"[^\"]*\"/APORIA_VERSION=\"$VERSION\"/" install.sh + +echo " aporia.zsh-theme : $(grep '^export APORIA_VERSION=' aporia.zsh-theme)" +echo " install.sh : $(grep '^APORIA_VERSION=' install.sh)" +echo +echo "Done. Formula/aporia.rb is updated automatically by the release workflow" +echo "once you push the '$VERSION' tag — no manual edit needed there." diff --git a/tests/test_plugins.zsh b/tests/test_plugins.zsh index 05a7c54..6eb72a6 100644 --- a/tests/test_plugins.zsh +++ b/tests/test_plugins.zsh @@ -1,6 +1,6 @@ #!/usr/bin/env zsh -# Verification tests for Aporia Plugin System (v1.1.4) +# Verification tests for Aporia Plugin System # Usage: zsh tests/test_plugins.zsh SOURCE_DIR=$(cd "$(dirname "$0")/.." && pwd) diff --git a/uninstall.sh b/uninstall.sh index 4877cc9..92b050f 100644 --- a/uninstall.sh +++ b/uninstall.sh @@ -43,18 +43,19 @@ restore_zshrc() { } restore_bashrc() { - hdr "Restoring ~/.bashrc" - BASHRC="$HOME/.bashrc" - [ -f "$BASHRC" ] || return 0 - + hdr "Restoring ~/.bashrc and ~/.profile" BRIDGE_MARK="# aporia-bash-bridge" - if grep -qF "$BRIDGE_MARK" "$BASHRC" 2>/dev/null; then - # Safely remove the 4-line bridge block - tmp=$(mktemp) - sed "/$BRIDGE_MARK/,+3d" "$BASHRC" > "$tmp" - mv "$tmp" "$BASHRC" - ok "Bash bridge removed" - fi + + for f in "$HOME/.bashrc" "$HOME/.profile"; do + [ -f "$f" ] || continue + if grep -qF "$BRIDGE_MARK" "$f" 2>/dev/null; then + # Safely remove the 4-line bridge block + tmp=$(mktemp) + sed "/$BRIDGE_MARK/,+3d" "$f" > "$tmp" + mv "$tmp" "$f" + ok "Bash bridge removed ($f)" + fi + done } remove_leftovers() {