JSPM

  • Created
  • Published
  • Downloads 2
  • Score
    100M100P100Q60419F
  • License MIT

A Friendly, General purpose CLI task runner defined by a simple YAML file

Package Exports

  • mxflow
  • mxflow/bin/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (mxflow) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

mxflow
Why | Installation | Usage | Options | Config | Videos

⚡ A Friendly, General purpose CLI task runner 🚀

mxflow is a CLI task runner which is 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 just not friendly!


Major Features

  • Interactive first - works with/without arguments; prompt missing args
  • Extensive config - group commands under a workflow, use arguments export value 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

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 multiple times, you can run the mxflow --clean-completion to clean and run setup again once.

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
--no-catch-git          | bypass initial git checks
--setup-completion      | setup shell tab completion
--clean-completion      | cleanup tab completion

Examples

for a fully interactive experience;

mxflow # or mxf

to bypass git checks;

mxflow --no-catch-git

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

version: 0.60.0
workflows:
  foobar:
    description: example placeholder
    args:
      - name: foo
        type: string
      - name: bar
        type: string
        regex: ^bar+\w
        default: barxorg
        export: barx
    steps:
      - echo {foo} world
      - echo goodbye {foo} {barx} cruel world
      - confirm echo {barx} goodbye
      - echo AWS_PROFILE $AWS_PROFILE
      - echo AWS_PROFILE {AWS_PROFILE}

Config Reference

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

Workflow Reference

description - workflow description

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, few 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: currently there are few special git commands: checkout-branch, list-logs, log-bugtracker. check wiki for usage example

Config Variables

example: echo foo {variable} bar

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

Real-world Use-cases


Roadmap

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

Videos

Installation

gifcast_221027184725.gif

Interactive Usage

gifcast_221104221552.gif

Argument Usage

gifcast_221104221727.gif


⚠️ MXflow is in an early state of release. Breaking changes may be made to APIs/core structures as the tool matures.

License

MIT