Current limitation
The audit found low-severity duplication and naming drift that make ownership and future maintenance less reliable:
.zi-at-eval is independently defined in both lib/zsh/autoload.zsh and lib/zsh/install.zsh.
- The header above
@zsh-plugin-run-on-unload names the update callback.
- The parallel updater header names
.zi-update-in-parallel, while the function is .zi-update-all-parallel.
.zi-load-ices contains an unresolved snippet-directory computation TODO that needs an ID-collision test before it can be classified as a defect.
Evidence at commit 795662792e70af6cd36155b019b775796a9fdbee:
|
# FUNCTION: .zi-at-eval [[[ |
|
.zi-at-eval() { |
|
local atclone="$2" atpull="$1" |
|
integer retval |
|
@zi-substitute atclone atpull |
|
[[ $atpull = "%atclone" ]] && { eval "$atclone"; retval=$?; } || { eval "$atpull"; retval=$?; } |
|
return $retval |
|
} # ]]] |
|
# FUNCTION: .zi-at-eval [[[ |
|
.zi-at-eval() { |
|
local atpull="$1" atclone="$2" |
|
integer retval |
|
@zi-substitute atclone atpull |
|
local cmd="$atpull" |
|
[[ $atpull == "%atclone" ]] && cmd="$atclone" |
|
eval "$cmd" |
|
return "$?" |
|
} # ]]] |
|
# FUNCTION: @zsh-plugin-run-on-update. [[[ |
|
# The Plugin Standard required mechanism, see: |
|
# https://wiki.zshell.dev/community/zsh_plugin_standard |
|
@zsh-plugin-run-on-unload() { |
|
ICE[ps-on-unload]="${(j.; .)@}" |
|
.zi-pack-ice "$id_as" "" |
|
} # ]]] |
|
# FUNCTION: @zsh-plugin-run-on-update. [[[ |
|
# The Plugin Standard required mechanism |
|
@zsh-plugin-run-on-update() { |
|
ICE[ps-on-update]="${(j.; .)@}" |
|
.zi-pack-ice "$id_as" "" |
|
} # ]]] |
|
# FUNCTION: .zi-update-in-parallel [[[ |
|
.zi-update-all-parallel() { |
|
builtin emulate -LR zsh ${=${options[xtrace]:#off}:+-o xtrace} |
|
# second-next command (that's why it's called "ice" - it melts), however they glue to the object (plugin |
|
# or snippet) mentioned in the next command – for later use with e.g. `zi update ...'. |
|
.zi-pack-ice() { |
|
ZI_SICE[$1${1:+${2:+/}}$2]+="${(j: :)${(qkv)ICE[@]}} " |
|
ZI_SICE[$1${1:+${2:+/}}$2]="${ZI_SICE[$1${1:+${2:+/}}$2]# }" |
|
return 0 |
|
} # ]]] |
|
# FUNCTION: .zi-load-ices. [[[ |
|
.zi-load-ices() { |
|
local id_as="$1" ___key ___path |
|
local -a ice_order |
|
ice_order=( |
|
${(As:|:)ZI[ice-list]} |
|
${(@)${(@Akons:|:u)${ZI_EXTS[ice-mods]//\'\'/}}/(#s)<->-/} |
|
) |
|
___path="${ZI[PLUGINS_DIR]}/${id_as//\//---}"/._zi |
|
# TODO Snippet's dir computation… |
|
if [[ ! -d $___path ]] { |
|
if ! .zi-get-object-path snippet "${id_as//\//---}"; then |
|
return 1 |
Proposed improvement
- Establish one owning definition for
.zi-at-eval and source it consistently.
- Correct function headers as part of the owning behavioral fixes.
- Add a focused test for plugin/snippet effective-ID collisions before deciding whether
.zi-load-ices needs a type-aware API.
- Keep compatibility aliases separate from accidental duplicate implementations.
Acceptance criteria
- One canonical
.zi-at-eval implementation remains.
- Function headers match their definitions.
- The snippet ICE TODO is either resolved with a regression test or replaced by a precise tracked limitation.
- Existing syntax, load, update, and extraction tests remain green.
Next action
Write the effective-ID collision test first, then consolidate only the duplication proven unnecessary.
Current limitation
The audit found low-severity duplication and naming drift that make ownership and future maintenance less reliable:
.zi-at-evalis independently defined in bothlib/zsh/autoload.zshandlib/zsh/install.zsh.@zsh-plugin-run-on-unloadnames the update callback..zi-update-in-parallel, while the function is.zi-update-all-parallel..zi-load-icescontains an unresolved snippet-directory computation TODO that needs an ID-collision test before it can be classified as a defect.Evidence at commit
795662792e70af6cd36155b019b775796a9fdbee:zi/lib/zsh/autoload.zsh
Lines 259 to 266 in 7956627
zi/lib/zsh/install.zsh
Lines 2046 to 2055 in 7956627
zi/zi.zsh
Lines 1154 to 1166 in 7956627
zi/lib/zsh/autoload.zsh
Lines 1846 to 1848 in 7956627
zi/zi.zsh
Lines 2025 to 2044 in 7956627
Proposed improvement
.zi-at-evaland source it consistently..zi-load-icesneeds a type-aware API.Acceptance criteria
.zi-at-evalimplementation remains.Next action
Write the effective-ID collision test first, then consolidate only the duplication proven unnecessary.