Expand description
Step runner — the engine behind [[command]] and [[hook]] execution.
This module executes a Vec<Step> declaratively, with injected
dependencies for process execution, desktop notification, and user
prompting. Every downstream feature that needs to run user-defined steps
(post-update hooks #43, krypt menu #25, krypt <group> <name> #25)
delegates here.
§Predicate evaluator (stub)
The eval_predicate parameter is a stub for issue #24. All predicate
strings currently evaluate to true (no-op). Issue #24 will implement
the real grammar: command_exists:foo, platform:linux, env:FOO=bar,
!file_exists:/path, and so on. Tests that need predicate gating supply
their own closure.
§on_fail semantics
| value | behaviour |
|---|---|
abort (default) | bubble up RunnerError::NonZeroExit |
ignore | swallow, increment steps_failed_ignored |
notify | call Notifier with failure details, then abort |
prompt | ask Prompter; true → ignore, false → abort |
ignore_failure = true is a shortcut alias for on_fail = "ignore" and
wins over a conflicting on_fail = "abort" if both are present (with a
tracing::warn!).
§Cross-platform note
RealProcessExec wraps std::process::Command directly. No shell is
injected — run = ["echo", "hi"] must reference a real binary in PATH.
Shell builtins (e.g. echo on Windows outside Git Bash) are the caller’s
responsibility. Path-containing args are passed through unchanged.
AutoNotifier auto-detects the best notification backend at
construction. Pin crate::notify::NotifyBackend::Stderr in tests.
Re-exports§
pub use crate::notify::AutoNotifier;
Structs§
- Context
- Execution context threaded through all steps.
- Mock
Notifier - Mock notifier that records calls.
- Mock
Process Exec - Mock process executor with scripted responses.
- Mock
Prompter - Mock prompter with scripted boolean responses.
- Process
Result - Outcome of a single process execution.
- Real
Process Exec - Production process executor using
std::process::Command. - Real
Prompter - Interactive prompter backed by stdin readline.
- RunReport
- Summary of a completed step sequence.
Enums§
- Runner
Error - Anything that can go wrong while running steps.
Traits§
- Notifier
- Abstraction over desktop notification, allowing test mocks.
- Process
Exec - Abstraction over process spawning, allowing test mocks.
- Prompter
- Abstraction over interactive prompting, allowing test mocks.
Functions§
- execute_
command - Execute a
KryptCommandas a step sequence. - execute_
hook - Execute a
Hookas a single-step equivalent. - execute_
steps - Execute a slice of steps with the given execution context and injected dependencies.
- interpolate
- Interpolate
{name},{0}..{9},{stdin}, and{{/}}escapes.