Skip to main content

Module plugin

Module plugin 

Source
Expand description

Plugin system — Stage A slicing (M4-A).

Introduces the ActionPlugin trait and an in-process Registry as the canonical registration path for Tier-1 actions. The 7 built-ins that M3 landed directly inside grex-core::execute are re-exposed here behind the trait so M4-B onwards can extend the surface without touching the executors.

§Why not async yet

The spec earmarks async fn execute for the plugin trait (M4 as a whole). Stage A deliberately keeps the trait synchronous: the wet-run executor, planner, and scheduler are all synchronous today, and the async-trait crate is not yet in the workspace dependency set. Adding async fn would force every built-in to wrap sync work in an async block, introduce .await at every call-site, and pull in a tokio runtime — all unrelated to the trait-slicing goal. The async switch belongs to the runtime work in M4-C, not the structural slice here.

§Why not dispatch via Registry inside FsExecutor / PlanExecutor

The task brief calls for the concrete executors to look up plugins via registry.get(action.name()) instead of matching on the Action enum directly. Doing so requires FsExecutor / PlanExecutor to carry a Registry field (which is not Copy), which cascades into >3-line edits across ~50 existing test call sites that construct the executors as bare unit structs. That conflicts with the other explicit rule in the task brief (“If a test needs >3 line change, stop and report”). Stage A therefore lands the trait + registry surface; the dispatch swap is queued for M4-B, which can reshape tests alongside the executor constructors in one pass.

Re-exports§

pub use pack_type::PackTypePluginSubmission;
pub use pack_type::PackTypePlugin;
pub use pack_type::PackTypeRegistry;

Modules§

pack_type
Pack-type plugin trait + registry — M5-1 Stage A/B.

Structs§

EnvPlugin
Wet-run env plugin.
ExecPlugin
Wet-run exec plugin.
MkdirPlugin
Wet-run mkdir plugin.
PluginSubmission
Submission record for compile-time plugin collection via inventory.
Registry
In-process registry mapping action name → plugin.
RequirePlugin
require plugin (predicate gate; side-effect-free).
RmdirPlugin
Wet-run rmdir plugin.
SymlinkPlugin
Wet-run symlink plugin.
UnlinkPlugin
Wet-run unlink plugin — synthesized inverse of symlink used by the declarative auto-reverse teardown path (R-M5-09). Not reachable from a YAML-authored pack: the Action::Unlink variant is only manufactured by DeclarativePlugin::inverse_of (private helper in crate::plugin::pack_type).
WhenPlugin
when plugin (conditional block; wet-run).

Traits§

ActionPlugin
Uniform registration surface for every Tier-1 action.

Functions§

register_builtins
Register all 7 Tier-1 built-in plugins in wet-run form.