Skip to content

workflow-manager

Workflow manager for batch command execution with conditional logic

Version: 9.0.1 | Size: 3.0MB | Author: Warith Al Maawali

License: Proprietary | Website: https://www.digi77.com


File Information

Property Value
Binary Name workflow-manager
Version 9.0.1
Build Date 2025-10-24T16:44:05.760076534Z
Rust Version 1.82.0
File Size 3.0MB
JSON Data View Raw JSON

SHA256 Checksum

723ffae63d99aaa8cd9d836a783139e0e24b4ab51c83c2dca9f259221136d7ca

Features

Feature Description
Feature Template-based workflow management
Feature Conditional command execution
Feature Batch processing with retry logic
Feature State tracking and logging
Feature Concurrent execution support
Feature Pause steps with user confirmation
Feature Pattern matching and regex conditions
Feature JSON path expression support
Feature Prerequisites validation before execution
Feature System state checking and probes
Feature Reusable probe functions for conditions

Security Features

Feature Description
Authentication Secure authentication with certificate pinning
Encryption TLS 1.3 for all network communications
Inputvalidation All inputs are validated and sanitized
Ratelimiting Built-in rate limiting for network operations

System Requirements

Requirement Value
OS Linux (Debian-based)
Privileges root/sudo for system operations
Dependencies OpenSSL, libcurl

Global Options

Flag Description
-h, --help Print help information
-v, --version Print version information
-n, --info Display detailed information
-e, --examples Show usage examples
--json Output in JSON format
--json-pretty Pretty-print JSON output with indentation
--json-human Enhanced JSON output with improved formatting (like jq)
--verbose Enable verbose output
--quiet Suppress non-essential output
--no-color Disable colored output
--config <FILE> Use custom configuration file
--timeout <SECS> Set timeout (default: 30)
--retry <COUNT> Retry attempts (default: 3)

Commands

Commands

create

Create a new workflow template

Usage:

workflow-manager create [OPTIONS]

add

Add a step to a workflow template

Usage:

workflow-manager add [OPTIONS]

pause

Add a pause step to a workflow template

Usage:

workflow-manager pause [OPTIONS]

list

List all workflow templates

Usage:

workflow-manager list [OPTIONS]

show

Show details of a workflow template

Usage:

workflow-manager show [OPTIONS]

run

Run a workflow template

Usage:

workflow-manager run [OPTIONS]

update

Update a step in a workflow template

Usage:

workflow-manager update [OPTIONS]

delete-step

Delete a step from a workflow template

Usage:

workflow-manager delete-step [OPTIONS]

delete

Delete an entire workflow template

Usage:

workflow-manager delete [OPTIONS]

state

Query system state

Usage:

workflow-manager state [OPTIONS]

prereq

Validate workflow prerequisites

Usage:

workflow-manager prereq [OPTIONS]

Examples

1. Template Management

Create, list, view, and delete workflow templates

Creates a new empty workflow template named 'my-workflow'

workflow-manager create my-workflow
Expected Output: Template 'my-workflow' created successfully

Creates a workflow with a descriptive label

workflow-manager create backup-workflow --description 'Daily backup routine'
Expected Output: Template 'backup-workflow' created successfully

Shows all available workflow templates

workflow-manager list
Expected Output: Workflow Templates (2 total)

Displays the full structure of a workflow template

workflow-manager show my-workflow
Expected Output: Workflow Template: my-workflow

Permanently removes a workflow template

workflow-manager delete my-workflow
Expected Output: Template 'my-workflow' deleted successfully

2. Adding Commands to Workflows

Add steps to workflows. Use comma-separated commands for multiple steps in one call, or add individually.

Adds a single command as step 1

workflow-manager add my-workflow 'echo Hello World'
Expected Output: Step 1 added to template 'my-workflow'

Note

Single command creates one step

Add multiple steps in one command using comma separation

workflow-manager add w1 "sudo ip-fetch","sudo online-auth check-login","ip addr show"
Expected Output: 3 steps added to template 'w1'

Note

Comma-separated commands create multiple steps automatically

Create a diagnostic workflow with 3 steps at once

workflow-manager add diagnostics "./health-control net-check","./tor-switch status","./dns-leak test"
Expected Output: 3 steps added to template 'diagnostics'

Note

All steps share the same timeout and condition settings

Adds a command with a 10-minute timeout

workflow-manager add my-workflow 'tar czf backup.tar.gz /data' --timeout 600
Expected Output: Step added with 600 second timeout

Runs only if the previous command succeeded

workflow-manager add my-workflow 'cleanup.sh' --condition if_success
Expected Output: Step added with conditional execution

Runs only if previous output contains 'ERROR'

workflow-manager add my-workflow 'notify-admin.sh' --if-contains 'ERROR'
Expected Output: Step added with pattern matching condition

3. Workflow Execution

Run workflows and control execution behavior

Executes all commands in the workflow sequentially

sudo workflow-manager run my-workflow
Expected Output: ✅ Workflow completed: Success

Note

Conditions are evaluated before each step

Shows what would be executed without running commands

sudo workflow-manager run my-workflow --dry-run
Expected Output: Dry run: 5 steps would be executed

