logo
54
33
WeChat Login

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.

Project Wiki

Click here

Fully auto-generated by CNB CodeWiki, with accuracy up to 99.7%

Installation

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

Usage

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

Using in Cloud Native Build

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

Supported Features

$ 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

CNB Plugins

git-cnb also provides some CNB plugins, and you can use the plugins to quickly complete some complex tasks.

Install in Custom Image

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

About

一个 cnb 专属的 Git 命令行扩展工具

cnbgittools
11.92 MiB
379.29 KiB
NPC
Skills
54 forks33 stars12 branches22 TagREADMEMIT license

Release
14

1.2.3latest
Language
Go94.8%
Shell4.1%
Dockerfile0.8%
Makefile0.3%