Markdown Converter
Agent skill for markdown-converter
Make AI coding agents productive immediately in this repository: a small Rust Proof-of-Concept BPM (workflow) engine. Focus on how processes, nodes, and task handlers are wired, where to change behavior, and the conventions for variable mapping and command parsing.
Sign in to like and favorite skills
Make AI coding agents productive immediately in this repository: a small Rust Proof-of-Concept BPM (workflow) engine. Focus on how processes, nodes, and task handlers are wired, where to change behavior, and the conventions for variable mapping and command parsing.
src/main.rs — contains a small ProcessEngine, ProcessBuilder helpers, and runnable examples.src/tasks — key pieces:
node.rs — Node and NodeType (Start, Task, ExclusiveGateway, ParallelGateway, End).config.rs — TaskConfig holds command/http/docker settings and input_mappings/output_mappings.context.rs — TaskContext (process variables passed to handlers).handlers.rs + handlers/* — TaskHandler trait and concrete handlers (command, function).output.rs — TaskOutput shape returned by handlers.Design intent: a minimal engine that keeps process definitions in-memory, runs example processes from
main, and demonstrates forks/joins, exclusive gateways, and command-based task handlers.
ProcessEngine::deploy / start_process / execute_instance in main.rs drive execution. To change scheduling, orchestration rules, or persistence, start here.NodeType::Task { handler_type, config }. handler_type selects the handler implementation found in src/tasks/handlers/*.TaskConfig.output_mappings (task_output_var -> process_var).handlers/command.rs replaces args of the form ${varname} with the process variable value from TaskContext.VAR: are interpreted as VAR:key=value and extracted.= with no space before = (simple key=value) are parsed.stdout, stderr, and exit_code into the task variables map.TaskConfig for a command task has command = None, the engine treats it as a placeholder and skips execution (see the check in main.rs).active_tokens); joins use join_counters to wait until all incoming tokens arrive before continuing.Result<TaskOutput, String> or set TaskOutput.success = false. The engine logs failures but continues basic flow; update execute_instance to change failure policies.Build a command task and map output to process variables (see
main.rs examples):
let mut builder = ProcessBuilder::new("command_process") .add_start("start") .add_command_task("list_files", "List Files", "ls", vec!["-la"]) .set_output_mapping("list_files", "stdout", "file_list");
Use
${var} substitution in TaskConfig.args to inject process variables into command arguments (handler does a simple replace).
To return multiple variables from a command task, print lines like
VAR:key=value or key=value (no spaces before =) from the program; handlers/command.rs will parse them.
tasks::handlers::TaskHandlerType, implement the trait in src/tasks/handlers/<your>.rs, and wire selection where handlers are invoked in main.rs.ProcessEngine (see the definitions and instances HashMaps). Replace with DB calls where deploy, start_process, execute_instance, and advance_token interact with state.cargo build (Rust 2024 edition, see Cargo.toml).cargo run.$env:RUST_BACKTRACE = 1; cargo run.main program contains several runnable examples (sequential, parallel, conditional, command output parsing). Use or adapt them to test engine changes quickly.#[cfg(test)]) or integration tests under tests/.handlers/command.rs to change parsing or variable substitution.TaskConfig, TaskOutput, TaskContext), update usages across main.rs and handlers/* — the repo is small so changes touch few files.src/main.rs — engine loop, ProcessBuilder, and examples.src/tasks/node.rs, src/tasks/config.rs, src/tasks/context.rs — model shapes.src/tasks/handlers.rs, src/tasks/handlers/command.rs — handler trait and shell command implementation.src/tasks/output.rs — TaskOutput format.If any section is unclear or you'd like more examples (e.g., a small unit test or a new handler stub), tell me which part to expand and I'll iterate.