CNB CLI
About 312 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.
- 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 pipeline injects CNB_TOKEN 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.
Command Examples
cnb issues list-issues --repo my-org/my-repo
cnb issues create-issue --repo my-org/my-repo --title "Bug" --body "Steps to reproduce..."
cnb pulls merge-pull --repo my-org/my-repo --number 42 --merge-style squash
cnb build start-build --repo my-org/my-repo --branch mainWhen CI is triggered by Issue or PR events, CNB injects CNB_REPO_SLUG, CNB_ISSUE_IID, CNB_PULL_REQUEST_IID and other environment variables. CLI shortcut commands read them automatically as --repo / --number, so you don't need to pass these flags:
cnb issues get
cnb issues comment --body "..."
cnb pulls get
cnb pulls check-statusLearn More
For the full module list, parameter reference and advanced usage such as the Git Credential Helper, see the CNB CLI plugin documentation.