0.64.5 • Published 11 months ago

mxflow v0.64.5

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

mxflow is a CLI task runner which configured via a YAML config file.

It searches for a .mxflow/config.yml in the current directory and parent directories recursively up which it then parses for commands and arguments

Why?

  • Internal processes can get complicated or too repetitive.

  • It's hard to streamline complex workflows across teams.

  • Existing task-runners are too focused on a specific use-case/environment or have complicated config files or are not friendly!


Major Features

  • Interactive first - works with/without arguments; prompt missing arguments
  • Extensive config - group commands under a workflow, use argument variables in commands
  • Shell completion - dynamic shell completion based on the closest config file
  • Confirmation - add confirm prefix to any step command to add confirmation prompt
  • Project / System config - searches for a .mxflow/config.yml in the current directory and parent directories recursively up, so you can have different configs based on the current directory

Requirements

  • Node 16+

Installation

Install the package, globally:

sudo npm i -g mxflow

Setup shell tab completion:

mxflow --setup-completion

make sure to run this command once, in case you have ran this command more than once, you can run the mxflow --clean-completion to clean.

Usage

mxflow [<action>] [<args>] [<flags>]

CLI Options

init | init sample configuration
trigger <workflow-name> | non-interactive workflow trigger
version, --version | show version
help, --help | help menu
-v, --verbose | verbose logs
-F, --force | bypass confirmation prompts
--setup-completion | setup shell tab completion
--clean-completion | cleanup tab completion

Examples

For a fully interactive experience;

mxflow # or mxf

To bypass confirmation prompts;

mxflow --force

To interactively select a workflow to trigger;

mxflow trigger

To trigger a particular workflow interactively;

mxflow trigger create-flight

To trigger a particular workflow with arguments;

mxflow trigger create-flight --taskId my-tsk --description my-desc --force

Config

.mxflow/config.yml

mxflow trigger foobar --foo fval --bar bar-xorg

# The CLI Version
version: 0.60.0
# The milliseconds to wait between commands
sleep: 1000
# Should exit upon first error code faced
exit_on_error: false
# Config Workflows
workflows:
  # Workflow name
  foobar:
    # Workflow description
    description: example placeholder
    # Checks to run before workflow. Possible checks are: [git-clean]
    checks:
      - git-clean
    # Variables to collect to be available later on steps
    args:
      # Variable name
      - name: foo
        # Variable type. Possible types are: [string, number]
        type: string
      - name: bar
        type: string
        # Regex to test argument input
        regex: ^bar+\w
        # The default value for the variable
        default: barxorg
        # Set a different name for the variable
        export: barx
    # Steps are list of commands to execute
    steps:
      # Variable name or its export are available with braces
      - echo {foo} world
        # Variable export
      - echo goodbye {foo} {barx} cruel world
        # the `current-branch` is a special variable; always available
      - echo git branch is {current-branch}
        # Appending `confirm` will add a confirmation step before the following command
      - confirm shutdown -h now
        # Its possible to use system environment variable; resolved at runtime
      - echo AWS_PROFILE $AWS_PROFILE
        # Or use braces syntax; it will resolve before execution
      - echo AWS_PROFILE {AWS_PROFILE}

version - config version

exit_on_error - (optional) should exit on any command with a non-zero exit code, default is false

sleep - (optional) adds a delay between each command, default is 1000

workflows - object with workflows

description - workflow description

checks - checks to run before workflow. Possible checks are: [git-clean]

args - list of arguments

args[*].name - what user inputs as argument

args[*].type - validation type; string | number

args[*].export - (optional) the exported variable, default is args[*].name

args[*].default - (optional) the default value, if any

args[*].regex - (optional) validation pattern

steps - list of commands to run

steps[*] - the command to run, any shell command string, with some specials commands

note: you can write a cd pre-step to change cwd of the following command

note: you can add a confirm prefix to add confirmation prompt

note: at the moment there are some git commands: checkout-branch, list-logs, log-bugtracker. Check wiki for usage example

Example: echo foo {variable} bar

  • Argument variables
    • args - export or name
  • Environment variables
    • environment - system environment variables
    • .env - variables defined in the .env file
  • git variables
    • {current-branch} - current active branch
  • workflow
    • {workflow} - current active workflow

Roadmap

  • project based config file
  • plugin system for dynamic lists
  • argument mode
  • argument autocomplete
  • support .env file import

Installation

gifcast_221027184725.gif

Interactive Usage

gifcast_221104221552.gif

Argument Usage

gifcast_221104221727.gif


License

MIT

0.64.3

