Skills Configuration: https://cnb.cool/cnb/skills/cnb-skill.git
git-cnb, a Git command-line extension tool specifically for CNB, allows you to quickly view CNB information in the terminal using git command style, such as repositories, users, issues, PRs, releases, etc.
Fully auto-generated by CNB CodeWiki, with accuracy up to 99.7%
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:rw
repo-pr:rw
repo-code:rw
repo-basic-info:r
account-profile:r
group-manage:rw
You can also use git-cnb in Cloud Native Build, which uses the build environment variable CNB_TOKEN by default. If the default TOKEN permissions do not meet your needs, you can manually specify one, e.g., using CNB_TOKEN_cnbcool.
stages:
- name: build
jobs:
- name: use git-cnb
image: docker.cnb.cool/looc/git-cnb:latest
script: git-cnb -h
$ git-cnb -h
Available Commands:
build Manage repository builds
charge View privilege information
chat Interact with CNB OpenAPI using natural language
commit Manage commits
completion Generate the autocompletion script for the specified shell
download Download repository files
git-settings Manage repository settings
groups Manage organizations
help Help about any command
info Display repository details
issues Manage repository issues
knowledges Manage repository knowledge base
pull Manage pull requests
release Manage repository releases
repolabels Manage repository labels
stars Plot repository star trend chart
stats Display repository stats dashboard
version Print the version number of git-cnb
workspace Manage cloud native workspaces
Flags:
--domain string domain, eg: cnb.cool, default: cnb.cool
-h, --help help for git-cnb
--repo string repo name, eg: looc/git-cnb
For detailed usage, see here
If you use git-cnb in a git directory, it will automatically parse the current repository information and get the API domain and reponame.
You can also manually specify the domain and reponame, e.g.: git-cnb --domain=cnb.cool --repo=looc/git-cnb stars
git-cnb also provides some CNB plugins, and you can use the plugins to quickly complete some complex tasks.
FROM your-base-image
# Copy git-cnb binary from the current repository artifact image
COPY --from=docker.cnb.cool/looc/git-cnb:latest /app/git-cnb /usr/local/bin/git-cnb