npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

cli-invoke

v1.2.4

Published

cli-invoke will ask questions defined in a configuration file and invoke a web hook based on your answers

Downloads

6

Readme

cli-invoke

Interactive command line tool (written in Node.js) that will ask questions defined in a configuration file and invoke a web hook based on the user's answers.

In your cli-invoke-config.json file you specify the questions you want to get prompted when you run cli-invoke. You also specify the URL to invoke and the template for the JSON body to post.

Installation

$ npm install -g cli-invoke

Usage

Make sure you have your cli-invoke-config.json file in the current directory or use the --config flag to specify an alternative location or file name.

The format of your cli-invoke-config.json file should be similar to this example

{
    "questions": [{
            "name": "BUILD_CONFIGURATION",
            "type": "list",
            "choices": [
                "MyBuildConfig1",
                "MyBuildConfig1",
                "MyBuildConfig1",
            ]
        },
        {
            "name": "BUILD_TARGET",
            "type": "list",
            "choices": [
                "Inhouse",
                "Kiosk",
                "AppStore"
            ]
        },
        {
            "name": "RELEASE_TYPE",
            "type": "list",
            "choices": [
                "New",
                "Update"
            ],
            "when": "(answers) => answers['BUILD_TARGET'] == 'Inhouse'"
        },
        {
            "name": "RELEASE_NOTE",
            "type": "editor"
        }
    ],
    "action": {
        "type": "http-request",
        "url": "https://app.bitrise.io/app/[redacted]/build/start.json",
        "method": "POST",
        "json_body": {
            "hook_info": {
                "type": "bitrise",
                "build_trigger_token": "[redacted]"
            },
            "build_params": {
                "branch": "development",
                "commit_message": "{RELEASE_NOTE}",
                "environments": [{
                        "mapped_to": "BUILD_CONFIGURATION",
                        "value": "{BUILD_CONFIGURATION}",
                        "is_expand": true
                    },
                    {
                        "mapped_to": "BUILD_TARGET",
                        "value": "{BUILD_TARGET}",
                        "is_expand": true
                    }
                ]
            },
            "triggered_by": "cli-invoke"
        }
    }
}

The questions should be defined in the format of the inquirer module. The possible question types are input, number, confirm, list, rawlist, expand, checkbox, password, editor. Note that not all values outlined in the format is directly supported. The values supported without any special work are those who are limited to a simple type only, such as strings, numbers or booleans. A few values support functions as well however there are some special cases such as default and choices where the spec is a little different from inquirer's that you can read about below. Do note that the different approach only applies when the value has multiple types including a function.

The action to perform after gathering your answers for all questions is defined in the action object. Currently the only supported action type is http-request. Placeholder values enclosed in curly braces such as {BUILD_CONFIGURATION} will be replaced by the answer to the question with that name.

Dynamic default values with defaultFunction

It can be useful to prefil default values for questions in a dynamic way. E.g. use the current git branch or the contents of a file. The inquirer format for defining questions support that a default value can be specified as a javascript function, but since the config file is in JSON format the function has to be passed as a string. This is possible by setting the defaultFunction property as a string containing a javascript function. A few examples:

{
    "name": "BRANCH",
    "type": "input",
    "defaultFunction": "() => branch.sync()"
},
{
    "name": "RELEASE_NOTE",
    "type": "editor",
    "defaultFunction": "() => fs.readFileSync('release_notes.txt')"
}

Dynamic choices with choicesFunction

Like defaultFunction it is also possible to provide choices as a result of a function. This is done by setting choicesFunction instead of choices and provide a function that returns an array of strings. Keep in mind however that the function is run when the config file is first parsed. This means the function is limited to computing the choices before the questions are asked.

{
    "name": "TESTERS",
    "type": "checkbox",
    "choicesFunction": "() => JSON.parse(fs.readFileSync('app.config')).testers"
}