11 months ago

0.64.2

11 months ago

0.64.5

11 months ago

0.64.4

11 months ago

0.64.1

11 months ago

0.64.0

11 months ago

0.50.1-0

2 years ago

0.62.1

2 years ago

0.62.0

2 years ago

0.62.3

2 years ago

0.62.2

2 years ago

0.62.12

2 years ago

0.62.11

2 years ago

0.62.14

2 years ago

0.62.13

2 years ago

0.62.10

2 years ago

0.62.19-13

2 years ago

0.62.19

2 years ago

0.62.19-12

2 years ago

0.62.19-11

2 years ago

0.62.19-10

2 years ago

0.62.16

2 years ago

0.62.15

2 years ago

0.62.18

2 years ago

0.62.19-14

2 years ago

0.62.17

2 years ago

0.51.0

2 years ago

0.51.1

2 years ago

0.63.8

2 years ago

0.62.23

2 years ago

0.62.19-3

2 years ago

0.63.7

2 years ago

0.62.22

2 years ago

0.62.19-4

2 years ago

0.62.19-1

2 years ago

0.63.9

1 year ago

0.62.19-2

2 years ago

0.63.4

2 years ago

0.62.19-7

2 years ago

0.63.3

2 years ago

0.62.19-8

2 years ago

0.63.6

2 years ago

0.62.21

2 years ago

0.62.19-5

2 years ago

0.63.9-0

1 year ago

0.63.5

2 years ago

0.62.20

2 years ago

0.62.19-6

2 years ago

0.62.19-9

2 years ago

0.63.1-0

2 years ago

0.63.0

2 years ago

0.63.2

2 years ago

0.62.13-0

2 years ago

0.63.1

2 years ago

0.61.2-1

2 years ago

0.61.2-0

2 years ago

0.50.1-5

2 years ago

0.50.1-3

2 years ago

0.50.1-4

2 years ago

0.50.1-1

2 years ago

0.50.1-2

2 years ago

0.62.9-4

2 years ago

0.62.9-5

2 years ago

0.62.9-0

2 years ago

0.62.9-1

2 years ago

0.62.9-2

2 years ago

0.62.9-3

2 years ago

0.62.5-0

2 years ago

0.62.5-1

2 years ago

0.62.5-2

2 years ago

0.62.5-3

2 years ago

0.63.10-0

1 year ago

0.50.4-1

2 years ago

0.50.4-0

2 years ago

0.61.1

2 years ago

0.62.19-0

2 years ago

0.61.0

2 years ago

0.50.3

2 years ago

0.50.1

2 years ago

0.50.2

2 years ago

0.50.0

2 years ago

0.62.9

2 years ago

0.62.8

2 years ago

0.62.5

2 years ago

0.62.4

2 years ago

0.63.11

1 year ago

0.63.8-0

2 years ago

0.62.7

2 years ago

0.63.10

1 year ago

0.62.6

2 years ago

0.63.4-2

2 years ago

0.63.4-3

2 years ago

0.63.4-0

2 years ago

0.63.4-1

2 years ago

0.48.0

2 years ago

0.47.32-1

2 years ago

0.47.32-0

2 years ago

0.47.31

2 years ago

0.47.31-7

2 years ago

0.47.31-6

2 years ago

0.47.31-5

2 years ago

0.47.31-4

2 years ago

0.47.31-3

2 years ago

0.47.31-2

2 years ago

0.47.31-1

2 years ago

0.47.31-0

2 years ago

0.47.30

2 years ago

0.47.29

2 years ago

0.47.28

2 years ago

0.47.27

2 years ago

0.47.26

2 years ago

0.47.26-8

2 years ago

0.47.26-7

2 years ago

0.47.26-6

2 years ago

0.47.26-5

2 years ago

0.47.26-4

2 years ago

0.47.26-3

2 years ago

0.47.26-2

2 years ago

0.47.26-1

2 years ago

0.47.26-0

2 years ago

0.47.25

2 years ago

0.47.24

2 years ago

0.47.23

2 years ago

0.47.22

2 years ago

0.47.22-2

2 years ago

0.47.22-1

2 years ago

0.47.22-0

2 years ago

0.47.21

2 years ago

0.47.21-7

2 years ago

0.47.21-6

2 years ago

0.47.21-5

2 years ago

0.47.21-4

2 years ago

0.47.21-3

2 years ago

0.47.21-2

2 years ago

0.47.21-1

2 years ago

0.47.21-0

2 years ago

0.47.20

2 years ago

0.47.19

2 years ago

0.47.17

2 years ago