Note

Use for testing workflows before execution

4. Managing Individual Steps

Update, delete, and inspect individual workflow steps

View all steps with their IDs and details

workflow-manager show my-workflow
Expected Output: Step 1: echo Hello Step 2: ./backup.sh Step 3: ./cleanup.sh

Note

Use this to identify step IDs before updating or deleting

Remove step #2 from the workflow

workflow-manager delete-step my-workflow 2
Expected Output: Step 2 deleted from 'my-workflow'

Note

Step IDs are renumbered after deletion

Change step #1 command and timeout

workflow-manager update my-workflow 1 'echo Updated Command' --timeout 300
Expected Output: Step 1 updated successfully

Note

All step properties can be updated

5. Efficient Batch Building

Build complete workflows quickly by chaining multiple 'add' commands with &&

Create workflow and add 3 steps in one command chain

workflow-manager create tor-recovery && workflow-manager add tor-recovery './routing-switch recover internet' --timeout 60 && workflow-manager add tor-recovery './health-control net-check' -c if_success && workflow-manager add tor-recovery './tor-switch start' -c if_success --timeout 120
Expected Output: Template created, 3 steps added successfully

Note

Use && to chain commands efficiently

Add 4 diagnostic steps with conditional execution

workflow-manager add diagnostics './health-control net-check' --timeout 30 && workflow-manager add diagnostics './tor-switch status' -c if_success && workflow-manager add diagnostics './dns-leak test' -c if_success && workflow-manager add diagnostics './integrity-check verify' -c if_success
Expected Output: 4 steps added to diagnostics workflow

Build complete backup workflow with pause and cleanup

workflow-manager add backup 'tar czf backup.tar.gz /data' && workflow-manager pause backup --message 'Check backup size' -c if_success && workflow-manager add backup 'rsync backup.tar.gz remote:/backups' -c if_success && workflow-manager add backup 'rm backup.tar.gz' -c if_success
Expected Output: Backup workflow with 4 steps created

Note

Mix commands and pauses for interactive workflows

6. Conditional Logic

All available condition types with practical examples

Always execute (default behavior, runs regardless)

workflow-manager add my-workflow './check-status.sh' -c always
Expected Output: Step added with 'always' condition

Execute only if previous step succeeded (exit code 0)

workflow-manager add my-workflow './deploy.sh' -c if_success
Expected Output: Step added with if_success condition

Note

Most common condition for sequential workflows

Execute only if previous step failed (exit code ≠ 0)

workflow-manager add my-workflow './rollback.sh' -c if_fail
Expected Output: Step added with if_fail condition

Note

Useful for error recovery and rollback scenarios

Execute if previous output contains pattern "success"

workflow-manager add my-workflow './alert-success.sh' --if-contains "success"
Expected Output: Step added with pattern matching condition

Note

Case-sensitive - matches JSON like \"status\":\"success\"

Execute if previous output does NOT contain "errors"

workflow-manager add my-workflow './continue.sh' --if-not-contains "errors"
Expected Output: Step added with negative pattern condition

Note

Case-sensitive - checks for absence of \"errors\" in JSON output

Execute if previous output exactly equals "ready"

workflow-manager add my-workflow './handle-done.sh' --if-equals "ready"
Expected Output: Step added with exact match condition

Note

Exact match (case-sensitive) - output is trimmed before comparison

Execute if previous output matches regex pattern

workflow-manager add my-workflow './process-result.sh' --if-regex '^status: (ok|success)$'
Expected Output: Step added with regex condition

Note

Supports full regex syntax for complex matching

Execute if output does NOT match regex (counting: skip if 4+ HARDENED found)

workflow-manager add my-workflow './skip-if-hardened.sh' --if-not-regex 'HARDENED.*HARDENED.*HARDENED.*HARDENED'
Expected Output: Step added with if_not_regex condition

Note

Inverse regex match - useful for counting occurrences. Pattern matches 4+ 'HARDENED' words.

Execute if fewer than 5 services are active (counting with regex quantifiers)

workflow-manager add my-workflow './alert-few-services.sh' --if-not-regex '(service.*active.*){5,}'
Expected Output: Step added with if_not_regex condition

Note

Uses regex quantifiers {5,} to count occurrences. Step runs if pattern does NOT match (< 5 services).

Execute if JSON field $.status equals 'connected'

workflow-manager add my-workflow './handle-connected.sh' --if-json-path '$.status="connected"'
Expected Output: Step added with JSON path condition

Note

Previous output must be valid JSON

Execute if JSON array element matches value

workflow-manager add my-workflow './finland-detected.sh' --if-json-path '$.data.records[0].country_name="Finland"'
Expected Output: Step added with JSON path array condition

Note

Supports array indexing [0], [1], etc. for nested JSON arrays

Execute if nested JSON path with array matches

workflow-manager add my-workflow './proxy-active.sh' --if-json-path '$.data.records[0].connection_status.connection_type="Proxy"'
Expected Output: Step added with complex nested JSON path condition

Note

Can navigate through objects and arrays: $.path.to.array[index].field

Execute if JSON boolean field is true

