A CLI for common Pushbot API functions
Last updated 2 years ago by nrod80 .
ISC · Original npm · Tarball · package.json
$ cnpm install @nrod80/pb-cli 
SYNC missed versions from official npm registry.

Welcome to PB CLI

This simple tool is designed to interact with the Pushbot Catalytic API to more easily perform common actions, including bulk process deletion and run abortion, process duplication within a team, and process copying across teams/environments.

Getting Started


npm i -g @nrod80/pb-cli

Setup and Basic Usage

The tool can be access with the pb command:

$ pb (type) (action) [...args]

There are four main types, each of which has their own actions:

  • Profile
  • Process
  • Run
  • User

If you ever need help, feel free to use the help command:

$ pb help
$ pb (type) help


The first time you use the pb command, you will be prompted to create a new profile. A profile corresponds to a specific user (userKey) on a specific team (teamName) in a particular environment (stage) and will be saved under a given name.

You can add a additional profiles at any time:

NOTE: Your password is not saved anywhere

$ pb profile create --name nick-dev-local --teamName nick-dev --stage test --userKey d979a16ede3dd48581c771ec0538c54f5a121d955a70f7dbbc88ab8766df39c9

$ pb profile login --name nick-dev-local --teamName nick-dev --stage test --username nick --password p@$$w0rd

You can view a specific profile:

$ pb profile get --name nick-dev-local

or view all profiles:

$ pb profile get

The first profile you create will automatically become your default profile. In all subsequent commands, unless a different profile is specified, your default profile will be used for all API calls. You can specify a different profile simply by adding its name to the command. For instance, this command will list all processes in the team/environment associated with the nick-dev-local profile.

$ pb process get nick-dev-local

To update your default profile, simply run:

$ pb profile put --default --name nick-dev-local

To delete a profile, simply run:

$ pb profile delete —-name nick-dev-local

To update a profile, simply run:

$ pb profile put —-name nick-dev-local --userKey d979a16ede3dd48581c771ec0538c54f5a121d955a70f7dbbc88ab8766df39c9


You can interact with processes in a number of different ways through the CLI.

You can get processes (either a single process or multiple):

NOTE: UUIDs will automatically be recognized as IDs, so an —-id flag isn't necessary

$ pb process get 43f19950-fc05-44d1-9462-a613fcfc9e37

$ pb process get --all

You can similarly delete processes:

NOTE: See the Filtering section under "Advanced" usage to see how to make this more useful

$ pb process delete 43f19950-fc05-44d1-9462-a613fcfc9e37

$ pb process delete --all

--all delete/abort actions are limited to 3 concurrent requests to prevent overloading the API. Additionally, bulk delete/abort actions are disabled on v1 unless you pass a —FORCE flag, mostly so I (Nick) didn't accidentally do anything stupid.

You can copy processes between environments:

$ pb process copy 43f19950-fc05-44d1-9462-a613fcfc9e37 --from {{source-profile}} --to {{destination-profile}}

If the from or to parameters are not set, the default profile will be used in their place. If the from and to profiles are the same, then the process will be duplicated within that environment.


Basically the same as processes, except you can't copy them :(


You can get a user by their username:

$ pb user get --username nick

You can invite a user (I don't remember why I did this…):

$ pb user invite --email test@example.com [--admin]

"Advanced" usage

Aliased commands

In retrospect, this was probably not the best idea, but I thought creating aliases for the various types/actions would make the tool easier to use. For instance, the following eight commands will all do the same thing:

$ pb process get
$ pb processes get
$ pb process list
$ pb processes list
$ pb template|templates get|list

See src/constants.ts for a complete list.

Filtering and Querying

Filtering: With any --all command, you can optionally provide a --filter argument that will filter the results of the request client-side. For instance, I can delete all processes where I am the owner or abort all runs of a given process started by me:

$ pb process delete --all --filter owner=nick

$ pb run abort --all --filter processName=my-process,owner=nick

Querying: With any command, you can optionally provide a --query argument that will be passed as part of the request:

$ pb run get --all --query owner=nick&processID={uuid}

You can ensure the filter/query is correct before bulk deleting by first running a get command with a —-filter/--query and browsing the results.

Bulk actions

With process delete and process copy requests, you can pass a --bulk argument that specifies a comma delimited list of processIDs:

$ pb process delete --bulk {uuid},{uuid2},{uuid3}

$ pb process copy --from local-team --to qa-staging  --bulk {uuid},{uuid2},{uuid3}


Please feel free to create an issue or open a PR or just talk to me about any feature/bug/improvements. If you do open a PR, feel free to refactor any of work that is sloppy or inefficient. Tests are always appreciated for new features, but don't feel obligated to write them.

Potential Future Enhancements:

  • Allow sudo login
  • Copy step by stepName from one process to another

Current Tags

  • 1.1.0                                ...           latest (2 years ago)

8 Versions

  • 1.1.0                                ...           2 years ago
  • 1.0.0                                ...           3 years ago
  • 0.0.6                                ...           3 years ago
  • 0.0.5                                ...           3 years ago
  • 0.0.4                                ...           3 years ago
  • 0.0.3                                ...           3 years ago
  • 0.0.2                                ...           3 years ago
  • 0.0.1                                ...           3 years ago
Maintainers (1)
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 2
Last Month 6
Dependencies (9)
Dev Dependencies (10)
Dependents (0)

Copyright 2014 - 2016 © taobao.org |