Problem
`nb.plugin.zsh`'s entry-point boilerplate does:
```zsh
typeset -gA Plugins
Plugins[NB_DIR]="${0:h}"
```
This is the pattern PATTERNS.md's "Plugin entry-point skeleton" section
marks retired, and it also conflicts with the current Zsh Plugin Standard:
"Never place plugin state in a shared global `Plugins` hash."
Concretely: the assignment unconditionally overwrites `Plugins[NB_DIR]`
without snapshotting whether the key existed or its prior value, so there
is no way to restore caller state — and there is no unload function at
all, so nothing ever reverses this side effect.
Fix
Rebuild the entry point from the canonical scaffold at
`z-shell/.github:.github/skills/new-zsh-plugin/templates/plugin.plugin.zsh`,
which snapshots the pre-load `Plugins` key/value, tracks whether this load
owns the `fpath` append, and provides a real `nb_plugin_unload` that
reverses both. Needs the usual load/unload verification in an isolated
`zsh -f` shell with temp `HOME`/`ZDOTDIR` (test both an absent key and a
pre-existing value).
Related
Split out of #85 to keep that XDG-defaults change scoped and mechanical
cleanup separate from behavioral change, per z-shell/.github's AGENTS.md.
Problem
`nb.plugin.zsh`'s entry-point boilerplate does:
```zsh
typeset -gA Plugins
Plugins[NB_DIR]="${0:h}"
```
This is the pattern PATTERNS.md's "Plugin entry-point skeleton" section
marks retired, and it also conflicts with the current Zsh Plugin Standard:
Concretely: the assignment unconditionally overwrites `Plugins[NB_DIR]`
without snapshotting whether the key existed or its prior value, so there
is no way to restore caller state — and there is no unload function at
all, so nothing ever reverses this side effect.
Fix
Rebuild the entry point from the canonical scaffold at
`z-shell/.github:.github/skills/new-zsh-plugin/templates/plugin.plugin.zsh`,
which snapshots the pre-load `Plugins` key/value, tracks whether this load
owns the `fpath` append, and provides a real `nb_plugin_unload` that
reverses both. Needs the usual load/unload verification in an isolated
`zsh -f` shell with temp `HOME`/`ZDOTDIR` (test both an absent key and a
pre-existing value).
Related
Split out of #85 to keep that XDG-defaults change scoped and mechanical
cleanup separate from behavioral change, per z-shell/.github's AGENTS.md.