workflow-manager add my-workflow './ip-online.sh' --if-json-path '$.ip_connectivity=true'
Expected Output: Step added with JSON boolean condition

Note

Supports true/false without quotes

Execute if JSON number field matches

workflow-manager add my-workflow './status-check.sh' --if-json-path '$.status_code=2'
Expected Output: Step added with JSON number condition

Note

Numbers don't need quotes: =2 not ="2"

7. Advanced Features

Pause steps and advanced workflow management

Adds an interactive pause point in the workflow

workflow-manager pause my-workflow --message 'Review results before continuing'
Expected Output: Pause step added to workflow

Note

User must press Enter to continue workflow execution

Conditional pause only if previous step succeeded

workflow-manager pause backup --message 'Verify backup integrity' -c if_success
Expected Output: Conditional pause step added

Note

Combine pauses with conditions for smart workflows

8. Real-World Kodachi Workflows

Practical workflows using actual Kodachi commands

Check IP geolocation and verify country

workflow-manager create ip-verify && workflow-manager add ip-verify 'sudo ip-fetch --json' --timeout 60 && workflow-manager add ip-verify 'echo Finland detected' --if-json-path '$.data.records[0].country_name="Finland"' && workflow-manager run ip-verify
Expected Output: Finland detected

Note

Uses JSON path with array indexing to check nested geolocation data

Verify authentication and session status

workflow-manager create auth-check && workflow-manager add auth-check 'sudo online-auth check-login --json' --timeout 30 && workflow-manager add auth-check 'echo Session valid' --if-contains 'valid' && workflow-manager run auth-check
Expected Output: Session valid

Note

Pattern matching on authentication response to confirm valid login

Complete system health and network connectivity check

workflow-manager create health-audit && workflow-manager add health-audit 'sudo health-control net-check --json' --timeout 60 && workflow-manager add health-audit 'echo Network online' --if-json-path '$.ip_connectivity=true' && workflow-manager add health-audit 'sudo routing-switch status --json' -c if_success --timeout 30 && workflow-manager run health-audit
Expected Output: Network online

Note

Combines network check with JSON boolean evaluation and cascading conditions

Verify Tor service health and responsiveness

workflow-manager create tor-verify && workflow-manager add tor-verify 'sudo tor-switch get-tor-status --json' --timeout 30 && workflow-manager add tor-verify 'echo Tor responding' --if-json-path '$.data.is_responding=true' && workflow-manager run tor-verify
Expected Output: Tor responding

Note

Checks Tor daemon status using JSON path boolean evaluation

9. Prerequisites

Define system state requirements that must be met before workflow execution

Prerequisites block in profile JSON - validates state before execution

# Example profile with prerequisites (edit JSON manually):
{
  "prerequisites": {
    "required": [
      {"check": "state.online", "expect": true, "error": "Internet connection required"},
      {"check": "state.torrify", "expect": false, "error": "System must not be torrified"},
      {"check": "state.tor_running", "expect": true, "error": "Tor must be running"}
    ],
    "on_failure": "abort"
  }
}
Expected Output: ✅ Prerequisites validated or ❌ Prerequisites not met - aborting

Note

If prerequisites is null or not present, no prerequisite checks are performed

Validate prerequisites without running the workflow

workflow-manager prereq check initial_terminal_setup_wireguard_torrify
Expected Output: ✅ All prerequisites met or ❌ Prerequisite failures listed

Note

Use this to test prerequisites before execution

10. System State Checking

Query current system state for debugging and validation

Show all system states as JSON

workflow-manager state
Expected Output: {"online": true, "torrify": false, "dnscrypt": true, "routing_mode": "wireguard", "tor_running": true}

Check specific state (online connectivity)

workflow-manager state online
Expected Output: {"state": "online", "value": true}

Note

20 states available: online, routing_mode, vpn_connected, dnscrypt, ipv6_disabled, dns_kodachi_managed, firewall_active, kill_switch_armed, network_hardened, disk_encrypted, security_score, torrify, tor_running, tor_dns_active, tor_verified, mac_spoofing, bluetooth_enabled, wifi_enabled, authenticated, tor_instances_count

11. Probe Functions

Define reusable probe functions in profiles for complex conditions

Define probes at profile level and use in step conditions

# Example profile with probes (edit JSON manually):
{
  "probes": {
    "harden_count": {
      "probe_type": "count",
      "expression": "count('harden', previous_output)",
      "description": "Count 'harden' occurrences"
    },
    "is_hardened": {
      "probe_type": "expression",
      "expression": "probe('harden_count') >= 4"
    }
  },
  "steps": [
    {
      "id": 2,
      "cmd": "echo 'Already hardened, skipping'",
      "condition": {
        "type": "if_probe",
        "probe": "is_hardened",
        "expect": true
      }
    }
  ]
}
Expected Output: Step executes based on probe evaluation

Note

Probe types: builtin, expression, count

Environment Variables

Variable Description Default Values
RUST_LOG Set logging level info error
NO_COLOR Disable all colored output when set unset 1

Exit Codes

Code Description
0 Success
1 General error
2 Invalid arguments
3 Permission denied
4 Network error
5 File not found