Skip to main content

Module discovery

Module discovery 

Source
Expand description

Plugin file discovery. Scans the configured plugin_dirs plus the default $XDG_CONFIG_HOME/linesmith/segments/ (falling back to ~/.config/linesmith/segments/) for .rhai files, returning an ordered deduplicated path list.

Discovery order per docs/specs/plugin-api.md §Plugin file location: config-declared directories first (in list order), then the XDG default. Dedupe is by canonical absolute path — symlinks to the same file appear once — but not by plugin id. Id-dedup lands in the registry step when the script is compiled and its const ID is known.

Missing directories are treated as empty (not an error); the spec §Edge cases row for “Plugin dir doesn’t exist” says the dir is silently skipped and linesmith doctor handles the hint.

Functions§

scan_plugin_dirs
Walk config_dirs followed by the XDG default, returning every .rhai file in discovery order with duplicates (by canonical path) removed. Non-recursive: files in subdirectories are not picked up.