mirror of
https://github.com/bahdotsh/wrkflw.git
synced 2026-09-01 19:50:23 +02:00
The expression evaluator was added in 2954b05, but it only handled
"complex" expressions as a fallback. Simple context references like
${{ env.FOO }} and ${{ runner.os }} were still resolved by six
separate regex preprocessors — each duplicating context resolution
logic that the evaluator already handles perfectly well.
This is the kind of redundancy that makes you maintain the same
mapping in two places and then wonder why they drift apart.
Rip out the individual regex preprocessors (preprocess_env_context,
preprocess_inputs_context, preprocess_github_context,
preprocess_runner_context, preprocess_step_outputs, and five regex
patterns). Now preprocess_expressions does exactly two things:
resolve hashFiles() (needs filesystem access), then route *all*
remaining ${{ }} through the expression evaluator. Net -46 lines.
While at it, fix three issues from code review:
- Add debug logging when expression evaluation fails in the
substitution path, instead of silently swallowing the error
- Document the surprising Bool/String coercion in expr_eq (where
false == "random" is true per GitHub Actions semantics)
- Add test coverage for that coercion edge case
Wrkflw Crates
This directory contains the Rust crates that make up the wrkflw workspace.
Crate Structure
| Crate | Purpose |
|---|---|
| wrkflw | CLI binary and library entry point |
| executor | Workflow execution engine (Docker, Podman, emulation) |
| parser | Workflow file parsing and JSON Schema validation |
| evaluator | Structural evaluation of workflow files |
| validators | Validation rules for jobs, steps, triggers, matrix |
| runtime | Container management and emulation runtime |
| ui | Terminal user interface (ratatui-based) |
| models | Shared data structures (ValidationResult, GitLab models) |
| matrix | Matrix expansion (include, exclude, fail-fast) |
| secrets | Secrets management with multiple providers and encryption |
| github | GitHub API integration (list/trigger workflows) |
| gitlab | GitLab API integration (trigger pipelines) |
| logging | Thread-safe in-memory logging for TUI/CLI |
| utils | Workflow file detection and fd redirection helpers |
Building
# Build everything
cargo build
# Build a specific crate
cargo build -p wrkflw-executor
Testing
# Run all tests
cargo test
# Run tests for a specific crate
cargo test -p wrkflw-executor
Each crate has its own Cargo.toml with dependencies managed through workspace inheritance in the root Cargo.toml.