git-cnb, a Git command-line extension tool specifically for cnb, allows you to quickly view cnb information in the terminal using git commands, such as repositories, users, issues, PRs, releases, etc.
Binary installation [Recommended]
curl https://cnb.cool/looc/git-cnb/-/git/raw/main/install.sh -sSfL | sh
Install using Golang
go install cnb.cool/looc/git-cnb@latest
Use it as a Git extension subcommand.
NOTE: Since it needs to call CNB's OpenAPI to get related information, you need to configure the CNB Token using environment variables. The token permissions depend on the features used, you can configure token permissions as needed.
$ export CNB_TOKEN="... your token ..."
If you need to operate multiple CNB instances with different domains, you can configure different CNB_TOKENs for each domain. The rule is CNB_TOKEN_{domain-without-dot} (environment variables don't support ., so we use the domain name without . as suffix to distinguish, e.g.
$ export CNB_TOKEN_cnbcool=".. your token ..." #cnb.cool $ export CNB_TOKEN_cnbdev=".. your token ..." #cnb.dev
The TOKEN requires at least the following permissions:
repo-notes:r
repo-pr:r
repo-code:rw
repo-basic-info:r
account-profile:r
$ git cnb -h
Available Commands:
commit Manage commits
help Help about any command
info Print information of this repo
issue Manage issue
pull Manage pull requests
release Manage releases
stars Print star trend info of this repo
stats Print stats information of this repo
version Print the version number of git-cnb
NOTE: CNB OpenAPI updates may have delays, please refer to actual situation
git cnb stats

git cnb stars

git cnb issue list

git cnb pull list

git cnb pull create
git cnb release asset-stats

git cnb release asset-clean --keep-days=1

git cnb commit asset-stats

git cnb commit asset-clean --keep-num=1
