A cli task runner

1.1.1 2023-12-12 13:36 UTC

This package is not auto-updated.

Last update: 2024-06-11 16:35:38 UTC




jim is a highly extensible task runner.



jim comes in two parts: the cli-command and the jim-core package.


The jim command is just a wrapper that makes the jim command globally available. When you run a jim command, it will look for a jim-runtime inside the current working directory and delegate the command to it.

jim-core (this package)

The jim-runtime can be installed via Composer or npm. Once you installed the package inside your project, you will be able to execute jim commands.

jim-core and jim-scripts

The jim-core packages comes with a pretty small set of pre-installed commands. The true power of jim lies in the concept of jim-scripts.

You can write your own commands as node- or shell-scripts and make them available to jim.



You can install the jim-command by executing the script inside the repository. You only need to do this once.


Depending on your project, you can install jim-core with the following commands:

Note It is recommended to install jim-core as a dev-dependency

Node / npm

npm install -D @pnodev/jim-core

PHP / Composer

composer require --dev pnodev/jim-core

Configuration / Usage

You can provide project-specific configuration with a .jimrc file:

NODE_VERSIONif you set the node-version, jim will make sure to set the correct version via nvm before executing node commands. This is especially useful if you are switching a lot between projects that require different node versions.
DIR_JIM_SCRIPTSMakes node- or shell-scripts at the specified location available as jim-commands.

You can add more project-specific variables here. All variables defined in .jimrc will be exposed to the commands, so you can use them in your scripts. You could e.g. add variables to define the path to your JavaScript files and use it inside a esbuild-task.

Writing custom commands

Custom commands can be written as shell scripts. The jim-runtime provides you with the following helpers for writing your scripts in a consistent manner:

Environment Variables

The following environment variables will be made available for your commands:

DIR_JIM_SCRIPTSThe path to your jim-scripts folder
DIR_COREThe path to your jim-core package

Note Additionally, all variables you defined in .jimrc will be available as well.

Utility functions

By importing the following script, you get access to a bunch of utility functions:

source "${DIR_CORE}/"


To generate more pleasing terminal output, you can use the following variables to format your logs:

COLOR_RESETResets all formatting
COLOR_YELLOWSets the color to yellow
COLOR_BLUESets the color to blue
COLOR_GREENSets the color to green
COLOR_REDSets the color to red
COLOR_CYANSets the color to cyan
COLOR_DIMMEDDimms the output color
COLOR_BOLDFormats the output bold


The _log function provides a coherent output behaviour. It is recommended to use it for all logs. It accepts the output string as the first parameter and an optional second parameter to set the output color.

_log "This is a yellow string" "${COLOR_YELLOW}"


The _ask functions displays a prompt to which the user can answer with yes or no. A good usecase for this function is asking the user for confirmation before executing a potentially dangerous command:

source "${DIR_CORE}/"

if _ask "This will overwrite the data on the deploy server, do you want to continue?"
  _log "… Stating update" "$COLOR_YELLOW"
  ddev updateDeploy
  _log "✓ update finished" "$COLOR_YELLOW"
  echo ""


The _box function will display a given string inside a box:

_box "I'm in a box"
│ I'm in a box │


The _invoke command can be used to start another jim-task as a subtask. E.g. if you have a build-task that should start both the build:css- and build:js-tasks, you could do the following:

source "${DIR_CORE}/"


_invoke build:css
_invoke build:js


Pre-formatted log for announcing that your task started.

_announceTaskStart "Building CSS"
[jim] 🚧 Building CSS


Pre-formatted log for announcing that your task finished.

_announceTaskEnd "CSS built in ${PATH_CSS_OUT}"
[jim] 💪 CSS built in Resources/Public/Css/main.min.css


Sets the node version to the one specified in .jimrc. This is useful if you need to call a node-script from inside a shell-script command.

source "${DIR_CORE}/"

npm install

Removing jim-cli

If you want to remove the jim command from your system, simply execute the script inside this repository.