K4sh Plugins File
Keep init.sh idempotent: sourcing multiple times should not duplicate definitions.
Namespace functions and variables to avoid collisions (prefix with plugin name).
Provide minimal startup footprint; defer heavy work.
Offer completions placed under completions/ using the shell’s completion API.
Declare dependencies in plugin.toml and fail gracefully if missing.
Include tests where possible (unit scripts or basic smoke tests).
Example minimal plugin (plugin.toml + init.sh)
init.sh:
Example lazy-command stub pattern (in k4sh core) k4sh plugins
plugin’s init.sh then defines real hello() replacing the stub.
The k4sh ecosystem is evolving rapidly. Here is what you can expect in the next 12-18 months: Keep init
Most shell plugin systems are either: