How bahdotsh/wrkflw works
1. Repository shape
- This is a Rust workspace centered on a single CLI binary, wrkflw, plus a set of internal libraries.
- The workspace is organized by concern: parsing/validation, execution/runtime, UI, secrets, remote integrations, and shared models/utilities.
2. Top-level entry point
- crates/wrkflw is the user-facing binary.
- It exposes the main modes described in the README: interactive TUI, workflow validation, local workflow execution, and remote triggering.
- The binary is the orchestration layer that wires together the lower-level crates.
3. Workflow ingestion and schema handling
- crates/parser reads GitHub Actions and GitLab CI definitions and normalizes them into structured Rust types.
- It includes bundled schemas and parser-specific logic for GitHub workflow YAML and GitLab CI YAML.
- This is the first major boundary: raw YAML/config files become typed workflow/job definitions.
4. Validation layer
- crates/validators performs semantic checks after parsing.
- It has separate validation areas for jobs, steps, triggers, matrix configuration, actions, and GitLab-specific rules.
- Validation is used both for CLI validate and for surfacing issues in the TUI before execution.
5. Shared domain model
- crates/models holds the canonical types used across the workspace.
- This crate is the contract between parser, validator, executor, and UI, preventing each subsystem from inventing its own workflow representation.
6. Execution planning and scheduling
- crates/executor is the core workflow engine.
- It resolves job dependencies, action substitution, environment setup, and execution ordering.
- It is responsible for turning a workflow graph into runnable job/step work, including parallelism and dependency-aware sequencing.
7. Action and environment resolution
- Within executor, the code is split into pieces for dependency handling, action resolution, substitutions, and environment management.
- This is where special action handling lives, including local actions, composite actions, JavaScript actions, Docker-based actions, and reusable workflow caller jobs.
- The executor is the main bridge between abstract workflow definitions and concrete runtime commands.
8. Runtime abstraction
- crates/runtime provides the actual execution backends:
- container-based execution,
- secure emulation,
- legacy emulation.
- It also includes sandboxing and secure emulation support, which is an explicit security boundary for running untrusted workflows locally.
- The runtime crate is where host vs container execution diverges.
9. Container backends
- Container execution is split between Docker and Podman support inside crates/executor and crates/runtime.
- The architecture treats Docker and Podman as interchangeable backends with the same workflow semantics but different process/container primitives.
- Podman is the rootless/security-oriented option; emulation avoids container infrastructure entirely.
10. Secrets subsystem
- crates/secrets is a separate subsystem for loading, validating, masking, storing, and substituting secrets.
- It supports multiple providers, including environment and file-based sources.
- The secrets manager is relevant to both execution and UI because it affects what gets injected into runs and what gets masked in logs.
11. Remote integrations
- crates/github and crates/gitlab handle remote workflow/pipeline triggering.
- These are separate from local execution: they communicate with external services and are only used for manual trigger commands.
- The README indicates GitHub workflow dispatch and GitLab pipeline triggers are supported through these integration crates.
12. Terminal UI
- crates/ui is a dedicated TUI application with tabs for workflows, execution, logs, and help.
- It consumes workflow state, execution updates, and log streams, and presents them interactively.
- The UI layer is not the executor; it observes execution state and issues commands back into the orchestration layer.
13. Logging and log processing
- crates/logging provides shared logging support across the workspace.
- crates/ui/src/log_processor.rs suggests the UI has a log ingestion/formatting path separate from core execution.
- This creates a data flow from runtime/executor output into a normalized log stream for display and masking.
14. Shared utilities and matrix support
- crates/matrix encapsulates matrix expansion and related job fan-out behavior.
- crates/utils is general shared code used across crates.
- Matrix expansion sits conceptually between parsing/validation and execution because it changes the job graph before scheduling.
15. Build, release, and test architecture
- The repo is CI-heavy: GitHub Actions workflows, GitLab CI config, release automation, and version management scripts are all present.
- Tests cover executor/runtime behavior, workflow fixtures, matrix behavior, reusable workflows, and security-related scenarios.
- The presence of demo casts and fixtures shows the repository is validated as both a CLI tool and an interactive TUI product.
16. End-to-end data flow
- Typical flow: file input → parser → validators → shared models → matrix/dependency resolution → executor → runtime backend → logs/outputs → UI or CLI.
- For remote triggering, the flow bypasses local execution and goes from CLI/TUI → GitHub/GitLab API client → external service.
- The main architectural boundary is between workflow semantics and execution backend: everything before runtime is declarative workflow processing; everything after is operational execution and presentation.
Main entry points: src/lib.rs Executor · main.rs wrkflw · src/lib.rs Runtime · src/lib.rs UI
Components 20
CLI orchestration
User-facing entrypoint and command wiring
- wrkflw · Main command-line entrypoint that orchestrates modes and subsystems
crates/wrkflw/src/main.rs
Workflow ingestion
Parsing, canonical models, validation, and matrix expansion
- Parser · Reads GitHub Actions and GitLab CI YAML into typed workflow structures
crates/parser/src/lib.rs - Validators · Applies job, step, trigger, matrix, action, and GitLab validation rules
crates/validators/src/lib.rs - Models · Canonical workflow and job types shared across the workspace
crates/models/src/lib.rs - Matrix · Expands matrix definitions into executable job variants
crates/matrix/src/lib.rs
Execution engine
Planning, resolving, and running workflows
- Executor · Coordinates dependency resolution, substitutions, and execution order
crates/executor/src/lib.rs - Dependencies · Resolves job ordering and dependency relationships
crates/executor/src/dependency.rs - Actions · Finds and normalizes local, composite, JavaScript, Docker, and reusable workflow actions
crates/executor/src/action_resolver.rs - Environment · Builds job and step environment state for execution
crates/executor/src/environment.rs - Substitution · Interpolates workflow expressions and runtime values
crates/executor/src/substitution.rs
Runtime backends
Container and emulation execution boundaries
- Runtime · Abstracts container and emulation execution backends
crates/runtime/src/lib.rs - Container · Runs workloads in Docker or Podman containers
crates/runtime/src/container.rs - Emulation · Executes workflows without containers in emulated mode
crates/runtime/src/emulation.rs - Secure emu · Hardened emulation path for untrusted workflow execution
crates/runtime/src/secure_emulation.rs
Remote integrations
External service clients for triggering workflows
Presentation
Terminal UI and log display
- UI · Interactive terminal interface for workflows, execution, and logs
crates/ui/src/lib.rs - Log processor · Normalizes runtime output for UI display and masking
crates/ui/src/log_processor.rs
Connections 27
- wrkflw → Parser: parse · Loads workflow definitions before any semantic processing
- wrkflw → Validators: validate · Runs validation mode and surfaces issues
- wrkflw → Executor: run · Starts local workflow execution
- wrkflw → UI: tui · Launches interactive terminal mode
- wrkflw → GitHub: trigger · Dispatches remote GitHub workflows
- wrkflw → GitLab: trigger · Triggers remote GitLab pipelines
- Parser → Models: emit · Produces canonical workflow data structures
- Parser → Validators: input · Parsed workflows are checked semantically
- Validators → Models: inspect · Validates the shared domain model
- Validators → Matrix: gate · Matrix rules are validated before expansion
- Matrix → Models: expand · Turns canonical jobs into expanded job variants
- Models → Executor: plan · Executor consumes canonical workflow and job definitions
- Executor → Dependencies: schedule · Computes dependency-aware job ordering
- Executor → Actions: resolve · Resolves action and reusable workflow references
- Executor → Environment: prepare · Builds per-job execution environment
- Executor → Substitution: expand · Interpolates expressions and runtime values
- Executor → Runtime: dispatch · Hands runnable work to the backend runtime
- Runtime → Container: container · Uses container-based execution when available
- Runtime → Emulation: emulate · Runs workflows without container infrastructure
- Emulation → Secure emu: harden · Uses secure emulation for stricter isolation
- Runtime → Secrets: inject · Consumes secret values during execution
- Runtime → Logging: emit · Produces logs and status events
- UI → Log processor: ingest · Consumes normalized execution logs
- UI → Logging: mask · Shares logging and masking conventions
- UI → Executor: control · Issues execution commands and observes state
- GitHub → Logging: report · Uses shared logging for remote trigger operations
- GitLab → Logging: report · Uses shared logging for remote trigger operations