Expand description
linesmith-plugin: rhai plugin host for the linesmith status line.
Construction (build_engine) and load-time machinery (discovery,
script compilation, @data_deps header parsing, id-collision
detection) live here. The bridge that adapts a CompiledPlugin
to linesmith-core’s Segment trait — and the DataContext →
rhai::Map mirror — lives in linesmith-core::plugins so this
crate’s public surface stays free of linesmith-domain types.
Surface contract per ADR-0018: declared deps cross this boundary
as Vec<String> (raw header tokens, validated against the
plugin-accessible name set defined by header::KNOWN_DEPS per
docs/specs/plugin-api.md); the consumer maps strings back to
its own dep enum. pub use rhai; lets consumers reach
rhai::Map / Engine / Dynamic via linesmith_plugin::rhai::*
without adding rhai as a direct dep — workspace alignment is
still the source of truth for which rhai version compiles together.
Workspace-internal in v0.1; public surface is free to refactor without SemVer cost until a publish decision lands.
Re-exports§
pub use discovery::scan_plugin_dirs;pub use engine::build_engine;pub use error::CollisionWinner;pub use error::PluginError;pub use error::ResourceLimit;pub use header::parse_data_deps_header;pub use header::HeaderError;pub use registry::CompiledPlugin;pub use registry::CompiledPluginParts;pub use registry::PluginRegistry;pub use rhai;
Modules§
- discovery
- Plugin file discovery. Scans the configured
plugin_dirsplus the default$XDG_CONFIG_HOME/linesmith/segments/(falling back to~/.config/linesmith/segments/) for.rhaifiles, returning an ordered deduplicated path list. - engine
- Rhai engine construction for the plugin runtime.
- error
PluginErrorcovers every failure mode described indocs/specs/plugin-api.md§Edge cases.- header
- Parses the optional
@data_deps = [...]declaration from the first contiguous block of//line comments at the top of a plugin script. Seedocs/specs/plugin-api.md§@data_deps header syntax for the full contract. - registry
- Plugin registry: the single source of truth for compiled
.rhaiscripts after discovery. Owns the parsed ASTs + resolved header data. Wrapping aCompiledPluginin aSegmentadapter is the consumer’s job (see linesmith-core’sRhaiSegment), not this module’s.