CNB CLI
About 311 wordsAbout 1 min
Overview
CNB CLI is the command-line tool for the CNB platform OpenAPI. A single cnb command lets you access the platform's full OpenAPI surface, covering source control, builds, registries, organizations and members, knowledge base and more.
When to use: when you want to operate CNB from the command line or a script — for example creating issues in bulk in a pipeline, checking build status, or manipulating artifacts, or letting an NPC call platform capabilities through it instead of crafting OpenAPI requests.
- npm package:
@cnbcool/cnb-cli - Docker image:
cnbcool/cnb-cli
Installation & Usage
Local install (requires Node.js LTS)
npm install -g @cnbcool/cnb-cli
cnb --helpRun with Docker (no install required)
docker run --rm -v $(pwd):$(pwd) -w $(pwd) cnbcool/cnb-cli cnb users get-user-infoUse inside a .cnb.yml pipeline
The example below runs on a push event to the main branch. CNB_TOKEN is injected automatically — no login needed:
main:
push:
- docker:
image: cnbcool/cnb-cli
stages:
- name: get-user-info
script: cnb users get-user-infoAuthentication
For local terminals, OAuth2 device authorization is recommended:
cnb login
cnb status
cnb logoutYou can also provide a token via the CNB_TOKEN environment variable, which is auto-injected in CI scenarios.
Exploring Available Commands
Platform capabilities are organized into modules. Use -s / --short to list the shortcut commands available in the current repository / event, or list all modules with cnb --help and drill down with cnb <module> --help and cnb <module> <tool> --help.
Learn More
For the full module list, parameter reference and advanced usage such as the Git Credential Helper, see the CNB CLI plugin documentation.